Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-27 16:40:10 +01:00
Add default firework flight length in 1.20.5->1.20.3 (#3866)
Dieser Commit ist enthalten in:
Ursprung
47f5617f83
Commit
d5ccb17951
@ -387,6 +387,13 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<Clientboun
|
|||||||
return dataItem;
|
return dataItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dataConverter.backupInconvertibleData()) {
|
||||||
|
// In 1.20.6, some items have default values which are not written into the components
|
||||||
|
if (item.identifier() == 1105 && !data.contains(StructuredDataKey.FIREWORKS)) {
|
||||||
|
data.set(StructuredDataKey.FIREWORKS, new Fireworks(1, new FireworkExplosion[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (final StructuredData<?> structuredData : data.data().values()) {
|
for (final StructuredData<?> structuredData : data.data().values()) {
|
||||||
dataConverter.writeToTag(connection, structuredData, tag);
|
dataConverter.writeToTag(connection, structuredData, tag);
|
||||||
}
|
}
|
||||||
|
@ -234,14 +234,16 @@ public final class StructuredDataConverter {
|
|||||||
});
|
});
|
||||||
register(StructuredDataKey.FIREWORKS, (data, tag) -> {
|
register(StructuredDataKey.FIREWORKS, (data, tag) -> {
|
||||||
final CompoundTag fireworksTag = new CompoundTag();
|
final CompoundTag fireworksTag = new CompoundTag();
|
||||||
fireworksTag.putInt("Flight", data.flightDuration());
|
fireworksTag.putByte("Flight", (byte) data.flightDuration());
|
||||||
tag.put("Fireworks", fireworksTag);
|
tag.put("Fireworks", fireworksTag);
|
||||||
|
|
||||||
final ListTag<CompoundTag> explosionsTag = new ListTag<>(CompoundTag.class);
|
if (data.explosions().length > 0) {
|
||||||
for (final FireworkExplosion explosion : data.explosions()) {
|
final ListTag<CompoundTag> explosionsTag = new ListTag<>(CompoundTag.class);
|
||||||
explosionsTag.add(convertExplosion(explosion));
|
for (final FireworkExplosion explosion : data.explosions()) {
|
||||||
|
explosionsTag.add(convertExplosion(explosion));
|
||||||
|
}
|
||||||
|
fireworksTag.put("Explosions", explosionsTag);
|
||||||
}
|
}
|
||||||
fireworksTag.put("Explosions", explosionsTag);
|
|
||||||
});
|
});
|
||||||
register(StructuredDataKey.FIREWORK_EXPLOSION, (data, tag) -> tag.put("Explosion", convertExplosion(data)));
|
register(StructuredDataKey.FIREWORK_EXPLOSION, (data, tag) -> tag.put("Explosion", convertExplosion(data)));
|
||||||
register(StructuredDataKey.PROFILE, (data, tag) -> {
|
register(StructuredDataKey.PROFILE, (data, tag) -> {
|
||||||
@ -871,6 +873,10 @@ public final class StructuredDataConverter {
|
|||||||
rewriters.put(key, c);
|
rewriters.put(key, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean backupInconvertibleData() {
|
||||||
|
return backupInconvertibleData;
|
||||||
|
}
|
||||||
|
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
interface SimpleDataConverter<T> {
|
interface SimpleDataConverter<T> {
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren