3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-11-17 13:30:14 +01:00

Add firework flight length fix from VV (#769)

Dieser Commit ist enthalten in:
EnZaXD 2024-06-02 09:04:17 +02:00 committet von GitHub
Ursprung 449ddd1de7
Commit 3370383481
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194

Datei anzeigen

@ -27,7 +27,11 @@ import com.viaversion.viabackwards.protocol.v1_20_5to1_20_3.Protocol1_20_5To1_20
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.Particle;
import com.viaversion.viaversion.api.minecraft.data.StructuredDataContainer;
import com.viaversion.viaversion.api.minecraft.data.StructuredDataKey;
import com.viaversion.viaversion.api.minecraft.item.Item;
import com.viaversion.viaversion.api.minecraft.item.data.FireworkExplosion;
import com.viaversion.viaversion.api.minecraft.item.data.Fireworks;
import com.viaversion.viaversion.api.type.Types;
import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_20_2;
import com.viaversion.viaversion.api.type.types.version.Types1_20_3;
@ -320,6 +324,12 @@ public final class BlockItemPacketRewriter1_20_5 extends BackwardsStructuredItem
super.handleItemToClient(connection, item);
// In 1.20.6, some items have default values which are not written into the components
final StructuredDataContainer data = item.structuredData();
if (item.identifier() == 1105 && !data.contains(StructuredDataKey.FIREWORKS)) {
data.set(StructuredDataKey.FIREWORKS, new Fireworks(1, new FireworkExplosion[0]));
}
final Item oldItem = vvProtocol.getItemRewriter().toOldItem(connection, item, DATA_CONVERTER);
if (oldItem.tag() != null && oldItem.tag().isEmpty()) {
// Improve item equality checks by removing empty tags