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/SculkShriekerBlock.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/SculkShriekerBlock.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower/net/minecraft/world/level/block/SculkShriekerBlock.java.patch | 204 |
1 files changed, 204 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/level/block/SculkShriekerBlock.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/level/block/SculkShriekerBlock.java.patch new file mode 100644 index 0000000000..585a60f135 --- /dev/null +++ b/patch-remap/mache-spigotflower/net/minecraft/world/level/block/SculkShriekerBlock.java.patch @@ -0,0 +1,204 @@ +--- a/net/minecraft/world/level/block/SculkShriekerBlock.java ++++ b/net/minecraft/world/level/block/SculkShriekerBlock.java +@@ -19,7 +19,7 @@ + import net.minecraft.world.level.block.entity.BlockEntityType; + import net.minecraft.world.level.block.entity.SculkShriekerBlockEntity; + 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; +@@ -40,139 +40,132 @@ + public static final double TOP_Y = SculkShriekerBlock.COLLIDER.max(Direction.Axis.Y); + + @Override +- @Override + public MapCodec<SculkShriekerBlock> codec() { + return SculkShriekerBlock.CODEC; + } + +- public SculkShriekerBlock(BlockBehaviour.Properties blockbehaviour_properties) { +- super(blockbehaviour_properties); +- this.registerDefaultState((BlockState) ((BlockState) ((BlockState) ((BlockState) this.stateDefinition.any()).setValue(SculkShriekerBlock.SHRIEKING, false)).setValue(SculkShriekerBlock.WATERLOGGED, false)).setValue(SculkShriekerBlock.CAN_SUMMON, false)); ++ public SculkShriekerBlock(BlockBehaviour.Properties properties) { ++ super(properties); ++ this.registerDefaultState((IBlockData) ((IBlockData) ((IBlockData) ((IBlockData) this.stateDefinition.any()).setValue(SculkShriekerBlock.SHRIEKING, false)).setValue(SculkShriekerBlock.WATERLOGGED, false)).setValue(SculkShriekerBlock.CAN_SUMMON, false)); + } + + @Override +- @Override +- protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> statedefinition_builder) { +- statedefinition_builder.add(SculkShriekerBlock.SHRIEKING); +- statedefinition_builder.add(SculkShriekerBlock.WATERLOGGED); +- statedefinition_builder.add(SculkShriekerBlock.CAN_SUMMON); ++ protected void createBlockStateDefinition(StateDefinition.Builder<Block, IBlockData> builder) { ++ builder.add(SculkShriekerBlock.SHRIEKING); ++ builder.add(SculkShriekerBlock.WATERLOGGED); ++ builder.add(SculkShriekerBlock.CAN_SUMMON); + } + + @Override +- @Override +- public void stepOn(Level level, BlockPos blockpos, BlockState blockstate, Entity entity) { ++ public void stepOn(Level level, BlockPos pos, IBlockData state, Entity entity) { + if (level instanceof ServerLevel) { +- ServerLevel serverlevel = (ServerLevel) level; +- ServerPlayer serverplayer = SculkShriekerBlockEntity.tryGetPlayer(entity); ++ ServerLevel worldserver = (ServerLevel) level; ++ ServerPlayer entityplayer = SculkShriekerBlockEntity.tryGetPlayer(entity); + +- if (serverplayer != null) { +- serverlevel.getBlockEntity(blockpos, BlockEntityType.SCULK_SHRIEKER).ifPresent((sculkshriekerblockentity) -> { +- sculkshriekerblockentity.tryShriek(serverlevel, serverplayer); ++ if (entityplayer != null) { ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(entityplayer, org.bukkit.event.block.Action.PHYSICAL, pos, null, null, null).isCancelled()) return; // CraftBukkit ++ worldserver.getBlockEntity(pos, BlockEntityType.SCULK_SHRIEKER).ifPresent((sculkshriekerblockentity) -> { ++ sculkshriekerblockentity.tryShriek(worldserver, entityplayer); + }); + } + } + +- super.stepOn(level, blockpos, blockstate, entity); ++ super.stepOn(level, pos, state, entity); + } + + @Override +- @Override +- public void onRemove(BlockState blockstate, Level level, BlockPos blockpos, BlockState blockstate1, boolean flag) { ++ public void onRemove(IBlockData state, Level level, BlockPos pos, IBlockData newState, boolean movedByPiston) { + if (level instanceof ServerLevel) { +- ServerLevel serverlevel = (ServerLevel) level; ++ ServerLevel worldserver = (ServerLevel) level; + +- if ((Boolean) blockstate.getValue(SculkShriekerBlock.SHRIEKING) && !blockstate.is(blockstate1.getBlock())) { +- serverlevel.getBlockEntity(blockpos, BlockEntityType.SCULK_SHRIEKER).ifPresent((sculkshriekerblockentity) -> { +- sculkshriekerblockentity.tryRespond(serverlevel); ++ if ((Boolean) state.getValue(SculkShriekerBlock.SHRIEKING) && !state.is(newState.getBlock())) { ++ worldserver.getBlockEntity(pos, BlockEntityType.SCULK_SHRIEKER).ifPresent((sculkshriekerblockentity) -> { ++ sculkshriekerblockentity.tryRespond(worldserver); + }); + } + } + +- super.onRemove(blockstate, level, blockpos, blockstate1, flag); ++ super.onRemove(state, level, pos, newState, movedByPiston); + } + + @Override +- @Override +- public void tick(BlockState blockstate, ServerLevel serverlevel, BlockPos blockpos, RandomSource randomsource) { +- if ((Boolean) blockstate.getValue(SculkShriekerBlock.SHRIEKING)) { +- serverlevel.setBlock(blockpos, (BlockState) blockstate.setValue(SculkShriekerBlock.SHRIEKING, false), 3); +- serverlevel.getBlockEntity(blockpos, BlockEntityType.SCULK_SHRIEKER).ifPresent((sculkshriekerblockentity) -> { +- sculkshriekerblockentity.tryRespond(serverlevel); ++ public void tick(IBlockData state, ServerLevel level, BlockPos pos, RandomSource random) { ++ if ((Boolean) state.getValue(SculkShriekerBlock.SHRIEKING)) { ++ level.setBlock(pos, (IBlockData) state.setValue(SculkShriekerBlock.SHRIEKING, false), 3); ++ level.getBlockEntity(pos, BlockEntityType.SCULK_SHRIEKER).ifPresent((sculkshriekerblockentity) -> { ++ sculkshriekerblockentity.tryRespond(level); + }); + } + + } + + @Override +- @Override +- public RenderShape getRenderShape(BlockState blockstate) { +- return RenderShape.MODEL; ++ public EnumRenderType getRenderShape(IBlockData state) { ++ return EnumRenderType.MODEL; + } + + @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 SculkShriekerBlock.COLLIDER; + } + + @Override +- @Override +- public VoxelShape getOcclusionShape(BlockState blockstate, BlockGetter blockgetter, BlockPos blockpos) { ++ public VoxelShape getOcclusionShape(IBlockData state, BlockGetter level, BlockPos pos) { + return SculkShriekerBlock.COLLIDER; + } + + @Override +- @Override +- public boolean useShapeForLightOcclusion(BlockState blockstate) { ++ public boolean useShapeForLightOcclusion(IBlockData state) { + return true; + } + + @Nullable + @Override +- @Override +- public BlockEntity newBlockEntity(BlockPos blockpos, BlockState blockstate) { +- return new SculkShriekerBlockEntity(blockpos, blockstate); ++ public BlockEntity newBlockEntity(BlockPos pos, IBlockData state) { ++ return new SculkShriekerBlockEntity(pos, state); + } + + @Override +- @Override +- public BlockState updateShape(BlockState blockstate, Direction direction, BlockState blockstate1, LevelAccessor levelaccessor, BlockPos blockpos, BlockPos blockpos1) { +- if ((Boolean) blockstate.getValue(SculkShriekerBlock.WATERLOGGED)) { +- levelaccessor.scheduleTick(blockpos, (Fluid) Fluids.WATER, Fluids.WATER.getTickDelay(levelaccessor)); ++ public IBlockData updateShape(IBlockData state, Direction direction, IBlockData neighborState, LevelAccessor level, BlockPos pos, BlockPos neighborPos) { ++ if ((Boolean) state.getValue(SculkShriekerBlock.WATERLOGGED)) { ++ level.scheduleTick(pos, (Fluid) Fluids.WATER, Fluids.WATER.getTickDelay(level)); + } + +- return super.updateShape(blockstate, direction, blockstate1, levelaccessor, blockpos, blockpos1); ++ return super.updateShape(state, direction, neighborState, level, pos, neighborPos); + } + + @Nullable + @Override ++ public IBlockData getStateForPlacement(BlockPlaceContext context) { ++ return (IBlockData) this.defaultBlockState().setValue(SculkShriekerBlock.WATERLOGGED, context.getLevel().getFluidState(context.getClickedPos()).getType() == Fluids.WATER); ++ } ++ + @Override +- public BlockState getStateForPlacement(BlockPlaceContext blockplacecontext) { +- return (BlockState) this.defaultBlockState().setValue(SculkShriekerBlock.WATERLOGGED, blockplacecontext.getLevel().getFluidState(blockplacecontext.getClickedPos()).getType() == Fluids.WATER); ++ public FluidState getFluidState(IBlockData state) { ++ return (Boolean) state.getValue(SculkShriekerBlock.WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(state); + } + + @Override +- @Override +- public FluidState getFluidState(BlockState blockstate) { +- return (Boolean) blockstate.getValue(SculkShriekerBlock.WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(blockstate); ++ public void spawnAfterBreak(IBlockData state, ServerLevel level, BlockPos pos, ItemStack stack, boolean dropExperience) { ++ super.spawnAfterBreak(state, level, pos, stack, dropExperience); ++ // CraftBukkit start - Delegate to getExpDrop + } + + @Override +- @Override +- public void spawnAfterBreak(BlockState blockstate, ServerLevel serverlevel, BlockPos blockpos, ItemStack itemstack, boolean flag) { +- super.spawnAfterBreak(blockstate, serverlevel, blockpos, itemstack, flag); ++ public int getExpDrop(IBlockData iblockdata, ServerLevel worldserver, BlockPos blockposition, ItemStack itemstack, boolean flag) { + if (flag) { +- this.tryDropExperience(serverlevel, blockpos, itemstack, ConstantInt.of(5)); ++ return this.tryDropExperience(worldserver, blockposition, itemstack, ConstantInt.of(5)); + } + ++ return 0; ++ // CraftBukkit end + } + + @Nullable + @Override +- @Override +- public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState blockstate, BlockEntityType<T> blockentitytype) { +- return !level.isClientSide ? BaseEntityBlock.createTickerHelper(blockentitytype, BlockEntityType.SCULK_SHRIEKER, (level1, blockpos, blockstate1, sculkshriekerblockentity) -> { +- VibrationSystem.Ticker.tick(level1, sculkshriekerblockentity.getVibrationData(), sculkshriekerblockentity.getVibrationUser()); ++ public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, IBlockData state, BlockEntityType<T> blockEntityType) { ++ return !level.isClientSide ? BaseEntityBlock.createTickerHelper(blockEntityType, BlockEntityType.SCULK_SHRIEKER, (world1, blockposition, iblockdata1, sculkshriekerblockentity) -> { ++ VibrationSystem.Ticker.tick(world1, sculkshriekerblockentity.getVibrationData(), sculkshriekerblockentity.getVibrationUser()); + }) : null; + } + } |