Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-27 00:22:51 +01:00
Fix firework rewriting in 1.20.3->.5 (#3860)
Makes the explosion tag optional like it is in 1.20.4 so the tooltip shows the correct duration when crafting a firework, also fixes the type used for Flight which is byte in 1.20.4
Dieser Commit ist enthalten in:
Ursprung
f92d241028
Commit
7d9c6fea69
@ -499,9 +499,7 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<Clientboun
|
||||
final CompoundTag fireworksTag = tag.getCompoundTag("Fireworks");
|
||||
if (fireworksTag != null) {
|
||||
final ListTag<CompoundTag> explosionsTag = fireworksTag.getListTag("Explosions", CompoundTag.class);
|
||||
if (explosionsTag != null) {
|
||||
updateFireworks(data, fireworksTag, explosionsTag);
|
||||
}
|
||||
updateFireworks(data, fireworksTag, explosionsTag);
|
||||
}
|
||||
|
||||
if (old.identifier() == 1085) {
|
||||
@ -1022,10 +1020,11 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<Clientboun
|
||||
}
|
||||
|
||||
private void updateFireworks(final StructuredDataContainer data, final CompoundTag fireworksTag, final ListTag<CompoundTag> explosionsTag) {
|
||||
final int flightDuration = fireworksTag.getInt("Flight");
|
||||
final int flightDuration = fireworksTag.getByte("Flight");
|
||||
final Fireworks fireworks = new Fireworks(
|
||||
flightDuration,
|
||||
explosionsTag.stream().limit(256).map(this::readExplosion).toArray(FireworkExplosion[]::new)
|
||||
explosionsTag != null ? explosionsTag.stream().limit(256).
|
||||
map(this::readExplosion).toArray(FireworkExplosion[]::new) : new FireworkExplosion[0]
|
||||
);
|
||||
data.set(StructuredDataKey.FIREWORKS, fireworks);
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren