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

Fixes #2610
This commit is contained in:
KennyTV 2021-07-07 10:01:22 +02:00
parent e70f230f39
commit b4f8024eef
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
2 changed files with 9 additions and 8 deletions

View File

@ -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.item.Item;
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.protocols.protocol1_16_2to1_16_1.Protocol1_16_2To1_16_1;
import com.viaversion.viaversion.rewriter.EntityRewriter;
@ -39,12 +39,12 @@ public class MetadataRewriter1_16_2To1_16_1 extends EntityRewriter<Protocol1_16_
@Override
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());
} else if (metadata.metaType() == MetaType1_14.BlockID) {
} else if (metadata.metaType() == MetaType1_16.BLOCK_STATE) {
int data = (int) metadata.getValue();
metadata.setValue(protocol.getMappingData().getNewBlockStateId(data));
} else if (metadata.metaType() == MetaType1_14.PARTICLE) {
} else if (metadata.metaType() == MetaType1_16.PARTICLE) {
rewriteParticle((Particle) metadata.getValue());
}

View File

@ -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.item.Item;
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.protocols.protocol1_16to1_15_2.Protocol1_16To1_15_2;
import com.viaversion.viaversion.rewriter.EntityRewriter;
@ -40,12 +40,13 @@ public class MetadataRewriter1_16To1_15_2 extends EntityRewriter<Protocol1_16To1
@Override
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());
} else if (metadata.metaType() == MetaType1_14.BlockID) {
} else if (metadata.metaType() == MetaType1_16.BLOCK_STATE) {
int data = (int) metadata.getValue();
metadata.setValue(protocol.getMappingData().getNewBlockStateId(data));
} else if (metadata.metaType() == MetaType1_14.PARTICLE) {
} else if (metadata.metaType() == MetaType1_16.PARTICLE) {
rewriteParticle((Particle) metadata.getValue());
}