Compare commits

...

5 Commits
swim ... v1.9.4

Author SHA1 Message Date
Leijurv
6eeeeb3a1b v1.9.4 2023-04-11 19:50:51 -07:00
leijurv
e3c6b312ef Merge pull request #3900 from wagyourtail/1.19.2
remove 1.19.3 method in blockOptionalMeta
2023-04-02 17:57:27 -07:00
Wagyourtail
acce20c573 remove 1.19.3 method in blockOptionalMeta 2023-04-02 17:01:57 -07:00
Leijurv
e4d725d9aa Revert "loottables broke & #click not working"
This reverts commit 3e082b21d5.
2023-04-02 15:24:50 -07:00
Leijurv
0cf89e0b2a Revert "fix items and #click"
This reverts commit 4168401aa1.
2023-04-02 15:20:26 -07:00
25 changed files with 81 additions and 166 deletions

View File

@@ -126,8 +126,7 @@ jar {
}
remapJar {
targetNamespace = "named"
fallbackTargetNamespace = "intermediary"
target = "mojmap"
}
javadoc {

View File

@@ -36,5 +36,5 @@ dependencies {
implementation group: 'com.google.code.gson', name: 'gson', version: '2.9.0'
implementation group: 'commons-io', name: 'commons-io', version: '2.6'
implementation group: 'xyz.wagyourtail.unimined', name: 'xyz.wagyourtail.unimined.gradle.plugin', version: '0.3.4'
implementation group: 'xyz.wagyourtail.unimined', name: 'xyz.wagyourtail.unimined.gradle.plugin', version: '0.4.9'
}

View File

@@ -81,7 +81,7 @@ public class ProguardTask extends BaritoneGradleTask {
MinecraftProvider<?, ?> provider = this.getProject().getExtensions().getByType(MinecraftProvider.class);
private File getMcJar() {
return provider.getMinecraftWithMapping(EnvType.COMBINED, provider.getMcPatcher().getProdNamespace(), provider.getMcPatcher().getProdFallbackNamespace()).toFile();
return provider.getMinecraftWithMapping(EnvType.COMBINED, provider.getMcPatcher().getProdNamespace(), provider.getMcPatcher().getProdNamespace()).toFile();
}
private boolean isMcJar(File f) {

View File

@@ -26,6 +26,6 @@
"depends": {
"fabricloader": ">=0.11.0",
"minecraft": "1.19.3"
"minecraft": "1.19.2"
}
}

View File

@@ -35,6 +35,6 @@ A Minecraft pathfinder bot.
modId="minecraft"
mandatory=true
# This version range declares a minimum of the current minecraft version up to but not including the next major version
versionRange="[1.19.3]"
versionRange="[1.19.2]"
ordering="NONE"
side="BOTH"

View File

@@ -1,9 +1,9 @@
org.gradle.jvmargs=-Xmx4G
mod_version=1.9.1
mod_version=1.9.4
maven_group=baritone
archives_base_name=baritone
minecraft_version=1.19.3
forge_version=1.19.3-44.0.1
fabric_version=0.14.11
minecraft_version=1.19.2
forge_version=1.19.2-43.1.65
fabric_version=0.14.9

View File

@@ -44,7 +44,6 @@ rootProject.name = 'baritone'
include("tweaker")
if (System.getProperty("Baritone.enabled_platforms") == null) {
System.setProperty("Baritone.enabled_platforms", "fabric,forge")
// System.setProperty("Baritone.enabled_platforms", "fabric")
}
for (platform in System.getProperty("Baritone.enabled_platforms").split(",")) {
include(platform)

View File

@@ -19,12 +19,11 @@ package baritone.api.command.datatypes;
import baritone.api.command.exception.CommandException;
import baritone.api.command.helpers.TabCompleteHelper;
import net.minecraft.core.registries.BuiltInRegistries;
import java.util.stream.Stream;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
import java.util.stream.Stream;
public enum BlockById implements IDatatypeFor<Block> {
INSTANCE;
@@ -32,7 +31,7 @@ public enum BlockById implements IDatatypeFor<Block> {
public Block get(IDatatypeContext ctx) throws CommandException {
ResourceLocation id = new ResourceLocation(ctx.getConsumer().getString());
Block block;
if ((block = BuiltInRegistries.BLOCK.getOptional(id).orElse(null)) == null) {
if ((block = Registry.BLOCK.getOptional(id).orElse(null)) == null) {
throw new IllegalArgumentException("no block found by that id");
}
return block;
@@ -42,7 +41,7 @@ public enum BlockById implements IDatatypeFor<Block> {
public Stream<String> tabComplete(IDatatypeContext ctx) throws CommandException {
return new TabCompleteHelper()
.append(
BuiltInRegistries.BLOCK.keySet()
Registry.BLOCK.keySet()
.stream()
.map(Object::toString)
)

View File

@@ -19,12 +19,11 @@ package baritone.api.command.datatypes;
import baritone.api.command.exception.CommandException;
import baritone.api.command.helpers.TabCompleteHelper;
import net.minecraft.core.registries.BuiltInRegistries;
import java.util.stream.Stream;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.EntityType;
import java.util.stream.Stream;
public enum EntityClassById implements IDatatypeFor<EntityType> {
INSTANCE;
@@ -32,7 +31,7 @@ public enum EntityClassById implements IDatatypeFor<EntityType> {
public EntityType get(IDatatypeContext ctx) throws CommandException {
ResourceLocation id = new ResourceLocation(ctx.getConsumer().getString());
EntityType entity;
if ((entity = BuiltInRegistries.ENTITY_TYPE.getOptional(id).orElse(null)) == null) {
if ((entity = Registry.ENTITY_TYPE.getOptional(id).orElse(null)) == null) {
throw new IllegalArgumentException("no entity found by that id");
}
return entity;
@@ -41,7 +40,7 @@ public enum EntityClassById implements IDatatypeFor<EntityType> {
@Override
public Stream<String> tabComplete(IDatatypeContext ctx) throws CommandException {
return new TabCompleteHelper()
.append(BuiltInRegistries.ENTITY_TYPE.stream().map(Object::toString))
.append(Registry.ENTITY_TYPE.stream().map(Object::toString))
.filterPrefixNamespaced(ctx.getConsumer().getString())
.sortAlphabetically()
.stream();

View File

@@ -18,7 +18,7 @@
package baritone.api.event.events;
import com.mojang.blaze3d.vertex.PoseStack;
import org.joml.Matrix4f;
import com.mojang.math.Matrix4f;
/**
* @author Brady

View File

@@ -20,29 +20,20 @@ package baritone.api.utils;
import baritone.api.utils.accessor.IItemStack;
import com.google.common.collect.ImmutableSet;
import io.netty.util.concurrent.ThreadPerTaskExecutor;
import net.minecraft.client.Minecraft;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.MinecraftServer;
import net.minecraft.resources.*;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.progress.ChunkProgressListener;
import net.minecraft.server.packs.*;
import net.minecraft.server.packs.PackResources;
import net.minecraft.server.packs.PackType;
import net.minecraft.server.packs.repository.PackRepository;
import net.minecraft.server.packs.repository.ServerPacksSource;
import net.minecraft.server.packs.resources.MultiPackResourceManager;
import net.minecraft.server.packs.resources.ReloadableResourceManager;
import net.minecraft.util.RandomSource;
import net.minecraft.util.Unit;
import net.minecraft.world.flag.FeatureFlagSet;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.CustomSpawner;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.dimension.LevelStem;
import net.minecraft.world.level.storage.LevelStorageSource;
import net.minecraft.world.level.storage.ServerLevelData;
import net.minecraft.world.level.storage.loot.BuiltInLootTables;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootTables;
@@ -50,14 +41,9 @@ import net.minecraft.world.level.storage.loot.PredicateManager;
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.Vec3;
import sun.misc.Unsafe;
import javax.annotation.Nonnull;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import java.util.regex.MatchResult;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -69,7 +55,7 @@ public final class BlockOptionalMeta {
private final ImmutableSet<Integer> stateHashes;
private final ImmutableSet<Integer> stackHashes;
private static final Pattern pattern = Pattern.compile("^(.+?)(?::(\\d+))?$");
private static LootTables lootTables;
private static LootTables manager;
private static PredicateManager predicate = new PredicateManager();
private static Map<Block, List<Item>> drops = new HashMap<>();
@@ -155,37 +141,21 @@ public final class BlockOptionalMeta {
return null;
}
private static Method getVanillaServerPack;
private static VanillaPackResources getVanillaServerPack() {
if (getVanillaServerPack == null) {
getVanillaServerPack = Arrays.stream(ServerPacksSource.class.getDeclaredMethods()).filter(field -> field.getReturnType() == VanillaPackResources.class).findFirst().orElseThrow();
getVanillaServerPack.setAccessible(true);
}
try {
return (VanillaPackResources) getVanillaServerPack.invoke(null);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public static LootTables getManager() {
if (lootTables == null) {
MultiPackResourceManager resources = new MultiPackResourceManager(PackType.SERVER_DATA, List.of(getVanillaServerPack()));
if (manager == null) {
PackRepository rpl = new PackRepository(PackType.SERVER_DATA, new ServerPacksSource());
rpl.reload();
PackResources thePack = rpl.getAvailablePacks().iterator().next().open();
ReloadableResourceManager resourceManager = new ReloadableResourceManager(PackType.SERVER_DATA);
lootTables = new LootTables(predicate);
resourceManager.registerReloadListener(lootTables);
manager = new LootTables(predicate);
resourceManager.registerReloadListener(manager);
try {
resourceManager.createReload(new ThreadPerTaskExecutor(Thread::new), new ThreadPerTaskExecutor(Thread::new), CompletableFuture.completedFuture(Unit.INSTANCE), resources.listPacks().toList()).done().get();
resourceManager.createReload(new ThreadPerTaskExecutor(Thread::new), new ThreadPerTaskExecutor(Thread::new), CompletableFuture.completedFuture(Unit.INSTANCE), Collections.singletonList(thePack)).done().get();
} catch (Exception exception) {
throw new RuntimeException(exception);
}
}
return lootTables;
return manager;
}
public static PredicateManager getPredicateManager() {
@@ -199,55 +169,20 @@ public final class BlockOptionalMeta {
return Collections.emptyList();
} else {
List<Item> items = new ArrayList<>();
try {
getManager().get(lootTableLocation).getRandomItems(
new LootContext.Builder(ServerLevelStub.fastCreate())
.withRandom(RandomSource.create())
.withParameter(LootContextParams.ORIGIN, Vec3.atLowerCornerOf(BlockPos.ZERO))
.withParameter(LootContextParams.TOOL, ItemStack.EMPTY)
.withOptionalParameter(LootContextParams.BLOCK_ENTITY, null)
.withParameter(LootContextParams.BLOCK_STATE, block.defaultBlockState())
.create(LootContextParamSets.BLOCK),
// the other overload for generate doesnt work in forge because forge adds code that requires a non null world
getManager().get(lootTableLocation).getRandomItems(
new LootContext.Builder((ServerLevel) null)
.withRandom(RandomSource.create())
.withParameter(LootContextParams.ORIGIN, Vec3.atLowerCornerOf(BlockPos.ZERO))
.withParameter(LootContextParams.TOOL, ItemStack.EMPTY)
.withOptionalParameter(LootContextParams.BLOCK_ENTITY, null)
.withParameter(LootContextParams.BLOCK_STATE, block.defaultBlockState())
.create(LootContextParamSets.BLOCK),
stack -> items.add(stack.getItem())
);
} catch (Exception e) {
e.printStackTrace();
}
);
return items;
}
});
}
private static class ServerLevelStub extends ServerLevel {
private static Minecraft client = Minecraft.getInstance();
private static Unsafe unsafe = getUnsafe();
public ServerLevelStub(MinecraftServer $$0, Executor $$1, LevelStorageSource.LevelStorageAccess $$2, ServerLevelData $$3, ResourceKey<Level> $$4, LevelStem $$5, ChunkProgressListener $$6, boolean $$7, long $$8, List<CustomSpawner> $$9, boolean $$10) {
super($$0, $$1, $$2, $$3, $$4, $$5, $$6, $$7, $$8, $$9, $$10);
}
@Override
public FeatureFlagSet enabledFeatures() {
assert client.level != null;
return client.level.enabledFeatures();
}
public static ServerLevelStub fastCreate() {
try {
return (ServerLevelStub) unsafe.allocateInstance(ServerLevelStub.class);
} catch (InstantiationException e) {
throw new RuntimeException(e);
}
}
public static Unsafe getUnsafe() {
try {
Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe");
theUnsafe.setAccessible(true);
return (Unsafe) theUnsafe.get(null);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}
}

View File

@@ -20,7 +20,6 @@ package baritone.api.utils;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
@@ -29,7 +28,7 @@ public class BlockUtils {
private static transient Map<String, Block> resourceCache = new HashMap<>();
public static String blockToString(Block block) {
ResourceLocation loc = BuiltInRegistries.BLOCK.getKey(block);
ResourceLocation loc = Registry.BLOCK.getKey(block);
String name = loc.getPath(); // normally, only write the part after the minecraft:
if (!loc.getNamespace().equals("minecraft")) {
// Baritone is running on top of forge with mods installed, perhaps?
@@ -57,7 +56,7 @@ public class BlockUtils {
if (resourceCache.containsKey(name)) {
return null; // cached as null
}
block = BuiltInRegistries.BLOCK.getOptional(ResourceLocation.tryParse(name.contains(":") ? name : "minecraft:" + name)).orElse(null);
block = Registry.BLOCK.getOptional(ResourceLocation.tryParse(name.contains(":") ? name : "minecraft:" + name)).orElse(null);
Map<String, Block> copy = new HashMap<>(resourceCache); // read only copy is safe, wont throw concurrentmodification
copy.put(name, block);
resourceCache = copy;

View File

@@ -23,7 +23,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.core.Direction;
import net.minecraft.core.Registry;
import net.minecraft.core.Vec3i;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
@@ -253,8 +252,8 @@ public class SettingsUtil {
),
ITEM(
Item.class,
str -> BuiltInRegistries.ITEM.get(new ResourceLocation(str.trim())), // TODO this now returns AIR on failure instead of null, is that an issue?
item -> BuiltInRegistries.ITEM.getKey(item).toString()
str -> Registry.ITEM.get(new ResourceLocation(str.trim())), // TODO this now returns AIR on failure instead of null, is that an issue?
item -> Registry.ITEM.getKey(item).toString()
),
LIST() {
@Override

View File

@@ -20,19 +20,14 @@ package baritone.launch.mixins;
import baritone.Baritone;
import baritone.api.BaritoneAPI;
import baritone.api.IBaritone;
import baritone.api.event.events.ChatEvent;
import baritone.api.event.events.ChunkEvent;
import baritone.api.event.events.type.EventState;
import baritone.cache.CachedChunk;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ClientPacketListener;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.network.chat.Component;
import net.minecraft.network.protocol.game.*;
import net.minecraft.world.level.ChunkPos;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@@ -68,25 +63,6 @@ public class MixinClientPlayNetHandler {
}
}*/
@Shadow @Final private Minecraft minecraft;
@Inject(
method = "sendChat(Ljava/lang/String;)V",
at = @At("HEAD"),
cancellable = true
)
private void sendChatMessage(String string, CallbackInfo ci) {
ChatEvent event = new ChatEvent(string);
IBaritone baritone = BaritoneAPI.getProvider().getBaritoneForPlayer(this.minecraft.player);
if (baritone == null) {
return;
}
baritone.getGameEventHandler().onSendChatMessage(event);
if (event.isCancelled()) {
ci.cancel();
}
}
@Inject(
method = "handleLevelChunkWithLight",
at = @At("RETURN")

View File

@@ -41,6 +41,23 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(LocalPlayer.class)
public class MixinClientPlayerEntity {
@Inject(
method = "sendChat(Ljava/lang/String;Lnet/minecraft/network/chat/Component;)V",
at = @At("HEAD"),
cancellable = true
)
private void sendChatMessage(String string, Component component, CallbackInfo ci) {
ChatEvent event = new ChatEvent(string);
IBaritone baritone = BaritoneAPI.getProvider().getBaritoneForPlayer((LocalPlayer) (Object) this);
if (baritone == null) {
return;
}
baritone.getGameEventHandler().onSendChatMessage(event);
if (event.isCancelled()) {
ci.cancel();
}
}
@Inject(
method = "tick",
at = @At(

View File

@@ -21,11 +21,11 @@ import baritone.api.BaritoneAPI;
import baritone.api.IBaritone;
import baritone.api.event.events.RenderEvent;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Matrix4f;
import net.minecraft.client.Camera;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.renderer.LevelRenderer;
import net.minecraft.client.renderer.LightTexture;
import org.joml.Matrix4f;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;

View File

@@ -27,7 +27,6 @@ import baritone.api.utils.BetterBlockPos;
import baritone.cache.CachedChunk;
import net.minecraft.core.Registry;
import net.minecraft.ChatFormatting;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.network.chat.ClickEvent;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.HoverEvent;
@@ -58,7 +57,7 @@ public class FindCommand extends Command {
Component[] components = toFind.stream()
.flatMap(block ->
ctx.worldData().getCachedWorld().getLocationsOf(
BuiltInRegistries.BLOCK.getKey(block).getPath(),
Registry.BLOCK.getKey(block).getPath(),
Integer.MAX_VALUE,
origin.x,
origin.y,
@@ -92,9 +91,9 @@ public class FindCommand extends Command {
public Stream<String> tabComplete(String label, IArgConsumer args) throws CommandException {
return new TabCompleteHelper()
.append(
CachedChunk.BLOCKS_TO_KEEP_TRACK_OF.stream()
.map(BuiltInRegistries.BLOCK::getKey)
.map(Object::toString)
CachedChunk.BLOCKS_TO_KEEP_TRACK_OF.stream()
.map(Registry.BLOCK::getKey)
.map(Object::toString)
)
.filterPrefixNamespaced(args.getString())
.sortAlphabetically()

View File

@@ -31,7 +31,6 @@ import java.util.*;
import java.util.function.Predicate;
import java.util.stream.Stream;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
@@ -85,7 +84,7 @@ public class FollowCommand extends Command {
} else {
logDirect("Following these types of entities:");
classes.stream()
.map(BuiltInRegistries.ENTITY_TYPE::getKey)
.map(Registry.ENTITY_TYPE::getKey)
.map(Objects::requireNonNull)
.map(ResourceLocation::toString)
.forEach(this::logDirect);

View File

@@ -724,7 +724,7 @@ public interface MovementHelper extends ActionCosts, Helper {
static boolean isBlockNormalCube(BlockState state) {
Block block = state.getBlock();
if (block instanceof BambooStalkBlock
if (block instanceof BambooBlock
|| block instanceof MovingPistonBlock
|| block instanceof ScaffoldingBlock
|| block instanceof ShulkerBoxBlock

View File

@@ -24,6 +24,8 @@ import baritone.api.utils.BetterBlockPos;
import baritone.api.utils.Helper;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Matrix4f;
import com.mojang.math.Vector4f;
import net.minecraft.ChatFormatting;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.player.LocalPlayer;
@@ -37,8 +39,6 @@ import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;
import org.joml.Matrix4f;
import org.joml.Vector4f;
import java.awt.*;
import java.util.Collections;
@@ -80,7 +80,6 @@ public class GuiClick extends Screen implements Helper {
HitResult result = player.level.clip(new ClipContext(near.add(viewerPos), far.add(viewerPos), ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, player));
if (result != null && result.getType() == HitResult.Type.BLOCK) {
currentMouseOver = ((BlockHitResult) result).getBlockPos();
System.out.println("currentMouseOver = " + currentMouseOver);
}
}
}
@@ -119,8 +118,8 @@ public class GuiClick extends Screen implements Helper {
}
public void onRender(PoseStack modelViewStack, Matrix4f projectionMatrix) {
this.projectionViewMatrix = new Matrix4f(projectionMatrix);
this.projectionViewMatrix.mul(modelViewStack.last().pose());
this.projectionViewMatrix = projectionMatrix.copy();
this.projectionViewMatrix.multiply(modelViewStack.last().pose());
this.projectionViewMatrix.invert();
if (currentMouseOver != null) {
@@ -159,13 +158,12 @@ public class GuiClick extends Screen implements Helper {
y = y * 2 - 1;
Vector4f pos = new Vector4f((float) x, (float) y, (float) z, 1.0F);
projectionViewMatrix.transform(pos);
pos.transform(this.projectionViewMatrix);
if (pos.w() == 0) {
return null;
}
pos.mul(1/pos.w());
pos.perspectiveDivide();
return new Vec3(pos.x(), pos.y(), pos.z());
}
}

View File

@@ -23,9 +23,9 @@ import baritone.api.utils.Helper;
import baritone.utils.accessor.IEntityRenderManager;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.*;
import com.mojang.math.Matrix4f;
import java.awt.*;
import net.minecraft.world.phys.AABB;
import org.joml.Matrix4f;
import static org.lwjgl.opengl.GL11.*;

View File

@@ -30,6 +30,7 @@ import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexFormat;
import com.mojang.math.Matrix4f;
import java.awt.*;
import java.util.Collection;
import java.util.Collections;
@@ -44,7 +45,6 @@ import net.minecraft.world.level.dimension.DimensionType;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import org.joml.Matrix4f;
import static org.lwjgl.opengl.GL11.*;

View File

@@ -20,7 +20,6 @@ package baritone.utils.schematic.format.defaults;
import baritone.utils.schematic.StaticSchematic;
import net.minecraft.core.Registry;
import net.minecraft.core.Vec3i;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.resources.ResourceLocation;
@@ -94,7 +93,7 @@ public final class LitematicaSchematic extends StaticSchematic {
BlockState[] blockList = new BlockState[blockStatePalette.size()];
for (int i = 0; i < blockStatePalette.size(); i++) {
Block block = BuiltInRegistries.BLOCK.get(new ResourceLocation((((CompoundTag) blockStatePalette.get(i)).getString("Name"))));
Block block = Registry.BLOCK.get(new ResourceLocation((((CompoundTag) blockStatePalette.get(i)).getString("Name"))));
CompoundTag properties = ((CompoundTag) blockStatePalette.get(i)).getCompound("Properties");
blockList[i] = getBlockState(block, properties);

View File

@@ -19,7 +19,6 @@ package baritone.utils.schematic.format.defaults;
import baritone.utils.schematic.StaticSchematic;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.datafix.fixes.ItemIdFix;
@@ -63,7 +62,7 @@ public final class MCEditSchematic extends StaticSchematic {
// additional is 0 through 15 inclusive since it's & 0xF above
blockID |= additional[blockInd] << 8;
}
Block block = BuiltInRegistries.BLOCK.get(ResourceLocation.tryParse(ItemIdFix.getItem(blockID)));
Block block = Registry.BLOCK.get(ResourceLocation.tryParse(ItemIdFix.getItem(blockID)));
// int meta = metadata[blockInd] & 0xFF;
// this.states[x][z][y] = block.getStateFromMeta(meta);
this.states[x][z][y] = block.defaultBlockState();

View File

@@ -26,7 +26,6 @@ import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
@@ -107,7 +106,7 @@ public final class SpongeSchematic extends StaticSchematic {
private BlockState deserialize() {
if (this.blockState == null) {
Block block = BuiltInRegistries.BLOCK.get(this.resourceLocation);
Block block = Registry.BLOCK.get(this.resourceLocation);
this.blockState = block.defaultBlockState();
this.properties.keySet().stream().sorted(String::compareTo).forEachOrdered(key -> {