diff options
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/level/material/LavaFluid.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower/net/minecraft/world/level/material/LavaFluid.java.patch | 341 |
1 files changed, 341 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/level/material/LavaFluid.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/level/material/LavaFluid.java.patch new file mode 100644 index 0000000000..22f5f0380b --- /dev/null +++ b/patch-remap/mache-spigotflower/net/minecraft/world/level/material/LavaFluid.java.patch @@ -0,0 +1,341 @@ +--- a/net/minecraft/world/level/material/LavaFluid.java ++++ b/net/minecraft/world/level/material/LavaFluid.java +@@ -21,7 +21,7 @@ + import net.minecraft.world.level.block.BaseFireBlock; + import net.minecraft.world.level.block.Blocks; + import net.minecraft.world.level.block.LiquidBlock; +-import net.minecraft.world.level.block.state.BlockState; ++import net.minecraft.world.level.block.state.IBlockData; + import net.minecraft.world.level.block.state.StateDefinition; + + public abstract class LavaFluid extends FlowingFluid { +@@ -31,81 +31,91 @@ + public LavaFluid() {} + + @Override +- @Override + public Fluid getFlowing() { + return Fluids.FLOWING_LAVA; + } + + @Override +- @Override + public Fluid getSource() { + return Fluids.LAVA; + } + + @Override +- @Override + public Item getBucket() { + return Items.LAVA_BUCKET; + } + + @Override +- @Override +- public void animateTick(Level level, BlockPos blockpos, FluidState fluidstate, RandomSource randomsource) { +- BlockPos blockpos1 = blockpos.above(); ++ public void animateTick(Level level, BlockPos pos, FluidState state, RandomSource random) { ++ BlockPos blockposition1 = pos.above(); + +- if (level.getBlockState(blockpos1).isAir() && !level.getBlockState(blockpos1).isSolidRender(level, blockpos1)) { +- if (randomsource.nextInt(100) == 0) { +- double d0 = (double) blockpos.getX() + randomsource.nextDouble(); +- double d1 = (double) blockpos.getY() + 1.0D; +- double d2 = (double) blockpos.getZ() + randomsource.nextDouble(); ++ if (level.getBlockState(blockposition1).isAir() && !level.getBlockState(blockposition1).isSolidRender(level, blockposition1)) { ++ if (random.nextInt(100) == 0) { ++ double d0 = (double) pos.getX() + random.nextDouble(); ++ double d1 = (double) pos.getY() + 1.0D; ++ double d2 = (double) pos.getZ() + random.nextDouble(); + + level.addParticle(ParticleTypes.LAVA, d0, d1, d2, 0.0D, 0.0D, 0.0D); +- level.playLocalSound(d0, d1, d2, SoundEvents.LAVA_POP, SoundSource.BLOCKS, 0.2F + randomsource.nextFloat() * 0.2F, 0.9F + randomsource.nextFloat() * 0.15F, false); ++ level.playLocalSound(d0, d1, d2, SoundEvents.LAVA_POP, SoundSource.BLOCKS, 0.2F + random.nextFloat() * 0.2F, 0.9F + random.nextFloat() * 0.15F, false); + } + +- if (randomsource.nextInt(200) == 0) { +- level.playLocalSound((double) blockpos.getX(), (double) blockpos.getY(), (double) blockpos.getZ(), SoundEvents.LAVA_AMBIENT, SoundSource.BLOCKS, 0.2F + randomsource.nextFloat() * 0.2F, 0.9F + randomsource.nextFloat() * 0.15F, false); ++ if (random.nextInt(200) == 0) { ++ level.playLocalSound((double) pos.getX(), (double) pos.getY(), (double) pos.getZ(), SoundEvents.LAVA_AMBIENT, SoundSource.BLOCKS, 0.2F + random.nextFloat() * 0.2F, 0.9F + random.nextFloat() * 0.15F, false); + } + } + + } + + @Override +- @Override +- public void randomTick(Level level, BlockPos blockpos, FluidState fluidstate, RandomSource randomsource) { ++ public void randomTick(Level level, BlockPos pos, FluidState state, RandomSource random) { + if (level.getGameRules().getBoolean(GameRules.RULE_DOFIRETICK)) { +- int i = randomsource.nextInt(3); ++ int i = random.nextInt(3); + + if (i > 0) { +- BlockPos blockpos1 = blockpos; ++ BlockPos blockposition1 = pos; + + for (int j = 0; j < i; ++j) { +- blockpos1 = blockpos1.offset(randomsource.nextInt(3) - 1, 1, randomsource.nextInt(3) - 1); +- if (!level.isLoaded(blockpos1)) { ++ blockposition1 = blockposition1.offset(random.nextInt(3) - 1, 1, random.nextInt(3) - 1); ++ if (!level.isLoaded(blockposition1)) { + return; + } + +- BlockState blockstate = level.getBlockState(blockpos1); ++ IBlockData iblockdata = level.getBlockState(blockposition1); + +- if (blockstate.isAir()) { +- if (this.hasFlammableNeighbours(level, blockpos1)) { +- level.setBlockAndUpdate(blockpos1, BaseFireBlock.getState(level, blockpos1)); ++ if (iblockdata.isAir()) { ++ if (this.hasFlammableNeighbours(level, blockposition1)) { ++ // CraftBukkit start - Prevent lava putting something on fire ++ if (level.getBlockState(blockposition1).getBlock() != Blocks.FIRE) { ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(level, blockposition1, pos).isCancelled()) { ++ continue; ++ } ++ } ++ // CraftBukkit end ++ level.setBlockAndUpdate(blockposition1, BaseFireBlock.getState(level, blockposition1)); + return; + } +- } else if (blockstate.blocksMotion()) { ++ } else if (iblockdata.blocksMotion()) { + return; + } + } + } else { + for (int k = 0; k < 3; ++k) { +- BlockPos blockpos2 = blockpos.offset(randomsource.nextInt(3) - 1, 0, randomsource.nextInt(3) - 1); ++ BlockPos blockposition2 = pos.offset(random.nextInt(3) - 1, 0, random.nextInt(3) - 1); + +- if (!level.isLoaded(blockpos2)) { ++ if (!level.isLoaded(blockposition2)) { + return; + } + +- if (level.isEmptyBlock(blockpos2.above()) && this.isFlammable(level, blockpos2)) { +- level.setBlockAndUpdate(blockpos2.above(), BaseFireBlock.getState(level, blockpos2)); ++ if (level.isEmptyBlock(blockposition2.above()) && this.isFlammable(level, blockposition2)) { ++ // CraftBukkit start - Prevent lava putting something on fire ++ BlockPos up = blockposition2.above(); ++ if (level.getBlockState(up).getBlock() != Blocks.FIRE) { ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(level, up, pos).isCancelled()) { ++ continue; ++ } ++ } ++ // CraftBukkit end ++ level.setBlockAndUpdate(blockposition2.above(), BaseFireBlock.getState(level, blockposition2)); + } + } + } +@@ -113,14 +123,14 @@ + } + } + +- private boolean hasFlammableNeighbours(LevelReader levelreader, BlockPos blockpos) { +- Direction[] adirection = Direction.values(); +- int i = adirection.length; ++ private boolean hasFlammableNeighbours(LevelReader level, BlockPos pos) { ++ Direction[] aenumdirection = Direction.values(); ++ int i = aenumdirection.length; + + for (int j = 0; j < i; ++j) { +- Direction direction = adirection[j]; ++ Direction enumdirection = aenumdirection[j]; + +- if (this.isFlammable(levelreader, blockpos.relative(direction))) { ++ if (this.isFlammable(level, pos.relative(enumdirection))) { + return true; + } + } +@@ -128,114 +138,104 @@ + return false; + } + +- private boolean isFlammable(LevelReader levelreader, BlockPos blockpos) { +- return blockpos.getY() >= levelreader.getMinBuildHeight() && blockpos.getY() < levelreader.getMaxBuildHeight() && !levelreader.hasChunkAt(blockpos) ? false : levelreader.getBlockState(blockpos).ignitedByLava(); ++ private boolean isFlammable(LevelReader level, BlockPos pos) { ++ return pos.getY() >= level.getMinBuildHeight() && pos.getY() < level.getMaxBuildHeight() && !level.hasChunkAt(pos) ? false : level.getBlockState(pos).ignitedByLava(); + } + + @Nullable + @Override +- @Override + public ParticleOptions getDripParticle() { + return ParticleTypes.DRIPPING_LAVA; + } + + @Override +- @Override +- protected void beforeDestroyingBlock(LevelAccessor levelaccessor, BlockPos blockpos, BlockState blockstate) { +- this.fizz(levelaccessor, blockpos); ++ protected void beforeDestroyingBlock(LevelAccessor level, BlockPos pos, IBlockData state) { ++ this.fizz(level, pos); + } + + @Override +- @Override +- public int getSlopeFindDistance(LevelReader levelreader) { +- return levelreader.dimensionType().ultraWarm() ? 4 : 2; ++ public int getSlopeFindDistance(LevelReader level) { ++ return level.dimensionType().ultraWarm() ? 4 : 2; + } + + @Override +- @Override +- public BlockState createLegacyBlock(FluidState fluidstate) { +- return (BlockState) Blocks.LAVA.defaultBlockState().setValue(LiquidBlock.LEVEL, getLegacyLevel(fluidstate)); ++ public IBlockData createLegacyBlock(FluidState state) { ++ return (IBlockData) Blocks.LAVA.defaultBlockState().setValue(LiquidBlock.LEVEL, getLegacyLevel(state)); + } + + @Override +- @Override + public boolean isSame(Fluid fluid) { + return fluid == Fluids.LAVA || fluid == Fluids.FLOWING_LAVA; + } + + @Override +- @Override +- public int getDropOff(LevelReader levelreader) { +- return levelreader.dimensionType().ultraWarm() ? 1 : 2; ++ public int getDropOff(LevelReader level) { ++ return level.dimensionType().ultraWarm() ? 1 : 2; + } + + @Override +- @Override +- public boolean canBeReplacedWith(FluidState fluidstate, BlockGetter blockgetter, BlockPos blockpos, Fluid fluid, Direction direction) { +- return fluidstate.getHeight(blockgetter, blockpos) >= 0.44444445F && fluid.is(FluidTags.WATER); ++ public boolean canBeReplacedWith(FluidState fluidState, BlockGetter blockReader, BlockPos pos, Fluid fluid, Direction direction) { ++ return fluidState.getHeight(blockReader, pos) >= 0.44444445F && fluid.is(FluidTags.WATER); + } + + @Override +- @Override +- public int getTickDelay(LevelReader levelreader) { +- return levelreader.dimensionType().ultraWarm() ? 10 : 30; ++ public int getTickDelay(LevelReader level) { ++ return level.dimensionType().ultraWarm() ? 10 : 30; + } + + @Override +- @Override +- public int getSpreadDelay(Level level, BlockPos blockpos, FluidState fluidstate, FluidState fluidstate1) { ++ public int getSpreadDelay(Level level, BlockPos pos, FluidState currentState, FluidState newState) { + int i = this.getTickDelay(level); + +- if (!fluidstate.isEmpty() && !fluidstate1.isEmpty() && !(Boolean) fluidstate.getValue(LavaFluid.FALLING) && !(Boolean) fluidstate1.getValue(LavaFluid.FALLING) && fluidstate1.getHeight(level, blockpos) > fluidstate.getHeight(level, blockpos) && level.getRandom().nextInt(4) != 0) { ++ if (!currentState.isEmpty() && !newState.isEmpty() && !(Boolean) currentState.getValue(LavaFluid.FALLING) && !(Boolean) newState.getValue(LavaFluid.FALLING) && newState.getHeight(level, pos) > currentState.getHeight(level, pos) && level.getRandom().nextInt(4) != 0) { + i *= 4; + } + + return i; + } + +- private void fizz(LevelAccessor levelaccessor, BlockPos blockpos) { +- levelaccessor.levelEvent(1501, blockpos, 0); ++ private void fizz(LevelAccessor level, BlockPos pos) { ++ level.levelEvent(1501, pos, 0); + } + + @Override +- @Override + protected boolean canConvertToSource(Level level) { + return level.getGameRules().getBoolean(GameRules.RULE_LAVA_SOURCE_CONVERSION); + } + + @Override +- @Override +- protected void spreadTo(LevelAccessor levelaccessor, BlockPos blockpos, BlockState blockstate, Direction direction, FluidState fluidstate) { ++ protected void spreadTo(LevelAccessor level, BlockPos pos, IBlockData blockState, Direction direction, FluidState fluidState) { + if (direction == Direction.DOWN) { +- FluidState fluidstate1 = levelaccessor.getFluidState(blockpos); ++ FluidState fluid1 = level.getFluidState(pos); + +- if (this.is(FluidTags.LAVA) && fluidstate1.is(FluidTags.WATER)) { +- if (blockstate.getBlock() instanceof LiquidBlock) { +- levelaccessor.setBlock(blockpos, Blocks.STONE.defaultBlockState(), 3); ++ if (this.is(FluidTags.LAVA) && fluid1.is(FluidTags.WATER)) { ++ if (blockState.getBlock() instanceof LiquidBlock) { ++ // CraftBukkit start ++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(level.getMinecraftWorld(), pos, Blocks.STONE.defaultBlockState(), 3)) { ++ return; ++ } ++ // CraftBukkit end + } + +- this.fizz(levelaccessor, blockpos); ++ this.fizz(level, pos); + return; + } + } + +- super.spreadTo(levelaccessor, blockpos, blockstate, direction, fluidstate); ++ super.spreadTo(level, pos, blockState, direction, fluidState); + } + + @Override +- @Override + protected boolean isRandomlyTicking() { + return true; + } + + @Override +- @Override + protected float getExplosionResistance() { + return 100.0F; + } + + @Override +- @Override + public Optional<SoundEvent> getPickupSound() { + return Optional.of(SoundEvents.BUCKET_FILL_LAVA); + } +@@ -245,21 +245,18 @@ + public Flowing() {} + + @Override +- @Override +- protected void createFluidStateDefinition(StateDefinition.Builder<Fluid, FluidState> statedefinition_builder) { +- super.createFluidStateDefinition(statedefinition_builder); +- statedefinition_builder.add(LavaFluid.Flowing.LEVEL); ++ protected void createFluidStateDefinition(StateDefinition.Builder<Fluid, FluidState> builder) { ++ super.createFluidStateDefinition(builder); ++ builder.add(LavaFluid.Flowing.LEVEL); + } + + @Override +- @Override +- public int getAmount(FluidState fluidstate) { +- return (Integer) fluidstate.getValue(LavaFluid.Flowing.LEVEL); ++ public int getAmount(FluidState state) { ++ return (Integer) state.getValue(LavaFluid.Flowing.LEVEL); + } + + @Override +- @Override +- public boolean isSource(FluidState fluidstate) { ++ public boolean isSource(FluidState state) { + return false; + } + } +@@ -269,14 +266,12 @@ + public Source() {} + + @Override +- @Override +- public int getAmount(FluidState fluidstate) { ++ public int getAmount(FluidState state) { + return 8; + } + + @Override +- @Override +- public boolean isSource(FluidState fluidstate) { ++ public boolean isSource(FluidState state) { + return true; + } + } |