aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower/net/minecraft/world/level/block/DoublePlantBlock.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/level/block/DoublePlantBlock.java.patch')
-rw-r--r--patch-remap/mache-spigotflower/net/minecraft/world/level/block/DoublePlantBlock.java.patch181
1 files changed, 181 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/level/block/DoublePlantBlock.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/level/block/DoublePlantBlock.java.patch
new file mode 100644
index 0000000000..4321cd8ff5
--- /dev/null
+++ b/patch-remap/mache-spigotflower/net/minecraft/world/level/block/DoublePlantBlock.java.patch
@@ -0,0 +1,181 @@
+--- a/net/minecraft/world/level/block/DoublePlantBlock.java
++++ b/net/minecraft/world/level/block/DoublePlantBlock.java
+@@ -14,10 +14,10 @@
+ import net.minecraft.world.level.LevelReader;
+ import net.minecraft.world.level.block.entity.BlockEntity;
+ 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.BlockPropertyDoubleBlockHalf;
+ import net.minecraft.world.level.block.state.properties.BlockStateProperties;
+-import net.minecraft.world.level.block.state.properties.DoubleBlockHalf;
+ import net.minecraft.world.level.block.state.properties.EnumProperty;
+ import net.minecraft.world.level.material.Fluid;
+ import net.minecraft.world.level.material.Fluids;
+@@ -25,114 +25,110 @@
+ public class DoublePlantBlock extends BushBlock {
+
+ public static final MapCodec<DoublePlantBlock> CODEC = simpleCodec(DoublePlantBlock::new);
+- public static final EnumProperty<DoubleBlockHalf> HALF = BlockStateProperties.DOUBLE_BLOCK_HALF;
++ public static final EnumProperty<BlockPropertyDoubleBlockHalf> HALF = BlockStateProperties.DOUBLE_BLOCK_HALF;
+
+ @Override
+- @Override
+ public MapCodec<? extends DoublePlantBlock> codec() {
+ return DoublePlantBlock.CODEC;
+ }
+
+- public DoublePlantBlock(BlockBehaviour.Properties blockbehaviour_properties) {
+- super(blockbehaviour_properties);
+- this.registerDefaultState((BlockState) ((BlockState) this.stateDefinition.any()).setValue(DoublePlantBlock.HALF, DoubleBlockHalf.LOWER));
++ public DoublePlantBlock(BlockBehaviour.Properties properties) {
++ super(properties);
++ this.registerDefaultState((IBlockData) ((IBlockData) this.stateDefinition.any()).setValue(DoublePlantBlock.HALF, BlockPropertyDoubleBlockHalf.LOWER));
+ }
+
+ @Override
+- @Override
+- public BlockState updateShape(BlockState blockstate, Direction direction, BlockState blockstate1, LevelAccessor levelaccessor, BlockPos blockpos, BlockPos blockpos1) {
+- DoubleBlockHalf doubleblockhalf = (DoubleBlockHalf) blockstate.getValue(DoublePlantBlock.HALF);
++ public IBlockData updateShape(IBlockData state, Direction facing, IBlockData facingState, LevelAccessor level, BlockPos currentPos, BlockPos facingPos) {
++ BlockPropertyDoubleBlockHalf blockpropertydoubleblockhalf = (BlockPropertyDoubleBlockHalf) state.getValue(DoublePlantBlock.HALF);
+
+- return direction.getAxis() == Direction.Axis.Y && doubleblockhalf == DoubleBlockHalf.LOWER == (direction == Direction.UP) && (!blockstate1.is((Block) this) || blockstate1.getValue(DoublePlantBlock.HALF) == doubleblockhalf) ? Blocks.AIR.defaultBlockState() : (doubleblockhalf == DoubleBlockHalf.LOWER && direction == Direction.DOWN && !blockstate.canSurvive(levelaccessor, blockpos) ? Blocks.AIR.defaultBlockState() : super.updateShape(blockstate, direction, blockstate1, levelaccessor, blockpos, blockpos1));
++ return facing.getAxis() == Direction.Axis.Y && blockpropertydoubleblockhalf == BlockPropertyDoubleBlockHalf.LOWER == (facing == Direction.UP) && (!facingState.is((Block) this) || facingState.getValue(DoublePlantBlock.HALF) == blockpropertydoubleblockhalf) ? Blocks.AIR.defaultBlockState() : (blockpropertydoubleblockhalf == BlockPropertyDoubleBlockHalf.LOWER && facing == Direction.DOWN && !state.canSurvive(level, currentPos) ? Blocks.AIR.defaultBlockState() : super.updateShape(state, facing, facingState, level, currentPos, facingPos));
+ }
+
+ @Nullable
+ @Override
+- @Override
+- public BlockState getStateForPlacement(BlockPlaceContext blockplacecontext) {
+- BlockPos blockpos = blockplacecontext.getClickedPos();
+- Level level = blockplacecontext.getLevel();
++ public IBlockData getStateForPlacement(BlockPlaceContext context) {
++ BlockPos blockposition = context.getClickedPos();
++ Level world = context.getLevel();
+
+- return blockpos.getY() < level.getMaxBuildHeight() - 1 && level.getBlockState(blockpos.above()).canBeReplaced(blockplacecontext) ? super.getStateForPlacement(blockplacecontext) : null;
++ return blockposition.getY() < world.getMaxBuildHeight() - 1 && world.getBlockState(blockposition.above()).canBeReplaced(context) ? super.getStateForPlacement(context) : null;
+ }
+
+ @Override
+- @Override
+- public void setPlacedBy(Level level, BlockPos blockpos, BlockState blockstate, LivingEntity livingentity, ItemStack itemstack) {
+- BlockPos blockpos1 = blockpos.above();
++ public void setPlacedBy(Level level, BlockPos pos, IBlockData state, LivingEntity placer, ItemStack stack) {
++ BlockPos blockposition1 = pos.above();
+
+- level.setBlock(blockpos1, copyWaterloggedFrom(level, blockpos1, (BlockState) this.defaultBlockState().setValue(DoublePlantBlock.HALF, DoubleBlockHalf.UPPER)), 3);
++ level.setBlock(blockposition1, copyWaterloggedFrom(level, blockposition1, (IBlockData) this.defaultBlockState().setValue(DoublePlantBlock.HALF, BlockPropertyDoubleBlockHalf.UPPER)), 3);
+ }
+
+ @Override
+- @Override
+- public boolean canSurvive(BlockState blockstate, LevelReader levelreader, BlockPos blockpos) {
+- if (blockstate.getValue(DoublePlantBlock.HALF) != DoubleBlockHalf.UPPER) {
+- return super.canSurvive(blockstate, levelreader, blockpos);
++ public boolean canSurvive(IBlockData state, LevelReader level, BlockPos pos) {
++ if (state.getValue(DoublePlantBlock.HALF) != BlockPropertyDoubleBlockHalf.UPPER) {
++ return super.canSurvive(state, level, pos);
+ } else {
+- BlockState blockstate1 = levelreader.getBlockState(blockpos.below());
++ IBlockData iblockdata1 = level.getBlockState(pos.below());
+
+- return blockstate1.is((Block) this) && blockstate1.getValue(DoublePlantBlock.HALF) == DoubleBlockHalf.LOWER;
++ return iblockdata1.is((Block) this) && iblockdata1.getValue(DoublePlantBlock.HALF) == BlockPropertyDoubleBlockHalf.LOWER;
+ }
+ }
+
+- public static void placeAt(LevelAccessor levelaccessor, BlockState blockstate, BlockPos blockpos, int i) {
+- BlockPos blockpos1 = blockpos.above();
++ public static void placeAt(LevelAccessor level, IBlockData state, BlockPos pos, int flags) {
++ BlockPos blockposition1 = pos.above();
+
+- levelaccessor.setBlock(blockpos, copyWaterloggedFrom(levelaccessor, blockpos, (BlockState) blockstate.setValue(DoublePlantBlock.HALF, DoubleBlockHalf.LOWER)), i);
+- levelaccessor.setBlock(blockpos1, copyWaterloggedFrom(levelaccessor, blockpos1, (BlockState) blockstate.setValue(DoublePlantBlock.HALF, DoubleBlockHalf.UPPER)), i);
++ level.setBlock(pos, copyWaterloggedFrom(level, pos, (IBlockData) state.setValue(DoublePlantBlock.HALF, BlockPropertyDoubleBlockHalf.LOWER)), flags);
++ level.setBlock(blockposition1, copyWaterloggedFrom(level, blockposition1, (IBlockData) state.setValue(DoublePlantBlock.HALF, BlockPropertyDoubleBlockHalf.UPPER)), flags);
+ }
+
+- public static BlockState copyWaterloggedFrom(LevelReader levelreader, BlockPos blockpos, BlockState blockstate) {
+- return blockstate.hasProperty(BlockStateProperties.WATERLOGGED) ? (BlockState) blockstate.setValue(BlockStateProperties.WATERLOGGED, levelreader.isWaterAt(blockpos)) : blockstate;
++ public static IBlockData copyWaterloggedFrom(LevelReader level, BlockPos pos, IBlockData state) {
++ return state.hasProperty(BlockStateProperties.WATERLOGGED) ? (IBlockData) state.setValue(BlockStateProperties.WATERLOGGED, level.isWaterAt(pos)) : state;
+ }
+
+ @Override
+- @Override
+- public BlockState playerWillDestroy(Level level, BlockPos blockpos, BlockState blockstate, Player player) {
+- if (!level.isClientSide) {
+- if (player.isCreative()) {
+- preventDropFromBottomPart(level, blockpos, blockstate, player);
++ public IBlockData playerWillDestroy(Level world, BlockPos blockposition, IBlockData iblockdata, Player entityhuman) {
++ if (!world.isClientSide) {
++ if (entityhuman.isCreative()) {
++ preventDropFromBottomPart(world, blockposition, iblockdata, entityhuman);
+ } else {
+- dropResources(blockstate, level, blockpos, (BlockEntity) null, player, player.getMainHandItem());
++ dropResources(iblockdata, world, blockposition, (BlockEntity) null, entityhuman, entityhuman.getMainHandItem());
+ }
+ }
+
+- return super.playerWillDestroy(level, blockpos, blockstate, player);
++ return super.playerWillDestroy(world, blockposition, iblockdata, entityhuman);
+ }
+
+ @Override
+- @Override
+- public void playerDestroy(Level level, Player player, BlockPos blockpos, BlockState blockstate, @Nullable BlockEntity blockentity, ItemStack itemstack) {
+- super.playerDestroy(level, player, blockpos, Blocks.AIR.defaultBlockState(), blockentity, itemstack);
++ public void playerDestroy(Level level, Player player, BlockPos pos, IBlockData state, @Nullable BlockEntity te, ItemStack stack) {
++ super.playerDestroy(level, player, pos, Blocks.AIR.defaultBlockState(), te, stack);
+ }
+
+- protected static void preventDropFromBottomPart(Level level, BlockPos blockpos, BlockState blockstate, Player player) {
+- DoubleBlockHalf doubleblockhalf = (DoubleBlockHalf) blockstate.getValue(DoublePlantBlock.HALF);
++ protected static void preventDropFromBottomPart(Level world, BlockPos blockposition, IBlockData iblockdata, Player entityhuman) {
++ // CraftBukkit start
++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world, blockposition).isCancelled()) {
++ return;
++ }
++ // CraftBukkit end
++ BlockPropertyDoubleBlockHalf blockpropertydoubleblockhalf = (BlockPropertyDoubleBlockHalf) iblockdata.getValue(DoublePlantBlock.HALF);
+
+- if (doubleblockhalf == DoubleBlockHalf.UPPER) {
+- BlockPos blockpos1 = blockpos.below();
+- BlockState blockstate1 = level.getBlockState(blockpos1);
++ if (blockpropertydoubleblockhalf == BlockPropertyDoubleBlockHalf.UPPER) {
++ BlockPos blockposition1 = blockposition.below();
++ IBlockData iblockdata1 = world.getBlockState(blockposition1);
+
+- if (blockstate1.is(blockstate.getBlock()) && blockstate1.getValue(DoublePlantBlock.HALF) == DoubleBlockHalf.LOWER) {
+- BlockState blockstate2 = blockstate1.getFluidState().is((Fluid) Fluids.WATER) ? Blocks.WATER.defaultBlockState() : Blocks.AIR.defaultBlockState();
++ if (iblockdata1.is(iblockdata.getBlock()) && iblockdata1.getValue(DoublePlantBlock.HALF) == BlockPropertyDoubleBlockHalf.LOWER) {
++ IBlockData iblockdata2 = iblockdata1.getFluidState().is((Fluid) Fluids.WATER) ? Blocks.WATER.defaultBlockState() : Blocks.AIR.defaultBlockState();
+
+- level.setBlock(blockpos1, blockstate2, 35);
+- level.levelEvent(player, 2001, blockpos1, Block.getId(blockstate1));
++ world.setBlock(blockposition1, iblockdata2, 35);
++ world.levelEvent(entityhuman, 2001, blockposition1, Block.getId(iblockdata1));
+ }
+ }
+
+ }
+
+ @Override
+- @Override
+- protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> statedefinition_builder) {
+- statedefinition_builder.add(DoublePlantBlock.HALF);
++ protected void createBlockStateDefinition(StateDefinition.Builder<Block, IBlockData> builder) {
++ builder.add(DoublePlantBlock.HALF);
+ }
+
+ @Override
+- @Override
+- public long getSeed(BlockState blockstate, BlockPos blockpos) {
+- return Mth.getSeed(blockpos.getX(), blockpos.below(blockstate.getValue(DoublePlantBlock.HALF) == DoubleBlockHalf.LOWER ? 0 : 1).getY(), blockpos.getZ());
++ public long getSeed(IBlockData state, BlockPos pos) {
++ return Mth.getSeed(pos.getX(), pos.below(state.getValue(DoublePlantBlock.HALF) == BlockPropertyDoubleBlockHalf.LOWER ? 0 : 1).getY(), pos.getZ());
+ }
+ }