aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower/net/minecraft/world/level/block/CactusBlock.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/level/block/CactusBlock.java.patch')
-rw-r--r--patch-remap/mache-spigotflower/net/minecraft/world/level/block/CactusBlock.java.patch169
1 files changed, 169 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/level/block/CactusBlock.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/level/block/CactusBlock.java.patch
new file mode 100644
index 0000000000..8ba6ac85b2
--- /dev/null
+++ b/patch-remap/mache-spigotflower/net/minecraft/world/level/block/CactusBlock.java.patch
@@ -0,0 +1,169 @@
+--- a/net/minecraft/world/level/block/CactusBlock.java
++++ b/net/minecraft/world/level/block/CactusBlock.java
+@@ -14,13 +14,14 @@
+ 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.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.VoxelShape;
++import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
+ public class CactusBlock extends Block {
+
+@@ -32,48 +33,45 @@
+ protected static final VoxelShape OUTLINE_SHAPE = Block.box(1.0D, 0.0D, 1.0D, 15.0D, 16.0D, 15.0D);
+
+ @Override
+- @Override
+ public MapCodec<CactusBlock> codec() {
+ return CactusBlock.CODEC;
+ }
+
+- protected CactusBlock(BlockBehaviour.Properties blockbehaviour_properties) {
+- super(blockbehaviour_properties);
+- this.registerDefaultState((BlockState) ((BlockState) this.stateDefinition.any()).setValue(CactusBlock.AGE, 0));
++ protected CactusBlock(BlockBehaviour.Properties properties) {
++ super(properties);
++ this.registerDefaultState((IBlockData) ((IBlockData) this.stateDefinition.any()).setValue(CactusBlock.AGE, 0));
+ }
+
+ @Override
+- @Override
+- public void tick(BlockState blockstate, ServerLevel serverlevel, BlockPos blockpos, RandomSource randomsource) {
+- if (!blockstate.canSurvive(serverlevel, blockpos)) {
+- serverlevel.destroyBlock(blockpos, true);
++ public void tick(IBlockData state, ServerLevel level, BlockPos pos, RandomSource random) {
++ if (!state.canSurvive(level, pos)) {
++ level.destroyBlock(pos, true);
+ }
+
+ }
+
+ @Override
+- @Override
+- public void randomTick(BlockState blockstate, ServerLevel serverlevel, BlockPos blockpos, RandomSource randomsource) {
+- BlockPos blockpos1 = blockpos.above();
++ public void randomTick(IBlockData state, ServerLevel level, BlockPos pos, RandomSource random) {
++ BlockPos blockposition1 = pos.above();
+
+- if (serverlevel.isEmptyBlock(blockpos1)) {
++ if (level.isEmptyBlock(blockposition1)) {
+ int i;
+
+- for (i = 1; serverlevel.getBlockState(blockpos.below(i)).is((Block) this); ++i) {
++ for (i = 1; level.getBlockState(pos.below(i)).is((Block) this); ++i) {
+ ;
+ }
+
+ if (i < 3) {
+- int j = (Integer) blockstate.getValue(CactusBlock.AGE);
++ int j = (Integer) state.getValue(CactusBlock.AGE);
+
+ if (j == 15) {
+- serverlevel.setBlockAndUpdate(blockpos1, this.defaultBlockState());
+- BlockState blockstate1 = (BlockState) blockstate.setValue(CactusBlock.AGE, 0);
++ CraftEventFactory.handleBlockGrowEvent(level, blockposition1, this.defaultBlockState()); // CraftBukkit
++ IBlockData iblockdata1 = (IBlockData) state.setValue(CactusBlock.AGE, 0);
+
+- serverlevel.setBlock(blockpos, blockstate1, 4);
+- serverlevel.neighborChanged(blockstate1, blockpos1, this, blockpos, false);
++ level.setBlock(pos, iblockdata1, 4);
++ level.neighborChanged(iblockdata1, blockposition1, this, pos, false);
+ } else {
+- serverlevel.setBlock(blockpos, (BlockState) blockstate.setValue(CactusBlock.AGE, j + 1), 4);
++ level.setBlock(pos, (IBlockData) state.setValue(CactusBlock.AGE, j + 1), 4);
+ }
+
+ }
+@@ -81,64 +79,59 @@
+ }
+
+ @Override
+- @Override
+- public VoxelShape getCollisionShape(BlockState blockstate, BlockGetter blockgetter, BlockPos blockpos, CollisionContext collisioncontext) {
++ public VoxelShape getCollisionShape(IBlockData state, BlockGetter level, BlockPos pos, CollisionContext context) {
+ return CactusBlock.COLLISION_SHAPE;
+ }
+
+ @Override
+- @Override
+- public VoxelShape getShape(BlockState blockstate, BlockGetter blockgetter, BlockPos blockpos, CollisionContext collisioncontext) {
++ public VoxelShape getShape(IBlockData state, BlockGetter level, BlockPos pos, CollisionContext context) {
+ return CactusBlock.OUTLINE_SHAPE;
+ }
+
+ @Override
+- @Override
+- public BlockState updateShape(BlockState blockstate, Direction direction, BlockState blockstate1, LevelAccessor levelaccessor, BlockPos blockpos, BlockPos blockpos1) {
+- if (!blockstate.canSurvive(levelaccessor, blockpos)) {
+- levelaccessor.scheduleTick(blockpos, (Block) this, 1);
++ public IBlockData updateShape(IBlockData state, Direction facing, IBlockData facingState, LevelAccessor level, BlockPos currentPos, BlockPos facingPos) {
++ if (!state.canSurvive(level, currentPos)) {
++ level.scheduleTick(currentPos, (Block) this, 1);
+ }
+
+- return super.updateShape(blockstate, direction, blockstate1, levelaccessor, blockpos, blockpos1);
++ return super.updateShape(state, facing, facingState, level, currentPos, facingPos);
+ }
+
+ @Override
+- @Override
+- public boolean canSurvive(BlockState blockstate, LevelReader levelreader, BlockPos blockpos) {
++ public boolean canSurvive(IBlockData state, LevelReader level, BlockPos pos) {
+ Iterator iterator = Direction.Plane.HORIZONTAL.iterator();
+
+- Direction direction;
+- BlockState blockstate1;
++ Direction enumdirection;
++ IBlockData iblockdata1;
+
+ do {
+ if (!iterator.hasNext()) {
+- BlockState blockstate2 = levelreader.getBlockState(blockpos.below());
++ IBlockData iblockdata2 = level.getBlockState(pos.below());
+
+- return (blockstate2.is(Blocks.CACTUS) || blockstate2.is(BlockTags.SAND)) && !levelreader.getBlockState(blockpos.above()).liquid();
++ return (iblockdata2.is(Blocks.CACTUS) || iblockdata2.is(BlockTags.SAND)) && !level.getBlockState(pos.above()).liquid();
+ }
+
+- direction = (Direction) iterator.next();
+- blockstate1 = levelreader.getBlockState(blockpos.relative(direction));
+- } while (!blockstate1.isSolid() && !levelreader.getFluidState(blockpos.relative(direction)).is(FluidTags.LAVA));
++ enumdirection = (Direction) iterator.next();
++ iblockdata1 = level.getBlockState(pos.relative(enumdirection));
++ } while (!iblockdata1.isSolid() && !level.getFluidState(pos.relative(enumdirection)).is(FluidTags.LAVA));
+
+ return false;
+ }
+
+ @Override
+- @Override
+- public void entityInside(BlockState blockstate, Level level, BlockPos blockpos, Entity entity) {
++ public void entityInside(IBlockData state, Level level, BlockPos pos, Entity entity) {
++ CraftEventFactory.blockDamage = level.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()); // CraftBukkit
+ entity.hurt(level.damageSources().cactus(), 1.0F);
++ CraftEventFactory.blockDamage = null; // CraftBukkit
+ }
+
+ @Override
+- @Override
+- protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> statedefinition_builder) {
+- statedefinition_builder.add(CactusBlock.AGE);
++ protected void createBlockStateDefinition(StateDefinition.Builder<Block, IBlockData> builder) {
++ builder.add(CactusBlock.AGE);
+ }
+
+ @Override
+- @Override
+- public boolean isPathfindable(BlockState blockstate, BlockGetter blockgetter, BlockPos blockpos, PathComputationType pathcomputationtype) {
++ public boolean isPathfindable(IBlockData state, BlockGetter level, BlockPos pos, PathMode type) {
+ return false;
+ }
+ }