aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/world/level/material/LavaFluid.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/level/material/LavaFluid.java.patch')
-rw-r--r--patch-remap/mache-vineflower/net/minecraft/world/level/material/LavaFluid.java.patch253
1 files changed, 253 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/level/material/LavaFluid.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/level/material/LavaFluid.java.patch
new file mode 100644
index 0000000000..5b1e653794
--- /dev/null
+++ b/patch-remap/mache-vineflower/net/minecraft/world/level/material/LavaFluid.java.patch
@@ -0,0 +1,253 @@
+--- a/net/minecraft/world/level/material/LavaFluid.java
++++ b/net/minecraft/world/level/material/LavaFluid.java
+@@ -21,12 +21,15 @@
+ 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 {
++
+ public static final float MIN_LEVEL_CUTOFF = 0.44444445F;
+
++ public LavaFluid() {}
++
+ @Override
+ public Fluid getFlowing() {
+ return Fluids.FLOWING_LAVA;
+@@ -44,74 +47,90 @@
+
+ @Override
+ public void animateTick(Level level, BlockPos pos, FluidState state, RandomSource random) {
+- BlockPos blockPos = pos.above();
+- if (level.getBlockState(blockPos).isAir() && !level.getBlockState(blockPos).isSolidRender(level, blockPos)) {
++ BlockPos blockposition1 = pos.above();
++
++ if (level.getBlockState(blockposition1).isAir() && !level.getBlockState(blockposition1).isSolidRender(level, blockposition1)) {
+ if (random.nextInt(100) == 0) {
+- double d = (double)pos.getX() + random.nextDouble();
+- double d1 = (double)pos.getY() + 1.0;
+- double d2 = (double)pos.getZ() + random.nextDouble();
+- level.addParticle(ParticleTypes.LAVA, d, d1, d2, 0.0, 0.0, 0.0);
+- level.playLocalSound(
+- d, d1, d2, SoundEvents.LAVA_POP, SoundSource.BLOCKS, 0.2F + random.nextFloat() * 0.2F, 0.9F + random.nextFloat() * 0.15F, false
+- );
++ 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 + random.nextFloat() * 0.2F, 0.9F + random.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
+- );
++ 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
+ public void randomTick(Level level, BlockPos pos, FluidState state, RandomSource random) {
+ if (level.getGameRules().getBoolean(GameRules.RULE_DOFIRETICK)) {
+- int randomInt = random.nextInt(3);
+- if (randomInt > 0) {
+- BlockPos blockPos = pos;
++ int i = random.nextInt(3);
+
+- for (int i = 0; i < randomInt; i++) {
+- blockPos = blockPos.offset(random.nextInt(3) - 1, 1, random.nextInt(3) - 1);
+- if (!level.isLoaded(blockPos)) {
++ if (i > 0) {
++ BlockPos blockposition1 = pos;
++
++ for (int j = 0; j < i; ++j) {
++ blockposition1 = blockposition1.offset(random.nextInt(3) - 1, 1, random.nextInt(3) - 1);
++ if (!level.isLoaded(blockposition1)) {
+ return;
+ }
+
+- BlockState blockState = level.getBlockState(blockPos);
+- if (blockState.isAir()) {
+- if (this.hasFlammableNeighbours(level, blockPos)) {
+- level.setBlockAndUpdate(blockPos, BaseFireBlock.getState(level, blockPos));
++ IBlockData iblockdata = level.getBlockState(blockposition1);
++
++ 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 i1 = 0; i1 < 3; i1++) {
+- BlockPos blockPos1 = pos.offset(random.nextInt(3) - 1, 0, random.nextInt(3) - 1);
+- if (!level.isLoaded(blockPos1)) {
++ for (int k = 0; k < 3; ++k) {
++ BlockPos blockposition2 = pos.offset(random.nextInt(3) - 1, 0, random.nextInt(3) - 1);
++
++ if (!level.isLoaded(blockposition2)) {
+ return;
+ }
+
+- if (level.isEmptyBlock(blockPos1.above()) && this.isFlammable(level, blockPos1)) {
+- level.setBlockAndUpdate(blockPos1.above(), BaseFireBlock.getState(level, blockPos1));
++ 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));
+ }
+ }
+ }
++
+ }
+ }
+
+ private boolean hasFlammableNeighbours(LevelReader level, BlockPos pos) {
+- for (Direction direction : Direction.values()) {
+- if (this.isFlammable(level, pos.relative(direction))) {
++ Direction[] aenumdirection = Direction.values();
++ int i = aenumdirection.length;
++
++ for (int j = 0; j < i; ++j) {
++ Direction enumdirection = aenumdirection[j];
++
++ if (this.isFlammable(level, pos.relative(enumdirection))) {
+ return true;
+ }
+ }
+@@ -120,8 +139,7 @@
+ }
+
+ private boolean isFlammable(LevelReader level, BlockPos pos) {
+- return (pos.getY() < level.getMinBuildHeight() || pos.getY() >= level.getMaxBuildHeight() || level.hasChunkAt(pos))
+- && level.getBlockState(pos).ignitedByLava();
++ return pos.getY() >= level.getMinBuildHeight() && pos.getY() < level.getMaxBuildHeight() && !level.hasChunkAt(pos) ? false : level.getBlockState(pos).ignitedByLava();
+ }
+
+ @Nullable
+@@ -131,7 +149,7 @@
+ }
+
+ @Override
+- protected void beforeDestroyingBlock(LevelAccessor level, BlockPos pos, BlockState state) {
++ protected void beforeDestroyingBlock(LevelAccessor level, BlockPos pos, IBlockData state) {
+ this.fizz(level, pos);
+ }
+
+@@ -141,8 +159,8 @@
+ }
+
+ @Override
+- public BlockState createLegacyBlock(FluidState state) {
+- return Blocks.LAVA.defaultBlockState().setValue(LiquidBlock.LEVEL, Integer.valueOf(getLegacyLevel(state)));
++ public IBlockData createLegacyBlock(FluidState state) {
++ return (IBlockData) Blocks.LAVA.defaultBlockState().setValue(LiquidBlock.LEVEL, getLegacyLevel(state));
+ }
+
+ @Override
+@@ -167,17 +185,13 @@
+
+ @Override
+ public int getSpreadDelay(Level level, BlockPos pos, FluidState currentState, FluidState newState) {
+- int tickDelay = this.getTickDelay(level);
+- if (!currentState.isEmpty()
+- && !newState.isEmpty()
+- && !currentState.getValue(FALLING)
+- && !newState.getValue(FALLING)
+- && newState.getHeight(level, pos) > currentState.getHeight(level, pos)
+- && level.getRandom().nextInt(4) != 0) {
+- tickDelay *= 4;
++ int i = this.getTickDelay(level);
++
++ 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 tickDelay;
++ return i;
+ }
+
+ private void fizz(LevelAccessor level, BlockPos pos) {
+@@ -190,12 +204,17 @@
+ }
+
+ @Override
+- protected void spreadTo(LevelAccessor level, BlockPos pos, 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 = level.getFluidState(pos);
+- if (this.is(FluidTags.LAVA) && fluidState1.is(FluidTags.WATER)) {
++ FluidState fluid1 = level.getFluidState(pos);
++
++ if (this.is(FluidTags.LAVA) && fluid1.is(FluidTags.WATER)) {
+ if (blockState.getBlock() instanceof LiquidBlock) {
+- level.setBlock(pos, Blocks.STONE.defaultBlockState(), 3);
++ // CraftBukkit start
++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(level.getMinecraftWorld(), pos, Blocks.STONE.defaultBlockState(), 3)) {
++ return;
++ }
++ // CraftBukkit end
+ }
+
+ this.fizz(level, pos);
+@@ -222,15 +241,18 @@
+ }
+
+ public static class Flowing extends LavaFluid {
++
++ public Flowing() {}
++
+ @Override
+ protected void createFluidStateDefinition(StateDefinition.Builder<Fluid, FluidState> builder) {
+ super.createFluidStateDefinition(builder);
+- builder.add(LEVEL);
++ builder.add(LavaFluid.Flowing.LEVEL);
+ }
+
+ @Override
+ public int getAmount(FluidState state) {
+- return state.getValue(LEVEL);
++ return (Integer) state.getValue(LavaFluid.Flowing.LEVEL);
+ }
+
+ @Override
+@@ -240,6 +262,9 @@
+ }
+
+ public static class Source extends LavaFluid {
++
++ public Source() {}
++
+ @Override
+ public int getAmount(FluidState state) {
+ return 8;