no falling onto half slab

This commit is contained in:
Leijurv 2018-09-03 09:21:26 -07:00
parent 16f88aa858
commit d328438cf2
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A

View File

@ -27,6 +27,8 @@ import baritone.pathing.movement.MovementState.MovementTarget;
import baritone.utils.*;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFalling;
import net.minecraft.block.BlockSlab;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
@ -49,9 +51,15 @@ public class MovementFall extends Movement {
if (fromDown == Blocks.LADDER || fromDown == Blocks.VINE) {
return COST_INF;
}
if (!MovementHelper.canWalkOn(dest.down())) {
IBlockState fallOnto = BlockStateInterface.get(dest.down());
if (!MovementHelper.canWalkOn(dest.down(), fallOnto)) {
return COST_INF;
}
if (fallOnto.getBlock() instanceof BlockSlab) {
if (!((BlockSlab) fallOnto.getBlock()).isDouble() && fallOnto.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.BOTTOM) {
return COST_INF; // falling onto a half slab is really glitchy, and can cause more fall damage than we'd expect
}
}
double placeBucketCost = 0.0;
if (!BlockStateInterface.isWater(dest) && src.getY() - dest.getY() > context.maxFallHeightNoWater()) {
if (!context.hasWaterBucket()) {