Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
6 changes: 3 additions & 3 deletions .github/workflows/gradle_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ jobs:
with:
fetch-depth: 0

- name: Set up JDK 21
- name: Set up JDK 25
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
java-version: '25'
distribution: 'zulu'
cache: gradle

- name: Grant execute permission for gradlew
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
- name: Set up JDK 25
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
java-version: '25'
distribution: 'zulu'

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Executing tests
run: ./gradlew test

2 changes: 0 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ allprojects {
version rootProject.minecraft_version

mappings {
intermediary()
mojmap()
parchment("1.21.4", "2025.03.23")

devFallbackNamespace "official"
}
Expand Down
8 changes: 7 additions & 1 deletion buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@

repositories {
mavenLocal()
maven {
name = 'WagYourMavenSnapshots'
url = 'https://maven.wagyourtail.xyz/snapshots'
}
maven {
name = 'WagYourMaven'
url = 'https://maven.wagyourtail.xyz/releases'
Expand All @@ -40,5 +44,7 @@ dependencies {
implementation group: 'com.google.code.gson', name: 'gson', version: '2.9.0'
implementation group: 'commons-io', name: 'commons-io', version: '2.7'

implementation group: 'xyz.wagyourtail.unimined', name: 'xyz.wagyourtail.unimined.gradle.plugin', version: '1.2.9'
// TODO: pin to a stable Unimined release once published.
implementation group: 'xyz.wagyourtail.unimined', name: 'xyz.wagyourtail.unimined.gradle.plugin', version: '1.4.2-SNAPSHOT'
implementation group: 'xyz.wagyourtail.unimined.mapping', name: 'unimined-mapping-library-jvm', version: '1.2.2'
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ protected void exec() throws Exception {

private File getMcJar() {
MinecraftConfig mcc = ext.getMinecrafts().get(sourceSets.getByName("main"));
return mcc.getMinecraft(mcc.getMcPatcher().getProdNamespace(), mcc.getMcPatcher().getProdNamespace()).toFile();
return mcc.getMinecraft(mcc.getMcPatcher().getProdNamespace()).toFile();
}

private boolean isMcJar(File f) {
Expand Down
2 changes: 1 addition & 1 deletion fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ components.java {
}

task proguard(type: ProguardTask) {
proguardVersion "7.4.2"
proguardVersion "7.8.2"
compType "fabric"
}

Expand Down
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.json"
],
"depends": {
"fabricloader": ">=0.14.22",
"minecraft": ["1.21.11"]
"fabricloader": ">=0.18.6",
"minecraft": ["26.1"]
},
"custom": {
"modmenu": {
Expand Down
2 changes: 1 addition & 1 deletion forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ components.java {
}

task proguard(type: ProguardTask) {
proguardVersion "7.4.2"
proguardVersion "7.8.2"
compType "forge"
}

Expand Down
4 changes: 2 additions & 2 deletions forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader="javafml" #mandatory
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
loaderVersion="[48,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
loaderVersion="[62,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
license="https://raw.githubusercontent.com/cabaletta/baritone/1.16.2/LICENSE"
# A URL to refer people to when problems occur with this mod
issueTrackerURL="https://github.com/cabaletta/baritone/issues" #optional
Expand Down 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="[1.21.11]"
versionRange="[26.1]"
ordering="NONE"
side="BOTH"
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
org.gradle.jvmargs=-Xmx4G

available_loaders=fabric,forge,tweaker
available_loaders=fabric,forge,neoforge,tweaker

mod_version=1.17.0
maven_group=baritone
archives_base_name=baritone

java_version=21
java_version=25

minecraft_version=1.21.11
minecraft_version=26.1

forge_version=61.0.0
forge_version=62.0.9

neoforge_version=0-beta
neoforge_version=19-beta

fabric_version=0.18.1
fabric_version=0.18.6

nether_pathfinder_version=1.4.1

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion neoforge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ components.java {
}

task proguard(type: ProguardTask) {
proguardVersion "7.4.2"
proguardVersion "7.8.2"
compType "neoforge"
}

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="[1.21.11]"
versionRange="[26.1]"
ordering="NONE"
side="BOTH"

Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ rootProject.name = 'baritone'

include("tweaker")
for (platform in available_loaders.split(",")) {
include(platform)
include(platform)
}
11 changes: 9 additions & 2 deletions src/api/java/baritone/api/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@
import baritone.api.utils.SettingsUtil;
import baritone.api.utils.TypeUtils;
import baritone.api.utils.gui.BaritoneToast;
import net.minecraft.client.GuiMessageTag;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.components.ChatComponent;
import net.minecraft.client.multiplayer.chat.GuiMessageTag;
import net.minecraft.core.Vec3i;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MessageSignature;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
Expand Down Expand Up @@ -1276,7 +1278,12 @@ public final class Settings {
public final Setting<Consumer<Component>> logger = new Setting<>((msg) -> {
try {
final GuiMessageTag tag = useMessageTag.value ? Helper.MESSAGE_TAG : null;
Minecraft.getInstance().gui.getChat().addMessage(msg, null, tag);
final ChatComponent chat = Minecraft.getInstance().gui.getChat();
if (tag != null) {
chat.addPlayerMessage(msg, new MessageSignature(new byte[MessageSignature.BYTES]), tag);
} else {
chat.addClientSystemMessage(msg);
}
} catch (Throwable t) {
LOGGER.warn("Failed to log message to chat: " + msg.getString(), t);
}
Expand Down
17 changes: 9 additions & 8 deletions src/api/java/baritone/api/utils/BlockOptionalMeta.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import net.minecraft.server.packs.resources.CloseableResourceManager;
import net.minecraft.server.packs.resources.MultiPackResourceManager;
import net.minecraft.tags.TagLoader;
import net.minecraft.world.RandomSequences;
import net.minecraft.world.flag.FeatureFlagSet;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
Expand Down Expand Up @@ -262,8 +261,8 @@ public static class ServerLevelStub extends ServerLevel {
private static Unsafe unsafe = getUnsafe();
private static CompletableFuture<RegistryAccess> registryAccess = load();

public ServerLevelStub(MinecraftServer $$0, Executor $$1, LevelStorageSource.LevelStorageAccess $$2, ServerLevelData $$3, ResourceKey<Level> $$4, LevelStem $$5, boolean $$6, long $$7, List<CustomSpawner> $$8, boolean $$9, @Nullable RandomSequences $$10) {
super($$0, $$1, $$2, $$3, $$4, $$5, $$6, $$7, $$8, $$9, $$10);
public ServerLevelStub(MinecraftServer $$0, Executor $$1, LevelStorageSource.LevelStorageAccess $$2, ServerLevelData $$3, ResourceKey<Level> $$4, LevelStem $$5, boolean $$6, long $$7, List<CustomSpawner> $$8, boolean $$9) {
super($$0, $$1, $$2, $$3, $$4, $$5, $$6, $$7, $$8, $$9);
}

@Override
Expand Down Expand Up @@ -313,13 +312,15 @@ public static CompletableFuture<RegistryAccess> load() {
baseLayeredRegistry.getAccessForLoading(RegistryLayer.WORLDGEN),
pendingTags
);
RegistryAccess.Frozen worldgenRegistries = RegistryDataLoader.load(
closeableResourceManager,
worldGenRegistryLookupList,
RegistryDataLoader.WORLDGEN_REGISTRIES,
ForkJoinPool.commonPool()
).join();
LayeredRegistryAccess<RegistryLayer> layeredRegistryAccess = baseLayeredRegistry.replaceFrom(
RegistryLayer.WORLDGEN,
RegistryDataLoader.load(
closeableResourceManager,
worldGenRegistryLookupList,
RegistryDataLoader.WORLDGEN_REGISTRIES
)
worldgenRegistries
);
return ReloadableServerRegistries.reload(
layeredRegistryAccess,
Expand Down
4 changes: 2 additions & 2 deletions src/api/java/baritone/api/utils/Helper.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import baritone.api.BaritoneAPI;
import baritone.api.Settings;
import net.minecraft.ChatFormatting;
import net.minecraft.client.GuiMessageTag;
import net.minecraft.client.multiplayer.chat.GuiMessageTag;
import net.minecraft.client.Minecraft;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
Expand Down Expand Up @@ -53,7 +53,7 @@ public interface Helper {
/**
* The tag to assign to chat messages when {@link Settings#useMessageTag} is {@code true}.
*/
GuiMessageTag MESSAGE_TAG = new GuiMessageTag(0xFF55FF, null, Component.literal("Baritone message."), "Baritone");
GuiMessageTag MESSAGE_TAG = new GuiMessageTag(0xFF55FF, GuiMessageTag.Icon.CHAT_MODIFIED, Component.literal("Baritone message."), "Baritone");

static Component getPrefix() {
// Inner text component
Expand Down
4 changes: 2 additions & 2 deletions src/api/java/baritone/api/utils/IPlayerController.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.ClickType;
import net.minecraft.world.inventory.ContainerInput;
import net.minecraft.world.level.GameType;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.BlockHitResult;
Expand All @@ -43,7 +43,7 @@ public interface IPlayerController {

void resetBlockRemoving();

void windowClick(int windowId, int slotId, int mouseButton, ClickType type, Player player);
void windowClick(int windowId, int slotId, int mouseButton, ContainerInput input, Player player);

GameType getGameType();

Expand Down
4 changes: 2 additions & 2 deletions src/launch/java/baritone/launch/mixins/MixinChunkArray.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ public void copyFrom(IChunkArray other) {
LevelChunk chunk = copyingFrom.get(k);
if (chunk != null) {
ChunkPos chunkpos = chunk.getPos();
if (inRange(chunkpos.x, chunkpos.z)) {
int index = getIndex(chunkpos.x, chunkpos.z);
if (inRange(chunkpos.x(), chunkpos.z())) {
int index = getIndex(chunkpos.x(), chunkpos.z());
if (chunks.get(index) != null) {
throw new IllegalStateException("Doing this would mutate the client's REAL loaded chunks?!");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private void preChunkUnload(ClientboundForgetLevelChunkPacket packet, CallbackIn
LocalPlayer player = ibaritone.getPlayerContext().player();
if (player != null && player.connection == (ClientPacketListener) (Object) this) {
ibaritone.getGameEventHandler().onChunkEvent(
new ChunkEvent(EventState.PRE, ChunkEvent.Type.UNLOAD, packet.pos().x, packet.pos().z)
new ChunkEvent(EventState.PRE, ChunkEvent.Type.UNLOAD, packet.pos().x(), packet.pos().z())
);
}
}
Expand All @@ -140,7 +140,7 @@ private void postChunkUnload(ClientboundForgetLevelChunkPacket packet, CallbackI
LocalPlayer player = ibaritone.getPlayerContext().player();
if (player != null && player.connection == (ClientPacketListener) (Object) this) {
ibaritone.getGameEventHandler().onChunkEvent(
new ChunkEvent(EventState.POST, ChunkEvent.Type.UNLOAD, packet.pos().x, packet.pos().z)
new ChunkEvent(EventState.POST, ChunkEvent.Type.UNLOAD, packet.pos().x(), packet.pos().z())
);
}
}
Expand Down Expand Up @@ -190,7 +190,7 @@ private void postHandleMultiBlockChange(ClientboundSectionBlocksUpdatePacket pac
return;
}
baritone.getGameEventHandler().onBlockChange(new BlockChangeEvent(
new ChunkPos(changes.get(0).first()),
ChunkPos.containing(changes.get(0).first()),
changes
));
}
Expand Down
7 changes: 3 additions & 4 deletions src/launch/java/baritone/launch/mixins/MixinItemStack.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import baritone.api.utils.accessor.IItemStack;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
Expand All @@ -32,8 +31,7 @@
public abstract class MixinItemStack implements IItemStack {

@Shadow
@Final
private Item item;
public abstract Item getItem();

@Unique
private int baritoneHash;
Expand All @@ -42,7 +40,8 @@ public abstract class MixinItemStack implements IItemStack {
public abstract int getDamageValue();

private void recalculateHash() {
baritoneHash = item == null ? -1 : item.hashCode() + getDamageValue();
Item it = getItem();
baritoneHash = it == null ? -1 : it.hashCode() + getDamageValue();
}

@Inject(
Expand Down
11 changes: 7 additions & 4 deletions src/launch/java/baritone/launch/mixins/MixinWorldRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@
import com.mojang.blaze3d.buffers.GpuBufferSlice;
import com.mojang.blaze3d.resource.GraphicsResourceAllocator;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Camera;
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;
import org.joml.Vector4f;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -44,11 +46,12 @@ public class MixinWorldRenderer {
method = "renderLevel",
at = @At("RETURN")
)
private void onStartHand(final GraphicsResourceAllocator graphicsResourceAllocator, final DeltaTracker deltaTracker, final boolean bl, final Camera camera, final Matrix4f matrix4f, final Matrix4f matrix4f2, final Matrix4f matrix4f3, final GpuBufferSlice gpuBufferSlice, final Vector4f vector4f, final boolean bl2, 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 ChunkSectionsToRender chunkSectionsToRender, final CallbackInfo ci) {
for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) {
PoseStack poseStack = new PoseStack();
poseStack.mulPose(matrix4f);
ibaritone.getGameEventHandler().onRenderPass(new RenderEvent(deltaTracker.getGameTimeDeltaPartialTick(false), poseStack, matrix4f2));
poseStack.mulPose(worldMatrix);
Matrix4f projection = new Matrix4f(cameraRenderState.projectionMatrix);
ibaritone.getGameEventHandler().onRenderPass(new RenderEvent(deltaTracker.getGameTimeDeltaPartialTick(false), poseStack, projection));
}
}
}
4 changes: 2 additions & 2 deletions src/main/java/baritone/behavior/InventoryBehavior.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import net.minecraft.core.component.DataComponents;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.inventory.ClickType;
import net.minecraft.world.inventory.ContainerInput;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
Expand Down Expand Up @@ -120,7 +120,7 @@ private boolean requestSwapWithHotBar(int inInventory, int inHotbar) {
logDebug("Inventory move requested but delaying until stationary");
return false;
}
ctx.playerController().windowClick(ctx.player().inventoryMenu.containerId, inInventory < 9 ? inInventory + 36 : inInventory, inHotbar, ClickType.SWAP, ctx.player());
ctx.playerController().windowClick(ctx.player().inventoryMenu.containerId, inInventory < 9 ? inInventory + 36 : inInventory, inHotbar, ContainerInput.SWAP, ctx.player());
ticksSinceLastInventoryMove = 0;
lastTickRequestedMove = null;
return true;
Expand Down
Loading