diff options
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/level/block/ScaffoldingBlock.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower/net/minecraft/world/level/block/ScaffoldingBlock.java.patch | 194 |
1 files changed, 194 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/level/block/ScaffoldingBlock.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/level/block/ScaffoldingBlock.java.patch new file mode 100644 index 0000000000..322e8173f0 --- /dev/null +++ b/patch-remap/mache-spigotflower/net/minecraft/world/level/block/ScaffoldingBlock.java.patch @@ -0,0 +1,194 @@ +--- a/net/minecraft/world/level/block/ScaffoldingBlock.java ++++ b/net/minecraft/world/level/block/ScaffoldingBlock.java +@@ -13,7 +13,7 @@ + import net.minecraft.world.level.LevelAccessor; + import net.minecraft.world.level.LevelReader; + import net.minecraft.world.level.block.state.BlockBehaviour; +-import net.minecraft.world.level.block.state.BlockState; ++import net.minecraft.world.level.block.state.IBlockData; + import net.minecraft.world.level.block.state.StateDefinition; + import net.minecraft.world.level.block.state.properties.BlockStateProperties; + import net.minecraft.world.level.block.state.properties.BooleanProperty; +@@ -39,132 +39,120 @@ + public static final BooleanProperty BOTTOM = BlockStateProperties.BOTTOM; + + @Override +- @Override + public MapCodec<ScaffoldingBlock> codec() { + return ScaffoldingBlock.CODEC; + } + +- protected ScaffoldingBlock(BlockBehaviour.Properties blockbehaviour_properties) { +- super(blockbehaviour_properties); +- this.registerDefaultState((BlockState) ((BlockState) ((BlockState) ((BlockState) this.stateDefinition.any()).setValue(ScaffoldingBlock.DISTANCE, 7)).setValue(ScaffoldingBlock.WATERLOGGED, false)).setValue(ScaffoldingBlock.BOTTOM, false)); ++ protected ScaffoldingBlock(BlockBehaviour.Properties properties) { ++ super(properties); ++ this.registerDefaultState((IBlockData) ((IBlockData) ((IBlockData) ((IBlockData) this.stateDefinition.any()).setValue(ScaffoldingBlock.DISTANCE, 7)).setValue(ScaffoldingBlock.WATERLOGGED, false)).setValue(ScaffoldingBlock.BOTTOM, false)); + } + + @Override +- @Override +- protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> statedefinition_builder) { +- statedefinition_builder.add(ScaffoldingBlock.DISTANCE, ScaffoldingBlock.WATERLOGGED, ScaffoldingBlock.BOTTOM); ++ protected void createBlockStateDefinition(StateDefinition.Builder<Block, IBlockData> builder) { ++ builder.add(ScaffoldingBlock.DISTANCE, ScaffoldingBlock.WATERLOGGED, ScaffoldingBlock.BOTTOM); + } + + @Override +- @Override +- public VoxelShape getShape(BlockState blockstate, BlockGetter blockgetter, BlockPos blockpos, CollisionContext collisioncontext) { +- return !collisioncontext.isHoldingItem(blockstate.getBlock().asItem()) ? ((Boolean) blockstate.getValue(ScaffoldingBlock.BOTTOM) ? ScaffoldingBlock.UNSTABLE_SHAPE : ScaffoldingBlock.STABLE_SHAPE) : Shapes.block(); ++ public VoxelShape getShape(IBlockData state, BlockGetter level, BlockPos pos, CollisionContext context) { ++ return !context.isHoldingItem(state.getBlock().asItem()) ? ((Boolean) state.getValue(ScaffoldingBlock.BOTTOM) ? ScaffoldingBlock.UNSTABLE_SHAPE : ScaffoldingBlock.STABLE_SHAPE) : Shapes.block(); + } + + @Override +- @Override +- public VoxelShape getInteractionShape(BlockState blockstate, BlockGetter blockgetter, BlockPos blockpos) { ++ public VoxelShape getInteractionShape(IBlockData state, BlockGetter level, BlockPos pos) { + return Shapes.block(); + } + + @Override +- @Override +- public boolean canBeReplaced(BlockState blockstate, BlockPlaceContext blockplacecontext) { +- return blockplacecontext.getItemInHand().is(this.asItem()); ++ public boolean canBeReplaced(IBlockData state, BlockPlaceContext useContext) { ++ return useContext.getItemInHand().is(this.asItem()); + } + + @Override +- @Override +- public BlockState getStateForPlacement(BlockPlaceContext blockplacecontext) { +- BlockPos blockpos = blockplacecontext.getClickedPos(); +- Level level = blockplacecontext.getLevel(); +- int i = getDistance(level, blockpos); ++ public IBlockData getStateForPlacement(BlockPlaceContext context) { ++ BlockPos blockposition = context.getClickedPos(); ++ Level world = context.getLevel(); ++ int i = getDistance(world, blockposition); + +- return (BlockState) ((BlockState) ((BlockState) this.defaultBlockState().setValue(ScaffoldingBlock.WATERLOGGED, level.getFluidState(blockpos).getType() == Fluids.WATER)).setValue(ScaffoldingBlock.DISTANCE, i)).setValue(ScaffoldingBlock.BOTTOM, this.isBottom(level, blockpos, i)); ++ return (IBlockData) ((IBlockData) ((IBlockData) this.defaultBlockState().setValue(ScaffoldingBlock.WATERLOGGED, world.getFluidState(blockposition).getType() == Fluids.WATER)).setValue(ScaffoldingBlock.DISTANCE, i)).setValue(ScaffoldingBlock.BOTTOM, this.isBottom(world, blockposition, i)); + } + + @Override +- @Override +- public void onPlace(BlockState blockstate, Level level, BlockPos blockpos, BlockState blockstate1, boolean flag) { ++ public void onPlace(IBlockData state, Level level, BlockPos pos, IBlockData oldState, boolean isMoving) { + if (!level.isClientSide) { +- level.scheduleTick(blockpos, (Block) this, 1); ++ level.scheduleTick(pos, (Block) this, 1); + } + + } + + @Override +- @Override +- public BlockState updateShape(BlockState blockstate, Direction direction, BlockState blockstate1, LevelAccessor levelaccessor, BlockPos blockpos, BlockPos blockpos1) { +- if ((Boolean) blockstate.getValue(ScaffoldingBlock.WATERLOGGED)) { +- levelaccessor.scheduleTick(blockpos, (Fluid) Fluids.WATER, Fluids.WATER.getTickDelay(levelaccessor)); ++ public IBlockData updateShape(IBlockData state, Direction facing, IBlockData facingState, LevelAccessor level, BlockPos currentPos, BlockPos facingPos) { ++ if ((Boolean) state.getValue(ScaffoldingBlock.WATERLOGGED)) { ++ level.scheduleTick(currentPos, (Fluid) Fluids.WATER, Fluids.WATER.getTickDelay(level)); + } + +- if (!levelaccessor.isClientSide()) { +- levelaccessor.scheduleTick(blockpos, (Block) this, 1); ++ if (!level.isClientSide()) { ++ level.scheduleTick(currentPos, (Block) this, 1); + } + +- return blockstate; ++ return state; + } + + @Override +- @Override +- public void tick(BlockState blockstate, ServerLevel serverlevel, BlockPos blockpos, RandomSource randomsource) { +- int i = getDistance(serverlevel, blockpos); +- BlockState blockstate1 = (BlockState) ((BlockState) blockstate.setValue(ScaffoldingBlock.DISTANCE, i)).setValue(ScaffoldingBlock.BOTTOM, this.isBottom(serverlevel, blockpos, i)); ++ public void tick(IBlockData state, ServerLevel level, BlockPos pos, RandomSource random) { ++ int i = getDistance(level, pos); ++ IBlockData iblockdata1 = (IBlockData) ((IBlockData) state.setValue(ScaffoldingBlock.DISTANCE, i)).setValue(ScaffoldingBlock.BOTTOM, this.isBottom(level, pos, i)); + +- if ((Integer) blockstate1.getValue(ScaffoldingBlock.DISTANCE) == 7) { +- if ((Integer) blockstate.getValue(ScaffoldingBlock.DISTANCE) == 7) { +- FallingBlockEntity.fall(serverlevel, blockpos, blockstate1); ++ if ((Integer) iblockdata1.getValue(ScaffoldingBlock.DISTANCE) == 7 && !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(level, pos, Blocks.AIR.defaultBlockState()).isCancelled()) { // CraftBukkit - BlockFadeEvent ++ if ((Integer) state.getValue(ScaffoldingBlock.DISTANCE) == 7) { ++ FallingBlockEntity.fall(level, pos, iblockdata1); + } else { +- serverlevel.destroyBlock(blockpos, true); ++ level.destroyBlock(pos, true); + } +- } else if (blockstate != blockstate1) { +- serverlevel.setBlock(blockpos, blockstate1, 3); ++ } else if (state != iblockdata1) { ++ level.setBlock(pos, iblockdata1, 3); + } + + } + + @Override +- @Override +- public boolean canSurvive(BlockState blockstate, LevelReader levelreader, BlockPos blockpos) { +- return getDistance(levelreader, blockpos) < 7; ++ public boolean canSurvive(IBlockData state, LevelReader level, BlockPos pos) { ++ return getDistance(level, pos) < 7; + } + + @Override +- @Override +- public VoxelShape getCollisionShape(BlockState blockstate, BlockGetter blockgetter, BlockPos blockpos, CollisionContext collisioncontext) { +- return collisioncontext.isAbove(Shapes.block(), blockpos, true) && !collisioncontext.isDescending() ? ScaffoldingBlock.STABLE_SHAPE : ((Integer) blockstate.getValue(ScaffoldingBlock.DISTANCE) != 0 && (Boolean) blockstate.getValue(ScaffoldingBlock.BOTTOM) && collisioncontext.isAbove(ScaffoldingBlock.BELOW_BLOCK, blockpos, true) ? ScaffoldingBlock.UNSTABLE_SHAPE_BOTTOM : Shapes.empty()); ++ public VoxelShape getCollisionShape(IBlockData state, BlockGetter level, BlockPos pos, CollisionContext context) { ++ return context.isAbove(Shapes.block(), pos, true) && !context.isDescending() ? ScaffoldingBlock.STABLE_SHAPE : ((Integer) state.getValue(ScaffoldingBlock.DISTANCE) != 0 && (Boolean) state.getValue(ScaffoldingBlock.BOTTOM) && context.isAbove(ScaffoldingBlock.BELOW_BLOCK, pos, true) ? ScaffoldingBlock.UNSTABLE_SHAPE_BOTTOM : Shapes.empty()); + } + + @Override +- @Override +- public FluidState getFluidState(BlockState blockstate) { +- return (Boolean) blockstate.getValue(ScaffoldingBlock.WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(blockstate); ++ public FluidState getFluidState(IBlockData state) { ++ return (Boolean) state.getValue(ScaffoldingBlock.WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); + } + +- private boolean isBottom(BlockGetter blockgetter, BlockPos blockpos, int i) { +- return i > 0 && !blockgetter.getBlockState(blockpos.below()).is((Block) this); ++ private boolean isBottom(BlockGetter level, BlockPos pos, int distance) { ++ return distance > 0 && !level.getBlockState(pos.below()).is((Block) this); + } + +- public static int getDistance(BlockGetter blockgetter, BlockPos blockpos) { +- BlockPos.MutableBlockPos blockpos_mutableblockpos = blockpos.mutable().move(Direction.DOWN); +- BlockState blockstate = blockgetter.getBlockState(blockpos_mutableblockpos); ++ public static int getDistance(BlockGetter level, BlockPos pos) { ++ BlockPos.MutableBlockPos blockposition_mutableblockposition = pos.mutable().move(Direction.DOWN); ++ IBlockData iblockdata = level.getBlockState(blockposition_mutableblockposition); + int i = 7; + +- if (blockstate.is(Blocks.SCAFFOLDING)) { +- i = (Integer) blockstate.getValue(ScaffoldingBlock.DISTANCE); +- } else if (blockstate.isFaceSturdy(blockgetter, blockpos_mutableblockpos, Direction.UP)) { ++ if (iblockdata.is(Blocks.SCAFFOLDING)) { ++ i = (Integer) iblockdata.getValue(ScaffoldingBlock.DISTANCE); ++ } else if (iblockdata.isFaceSturdy(level, blockposition_mutableblockposition, Direction.UP)) { + return 0; + } + + Iterator iterator = Direction.Plane.HORIZONTAL.iterator(); + + while (iterator.hasNext()) { +- Direction direction = (Direction) iterator.next(); +- BlockState blockstate1 = blockgetter.getBlockState(blockpos_mutableblockpos.setWithOffset(blockpos, direction)); ++ Direction enumdirection = (Direction) iterator.next(); ++ IBlockData iblockdata1 = level.getBlockState(blockposition_mutableblockposition.setWithOffset(pos, enumdirection)); + +- if (blockstate1.is(Blocks.SCAFFOLDING)) { +- i = Math.min(i, (Integer) blockstate1.getValue(ScaffoldingBlock.DISTANCE) + 1); ++ if (iblockdata1.is(Blocks.SCAFFOLDING)) { ++ i = Math.min(i, (Integer) iblockdata1.getValue(ScaffoldingBlock.DISTANCE) + 1); + if (i == 1) { + break; + } |