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
25 changes: 23 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,22 @@ allprojects {
name = 'spongepowered-repo'
url = 'https://repo.spongepowered.org/repository/maven-public/'
}
maven {
name = 'fabric-intermediary-artifact'
url = 'https://maven.fabricmc.net/'
metadataSources {
artifact()
}
content {
includeModule("net.fabricmc", "intermediary")
}
}
maven {
name = 'fabric-maven'
url = 'https://maven.fabricmc.net/'
content {
excludeModule("net.fabricmc", "intermediary")
}
}
maven {
name = 'impactdevelopment-repo'
Expand Down Expand Up @@ -93,9 +106,17 @@ allprojects {
version rootProject.minecraft_version

mappings {
intermediary()
if (rootProject.minecraft_version == "26.3-snapshot-1") {
mapping("net.fabricmc:intermediary:0.0.0:v2", "intermediary") {
provides("intermediary", false)
}
} else {
intermediary()
}
mojmap()
parchment(rootProject.minecraft_version, "2025.12.20")
if (rootProject.hasProperty("parchment_version") && rootProject.parchment_version) {
parchment(rootProject.minecraft_version, rootProject.parchment_version)
}
}
}

Expand Down
8 changes: 6 additions & 2 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,19 @@ components.java {
}

task proguard(type: ProguardTask) {
proguardVersion "7.4.2"
enabled = project.java_version.toInteger() <= 21
proguardVersion "7.9.1"
compType "fabric"
}

task createDist(type: CreateDistTask, dependsOn: proguard) {
enabled = project.java_version.toInteger() <= 21
compType "fabric"
}

build.finalizedBy(createDist)
if (project.java_version.toInteger() <= 21) {
build.finalizedBy(createDist)
}

publishing {
publications {
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.3-snapshot-1"]
},
"custom": {
"modmenu": {
Expand Down
8 changes: 4 additions & 4 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,neoforge,tweaker
available_loaders=fabric

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.3-snapshot-1

forge_version=61.1.5

neoforge_version=42

fabric_version=0.18.5
fabric_version=0.19.3

nether_pathfinder_version=1.4.1

Expand Down
4 changes: 4 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ pluginManagement {
}
}

plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
}

rootProject.name = 'baritone'

for (platform in available_loaders.split(",")) {
Expand Down
10 changes: 7 additions & 3 deletions src/api/java/baritone/api/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
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.multiplayer.chat.GuiMessageTag;
import net.minecraft.core.Vec3i;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.Item;
Expand Down Expand Up @@ -1280,8 +1280,12 @@ public final class Settings {
@JavaOnly
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);
if (useMessageTag.value) {
final GuiMessageTag tag = Helper.MESSAGE_TAG;
Minecraft.getInstance().gui.hud.getChat().addPlayerMessage(msg, null, tag);
} else {
Minecraft.getInstance().gui.hud.getChat().addClientSystemMessage(msg);
}
} catch (Throwable t) {
LOGGER.warn("Failed to log message to chat: " + msg.getString(), t);
}
Expand Down
5 changes: 5 additions & 0 deletions src/api/java/baritone/api/utils/BetterBlockPos.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import net.minecraft.core.Direction;
import net.minecraft.core.Vec3i;
import net.minecraft.util.Mth;
import net.minecraft.world.phys.Vec3;

/**
* A better BlockPos that has fewer hash collisions (and slightly more performant offsets)
Expand Down Expand Up @@ -224,6 +225,10 @@ public double distanceTo(final BetterBlockPos to) {
return Math.sqrt(dx * dx + dy * dy + dz * dz);
}

public Vec3 getCenter() {
return new Vec3(x + 0.5, y + 0.5, z + 0.5);
}

@Override
@Nonnull
public String toString() {
Expand Down
13 changes: 7 additions & 6 deletions src/api/java/baritone/api/utils/BlockOptionalMeta.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
import net.minecraft.server.RegistryLayer;
import net.minecraft.server.ReloadableServerRegistries;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.packs.PackResources;
import net.minecraft.server.packs.PackType;
import net.minecraft.server.packs.VanillaPackResources;
import net.minecraft.server.packs.repository.ServerPacksSource;
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 +262,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 @@ -303,7 +303,7 @@ public static CompletableFuture<RegistryAccess> load() {
// Simplified from {@link net.minecraft.server.WorldLoader#load()}
CloseableResourceManager closeableResourceManager = new MultiPackResourceManager(
PackType.SERVER_DATA,
List.of(ServerPacksSource.createVanillaPackSource())
List.of(ServerPacksSource.createVanillaPackSource().fullResources())
);
LayeredRegistryAccess<RegistryLayer> baseLayeredRegistry = RegistryLayer.createRegistryAccess();
List<Registry.PendingTags<?>> pendingTags = TagLoader.loadTagsForExistingRegistries(
Expand All @@ -318,8 +318,9 @@ public static CompletableFuture<RegistryAccess> load() {
RegistryDataLoader.load(
closeableResourceManager,
worldGenRegistryLookupList,
RegistryDataLoader.WORLDGEN_REGISTRIES
)
RegistryDataLoader.WORLDGEN_REGISTRIES,
ForkJoinPool.commonPool()
).join()
);
return ReloadableServerRegistries.reload(
layeredRegistryAccess,
Expand Down
2 changes: 1 addition & 1 deletion src/api/java/baritone/api/utils/Helper.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import baritone.api.BaritoneAPI;
import baritone.api.Settings;
import net.minecraft.ChatFormatting;
import net.minecraft.client.GuiMessageTag;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.chat.GuiMessageTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;

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 type, Player player);

GameType getGameType();

Expand Down
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);
}
}
28 changes: 28 additions & 0 deletions src/api/java/net/minecraft/util/Tuple.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package net.minecraft.util;

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;
}
}
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
package baritone.launch.mixins;

import baritone.utils.accessor.IFireworkRocketEntity;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.resources.Identifier;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
Expand All @@ -43,8 +45,9 @@ public abstract class MixinFireworkRocketEntity extends Entity implements IFirew
@Shadow
public abstract boolean isAttachedToEntity();

@SuppressWarnings("unchecked")
private MixinFireworkRocketEntity(Level level) {
super(EntityType.FIREWORK_ROCKET, level);
super((EntityType<? extends Entity>) BuiltInRegistries.ENTITY_TYPE.getValue(Identifier.withDefaultNamespace("firework_rocket")), level);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/launch/java/baritone/launch/mixins/MixinMinecraft.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ private Screen passEvents(Minecraft instance) {
if (BaritoneAPI.getProvider().getPrimaryBaritone().getPathingBehavior().isPathing() && player != null) {
return null;
}
return instance.screen;
return instance.gui.screen();
}

// TODO
Expand Down
12 changes: 7 additions & 5 deletions src/launch/java/baritone/launch/mixins/MixinWorldRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
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.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 @@ -41,14 +42,15 @@
public class MixinWorldRenderer {

@Inject(
method = "renderLevel",
method = "render",
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 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));
}
}
}
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
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