From 0488cb7fbe76ff62b64bfbd9e28ab39e08608d16 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Wed, 21 Aug 2024 19:03:01 +0200 Subject: [PATCH] Fix item type in 1.21.2 entity data --- .../minecraft/entitydata/types/EntityDataTypes1_21.java | 8 +++++--- .../viaversion/api/type/types/version/Types1_21.java | 2 +- .../viaversion/api/type/types/version/Types1_21_2.java | 2 +- .../protocols/template/BlockItemPacketRewriter1_99.java | 1 + 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_21.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_21.java index cd746d676..01bd6a92c 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_21.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_21.java @@ -26,10 +26,11 @@ import com.viaversion.viaversion.api.minecraft.PaintingVariant; import com.viaversion.viaversion.api.minecraft.Particle; import com.viaversion.viaversion.api.minecraft.WolfVariant; import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType; +import com.viaversion.viaversion.api.minecraft.item.Item; +import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.api.type.types.ArrayType; import com.viaversion.viaversion.api.type.types.misc.ParticleType; -import com.viaversion.viaversion.api.type.types.version.Types1_21; public final class EntityDataTypes1_21 extends AbstractEntityDataTypes { @@ -40,7 +41,7 @@ public final class EntityDataTypes1_21 extends AbstractEntityDataTypes { public final EntityDataType stringType = add(4, Types.STRING); public final EntityDataType componentType = add(5, Types.TAG); public final EntityDataType optionalComponentType = add(6, Types.OPTIONAL_TAG); - public final EntityDataType itemType = add(7, Types1_21.ITEM); + public final EntityDataType itemType; public final EntityDataType booleanType = add(8, Types.BOOLEAN); public final EntityDataType rotationsType = add(9, Types.ROTATIONS); public final EntityDataType blockPositionType = add(10, Types.BLOCK_POSITION1_14); @@ -65,8 +66,9 @@ public final class EntityDataTypes1_21 extends AbstractEntityDataTypes { public final EntityDataType vector3FType = add(29, Types.VECTOR3F); public final EntityDataType quaternionType = add(30, Types.QUATERNION); - public EntityDataTypes1_21(final ParticleType particleType, final ArrayType particlesType) { + public EntityDataTypes1_21(final Type itemType, final ParticleType particleType, final ArrayType particlesType) { super(31); + this.itemType = add(7, itemType); this.particleType = add(17, particleType); this.particlesType = add(18, particlesType); } diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_21.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_21.java index ce496d5ff..b315f98a0 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_21.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_21.java @@ -50,7 +50,7 @@ public final class Types1_21 { public static final ParticleType PARTICLE = new ParticleType(); public static final ArrayType PARTICLES = new ArrayType<>(PARTICLE); - public static final EntityDataTypes1_21 ENTITY_DATA_TYPES = new EntityDataTypes1_21(PARTICLE, PARTICLES); + public static final EntityDataTypes1_21 ENTITY_DATA_TYPES = new EntityDataTypes1_21(ITEM, PARTICLE, PARTICLES); public static final Type ENTITY_DATA = new EntityDataType(ENTITY_DATA_TYPES); public static final Type> ENTITY_DATA_LIST = new EntityDataListType(ENTITY_DATA); } diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_21_2.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_21_2.java index 3982b74cb..d143daf76 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_21_2.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_21_2.java @@ -50,7 +50,7 @@ public final class Types1_21_2 { public static final ParticleType PARTICLE = new ParticleType(); public static final ArrayType PARTICLES = new ArrayType<>(PARTICLE); - public static final EntityDataTypes1_21 ENTITY_DATA_TYPES = new EntityDataTypes1_21(PARTICLE, PARTICLES); + public static final EntityDataTypes1_21 ENTITY_DATA_TYPES = new EntityDataTypes1_21(ITEM, PARTICLE, PARTICLES); public static final Type ENTITY_DATA = new EntityDataType(ENTITY_DATA_TYPES); public static final Type> ENTITY_DATA_LIST = new EntityDataListType(ENTITY_DATA); } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/template/BlockItemPacketRewriter1_99.java b/common/src/main/java/com/viaversion/viaversion/protocols/template/BlockItemPacketRewriter1_99.java index cb74338a4..7d8da0bcf 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/template/BlockItemPacketRewriter1_99.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/template/BlockItemPacketRewriter1_99.java @@ -58,6 +58,7 @@ final class BlockItemPacketRewriter1_99 extends StructuredItemRewriter