Skip to content
Open
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
2 changes: 1 addition & 1 deletion forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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="[26.1]"
versionRange="[26.2]"
ordering="NONE"
side="BOTH"
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
2 changes: 1 addition & 1 deletion neoforge/src/main/resources/META-INF/neoforge.mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ A Minecraft pathfinder bot.
modId="minecraft"
type="required"
# This version range declares a minimum of the current minecraft version up to but not including the next major version
versionRange="[26.1]"
versionRange="[26.2]"
ordering="NONE"
side="BOTH"

Expand Down
2 changes: 1 addition & 1 deletion src/api/java/baritone/api/Settings.java
Original file line number Diff line number Diff line change
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.Pair;

import java.util.List;
import java.util.stream.Stream;
Expand All @@ -44,9 +44,9 @@ public interface ICommandManager {

boolean execute(String string);

boolean execute(Tuple<String, List<ICommandArgument>> expanded);
boolean execute(Pair<String, List<ICommandArgument>> expanded);

Stream<String> tabComplete(Tuple<String, List<ICommandArgument>> expanded);
Stream<String> tabComplete(Pair<String, List<ICommandArgument>> expanded);

Stream<String> tabComplete(String prefix);
}
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 @@ -20,7 +20,7 @@
import baritone.utils.accessor.IFireworkRocketEntity;
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 +44,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
26 changes: 8 additions & 18 deletions src/launch/java/baritone/launch/mixins/MixinMinecraft.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
import baritone.api.event.events.WorldEvent;
import baritone.api.event.events.type.EventState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.player.LocalPlayer;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
Expand Down Expand Up @@ -65,18 +65,9 @@ private void postInit(CallbackInfo ci) {
@Inject(
method = "tick",
at = @At(
value = "FIELD",
opcode = Opcodes.GETFIELD,
target = "net/minecraft/client/Minecraft.screen:Lnet/minecraft/client/gui/screens/Screen;",
ordinal = 0,
value = "INVOKE",
target = "Lnet/minecraft/client/gui/Gui;overlay()Lnet/minecraft/client/gui/screens/Overlay;",
shift = At.Shift.BEFORE
),
slice = @Slice(
from = @At(
value = "FIELD",
opcode = Opcodes.PUTFIELD,
target = "net/minecraft/client/Minecraft.missTime:I"
)
)
)
private void runTick(CallbackInfo ci) {
Expand Down Expand Up @@ -165,27 +156,26 @@ 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;"
value = "INVOKE",
target = "Lnet/minecraft/client/gui/Gui;screen()Lnet/minecraft/client/gui/screens/Screen;"
),
slice = @Slice(
from = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/components/DebugScreenOverlay;showDebugScreen()Z"
target = "Lnet/minecraft/client/gui/Gui;overlay()Lnet/minecraft/client/gui/screens/Overlay;"
),
to = @At(
value = "CONSTANT",
args = "stringValue=Keybindings"
)
)
)
private Screen passEvents(Minecraft instance) {
private Screen passEvents(Gui instance) {
// allow user input is only the primary baritone
if (BaritoneAPI.getProvider().getPrimaryBaritone().getPathingBehavior().isPathing() && player != null) {
return null;
}
return instance.screen;
return instance.screen();
}

// TODO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class MixinRenderPipelines implements IRenderPipelines {
private static RenderPipeline.Snippet LINES_SNIPPET;

@Final @Shadow
private static RenderPipeline.Snippet MATRICES_FOG_SNIPPET;
private static RenderPipeline.Snippet BEACON_BEAM_SNIPPET;

@Shadow
private static RenderPipeline register(final RenderPipeline renderPipeline) { return null; }
Expand All @@ -40,8 +40,8 @@ public RenderPipeline.Snippet getLinesSnippet() {
}

@Override
public RenderPipeline.Snippet getMatricesFogSnippet() {
return MATRICES_FOG_SNIPPET;
public RenderPipeline.Snippet getBeaconBeamSnippet() {
return BEACON_BEAM_SNIPPET;
}

@Override
Expand Down
20 changes: 12 additions & 8 deletions src/launch/java/baritone/launch/mixins/MixinWorldRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
import baritone.api.BaritoneAPI;
import baritone.api.IBaritone;
import baritone.api.event.events.RenderEvent;
import baritone.utils.IRenderer;
import com.mojang.blaze3d.buffers.GpuBufferSlice;
import com.mojang.blaze3d.resource.GraphicsResourceAllocator;
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 @@ -43,15 +43,19 @@
public class MixinWorldRenderer {

@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) {
for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) {
PoseStack poseStack = new PoseStack();
poseStack.mulPose(worldMatrix);
Matrix4f projection = new Matrix4f(cameraRenderState.projectionMatrix);
ibaritone.getGameEventHandler().onRenderPass(new RenderEvent(deltaTracker.getGameTimeDeltaPartialTick(false), poseStack, projection));
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) {
try {
for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) {
PoseStack poseStack = new PoseStack();
poseStack.mulPose(worldMatrix);
Matrix4f projection = new Matrix4f(cameraRenderState.projectionMatrix);
ibaritone.getGameEventHandler().onRenderPass(new RenderEvent(deltaTracker.getGameTimeDeltaPartialTick(false), poseStack, projection));
}
} finally {
IRenderer.endFrame();
}
}
}
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.gui.setScreen(new GuiClick()));
} catch (Exception ignored) {}
}).start();
}
Expand Down
64 changes: 32 additions & 32 deletions src/main/java/baritone/cache/CachedChunk.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,22 @@ public final class CachedChunk {
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.DYED_SHULKER_BOX.white(),
Blocks.DYED_SHULKER_BOX.orange(),
Blocks.DYED_SHULKER_BOX.magenta(),
Blocks.DYED_SHULKER_BOX.lightBlue(),
Blocks.DYED_SHULKER_BOX.yellow(),
Blocks.DYED_SHULKER_BOX.lime(),
Blocks.DYED_SHULKER_BOX.pink(),
Blocks.DYED_SHULKER_BOX.gray(),
Blocks.DYED_SHULKER_BOX.lightGray(),
Blocks.DYED_SHULKER_BOX.cyan(),
Blocks.DYED_SHULKER_BOX.purple(),
Blocks.DYED_SHULKER_BOX.blue(),
Blocks.DYED_SHULKER_BOX.brown(),
Blocks.DYED_SHULKER_BOX.green(),
Blocks.DYED_SHULKER_BOX.red(),
Blocks.DYED_SHULKER_BOX.black(),
Blocks.NETHER_PORTAL,
Blocks.HOPPER,
Blocks.BEACON,
Expand All @@ -87,22 +87,22 @@ public final class CachedChunk {
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.BED.white(),
Blocks.BED.orange(),
Blocks.BED.magenta(),
Blocks.BED.lightBlue(),
Blocks.BED.yellow(),
Blocks.BED.lime(),
Blocks.BED.pink(),
Blocks.BED.gray(),
Blocks.BED.lightGray(),
Blocks.BED.cyan(),
Blocks.BED.purple(),
Blocks.BED.blue(),
Blocks.BED.brown(),
Blocks.BED.green(),
Blocks.BED.red(),
Blocks.BED.black(),
Blocks.DRAGON_EGG,
Blocks.JUKEBOX,
Blocks.END_GATEWAY,
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/baritone/cache/WorldProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.Pair;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.storage.LevelResource;
import org.apache.commons.lang3.SystemUtils;
Expand Down Expand Up @@ -71,8 +71,8 @@ public final WorldData getCurrentWorld() {
*/
public final void initWorld(Level world) {
this.getSaveDirectories(world).ifPresent(dirs -> {
final Path worldDir = dirs.getA();
final Path readmeDir = dirs.getB();
final Path worldDir = dirs.first();
final Path readmeDir = dirs.second();

try {
// lol wtf is this baritone folder in my minecraft save?
Expand Down Expand Up @@ -119,7 +119,7 @@ private Path getWorldDataDirectory(Path parent, Level world) {
* @return An {@link Optional} containing the world's baritone dir and readme dir, or {@link Optional#empty()} if
* the world isn't valid for caching.
*/
private Optional<Tuple<Path, Path>> getSaveDirectories(Level world) {
private Optional<Pair<Path, Path>> getSaveDirectories(Level world) {
Path worldDir;
Path readmeDir;

Expand Down Expand Up @@ -156,7 +156,7 @@ private Optional<Tuple<Path, Path>> getSaveDirectories(Level world) {
readmeDir = baritone.getDirectory();
}

return Optional.of(new Tuple<>(worldDir, readmeDir));
return Optional.of(new Pair<>(worldDir, readmeDir));
}

/**
Expand Down
Loading