aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/world/level/block/ScaffoldingBlock.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/level/block/ScaffoldingBlock.java.patch')
-rw-r--r--patch-remap/mache-vineflower/net/minecraft/world/level/block/ScaffoldingBlock.java.patch249
1 files changed, 249 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/level/block/ScaffoldingBlock.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/level/block/ScaffoldingBlock.java.patch
new file mode 100644
index 0000000000..22652c83ec
--- /dev/null
+++ b/patch-remap/mache-vineflower/net/minecraft/world/level/block/ScaffoldingBlock.java.patch
@@ -0,0 +1,249 @@
+--- a/net/minecraft/world/level/block/ScaffoldingBlock.java
++++ b/net/minecraft/world/level/block/ScaffoldingBlock.java
+@@ -1,6 +1,7 @@
+ package net.minecraft.world.level.block;
+
+ import com.mojang.serialization.MapCodec;
++import java.util.Iterator;
+ import net.minecraft.core.BlockPos;
+ import net.minecraft.core.Direction;
+ import net.minecraft.server.level.ServerLevel;
+@@ -12,11 +13,12 @@
+ 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;
+ import net.minecraft.world.level.block.state.properties.IntegerProperty;
++import net.minecraft.world.level.material.Fluid;
+ import net.minecraft.world.level.material.FluidState;
+ import net.minecraft.world.level.material.Fluids;
+ import net.minecraft.world.phys.shapes.CollisionContext;
+@@ -24,12 +26,13 @@
+ import net.minecraft.world.phys.shapes.VoxelShape;
+
+ public class ScaffoldingBlock extends Block implements SimpleWaterloggedBlock {
++
+ public static final MapCodec<ScaffoldingBlock> CODEC = simpleCodec(ScaffoldingBlock::new);
+ private static final int TICK_DELAY = 1;
+ private static final VoxelShape STABLE_SHAPE;
+ private static final VoxelShape UNSTABLE_SHAPE;
+- private static final VoxelShape UNSTABLE_SHAPE_BOTTOM = Block.box(0.0, 0.0, 0.0, 16.0, 2.0, 16.0);
+- private static final VoxelShape BELOW_BLOCK = Shapes.block().move(0.0, -1.0, 0.0);
++ private static final VoxelShape UNSTABLE_SHAPE_BOTTOM = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D);
++ private static final VoxelShape BELOW_BLOCK = Shapes.block().move(0.0D, -1.0D, 0.0D);
+ public static final int STABILITY_MAX_DISTANCE = 7;
+ public static final IntegerProperty DISTANCE = BlockStateProperties.STABILITY_DISTANCE;
+ public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
+@@ -37,127 +40,119 @@
+
+ @Override
+ public MapCodec<ScaffoldingBlock> codec() {
+- return CODEC;
++ return ScaffoldingBlock.CODEC;
+ }
+
+ protected ScaffoldingBlock(BlockBehaviour.Properties properties) {
+ super(properties);
+- this.registerDefaultState(
+- this.stateDefinition
+- .any()
+- .setValue(DISTANCE, Integer.valueOf(7))
+- .setValue(WATERLOGGED, Boolean.valueOf(false))
+- .setValue(BOTTOM, Boolean.valueOf(false))
+- );
++ this.registerDefaultState((IBlockData) ((IBlockData) ((IBlockData) ((IBlockData) this.stateDefinition.any()).setValue(ScaffoldingBlock.DISTANCE, 7)).setValue(ScaffoldingBlock.WATERLOGGED, false)).setValue(ScaffoldingBlock.BOTTOM, false));
+ }
+
+ @Override
+- protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
+- builder.add(DISTANCE, WATERLOGGED, BOTTOM);
++ protected void createBlockStateDefinition(StateDefinition.Builder<Block, IBlockData> builder) {
++ builder.add(ScaffoldingBlock.DISTANCE, ScaffoldingBlock.WATERLOGGED, ScaffoldingBlock.BOTTOM);
+ }
+
+ @Override
+- public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
+- if (!context.isHoldingItem(state.getBlock().asItem())) {
+- return state.getValue(BOTTOM) ? UNSTABLE_SHAPE : STABLE_SHAPE;
+- } else {
+- return 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
+- public VoxelShape getInteractionShape(BlockState state, BlockGetter level, BlockPos pos) {
++ public VoxelShape getInteractionShape(IBlockData state, BlockGetter level, BlockPos pos) {
+ return Shapes.block();
+ }
+
+ @Override
+- public boolean canBeReplaced(BlockState state, BlockPlaceContext useContext) {
++ public boolean canBeReplaced(IBlockData state, BlockPlaceContext useContext) {
+ return useContext.getItemInHand().is(this.asItem());
+ }
+
+ @Override
+- public BlockState getStateForPlacement(BlockPlaceContext context) {
+- BlockPos clickedPos = context.getClickedPos();
+- Level level = context.getLevel();
+- int distance = getDistance(level, clickedPos);
+- return this.defaultBlockState()
+- .setValue(WATERLOGGED, Boolean.valueOf(level.getFluidState(clickedPos).getType() == Fluids.WATER))
+- .setValue(DISTANCE, Integer.valueOf(distance))
+- .setValue(BOTTOM, Boolean.valueOf(this.isBottom(level, clickedPos, distance)));
++ public IBlockData getStateForPlacement(BlockPlaceContext context) {
++ BlockPos blockposition = context.getClickedPos();
++ Level world = context.getLevel();
++ int i = getDistance(world, blockposition);
++
++ 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
+- public void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean isMoving) {
++ public void onPlace(IBlockData state, Level level, BlockPos pos, IBlockData oldState, boolean isMoving) {
+ if (!level.isClientSide) {
+- level.scheduleTick(pos, this, 1);
++ level.scheduleTick(pos, (Block) this, 1);
+ }
++
+ }
+
+ @Override
+- public BlockState updateShape(BlockState state, Direction facing, BlockState facingState, LevelAccessor level, BlockPos currentPos, BlockPos facingPos) {
+- if (state.getValue(WATERLOGGED)) {
+- level.scheduleTick(currentPos, Fluids.WATER, Fluids.WATER.getTickDelay(level));
++ 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 (!level.isClientSide()) {
+- level.scheduleTick(currentPos, this, 1);
++ level.scheduleTick(currentPos, (Block) this, 1);
+ }
+
+ return state;
+ }
+
+ @Override
+- public void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
+- int distance = getDistance(level, pos);
+- BlockState blockState = state.setValue(DISTANCE, Integer.valueOf(distance)).setValue(BOTTOM, Boolean.valueOf(this.isBottom(level, pos, distance)));
+- if (blockState.getValue(DISTANCE) == 7) {
+- if (state.getValue(DISTANCE) == 7) {
+- FallingBlockEntity.fall(level, pos, blockState);
++ 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) 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 {
+ level.destroyBlock(pos, true);
+ }
+- } else if (state != blockState) {
+- level.setBlock(pos, blockState, 3);
++ } else if (state != iblockdata1) {
++ level.setBlock(pos, iblockdata1, 3);
+ }
++
+ }
+
+ @Override
+- public boolean canSurvive(BlockState state, LevelReader level, BlockPos pos) {
++ public boolean canSurvive(IBlockData state, LevelReader level, BlockPos pos) {
+ return getDistance(level, pos) < 7;
+ }
+
+ @Override
+- public VoxelShape getCollisionShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
+- if (context.isAbove(Shapes.block(), pos, true) && !context.isDescending()) {
+- return STABLE_SHAPE;
+- } else {
+- return state.getValue(DISTANCE) != 0 && state.getValue(BOTTOM) && context.isAbove(BELOW_BLOCK, pos, true) ? 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
+- public FluidState getFluidState(BlockState state) {
+- return state.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state);
++ public FluidState getFluidState(IBlockData state) {
++ return (Boolean) state.getValue(ScaffoldingBlock.WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state);
+ }
+
+ private boolean isBottom(BlockGetter level, BlockPos pos, int distance) {
+- return distance > 0 && !level.getBlockState(pos.below()).is(this);
++ return distance > 0 && !level.getBlockState(pos.below()).is((Block) this);
+ }
+
+ public static int getDistance(BlockGetter level, BlockPos pos) {
+- BlockPos.MutableBlockPos mutableBlockPos = pos.mutable().move(Direction.DOWN);
+- BlockState blockState = level.getBlockState(mutableBlockPos);
++ BlockPos.MutableBlockPos blockposition_mutableblockposition = pos.mutable().move(Direction.DOWN);
++ IBlockData iblockdata = level.getBlockState(blockposition_mutableblockposition);
+ int i = 7;
+- if (blockState.is(Blocks.SCAFFOLDING)) {
+- i = blockState.getValue(DISTANCE);
+- } else if (blockState.isFaceSturdy(level, 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;
+ }
+
+- for (Direction direction : Direction.Plane.HORIZONTAL) {
+- BlockState blockState1 = level.getBlockState(mutableBlockPos.setWithOffset(pos, direction));
+- if (blockState1.is(Blocks.SCAFFOLDING)) {
+- i = Math.min(i, blockState1.getValue(DISTANCE) + 1);
++ Iterator iterator = Direction.Plane.HORIZONTAL.iterator();
++
++ while (iterator.hasNext()) {
++ Direction enumdirection = (Direction) iterator.next();
++ IBlockData iblockdata1 = level.getBlockState(blockposition_mutableblockposition.setWithOffset(pos, enumdirection));
++
++ if (iblockdata1.is(Blocks.SCAFFOLDING)) {
++ i = Math.min(i, (Integer) iblockdata1.getValue(ScaffoldingBlock.DISTANCE) + 1);
+ if (i == 1) {
+ break;
+ }
+@@ -168,16 +163,18 @@
+ }
+
+ static {
+- VoxelShape voxelShape = Block.box(0.0, 14.0, 0.0, 16.0, 16.0, 16.0);
+- VoxelShape voxelShape1 = Block.box(0.0, 0.0, 0.0, 2.0, 16.0, 2.0);
+- VoxelShape voxelShape2 = Block.box(14.0, 0.0, 0.0, 16.0, 16.0, 2.0);
+- VoxelShape voxelShape3 = Block.box(0.0, 0.0, 14.0, 2.0, 16.0, 16.0);
+- VoxelShape voxelShape4 = Block.box(14.0, 0.0, 14.0, 16.0, 16.0, 16.0);
+- STABLE_SHAPE = Shapes.or(voxelShape, voxelShape1, voxelShape2, voxelShape3, voxelShape4);
+- VoxelShape voxelShape5 = Block.box(0.0, 0.0, 0.0, 2.0, 2.0, 16.0);
+- VoxelShape voxelShape6 = Block.box(14.0, 0.0, 0.0, 16.0, 2.0, 16.0);
+- VoxelShape voxelShape7 = Block.box(0.0, 0.0, 14.0, 16.0, 2.0, 16.0);
+- VoxelShape voxelShape8 = Block.box(0.0, 0.0, 0.0, 16.0, 2.0, 2.0);
+- UNSTABLE_SHAPE = Shapes.or(ScaffoldingBlock.UNSTABLE_SHAPE_BOTTOM, STABLE_SHAPE, voxelShape6, voxelShape5, voxelShape8, voxelShape7);
++ VoxelShape voxelshape = Block.box(0.0D, 14.0D, 0.0D, 16.0D, 16.0D, 16.0D);
++ VoxelShape voxelshape1 = Block.box(0.0D, 0.0D, 0.0D, 2.0D, 16.0D, 2.0D);
++ VoxelShape voxelshape2 = Block.box(14.0D, 0.0D, 0.0D, 16.0D, 16.0D, 2.0D);
++ VoxelShape voxelshape3 = Block.box(0.0D, 0.0D, 14.0D, 2.0D, 16.0D, 16.0D);
++ VoxelShape voxelshape4 = Block.box(14.0D, 0.0D, 14.0D, 16.0D, 16.0D, 16.0D);
++
++ STABLE_SHAPE = Shapes.or(voxelshape, voxelshape1, voxelshape2, voxelshape3, voxelshape4);
++ VoxelShape voxelshape5 = Block.box(0.0D, 0.0D, 0.0D, 2.0D, 2.0D, 16.0D);
++ VoxelShape voxelshape6 = Block.box(14.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D);
++ VoxelShape voxelshape7 = Block.box(0.0D, 0.0D, 14.0D, 16.0D, 2.0D, 16.0D);
++ VoxelShape voxelshape8 = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 2.0D);
++
++ UNSTABLE_SHAPE = Shapes.or(ScaffoldingBlock.UNSTABLE_SHAPE_BOTTOM, ScaffoldingBlock.STABLE_SHAPE, voxelshape6, voxelshape5, voxelshape8, voxelshape7);
+ }
+ }