diff options
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/level/block/BaseFireBlock.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower/net/minecraft/world/level/block/BaseFireBlock.java.patch | 280 |
1 files changed, 280 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/level/block/BaseFireBlock.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/level/block/BaseFireBlock.java.patch new file mode 100644 index 0000000000..ec81b5847a --- /dev/null +++ b/patch-remap/mache-spigotflower/net/minecraft/world/level/block/BaseFireBlock.java.patch @@ -0,0 +1,280 @@ +--- a/net/minecraft/world/level/block/BaseFireBlock.java ++++ b/net/minecraft/world/level/block/BaseFireBlock.java +@@ -14,7 +14,7 @@ + import net.minecraft.world.level.BlockGetter; + import net.minecraft.world.level.Level; + 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.portal.PortalShape; + import net.minecraft.world.phys.shapes.CollisionContext; + import net.minecraft.world.phys.shapes.VoxelShape; +@@ -26,126 +26,127 @@ + protected static final float AABB_OFFSET = 1.0F; + protected static final VoxelShape DOWN_AABB = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 1.0D, 16.0D); + +- public BaseFireBlock(BlockBehaviour.Properties blockbehaviour_properties, float f) { +- super(blockbehaviour_properties); +- this.fireDamage = f; ++ public BaseFireBlock(BlockBehaviour.Properties properties, float fireDamage) { ++ super(properties); ++ this.fireDamage = fireDamage; + } + + @Override +- @Override + protected abstract MapCodec<? extends BaseFireBlock> codec(); + + @Override +- @Override +- public BlockState getStateForPlacement(BlockPlaceContext blockplacecontext) { +- return getState(blockplacecontext.getLevel(), blockplacecontext.getClickedPos()); ++ public IBlockData getStateForPlacement(BlockPlaceContext context) { ++ return getState(context.getLevel(), context.getClickedPos()); + } + +- public static BlockState getState(BlockGetter blockgetter, BlockPos blockpos) { +- BlockPos blockpos1 = blockpos.below(); +- BlockState blockstate = blockgetter.getBlockState(blockpos1); ++ public static IBlockData getState(BlockGetter reader, BlockPos pos) { ++ BlockPos blockposition1 = pos.below(); ++ IBlockData iblockdata = reader.getBlockState(blockposition1); + +- return SoulFireBlock.canSurviveOnBlock(blockstate) ? Blocks.SOUL_FIRE.defaultBlockState() : ((FireBlock) Blocks.FIRE).getStateForPlacement(blockgetter, blockpos); ++ return SoulFireBlock.canSurviveOnBlock(iblockdata) ? Blocks.SOUL_FIRE.defaultBlockState() : ((FireBlock) Blocks.FIRE).getStateForPlacement(reader, pos); + } + + @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 BaseFireBlock.DOWN_AABB; + } + + @Override +- @Override +- public void animateTick(BlockState blockstate, Level level, BlockPos blockpos, RandomSource randomsource) { +- if (randomsource.nextInt(24) == 0) { +- level.playLocalSound((double) blockpos.getX() + 0.5D, (double) blockpos.getY() + 0.5D, (double) blockpos.getZ() + 0.5D, SoundEvents.FIRE_AMBIENT, SoundSource.BLOCKS, 1.0F + randomsource.nextFloat(), randomsource.nextFloat() * 0.7F + 0.3F, false); ++ public void animateTick(IBlockData state, Level level, BlockPos pos, RandomSource random) { ++ if (random.nextInt(24) == 0) { ++ level.playLocalSound((double) pos.getX() + 0.5D, (double) pos.getY() + 0.5D, (double) pos.getZ() + 0.5D, SoundEvents.FIRE_AMBIENT, SoundSource.BLOCKS, 1.0F + random.nextFloat(), random.nextFloat() * 0.7F + 0.3F, false); + } + +- BlockPos blockpos1 = blockpos.below(); +- BlockState blockstate1 = level.getBlockState(blockpos1); ++ BlockPos blockposition1 = pos.below(); ++ IBlockData iblockdata1 = level.getBlockState(blockposition1); + double d0; + double d1; + double d2; + int i; + +- if (!this.canBurn(blockstate1) && !blockstate1.isFaceSturdy(level, blockpos1, Direction.UP)) { +- if (this.canBurn(level.getBlockState(blockpos.west()))) { ++ if (!this.canBurn(iblockdata1) && !iblockdata1.isFaceSturdy(level, blockposition1, Direction.UP)) { ++ if (this.canBurn(level.getBlockState(pos.west()))) { + for (i = 0; i < 2; ++i) { +- d0 = (double) blockpos.getX() + randomsource.nextDouble() * 0.10000000149011612D; +- d1 = (double) blockpos.getY() + randomsource.nextDouble(); +- d2 = (double) blockpos.getZ() + randomsource.nextDouble(); ++ d0 = (double) pos.getX() + random.nextDouble() * 0.10000000149011612D; ++ d1 = (double) pos.getY() + random.nextDouble(); ++ d2 = (double) pos.getZ() + random.nextDouble(); + level.addParticle(ParticleTypes.LARGE_SMOKE, d0, d1, d2, 0.0D, 0.0D, 0.0D); + } + } + +- if (this.canBurn(level.getBlockState(blockpos.east()))) { ++ if (this.canBurn(level.getBlockState(pos.east()))) { + for (i = 0; i < 2; ++i) { +- d0 = (double) (blockpos.getX() + 1) - randomsource.nextDouble() * 0.10000000149011612D; +- d1 = (double) blockpos.getY() + randomsource.nextDouble(); +- d2 = (double) blockpos.getZ() + randomsource.nextDouble(); ++ d0 = (double) (pos.getX() + 1) - random.nextDouble() * 0.10000000149011612D; ++ d1 = (double) pos.getY() + random.nextDouble(); ++ d2 = (double) pos.getZ() + random.nextDouble(); + level.addParticle(ParticleTypes.LARGE_SMOKE, d0, d1, d2, 0.0D, 0.0D, 0.0D); + } + } + +- if (this.canBurn(level.getBlockState(blockpos.north()))) { ++ if (this.canBurn(level.getBlockState(pos.north()))) { + for (i = 0; i < 2; ++i) { +- d0 = (double) blockpos.getX() + randomsource.nextDouble(); +- d1 = (double) blockpos.getY() + randomsource.nextDouble(); +- d2 = (double) blockpos.getZ() + randomsource.nextDouble() * 0.10000000149011612D; ++ d0 = (double) pos.getX() + random.nextDouble(); ++ d1 = (double) pos.getY() + random.nextDouble(); ++ d2 = (double) pos.getZ() + random.nextDouble() * 0.10000000149011612D; + level.addParticle(ParticleTypes.LARGE_SMOKE, d0, d1, d2, 0.0D, 0.0D, 0.0D); + } + } + +- if (this.canBurn(level.getBlockState(blockpos.south()))) { ++ if (this.canBurn(level.getBlockState(pos.south()))) { + for (i = 0; i < 2; ++i) { +- d0 = (double) blockpos.getX() + randomsource.nextDouble(); +- d1 = (double) blockpos.getY() + randomsource.nextDouble(); +- d2 = (double) (blockpos.getZ() + 1) - randomsource.nextDouble() * 0.10000000149011612D; ++ d0 = (double) pos.getX() + random.nextDouble(); ++ d1 = (double) pos.getY() + random.nextDouble(); ++ d2 = (double) (pos.getZ() + 1) - random.nextDouble() * 0.10000000149011612D; + level.addParticle(ParticleTypes.LARGE_SMOKE, d0, d1, d2, 0.0D, 0.0D, 0.0D); + } + } + +- if (this.canBurn(level.getBlockState(blockpos.above()))) { ++ if (this.canBurn(level.getBlockState(pos.above()))) { + for (i = 0; i < 2; ++i) { +- d0 = (double) blockpos.getX() + randomsource.nextDouble(); +- d1 = (double) (blockpos.getY() + 1) - randomsource.nextDouble() * 0.10000000149011612D; +- d2 = (double) blockpos.getZ() + randomsource.nextDouble(); ++ d0 = (double) pos.getX() + random.nextDouble(); ++ d1 = (double) (pos.getY() + 1) - random.nextDouble() * 0.10000000149011612D; ++ d2 = (double) pos.getZ() + random.nextDouble(); + level.addParticle(ParticleTypes.LARGE_SMOKE, d0, d1, d2, 0.0D, 0.0D, 0.0D); + } + } + } else { + for (i = 0; i < 3; ++i) { +- d0 = (double) blockpos.getX() + randomsource.nextDouble(); +- d1 = (double) blockpos.getY() + randomsource.nextDouble() * 0.5D + 0.5D; +- d2 = (double) blockpos.getZ() + randomsource.nextDouble(); ++ d0 = (double) pos.getX() + random.nextDouble(); ++ d1 = (double) pos.getY() + random.nextDouble() * 0.5D + 0.5D; ++ d2 = (double) pos.getZ() + random.nextDouble(); + level.addParticle(ParticleTypes.LARGE_SMOKE, d0, d1, d2, 0.0D, 0.0D, 0.0D); + } + } + + } + +- protected abstract boolean canBurn(BlockState state); ++ protected abstract boolean canBurn(IBlockData state); + + @Override +- @Override +- public void entityInside(BlockState blockstate, Level level, BlockPos blockpos, Entity entity) { ++ public void entityInside(IBlockData state, Level level, BlockPos pos, Entity entity) { + if (!entity.fireImmune()) { + entity.setRemainingFireTicks(entity.getRemainingFireTicks() + 1); + if (entity.getRemainingFireTicks() == 0) { +- entity.setSecondsOnFire(8); ++ // CraftBukkit start ++ org.bukkit.event.entity.EntityCombustEvent event = new org.bukkit.event.entity.EntityCombustByBlockEvent(org.bukkit.craftbukkit.block.CraftBlock.at(level, pos), entity.getBukkitEntity(), 8); ++ level.getCraftServer().getPluginManager().callEvent(event); ++ ++ if (!event.isCancelled()) { ++ entity.setSecondsOnFire(event.getDuration(), false); ++ } ++ // CraftBukkit end + } + } + + entity.hurt(level.damageSources().inFire(), this.fireDamage); +- super.entityInside(blockstate, level, blockpos, entity); ++ super.entityInside(state, level, pos, entity); + } + + @Override +- @Override +- public void onPlace(BlockState blockstate, Level level, BlockPos blockpos, BlockState blockstate1, boolean flag) { +- if (!blockstate1.is(blockstate.getBlock())) { ++ public void onPlace(IBlockData state, Level level, BlockPos pos, IBlockData oldState, boolean isMoving) { ++ if (!oldState.is(state.getBlock())) { + if (inPortalDimension(level)) { +- Optional<PortalShape> optional = PortalShape.findEmptyPortalShape(level, blockpos, Direction.Axis.X); ++ Optional<PortalShape> optional = PortalShape.findEmptyPortalShape(level, pos, Direction.Axis.X); + + if (optional.isPresent()) { + ((PortalShape) optional.get()).createPortalBlocks(); +@@ -153,50 +154,48 @@ + } + } + +- if (!blockstate.canSurvive(level, blockpos)) { +- level.removeBlock(blockpos, false); ++ if (!state.canSurvive(level, pos)) { ++ fireExtinguished(level, pos); // CraftBukkit - fuel block broke + } + + } + } + + private static boolean inPortalDimension(Level level) { +- return level.dimension() == Level.OVERWORLD || level.dimension() == Level.NETHER; ++ return level.getTypeKey() == net.minecraft.world.level.dimension.LevelStem.OVERWORLD || level.getTypeKey() == net.minecraft.world.level.dimension.LevelStem.NETHER; // CraftBukkit - getTypeKey() + } + + @Override +- @Override +- protected void spawnDestroyParticles(Level level, Player player, BlockPos blockpos, BlockState blockstate) {} ++ protected void spawnDestroyParticles(Level level, Player player, BlockPos pos, IBlockData state) {} + + @Override +- @Override +- public BlockState playerWillDestroy(Level level, BlockPos blockpos, BlockState blockstate, Player player) { +- if (!level.isClientSide()) { +- level.levelEvent((Player) null, 1009, blockpos, 0); ++ public IBlockData playerWillDestroy(Level world, BlockPos blockposition, IBlockData iblockdata, Player entityhuman) { ++ if (!world.isClientSide()) { ++ world.levelEvent((Player) null, 1009, blockposition, 0); + } + +- return super.playerWillDestroy(level, blockpos, blockstate, player); ++ return super.playerWillDestroy(world, blockposition, iblockdata, entityhuman); + } + +- public static boolean canBePlacedAt(Level level, BlockPos blockpos, Direction direction) { +- BlockState blockstate = level.getBlockState(blockpos); ++ public static boolean canBePlacedAt(Level level, BlockPos pos, Direction direction) { ++ IBlockData iblockdata = level.getBlockState(pos); + +- return !blockstate.isAir() ? false : getState(level, blockpos).canSurvive(level, blockpos) || isPortal(level, blockpos, direction); ++ return !iblockdata.isAir() ? false : getState(level, pos).canSurvive(level, pos) || isPortal(level, pos, direction); + } + +- private static boolean isPortal(Level level, BlockPos blockpos, Direction direction) { ++ private static boolean isPortal(Level level, BlockPos pos, Direction direction) { + if (!inPortalDimension(level)) { + return false; + } else { +- BlockPos.MutableBlockPos blockpos_mutableblockpos = blockpos.mutable(); ++ BlockPos.MutableBlockPos blockposition_mutableblockposition = pos.mutable(); + boolean flag = false; +- Direction[] adirection = Direction.values(); +- int i = adirection.length; ++ Direction[] aenumdirection = Direction.values(); ++ int i = aenumdirection.length; + + for (int j = 0; j < i; ++j) { +- Direction direction1 = adirection[j]; ++ Direction enumdirection1 = aenumdirection[j]; + +- if (level.getBlockState(blockpos_mutableblockpos.set(blockpos).move(direction1)).is(Blocks.OBSIDIAN)) { ++ if (level.getBlockState(blockposition_mutableblockposition.set(pos).move(enumdirection1)).is(Blocks.OBSIDIAN)) { + flag = true; + break; + } +@@ -205,10 +204,18 @@ + if (!flag) { + return false; + } else { +- Direction.Axis direction_axis = direction.getAxis().isHorizontal() ? direction.getCounterClockWise().getAxis() : Direction.Plane.HORIZONTAL.getRandomAxis(level.random); ++ Direction.Axis enumdirection_enumaxis = direction.getAxis().isHorizontal() ? direction.getCounterClockWise().getAxis() : Direction.Plane.HORIZONTAL.getRandomAxis(level.random); + +- return PortalShape.findEmptyPortalShape(level, blockpos, direction_axis).isPresent(); ++ return PortalShape.findEmptyPortalShape(level, pos, enumdirection_enumaxis).isPresent(); + } + } + } ++ ++ // CraftBukkit start ++ protected void fireExtinguished(net.minecraft.world.level.LevelAccessor world, BlockPos position) { ++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, position, Blocks.AIR.defaultBlockState()).isCancelled()) { ++ world.removeBlock(position, false); ++ } ++ } ++ // CraftBukkit end + } |