Skip to content

Commit

Permalink
Fix #323 - A newly added explosion doesn't gets saved into firework's…
Browse files Browse the repository at this point in the history
… namedtag
  • Loading branch information
lt-name committed Oct 6, 2024
1 parent 438fa1c commit 3b0b2f9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/cn/nukkit/item/ItemFirework.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,16 @@ public void addExplosion(FireworkExplosion explosion) {
fds[i] = (byte) fades.get(i).getDyeData();
}

ListTag<CompoundTag> explosions = this.getNamedTag().getCompound("Fireworks").getList("Explosions", CompoundTag.class);
CompoundTag namedTag = this.getNamedTag();
ListTag<CompoundTag> explosions = namedTag.getCompound("Fireworks").getList("Explosions", CompoundTag.class);
CompoundTag tag = new CompoundTag()
.putByteArray("FireworkColor", clrs)
.putByteArray("FireworkFade", fds)
.putBoolean("FireworkFlicker", explosion.flicker)
.putBoolean("FireworkTrail", explosion.trail)
.putByte("FireworkType", explosion.type.ordinal());

explosions.add(tag);
this.setNamedTag(namedTag);
}

public void clearExplosions() {
Expand Down

0 comments on commit 3b0b2f9

Please sign in to comment.