3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-20 06:50:08 +01:00

Fix 1.15->1.16 and 1.16.1->1.16.2 dropped items

Fixes #2610
Dieser Commit ist enthalten in:
KennyTV 2021-07-07 10:01:22 +02:00
Ursprung e70f230f39
Commit b4f8024eef
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
2 geänderte Dateien mit 9 neuen und 8 gelöschten Zeilen

Datei anzeigen

@ -23,7 +23,7 @@ import com.viaversion.viaversion.api.minecraft.entities.Entity1_16_2Types;
import com.viaversion.viaversion.api.minecraft.entities.EntityType; import com.viaversion.viaversion.api.minecraft.entities.EntityType;
import com.viaversion.viaversion.api.minecraft.item.Item; import com.viaversion.viaversion.api.minecraft.item.Item;
import com.viaversion.viaversion.api.minecraft.metadata.Metadata; import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_14; import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_16;
import com.viaversion.viaversion.api.type.types.Particle; import com.viaversion.viaversion.api.type.types.Particle;
import com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.Protocol1_16_2To1_16_1; import com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.Protocol1_16_2To1_16_1;
import com.viaversion.viaversion.rewriter.EntityRewriter; import com.viaversion.viaversion.rewriter.EntityRewriter;
@ -39,12 +39,12 @@ public class MetadataRewriter1_16_2To1_16_1 extends EntityRewriter<Protocol1_16_
@Override @Override
public void handleMetadata(int entityId, EntityType type, Metadata metadata, List<Metadata> metadatas, UserConnection connection) throws Exception { public void handleMetadata(int entityId, EntityType type, Metadata metadata, List<Metadata> metadatas, UserConnection connection) throws Exception {
if (metadata.metaType() == MetaType1_14.Slot) { if (metadata.metaType() == MetaType1_16.ITEM) {
protocol.getItemRewriter().handleItemToClient((Item) metadata.getValue()); protocol.getItemRewriter().handleItemToClient((Item) metadata.getValue());
} else if (metadata.metaType() == MetaType1_14.BlockID) { } else if (metadata.metaType() == MetaType1_16.BLOCK_STATE) {
int data = (int) metadata.getValue(); int data = (int) metadata.getValue();
metadata.setValue(protocol.getMappingData().getNewBlockStateId(data)); metadata.setValue(protocol.getMappingData().getNewBlockStateId(data));
} else if (metadata.metaType() == MetaType1_14.PARTICLE) { } else if (metadata.metaType() == MetaType1_16.PARTICLE) {
rewriteParticle((Particle) metadata.getValue()); rewriteParticle((Particle) metadata.getValue());
} }

Datei anzeigen

@ -23,7 +23,7 @@ import com.viaversion.viaversion.api.minecraft.entities.Entity1_16Types;
import com.viaversion.viaversion.api.minecraft.entities.EntityType; import com.viaversion.viaversion.api.minecraft.entities.EntityType;
import com.viaversion.viaversion.api.minecraft.item.Item; import com.viaversion.viaversion.api.minecraft.item.Item;
import com.viaversion.viaversion.api.minecraft.metadata.Metadata; import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_14; import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_16;
import com.viaversion.viaversion.api.type.types.Particle; import com.viaversion.viaversion.api.type.types.Particle;
import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.Protocol1_16To1_15_2; import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.Protocol1_16To1_15_2;
import com.viaversion.viaversion.rewriter.EntityRewriter; import com.viaversion.viaversion.rewriter.EntityRewriter;
@ -40,12 +40,13 @@ public class MetadataRewriter1_16To1_15_2 extends EntityRewriter<Protocol1_16To1
@Override @Override
public void handleMetadata(int entityId, EntityType type, Metadata metadata, List<Metadata> metadatas, UserConnection connection) throws Exception { public void handleMetadata(int entityId, EntityType type, Metadata metadata, List<Metadata> metadatas, UserConnection connection) throws Exception {
if (metadata.metaType() == MetaType1_14.Slot) { metadata.setMetaType(MetaType1_16.byId(metadata.metaType().typeId()));
if (metadata.metaType() == MetaType1_16.ITEM) {
protocol.getItemRewriter().handleItemToClient((Item) metadata.getValue()); protocol.getItemRewriter().handleItemToClient((Item) metadata.getValue());
} else if (metadata.metaType() == MetaType1_14.BlockID) { } else if (metadata.metaType() == MetaType1_16.BLOCK_STATE) {
int data = (int) metadata.getValue(); int data = (int) metadata.getValue();
metadata.setValue(protocol.getMappingData().getNewBlockStateId(data)); metadata.setValue(protocol.getMappingData().getNewBlockStateId(data));
} else if (metadata.metaType() == MetaType1_14.PARTICLE) { } else if (metadata.metaType() == MetaType1_16.PARTICLE) {
rewriteParticle((Particle) metadata.getValue()); rewriteParticle((Particle) metadata.getValue());
} }