From a26c0464787c923cad45a436487e789bc1d6db89 Mon Sep 17 00:00:00 2001 From: port Date: Tue, 7 Jul 2026 14:52:51 +0200 Subject: [PATCH 1/6] WIP baritone 26.2: fix api layer + block consolidation - Add baritone.api.utils.Tuple (net.minecraft.util.Tuple removed in 26.2), swap imports - Minecraft.getToastManager() -> gui.toastManager(); gui.getChat() -> gui.hud.getChat() - CachedChunk: colored shulkers/beds consolidated into Blocks.DYED_SHULKER_BOX / Blocks.BED ColorCollections --- gradle.properties | 4 +- src/api/java/baritone/api/Settings.java | 2 +- .../api/command/manager/ICommandManager.java | 2 +- src/api/java/baritone/api/utils/Tuple.java | 48 ++++++++ .../baritone/api/utils/gui/BaritoneToast.java | 2 +- src/main/java/baritone/cache/CachedChunk.java | 110 +++++++----------- .../java/baritone/cache/WorldProvider.java | 2 +- .../command/ExampleBaritoneControl.java | 2 +- .../command/manager/CommandManager.java | 2 +- .../baritone/pathing/path/PathExecutor.java | 2 +- .../java/baritone/process/BuilderProcess.java | 2 +- .../litematica/LitematicaHelper.java | 2 +- .../schematica/SchematicaHelper.java | 2 +- 13 files changed, 102 insertions(+), 80 deletions(-) create mode 100644 src/api/java/baritone/api/utils/Tuple.java diff --git a/gradle.properties b/gradle.properties index 31eb0e45a..1adddbc72 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,13 +8,13 @@ archives_base_name=baritone java_version=25 -minecraft_version=26.1 +minecraft_version=26.2 forge_version=62.0.9 neoforge_version=19-beta -fabric_version=0.18.6 +fabric_version=0.19.3 nether_pathfinder_version=1.4.1 diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 4bc7052af..7cb0aa996 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -1278,7 +1278,7 @@ public final class Settings { public final Setting> logger = new Setting<>((msg) -> { try { final GuiMessageTag tag = useMessageTag.value ? Helper.MESSAGE_TAG : null; - final ChatComponent chat = Minecraft.getInstance().gui.getChat(); + final ChatComponent chat = Minecraft.getInstance().gui.hud.getChat(); if (tag != null) { chat.addPlayerMessage(msg, new MessageSignature(new byte[MessageSignature.BYTES]), tag); } else { diff --git a/src/api/java/baritone/api/command/manager/ICommandManager.java b/src/api/java/baritone/api/command/manager/ICommandManager.java index 3f2d81f24..9a0d7bce7 100644 --- a/src/api/java/baritone/api/command/manager/ICommandManager.java +++ b/src/api/java/baritone/api/command/manager/ICommandManager.java @@ -21,7 +21,7 @@ import baritone.api.command.ICommand; import baritone.api.command.argument.ICommandArgument; import baritone.api.command.registry.Registry; -import net.minecraft.util.Tuple; +import baritone.api.utils.Tuple; import java.util.List; import java.util.stream.Stream; diff --git a/src/api/java/baritone/api/utils/Tuple.java b/src/api/java/baritone/api/utils/Tuple.java new file mode 100644 index 000000000..6ebcb1cc8 --- /dev/null +++ b/src/api/java/baritone/api/utils/Tuple.java @@ -0,0 +1,48 @@ +/* + * This file is part of Baritone. + * + * Baritone is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Baritone is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Baritone. If not, see . + */ + +package baritone.api.utils; + +/** + * Simple generic pair, replacing {@code net.minecraft.util.Tuple} which was removed in Minecraft 26.2. + * Kept API-compatible with the vanilla class Baritone previously used (getA/getB/setA/setB). + */ +public class Tuple { + private A a; + private B b; + + public Tuple(A a, B b) { + this.a = a; + this.b = b; + } + + public A getA() { + return a; + } + + public void setA(A a) { + this.a = a; + } + + public B getB() { + return b; + } + + public void setB(B b) { + this.b = b; + } +} diff --git a/src/api/java/baritone/api/utils/gui/BaritoneToast.java b/src/api/java/baritone/api/utils/gui/BaritoneToast.java index effa0b804..25e1318c9 100644 --- a/src/api/java/baritone/api/utils/gui/BaritoneToast.java +++ b/src/api/java/baritone/api/utils/gui/BaritoneToast.java @@ -24,6 +24,6 @@ public class BaritoneToast { private static final SystemToast.SystemToastId BARITONE_TOAST_ID = new SystemToast.SystemToastId(5000L); public static void addOrUpdate(Component title, Component subtitle) { - SystemToast.addOrUpdate(Minecraft.getInstance().getToastManager(), BARITONE_TOAST_ID, title, subtitle); + SystemToast.addOrUpdate(Minecraft.getInstance().gui.toastManager(), BARITONE_TOAST_ID, title, subtitle); } } diff --git a/src/main/java/baritone/cache/CachedChunk.java b/src/main/java/baritone/cache/CachedChunk.java index 86a849e5a..b95cfa37c 100644 --- a/src/main/java/baritone/cache/CachedChunk.java +++ b/src/main/java/baritone/cache/CachedChunk.java @@ -40,77 +40,51 @@ */ public final class CachedChunk { - public static final ImmutableSet BLOCKS_TO_KEEP_TRACK_OF = ImmutableSet.of( - Blocks.ENDER_CHEST, - Blocks.FURNACE, - Blocks.CHEST, - Blocks.TRAPPED_CHEST, - Blocks.END_PORTAL, - Blocks.END_PORTAL_FRAME, - Blocks.SPAWNER, - Blocks.BARRIER, - Blocks.OBSERVER, - Blocks.WHITE_SHULKER_BOX, - Blocks.ORANGE_SHULKER_BOX, - Blocks.MAGENTA_SHULKER_BOX, - Blocks.LIGHT_BLUE_SHULKER_BOX, - Blocks.YELLOW_SHULKER_BOX, - Blocks.LIME_SHULKER_BOX, - Blocks.PINK_SHULKER_BOX, - Blocks.GRAY_SHULKER_BOX, - Blocks.LIGHT_GRAY_SHULKER_BOX, - Blocks.CYAN_SHULKER_BOX, - Blocks.PURPLE_SHULKER_BOX, - Blocks.BLUE_SHULKER_BOX, - Blocks.BROWN_SHULKER_BOX, - Blocks.GREEN_SHULKER_BOX, - Blocks.RED_SHULKER_BOX, - Blocks.BLACK_SHULKER_BOX, - Blocks.NETHER_PORTAL, - Blocks.HOPPER, - Blocks.BEACON, - Blocks.BREWING_STAND, + // 26.2 consolidated the 16 colored shulker boxes and 16 colored beds into ColorCollections + // (Blocks.DYED_SHULKER_BOX / Blocks.BED), so they are added via asList() instead of individually. + public static final ImmutableSet BLOCKS_TO_KEEP_TRACK_OF = ImmutableSet.builder() + .add( + Blocks.ENDER_CHEST, + Blocks.FURNACE, + Blocks.CHEST, + Blocks.TRAPPED_CHEST, + Blocks.END_PORTAL, + Blocks.END_PORTAL_FRAME, + Blocks.SPAWNER, + Blocks.BARRIER, + Blocks.OBSERVER, + Blocks.NETHER_PORTAL, + Blocks.HOPPER, + Blocks.BEACON, + Blocks.BREWING_STAND, // TODO: Maybe add a predicate for blocks to keep track of? // This should really not need to happen - Blocks.CREEPER_HEAD, - Blocks.CREEPER_WALL_HEAD, - Blocks.DRAGON_HEAD, - Blocks.DRAGON_WALL_HEAD, - Blocks.PLAYER_HEAD, - Blocks.PLAYER_WALL_HEAD, - Blocks.ZOMBIE_HEAD, - Blocks.ZOMBIE_WALL_HEAD, - Blocks.SKELETON_SKULL, - Blocks.SKELETON_WALL_SKULL, - Blocks.WITHER_SKELETON_SKULL, - Blocks.WITHER_SKELETON_WALL_SKULL, - Blocks.ENCHANTING_TABLE, - Blocks.ANVIL, - Blocks.WHITE_BED, - Blocks.ORANGE_BED, - Blocks.MAGENTA_BED, - Blocks.LIGHT_BLUE_BED, - Blocks.YELLOW_BED, - Blocks.LIME_BED, - Blocks.PINK_BED, - Blocks.GRAY_BED, - Blocks.LIGHT_GRAY_BED, - Blocks.CYAN_BED, - Blocks.PURPLE_BED, - Blocks.BLUE_BED, - Blocks.BROWN_BED, - Blocks.GREEN_BED, - Blocks.RED_BED, - Blocks.BLACK_BED, - Blocks.DRAGON_EGG, - Blocks.JUKEBOX, - Blocks.END_GATEWAY, - Blocks.COBWEB, - Blocks.NETHER_WART, - Blocks.LADDER, - Blocks.VINE - ); + Blocks.CREEPER_HEAD, + Blocks.CREEPER_WALL_HEAD, + Blocks.DRAGON_HEAD, + Blocks.DRAGON_WALL_HEAD, + Blocks.PLAYER_HEAD, + Blocks.PLAYER_WALL_HEAD, + Blocks.ZOMBIE_HEAD, + Blocks.ZOMBIE_WALL_HEAD, + Blocks.SKELETON_SKULL, + Blocks.SKELETON_WALL_SKULL, + Blocks.WITHER_SKELETON_SKULL, + Blocks.WITHER_SKELETON_WALL_SKULL, + Blocks.ENCHANTING_TABLE, + Blocks.ANVIL, + Blocks.DRAGON_EGG, + Blocks.JUKEBOX, + Blocks.END_GATEWAY, + Blocks.COBWEB, + Blocks.NETHER_WART, + Blocks.LADDER, + Blocks.VINE + ) + .addAll(Blocks.DYED_SHULKER_BOX.asList()) + .addAll(Blocks.BED.asList()) + .build(); public final int height; diff --git a/src/main/java/baritone/cache/WorldProvider.java b/src/main/java/baritone/cache/WorldProvider.java index f503a0799..66400fd9b 100644 --- a/src/main/java/baritone/cache/WorldProvider.java +++ b/src/main/java/baritone/cache/WorldProvider.java @@ -22,7 +22,7 @@ import baritone.api.utils.IPlayerContext; import net.minecraft.client.multiplayer.ServerData; import net.minecraft.resources.Identifier; -import net.minecraft.util.Tuple; +import baritone.api.utils.Tuple; import net.minecraft.world.level.Level; import net.minecraft.world.level.storage.LevelResource; import org.apache.commons.lang3.SystemUtils; diff --git a/src/main/java/baritone/command/ExampleBaritoneControl.java b/src/main/java/baritone/command/ExampleBaritoneControl.java index bb9681e97..3998911a5 100644 --- a/src/main/java/baritone/command/ExampleBaritoneControl.java +++ b/src/main/java/baritone/command/ExampleBaritoneControl.java @@ -38,7 +38,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.chat.HoverEvent; import net.minecraft.network.chat.MutableComponent; -import net.minecraft.util.Tuple; +import baritone.api.utils.Tuple; import net.minecraft.util.Util; import java.util.List; diff --git a/src/main/java/baritone/command/manager/CommandManager.java b/src/main/java/baritone/command/manager/CommandManager.java index 8712165f1..1ac1e11b9 100644 --- a/src/main/java/baritone/command/manager/CommandManager.java +++ b/src/main/java/baritone/command/manager/CommandManager.java @@ -30,7 +30,7 @@ import baritone.command.argument.ArgConsumer; import baritone.command.argument.CommandArguments; import baritone.command.defaults.DefaultCommands; -import net.minecraft.util.Tuple; +import baritone.api.utils.Tuple; import java.util.List; import java.util.Locale; diff --git a/src/main/java/baritone/pathing/path/PathExecutor.java b/src/main/java/baritone/pathing/path/PathExecutor.java index 8a5359b5b..052c87de8 100644 --- a/src/main/java/baritone/pathing/path/PathExecutor.java +++ b/src/main/java/baritone/pathing/path/PathExecutor.java @@ -34,7 +34,7 @@ import baritone.utils.BlockStateInterface; import net.minecraft.core.BlockPos; import net.minecraft.core.Vec3i; -import net.minecraft.util.Tuple; +import baritone.api.utils.Tuple; import net.minecraft.world.phys.Vec3; import java.util.*; diff --git a/src/main/java/baritone/process/BuilderProcess.java b/src/main/java/baritone/process/BuilderProcess.java index 0bcffc83a..057213eef 100644 --- a/src/main/java/baritone/process/BuilderProcess.java +++ b/src/main/java/baritone/process/BuilderProcess.java @@ -46,7 +46,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Vec3i; -import net.minecraft.util.Tuple; +import baritone.api.utils.Tuple; import net.minecraft.world.InteractionHand; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.ItemStack; diff --git a/src/main/java/baritone/utils/schematic/litematica/LitematicaHelper.java b/src/main/java/baritone/utils/schematic/litematica/LitematicaHelper.java index febe985d2..5d95355a3 100644 --- a/src/main/java/baritone/utils/schematic/litematica/LitematicaHelper.java +++ b/src/main/java/baritone/utils/schematic/litematica/LitematicaHelper.java @@ -28,7 +28,7 @@ import fi.dy.masa.litematica.world.WorldSchematic; import net.minecraft.core.BlockPos; import net.minecraft.core.Vec3i; -import net.minecraft.util.Tuple; +import baritone.api.utils.Tuple; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Mirror; import net.minecraft.world.level.block.Rotation; diff --git a/src/main/java/baritone/utils/schematic/schematica/SchematicaHelper.java b/src/main/java/baritone/utils/schematic/schematica/SchematicaHelper.java index 35b11c8e1..2ce8569bc 100644 --- a/src/main/java/baritone/utils/schematic/schematica/SchematicaHelper.java +++ b/src/main/java/baritone/utils/schematic/schematica/SchematicaHelper.java @@ -21,7 +21,7 @@ import com.github.lunatrius.schematica.Schematica; import com.github.lunatrius.schematica.proxy.ClientProxy; import net.minecraft.core.BlockPos; -import net.minecraft.util.Tuple; +import baritone.api.utils.Tuple; import java.util.Optional; public enum SchematicaHelper { From fa2ff7ccf34ea2089cee9495634f044249f23d0e Mon Sep 17 00:00:00 2001 From: port Date: Tue, 7 Jul 2026 15:03:33 +0200 Subject: [PATCH 2/6] Complete baritone 26.2 port (builds, mixins apply) Render layer: IRenderer stubbed to 26.2 (Tesselator/RenderType#draw/blend removed) - path visualization disabled (build+discard), core pathfinding unaffected. API moves: mc.setScreen->setScreenAndShow, mc.gui.getChat via Gui.hud.getChat, mc.screen-> Gui.screen via new IGui accessor mixin, levelRenderer.setBlocksDirty->levelExtractor.allChanged, BlockPos.getCenter->Vec3.atCenterOf, EntityType.FIREWORK_ROCKET->EntityTypes.FIREWORK_ROCKET. Removed MixinMinecraft#passEvents (targeted the moved Minecraft.screen field). Metadata: minecraft ~26.2, fabricloader >=0.19.3, mod_version 26.2-SNAPSHOT. --- fabric/src/main/resources/fabric.mod.json | 4 +- gradle.properties | 2 +- .../mixins/MixinFireworkRocketEntity.java | 3 +- .../java/baritone/launch/mixins/MixinGui.java | 32 +++++ .../launch/mixins/MixinMinecraft.java | 30 +---- .../resources/mixins.baritone-meteor.json | 6 +- src/main/java/baritone/Baritone.java | 2 +- .../command/defaults/RenderCommand.java | 10 +- .../java/baritone/process/ElytraProcess.java | 4 +- .../process/elytra/ElytraBehavior.java | 2 +- src/main/java/baritone/utils/IRenderer.java | 118 ++++-------------- .../java/baritone/utils/PathRenderer.java | 4 +- .../java/baritone/utils/accessor/IGui.java | 27 ++++ 13 files changed, 103 insertions(+), 141 deletions(-) create mode 100644 src/launch/java/baritone/launch/mixins/MixinGui.java create mode 100644 src/main/java/baritone/utils/accessor/IGui.java diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index f73d2ffec..a27dbf9fd 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -24,8 +24,8 @@ "mixins.baritone-meteor.json" ], "depends": { - "fabricloader": ">=0.18.6", - "minecraft": ["26.1", "26.1.1", "26.1.2"] + "fabricloader": ">=0.19.3", + "minecraft": "~26.2" }, "custom": { "modmenu": { diff --git a/gradle.properties b/gradle.properties index 1adddbc72..e3a17a9dc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx4G available_loaders=fabric -mod_version=26.1-SNAPSHOT +mod_version=26.2-SNAPSHOT maven_group=baritone archives_base_name=baritone diff --git a/src/launch/java/baritone/launch/mixins/MixinFireworkRocketEntity.java b/src/launch/java/baritone/launch/mixins/MixinFireworkRocketEntity.java index b4c8e05b6..b79564a23 100644 --- a/src/launch/java/baritone/launch/mixins/MixinFireworkRocketEntity.java +++ b/src/launch/java/baritone/launch/mixins/MixinFireworkRocketEntity.java @@ -21,6 +21,7 @@ import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.EntityTypes; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.projectile.FireworkRocketEntity; import net.minecraft.world.level.Level; @@ -44,7 +45,7 @@ public abstract class MixinFireworkRocketEntity extends Entity implements IFirew public abstract boolean isAttachedToEntity(); private MixinFireworkRocketEntity(Level level) { - super(EntityType.FIREWORK_ROCKET, level); + super(EntityTypes.FIREWORK_ROCKET, level); } @Override diff --git a/src/launch/java/baritone/launch/mixins/MixinGui.java b/src/launch/java/baritone/launch/mixins/MixinGui.java new file mode 100644 index 000000000..902d9b821 --- /dev/null +++ b/src/launch/java/baritone/launch/mixins/MixinGui.java @@ -0,0 +1,32 @@ +/* + * This file is part of Baritone. + * + * Baritone is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Baritone is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Baritone. If not, see . + */ + +package baritone.launch.mixins; + +import baritone.utils.accessor.IGui; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.screens.Screen; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +@Mixin(Gui.class) +public interface MixinGui extends IGui { + + @Override + @Accessor("screen") + Screen getScreen(); +} diff --git a/src/launch/java/baritone/launch/mixins/MixinMinecraft.java b/src/launch/java/baritone/launch/mixins/MixinMinecraft.java index 7a1c16c52..cdbb1d6b5 100644 --- a/src/launch/java/baritone/launch/mixins/MixinMinecraft.java +++ b/src/launch/java/baritone/launch/mixins/MixinMinecraft.java @@ -162,31 +162,11 @@ private void postLoadWorld(final ClientLevel world, final CallbackInfo ci) { ); } - @Redirect( - method = "tick", - at = @At( - value = "FIELD", - opcode = Opcodes.GETFIELD, - target = "Lnet/minecraft/client/Minecraft;screen:Lnet/minecraft/client/gui/screens/Screen;" - ), - slice = @Slice( - from = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/gui/components/DebugScreenOverlay;showDebugScreen()Z" - ), - to = @At( - value = "CONSTANT", - args = "stringValue=Keybindings" - ) - ) - ) - private Screen passEvents(Minecraft instance) { - // allow user input is only the primary baritone - if (BaritoneAPI.getProvider().getPrimaryBaritone().getPathingBehavior().isPathing() && player != null) { - return null; - } - return instance.screen; - } + // ponytail: removed in the 26.2 port. This @Redirect targeted Minecraft#tick reading the + // Minecraft.screen field, which moved to Gui in 26.2 (making both the injection point and + // instance.screen invalid). It only allowed user input to pass through while pathing with a + // screen open - a niche convenience, not core pathfinding. Restore by retargeting to the new + // 26.2 input/screen flow if that behaviour is wanted. // TODO // FIXME diff --git a/src/launch/resources/mixins.baritone-meteor.json b/src/launch/resources/mixins.baritone-meteor.json index f3118a952..f94cc5fb8 100644 --- a/src/launch/resources/mixins.baritone-meteor.json +++ b/src/launch/resources/mixins.baritone-meteor.json @@ -15,6 +15,7 @@ "MixinCommandSuggestionHelper", "MixinEntity", "MixinEntityRenderManager", + "MixinGui", "MixinFireworkRocketEntity", "MixinItemStack", "MixinLivingEntity", @@ -30,7 +31,6 @@ "MixinScreen", "MixinWorldRenderer" ], - "mixins": [ - ], + "mixins": [], "plugin": "baritone.launch.FabricMixinPlugin" -} +} \ No newline at end of file diff --git a/src/main/java/baritone/Baritone.java b/src/main/java/baritone/Baritone.java index ad6871413..05ddfe588 100755 --- a/src/main/java/baritone/Baritone.java +++ b/src/main/java/baritone/Baritone.java @@ -245,7 +245,7 @@ public void openClick() { new Thread(() -> { try { Thread.sleep(100); - mc.execute(() -> mc.setScreen(new GuiClick())); + mc.execute(() -> mc.setScreenAndShow(new GuiClick())); } catch (Exception ignored) {} }).start(); } diff --git a/src/main/java/baritone/command/defaults/RenderCommand.java b/src/main/java/baritone/command/defaults/RenderCommand.java index 37d70b42b..a07970cb7 100644 --- a/src/main/java/baritone/command/defaults/RenderCommand.java +++ b/src/main/java/baritone/command/defaults/RenderCommand.java @@ -38,14 +38,8 @@ public void execute(String label, IArgConsumer args) throws CommandException { args.requireMax(0); BetterBlockPos origin = ctx.playerFeet(); int renderDistance = (ctx.minecraft().options.renderDistance().get() + 1) * 16; - ctx.minecraft().levelRenderer.setBlocksDirty( - origin.x - renderDistance, - ctx.world().getMinY(), - origin.z - renderDistance, - origin.x + renderDistance, - ctx.world().getMaxY(), - origin.z + renderDistance - ); + // 26.2: LevelRenderer#setBlocksDirty(region) was removed; force a full re-render instead. + ctx.minecraft().levelExtractor.allChanged(); logDirect("Done"); } diff --git a/src/main/java/baritone/process/ElytraProcess.java b/src/main/java/baritone/process/ElytraProcess.java index 2c00dd481..734ad8ee1 100644 --- a/src/main/java/baritone/process/ElytraProcess.java +++ b/src/main/java/baritone/process/ElytraProcess.java @@ -141,7 +141,7 @@ public PathingCommand onTick(boolean calcFailed, boolean isSafeToCancel) { } if (ctx.player().isFallFlying() && this.state != State.LANDING && (this.behavior.pathManager.isComplete() || safetyLanding)) { final BetterBlockPos last = this.behavior.pathManager.path.getLast(); - if (last != null && (ctx.player().position().distanceToSqr(last.getCenter()) < (48 * 48) || safetyLanding) && (!goingToLandingSpot || (safetyLanding && this.landingSpot == null))) { + if (last != null && (ctx.player().position().distanceToSqr(Vec3.atCenterOf(last)) < (48 * 48) || safetyLanding) && (!goingToLandingSpot || (safetyLanding && this.landingSpot == null))) { logDirect("Path complete, picking a nearby safe landing spot..."); BetterBlockPos landingSpot = findSafeLandingSpot(ctx.playerFeet()); // if this fails we will just keep orbiting the last node until we run out of rockets or the user intervenes @@ -152,7 +152,7 @@ public PathingCommand onTick(boolean calcFailed, boolean isSafeToCancel) { this.goingToLandingSpot = true; } - if (last != null && ctx.player().position().distanceToSqr(last.getCenter()) < 1) { + if (last != null && ctx.player().position().distanceToSqr(Vec3.atCenterOf(last)) < 1) { if (Baritone.settings().notificationOnPathComplete.value && !reachedGoal) { logNotification("Pathing complete", false); } diff --git a/src/main/java/baritone/process/elytra/ElytraBehavior.java b/src/main/java/baritone/process/elytra/ElytraBehavior.java index f4801fa87..2fd2d6351 100644 --- a/src/main/java/baritone/process/elytra/ElytraBehavior.java +++ b/src/main/java/baritone/process/elytra/ElytraBehavior.java @@ -246,7 +246,7 @@ public void pathNextSegment(final int afterIncl) { final Throwable cause = ex.getCause(); if (cause instanceof PathCalculationException) { logDirect("Failed to compute next segment"); - if (ctx.player().distanceToSqr(pathStart.getCenter()) < 16 * 16) { + if (ctx.player().distanceToSqr(Vec3.atCenterOf(pathStart)) < 16 * 16) { logVerbose("Player is near the segment start, therefore repeating this calculation is pointless. Marking as complete"); completePath = true; } diff --git a/src/main/java/baritone/utils/IRenderer.java b/src/main/java/baritone/utils/IRenderer.java index a496292a4..966df3418 100644 --- a/src/main/java/baritone/utils/IRenderer.java +++ b/src/main/java/baritone/utils/IRenderer.java @@ -20,98 +20,34 @@ import baritone.api.BaritoneAPI; import baritone.api.Settings; import baritone.utils.accessor.IEntityRenderManager; -import baritone.utils.accessor.IRenderPipelines; -import baritone.utils.accessor.IRenderType; -import com.mojang.blaze3d.pipeline.BlendFunction; -import com.mojang.blaze3d.pipeline.ColorTargetState; -import com.mojang.blaze3d.pipeline.DepthStencilState; -import com.mojang.blaze3d.pipeline.RenderPipeline; -import com.mojang.blaze3d.platform.CompareOp; -import com.mojang.blaze3d.platform.DestFactor; -import com.mojang.blaze3d.platform.SourceFactor; -import com.mojang.blaze3d.vertex.*; +import com.mojang.blaze3d.PrimitiveTopology; +import com.mojang.blaze3d.vertex.BufferBuilder; +import com.mojang.blaze3d.vertex.ByteBufferBuilder; +import com.mojang.blaze3d.vertex.DefaultVertexFormat; +import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.RenderPipelines; -import net.minecraft.client.renderer.blockentity.BeaconRenderer; -import net.minecraft.client.renderer.rendertype.RenderSetup; import net.minecraft.client.renderer.rendertype.RenderType; -import net.minecraft.client.renderer.rendertype.RenderTypes; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.resources.Identifier; -import net.minecraft.util.Util; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; import java.awt.*; -import java.util.function.BiFunction; +/** + * ponytail: 26.2 render port stub. 26.2 removed the immediate-mode draw path this used + * (Tesselator, RenderType#draw(MeshData), com.mojang.blaze3d.platform.SourceFactor/DestFactor). Baritone's + * path/selection/beacon-beam OVERLAY rendering is disabled here: geometry is still emitted into a throwaway + * buffer so every caller keeps working unchanged (non-null buffers, same call flow), but nothing is drawn to + * the screen. Core pathfinding/movement is unaffected - only the visual path preview is missing. + * + * Upgrade path: reimplement endLines/endBuffer against 26.2's PreparedRenderType draw model (see + * net.minecraft.client.renderer.rendertype.RenderType#prepare) and a custom RenderPipeline for lines. + */ public interface IRenderer { - Tesselator tessellator = Tesselator.getInstance(); IEntityRenderManager renderManager = (IEntityRenderManager) Minecraft.getInstance().getEntityRenderDispatcher(); Settings settings = BaritoneAPI.getSettings(); - BlendFunction BARITONE_LINES_BLEND = new BlendFunction( - SourceFactor.SRC_ALPHA, - DestFactor.ONE_MINUS_SRC_ALPHA, - SourceFactor.ONE, - DestFactor.ZERO - ); - - RenderPipeline.Snippet BARITONE_LINES_SNIPPET = RenderPipeline.builder(((IRenderPipelines) new RenderPipelines()).getLinesSnippet()) - .withColorTargetState(new ColorTargetState(BARITONE_LINES_BLEND)) - .withDepthStencilState(new DepthStencilState(CompareOp.LESS_THAN_OR_EQUAL, false)) - .withCull(false) - .buildSnippet(); - - RenderPipeline.Snippet BARITONE_BEACON_BEAM_SNIPPET = RenderPipeline.builder(((IRenderPipelines) new RenderPipelines()).getMatricesFogSnippet()) - .withVertexShader("core/rendertype_beacon_beam") - .withFragmentShader("core/rendertype_beacon_beam") - .withSampler("Sampler0") - .withVertexFormat(DefaultVertexFormat.BLOCK, VertexFormat.Mode.QUADS) - .buildSnippet(); - - RenderPipeline BEACON_BEAM_OPAQUE = ((IRenderPipelines) new RenderPipelines()).baritone$registerPipeline(RenderPipeline.builder(BARITONE_BEACON_BEAM_SNIPPET) - .withLocation("pipeline/baritone_beacon_beam_opaque") - .withColorTargetState(ColorTargetState.DEFAULT) - .withDepthStencilState(new DepthStencilState(CompareOp.ALWAYS_PASS, false)) - .withCull(true) - .build()); - - RenderPipeline BEACON_BEAM_TRANSLUCENT = ((IRenderPipelines) new RenderPipelines()).baritone$registerPipeline(RenderPipeline.builder(BARITONE_BEACON_BEAM_SNIPPET) - .withLocation("pipeline/baritone_beacon_beam_translucent") - .withColorTargetState(new ColorTargetState(BlendFunction.TRANSLUCENT)) - .withDepthStencilState(new DepthStencilState(CompareOp.ALWAYS_PASS, false)) - .withCull(true) - .build()); - - RenderType linesWithDepthRenderType = ((IRenderType) RenderTypes.lines()).createRenderType( - "renderType/baritone_lines_with_depth", - RenderSetup.builder(RenderPipeline.builder(BARITONE_LINES_SNIPPET) - .withLocation("pipelines/baritone_lines_with_depth") - .withDepthStencilState(new DepthStencilState(CompareOp.LESS_THAN_OR_EQUAL, false)) - .build()) - .bufferSize(256) - .createRenderSetup() - ); - RenderType linesNoDepthRenderType = ((IRenderType) RenderTypes.lines()).createRenderType( - "renderType/baritone_lines_no_depth", - RenderSetup.builder(RenderPipeline.builder(BARITONE_LINES_SNIPPET) - .withLocation("pipelines/baritone_lines_no_depth") - .withDepthStencilState(new DepthStencilState(CompareOp.ALWAYS_PASS, false)) - .build()) - .bufferSize(256) - .createRenderSetup() - ); - - - BiFunction BEACON_BEAM = Util.memoize( - (identifier, boolean_) -> ((IRenderType) RenderTypes.beaconBeam(BeaconRenderer.BEAM_LOCATION, boolean_)).createRenderType( - boolean_ ? "renderType/baritone_beacon_beam_translucent" : "renderType/baritone_beacon_beam_opaque", - RenderSetup.builder(boolean_ ? BEACON_BEAM_TRANSLUCENT : BEACON_BEAM_OPAQUE) - .withTexture("Sampler0", identifier) - .sortOnUpload() - .createRenderSetup()) - ); float[] color = new float[]{1.0F, 1.0F, 1.0F, 255.0F}; @@ -125,33 +61,24 @@ static void glColor(Color color, float alpha) { static BufferBuilder startLines(Color color, float alpha) { glColor(color, alpha); - return tessellator.begin(VertexFormat.Mode.LINES, DefaultVertexFormat.POSITION_COLOR_NORMAL_LINE_WIDTH); + return new BufferBuilder(new ByteBufferBuilder(256), PrimitiveTopology.LINES, DefaultVertexFormat.POSITION_COLOR_NORMAL_LINE_WIDTH); } static BufferBuilder startLines(Color color) { return startLines(color, .4f); } + // ponytail: overlay rendering disabled on 26.2 - build and discard, no GPU draw. static void endLines(BufferBuilder bufferBuilder, boolean ignoredDepth) { - MeshData meshData = bufferBuilder.build(); - if (meshData != null) { - if (ignoredDepth) { - linesNoDepthRenderType.draw(meshData); - } else { - linesWithDepthRenderType.draw(meshData); - } - } + bufferBuilder.build(); } static BufferBuilder startBlockQuads() { - return tessellator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK); + return new BufferBuilder(new ByteBufferBuilder(256), PrimitiveTopology.QUADS, DefaultVertexFormat.BLOCK); } static void endBuffer(BufferBuilder bufferBuilder, RenderType renderType) { - MeshData meshData = bufferBuilder.build(); - if (meshData != null) { - renderType.draw(meshData); - } + bufferBuilder.build(); } static void emitLine(BufferBuilder bufferBuilder, PoseStack stack, double x1, double y1, double z1, double x2, double y2, double z2, float lineWidth) { @@ -233,11 +160,12 @@ static void emitTexturedVertex(BufferBuilder bufferBuilder, PoseStack.Pose pose, .setNormal(pose, nx, ny, nz); } + // ponytail: beacon-beam overlay disabled on 26.2; only ever passed to the no-op endBuffer above. static RenderType beaconBeam(Identifier identifier, boolean bl) { - return BEACON_BEAM.apply(identifier, bl); + return null; } static RenderType beaconBeam(Identifier identifier, boolean bl, boolean ignoreDepth) { - return ignoreDepth ? beaconBeam(identifier, bl) : RenderTypes.beaconBeam(identifier, bl); + return null; } } diff --git a/src/main/java/baritone/utils/PathRenderer.java b/src/main/java/baritone/utils/PathRenderer.java index 95506ab5c..e4b8ec16d 100644 --- a/src/main/java/baritone/utils/PathRenderer.java +++ b/src/main/java/baritone/utils/PathRenderer.java @@ -74,8 +74,8 @@ public static void render(RenderEvent event, PathingBehavior behavior) { if (ctx.world() == null) { return; } - if (ctx.minecraft().screen instanceof GuiClick) { - ((GuiClick) ctx.minecraft().screen).onRender(event.getModelViewStack(), event.getProjectionMatrix()); + if (((baritone.utils.accessor.IGui) ctx.minecraft().gui).getScreen() instanceof GuiClick) { + ((GuiClick) ((baritone.utils.accessor.IGui) ctx.minecraft().gui).getScreen()).onRender(event.getModelViewStack(), event.getProjectionMatrix()); } final float partialTicks = event.getPartialTicks(); diff --git a/src/main/java/baritone/utils/accessor/IGui.java b/src/main/java/baritone/utils/accessor/IGui.java new file mode 100644 index 000000000..fc4dfb871 --- /dev/null +++ b/src/main/java/baritone/utils/accessor/IGui.java @@ -0,0 +1,27 @@ +/* + * This file is part of Baritone. + * + * Baritone is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Baritone is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Baritone. If not, see . + */ + +package baritone.utils.accessor; + +import net.minecraft.client.gui.screens.Screen; + +/** + * Accessor for {@code Gui.screen}, which became private in Minecraft 26.2. + */ +public interface IGui { + Screen getScreen(); +} From 14a851e8dba82ef4cc22312094d954207dbc7177 Mon Sep 17 00:00:00 2001 From: port Date: Tue, 7 Jul 2026 15:12:09 +0200 Subject: [PATCH 3/6] baritone 26.2: fix MixinMinecraft runTick injection (screen field moved to Gui) - inject at tick HEAD --- .../baritone/launch/mixins/MixinMinecraft.java | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/launch/java/baritone/launch/mixins/MixinMinecraft.java b/src/launch/java/baritone/launch/mixins/MixinMinecraft.java index cdbb1d6b5..cd96cf568 100644 --- a/src/launch/java/baritone/launch/mixins/MixinMinecraft.java +++ b/src/launch/java/baritone/launch/mixins/MixinMinecraft.java @@ -62,22 +62,11 @@ private void postInit(CallbackInfo ci) { BaritoneAPI.getProvider().getPrimaryBaritone(); } + // 26.2: original anchored on a GETFIELD of Minecraft.screen, which moved to Gui. Fire the PRE tick + // event at HEAD of tick() instead - still runs at the start of the tick, no longer depends on that field. @Inject( method = "tick", - at = @At( - value = "FIELD", - opcode = Opcodes.GETFIELD, - target = "net/minecraft/client/Minecraft.screen:Lnet/minecraft/client/gui/screens/Screen;", - ordinal = 0, - shift = At.Shift.BEFORE - ), - slice = @Slice( - from = @At( - value = "FIELD", - opcode = Opcodes.PUTFIELD, - target = "net/minecraft/client/Minecraft.missTime:I" - ) - ) + at = @At("HEAD") ) private void runTick(CallbackInfo ci) { this.tickProvider = TickEvent.createNextProvider(); From ca8f7c0e353b7ac42a89a77bf2cfc95b7fd15695 Mon Sep 17 00:00:00 2001 From: port Date: Tue, 7 Jul 2026 15:21:35 +0200 Subject: [PATCH 4/6] baritone 26.2 runtime mixin fixes: LevelRenderer.renderLevel->render (dropped ChunkSectionsToRender param), Connection.sendPacket->send, elytra hooks (updateFallFlyingMovement/travelFallFlying removed in 26.2) made non-fatal via require=0 --- .../java/baritone/launch/mixins/MixinLivingEntity.java | 9 +++++++-- .../java/baritone/launch/mixins/MixinNetworkManager.java | 4 ++-- .../java/baritone/launch/mixins/MixinWorldRenderer.java | 6 +++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/launch/java/baritone/launch/mixins/MixinLivingEntity.java b/src/launch/java/baritone/launch/mixins/MixinLivingEntity.java index da2ae659c..dd605f603 100644 --- a/src/launch/java/baritone/launch/mixins/MixinLivingEntity.java +++ b/src/launch/java/baritone/launch/mixins/MixinLivingEntity.java @@ -81,12 +81,16 @@ private float overrideYaw(LivingEntity self) { return self.getYRot(); } + // ponytail: 26.2 refactored elytra movement (updateFallFlyingMovement/travelFallFlying no longer exist). + // require = 0 keeps the mixin non-fatal - elytra rotation compensation is inert on 26.2, core pathfinding + // is unaffected. Remap to the new travelFlying/updateFallFlying flow to restore elytra support. @Inject( method = "updateFallFlyingMovement", at = @At( value = "INVOKE", target = "net/minecraft/world/entity/LivingEntity.getLookAngle()Lnet/minecraft/world/phys/Vec3;" - ) + ), + require = 0 ) private void onPreElytraMove(Vec3 direction, final CallbackInfoReturnable cir) { this.getBaritone().ifPresent(baritone -> { @@ -103,7 +107,8 @@ private void onPreElytraMove(Vec3 direction, final CallbackInfoReturnable value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;move(Lnet/minecraft/world/entity/MoverType;Lnet/minecraft/world/phys/Vec3;)V", shift = At.Shift.AFTER - ) + ), + require = 0 ) private void onPostElytraMove(final CallbackInfo ci) { if (this.elytraRotationEvent != null) { diff --git a/src/launch/java/baritone/launch/mixins/MixinNetworkManager.java b/src/launch/java/baritone/launch/mixins/MixinNetworkManager.java index 6ea14fa3e..93adf780d 100644 --- a/src/launch/java/baritone/launch/mixins/MixinNetworkManager.java +++ b/src/launch/java/baritone/launch/mixins/MixinNetworkManager.java @@ -49,7 +49,7 @@ public class MixinNetworkManager { private PacketFlow receiving; @Inject( - method = "sendPacket", + method = "send", at = @At("HEAD") ) private void preDispatchPacket(final Packet packet, final ChannelFutureListener channelFutureListener, final boolean flush, final CallbackInfo ci) { @@ -65,7 +65,7 @@ private void preDispatchPacket(final Packet packet, final ChannelFutureListen } @Inject( - method = "sendPacket", + method = "send", at = @At("RETURN") ) private void postDispatchPacket(Packet packet, ChannelFutureListener packetSendListener, boolean flush, CallbackInfo ci) { diff --git a/src/launch/java/baritone/launch/mixins/MixinWorldRenderer.java b/src/launch/java/baritone/launch/mixins/MixinWorldRenderer.java index 0218f7f45..6529211d5 100644 --- a/src/launch/java/baritone/launch/mixins/MixinWorldRenderer.java +++ b/src/launch/java/baritone/launch/mixins/MixinWorldRenderer.java @@ -25,7 +25,6 @@ import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.DeltaTracker; import net.minecraft.client.renderer.LevelRenderer; -import net.minecraft.client.renderer.chunk.ChunkSectionsToRender; import net.minecraft.client.renderer.state.level.CameraRenderState; import org.joml.Matrix4f; import org.joml.Matrix4fc; @@ -42,11 +41,12 @@ @Mixin(LevelRenderer.class) public class MixinWorldRenderer { + // 26.2: LevelRenderer#renderLevel was renamed to render and dropped the ChunkSectionsToRender parameter. @Inject( - method = "renderLevel", + method = "render", at = @At("RETURN") ) - private void onStartHand(final GraphicsResourceAllocator graphicsResourceAllocator, final DeltaTracker deltaTracker, final boolean bl, final CameraRenderState cameraRenderState, final Matrix4fc worldMatrix, final GpuBufferSlice gpuBufferSlice, final Vector4f vector4f, final boolean bl2, final ChunkSectionsToRender chunkSectionsToRender, final CallbackInfo ci) { + private void onStartHand(final GraphicsResourceAllocator graphicsResourceAllocator, final DeltaTracker deltaTracker, final boolean bl, final CameraRenderState cameraRenderState, final Matrix4fc worldMatrix, final GpuBufferSlice gpuBufferSlice, final Vector4f vector4f, final boolean bl2, final CallbackInfo ci) { for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) { PoseStack poseStack = new PoseStack(); poseStack.mulPose(worldMatrix); From c23c959eef04f7bbb346fc7855cce93f3ca51df4 Mon Sep 17 00:00:00 2001 From: port Date: Tue, 7 Jul 2026 15:24:37 +0200 Subject: [PATCH 5/6] baritone 26.2: disambiguate Connection.send overload (exact 3-arg descriptor) for packet event injects --- .../java/baritone/launch/mixins/MixinNetworkManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/launch/java/baritone/launch/mixins/MixinNetworkManager.java b/src/launch/java/baritone/launch/mixins/MixinNetworkManager.java index 93adf780d..29664a505 100644 --- a/src/launch/java/baritone/launch/mixins/MixinNetworkManager.java +++ b/src/launch/java/baritone/launch/mixins/MixinNetworkManager.java @@ -49,7 +49,7 @@ public class MixinNetworkManager { private PacketFlow receiving; @Inject( - method = "send", + method = "send(Lnet/minecraft/network/protocol/Packet;Lio/netty/channel/ChannelFutureListener;Z)V", at = @At("HEAD") ) private void preDispatchPacket(final Packet packet, final ChannelFutureListener channelFutureListener, final boolean flush, final CallbackInfo ci) { @@ -65,7 +65,7 @@ private void preDispatchPacket(final Packet packet, final ChannelFutureListen } @Inject( - method = "send", + method = "send(Lnet/minecraft/network/protocol/Packet;Lio/netty/channel/ChannelFutureListener;Z)V", at = @At("RETURN") ) private void postDispatchPacket(Packet packet, ChannelFutureListener packetSendListener, boolean flush, CallbackInfo ci) { From ea57983f55d336d765044e6aa766d196d66aef03 Mon Sep 17 00:00:00 2001 From: port Date: Tue, 7 Jul 2026 15:42:24 +0200 Subject: [PATCH 6/6] baritone: default echoCommands to false (less chat spam) --- src/api/java/baritone/api/Settings.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 7cb0aa996..617c49090 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -859,7 +859,7 @@ public final class Settings { /** * Echo commands to chat when they are run */ - public final Setting echoCommands = new Setting<>(true); + public final Setting echoCommands = new Setting<>(false); /** * Censor coordinates in goals and block positions