diff options
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/level/block/SnowLayerBlock.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower/net/minecraft/world/level/block/SnowLayerBlock.java.patch | 178 |
1 files changed, 178 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/level/block/SnowLayerBlock.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/level/block/SnowLayerBlock.java.patch new file mode 100644 index 0000000000..56ffa70460 --- /dev/null +++ b/patch-remap/mache-spigotflower/net/minecraft/world/level/block/SnowLayerBlock.java.patch @@ -0,0 +1,178 @@ +--- a/net/minecraft/world/level/block/SnowLayerBlock.java ++++ b/net/minecraft/world/level/block/SnowLayerBlock.java +@@ -9,15 +9,15 @@ + import net.minecraft.util.RandomSource; + import net.minecraft.world.item.context.BlockPlaceContext; + import net.minecraft.world.level.BlockGetter; ++import net.minecraft.world.level.EnumSkyBlock; + import net.minecraft.world.level.LevelAccessor; + import net.minecraft.world.level.LevelReader; +-import net.minecraft.world.level.LightLayer; + 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.IntegerProperty; +-import net.minecraft.world.level.pathfinder.PathComputationType; ++import net.minecraft.world.level.pathfinder.PathMode; + import net.minecraft.world.phys.shapes.CollisionContext; + import net.minecraft.world.phys.shapes.Shapes; + import net.minecraft.world.phys.shapes.VoxelShape; +@@ -31,22 +31,20 @@ + public static final int HEIGHT_IMPASSABLE = 5; + + @Override +- @Override + public MapCodec<SnowLayerBlock> codec() { + return SnowLayerBlock.CODEC; + } + +- protected SnowLayerBlock(BlockBehaviour.Properties blockbehaviour_properties) { +- super(blockbehaviour_properties); +- this.registerDefaultState((BlockState) ((BlockState) this.stateDefinition.any()).setValue(SnowLayerBlock.LAYERS, 1)); ++ protected SnowLayerBlock(BlockBehaviour.Properties properties) { ++ super(properties); ++ this.registerDefaultState((IBlockData) ((IBlockData) this.stateDefinition.any()).setValue(SnowLayerBlock.LAYERS, 1)); + } + + @Override +- @Override +- public boolean isPathfindable(BlockState blockstate, BlockGetter blockgetter, BlockPos blockpos, PathComputationType pathcomputationtype) { +- switch (pathcomputationtype) { ++ public boolean isPathfindable(IBlockData state, BlockGetter level, BlockPos pos, PathMode type) { ++ switch (type) { + case LAND: +- return (Integer) blockstate.getValue(SnowLayerBlock.LAYERS) < 5; ++ return (Integer) state.getValue(SnowLayerBlock.LAYERS) < 5; + case WATER: + return false; + case AIR: +@@ -57,91 +55,84 @@ + } + + @Override +- @Override +- public VoxelShape getShape(BlockState blockstate, BlockGetter blockgetter, BlockPos blockpos, CollisionContext collisioncontext) { +- return SnowLayerBlock.SHAPE_BY_LAYER[(Integer) blockstate.getValue(SnowLayerBlock.LAYERS)]; ++ public VoxelShape getShape(IBlockData state, BlockGetter level, BlockPos pos, CollisionContext context) { ++ return SnowLayerBlock.SHAPE_BY_LAYER[(Integer) state.getValue(SnowLayerBlock.LAYERS)]; + } + + @Override +- @Override +- public VoxelShape getCollisionShape(BlockState blockstate, BlockGetter blockgetter, BlockPos blockpos, CollisionContext collisioncontext) { +- return SnowLayerBlock.SHAPE_BY_LAYER[(Integer) blockstate.getValue(SnowLayerBlock.LAYERS) - 1]; ++ public VoxelShape getCollisionShape(IBlockData state, BlockGetter level, BlockPos pos, CollisionContext context) { ++ return SnowLayerBlock.SHAPE_BY_LAYER[(Integer) state.getValue(SnowLayerBlock.LAYERS) - 1]; + } + + @Override +- @Override +- public VoxelShape getBlockSupportShape(BlockState blockstate, BlockGetter blockgetter, BlockPos blockpos) { +- return SnowLayerBlock.SHAPE_BY_LAYER[(Integer) blockstate.getValue(SnowLayerBlock.LAYERS)]; ++ public VoxelShape getBlockSupportShape(IBlockData state, BlockGetter reader, BlockPos pos) { ++ return SnowLayerBlock.SHAPE_BY_LAYER[(Integer) state.getValue(SnowLayerBlock.LAYERS)]; + } + + @Override +- @Override +- public VoxelShape getVisualShape(BlockState blockstate, BlockGetter blockgetter, BlockPos blockpos, CollisionContext collisioncontext) { +- return SnowLayerBlock.SHAPE_BY_LAYER[(Integer) blockstate.getValue(SnowLayerBlock.LAYERS)]; ++ public VoxelShape getVisualShape(IBlockData state, BlockGetter reader, BlockPos pos, CollisionContext context) { ++ return SnowLayerBlock.SHAPE_BY_LAYER[(Integer) state.getValue(SnowLayerBlock.LAYERS)]; + } + + @Override +- @Override +- public boolean useShapeForLightOcclusion(BlockState blockstate) { ++ public boolean useShapeForLightOcclusion(IBlockData state) { + return true; + } + + @Override +- @Override +- public float getShadeBrightness(BlockState blockstate, BlockGetter blockgetter, BlockPos blockpos) { +- return (Integer) blockstate.getValue(SnowLayerBlock.LAYERS) == 8 ? 0.2F : 1.0F; ++ public float getShadeBrightness(IBlockData state, BlockGetter level, BlockPos pos) { ++ return (Integer) state.getValue(SnowLayerBlock.LAYERS) == 8 ? 0.2F : 1.0F; + } + + @Override +- @Override +- public boolean canSurvive(BlockState blockstate, LevelReader levelreader, BlockPos blockpos) { +- BlockState blockstate1 = levelreader.getBlockState(blockpos.below()); ++ public boolean canSurvive(IBlockData state, LevelReader level, BlockPos pos) { ++ IBlockData iblockdata1 = level.getBlockState(pos.below()); + +- return blockstate1.is(BlockTags.SNOW_LAYER_CANNOT_SURVIVE_ON) ? false : (blockstate1.is(BlockTags.SNOW_LAYER_CAN_SURVIVE_ON) ? true : Block.isFaceFull(blockstate1.getCollisionShape(levelreader, blockpos.below()), Direction.UP) || blockstate1.is((Block) this) && (Integer) blockstate1.getValue(SnowLayerBlock.LAYERS) == 8); ++ return iblockdata1.is(BlockTags.SNOW_LAYER_CANNOT_SURVIVE_ON) ? false : (iblockdata1.is(BlockTags.SNOW_LAYER_CAN_SURVIVE_ON) ? true : Block.isFaceFull(iblockdata1.getCollisionShape(level, pos.below()), Direction.UP) || iblockdata1.is((Block) this) && (Integer) iblockdata1.getValue(SnowLayerBlock.LAYERS) == 8); + } + + @Override +- @Override +- public BlockState updateShape(BlockState blockstate, Direction direction, BlockState blockstate1, LevelAccessor levelaccessor, BlockPos blockpos, BlockPos blockpos1) { +- return !blockstate.canSurvive(levelaccessor, blockpos) ? Blocks.AIR.defaultBlockState() : super.updateShape(blockstate, direction, blockstate1, levelaccessor, blockpos, blockpos1); ++ public IBlockData updateShape(IBlockData state, Direction facing, IBlockData facingState, LevelAccessor level, BlockPos currentPos, BlockPos facingPos) { ++ return !state.canSurvive(level, currentPos) ? Blocks.AIR.defaultBlockState() : super.updateShape(state, facing, facingState, level, currentPos, facingPos); + } + + @Override +- @Override +- public void randomTick(BlockState blockstate, ServerLevel serverlevel, BlockPos blockpos, RandomSource randomsource) { +- if (serverlevel.getBrightness(LightLayer.BLOCK, blockpos) > 11) { +- dropResources(blockstate, serverlevel, blockpos); +- serverlevel.removeBlock(blockpos, false); ++ public void randomTick(IBlockData state, ServerLevel level, BlockPos pos, RandomSource random) { ++ if (level.getBrightness(EnumSkyBlock.BLOCK, pos) > 11) { ++ // CraftBukkit start ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(level, pos, Blocks.AIR.defaultBlockState()).isCancelled()) { ++ return; ++ } ++ // CraftBukkit end ++ dropResources(state, level, pos); ++ level.removeBlock(pos, false); + } + + } + + @Override +- @Override +- public boolean canBeReplaced(BlockState blockstate, BlockPlaceContext blockplacecontext) { +- int i = (Integer) blockstate.getValue(SnowLayerBlock.LAYERS); ++ public boolean canBeReplaced(IBlockData state, BlockPlaceContext useContext) { ++ int i = (Integer) state.getValue(SnowLayerBlock.LAYERS); + +- return blockplacecontext.getItemInHand().is(this.asItem()) && i < 8 ? (blockplacecontext.replacingClickedOnBlock() ? blockplacecontext.getClickedFace() == Direction.UP : true) : i == 1; ++ return useContext.getItemInHand().is(this.asItem()) && i < 8 ? (useContext.replacingClickedOnBlock() ? useContext.getClickedFace() == Direction.UP : true) : i == 1; + } + + @Nullable + @Override +- @Override +- public BlockState getStateForPlacement(BlockPlaceContext blockplacecontext) { +- BlockState blockstate = blockplacecontext.getLevel().getBlockState(blockplacecontext.getClickedPos()); ++ public IBlockData getStateForPlacement(BlockPlaceContext context) { ++ IBlockData iblockdata = context.getLevel().getBlockState(context.getClickedPos()); + +- if (blockstate.is((Block) this)) { +- int i = (Integer) blockstate.getValue(SnowLayerBlock.LAYERS); ++ if (iblockdata.is((Block) this)) { ++ int i = (Integer) iblockdata.getValue(SnowLayerBlock.LAYERS); + +- return (BlockState) blockstate.setValue(SnowLayerBlock.LAYERS, Math.min(8, i + 1)); ++ return (IBlockData) iblockdata.setValue(SnowLayerBlock.LAYERS, Math.min(8, i + 1)); + } else { +- return super.getStateForPlacement(blockplacecontext); ++ return super.getStateForPlacement(context); + } + } + + @Override +- @Override +- protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> statedefinition_builder) { +- statedefinition_builder.add(SnowLayerBlock.LAYERS); ++ protected void createBlockStateDefinition(StateDefinition.Builder<Block, IBlockData> builder) { ++ builder.add(SnowLayerBlock.LAYERS); + } + } |