13
0
geforkt von Mirrors/Paper

SPIGOT-7068: SKULK and SKULK_VEIN BlockSpreadEvents Still do not reference the correct source (SKULK_CATALYST)

By: DerFrZocker <derrieple@gmail.com>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2022-06-19 21:48:24 +10:00
Ursprung 100bb8f120
Commit 6e92592b55
2 geänderte Dateien mit 14 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -0,0 +1,12 @@
--- a/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java
@@ -86,7 +86,9 @@
}
public static void serverTick(World world, BlockPosition blockposition, IBlockData iblockdata, SculkCatalystBlockEntity sculkcatalystblockentity) {
+ org.bukkit.craftbukkit.event.CraftEventFactory.sourceBlockOverride = sculkcatalystblockentity.getBlockPos(); // CraftBukkit - SPIGOT-7068: Add source block override, not the most elegant way but better than passing down a BlockPosition up to five methods deep.
sculkcatalystblockentity.sculkSpreader.updateCursors(world, blockposition, world.getRandom(), true);
+ org.bukkit.craftbukkit.event.CraftEventFactory.sourceBlockOverride = null; // CraftBukkit
}
@Override

Datei anzeigen

@ -768,6 +768,7 @@ public class CraftEventFactory {
return handleBlockSpreadEvent(world, source, target, block, 2); return handleBlockSpreadEvent(world, source, target, block, 2);
} }
public static BlockPosition sourceBlockOverride = null; // SPIGOT-7068: Add source block override, not the most elegant way but better than passing down a BlockPosition up to five methods deep.
public static boolean handleBlockSpreadEvent(GeneratorAccess world, BlockPosition source, BlockPosition target, IBlockData block, int flag) { public static boolean handleBlockSpreadEvent(GeneratorAccess world, BlockPosition source, BlockPosition target, IBlockData block, int flag) {
// Suppress during worldgen // Suppress during worldgen
if (!(world instanceof World)) { if (!(world instanceof World)) {
@ -778,7 +779,7 @@ public class CraftEventFactory {
CraftBlockState state = CraftBlockStates.getBlockState(world, target, flag); CraftBlockState state = CraftBlockStates.getBlockState(world, target, flag);
state.setData(block); state.setData(block);
BlockSpreadEvent event = new BlockSpreadEvent(state.getBlock(), CraftBlock.at(world, source), state); BlockSpreadEvent event = new BlockSpreadEvent(state.getBlock(), CraftBlock.at(world, sourceBlockOverride != null ? sourceBlockOverride : source), state);
Bukkit.getPluginManager().callEvent(event); Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {