mirror of https://github.com/cabaletta/baritone
Merge branch '1.17.1' into 1.18.2
This commit is contained in:
commit
4a042510d8
|
@ -83,7 +83,7 @@ class BaritoneGradleTask extends DefaultTask {
|
||||||
|
|
||||||
protected void verifyArtifacts() throws IllegalStateException {
|
protected void verifyArtifacts() throws IllegalStateException {
|
||||||
if (!Files.exists(this.artifactPath)) {
|
if (!Files.exists(this.artifactPath)) {
|
||||||
throw new IllegalStateException("Artifact not found! Run build first!");
|
throw new IllegalStateException("Artifact not found! Run build first! Missing file: " + this.artifactPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
|
@ -38,3 +38,5 @@ pluginManagement {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rootProject.name = 'baritone'
|
||||||
|
|
|
@ -65,8 +65,8 @@ public interface ActionCosts {
|
||||||
|
|
||||||
|
|
||||||
static double[] generateFallNBlocksCost() {
|
static double[] generateFallNBlocksCost() {
|
||||||
double[] costs = new double[257];
|
double[] costs = new double[4097];
|
||||||
for (int i = 0; i < 257; i++) {
|
for (int i = 0; i < 4097; i++) {
|
||||||
costs[i] = distanceToTicks(i);
|
costs[i] = distanceToTicks(i);
|
||||||
}
|
}
|
||||||
return costs;
|
return costs;
|
||||||
|
|
|
@ -175,7 +175,7 @@ public class MixinClientPlayNetHandler {
|
||||||
method = "handlePlayerCombatKill",
|
method = "handlePlayerCombatKill",
|
||||||
at = @At(
|
at = @At(
|
||||||
value = "INVOKE",
|
value = "INVOKE",
|
||||||
target = "Lnet/minecraft/client/Minecraft;setScreen(Lnet/minecraft/client/gui/screens/Screen;)V"
|
target = "Lnet/minecraft/client/player/LocalPlayer;shouldShowDeathScreen()Z"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
private void onPlayerDeath(ClientboundPlayerCombatKillPacket packetIn, CallbackInfo ci) {
|
private void onPlayerDeath(ClientboundPlayerCombatKillPacket packetIn, CallbackInfo ci) {
|
||||||
|
|
|
@ -99,12 +99,15 @@ public interface MovementHelper extends ActionCosts, Helper {
|
||||||
if (block instanceof AirBlock) { // early return for most common case
|
if (block instanceof AirBlock) { // early return for most common case
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (block instanceof BaseFireBlock || block == Blocks.TRIPWIRE || block == Blocks.COBWEB || block == Blocks.END_PORTAL || block == Blocks.COCOA || block instanceof AbstractSkullBlock || block == Blocks.BUBBLE_COLUMN || block instanceof ShulkerBoxBlock || block instanceof SlabBlock || block instanceof TrapDoorBlock || block == Blocks.HONEY_BLOCK || block == Blocks.END_ROD || block == Blocks.POINTED_DRIPSTONE || block == Blocks.AMETHYST_CLUSTER || block instanceof AzaleaBlock) {
|
if (block instanceof BaseFireBlock || block == Blocks.TRIPWIRE || block == Blocks.COBWEB || block == Blocks.END_PORTAL || block == Blocks.COCOA || block instanceof AbstractSkullBlock || block == Blocks.BUBBLE_COLUMN || block instanceof ShulkerBoxBlock || block instanceof SlabBlock || block instanceof TrapDoorBlock || block == Blocks.HONEY_BLOCK || block == Blocks.END_ROD || block == Blocks.SWEET_BERRY_BUSH || block == Blocks.POINTED_DRIPSTONE || block instanceof AmethystClusterBlock || block instanceof AzaleaBlock) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (block == Blocks.BIG_DRIPLEAF) {
|
if (block == Blocks.BIG_DRIPLEAF) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (block == Blocks.POWDER_SNOW) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (Baritone.settings().blocksToAvoid.value.contains(block)) {
|
if (Baritone.settings().blocksToAvoid.value.contains(block)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -288,6 +291,7 @@ public interface MovementHelper extends ActionCosts, Helper {
|
||||||
return !state.getFluidState().isEmpty()
|
return !state.getFluidState().isEmpty()
|
||||||
|| block == Blocks.MAGMA_BLOCK
|
|| block == Blocks.MAGMA_BLOCK
|
||||||
|| block == Blocks.CACTUS
|
|| block == Blocks.CACTUS
|
||||||
|
|| block == Blocks.SWEET_BERRY_BUSH
|
||||||
|| block instanceof BaseFireBlock
|
|| block instanceof BaseFireBlock
|
||||||
|| block == Blocks.END_PORTAL
|
|| block == Blocks.END_PORTAL
|
||||||
|| block == Blocks.COBWEB
|
|| block == Blocks.COBWEB
|
||||||
|
|
|
@ -847,7 +847,18 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// <toxic cloud>
|
// <toxic cloud>
|
||||||
result.add(((BlockItem) stack.getItem()).getBlock().getStateForPlacement(new BlockPlaceContext(new UseOnContext(ctx.world(), ctx.player(), InteractionHand.MAIN_HAND, stack, new BlockHitResult(new Vec3(ctx.player().position().x, ctx.player().position().y, ctx.player().position().z), Direction.UP, ctx.playerFeet(), false)) {})));
|
BlockState itemState = ((BlockItem) stack.getItem())
|
||||||
|
.getBlock()
|
||||||
|
.getStateForPlacement(
|
||||||
|
new BlockPlaceContext(
|
||||||
|
new UseOnContext(ctx.world(), ctx.player(), InteractionHand.MAIN_HAND, stack, new BlockHitResult(new Vec3(ctx.player().position().x, ctx.player().position().y, ctx.player().position().z), Direction.UP, ctx.playerFeet(), false)) {}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
if (itemState != null) {
|
||||||
|
result.add(itemState);
|
||||||
|
} else {
|
||||||
|
result.add(Blocks.AIR.defaultBlockState());
|
||||||
|
}
|
||||||
// </toxic cloud>
|
// </toxic cloud>
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class BlockStateInterface {
|
||||||
|
|
||||||
private final ClientChunkCache provider;
|
private final ClientChunkCache provider;
|
||||||
private final WorldData worldData;
|
private final WorldData worldData;
|
||||||
protected final BlockGetter world;
|
protected final Level world;
|
||||||
public final BlockPos.MutableBlockPos isPassableBlockPos;
|
public final BlockPos.MutableBlockPos isPassableBlockPos;
|
||||||
public final BlockGetter access;
|
public final BlockGetter access;
|
||||||
|
|
||||||
|
@ -97,9 +97,9 @@ public class BlockStateInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockState get0(int x, int y, int z) { // Mickey resigned
|
public BlockState get0(int x, int y, int z) { // Mickey resigned
|
||||||
y -= worldData.dimension.minY();
|
y -= world.dimensionType().minY();
|
||||||
// Invalid vertical position
|
// Invalid vertical position
|
||||||
if (y < 0 || y >= worldData.dimension.height()) {
|
if (y < 0 || y >= world.dimensionType().height()) {
|
||||||
return AIR;
|
return AIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,10 @@ public class ActionCostsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFallNBlocksCost() {
|
public void testFallNBlocksCost() {
|
||||||
assertEquals(FALL_N_BLOCKS_COST.length, 257); // Fall 0 blocks through fall 256 blocks
|
assertEquals(FALL_N_BLOCKS_COST.length, 4097); // Fall 0 blocks through fall 4096 blocks
|
||||||
for (int i = 0; i < 257; i++) {
|
for (int i = 0; i < 4097; i++) {
|
||||||
double blocks = ticksToBlocks(FALL_N_BLOCKS_COST[i]);
|
double blocks = ticksToBlocks(FALL_N_BLOCKS_COST[i]);
|
||||||
assertEquals(blocks, i, 0.000000000001); // If you add another 0 the test fails at i=217 LOL
|
assertEquals(blocks, i, 0.00000000001); // If you add another 0 the test fails at i=989 LOL
|
||||||
}
|
}
|
||||||
assertEquals(FALL_1_25_BLOCKS_COST, 6.2344, 0.00001);
|
assertEquals(FALL_1_25_BLOCKS_COST, 6.2344, 0.00001);
|
||||||
assertEquals(FALL_0_25_BLOCKS_COST, 3.0710, 0.00001);
|
assertEquals(FALL_0_25_BLOCKS_COST, 3.0710, 0.00001);
|
||||||
|
|
Loading…
Reference in New Issue