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
87 changes: 58 additions & 29 deletions .github/workflows/gradle_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,67 @@ name: Java CI with Gradle
on:
push:
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest
outputs:
dist_artifact_name: ${{ steps.artifact_names.outputs.dist }}
mapping_artifact_name: ${{ steps.artifact_names.outputs.mapping }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

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

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

- name: Build with Gradle
run: ./gradlew build -Pmod_version="$(git describe --always --tags --first-parent | cut -c2-)"

- name: Archive Artifacts
uses: actions/upload-artifact@v4
with:
name: Artifacts
path: dist/

- name: Archive mapping.txt
uses: actions/upload-artifact@v4
with:
name: Mappings
path: mapping/
- uses: actions/checkout@v4
with:
fetch-depth: 0

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

- name: Resolve build version
id: version
shell: bash
run: |
version="$(git describe --always --tags --first-parent --dirty)"
version="${version#v}"
echo "value=$version" >> "$GITHUB_OUTPUT"

- name: Resolve artifact names
id: artifact_names
shell: bash
run: |
echo "dist=baritone-dist-${{ steps.version.outputs.value }}" >> "$GITHUB_OUTPUT"
echo "mapping=baritone-mapping-${{ steps.version.outputs.value }}" >> "$GITHUB_OUTPUT"

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

- name: Clean artifact staging directories
run: rm -rf dist mapping

- name: Build with Gradle
run: ./gradlew clean build -Pmod_version="${{ steps.version.outputs.value }}"

- name: Upload distribution artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ steps.artifact_names.outputs.dist }}
path: dist/
if-no-files-found: error
retention-days: 14

- name: Upload mapping artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ steps.artifact_names.outputs.mapping }}
path: mapping/
if-no-files-found: warn
retention-days: 14

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

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

mappings {
intermediary()
mojmap()
parchment(rootProject.minecraft_version, "2025.12.20")

devFallbackNamespace "official"
}
}

Expand Down
5 changes: 5 additions & 0 deletions 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 Down Expand Up @@ -44,6 +48,7 @@ dependencies {
implementation group: 'com.google.code.gson', name: 'gson', version: '2.9.0'
implementation group: 'commons-io', name: 'commons-io', version: '2.7'

// 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'
}
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.19.3",
"minecraft": ["26.1.2"]
},
"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="[64,)" #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.2]"
ordering="NONE"
side="BOTH"
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ 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.2

forge_version=61.1.5
forge_version=64.0.8

neoforge_version=42
neoforge_version=73

fabric_version=0.18.5
fabric_version=0.19.3

nether_pathfinder_version=1.4.1

Expand Down
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.2]"
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 @@ -42,5 +42,5 @@ pluginManagement {
rootProject.name = 'baritone'

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 @@ -1281,7 +1283,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
Loading