geforkt von Mirrors/Paper
90fe0d58a5
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 897a0a23 SPIGOT-5753: Back PotionType by a minecraft registry 255b2aa1 SPIGOT-7080: Add World#locateNearestBiome ff984826 Remove javadoc.io doc links CraftBukkit Changes: 71b0135cc SPIGOT-5753: Back PotionType by a minecraft registry a6bcb8489 SPIGOT-7080: Add World#locateNearestBiome ad0e57434 SPIGOT-7502: CraftMetaItem - cannot deserialize BlockStateTag b3efca57a SPIGOT-6400: Use Mockito instead of InvocationHandler 38c599f9d PR-1272: Only allow one entity in CraftItem instead of two f065271ac SPIGOT-7498: ChunkSnapshot.getBlockEmittedLight() gets 64 blocks upper in Overworld Spigot Changes: e0e223fe Remove javadoc.io doc links
84 Zeilen
5.3 KiB
Diff
84 Zeilen
5.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
Date: Tue, 29 Mar 2022 13:46:23 -0700
|
|
Subject: [PATCH] Fire CauldronLevelChange on initial fill
|
|
|
|
Also don't fire level events or game events if stalactite
|
|
drip is cancelled
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/CauldronBlock.java b/src/main/java/net/minecraft/world/level/block/CauldronBlock.java
|
|
index 53089c3a36bf2c0ec1bc9b436884deff0c30f028..2f85b893dd0abc39fcedec65acc89e1567faf6f0 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/CauldronBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/CauldronBlock.java
|
|
@@ -36,10 +36,18 @@ public class CauldronBlock extends AbstractCauldronBlock {
|
|
public void handlePrecipitation(BlockState state, Level world, BlockPos pos, Biome.Precipitation precipitation) {
|
|
if (CauldronBlock.shouldHandlePrecipitation(world, precipitation)) {
|
|
if (precipitation == Biome.Precipitation.RAIN) {
|
|
- world.setBlockAndUpdate(pos, Blocks.WATER_CAULDRON.defaultBlockState());
|
|
+ // Paper start - call event for initial fill
|
|
+ if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.WATER_CAULDRON.defaultBlockState(), null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL, false)) { // avoid duplicate game event
|
|
+ return;
|
|
+ }
|
|
+ // Paper end
|
|
world.gameEvent((Entity) null, GameEvent.BLOCK_CHANGE, pos);
|
|
} else if (precipitation == Biome.Precipitation.SNOW) {
|
|
- world.setBlockAndUpdate(pos, Blocks.POWDER_SNOW_CAULDRON.defaultBlockState());
|
|
+ // Paper start - call event for initial fill
|
|
+ if (!LayeredCauldronBlock.changeLevel(state, world, pos, Blocks.POWDER_SNOW_CAULDRON.defaultBlockState(), null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL, false)) { // avoid duplicate game event
|
|
+ return;
|
|
+ }
|
|
+ // Paper end
|
|
world.gameEvent((Entity) null, GameEvent.BLOCK_CHANGE, pos);
|
|
}
|
|
|
|
@@ -57,11 +65,19 @@ public class CauldronBlock extends AbstractCauldronBlock {
|
|
|
|
if (fluid == Fluids.WATER) {
|
|
iblockdata1 = Blocks.WATER_CAULDRON.defaultBlockState();
|
|
- LayeredCauldronBlock.changeLevel(state, world, pos, iblockdata1, null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL); // CraftBukkit
|
|
+ // Paper start - don't send level event or game event if cancelled
|
|
+ if (!LayeredCauldronBlock.changeLevel(state, world, pos, iblockdata1, null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL)) { // CraftBukkit
|
|
+ return;
|
|
+ }
|
|
+ // Paper end
|
|
world.levelEvent(1047, pos, 0);
|
|
} else if (fluid == Fluids.LAVA) {
|
|
iblockdata1 = Blocks.LAVA_CAULDRON.defaultBlockState();
|
|
- LayeredCauldronBlock.changeLevel(state, world, pos, iblockdata1, null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL); // CraftBukkit
|
|
+ // Paper start - don't send level event or game event if cancelled
|
|
+ if (!LayeredCauldronBlock.changeLevel(state, world, pos, iblockdata1, null, CauldronLevelChangeEvent.ChangeReason.NATURAL_FILL)) { // CraftBukkit
|
|
+ return;
|
|
+ }
|
|
+ // Paper end
|
|
world.levelEvent(1046, pos, 0);
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
|
|
index 24d2da792bc498adf4251555a538df4cafe2e827..14164aa59fa5e315788cd7a207228081a05fd18f 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/LayeredCauldronBlock.java
|
|
@@ -91,7 +91,13 @@ public class LayeredCauldronBlock extends AbstractCauldronBlock {
|
|
}
|
|
|
|
// CraftBukkit start
|
|
- public static boolean changeLevel(BlockState iblockdata, Level world, BlockPos blockposition, BlockState newBlock, Entity entity, CauldronLevelChangeEvent.ChangeReason reason) {
|
|
+ // Paper start
|
|
+ public static boolean changeLevel(BlockState iblockdata, Level world, BlockPos blockposition, BlockState newBlock, @javax.annotation.Nullable Entity entity, CauldronLevelChangeEvent.ChangeReason reason) { // Paper - entity is nullable
|
|
+ return changeLevel(iblockdata, world, blockposition, newBlock, entity, reason, true);
|
|
+ }
|
|
+
|
|
+ public static boolean changeLevel(BlockState iblockdata, Level world, BlockPos blockposition, BlockState newBlock, @javax.annotation.Nullable Entity entity, CauldronLevelChangeEvent.ChangeReason reason, boolean sendGameEvent) { // Paper - entity is nullable
|
|
+ // Paper end
|
|
CraftBlockState newState = CraftBlockStates.getBlockState(world, blockposition);
|
|
newState.setData(newBlock);
|
|
|
|
@@ -104,7 +110,7 @@ public class LayeredCauldronBlock extends AbstractCauldronBlock {
|
|
return false;
|
|
}
|
|
newState.update(true);
|
|
- world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.Context.of(newBlock));
|
|
+ if (sendGameEvent) world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.Context.of(newBlock)); // Paper
|
|
return true;
|
|
}
|
|
// CraftBukkit end
|