Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7487b90d50 | ||
|
|
09554ab39d | ||
|
|
2ae7bc6a64 | ||
|
|
6979bd6971 | ||
|
|
b2bd025896 | ||
|
|
666a890088 | ||
|
|
b389b573e5 | ||
|
|
eb28298983 | ||
|
|
336b2c2798 | ||
|
|
63d0064d69 | ||
|
|
43eb4e3581 |
@@ -126,8 +126,7 @@ jar {
|
||||
}
|
||||
|
||||
remapJar {
|
||||
targetNamespace = "named"
|
||||
fallbackTargetNamespace = "intermediary"
|
||||
target = "mojmap"
|
||||
}
|
||||
|
||||
javadoc {
|
||||
|
||||
@@ -36,5 +36,5 @@ dependencies {
|
||||
implementation group: 'com.google.code.gson', name: 'gson', version: '2.9.0'
|
||||
implementation group: 'commons-io', name: 'commons-io', version: '2.6'
|
||||
|
||||
implementation group: 'xyz.wagyourtail.unimined', name: 'xyz.wagyourtail.unimined.gradle.plugin', version: '0.3.4'
|
||||
implementation group: 'xyz.wagyourtail.unimined', name: 'xyz.wagyourtail.unimined.gradle.plugin', version: '0.4.10'
|
||||
}
|
||||
@@ -81,7 +81,7 @@ public class ProguardTask extends BaritoneGradleTask {
|
||||
MinecraftProvider<?, ?> provider = this.getProject().getExtensions().getByType(MinecraftProvider.class);
|
||||
|
||||
private File getMcJar() {
|
||||
return provider.getMinecraftWithMapping(EnvType.COMBINED, provider.getMcPatcher().getProdNamespace(), provider.getMcPatcher().getProdFallbackNamespace()).toFile();
|
||||
return provider.getMinecraftWithMapping(EnvType.COMBINED, provider.getMcPatcher().getProdNamespace(), provider.getMcPatcher().getProdNamespace()).toFile();
|
||||
}
|
||||
|
||||
private boolean isMcJar(File f) {
|
||||
|
||||
@@ -26,6 +26,6 @@
|
||||
|
||||
"depends": {
|
||||
"fabricloader": ">=0.11.0",
|
||||
"minecraft": "1.19.4"
|
||||
"minecraft": ">=1.20 <=1.20.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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="[33,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
|
||||
loaderVersion="[46,)" #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
|
||||
@@ -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.19.4]"
|
||||
versionRange="[1.20,1.20.1]"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
org.gradle.jvmargs=-Xmx4G
|
||||
|
||||
mod_version=1.9.3
|
||||
available_loaders=fabric,forge,tweaker
|
||||
|
||||
mod_version=1.10.1
|
||||
maven_group=baritone
|
||||
archives_base_name=baritone
|
||||
|
||||
minecraft_version=1.19.4
|
||||
forge_version=1.19.4-45.0.43
|
||||
fabric_version=0.14.11
|
||||
minecraft_version=1.20.1
|
||||
forge_version=1.20.1-47.0.1
|
||||
fabric_version=0.14.18
|
||||
|
||||
@@ -42,9 +42,6 @@ pluginManagement {
|
||||
rootProject.name = 'baritone'
|
||||
|
||||
include("tweaker")
|
||||
if (System.getProperty("Baritone.enabled_platforms") == null) {
|
||||
System.setProperty("Baritone.enabled_platforms", "fabric,forge")
|
||||
}
|
||||
for (platform in System.getProperty("Baritone.enabled_platforms").split(",")) {
|
||||
for (platform in available_loaders.split(",")) {
|
||||
include(platform)
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import net.minecraft.server.packs.resources.MultiPackResourceManager;
|
||||
import net.minecraft.server.packs.resources.ReloadableResourceManager;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.util.Unit;
|
||||
import net.minecraft.world.RandomSequences;
|
||||
import net.minecraft.world.flag.FeatureFlagSet;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
@@ -45,14 +46,15 @@ import net.minecraft.world.level.storage.LevelStorageSource;
|
||||
import net.minecraft.world.level.storage.ServerLevelData;
|
||||
import net.minecraft.world.level.storage.loot.BuiltInLootTables;
|
||||
import net.minecraft.world.level.storage.loot.LootContext;
|
||||
import net.minecraft.world.level.storage.loot.LootTables;
|
||||
import net.minecraft.world.level.storage.loot.PredicateManager;
|
||||
import net.minecraft.world.level.storage.loot.LootDataManager;
|
||||
import net.minecraft.world.level.storage.loot.LootParams;
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import sun.misc.Unsafe;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
@@ -69,8 +71,7 @@ public final class BlockOptionalMeta {
|
||||
private final ImmutableSet<Integer> stateHashes;
|
||||
private final ImmutableSet<Integer> stackHashes;
|
||||
private static final Pattern pattern = Pattern.compile("^(.+?)(?::(\\d+))?$");
|
||||
private static LootTables lootTables;
|
||||
private static PredicateManager predicate = new PredicateManager();
|
||||
private static LootDataManager lootTables;
|
||||
private static Map<Block, List<Item>> drops = new HashMap<>();
|
||||
|
||||
public BlockOptionalMeta(@Nonnull Block block) {
|
||||
@@ -172,11 +173,11 @@ public final class BlockOptionalMeta {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static LootTables getManager() {
|
||||
public static LootDataManager getManager() {
|
||||
if (lootTables == null) {
|
||||
MultiPackResourceManager resources = new MultiPackResourceManager(PackType.SERVER_DATA, List.of(getVanillaServerPack()));
|
||||
ReloadableResourceManager resourceManager = new ReloadableResourceManager(PackType.SERVER_DATA);
|
||||
lootTables = new LootTables(predicate);
|
||||
lootTables = new LootDataManager();
|
||||
resourceManager.registerReloadListener(lootTables);
|
||||
try {
|
||||
resourceManager.createReload(new ThreadPerTaskExecutor(Thread::new), new ThreadPerTaskExecutor(Thread::new), CompletableFuture.completedFuture(Unit.INSTANCE), resources.listPacks().toList()).done().get();
|
||||
@@ -188,10 +189,6 @@ public final class BlockOptionalMeta {
|
||||
return lootTables;
|
||||
}
|
||||
|
||||
public static PredicateManager getPredicateManager() {
|
||||
return predicate;
|
||||
}
|
||||
|
||||
private static synchronized List<Item> drops(Block b) {
|
||||
return drops.computeIfAbsent(b, block -> {
|
||||
ResourceLocation lootTableLocation = block.getLootTable();
|
||||
@@ -200,14 +197,17 @@ public final class BlockOptionalMeta {
|
||||
} else {
|
||||
List<Item> items = new ArrayList<>();
|
||||
try {
|
||||
getManager().get(lootTableLocation).getRandomItems(
|
||||
new LootContext.Builder(ServerLevelStub.fastCreate())
|
||||
.withRandom(RandomSource.create())
|
||||
.withParameter(LootContextParams.ORIGIN, Vec3.atLowerCornerOf(BlockPos.ZERO))
|
||||
.withParameter(LootContextParams.TOOL, ItemStack.EMPTY)
|
||||
.withOptionalParameter(LootContextParams.BLOCK_ENTITY, null)
|
||||
.withParameter(LootContextParams.BLOCK_STATE, block.defaultBlockState())
|
||||
.create(LootContextParamSets.BLOCK),
|
||||
|
||||
getManager().getLootTable(lootTableLocation).getRandomItemsRaw(
|
||||
new LootContext.Builder(
|
||||
new LootParams.Builder(ServerLevelStub.fastCreate())
|
||||
.withParameter(LootContextParams.ORIGIN, Vec3.atLowerCornerOf(BlockPos.ZERO))
|
||||
.withParameter(LootContextParams.TOOL, ItemStack.EMPTY)
|
||||
.withOptionalParameter(LootContextParams.BLOCK_ENTITY, null)
|
||||
.withParameter(LootContextParams.BLOCK_STATE, block.defaultBlockState())
|
||||
.create(LootContextParamSets.BLOCK)
|
||||
).withOptionalRandomSeed(1L)
|
||||
.create(null),
|
||||
stack -> items.add(stack.getItem())
|
||||
);
|
||||
} catch (Exception e) {
|
||||
@@ -221,8 +221,9 @@ public final class BlockOptionalMeta {
|
||||
private static class ServerLevelStub extends ServerLevel {
|
||||
private static Minecraft client = Minecraft.getInstance();
|
||||
private static Unsafe unsafe = getUnsafe();
|
||||
public ServerLevelStub(MinecraftServer $$0, Executor $$1, LevelStorageSource.LevelStorageAccess $$2, ServerLevelData $$3, ResourceKey<Level> $$4, LevelStem $$5, ChunkProgressListener $$6, boolean $$7, long $$8, List<CustomSpawner> $$9, boolean $$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, ChunkProgressListener $$6, boolean $$7, long $$8, List<CustomSpawner> $$9, boolean $$10, @Nullable RandomSequences $$11) {
|
||||
super($$0, $$1, $$2, $$3, $$4, $$5, $$6, $$7, $$8, $$9, $$10, $$11);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -57,7 +57,7 @@ public final class RayTraceUtils {
|
||||
direction.y * blockReachDistance,
|
||||
direction.z * blockReachDistance
|
||||
);
|
||||
return entity.level.clip(new ClipContext(start, end, ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, entity));
|
||||
return entity.level().clip(new ClipContext(start, end, ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, entity));
|
||||
}
|
||||
|
||||
public static Vec3 inferSneakingEyePosition(Entity entity) {
|
||||
|
||||
@@ -196,8 +196,8 @@ public final class RotationUtils {
|
||||
return possibleRotation;
|
||||
}
|
||||
|
||||
BlockState state = entity.level.getBlockState(pos);
|
||||
VoxelShape shape = state.getShape(entity.level, pos);
|
||||
BlockState state = entity.level().getBlockState(pos);
|
||||
VoxelShape shape = state.getShape(entity.level(), pos);
|
||||
if (shape.isEmpty()) {
|
||||
shape = Shapes.block();
|
||||
}
|
||||
@@ -233,7 +233,7 @@ public final class RotationUtils {
|
||||
if (((BlockHitResult) result).getBlockPos().equals(pos)) {
|
||||
return Optional.of(rotation);
|
||||
}
|
||||
if (entity.level.getBlockState(pos).getBlock() instanceof BaseFireBlock && ((BlockHitResult) result).getBlockPos().equals(pos.below())) {
|
||||
if (entity.level().getBlockState(pos).getBlock() instanceof BaseFireBlock && ((BlockHitResult) result).getBlockPos().equals(pos.below())) {
|
||||
return Optional.of(rotation);
|
||||
}
|
||||
}
|
||||
@@ -250,6 +250,6 @@ public final class RotationUtils {
|
||||
* @return The optional rotation
|
||||
*/
|
||||
public static Optional<Rotation> reachableCenter(Entity entity, BlockPos pos, double blockReachDistance, boolean wouldSneak) {
|
||||
return reachableOffset(entity, pos, VecUtils.calculateBlockCenter(entity.level, pos), blockReachDistance, wouldSneak);
|
||||
return reachableOffset(entity, pos, VecUtils.calculateBlockCenter(entity.level(), pos), blockReachDistance, wouldSneak);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ package baritone.api.utils.gui;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.components.toasts.Toast;
|
||||
import net.minecraft.client.gui.components.toasts.ToastComponent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
@@ -38,7 +39,7 @@ public class BaritoneToast implements Toast {
|
||||
this.totalShowTime = totalShowTime;
|
||||
}
|
||||
|
||||
public Visibility render(PoseStack matrixStack, ToastComponent toastGui, long delta) {
|
||||
public Visibility render(GuiGraphics gui, ToastComponent toastGui, long delta) {
|
||||
if (this.newDisplay) {
|
||||
this.firstDrawTime = delta;
|
||||
this.newDisplay = false;
|
||||
@@ -46,15 +47,13 @@ public class BaritoneToast implements Toast {
|
||||
|
||||
|
||||
//TODO: check
|
||||
toastGui.getMinecraft().getTextureManager().bindForSetup(new ResourceLocation("textures/gui/toasts.png"));
|
||||
//GlStateManager._color4f(1.0F, 1.0F, 1.0F, 255.0F);
|
||||
toastGui.blit(matrixStack, 0, 0, 0, 32, 160, 32);
|
||||
gui.blit(new ResourceLocation("textures/gui/toasts.png"), 0, 0, 0, 32, 160, 32);
|
||||
|
||||
if (this.subtitle == null) {
|
||||
toastGui.getMinecraft().font.draw(matrixStack, this.title, 18, 12, -11534256);
|
||||
gui.drawString(toastGui.getMinecraft().font, this.title, 18, 12, -11534256);
|
||||
} else {
|
||||
toastGui.getMinecraft().font.draw(matrixStack, this.title, 18, 7, -11534256);
|
||||
toastGui.getMinecraft().font.draw(matrixStack, this.subtitle, 18, 18, -16777216);
|
||||
gui.drawString(toastGui.getMinecraft().font, this.title, 18, 7, -11534256);
|
||||
gui.drawString(toastGui.getMinecraft().font, this.subtitle, 18, 18, -16777216);
|
||||
}
|
||||
|
||||
return delta - this.firstDrawTime < totalShowTime ? Visibility.SHOW : Visibility.HIDE;
|
||||
|
||||
@@ -21,8 +21,7 @@ import baritone.api.utils.BlockOptionalMeta;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.level.storage.loot.LootContext;
|
||||
import net.minecraft.world.level.storage.loot.LootTables;
|
||||
import net.minecraft.world.level.storage.loot.PredicateManager;
|
||||
import net.minecraft.world.level.storage.loot.LootDataManager;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
@@ -48,27 +47,13 @@ public class MixinLootContext {
|
||||
method = "create",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/server/MinecraftServer;getLootTables()Lnet/minecraft/world/level/storage/loot/LootTables;"
|
||||
target = "Lnet/minecraft/server/MinecraftServer;getLootData()Lnet/minecraft/world/level/storage/loot/LootDataManager;"
|
||||
)
|
||||
)
|
||||
private LootTables getLootTableManager(MinecraftServer server) {
|
||||
private LootDataManager getLootTableManager(MinecraftServer server) {
|
||||
if (server == null) {
|
||||
return BlockOptionalMeta.getManager();
|
||||
}
|
||||
return server.getLootTables();
|
||||
}
|
||||
|
||||
@Redirect(
|
||||
method = "create",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/server/MinecraftServer;getPredicateManager()Lnet/minecraft/world/level/storage/loot/PredicateManager;"
|
||||
)
|
||||
)
|
||||
private PredicateManager getLootPredicateManager(MinecraftServer server) {
|
||||
if (server == null) {
|
||||
return BlockOptionalMeta.getPredicateManager();
|
||||
}
|
||||
return server.getPredicateManager();
|
||||
return server.getLootData();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.Slice;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
@@ -123,12 +124,26 @@ public class MixinMinecraft {
|
||||
at = @At(
|
||||
value = "FIELD",
|
||||
opcode = Opcodes.GETFIELD,
|
||||
target = "Lnet/minecraft/client/gui/screens/Screen;passEvents:Z"
|
||||
target = "Lnet/minecraft/client/Minecraft;screen:Lnet/minecraft/client/gui/screens/Screen;"
|
||||
),
|
||||
slice = @Slice(
|
||||
from = @At(
|
||||
value = "FIELD",
|
||||
opcode = Opcodes.GETFIELD,
|
||||
target = "Lnet/minecraft/client/Options;renderDebug:Z"
|
||||
),
|
||||
to = @At(
|
||||
value = "CONSTANT",
|
||||
args = "stringValue=Keybindings"
|
||||
)
|
||||
)
|
||||
)
|
||||
private boolean passEvents(Screen screen) {
|
||||
private Screen passEvents(Minecraft instance) {
|
||||
// allow user input is only the primary baritone
|
||||
return (BaritoneAPI.getProvider().getPrimaryBaritone().getPathingBehavior().isPathing() && player != null) || screen.passEvents;
|
||||
if (BaritoneAPI.getProvider().getPrimaryBaritone().getPathingBehavior().isPathing() && player != null) {
|
||||
return null;
|
||||
}
|
||||
return instance.screen;
|
||||
}
|
||||
|
||||
// TODO
|
||||
|
||||
@@ -419,7 +419,7 @@ public final class PathingBehavior extends Behavior implements IPathingBehavior,
|
||||
public BetterBlockPos pathStart() { // TODO move to a helper or util class
|
||||
BetterBlockPos feet = ctx.playerFeet();
|
||||
if (!MovementHelper.canWalkOn(ctx, feet.below())) {
|
||||
if (ctx.player().isOnGround()) {
|
||||
if (ctx.player().onGround()) {
|
||||
double playerX = ctx.player().position().x;
|
||||
double playerZ = ctx.player().position().z;
|
||||
ArrayList<BetterBlockPos> closest = new ArrayList<>();
|
||||
|
||||
@@ -43,7 +43,6 @@ import net.minecraft.world.level.material.FlowingFluid;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.level.material.WaterFluid;
|
||||
import net.minecraft.world.level.pathfinder.PathComputationType;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
@@ -327,7 +326,7 @@ public interface MovementHelper extends ActionCosts, Helper {
|
||||
if (block == Blocks.LARGE_FERN || block == Blocks.TALL_GRASS) {
|
||||
return true;
|
||||
}
|
||||
return state.getMaterial().isReplaceable();
|
||||
return state.canBeReplaced();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@@ -511,14 +510,14 @@ public interface MovementHelper extends ActionCosts, Helper {
|
||||
|
||||
static boolean canUseFrostWalker(CalculationContext context, BlockState state) {
|
||||
return context.frostWalker != 0
|
||||
&& state.getMaterial() == Material.WATER
|
||||
&& state == FrostedIceBlock.meltsInto()
|
||||
&& ((Integer) state.getValue(LiquidBlock.LEVEL)) == 0;
|
||||
}
|
||||
|
||||
static boolean canUseFrostWalker(IPlayerContext ctx, BlockPos pos) {
|
||||
BlockState state = BlockStateInterface.get(ctx, pos);
|
||||
return EnchantmentHelper.hasFrostWalker(ctx.player())
|
||||
&& state.getMaterial() == Material.WATER
|
||||
&& state == FrostedIceBlock.meltsInto()
|
||||
&& ((Integer) state.getValue(LiquidBlock.LEVEL)) == 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ public class MovementFall extends Movement {
|
||||
return state.setStatus(MovementStatus.UNREACHABLE);
|
||||
}
|
||||
|
||||
if (ctx.player().position().y - dest.getY() < ctx.playerController().getBlockReachDistance() && !ctx.player().isOnGround()) {
|
||||
if (ctx.player().position().y - dest.getY() < ctx.playerController().getBlockReachDistance() && !ctx.player().onGround()) {
|
||||
ctx.player().getInventory().selected = ctx.player().getInventory().findSlotMatchingItem(STACK_BUCKET_WATER);
|
||||
|
||||
targetRotation = new Rotation(toDest.getYaw(), 90.0F);
|
||||
@@ -135,7 +135,7 @@ public class MovementFall extends Movement {
|
||||
}
|
||||
Vec3 destCenter = VecUtils.getBlockPosCenter(dest); // we are moving to the 0.5 center not the edge (like if we were falling on a ladder)
|
||||
if (Math.abs(ctx.player().position().x + ctx.player().getDeltaMovement().x - destCenter.x) > 0.1 || Math.abs(ctx.player().position().z + ctx.player().getDeltaMovement().z - destCenter.z) > 0.1) {
|
||||
if (!ctx.player().isOnGround() && Math.abs(ctx.player().getDeltaMovement().y) > 0.4) {
|
||||
if (!ctx.player().onGround() && Math.abs(ctx.player().getDeltaMovement().y) > 0.4) {
|
||||
state.setInput(Input.SNEAK, true);
|
||||
}
|
||||
state.setInput(Input.MOVE_FORWARD, true);
|
||||
@@ -147,7 +147,7 @@ public class MovementFall extends Movement {
|
||||
double dist = Math.abs(avoid.getX() * (destCenter.x - avoid.getX() / 2.0 - ctx.player().position().x)) + Math.abs(avoid.getZ() * (destCenter.z - avoid.getZ() / 2.0 - ctx.player().position().z));
|
||||
if (dist < 0.6) {
|
||||
state.setInput(Input.MOVE_FORWARD, true);
|
||||
} else if (!ctx.player().isOnGround()) {
|
||||
} else if (!ctx.player().onGround()) {
|
||||
state.setInput(Input.SNEAK, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ public class MovementParkour extends Movement {
|
||||
if (Baritone.settings().allowPlace.value // see PR #3775
|
||||
&& ((Baritone) baritone).getInventoryBehavior().hasGenericThrowaway()
|
||||
&& !MovementHelper.canWalkOn(ctx, dest.below())
|
||||
&& !ctx.player().isOnGround()
|
||||
&& !ctx.player().onGround()
|
||||
&& MovementHelper.attemptToPlaceABlock(state, baritone, dest.below(), true, false) == PlaceResult.READY_TO_PLACE
|
||||
) {
|
||||
// go in the opposite order to check DOWN before all horizontals -- down is preferable because you don't have to look to the side while in midair, which could mess up the trajectory
|
||||
|
||||
@@ -256,7 +256,7 @@ public class MovementPillar extends Movement {
|
||||
BlockState frState = BlockStateInterface.get(ctx, src);
|
||||
Block fr = frState.getBlock();
|
||||
// TODO: Evaluate usage of getMaterial().isReplaceable()
|
||||
if (!(fr instanceof AirBlock || frState.getMaterial().isReplaceable())) {
|
||||
if (!(fr instanceof AirBlock || frState.canBeReplaced())) {
|
||||
RotationUtils.reachable(ctx.player(), src, ctx.playerController().getBlockReachDistance())
|
||||
.map(rot -> new MovementState.MovementTarget(rot, true))
|
||||
.ifPresent(state::setTarget);
|
||||
|
||||
@@ -261,7 +261,7 @@ public class MovementTraverse extends Movement {
|
||||
}
|
||||
Block low = BlockStateInterface.get(ctx, src).getBlock();
|
||||
Block high = BlockStateInterface.get(ctx, src.above()).getBlock();
|
||||
if (ctx.player().position().y > src.y + 0.1D && !ctx.player().isOnGround() && (low == Blocks.VINE || low == Blocks.LADDER || high == Blocks.VINE || high == Blocks.LADDER)) {
|
||||
if (ctx.player().position().y > src.y + 0.1D && !ctx.player().onGround() && (low == Blocks.VINE || low == Blocks.LADDER || high == Blocks.VINE || high == Blocks.LADDER)) {
|
||||
// hitting W could cause us to climb the ladder instead of going forward
|
||||
// wait until we're on the ground
|
||||
return state;
|
||||
|
||||
@@ -272,7 +272,7 @@ public class PathExecutor implements IPathExecutor, Helper {
|
||||
if (!current.isPresent()) {
|
||||
return false;
|
||||
}
|
||||
if (!ctx.player().isOnGround()) {
|
||||
if (!ctx.player().onGround()) {
|
||||
return false;
|
||||
}
|
||||
if (!MovementHelper.canWalkOn(ctx, ctx.playerFeet().below())) {
|
||||
@@ -321,7 +321,7 @@ public class PathExecutor implements IPathExecutor, Helper {
|
||||
* @return Whether or not it was possible to snap to the current player feet
|
||||
*/
|
||||
public boolean snipsnapifpossible() {
|
||||
if (!ctx.player().isOnGround() && ctx.world().getFluidState(ctx.playerFeet()).isEmpty()) {
|
||||
if (!ctx.player().onGround() && ctx.world().getFluidState(ctx.playerFeet()).isEmpty()) {
|
||||
// if we're falling in the air, and not in water, don't splice
|
||||
return false;
|
||||
} else {
|
||||
|
||||
@@ -525,7 +525,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
|
||||
}
|
||||
|
||||
Optional<Tuple<BetterBlockPos, Rotation>> toBreak = toBreakNearPlayer(bcc);
|
||||
if (toBreak.isPresent() && isSafeToCancel && ctx.player().isOnGround()) {
|
||||
if (toBreak.isPresent() && isSafeToCancel && ctx.player().onGround()) {
|
||||
// we'd like to pause to break this block
|
||||
// only change look direction if it's safe (don't want to fuck up an in progress parkour for example
|
||||
Rotation rot = toBreak.get().getB();
|
||||
@@ -545,7 +545,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
|
||||
}
|
||||
List<BlockState> desirableOnHotbar = new ArrayList<>();
|
||||
Optional<Placement> toPlace = searchForPlacables(bcc, desirableOnHotbar);
|
||||
if (toPlace.isPresent() && isSafeToCancel && ctx.player().isOnGround() && ticks <= 0) {
|
||||
if (toPlace.isPresent() && isSafeToCancel && ctx.player().onGround() && ticks <= 0) {
|
||||
Rotation rot = toPlace.get().rot;
|
||||
baritone.getLookBehavior().updateTarget(rot, true);
|
||||
ctx.player().getInventory().selected = toPlace.get().hotbarSelection;
|
||||
|
||||
@@ -303,7 +303,7 @@ public final class FarmProcess extends BaritoneProcessHelper implements IFarmPro
|
||||
}
|
||||
}
|
||||
for (Entity entity : ctx.entities()) {
|
||||
if (entity instanceof ItemEntity && entity.isOnGround()) {
|
||||
if (entity instanceof ItemEntity && entity.onGround()) {
|
||||
ItemEntity ei = (ItemEntity) entity;
|
||||
if (PICKUP_DROPPED.contains(ei.getItem().getItem())) {
|
||||
// +0.1 because of farmland's 0.9375 dummy height lol
|
||||
|
||||
@@ -123,7 +123,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro
|
||||
.filter(pos -> !(BlockStateInterface.get(ctx, pos).getBlock() instanceof AirBlock)) // after breaking a block, it takes mineGoalUpdateInterval ticks for it to actually update this list =(
|
||||
.min(Comparator.comparingDouble(ctx.playerFeet()::distSqr));
|
||||
baritone.getInputOverrideHandler().clearAllKeys();
|
||||
if (shaft.isPresent() && ctx.player().isOnGround()) {
|
||||
if (shaft.isPresent() && ctx.player().onGround()) {
|
||||
BlockPos pos = shaft.get();
|
||||
BlockState state = baritone.bsi.get0(pos);
|
||||
if (!MovementHelper.avoidBreaking(baritone.bsi, pos.getX(), pos.getY(), pos.getZ(), state)) {
|
||||
|
||||
@@ -25,6 +25,7 @@ import baritone.api.utils.Helper;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
@@ -64,7 +65,7 @@ public class GuiClick extends Screen implements Helper {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack stack, int mouseX, int mouseY, float partialTicks) {
|
||||
public void render(GuiGraphics stack, int mouseX, int mouseY, float partialTicks) {
|
||||
double mx = mc.mouseHandler.xpos();
|
||||
double my = mc.mouseHandler.ypos();
|
||||
|
||||
@@ -78,7 +79,7 @@ public class GuiClick extends Screen implements Helper {
|
||||
///
|
||||
Vec3 viewerPos = new Vec3(PathRenderer.posX(), PathRenderer.posY(), PathRenderer.posZ());
|
||||
LocalPlayer player = BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext().player();
|
||||
HitResult result = player.level.clip(new ClipContext(near.add(viewerPos), far.add(viewerPos), ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, player));
|
||||
HitResult result = player.level().clip(new ClipContext(near.add(viewerPos), far.add(viewerPos), ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, player));
|
||||
if (result != null && result.getType() == HitResult.Type.BLOCK) {
|
||||
currentMouseOver = ((BlockHitResult) result).getBlockPos();
|
||||
System.out.println("currentMouseOver = " + currentMouseOver);
|
||||
|
||||
@@ -88,7 +88,7 @@ public final class PathRenderer implements IRenderer, Helper {
|
||||
|
||||
Entity renderView = Helper.mc.getCameraEntity();
|
||||
|
||||
if (renderView.level != BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext().world()) {
|
||||
if (renderView.level() != BaritoneAPI.getProvider().getPrimaryBaritone().getPlayerContext().world()) {
|
||||
System.out.println("I have no idea what's going on");
|
||||
System.out.println("The primary baritone is in a different world than the render view entity");
|
||||
System.out.println("Not rendering the path");
|
||||
@@ -209,7 +209,7 @@ public final class PathRenderer implements IRenderer, Helper {
|
||||
|
||||
positions.forEach(pos -> {
|
||||
BlockState state = bsi.get0(pos);
|
||||
VoxelShape shape = state.getShape(player.level, pos);
|
||||
VoxelShape shape = state.getShape(player.level(), pos);
|
||||
AABB toDraw = shape.isEmpty() ? Shapes.block().bounds() : shape.bounds();
|
||||
toDraw = toDraw.move(pos);
|
||||
IRenderer.drawAABB(stack, toDraw, .002D);
|
||||
@@ -272,7 +272,7 @@ public final class PathRenderer implements IRenderer, Helper {
|
||||
TEXTURE_BEACON_BEAM,
|
||||
settings.renderGoalAnimated.value ? partialTicks : 0,
|
||||
1.0F,
|
||||
settings.renderGoalAnimated.value ? player.level.getGameTime() : 0,
|
||||
settings.renderGoalAnimated.value ? player.level().getGameTime() : 0,
|
||||
0,
|
||||
256,
|
||||
color.getColorComponents(null),
|
||||
|
||||
@@ -47,7 +47,6 @@ dependencies {
|
||||
implementation "org.ow2.asm:asm-util:9.3"
|
||||
implementation "org.ow2.asm:asm-analysis:9.3"
|
||||
|
||||
|
||||
implementation 'com.github.ImpactDevelopment:SimpleTweaker:1.2'
|
||||
implementation('net.minecraft:launchwrapper:of-2.3') {
|
||||
exclude module: 'lwjgl'
|
||||
|
||||
Reference in New Issue
Block a user