diff options
author | MiniDigger | Martin <[email protected]> | 2024-01-14 11:04:49 +0100 |
---|---|---|
committer | MiniDigger | Martin <[email protected]> | 2024-01-14 11:04:49 +0100 |
commit | bee74680e607c2e29b038329f62181238911cd83 (patch) | |
tree | 708fd1a4a0227d9071243adf2a42d5e9e96cde4a /patch-remap/mache-spigotflower/net/minecraft/world/level/block/FenceGateBlock.java.patch | |
parent | 0a44692ef6ff6e255d48eb3ba1bb114166eafda9 (diff) | |
download | Paper-softspoon.tar.gz Paper-softspoon.zip |
add remapped patches as a testsoftspoon
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/level/block/FenceGateBlock.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower/net/minecraft/world/level/block/FenceGateBlock.java.patch | 261 |
1 files changed, 261 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/level/block/FenceGateBlock.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/level/block/FenceGateBlock.java.patch new file mode 100644 index 0000000000..59ad7260a5 --- /dev/null +++ b/patch-remap/mache-spigotflower/net/minecraft/world/level/block/FenceGateBlock.java.patch @@ -0,0 +1,261 @@ +--- a/net/minecraft/world/level/block/FenceGateBlock.java ++++ b/net/minecraft/world/level/block/FenceGateBlock.java +@@ -7,7 +7,7 @@ + import net.minecraft.core.Direction; + import net.minecraft.sounds.SoundSource; + import net.minecraft.tags.BlockTags; +-import net.minecraft.world.InteractionHand; ++import net.minecraft.world.EnumHand; + import net.minecraft.world.InteractionResult; + import net.minecraft.world.entity.Entity; + import net.minecraft.world.entity.player.Player; +@@ -18,13 +18,13 @@ + import net.minecraft.world.level.Level; + import net.minecraft.world.level.LevelAccessor; + 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.WoodType; + import net.minecraft.world.level.gameevent.GameEvent; +-import net.minecraft.world.level.pathfinder.PathComputationType; ++import net.minecraft.world.level.pathfinder.PathMode; + import net.minecraft.world.phys.BlockHitResult; + import net.minecraft.world.phys.shapes.CollisionContext; + import net.minecraft.world.phys.shapes.Shapes; +@@ -33,8 +33,8 @@ + public class FenceGateBlock extends HorizontalDirectionalBlock { + + public static final MapCodec<FenceGateBlock> CODEC = RecordCodecBuilder.mapCodec((instance) -> { +- return instance.group(WoodType.CODEC.fieldOf("wood_type").forGetter((fencegateblock) -> { +- return fencegateblock.type; ++ return instance.group(WoodType.CODEC.fieldOf("wood_type").forGetter((blockfencegate) -> { ++ return blockfencegate.type; + }), propertiesCodec()).apply(instance, FenceGateBlock::new); + }); + public static final BooleanProperty OPEN = BlockStateProperties.OPEN; +@@ -55,136 +55,136 @@ + private final WoodType type; + + @Override +- @Override + public MapCodec<FenceGateBlock> codec() { + return FenceGateBlock.CODEC; + } + +- public FenceGateBlock(WoodType woodtype, BlockBehaviour.Properties blockbehaviour_properties) { +- super(blockbehaviour_properties.sound(woodtype.soundType())); +- this.type = woodtype; +- this.registerDefaultState((BlockState) ((BlockState) ((BlockState) ((BlockState) this.stateDefinition.any()).setValue(FenceGateBlock.OPEN, false)).setValue(FenceGateBlock.POWERED, false)).setValue(FenceGateBlock.IN_WALL, false)); ++ public FenceGateBlock(WoodType blockpropertywood, BlockBehaviour.Properties blockbase_info) { ++ super(blockbase_info.sound(blockpropertywood.soundType())); ++ this.type = blockpropertywood; ++ this.registerDefaultState((IBlockData) ((IBlockData) ((IBlockData) ((IBlockData) this.stateDefinition.any()).setValue(FenceGateBlock.OPEN, false)).setValue(FenceGateBlock.POWERED, false)).setValue(FenceGateBlock.IN_WALL, false)); + } + + @Override +- @Override +- public VoxelShape getShape(BlockState blockstate, BlockGetter blockgetter, BlockPos blockpos, CollisionContext collisioncontext) { +- return (Boolean) blockstate.getValue(FenceGateBlock.IN_WALL) ? (((Direction) blockstate.getValue(FenceGateBlock.FACING)).getAxis() == Direction.Axis.X ? FenceGateBlock.X_SHAPE_LOW : FenceGateBlock.Z_SHAPE_LOW) : (((Direction) blockstate.getValue(FenceGateBlock.FACING)).getAxis() == Direction.Axis.X ? FenceGateBlock.X_SHAPE : FenceGateBlock.Z_SHAPE); ++ public VoxelShape getShape(IBlockData state, BlockGetter level, BlockPos pos, CollisionContext context) { ++ return (Boolean) state.getValue(FenceGateBlock.IN_WALL) ? (((Direction) state.getValue(FenceGateBlock.FACING)).getAxis() == Direction.Axis.X ? FenceGateBlock.X_SHAPE_LOW : FenceGateBlock.Z_SHAPE_LOW) : (((Direction) state.getValue(FenceGateBlock.FACING)).getAxis() == Direction.Axis.X ? FenceGateBlock.X_SHAPE : FenceGateBlock.Z_SHAPE); + } + + @Override +- @Override +- public BlockState updateShape(BlockState blockstate, Direction direction, BlockState blockstate1, LevelAccessor levelaccessor, BlockPos blockpos, BlockPos blockpos1) { +- Direction.Axis direction_axis = direction.getAxis(); ++ public IBlockData updateShape(IBlockData state, Direction facing, IBlockData facingState, LevelAccessor level, BlockPos currentPos, BlockPos facingPos) { ++ Direction.Axis enumdirection_enumaxis = facing.getAxis(); + +- if (((Direction) blockstate.getValue(FenceGateBlock.FACING)).getClockWise().getAxis() != direction_axis) { +- return super.updateShape(blockstate, direction, blockstate1, levelaccessor, blockpos, blockpos1); ++ if (((Direction) state.getValue(FenceGateBlock.FACING)).getClockWise().getAxis() != enumdirection_enumaxis) { ++ return super.updateShape(state, facing, facingState, level, currentPos, facingPos); + } else { +- boolean flag = this.isWall(blockstate1) || this.isWall(levelaccessor.getBlockState(blockpos.relative(direction.getOpposite()))); ++ boolean flag = this.isWall(facingState) || this.isWall(level.getBlockState(currentPos.relative(facing.getOpposite()))); + +- return (BlockState) blockstate.setValue(FenceGateBlock.IN_WALL, flag); ++ return (IBlockData) state.setValue(FenceGateBlock.IN_WALL, flag); + } + } + + @Override +- @Override +- public VoxelShape getBlockSupportShape(BlockState blockstate, BlockGetter blockgetter, BlockPos blockpos) { +- return (Boolean) blockstate.getValue(FenceGateBlock.OPEN) ? Shapes.empty() : (((Direction) blockstate.getValue(FenceGateBlock.FACING)).getAxis() == Direction.Axis.Z ? FenceGateBlock.Z_SUPPORT_SHAPE : FenceGateBlock.X_SUPPORT_SHAPE); ++ public VoxelShape getBlockSupportShape(IBlockData state, BlockGetter level, BlockPos pos) { ++ return (Boolean) state.getValue(FenceGateBlock.OPEN) ? Shapes.empty() : (((Direction) state.getValue(FenceGateBlock.FACING)).getAxis() == Direction.Axis.Z ? FenceGateBlock.Z_SUPPORT_SHAPE : FenceGateBlock.X_SUPPORT_SHAPE); + } + + @Override +- @Override +- public VoxelShape getCollisionShape(BlockState blockstate, BlockGetter blockgetter, BlockPos blockpos, CollisionContext collisioncontext) { +- return (Boolean) blockstate.getValue(FenceGateBlock.OPEN) ? Shapes.empty() : (((Direction) blockstate.getValue(FenceGateBlock.FACING)).getAxis() == Direction.Axis.Z ? FenceGateBlock.Z_COLLISION_SHAPE : FenceGateBlock.X_COLLISION_SHAPE); ++ public VoxelShape getCollisionShape(IBlockData state, BlockGetter level, BlockPos pos, CollisionContext context) { ++ return (Boolean) state.getValue(FenceGateBlock.OPEN) ? Shapes.empty() : (((Direction) state.getValue(FenceGateBlock.FACING)).getAxis() == Direction.Axis.Z ? FenceGateBlock.Z_COLLISION_SHAPE : FenceGateBlock.X_COLLISION_SHAPE); + } + + @Override +- @Override +- public VoxelShape getOcclusionShape(BlockState blockstate, BlockGetter blockgetter, BlockPos blockpos) { +- return (Boolean) blockstate.getValue(FenceGateBlock.IN_WALL) ? (((Direction) blockstate.getValue(FenceGateBlock.FACING)).getAxis() == Direction.Axis.X ? FenceGateBlock.X_OCCLUSION_SHAPE_LOW : FenceGateBlock.Z_OCCLUSION_SHAPE_LOW) : (((Direction) blockstate.getValue(FenceGateBlock.FACING)).getAxis() == Direction.Axis.X ? FenceGateBlock.X_OCCLUSION_SHAPE : FenceGateBlock.Z_OCCLUSION_SHAPE); ++ public VoxelShape getOcclusionShape(IBlockData state, BlockGetter level, BlockPos pos) { ++ return (Boolean) state.getValue(FenceGateBlock.IN_WALL) ? (((Direction) state.getValue(FenceGateBlock.FACING)).getAxis() == Direction.Axis.X ? FenceGateBlock.X_OCCLUSION_SHAPE_LOW : FenceGateBlock.Z_OCCLUSION_SHAPE_LOW) : (((Direction) state.getValue(FenceGateBlock.FACING)).getAxis() == Direction.Axis.X ? FenceGateBlock.X_OCCLUSION_SHAPE : FenceGateBlock.Z_OCCLUSION_SHAPE); + } + + @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 (Boolean) blockstate.getValue(FenceGateBlock.OPEN); ++ return (Boolean) state.getValue(FenceGateBlock.OPEN); + case WATER: + return false; + case AIR: +- return (Boolean) blockstate.getValue(FenceGateBlock.OPEN); ++ return (Boolean) state.getValue(FenceGateBlock.OPEN); + default: + return false; + } + } + + @Override +- @Override +- public BlockState getStateForPlacement(BlockPlaceContext blockplacecontext) { +- Level level = blockplacecontext.getLevel(); +- BlockPos blockpos = blockplacecontext.getClickedPos(); +- boolean flag = level.hasNeighborSignal(blockpos); +- Direction direction = blockplacecontext.getHorizontalDirection(); +- Direction.Axis direction_axis = direction.getAxis(); +- boolean flag1 = direction_axis == Direction.Axis.Z && (this.isWall(level.getBlockState(blockpos.west())) || this.isWall(level.getBlockState(blockpos.east()))) || direction_axis == Direction.Axis.X && (this.isWall(level.getBlockState(blockpos.north())) || this.isWall(level.getBlockState(blockpos.south()))); ++ public IBlockData getStateForPlacement(BlockPlaceContext context) { ++ Level world = context.getLevel(); ++ BlockPos blockposition = context.getClickedPos(); ++ boolean flag = world.hasNeighborSignal(blockposition); ++ Direction enumdirection = context.getHorizontalDirection(); ++ Direction.Axis enumdirection_enumaxis = enumdirection.getAxis(); ++ boolean flag1 = enumdirection_enumaxis == Direction.Axis.Z && (this.isWall(world.getBlockState(blockposition.west())) || this.isWall(world.getBlockState(blockposition.east()))) || enumdirection_enumaxis == Direction.Axis.X && (this.isWall(world.getBlockState(blockposition.north())) || this.isWall(world.getBlockState(blockposition.south()))); + +- return (BlockState) ((BlockState) ((BlockState) ((BlockState) this.defaultBlockState().setValue(FenceGateBlock.FACING, direction)).setValue(FenceGateBlock.OPEN, flag)).setValue(FenceGateBlock.POWERED, flag)).setValue(FenceGateBlock.IN_WALL, flag1); ++ return (IBlockData) ((IBlockData) ((IBlockData) ((IBlockData) this.defaultBlockState().setValue(FenceGateBlock.FACING, enumdirection)).setValue(FenceGateBlock.OPEN, flag)).setValue(FenceGateBlock.POWERED, flag)).setValue(FenceGateBlock.IN_WALL, flag1); + } + +- private boolean isWall(BlockState blockstate) { +- return blockstate.is(BlockTags.WALLS); ++ private boolean isWall(IBlockData state) { ++ return state.is(BlockTags.WALLS); + } + + @Override +- @Override +- public InteractionResult use(BlockState blockstate, Level level, BlockPos blockpos, Player player, InteractionHand interactionhand, BlockHitResult blockhitresult) { +- if ((Boolean) blockstate.getValue(FenceGateBlock.OPEN)) { +- blockstate = (BlockState) blockstate.setValue(FenceGateBlock.OPEN, false); +- level.setBlock(blockpos, blockstate, 10); ++ public InteractionResult use(IBlockData state, Level level, BlockPos pos, Player player, EnumHand hand, BlockHitResult hit) { ++ if ((Boolean) state.getValue(FenceGateBlock.OPEN)) { ++ state = (IBlockData) state.setValue(FenceGateBlock.OPEN, false); ++ level.setBlock(pos, state, 10); + } else { +- Direction direction = player.getDirection(); ++ Direction enumdirection = player.getDirection(); + +- if (blockstate.getValue(FenceGateBlock.FACING) == direction.getOpposite()) { +- blockstate = (BlockState) blockstate.setValue(FenceGateBlock.FACING, direction); ++ if (state.getValue(FenceGateBlock.FACING) == enumdirection.getOpposite()) { ++ state = (IBlockData) state.setValue(FenceGateBlock.FACING, enumdirection); + } + +- blockstate = (BlockState) blockstate.setValue(FenceGateBlock.OPEN, true); +- level.setBlock(blockpos, blockstate, 10); ++ state = (IBlockData) state.setValue(FenceGateBlock.OPEN, true); ++ level.setBlock(pos, state, 10); + } + +- boolean flag = (Boolean) blockstate.getValue(FenceGateBlock.OPEN); ++ boolean flag = (Boolean) state.getValue(FenceGateBlock.OPEN); + +- level.playSound(player, blockpos, flag ? this.type.fenceGateOpen() : this.type.fenceGateClose(), SoundSource.BLOCKS, 1.0F, level.getRandom().nextFloat() * 0.1F + 0.9F); +- level.gameEvent((Entity) player, flag ? GameEvent.BLOCK_OPEN : GameEvent.BLOCK_CLOSE, blockpos); ++ level.playSound(player, pos, flag ? this.type.fenceGateOpen() : this.type.fenceGateClose(), SoundSource.BLOCKS, 1.0F, level.getRandom().nextFloat() * 0.1F + 0.9F); ++ level.gameEvent((Entity) player, flag ? GameEvent.BLOCK_OPEN : GameEvent.BLOCK_CLOSE, pos); + return InteractionResult.sidedSuccess(level.isClientSide); + } + + @Override +- @Override +- public void onExplosionHit(BlockState blockstate, Level level, BlockPos blockpos, Explosion explosion, BiConsumer<ItemStack, BlockPos> biconsumer) { +- if (explosion.getBlockInteraction() == Explosion.BlockInteraction.TRIGGER_BLOCK && !level.isClientSide() && !(Boolean) blockstate.getValue(FenceGateBlock.POWERED)) { +- boolean flag = (Boolean) blockstate.getValue(FenceGateBlock.OPEN); ++ public void onExplosionHit(IBlockData iblockdata, Level world, BlockPos blockposition, Explosion explosion, BiConsumer<ItemStack, BlockPos> biconsumer) { ++ if (explosion.getBlockInteraction() == Explosion.Effect.TRIGGER_BLOCK && !world.isClientSide() && !(Boolean) iblockdata.getValue(FenceGateBlock.POWERED)) { ++ boolean flag = (Boolean) iblockdata.getValue(FenceGateBlock.OPEN); + +- level.setBlockAndUpdate(blockpos, (BlockState) blockstate.setValue(FenceGateBlock.OPEN, !flag)); +- level.playSound((Player) null, blockpos, flag ? this.type.fenceGateClose() : this.type.fenceGateOpen(), SoundSource.BLOCKS, 1.0F, level.getRandom().nextFloat() * 0.1F + 0.9F); +- level.gameEvent(flag ? GameEvent.BLOCK_CLOSE : GameEvent.BLOCK_OPEN, blockpos, GameEvent.Context.of(blockstate)); ++ world.setBlockAndUpdate(blockposition, (IBlockData) iblockdata.setValue(FenceGateBlock.OPEN, !flag)); ++ world.playSound((Player) null, blockposition, flag ? this.type.fenceGateClose() : this.type.fenceGateOpen(), SoundSource.BLOCKS, 1.0F, world.getRandom().nextFloat() * 0.1F + 0.9F); ++ world.gameEvent(flag ? GameEvent.BLOCK_CLOSE : GameEvent.BLOCK_OPEN, blockposition, GameEvent.Context.of(iblockdata)); + } + +- super.onExplosionHit(blockstate, level, blockpos, explosion, biconsumer); ++ super.onExplosionHit(iblockdata, world, blockposition, explosion, biconsumer); + } + + @Override +- @Override +- public void neighborChanged(BlockState blockstate, Level level, BlockPos blockpos, Block block, BlockPos blockpos1, boolean flag) { ++ public void neighborChanged(IBlockData state, Level level, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving) { + if (!level.isClientSide) { +- boolean flag1 = level.hasNeighborSignal(blockpos); ++ boolean flag1 = level.hasNeighborSignal(pos); ++ // CraftBukkit start ++ boolean oldPowered = state.getValue(FenceGateBlock.POWERED); ++ if (oldPowered != flag1) { ++ int newPower = flag1 ? 15 : 0; ++ int oldPower = oldPowered ? 15 : 0; ++ org.bukkit.block.Block bukkitBlock = org.bukkit.craftbukkit.block.CraftBlock.at(level, pos); ++ org.bukkit.event.block.BlockRedstoneEvent eventRedstone = new org.bukkit.event.block.BlockRedstoneEvent(bukkitBlock, oldPower, newPower); ++ level.getCraftServer().getPluginManager().callEvent(eventRedstone); ++ flag1 = eventRedstone.getNewCurrent() > 0; ++ } ++ // CraftBukkit end + +- if ((Boolean) blockstate.getValue(FenceGateBlock.POWERED) != flag1) { +- level.setBlock(blockpos, (BlockState) ((BlockState) blockstate.setValue(FenceGateBlock.POWERED, flag1)).setValue(FenceGateBlock.OPEN, flag1), 2); +- if ((Boolean) blockstate.getValue(FenceGateBlock.OPEN) != flag1) { +- level.playSound((Player) null, blockpos, flag1 ? this.type.fenceGateOpen() : this.type.fenceGateClose(), SoundSource.BLOCKS, 1.0F, level.getRandom().nextFloat() * 0.1F + 0.9F); +- level.gameEvent((Entity) null, flag1 ? GameEvent.BLOCK_OPEN : GameEvent.BLOCK_CLOSE, blockpos); ++ if ((Boolean) state.getValue(FenceGateBlock.POWERED) != flag1) { ++ level.setBlock(pos, (IBlockData) ((IBlockData) state.setValue(FenceGateBlock.POWERED, flag1)).setValue(FenceGateBlock.OPEN, flag1), 2); ++ if ((Boolean) state.getValue(FenceGateBlock.OPEN) != flag1) { ++ level.playSound((Player) null, pos, flag1 ? this.type.fenceGateOpen() : this.type.fenceGateClose(), SoundSource.BLOCKS, 1.0F, level.getRandom().nextFloat() * 0.1F + 0.9F); ++ level.gameEvent((Entity) null, flag1 ? GameEvent.BLOCK_OPEN : GameEvent.BLOCK_CLOSE, pos); + } + } + +@@ -192,12 +192,11 @@ + } + + @Override +- @Override +- protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> statedefinition_builder) { +- statedefinition_builder.add(FenceGateBlock.FACING, FenceGateBlock.OPEN, FenceGateBlock.POWERED, FenceGateBlock.IN_WALL); ++ protected void createBlockStateDefinition(StateDefinition.Builder<Block, IBlockData> builder) { ++ builder.add(FenceGateBlock.FACING, FenceGateBlock.OPEN, FenceGateBlock.POWERED, FenceGateBlock.IN_WALL); + } + +- public static boolean connectsToDirection(BlockState blockstate, Direction direction) { +- return ((Direction) blockstate.getValue(FenceGateBlock.FACING)).getAxis() == direction.getClockWise().getAxis(); ++ public static boolean connectsToDirection(IBlockData state, Direction direction) { ++ return ((Direction) state.getValue(FenceGateBlock.FACING)).getAxis() == direction.getClockWise().getAxis(); + } + } |