Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ org.gradle.jvmargs=-Xmx4G

available_loaders=fabric

mod_version=26.1-SNAPSHOT
mod_version=26.2-SNAPSHOT
maven_group=baritone
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

Expand Down
4 changes: 2 additions & 2 deletions src/api/java/baritone/api/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ public final class Settings {
/**
* Echo commands to chat when they are run
*/
public final Setting<Boolean> echoCommands = new Setting<>(true);
public final Setting<Boolean> echoCommands = new Setting<>(false);

/**
* Censor coordinates in goals and block positions
Expand Down Expand Up @@ -1278,7 +1278,7 @@ public final class Settings {
public final Setting<Consumer<Component>> 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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
48 changes: 48 additions & 0 deletions src/api/java/baritone/api/utils/Tuple.java
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
*/

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<A, B> {
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;
}
}
2 changes: 1 addition & 1 deletion src/api/java/baritone/api/utils/gui/BaritoneToast.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
32 changes: 32 additions & 0 deletions src/launch/java/baritone/launch/mixins/MixinGui.java
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
*/

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();
}
9 changes: 7 additions & 2 deletions src/launch/java/baritone/launch/mixins/MixinLivingEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<Vec3> cir) {
this.getBaritone().ifPresent(baritone -> {
Expand All @@ -103,7 +107,8 @@ private void onPreElytraMove(Vec3 direction, final CallbackInfoReturnable<Vec3>
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) {
Expand Down
47 changes: 8 additions & 39 deletions src/launch/java/baritone/launch/mixins/MixinMinecraft.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -162,31 +151,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class MixinNetworkManager {
private PacketFlow receiving;

@Inject(
method = "sendPacket",
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) {
Expand All @@ -65,7 +65,7 @@ private void preDispatchPacket(final Packet<?> packet, final ChannelFutureListen
}

@Inject(
method = "sendPacket",
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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/launch/resources/mixins.baritone-meteor.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"MixinCommandSuggestionHelper",
"MixinEntity",
"MixinEntityRenderManager",
"MixinGui",
"MixinFireworkRocketEntity",
"MixinItemStack",
"MixinLivingEntity",
Expand All @@ -30,7 +31,6 @@
"MixinScreen",
"MixinWorldRenderer"
],
"mixins": [
],
"mixins": [],
"plugin": "baritone.launch.FabricMixinPlugin"
}
}
2 changes: 1 addition & 1 deletion src/main/java/baritone/Baritone.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Loading