Use correct source for mushroom block spread event

This commit is contained in:
Warrior 2023-08-08 11:49:32 +02:00
parent 36ae0bcfea
commit d2f251cc5c

View file

@ -19,16 +19,24 @@
int i = 5;
boolean flag = true;
Iterator iterator = BlockPos.betweenClosed(pos.offset(-4, -1, -4), pos.offset(4, 1, 4)).iterator();
@@ -75,7 +78,7 @@
@@ -65,6 +68,7 @@
}
BlockPos blockposition2 = pos.offset(random.nextInt(3) - 1, random.nextInt(2) - random.nextInt(2), random.nextInt(3) - 1);
+ final BlockPos sourcePos = pos; // Paper - Use correct source for mushroom block spread event
for (int j = 0; j < 4; ++j) {
if (world.isEmptyBlock(blockposition2) && state.canSurvive(world, blockposition2)) {
@@ -75,7 +79,7 @@
}
if (world.isEmptyBlock(blockposition2) && state.canSurvive(world, blockposition2)) {
- world.setBlock(blockposition2, state, 2);
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, pos, blockposition2, state, 2); // CraftBukkit
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, sourcePos, blockposition2, state, 2); // CraftBukkit // Paper - Use correct source for mushroom block spread event
}
}
@@ -101,6 +104,7 @@
@@ -101,6 +105,7 @@
return false;
} else {
world.removeBlock(pos, false);