Merge branch '1.17.1' into 1.18.2

This commit is contained in:
ZacSharp 2022-06-03 22:26:24 +02:00
commit 4a042510d8
No known key found for this signature in database
GPG Key ID: 9453647B005083A3
9 changed files with 31 additions and 14 deletions

View File

@ -83,7 +83,7 @@ class BaritoneGradleTask extends DefaultTask {
protected void verifyArtifacts() throws IllegalStateException {
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);
}
}

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
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
zipStorePath=wrapper/dists

View File

@ -37,4 +37,6 @@ pluginManagement {
}
mavenCentral()
}
}
}
rootProject.name = 'baritone'

View File

@ -65,8 +65,8 @@ public interface ActionCosts {
static double[] generateFallNBlocksCost() {
double[] costs = new double[257];
for (int i = 0; i < 257; i++) {
double[] costs = new double[4097];
for (int i = 0; i < 4097; i++) {
costs[i] = distanceToTicks(i);
}
return costs;

View File

@ -175,7 +175,7 @@ public class MixinClientPlayNetHandler {
method = "handlePlayerCombatKill",
at = @At(
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) {

View File

@ -99,12 +99,15 @@ public interface MovementHelper extends ActionCosts, Helper {
if (block instanceof AirBlock) { // early return for most common case
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;
}
if (block == Blocks.BIG_DRIPLEAF) {
return false;
}
if (block == Blocks.POWDER_SNOW) {
return false;
}
if (Baritone.settings().blocksToAvoid.value.contains(block)) {
return false;
}
@ -288,6 +291,7 @@ public interface MovementHelper extends ActionCosts, Helper {
return !state.getFluidState().isEmpty()
|| block == Blocks.MAGMA_BLOCK
|| block == Blocks.CACTUS
|| block == Blocks.SWEET_BERRY_BUSH
|| block instanceof BaseFireBlock
|| block == Blocks.END_PORTAL
|| block == Blocks.COBWEB

View File

@ -847,7 +847,18 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
continue;
}
// <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>
}
return result;

View File

@ -43,7 +43,7 @@ public class BlockStateInterface {
private final ClientChunkCache provider;
private final WorldData worldData;
protected final BlockGetter world;
protected final Level world;
public final BlockPos.MutableBlockPos isPassableBlockPos;
public final BlockGetter access;
@ -97,9 +97,9 @@ public class BlockStateInterface {
}
public BlockState get0(int x, int y, int z) { // Mickey resigned
y -= worldData.dimension.minY();
y -= world.dimensionType().minY();
// Invalid vertical position
if (y < 0 || y >= worldData.dimension.height()) {
if (y < 0 || y >= world.dimensionType().height()) {
return AIR;
}

View File

@ -26,10 +26,10 @@ public class ActionCostsTest {
@Test
public void testFallNBlocksCost() {
assertEquals(FALL_N_BLOCKS_COST.length, 257); // Fall 0 blocks through fall 256 blocks
for (int i = 0; i < 257; i++) {
assertEquals(FALL_N_BLOCKS_COST.length, 4097); // Fall 0 blocks through fall 4096 blocks
for (int i = 0; i < 4097; 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_0_25_BLOCKS_COST, 3.0710, 0.00001);