Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
647daf23aa | ||
|
|
01379f5474 |
@@ -38,7 +38,7 @@ allprojects {
|
||||
group = rootProject.maven_group
|
||||
|
||||
sourceCompatibility = targetCompatibility = JavaVersion.toVersion(project.java_version)
|
||||
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(sourceCompatibility.majorVersion.toInteger()))
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
"depends": {
|
||||
"fabricloader": ">=0.11.0",
|
||||
"minecraft": ">=1.20 <=1.20.1"
|
||||
"minecraft": "1.19.4"
|
||||
},
|
||||
"custom": {
|
||||
"modmenu": {
|
||||
|
||||
@@ -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="[46,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
|
||||
loaderVersion="[33,)" #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.20,1.20.1]"
|
||||
versionRange="[1.19.4]"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
org.gradle.jvmargs=-Xmx4G
|
||||
|
||||
available_loaders=fabric,forge,tweaker
|
||||
|
||||
mod_version=1.10.3
|
||||
mod_version=1.9.5
|
||||
maven_group=baritone
|
||||
archives_base_name=baritone
|
||||
|
||||
java_version=17
|
||||
|
||||
minecraft_version=1.20.1
|
||||
minecraft_version=1.19.4
|
||||
|
||||
forge_version=47.0.1
|
||||
forge_version=45.0.43
|
||||
|
||||
fabric_version=0.14.18
|
||||
fabric_version=0.14.11
|
||||
|
||||
nether_pathfinder_version=1.4.1
|
||||
|
||||
|
||||
@@ -42,6 +42,9 @@ pluginManagement {
|
||||
rootProject.name = 'baritone'
|
||||
|
||||
include("tweaker")
|
||||
for (platform in available_loaders.split(",")) {
|
||||
if (System.getProperty("Baritone.enabled_platforms") == null) {
|
||||
System.setProperty("Baritone.enabled_platforms", "fabric,forge")
|
||||
}
|
||||
for (platform in System.getProperty("Baritone.enabled_platforms").split(",")) {
|
||||
include(platform)
|
||||
}
|
||||
|
||||
@@ -28,13 +28,12 @@ import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.progress.ChunkProgressListener;
|
||||
import net.minecraft.server.packs.PackType;
|
||||
import net.minecraft.server.packs.VanillaPackResources;
|
||||
import net.minecraft.server.packs.*;
|
||||
import net.minecraft.server.packs.repository.ServerPacksSource;
|
||||
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;
|
||||
@@ -48,18 +47,24 @@ 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.LootDataManager;
|
||||
import net.minecraft.world.level.storage.loot.LootParams;
|
||||
import net.minecraft.world.level.storage.loot.LootTables;
|
||||
import net.minecraft.world.level.storage.loot.PredicateManager;
|
||||
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.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.regex.Matcher;
|
||||
@@ -73,9 +78,10 @@ public final class BlockOptionalMeta {
|
||||
private final Block block;
|
||||
private final String propertiesDescription; // exists so toString() can return something more useful than a list of all blockstates
|
||||
private final Set<BlockState> blockstates;
|
||||
private final ImmutableSet<Integer> stateHashes;
|
||||
private final ImmutableSet<Integer> stackHashes;
|
||||
private static LootDataManager lootTables;
|
||||
private final Set<Integer> stateHashes;
|
||||
private final Set<Integer> stackHashes;
|
||||
private static LootTables lootTables;
|
||||
private static PredicateManager predicate = new PredicateManager();
|
||||
private static Map<Block, List<Item>> drops = new HashMap<>();
|
||||
|
||||
public BlockOptionalMeta(@Nonnull Block block) {
|
||||
@@ -218,11 +224,11 @@ public final class BlockOptionalMeta {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static LootDataManager getManager() {
|
||||
public static LootTables getManager() {
|
||||
if (lootTables == null) {
|
||||
MultiPackResourceManager resources = new MultiPackResourceManager(PackType.SERVER_DATA, List.of(getVanillaServerPack()));
|
||||
ReloadableResourceManager resourceManager = new ReloadableResourceManager(PackType.SERVER_DATA);
|
||||
lootTables = new LootDataManager();
|
||||
lootTables = new LootTables(predicate);
|
||||
resourceManager.registerReloadListener(lootTables);
|
||||
try {
|
||||
resourceManager.createReload(new ThreadPerTaskExecutor(Thread::new), new ThreadPerTaskExecutor(Thread::new), CompletableFuture.completedFuture(Unit.INSTANCE), resources.listPacks().toList()).done().get();
|
||||
@@ -234,6 +240,10 @@ 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();
|
||||
@@ -242,18 +252,15 @@ public final class BlockOptionalMeta {
|
||||
} else {
|
||||
List<Item> items = new ArrayList<>();
|
||||
try {
|
||||
|
||||
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())
|
||||
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),
|
||||
stack -> items.add(stack.getItem())
|
||||
);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -266,9 +273,8 @@ 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, @Nullable RandomSequences $$11) {
|
||||
super($$0, $$1, $$2, $$3, $$4, $$5, $$6, $$7, $$8, $$9, $$10, $$11);
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -59,7 +59,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) {
|
||||
|
||||
@@ -283,7 +283,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);
|
||||
}
|
||||
}
|
||||
@@ -292,6 +292,6 @@ public final class RotationUtils {
|
||||
|
||||
@Deprecated
|
||||
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,7 +20,6 @@ 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;
|
||||
@@ -39,7 +38,7 @@ public class BaritoneToast implements Toast {
|
||||
this.totalShowTime = totalShowTime;
|
||||
}
|
||||
|
||||
public Visibility render(GuiGraphics gui, ToastComponent toastGui, long delta) {
|
||||
public Visibility render(PoseStack matrixStack, ToastComponent toastGui, long delta) {
|
||||
if (this.newDisplay) {
|
||||
this.firstDrawTime = delta;
|
||||
this.newDisplay = false;
|
||||
@@ -47,13 +46,15 @@ public class BaritoneToast implements Toast {
|
||||
|
||||
|
||||
//TODO: check
|
||||
gui.blit(new ResourceLocation("textures/gui/toasts.png"), 0, 0, 0, 32, 160, 32);
|
||||
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);
|
||||
|
||||
if (this.subtitle == null) {
|
||||
gui.drawString(toastGui.getMinecraft().font, this.title, 18, 12, -11534256);
|
||||
toastGui.getMinecraft().font.draw(matrixStack, this.title, 18, 12, -11534256);
|
||||
} else {
|
||||
gui.drawString(toastGui.getMinecraft().font, this.title, 18, 7, -11534256);
|
||||
gui.drawString(toastGui.getMinecraft().font, this.subtitle, 18, 18, -16777216);
|
||||
toastGui.getMinecraft().font.draw(matrixStack, this.title, 18, 7, -11534256);
|
||||
toastGui.getMinecraft().font.draw(matrixStack, this.subtitle, 18, 18, -16777216);
|
||||
}
|
||||
|
||||
return delta - this.firstDrawTime < totalShowTime ? Visibility.SHOW : Visibility.HIDE;
|
||||
|
||||
@@ -50,7 +50,7 @@ public abstract class MixinFireworkRocketEntity extends Entity implements IFirew
|
||||
@Override
|
||||
public LivingEntity getBoostedEntity() {
|
||||
if (this.isAttachedToEntity() && this.attachedToEntity == null) { // isAttachedToEntity checks if the optional is present
|
||||
final Entity entity = this.level().getEntity(this.entityData.get(DATA_ATTACHED_TO_TARGET).getAsInt());
|
||||
final Entity entity = this.level.getEntity(this.entityData.get(DATA_ATTACHED_TO_TARGET).getAsInt());
|
||||
if (entity instanceof LivingEntity) {
|
||||
this.attachedToEntity = (LivingEntity) entity;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,8 @@ 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.LootDataManager;
|
||||
import net.minecraft.world.level.storage.loot.LootTables;
|
||||
import net.minecraft.world.level.storage.loot.PredicateManager;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
@@ -47,13 +48,27 @@ public class MixinLootContext {
|
||||
method = "create",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/server/MinecraftServer;getLootData()Lnet/minecraft/world/level/storage/loot/LootDataManager;"
|
||||
target = "Lnet/minecraft/server/MinecraftServer;getLootTables()Lnet/minecraft/world/level/storage/loot/LootTables;"
|
||||
)
|
||||
)
|
||||
private LootDataManager getLootTableManager(MinecraftServer server) {
|
||||
private LootTables getLootTableManager(MinecraftServer server) {
|
||||
if (server == null) {
|
||||
return BlockOptionalMeta.getManager();
|
||||
}
|
||||
return server.getLootData();
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,26 +167,12 @@ public class MixinMinecraft {
|
||||
at = @At(
|
||||
value = "FIELD",
|
||||
opcode = Opcodes.GETFIELD,
|
||||
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"
|
||||
)
|
||||
target = "Lnet/minecraft/client/gui/screens/Screen;passEvents:Z"
|
||||
)
|
||||
)
|
||||
private Screen passEvents(Minecraft instance) {
|
||||
private boolean passEvents(Screen screen) {
|
||||
// allow user input is only the primary baritone
|
||||
if (BaritoneAPI.getProvider().getPrimaryBaritone().getPathingBehavior().isPathing() && player != null) {
|
||||
return null;
|
||||
}
|
||||
return instance.screen;
|
||||
return (BaritoneAPI.getProvider().getPrimaryBaritone().getPathingBehavior().isPathing() && player != null) || screen.passEvents;
|
||||
}
|
||||
|
||||
// TODO
|
||||
|
||||
@@ -423,7 +423,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().onGround()) {
|
||||
if (ctx.player().isOnGround()) {
|
||||
double playerX = ctx.player().position().x;
|
||||
double playerZ = ctx.player().position().z;
|
||||
ArrayList<BetterBlockPos> closest = new ArrayList<>();
|
||||
|
||||
@@ -162,26 +162,26 @@ public enum FasterWorldScanner implements IWorldScanner {
|
||||
}
|
||||
|
||||
|
||||
|
||||
private List<BlockPos> collectChunkSections(BlockOptionalMetaLookup lookup, LevelChunk chunk, long chunkX, long chunkZ, int playerSection) {
|
||||
// iterate over sections relative to player
|
||||
List<BlockPos> blocks = new ArrayList<>();
|
||||
int chunkY = chunk.getMinBuildHeight();
|
||||
LevelChunkSection[] sections = chunk.getSections();
|
||||
int l = sections.length;
|
||||
int i = playerSection - 1;
|
||||
int j = playerSection;
|
||||
for (; i >= 0 || j < l; ++j, --i) {
|
||||
if (j < l) {
|
||||
visitSection(lookup, sections[j], blocks, chunkX, chunkY + j * 16, chunkZ);
|
||||
visitSection(lookup, sections[j], blocks, chunkX, chunkZ);
|
||||
}
|
||||
if (i >= 0) {
|
||||
visitSection(lookup, sections[i], blocks, chunkX, chunkY + i * 16, chunkZ);
|
||||
visitSection(lookup, sections[i], blocks, chunkX, chunkZ);
|
||||
}
|
||||
}
|
||||
return blocks;
|
||||
}
|
||||
|
||||
private void visitSection(BlockOptionalMetaLookup lookup, LevelChunkSection section, List<BlockPos> blocks, long chunkX, int sectionY, long chunkZ) {
|
||||
private void visitSection(BlockOptionalMetaLookup lookup, LevelChunkSection section, List<BlockPos> blocks, long chunkX, long chunkZ) {
|
||||
if (section == null || section.hasOnlyAir()) {
|
||||
return;
|
||||
}
|
||||
@@ -192,6 +192,7 @@ public enum FasterWorldScanner implements IWorldScanner {
|
||||
return;
|
||||
}
|
||||
|
||||
int yOffset = section.bottomBlockY();
|
||||
Palette<BlockState> palette = ((IPalettedContainer<BlockState>) sectionContainer).getPalette();
|
||||
|
||||
if (palette instanceof SingleValuePalette) {
|
||||
@@ -203,7 +204,7 @@ public enum FasterWorldScanner implements IWorldScanner {
|
||||
for (int z = 0; z < 16; ++z) {
|
||||
blocks.add(new BlockPos(
|
||||
(int) chunkX + x,
|
||||
sectionY + y,
|
||||
yOffset + y,
|
||||
(int) chunkZ + z
|
||||
));
|
||||
}
|
||||
@@ -232,7 +233,7 @@ public enum FasterWorldScanner implements IWorldScanner {
|
||||
//noinspection DuplicateExpressions
|
||||
blocks.add(new BlockPos(
|
||||
(int) chunkX + ((idx & 255) & 15),
|
||||
sectionY + (idx >> 8),
|
||||
yOffset + (idx >> 8),
|
||||
(int) chunkZ + ((idx & 255) >> 4)
|
||||
));
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ 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;
|
||||
@@ -326,7 +327,7 @@ public interface MovementHelper extends ActionCosts, Helper {
|
||||
if (block == Blocks.LARGE_FERN || block == Blocks.TALL_GRASS) {
|
||||
return true;
|
||||
}
|
||||
return state.canBeReplaced();
|
||||
return state.getMaterial().isReplaceable();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@@ -510,14 +511,14 @@ public interface MovementHelper extends ActionCosts, Helper {
|
||||
|
||||
static boolean canUseFrostWalker(CalculationContext context, BlockState state) {
|
||||
return context.frostWalker != 0
|
||||
&& state == FrostedIceBlock.meltsInto()
|
||||
&& state.getMaterial() == Material.WATER
|
||||
&& ((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 == FrostedIceBlock.meltsInto()
|
||||
&& state.getMaterial() == Material.WATER
|
||||
&& ((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().onGround()) {
|
||||
if (ctx.player().position().y - dest.getY() < ctx.playerController().getBlockReachDistance() && !ctx.player().isOnGround()) {
|
||||
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().onGround() && Math.abs(ctx.player().getDeltaMovement().y) > 0.4) {
|
||||
if (!ctx.player().isOnGround() && 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().onGround()) {
|
||||
} else if (!ctx.player().isOnGround()) {
|
||||
state.setInput(Input.SNEAK, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,7 +278,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().onGround()
|
||||
&& !ctx.player().isOnGround()
|
||||
&& 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
|
||||
|
||||
@@ -32,7 +32,14 @@ import baritone.pathing.movement.MovementState;
|
||||
import baritone.utils.BlockStateInterface;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.*;
|
||||
import net.minecraft.world.level.block.AirBlock;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.CarpetBlock;
|
||||
import net.minecraft.world.level.block.FallingBlock;
|
||||
import net.minecraft.world.level.block.FenceGateBlock;
|
||||
import net.minecraft.world.level.block.LadderBlock;
|
||||
import net.minecraft.world.level.block.SlabBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.SlabType;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
@@ -249,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.canBeReplaced())) {
|
||||
if (!(fr instanceof AirBlock || frState.getMaterial().isReplaceable())) {
|
||||
RotationUtils.reachable(ctx, 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().onGround() && (low == Blocks.VINE || low == Blocks.LADDER || high == Blocks.VINE || high == Blocks.LADDER)) {
|
||||
if (ctx.player().position().y > src.y + 0.1D && !ctx.player().isOnGround() && (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().onGround()) {
|
||||
if (!ctx.player().isOnGround()) {
|
||||
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().onGround() && ctx.world().getFluidState(ctx.playerFeet()).isEmpty()) {
|
||||
if (!ctx.player().isOnGround() && ctx.world().getFluidState(ctx.playerFeet()).isEmpty()) {
|
||||
// if we're falling in the air, and not in water, don't splice
|
||||
return false;
|
||||
} else {
|
||||
|
||||
@@ -545,7 +545,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
|
||||
}
|
||||
|
||||
Optional<Tuple<BetterBlockPos, Rotation>> toBreak = toBreakNearPlayer(bcc);
|
||||
if (toBreak.isPresent() && isSafeToCancel && ctx.player().onGround()) {
|
||||
if (toBreak.isPresent() && isSafeToCancel && ctx.player().isOnGround()) {
|
||||
// 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();
|
||||
@@ -565,7 +565,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().onGround() && ticks <= 0) {
|
||||
if (toPlace.isPresent() && isSafeToCancel && ctx.player().isOnGround() && ticks <= 0) {
|
||||
Rotation rot = toPlace.get().rot;
|
||||
baritone.getLookBehavior().updateTarget(rot, true);
|
||||
ctx.player().getInventory().selected = toPlace.get().hotbarSelection;
|
||||
|
||||
@@ -204,7 +204,7 @@ public class ElytraProcess extends BaritoneProcessHelper implements IBaritonePro
|
||||
}
|
||||
|
||||
if (this.state == State.FLYING || this.state == State.START_FLYING) {
|
||||
this.state = ctx.player().onGround() && Baritone.settings().elytraAutoJump.value
|
||||
this.state = ctx.player().isOnGround() && Baritone.settings().elytraAutoJump.value
|
||||
? State.LOCATE_JUMP
|
||||
: State.START_FLYING;
|
||||
}
|
||||
@@ -322,7 +322,7 @@ public class ElytraProcess extends BaritoneProcessHelper implements IBaritonePro
|
||||
}
|
||||
|
||||
private void pathTo0(BlockPos destination, boolean appendDestination) {
|
||||
if (ctx.player() == null || ctx.player().level().dimension() != Level.NETHER) {
|
||||
if (ctx.player() == null || ctx.player().level.dimension() != Level.NETHER) {
|
||||
return;
|
||||
}
|
||||
this.onLostControl();
|
||||
|
||||
@@ -376,7 +376,7 @@ public final class FarmProcess extends BaritoneProcessHelper implements IFarmPro
|
||||
}
|
||||
}
|
||||
for (Entity entity : ctx.entities()) {
|
||||
if (entity instanceof ItemEntity && entity.onGround()) {
|
||||
if (entity instanceof ItemEntity && entity.isOnGround()) {
|
||||
ItemEntity ei = (ItemEntity) entity;
|
||||
if (PICKUP_DROPPED.contains(ei.getItem().getItem())) {
|
||||
// +0.1 because of farmland's 0.9375 dummy height lol
|
||||
|
||||
@@ -120,7 +120,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().above()::distSqr));
|
||||
baritone.getInputOverrideHandler().clearAllKeys();
|
||||
if (shaft.isPresent() && ctx.player().onGround()) {
|
||||
if (shaft.isPresent() && ctx.player().isOnGround()) {
|
||||
BlockPos pos = shaft.get();
|
||||
BlockState state = baritone.bsi.get0(pos);
|
||||
if (!MovementHelper.avoidBreaking(baritone.bsi, pos.getX(), pos.getY(), pos.getZ(), state)) {
|
||||
|
||||
@@ -25,7 +25,6 @@ import baritone.api.event.events.*;
|
||||
import baritone.api.pathing.goals.GoalBlock;
|
||||
import baritone.api.utils.*;
|
||||
import baritone.api.utils.input.Input;
|
||||
import baritone.pathing.movement.MovementHelper;
|
||||
import baritone.process.ElytraProcess;
|
||||
import baritone.utils.BlockStateInterface;
|
||||
import baritone.utils.IRenderer;
|
||||
@@ -46,10 +45,9 @@ import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.ClipContext;
|
||||
import net.minecraft.world.level.block.AirBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkSource;
|
||||
import net.minecraft.world.level.chunk.LevelChunk;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
@@ -1266,8 +1264,8 @@ public final class ElytraBehavior implements Helper {
|
||||
|
||||
private boolean passable(int x, int y, int z, boolean ignoreLava) {
|
||||
if (ignoreLava) {
|
||||
final BlockState state = this.bsi.get0(x, y, z);
|
||||
return state.getBlock() instanceof AirBlock || MovementHelper.isLava(state);
|
||||
final Material mat = this.bsi.get0(x, y, z).getMaterial();
|
||||
return mat == Material.AIR || mat == Material.LAVA;
|
||||
} else {
|
||||
return !this.boi.get0(x, y, z);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ import baritone.api.utils.BetterBlockPos;
|
||||
import baritone.api.utils.Helper;
|
||||
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;
|
||||
@@ -63,7 +62,7 @@ public class GuiClick extends Screen implements Helper {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(GuiGraphics stack, int mouseX, int mouseY, float partialTicks) {
|
||||
public void render(PoseStack stack, int mouseX, int mouseY, float partialTicks) {
|
||||
double mx = mc.mouseHandler.xpos();
|
||||
double my = mc.mouseHandler.ypos();
|
||||
|
||||
@@ -76,7 +75,7 @@ public class GuiClick extends Screen implements Helper {
|
||||
if (near != null && far != null) {
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ public final class PathRenderer implements IRenderer {
|
||||
|
||||
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.emitAABB(stack, toDraw, .002D);
|
||||
|
||||
Reference in New Issue
Block a user