mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-14 05:33:56 +01:00
Fix SculkBloomEvent firing for block entity loading
This commit is contained in:
parent
b724ae078d
commit
8a940ca0ba
1 changed files with 22 additions and 4 deletions
|
@ -40,7 +40,15 @@
|
|||
Logger logger = SculkSpreader.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -126,7 +133,7 @@
|
||||
@@ -119,14 +126,14 @@
|
||||
int i = Math.min(list.size(), 32);
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
- this.addCursor((SculkSpreader.ChargeCursor) list.get(j));
|
||||
+ this.addCursor((SculkSpreader.ChargeCursor) list.get(j), false); // Paper - don't fire event for block entity loading
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void save(CompoundTag nbt) {
|
||||
|
@ -49,12 +57,22 @@
|
|||
Logger logger = SculkSpreader.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -147,6 +154,19 @@
|
||||
@@ -139,14 +146,27 @@
|
||||
while (charge > 0) {
|
||||
int j = Math.min(charge, 1000);
|
||||
|
||||
private void addCursor(SculkSpreader.ChargeCursor cursor) {
|
||||
- this.addCursor(new SculkSpreader.ChargeCursor(pos, j));
|
||||
+ this.addCursor(new SculkSpreader.ChargeCursor(pos, j), true); // Paper - allow firing event for other causes
|
||||
charge -= j;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- private void addCursor(SculkSpreader.ChargeCursor cursor) {
|
||||
+ private void addCursor(SculkSpreader.ChargeCursor cursor, boolean fireEvent) { // Paper - add boolean to conditionally fire SculkBloomEvent
|
||||
if (this.cursors.size() < 32) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!this.isWorldGeneration()) { // CraftBukkit - SPIGOT-7475: Don't call event during world generation
|
||||
+ if (!this.isWorldGeneration() && fireEvent) { // CraftBukkit - SPIGOT-7475: Don't call event during world generation // Paper - add boolean to conditionally fire SculkBloomEvent
|
||||
+ CraftBlock bukkitBlock = CraftBlock.at(this.level, cursor.pos);
|
||||
+ SculkBloomEvent event = new SculkBloomEvent(bukkitBlock, cursor.getCharge());
|
||||
+ Bukkit.getPluginManager().callEvent(event);
|
||||
|
|
Loading…
Reference in a new issue