From 5cdaabeaece2763a4563de42c29819a625d6e252 Mon Sep 17 00:00:00 2001 From: KennyTV Date: Thu, 17 Jun 2021 11:55:22 +0200 Subject: [PATCH] Handle particle id change in 1.16 metadata Fixes #2551 --- .../metadata/types/MetaType1_16.java | 72 +++++++++++ .../viaversion/api/type/PartialType.java | 9 +- .../types/minecraft/AbstractParticleType.java | 115 ++++++++++++++++++ .../MetaListType.java} | 15 ++- .../types/minecraft/MetaTypeTemplate.java | 2 +- .../types/minecraft/Particle1_13Type.java | 42 +------ .../types/minecraft/Particle1_14Type.java | 43 +------ .../Particle1_16Type.java} | 15 +-- .../types/minecraft/Particle1_17Type.java | 61 ++-------- ...ist1_17Type.java => Metadata1_16Type.java} | 12 +- .../types/version/MetadataList1_12Type.java | 34 ------ .../types/version/MetadataList1_13Type.java | 34 ------ .../types/version/MetadataList1_14Type.java | 34 ------ .../api/type/types/version/Types1_12.java | 9 +- .../api/type/types/version/Types1_13.java | 10 +- .../api/type/types/version/Types1_13_2.java | 9 +- .../api/type/types/version/Types1_14.java | 11 +- .../api/type/types/version/Types1_16.java | 12 +- .../api/type/types/version/Types1_17.java | 5 +- .../api/type/types/version/Types1_8.java | 8 +- .../api/type/types/version/Types1_9.java | 10 +- .../packets/EntityPackets.java | 4 +- .../packets/EntityPackets.java | 3 +- .../packets/EntityPackets.java | 4 +- 24 files changed, 287 insertions(+), 286 deletions(-) create mode 100644 api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaType1_16.java create mode 100644 api/src/main/java/com/viaversion/viaversion/api/type/types/minecraft/AbstractParticleType.java rename api/src/main/java/com/viaversion/viaversion/api/type/types/{version/MetadataList1_13_2Type.java => minecraft/MetaListType.java} (80%) rename api/src/main/java/com/viaversion/viaversion/api/type/types/{version/MetadataList1_9Type.java => minecraft/Particle1_16Type.java} (78%) rename api/src/main/java/com/viaversion/viaversion/api/type/types/version/{MetadataList1_17Type.java => Metadata1_16Type.java} (82%) delete mode 100644 api/src/main/java/com/viaversion/viaversion/api/type/types/version/MetadataList1_12Type.java delete mode 100644 api/src/main/java/com/viaversion/viaversion/api/type/types/version/MetadataList1_13Type.java delete mode 100644 api/src/main/java/com/viaversion/viaversion/api/type/types/version/MetadataList1_14Type.java diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaType1_16.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaType1_16.java new file mode 100644 index 000000000..dcc7f93c5 --- /dev/null +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaType1_16.java @@ -0,0 +1,72 @@ +/* + * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion + * Copyright (C) 2016-2021 ViaVersion and contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package com.viaversion.viaversion.api.minecraft.metadata.types; + +import com.viaversion.viaversion.api.minecraft.metadata.MetaType; +import com.viaversion.viaversion.api.type.Type; +import com.viaversion.viaversion.api.type.types.version.Types1_16; + +public enum MetaType1_16 implements MetaType { + BYTE(0, Type.BYTE), + VAR_INT(1, Type.VAR_INT), + FLOAT(2, Type.FLOAT), + STRING(3, Type.STRING), + COMPONENT(4, Type.COMPONENT), + OPT_COMPONENT(5, Type.OPTIONAL_COMPONENT), + ITEM(6, Type.FLAT_VAR_INT_ITEM), + BOOLEAN(7, Type.BOOLEAN), + ROTATION(8, Type.ROTATION), + POSITION(9, Type.POSITION1_14), + OPT_POSITION(10, Type.OPTIONAL_POSITION_1_14), + DIRECTION(11, Type.VAR_INT), + OPT_UUID(12, Type.OPTIONAL_UUID), + BLOCK_STATE(13, Type.VAR_INT), + NBT(14, Type.NBT), + PARTICLE(15, Types1_16.PARTICLE), + VILLAGER_DATA(16, Type.VILLAGER_DATA), + OPT_VAR_INT(17, Type.OPTIONAL_VAR_INT), + POSE(18, Type.VAR_INT); + + private static final MetaType1_16[] VALUES = values(); + private final int typeId; + private final Type type; + + MetaType1_16(int typeId, Type type) { + this.typeId = typeId; + this.type = type; + } + + public static MetaType1_16 byId(int id) { + return VALUES[id]; + } + + @Override + public int typeId() { + return typeId; + } + + @Override + public Type type() { + return type; + } +} diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/PartialType.java b/api/src/main/java/com/viaversion/viaversion/api/type/PartialType.java index ed97e2b03..06b9f8b10 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/PartialType.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/PartialType.java @@ -32,17 +32,22 @@ public abstract class PartialType extends Type { this.param = param; } + protected PartialType(X param, String name, Class type) { + super(name, type); + this.param = param; + } + public abstract T read(ByteBuf buffer, X param) throws Exception; public abstract void write(ByteBuf buffer, X param, T object) throws Exception; @Override - public T read(ByteBuf buffer) throws Exception { + public final T read(ByteBuf buffer) throws Exception { return read(buffer, this.param); } @Override - public void write(ByteBuf buffer, T object) throws Exception { + public final void write(ByteBuf buffer, T object) throws Exception { write(buffer, this.param, object); } } diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/minecraft/AbstractParticleType.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/minecraft/AbstractParticleType.java new file mode 100644 index 000000000..f08978b6a --- /dev/null +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/minecraft/AbstractParticleType.java @@ -0,0 +1,115 @@ +/* + * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion + * Copyright (C) 2016-2021 ViaVersion and contributors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package com.viaversion.viaversion.api.type.types.minecraft; + +import com.viaversion.viaversion.api.Via; +import com.viaversion.viaversion.api.minecraft.Position; +import com.viaversion.viaversion.api.minecraft.item.Item; +import com.viaversion.viaversion.api.type.Type; +import com.viaversion.viaversion.api.type.types.Particle; +import io.netty.buffer.ByteBuf; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; + +public abstract class AbstractParticleType extends Type { + + protected final Int2ObjectMap readers = new Int2ObjectOpenHashMap<>(); + + protected AbstractParticleType() { + super("Particle", Particle.class); + } + + @Override + public void write(ByteBuf buffer, Particle object) throws Exception { + Type.VAR_INT.writePrimitive(buffer, object.getId()); + for (Particle.ParticleData data : object.getArguments()) { + data.getType().write(buffer, data.getValue()); + } + } + + @Override + public Particle read(ByteBuf buffer) throws Exception { + int type = Type.VAR_INT.readPrimitive(buffer); + Particle particle = new Particle(type); + + ParticleReader reader = readers.get(type); + if (reader != null) { + reader.read(buffer, particle); + } + return particle; + } + + protected ParticleReader blockHandler() { + return (buf, particle) -> { + particle.getArguments().add(new Particle.ParticleData(Type.VAR_INT, Type.VAR_INT.readPrimitive(buf))); // Flat Block + }; + } + + protected ParticleReader itemHandler(Type itemType) { + return (buf, particle) -> { + particle.getArguments().add(new Particle.ParticleData(itemType, itemType.read(buf))); // Flat item; + }; + } + + protected ParticleReader dustHandler() { + return (buf, particle) -> { + particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, Type.FLOAT.readPrimitive(buf))); // Red 0 - 1 + particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, Type.FLOAT.readPrimitive(buf))); // Green 0 - 1 + particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, Type.FLOAT.readPrimitive(buf))); // Blue 0 - 1 + particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, Type.FLOAT.readPrimitive(buf))); // Scale 0.01 - 4 + }; + } + + protected ParticleReader dustTransitionHandler() { + return (buf, particle) -> { + particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, Type.FLOAT.readPrimitive(buf))); // Red 0 - 1 + particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, Type.FLOAT.readPrimitive(buf))); // Green 0 - 1 + particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, Type.FLOAT.readPrimitive(buf))); // Blue 0 - 1 + particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, Type.FLOAT.readPrimitive(buf))); // Scale 0.01 - 4 + particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, Type.FLOAT.readPrimitive(buf))); // Red + particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, Type.FLOAT.readPrimitive(buf))); // Green + particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, Type.FLOAT.readPrimitive(buf))); // Blue + }; + } + + protected ParticleReader vibrationHandler(Type positionType) { + return (buf, particle) -> { + particle.getArguments().add(new Particle.ParticleData(positionType, positionType.read(buf))); // From block pos + String resourceLocation = Type.STRING.read(buf); + if (resourceLocation.equals("block")) { + particle.getArguments().add(new Particle.ParticleData(positionType, positionType.read(buf))); // Target block pos + } else if (resourceLocation.equals("entity")) { + particle.getArguments().add(new Particle.ParticleData(Type.VAR_INT, Type.VAR_INT.readPrimitive(buf))); // Target entity + } else { + Via.getPlatform().getLogger().warning("Unknown vibration path position source type: " + resourceLocation); + } + particle.getArguments().add(new Particle.ParticleData(Type.VAR_INT, Type.VAR_INT.readPrimitive(buf))); // Arrival in ticks + }; + } + + @FunctionalInterface + public interface ParticleReader { + + void read(ByteBuf buf, Particle particle) throws Exception; + } +} diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/MetadataList1_13_2Type.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/minecraft/MetaListType.java similarity index 80% rename from api/src/main/java/com/viaversion/viaversion/api/type/types/version/MetadataList1_13_2Type.java rename to api/src/main/java/com/viaversion/viaversion/api/type/types/minecraft/MetaListType.java index 1798f4afd..7bcd7b020 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/MetadataList1_13_2Type.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/minecraft/MetaListType.java @@ -20,15 +20,22 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -package com.viaversion.viaversion.api.type.types.version; +package com.viaversion.viaversion.api.type.types.minecraft; +import com.google.common.base.Preconditions; import com.viaversion.viaversion.api.minecraft.metadata.Metadata; import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.api.type.types.minecraft.ModernMetaListType; -public class MetadataList1_13_2Type extends ModernMetaListType { +public final class MetaListType extends ModernMetaListType { + private final Type type; + + public MetaListType(Type type) { + Preconditions.checkNotNull(type); + this.type = type; + } + @Override protected Type getType() { - return Types1_13_2.METADATA; + return type; } } diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/minecraft/MetaTypeTemplate.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/minecraft/MetaTypeTemplate.java index b640c0b34..a5640f1ec 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/minecraft/MetaTypeTemplate.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/minecraft/MetaTypeTemplate.java @@ -26,7 +26,7 @@ import com.viaversion.viaversion.api.minecraft.metadata.Metadata; import com.viaversion.viaversion.api.type.Type; public abstract class MetaTypeTemplate extends Type { - public MetaTypeTemplate() { + protected MetaTypeTemplate() { super("Metadata type", Metadata.class); } diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/minecraft/Particle1_13Type.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/minecraft/Particle1_13Type.java index 4dfb3fc22..7c76d9d03 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/minecraft/Particle1_13Type.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/minecraft/Particle1_13Type.java @@ -23,45 +23,13 @@ package com.viaversion.viaversion.api.type.types.minecraft; import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.api.type.types.Particle; -import io.netty.buffer.ByteBuf; -public class Particle1_13Type extends Type { +public class Particle1_13Type extends AbstractParticleType { public Particle1_13Type() { - super("Particle", Particle.class); - } - - @Override - public void write(ByteBuf buffer, Particle object) throws Exception { - Type.VAR_INT.writePrimitive(buffer, object.getId()); - for (Particle.ParticleData data : object.getArguments()) - data.getType().write(buffer, data.getValue()); - } - - @Override - public Particle read(ByteBuf buffer) throws Exception { - int type = Type.VAR_INT.readPrimitive(buffer); - Particle particle = new Particle(type); - - switch (type) { - // Block / Falling Dust / - case 3: - case 20: - particle.getArguments().add(new Particle.ParticleData(Type.VAR_INT, Type.VAR_INT.readPrimitive(buffer))); // Flat Block - break; - // Dust - case 11: - particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, Type.FLOAT.readPrimitive(buffer))); // Red 0 - 1 - particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, Type.FLOAT.readPrimitive(buffer))); // Green 0 - 1 - particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, Type.FLOAT.readPrimitive(buffer))); // Blue 0 - 1 - particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, Type.FLOAT.readPrimitive(buffer)));// Scale 0.01 - 4 - break; - // Item - case 27: - particle.getArguments().add(new Particle.ParticleData(Type.FLAT_ITEM, Type.FLAT_ITEM.read(buffer))); // Flat item - break; - } - return particle; + readers.put(3, blockHandler()); + readers.put(20, blockHandler()); + readers.put(11, dustHandler()); + readers.put(27, itemHandler(Type.FLAT_ITEM)); } } diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/minecraft/Particle1_14Type.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/minecraft/Particle1_14Type.java index 42130dd23..ebeb5e1a5 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/minecraft/Particle1_14Type.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/minecraft/Particle1_14Type.java @@ -23,46 +23,13 @@ package com.viaversion.viaversion.api.type.types.minecraft; import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.api.type.types.Particle; -import io.netty.buffer.ByteBuf; -public class Particle1_14Type extends Type { +public class Particle1_14Type extends AbstractParticleType { public Particle1_14Type() { - super("Particle", Particle.class); - } - - @Override - public void write(ByteBuf buffer, Particle object) throws Exception { - Type.VAR_INT.writePrimitive(buffer, object.getId()); - for (Particle.ParticleData data : object.getArguments()) - data.getType().write(buffer, data.getValue()); - } - - @Override - public Particle read(ByteBuf buffer) throws Exception { - int type = Type.VAR_INT.readPrimitive(buffer); - Particle particle = new Particle(type); - - switch (type) { - // Block / Falling Dust / - case 3: - case 23: - particle.getArguments().add(new Particle.ParticleData(Type.VAR_INT, Type.VAR_INT.readPrimitive(buffer))); // Flat Block - break; - // Dust - case 14: - particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, Type.FLOAT.readPrimitive(buffer))); // Red 0 - 1 - particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, Type.FLOAT.readPrimitive(buffer))); // Green 0 - 1 - particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, Type.FLOAT.readPrimitive(buffer))); // Blue 0 - 1 - particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, Type.FLOAT.readPrimitive(buffer)));// Scale 0.01 - 4 - break; - // Item - case 32: - particle.getArguments().add(new Particle.ParticleData(Type.FLAT_VAR_INT_ITEM, Type.FLAT_VAR_INT_ITEM.read(buffer))); // Flat item - break; - } - return particle; + readers.put(3, blockHandler()); + readers.put(23, blockHandler()); + readers.put(14, dustHandler()); + readers.put(32, itemHandler(Type.FLAT_VAR_INT_ITEM)); } } - diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/MetadataList1_9Type.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/minecraft/Particle1_16Type.java similarity index 78% rename from api/src/main/java/com/viaversion/viaversion/api/type/types/version/MetadataList1_9Type.java rename to api/src/main/java/com/viaversion/viaversion/api/type/types/minecraft/Particle1_16Type.java index 1655352b2..a0dc6698a 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/MetadataList1_9Type.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/minecraft/Particle1_16Type.java @@ -20,15 +20,16 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -package com.viaversion.viaversion.api.type.types.version; +package com.viaversion.viaversion.api.type.types.minecraft; -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.api.type.types.minecraft.ModernMetaListType; -public class MetadataList1_9Type extends ModernMetaListType { - @Override - protected Type getType() { - return Types1_9.METADATA; +public class Particle1_16Type extends AbstractParticleType { + + public Particle1_16Type() { + readers.put(3, blockHandler()); + readers.put(23, blockHandler()); + readers.put(14, dustHandler()); + readers.put(34, itemHandler(Type.FLAT_VAR_INT_ITEM)); } } diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/minecraft/Particle1_17Type.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/minecraft/Particle1_17Type.java index 178759c61..595b7dfe9 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/minecraft/Particle1_17Type.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/minecraft/Particle1_17Type.java @@ -22,64 +22,17 @@ */ package com.viaversion.viaversion.api.type.types.minecraft; -import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.api.type.types.Particle; -import io.netty.buffer.ByteBuf; -public class Particle1_17Type extends Type { +public class Particle1_17Type extends AbstractParticleType { public Particle1_17Type() { - super("Particle", Particle.class); - } - - @Override - public void write(ByteBuf buffer, Particle object) throws Exception { - Type.VAR_INT.writePrimitive(buffer, object.getId()); - for (Particle.ParticleData data : object.getArguments()) { - data.getType().write(buffer, data.getValue()); - } - } - - @Override - public Particle read(ByteBuf buffer) throws Exception { - int type = Type.VAR_INT.readPrimitive(buffer); - Particle particle = new Particle(type); - - switch (type) { - case 3: // Block - case 24: // Falling dust - particle.getArguments().add(new Particle.ParticleData(Type.VAR_INT, Type.VAR_INT.readPrimitive(buffer))); // Flat Block - break; - case 14: // Dust - case 15: // Dust transition - particle.getArguments().add(new Particle.ParticleData(Type.DOUBLE, Type.DOUBLE.readPrimitive(buffer))); // Red 0 - 1 - particle.getArguments().add(new Particle.ParticleData(Type.DOUBLE, Type.DOUBLE.readPrimitive(buffer))); // Green 0 - 1 - particle.getArguments().add(new Particle.ParticleData(Type.DOUBLE, Type.DOUBLE.readPrimitive(buffer))); // Blue 0 - 1 - particle.getArguments().add(new Particle.ParticleData(Type.FLOAT, Type.FLOAT.readPrimitive(buffer))); // Scale 0.01 - 4 - if (type == 15) { - // Transition to color - particle.getArguments().add(new Particle.ParticleData(Type.DOUBLE, Type.DOUBLE.readPrimitive(buffer))); // Red - particle.getArguments().add(new Particle.ParticleData(Type.DOUBLE, Type.DOUBLE.readPrimitive(buffer))); // Green - particle.getArguments().add(new Particle.ParticleData(Type.DOUBLE, Type.DOUBLE.readPrimitive(buffer))); // Blue - } - break; - case 33: // Item - particle.getArguments().add(new Particle.ParticleData(Type.FLAT_VAR_INT_ITEM, Type.FLAT_VAR_INT_ITEM.read(buffer))); // Flat item - break; - case 36: // Vibration path - particle.getArguments().add(new Particle.ParticleData(Type.POSITION1_14, Type.POSITION1_14.read(buffer))); // From block pos - String resourceLocation = Type.STRING.read(buffer); - if (resourceLocation.equals("block")) { - particle.getArguments().add(new Particle.ParticleData(Type.POSITION1_14, Type.POSITION1_14.read(buffer))); // Target block pos - } else if (resourceLocation.equals("entity")) { - particle.getArguments().add(new Particle.ParticleData(Type.VAR_INT, Type.VAR_INT.readPrimitive(buffer))); // Target entity - } else { - Via.getPlatform().getLogger().warning("Unknown vibration path position source type: " + resourceLocation); - } - particle.getArguments().add(new Particle.ParticleData(Type.VAR_INT, Type.VAR_INT.readPrimitive(buffer))); // Arrival in ticks - } - return particle; + readers.put(4, blockHandler()); + readers.put(25, blockHandler()); + readers.put(15, dustHandler()); + readers.put(16, dustTransitionHandler()); + readers.put(36, itemHandler(Type.FLAT_VAR_INT_ITEM)); + readers.put(37, vibrationHandler(Type.POSITION1_14)); } } diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/MetadataList1_17Type.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Metadata1_16Type.java similarity index 82% rename from api/src/main/java/com/viaversion/viaversion/api/type/types/version/MetadataList1_17Type.java rename to api/src/main/java/com/viaversion/viaversion/api/type/types/version/Metadata1_16Type.java index d23346fda..0bceb0dd9 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/MetadataList1_17Type.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Metadata1_16Type.java @@ -22,14 +22,14 @@ */ package com.viaversion.viaversion.api.type.types.version; -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; -import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.api.type.types.minecraft.ModernMetaListType; +import com.viaversion.viaversion.api.minecraft.metadata.MetaType; +import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_16; +import com.viaversion.viaversion.api.type.types.minecraft.ModernMetaType; -public class MetadataList1_17Type extends ModernMetaListType { +public class Metadata1_16Type extends ModernMetaType { @Override - protected Type getType() { - return Types1_17.METADATA; + protected MetaType getType(final int index) { + return MetaType1_16.byId(index); } } diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/MetadataList1_12Type.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/MetadataList1_12Type.java deleted file mode 100644 index 9bb808e51..000000000 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/MetadataList1_12Type.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion - * Copyright (C) 2016-2021 ViaVersion and contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.viaversion.viaversion.api.type.types.version; - -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; -import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.api.type.types.minecraft.ModernMetaListType; - -public class MetadataList1_12Type extends ModernMetaListType { - @Override - protected Type getType() { - return Types1_12.METADATA; - } -} diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/MetadataList1_13Type.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/MetadataList1_13Type.java deleted file mode 100644 index ad7441b42..000000000 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/MetadataList1_13Type.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion - * Copyright (C) 2016-2021 ViaVersion and contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.viaversion.viaversion.api.type.types.version; - -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; -import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.api.type.types.minecraft.ModernMetaListType; - -public class MetadataList1_13Type extends ModernMetaListType { - @Override - protected Type getType() { - return Types1_13.METADATA; - } -} diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/MetadataList1_14Type.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/MetadataList1_14Type.java deleted file mode 100644 index 28f81e129..000000000 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/MetadataList1_14Type.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion - * Copyright (C) 2016-2021 ViaVersion and contributors - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package com.viaversion.viaversion.api.type.types.version; - -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; -import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.api.type.types.minecraft.ModernMetaListType; - -public class MetadataList1_14Type extends ModernMetaListType { - @Override - protected Type getType() { - return Types1_14.METADATA; - } -} diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_12.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_12.java index e0490bdd7..b4a1c5405 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_12.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_12.java @@ -24,17 +24,18 @@ package com.viaversion.viaversion.api.type.types.version; import com.viaversion.viaversion.api.minecraft.metadata.Metadata; import com.viaversion.viaversion.api.type.Type; +import com.viaversion.viaversion.api.type.types.minecraft.MetaListType; import java.util.List; public class Types1_12 { - /** - * Metadata list type for 1.12 - */ - public static final Type> METADATA_LIST = new MetadataList1_12Type(); /** * Metadata type for 1.12 */ public static final Type METADATA = new Metadata1_12Type(); + /** + * Metadata list type for 1.12 + */ + public static final Type> METADATA_LIST = new MetaListType(METADATA); } diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_13.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_13.java index 3af0ae691..f392dc4c0 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_13.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_13.java @@ -26,20 +26,20 @@ import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection; import com.viaversion.viaversion.api.minecraft.metadata.Metadata; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.types.Particle; +import com.viaversion.viaversion.api.type.types.minecraft.MetaListType; import com.viaversion.viaversion.api.type.types.minecraft.Particle1_13Type; import java.util.List; public class Types1_13 { - /** - * Metadata list type for 1.13 - */ - public static final Type> METADATA_LIST = new MetadataList1_13Type(); - /** * Metadata type for 1.13 */ public static final Type METADATA = new Metadata1_13Type(); + /** + * Metadata list type for 1.13 + */ + public static final Type> METADATA_LIST = new MetaListType(METADATA); public static final Type CHUNK_SECTION = new ChunkSectionType1_13(); diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_13_2.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_13_2.java index bab728d82..fdff3e099 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_13_2.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_13_2.java @@ -25,20 +25,21 @@ package com.viaversion.viaversion.api.type.types.version; import com.viaversion.viaversion.api.minecraft.metadata.Metadata; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.types.Particle; +import com.viaversion.viaversion.api.type.types.minecraft.MetaListType; import com.viaversion.viaversion.api.type.types.minecraft.Particle1_13_2Type; import java.util.List; public class Types1_13_2 { - /** - * Metadata list type for 1.13 - */ - public static final Type> METADATA_LIST = new MetadataList1_13_2Type(); /** * Metadata type for 1.13 */ public static final Type METADATA = new Metadata1_13_2Type(); + /** + * Metadata list type for 1.13 + */ + public static final Type> METADATA_LIST = new MetaListType(METADATA); /** * Particle type for 1.13.2 diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_14.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_14.java index 21bb0a285..61bfe3f69 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_14.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_14.java @@ -25,20 +25,21 @@ package com.viaversion.viaversion.api.type.types.version; import com.viaversion.viaversion.api.minecraft.metadata.Metadata; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.types.Particle; +import com.viaversion.viaversion.api.type.types.minecraft.MetaListType; import com.viaversion.viaversion.api.type.types.minecraft.Particle1_14Type; import java.util.List; -public class Types1_14 { - /** - * Metadata list type for 1.14 - */ - public static final Type> METADATA_LIST = new MetadataList1_14Type(); +public final class Types1_14 { /** * Metadata type for 1.14 */ public static final Type METADATA = new Metadata1_14Type(); + /** + * Metadata list type for 1.14 + */ + public static final Type> METADATA_LIST = new MetaListType(METADATA); /** * Particle type for 1.14 diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_16.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_16.java index a46813270..e54286556 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_16.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_16.java @@ -23,12 +23,22 @@ package com.viaversion.viaversion.api.type.types.version; import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection; +import com.viaversion.viaversion.api.minecraft.metadata.Metadata; import com.viaversion.viaversion.api.type.Type; +import com.viaversion.viaversion.api.type.types.Particle; +import com.viaversion.viaversion.api.type.types.minecraft.MetaListType; +import com.viaversion.viaversion.api.type.types.minecraft.Particle1_16Type; -public class Types1_16 { +import java.util.List; + +public final class Types1_16 { /** * Chunk section type for 1.16 */ public static final Type CHUNK_SECTION = new ChunkSectionType1_16(); + + public static final Type METADATA = new Metadata1_16Type(); + public static final Type> METADATA_LIST = new MetaListType(METADATA); + public static final Type PARTICLE = new Particle1_16Type(); } diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_17.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_17.java index f0a5e736b..1e60ced11 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_17.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_17.java @@ -25,13 +25,14 @@ package com.viaversion.viaversion.api.type.types.version; import com.viaversion.viaversion.api.minecraft.metadata.Metadata; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.types.Particle; +import com.viaversion.viaversion.api.type.types.minecraft.MetaListType; import com.viaversion.viaversion.api.type.types.minecraft.Particle1_17Type; import java.util.List; -public class Types1_17 { +public final class Types1_17 { - public static final Type> METADATA_LIST = new MetadataList1_17Type(); public static final Type METADATA = new Metadata1_17Type(); + public static final Type> METADATA_LIST = new MetaListType(METADATA); public static final Type PARTICLE = new Particle1_17Type(); } diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_8.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_8.java index 61c81e54a..2dbb57f92 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_8.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_8.java @@ -29,15 +29,15 @@ import com.viaversion.viaversion.api.type.Type; import java.util.List; public class Types1_8 { - /** - * Metadata list type for 1.8 - */ - public static final Type> METADATA_LIST = new MetadataList1_8Type(); /** * Metadata type for 1.8 */ public static final Type METADATA = new Metadata1_8Type(); + /** + * Metadata list type for 1.8 + */ + public static final Type> METADATA_LIST = new MetadataList1_8Type(); public static final Type CHUNK_SECTION = new ChunkSectionType1_8(); } diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_9.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_9.java index ea881691b..ebe0f6c51 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_9.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_9.java @@ -25,19 +25,19 @@ package com.viaversion.viaversion.api.type.types.version; import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection; import com.viaversion.viaversion.api.minecraft.metadata.Metadata; import com.viaversion.viaversion.api.type.Type; +import com.viaversion.viaversion.api.type.types.minecraft.MetaListType; import java.util.List; public class Types1_9 { - /** - * Metadata list type for 1.9 - */ - public static final Type> METADATA_LIST = new MetadataList1_9Type(); - /** * Metadata type for 1.9 */ public static final Type METADATA = new Metadata1_9Type(); + /** + * Metadata list type for 1.9 + */ + public static final Type> METADATA_LIST = new MetaListType(METADATA); public static final Type CHUNK_SECTION = new ChunkSectionType1_9(); } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16_2to1_16_1/packets/EntityPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16_2to1_16_1/packets/EntityPackets.java index a03e09340..edb6ceabc 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16_2to1_16_1/packets/EntityPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16_2to1_16_1/packets/EntityPackets.java @@ -22,7 +22,7 @@ import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.minecraft.entities.Entity1_16_2Types; import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper; import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.api.type.types.version.Types1_14; +import com.viaversion.viaversion.api.type.types.version.Types1_16; 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.metadata.MetadataRewriter1_16_2To1_16_1; import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.ClientboundPackets1_16; @@ -34,7 +34,7 @@ public class EntityPackets { metadataRewriter.registerTrackerWithData(ClientboundPackets1_16.SPAWN_ENTITY, Entity1_16_2Types.FALLING_BLOCK); metadataRewriter.registerTracker(ClientboundPackets1_16.SPAWN_MOB); metadataRewriter.registerTracker(ClientboundPackets1_16.SPAWN_PLAYER, Entity1_16_2Types.PLAYER); - metadataRewriter.registerMetadataRewriter(ClientboundPackets1_16.ENTITY_METADATA, Types1_14.METADATA_LIST); + metadataRewriter.registerMetadataRewriter(ClientboundPackets1_16.ENTITY_METADATA, Types1_16.METADATA_LIST); metadataRewriter.registerRemoveEntities(ClientboundPackets1_16.DESTROY_ENTITIES); protocol.registerClientbound(ClientboundPackets1_16.JOIN_GAME, new PacketRemapper() { diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16to1_15_2/packets/EntityPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16to1_15_2/packets/EntityPackets.java index c48f398f1..62c1fe5b4 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16to1_15_2/packets/EntityPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_16to1_15_2/packets/EntityPackets.java @@ -30,6 +30,7 @@ import com.viaversion.viaversion.api.protocol.remapper.PacketHandler; import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.types.version.Types1_14; +import com.viaversion.viaversion.api.type.types.version.Types1_16; import com.viaversion.viaversion.protocols.protocol1_15to1_14_4.ClientboundPackets1_15; import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.ClientboundPackets1_16; import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.Protocol1_16To1_15_2; @@ -174,7 +175,7 @@ public class EntityPackets { metadataRewriter.registerTrackerWithData(ClientboundPackets1_15.SPAWN_ENTITY, Entity1_16Types.FALLING_BLOCK); metadataRewriter.registerTracker(ClientboundPackets1_15.SPAWN_MOB); metadataRewriter.registerTracker(ClientboundPackets1_15.SPAWN_PLAYER, Entity1_16Types.PLAYER); - metadataRewriter.registerMetadataRewriter(ClientboundPackets1_15.ENTITY_METADATA, Types1_14.METADATA_LIST); + metadataRewriter.registerMetadataRewriter(ClientboundPackets1_15.ENTITY_METADATA, Types1_14.METADATA_LIST, Types1_16.METADATA_LIST); metadataRewriter.registerRemoveEntities(ClientboundPackets1_15.DESTROY_ENTITIES); protocol.registerClientbound(ClientboundPackets1_15.RESPAWN, new PacketRemapper() { diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_17to1_16_4/packets/EntityPackets.java b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_17to1_16_4/packets/EntityPackets.java index 7758bea91..47fb6ce4e 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_17to1_16_4/packets/EntityPackets.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/protocol1_17to1_16_4/packets/EntityPackets.java @@ -26,7 +26,7 @@ import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper; import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.api.type.types.version.Types1_14; +import com.viaversion.viaversion.api.type.types.version.Types1_16; import com.viaversion.viaversion.api.type.types.version.Types1_17; import com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2; import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ClientboundPackets1_17; @@ -45,7 +45,7 @@ public final class EntityPackets extends EntityRewriter { registerTrackerWithData(ClientboundPackets1_16_2.SPAWN_ENTITY, Entity1_17Types.FALLING_BLOCK); registerTracker(ClientboundPackets1_16_2.SPAWN_MOB); registerTracker(ClientboundPackets1_16_2.SPAWN_PLAYER, Entity1_17Types.PLAYER); - registerMetadataRewriter(ClientboundPackets1_16_2.ENTITY_METADATA, Types1_14.METADATA_LIST, Types1_17.METADATA_LIST); + registerMetadataRewriter(ClientboundPackets1_16_2.ENTITY_METADATA, Types1_16.METADATA_LIST, Types1_17.METADATA_LIST); protocol.registerClientbound(ClientboundPackets1_16_2.DESTROY_ENTITIES, null, new PacketRemapper() { @Override