diff --git a/.editorconfig b/.editorconfig index e79338611..ba4484a42 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,7 +8,7 @@ tab_width = 4 [*.java] ij_java_class_count_to_use_import_on_demand = 999999 ij_java_names_count_to_use_import_on_demand = 999999 -ij_java_imports_layout = *,|,$* +ij_java_imports_layout = *, |, $* ij_java_generate_final_locals = true ij_java_generate_final_parameters = true diff --git a/README.md b/README.md index 304ef6015..e670e54e8 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ it works on any platform you can think of.** The base ViaVersion jar runs on Paper, Velocity, Bungee, and Sponge. We also have projects integrating ViaVersion to run -on Fabric, Forge, or as a standalone proxy to join from basically any client version on any server version from the +on Fabric, Forge, or as a standalone proxy to join from basically any client version on any server version from the past decade. **See [HERE](https://github.com/ViaVersion) for an overview of the different Via\* projects.** Supported Versions: diff --git a/api/src/main/java/com/viaversion/viaversion/api/configuration/ViaVersionConfig.java b/api/src/main/java/com/viaversion/viaversion/api/configuration/ViaVersionConfig.java index 91e2b9fd9..ab564277a 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/configuration/ViaVersionConfig.java +++ b/api/src/main/java/com/viaversion/viaversion/api/configuration/ViaVersionConfig.java @@ -27,7 +27,6 @@ import com.viaversion.viaversion.api.connection.StorableObject; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.minecraft.WorldIdentifiers; import com.viaversion.viaversion.api.protocol.version.BlockedProtocolVersions; -import org.checkerframework.checker.nullness.qual.Nullable; public interface ViaVersionConfig extends Config { diff --git a/api/src/main/java/com/viaversion/viaversion/api/data/FullMappingsBase.java b/api/src/main/java/com/viaversion/viaversion/api/data/FullMappingsBase.java index 3a204ed06..9c4e7fccb 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/data/FullMappingsBase.java +++ b/api/src/main/java/com/viaversion/viaversion/api/data/FullMappingsBase.java @@ -54,6 +54,15 @@ public class FullMappingsBase implements FullMappings { this.mappings = mappings; } + private static Object2IntMap toInverseMap(final List list) { + final Object2IntMap map = new Object2IntOpenHashMap<>(list.size()); + map.defaultReturnValue(-1); + for (int i = 0; i < list.size(); i++) { + map.put(list.get(i), i); + } + return map; + } + @Override public int id(final String identifier) { return stringToId.getInt(Key.stripMinecraftNamespace(identifier)); @@ -119,13 +128,4 @@ public class FullMappingsBase implements FullMappings { public FullMappings inverse() { return new FullMappingsBase(mappedStringToId, stringToId, mappedIdToString, idToString, mappings.inverse()); } - - private static Object2IntMap toInverseMap(final List list) { - final Object2IntMap map = new Object2IntOpenHashMap<>(list.size()); - map.defaultReturnValue(-1); - for (int i = 0; i < list.size(); i++) { - map.put(list.get(i), i); - } - return map; - } } diff --git a/api/src/main/java/com/viaversion/viaversion/api/data/MappingDataLoader.java b/api/src/main/java/com/viaversion/viaversion/api/data/MappingDataLoader.java index 3cf27105b..e5b1ad257 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/data/MappingDataLoader.java +++ b/api/src/main/java/com/viaversion/viaversion/api/data/MappingDataLoader.java @@ -22,6 +22,14 @@ */ package com.viaversion.viaversion.api.data; +import com.google.common.annotations.Beta; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonIOException; +import com.google.gson.JsonObject; +import com.google.gson.JsonSyntaxException; +import com.viaversion.nbt.io.NBTIO; +import com.viaversion.nbt.io.TagReader; import com.viaversion.nbt.tag.ByteTag; import com.viaversion.nbt.tag.CompoundTag; import com.viaversion.nbt.tag.IntArrayTag; @@ -29,14 +37,6 @@ import com.viaversion.nbt.tag.IntTag; import com.viaversion.nbt.tag.ListTag; import com.viaversion.nbt.tag.StringTag; import com.viaversion.nbt.tag.Tag; -import com.viaversion.nbt.io.NBTIO; -import com.viaversion.nbt.io.TagReader; -import com.google.common.annotations.Beta; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonIOException; -import com.google.gson.JsonObject; -import com.google.gson.JsonSyntaxException; import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.util.GsonUtil; import it.unimi.dsi.fastutil.objects.Object2IntMap; diff --git a/api/src/main/java/com/viaversion/viaversion/api/data/entity/TrackedEntity.java b/api/src/main/java/com/viaversion/viaversion/api/data/entity/TrackedEntity.java index 917de2db4..5d18521d1 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/data/entity/TrackedEntity.java +++ b/api/src/main/java/com/viaversion/viaversion/api/data/entity/TrackedEntity.java @@ -48,11 +48,11 @@ public interface TrackedEntity { boolean hasData(); /** - * Returns whether metadata has already been sent at least once for this entity. + * Returns whether entity data has already been sent at least once for this entity. * - * @return whether metadata has already been sent at least once for this entity + * @return whether entity data has already been sent at least once for this entity */ - boolean hasSentMetadata(); + boolean hasSentEntityData(); - void sentMetadata(boolean sentMetadata); + void sentEntityData(boolean sentEntityData); } \ No newline at end of file diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/ChunkPosition.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/ChunkPosition.java similarity index 94% rename from api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/ChunkPosition.java rename to api/src/main/java/com/viaversion/viaversion/api/minecraft/ChunkPosition.java index 96d58e5c9..400dd6136 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/ChunkPosition.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/ChunkPosition.java @@ -20,7 +20,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -package com.viaversion.viaversion.api.minecraft.metadata; +package com.viaversion.viaversion.api.minecraft; import java.util.Objects; @@ -82,8 +82,8 @@ public final class ChunkPosition { @Override public String toString() { return "ChunkPosition{" + - "chunkX=" + chunkX + - ", chunkZ=" + chunkZ + - '}'; + "chunkX=" + chunkX + + ", chunkZ=" + chunkZ + + '}'; } } diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/GameMode.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/GameMode.java index 4520c33ab..1fa30424b 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/GameMode.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/GameMode.java @@ -27,7 +27,7 @@ public enum GameMode { SURVIVAL("Survival Mode"), CREATIVE("Creative Mode"), ADVENTURE("Adventure Mode"), - SPECTATOR( "Spectator Mode"); + SPECTATOR("Spectator Mode"); private final String text; diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/GlobalPosition.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/GlobalPosition.java index b45f94dc0..a8b90c383 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/GlobalPosition.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/GlobalPosition.java @@ -57,10 +57,10 @@ public final class GlobalPosition extends Position { @Override public String toString() { return "GlobalPosition{" + - "dimension='" + dimension + '\'' + - ", x=" + x + - ", y=" + y + - ", z=" + z + - '}'; + "dimension='" + dimension + '\'' + + ", x=" + x + + ", y=" + y + + ", z=" + z + + '}'; } } diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/Particle.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/Particle.java index 8254086b9..6df27415a 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/Particle.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/Particle.java @@ -112,9 +112,9 @@ public final class Particle implements IdHolder { @Override public String toString() { return "ParticleData{" + - "type=" + type + - ", value=" + value + - '}'; + "type=" + type + + ", value=" + value + + '}'; } } } diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/Position.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/Position.java index ead39b4e7..ea9ca5e8d 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/Position.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/Position.java @@ -79,9 +79,9 @@ public class Position { @Override public String toString() { return "Position{" + - "x=" + x + - ", y=" + y + - ", z=" + z + - '}'; + "x=" + x + + ", y=" + y + + ", z=" + z + + '}'; } } diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/chunks/DataPaletteImpl.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/chunks/DataPaletteImpl.java index c241ec8d3..5852cfd8f 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/chunks/DataPaletteImpl.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/chunks/DataPaletteImpl.java @@ -137,6 +137,7 @@ public final class DataPaletteImpl implements DataPalette { interface ChunkData { int get(int idx); + void set(int idx, int val); } diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/Metadata.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/EntityData.java similarity index 81% rename from api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/Metadata.java rename to api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/EntityData.java index 95416b566..7a1cd881c 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/Metadata.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/EntityData.java @@ -20,15 +20,15 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -package com.viaversion.viaversion.api.minecraft.metadata; +package com.viaversion.viaversion.api.minecraft.entitydata; import com.google.common.base.Preconditions; import java.util.Objects; import org.checkerframework.checker.nullness.qual.Nullable; -public final class Metadata { +public final class EntityData { private int id; - private MetaType metaType; + private EntityDataType metaType; private Object value; /** @@ -39,7 +39,7 @@ public final class Metadata { * @param value value if present * @throws IllegalArgumentException if the value and metaType are incompatible */ - public Metadata(int id, MetaType metaType, @Nullable Object value) { + public EntityData(int id, EntityDataType metaType, @Nullable Object value) { this.id = id; this.metaType = metaType; this.value = checkValue(metaType, value); @@ -53,7 +53,7 @@ public final class Metadata { this.id = id; } - public MetaType metaType() { + public EntityDataType dataType() { return metaType; } @@ -62,9 +62,9 @@ public final class Metadata { * * @param metaType metadata type * @throws IllegalArgumentException if the metadata type and current value are incompatible - * @see #setTypeAndValue(MetaType, Object) + * @see #setTypeAndValue(EntityDataType, Object) */ - public void setMetaType(MetaType metaType) { + public void setDataType(EntityDataType metaType) { checkValue(metaType, this.value); this.metaType = metaType; } @@ -82,7 +82,7 @@ public final class Metadata { * * @param value value * @throws IllegalArgumentException if the value and current metaType are incompatible - * @see #setTypeAndValue(MetaType, Object) + * @see #setTypeAndValue(EntityDataType, Object) */ public void setValue(@Nullable Object value) { this.value = checkValue(this.metaType, value); @@ -95,22 +95,22 @@ public final class Metadata { * @param value value * @throws IllegalArgumentException if the value and metaType are incompatible */ - public void setTypeAndValue(MetaType metaType, @Nullable Object value) { + public void setTypeAndValue(EntityDataType metaType, @Nullable Object value) { this.value = checkValue(metaType, value); this.metaType = metaType; } - private Object checkValue(MetaType metaType, @Nullable Object value) { + private Object checkValue(EntityDataType metaType, @Nullable Object value) { Preconditions.checkNotNull(metaType); if (value != null && !metaType.type().getOutputClass().isAssignableFrom(value.getClass())) { throw new IllegalArgumentException("Metadata value and metaType are incompatible. Type=" + metaType - + ", value=" + value + " (" + value.getClass().getSimpleName() + ")"); + + ", value=" + value + " (" + value.getClass().getSimpleName() + ")"); } return value; } @Deprecated - public void setMetaTypeUnsafe(MetaType type) { + public void setDataTypeUnsafe(EntityDataType type) { this.metaType = type; } @@ -118,7 +118,7 @@ public final class Metadata { public boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - Metadata metadata = (Metadata) o; + EntityData metadata = (EntityData) o; if (id != metadata.id) return false; if (metaType != metadata.metaType) return false; return Objects.equals(value, metadata.value); @@ -135,9 +135,9 @@ public final class Metadata { @Override public String toString() { return "Metadata{" + - "id=" + id + - ", metaType=" + metaType + - ", value=" + value + - '}'; + "id=" + id + + ", metaType=" + metaType + + ", value=" + value + + '}'; } } diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/MetaType.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/EntityDataType.java similarity index 81% rename from api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/MetaType.java rename to api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/EntityDataType.java index e93f043ca..ee2e36d52 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/MetaType.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/EntityDataType.java @@ -20,12 +20,12 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -package com.viaversion.viaversion.api.minecraft.metadata; +package com.viaversion.viaversion.api.minecraft.entitydata; import com.google.common.base.Preconditions; import com.viaversion.viaversion.api.type.Type; -public interface MetaType { +public interface EntityDataType { /** * Get the write/read type @@ -41,15 +41,15 @@ public interface MetaType { */ int typeId(); - static MetaType create(final int typeId, final Type type) { - return new MetaTypeImpl(typeId, type); + static EntityDataType create(final int typeId, final Type type) { + return new EntityDataTypeImpl(typeId, type); } - final class MetaTypeImpl implements MetaType { + final class EntityDataTypeImpl implements EntityDataType { private final int typeId; private final Type type; - MetaTypeImpl(final int typeId, final Type type) { + EntityDataTypeImpl(final int typeId, final Type type) { Preconditions.checkNotNull(type); this.typeId = typeId; this.type = type; @@ -67,17 +67,17 @@ public interface MetaType { @Override public String toString() { - return "MetaType{" + - "typeId=" + typeId + - ", type=" + type + - '}'; + return "EntityDataType{" + + "typeId=" + typeId + + ", type=" + type + + '}'; } @Override public boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - final MetaTypeImpl metaType = (MetaTypeImpl) o; + final EntityDataTypeImpl metaType = (EntityDataTypeImpl) o; if (typeId != metaType.typeId) return false; return type.equals(metaType.type); } diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/AbstractMetaTypes.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/AbstractEntityDataTypes.java similarity index 70% rename from api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/AbstractMetaTypes.java rename to api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/AbstractEntityDataTypes.java index ebaa2fedd..1a094ed00 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/AbstractMetaTypes.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/AbstractEntityDataTypes.java @@ -20,31 +20,31 @@ * 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; +package com.viaversion.viaversion.api.minecraft.entitydata.types; -import com.viaversion.viaversion.api.minecraft.metadata.MetaType; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType; import com.viaversion.viaversion.api.type.Type; -public abstract class AbstractMetaTypes implements MetaTypes { +public abstract class AbstractEntityDataTypes implements EntityDataTypes { - private final MetaType[] values; + private final EntityDataType[] values; - protected AbstractMetaTypes(final int values) { - this.values = new MetaType[values]; + protected AbstractEntityDataTypes(final int values) { + this.values = new EntityDataType[values]; } @Override - public MetaType byId(final int id) { + public EntityDataType byId(final int id) { return values[id]; } @Override - public MetaType[] values() { + public EntityDataType[] values() { return values; } - protected MetaType add(final int typeId, final Type type) { - final MetaType metaType = MetaType.create(typeId, type); + protected EntityDataType add(final int typeId, final Type type) { + final EntityDataType metaType = EntityDataType.create(typeId, type); values[typeId] = metaType; return metaType; } diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes.java similarity index 86% rename from api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes.java rename to api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes.java index 7ef4e0db8..fd95300eb 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes.java @@ -20,11 +20,11 @@ * 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; +package com.viaversion.viaversion.api.minecraft.entitydata.types; -import com.viaversion.viaversion.api.minecraft.metadata.MetaType; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType; -public interface MetaTypes { +public interface EntityDataTypes { /** * Returns the meta type by the given id. @@ -33,12 +33,12 @@ public interface MetaTypes { * @return meta type by id * @throws IndexOutOfBoundsException if id is out of bounds */ - MetaType byId(int id); + EntityDataType byId(int id); /** * Returns an array of meta types. * * @return array of meta types */ - MetaType[] values(); + EntityDataType[] values(); } diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaType1_12.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_12.java similarity index 87% rename from api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaType1_12.java rename to api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_12.java index 9bd2bb2f7..a6159ec2c 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaType1_12.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_12.java @@ -20,13 +20,13 @@ * 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; +package com.viaversion.viaversion.api.minecraft.entitydata.types; -import com.viaversion.viaversion.api.minecraft.metadata.MetaType; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; -public enum MetaType1_12 implements MetaType { +public enum EntityDataTypes1_12 implements EntityDataType { BYTE(Types.BYTE), VAR_INT(Types.VAR_INT), FLOAT(Types.FLOAT), @@ -44,11 +44,11 @@ public enum MetaType1_12 implements MetaType { private final Type type; - MetaType1_12(Type type) { + EntityDataTypes1_12(Type type) { this.type = type; } - public static MetaType1_12 byId(int id) { + public static EntityDataTypes1_12 byId(int id) { return values()[id]; } diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_13.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_13.java new file mode 100644 index 000000000..311b3686d --- /dev/null +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_13.java @@ -0,0 +1,52 @@ +/* + * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion + * Copyright (C) 2016-2024 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.entitydata.types; + +import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType; +import com.viaversion.viaversion.api.type.Types; +import com.viaversion.viaversion.api.type.types.misc.ParticleType; + +public final class EntityDataTypes1_13 extends AbstractEntityDataTypes { + + public final EntityDataType byteType = add(0, Types.BYTE); + public final EntityDataType varIntType = add(1, Types.VAR_INT); + public final EntityDataType floatType = add(2, Types.FLOAT); + public final EntityDataType stringType = add(3, Types.STRING); + public final EntityDataType componentType = add(4, Types.COMPONENT); + public final EntityDataType optionalComponentType = add(5, Types.OPTIONAL_COMPONENT); + public final EntityDataType itemType = add(6, Types.ITEM1_13); + public final EntityDataType booleanType = add(7, Types.BOOLEAN); + public final EntityDataType rotationsType = add(8, Types.ROTATIONS); + public final EntityDataType blockPositionType = add(9, Types.BLOCK_POSITION1_8); + public final EntityDataType optionalBlockPositionType = add(10, Types.OPTIONAL_POSITION1_8); + public final EntityDataType directionType = add(11, Types.VAR_INT); + public final EntityDataType optionalUUIDType = add(12, Types.OPTIONAL_UUID); + public final EntityDataType optionalBlockStateType = add(13, Types.VAR_INT); + public final EntityDataType compoundTagType = add(14, Types.NAMED_COMPOUND_TAG); + public final EntityDataType particleType; + + public EntityDataTypes1_13(final ParticleType particleType) { + super(16); + this.particleType = add(15, particleType); + } +} diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_13_2.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_13_2.java new file mode 100644 index 000000000..5acf1ded3 --- /dev/null +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_13_2.java @@ -0,0 +1,52 @@ +/* + * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion + * Copyright (C) 2016-2024 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.entitydata.types; + +import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType; +import com.viaversion.viaversion.api.type.Types; +import com.viaversion.viaversion.api.type.types.misc.ParticleType; + +public final class EntityDataTypes1_13_2 extends AbstractEntityDataTypes { + + public final EntityDataType byteType = add(0, Types.BYTE); + public final EntityDataType varIntType = add(1, Types.VAR_INT); + public final EntityDataType floatType = add(2, Types.FLOAT); + public final EntityDataType stringType = add(3, Types.STRING); + public final EntityDataType componentType = add(4, Types.COMPONENT); + public final EntityDataType optionalComponentType = add(5, Types.OPTIONAL_COMPONENT); + public final EntityDataType itemType = add(6, Types.ITEM1_13_2); + public final EntityDataType booleanType = add(7, Types.BOOLEAN); + public final EntityDataType rotationsType = add(8, Types.ROTATIONS); + public final EntityDataType blockPositionType = add(9, Types.BLOCK_POSITION1_8); + public final EntityDataType optionalBlockPositionType = add(10, Types.OPTIONAL_POSITION1_8); + public final EntityDataType directionType = add(11, Types.VAR_INT); + public final EntityDataType optionalUUIDType = add(12, Types.OPTIONAL_UUID); + public final EntityDataType optionalBlockStateType = add(13, Types.VAR_INT); + public final EntityDataType compoundTagType = add(14, Types.NAMED_COMPOUND_TAG); + public final EntityDataType particleType; + + public EntityDataTypes1_13_2(final ParticleType particleType) { + super(16); + this.particleType = add(15, particleType); + } +} diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_14.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_14.java new file mode 100644 index 000000000..8bbe08b20 --- /dev/null +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_14.java @@ -0,0 +1,55 @@ +/* + * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion + * Copyright (C) 2016-2024 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.entitydata.types; + +import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType; +import com.viaversion.viaversion.api.type.Types; +import com.viaversion.viaversion.api.type.types.misc.ParticleType; + +public final class EntityDataTypes1_14 extends AbstractEntityDataTypes { + + public final EntityDataType byteType = add(0, Types.BYTE); + public final EntityDataType varIntType = add(1, Types.VAR_INT); + public final EntityDataType floatType = add(2, Types.FLOAT); + public final EntityDataType stringType = add(3, Types.STRING); + public final EntityDataType componentType = add(4, Types.COMPONENT); + public final EntityDataType optionalComponentType = add(5, Types.OPTIONAL_COMPONENT); + public final EntityDataType itemType = add(6, Types.ITEM1_13_2); + public final EntityDataType booleanType = add(7, Types.BOOLEAN); + public final EntityDataType rotationsType = add(8, Types.ROTATIONS); + public final EntityDataType blockPositionType = add(9, Types.BLOCK_POSITION1_14); + public final EntityDataType optionalBlockPositionType = add(10, Types.OPTIONAL_POSITION_1_14); + public final EntityDataType directionType = add(11, Types.VAR_INT); + public final EntityDataType optionalUUIDType = add(12, Types.OPTIONAL_UUID); + public final EntityDataType optionalBlockStateType = add(13, Types.VAR_INT); + public final EntityDataType compoundTagType = add(14, Types.NAMED_COMPOUND_TAG); + public final EntityDataType particleType; + public final EntityDataType villagerDatatType = add(16, Types.VILLAGER_DATA); + public final EntityDataType optionalVarIntType = add(17, Types.OPTIONAL_VAR_INT); + public final EntityDataType poseType = add(18, Types.VAR_INT); + + public EntityDataTypes1_14(final ParticleType particleType) { + super(19); + this.particleType = add(15, particleType); + } +} diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_19.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_19.java new file mode 100644 index 000000000..14332fe48 --- /dev/null +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_19.java @@ -0,0 +1,59 @@ +/* + * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion + * Copyright (C) 2016-2024 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.entitydata.types; + +import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType; +import com.viaversion.viaversion.api.type.Types; +import com.viaversion.viaversion.api.type.types.misc.ParticleType; + +public final class EntityDataTypes1_19 extends AbstractEntityDataTypes { + + public final EntityDataType byteType = add(0, Types.BYTE); + public final EntityDataType varIntType = add(1, Types.VAR_INT); + public final EntityDataType floatType = add(2, Types.FLOAT); + public final EntityDataType stringType = add(3, Types.STRING); + public final EntityDataType componentType = add(4, Types.COMPONENT); + public final EntityDataType optionalComponentType = add(5, Types.OPTIONAL_COMPONENT); + public final EntityDataType itemType = add(6, Types.ITEM1_13_2); + public final EntityDataType booleanType = add(7, Types.BOOLEAN); + public final EntityDataType rotationsType = add(8, Types.ROTATIONS); + public final EntityDataType blockPositionType = add(9, Types.BLOCK_POSITION1_14); + public final EntityDataType optionalBlockPositionType = add(10, Types.OPTIONAL_POSITION_1_14); + public final EntityDataType directionType = add(11, Types.VAR_INT); + public final EntityDataType optionalUUIDType = add(12, Types.OPTIONAL_UUID); + public final EntityDataType optionalBlockStateType = add(13, Types.VAR_INT); + public final EntityDataType compoundTagType = add(14, Types.NAMED_COMPOUND_TAG); + public final EntityDataType particleType; + public final EntityDataType villagerDatatType = add(16, Types.VILLAGER_DATA); + public final EntityDataType optionalVarIntType = add(17, Types.OPTIONAL_VAR_INT); + public final EntityDataType poseType = add(18, Types.VAR_INT); + public final EntityDataType catVariantType = add(19, Types.VAR_INT); + public final EntityDataType frogVariantType = add(20, Types.VAR_INT); + public final EntityDataType optionalGlobalPosition = add(21, Types.OPTIONAL_GLOBAL_POSITION); + public final EntityDataType paintingVariantType = add(22, Types.VAR_INT); + + public EntityDataTypes1_19(final ParticleType particleType) { + super(23); + this.particleType = add(15, particleType); + } +} diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_19_3.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_19_3.java new file mode 100644 index 000000000..f8c09b0e7 --- /dev/null +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_19_3.java @@ -0,0 +1,60 @@ +/* + * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion + * Copyright (C) 2016-2024 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.entitydata.types; + +import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType; +import com.viaversion.viaversion.api.type.Types; +import com.viaversion.viaversion.api.type.types.misc.ParticleType; + +public final class EntityDataTypes1_19_3 extends AbstractEntityDataTypes { + + public final EntityDataType byteType = add(0, Types.BYTE); + public final EntityDataType varIntType = add(1, Types.VAR_INT); + public final EntityDataType longType = add(2, Types.VAR_LONG); + public final EntityDataType floatType = add(3, Types.FLOAT); + public final EntityDataType stringType = add(4, Types.STRING); + public final EntityDataType componentType = add(5, Types.COMPONENT); + public final EntityDataType optionalComponentType = add(6, Types.OPTIONAL_COMPONENT); + public final EntityDataType itemType = add(7, Types.ITEM1_13_2); + 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); + public final EntityDataType optionalBlockPositionType = add(11, Types.OPTIONAL_POSITION_1_14); + public final EntityDataType directionType = add(12, Types.VAR_INT); + public final EntityDataType optionalUUIDType = add(13, Types.OPTIONAL_UUID); + public final EntityDataType optionalBlockStateType = add(14, Types.VAR_INT); + public final EntityDataType compoundTagType = add(15, Types.NAMED_COMPOUND_TAG); + public final EntityDataType particleType; + public final EntityDataType villagerDatatType = add(17, Types.VILLAGER_DATA); + public final EntityDataType optionalVarIntType = add(18, Types.OPTIONAL_VAR_INT); + public final EntityDataType poseType = add(19, Types.VAR_INT); + public final EntityDataType catVariantType = add(20, Types.VAR_INT); + public final EntityDataType frogVariantType = add(21, Types.VAR_INT); + public final EntityDataType optionalGlobalPosition = add(22, Types.OPTIONAL_GLOBAL_POSITION); + public final EntityDataType paintingVariantType = add(23, Types.VAR_INT); + + public EntityDataTypes1_19_3(final ParticleType particleType) { + super(24); + this.particleType = add(16, particleType); + } +} diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_19_4.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_19_4.java new file mode 100644 index 000000000..deb4d9eab --- /dev/null +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_19_4.java @@ -0,0 +1,64 @@ +/* + * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion + * Copyright (C) 2016-2024 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.entitydata.types; + +import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType; +import com.viaversion.viaversion.api.type.Types; +import com.viaversion.viaversion.api.type.types.misc.ParticleType; + +public final class EntityDataTypes1_19_4 extends AbstractEntityDataTypes { + + public final EntityDataType byteType = add(0, Types.BYTE); + public final EntityDataType varIntType = add(1, Types.VAR_INT); + public final EntityDataType longType = add(2, Types.VAR_LONG); + public final EntityDataType floatType = add(3, Types.FLOAT); + public final EntityDataType stringType = add(4, Types.STRING); + public final EntityDataType componentType = add(5, Types.COMPONENT); + public final EntityDataType optionalComponentType = add(6, Types.OPTIONAL_COMPONENT); + public final EntityDataType itemType = add(7, Types.ITEM1_13_2); + 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); + public final EntityDataType optionalBlockPositionType = add(11, Types.OPTIONAL_POSITION_1_14); + public final EntityDataType directionType = add(12, Types.VAR_INT); + public final EntityDataType optionalUUIDType = add(13, Types.OPTIONAL_UUID); + public final EntityDataType blockStateType = add(14, Types.VAR_INT); + public final EntityDataType optionalBlockStateType = add(15, Types.VAR_INT); + public final EntityDataType compoundTagType = add(16, Types.NAMED_COMPOUND_TAG); + public final EntityDataType particleType; + public final EntityDataType villagerDatatType = add(18, Types.VILLAGER_DATA); + public final EntityDataType optionalVarIntType = add(19, Types.OPTIONAL_VAR_INT); + public final EntityDataType poseType = add(20, Types.VAR_INT); + public final EntityDataType catVariantType = add(21, Types.VAR_INT); + public final EntityDataType frogVariantType = add(22, Types.VAR_INT); + public final EntityDataType optionalGlobalPosition = add(23, Types.OPTIONAL_GLOBAL_POSITION); + public final EntityDataType paintingVariantType = add(24, Types.VAR_INT); + public final EntityDataType snifferState = add(25, Types.VAR_INT); + public final EntityDataType vector3FType = add(26, Types.VECTOR3F); + public final EntityDataType quaternionType = add(27, Types.QUATERNION); + + public EntityDataTypes1_19_4(final ParticleType particleType) { + super(28); + this.particleType = add(17, particleType); + } +} diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_20_2.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_20_2.java new file mode 100644 index 000000000..ab38fbf85 --- /dev/null +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_20_2.java @@ -0,0 +1,64 @@ +/* + * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion + * Copyright (C) 2016-2024 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.entitydata.types; + +import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType; +import com.viaversion.viaversion.api.type.Types; +import com.viaversion.viaversion.api.type.types.misc.ParticleType; + +public final class EntityDataTypes1_20_2 extends AbstractEntityDataTypes { + + public final EntityDataType byteType = add(0, Types.BYTE); + public final EntityDataType varIntType = add(1, Types.VAR_INT); + public final EntityDataType longType = add(2, Types.VAR_LONG); + public final EntityDataType floatType = add(3, Types.FLOAT); + public final EntityDataType stringType = add(4, Types.STRING); + public final EntityDataType componentType = add(5, Types.COMPONENT); + public final EntityDataType optionalComponentType = add(6, Types.OPTIONAL_COMPONENT); + public final EntityDataType itemType = add(7, Types.ITEM1_20_2); + 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); + public final EntityDataType optionalBlockPositionType = add(11, Types.OPTIONAL_POSITION_1_14); + public final EntityDataType directionType = add(12, Types.VAR_INT); + public final EntityDataType optionalUUIDType = add(13, Types.OPTIONAL_UUID); + public final EntityDataType blockStateType = add(14, Types.VAR_INT); + public final EntityDataType optionalBlockStateType = add(15, Types.VAR_INT); + public final EntityDataType compoundTagType = add(16, Types.COMPOUND_TAG); + public final EntityDataType particleType; + public final EntityDataType villagerDatatType = add(18, Types.VILLAGER_DATA); + public final EntityDataType optionalVarIntType = add(19, Types.OPTIONAL_VAR_INT); + public final EntityDataType poseType = add(20, Types.VAR_INT); + public final EntityDataType catVariantType = add(21, Types.VAR_INT); + public final EntityDataType frogVariantType = add(22, Types.VAR_INT); + public final EntityDataType optionalGlobalPosition = add(23, Types.OPTIONAL_GLOBAL_POSITION); + public final EntityDataType paintingVariantType = add(24, Types.VAR_INT); + public final EntityDataType snifferState = add(25, Types.VAR_INT); + public final EntityDataType vector3FType = add(26, Types.VECTOR3F); + public final EntityDataType quaternionType = add(27, Types.QUATERNION); + + public EntityDataTypes1_20_2(final ParticleType particleType) { + super(28); + this.particleType = add(17, particleType); + } +} diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_20_3.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_20_3.java new file mode 100644 index 000000000..7672c2564 --- /dev/null +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_20_3.java @@ -0,0 +1,64 @@ +/* + * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion + * Copyright (C) 2016-2024 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.entitydata.types; + +import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType; +import com.viaversion.viaversion.api.type.Types; +import com.viaversion.viaversion.api.type.types.misc.ParticleType; + +public final class EntityDataTypes1_20_3 extends AbstractEntityDataTypes { + + public final EntityDataType byteType = add(0, Types.BYTE); + public final EntityDataType varIntType = add(1, Types.VAR_INT); + public final EntityDataType longType = add(2, Types.VAR_LONG); + public final EntityDataType floatType = add(3, Types.FLOAT); + 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, Types.ITEM1_20_2); + 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); + public final EntityDataType optionalBlockPositionType = add(11, Types.OPTIONAL_POSITION_1_14); + public final EntityDataType directionType = add(12, Types.VAR_INT); + public final EntityDataType optionalUUIDType = add(13, Types.OPTIONAL_UUID); + public final EntityDataType blockStateType = add(14, Types.VAR_INT); + public final EntityDataType optionalBlockStateType = add(15, Types.VAR_INT); + public final EntityDataType compoundTagType = add(16, Types.COMPOUND_TAG); + public final EntityDataType particleType; + public final EntityDataType villagerDatatType = add(18, Types.VILLAGER_DATA); + public final EntityDataType optionalVarIntType = add(19, Types.OPTIONAL_VAR_INT); + public final EntityDataType poseType = add(20, Types.VAR_INT); + public final EntityDataType catVariantType = add(21, Types.VAR_INT); + public final EntityDataType frogVariantType = add(22, Types.VAR_INT); + public final EntityDataType optionalGlobalPosition = add(23, Types.OPTIONAL_GLOBAL_POSITION); + public final EntityDataType paintingVariantType = add(24, Types.VAR_INT); + public final EntityDataType snifferState = add(25, Types.VAR_INT); + public final EntityDataType vector3FType = add(26, Types.VECTOR3F); + public final EntityDataType quaternionType = add(27, Types.QUATERNION); + + public EntityDataTypes1_20_3(final ParticleType particleType) { + super(28); + this.particleType = add(17, particleType); + } +} diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_20_5.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_20_5.java new file mode 100644 index 000000000..f16c66036 --- /dev/null +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_20_5.java @@ -0,0 +1,71 @@ +/* + * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion + * Copyright (C) 2016-2024 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.entitydata.types; + +import com.viaversion.viaversion.api.minecraft.Particle; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType; +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_20_5; + +public final class EntityDataTypes1_20_5 extends AbstractEntityDataTypes { + + public final EntityDataType byteType = add(0, Types.BYTE); + public final EntityDataType varIntType = add(1, Types.VAR_INT); + public final EntityDataType longType = add(2, Types.VAR_LONG); + public final EntityDataType floatType = add(3, Types.FLOAT); + 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_20_5.ITEM); + 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); + public final EntityDataType optionalBlockPositionType = add(11, Types.OPTIONAL_POSITION_1_14); + public final EntityDataType directionType = add(12, Types.VAR_INT); + public final EntityDataType optionalUUIDType = add(13, Types.OPTIONAL_UUID); + public final EntityDataType blockStateType = add(14, Types.VAR_INT); + public final EntityDataType optionalBlockStateType = add(15, Types.VAR_INT); + public final EntityDataType compoundTagType = add(16, Types.COMPOUND_TAG); + public final EntityDataType particleType; + public final EntityDataType particlesType; + public final EntityDataType villagerDatatType = add(19, Types.VILLAGER_DATA); + public final EntityDataType optionalVarIntType = add(20, Types.OPTIONAL_VAR_INT); + public final EntityDataType poseType = add(21, Types.VAR_INT); + public final EntityDataType catVariantType = add(22, Types.VAR_INT); + public final EntityDataType wolfVariantType = add(23, Types.VAR_INT); + public final EntityDataType frogVariantType = add(24, Types.VAR_INT); + public final EntityDataType optionalGlobalPosition = add(25, Types.OPTIONAL_GLOBAL_POSITION); + public final EntityDataType paintingVariantType = add(26, Types.VAR_INT); + public final EntityDataType snifferState = add(27, Types.VAR_INT); + public final EntityDataType armadilloState = add(28, Types.VAR_INT); + public final EntityDataType vector3FType = add(29, Types.VECTOR3F); + public final EntityDataType quaternionType = add(30, Types.QUATERNION); + + public EntityDataTypes1_20_5(final ParticleType particleType, final ArrayType particlesType) { + super(31); + this.particleType = add(17, particleType); + this.particlesType = add(18, particlesType); + } +} diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaType1_8.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_8.java similarity index 85% rename from api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaType1_8.java rename to api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_8.java index 04adf3927..468c10e21 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaType1_8.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_8.java @@ -20,13 +20,13 @@ * 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; +package com.viaversion.viaversion.api.minecraft.entitydata.types; -import com.viaversion.viaversion.api.minecraft.metadata.MetaType; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; -public enum MetaType1_8 implements MetaType { +public enum EntityDataTypes1_8 implements EntityDataType { BYTE(Types.BYTE), SHORT(Types.SHORT), INT(Types.INT), @@ -38,11 +38,11 @@ public enum MetaType1_8 implements MetaType { private final Type type; - MetaType1_8(Type type) { + EntityDataTypes1_8(Type type) { this.type = type; } - public static MetaType1_8 byId(int id) { + public static EntityDataTypes1_8 byId(int id) { return values()[id]; } diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaType1_9.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_9.java similarity index 87% rename from api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaType1_9.java rename to api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_9.java index ab1ccdbac..7db2219ce 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaType1_9.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/entitydata/types/EntityDataTypes1_9.java @@ -20,13 +20,13 @@ * 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; +package com.viaversion.viaversion.api.minecraft.entitydata.types; -import com.viaversion.viaversion.api.minecraft.metadata.MetaType; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; -public enum MetaType1_9 implements MetaType { +public enum EntityDataTypes1_9 implements EntityDataType { BYTE(Types.BYTE), VAR_INT(Types.VAR_INT), FLOAT(Types.FLOAT), @@ -43,11 +43,11 @@ public enum MetaType1_9 implements MetaType { private final Type type; - MetaType1_9(Type type) { + EntityDataTypes1_9(Type type) { this.type = type; } - public static MetaType1_9 byId(int id) { + public static EntityDataTypes1_9 byId(int id) { return values()[id]; } diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/item/DataItem.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/item/DataItem.java index 0e71f7328..ff8ff19ed 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/item/DataItem.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/item/DataItem.java @@ -22,8 +22,8 @@ */ package com.viaversion.viaversion.api.minecraft.item; -import com.viaversion.nbt.tag.CompoundTag; import com.google.gson.annotations.SerializedName; +import com.viaversion.nbt.tag.CompoundTag; import com.viaversion.viaversion.api.minecraft.data.StructuredDataContainer; import java.util.Objects; import org.checkerframework.checker.nullness.qual.Nullable; diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/item/data/ArmorTrimMaterial.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/item/data/ArmorTrimMaterial.java index 02d5dafec..d26fbf000 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/item/data/ArmorTrimMaterial.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/item/data/ArmorTrimMaterial.java @@ -23,7 +23,6 @@ package com.viaversion.viaversion.api.minecraft.item.data; import com.viaversion.nbt.tag.Tag; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.api.type.types.misc.HolderType; import io.netty.buffer.ByteBuf; diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/item/data/ArmorTrimPattern.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/item/data/ArmorTrimPattern.java index 193b2c746..0a5e658a3 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/item/data/ArmorTrimPattern.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/item/data/ArmorTrimPattern.java @@ -23,7 +23,6 @@ package com.viaversion.viaversion.api.minecraft.item.data; import com.viaversion.nbt.tag.Tag; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.api.type.types.misc.HolderType; import io.netty.buffer.ByteBuf; diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/item/data/BannerPattern.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/item/data/BannerPattern.java index 8ffe72c58..724fa44b9 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/item/data/BannerPattern.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/item/data/BannerPattern.java @@ -22,7 +22,6 @@ */ package com.viaversion.viaversion.api.minecraft.item.data; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.api.type.types.misc.HolderType; import io.netty.buffer.ByteBuf; diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_13.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_13.java deleted file mode 100644 index 939c0c92e..000000000 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_13.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion - * Copyright (C) 2016-2024 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; -import com.viaversion.viaversion.api.type.types.misc.ParticleType; - -public final class MetaTypes1_13 extends AbstractMetaTypes { - - public final MetaType byteType = add(0, Types.BYTE); - public final MetaType varIntType = add(1, Types.VAR_INT); - public final MetaType floatType = add(2, Types.FLOAT); - public final MetaType stringType = add(3, Types.STRING); - public final MetaType componentType = add(4, Types.COMPONENT); - public final MetaType optionalComponentType = add(5, Types.OPTIONAL_COMPONENT); - public final MetaType itemType = add(6, Types.ITEM1_13); - public final MetaType booleanType = add(7, Types.BOOLEAN); - public final MetaType rotationsType = add(8, Types.ROTATIONS); - public final MetaType blockPositionType = add(9, Types.BLOCK_POSITION1_8); - public final MetaType optionalBlockPositionType = add(10, Types.OPTIONAL_POSITION1_8); - public final MetaType directionType = add(11, Types.VAR_INT); - public final MetaType optionalUUIDType = add(12, Types.OPTIONAL_UUID); - public final MetaType optionalBlockStateType = add(13, Types.VAR_INT); - public final MetaType compoundTagType = add(14, Types.NAMED_COMPOUND_TAG); - public final MetaType particleType; - - public MetaTypes1_13(final ParticleType particleType) { - super(16); - this.particleType = add(15, particleType); - } -} diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_13_2.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_13_2.java deleted file mode 100644 index c70c9ea8e..000000000 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_13_2.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion - * Copyright (C) 2016-2024 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; -import com.viaversion.viaversion.api.type.types.misc.ParticleType; - -public final class MetaTypes1_13_2 extends AbstractMetaTypes { - - public final MetaType byteType = add(0, Types.BYTE); - public final MetaType varIntType = add(1, Types.VAR_INT); - public final MetaType floatType = add(2, Types.FLOAT); - public final MetaType stringType = add(3, Types.STRING); - public final MetaType componentType = add(4, Types.COMPONENT); - public final MetaType optionalComponentType = add(5, Types.OPTIONAL_COMPONENT); - public final MetaType itemType = add(6, Types.ITEM1_13_2); - public final MetaType booleanType = add(7, Types.BOOLEAN); - public final MetaType rotationsType = add(8, Types.ROTATIONS); - public final MetaType blockPositionType = add(9, Types.BLOCK_POSITION1_8); - public final MetaType optionalBlockPositionType = add(10, Types.OPTIONAL_POSITION1_8); - public final MetaType directionType = add(11, Types.VAR_INT); - public final MetaType optionalUUIDType = add(12, Types.OPTIONAL_UUID); - public final MetaType optionalBlockStateType = add(13, Types.VAR_INT); - public final MetaType compoundTagType = add(14, Types.NAMED_COMPOUND_TAG); - public final MetaType particleType; - - public MetaTypes1_13_2(final ParticleType particleType) { - super(16); - this.particleType = add(15, particleType); - } -} diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_14.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_14.java deleted file mode 100644 index aa2a9114f..000000000 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_14.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion - * Copyright (C) 2016-2024 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; -import com.viaversion.viaversion.api.type.types.misc.ParticleType; - -public final class MetaTypes1_14 extends AbstractMetaTypes { - - public final MetaType byteType = add(0, Types.BYTE); - public final MetaType varIntType = add(1, Types.VAR_INT); - public final MetaType floatType = add(2, Types.FLOAT); - public final MetaType stringType = add(3, Types.STRING); - public final MetaType componentType = add(4, Types.COMPONENT); - public final MetaType optionalComponentType = add(5, Types.OPTIONAL_COMPONENT); - public final MetaType itemType = add(6, Types.ITEM1_13_2); - public final MetaType booleanType = add(7, Types.BOOLEAN); - public final MetaType rotationsType = add(8, Types.ROTATIONS); - public final MetaType blockPositionType = add(9, Types.BLOCK_POSITION1_14); - public final MetaType optionalBlockPositionType = add(10, Types.OPTIONAL_POSITION_1_14); - public final MetaType directionType = add(11, Types.VAR_INT); - public final MetaType optionalUUIDType = add(12, Types.OPTIONAL_UUID); - public final MetaType optionalBlockStateType = add(13, Types.VAR_INT); - public final MetaType compoundTagType = add(14, Types.NAMED_COMPOUND_TAG); - public final MetaType particleType; - public final MetaType villagerDatatType = add(16, Types.VILLAGER_DATA); - public final MetaType optionalVarIntType = add(17, Types.OPTIONAL_VAR_INT); - public final MetaType poseType = add(18, Types.VAR_INT); - - public MetaTypes1_14(final ParticleType particleType) { - super(19); - this.particleType = add(15, particleType); - } -} diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_19.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_19.java deleted file mode 100644 index 661bf965d..000000000 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_19.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion - * Copyright (C) 2016-2024 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; -import com.viaversion.viaversion.api.type.types.misc.ParticleType; - -public final class MetaTypes1_19 extends AbstractMetaTypes { - - public final MetaType byteType = add(0, Types.BYTE); - public final MetaType varIntType = add(1, Types.VAR_INT); - public final MetaType floatType = add(2, Types.FLOAT); - public final MetaType stringType = add(3, Types.STRING); - public final MetaType componentType = add(4, Types.COMPONENT); - public final MetaType optionalComponentType = add(5, Types.OPTIONAL_COMPONENT); - public final MetaType itemType = add(6, Types.ITEM1_13_2); - public final MetaType booleanType = add(7, Types.BOOLEAN); - public final MetaType rotationsType = add(8, Types.ROTATIONS); - public final MetaType blockPositionType = add(9, Types.BLOCK_POSITION1_14); - public final MetaType optionalBlockPositionType = add(10, Types.OPTIONAL_POSITION_1_14); - public final MetaType directionType = add(11, Types.VAR_INT); - public final MetaType optionalUUIDType = add(12, Types.OPTIONAL_UUID); - public final MetaType optionalBlockStateType = add(13, Types.VAR_INT); - public final MetaType compoundTagType = add(14, Types.NAMED_COMPOUND_TAG); - public final MetaType particleType; - public final MetaType villagerDatatType = add(16, Types.VILLAGER_DATA); - public final MetaType optionalVarIntType = add(17, Types.OPTIONAL_VAR_INT); - public final MetaType poseType = add(18, Types.VAR_INT); - public final MetaType catVariantType = add(19, Types.VAR_INT); - public final MetaType frogVariantType = add(20, Types.VAR_INT); - public final MetaType optionalGlobalPosition = add(21, Types.OPTIONAL_GLOBAL_POSITION); - public final MetaType paintingVariantType = add(22, Types.VAR_INT); - - public MetaTypes1_19(final ParticleType particleType) { - super(23); - this.particleType = add(15, particleType); - } -} diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_19_3.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_19_3.java deleted file mode 100644 index f88577420..000000000 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_19_3.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion - * Copyright (C) 2016-2024 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; -import com.viaversion.viaversion.api.type.types.misc.ParticleType; - -public final class MetaTypes1_19_3 extends AbstractMetaTypes { - - public final MetaType byteType = add(0, Types.BYTE); - public final MetaType varIntType = add(1, Types.VAR_INT); - public final MetaType longType = add(2, Types.VAR_LONG); - public final MetaType floatType = add(3, Types.FLOAT); - public final MetaType stringType = add(4, Types.STRING); - public final MetaType componentType = add(5, Types.COMPONENT); - public final MetaType optionalComponentType = add(6, Types.OPTIONAL_COMPONENT); - public final MetaType itemType = add(7, Types.ITEM1_13_2); - public final MetaType booleanType = add(8, Types.BOOLEAN); - public final MetaType rotationsType = add(9, Types.ROTATIONS); - public final MetaType blockPositionType = add(10, Types.BLOCK_POSITION1_14); - public final MetaType optionalBlockPositionType = add(11, Types.OPTIONAL_POSITION_1_14); - public final MetaType directionType = add(12, Types.VAR_INT); - public final MetaType optionalUUIDType = add(13, Types.OPTIONAL_UUID); - public final MetaType optionalBlockStateType = add(14, Types.VAR_INT); - public final MetaType compoundTagType = add(15, Types.NAMED_COMPOUND_TAG); - public final MetaType particleType; - public final MetaType villagerDatatType = add(17, Types.VILLAGER_DATA); - public final MetaType optionalVarIntType = add(18, Types.OPTIONAL_VAR_INT); - public final MetaType poseType = add(19, Types.VAR_INT); - public final MetaType catVariantType = add(20, Types.VAR_INT); - public final MetaType frogVariantType = add(21, Types.VAR_INT); - public final MetaType optionalGlobalPosition = add(22, Types.OPTIONAL_GLOBAL_POSITION); - public final MetaType paintingVariantType = add(23, Types.VAR_INT); - - public MetaTypes1_19_3(final ParticleType particleType) { - super(24); - this.particleType = add(16, particleType); - } -} diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_19_4.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_19_4.java deleted file mode 100644 index bb708129f..000000000 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_19_4.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion - * Copyright (C) 2016-2024 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; -import com.viaversion.viaversion.api.type.types.misc.ParticleType; - -public final class MetaTypes1_19_4 extends AbstractMetaTypes { - - public final MetaType byteType = add(0, Types.BYTE); - public final MetaType varIntType = add(1, Types.VAR_INT); - public final MetaType longType = add(2, Types.VAR_LONG); - public final MetaType floatType = add(3, Types.FLOAT); - public final MetaType stringType = add(4, Types.STRING); - public final MetaType componentType = add(5, Types.COMPONENT); - public final MetaType optionalComponentType = add(6, Types.OPTIONAL_COMPONENT); - public final MetaType itemType = add(7, Types.ITEM1_13_2); - public final MetaType booleanType = add(8, Types.BOOLEAN); - public final MetaType rotationsType = add(9, Types.ROTATIONS); - public final MetaType blockPositionType = add(10, Types.BLOCK_POSITION1_14); - public final MetaType optionalBlockPositionType = add(11, Types.OPTIONAL_POSITION_1_14); - public final MetaType directionType = add(12, Types.VAR_INT); - public final MetaType optionalUUIDType = add(13, Types.OPTIONAL_UUID); - public final MetaType blockStateType = add(14, Types.VAR_INT); - public final MetaType optionalBlockStateType = add(15, Types.VAR_INT); - public final MetaType compoundTagType = add(16, Types.NAMED_COMPOUND_TAG); - public final MetaType particleType; - public final MetaType villagerDatatType = add(18, Types.VILLAGER_DATA); - public final MetaType optionalVarIntType = add(19, Types.OPTIONAL_VAR_INT); - public final MetaType poseType = add(20, Types.VAR_INT); - public final MetaType catVariantType = add(21, Types.VAR_INT); - public final MetaType frogVariantType = add(22, Types.VAR_INT); - public final MetaType optionalGlobalPosition = add(23, Types.OPTIONAL_GLOBAL_POSITION); - public final MetaType paintingVariantType = add(24, Types.VAR_INT); - public final MetaType snifferState = add(25, Types.VAR_INT); - public final MetaType vector3FType = add(26, Types.VECTOR3F); - public final MetaType quaternionType = add(27, Types.QUATERNION); - - public MetaTypes1_19_4(final ParticleType particleType) { - super(28); - this.particleType = add(17, particleType); - } -} diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_20_2.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_20_2.java deleted file mode 100644 index d3a610cec..000000000 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_20_2.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion - * Copyright (C) 2016-2024 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; -import com.viaversion.viaversion.api.type.types.misc.ParticleType; - -public final class MetaTypes1_20_2 extends AbstractMetaTypes { - - public final MetaType byteType = add(0, Types.BYTE); - public final MetaType varIntType = add(1, Types.VAR_INT); - public final MetaType longType = add(2, Types.VAR_LONG); - public final MetaType floatType = add(3, Types.FLOAT); - public final MetaType stringType = add(4, Types.STRING); - public final MetaType componentType = add(5, Types.COMPONENT); - public final MetaType optionalComponentType = add(6, Types.OPTIONAL_COMPONENT); - public final MetaType itemType = add(7, Types.ITEM1_20_2); - public final MetaType booleanType = add(8, Types.BOOLEAN); - public final MetaType rotationsType = add(9, Types.ROTATIONS); - public final MetaType blockPositionType = add(10, Types.BLOCK_POSITION1_14); - public final MetaType optionalBlockPositionType = add(11, Types.OPTIONAL_POSITION_1_14); - public final MetaType directionType = add(12, Types.VAR_INT); - public final MetaType optionalUUIDType = add(13, Types.OPTIONAL_UUID); - public final MetaType blockStateType = add(14, Types.VAR_INT); - public final MetaType optionalBlockStateType = add(15, Types.VAR_INT); - public final MetaType compoundTagType = add(16, Types.COMPOUND_TAG); - public final MetaType particleType; - public final MetaType villagerDatatType = add(18, Types.VILLAGER_DATA); - public final MetaType optionalVarIntType = add(19, Types.OPTIONAL_VAR_INT); - public final MetaType poseType = add(20, Types.VAR_INT); - public final MetaType catVariantType = add(21, Types.VAR_INT); - public final MetaType frogVariantType = add(22, Types.VAR_INT); - public final MetaType optionalGlobalPosition = add(23, Types.OPTIONAL_GLOBAL_POSITION); - public final MetaType paintingVariantType = add(24, Types.VAR_INT); - public final MetaType snifferState = add(25, Types.VAR_INT); - public final MetaType vector3FType = add(26, Types.VECTOR3F); - public final MetaType quaternionType = add(27, Types.QUATERNION); - - public MetaTypes1_20_2(final ParticleType particleType) { - super(28); - this.particleType = add(17, particleType); - } -} diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_20_3.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_20_3.java deleted file mode 100644 index 8bf0e0cf2..000000000 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_20_3.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion - * Copyright (C) 2016-2024 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; -import com.viaversion.viaversion.api.type.types.misc.ParticleType; - -public final class MetaTypes1_20_3 extends AbstractMetaTypes { - - public final MetaType byteType = add(0, Types.BYTE); - public final MetaType varIntType = add(1, Types.VAR_INT); - public final MetaType longType = add(2, Types.VAR_LONG); - public final MetaType floatType = add(3, Types.FLOAT); - public final MetaType stringType = add(4, Types.STRING); - public final MetaType componentType = add(5, Types.TAG); - public final MetaType optionalComponentType = add(6, Types.OPTIONAL_TAG); - public final MetaType itemType = add(7, Types.ITEM1_20_2); - public final MetaType booleanType = add(8, Types.BOOLEAN); - public final MetaType rotationsType = add(9, Types.ROTATIONS); - public final MetaType blockPositionType = add(10, Types.BLOCK_POSITION1_14); - public final MetaType optionalBlockPositionType = add(11, Types.OPTIONAL_POSITION_1_14); - public final MetaType directionType = add(12, Types.VAR_INT); - public final MetaType optionalUUIDType = add(13, Types.OPTIONAL_UUID); - public final MetaType blockStateType = add(14, Types.VAR_INT); - public final MetaType optionalBlockStateType = add(15, Types.VAR_INT); - public final MetaType compoundTagType = add(16, Types.COMPOUND_TAG); - public final MetaType particleType; - public final MetaType villagerDatatType = add(18, Types.VILLAGER_DATA); - public final MetaType optionalVarIntType = add(19, Types.OPTIONAL_VAR_INT); - public final MetaType poseType = add(20, Types.VAR_INT); - public final MetaType catVariantType = add(21, Types.VAR_INT); - public final MetaType frogVariantType = add(22, Types.VAR_INT); - public final MetaType optionalGlobalPosition = add(23, Types.OPTIONAL_GLOBAL_POSITION); - public final MetaType paintingVariantType = add(24, Types.VAR_INT); - public final MetaType snifferState = add(25, Types.VAR_INT); - public final MetaType vector3FType = add(26, Types.VECTOR3F); - public final MetaType quaternionType = add(27, Types.QUATERNION); - - public MetaTypes1_20_3(final ParticleType particleType) { - super(28); - this.particleType = add(17, particleType); - } -} diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_20_5.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_20_5.java deleted file mode 100644 index e2e641294..000000000 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/metadata/types/MetaTypes1_20_5.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion - * Copyright (C) 2016-2024 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.Particle; -import com.viaversion.viaversion.api.minecraft.metadata.MetaType; -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_20_5; - -public final class MetaTypes1_20_5 extends AbstractMetaTypes { - - public final MetaType byteType = add(0, Types.BYTE); - public final MetaType varIntType = add(1, Types.VAR_INT); - public final MetaType longType = add(2, Types.VAR_LONG); - public final MetaType floatType = add(3, Types.FLOAT); - public final MetaType stringType = add(4, Types.STRING); - public final MetaType componentType = add(5, Types.TAG); - public final MetaType optionalComponentType = add(6, Types.OPTIONAL_TAG); - public final MetaType itemType = add(7, Types1_20_5.ITEM); - public final MetaType booleanType = add(8, Types.BOOLEAN); - public final MetaType rotationsType = add(9, Types.ROTATIONS); - public final MetaType blockPositionType = add(10, Types.BLOCK_POSITION1_14); - public final MetaType optionalBlockPositionType = add(11, Types.OPTIONAL_POSITION_1_14); - public final MetaType directionType = add(12, Types.VAR_INT); - public final MetaType optionalUUIDType = add(13, Types.OPTIONAL_UUID); - public final MetaType blockStateType = add(14, Types.VAR_INT); - public final MetaType optionalBlockStateType = add(15, Types.VAR_INT); - public final MetaType compoundTagType = add(16, Types.COMPOUND_TAG); - public final MetaType particleType; - public final MetaType particlesType; - public final MetaType villagerDatatType = add(19, Types.VILLAGER_DATA); - public final MetaType optionalVarIntType = add(20, Types.OPTIONAL_VAR_INT); - public final MetaType poseType = add(21, Types.VAR_INT); - public final MetaType catVariantType = add(22, Types.VAR_INT); - public final MetaType wolfVariantType = add(23, Types.VAR_INT); - public final MetaType frogVariantType = add(24, Types.VAR_INT); - public final MetaType optionalGlobalPosition = add(25, Types.OPTIONAL_GLOBAL_POSITION); - public final MetaType paintingVariantType = add(26, Types.VAR_INT); - public final MetaType snifferState = add(27, Types.VAR_INT); - public final MetaType armadilloState = add(28, Types.VAR_INT); - public final MetaType vector3FType = add(29, Types.VECTOR3F); - public final MetaType quaternionType = add(30, Types.QUATERNION); - - public MetaTypes1_20_5(final ParticleType particleType, final ArrayType particlesType) { - super(31); - this.particleType = add(17, particleType); - this.particlesType = add(18, particlesType); - } -} diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/SignableCommandArgumentsProvider.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/SignableCommandArgumentsProvider.java index d991742be..6ae11ae22 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/SignableCommandArgumentsProvider.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/SignableCommandArgumentsProvider.java @@ -24,7 +24,6 @@ package com.viaversion.viaversion.api.minecraft.signature; import com.viaversion.viaversion.api.platform.providers.Provider; import com.viaversion.viaversion.util.Pair; - import java.util.List; public abstract class SignableCommandArgumentsProvider implements Provider { diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/model/chain/v1_19_1/MessageBody.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/model/chain/v1_19_1/MessageBody.java index 472523f59..e1f06713c 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/model/chain/v1_19_1/MessageBody.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/model/chain/v1_19_1/MessageBody.java @@ -26,7 +26,6 @@ import com.viaversion.viaversion.api.minecraft.PlayerMessageSignature; import com.viaversion.viaversion.api.minecraft.signature.model.DecoratableMessage; import com.viaversion.viaversion.api.minecraft.signature.util.DataConsumer; import com.viaversion.viaversion.util.GsonUtil; - import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.io.IOException; diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/model/chain/v1_19_1/MessageHeader.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/model/chain/v1_19_1/MessageHeader.java index c4c786593..9a385b556 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/model/chain/v1_19_1/MessageHeader.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/model/chain/v1_19_1/MessageHeader.java @@ -23,7 +23,6 @@ package com.viaversion.viaversion.api.minecraft.signature.model.chain.v1_19_1; import com.viaversion.viaversion.api.minecraft.signature.util.DataConsumer; - import java.util.UUID; public class MessageHeader { diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/model/chain/v1_19_3/MessageBody.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/model/chain/v1_19_3/MessageBody.java index a1632bdaf..0e035b33d 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/model/chain/v1_19_3/MessageBody.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/model/chain/v1_19_3/MessageBody.java @@ -26,7 +26,6 @@ import com.google.common.primitives.Ints; import com.google.common.primitives.Longs; import com.viaversion.viaversion.api.minecraft.PlayerMessageSignature; import com.viaversion.viaversion.api.minecraft.signature.util.DataConsumer; - import java.nio.charset.StandardCharsets; import java.time.Instant; diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/model/chain/v1_19_3/MessageLink.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/model/chain/v1_19_3/MessageLink.java index 0a000c170..e4bae3476 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/model/chain/v1_19_3/MessageLink.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/model/chain/v1_19_3/MessageLink.java @@ -24,7 +24,6 @@ package com.viaversion.viaversion.api.minecraft.signature.model.chain.v1_19_3; import com.google.common.primitives.Ints; import com.viaversion.viaversion.api.minecraft.signature.util.DataConsumer; - import java.util.UUID; public class MessageLink { diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/storage/ChatSession.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/storage/ChatSession.java index aed967b2a..f049c3620 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/storage/ChatSession.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/storage/ChatSession.java @@ -25,7 +25,6 @@ package com.viaversion.viaversion.api.minecraft.signature.storage; import com.viaversion.viaversion.api.connection.StorableObject; import com.viaversion.viaversion.api.minecraft.ProfileKey; import com.viaversion.viaversion.api.minecraft.signature.util.DataConsumer; - import java.security.PrivateKey; import java.security.Signature; import java.security.SignatureException; diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/storage/ChatSession1_19_0.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/storage/ChatSession1_19_0.java index e2c306541..d7cbd9214 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/storage/ChatSession1_19_0.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/storage/ChatSession1_19_0.java @@ -26,7 +26,6 @@ import com.viaversion.viaversion.api.minecraft.ProfileKey; import com.viaversion.viaversion.api.minecraft.signature.model.DecoratableMessage; import com.viaversion.viaversion.api.minecraft.signature.model.MessageMetadata; import com.viaversion.viaversion.util.GsonUtil; - import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.charset.StandardCharsets; diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/storage/ChatSession1_19_1.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/storage/ChatSession1_19_1.java index 5213a9c1b..e436efa55 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/storage/ChatSession1_19_1.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/storage/ChatSession1_19_1.java @@ -28,7 +28,6 @@ import com.viaversion.viaversion.api.minecraft.signature.model.DecoratableMessag import com.viaversion.viaversion.api.minecraft.signature.model.MessageMetadata; import com.viaversion.viaversion.api.minecraft.signature.model.chain.v1_19_1.MessageBody; import com.viaversion.viaversion.api.minecraft.signature.model.chain.v1_19_1.MessageHeader; - import java.security.PrivateKey; import java.security.SignatureException; import java.util.UUID; diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/storage/ChatSession1_19_3.java b/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/storage/ChatSession1_19_3.java index e52fd57bc..7c6b18303 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/storage/ChatSession1_19_3.java +++ b/api/src/main/java/com/viaversion/viaversion/api/minecraft/signature/storage/ChatSession1_19_3.java @@ -28,7 +28,6 @@ import com.viaversion.viaversion.api.minecraft.ProfileKey; import com.viaversion.viaversion.api.minecraft.signature.model.MessageMetadata; import com.viaversion.viaversion.api.minecraft.signature.model.chain.v1_19_3.MessageBody; import com.viaversion.viaversion.api.minecraft.signature.model.chain.v1_19_3.MessageLink; - import java.security.PrivateKey; import java.security.SignatureException; import java.util.UUID; diff --git a/api/src/main/java/com/viaversion/viaversion/api/platform/ViaPlatform.java b/api/src/main/java/com/viaversion/viaversion/api/platform/ViaPlatform.java index 01b58f04f..190bba759 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/platform/ViaPlatform.java +++ b/api/src/main/java/com/viaversion/viaversion/api/platform/ViaPlatform.java @@ -23,10 +23,8 @@ package com.viaversion.viaversion.api.platform; import com.google.gson.JsonObject; -import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.ViaAPI; import com.viaversion.viaversion.api.command.ViaCommandSender; -import com.viaversion.viaversion.api.configuration.ConfigurationProvider; import com.viaversion.viaversion.api.configuration.ViaVersionConfig; import com.viaversion.viaversion.api.connection.UserConnection; import java.io.File; diff --git a/api/src/main/java/com/viaversion/viaversion/api/protocol/AbstractProtocol.java b/api/src/main/java/com/viaversion/viaversion/api/protocol/AbstractProtocol.java index 463f8bf63..8a5b4df3a 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/protocol/AbstractProtocol.java +++ b/api/src/main/java/com/viaversion/viaversion/api/protocol/AbstractProtocol.java @@ -62,7 +62,7 @@ import static com.viaversion.viaversion.util.ProtocolUtil.packetTypeMap; * @param unmapped serverbound packet type */ public abstract class AbstractProtocol implements Protocol { + SM extends ServerboundPacketType, SU extends ServerboundPacketType> implements Protocol { protected final Class unmappedClientboundPacketType; protected final Class mappedClientboundPacketType; protected final Class mappedServerboundPacketType; @@ -108,21 +108,21 @@ public abstract class AbstractProtocol void registerPacketIdChanges( - Map> unmappedPacketTypes, - Map> mappedPacketTypes, - Predicate registeredPredicate, - BiConsumer registerConsumer + Map> unmappedPacketTypes, + Map> mappedPacketTypes, + Predicate registeredPredicate, + BiConsumer registerConsumer ) { for (Map.Entry> entry : mappedPacketTypes.entrySet()) { PacketTypeMap mappedTypes = entry.getValue(); @@ -241,10 +241,10 @@ public abstract class AbstractProtocol createPacketTypesProvider() { return new SimplePacketTypesProvider<>( - packetTypeMap(unmappedClientboundPacketType, unmappedClientboundPacketType), - packetTypeMap(mappedClientboundPacketType, mappedClientboundPacketType), - packetTypeMap(mappedServerboundPacketType, mappedServerboundPacketType), - packetTypeMap(unmappedServerboundPacketType, unmappedServerboundPacketType) + packetTypeMap(unmappedClientboundPacketType, unmappedClientboundPacketType), + packetTypeMap(mappedClientboundPacketType, mappedClientboundPacketType), + packetTypeMap(mappedServerboundPacketType, mappedServerboundPacketType), + packetTypeMap(unmappedServerboundPacketType, unmappedServerboundPacketType) ); } @@ -280,7 +280,7 @@ public abstract class AbstractProtocol" + ProtocolUtil.toNiceHex(mappedPacketId)); + + " IN REMAP OF " + state + " " + ProtocolUtil.toNiceHex(unmappedPacketId) + "->" + ProtocolUtil.toNiceHex(mappedPacketId)); } } diff --git a/api/src/main/java/com/viaversion/viaversion/api/protocol/AbstractSimpleProtocol.java b/api/src/main/java/com/viaversion/viaversion/api/protocol/AbstractSimpleProtocol.java index 8f4c8843d..a8c6dd396 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/protocol/AbstractSimpleProtocol.java +++ b/api/src/main/java/com/viaversion/viaversion/api/protocol/AbstractSimpleProtocol.java @@ -28,7 +28,7 @@ package com.viaversion.viaversion.api.protocol; * {@link AbstractProtocol} should be preferred over this class in most cases. */ public abstract class AbstractSimpleProtocol extends AbstractProtocol implements SimpleProtocol { + SimpleProtocol.DummyPacketTypes, SimpleProtocol.DummyPacketTypes> implements SimpleProtocol { protected AbstractSimpleProtocol() { super(null, null, null, null); diff --git a/api/src/main/java/com/viaversion/viaversion/api/protocol/ProtocolManager.java b/api/src/main/java/com/viaversion/viaversion/api/protocol/ProtocolManager.java index f64e1b320..468d32bcd 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/protocol/ProtocolManager.java +++ b/api/src/main/java/com/viaversion/viaversion/api/protocol/ProtocolManager.java @@ -31,7 +31,6 @@ import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType; import com.viaversion.viaversion.api.protocol.packet.VersionedPacketTransformer; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viaversion.api.protocol.version.ServerProtocolVersion; -import com.viaversion.viaversion.api.protocol.version.VersionType; import io.netty.buffer.ByteBuf; import java.util.Collection; import java.util.List; diff --git a/api/src/main/java/com/viaversion/viaversion/api/protocol/packet/provider/PacketTypeArrayMap.java b/api/src/main/java/com/viaversion/viaversion/api/protocol/packet/provider/PacketTypeArrayMap.java index 5fff26d54..f026ca722 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/protocol/packet/provider/PacketTypeArrayMap.java +++ b/api/src/main/java/com/viaversion/viaversion/api/protocol/packet/provider/PacketTypeArrayMap.java @@ -22,11 +22,10 @@ */ package com.viaversion.viaversion.api.protocol.packet.provider; +import com.viaversion.viaversion.api.protocol.packet.PacketType; import java.util.Arrays; import java.util.Collection; import java.util.Map; - -import com.viaversion.viaversion.api.protocol.packet.PacketType; import org.checkerframework.checker.nullness.qual.Nullable; final class PacketTypeArrayMap

implements PacketTypeMap

{ diff --git a/api/src/main/java/com/viaversion/viaversion/api/protocol/packet/provider/SimplePacketTypesProvider.java b/api/src/main/java/com/viaversion/viaversion/api/protocol/packet/provider/SimplePacketTypesProvider.java index e7b18eba9..c32e27b6c 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/protocol/packet/provider/SimplePacketTypesProvider.java +++ b/api/src/main/java/com/viaversion/viaversion/api/protocol/packet/provider/SimplePacketTypesProvider.java @@ -28,9 +28,9 @@ import com.viaversion.viaversion.api.protocol.packet.State; import java.util.Map; public record SimplePacketTypesProvider( - Map> unmappedClientboundPacketTypes, - Map> mappedClientboundPacketTypes, - Map> mappedServerboundPacketTypes, - Map> unmappedServerboundPacketTypes + Map> unmappedClientboundPacketTypes, + Map> mappedClientboundPacketTypes, + Map> mappedServerboundPacketTypes, + Map> unmappedServerboundPacketTypes ) implements PacketTypesProvider { } diff --git a/api/src/main/java/com/viaversion/viaversion/api/rewriter/EntityRewriter.java b/api/src/main/java/com/viaversion/viaversion/api/rewriter/EntityRewriter.java index bdaaf95fd..a73fd6d27 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/rewriter/EntityRewriter.java +++ b/api/src/main/java/com/viaversion/viaversion/api/rewriter/EntityRewriter.java @@ -25,7 +25,7 @@ package com.viaversion.viaversion.api.rewriter; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.data.entity.EntityTracker; import com.viaversion.viaversion.api.minecraft.entities.EntityType; -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; import com.viaversion.viaversion.api.protocol.Protocol; import java.util.List; @@ -65,7 +65,7 @@ public interface EntityRewriter> extends Rewriter * @param metadataList full, mutable list of metadata * @param connection user connection */ - void handleMetadata(int entityId, List metadataList, UserConnection connection); + void handleEntityData(int entityId, List metadataList, UserConnection connection); /** * Returns the entity tracker for the current protocol. diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/Types.java b/api/src/main/java/com/viaversion/viaversion/api/type/Types.java index 2cf15fa22..655a3f618 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/Types.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/Types.java @@ -42,7 +42,7 @@ import com.viaversion.viaversion.api.minecraft.VillagerData; import com.viaversion.viaversion.api.minecraft.blockentity.BlockEntity; import com.viaversion.viaversion.api.minecraft.item.Item; import com.viaversion.viaversion.api.minecraft.item.data.Enchantments; -import com.viaversion.viaversion.api.minecraft.metadata.ChunkPosition; +import com.viaversion.viaversion.api.minecraft.ChunkPosition; import com.viaversion.viaversion.api.type.types.ArrayType; import com.viaversion.viaversion.api.type.types.BitSetType; import com.viaversion.viaversion.api.type.types.BooleanType; diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/IntArrayType.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/IntArrayType.java index c0623e290..8a8e4d3e3 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/IntArrayType.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/IntArrayType.java @@ -23,7 +23,6 @@ package com.viaversion.viaversion.api.type.types; import com.google.common.base.Preconditions; -import com.viaversion.viaversion.api.type.OptionalType; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import io.netty.buffer.ByteBuf; diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/StringType.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/StringType.java index d5360c6d6..59f1fbfb5 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/StringType.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/StringType.java @@ -32,7 +32,7 @@ import java.nio.charset.StandardCharsets; public class StringType extends Type { // String#length() (used to limit the string in Minecraft source code) uses char[]#length private static final int MAX_CHAR_UTF_8_LENGTH = Character.toString(Character.MAX_VALUE) - .getBytes(StandardCharsets.UTF_8).length; + .getBytes(StandardCharsets.UTF_8).length; private final int maxLength; public StringType() { @@ -49,13 +49,13 @@ public class StringType extends Type { int len = Types.VAR_INT.readPrimitive(buffer); Preconditions.checkArgument(len <= maxLength * MAX_CHAR_UTF_8_LENGTH, - "Cannot receive string longer than Short.MAX_VALUE * " + MAX_CHAR_UTF_8_LENGTH + " bytes (got %s bytes)", len); + "Cannot receive string longer than Short.MAX_VALUE * " + MAX_CHAR_UTF_8_LENGTH + " bytes (got %s bytes)", len); String string = buffer.toString(buffer.readerIndex(), len, StandardCharsets.UTF_8); buffer.skipBytes(len); Preconditions.checkArgument(string.length() <= maxLength, - "Cannot receive string longer than Short.MAX_VALUE characters (got %s bytes)", string.length()); + "Cannot receive string longer than Short.MAX_VALUE characters (got %s bytes)", string.length()); return string; } diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkSectionType1_13.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkSectionType1_13.java index 837fe2a28..acca58a1d 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkSectionType1_13.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkSectionType1_13.java @@ -68,7 +68,7 @@ public class ChunkSectionType1_13 extends Type { if (blockData.length == expectedLength) { DataPalette blockPalette = chunkSection.palette(PaletteType.BLOCKS); CompactArrayUtil.iterateCompactArray(bitsPerBlock, ChunkSection.SIZE, blockData, - bitsPerBlock == GLOBAL_PALETTE ? blockPalette::setIdAt : blockPalette::setPaletteIndexAt); + bitsPerBlock == GLOBAL_PALETTE ? blockPalette::setIdAt : blockPalette::setPaletteIndexAt); } } @@ -98,7 +98,7 @@ public class ChunkSectionType1_13 extends Type { } long[] data = CompactArrayUtil.createCompactArray(bitsPerBlock, ChunkSection.SIZE, - bitsPerBlock == GLOBAL_PALETTE ? blockPalette::idAt : blockPalette::paletteIndexAt); + bitsPerBlock == GLOBAL_PALETTE ? blockPalette::idAt : blockPalette::paletteIndexAt); Types.LONG_ARRAY_PRIMITIVE.write(buffer, data); } } diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkSectionType1_16.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkSectionType1_16.java index 02170562d..d044da43d 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkSectionType1_16.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkSectionType1_16.java @@ -69,7 +69,7 @@ public class ChunkSectionType1_16 extends Type { if (blockData.length == expectedLength) { DataPalette blockPalette = chunkSection.palette(PaletteType.BLOCKS); CompactArrayUtil.iterateCompactArrayWithPadding(bitsPerBlock, ChunkSection.SIZE, blockData, - bitsPerBlock == GLOBAL_PALETTE ? blockPalette::setIdAt : blockPalette::setPaletteIndexAt); + bitsPerBlock == GLOBAL_PALETTE ? blockPalette::setIdAt : blockPalette::setPaletteIndexAt); } } @@ -99,7 +99,7 @@ public class ChunkSectionType1_16 extends Type { } long[] data = CompactArrayUtil.createCompactArrayWithPadding(bitsPerBlock, ChunkSection.SIZE, - bitsPerBlock == GLOBAL_PALETTE ? blockPalette::idAt : blockPalette::paletteIndexAt); + bitsPerBlock == GLOBAL_PALETTE ? blockPalette::idAt : blockPalette::paletteIndexAt); Types.LONG_ARRAY_PRIMITIVE.write(buffer, data); } } diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkSectionType1_9.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkSectionType1_9.java index 7427cabbb..201c8829e 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkSectionType1_9.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkSectionType1_9.java @@ -67,7 +67,7 @@ public class ChunkSectionType1_9 extends Type { int expectedLength = (int) Math.ceil(ChunkSection.SIZE * bitsPerBlock / 64.0); if (blockData.length == expectedLength) { CompactArrayUtil.iterateCompactArray(bitsPerBlock, ChunkSection.SIZE, blockData, - bitsPerBlock == GLOBAL_PALETTE ? blockPalette::setIdAt : blockPalette::setPaletteIndexAt); + bitsPerBlock == GLOBAL_PALETTE ? blockPalette::setIdAt : blockPalette::setPaletteIndexAt); } } @@ -99,7 +99,7 @@ public class ChunkSectionType1_9 extends Type { } long[] data = CompactArrayUtil.createCompactArray(bitsPerBlock, ChunkSection.SIZE, - bitsPerBlock == GLOBAL_PALETTE ? blockPalette::idAt : blockPalette::paletteIndexAt); + bitsPerBlock == GLOBAL_PALETTE ? blockPalette::idAt : blockPalette::paletteIndexAt); Types.LONG_ARRAY_PRIMITIVE.write(buffer, data); } } diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_14.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_14.java index f6d0ca2a5..b85988519 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_14.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_14.java @@ -23,7 +23,6 @@ package com.viaversion.viaversion.api.type.types.chunk; import com.viaversion.nbt.tag.CompoundTag; -import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.minecraft.chunks.BaseChunk; import com.viaversion.viaversion.api.minecraft.chunks.Chunk; import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection; diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_15.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_15.java index f884e62a4..3ad6768ea 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_15.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_15.java @@ -23,7 +23,6 @@ package com.viaversion.viaversion.api.type.types.chunk; import com.viaversion.nbt.tag.CompoundTag; -import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.minecraft.chunks.BaseChunk; import com.viaversion.viaversion.api.minecraft.chunks.Chunk; import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection; diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_16.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_16.java index 88f9d5568..224d9da42 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_16.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_16.java @@ -23,7 +23,6 @@ package com.viaversion.viaversion.api.type.types.chunk; import com.viaversion.nbt.tag.CompoundTag; -import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.minecraft.chunks.BaseChunk; import com.viaversion.viaversion.api.minecraft.chunks.Chunk; import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection; diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_16_2.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_16_2.java index 73046b8ae..18f1e91f8 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_16_2.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_16_2.java @@ -23,7 +23,6 @@ package com.viaversion.viaversion.api.type.types.chunk; import com.viaversion.nbt.tag.CompoundTag; -import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.minecraft.chunks.BaseChunk; import com.viaversion.viaversion.api.minecraft.chunks.Chunk; import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection; diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_17.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_17.java index d00fbc084..e6c10c899 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_17.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_17.java @@ -22,9 +22,8 @@ */ package com.viaversion.viaversion.api.type.types.chunk; -import com.viaversion.nbt.tag.CompoundTag; import com.google.common.base.Preconditions; -import com.viaversion.viaversion.api.Via; +import com.viaversion.nbt.tag.CompoundTag; import com.viaversion.viaversion.api.minecraft.chunks.BaseChunk; import com.viaversion.viaversion.api.minecraft.chunks.Chunk; import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection; diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_18.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_18.java index 1c13f845d..1d4a8991d 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_18.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_18.java @@ -22,8 +22,8 @@ */ package com.viaversion.viaversion.api.type.types.chunk; -import com.viaversion.nbt.tag.CompoundTag; import com.google.common.base.Preconditions; +import com.viaversion.nbt.tag.CompoundTag; import com.viaversion.viaversion.api.minecraft.blockentity.BlockEntity; import com.viaversion.viaversion.api.minecraft.chunks.Chunk; import com.viaversion.viaversion.api.minecraft.chunks.Chunk1_18; diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_20_2.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_20_2.java index c679cd5a1..ffe709afd 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_20_2.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_20_2.java @@ -22,8 +22,8 @@ */ package com.viaversion.viaversion.api.type.types.chunk; -import com.viaversion.nbt.tag.CompoundTag; import com.google.common.base.Preconditions; +import com.viaversion.nbt.tag.CompoundTag; import com.viaversion.viaversion.api.minecraft.blockentity.BlockEntity; import com.viaversion.viaversion.api.minecraft.chunks.Chunk; import com.viaversion.viaversion.api.minecraft.chunks.Chunk1_18; diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_8.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_8.java index e86373b84..a9cdf6695 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_8.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_8.java @@ -33,7 +33,6 @@ import com.viaversion.viaversion.api.type.types.version.Types1_8; import com.viaversion.viaversion.util.ChunkUtil; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; - import java.util.ArrayList; import java.util.logging.Level; diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_9_1.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_9_1.java index 80f422c10..7507eb9be 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_9_1.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_9_1.java @@ -32,7 +32,6 @@ import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.api.type.types.version.Types1_9; import com.viaversion.viaversion.util.ChunkUtil; import io.netty.buffer.ByteBuf; - import java.util.ArrayList; import java.util.BitSet; import java.util.logging.Level; diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_9_3.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_9_3.java index 3e05e20a6..feb4428b2 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_9_3.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/ChunkType1_9_3.java @@ -33,7 +33,6 @@ import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.api.type.types.version.Types1_9; import com.viaversion.viaversion.util.ChunkUtil; import io.netty.buffer.ByteBuf; - import java.util.ArrayList; import java.util.Arrays; import java.util.List; diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/PaletteType1_18.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/PaletteType1_18.java index 01fa1fb9d..7e404fb76 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/PaletteType1_18.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/chunk/PaletteType1_18.java @@ -77,7 +77,7 @@ public final class PaletteType1_18 extends Type { final int expectedLength = (type.size() + valuesPerLong - 1) / valuesPerLong; if (values.length == expectedLength) { // Thanks, Hypixel CompactArrayUtil.iterateCompactArrayWithPadding(bitsPerValue, type.size(), values, - bitsPerValue == globalPaletteBits ? palette::setIdAt : palette::setPaletteIndexAt); + bitsPerValue == globalPaletteBits ? palette::setIdAt : palette::setPaletteIndexAt); } } return palette; diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/metadata/MetaListType.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/entitydata/EntityDataListType.java similarity index 75% rename from api/src/main/java/com/viaversion/viaversion/api/type/types/metadata/MetaListType.java rename to api/src/main/java/com/viaversion/viaversion/api/type/types/entitydata/EntityDataListType.java index bf0c6eaed..ab29e0453 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/metadata/MetaListType.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/entitydata/EntityDataListType.java @@ -20,27 +20,27 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -package com.viaversion.viaversion.api.type.types.metadata; +package com.viaversion.viaversion.api.type.types.entitydata; import com.google.common.base.Preconditions; -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; import com.viaversion.viaversion.api.type.Type; import io.netty.buffer.ByteBuf; import java.util.ArrayList; import java.util.List; -public final class MetaListType extends MetaListTypeTemplate { - private final Type type; +public final class EntityDataListType extends EntityDataListTypeTemplate { + private final Type type; - public MetaListType(Type type) { + public EntityDataListType(Type type) { Preconditions.checkNotNull(type); this.type = type; } @Override - public List read(final ByteBuf buffer) { - final List list = new ArrayList<>(); - Metadata meta; + public List read(final ByteBuf buffer) { + final List list = new ArrayList<>(); + EntityData meta; do { meta = this.type.read(buffer); if (meta != null) { @@ -51,8 +51,8 @@ public final class MetaListType extends MetaListTypeTemplate { } @Override - public void write(final ByteBuf buffer, final List object) { - for (final Metadata metadata : object) { + public void write(final ByteBuf buffer, final List object) { + for (final EntityData metadata : object) { this.type.write(buffer, metadata); } this.type.write(buffer, null); diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/metadata/MetaListTypeTemplate.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/entitydata/EntityDataListTypeTemplate.java similarity index 79% rename from api/src/main/java/com/viaversion/viaversion/api/type/types/metadata/MetaListTypeTemplate.java rename to api/src/main/java/com/viaversion/viaversion/api/type/types/entitydata/EntityDataListTypeTemplate.java index 91fd3be85..bc7b36b42 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/metadata/MetaListTypeTemplate.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/entitydata/EntityDataListTypeTemplate.java @@ -20,20 +20,20 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -package com.viaversion.viaversion.api.type.types.metadata; +package com.viaversion.viaversion.api.type.types.entitydata; -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; import com.viaversion.viaversion.api.type.Type; import java.util.List; -public abstract class MetaListTypeTemplate extends Type> { +public abstract class EntityDataListTypeTemplate extends Type> { - protected MetaListTypeTemplate() { - super("MetaData List", List.class); + protected EntityDataListTypeTemplate() { + super("Entity data list", List.class); } @Override public Class getBaseClass() { - return MetaListTypeTemplate.class; + return EntityDataListTypeTemplate.class; } } diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/metadata/MetadataType.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/entitydata/EntityDataType.java similarity index 73% rename from api/src/main/java/com/viaversion/viaversion/api/type/types/metadata/MetadataType.java rename to api/src/main/java/com/viaversion/viaversion/api/type/types/entitydata/EntityDataType.java index e50517d3a..52c977622 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/metadata/MetadataType.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/entitydata/EntityDataType.java @@ -20,22 +20,20 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -package com.viaversion.viaversion.api.type.types.metadata; +package com.viaversion.viaversion.api.type.types.entitydata; -import com.viaversion.viaversion.api.minecraft.metadata.MetaType; -import com.viaversion.viaversion.api.minecraft.metadata.types.MetaTypes; -import com.viaversion.viaversion.api.type.types.metadata.ModernMetaType; +import com.viaversion.viaversion.api.minecraft.entitydata.types.EntityDataTypes; -public final class MetadataType extends ModernMetaType { +public final class EntityDataType extends ModernEntityDataType { - private final MetaTypes metaTypes; + private final EntityDataTypes metaTypes; - public MetadataType(final MetaTypes metaTypes) { + public EntityDataType(final EntityDataTypes metaTypes) { this.metaTypes = metaTypes; } @Override - protected MetaType getType(final int index) { + protected com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType getType(final int index) { return metaTypes.byId(index); } } diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/metadata/MetadataType1_8.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/entitydata/EntityDataType1_12.java similarity index 75% rename from api/src/main/java/com/viaversion/viaversion/api/type/types/metadata/MetadataType1_8.java rename to api/src/main/java/com/viaversion/viaversion/api/type/types/entitydata/EntityDataType1_12.java index 18cb542b7..4dc994de3 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/metadata/MetadataType1_8.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/entitydata/EntityDataType1_12.java @@ -20,16 +20,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -package com.viaversion.viaversion.api.type.types.metadata; +package com.viaversion.viaversion.api.type.types.entitydata; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType; +import com.viaversion.viaversion.api.minecraft.entitydata.types.EntityDataTypes1_12; -import com.viaversion.viaversion.api.minecraft.metadata.MetaType; -import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_8; -import com.viaversion.viaversion.api.type.types.metadata.OldMetaType; - -public class MetadataType1_8 extends OldMetaType { +public class EntityDataType1_12 extends ModernEntityDataType { @Override - protected MetaType getType(int index) { - return MetaType1_8.byId(index); + protected EntityDataType getType(final int index) { + return EntityDataTypes1_12.byId(index); } } diff --git a/api/src/main/java/com/viaversion/viaversion/api/minecraft/Position3d.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/entitydata/EntityDataType1_8.java similarity index 75% rename from api/src/main/java/com/viaversion/viaversion/api/minecraft/Position3d.java rename to api/src/main/java/com/viaversion/viaversion/api/type/types/entitydata/EntityDataType1_8.java index de425ec4e..d057cc447 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/minecraft/Position3d.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/entitydata/EntityDataType1_8.java @@ -20,7 +20,15 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -package com.viaversion.viaversion.api.minecraft; +package com.viaversion.viaversion.api.type.types.entitydata; -public record Position3d(double x, double y, double z) { + +import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType; +import com.viaversion.viaversion.api.minecraft.entitydata.types.EntityDataTypes1_8; + +public class EntityDataType1_8 extends OldEntityDataType { + @Override + protected EntityDataType getType(int index) { + return EntityDataTypes1_8.byId(index); + } } diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/metadata/MetadataType1_9.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/entitydata/EntityDataType1_9.java similarity index 74% rename from api/src/main/java/com/viaversion/viaversion/api/type/types/metadata/MetadataType1_9.java rename to api/src/main/java/com/viaversion/viaversion/api/type/types/entitydata/EntityDataType1_9.java index 9ad9d6781..9b6540029 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/metadata/MetadataType1_9.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/entitydata/EntityDataType1_9.java @@ -20,15 +20,14 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -package com.viaversion.viaversion.api.type.types.metadata; +package com.viaversion.viaversion.api.type.types.entitydata; -import com.viaversion.viaversion.api.minecraft.metadata.MetaType; -import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_9; -import com.viaversion.viaversion.api.type.types.metadata.ModernMetaType; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType; +import com.viaversion.viaversion.api.minecraft.entitydata.types.EntityDataTypes1_9; -public class MetadataType1_9 extends ModernMetaType { +public class EntityDataType1_9 extends ModernEntityDataType { @Override - protected MetaType getType(final int index) { - return MetaType1_9.byId(index); + protected EntityDataType getType(final int index) { + return EntityDataTypes1_9.byId(index); } } diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/metadata/MetaTypeTemplate.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/entitydata/EntityDataTypeTemplate.java similarity index 79% rename from api/src/main/java/com/viaversion/viaversion/api/type/types/metadata/MetaTypeTemplate.java rename to api/src/main/java/com/viaversion/viaversion/api/type/types/entitydata/EntityDataTypeTemplate.java index 1efe22f32..7f5df63b7 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/metadata/MetaTypeTemplate.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/entitydata/EntityDataTypeTemplate.java @@ -20,18 +20,18 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -package com.viaversion.viaversion.api.type.types.metadata; +package com.viaversion.viaversion.api.type.types.entitydata; -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; import com.viaversion.viaversion.api.type.Type; -public abstract class MetaTypeTemplate extends Type { - protected MetaTypeTemplate() { - super("Metadata type", Metadata.class); +public abstract class EntityDataTypeTemplate extends Type { + protected EntityDataTypeTemplate() { + super("Entity data type", EntityData.class); } @Override public Class getBaseClass() { - return MetaTypeTemplate.class; + return EntityDataTypeTemplate.class; } } diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/metadata/ModernMetaType.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/entitydata/ModernEntityDataType.java similarity index 71% rename from api/src/main/java/com/viaversion/viaversion/api/type/types/metadata/ModernMetaType.java rename to api/src/main/java/com/viaversion/viaversion/api/type/types/entitydata/ModernEntityDataType.java index d813073a0..3ec603e69 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/metadata/ModernMetaType.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/entitydata/ModernEntityDataType.java @@ -20,33 +20,33 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -package com.viaversion.viaversion.api.type.types.metadata; +package com.viaversion.viaversion.api.type.types.entitydata; -import com.viaversion.viaversion.api.minecraft.metadata.MetaType; -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType; import com.viaversion.viaversion.api.type.Types; import io.netty.buffer.ByteBuf; -public abstract class ModernMetaType extends MetaTypeTemplate { +public abstract class ModernEntityDataType extends EntityDataTypeTemplate { private static final int END = 255; @Override - public Metadata read(final ByteBuf buffer) { + public EntityData read(final ByteBuf buffer) { final short index = buffer.readUnsignedByte(); if (index == END) return null; // End of metadata - final MetaType type = this.getType(Types.VAR_INT.readPrimitive(buffer)); - return new Metadata(index, type, type.type().read(buffer)); + final EntityDataType type = this.getType(Types.VAR_INT.readPrimitive(buffer)); + return new EntityData(index, type, type.type().read(buffer)); } - protected abstract MetaType getType(final int index); + protected abstract EntityDataType getType(final int index); @Override - public void write(final ByteBuf buffer, final Metadata object) { + public void write(final ByteBuf buffer, final EntityData object) { if (object == null) { buffer.writeByte(END); } else { buffer.writeByte(object.id()); - final MetaType type = object.metaType(); + final EntityDataType type = object.dataType(); Types.VAR_INT.writePrimitive(buffer, type.typeId()); type.type().write(buffer, object.getValue()); } diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/metadata/OldMetaType.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/entitydata/OldEntityDataType.java similarity index 67% rename from api/src/main/java/com/viaversion/viaversion/api/type/types/metadata/OldMetaType.java rename to api/src/main/java/com/viaversion/viaversion/api/type/types/entitydata/OldEntityDataType.java index 1fd0d33ce..a9867e124 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/metadata/OldMetaType.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/entitydata/OldEntityDataType.java @@ -20,34 +20,33 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -package com.viaversion.viaversion.api.type.types.metadata; +package com.viaversion.viaversion.api.type.types.entitydata; -import com.viaversion.viaversion.api.minecraft.metadata.MetaType; -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; -import com.viaversion.viaversion.api.type.types.metadata.MetaTypeTemplate; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType; import io.netty.buffer.ByteBuf; -public abstract class OldMetaType extends MetaTypeTemplate { +public abstract class OldEntityDataType extends EntityDataTypeTemplate { private static final int END = 127; @Override - public Metadata read(final ByteBuf buffer) { + public EntityData read(final ByteBuf buffer) { final byte index = buffer.readByte(); if (index == END) return null; // End of metadata - final MetaType type = this.getType((index & 224) >> 5); - return new Metadata(index & 31, type, type.type().read(buffer)); + final EntityDataType type = this.getType((index & 224) >> 5); + return new EntityData(index & 31, type, type.type().read(buffer)); } - protected abstract MetaType getType(final int index); + protected abstract EntityDataType getType(final int index); @Override - public void write(final ByteBuf buffer, final Metadata object) { + public void write(final ByteBuf buffer, final EntityData object) { if (object == null) { buffer.writeByte(END); } else { - final int index = (object.metaType().typeId() << 5 | object.id() & 31) & 255; + final int index = (object.dataType().typeId() << 5 | object.id() & 31) & 255; buffer.writeByte(index); - object.metaType().type().write(buffer, object.getValue()); + object.dataType().type().write(buffer, object.getValue()); } } } diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/item/ItemShortArrayType1_13.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/item/ItemShortArrayType1_13.java index accbebe15..a09bf536d 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/item/ItemShortArrayType1_13.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/item/ItemShortArrayType1_13.java @@ -23,7 +23,6 @@ package com.viaversion.viaversion.api.type.types.item; import com.viaversion.viaversion.api.minecraft.item.Item; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import io.netty.buffer.ByteBuf; diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/item/ItemShortArrayType1_13_2.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/item/ItemShortArrayType1_13_2.java index c5477d850..2dba847e8 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/item/ItemShortArrayType1_13_2.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/item/ItemShortArrayType1_13_2.java @@ -23,7 +23,6 @@ package com.viaversion.viaversion.api.type.types.item; import com.viaversion.viaversion.api.minecraft.item.Item; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import io.netty.buffer.ByteBuf; diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/item/ItemShortArrayType1_8.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/item/ItemShortArrayType1_8.java index 0e5ff7b6a..30cf938a5 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/item/ItemShortArrayType1_8.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/item/ItemShortArrayType1_8.java @@ -23,7 +23,6 @@ package com.viaversion.viaversion.api.type.types.item; import com.viaversion.viaversion.api.minecraft.item.Item; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import io.netty.buffer.ByteBuf; diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/math/ChunkPositionType.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/math/ChunkPositionType.java index 09f11d7fb..4d15ce808 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/math/ChunkPositionType.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/math/ChunkPositionType.java @@ -22,7 +22,7 @@ */ package com.viaversion.viaversion.api.type.types.math; -import com.viaversion.viaversion.api.minecraft.metadata.ChunkPosition; +import com.viaversion.viaversion.api.minecraft.ChunkPosition; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import io.netty.buffer.ByteBuf; diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/math/PositionType1_14.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/math/PositionType1_14.java index a022c8e39..08bdac9eb 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/math/PositionType1_14.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/math/PositionType1_14.java @@ -47,8 +47,8 @@ public class PositionType1_14 extends Type { @Override public void write(ByteBuf buffer, Position object) { buffer.writeLong((((long) object.x() & 0x3ffffff) << 38) - | (object.y() & 0xfff) - | ((((long) object.z()) & 0x3ffffff) << 12)); + | (object.y() & 0xfff) + | ((((long) object.z()) & 0x3ffffff) << 12)); } public static final class OptionalPosition1_14Type extends OptionalType { diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/metadata/MetadataType1_12.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/metadata/MetadataType1_12.java deleted file mode 100644 index 436fbc4ca..000000000 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/metadata/MetadataType1_12.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of ViaVersion - https://github.com/ViaVersion/ViaVersion - * Copyright (C) 2016-2024 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.metadata; - -import com.viaversion.viaversion.api.minecraft.metadata.MetaType; -import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_12; -import com.viaversion.viaversion.api.type.types.metadata.ModernMetaType; - -public class MetadataType1_12 extends ModernMetaType { - @Override - protected MetaType getType(final int index) { - return MetaType1_12.byId(index); - } -} diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/misc/NamedCompoundTagType.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/misc/NamedCompoundTagType.java index 7f8fb14ee..8a318b211 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/misc/NamedCompoundTagType.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/misc/NamedCompoundTagType.java @@ -22,9 +22,9 @@ */ package com.viaversion.viaversion.api.type.types.misc; +import com.viaversion.nbt.limiter.TagLimiter; import com.viaversion.nbt.tag.CompoundTag; import com.viaversion.nbt.tag.Tag; -import com.viaversion.nbt.limiter.TagLimiter; import com.viaversion.viaversion.api.type.OptionalType; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/misc/SoundEventType.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/misc/SoundEventType.java index 81b343765..3dc88b147 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/misc/SoundEventType.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/misc/SoundEventType.java @@ -23,7 +23,6 @@ package com.viaversion.viaversion.api.type.types.misc; import com.viaversion.viaversion.api.minecraft.SoundEvent; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import io.netty.buffer.ByteBuf; diff --git a/api/src/main/java/com/viaversion/viaversion/api/type/types/misc/TagType.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/misc/TagType.java index a99232803..9ea77b976 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/misc/TagType.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/misc/TagType.java @@ -23,8 +23,8 @@ package com.viaversion.viaversion.api.type.types.misc; import com.viaversion.nbt.io.TagRegistry; -import com.viaversion.nbt.tag.Tag; import com.viaversion.nbt.limiter.TagLimiter; +import com.viaversion.nbt.tag.Tag; import com.viaversion.viaversion.api.type.OptionalType; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; 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 51104c7d1..7220248ef 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 @@ -22,10 +22,10 @@ */ package com.viaversion.viaversion.api.type.types.version; -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.api.type.types.metadata.MetaListType; -import com.viaversion.viaversion.api.type.types.metadata.MetadataType1_12; +import com.viaversion.viaversion.api.type.types.entitydata.EntityDataListType; +import com.viaversion.viaversion.api.type.types.entitydata.EntityDataType1_12; import java.util.List; public final class Types1_12 { @@ -33,9 +33,9 @@ public final class Types1_12 { /** * Metadata type for 1.12 */ - public static final Type METADATA = new MetadataType1_12(); + public static final Type ENTITY_DATA = new EntityDataType1_12(); /** * Metadata list type for 1.12 */ - public static final Type> METADATA_LIST = new MetaListType(METADATA); + 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_13.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_13.java index af85400d4..2ccc13aa0 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 @@ -23,12 +23,12 @@ 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.minecraft.metadata.types.MetaTypes1_13; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; +import com.viaversion.viaversion.api.minecraft.entitydata.types.EntityDataTypes1_13; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.types.chunk.ChunkSectionType1_13; -import com.viaversion.viaversion.api.type.types.metadata.MetaListType; -import com.viaversion.viaversion.api.type.types.metadata.MetadataType; +import com.viaversion.viaversion.api.type.types.entitydata.EntityDataListType; +import com.viaversion.viaversion.api.type.types.entitydata.EntityDataType; import com.viaversion.viaversion.api.type.types.misc.ParticleType; import java.util.List; @@ -36,7 +36,7 @@ public final class Types1_13 { public static final Type CHUNK_SECTION = new ChunkSectionType1_13(); public static final ParticleType PARTICLE = new ParticleType(); - public static final MetaTypes1_13 META_TYPES = new MetaTypes1_13(PARTICLE); - public static final Type METADATA = new MetadataType(META_TYPES); - public static final Type> METADATA_LIST = new MetaListType(METADATA); + public static final EntityDataTypes1_13 ENTITY_DATA_TYPES = new EntityDataTypes1_13(PARTICLE); + 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_13_2.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_13_2.java index e73d43bfd..d81dbf0e2 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 @@ -22,18 +22,18 @@ */ package com.viaversion.viaversion.api.type.types.version; -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; -import com.viaversion.viaversion.api.minecraft.metadata.types.MetaTypes1_13_2; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; +import com.viaversion.viaversion.api.minecraft.entitydata.types.EntityDataTypes1_13_2; import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.api.type.types.metadata.MetaListType; -import com.viaversion.viaversion.api.type.types.metadata.MetadataType; +import com.viaversion.viaversion.api.type.types.entitydata.EntityDataListType; +import com.viaversion.viaversion.api.type.types.entitydata.EntityDataType; import com.viaversion.viaversion.api.type.types.misc.ParticleType; import java.util.List; public final class Types1_13_2 { public static final ParticleType PARTICLE = new ParticleType(); - public static final MetaTypes1_13_2 META_TYPES = new MetaTypes1_13_2(PARTICLE); - public static final Type METADATA = new MetadataType(META_TYPES); - public static final Type> METADATA_LIST = new MetaListType(METADATA); + public static final EntityDataTypes1_13_2 ENTITY_DATA_TYPES = new EntityDataTypes1_13_2(PARTICLE); + 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_14.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_14.java index ffbc9b246..0569525d6 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 @@ -22,18 +22,18 @@ */ package com.viaversion.viaversion.api.type.types.version; -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; -import com.viaversion.viaversion.api.minecraft.metadata.types.MetaTypes1_14; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; +import com.viaversion.viaversion.api.minecraft.entitydata.types.EntityDataTypes1_14; import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.api.type.types.metadata.MetaListType; -import com.viaversion.viaversion.api.type.types.metadata.MetadataType; +import com.viaversion.viaversion.api.type.types.entitydata.EntityDataListType; +import com.viaversion.viaversion.api.type.types.entitydata.EntityDataType; import com.viaversion.viaversion.api.type.types.misc.ParticleType; import java.util.List; public final class Types1_14 { public static final ParticleType PARTICLE = new ParticleType(); - public static final MetaTypes1_14 META_TYPES = new MetaTypes1_14(PARTICLE); - public static final Type METADATA = new MetadataType(META_TYPES); - public static final Type> METADATA_LIST = new MetaListType(METADATA); + public static final EntityDataTypes1_14 ENTITY_DATA_TYPES = new EntityDataTypes1_14(PARTICLE); + 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_16.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_16.java index 17cab002d..4235fc162 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,12 @@ 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.minecraft.metadata.types.MetaTypes1_14; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; +import com.viaversion.viaversion.api.minecraft.entitydata.types.EntityDataTypes1_14; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.types.chunk.ChunkSectionType1_16; -import com.viaversion.viaversion.api.type.types.metadata.MetaListType; -import com.viaversion.viaversion.api.type.types.metadata.MetadataType; +import com.viaversion.viaversion.api.type.types.entitydata.EntityDataListType; +import com.viaversion.viaversion.api.type.types.entitydata.EntityDataType; import com.viaversion.viaversion.api.type.types.misc.ParticleType; import java.util.List; @@ -36,7 +36,7 @@ public final class Types1_16 { public static final Type CHUNK_SECTION = new ChunkSectionType1_16(); public static final ParticleType PARTICLE = new ParticleType(); // Only safe to use after protocol loading - public static final MetaTypes1_14 META_TYPES = new MetaTypes1_14(PARTICLE); - public static final Type METADATA = new MetadataType(META_TYPES); - public static final Type> METADATA_LIST = new MetaListType(METADATA); + public static final EntityDataTypes1_14 ENTITY_DATA_TYPES = new EntityDataTypes1_14(PARTICLE); + 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_17.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_17.java index 87a6e87ea..bbaf6cc83 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 @@ -22,18 +22,18 @@ */ package com.viaversion.viaversion.api.type.types.version; -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; -import com.viaversion.viaversion.api.minecraft.metadata.types.MetaTypes1_14; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; +import com.viaversion.viaversion.api.minecraft.entitydata.types.EntityDataTypes1_14; import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.api.type.types.metadata.MetaListType; -import com.viaversion.viaversion.api.type.types.metadata.MetadataType; +import com.viaversion.viaversion.api.type.types.entitydata.EntityDataListType; +import com.viaversion.viaversion.api.type.types.entitydata.EntityDataType; import com.viaversion.viaversion.api.type.types.misc.ParticleType; import java.util.List; public final class Types1_17 { public static final ParticleType PARTICLE = new ParticleType(); // Only safe to use after protocol loading - public static final MetaTypes1_14 META_TYPES = new MetaTypes1_14(PARTICLE); - public static final Type METADATA = new MetadataType(META_TYPES); - public static final Type> METADATA_LIST = new MetaListType(METADATA); + public static final EntityDataTypes1_14 ENTITY_DATA_TYPES = new EntityDataTypes1_14(PARTICLE); + 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_18.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_18.java index bbee20daf..113da587c 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_18.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_18.java @@ -22,18 +22,18 @@ */ package com.viaversion.viaversion.api.type.types.version; -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; -import com.viaversion.viaversion.api.minecraft.metadata.types.MetaTypes1_14; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; +import com.viaversion.viaversion.api.minecraft.entitydata.types.EntityDataTypes1_14; import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.api.type.types.metadata.MetaListType; -import com.viaversion.viaversion.api.type.types.metadata.MetadataType; +import com.viaversion.viaversion.api.type.types.entitydata.EntityDataListType; +import com.viaversion.viaversion.api.type.types.entitydata.EntityDataType; import com.viaversion.viaversion.api.type.types.misc.ParticleType; import java.util.List; public final class Types1_18 { public static final ParticleType PARTICLE = new ParticleType(); // Only safe to use after protocol loading - public static final MetaTypes1_14 META_TYPES = new MetaTypes1_14(PARTICLE); - public static final Type METADATA = new MetadataType(META_TYPES); - public static final Type> METADATA_LIST = new MetaListType(METADATA); + public static final EntityDataTypes1_14 ENTITY_DATA_TYPES = new EntityDataTypes1_14(PARTICLE); + 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_19.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_19.java index 5784008b7..62dc1eca2 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_19.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_19.java @@ -22,18 +22,18 @@ */ package com.viaversion.viaversion.api.type.types.version; -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; -import com.viaversion.viaversion.api.minecraft.metadata.types.MetaTypes1_19; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; +import com.viaversion.viaversion.api.minecraft.entitydata.types.EntityDataTypes1_19; import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.api.type.types.metadata.MetaListType; -import com.viaversion.viaversion.api.type.types.metadata.MetadataType; +import com.viaversion.viaversion.api.type.types.entitydata.EntityDataListType; +import com.viaversion.viaversion.api.type.types.entitydata.EntityDataType; import com.viaversion.viaversion.api.type.types.misc.ParticleType; import java.util.List; public final class Types1_19 { public static final ParticleType PARTICLE = new ParticleType(); // Only safe to use after protocol loading - public static final MetaTypes1_19 META_TYPES = new MetaTypes1_19(PARTICLE); - public static final Type METADATA = new MetadataType(META_TYPES); - public static final Type> METADATA_LIST = new MetaListType(METADATA); + public static final EntityDataTypes1_19 ENTITY_DATA_TYPES = new EntityDataTypes1_19(PARTICLE); + 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_19_3.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_19_3.java index 826911a5b..589b45968 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_19_3.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_19_3.java @@ -22,18 +22,18 @@ */ package com.viaversion.viaversion.api.type.types.version; -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; -import com.viaversion.viaversion.api.minecraft.metadata.types.MetaTypes1_19_3; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; +import com.viaversion.viaversion.api.minecraft.entitydata.types.EntityDataTypes1_19_3; import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.api.type.types.metadata.MetaListType; -import com.viaversion.viaversion.api.type.types.metadata.MetadataType; +import com.viaversion.viaversion.api.type.types.entitydata.EntityDataListType; +import com.viaversion.viaversion.api.type.types.entitydata.EntityDataType; import com.viaversion.viaversion.api.type.types.misc.ParticleType; import java.util.List; public final class Types1_19_3 { public static final ParticleType PARTICLE = new ParticleType(); // Only safe to use after protocol loading - public static final MetaTypes1_19_3 META_TYPES = new MetaTypes1_19_3(PARTICLE); - public static final Type METADATA = new MetadataType(META_TYPES); - public static final Type> METADATA_LIST = new MetaListType(METADATA); + public static final EntityDataTypes1_19_3 ENTITY_DATA_TYPES = new EntityDataTypes1_19_3(PARTICLE); + 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_19_4.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_19_4.java index 8db16b9d6..8792f8438 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_19_4.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_19_4.java @@ -22,18 +22,18 @@ */ package com.viaversion.viaversion.api.type.types.version; -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; -import com.viaversion.viaversion.api.minecraft.metadata.types.MetaTypes1_19_4; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; +import com.viaversion.viaversion.api.minecraft.entitydata.types.EntityDataTypes1_19_4; import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.api.type.types.metadata.MetaListType; -import com.viaversion.viaversion.api.type.types.metadata.MetadataType; +import com.viaversion.viaversion.api.type.types.entitydata.EntityDataListType; +import com.viaversion.viaversion.api.type.types.entitydata.EntityDataType; import com.viaversion.viaversion.api.type.types.misc.ParticleType; import java.util.List; public final class Types1_19_4 { public static final ParticleType PARTICLE = new ParticleType(); // Only safe to use after protocol loading - public static final MetaTypes1_19_4 META_TYPES = new MetaTypes1_19_4(PARTICLE); - public static final Type METADATA = new MetadataType(META_TYPES); - public static final Type> METADATA_LIST = new MetaListType(METADATA); + public static final EntityDataTypes1_19_4 ENTITY_DATA_TYPES = new EntityDataTypes1_19_4(PARTICLE); + 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_20.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_20.java index 807f6a8c2..d09a23147 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_20.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_20.java @@ -22,18 +22,18 @@ */ package com.viaversion.viaversion.api.type.types.version; -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; -import com.viaversion.viaversion.api.minecraft.metadata.types.MetaTypes1_19_4; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; +import com.viaversion.viaversion.api.minecraft.entitydata.types.EntityDataTypes1_19_4; import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.api.type.types.metadata.MetaListType; -import com.viaversion.viaversion.api.type.types.metadata.MetadataType; +import com.viaversion.viaversion.api.type.types.entitydata.EntityDataListType; +import com.viaversion.viaversion.api.type.types.entitydata.EntityDataType; import com.viaversion.viaversion.api.type.types.misc.ParticleType; import java.util.List; public final class Types1_20 { public static final ParticleType PARTICLE = new ParticleType(); // Only safe to use after protocol loading - public static final MetaTypes1_19_4 META_TYPES = new MetaTypes1_19_4(PARTICLE); - public static final Type METADATA = new MetadataType(META_TYPES); - public static final Type> METADATA_LIST = new MetaListType(METADATA); + public static final EntityDataTypes1_19_4 ENTITY_DATA_TYPES = new EntityDataTypes1_19_4(PARTICLE); + 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_20_2.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_20_2.java index 142e35e80..80d0aa877 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_20_2.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_20_2.java @@ -22,18 +22,18 @@ */ package com.viaversion.viaversion.api.type.types.version; -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; -import com.viaversion.viaversion.api.minecraft.metadata.types.MetaTypes1_20_2; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; +import com.viaversion.viaversion.api.minecraft.entitydata.types.EntityDataTypes1_20_2; import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.api.type.types.metadata.MetaListType; -import com.viaversion.viaversion.api.type.types.metadata.MetadataType; +import com.viaversion.viaversion.api.type.types.entitydata.EntityDataListType; +import com.viaversion.viaversion.api.type.types.entitydata.EntityDataType; import com.viaversion.viaversion.api.type.types.misc.ParticleType; import java.util.List; public final class Types1_20_2 { public static final ParticleType PARTICLE = Types1_20.PARTICLE; // Only safe to use after protocol loading - public static final MetaTypes1_20_2 META_TYPES = new MetaTypes1_20_2(PARTICLE); - public static final Type METADATA = new MetadataType(META_TYPES); - public static final Type> METADATA_LIST = new MetaListType(METADATA); + public static final EntityDataTypes1_20_2 ENTITY_DATA_TYPES = new EntityDataTypes1_20_2(PARTICLE); + 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_20_3.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_20_3.java index 651c98149..5a24de121 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_20_3.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_20_3.java @@ -22,18 +22,18 @@ */ package com.viaversion.viaversion.api.type.types.version; -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; -import com.viaversion.viaversion.api.minecraft.metadata.types.MetaTypes1_20_3; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; +import com.viaversion.viaversion.api.minecraft.entitydata.types.EntityDataTypes1_20_3; import com.viaversion.viaversion.api.type.Type; -import com.viaversion.viaversion.api.type.types.metadata.MetaListType; -import com.viaversion.viaversion.api.type.types.metadata.MetadataType; +import com.viaversion.viaversion.api.type.types.entitydata.EntityDataListType; +import com.viaversion.viaversion.api.type.types.entitydata.EntityDataType; import com.viaversion.viaversion.api.type.types.misc.ParticleType; import java.util.List; public final class Types1_20_3 { public static final ParticleType PARTICLE = new ParticleType(); // Only safe to use after protocol loading - public static final MetaTypes1_20_3 META_TYPES = new MetaTypes1_20_3(PARTICLE); - public static final Type METADATA = new MetadataType(META_TYPES); - public static final Type> METADATA_LIST = new MetaListType(METADATA); + public static final EntityDataTypes1_20_3 ENTITY_DATA_TYPES = new EntityDataTypes1_20_3(PARTICLE); + 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_20_5.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_20_5.java index bd0a3af1e..495de4c20 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_20_5.java +++ b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_20_5.java @@ -25,15 +25,15 @@ package com.viaversion.viaversion.api.type.types.version; import com.viaversion.viaversion.api.minecraft.Particle; import com.viaversion.viaversion.api.minecraft.data.StructuredData; import com.viaversion.viaversion.api.minecraft.item.Item; -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; -import com.viaversion.viaversion.api.minecraft.metadata.types.MetaTypes1_20_5; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; +import com.viaversion.viaversion.api.minecraft.entitydata.types.EntityDataTypes1_20_5; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.types.ArrayType; import com.viaversion.viaversion.api.type.types.item.ItemCostType1_20_5; import com.viaversion.viaversion.api.type.types.item.ItemType1_20_5; import com.viaversion.viaversion.api.type.types.item.StructuredDataType; -import com.viaversion.viaversion.api.type.types.metadata.MetaListType; -import com.viaversion.viaversion.api.type.types.metadata.MetadataType; +import com.viaversion.viaversion.api.type.types.entitydata.EntityDataListType; +import com.viaversion.viaversion.api.type.types.entitydata.EntityDataType; import com.viaversion.viaversion.api.type.types.misc.ParticleType; import java.util.List; @@ -49,7 +49,7 @@ public final class Types1_20_5 { public static final ParticleType PARTICLE = new ParticleType(); public static final ArrayType PARTICLES = new ArrayType<>(PARTICLE); - public static final MetaTypes1_20_5 META_TYPES = new MetaTypes1_20_5(PARTICLE, PARTICLES); - public static final Type METADATA = new MetadataType(META_TYPES); - public static final Type> METADATA_LIST = new MetaListType(METADATA); + public static final EntityDataTypes1_20_5 ENTITY_DATA_TYPES = new EntityDataTypes1_20_5(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_8.java b/api/src/main/java/com/viaversion/viaversion/api/type/types/version/Types1_8.java index 8815447a5..6d59d8f92 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 @@ -23,11 +23,11 @@ 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.minecraft.entitydata.EntityData; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.types.chunk.ChunkSectionType1_8; -import com.viaversion.viaversion.api.type.types.metadata.MetaListType; -import com.viaversion.viaversion.api.type.types.metadata.MetadataType1_8; +import com.viaversion.viaversion.api.type.types.entitydata.EntityDataListType; +import com.viaversion.viaversion.api.type.types.entitydata.EntityDataType1_8; import java.util.List; public final class Types1_8 { @@ -35,11 +35,11 @@ public final class Types1_8 { /** * Metadata type for 1.8 */ - public static final Type METADATA = new MetadataType1_8(); + public static final Type ENTITY_DATA = new EntityDataType1_8(); /** * Metadata list type for 1.8 */ - public static final Type> METADATA_LIST = new MetaListType(METADATA); + public static final Type> ENTITY_DATA_LIST = new EntityDataListType(ENTITY_DATA); 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 2a3745bec..eda14badb 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 @@ -23,22 +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.minecraft.entitydata.EntityData; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.types.chunk.ChunkSectionType1_9; -import com.viaversion.viaversion.api.type.types.metadata.MetaListType; -import com.viaversion.viaversion.api.type.types.metadata.MetadataType1_9; +import com.viaversion.viaversion.api.type.types.entitydata.EntityDataListType; +import com.viaversion.viaversion.api.type.types.entitydata.EntityDataType1_9; import java.util.List; public final class Types1_9 { /** * Metadata type for 1.9 */ - public static final Type METADATA = new MetadataType1_9(); + public static final Type ENTITY_DATA = new EntityDataType1_9(); /** * Metadata list type for 1.9 */ - public static final Type> METADATA_LIST = new MetaListType(METADATA); + public static final Type> ENTITY_DATA_LIST = new EntityDataListType(ENTITY_DATA); public static final Type CHUNK_SECTION = new ChunkSectionType1_9(); } diff --git a/api/src/main/java/com/viaversion/viaversion/util/CompactArrayUtil.java b/api/src/main/java/com/viaversion/viaversion/util/CompactArrayUtil.java index 40c61d159..78d9ccc4c 100644 --- a/api/src/main/java/com/viaversion/viaversion/util/CompactArrayUtil.java +++ b/api/src/main/java/com/viaversion/viaversion/util/CompactArrayUtil.java @@ -26,25 +26,25 @@ import java.util.function.IntToLongFunction; public final class CompactArrayUtil { private static final long[] RECIPROCAL_MULT_AND_ADD = { - 0xffffffffL, 0x00000000, 0x55555555, 0x00000000, 0x33333333, 0x2aaaaaaa, 0x24924924, 0x00000000, - 0x1c71c71c, 0x19999999, 0x1745d174, 0x15555555, 0x13b13b13, 0x12492492, 0x11111111, 0x00000000, - 0xf0f0f0f, 0xe38e38e, 0xd79435e, 0xccccccc, 0xc30c30c, 0xba2e8ba, 0xb21642c, 0xaaaaaaa, - 0xa3d70a3, 0x9d89d89, 0x97b425e, 0x9249249, 0x8d3dcb0, 0x8888888, 0x8421084, 0x00000000, - 0x7c1f07c, 0x7878787, 0x7507507, 0x71c71c7, 0x6eb3e45, 0x6bca1af, 0x6906906, 0x6666666, - 0x63e7063, 0x6186186, 0x5f417d0, 0x5d1745d, 0x5b05b05, 0x590b216, 0x572620a, 0x5555555, - 0x5397829, 0x51eb851, 0x5050505, 0x4ec4ec4, 0x4d4873e, 0x4bda12f, 0x4a7904a, 0x4924924, - 0x47dc11f, 0x469ee58, 0x456c797, 0x4444444, 0x4325c53, 0x4210842, 0x4104104, 0x00000000 + 0xffffffffL, 0x00000000, 0x55555555, 0x00000000, 0x33333333, 0x2aaaaaaa, 0x24924924, 0x00000000, + 0x1c71c71c, 0x19999999, 0x1745d174, 0x15555555, 0x13b13b13, 0x12492492, 0x11111111, 0x00000000, + 0xf0f0f0f, 0xe38e38e, 0xd79435e, 0xccccccc, 0xc30c30c, 0xba2e8ba, 0xb21642c, 0xaaaaaaa, + 0xa3d70a3, 0x9d89d89, 0x97b425e, 0x9249249, 0x8d3dcb0, 0x8888888, 0x8421084, 0x00000000, + 0x7c1f07c, 0x7878787, 0x7507507, 0x71c71c7, 0x6eb3e45, 0x6bca1af, 0x6906906, 0x6666666, + 0x63e7063, 0x6186186, 0x5f417d0, 0x5d1745d, 0x5b05b05, 0x590b216, 0x572620a, 0x5555555, + 0x5397829, 0x51eb851, 0x5050505, 0x4ec4ec4, 0x4d4873e, 0x4bda12f, 0x4a7904a, 0x4924924, + 0x47dc11f, 0x469ee58, 0x456c797, 0x4444444, 0x4325c53, 0x4210842, 0x4104104, 0x00000000 }; // Incrementally shift with each 0x80000000/0x00000000 tuple private static final int[] RECIPROCAL_RIGHT_SHIFT = { - 0, 0, 0, 1, 0, 0, 0, 2, - 0, 0, 0, 0, 0, 0, 0, 3, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 4, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 5 + 0, 0, 0, 1, 0, 0, 0, 2, + 0, 0, 0, 0, 0, 0, 0, 3, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 4, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 5 }; private CompactArrayUtil() { diff --git a/bukkit-legacy/src/main/java/com/viaversion/viaversion/bukkit/listeners/protocol1_9to1_8/ArmorListener.java b/bukkit-legacy/src/main/java/com/viaversion/viaversion/bukkit/listeners/protocol1_9to1_8/ArmorListener.java index 2439638ae..7f289490f 100644 --- a/bukkit-legacy/src/main/java/com/viaversion/viaversion/bukkit/listeners/protocol1_9to1_8/ArmorListener.java +++ b/bukkit-legacy/src/main/java/com/viaversion/viaversion/bukkit/listeners/protocol1_9to1_8/ArmorListener.java @@ -19,11 +19,10 @@ package com.viaversion.viaversion.bukkit.listeners.protocol1_9to1_8; import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.bukkit.listeners.ViaBukkitListener; -import com.viaversion.viaversion.protocols.v1_8to1_9.data.ArmorTypes1_8; import com.viaversion.viaversion.protocols.v1_8to1_9.Protocol1_8To1_9; +import com.viaversion.viaversion.protocols.v1_8to1_9.data.ArmorTypes1_8; import com.viaversion.viaversion.protocols.v1_8to1_9.packet.ClientboundPackets1_9; import java.util.UUID; import org.bukkit.Bukkit; @@ -76,7 +75,7 @@ public class ArmorListener extends ViaBukkitListener { HumanEntity human = e.getWhoClicked(); if (human instanceof final Player player && e.getInventory() instanceof CraftingInventory) { if ((e.getCurrentItem() != null && ArmorTypes1_8.isArmor(e.getCurrentItem().getTypeId())) - || (e.getRawSlot() >= 5 && e.getRawSlot() <= 8)) { + || (e.getRawSlot() >= 5 && e.getRawSlot() <= 8)) { sendDelayedArmorUpdate(player); } } diff --git a/bukkit-legacy/src/main/java/com/viaversion/viaversion/bukkit/listeners/protocol1_9to1_8/DeathListener.java b/bukkit-legacy/src/main/java/com/viaversion/viaversion/bukkit/listeners/protocol1_9to1_8/DeathListener.java index dbd353db6..e0d0311bd 100644 --- a/bukkit-legacy/src/main/java/com/viaversion/viaversion/bukkit/listeners/protocol1_9to1_8/DeathListener.java +++ b/bukkit-legacy/src/main/java/com/viaversion/viaversion/bukkit/listeners/protocol1_9to1_8/DeathListener.java @@ -20,19 +20,18 @@ package com.viaversion.viaversion.bukkit.listeners.protocol1_9to1_8; import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.bukkit.listeners.ViaBukkitListener; import com.viaversion.viaversion.protocols.v1_8to1_9.Protocol1_8To1_9; import com.viaversion.viaversion.protocols.v1_8to1_9.packet.ClientboundPackets1_9; import com.viaversion.viaversion.util.ComponentUtil; +import java.util.logging.Level; import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.plugin.Plugin; -import java.util.logging.Level; public class DeathListener extends ViaBukkitListener { diff --git a/bukkit-legacy/src/main/java/com/viaversion/viaversion/bukkit/util/CollisionChecker.java b/bukkit-legacy/src/main/java/com/viaversion/viaversion/bukkit/util/CollisionChecker.java index 9ce05d468..b4b279ed3 100644 --- a/bukkit-legacy/src/main/java/com/viaversion/viaversion/bukkit/util/CollisionChecker.java +++ b/bukkit-legacy/src/main/java/com/viaversion/viaversion/bukkit/util/CollisionChecker.java @@ -18,25 +18,25 @@ package com.viaversion.viaversion.bukkit.util; import com.viaversion.viaversion.api.Via; -import org.bukkit.block.Block; -import org.bukkit.entity.Entity; - import java.lang.reflect.Method; import java.util.AbstractList; import java.util.List; import java.util.logging.Level; +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; public class CollisionChecker { private static final CollisionChecker INSTANCE; + static { CollisionChecker instance = null; try { instance = new CollisionChecker(); } catch (ReflectiveOperationException ex) { Via.getPlatform().getLogger().log( - Level.WARNING, - "Couldn't find reflection methods/fields to calculate bounding boxes.\n" + - "Placing non-full blocks where the player stands may fail.", ex); + Level.WARNING, + "Couldn't find reflection methods/fields to calculate bounding boxes.\n" + + "Placing non-full blocks where the player stands may fail.", ex); } INSTANCE = instance; } @@ -65,12 +65,12 @@ public class CollisionChecker { GET_BLOCK_BY_ID = NMSUtil.nms("Block").getDeclaredMethod("getById", int.class); GET_COLLISIONS = GET_BLOCK_BY_ID.getReturnType().getDeclaredMethod("a", - world, - blockPosition, - GET_BLOCK_TYPE.getReturnType(), - GET_ENTITY_BB.getReturnType(), - List.class, - GET_ENTITY_HANDLE.getReturnType()); + world, + blockPosition, + GET_BLOCK_TYPE.getReturnType(), + GET_ENTITY_BB.getReturnType(), + List.class, + GET_ENTITY_HANDLE.getReturnType()); SET_POSITION = mutableBlockPosition.getDeclaredMethod("c", int.class, int.class, int.class); BLOCK_POSITION = mutableBlockPosition.getConstructor().newInstance(); @@ -93,12 +93,12 @@ public class CollisionChecker { List collisions = new DummyList<>(); GET_COLLISIONS.invoke(nmsBlock, - nmsWorld, - BLOCK_POSITION, - GET_BLOCK_TYPE.invoke(nmsWorld, BLOCK_POSITION), - GET_ENTITY_BB.invoke(nmsPlayer), - collisions, - nmsPlayer); + nmsWorld, + BLOCK_POSITION, + GET_BLOCK_TYPE.invoke(nmsWorld, BLOCK_POSITION), + GET_ENTITY_BB.invoke(nmsPlayer), + collisions, + nmsPlayer); return !collisions.isEmpty(); } catch (ReflectiveOperationException ex) { return null; diff --git a/bukkit-legacy/src/main/java/com/viaversion/viaversion/bukkit/util/NMSUtil.java b/bukkit-legacy/src/main/java/com/viaversion/viaversion/bukkit/util/NMSUtil.java index fef9b3698..5645271fe 100644 --- a/bukkit-legacy/src/main/java/com/viaversion/viaversion/bukkit/util/NMSUtil.java +++ b/bukkit-legacy/src/main/java/com/viaversion/viaversion/bukkit/util/NMSUtil.java @@ -27,8 +27,8 @@ public final class NMSUtil { private static boolean loadDebugProperty() { try { Class serverClass = nms( - "MinecraftServer", - "net.minecraft.server.MinecraftServer" + "MinecraftServer", + "net.minecraft.server.MinecraftServer" ); Object server = serverClass.getDeclaredMethod("getServer").invoke(null); return (boolean) serverClass.getMethod("isDebugging").invoke(server); diff --git a/bukkit/src/main/java/com/viaversion/viaversion/ViaVersionPlugin.java b/bukkit/src/main/java/com/viaversion/viaversion/ViaVersionPlugin.java index 1036abbf5..1878534dc 100644 --- a/bukkit/src/main/java/com/viaversion/viaversion/ViaVersionPlugin.java +++ b/bukkit/src/main/java/com/viaversion/viaversion/ViaVersionPlugin.java @@ -66,11 +66,11 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaPlatform conf = new BukkitViaConfig(getDataFolder(), getLogger()); Via.init(ViaManagerImpl.builder() - .platform(this) - .commandHandler(commandHandler) - .injector(new BukkitViaInjector()) - .loader(new BukkitViaLoader(this)) - .build()); + .platform(this) + .commandHandler(commandHandler) + .injector(new BukkitViaInjector()) + .loader(new BukkitViaLoader(this)) + .build()); conf.reload(); } @@ -253,13 +253,13 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaPlatform public final Collection getUnsupportedSoftwareClasses() { final List list = new ArrayList<>(ViaPlatform.super.getUnsupportedSoftwareClasses()); list.add(new UnsupportedServerSoftware.Builder().name("Yatopia").reason(UnsupportedServerSoftware.Reason.DANGEROUS_SERVER_SOFTWARE) - .addClassName("org.yatopiamc.yatopia.server.YatopiaConfig") - .addClassName("net.yatopia.api.event.PlayerAttackEntityEvent") - .addClassName("yatopiamc.org.yatopia.server.YatopiaConfig") // Only the best kind of software relocates its own classes to hide itself :tinfoilhat: - .addMethod("org.bukkit.Server", "getLastTickTime").build()); + .addClassName("org.yatopiamc.yatopia.server.YatopiaConfig") + .addClassName("net.yatopia.api.event.PlayerAttackEntityEvent") + .addClassName("yatopiamc.org.yatopia.server.YatopiaConfig") // Only the best kind of software relocates its own classes to hide itself :tinfoilhat: + .addMethod("org.bukkit.Server", "getLastTickTime").build()); list.add(new UnsupportedPlugin.Builder().name("software to mess with message signing").reason(UnsupportedPlugin.Reason.SECURE_CHAT_BYPASS) - .addPlugin("NoEncryption").addPlugin("NoReport") - .addPlugin("NoChatReports").addPlugin("NoChatReport").build()); + .addPlugin("NoEncryption").addPlugin("NoReport") + .addPlugin("NoChatReports").addPlugin("NoChatReport").build()); return Collections.unmodifiableList(list); } diff --git a/bukkit/src/main/java/com/viaversion/viaversion/bukkit/listeners/UpdateListener.java b/bukkit/src/main/java/com/viaversion/viaversion/bukkit/listeners/UpdateListener.java index 2ceab0b48..4d1c3b11d 100644 --- a/bukkit/src/main/java/com/viaversion/viaversion/bukkit/listeners/UpdateListener.java +++ b/bukkit/src/main/java/com/viaversion/viaversion/bukkit/listeners/UpdateListener.java @@ -28,7 +28,7 @@ public class UpdateListener implements Listener { @EventHandler public void onJoin(PlayerJoinEvent e) { if (e.getPlayer().hasPermission("viaversion.update") - && Via.getConfig().isCheckForUpdates()) { + && Via.getConfig().isCheckForUpdates()) { UpdateUtil.sendUpdateMessage(e.getPlayer().getUniqueId()); } } diff --git a/bukkit/src/main/java/com/viaversion/viaversion/bukkit/listeners/multiversion/PlayerSneakListener.java b/bukkit/src/main/java/com/viaversion/viaversion/bukkit/listeners/multiversion/PlayerSneakListener.java index b8c46eaa6..8e3ba2ef3 100644 --- a/bukkit/src/main/java/com/viaversion/viaversion/bukkit/listeners/multiversion/PlayerSneakListener.java +++ b/bukkit/src/main/java/com/viaversion/viaversion/bukkit/listeners/multiversion/PlayerSneakListener.java @@ -62,7 +62,7 @@ public class PlayerSneakListener extends ViaBukkitListener { getHandle = Class.forName(packageName + ".entity.CraftPlayer").getMethod("getHandle"); final Class entityPlayerClass = Class.forName(packageName - .replace("org.bukkit.craftbukkit", "net.minecraft.server") + ".EntityPlayer"); + .replace("org.bukkit.craftbukkit", "net.minecraft.server") + ".EntityPlayer"); try { setSize = entityPlayerClass.getMethod("setSize", Float.TYPE, Float.TYPE); } catch (NoSuchMethodException e) { diff --git a/bukkit/src/main/java/com/viaversion/viaversion/bukkit/listeners/protocol1_15to1_14_4/EntityToggleGlideListener.java b/bukkit/src/main/java/com/viaversion/viaversion/bukkit/listeners/protocol1_15to1_14_4/EntityToggleGlideListener.java index c35fd8f8d..dc12829f0 100644 --- a/bukkit/src/main/java/com/viaversion/viaversion/bukkit/listeners/protocol1_15to1_14_4/EntityToggleGlideListener.java +++ b/bukkit/src/main/java/com/viaversion/viaversion/bukkit/listeners/protocol1_15to1_14_4/EntityToggleGlideListener.java @@ -18,17 +18,14 @@ package com.viaversion.viaversion.bukkit.listeners.protocol1_15to1_14_4; import com.viaversion.viaversion.ViaVersionPlugin; -import com.viaversion.viaversion.api.Via; -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.api.type.types.version.Types1_14; import com.viaversion.viaversion.bukkit.listeners.ViaBukkitListener; import com.viaversion.viaversion.protocols.v1_14_4to1_15.Protocol1_14_4To1_15; import com.viaversion.viaversion.protocols.v1_14_4to1_15.packet.ClientboundPackets1_15; import java.util.Arrays; -import java.util.logging.Level; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -82,7 +79,7 @@ public class EntityToggleGlideListener extends ViaBukkitListener { } // leave 0x80 as 0 to stop gliding - packet.write(Types1_14.METADATA_LIST, Arrays.asList(new Metadata(0, Types1_14.META_TYPES.byteType, bitmask))); + packet.write(Types1_14.ENTITY_DATA_LIST, Arrays.asList(new EntityData(0, Types1_14.ENTITY_DATA_TYPES.byteType, bitmask))); packet.scheduleSend(Protocol1_14_4To1_15.class); } } diff --git a/bukkit/src/main/java/com/viaversion/viaversion/bukkit/platform/BukkitViaInjector.java b/bukkit/src/main/java/com/viaversion/viaversion/bukkit/platform/BukkitViaInjector.java index d0a6e20a9..9edf69a3e 100644 --- a/bukkit/src/main/java/com/viaversion/viaversion/bukkit/platform/BukkitViaInjector.java +++ b/bukkit/src/main/java/com/viaversion/viaversion/bukkit/platform/BukkitViaInjector.java @@ -40,8 +40,8 @@ import org.checkerframework.checker.nullness.qual.Nullable; public class BukkitViaInjector extends LegacyViaInjector { private static final boolean HAS_WORLD_VERSION_PROTOCOL_VERSION = PaperViaInjector.hasClass("net.minecraft.SharedConstants") - && PaperViaInjector.hasClass("net.minecraft.WorldVersion") - && !PaperViaInjector.hasClass("com.mojang.bridge.game.GameVersion"); + && PaperViaInjector.hasClass("net.minecraft.WorldVersion") + && !PaperViaInjector.hasClass("com.mojang.bridge.game.GameVersion"); @Override public void inject() throws ReflectiveOperationException { @@ -104,8 +104,8 @@ public class BukkitViaInjector extends LegacyViaInjector { // Grab the ping class and find the field to access it Class pingClazz = NMSUtil.nms( - "ServerPing", - "net.minecraft.network.protocol.status.ServerPing" + "ServerPing", + "net.minecraft.network.protocol.status.ServerPing" ); Object ping = null; for (Field field : serverClazz.getDeclaredFields()) { @@ -119,8 +119,8 @@ public class BukkitViaInjector extends LegacyViaInjector { // Now get the ServerData inside ServerPing Class serverDataClass = NMSUtil.nms( - "ServerPing$ServerData", - "net.minecraft.network.protocol.status.ServerPing$ServerData" + "ServerPing$ServerData", + "net.minecraft.network.protocol.status.ServerPing$ServerData" ); Object serverData = null; for (Field field : pingClazz.getDeclaredFields()) { @@ -150,12 +150,12 @@ public class BukkitViaInjector extends LegacyViaInjector { @Override protected @Nullable Object getServerConnection() throws ReflectiveOperationException { Class serverClass = NMSUtil.nms( - "MinecraftServer", - "net.minecraft.server.MinecraftServer" + "MinecraftServer", + "net.minecraft.server.MinecraftServer" ); Class connectionClass = NMSUtil.nms( - "ServerConnection", - "net.minecraft.server.network.ServerConnection" + "ServerConnection", + "net.minecraft.server.network.ServerConnection" ); Object server = ReflectionUtil.invokeStatic(serverClass, "getServer"); diff --git a/bukkit/src/main/java/com/viaversion/viaversion/bukkit/platform/BukkitViaTask.java b/bukkit/src/main/java/com/viaversion/viaversion/bukkit/platform/BukkitViaTask.java index a5fd603ee..0ab66e5a6 100644 --- a/bukkit/src/main/java/com/viaversion/viaversion/bukkit/platform/BukkitViaTask.java +++ b/bukkit/src/main/java/com/viaversion/viaversion/bukkit/platform/BukkitViaTask.java @@ -20,7 +20,6 @@ package com.viaversion.viaversion.bukkit.platform; import com.google.common.base.Preconditions; import com.viaversion.viaversion.api.platform.PlatformTask; import org.bukkit.scheduler.BukkitTask; -import org.checkerframework.checker.nullness.qual.Nullable; public record BukkitViaTask(BukkitTask task) implements PlatformTask { diff --git a/bukkit/src/main/java/com/viaversion/viaversion/bukkit/providers/BukkitInventoryQuickMoveProvider.java b/bukkit/src/main/java/com/viaversion/viaversion/bukkit/providers/BukkitInventoryQuickMoveProvider.java index 11b09de29..12b456c8f 100644 --- a/bukkit/src/main/java/com/viaversion/viaversion/bukkit/providers/BukkitInventoryQuickMoveProvider.java +++ b/bukkit/src/main/java/com/viaversion/viaversion/bukkit/providers/BukkitInventoryQuickMoveProvider.java @@ -118,7 +118,7 @@ public class BukkitInventoryQuickMoveProvider extends InventoryQuickMoveProvider } else { // if not true we got too many slots (version inventory slot changes)? String cause = "Too many inventory slots: slotId: " + slotId + " invSlotCount: " + inv.countSlots() - + " invType: " + inv.getType() + " topInvType: " + tinvtype; + + " invType: " + inv.getType() + " topInvType: " + tinvtype; Via.getPlatform().getLogger().severe("Failed to get an item to create a window click packet. Please report this issue to the ViaVersion Github: " + cause); } Object packet = null; diff --git a/bukkit/src/main/java/com/viaversion/viaversion/bukkit/providers/BukkitViaMovementTransmitter.java b/bukkit/src/main/java/com/viaversion/viaversion/bukkit/providers/BukkitViaMovementTransmitter.java index c653a2896..b50cd1301 100644 --- a/bukkit/src/main/java/com/viaversion/viaversion/bukkit/providers/BukkitViaMovementTransmitter.java +++ b/bukkit/src/main/java/com/viaversion/viaversion/bukkit/providers/BukkitViaMovementTransmitter.java @@ -22,13 +22,12 @@ import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.bukkit.util.NMSUtil; import com.viaversion.viaversion.protocols.v1_8to1_9.provider.MovementTransmitterProvider; import com.viaversion.viaversion.protocols.v1_8to1_9.storage.MovementTracker; +import com.viaversion.viaversion.util.PipelineUtil; +import io.netty.channel.ChannelHandlerContext; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.logging.Level; - -import com.viaversion.viaversion.util.PipelineUtil; -import io.netty.channel.ChannelHandlerContext; import org.bukkit.Bukkit; import org.bukkit.entity.Player; diff --git a/bungee/src/main/java/com/viaversion/viaversion/BungeePlugin.java b/bungee/src/main/java/com/viaversion/viaversion/BungeePlugin.java index f425c996d..05d0675d3 100644 --- a/bungee/src/main/java/com/viaversion/viaversion/BungeePlugin.java +++ b/bungee/src/main/java/com/viaversion/viaversion/BungeePlugin.java @@ -78,11 +78,11 @@ public class BungeePlugin extends Plugin implements ViaServerProxyPlatform plugins = new ArrayList<>(); for (Plugin p : ProxyServer.getInstance().getPluginManager().getPlugins()) plugins.add(new PluginInfo( - true, - p.getDescription().getName(), - p.getDescription().getVersion(), - p.getDescription().getMain(), - Collections.singletonList(p.getDescription().getAuthor()) + true, + p.getDescription().getName(), + p.getDescription().getVersion(), + p.getDescription().getMain(), + Collections.singletonList(p.getDescription().getAuthor()) )); platformSpecific.add("plugins", GsonUtil.getGson().toJsonTree(plugins)); @@ -208,10 +208,10 @@ public class BungeePlugin extends Plugin implements ViaServerProxyPlatform getUnsupportedSoftwareClasses() { final Collection list = new ArrayList<>(ViaServerProxyPlatform.super.getUnsupportedSoftwareClasses()); list.add(new UnsupportedServerSoftware.Builder() - .name("FlameCord") - .addClassName("dev._2lstudios.flamecord.FlameCord") - .reason(UnsupportedServerSoftware.Reason.BREAKING_PROXY_SOFTWARE) - .build()); + .name("FlameCord") + .addClassName("dev._2lstudios.flamecord.FlameCord") + .reason(UnsupportedServerSoftware.Reason.BREAKING_PROXY_SOFTWARE) + .build()); return ImmutableList.copyOf(list); } diff --git a/bungee/src/main/java/com/viaversion/viaversion/bungee/commands/subs/ProbeSubCmd.java b/bungee/src/main/java/com/viaversion/viaversion/bungee/commands/subs/ProbeSubCmd.java index 7c19e81f3..adbb352f6 100644 --- a/bungee/src/main/java/com/viaversion/viaversion/bungee/commands/subs/ProbeSubCmd.java +++ b/bungee/src/main/java/com/viaversion/viaversion/bungee/commands/subs/ProbeSubCmd.java @@ -31,8 +31,8 @@ public class ProbeSubCmd implements ViaSubCommand { @Override public String description() { return "Forces ViaVersion to scan server protocol versions " + - (((BungeeViaConfig) Via.getConfig()).getBungeePingInterval() == -1 ? - "" : "(Also happens at an interval)"); + (((BungeeViaConfig) Via.getConfig()).getBungeePingInterval() == -1 ? + "" : "(Also happens at an interval)"); } @Override diff --git a/bungee/src/main/java/com/viaversion/viaversion/bungee/handlers/BungeeServerHandler.java b/bungee/src/main/java/com/viaversion/viaversion/bungee/handlers/BungeeServerHandler.java index 1c567d2a0..fc3cd7d20 100644 --- a/bungee/src/main/java/com/viaversion/viaversion/bungee/handlers/BungeeServerHandler.java +++ b/bungee/src/main/java/com/viaversion/viaversion/bungee/handlers/BungeeServerHandler.java @@ -27,7 +27,6 @@ import com.viaversion.viaversion.api.protocol.ProtocolPathEntry; import com.viaversion.viaversion.api.protocol.ProtocolPipeline; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.bungee.storage.BungeeStorage; import com.viaversion.viaversion.protocols.v1_12_2to1_13.rewriter.ItemPacketRewriter1_13; diff --git a/bungee/src/main/java/com/viaversion/viaversion/bungee/listeners/ElytraPatch.java b/bungee/src/main/java/com/viaversion/viaversion/bungee/listeners/ElytraPatch.java index 6e4d03c83..2308eb1b5 100644 --- a/bungee/src/main/java/com/viaversion/viaversion/bungee/listeners/ElytraPatch.java +++ b/bungee/src/main/java/com/viaversion/viaversion/bungee/listeners/ElytraPatch.java @@ -19,10 +19,9 @@ package com.viaversion.viaversion.bungee.listeners; import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.connection.UserConnection; -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; -import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_9; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; +import com.viaversion.viaversion.api.minecraft.entitydata.types.EntityDataTypes1_9; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.api.type.types.version.Types1_9; import com.viaversion.viaversion.protocols.v1_8to1_9.Protocol1_8To1_9; @@ -51,7 +50,7 @@ public class ElytraPatch implements Listener { PacketWrapper wrapper = PacketWrapper.create(ClientboundPackets1_9.SET_ENTITY_DATA, null, user); wrapper.write(Types.VAR_INT, entityId); - wrapper.write(Types1_9.METADATA_LIST, Collections.singletonList(new Metadata(0, MetaType1_9.BYTE, (byte) 0))); + wrapper.write(Types1_9.ENTITY_DATA_LIST, Collections.singletonList(new EntityData(0, EntityDataTypes1_9.BYTE, (byte) 0))); wrapper.scheduleSend(Protocol1_8To1_9.class); } diff --git a/bungee/src/main/java/com/viaversion/viaversion/bungee/listeners/UpdateListener.java b/bungee/src/main/java/com/viaversion/viaversion/bungee/listeners/UpdateListener.java index ccc4651d6..9789e2f89 100644 --- a/bungee/src/main/java/com/viaversion/viaversion/bungee/listeners/UpdateListener.java +++ b/bungee/src/main/java/com/viaversion/viaversion/bungee/listeners/UpdateListener.java @@ -28,7 +28,7 @@ public class UpdateListener implements Listener { @EventHandler public void onJoin(PostLoginEvent e) { if (e.getPlayer().hasPermission("viaversion.update") - && Via.getConfig().isCheckForUpdates()) { + && Via.getConfig().isCheckForUpdates()) { UpdateUtil.sendUpdateMessage(e.getPlayer().getUniqueId()); } } diff --git a/bungee/src/main/java/com/viaversion/viaversion/bungee/platform/BungeeViaLoader.java b/bungee/src/main/java/com/viaversion/viaversion/bungee/platform/BungeeViaLoader.java index 140d96963..7d952a8e5 100644 --- a/bungee/src/main/java/com/viaversion/viaversion/bungee/platform/BungeeViaLoader.java +++ b/bungee/src/main/java/com/viaversion/viaversion/bungee/platform/BungeeViaLoader.java @@ -76,10 +76,10 @@ public class BungeeViaLoader implements ViaPlatformLoader { if (plugin.getConf().getBungeePingInterval() > 0) { tasks.add(plugin.getProxy().getScheduler().schedule( - plugin, - () -> Via.proxyPlatform().protocolDetectorService().probeAllServers(), - 0, plugin.getConf().getBungeePingInterval(), - TimeUnit.SECONDS + plugin, + () -> Via.proxyPlatform().protocolDetectorService().probeAllServers(), + 0, plugin.getConf().getBungeePingInterval(), + TimeUnit.SECONDS )); } } diff --git a/common/src/main/java/com/viaversion/viaversion/ViaListener.java b/common/src/main/java/com/viaversion/viaversion/ViaListener.java index 28763c93a..7c97b7bd3 100644 --- a/common/src/main/java/com/viaversion/viaversion/ViaListener.java +++ b/common/src/main/java/com/viaversion/viaversion/ViaListener.java @@ -50,7 +50,7 @@ public abstract class ViaListener { protected boolean isOnPipe(UUID uuid) { UserConnection userConnection = getUserConnection(uuid); return userConnection != null && - (requiredPipeline == null || userConnection.getProtocolInfo().getPipeline().contains(requiredPipeline)); + (requiredPipeline == null || userConnection.getProtocolInfo().getPipeline().contains(requiredPipeline)); } /** diff --git a/common/src/main/java/com/viaversion/viaversion/ViaManagerImpl.java b/common/src/main/java/com/viaversion/viaversion/ViaManagerImpl.java index 2ca0f33f0..4ffb706a1 100644 --- a/common/src/main/java/com/viaversion/viaversion/ViaManagerImpl.java +++ b/common/src/main/java/com/viaversion/viaversion/ViaManagerImpl.java @@ -150,8 +150,8 @@ public class ViaManagerImpl implements ViaManager { platform.getLogger().warning("and if you're still unsure, feel free to join our Discord-Server for further assistance."); } else if (protocolVersion.highestSupportedProtocolVersion().olderThan(ProtocolVersion.v1_13)) { platform.getLogger().warning("This version of Minecraft is extremely outdated and support for it has reached its end of life. " - + "You will still be able to run Via on this Minecraft version, but we are unlikely to provide any further fixes or help with problems specific to legacy Minecraft versions. " - + "Please consider updating to give your players a better experience and to avoid issues that have long been fixed."); + + "You will still be able to run Via on this Minecraft version, but we are unlikely to provide any further fixes or help with problems specific to legacy Minecraft versions. " + + "Please consider updating to give your players a better experience and to avoid issues that have long been fixed."); } } diff --git a/common/src/main/java/com/viaversion/viaversion/configuration/AbstractViaConfig.java b/common/src/main/java/com/viaversion/viaversion/configuration/AbstractViaConfig.java index 2c3bcf9d8..fb3cf95ba 100644 --- a/common/src/main/java/com/viaversion/viaversion/configuration/AbstractViaConfig.java +++ b/common/src/main/java/com/viaversion/viaversion/configuration/AbstractViaConfig.java @@ -154,8 +154,8 @@ public abstract class AbstractViaConfig extends Config implements ViaVersionConf resourcePack1_17PromptMessage = getSerializedComponent("resource-pack-1_17-prompt"); Map worlds = get("map-1_16-world-names", new HashMap<>()); map1_16WorldNames = new WorldIdentifiers(worlds.getOrDefault("overworld", WorldIdentifiers.OVERWORLD_DEFAULT), - worlds.getOrDefault("nether", WorldIdentifiers.NETHER_DEFAULT), - worlds.getOrDefault("end", WorldIdentifiers.END_DEFAULT)); + worlds.getOrDefault("nether", WorldIdentifiers.NETHER_DEFAULT), + worlds.getOrDefault("end", WorldIdentifiers.END_DEFAULT)); cache1_17Light = getBoolean("cache-1_17-light", true); translateOcelotToCat = getBoolean("translate-ocelot-to-cat", true); enforceSecureChat = getBoolean("enforce-secure-chat", false); diff --git a/common/src/main/java/com/viaversion/viaversion/connection/UserConnectionImpl.java b/common/src/main/java/com/viaversion/viaversion/connection/UserConnectionImpl.java index 95df9f6d0..22528bace 100644 --- a/common/src/main/java/com/viaversion/viaversion/connection/UserConnectionImpl.java +++ b/common/src/main/java/com/viaversion/viaversion/connection/UserConnectionImpl.java @@ -59,8 +59,8 @@ public class UserConnectionImpl implements UserConnection { private final Map, EntityTracker> entityTrackers = new HashMap<>(); private final PacketTracker packetTracker = new PacketTracker(this); private final Set passthroughTokens = Collections.newSetFromMap(CacheBuilder.newBuilder() - .expireAfterWrite(10, TimeUnit.SECONDS) - .build().asMap()); + .expireAfterWrite(10, TimeUnit.SECONDS) + .build().asMap()); private final ProtocolInfo protocolInfo = new ProtocolInfoImpl(); private final Channel channel; private final boolean clientSide; @@ -167,7 +167,7 @@ public class UserConnectionImpl implements UserConnection { if (clientSide) { // We'll just assume that Via decoder isn't wrapping the original decoder act = () -> getChannel().pipeline() - .context(Via.getManager().getInjector().getDecoderName()).fireChannelRead(packet); + .context(Via.getManager().getInjector().getDecoderName()).fireChannelRead(packet); } else { act = () -> channel.pipeline().context(Via.getManager().getInjector().getEncoderName()).writeAndFlush(packet); } @@ -234,7 +234,7 @@ public class UserConnectionImpl implements UserConnection { try { // We'll use passing through because there are some encoder wrappers ChannelHandlerContext context = PipelineUtil - .getPreviousContext(Via.getManager().getInjector().getDecoderName(), channel.pipeline()); + .getPreviousContext(Via.getManager().getInjector().getDecoderName(), channel.pipeline()); if (shouldTransformPacket()) { // Bypass serverbound packet decoder transforming @@ -268,7 +268,7 @@ public class UserConnectionImpl implements UserConnection { private void sendRawPacketToServerClientSide(final ByteBuf packet, boolean currentThread) { Runnable act = () -> getChannel().pipeline() - .context(Via.getManager().getInjector().getEncoderName()).writeAndFlush(packet); + .context(Via.getManager().getInjector().getEncoderName()).writeAndFlush(packet); if (currentThread) { act.run(); } else { diff --git a/common/src/main/java/com/viaversion/viaversion/data/entity/DimensionDataImpl.java b/common/src/main/java/com/viaversion/viaversion/data/entity/DimensionDataImpl.java index c56695d3e..e5e3cf639 100644 --- a/common/src/main/java/com/viaversion/viaversion/data/entity/DimensionDataImpl.java +++ b/common/src/main/java/com/viaversion/viaversion/data/entity/DimensionDataImpl.java @@ -66,8 +66,8 @@ public final class DimensionDataImpl implements DimensionData { @Override public String toString() { return "DimensionData{" + - "minY=" + minY + - ", height=" + height + - '}'; + "minY=" + minY + + ", height=" + height + + '}'; } } diff --git a/common/src/main/java/com/viaversion/viaversion/data/entity/TrackedEntityImpl.java b/common/src/main/java/com/viaversion/viaversion/data/entity/TrackedEntityImpl.java index bfae1e9d6..d0197189e 100644 --- a/common/src/main/java/com/viaversion/viaversion/data/entity/TrackedEntityImpl.java +++ b/common/src/main/java/com/viaversion/viaversion/data/entity/TrackedEntityImpl.java @@ -24,7 +24,7 @@ import com.viaversion.viaversion.api.minecraft.entities.EntityType; public final class TrackedEntityImpl implements TrackedEntity { private final EntityType entityType; private StoredEntityData data; - private boolean sentMetadata; + private boolean sentEntityData; public TrackedEntityImpl(final EntityType entityType) { this.entityType = entityType; @@ -49,21 +49,21 @@ public final class TrackedEntityImpl implements TrackedEntity { } @Override - public boolean hasSentMetadata() { - return sentMetadata; + public boolean hasSentEntityData() { + return sentEntityData; } @Override - public void sentMetadata(final boolean sentMetadata) { - this.sentMetadata = sentMetadata; + public void sentEntityData(final boolean sentEntityData) { + this.sentEntityData = sentEntityData; } @Override public String toString() { return "TrackedEntityImpl{" + - "entityType=" + entityType + - ", data=" + data + - ", sentMetadata=" + sentMetadata + - '}'; + "entityType=" + entityType + + ", data=" + data + + ", sentEntityData=" + sentEntityData + + '}'; } } \ No newline at end of file diff --git a/common/src/main/java/com/viaversion/viaversion/debug/DebugHandlerImpl.java b/common/src/main/java/com/viaversion/viaversion/debug/DebugHandlerImpl.java index fbd8bbb38..d4fcf6984 100644 --- a/common/src/main/java/com/viaversion/viaversion/debug/DebugHandlerImpl.java +++ b/common/src/main/java/com/viaversion/viaversion/debug/DebugHandlerImpl.java @@ -77,7 +77,7 @@ public final class DebugHandlerImpl implements DebugHandler { @Override public boolean shouldLog(final PacketWrapper wrapper, final Direction direction) { return packetTypesToLog.isEmpty() && serverboundPacketIdsToLog.isEmpty() && clientboundPacketIdsToLog.isEmpty() - || (wrapper.getPacketType() != null && packetTypesToLog.contains(wrapper.getPacketType().getName())) - || (direction == Direction.SERVERBOUND ? serverboundPacketIdsToLog : clientboundPacketIdsToLog).contains(wrapper.getId()); + || (wrapper.getPacketType() != null && packetTypesToLog.contains(wrapper.getPacketType().getName())) + || (direction == Direction.SERVERBOUND ? serverboundPacketIdsToLog : clientboundPacketIdsToLog).contains(wrapper.getId()); } } diff --git a/common/src/main/java/com/viaversion/viaversion/platform/AbstractProtocolDetectorService.java b/common/src/main/java/com/viaversion/viaversion/platform/AbstractProtocolDetectorService.java index b792917c9..7a27ed058 100644 --- a/common/src/main/java/com/viaversion/viaversion/platform/AbstractProtocolDetectorService.java +++ b/common/src/main/java/com/viaversion/viaversion/platform/AbstractProtocolDetectorService.java @@ -19,7 +19,6 @@ package com.viaversion.viaversion.platform; import com.viaversion.viaversion.api.platform.ProtocolDetectorService; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import com.viaversion.viaversion.api.protocol.version.VersionType; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; import java.util.Map; diff --git a/common/src/main/java/com/viaversion/viaversion/protocol/BlockedProtocolVersionsImpl.java b/common/src/main/java/com/viaversion/viaversion/protocol/BlockedProtocolVersionsImpl.java index a000785f6..f7051c7fb 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocol/BlockedProtocolVersionsImpl.java +++ b/common/src/main/java/com/viaversion/viaversion/protocol/BlockedProtocolVersionsImpl.java @@ -27,7 +27,7 @@ public record BlockedProtocolVersionsImpl(Set singleBlockedVers @Override public boolean contains(final ProtocolVersion protocolVersion) { return blocksBelow.isKnown() && protocolVersion.olderThan(blocksBelow) - || blocksAbove.isKnown() && protocolVersion.newerThan(blocksAbove) - || singleBlockedVersions.contains(protocolVersion); + || blocksAbove.isKnown() && protocolVersion.newerThan(blocksAbove) + || singleBlockedVersions.contains(protocolVersion); } } diff --git a/common/src/main/java/com/viaversion/viaversion/protocol/ProtocolManagerImpl.java b/common/src/main/java/com/viaversion/viaversion/protocol/ProtocolManagerImpl.java index 039c9c272..a12e19ccf 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocol/ProtocolManagerImpl.java +++ b/common/src/main/java/com/viaversion/viaversion/protocol/ProtocolManagerImpl.java @@ -41,45 +41,49 @@ import com.viaversion.viaversion.protocol.packet.VersionedPacketTransformerImpl; import com.viaversion.viaversion.protocols.base.BaseProtocol; import com.viaversion.viaversion.protocols.base.BaseProtocol1_16; import com.viaversion.viaversion.protocols.base.BaseProtocol1_7; -import com.viaversion.viaversion.protocols.v1_9_3to1_10.Protocol1_9_3To1_10; -import com.viaversion.viaversion.protocols.v1_11to1_11_1.Protocol1_11To1_11_1; import com.viaversion.viaversion.protocols.v1_10to1_11.Protocol1_10To1_11; -import com.viaversion.viaversion.protocols.v1_12to1_12_1.Protocol1_12To1_12_1; -import com.viaversion.viaversion.protocols.v1_12_1to1_12_2.Protocol1_12_1To1_12_2; import com.viaversion.viaversion.protocols.v1_11_1to1_12.Protocol1_11_1To1_12; -import com.viaversion.viaversion.protocols.v1_13to1_13_1.Protocol1_13To1_13_1; -import com.viaversion.viaversion.protocols.v1_13_1to1_13_2.Protocol1_13_1To1_13_2; +import com.viaversion.viaversion.protocols.v1_11to1_11_1.Protocol1_11To1_11_1; +import com.viaversion.viaversion.protocols.v1_12_1to1_12_2.Protocol1_12_1To1_12_2; import com.viaversion.viaversion.protocols.v1_12_2to1_13.Protocol1_12_2To1_13; -import com.viaversion.viaversion.protocols.v1_14to1_14_1.Protocol1_14To1_14_1; +import com.viaversion.viaversion.protocols.v1_12to1_12_1.Protocol1_12To1_12_1; +import com.viaversion.viaversion.protocols.v1_13_1to1_13_2.Protocol1_13_1To1_13_2; +import com.viaversion.viaversion.protocols.v1_13_2to1_14.Protocol1_13_2To1_14; +import com.viaversion.viaversion.protocols.v1_13to1_13_1.Protocol1_13To1_13_1; import com.viaversion.viaversion.protocols.v1_14_1to1_14_2.Protocol1_14_1To1_14_2; import com.viaversion.viaversion.protocols.v1_14_2to1_14_3.Protocol1_14_2To1_14_3; import com.viaversion.viaversion.protocols.v1_14_3to1_14_4.Protocol1_14_3To1_14_4; -import com.viaversion.viaversion.protocols.v1_13_2to1_14.Protocol1_13_2To1_14; -import com.viaversion.viaversion.protocols.v1_15to1_15_1.Protocol1_15To1_15_1; -import com.viaversion.viaversion.protocols.v1_15_1to1_15_2.Protocol1_15_1To1_15_2; import com.viaversion.viaversion.protocols.v1_14_4to1_15.Protocol1_14_4To1_15; -import com.viaversion.viaversion.protocols.v1_16to1_16_1.Protocol1_16To1_16_1; +import com.viaversion.viaversion.protocols.v1_14to1_14_1.Protocol1_14To1_14_1; +import com.viaversion.viaversion.protocols.v1_15_1to1_15_2.Protocol1_15_1To1_15_2; +import com.viaversion.viaversion.protocols.v1_15_2to1_16.Protocol1_15_2To1_16; +import com.viaversion.viaversion.protocols.v1_15to1_15_1.Protocol1_15To1_15_1; import com.viaversion.viaversion.protocols.v1_16_1to1_16_2.Protocol1_16_1To1_16_2; import com.viaversion.viaversion.protocols.v1_16_2to1_16_3.Protocol1_16_2To1_16_3; import com.viaversion.viaversion.protocols.v1_16_3to1_16_4.Protocol1_16_3To1_16_4; -import com.viaversion.viaversion.protocols.v1_15_2to1_16.Protocol1_15_2To1_16; -import com.viaversion.viaversion.protocols.v1_17to1_17_1.Protocol1_17To1_17_1; import com.viaversion.viaversion.protocols.v1_16_4to1_17.Protocol1_16_4To1_17; -import com.viaversion.viaversion.protocols.v1_18to1_18_2.Protocol1_18To1_18_2; +import com.viaversion.viaversion.protocols.v1_16to1_16_1.Protocol1_16To1_16_1; import com.viaversion.viaversion.protocols.v1_17_1to1_18.Protocol1_17_1To1_18; -import com.viaversion.viaversion.protocols.v1_19to1_19_1.Protocol1_19To1_19_1; +import com.viaversion.viaversion.protocols.v1_17to1_17_1.Protocol1_17To1_17_1; +import com.viaversion.viaversion.protocols.v1_18_2to1_19.Protocol1_18_2To1_19; +import com.viaversion.viaversion.protocols.v1_18to1_18_2.Protocol1_18To1_18_2; import com.viaversion.viaversion.protocols.v1_19_1to1_19_3.Protocol1_19_1To1_19_3; import com.viaversion.viaversion.protocols.v1_19_3to1_19_4.Protocol1_19_3To1_19_4; -import com.viaversion.viaversion.protocols.v1_18_2to1_19.Protocol1_18_2To1_19; -import com.viaversion.viaversion.protocols.v1_20to1_20_2.Protocol1_20To1_20_2; +import com.viaversion.viaversion.protocols.v1_19_4to1_20.Protocol1_19_4To1_20; +import com.viaversion.viaversion.protocols.v1_19to1_19_1.Protocol1_19To1_19_1; import com.viaversion.viaversion.protocols.v1_20_2to1_20_3.Protocol1_20_2To1_20_3; import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.Protocol1_20_3To1_20_5; -import com.viaversion.viaversion.protocols.v1_19_4to1_20.Protocol1_19_4To1_20; -import com.viaversion.viaversion.protocols.v1_9to1_9_1.Protocol1_9To1_9_1; -import com.viaversion.viaversion.protocols.v1_9_1to1_9_3.Protocol1_9_1To1_9_3; +import com.viaversion.viaversion.protocols.v1_20to1_20_2.Protocol1_20To1_20_2; import com.viaversion.viaversion.protocols.v1_8to1_9.Protocol1_8To1_9; +import com.viaversion.viaversion.protocols.v1_9_1to1_9_3.Protocol1_9_1To1_9_3; +import com.viaversion.viaversion.protocols.v1_9_3to1_10.Protocol1_9_3To1_10; +import com.viaversion.viaversion.protocols.v1_9to1_9_1.Protocol1_9To1_9_1; import com.viaversion.viaversion.util.Pair; import io.netty.buffer.ByteBuf; +import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2ObjectSortedMap; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -101,10 +105,6 @@ import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.function.Function; import java.util.logging.Level; -import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; -import it.unimi.dsi.fastutil.objects.Object2ObjectSortedMap; import org.checkerframework.checker.nullness.qual.Nullable; public class ProtocolManagerImpl implements ProtocolManager { @@ -289,10 +289,10 @@ public class ProtocolManagerImpl implements ProtocolManager { @Override public VersionedPacketTransformer createPacketTransformer(ProtocolVersion inputVersion, - @Nullable Class clientboundPacketsClass, - @Nullable Class serverboundPacketsClass) { + S extends ServerboundPacketType + > VersionedPacketTransformer createPacketTransformer(ProtocolVersion inputVersion, + @Nullable Class clientboundPacketsClass, + @Nullable Class serverboundPacketsClass) { Preconditions.checkArgument(clientboundPacketsClass != ClientboundPacketType.class && serverboundPacketsClass != ServerboundPacketType.class); return new VersionedPacketTransformerImpl<>(inputVersion, clientboundPacketsClass, serverboundPacketsClass); } @@ -475,7 +475,7 @@ public class ProtocolManagerImpl implements ProtocolManager { @Override public void addMappingLoaderFuture(Class protocolClass, Class dependsOn, Runnable runnable) { CompletableFuture future = getMappingLoaderFuture(dependsOn) - .whenCompleteAsync((v, throwable) -> runnable.run(), mappingLoaderExecutor).exceptionally(mappingLoaderThrowable(protocolClass)); + .whenCompleteAsync((v, throwable) -> runnable.run(), mappingLoaderExecutor).exceptionally(mappingLoaderThrowable(protocolClass)); mappingLoaderLock.writeLock().lock(); try { diff --git a/common/src/main/java/com/viaversion/viaversion/protocol/ProtocolPathKeyImpl.java b/common/src/main/java/com/viaversion/viaversion/protocol/ProtocolPathKeyImpl.java index 98bc85747..affa50e19 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocol/ProtocolPathKeyImpl.java +++ b/common/src/main/java/com/viaversion/viaversion/protocol/ProtocolPathKeyImpl.java @@ -19,7 +19,7 @@ package com.viaversion.viaversion.protocol; import com.viaversion.viaversion.api.protocol.ProtocolPathKey; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import java.util.Objects; -public record ProtocolPathKeyImpl(ProtocolVersion clientProtocolVersion, ProtocolVersion serverProtocolVersion) implements ProtocolPathKey { +public record ProtocolPathKeyImpl(ProtocolVersion clientProtocolVersion, + ProtocolVersion serverProtocolVersion) implements ProtocolPathKey { } diff --git a/common/src/main/java/com/viaversion/viaversion/protocol/RedirectProtocolVersion.java b/common/src/main/java/com/viaversion/viaversion/protocol/RedirectProtocolVersion.java index dc109bd49..93d4db165 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocol/RedirectProtocolVersion.java +++ b/common/src/main/java/com/viaversion/viaversion/protocol/RedirectProtocolVersion.java @@ -20,11 +20,11 @@ package com.viaversion.viaversion.protocol; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viaversion.api.protocol.version.SubVersionRange; import com.viaversion.viaversion.api.protocol.version.VersionType; -import org.checkerframework.checker.nullness.qual.Nullable; import java.util.Comparator; +import org.checkerframework.checker.nullness.qual.Nullable; /** - * Special protocol version that compares to another version. This can be used for e.g. April Fool versions which are depending + * Special protocol version that compares to another version. This can be used for e.g. April Fool versions which are depending * on vanilla game versions. */ public class RedirectProtocolVersion extends ProtocolVersion { diff --git a/common/src/main/java/com/viaversion/viaversion/protocol/ServerProtocolVersionRange.java b/common/src/main/java/com/viaversion/viaversion/protocol/ServerProtocolVersionRange.java index 51906eb41..e51129574 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocol/ServerProtocolVersionRange.java +++ b/common/src/main/java/com/viaversion/viaversion/protocol/ServerProtocolVersionRange.java @@ -21,6 +21,7 @@ import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viaversion.api.protocol.version.ServerProtocolVersion; import java.util.SortedSet; -public record ServerProtocolVersionRange(ProtocolVersion lowestSupportedProtocolVersion, ProtocolVersion highestSupportedProtocolVersion, +public record ServerProtocolVersionRange(ProtocolVersion lowestSupportedProtocolVersion, + ProtocolVersion highestSupportedProtocolVersion, SortedSet supportedProtocolVersions) implements ServerProtocolVersion { } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/base/BaseProtocol.java b/common/src/main/java/com/viaversion/viaversion/protocols/base/BaseProtocol.java index 66595602e..1433b4e18 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/base/BaseProtocol.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/base/BaseProtocol.java @@ -32,7 +32,6 @@ import com.viaversion.viaversion.api.protocol.packet.provider.PacketTypesProvide import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viaversion.api.protocol.version.VersionProvider; import com.viaversion.viaversion.api.protocol.version.VersionType; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.exception.CancelException; import com.viaversion.viaversion.exception.InformativeException; diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/base/BaseProtocol1_16.java b/common/src/main/java/com/viaversion/viaversion/protocols/base/BaseProtocol1_16.java index 4a188757c..6997b774b 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/base/BaseProtocol1_16.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/base/BaseProtocol1_16.java @@ -18,7 +18,6 @@ package com.viaversion.viaversion.protocols.base; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import java.util.UUID; diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/base/BaseProtocol1_7.java b/common/src/main/java/com/viaversion/viaversion/protocols/base/BaseProtocol1_7.java index d5b98e942..19b8275fb 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/base/BaseProtocol1_7.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/base/BaseProtocol1_7.java @@ -32,7 +32,6 @@ import com.viaversion.viaversion.api.protocol.packet.provider.PacketTypesProvide import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; import com.viaversion.viaversion.api.protocol.version.VersionProvider; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.protocol.ProtocolManagerImpl; import com.viaversion.viaversion.protocol.ServerProtocolVersionSingleton; @@ -156,11 +155,11 @@ public class BaseProtocol1_7 extends AbstractProtocol { int entityId = wrapper.get(Types.VAR_INT, 0); // Change Type :) int type = wrapper.get(Types.VAR_INT, 1); - EntityTypes1_11.EntityType entType = rewriteEntityType(type, wrapper.get(Types1_9.METADATA_LIST, 0)); + EntityTypes1_11.EntityType entType = rewriteEntityType(type, wrapper.get(Types1_9.ENTITY_DATA_LIST, 0)); if (entType != null) { wrapper.set(Types.VAR_INT, 1, entType.getId()); // Register Type ID wrapper.user().getEntityTracker(Protocol1_10To1_11.class).addEntity(entityId, entType); - handleMetadata(entityId, wrapper.get(Types1_9.METADATA_LIST, 0), wrapper.user()); + handleEntityData(entityId, wrapper.get(Types1_9.ENTITY_DATA_LIST, 0), wrapper.user()); } }); } @@ -105,7 +105,7 @@ public class EntityPacketRewriter1_11 extends EntityRewriter { boolean value = (((byte) meta.getValue()) & 0x02) == 0x02; - meta.setTypeAndValue(MetaType1_9.BOOLEAN, value); + meta.setTypeAndValue(EntityDataTypes1_9.BOOLEAN, value); }); filter().type(EntityType.ABSTRACT_SKELETON).removeIndex(12); @@ -203,9 +203,9 @@ public class EntityPacketRewriter1_11 extends EntityRewriter metadata) { - Optional optType = EntityType.findById(numType); - if (optType.isEmpty()) { + public EntityType rewriteEntityType(int numType, List metadata) { + EntityType type = EntityType.findById(numType); + if (type == null) { Via.getManager().getPlatform().getLogger().severe("Error: could not find Entity type " + numType + " with metadata: " + metadata); return null; } @@ -265,7 +265,7 @@ public class EntityPacketRewriter1_11 extends EntityRewriter options = getById(metadata, 12); + Optional options = getById(metadata, 12); if (options.isPresent()) { if ((((byte) options.get().getValue()) & 0x04) == 0x04) { return EntityType.ELDER_GUARDIAN; @@ -275,7 +275,7 @@ public class EntityPacketRewriter1_11 extends EntityRewriter options = getById(metadata, 12); + Optional options = getById(metadata, 12); if (options.isPresent()) { if (((int) options.get().getValue()) == 1) { return EntityType.WITHER_SKELETON; @@ -288,11 +288,11 @@ public class EntityPacketRewriter1_11 extends EntityRewriter options = getById(metadata, 13); + Optional options = getById(metadata, 13); if (options.isPresent()) { int value = (int) options.get().getValue(); if (value > 0 && value < 6) { - metadata.add(new Metadata(16, MetaType1_9.VAR_INT, value - 1)); // Add profession type to new metadata + metadata.add(new EntityData(16, EntityDataTypes1_9.VAR_INT, value - 1)); // Add profession type to new metadata return EntityType.ZOMBIE_VILLAGER; } if (value == 6) { @@ -305,7 +305,7 @@ public class EntityPacketRewriter1_11 extends EntityRewriter options = getById(metadata, 14); + Optional options = getById(metadata, 14); if (options.isPresent()) { if (((int) options.get().getValue()) == 0) { return EntityType.HORSE; @@ -335,8 +335,8 @@ public class EntityPacketRewriter1_11 extends EntityRewriter getById(List metadatas, int id) { - for (Metadata metadata : metadatas) { + public Optional getById(List metadatas, int id) { + for (EntityData metadata : metadatas) { if (metadata.id() == id) return Optional.of(metadata); } return Optional.empty(); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_10to1_11/rewriter/ItemPacketRewriter1_11.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_10to1_11/rewriter/ItemPacketRewriter1_11.java index bdb4f37d1..dd48699b4 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_10to1_11/rewriter/ItemPacketRewriter1_11.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_10to1_11/rewriter/ItemPacketRewriter1_11.java @@ -36,8 +36,8 @@ public class ItemPacketRewriter1_11 extends ItemRewriter Trading protocol.registerClientbound(ClientboundPackets1_9_3.CUSTOM_PAYLOAD, new PacketHandlers() { @@ -68,8 +68,8 @@ public class ItemPacketRewriter1_11 extends ItemRewriter packetWrapper.write(Types.VAR_INT, 0)) - .scheduleSend(Protocol1_12_2To1_13.class); + .scheduleSend(Protocol1_12_2To1_13.class); } }); } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_11_1to1_12/data/ChatItemRewriter.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_11_1to1_12/data/ChatItemRewriter.java index d34039cd7..b94b1ce44 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_11_1to1_12/data/ChatItemRewriter.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_11_1to1_12/data/ChatItemRewriter.java @@ -17,10 +17,10 @@ */ package com.viaversion.viaversion.protocols.v1_11_1to1_12.data; -import com.viaversion.nbt.tag.CompoundTag; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import com.viaversion.nbt.tag.CompoundTag; import com.viaversion.viaversion.util.ComponentUtil; import com.viaversion.viaversion.util.SerializerVersion; diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_11_1to1_12/data/TranslateRewriter.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_11_1to1_12/data/TranslateRewriter.java index d6066be93..2649d41ef 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_11_1to1_12/data/TranslateRewriter.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_11_1to1_12/data/TranslateRewriter.java @@ -22,7 +22,6 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.connection.UserConnection; -import com.viaversion.viaversion.protocols.v1_11_1to1_12.Protocol1_11_1To1_12; import com.viaversion.viaversion.protocols.v1_9_1to1_9_3.packet.ClientboundPackets1_9_3; import com.viaversion.viaversion.rewriter.ComponentRewriter; import com.viaversion.viaversion.util.SerializerVersion; diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_11_1to1_12/rewriter/EntityPacketRewriter1_12.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_11_1to1_12/rewriter/EntityPacketRewriter1_12.java index 7db3d83d9..8a0dcd675 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_11_1to1_12/rewriter/EntityPacketRewriter1_12.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_11_1to1_12/rewriter/EntityPacketRewriter1_12.java @@ -62,15 +62,15 @@ public class EntityPacketRewriter1_12 extends EntityRewriter Trading protocol.registerClientbound(ClientboundPackets1_9_3.CUSTOM_PAYLOAD, new PacketHandlers() { @@ -73,43 +72,43 @@ public class ItemPacketRewriter1_12 extends ItemRewriter { - Item item = wrapper.get(Types.ITEM1_8, 0); - if (!Via.getConfig().is1_12QuickMoveActionFix()) { - handleItemToServer(wrapper.user(), item); - return; + handler(wrapper -> { + Item item = wrapper.get(Types.ITEM1_8, 0); + if (!Via.getConfig().is1_12QuickMoveActionFix()) { + handleItemToServer(wrapper.user(), item); + return; + } + byte button = wrapper.get(Types.BYTE, 0); + int mode = wrapper.get(Types.VAR_INT, 0); + // QUICK_MOVE PATCH (Shift + (click/double click)) + if (mode == 1 && button == 0 && item == null) { + short windowId = wrapper.get(Types.UNSIGNED_BYTE, 0); + short slotId = wrapper.get(Types.SHORT, 0); + short actionId = wrapper.get(Types.SHORT, 1); + InventoryQuickMoveProvider provider = Via.getManager().getProviders().get(InventoryQuickMoveProvider.class); + boolean succeed = provider.registerQuickMoveAction(windowId, slotId, actionId, wrapper.user()); + if (succeed) { + wrapper.cancel(); } - byte button = wrapper.get(Types.BYTE, 0); - int mode = wrapper.get(Types.VAR_INT, 0); - // QUICK_MOVE PATCH (Shift + (click/double click)) - if (mode == 1 && button == 0 && item == null) { - short windowId = wrapper.get(Types.UNSIGNED_BYTE, 0); - short slotId = wrapper.get(Types.SHORT, 0); - short actionId = wrapper.get(Types.SHORT, 1); - InventoryQuickMoveProvider provider = Via.getManager().getProviders().get(InventoryQuickMoveProvider.class); - boolean succeed = provider.registerQuickMoveAction(windowId, slotId, actionId, wrapper.user()); - if (succeed) { - wrapper.cancel(); - } - // otherwise just pass through so the server sends the PacketPlayOutTransaction packet. - } else { - handleItemToServer(wrapper.user(), item); - } - }); - } + // otherwise just pass through so the server sends the PacketPlayOutTransaction packet. + } else { + handleItemToServer(wrapper.user(), item); + } + }); } + } ); - registerCreativeInvAction(ServerboundPackets1_12.SET_CREATIVE_MODE_SLOT); + registerSetCreativeModeSlot(ServerboundPackets1_12.SET_CREATIVE_MODE_SLOT); } @Override diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_11to1_11_1/rewriter/ItemPacketRewriter1_11_1.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_11to1_11_1/rewriter/ItemPacketRewriter1_11_1.java index aa2b855fb..d1eba3d31 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_11to1_11_1/rewriter/ItemPacketRewriter1_11_1.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_11to1_11_1/rewriter/ItemPacketRewriter1_11_1.java @@ -19,7 +19,6 @@ package com.viaversion.viaversion.protocols.v1_11to1_11_1.rewriter; import com.viaversion.viaversion.api.connection.UserConnection; 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.protocols.v1_11to1_11_1.Protocol1_11To1_11_1; import com.viaversion.viaversion.protocols.v1_9_1to1_9_3.packet.ClientboundPackets1_9_3; @@ -34,7 +33,7 @@ public class ItemPacketRewriter1_11_1 extends ItemRewriter { - // Send fake declare commands - w.create(ClientboundPackets1_13.COMMANDS, wrapper -> { - wrapper.write(Types.VAR_INT, 2); // Size - // Write root node - wrapper.write(Types.BYTE, (byte) 0); // Mark as command - wrapper.write(Types.VAR_INT_ARRAY_PRIMITIVE, new int[]{1}); // 1 child at index 1 + w -> { + // Send fake declare commands + w.create(ClientboundPackets1_13.COMMANDS, wrapper -> { + wrapper.write(Types.VAR_INT, 2); // Size + // Write root node + wrapper.write(Types.BYTE, (byte) 0); // Mark as command + wrapper.write(Types.VAR_INT_ARRAY_PRIMITIVE, new int[]{1}); // 1 child at index 1 - // Write arg node - wrapper.write(Types.BYTE, (byte) (0x02 | 0x04 | 0x10)); // Mark as command - wrapper.write(Types.VAR_INT_ARRAY_PRIMITIVE, new int[0]); // No children - // Extra data - wrapper.write(Types.STRING, "args"); // Arg name - wrapper.write(Types.STRING, "brigadier:string"); - wrapper.write(Types.VAR_INT, 2); // Greedy - wrapper.write(Types.STRING, "minecraft:ask_server"); // Ask server + // Write arg node + wrapper.write(Types.BYTE, (byte) (0x02 | 0x04 | 0x10)); // Mark as command + wrapper.write(Types.VAR_INT_ARRAY_PRIMITIVE, new int[0]); // No children + // Extra data + wrapper.write(Types.STRING, "args"); // Arg name + wrapper.write(Types.STRING, "brigadier:string"); + wrapper.write(Types.VAR_INT, 2); // Greedy + wrapper.write(Types.STRING, "minecraft:ask_server"); // Ask server - wrapper.write(Types.VAR_INT, 0); // Root node index - }).scheduleSend(Protocol1_12_2To1_13.class); + wrapper.write(Types.VAR_INT, 0); // Root node index + }).scheduleSend(Protocol1_12_2To1_13.class); - // Send tags packet - w.create(ClientboundPackets1_13.UPDATE_TAGS, wrapper -> { - wrapper.write(Types.VAR_INT, MAPPINGS.getBlockTags().size()); // block tags - for (Map.Entry tag : MAPPINGS.getBlockTags().entrySet()) { - wrapper.write(Types.STRING, tag.getKey()); - // Needs copy as other protocols may modify it - wrapper.write(Types.VAR_INT_ARRAY_PRIMITIVE, tag.getValue()); - } - wrapper.write(Types.VAR_INT, MAPPINGS.getItemTags().size()); // item tags - for (Map.Entry tag : MAPPINGS.getItemTags().entrySet()) { - wrapper.write(Types.STRING, tag.getKey()); - // Needs copy as other protocols may modify it - wrapper.write(Types.VAR_INT_ARRAY_PRIMITIVE, tag.getValue()); - } - wrapper.write(Types.VAR_INT, MAPPINGS.getFluidTags().size()); // fluid tags - for (Map.Entry tag : MAPPINGS.getFluidTags().entrySet()) { - wrapper.write(Types.STRING, tag.getKey()); - // Needs copy as other protocols may modify it - wrapper.write(Types.VAR_INT_ARRAY_PRIMITIVE, tag.getValue()); - } - }).scheduleSend(Protocol1_12_2To1_13.class); - }; + // Send tags packet + w.create(ClientboundPackets1_13.UPDATE_TAGS, wrapper -> { + wrapper.write(Types.VAR_INT, MAPPINGS.getBlockTags().size()); // block tags + for (Map.Entry tag : MAPPINGS.getBlockTags().entrySet()) { + wrapper.write(Types.STRING, tag.getKey()); + // Needs copy as other protocols may modify it + wrapper.write(Types.VAR_INT_ARRAY_PRIMITIVE, tag.getValue()); + } + wrapper.write(Types.VAR_INT, MAPPINGS.getItemTags().size()); // item tags + for (Map.Entry tag : MAPPINGS.getItemTags().entrySet()) { + wrapper.write(Types.STRING, tag.getKey()); + // Needs copy as other protocols may modify it + wrapper.write(Types.VAR_INT_ARRAY_PRIMITIVE, tag.getValue()); + } + wrapper.write(Types.VAR_INT, MAPPINGS.getFluidTags().size()); // fluid tags + for (Map.Entry tag : MAPPINGS.getFluidTags().entrySet()) { + wrapper.write(Types.STRING, tag.getKey()); + // Needs copy as other protocols may modify it + wrapper.write(Types.VAR_INT_ARRAY_PRIMITIVE, tag.getValue()); + } + }).scheduleSend(Protocol1_12_2To1_13.class); + }; @Override protected void registerPackets() { @@ -246,7 +246,7 @@ public class Protocol1_12_2To1_13 extends AbstractProtocol { @@ -352,7 +352,7 @@ public class Protocol1_12_2To1_13 extends AbstractProtocol(Types.STRING) { // Rotation @Override public String transform(PacketWrapper wrapper, Integer rotation) { return rotation == 0 ? "NONE" - : rotation == 1 ? "CLOCKWISE_90" - : rotation == 2 ? "CLOCKWISE_180" - : "COUNTERCLOCKWISE_90"; + : rotation == 1 ? "CLOCKWISE_90" + : rotation == 2 ? "CLOCKWISE_180" + : "COUNTERCLOCKWISE_90"; } }); map(Types.STRING); @@ -830,10 +830,10 @@ public class Protocol1_12_2To1_13 extends AbstractProtocol map = GsonUtil.getGson().fromJson( - reader, - new TypeToken>() { - }.getType()); + reader, + new TypeToken>() { + }.getType()); blockIdMapping.putAll(map); for (Map.Entry entry : blockIdMapping.entrySet()) { for (String val : entry.getValue()) { @@ -58,12 +58,12 @@ public class BlockIdData { } InputStream blockS = MappingData1_13.class.getClassLoader() - .getResourceAsStream("assets/viaversion/data/blockNumberToString1.12.json"); + .getResourceAsStream("assets/viaversion/data/blockNumberToString1.12.json"); try (InputStreamReader blockR = new InputStreamReader(blockS)) { Map map = GsonUtil.getGson().fromJson( - blockR, - new TypeToken>() { - }.getType() + blockR, + new TypeToken>() { + }.getType() ); numberIdToString.putAll(map); } catch (IOException e) { diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/data/ComponentRewriter1_13.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/data/ComponentRewriter1_13.java index 6e4206462..731a58d4d 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/data/ComponentRewriter1_13.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/data/ComponentRewriter1_13.java @@ -17,12 +17,12 @@ */ package com.viaversion.viaversion.protocols.v1_12_2to1_13.data; -import com.viaversion.nbt.tag.CompoundTag; -import com.viaversion.nbt.tag.NumberTag; -import com.viaversion.nbt.tag.ShortTag; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import com.viaversion.nbt.tag.CompoundTag; +import com.viaversion.nbt.tag.NumberTag; +import com.viaversion.nbt.tag.ShortTag; import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.minecraft.item.DataItem; @@ -32,7 +32,6 @@ import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType; import com.viaversion.viaversion.protocols.v1_12_2to1_13.Protocol1_12_2To1_13; import com.viaversion.viaversion.rewriter.ComponentRewriter; import com.viaversion.viaversion.util.ComponentUtil; -import com.viaversion.viaversion.util.ProtocolLogger; import com.viaversion.viaversion.util.SerializerVersion; import java.util.logging.Level; diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/data/MappingData1_13.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/data/MappingData1_13.java index 84bae7f74..2f83a15d6 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/data/MappingData1_13.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/data/MappingData1_13.java @@ -17,16 +17,16 @@ */ package com.viaversion.viaversion.protocols.v1_12_2to1_13.data; -import com.viaversion.nbt.tag.CompoundTag; -import com.viaversion.nbt.tag.IntArrayTag; -import com.viaversion.nbt.tag.StringTag; -import com.viaversion.nbt.tag.Tag; import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; import com.google.common.io.CharStreams; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.reflect.TypeToken; +import com.viaversion.nbt.tag.CompoundTag; +import com.viaversion.nbt.tag.IntArrayTag; +import com.viaversion.nbt.tag.StringTag; +import com.viaversion.nbt.tag.Tag; import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.data.BiMappings; import com.viaversion.viaversion.api.data.Int2IntMapBiMappings; @@ -95,13 +95,13 @@ public class MappingData1_13 extends MappingDataBase { } Map translationMappingData = GsonUtil.getGson().fromJson( - new InputStreamReader(MappingData1_13.class.getClassLoader().getResourceAsStream("assets/viaversion/data/mapping-lang-1.12-1.13.json")), - new TypeToken>() { - }.getType()); + new InputStreamReader(MappingData1_13.class.getClassLoader().getResourceAsStream("assets/viaversion/data/mapping-lang-1.12-1.13.json")), + new TypeToken>() { + }.getType()); String[] unmappedTranslationLines; try (Reader reader = new InputStreamReader(MappingData1_13.class.getClassLoader() - .getResourceAsStream("assets/viaversion/data/en_US.properties"), StandardCharsets.UTF_8)) { + .getResourceAsStream("assets/viaversion/data/en_US.properties"), StandardCharsets.UTF_8)) { unmappedTranslationLines = CharStreams.toString(reader).split("\n"); } catch (IOException e) { throw new RuntimeException(e); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/data/ParticleRewriter.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/data/ParticleRewriter.java index f3beaa5e8..da82e2a38 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/data/ParticleRewriter.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/data/ParticleRewriter.java @@ -18,12 +18,12 @@ package com.viaversion.viaversion.protocols.v1_12_2to1_13.data; import com.viaversion.viaversion.api.Via; +import com.viaversion.viaversion.api.minecraft.Particle; import com.viaversion.viaversion.api.minecraft.item.DataItem; import com.viaversion.viaversion.api.minecraft.item.Item; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.protocols.v1_12_2to1_13.Protocol1_12_2To1_13; import com.viaversion.viaversion.protocols.v1_12_2to1_13.rewriter.WorldPacketRewriter1_13; -import com.viaversion.viaversion.api.minecraft.Particle; import java.util.ArrayList; import java.util.Arrays; import java.util.List; diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/data/RecipeData.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/data/RecipeData.java index 0db5f77c7..61eba42c9 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/data/RecipeData.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/data/RecipeData.java @@ -30,12 +30,12 @@ public class RecipeData { public static void init() { InputStream stream = MappingData1_13.class.getClassLoader() - .getResourceAsStream("assets/viaversion/data/itemrecipes1_12_2to1_13.json"); + .getResourceAsStream("assets/viaversion/data/itemrecipes1_12_2to1_13.json"); try (InputStreamReader reader = new InputStreamReader(stream)) { recipes = GsonUtil.getGson().fromJson( - reader, - new TypeToken>() { - }.getType() + reader, + new TypeToken>() { + }.getType() ); } catch (IOException e) { throw new RuntimeException(e); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/provider/blockentities/CommandBlockHandler.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/provider/blockentities/CommandBlockHandler.java index c1c7f0a22..6363b7896 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/provider/blockentities/CommandBlockHandler.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/provider/blockentities/CommandBlockHandler.java @@ -17,10 +17,10 @@ */ package com.viaversion.viaversion.protocols.v1_12_2to1_13.provider.blockentities; -import com.viaversion.nbt.tag.CompoundTag; -import com.viaversion.nbt.tag.StringTag; import com.google.gson.JsonElement; import com.google.gson.JsonParser; +import com.viaversion.nbt.tag.CompoundTag; +import com.viaversion.nbt.tag.StringTag; import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.protocols.v1_12_2to1_13.Protocol1_12_2To1_13; diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/rewriter/EntityPacketRewriter1_13.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/rewriter/EntityPacketRewriter1_13.java index ba4c4544e..aba8963f2 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/rewriter/EntityPacketRewriter1_13.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/rewriter/EntityPacketRewriter1_13.java @@ -22,7 +22,7 @@ import com.viaversion.viaversion.api.minecraft.ClientWorld; import com.viaversion.viaversion.api.minecraft.Particle; import com.viaversion.viaversion.api.minecraft.entities.EntityType; import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_13; -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.api.type.types.version.Types1_12; @@ -102,9 +102,9 @@ public class EntityPacketRewriter1_13 extends EntityRewriter Types1_13.META_TYPES.byId(typeId > 4 ? typeId + 1 : typeId)); - filter().metaType(Types1_13.META_TYPES.itemType).handler(((event, meta) -> protocol.getItemRewriter().handleItemToClient(event.user(), meta.value()))); - filter().metaType(Types1_13.META_TYPES.optionalBlockStateType).handler(((event, meta) -> { + filter().mapDataType(typeId -> Types1_13.ENTITY_DATA_TYPES.byId(typeId > 4 ? typeId + 1 : typeId)); + filter().dataType(Types1_13.ENTITY_DATA_TYPES.itemType).handler(((event, meta) -> protocol.getItemRewriter().handleItemToClient(event.user(), meta.value()))); + filter().dataType(Types1_13.ENTITY_DATA_TYPES.optionalBlockStateType).handler(((event, meta) -> { final int oldId = meta.value(); if (oldId != 0) { final int combined = (((oldId & 4095) << 4) | (oldId >> 12 & 15)); @@ -182,9 +182,9 @@ public class EntityPacketRewriter1_13 extends EntityRewriter { if (meta.getValue() != null && !((String) meta.getValue()).isEmpty()) { - meta.setTypeAndValue(Types1_13.META_TYPES.optionalComponentType, ComponentUtil.legacyToJson((String) meta.getValue())); + meta.setTypeAndValue(Types1_13.ENTITY_DATA_TYPES.optionalComponentType, ComponentUtil.legacyToJson((String) meta.getValue())); } else { - meta.setTypeAndValue(Types1_13.META_TYPES.optionalComponentType, null); + meta.setTypeAndValue(Types1_13.ENTITY_DATA_TYPES.optionalComponentType, null); } })); @@ -205,14 +205,14 @@ public class EntityPacketRewriter1_13 extends EntityRewriter { if (meta.id() == 9) { int particleId = meta.value(); - Metadata parameter1Meta = event.metaAtIndex(10); - Metadata parameter2Meta = event.metaAtIndex(11); + EntityData parameter1Meta = event.dataAtIndex(10); + EntityData parameter2Meta = event.dataAtIndex(11); int parameter1 = parameter1Meta != null ? parameter1Meta.value() : 0; int parameter2 = parameter2Meta != null ? parameter2Meta.value() : 0; Particle particle = ParticleRewriter.rewriteParticle(particleId, new Integer[]{parameter1, parameter2}); if (particle != null && particle.id() != -1) { - event.createExtraMeta(new Metadata(9, Types1_13.META_TYPES.particleType, particle)); + event.createExtraData(new EntityData(9, Types1_13.ENTITY_DATA_TYPES.particleType, particle)); } } if (meta.id() >= 9) { diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/rewriter/ItemPacketRewriter1_13.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/rewriter/ItemPacketRewriter1_13.java index f0cb58aa2..af0e679f1 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/rewriter/ItemPacketRewriter1_13.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/rewriter/ItemPacketRewriter1_13.java @@ -17,33 +17,31 @@ */ package com.viaversion.viaversion.protocols.v1_12_2to1_13.rewriter; +import com.google.common.base.Joiner; +import com.google.common.primitives.Ints; import com.viaversion.nbt.tag.CompoundTag; import com.viaversion.nbt.tag.IntTag; import com.viaversion.nbt.tag.ListTag; import com.viaversion.nbt.tag.NumberTag; import com.viaversion.nbt.tag.StringTag; import com.viaversion.nbt.tag.Tag; -import com.google.common.base.Joiner; -import com.google.common.primitives.Ints; import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.minecraft.item.Item; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.type.Types; -import com.viaversion.viaversion.protocols.v1_11_1to1_12.Protocol1_11_1To1_12; -import com.viaversion.viaversion.protocols.v1_12_2to1_13.packet.ClientboundPackets1_13; -import com.viaversion.viaversion.protocols.v1_12_2to1_13.packet.ServerboundPackets1_13; -import com.viaversion.viaversion.protocols.v1_12to1_12_1.packet.ClientboundPackets1_12_1; import com.viaversion.viaversion.protocols.v1_12_2to1_13.Protocol1_12_2To1_13; import com.viaversion.viaversion.protocols.v1_12_2to1_13.data.BlockIdData; import com.viaversion.viaversion.protocols.v1_12_2to1_13.data.MappingData1_13; import com.viaversion.viaversion.protocols.v1_12_2to1_13.data.SoundSource; import com.viaversion.viaversion.protocols.v1_12_2to1_13.data.SpawnEggRewriter; +import com.viaversion.viaversion.protocols.v1_12_2to1_13.packet.ClientboundPackets1_13; +import com.viaversion.viaversion.protocols.v1_12_2to1_13.packet.ServerboundPackets1_13; +import com.viaversion.viaversion.protocols.v1_12to1_12_1.packet.ClientboundPackets1_12_1; import com.viaversion.viaversion.rewriter.ItemRewriter; import com.viaversion.viaversion.util.ComponentUtil; import com.viaversion.viaversion.util.IdAndData; import com.viaversion.viaversion.util.Key; - import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; @@ -672,8 +670,8 @@ public class ItemPacketRewriter1_13 extends ItemRewriter= 256 && id <= 259 // iron shovel, pickaxe, axe, flint and steel - || id == 261 // bow - || id >= 267 && id <= 279 // iron sword, wooden+stone+diamond swords, shovels, pickaxes, axes - || id >= 283 && id <= 286 // gold sword, shovel, pickaxe, axe - || id >= 290 && id <= 294 // hoes - || id >= 298 && id <= 317 // armors - || id == 346 // fishing rod - || id == 359 // shears - || id == 398 // carrot on a stick - || id == 442 // shield - || id == 443; // elytra + || id == 261 // bow + || id >= 267 && id <= 279 // iron sword, wooden+stone+diamond swords, shovels, pickaxes, axes + || id >= 283 && id <= 286 // gold sword, shovel, pickaxe, axe + || id >= 290 && id <= 294 // hoes + || id >= 298 && id <= 317 // armors + || id == 346 // fishing rod + || id == 359 // shears + || id == 398 // carrot on a stick + || id == 442 // shield + || id == 443; // elytra } } \ No newline at end of file diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/rewriter/WorldPacketRewriter1_13.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/rewriter/WorldPacketRewriter1_13.java index a81e6746a..4a82fbbd3 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/rewriter/WorldPacketRewriter1_13.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/rewriter/WorldPacketRewriter1_13.java @@ -213,9 +213,9 @@ public class WorldPacketRewriter1_13 { for (BlockChangeRecord record : records) { int newBlock = toNewId(record.getBlockId()); Position position = new Position( - record.getSectionX() + (chunkX << 4), - record.getY(), - record.getSectionZ() + (chunkZ << 4)); + record.getSectionX() + (chunkX << 4), + record.getY(), + record.getSectionZ() + (chunkZ << 4)); record.setBlockId(checkStorage(wrapper.user(), position, newBlock)); if (Via.getConfig().isServersideBlockConnections()) { @@ -228,9 +228,9 @@ public class WorldPacketRewriter1_13 { int blockState = record.getBlockId(); Position position = new Position( - record.getSectionX() + (chunkX * 16), - record.getY(), - record.getSectionZ() + (chunkZ * 16)); + record.getSectionX() + (chunkX * 16), + record.getY(), + record.getSectionZ() + (chunkZ * 16)); ConnectionHandler handler = ConnectionData.getConnectionHandler(blockState); if (handler != null) { @@ -246,9 +246,9 @@ public class WorldPacketRewriter1_13 { for (BlockChangeRecord record : records) { Position position = new Position( - record.getSectionX() + (chunkX * 16), - record.getY(), - record.getSectionZ() + (chunkZ * 16)); + record.getSectionX() + (chunkX * 16), + record.getY(), + record.getSectionZ() + (chunkZ * 16)); ConnectionData.update(userConnection, position); } } @@ -279,9 +279,9 @@ public class WorldPacketRewriter1_13 { for (int i = 0; i < recordCount; i++) { Position position = new Position( - x + wrapper.passthrough(Types.BYTE), - (short) (y + wrapper.passthrough(Types.BYTE)), - z + wrapper.passthrough(Types.BYTE)); + x + wrapper.passthrough(Types.BYTE), + (short) (y + wrapper.passthrough(Types.BYTE)), + z + wrapper.passthrough(Types.BYTE)); records[i] = position; // Set to air @@ -407,7 +407,7 @@ public class WorldPacketRewriter1_13 { int biome = chunk.getBiomeData()[i]; if (!VALID_BIOMES.contains(biome)) { if (biome != 255 // is it generated naturally? *shrug* - && latestBiomeWarn != biome) { + && latestBiomeWarn != biome) { if (!Via.getConfig().isSuppressConversionWarnings()) { Protocol1_12_2To1_13.LOGGER.warning("Received invalid biome id: " + biome); } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/storage/TabCompleteTracker.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/storage/TabCompleteTracker.java index 2f98b5c34..2aa091997 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/storage/TabCompleteTracker.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_12_2to1_13/storage/TabCompleteTracker.java @@ -22,7 +22,6 @@ import com.viaversion.viaversion.api.connection.StorableObject; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.minecraft.Position; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.protocols.v1_12_2to1_13.Protocol1_12_2To1_13; import com.viaversion.viaversion.protocols.v1_12_2to1_13.provider.PlayerLookTargetProvider; diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_13_1to1_13_2/Protocol1_13_1To1_13_2.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_13_1to1_13_2/Protocol1_13_1To1_13_2.java index 182d9fc3d..7ed5710ef 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_13_1to1_13_2/Protocol1_13_1To1_13_2.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_13_1to1_13_2/Protocol1_13_1To1_13_2.java @@ -20,7 +20,6 @@ package com.viaversion.viaversion.protocols.v1_13_1to1_13_2; import com.viaversion.viaversion.api.minecraft.item.Item; import com.viaversion.viaversion.api.protocol.AbstractProtocol; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.protocols.v1_12_2to1_13.packet.ClientboundPackets1_13; import com.viaversion.viaversion.protocols.v1_12_2to1_13.packet.ServerboundPackets1_13; diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_13_1to1_13_2/rewriter/EntityPacketRewriter1_13_2.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_13_1to1_13_2/rewriter/EntityPacketRewriter1_13_2.java index 91173f434..44b00d98f 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_13_1to1_13_2/rewriter/EntityPacketRewriter1_13_2.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_13_1to1_13_2/rewriter/EntityPacketRewriter1_13_2.java @@ -17,10 +17,9 @@ */ package com.viaversion.viaversion.protocols.v1_13_1to1_13_2.rewriter; -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; import com.viaversion.viaversion.api.protocol.remapper.PacketHandler; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.api.type.types.version.Types1_13; import com.viaversion.viaversion.api.type.types.version.Types1_13_2; @@ -31,8 +30,8 @@ public class EntityPacketRewriter1_13_2 { public static void register(Protocol1_13_1To1_13_2 protocol) { final PacketHandler metaTypeHandler = wrapper -> { - for (Metadata metadata : wrapper.get(Types1_13_2.METADATA_LIST, 0)) { - metadata.setMetaType(Types1_13_2.META_TYPES.byId(metadata.metaType().typeId())); + for (EntityData metadata : wrapper.get(Types1_13_2.ENTITY_DATA_LIST, 0)) { + metadata.setDataType(Types1_13_2.ENTITY_DATA_TYPES.byId(metadata.dataType().typeId())); } }; @@ -51,7 +50,7 @@ public class EntityPacketRewriter1_13_2 { map(Types.SHORT); // 9 - Velocity X map(Types.SHORT); // 10 - Velocity Y map(Types.SHORT); // 11 - Velocity Z - map(Types1_13.METADATA_LIST, Types1_13_2.METADATA_LIST); // 12 - Metadata + map(Types1_13.ENTITY_DATA_LIST, Types1_13_2.ENTITY_DATA_LIST); // 12 - Metadata handler(metaTypeHandler); } @@ -67,7 +66,7 @@ public class EntityPacketRewriter1_13_2 { map(Types.DOUBLE); // 4 - Z map(Types.BYTE); // 5 - Yaw map(Types.BYTE); // 6 - Pitch - map(Types1_13.METADATA_LIST, Types1_13_2.METADATA_LIST); // 7 - Metadata + map(Types1_13.ENTITY_DATA_LIST, Types1_13_2.ENTITY_DATA_LIST); // 7 - Metadata handler(metaTypeHandler); } @@ -77,7 +76,7 @@ public class EntityPacketRewriter1_13_2 { @Override public void register() { map(Types.VAR_INT); // 0 - Entity ID - map(Types1_13.METADATA_LIST, Types1_13_2.METADATA_LIST); // 1 - Metadata list + map(Types1_13.ENTITY_DATA_LIST, Types1_13_2.ENTITY_DATA_LIST); // 1 - Metadata list handler(metaTypeHandler); } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_13_1to1_13_2/rewriter/ItemPacketRewriter1_13_2.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_13_1to1_13_2/rewriter/ItemPacketRewriter1_13_2.java index 12bafb901..940d66fc4 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_13_1to1_13_2/rewriter/ItemPacketRewriter1_13_2.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_13_1to1_13_2/rewriter/ItemPacketRewriter1_13_2.java @@ -18,7 +18,6 @@ package com.viaversion.viaversion.protocols.v1_13_1to1_13_2.rewriter; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.protocols.v1_12_2to1_13.packet.ClientboundPackets1_13; import com.viaversion.viaversion.protocols.v1_12_2to1_13.packet.ServerboundPackets1_13; diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_13_1to1_13_2/rewriter/WorldPacketRewriter1_13_2.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_13_1to1_13_2/rewriter/WorldPacketRewriter1_13_2.java index 801fb8b87..732c69db9 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_13_1to1_13_2/rewriter/WorldPacketRewriter1_13_2.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_13_1to1_13_2/rewriter/WorldPacketRewriter1_13_2.java @@ -18,7 +18,6 @@ package com.viaversion.viaversion.protocols.v1_13_1to1_13_2.rewriter; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.protocols.v1_12_2to1_13.packet.ClientboundPackets1_13; import com.viaversion.viaversion.protocols.v1_13_1to1_13_2.Protocol1_13_1To1_13_2; diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_13_2to1_14/Protocol1_13_2To1_14.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_13_2to1_14/Protocol1_13_2To1_14.java index f7bff9639..a84a682ae 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_13_2to1_14/Protocol1_13_2To1_14.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_13_2to1_14/Protocol1_13_2To1_14.java @@ -29,9 +29,9 @@ import com.viaversion.viaversion.protocols.v1_12_2to1_13.packet.ClientboundPacke import com.viaversion.viaversion.protocols.v1_12_2to1_13.packet.ServerboundPackets1_13; import com.viaversion.viaversion.protocols.v1_13_2to1_14.data.ComponentRewriter1_14; import com.viaversion.viaversion.protocols.v1_13_2to1_14.data.MappingData1_14; -import com.viaversion.viaversion.protocols.v1_13_2to1_14.rewriter.EntityPacketRewriter1_14; import com.viaversion.viaversion.protocols.v1_13_2to1_14.packet.ClientboundPackets1_14; import com.viaversion.viaversion.protocols.v1_13_2to1_14.packet.ServerboundPackets1_14; +import com.viaversion.viaversion.protocols.v1_13_2to1_14.rewriter.EntityPacketRewriter1_14; import com.viaversion.viaversion.protocols.v1_13_2to1_14.rewriter.ItemPacketRewriter1_14; import com.viaversion.viaversion.protocols.v1_13_2to1_14.rewriter.PlayerPacketRewriter1_14; import com.viaversion.viaversion.protocols.v1_13_2to1_14.rewriter.WorldPacketRewriter1_14; @@ -89,15 +89,15 @@ public class Protocol1_13_2To1_14 extends AbstractProtocol metadataList = new LinkedList<>(); + List metadataList = new LinkedList<>(); if (tracker.clientEntityId() != entityId) { - metadataList.add(new Metadata(6, Types1_14.META_TYPES.poseType, EntityPacketRewriter1_14.recalculatePlayerPose(entityId, tracker))); + metadataList.add(new EntityData(6, Types1_14.ENTITY_DATA_TYPES.poseType, EntityPacketRewriter1_14.recalculatePlayerPose(entityId, tracker))); } - metadataList.add(new Metadata(12, Types1_14.META_TYPES.optionalBlockPositionType, null)); - metadataPacket.write(Types1_14.METADATA_LIST, metadataList); + metadataList.add(new EntityData(12, Types1_14.ENTITY_DATA_TYPES.optionalBlockPositionType, null)); + metadataPacket.write(Types1_14.ENTITY_DATA_LIST, metadataList); metadataPacket.scheduleSend(Protocol1_13_2To1_14.class); } }); @@ -242,24 +242,24 @@ public class EntityPacketRewriter1_14 extends EntityRewriter metadataList = new LinkedList<>(); - metadataList.add(new Metadata(12, Types1_14.META_TYPES.optionalBlockPositionType, position)); + List metadataList = new LinkedList<>(); + metadataList.add(new EntityData(12, Types1_14.ENTITY_DATA_TYPES.optionalBlockPositionType, position)); if (tracker.clientEntityId() != entityId) { - metadataList.add(new Metadata(6, Types1_14.META_TYPES.poseType, EntityPacketRewriter1_14.recalculatePlayerPose(entityId, tracker))); + metadataList.add(new EntityData(6, Types1_14.ENTITY_DATA_TYPES.poseType, EntityPacketRewriter1_14.recalculatePlayerPose(entityId, tracker))); } - wrapper.write(Types1_14.METADATA_LIST, metadataList); + wrapper.write(Types1_14.ENTITY_DATA_LIST, metadataList); }); } }); registerRemoveEntities(ClientboundPackets1_13.REMOVE_ENTITIES); - registerMetadataRewriter(ClientboundPackets1_13.SET_ENTITY_DATA, Types1_13_2.METADATA_LIST, Types1_14.METADATA_LIST); + registerSetEntityData(ClientboundPackets1_13.SET_ENTITY_DATA, Types1_13_2.ENTITY_DATA_LIST, Types1_14.ENTITY_DATA_LIST); } @Override protected void registerRewrites() { - filter().mapMetaType(Types1_14.META_TYPES::byId); - registerMetaTypeHandler(Types1_14.META_TYPES.itemType, Types1_14.META_TYPES.optionalBlockStateType, Types1_14.META_TYPES.particleType); + filter().mapDataType(Types1_14.ENTITY_DATA_TYPES::byId); + registerEntityDataTypeHandler(Types1_14.ENTITY_DATA_TYPES.itemType, Types1_14.ENTITY_DATA_TYPES.optionalBlockStateType, Types1_14.ENTITY_DATA_TYPES.particleType); filter().type(EntityTypes1_14.ENTITY).addIndex(6); filter().type(EntityTypes1_14.LIVING_ENTITY).addIndex(12); @@ -291,7 +291,7 @@ public class EntityPacketRewriter1_14 extends EntityRewriter 16) { meta.setId(meta.id() - 1); @@ -339,17 +339,17 @@ public class EntityPacketRewriter1_14 extends EntityRewriter { - meta.setTypeAndValue(Types1_14.META_TYPES.villagerDatatType, new VillagerData(2, getNewProfessionId(meta.value()), 0)); + meta.setTypeAndValue(Types1_14.ENTITY_DATA_TYPES.villagerDatatType, new VillagerData(2, getNewProfessionId(meta.value()), 0)); }); filter().type(EntityTypes1_14.ZOMBIE_VILLAGER).index(18).handler((event, meta) -> { - meta.setTypeAndValue(Types1_14.META_TYPES.villagerDatatType, new VillagerData(2, getNewProfessionId(meta.value()), 0)); + meta.setTypeAndValue(Types1_14.ENTITY_DATA_TYPES.villagerDatatType, new VillagerData(2, getNewProfessionId(meta.value()), 0)); }); filter().type(EntityTypes1_14.ABSTRACT_ARROW).addIndex(9); // Piercing level added filter().type(EntityTypes1_14.FIREWORK_ROCKET).index(8).handler((event, meta) -> { - meta.setMetaType(Types1_14.META_TYPES.optionalVarIntType); + meta.setDataType(Types1_14.ENTITY_DATA_TYPES.optionalVarIntType); if (meta.getValue().equals(0)) { meta.setValue(null); // https://bugs.mojang.com/browse/MC-111480 } @@ -360,7 +360,7 @@ public class EntityPacketRewriter1_14 extends EntityRewriter 14) { meta.setId(meta.id() - 1); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_13_2to1_14/rewriter/ItemPacketRewriter1_14.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_13_2to1_14/rewriter/ItemPacketRewriter1_14.java index 1d43d0db4..1ee24a025 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_13_2to1_14/rewriter/ItemPacketRewriter1_14.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_13_2to1_14/rewriter/ItemPacketRewriter1_14.java @@ -17,14 +17,14 @@ */ package com.viaversion.viaversion.protocols.v1_13_2to1_14.rewriter; +import com.google.common.collect.Sets; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.viaversion.nbt.tag.CompoundTag; import com.viaversion.nbt.tag.DoubleTag; import com.viaversion.nbt.tag.ListTag; import com.viaversion.nbt.tag.StringTag; import com.viaversion.nbt.tag.Tag; -import com.google.common.collect.Sets; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.minecraft.item.DataItem; import com.viaversion.viaversion.api.minecraft.item.Item; @@ -42,7 +42,6 @@ import com.viaversion.viaversion.rewriter.ItemRewriter; import com.viaversion.viaversion.rewriter.RecipeRewriter; import com.viaversion.viaversion.util.ComponentUtil; import com.viaversion.viaversion.util.Key; - import java.util.Set; import java.util.concurrent.ThreadLocalRandom; @@ -65,7 +64,7 @@ public class ItemPacketRewriter1_14 extends ItemRewriter { @@ -134,7 +133,7 @@ public class ItemPacketRewriter1_14 extends ItemRewriter recipeRewriter = new RecipeRewriter<>(protocol); protocol.registerClientbound(ClientboundPackets1_13.UPDATE_RECIPES, wrapper -> { @@ -210,7 +209,7 @@ public class ItemPacketRewriter1_14 extends ItemRewriter { // Selecting trade now moves the items, we need to resync the inventory @@ -227,9 +226,9 @@ public class ItemPacketRewriter1_14 extends ItemRewriter= SERVERSIDE_VIEW_DISTANCE - || diffZ >= SERVERSIDE_VIEW_DISTANCE) { + || diffX >= SERVERSIDE_VIEW_DISTANCE + || diffZ >= SERVERSIDE_VIEW_DISTANCE) { PacketWrapper fakePosLook = wrapper.create(ClientboundPackets1_14.SET_CHUNK_CACHE_CENTER); // Set center chunk fakePosLook.write(Types.VAR_INT, chunk.getX()); fakePosLook.write(Types.VAR_INT, chunk.getZ()); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_13to1_13_1/rewriter/EntityPacketRewriter1_13_1.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_13to1_13_1/rewriter/EntityPacketRewriter1_13_1.java index eb4d7d0ae..e5410847e 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_13to1_13_1/rewriter/EntityPacketRewriter1_13_1.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_13to1_13_1/rewriter/EntityPacketRewriter1_13_1.java @@ -80,9 +80,9 @@ public class EntityPacketRewriter1_13_1 extends EntityRewriter { + registerEntityDataTypeHandler(Types1_13.ENTITY_DATA_TYPES.itemType, Types1_13.ENTITY_DATA_TYPES.optionalBlockStateType, Types1_13.ENTITY_DATA_TYPES.particleType); + filter().type(EntityTypes1_13.EntityType.ABSTRACT_MINECART).index(9).handler((event, meta) -> { int data = meta.value(); meta.setValue(protocol.getMappingData().getNewBlockStateId(data)); }); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_13to1_13_1/rewriter/ItemPacketRewriter1_13_1.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_13to1_13_1/rewriter/ItemPacketRewriter1_13_1.java index 0b520e980..748a43d44 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_13to1_13_1/rewriter/ItemPacketRewriter1_13_1.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_13to1_13_1/rewriter/ItemPacketRewriter1_13_1.java @@ -37,9 +37,9 @@ public class ItemPacketRewriter1_13_1 extends ItemRewriter recipeRewriter = new RecipeRewriter<>(protocol) { @Override @@ -95,9 +95,9 @@ public class ItemPacketRewriter1_13_1 extends ItemRewriter { int data = meta.value(); meta.setValue(protocol.getMappingData().getNewBlockStateId(data)); @@ -127,7 +127,7 @@ public class EntityPacketRewriter1_15 extends EntityRewriter metadata = wrapper.read(Types1_14.METADATA_LIST); + List metadata = wrapper.read(Types1_14.ENTITY_DATA_LIST); if (metadata.isEmpty()) { return; } @@ -137,11 +137,11 @@ public class EntityPacketRewriter1_15 extends EntityRewriter(protocol).register(ClientboundPackets1_14_4.UPDATE_RECIPES); - registerClickWindow(ServerboundPackets1_14.CONTAINER_CLICK); - registerCreativeInvAction(ServerboundPackets1_14.SET_CREATIVE_MODE_SLOT); + registerContainerClick(ServerboundPackets1_14.CONTAINER_CLICK); + registerSetCreativeModeSlot(ServerboundPackets1_14.SET_CREATIVE_MODE_SLOT); } } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_14_4to1_15/rewriter/WorldPacketRewriter1_15.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_14_4to1_15/rewriter/WorldPacketRewriter1_15.java index b085ff6f6..cf6ab0b7b 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_14_4to1_15/rewriter/WorldPacketRewriter1_15.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_14_4to1_15/rewriter/WorldPacketRewriter1_15.java @@ -22,7 +22,6 @@ import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection; import com.viaversion.viaversion.api.minecraft.chunks.DataPalette; import com.viaversion.viaversion.api.minecraft.chunks.PaletteType; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_14; import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_15; @@ -35,10 +34,10 @@ public final class WorldPacketRewriter1_15 { public static void register(Protocol1_14_4To1_15 protocol) { BlockRewriter blockRewriter = BlockRewriter.for1_14(protocol); - blockRewriter.registerBlockAction(ClientboundPackets1_14_4.BLOCK_EVENT); - blockRewriter.registerBlockChange(ClientboundPackets1_14_4.BLOCK_UPDATE); - blockRewriter.registerMultiBlockChange(ClientboundPackets1_14_4.CHUNK_BLOCKS_UPDATE); - blockRewriter.registerAcknowledgePlayerDigging(ClientboundPackets1_14_4.BLOCK_BREAK_ACK); + blockRewriter.registerBlockEvent(ClientboundPackets1_14_4.BLOCK_EVENT); + blockRewriter.registerBlockUpdate(ClientboundPackets1_14_4.BLOCK_UPDATE); + blockRewriter.registerChunkBlocksUpdate(ClientboundPackets1_14_4.CHUNK_BLOCKS_UPDATE); + blockRewriter.registerBlockBreakAck(ClientboundPackets1_14_4.BLOCK_BREAK_ACK); protocol.registerClientbound(ClientboundPackets1_14_4.LEVEL_CHUNK, wrapper -> { Chunk chunk = wrapper.read(ChunkType1_14.TYPE); @@ -80,7 +79,7 @@ public final class WorldPacketRewriter1_15 { } }); - blockRewriter.registerEffect(ClientboundPackets1_14_4.LEVEL_EVENT, 1010, 2001); + blockRewriter.registerLevelEvent(ClientboundPackets1_14_4.LEVEL_EVENT, 1010, 2001); protocol.registerClientbound(ClientboundPackets1_14_4.LEVEL_PARTICLES, new PacketHandlers() { @Override public void register() { diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_14to1_14_1/rewriter/EntityPacketRewriter1_14_1.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_14to1_14_1/rewriter/EntityPacketRewriter1_14_1.java index c71b97775..9ec862efa 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_14to1_14_1/rewriter/EntityPacketRewriter1_14_1.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_14to1_14_1/rewriter/EntityPacketRewriter1_14_1.java @@ -49,9 +49,9 @@ public class EntityPacketRewriter1_14_1 extends EntityRewriter soundRewriter = new SoundRewriter<>(this); soundRewriter.registerSound(ClientboundPackets1_15.SOUND); @@ -250,19 +249,19 @@ public class Protocol1_15_2To1_16 extends AbstractProtocol { @@ -108,7 +107,7 @@ public class EntityPacketRewriter1_16 extends EntityRewriter { int data = meta.value(); meta.setValue(protocol.getMappingData().getNewBlockStateId(data)); @@ -217,7 +216,7 @@ public class EntityPacketRewriter1_16 extends EntityRewriter { byte mask = meta.value(); int angerTime = (mask & 0x02) != 0 ? Integer.MAX_VALUE : 0; - event.createExtraMeta(new Metadata(20, Types1_16.META_TYPES.varIntType, angerTime)); + event.createExtraData(new EntityData(20, Types1_16.ENTITY_DATA_TYPES.varIntType, angerTime)); }); } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_15_2to1_16/rewriter/ItemPacketRewriter1_16.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_15_2to1_16/rewriter/ItemPacketRewriter1_16.java index 3359a92f3..3aa17a679 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_15_2to1_16/rewriter/ItemPacketRewriter1_16.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_15_2to1_16/rewriter/ItemPacketRewriter1_16.java @@ -106,9 +106,9 @@ public class ItemPacketRewriter1_16 extends ItemRewriter(protocol).register(ClientboundPackets1_15.UPDATE_RECIPES); - registerClickWindow(ServerboundPackets1_16.CONTAINER_CLICK); - registerCreativeInvAction(ServerboundPackets1_16.SET_CREATIVE_MODE_SLOT); + registerContainerClick(ServerboundPackets1_16.CONTAINER_CLICK); + registerSetCreativeModeSlot(ServerboundPackets1_16.SET_CREATIVE_MODE_SLOT); protocol.registerServerbound(ServerboundPackets1_16.CONTAINER_CLOSE, wrapper -> { InventoryTracker1_16 inventoryTracker = wrapper.user().get(InventoryTracker1_16.class); @@ -137,7 +137,7 @@ public class ItemPacketRewriter1_16 extends ItemRewriter handleItemToServer(wrapper.user(), wrapper.passthrough(Types.ITEM1_13_2))); - registerSpawnParticle(ClientboundPackets1_15.LEVEL_PARTICLES, Types.DOUBLE); + registerLevelParticles(ClientboundPackets1_15.LEVEL_PARTICLES, Types.DOUBLE); } @Override @@ -240,7 +240,7 @@ public class ItemPacketRewriter1_16 extends ItemRewriter blockRewriter = BlockRewriter.for1_14(protocol); - blockRewriter.registerBlockAction(ClientboundPackets1_15.BLOCK_EVENT); - blockRewriter.registerBlockChange(ClientboundPackets1_15.BLOCK_UPDATE); - blockRewriter.registerMultiBlockChange(ClientboundPackets1_15.CHUNK_BLOCKS_UPDATE); - blockRewriter.registerAcknowledgePlayerDigging(ClientboundPackets1_15.BLOCK_BREAK_ACK); + blockRewriter.registerBlockEvent(ClientboundPackets1_15.BLOCK_EVENT); + blockRewriter.registerBlockUpdate(ClientboundPackets1_15.BLOCK_UPDATE); + blockRewriter.registerChunkBlocksUpdate(ClientboundPackets1_15.CHUNK_BLOCKS_UPDATE); + blockRewriter.registerBlockBreakAck(ClientboundPackets1_15.BLOCK_BREAK_ACK); protocol.registerClientbound(ClientboundPackets1_15.LIGHT_UPDATE, new PacketHandlers() { @Override @@ -101,7 +100,7 @@ public class WorldPacketRewriter1_16 { handleBlockEntity(protocol, wrapper.user(), tag); }); - blockRewriter.registerEffect(ClientboundPackets1_15.LEVEL_EVENT, 1010, 2001); + blockRewriter.registerLevelEvent(ClientboundPackets1_15.LEVEL_EVENT, 1010, 2001); } private static void handleBlockEntity(Protocol1_15_2To1_16 protocol, UserConnection connection, CompoundTag compoundTag) { diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_16_1to1_16_2/rewriter/EntityPacketRewriter1_16_2.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_16_1to1_16_2/rewriter/EntityPacketRewriter1_16_2.java index 07572a358..2b47d8aec 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_16_1to1_16_2/rewriter/EntityPacketRewriter1_16_2.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_16_1to1_16_2/rewriter/EntityPacketRewriter1_16_2.java @@ -38,7 +38,7 @@ public class EntityPacketRewriter1_16_2 extends EntityRewriter { int data = meta.value(); meta.setValue(protocol.getMappingData().getNewBlockStateId(data)); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_16_1to1_16_2/rewriter/ItemPacketRewriter1_16_2.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_16_1to1_16_2/rewriter/ItemPacketRewriter1_16_2.java index bf1a4e243..88c872d0d 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_16_1to1_16_2/rewriter/ItemPacketRewriter1_16_2.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_16_1to1_16_2/rewriter/ItemPacketRewriter1_16_2.java @@ -17,7 +17,6 @@ */ package com.viaversion.viaversion.protocols.v1_16_1to1_16_2.rewriter; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.protocols.v1_15_2to1_16.packet.ClientboundPackets1_16; import com.viaversion.viaversion.protocols.v1_16_1to1_16_2.Protocol1_16_1To1_16_2; @@ -33,11 +32,11 @@ public class ItemPacketRewriter1_16_2 extends ItemRewriter { @@ -55,10 +54,10 @@ public class ItemPacketRewriter1_16_2 extends ItemRewriter(protocol).register(ClientboundPackets1_16.UPDATE_RECIPES); - registerClickWindow(ServerboundPackets1_16_2.CONTAINER_CLICK); - registerCreativeInvAction(ServerboundPackets1_16_2.SET_CREATIVE_MODE_SLOT); + registerContainerClick(ServerboundPackets1_16_2.CONTAINER_CLICK); + registerSetCreativeModeSlot(ServerboundPackets1_16_2.SET_CREATIVE_MODE_SLOT); protocol.registerServerbound(ServerboundPackets1_16_2.EDIT_BOOK, wrapper -> handleItemToServer(wrapper.user(), wrapper.passthrough(Types.ITEM1_13_2))); - registerSpawnParticle(ClientboundPackets1_16.LEVEL_PARTICLES, Types.DOUBLE); + registerLevelParticles(ClientboundPackets1_16.LEVEL_PARTICLES, Types.DOUBLE); } } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_16_1to1_16_2/rewriter/WorldPacketRewriter1_16_2.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_16_1to1_16_2/rewriter/WorldPacketRewriter1_16_2.java index a4f6bcfef..a278372b8 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_16_1to1_16_2/rewriter/WorldPacketRewriter1_16_2.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_16_1to1_16_2/rewriter/WorldPacketRewriter1_16_2.java @@ -42,9 +42,9 @@ public class WorldPacketRewriter1_16_2 { public static void register(Protocol1_16_1To1_16_2 protocol) { BlockRewriter blockRewriter = BlockRewriter.for1_14(protocol); - blockRewriter.registerBlockAction(ClientboundPackets1_16.BLOCK_EVENT); - blockRewriter.registerBlockChange(ClientboundPackets1_16.BLOCK_UPDATE); - blockRewriter.registerAcknowledgePlayerDigging(ClientboundPackets1_16.BLOCK_BREAK_ACK); + blockRewriter.registerBlockEvent(ClientboundPackets1_16.BLOCK_EVENT); + blockRewriter.registerBlockUpdate(ClientboundPackets1_16.BLOCK_UPDATE); + blockRewriter.registerBlockBreakAck(ClientboundPackets1_16.BLOCK_BREAK_ACK); protocol.registerClientbound(ClientboundPackets1_16.LEVEL_CHUNK, wrapper -> { Chunk chunk = wrapper.read(ChunkType1_16.TYPE); @@ -101,6 +101,6 @@ public class WorldPacketRewriter1_16_2 { } }); - blockRewriter.registerEffect(ClientboundPackets1_16.LEVEL_EVENT, 1010, 2001); + blockRewriter.registerLevelEvent(ClientboundPackets1_16.LEVEL_EVENT, 1010, 2001); } } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_16_4to1_17/Protocol1_16_4To1_17.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_16_4to1_17/Protocol1_16_4To1_17.java index c9d3d392d..78b8d9cd0 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_16_4to1_17/Protocol1_16_4To1_17.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_16_4to1_17/Protocol1_16_4To1_17.java @@ -26,7 +26,6 @@ import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_17; import com.viaversion.viaversion.api.protocol.AbstractProtocol; import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.api.type.types.misc.ParticleType; import com.viaversion.viaversion.api.type.types.version.Types1_17; @@ -176,26 +175,26 @@ public final class Protocol1_16_4To1_17 extends AbstractProtocol { int[] entityIds = wrapper.read(Types.VAR_INT_ARRAY_PRIMITIVE); @@ -136,15 +135,15 @@ public final class EntityPacketRewriter1_17 extends EntityRewriter { + filter().mapDataType(Types1_17.ENTITY_DATA_TYPES::byId); + filter().dataType(Types1_17.ENTITY_DATA_TYPES.poseType).handler((event, meta) -> { int pose = meta.value(); if (pose > 5) { // Added LONG_JUMP at 6 meta.setValue(pose + 1); } }); - registerMetaTypeHandler(Types1_17.META_TYPES.itemType, Types1_17.META_TYPES.optionalBlockStateType, Types1_17.META_TYPES.particleType); + registerEntityDataTypeHandler(Types1_17.ENTITY_DATA_TYPES.itemType, Types1_17.ENTITY_DATA_TYPES.optionalBlockStateType, Types1_17.ENTITY_DATA_TYPES.particleType); // Ticks frozen added with id 7 filter().type(EntityTypes1_17.ENTITY).addIndex(7); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_16_4to1_17/rewriter/ItemPacketRewriter1_17.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_16_4to1_17/rewriter/ItemPacketRewriter1_17.java index 6e905df79..27d39f7f4 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_16_4to1_17/rewriter/ItemPacketRewriter1_17.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_16_4to1_17/rewriter/ItemPacketRewriter1_17.java @@ -23,7 +23,6 @@ import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.minecraft.item.Item; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.protocols.v1_16_1to1_16_2.packet.ClientboundPackets1_16_2; import com.viaversion.viaversion.protocols.v1_16_1to1_16_2.packet.ServerboundPackets1_16_2; @@ -42,17 +41,17 @@ public final class ItemPacketRewriter1_17 extends ItemRewriter(protocol).register(ClientboundPackets1_16_2.UPDATE_RECIPES); - registerCreativeInvAction(ServerboundPackets1_17.SET_CREATIVE_MODE_SLOT); + registerSetCreativeModeSlot(ServerboundPackets1_17.SET_CREATIVE_MODE_SLOT); protocol.registerServerbound(ServerboundPackets1_17.EDIT_BOOK, wrapper -> handleItemToServer(wrapper.user(), wrapper.passthrough(Types.ITEM1_13_2))); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_16_4to1_17/rewriter/WorldPacketRewriter1_17.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_16_4to1_17/rewriter/WorldPacketRewriter1_17.java index d1566e396..e9b972f6f 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_16_4to1_17/rewriter/WorldPacketRewriter1_17.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_16_4to1_17/rewriter/WorldPacketRewriter1_17.java @@ -26,7 +26,6 @@ import com.viaversion.viaversion.api.minecraft.chunks.PaletteType; import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_16_2; import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_17; @@ -43,10 +42,10 @@ public final class WorldPacketRewriter1_17 { public static void register(Protocol1_16_4To1_17 protocol) { BlockRewriter blockRewriter = BlockRewriter.for1_14(protocol); - blockRewriter.registerBlockAction(ClientboundPackets1_16_2.BLOCK_EVENT); - blockRewriter.registerBlockChange(ClientboundPackets1_16_2.BLOCK_UPDATE); - blockRewriter.registerVarLongMultiBlockChange(ClientboundPackets1_16_2.SECTION_BLOCKS_UPDATE); - blockRewriter.registerAcknowledgePlayerDigging(ClientboundPackets1_16_2.BLOCK_BREAK_ACK); + blockRewriter.registerBlockEvent(ClientboundPackets1_16_2.BLOCK_EVENT); + blockRewriter.registerBlockUpdate(ClientboundPackets1_16_2.BLOCK_UPDATE); + blockRewriter.registerSectionBlocksUpdate(ClientboundPackets1_16_2.SECTION_BLOCKS_UPDATE); + blockRewriter.registerBlockBreakAck(ClientboundPackets1_16_2.BLOCK_BREAK_ACK); protocol.registerClientbound(ClientboundPackets1_16_2.SET_BORDER, null, wrapper -> { // Border packet actions have been split into individual packets (the content hasn't changed) @@ -140,7 +139,7 @@ public final class WorldPacketRewriter1_17 { } }); - blockRewriter.registerEffect(ClientboundPackets1_16_2.LEVEL_EVENT, 1010, 2001); + blockRewriter.registerLevelEvent(ClientboundPackets1_16_2.LEVEL_EVENT, 1010, 2001); } private static void writeMultiBlockChangePacket(PacketWrapper wrapper, Chunk chunk) { diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_17_1to1_18/Protocol1_17_1To1_18.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_17_1to1_18/Protocol1_17_1To1_18.java index 0ca89a5ce..d401a7e73 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_17_1to1_18/Protocol1_17_1To1_18.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_17_1to1_18/Protocol1_17_1To1_18.java @@ -64,9 +64,9 @@ public final class Protocol1_17_1To1_18 extends AbstractProtocol(this).register(ClientboundPackets1_17_1.AWARD_STATS); @@ -89,13 +89,13 @@ public final class Protocol1_17_1To1_18 extends AbstractProtocol { + filter().mapDataType(Types1_18.ENTITY_DATA_TYPES::byId); + filter().dataType(Types1_18.ENTITY_DATA_TYPES.particleType).handler((event, meta) -> { final Particle particle = (Particle) meta.getValue(); if (particle.id() == 2) { // Barrier particle.setId(3); // Block marker @@ -95,7 +94,7 @@ public final class EntityPacketRewriter1_18 extends EntityRewriter(protocol).register(ClientboundPackets1_17_1.UPDATE_RECIPES); - registerClickWindow1_17_1(ServerboundPackets1_17.CONTAINER_CLICK); - registerCreativeInvAction(ServerboundPackets1_17.SET_CREATIVE_MODE_SLOT); + registerContainerClick1_17_1(ServerboundPackets1_17.CONTAINER_CLICK); + registerSetCreativeModeSlot(ServerboundPackets1_17.SET_CREATIVE_MODE_SLOT); } } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_17_1to1_18/rewriter/WorldPacketRewriter1_18.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_17_1to1_18/rewriter/WorldPacketRewriter1_18.java index f876a557a..0e58ab616 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_17_1to1_18/rewriter/WorldPacketRewriter1_18.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_17_1to1_18/rewriter/WorldPacketRewriter1_18.java @@ -35,8 +35,8 @@ import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_17; import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_18; import com.viaversion.viaversion.protocols.v1_17_1to1_18.Protocol1_17_1To1_18; -import com.viaversion.viaversion.protocols.v1_17_1to1_18.data.BlockEntityIds1_18; import com.viaversion.viaversion.protocols.v1_17_1to1_18.data.BlockEntities1_18; +import com.viaversion.viaversion.protocols.v1_17_1to1_18.data.BlockEntityIds1_18; import com.viaversion.viaversion.protocols.v1_17_1to1_18.packet.ClientboundPackets1_18; import com.viaversion.viaversion.protocols.v1_17_1to1_18.storage.ChunkLightStorage; import com.viaversion.viaversion.protocols.v1_17to1_17_1.packet.ClientboundPackets1_17_1; @@ -98,8 +98,8 @@ public final class WorldPacketRewriter1_18 { final ChunkLightStorage lightStorage = wrapper.user().get(ChunkLightStorage.class); lightStorage.storeLight(chunkX, chunkZ, - new ChunkLightStorage.ChunkLight(trustEdges, skyLightMask, blockLightMask, - emptySkyLightMask, emptyBlockLightMask, skyLight, blockLight)); + new ChunkLightStorage.ChunkLight(trustEdges, skyLightMask, blockLightMask, + emptySkyLightMask, emptyBlockLightMask, skyLight, blockLight)); }); protocol.registerClientbound(ClientboundPackets1_17_1.LEVEL_CHUNK, ClientboundPackets1_18.LEVEL_CHUNK_WITH_LIGHT, wrapper -> { @@ -157,15 +157,15 @@ public final class WorldPacketRewriter1_18 { final Chunk chunk = new Chunk1_18(oldChunk.getX(), oldChunk.getZ(), sections, oldChunk.getHeightMap(), blockEntities); wrapper.write(new ChunkType1_18(tracker.currentWorldSectionHeight(), - MathUtil.ceilLog2(protocol.getMappingData().getBlockStateMappings().mappedSize()), - MathUtil.ceilLog2(tracker.biomesSent())), chunk); + MathUtil.ceilLog2(protocol.getMappingData().getBlockStateMappings().mappedSize()), + MathUtil.ceilLog2(tracker.biomesSent())), chunk); final ChunkLightStorage lightStorage = wrapper.user().get(ChunkLightStorage.class); final boolean alreadyLoaded = !lightStorage.addLoadedChunk(chunk.getX(), chunk.getZ()); // Append light data to chunk packet final ChunkLightStorage.ChunkLight light = Via.getConfig().cache1_17Light() ? - lightStorage.getLight(chunk.getX(), chunk.getZ()) : lightStorage.removeLight(chunk.getX(), chunk.getZ()); + lightStorage.getLight(chunk.getX(), chunk.getZ()) : lightStorage.removeLight(chunk.getX(), chunk.getZ()); if (light == null) { protocol.getLogger().warning("No light data found for chunk at " + chunk.getX() + ", " + chunk.getZ() + ". Chunk was already loaded: " + alreadyLoaded); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_17to1_17_1/Protocol1_17To1_17_1.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_17to1_17_1/Protocol1_17To1_17_1.java index 6ef8063cb..083d786bf 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_17to1_17_1/Protocol1_17To1_17_1.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_17to1_17_1/Protocol1_17To1_17_1.java @@ -24,7 +24,6 @@ import com.viaversion.viaversion.api.minecraft.item.DataItem; import com.viaversion.viaversion.api.minecraft.item.Item; import com.viaversion.viaversion.api.protocol.AbstractProtocol; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.api.type.types.StringType; import com.viaversion.viaversion.protocols.v1_16_4to1_17.packet.ClientboundPackets1_17; diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_18_2to1_19/Protocol1_18_2To1_19.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_18_2to1_19/Protocol1_18_2To1_19.java index 0e0b414bf..f1d010ccf 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_18_2to1_19/Protocol1_18_2To1_19.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_18_2to1_19/Protocol1_18_2To1_19.java @@ -49,7 +49,6 @@ import com.viaversion.viaversion.rewriter.StatisticsRewriter; import com.viaversion.viaversion.rewriter.TagRewriter; import com.viaversion.viaversion.util.CipherUtil; import com.viaversion.viaversion.util.ComponentUtil; - import java.util.concurrent.ThreadLocalRandom; public final class Protocol1_18_2To1_19 extends AbstractProtocol { @@ -292,15 +291,15 @@ public final class Protocol1_18_2To1_19 extends AbstractProtocol metadata = new ArrayList<>(); - metadata.add(new Metadata(8, Types1_19.META_TYPES.paintingVariantType, protocol.getMappingData().getPaintingMappings().getNewIdOrDefault(motive, 0))); - metaPacket.write(Types1_19.METADATA_LIST, metadata); + final List metadata = new ArrayList<>(); + metadata.add(new EntityData(8, Types1_19.ENTITY_DATA_TYPES.paintingVariantType, protocol.getMappingData().getPaintingMappings().getNewIdOrDefault(motive, 0))); + metaPacket.write(Types1_19.ENTITY_DATA_LIST, metadata); metaPacket.send(Protocol1_18_2To1_19.class); }); } @@ -287,11 +287,11 @@ public final class EntityPacketRewriter1_19 extends EntityRewriter new Pair<>(it, Maps.difference(currentDimension.getValue(), it.getKey().getValue()).entriesInCommon())) - .filter(it -> it.value().containsKey("min_y") && it.value().containsKey("height")) - .max(Comparator.comparingInt(it -> it.value().size())) - .orElseThrow(() -> new IllegalArgumentException("Dimension not found in registry data from join packet: " + currentDimension)) - .key().getValue(); + .map(it -> new Pair<>(it, Maps.difference(currentDimension.getValue(), it.getKey().getValue()).entriesInCommon())) + .filter(it -> it.value().containsKey("min_y") && it.value().containsKey("height")) + .max(Comparator.comparingInt(it -> it.value().size())) + .orElseThrow(() -> new IllegalArgumentException("Dimension not found in registry data from join packet: " + currentDimension)) + .key().getValue(); } wrapper.write(Types.STRING, dimensionKey); @@ -316,8 +316,8 @@ public final class EntityPacketRewriter1_19 extends EntityRewriter { + filter().mapDataType(Types1_19.ENTITY_DATA_TYPES::byId); + filter().dataType(Types1_19.ENTITY_DATA_TYPES.particleType).handler((event, meta) -> { final Particle particle = (Particle) meta.getValue(); final ParticleMappings particleMappings = protocol.getMappingData().getParticleMappings(); if (particle.id() == particleMappings.id("vibration")) { @@ -334,7 +334,7 @@ public final class EntityPacketRewriter1_19 extends EntityRewriter { // Convert to new block id @@ -342,7 +342,7 @@ public final class EntityPacketRewriter1_19 extends EntityRewriter Types1_19.META_TYPES.catVariantType); + filter().type(EntityTypes1_19.CAT).index(19).mapDataType(typeId -> Types1_19.ENTITY_DATA_TYPES.catVariantType); } @Override diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_18_2to1_19/rewriter/ItemPacketRewriter1_19.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_18_2to1_19/rewriter/ItemPacketRewriter1_19.java index 8b0ef010e..0b7ddbf1e 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_18_2to1_19/rewriter/ItemPacketRewriter1_19.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_18_2to1_19/rewriter/ItemPacketRewriter1_19.java @@ -21,7 +21,6 @@ import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.data.ParticleMappings; import com.viaversion.viaversion.api.protocol.remapper.PacketHandler; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.protocols.v1_17_1to1_18.packet.ClientboundPackets1_18; import com.viaversion.viaversion.protocols.v1_18_2to1_19.Protocol1_18_2To1_19; @@ -39,11 +38,11 @@ public final class ItemPacketRewriter1_19 extends ItemRewriter blockRewriter = BlockRewriter.for1_14(protocol); - blockRewriter.registerBlockAction(ClientboundPackets1_18.BLOCK_EVENT); - blockRewriter.registerBlockChange(ClientboundPackets1_18.BLOCK_UPDATE); - blockRewriter.registerVarLongMultiBlockChange(ClientboundPackets1_18.SECTION_BLOCKS_UPDATE); - blockRewriter.registerEffect(ClientboundPackets1_18.LEVEL_EVENT, 1010, 2001); + blockRewriter.registerBlockEvent(ClientboundPackets1_18.BLOCK_EVENT); + blockRewriter.registerBlockUpdate(ClientboundPackets1_18.BLOCK_UPDATE); + blockRewriter.registerSectionBlocksUpdate(ClientboundPackets1_18.SECTION_BLOCKS_UPDATE); + blockRewriter.registerLevelEvent(ClientboundPackets1_18.LEVEL_EVENT, 1010, 2001); protocol.cancelClientbound(ClientboundPackets1_18.BLOCK_BREAK_ACK); @@ -47,8 +47,8 @@ public final class WorldPacketRewriter1_19 { Preconditions.checkArgument(tracker.biomesSent() != -1, "Biome count not set"); Preconditions.checkArgument(tracker.currentWorldSectionHeight() != -1, "Section height not set"); final ChunkType1_18 chunkType = new ChunkType1_18(tracker.currentWorldSectionHeight(), - MathUtil.ceilLog2(protocol.getMappingData().getBlockStateMappings().mappedSize()), - MathUtil.ceilLog2(tracker.biomesSent())); + MathUtil.ceilLog2(protocol.getMappingData().getBlockStateMappings().mappedSize()), + MathUtil.ceilLog2(tracker.biomesSent())); final Chunk chunk = wrapper.passthrough(chunkType); for (final ChunkSection section : chunk.getSections()) { final DataPalette blockPalette = section.palette(PaletteType.BLOCKS); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_18to1_18_2/Protocol1_18To1_18_2.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_18to1_18_2/Protocol1_18To1_18_2.java index 5b53f3f28..cb2cd952d 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_18to1_18_2/Protocol1_18To1_18_2.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_18to1_18_2/Protocol1_18To1_18_2.java @@ -24,7 +24,6 @@ import com.viaversion.nbt.tag.Tag; import com.viaversion.viaversion.api.minecraft.RegistryType; import com.viaversion.viaversion.api.protocol.AbstractProtocol; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.protocols.v1_16_4to1_17.packet.ServerboundPackets1_17; import com.viaversion.viaversion.protocols.v1_17_1to1_18.packet.ClientboundPackets1_18; diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_19_1to1_19_3/Protocol1_19_1To1_19_3.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_19_1to1_19_3/Protocol1_19_1To1_19_3.java index e9736fd25..382356bb3 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_19_1to1_19_3/Protocol1_19_1To1_19_3.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_19_1to1_19_3/Protocol1_19_1To1_19_3.java @@ -81,7 +81,7 @@ public final class Protocol1_19_1To1_19_3 extends AbstractProtocol "minecraft:resource_key"; case "minecraft:resource_or_tag" -> "minecraft:resource_or_tag_key"; case "minecraft:entity_summon", "minecraft:item_enchantment", "minecraft:mob_effect" -> - "minecraft:resource"; + "minecraft:resource"; default -> argumentType; }; } @@ -348,15 +348,15 @@ public final class Protocol1_19_1To1_19_3 extends AbstractProtocol Types1_19_3.META_TYPES.byId(typeId >= 2 ? typeId + 1 : typeId)); // Long added - registerMetaTypeHandler(Types1_19_3.META_TYPES.itemType, Types1_19_3.META_TYPES.optionalBlockStateType, Types1_19_3.META_TYPES.particleType); + filter().mapDataType(typeId -> Types1_19_3.ENTITY_DATA_TYPES.byId(typeId >= 2 ? typeId + 1 : typeId)); // Long added + registerEntityDataTypeHandler(Types1_19_3.ENTITY_DATA_TYPES.itemType, Types1_19_3.ENTITY_DATA_TYPES.optionalBlockStateType, Types1_19_3.ENTITY_DATA_TYPES.particleType); filter().type(EntityTypes1_19_3.ENTITY).index(6).handler((event, meta) -> { // Sitting pose added diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_19_1to1_19_3/rewriter/ItemPacketRewriter1_19_3.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_19_1to1_19_3/rewriter/ItemPacketRewriter1_19_3.java index 4737b5e68..fe6d58dd6 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_19_1to1_19_3/rewriter/ItemPacketRewriter1_19_3.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_19_1to1_19_3/rewriter/ItemPacketRewriter1_19_3.java @@ -41,23 +41,23 @@ public final class ItemPacketRewriter1_19_3 extends ItemRewriter blockRewriter = BlockRewriter.for1_14(protocol); - blockRewriter.registerBlockAction(ClientboundPackets1_19_1.BLOCK_EVENT); - blockRewriter.registerBlockChange(ClientboundPackets1_19_1.BLOCK_UPDATE); - blockRewriter.registerVarLongMultiBlockChange(ClientboundPackets1_19_1.SECTION_BLOCKS_UPDATE); - blockRewriter.registerEffect(ClientboundPackets1_19_1.LEVEL_EVENT, 1010, 2001); - blockRewriter.registerChunkData1_19(ClientboundPackets1_19_1.LEVEL_CHUNK_WITH_LIGHT, ChunkType1_18::new); + blockRewriter.registerBlockEvent(ClientboundPackets1_19_1.BLOCK_EVENT); + blockRewriter.registerBlockUpdate(ClientboundPackets1_19_1.BLOCK_UPDATE); + blockRewriter.registerSectionBlocksUpdate(ClientboundPackets1_19_1.SECTION_BLOCKS_UPDATE); + blockRewriter.registerLevelEvent(ClientboundPackets1_19_1.LEVEL_EVENT, 1010, 2001); + blockRewriter.registerLevelChunk1_19(ClientboundPackets1_19_1.LEVEL_CHUNK_WITH_LIGHT, ChunkType1_18::new); blockRewriter.registerBlockEntityData(ClientboundPackets1_19_1.BLOCK_ENTITY_DATA); - registerSetCooldown(ClientboundPackets1_19_1.COOLDOWN); - registerWindowItems1_17_1(ClientboundPackets1_19_1.CONTAINER_SET_CONTENT); + registerCooldown(ClientboundPackets1_19_1.COOLDOWN); + registerSetContent1_17_1(ClientboundPackets1_19_1.CONTAINER_SET_CONTENT); registerSetSlot1_17_1(ClientboundPackets1_19_1.CONTAINER_SET_SLOT); registerAdvancements(ClientboundPackets1_19_1.UPDATE_ADVANCEMENTS); - registerEntityEquipmentArray(ClientboundPackets1_19_1.SET_EQUIPMENT); - registerClickWindow1_17_1(ServerboundPackets1_19_3.CONTAINER_CLICK); - registerTradeList1_19(ClientboundPackets1_19_1.MERCHANT_OFFERS); - registerCreativeInvAction(ServerboundPackets1_19_3.SET_CREATIVE_MODE_SLOT); - registerWindowPropertyEnchantmentHandler(ClientboundPackets1_19_1.CONTAINER_SET_DATA); - registerSpawnParticle1_19(ClientboundPackets1_19_1.LEVEL_PARTICLES); + registerSetEquipment(ClientboundPackets1_19_1.SET_EQUIPMENT); + registerContainerClick1_17_1(ServerboundPackets1_19_3.CONTAINER_CLICK); + registerMerchantOffers1_19(ClientboundPackets1_19_1.MERCHANT_OFFERS); + registerSetCreativeModeSlot(ServerboundPackets1_19_3.SET_CREATIVE_MODE_SLOT); + registerContainerSetData(ClientboundPackets1_19_1.CONTAINER_SET_DATA); + registerLevelParticles1_19(ClientboundPackets1_19_1.LEVEL_PARTICLES); final RecipeRewriter recipeRewriter = new RecipeRewriter<>(protocol); protocol.registerClientbound(ClientboundPackets1_19_1.UPDATE_RECIPES, wrapper -> { diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_19_1to1_19_3/storage/NonceStorage1_19_3.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_19_1to1_19_3/storage/NonceStorage1_19_3.java index 84490434d..150e7f5b9 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_19_1to1_19_3/storage/NonceStorage1_19_3.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_19_1to1_19_3/storage/NonceStorage1_19_3.java @@ -20,5 +20,5 @@ package com.viaversion.viaversion.protocols.v1_19_1to1_19_3.storage; import com.viaversion.viaversion.api.connection.StorableObject; import org.checkerframework.checker.nullness.qual.Nullable; -public record NonceStorage1_19_3(byte @Nullable[] nonce) implements StorableObject { +public record NonceStorage1_19_3(byte @Nullable [] nonce) implements StorableObject { } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_19_3to1_19_4/Protocol1_19_3To1_19_4.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_19_3to1_19_4/Protocol1_19_3To1_19_4.java index dc47b7466..9db2a7aba 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_19_3to1_19_4/Protocol1_19_3To1_19_4.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_19_3to1_19_4/Protocol1_19_3To1_19_4.java @@ -62,8 +62,8 @@ public final class Protocol1_19_3To1_19_4 extends AbstractProtocol(this).register(ClientboundPackets1_19_3.AWARD_STATS); final SoundRewriter soundRewriter = new SoundRewriter<>(this); - soundRewriter.register1_19_3Sound(ClientboundPackets1_19_3.SOUND_ENTITY); - soundRewriter.register1_19_3Sound(ClientboundPackets1_19_3.SOUND); + soundRewriter.registerSound1_19_3(ClientboundPackets1_19_3.SOUND_ENTITY); + soundRewriter.registerSound1_19_3(ClientboundPackets1_19_3.SOUND); new CommandRewriter<>(this) { @Override @@ -98,15 +98,15 @@ public final class Protocol1_19_3To1_19_4 extends AbstractProtocol Types1_19_4.META_TYPES.byId(typeId >= 14 ? typeId + 1 : typeId)); // Optional block state (and map block state=14 to optional block state) - registerMetaTypeHandler(Types1_19_4.META_TYPES.itemType, Types1_19_4.META_TYPES.blockStateType, Types1_19_4.META_TYPES.optionalBlockStateType, Types1_19_4.META_TYPES.particleType, null); + filter().mapDataType(typeId -> Types1_19_4.ENTITY_DATA_TYPES.byId(typeId >= 14 ? typeId + 1 : typeId)); // Optional block state (and map block state=14 to optional block state) + registerEntityDataTypeHandler(Types1_19_4.ENTITY_DATA_TYPES.itemType, Types1_19_4.ENTITY_DATA_TYPES.blockStateType, Types1_19_4.ENTITY_DATA_TYPES.optionalBlockStateType, Types1_19_4.ENTITY_DATA_TYPES.particleType, null); filter().type(EntityTypes1_19_4.ABSTRACT_MINECART).index(11).handler((event, meta) -> { final int blockState = meta.value(); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_19_3to1_19_4/rewriter/ItemPacketRewriter1_19_4.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_19_3to1_19_4/rewriter/ItemPacketRewriter1_19_4.java index 28a69984f..56286be44 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_19_3to1_19_4/rewriter/ItemPacketRewriter1_19_4.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_19_3to1_19_4/rewriter/ItemPacketRewriter1_19_4.java @@ -38,10 +38,10 @@ public final class ItemPacketRewriter1_19_4 extends ItemRewriter blockRewriter = BlockRewriter.for1_14(protocol); - blockRewriter.registerBlockAction(ClientboundPackets1_19_3.BLOCK_EVENT); - blockRewriter.registerBlockChange(ClientboundPackets1_19_3.BLOCK_UPDATE); - blockRewriter.registerVarLongMultiBlockChange(ClientboundPackets1_19_3.SECTION_BLOCKS_UPDATE); - blockRewriter.registerChunkData1_19(ClientboundPackets1_19_3.LEVEL_CHUNK_WITH_LIGHT, ChunkType1_18::new); + blockRewriter.registerBlockEvent(ClientboundPackets1_19_3.BLOCK_EVENT); + blockRewriter.registerBlockUpdate(ClientboundPackets1_19_3.BLOCK_UPDATE); + blockRewriter.registerSectionBlocksUpdate(ClientboundPackets1_19_3.SECTION_BLOCKS_UPDATE); + blockRewriter.registerLevelChunk1_19(ClientboundPackets1_19_3.LEVEL_CHUNK_WITH_LIGHT, ChunkType1_18::new); blockRewriter.registerBlockEntityData(ClientboundPackets1_19_3.BLOCK_ENTITY_DATA); protocol.registerClientbound(ClientboundPackets1_19_3.LEVEL_EVENT, new PacketHandlers() { @@ -84,16 +84,16 @@ public final class ItemPacketRewriter1_19_4 extends ItemRewriter(protocol) { @Override diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_19_4to1_20/Protocol1_19_4To1_20.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_19_4to1_20/Protocol1_19_4To1_20.java index 930f041a0..8494ae7e6 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_19_4to1_20/Protocol1_19_4To1_20.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_19_4to1_20/Protocol1_19_4To1_20.java @@ -52,8 +52,8 @@ public final class Protocol1_19_4To1_20 extends AbstractProtocol soundRewriter = new SoundRewriter<>(this); - soundRewriter.register1_19_3Sound(ClientboundPackets1_19_4.SOUND); - soundRewriter.register1_19_3Sound(ClientboundPackets1_19_4.SOUND_ENTITY); + soundRewriter.registerSound1_19_3(ClientboundPackets1_19_4.SOUND); + soundRewriter.registerSound1_19_3(ClientboundPackets1_19_4.SOUND_ENTITY); new StatisticsRewriter<>(this).register(ClientboundPackets1_19_4.AWARD_STATS); @@ -70,15 +70,15 @@ public final class Protocol1_19_4To1_20 extends AbstractProtocol { - if (event.trackedEntity().hasSentMetadata() || event.hasExtraMeta()) { + if (event.trackedEntity().hasSentEntityData() || event.hasExtraData()) { return; } - if (event.metaAtIndex(12) == null) { - event.createExtraMeta(new Metadata(12, Types1_20.META_TYPES.quaternionType, Y_FLIPPED_ROTATION)); + if (event.dataAtIndex(12) == null) { + event.createExtraData(new EntityData(12, Types1_20.ENTITY_DATA_TYPES.quaternionType, Y_FLIPPED_ROTATION)); } }); filter().type(EntityTypes1_19_4.ITEM_DISPLAY).index(12).handler((event, meta) -> { diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_19_4to1_20/rewriter/ItemPacketRewriter1_20.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_19_4to1_20/rewriter/ItemPacketRewriter1_20.java index 9e38046b6..d3e0b1861 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_19_4to1_20/rewriter/ItemPacketRewriter1_20.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_19_4to1_20/rewriter/ItemPacketRewriter1_20.java @@ -24,7 +24,6 @@ import com.viaversion.nbt.tag.Tag; import com.viaversion.viaversion.api.minecraft.BlockChangeRecord; import com.viaversion.viaversion.api.minecraft.blockentity.BlockEntity; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_18; import com.viaversion.viaversion.protocols.v1_19_3to1_19_4.packet.ClientboundPackets1_19_4; @@ -46,21 +45,21 @@ public final class ItemPacketRewriter1_20 extends ItemRewriter blockRewriter = BlockRewriter.for1_14(protocol); - blockRewriter.registerBlockAction(ClientboundPackets1_19_4.BLOCK_EVENT); - blockRewriter.registerBlockChange(ClientboundPackets1_19_4.BLOCK_UPDATE); - blockRewriter.registerEffect(ClientboundPackets1_19_4.LEVEL_EVENT, 1010, 2001); + blockRewriter.registerBlockEvent(ClientboundPackets1_19_4.BLOCK_EVENT); + blockRewriter.registerBlockUpdate(ClientboundPackets1_19_4.BLOCK_UPDATE); + blockRewriter.registerLevelEvent(ClientboundPackets1_19_4.LEVEL_EVENT, 1010, 2001); blockRewriter.registerBlockEntityData(ClientboundPackets1_19_4.BLOCK_ENTITY_DATA, this::handleBlockEntity); - registerOpenWindow(ClientboundPackets1_19_4.OPEN_SCREEN); - registerSetCooldown(ClientboundPackets1_19_4.COOLDOWN); - registerWindowItems1_17_1(ClientboundPackets1_19_4.CONTAINER_SET_CONTENT); + registerOpenScreen(ClientboundPackets1_19_4.OPEN_SCREEN); + registerCooldown(ClientboundPackets1_19_4.COOLDOWN); + registerSetContent1_17_1(ClientboundPackets1_19_4.CONTAINER_SET_CONTENT); registerSetSlot1_17_1(ClientboundPackets1_19_4.CONTAINER_SET_SLOT); - registerEntityEquipmentArray(ClientboundPackets1_19_4.SET_EQUIPMENT); - registerClickWindow1_17_1(ServerboundPackets1_19_4.CONTAINER_CLICK); - registerTradeList1_19(ClientboundPackets1_19_4.MERCHANT_OFFERS); - registerCreativeInvAction(ServerboundPackets1_19_4.SET_CREATIVE_MODE_SLOT); - registerWindowPropertyEnchantmentHandler(ClientboundPackets1_19_4.CONTAINER_SET_DATA); - registerSpawnParticle1_19(ClientboundPackets1_19_4.LEVEL_PARTICLES); + registerSetEquipment(ClientboundPackets1_19_4.SET_EQUIPMENT); + registerContainerClick1_17_1(ServerboundPackets1_19_4.CONTAINER_CLICK); + registerMerchantOffers1_19(ClientboundPackets1_19_4.MERCHANT_OFFERS); + registerSetCreativeModeSlot(ServerboundPackets1_19_4.SET_CREATIVE_MODE_SLOT); + registerContainerSetData(ClientboundPackets1_19_4.CONTAINER_SET_DATA); + registerLevelParticles1_19(ClientboundPackets1_19_4.LEVEL_PARTICLES); protocol.registerClientbound(ClientboundPackets1_19_4.UPDATE_ADVANCEMENTS, wrapper -> { wrapper.passthrough(Types.BOOLEAN); // Reset/clear @@ -109,7 +108,7 @@ public final class ItemPacketRewriter1_20 extends ItemRewriter handleBlockEntity(blockEntity))); + handler(blockRewriter.chunkHandler1_19(ChunkType1_18::new, (user, blockEntity) -> handleBlockEntity(blockEntity))); read(Types.BOOLEAN); // Trust edges } }); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_19to1_19_1/Protocol1_19To1_19_1.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_19to1_19_1/Protocol1_19To1_19_1.java index 72d77d323..624a8ddc5 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_19to1_19_1/Protocol1_19To1_19_1.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_19to1_19_1/Protocol1_19To1_19_1.java @@ -17,13 +17,13 @@ */ package com.viaversion.viaversion.protocols.v1_19to1_19_1; +import com.google.common.base.Preconditions; +import com.google.gson.JsonElement; import com.viaversion.nbt.tag.ByteTag; import com.viaversion.nbt.tag.CompoundTag; import com.viaversion.nbt.tag.ListTag; import com.viaversion.nbt.tag.NumberTag; import com.viaversion.nbt.tag.StringTag; -import com.google.common.base.Preconditions; -import com.google.gson.JsonElement; import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.minecraft.ProfileKey; @@ -48,13 +48,13 @@ import com.viaversion.viaversion.protocols.v1_19to1_19_1.storage.NonceStorage1_1 import com.viaversion.viaversion.util.CipherUtil; import com.viaversion.viaversion.util.Pair; import com.viaversion.viaversion.util.ProtocolLogger; +import com.viaversion.viaversion.util.SerializerVersion; import com.viaversion.viaversion.util.TagUtil; import java.security.SignatureException; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.UUID; -import com.viaversion.viaversion.util.SerializerVersion; import net.lenni0451.mcstructs.core.TextFormatting; import net.lenni0451.mcstructs.text.ATextComponent; import net.lenni0451.mcstructs.text.Style; @@ -319,11 +319,11 @@ public final class Protocol1_19To1_19_1 extends AbstractProtocol soundRewriter = new SoundRewriter<>(this); - soundRewriter.register1_19_3Sound(ClientboundPackets1_20_2.SOUND); - soundRewriter.register1_19_3Sound(ClientboundPackets1_20_2.SOUND_ENTITY); + soundRewriter.registerSound1_19_3(ClientboundPackets1_20_2.SOUND); + soundRewriter.registerSound1_19_3(ClientboundPackets1_20_2.SOUND_ENTITY); new StatisticsRewriter<>(this).register(ClientboundPackets1_20_2.AWARD_STATS); new CommandRewriter1_19_4<>(this).registerDeclareCommands1_19(ClientboundPackets1_20_2.COMMANDS); @@ -348,15 +348,15 @@ public final class Protocol1_20_2To1_20_3 extends AbstractProtocol createPacketTypesProvider() { return new SimplePacketTypesProvider<>( - packetTypeMap(unmappedClientboundPacketType, ClientboundPackets1_20_2.class, ClientboundConfigurationPackets1_20_2.class), - packetTypeMap(mappedClientboundPacketType, ClientboundPackets1_20_3.class, ClientboundConfigurationPackets1_20_3.class), - packetTypeMap(mappedServerboundPacketType, ServerboundPackets1_20_2.class, ServerboundConfigurationPackets1_20_2.class), - packetTypeMap(unmappedServerboundPacketType, ServerboundPackets1_20_3.class, ServerboundConfigurationPackets1_20_2.class) + packetTypeMap(unmappedClientboundPacketType, ClientboundPackets1_20_2.class, ClientboundConfigurationPackets1_20_2.class), + packetTypeMap(mappedClientboundPacketType, ClientboundPackets1_20_3.class, ClientboundConfigurationPackets1_20_3.class), + packetTypeMap(mappedServerboundPacketType, ServerboundPackets1_20_2.class, ServerboundConfigurationPackets1_20_2.class), + packetTypeMap(unmappedServerboundPacketType, ServerboundPackets1_20_3.class, ServerboundConfigurationPackets1_20_2.class) ); } } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_2to1_20_3/rewriter/BlockItemPacketRewriter1_20_3.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_2to1_20_3/rewriter/BlockItemPacketRewriter1_20_3.java index b549968ef..97566ad29 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_2to1_20_3/rewriter/BlockItemPacketRewriter1_20_3.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_2to1_20_3/rewriter/BlockItemPacketRewriter1_20_3.java @@ -55,21 +55,21 @@ public final class BlockItemPacketRewriter1_20_3 extends ItemRewriter blockRewriter = BlockRewriter.for1_20_2(protocol); - blockRewriter.registerBlockAction(ClientboundPackets1_20_2.BLOCK_EVENT); - blockRewriter.registerBlockChange(ClientboundPackets1_20_2.BLOCK_UPDATE); - blockRewriter.registerVarLongMultiBlockChange1_20(ClientboundPackets1_20_2.SECTION_BLOCKS_UPDATE); - blockRewriter.registerEffect(ClientboundPackets1_20_2.LEVEL_EVENT, 1010, 2001); - blockRewriter.registerChunkData1_19(ClientboundPackets1_20_2.LEVEL_CHUNK_WITH_LIGHT, ChunkType1_20_2::new); + blockRewriter.registerBlockEvent(ClientboundPackets1_20_2.BLOCK_EVENT); + blockRewriter.registerBlockUpdate(ClientboundPackets1_20_2.BLOCK_UPDATE); + blockRewriter.registerSectionBlocksUpdate1_20(ClientboundPackets1_20_2.SECTION_BLOCKS_UPDATE); + blockRewriter.registerLevelEvent(ClientboundPackets1_20_2.LEVEL_EVENT, 1010, 2001); + blockRewriter.registerLevelChunk1_19(ClientboundPackets1_20_2.LEVEL_CHUNK_WITH_LIGHT, ChunkType1_20_2::new); blockRewriter.registerBlockEntityData(ClientboundPackets1_20_2.BLOCK_ENTITY_DATA); - registerSetCooldown(ClientboundPackets1_20_2.COOLDOWN); - registerWindowItems1_17_1(ClientboundPackets1_20_2.CONTAINER_SET_CONTENT); + registerCooldown(ClientboundPackets1_20_2.COOLDOWN); + registerSetContent1_17_1(ClientboundPackets1_20_2.CONTAINER_SET_CONTENT); registerSetSlot1_17_1(ClientboundPackets1_20_2.CONTAINER_SET_SLOT); - registerEntityEquipmentArray(ClientboundPackets1_20_2.SET_EQUIPMENT); - registerClickWindow1_17_1(ServerboundPackets1_20_3.CONTAINER_CLICK); - registerTradeList1_19(ClientboundPackets1_20_2.MERCHANT_OFFERS); - registerCreativeInvAction(ServerboundPackets1_20_3.SET_CREATIVE_MODE_SLOT); - registerWindowPropertyEnchantmentHandler(ClientboundPackets1_20_2.CONTAINER_SET_DATA); + registerSetEquipment(ClientboundPackets1_20_2.SET_EQUIPMENT); + registerContainerClick1_17_1(ServerboundPackets1_20_3.CONTAINER_CLICK); + registerMerchantOffers1_19(ClientboundPackets1_20_2.MERCHANT_OFFERS); + registerSetCreativeModeSlot(ServerboundPackets1_20_3.SET_CREATIVE_MODE_SLOT); + registerContainerSetData(ClientboundPackets1_20_2.CONTAINER_SET_DATA); protocol.registerClientbound(ClientboundPackets1_20_2.LEVEL_PARTICLES, new PacketHandlers() { @Override @@ -92,7 +92,7 @@ public final class BlockItemPacketRewriter1_20_3 extends ItemRewriter { - final MetaType type = meta.metaType(); - if (type == Types1_20_2.META_TYPES.componentType) { - meta.setTypeAndValue(Types1_20_3.META_TYPES.componentType, ComponentUtil.jsonToTag(meta.value())); - } else if (type == Types1_20_2.META_TYPES.optionalComponentType) { - meta.setTypeAndValue(Types1_20_3.META_TYPES.optionalComponentType, ComponentUtil.jsonToTag(meta.value())); + final EntityDataType type = meta.dataType(); + if (type == Types1_20_2.ENTITY_DATA_TYPES.componentType) { + meta.setTypeAndValue(Types1_20_3.ENTITY_DATA_TYPES.componentType, ComponentUtil.jsonToTag(meta.value())); + } else if (type == Types1_20_2.ENTITY_DATA_TYPES.optionalComponentType) { + meta.setTypeAndValue(Types1_20_3.ENTITY_DATA_TYPES.optionalComponentType, ComponentUtil.jsonToTag(meta.value())); } else { - meta.setMetaType(Types1_20_3.META_TYPES.byId(type.typeId())); + meta.setDataType(Types1_20_3.ENTITY_DATA_TYPES.byId(type.typeId())); } }); - filter().metaType(Types1_20_3.META_TYPES.particleType).handler((event, meta) -> { + filter().dataType(Types1_20_3.ENTITY_DATA_TYPES.particleType).handler((event, meta) -> { final Particle particle = meta.value(); final ParticleMappings particleMappings = protocol.getMappingData().getParticleMappings(); if (particle.id() == particleMappings.id("vibration")) { @@ -130,12 +129,12 @@ public final class EntityPacketRewriter1_20_3 extends EntityRewriter { final int blockState = meta.value(); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/Protocol1_20_3To1_20_5.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/Protocol1_20_3To1_20_5.java index 6a3296da5..279cbff18 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/Protocol1_20_3To1_20_5.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/Protocol1_20_3To1_20_5.java @@ -84,14 +84,14 @@ public final class Protocol1_20_3To1_20_5 extends AbstractProtocol soundRewriter = new SoundRewriter<>(this); - soundRewriter.register1_19_3Sound(ClientboundPackets1_20_3.SOUND); - soundRewriter.register1_19_3Sound(ClientboundPackets1_20_3.SOUND_ENTITY); + soundRewriter.registerSound1_19_3(ClientboundPackets1_20_3.SOUND); + soundRewriter.registerSound1_19_3(ClientboundPackets1_20_3.SOUND_ENTITY); new StatisticsRewriter<>(this).register(ClientboundPackets1_20_3.AWARD_STATS); componentRewriter.registerComponentPacket(ClientboundPackets1_20_3.SYSTEM_CHAT); componentRewriter.registerComponentPacket(ClientboundPackets1_20_3.DISGUISED_CHAT); - componentRewriter.registerCombatKill1_20(ClientboundPackets1_20_3.PLAYER_COMBAT_KILL); + componentRewriter.registerPlayerCombatKill1_20(ClientboundPackets1_20_3.PLAYER_COMBAT_KILL); registerClientbound(State.LOGIN, ClientboundLoginPackets.HELLO, wrapper -> { wrapper.passthrough(Types.STRING); // Server ID diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/rewriter/BlockItemPacketRewriter1_20_5.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/rewriter/BlockItemPacketRewriter1_20_5.java index fbc537b3d..460054bb4 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/rewriter/BlockItemPacketRewriter1_20_5.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/rewriter/BlockItemPacketRewriter1_20_5.java @@ -135,10 +135,10 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter blockRewriter = BlockRewriter.for1_20_2(protocol); - blockRewriter.registerBlockAction(ClientboundPackets1_20_3.BLOCK_EVENT); - blockRewriter.registerBlockChange(ClientboundPackets1_20_3.BLOCK_UPDATE); - blockRewriter.registerVarLongMultiBlockChange1_20(ClientboundPackets1_20_3.SECTION_BLOCKS_UPDATE); - blockRewriter.registerEffect(ClientboundPackets1_20_3.LEVEL_EVENT, 1010, 2001); + blockRewriter.registerBlockEvent(ClientboundPackets1_20_3.BLOCK_EVENT); + blockRewriter.registerBlockUpdate(ClientboundPackets1_20_3.BLOCK_UPDATE); + blockRewriter.registerSectionBlocksUpdate1_20(ClientboundPackets1_20_3.SECTION_BLOCKS_UPDATE); + blockRewriter.registerLevelEvent(ClientboundPackets1_20_3.LEVEL_EVENT, 1010, 2001); protocol.registerClientbound(ClientboundPackets1_20_3.LEVEL_CHUNK_WITH_LIGHT, wrapper -> { final Chunk chunk = blockRewriter.handleChunk1_19(wrapper, ChunkType1_20_2::new); for (int i = 0; i < chunk.blockEntities().size(); i++) { @@ -171,13 +171,13 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter { final byte containerId = wrapper.read(Types.VAR_INT).byteValue(); final byte buttonId = wrapper.read(Types.VAR_INT).byteValue(); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/rewriter/EntityPacketRewriter1_20_5.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/rewriter/EntityPacketRewriter1_20_5.java index 84ebf3144..b1a24a4bd 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/rewriter/EntityPacketRewriter1_20_5.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_20_3to1_20_5/rewriter/EntityPacketRewriter1_20_5.java @@ -29,10 +29,9 @@ import com.viaversion.viaversion.api.minecraft.RegistryEntry; import com.viaversion.viaversion.api.minecraft.entities.EntityType; import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_5; import com.viaversion.viaversion.api.minecraft.item.Item; -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.api.type.types.version.Types1_20_3; import com.viaversion.viaversion.api.type.types.version.Types1_20_5; @@ -71,7 +70,7 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter { @@ -393,31 +392,31 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter { + filter().mapDataType(typeId -> { int id = typeId; - if (id >= Types1_20_5.META_TYPES.particlesType.typeId()) { + if (id >= Types1_20_5.ENTITY_DATA_TYPES.particlesType.typeId()) { id++; } - if (id >= Types1_20_5.META_TYPES.wolfVariantType.typeId()) { + if (id >= Types1_20_5.ENTITY_DATA_TYPES.wolfVariantType.typeId()) { id++; } - if (id >= Types1_20_5.META_TYPES.armadilloState.typeId()) { + if (id >= Types1_20_5.ENTITY_DATA_TYPES.armadilloState.typeId()) { id++; } - return Types1_20_5.META_TYPES.byId(id); + return Types1_20_5.ENTITY_DATA_TYPES.byId(id); }); - registerMetaTypeHandler( - Types1_20_5.META_TYPES.itemType, - Types1_20_5.META_TYPES.blockStateType, - Types1_20_5.META_TYPES.optionalBlockStateType, - Types1_20_5.META_TYPES.particleType, + registerEntityDataTypeHandler( + Types1_20_5.ENTITY_DATA_TYPES.itemType, + Types1_20_5.ENTITY_DATA_TYPES.blockStateType, + Types1_20_5.ENTITY_DATA_TYPES.optionalBlockStateType, + Types1_20_5.ENTITY_DATA_TYPES.particleType, null ); - filter().metaType(Types1_20_5.META_TYPES.componentType).handler((event, meta) -> protocol.getComponentRewriter().processTag(event.user(), meta.value())); - filter().metaType(Types1_20_5.META_TYPES.optionalComponentType).handler((event, meta) -> protocol.getComponentRewriter().processTag(event.user(), meta.value())); + filter().dataType(Types1_20_5.ENTITY_DATA_TYPES.componentType).handler((event, meta) -> protocol.getComponentRewriter().processTag(event.user(), meta.value())); + filter().dataType(Types1_20_5.ENTITY_DATA_TYPES.optionalComponentType).handler((event, meta) -> protocol.getComponentRewriter().processTag(event.user(), meta.value())); - filter().metaType(Types1_20_5.META_TYPES.itemType).handler((event, meta) -> { + filter().dataType(Types1_20_5.ENTITY_DATA_TYPES.itemType).handler((event, meta) -> { final Item item = meta.value(); if (item != null && item.amount() <= 0) { // No longer accepted by the client, needs to be properly empty @@ -429,13 +428,13 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter { @@ -76,8 +75,8 @@ public final class Protocol1_20To1_20_2 extends AbstractProtocol soundRewriter = new SoundRewriter<>(this); - soundRewriter.register1_19_3Sound(ClientboundPackets1_19_4.SOUND); - soundRewriter.register1_19_3Sound(ClientboundPackets1_19_4.SOUND_ENTITY); + soundRewriter.registerSound1_19_3(ClientboundPackets1_19_4.SOUND); + soundRewriter.registerSound1_19_3(ClientboundPackets1_19_4.SOUND_ENTITY); final PacketHandlers sanitizeCustomPayload = new PacketHandlers() { @Override @@ -160,14 +159,14 @@ public final class Protocol1_20To1_20_2 extends AbstractProtocol { final ConfigurationState.ClientInformation clientInformation = new ConfigurationState.ClientInformation( - wrapper.read(Types.STRING), // Language - wrapper.read(Types.BYTE), // View distance - wrapper.read(Types.VAR_INT), // Chat visibility - wrapper.read(Types.BOOLEAN), // Chat colors - wrapper.read(Types.UNSIGNED_BYTE), // Model customization - wrapper.read(Types.VAR_INT), // Main hand - wrapper.read(Types.BOOLEAN), // Text filtering enabled - wrapper.read(Types.BOOLEAN) // Allow listing in server list preview + wrapper.read(Types.STRING), // Language + wrapper.read(Types.BYTE), // View distance + wrapper.read(Types.VAR_INT), // Chat visibility + wrapper.read(Types.BOOLEAN), // Chat colors + wrapper.read(Types.UNSIGNED_BYTE), // Model customization + wrapper.read(Types.VAR_INT), // Main hand + wrapper.read(Types.BOOLEAN), // Text filtering enabled + wrapper.read(Types.BOOLEAN) // Allow listing in server list preview ); // Store it to re-send it when another ClientboundLoginPacket is sent, since the client will only send it diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_20to1_20_2/rewriter/BlockItemPacketRewriter1_20_2.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_20to1_20_2/rewriter/BlockItemPacketRewriter1_20_2.java index d96790942..b20955759 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_20to1_20_2/rewriter/BlockItemPacketRewriter1_20_2.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_20to1_20_2/rewriter/BlockItemPacketRewriter1_20_2.java @@ -18,7 +18,6 @@ package com.viaversion.viaversion.protocols.v1_20to1_20_2.rewriter; import com.viaversion.nbt.tag.CompoundTag; -import com.viaversion.nbt.tag.IntTag; import com.viaversion.nbt.tag.ListTag; import com.viaversion.nbt.tag.NumberTag; import com.viaversion.nbt.tag.StringTag; @@ -32,7 +31,7 @@ import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection; import com.viaversion.viaversion.api.minecraft.chunks.DataPalette; import com.viaversion.viaversion.api.minecraft.chunks.PaletteType; import com.viaversion.viaversion.api.minecraft.item.Item; -import com.viaversion.viaversion.api.minecraft.metadata.ChunkPosition; +import com.viaversion.viaversion.api.minecraft.ChunkPosition; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.type.Type; @@ -58,10 +57,10 @@ public final class BlockItemPacketRewriter1_20_2 extends ItemRewriter blockRewriter = BlockRewriter.for1_14(protocol); - blockRewriter.registerBlockAction(ClientboundPackets1_19_4.BLOCK_EVENT); - blockRewriter.registerBlockChange(ClientboundPackets1_19_4.BLOCK_UPDATE); - blockRewriter.registerVarLongMultiBlockChange1_20(ClientboundPackets1_19_4.SECTION_BLOCKS_UPDATE); - blockRewriter.registerEffect(ClientboundPackets1_19_4.LEVEL_EVENT, 1010, 2001); + blockRewriter.registerBlockEvent(ClientboundPackets1_19_4.BLOCK_EVENT); + blockRewriter.registerBlockUpdate(ClientboundPackets1_19_4.BLOCK_UPDATE); + blockRewriter.registerSectionBlocksUpdate1_20(ClientboundPackets1_19_4.SECTION_BLOCKS_UPDATE); + blockRewriter.registerLevelEvent(ClientboundPackets1_19_4.LEVEL_EVENT, 1010, 2001); protocol.registerServerbound(ServerboundPackets1_20_2.SET_BEACON, wrapper -> { // Effects start at 1 before 1.20.2 @@ -93,13 +92,13 @@ public final class BlockItemPacketRewriter1_20_2 extends ItemRewriter { final EntityTracker tracker = protocol.getEntityRewriter().tracker(wrapper.user()); final Type chunkType = new ChunkType1_18(tracker.currentWorldSectionHeight(), - MathUtil.ceilLog2(protocol.getMappingData().getBlockStateMappings().size()), - MathUtil.ceilLog2(tracker.biomesSent())); + MathUtil.ceilLog2(protocol.getMappingData().getBlockStateMappings().size()), + MathUtil.ceilLog2(tracker.biomesSent())); final Chunk chunk = wrapper.read(chunkType); final Type newChunkType = new ChunkType1_20_2(tracker.currentWorldSectionHeight(), - MathUtil.ceilLog2(protocol.getMappingData().getBlockStateMappings().mappedSize()), - MathUtil.ceilLog2(tracker.biomesSent())); + MathUtil.ceilLog2(protocol.getMappingData().getBlockStateMappings().mappedSize()), + MathUtil.ceilLog2(tracker.biomesSent())); wrapper.write(newChunkType, chunk); for (final ChunkSection section : chunk.getSections()) { diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_20to1_20_2/rewriter/EntityPacketRewriter1_20_2.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_20to1_20_2/rewriter/EntityPacketRewriter1_20_2.java index 68cfcc72c..e4587c7ee 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_20to1_20_2/rewriter/EntityPacketRewriter1_20_2.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_20to1_20_2/rewriter/EntityPacketRewriter1_20_2.java @@ -22,7 +22,6 @@ import com.viaversion.viaversion.api.minecraft.entities.EntityType; import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_19_4; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.api.type.types.version.Types1_20; import com.viaversion.viaversion.api.type.types.version.Types1_20_2; @@ -41,7 +40,7 @@ public final class EntityPacketRewriter1_20_2 extends EntityRewriter { @@ -173,8 +172,8 @@ public final class EntityPacketRewriter1_20_2 extends EntityRewriter, MetaIndex1_8> metadataRewrites = new HashMap<>(); + private static final HashMap, MetaIndex1_8> metadataRewrites = new HashMap<>(); static { for (MetaIndex1_8 index : MetaIndex1_8.values()) { @@ -197,13 +197,13 @@ public enum MetaIndex1_8 { } } - private final EntityTypes1_10.EntityType clazz; + private final EntityTypes1_9.EntityType clazz; private final int newIndex; - private final MetaType1_9 newType; - private final MetaType1_8 oldType; + private final EntityDataTypes1_9 newType; + private final EntityDataTypes1_8 oldType; private final int index; - MetaIndex1_8(EntityTypes1_10.EntityType type, int index, MetaType1_8 oldType, @Nullable MetaType1_9 newType) { + MetaIndex1_8(EntityTypes1_9.EntityType type, int index, EntityDataTypes1_8 oldType, @Nullable EntityDataTypes1_9 newType) { this.clazz = type; this.index = index; this.newIndex = index; @@ -211,7 +211,7 @@ public enum MetaIndex1_8 { this.newType = newType; } - MetaIndex1_8(EntityTypes1_10.EntityType type, int newIndex, @Nullable MetaType1_9 newType) { + MetaIndex1_8(EntityTypes1_9.EntityType type, int newIndex, @Nullable EntityDataTypes1_9 newType) { this.clazz = type; this.index = -1; this.oldType = null; @@ -219,7 +219,7 @@ public enum MetaIndex1_8 { this.newType = newType; } - MetaIndex1_8(EntityTypes1_10.EntityType type, int index, MetaType1_8 oldType, int newIndex, @Nullable MetaType1_9 newType) { + MetaIndex1_8(EntityTypes1_9.EntityType type, int index, EntityDataTypes1_8 oldType, int newIndex, @Nullable EntityDataTypes1_9 newType) { this.clazz = type; this.index = index; this.oldType = oldType; @@ -227,7 +227,7 @@ public enum MetaIndex1_8 { this.newType = newType; } - public EntityTypes1_10.EntityType getClazz() { + public EntityTypes1_9.EntityType getClazz() { return clazz; } @@ -235,11 +235,11 @@ public enum MetaIndex1_8 { return newIndex; } - public @Nullable MetaType1_9 getNewType() { + public @Nullable EntityDataTypes1_9 getNewType() { return newType; } - public MetaType1_8 getOldType() { + public EntityDataTypes1_8 getOldType() { return oldType; } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_8to1_9/provider/CompressionProvider.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_8to1_9/provider/CompressionProvider.java index 99e708280..08fc09088 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_8to1_9/provider/CompressionProvider.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_8to1_9/provider/CompressionProvider.java @@ -102,7 +102,7 @@ public class CompressionProvider implements Provider { try { this.inflater.setInput(temp.array(), temp.arrayOffset() + temp.readerIndex(), temp.readableBytes()); output.writerIndex(output.writerIndex() + this.inflater.inflate( - output.array(), output.arrayOffset(), outLength)); + output.array(), output.arrayOffset(), outLength)); out.add(output.retain()); } finally { output.release(); @@ -151,7 +151,7 @@ public class CompressionProvider implements Provider { while (!deflater.finished()) { output.ensureWritable(4096); output.writerIndex(output.writerIndex() + this.deflater.deflate(output.array(), - output.arrayOffset() + output.writerIndex(), output.writableBytes())); + output.arrayOffset() + output.writerIndex(), output.writableBytes())); } out.writeBytes(output); } finally { diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_8to1_9/provider/MovementTransmitterProvider.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_8to1_9/provider/MovementTransmitterProvider.java index 94cea0fe8..ee1956c8f 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_8to1_9/provider/MovementTransmitterProvider.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_8to1_9/provider/MovementTransmitterProvider.java @@ -23,8 +23,8 @@ import com.viaversion.viaversion.api.platform.providers.Provider; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.packet.State; import com.viaversion.viaversion.api.type.Types; -import com.viaversion.viaversion.protocols.v1_8to1_9.packet.ServerboundPackets1_8; import com.viaversion.viaversion.protocols.v1_8to1_9.Protocol1_8To1_9; +import com.viaversion.viaversion.protocols.v1_8to1_9.packet.ServerboundPackets1_8; import com.viaversion.viaversion.protocols.v1_8to1_9.storage.MovementTracker; import java.util.logging.Level; diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_8to1_9/rewriter/EntityPacketRewriter1_9.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_8to1_9/rewriter/EntityPacketRewriter1_9.java index 5fe6ffcf4..b50d49d4d 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_8to1_9/rewriter/EntityPacketRewriter1_9.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_8to1_9/rewriter/EntityPacketRewriter1_9.java @@ -24,23 +24,23 @@ import com.viaversion.viaversion.api.minecraft.Vector; import com.viaversion.viaversion.api.minecraft.entities.EntityType; import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_10; import com.viaversion.viaversion.api.minecraft.item.Item; -import com.viaversion.viaversion.api.minecraft.metadata.MetaType; -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; -import com.viaversion.viaversion.api.minecraft.metadata.types.MetaType1_8; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType; +import com.viaversion.viaversion.api.minecraft.entitydata.types.EntityDataTypes1_8; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.protocol.remapper.ValueTransformer; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.api.type.types.version.Types1_8; import com.viaversion.viaversion.api.type.types.version.Types1_9; -import com.viaversion.viaversion.protocols.v1_8to1_9.packet.ClientboundPackets1_8; import com.viaversion.viaversion.protocols.v1_8to1_9.Protocol1_8To1_9; import com.viaversion.viaversion.protocols.v1_8to1_9.data.MetaIndex1_8; +import com.viaversion.viaversion.protocols.v1_8to1_9.packet.ClientboundPackets1_8; import com.viaversion.viaversion.protocols.v1_8to1_9.packet.ClientboundPackets1_9; import com.viaversion.viaversion.protocols.v1_8to1_9.packet.ServerboundPackets1_9; import com.viaversion.viaversion.protocols.v1_8to1_9.storage.EntityTracker1_9; import com.viaversion.viaversion.rewriter.EntityRewriter; -import com.viaversion.viaversion.rewriter.meta.MetaHandlerEvent; +import com.viaversion.viaversion.rewriter.entitydata.EntityDataHandlerEvent; import com.viaversion.viaversion.util.ComponentUtil; import com.viaversion.viaversion.util.Pair; import com.viaversion.viaversion.util.SerializerVersion; @@ -210,13 +210,13 @@ public class EntityPacketRewriter1_9 extends EntityRewriter { - List metadataList = wrapper.get(Types1_9.METADATA_LIST, 0); + List metadataList = wrapper.get(Types1_9.ENTITY_DATA_LIST, 0); int entityId = wrapper.get(Types.VAR_INT, 0); EntityTracker1_9 tracker = wrapper.user().getEntityTracker(Protocol1_8To1_9.class); if (tracker.hasEntity(entityId)) { - handleMetadata(entityId, metadataList, wrapper.user()); + handleEntityData(entityId, metadataList, wrapper.user()); } else { wrapper.cancel(); } @@ -224,7 +224,7 @@ public class EntityPacketRewriter1_9 extends EntityRewriter { - List metadataList = wrapper.get(Types1_9.METADATA_LIST, 0); + List metadataList = wrapper.get(Types1_9.ENTITY_DATA_LIST, 0); int entityID = wrapper.get(Types.VAR_INT, 0); EntityTracker1_9 tracker = wrapper.user().getEntityTracker(Protocol1_8To1_9.class); tracker.handleMetadata(entityID, metadataList); @@ -232,7 +232,7 @@ public class EntityPacketRewriter1_9 extends EntityRewriter { - List metadataList = wrapper.get(Types1_9.METADATA_LIST, 0); + List metadataList = wrapper.get(Types1_9.ENTITY_DATA_LIST, 0); if (metadataList.isEmpty()) { wrapper.cancel(); } @@ -391,7 +391,7 @@ public class EntityPacketRewriter1_9 extends EntityRewriter { diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_8to1_9/rewriter/PlayerPacketRewriter1_9.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_8to1_9/rewriter/PlayerPacketRewriter1_9.java index fc9bbb07d..3bf58498b 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_8to1_9/rewriter/PlayerPacketRewriter1_9.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_8to1_9/rewriter/PlayerPacketRewriter1_9.java @@ -24,14 +24,14 @@ import com.viaversion.nbt.tag.ListTag; import com.viaversion.nbt.tag.StringTag; import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.minecraft.ClientWorld; +import com.viaversion.viaversion.api.minecraft.GameMode; import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_10; import com.viaversion.viaversion.api.minecraft.item.Item; import com.viaversion.viaversion.api.protocol.remapper.PacketHandler; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.type.Types; -import com.viaversion.viaversion.protocols.v1_8to1_9.packet.ClientboundPackets1_8; import com.viaversion.viaversion.protocols.v1_8to1_9.Protocol1_8To1_9; -import com.viaversion.viaversion.api.minecraft.GameMode; +import com.viaversion.viaversion.protocols.v1_8to1_9.packet.ClientboundPackets1_8; import com.viaversion.viaversion.protocols.v1_8to1_9.packet.ServerboundPackets1_9; import com.viaversion.viaversion.protocols.v1_8to1_9.provider.CommandBlockProvider; import com.viaversion.viaversion.protocols.v1_8to1_9.provider.CompressionProvider; @@ -164,7 +164,7 @@ public class PlayerPacketRewriter1_9 { final EntityTracker1_9 entityTracker = wrapper.user().getEntityTracker(Protocol1_8To1_9.class); String teamName = wrapper.get(Types.STRING, 0); if (entityTracker.isAutoTeam() - && teamName.equals(entityTracker.getCurrentTeam())) { + && teamName.equals(entityTracker.getCurrentTeam())) { // team was removed // Workaround for packet order issue wrapper.send(Protocol1_8To1_9.class); @@ -258,13 +258,13 @@ public class PlayerPacketRewriter1_9 { wrapper.passthrough(Types.VAR_INT); // ping String displayName = wrapper.read(Types.OPTIONAL_STRING); wrapper.write(Types.OPTIONAL_COMPONENT, displayName != null ? - Protocol1_8To1_9.STRING_TO_JSON.transform(wrapper, displayName) : null); + Protocol1_8To1_9.STRING_TO_JSON.transform(wrapper, displayName) : null); } else if ((action == 1) || (action == 2)) { // update gamemode || update latency wrapper.passthrough(Types.VAR_INT); } else if (action == 3) { // update display name String displayName = wrapper.read(Types.OPTIONAL_STRING); wrapper.write(Types.OPTIONAL_COMPONENT, displayName != null ? - Protocol1_8To1_9.STRING_TO_JSON.transform(wrapper, displayName) : null); + Protocol1_8To1_9.STRING_TO_JSON.transform(wrapper, displayName) : null); } } }); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_8to1_9/rewriter/SpawnPacketRewriter1_9.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_8to1_9/rewriter/SpawnPacketRewriter1_9.java index 041de33ee..4d39485c4 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_8to1_9/rewriter/SpawnPacketRewriter1_9.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_8to1_9/rewriter/SpawnPacketRewriter1_9.java @@ -21,16 +21,16 @@ import com.viaversion.viaversion.api.data.entity.EntityTracker; import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_10; import com.viaversion.viaversion.api.minecraft.item.DataItem; 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_9; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; +import com.viaversion.viaversion.api.minecraft.entitydata.types.EntityDataTypes1_9; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.protocol.remapper.ValueTransformer; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.api.type.types.version.Types1_8; import com.viaversion.viaversion.api.type.types.version.Types1_9; -import com.viaversion.viaversion.protocols.v1_8to1_9.packet.ClientboundPackets1_8; import com.viaversion.viaversion.protocols.v1_8to1_9.Protocol1_8To1_9; +import com.viaversion.viaversion.protocols.v1_8to1_9.packet.ClientboundPackets1_8; import com.viaversion.viaversion.protocols.v1_8to1_9.packet.ClientboundPackets1_9; import com.viaversion.viaversion.protocols.v1_8to1_9.storage.EntityTracker1_9; import java.util.ArrayList; @@ -102,13 +102,13 @@ public class SpawnPacketRewriter1_9 { // Convert this to meta data, woo! PacketWrapper metaPacket = wrapper.create(ClientboundPackets1_9.SET_ENTITY_DATA, wrapper1 -> { wrapper1.write(Types.VAR_INT, entityID); - List meta = new ArrayList<>(); + List meta = new ArrayList<>(); Item item = new DataItem(373, (byte) 1, (short) data, null); // Potion protocol.getItemRewriter().handleItemToClient(wrapper.user(), item); // Rewrite so that it gets the right nbt // TEMP FIX FOR POTIONS UNTIL WE FIGURE OUT HOW TO TRANSFORM SENT PACKETS - Metadata potion = new Metadata(5, MetaType1_9.ITEM, item); + EntityData potion = new EntityData(5, EntityDataTypes1_9.ITEM, item); meta.add(potion); - wrapper1.write(Types1_9.METADATA_LIST, meta); + wrapper1.write(Types1_9.ENTITY_DATA_LIST, meta); }); // Fix packet order wrapper.send(Protocol1_8To1_9.class); @@ -190,13 +190,13 @@ public class SpawnPacketRewriter1_9 { map(Types.SHORT); // 10 - Velocity Y map(Types.SHORT); // 11 - Velocity Z - map(Types1_8.METADATA_LIST, Types1_9.METADATA_LIST); + map(Types1_8.ENTITY_DATA_LIST, Types1_9.ENTITY_DATA_LIST); handler(wrapper -> { - List metadataList = wrapper.get(Types1_9.METADATA_LIST, 0); + List metadataList = wrapper.get(Types1_9.ENTITY_DATA_LIST, 0); int entityId = wrapper.get(Types.VAR_INT, 0); EntityTracker1_9 tracker = wrapper.user().getEntityTracker(Protocol1_8To1_9.class); if (tracker.hasEntity(entityId)) { - protocol.getEntityRewriter().handleMetadata(entityId, metadataList, wrapper.user()); + protocol.getEntityRewriter().handleEntityData(entityId, metadataList, wrapper.user()); } else { protocol.getLogger().warning("Unable to find entity for metadata, entity ID: " + entityId); metadataList.clear(); @@ -204,7 +204,7 @@ public class SpawnPacketRewriter1_9 { }); // Handler for meta data handler(wrapper -> { - List metadataList = wrapper.get(Types1_9.METADATA_LIST, 0); + List metadataList = wrapper.get(Types1_9.ENTITY_DATA_LIST, 0); int entityID = wrapper.get(Types.VAR_INT, 0); EntityTracker1_9 tracker = wrapper.user().getEntityTracker(Protocol1_8To1_9.class); tracker.handleMetadata(entityID, metadataList); @@ -267,14 +267,14 @@ public class SpawnPacketRewriter1_9 { } }); - map(Types1_8.METADATA_LIST, Types1_9.METADATA_LIST); + map(Types1_8.ENTITY_DATA_LIST, Types1_9.ENTITY_DATA_LIST); handler(wrapper -> { - List metadataList = wrapper.get(Types1_9.METADATA_LIST, 0); + List metadataList = wrapper.get(Types1_9.ENTITY_DATA_LIST, 0); int entityId = wrapper.get(Types.VAR_INT, 0); EntityTracker1_9 tracker = wrapper.user().getEntityTracker(Protocol1_8To1_9.class); if (tracker.hasEntity(entityId)) { - protocol.getEntityRewriter().handleMetadata(entityId, metadataList, wrapper.user()); + protocol.getEntityRewriter().handleEntityData(entityId, metadataList, wrapper.user()); } else { protocol.getLogger().warning("Unable to find entity for metadata, entity ID: " + entityId); metadataList.clear(); @@ -283,7 +283,7 @@ public class SpawnPacketRewriter1_9 { // Handler for meta data handler(wrapper -> { - List metadataList = wrapper.get(Types1_9.METADATA_LIST, 0); + List metadataList = wrapper.get(Types1_9.ENTITY_DATA_LIST, 0); int entityID = wrapper.get(Types.VAR_INT, 0); EntityTracker1_9 tracker = wrapper.user().getEntityTracker(Protocol1_8To1_9.class); tracker.handleMetadata(entityID, metadataList); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_8to1_9/rewriter/WorldPacketRewriter1_9.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_8to1_9/rewriter/WorldPacketRewriter1_9.java index 6ca3163ea..64f5f1dd0 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_8to1_9/rewriter/WorldPacketRewriter1_9.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_8to1_9/rewriter/WorldPacketRewriter1_9.java @@ -35,15 +35,15 @@ import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.api.type.types.chunk.BulkChunkType1_8; import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_8; import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_9_1; -import com.viaversion.viaversion.protocols.v1_8to1_9.packet.ClientboundPackets1_8; -import com.viaversion.viaversion.protocols.v1_8to1_9.packet.ServerboundPackets1_8; import com.viaversion.viaversion.protocols.v1_8to1_9.Protocol1_8To1_9; +import com.viaversion.viaversion.protocols.v1_8to1_9.data.EffectIds1_8; import com.viaversion.viaversion.protocols.v1_8to1_9.data.PotionIds1_8; +import com.viaversion.viaversion.protocols.v1_8to1_9.data.SoundEffects1_8; +import com.viaversion.viaversion.protocols.v1_8to1_9.packet.ClientboundPackets1_8; import com.viaversion.viaversion.protocols.v1_8to1_9.packet.ClientboundPackets1_9; +import com.viaversion.viaversion.protocols.v1_8to1_9.packet.ServerboundPackets1_8; import com.viaversion.viaversion.protocols.v1_8to1_9.packet.ServerboundPackets1_9; import com.viaversion.viaversion.protocols.v1_8to1_9.provider.CommandBlockProvider; -import com.viaversion.viaversion.protocols.v1_8to1_9.data.EffectIds1_8; -import com.viaversion.viaversion.protocols.v1_8to1_9.data.SoundEffects1_8; import com.viaversion.viaversion.protocols.v1_8to1_9.storage.ClientChunks; import com.viaversion.viaversion.protocols.v1_8to1_9.storage.EntityTracker1_9; import com.viaversion.viaversion.util.ComponentUtil; @@ -303,7 +303,7 @@ public class WorldPacketRewriter1_9 { // Method to identify the sword in hand boolean isSword = showShieldWhenSwordInHand ? tracker.hasSwordInHand() - : item != null && Protocol1_8To1_9.isSword(item.identifier()); + : item != null && Protocol1_8To1_9.isSword(item.identifier()); if (isSword) { if (hand == 0 && !tracker.isBlocking()) { @@ -320,7 +320,7 @@ public class WorldPacketRewriter1_9 { // Use the main hand to trigger the blocking boolean blockUsingMainHand = Via.getConfig().isNoDelayShieldBlocking() - && !showShieldWhenSwordInHand; + && !showShieldWhenSwordInHand; if (blockUsingMainHand && hand == 1 || !blockUsingMainHand && hand == 0) { wrapper.cancel(); diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_8to1_9/storage/EntityTracker1_9.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_8to1_9/storage/EntityTracker1_9.java index 1444a0bb6..3766249c2 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_8to1_9/storage/EntityTracker1_9.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_8to1_9/storage/EntityTracker1_9.java @@ -23,18 +23,17 @@ import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.legacy.bossbar.BossBar; import com.viaversion.viaversion.api.legacy.bossbar.BossColor; import com.viaversion.viaversion.api.legacy.bossbar.BossStyle; +import com.viaversion.viaversion.api.minecraft.GameMode; import com.viaversion.viaversion.api.minecraft.Position; import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_10.EntityType; import com.viaversion.viaversion.api.minecraft.item.DataItem; 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_9; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; +import com.viaversion.viaversion.api.minecraft.entitydata.types.EntityDataTypes1_9; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.data.entity.EntityTrackerBase; import com.viaversion.viaversion.protocols.v1_8to1_9.Protocol1_8To1_9; -import com.viaversion.viaversion.api.minecraft.GameMode; import com.viaversion.viaversion.protocols.v1_8to1_9.packet.ClientboundPackets1_9; import com.viaversion.viaversion.protocols.v1_8to1_9.provider.BossBarProvider; import com.viaversion.viaversion.protocols.v1_8to1_9.provider.EntityIdProvider; @@ -60,10 +59,10 @@ public class EntityTracker1_9 extends EntityTrackerBase { private final IntSet validBlocking = new IntOpenHashSet(); private final IntSet knownHolograms = new IntOpenHashSet(); private final Set blockInteractions = Collections.newSetFromMap(CacheBuilder.newBuilder() - .maximumSize(1000) - .expireAfterAccess(250, TimeUnit.MILLISECONDS) - .build() - .asMap()); + .maximumSize(1000) + .expireAfterAccess(250, TimeUnit.MILLISECONDS) + .build() + .asMap()); private boolean blocking; private boolean autoTeam; private Position currentlyDigging; @@ -152,16 +151,16 @@ public class EntityTracker1_9 extends EntityTrackerBase { blockInteractions.add(p); } - public void handleMetadata(int entityId, List metadataList) { + public void handleMetadata(int entityId, List metadataList) { com.viaversion.viaversion.api.minecraft.entities.EntityType type = entityType(entityId); if (type == null) { return; } - for (Metadata metadata : new ArrayList<>(metadataList)) { + for (EntityData metadata : new ArrayList<>(metadataList)) { if (type == EntityType.SKELETON) { if ((getMetaByIndex(metadataList, 12)) == null) { - metadataList.add(new Metadata(12, MetaType1_9.BOOLEAN, true)); + metadataList.add(new EntityData(12, EntityDataTypes1_9.BOOLEAN, true)); } } @@ -192,23 +191,23 @@ public class EntityTracker1_9 extends EntityTrackerBase { } } if (metadata.id() == 12 && Via.getConfig().isLeftHandedHandling()) { // Player model - metadataList.add(new Metadata( - 13, // Main hand - MetaType1_9.BYTE, - (byte) (((((byte) metadata.getValue()) & 0x80) != 0) ? 0 : 1) + metadataList.add(new EntityData( + 13, // Main hand + EntityDataTypes1_9.BYTE, + (byte) (((((byte) metadata.getValue()) & 0x80) != 0) ? 0 : 1) )); } } if (type == EntityType.ARMOR_STAND && Via.getConfig().isHologramPatch()) { if (metadata.id() == 0 && getMetaByIndex(metadataList, 10) != null) { - Metadata meta = getMetaByIndex(metadataList, 10); //Only happens if the armorstand is small + EntityData meta = getMetaByIndex(metadataList, 10); //Only happens if the armorstand is small byte data = (byte) metadata.getValue(); // Check invisible | Check small | Check if custom name is empty | Check if custom name visible is true - Metadata displayName; - Metadata displayNameVisible; + EntityData displayName; + EntityData displayNameVisible; if ((data & 0x20) == 0x20 && ((byte) meta.getValue() & 0x01) == 0x01 - && (displayName = getMetaByIndex(metadataList, 2)) != null && !((String) displayName.getValue()).isEmpty() - && (displayNameVisible = getMetaByIndex(metadataList, 3)) != null && (boolean) displayNameVisible.getValue()) { + && (displayName = getMetaByIndex(metadataList, 2)) != null && !((String) displayName.getValue()).isEmpty() + && (displayNameVisible = getMetaByIndex(metadataList, 3)) != null && (boolean) displayNameVisible.getValue()) { if (!knownHolograms.contains(entityId)) { knownHolograms.add(entityId); // Send movement @@ -263,8 +262,8 @@ public class EntityTracker1_9 extends EntityTrackerBase { } } - public Metadata getMetaByIndex(List list, int index) { - for (Metadata meta : list) + public EntityData getMetaByIndex(List list, int index) { + for (EntityData meta : list) if (index == meta.id()) { return meta; } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_9_1to1_9_3/Protocol1_9_1To1_9_3.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_9_1to1_9_3/Protocol1_9_1To1_9_3.java index 945324a10..cfffc4a4f 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_9_1to1_9_3/Protocol1_9_1To1_9_3.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_9_1to1_9_3/Protocol1_9_1To1_9_3.java @@ -17,10 +17,10 @@ */ package com.viaversion.viaversion.protocols.v1_9_1to1_9_3; +import com.google.gson.JsonElement; import com.viaversion.nbt.tag.CompoundTag; import com.viaversion.nbt.tag.IntTag; import com.viaversion.nbt.tag.StringTag; -import com.google.gson.JsonElement; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.minecraft.ClientWorld; import com.viaversion.viaversion.api.minecraft.Position; @@ -32,7 +32,6 @@ import com.viaversion.viaversion.api.protocol.AbstractProtocol; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.protocol.remapper.ValueTransformer; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_9_1; import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_9_3; @@ -103,10 +102,10 @@ public class Protocol1_9_1To1_9_3 extends AbstractProtocol> 4; if (FakeTileEntities1_9_1.isTileEntity(id)) { tags.add(FakeTileEntities1_9_1.createTileEntity( - ChunkSection.xFromIndex(idx) + (chunk.getX() << 4), - ChunkSection.yFromIndex(idx) + (s << 4), - ChunkSection.zFromIndex(idx) + (chunk.getZ() << 4), - id + ChunkSection.xFromIndex(idx) + (chunk.getX() << 4), + ChunkSection.yFromIndex(idx) + (s << 4), + ChunkSection.zFromIndex(idx) + (chunk.getZ() << 4), + id )); } } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_9_3to1_10/Protocol1_9_3To1_10.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_9_3to1_10/Protocol1_9_3To1_10.java index 419e19406..247cdbcf8 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_9_3to1_10/Protocol1_9_3To1_10.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_9_3to1_10/Protocol1_9_3To1_10.java @@ -23,12 +23,11 @@ import com.viaversion.viaversion.api.minecraft.ClientWorld; import com.viaversion.viaversion.api.minecraft.chunks.Chunk; import com.viaversion.viaversion.api.minecraft.chunks.ChunkSection; import com.viaversion.viaversion.api.minecraft.chunks.PaletteType; -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; import com.viaversion.viaversion.api.protocol.AbstractProtocol; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; import com.viaversion.viaversion.api.protocol.remapper.ValueTransformer; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_9_3; import com.viaversion.viaversion.api.type.types.version.Types1_9; @@ -47,11 +46,11 @@ public class Protocol1_9_3To1_10 extends AbstractProtocol, List> TRANSFORM_METADATA = new ValueTransformer<>(Types1_9.METADATA_LIST) { + public static final ValueTransformer, List> TRANSFORM_METADATA = new ValueTransformer<>(Types1_9.ENTITY_DATA_LIST) { @Override - public List transform(PacketWrapper wrapper, List inputValue) { - List metaList = new CopyOnWriteArrayList<>(inputValue); - for (Metadata m : metaList) { + public List transform(PacketWrapper wrapper, List inputValue) { + List metaList = new CopyOnWriteArrayList<>(inputValue); + for (EntityData m : metaList) { if (m.id() >= 5) m.setId(m.id() + 1); } @@ -106,7 +105,7 @@ public class Protocol1_9_3To1_10 extends AbstractProtocol { diff --git a/common/src/main/java/com/viaversion/viaversion/rewriter/BlockRewriter.java b/common/src/main/java/com/viaversion/viaversion/rewriter/BlockRewriter.java index a8e1fead1..c90478296 100644 --- a/common/src/main/java/com/viaversion/viaversion/rewriter/BlockRewriter.java +++ b/common/src/main/java/com/viaversion/viaversion/rewriter/BlockRewriter.java @@ -17,8 +17,8 @@ */ package com.viaversion.viaversion.rewriter; -import com.viaversion.nbt.tag.CompoundTag; import com.google.common.base.Preconditions; +import com.viaversion.nbt.tag.CompoundTag; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.data.Mappings; import com.viaversion.viaversion.api.data.entity.EntityTracker; @@ -66,7 +66,7 @@ public class BlockRewriter { return new BlockRewriter<>(protocol, Types.BLOCK_POSITION1_14, Types.COMPOUND_TAG); } - public void registerBlockAction(C packetType) { + public void registerBlockEvent(C packetType) { protocol.registerClientbound(packetType, new PacketHandlers() { @Override public void register() { @@ -93,7 +93,7 @@ public class BlockRewriter { }); } - public void registerBlockChange(C packetType) { + public void registerBlockUpdate(C packetType) { protocol.registerClientbound(packetType, new PacketHandlers() { @Override public void register() { @@ -104,7 +104,7 @@ public class BlockRewriter { }); } - public void registerMultiBlockChange(C packetType) { + public void registerChunkBlocksUpdate(C packetType) { protocol.registerClientbound(packetType, new PacketHandlers() { @Override public void register() { @@ -119,7 +119,7 @@ public class BlockRewriter { }); } - public void registerVarLongMultiBlockChange(C packetType) { + public void registerSectionBlocksUpdate(C packetType) { protocol.registerClientbound(packetType, new PacketHandlers() { @Override public void register() { @@ -134,7 +134,7 @@ public class BlockRewriter { }); } - public void registerVarLongMultiBlockChange1_20(C packetType) { + public void registerSectionBlocksUpdate1_20(C packetType) { protocol.registerClientbound(packetType, new PacketHandlers() { @Override public void register() { @@ -148,12 +148,12 @@ public class BlockRewriter { }); } - public void registerAcknowledgePlayerDigging(C packetType) { + public void registerBlockBreakAck(C packetType) { // Same exact handler - registerBlockChange(packetType); + registerBlockUpdate(packetType); } - public void registerEffect(C packetType, int playRecordId, int blockBreakId) { + public void registerLevelEvent(C packetType, int playRecordId, int blockBreakId) { protocol.registerClientbound(packetType, new PacketHandlers() { @Override public void register() { @@ -173,15 +173,15 @@ public class BlockRewriter { }); } - public void registerChunkData1_19(C packetType, ChunkTypeSupplier chunkTypeSupplier) { - registerChunkData1_19(packetType, chunkTypeSupplier, null); + public void registerLevelChunk1_19(C packetType, ChunkTypeSupplier chunkTypeSupplier) { + registerLevelChunk1_19(packetType, chunkTypeSupplier, null); } - public void registerChunkData1_19(C packetType, ChunkTypeSupplier chunkTypeSupplier, @Nullable BiConsumer blockEntityHandler) { - protocol.registerClientbound(packetType, chunkDataHandler1_19(chunkTypeSupplier, blockEntityHandler)); + public void registerLevelChunk1_19(C packetType, ChunkTypeSupplier chunkTypeSupplier, @Nullable BiConsumer blockEntityHandler) { + protocol.registerClientbound(packetType, chunkHandler1_19(chunkTypeSupplier, blockEntityHandler)); } - public PacketHandler chunkDataHandler1_19(ChunkTypeSupplier chunkTypeSupplier, @Nullable BiConsumer blockEntityHandler) { + public PacketHandler chunkHandler1_19(ChunkTypeSupplier chunkTypeSupplier, @Nullable BiConsumer blockEntityHandler) { return wrapper -> { final Chunk chunk = handleChunk1_19(wrapper, chunkTypeSupplier); final Mappings blockEntityMappings = protocol.getMappingData().getBlockEntityMappings(); @@ -205,7 +205,7 @@ public class BlockRewriter { }; } - public Chunk handleChunk1_19(PacketWrapper wrapper, ChunkTypeSupplier chunkTypeSupplier) throws Exception { + public Chunk handleChunk1_19(PacketWrapper wrapper, ChunkTypeSupplier chunkTypeSupplier) { final EntityTracker tracker = protocol.getEntityRewriter().tracker(wrapper.user()); Preconditions.checkArgument(tracker.biomesSent() != -1, "Biome count not set"); Preconditions.checkArgument(tracker.currentWorldSectionHeight() != -1, "Section height not set"); diff --git a/common/src/main/java/com/viaversion/viaversion/rewriter/CommandRewriter.java b/common/src/main/java/com/viaversion/viaversion/rewriter/CommandRewriter.java index a5af04e41..ae6f324bd 100644 --- a/common/src/main/java/com/viaversion/viaversion/rewriter/CommandRewriter.java +++ b/common/src/main/java/com/viaversion/viaversion/rewriter/CommandRewriter.java @@ -22,7 +22,6 @@ import com.viaversion.viaversion.api.data.FullMappings; import com.viaversion.viaversion.api.protocol.Protocol; import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import java.util.HashMap; import java.util.Map; diff --git a/common/src/main/java/com/viaversion/viaversion/rewriter/ComponentRewriter.java b/common/src/main/java/com/viaversion/viaversion/rewriter/ComponentRewriter.java index dd873e766..43f431ff0 100644 --- a/common/src/main/java/com/viaversion/viaversion/rewriter/ComponentRewriter.java +++ b/common/src/main/java/com/viaversion/viaversion/rewriter/ComponentRewriter.java @@ -17,16 +17,16 @@ */ package com.viaversion.viaversion.rewriter; -import com.viaversion.nbt.tag.CompoundTag; -import com.viaversion.nbt.tag.ListTag; -import com.viaversion.nbt.tag.StringTag; -import com.viaversion.nbt.tag.Tag; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.google.gson.JsonPrimitive; import com.google.gson.JsonSyntaxException; +import com.viaversion.nbt.tag.CompoundTag; +import com.viaversion.nbt.tag.ListTag; +import com.viaversion.nbt.tag.StringTag; +import com.viaversion.nbt.tag.Tag; import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.protocol.Protocol; @@ -61,7 +61,7 @@ public class ComponentRewriter { protocol.registerClientbound(packetType, this::passthroughAndProcess); } - public void registerBossBar(final C packetType) { + public void registerBossEvent(final C packetType) { protocol.registerClientbound(packetType, new PacketHandlers() { @Override public void register() { @@ -80,7 +80,7 @@ public class ComponentRewriter { /** * Handles sub 1.17 combat event components. */ - public void registerCombatEvent(final C packetType) { + public void registerPlayerCombat(final C packetType) { protocol.registerClientbound(packetType, wrapper -> { if (wrapper.passthrough(Types.VAR_INT) == 2) { wrapper.passthrough(Types.VAR_INT); @@ -118,7 +118,7 @@ public class ComponentRewriter { }); } - public void registerOpenWindow(final C packetType) { + public void registerOpenScreen(final C packetType) { protocol.registerClientbound(packetType, new PacketHandlers() { @Override public void register() { @@ -136,7 +136,7 @@ public class ComponentRewriter { }); } - public void registerCombatKill(final C packetType) { + public void registerPlayerCombatKill(final C packetType) { protocol.registerClientbound(packetType, new PacketHandlers() { @Override public void register() { @@ -147,7 +147,7 @@ public class ComponentRewriter { }); } - public void registerCombatKill1_20(final C packetType) { + public void registerPlayerCombatKill1_20(final C packetType) { protocol.registerClientbound(packetType, new PacketHandlers() { @Override public void register() { diff --git a/common/src/main/java/com/viaversion/viaversion/rewriter/EntityRewriter.java b/common/src/main/java/com/viaversion/viaversion/rewriter/EntityRewriter.java index 9ebbd1d15..1b7fab115 100644 --- a/common/src/main/java/com/viaversion/viaversion/rewriter/EntityRewriter.java +++ b/common/src/main/java/com/viaversion/viaversion/rewriter/EntityRewriter.java @@ -17,10 +17,10 @@ */ package com.viaversion.viaversion.rewriter; +import com.google.common.base.Preconditions; import com.viaversion.nbt.tag.CompoundTag; import com.viaversion.nbt.tag.ListTag; import com.viaversion.nbt.tag.NumberTag; -import com.google.common.base.Preconditions; import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.data.Int2IntMapMappings; @@ -33,8 +33,8 @@ import com.viaversion.viaversion.api.minecraft.Particle; import com.viaversion.viaversion.api.minecraft.RegistryEntry; import com.viaversion.viaversion.api.minecraft.entities.EntityType; import com.viaversion.viaversion.api.minecraft.item.Item; -import com.viaversion.viaversion.api.minecraft.metadata.MetaType; -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType; import com.viaversion.viaversion.api.protocol.Protocol; import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; @@ -45,9 +45,9 @@ import com.viaversion.viaversion.api.rewriter.RewriterBase; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.data.entity.DimensionDataImpl; -import com.viaversion.viaversion.rewriter.meta.MetaFilter; -import com.viaversion.viaversion.rewriter.meta.MetaHandlerEvent; -import com.viaversion.viaversion.rewriter.meta.MetaHandlerEventImpl; +import com.viaversion.viaversion.rewriter.entitydata.EntityDataFilter; +import com.viaversion.viaversion.rewriter.entitydata.EntityDataHandlerEvent; +import com.viaversion.viaversion.rewriter.entitydata.EntityDataHandlerEventImpl; import com.viaversion.viaversion.util.Key; import com.viaversion.viaversion.util.TagUtil; import java.util.ArrayList; @@ -61,8 +61,8 @@ import org.checkerframework.checker.nullness.qual.Nullable; public abstract class EntityRewriter> extends RewriterBase implements com.viaversion.viaversion.api.rewriter.EntityRewriter { - private static final Metadata[] EMPTY_ARRAY = new Metadata[0]; - protected final List metadataFilters = new ArrayList<>(); + private static final EntityData[] EMPTY_ARRAY = new EntityData[0]; + protected final List entityDataFilters = new ArrayList<>(); protected final boolean trackMappedType; protected Mappings typeMappings; @@ -83,66 +83,66 @@ public abstract class EntityRewriter - * Calling {@link com.viaversion.viaversion.rewriter.meta.MetaFilter.Builder#register()} will automatically register the filter on this rewriter. + * Calling {@link EntityDataFilter.Builder#register()} will automatically register the filter on this rewriter. * - * @return meta filter builder + * @return entity data filter builder */ - public MetaFilter.Builder filter() { - return new MetaFilter.Builder(this); + public EntityDataFilter.Builder filter() { + return new EntityDataFilter.Builder(this); } /** - * Registers a metadata filter. - * Note that {@link com.viaversion.viaversion.rewriter.meta.MetaFilter.Builder#register()} already calls this method. + * Registers an entity data filter. + * Note that {@link EntityDataFilter.Builder#register()} already calls this method. * * @param filter filter to register * @throws IllegalArgumentException if the filter is already registered */ - public void registerFilter(MetaFilter filter) { - Preconditions.checkArgument(!metadataFilters.contains(filter)); - metadataFilters.add(filter); + public void registerFilter(EntityDataFilter filter) { + Preconditions.checkArgument(!entityDataFilters.contains(filter)); + entityDataFilters.add(filter); } @Override - public void handleMetadata(final int entityId, final List metadataList, final UserConnection connection) { + public void handleEntityData(final int entityId, final List entityDataList, final UserConnection connection) { final TrackedEntity entity = tracker(connection).entity(entityId); final EntityType type = entity != null ? entity.entityType() : null; - for (final Metadata metadata : metadataList.toArray(EMPTY_ARRAY)) { // Copy the list to allow mutation - MetaHandlerEvent event = null; - for (final MetaFilter filter : metadataFilters) { - if (!filter.isFiltered(type, metadata)) { + for (final EntityData entityData : entityDataList.toArray(EMPTY_ARRAY)) { // Copy the list to allow mutation + EntityDataHandlerEvent event = null; + for (final EntityDataFilter filter : entityDataFilters) { + if (!filter.isFiltered(type, entityData)) { continue; } if (event == null) { // Instantiate lazily and share event instance - event = new MetaHandlerEventImpl(connection, entity, entityId, metadata, metadataList); + event = new EntityDataHandlerEventImpl(connection, entity, entityId, entityData, entityDataList); } try { - filter.handler().handle(event, metadata); + filter.handler().handle(event, entityData); } catch (final Exception e) { - logException(e, type, metadataList, metadata); - metadataList.remove(metadata); + logException(e, type, entityDataList, entityData); + entityDataList.remove(entityData); break; } if (event.cancelled()) { - // Remove meta, and break current filter loop - metadataList.remove(metadata); + // Remove entity data, and break current filter loop + entityDataList.remove(entityData); break; } } - if (event != null && event.hasExtraMeta()) { - // Finally, add newly created meta - metadataList.addAll(event.extraMeta()); + if (event != null && event.hasExtraData()) { + // Finally, add newly created entity data + entityDataList.addAll(event.extraData()); } } if (entity != null) { - entity.sentMetadata(true); + entity.sentEntityData(true); } } @@ -180,42 +180,42 @@ public abstract class EntityRewriter { - final MetaType type = meta.metaType(); + public void registerEntityDataTypeHandler(@Nullable EntityDataType itemType, @Nullable EntityDataType blockStateType, @Nullable EntityDataType optionalBlockStateType, @Nullable EntityDataType particleType, @Nullable EntityDataType particlesType) { + filter().handler((event, data) -> { + final EntityDataType type = data.dataType(); if (type == itemType) { - meta.setValue(protocol.getItemRewriter().handleItemToClient(event.user(), meta.value())); + data.setValue(protocol.getItemRewriter().handleItemToClient(event.user(), data.value())); } else if (type == blockStateType) { - int data = meta.value(); - meta.setValue(protocol.getMappingData().getNewBlockStateId(data)); + int value = data.value(); + data.setValue(protocol.getMappingData().getNewBlockStateId(value)); } else if (type == optionalBlockStateType) { - int data = meta.value(); - if (data != 0) { - meta.setValue(protocol.getMappingData().getNewBlockStateId(data)); + int value = data.value(); + if (value != 0) { + data.setValue(protocol.getMappingData().getNewBlockStateId(value)); } } else if (type == particleType) { - rewriteParticle(event.user(), meta.value()); + rewriteParticle(event.user(), data.value()); } else if (type == particlesType) { - final Particle[] particles = meta.value(); + final Particle[] particles = data.value(); for (final Particle particle : particles) { rewriteParticle(event.user(), particle); } @@ -341,27 +341,27 @@ public abstract class EntityRewriter> oldMetaType, Type> newMetaType) { + public void registerSetEntityData(C packetType, @Nullable Type> dataType, Type> mappedDataType) { protocol.registerClientbound(packetType, new PacketHandlers() { @Override public void register() { map(Types.VAR_INT); // 0 - Entity ID - if (oldMetaType != null) { - map(oldMetaType, newMetaType); + if (dataType != null) { + map(dataType, mappedDataType); } else { - map(newMetaType); + map(mappedDataType); } handler(wrapper -> { int entityId = wrapper.get(Types.VAR_INT, 0); - List metadata = wrapper.get(newMetaType, 0); - handleMetadata(entityId, metadata, wrapper.user()); + List entityData = wrapper.get(mappedDataType, 0); + handleEntityData(entityId, entityData, wrapper.user()); }); } }); } - public void registerMetadataRewriter(C packetType, Type> metaType) { - registerMetadataRewriter(packetType, null, metaType); + public void registerSetEntityData(C packetType, Type> dataType) { + registerSetEntityData(packetType, null, dataType); } public PacketHandler trackerHandler() { @@ -519,10 +519,10 @@ public abstract class EntityRewriter> metaType) { + public PacketHandler trackerAndRewriterHandler(@Nullable Type> dataType) { return wrapper -> { int entityId = wrapper.get(Types.VAR_INT, 0); int type = wrapper.get(Types.VAR_INT, 1); @@ -536,20 +536,20 @@ public abstract class EntityRewriter> metaType, EntityType entityType) { + public PacketHandler trackerAndRewriterHandler(@Nullable Type> dataType, EntityType entityType) { return wrapper -> { int entityId = wrapper.get(Types.VAR_INT, 0); // Register Type ID tracker(wrapper.user()).addEntity(entityId, entityType); - if (metaType != null) { - handleMetadata(entityId, wrapper.get(metaType, 0), wrapper.user()); + if (dataType != null) { + handleEntityData(entityId, wrapper.get(dataType, 0), wrapper.user()); } }; } @@ -599,12 +599,12 @@ public abstract class EntityRewriter metadataList, Metadata metadata) { + private void logException(Exception e, @Nullable EntityType type, List entityDataList, EntityData entityData) { if (!Via.getConfig().isSuppressMetadataErrors() || Via.getManager().isDebug()) { - protocol.getLogger().severe("An error occurred in metadata handler " + this.getClass().getSimpleName() - + " for " + (type != null ? type.name() : "untracked") + " entity type: " + metadata); - protocol.getLogger().severe(metadataList.stream().sorted(Comparator.comparingInt(Metadata::id)) - .map(Metadata::toString).collect(Collectors.joining("\n", "Full metadata: ", ""))); + protocol.getLogger().severe("An error occurred in entity data handler " + this.getClass().getSimpleName() + + " for " + (type != null ? type.name() : "untracked") + " entity type: " + entityData); + protocol.getLogger().severe(entityDataList.stream().sorted(Comparator.comparingInt(EntityData::id)) + .map(EntityData::toString).collect(Collectors.joining("\n", "Full entity data: ", ""))); protocol.getLogger().log(Level.SEVERE, "Error: ", e); } } diff --git a/common/src/main/java/com/viaversion/viaversion/rewriter/ItemRewriter.java b/common/src/main/java/com/viaversion/viaversion/rewriter/ItemRewriter.java index 9e818096a..f770f39da 100644 --- a/common/src/main/java/com/viaversion/viaversion/rewriter/ItemRewriter.java +++ b/common/src/main/java/com/viaversion/viaversion/rewriter/ItemRewriter.java @@ -53,7 +53,7 @@ public class ItemRewriter { int itemId = wrapper.read(Types.VAR_INT); wrapper.write(Types.VAR_INT, protocol.getMappingData().getNewItemId(itemId)); @@ -235,7 +235,7 @@ public class ItemRewriter { wrapper.passthrough(Types.VAR_INT); int size = wrapper.passthrough(Types.UNSIGNED_BYTE); @@ -260,7 +260,7 @@ public class ItemRewriter { wrapper.passthrough(Types.VAR_INT); // Container id int size = wrapper.passthrough(Types.VAR_INT); @@ -282,7 +282,7 @@ public class ItemRewriter costType, final Type mappedCostType, final Type optionalCostType, final Type mappedOptionalCostType @@ -383,7 +383,7 @@ public class ItemRewriter coordType) { + public void registerLevelParticles(C packetType, Type coordType) { protocol.registerClientbound(packetType, new PacketHandlers() { @Override public void register() { @@ -419,12 +419,12 @@ public class ItemRewriter unmappedParticleType, Type mappedParticleType) { + public void registerLevelParticles1_20_5(C packetType, Type unmappedParticleType, Type mappedParticleType) { protocol.registerClientbound(packetType, new PacketHandlers() { @Override public void register() { @@ -494,11 +494,11 @@ public class ItemRewriter idType) { + public PacketHandler levelParticlesHandler(Type idType) { return wrapper -> { int id = wrapper.get(idType, 0); if (id == -1) { diff --git a/common/src/main/java/com/viaversion/viaversion/rewriter/RecipeRewriter.java b/common/src/main/java/com/viaversion/viaversion/rewriter/RecipeRewriter.java index 1d5c087b1..a713d9d6d 100644 --- a/common/src/main/java/com/viaversion/viaversion/rewriter/RecipeRewriter.java +++ b/common/src/main/java/com/viaversion/viaversion/rewriter/RecipeRewriter.java @@ -150,7 +150,7 @@ public class RecipeRewriter { handleIngredient(wrapper); // Additions } - protected @Nullable Item rewrite(UserConnection connection, @Nullable Item item) { + protected @Nullable Item rewrite(UserConnection connection, @Nullable Item item) { if (protocol.getItemRewriter() != null) { return protocol.getItemRewriter().handleItemToClient(connection, item); } diff --git a/common/src/main/java/com/viaversion/viaversion/rewriter/SoundRewriter.java b/common/src/main/java/com/viaversion/viaversion/rewriter/SoundRewriter.java index fb5e26ae6..15ffbadc1 100644 --- a/common/src/main/java/com/viaversion/viaversion/rewriter/SoundRewriter.java +++ b/common/src/main/java/com/viaversion/viaversion/rewriter/SoundRewriter.java @@ -49,7 +49,7 @@ public class SoundRewriter { }); } - public void register1_19_3Sound(C packetType) { + public void registerSound1_19_3(C packetType) { protocol.registerClientbound(packetType, soundHolderHandler()); } diff --git a/common/src/main/java/com/viaversion/viaversion/rewriter/StatisticsRewriter.java b/common/src/main/java/com/viaversion/viaversion/rewriter/StatisticsRewriter.java index 4ec185473..1a36177ad 100644 --- a/common/src/main/java/com/viaversion/viaversion/rewriter/StatisticsRewriter.java +++ b/common/src/main/java/com/viaversion/viaversion/rewriter/StatisticsRewriter.java @@ -70,11 +70,11 @@ public class StatisticsRewriter { protected @Nullable IdRewriteFunction getRewriter(RegistryType type) { return switch (type) { case BLOCK -> - protocol.getMappingData().getBlockMappings() != null ? id -> protocol.getMappingData().getNewBlockId(id) : null; + protocol.getMappingData().getBlockMappings() != null ? id -> protocol.getMappingData().getNewBlockId(id) : null; case ITEM -> - protocol.getMappingData().getItemMappings() != null ? id -> protocol.getMappingData().getNewItemId(id) : null; + protocol.getMappingData().getItemMappings() != null ? id -> protocol.getMappingData().getNewItemId(id) : null; case ENTITY -> - protocol.getEntityRewriter() != null ? id -> protocol.getEntityRewriter().newEntityId(id) : null; + protocol.getEntityRewriter() != null ? id -> protocol.getEntityRewriter().newEntityId(id) : null; default -> throw new IllegalArgumentException("Unknown registry type in statistics packet: " + type); }; } diff --git a/common/src/main/java/com/viaversion/viaversion/rewriter/TagRewriter.java b/common/src/main/java/com/viaversion/viaversion/rewriter/TagRewriter.java index 0725cf337..3075a5fb9 100644 --- a/common/src/main/java/com/viaversion/viaversion/rewriter/TagRewriter.java +++ b/common/src/main/java/com/viaversion/viaversion/rewriter/TagRewriter.java @@ -25,7 +25,6 @@ import com.viaversion.viaversion.api.protocol.Protocol; import com.viaversion.viaversion.api.protocol.packet.ClientboundPacketType; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.remapper.PacketHandler; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.util.Key; import it.unimi.dsi.fastutil.ints.IntArrayList; @@ -223,11 +222,11 @@ public class TagRewriter implements com.viavers MappingData mappingData = protocol.getMappingData(); return switch (tagType) { case BLOCK -> - mappingData != null && mappingData.getBlockMappings() != null ? mappingData::getNewBlockId : null; + mappingData != null && mappingData.getBlockMappings() != null ? mappingData::getNewBlockId : null; case ITEM -> - mappingData != null && mappingData.getItemMappings() != null ? mappingData::getNewItemId : null; + mappingData != null && mappingData.getItemMappings() != null ? mappingData::getNewItemId : null; case ENTITY -> - protocol.getEntityRewriter() != null ? id -> protocol.getEntityRewriter().newEntityId(id) : null; + protocol.getEntityRewriter() != null ? id -> protocol.getEntityRewriter().newEntityId(id) : null; case FLUID, GAME_EVENT -> null; }; } diff --git a/common/src/main/java/com/viaversion/viaversion/rewriter/meta/MetaFilter.java b/common/src/main/java/com/viaversion/viaversion/rewriter/entitydata/EntityDataFilter.java similarity index 80% rename from common/src/main/java/com/viaversion/viaversion/rewriter/meta/MetaFilter.java rename to common/src/main/java/com/viaversion/viaversion/rewriter/entitydata/EntityDataFilter.java index 9f7567156..564c553d9 100644 --- a/common/src/main/java/com/viaversion/viaversion/rewriter/meta/MetaFilter.java +++ b/common/src/main/java/com/viaversion/viaversion/rewriter/entitydata/EntityDataFilter.java @@ -16,21 +16,21 @@ * along with this program. If not, see . */ -package com.viaversion.viaversion.rewriter.meta; +package com.viaversion.viaversion.rewriter.entitydata; import com.google.common.base.Preconditions; import com.viaversion.viaversion.api.minecraft.entities.EntityType; -import com.viaversion.viaversion.api.minecraft.metadata.MetaType; -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityDataType; import com.viaversion.viaversion.rewriter.EntityRewriter; import it.unimi.dsi.fastutil.ints.Int2ObjectFunction; import java.util.Objects; import org.checkerframework.checker.nullness.qual.Nullable; -public record MetaFilter(@Nullable EntityType type, boolean filterFamily, - @Nullable MetaType metaType, int index, MetaHandler handler) { +public record EntityDataFilter(@Nullable EntityType type, boolean filterFamily, + @Nullable EntityDataType dataType, int index, EntityDataHandler handler) { - public MetaFilter { + public EntityDataFilter { Preconditions.checkNotNull(handler, "MetaHandler cannot be null"); } @@ -53,12 +53,12 @@ public record MetaFilter(@Nullable EntityType type, boolean filterFamily, } /** - * Returns the meta type to filter, or null. + * Returns the entity data type to filter, or null. * - * @return the meta type to filter, or null if unset + * @return the entity data type to filter, or null if unset */ - public @Nullable MetaType metaType() { - return metaType; + public @Nullable EntityDataType dataType() { + return dataType; } /** @@ -66,7 +66,7 @@ public record MetaFilter(@Nullable EntityType type, boolean filterFamily, * * @return metadata handler */ - public MetaHandler handler() { + public EntityDataHandler handler() { return handler; } @@ -86,12 +86,12 @@ public record MetaFilter(@Nullable EntityType type, boolean filterFamily, * @param metadata metadata * @return whether the meta should be filtered */ - public boolean isFiltered(@Nullable EntityType type, Metadata metadata) { + public boolean isFiltered(@Nullable EntityType type, EntityData metadata) { // Check if no specific index is filtered or the indexes are equal // Then check if the filter has no entity type or the type is equal to or part of the filtered parent type return (this.index == -1 || metadata.id() == this.index) - && (this.type == null || matchesType(type)) - && (this.metaType == null || metadata.metaType() == this.metaType); + && (this.type == null || matchesType(type)) + && (this.dataType == null || metadata.dataType() == this.dataType); } private boolean matchesType(EntityType type) { @@ -105,11 +105,11 @@ public record MetaFilter(@Nullable EntityType type, boolean filterFamily, public boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - MetaFilter that = (MetaFilter) o; + EntityDataFilter that = (EntityDataFilter) o; if (index != that.index) return false; if (filterFamily != that.filterFamily) return false; if (!handler.equals(that.handler)) return false; - if (!Objects.equals(metaType, that.metaType)) return false; + if (!Objects.equals(dataType, that.dataType)) return false; return Objects.equals(type, that.type); } @@ -117,7 +117,7 @@ public record MetaFilter(@Nullable EntityType type, boolean filterFamily, public int hashCode() { int result = handler.hashCode(); result = 31 * result + (type != null ? type.hashCode() : 0); - result = 31 * result + (metaType != null ? metaType.hashCode() : 0); + result = 31 * result + (dataType != null ? dataType.hashCode() : 0); result = 31 * result + index; result = 31 * result + (filterFamily ? 1 : 0); return result; @@ -125,30 +125,30 @@ public record MetaFilter(@Nullable EntityType type, boolean filterFamily, @Override public String toString() { - return "MetaFilter{" + - "type=" + type + - ", filterFamily=" + filterFamily + - ", metaType=" + metaType + - ", index=" + index + - ", handler=" + handler + - '}'; + return "EntityDataFilter{" + + "type=" + type + + ", filterFamily=" + filterFamily + + ", dataType=" + dataType + + ", index=" + index + + ", handler=" + handler + + '}'; } public static final class Builder { private final EntityRewriter rewriter; private EntityType type; - private MetaType metaType; + private EntityDataType dataType; private int index = -1; private boolean filterFamily; - private MetaHandler handler; + private EntityDataHandler handler; public Builder(EntityRewriter rewriter) { this.rewriter = rewriter; } - public Builder metaType(MetaType metaType) { - Preconditions.checkArgument(this.metaType == null); - this.metaType = metaType; + public Builder dataType(EntityDataType dataType) { + Preconditions.checkArgument(this.dataType == null); + this.dataType = dataType; return this; } @@ -192,7 +192,7 @@ public record MetaFilter(@Nullable EntityType type, boolean filterFamily, return this; } - public Builder handlerNoRegister(MetaHandler handler) { + public Builder handlerNoRegister(EntityDataHandler handler) { Preconditions.checkArgument(this.handler == null); this.handler = handler; return this; @@ -205,17 +205,17 @@ public record MetaFilter(@Nullable EntityType type, boolean filterFamily, * @param handler metadata handler * @throws IllegalArgumentException if a handler has already been set */ - public void handler(MetaHandler handler) { + public void handler(EntityDataHandler handler) { Preconditions.checkArgument(this.handler == null); this.handler = handler; register(); } - public void mapMetaType(Int2ObjectFunction updateFunction) { + public void mapDataType(Int2ObjectFunction updateFunction) { handler((event, meta) -> { - MetaType mappedType = updateFunction.apply(meta.metaType().typeId()); + EntityDataType mappedType = updateFunction.apply(meta.dataType().typeId()); if (mappedType != null) { - meta.setMetaType(mappedType); + meta.setDataType(mappedType); } else { event.cancel(); } @@ -292,8 +292,8 @@ public record MetaFilter(@Nullable EntityType type, boolean filterFamily, * * @return created meta filter */ - public MetaFilter build() { - return new MetaFilter(type, filterFamily, metaType, index, handler); + public EntityDataFilter build() { + return new EntityDataFilter(type, filterFamily, dataType, index, handler); } } } diff --git a/common/src/main/java/com/viaversion/viaversion/rewriter/meta/MetaHandler.java b/common/src/main/java/com/viaversion/viaversion/rewriter/entitydata/EntityDataHandler.java similarity index 67% rename from common/src/main/java/com/viaversion/viaversion/rewriter/meta/MetaHandler.java rename to common/src/main/java/com/viaversion/viaversion/rewriter/entitydata/EntityDataHandler.java index f6cb74ac8..7b069ebf6 100644 --- a/common/src/main/java/com/viaversion/viaversion/rewriter/meta/MetaHandler.java +++ b/common/src/main/java/com/viaversion/viaversion/rewriter/entitydata/EntityDataHandler.java @@ -16,18 +16,18 @@ * along with this program. If not, see . */ -package com.viaversion.viaversion.rewriter.meta; +package com.viaversion.viaversion.rewriter.entitydata; -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; @FunctionalInterface -public interface MetaHandler { +public interface EntityDataHandler { /** - * Handles a metadata entry of an entity. + * Handles an entity data entry of. * - * @param event metadata event - * @param meta metadata, convenience parameter for {@link MetaHandlerEvent#meta()} + * @param event entity data event + * @param data entity data, convenience parameter for {@link EntityDataHandlerEvent#data()} */ - void handle(MetaHandlerEvent event, Metadata meta); + void handle(EntityDataHandlerEvent event, EntityData data); } diff --git a/common/src/main/java/com/viaversion/viaversion/rewriter/meta/MetaHandlerEvent.java b/common/src/main/java/com/viaversion/viaversion/rewriter/entitydata/EntityDataHandlerEvent.java similarity index 53% rename from common/src/main/java/com/viaversion/viaversion/rewriter/meta/MetaHandlerEvent.java rename to common/src/main/java/com/viaversion/viaversion/rewriter/entitydata/EntityDataHandlerEvent.java index c42512b6c..afa2d3d14 100644 --- a/common/src/main/java/com/viaversion/viaversion/rewriter/meta/MetaHandlerEvent.java +++ b/common/src/main/java/com/viaversion/viaversion/rewriter/entitydata/EntityDataHandlerEvent.java @@ -15,16 +15,16 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.viaversion.viaversion.rewriter.meta; +package com.viaversion.viaversion.rewriter.entitydata; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.data.entity.TrackedEntity; import com.viaversion.viaversion.api.minecraft.entities.EntityType; -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; import java.util.List; import org.checkerframework.checker.nullness.qual.Nullable; -public interface MetaHandlerEvent { +public interface EntityDataHandlerEvent { /** * Returns the user connection the metadata is sent to. @@ -48,7 +48,7 @@ public interface MetaHandlerEvent { @Nullable TrackedEntity trackedEntity(); /** - * Returns the entity type of the entity the metadata belongs to if tracked. + * Returns the entity type of the entity data belongs to if tracked. * * @return entity type of the entity if tracked, else null */ @@ -57,83 +57,83 @@ public interface MetaHandlerEvent { } /** - * Returns the metadata index. + * Returns the entity data index. * - * @return return meta index + * @return return entity data index */ default int index() { - return meta().id(); + return data().id(); } /** - * Sets the metadata index. + * Sets the entity data index. * - * @param index new metadata index + * @param index new entity data index */ default void setIndex(int index) { - meta().setId(index); + data().setId(index); } /** - * Returns the metadata. + * Returns the entity data. * - * @return return metadata + * @return return entity data */ - Metadata meta(); + EntityData data(); /** - * Prevents other handlers from being called with this metadata entry and removes it from the list. + * Prevents other handlers from being called with this entity data entry and removes it from the list. */ void cancel(); /** - * Returns whether this metadata entry should be removed. + * Returns whether this entity data entry should be removed. * * @return true if cancelled/removed */ boolean cancelled(); /** - * Returns metadata by the given index if present. + * Returns entity data by the given index if present. * - * @param index metadata index - * @return metadata if present, else null + * @param index entity data index + * @return entity data if present, else null */ - @Nullable Metadata metaAtIndex(int index); + @Nullable EntityData dataAtIndex(int index); /** - * Returns an immutable metadata view. - * This list is not sorted or indexed by the actual metadata indexes. + * Returns an immutable entity data view. + * This list is not sorted or indexed by the actual entity data indexes. * - * @return immutable metadata list - * @see #metaAtIndex(int) + * @return immutable entity data list + * @see #dataAtIndex(int) * @see #cancel() - * @see #createExtraMeta(Metadata) + * @see #createExtraData(EntityData) */ - List metadataList(); + List dataList(); /** - * Returns additionally created metadata. - * May be null; use {@link #createExtraMeta(Metadata)} for adding metadata. + * Returns additionally created entity data. + * May be null; use {@link #createExtraData(EntityData)} for adding entity data. * - * @return additionally created metadata if present + * @return additionally created entity data if present */ - @Nullable List extraMeta(); + @Nullable List extraData(); /** - * Returns whether additionally created metadata will be added. + * Returns whether additionally created entity data will be added. * - * @return true if additionally created metadata is present + * @return true if additionally created entity data is present */ - default boolean hasExtraMeta() { - return extraMeta() != null; + default boolean hasExtraData() { + return extraData() != null; } /** - * Adds the given metadata to the metadata list. - * This metadata will not be passed through handlers of the current loop. + * Adds the given entity data to the entity data list. + * This entity data will not be passed through handlers of the current loop. * - * @param metadata metadata + * @param entityData entity data */ - void createExtraMeta(Metadata metadata); + void createExtraData(EntityData entityData); } diff --git a/common/src/main/java/com/viaversion/viaversion/rewriter/meta/MetaHandlerEventImpl.java b/common/src/main/java/com/viaversion/viaversion/rewriter/entitydata/EntityDataHandlerEventImpl.java similarity index 74% rename from common/src/main/java/com/viaversion/viaversion/rewriter/meta/MetaHandlerEventImpl.java rename to common/src/main/java/com/viaversion/viaversion/rewriter/entitydata/EntityDataHandlerEventImpl.java index 65e151f46..3e227f5e7 100644 --- a/common/src/main/java/com/viaversion/viaversion/rewriter/meta/MetaHandlerEventImpl.java +++ b/common/src/main/java/com/viaversion/viaversion/rewriter/entitydata/EntityDataHandlerEventImpl.java @@ -16,26 +16,26 @@ * along with this program. If not, see . */ -package com.viaversion.viaversion.rewriter.meta; +package com.viaversion.viaversion.rewriter.entitydata; import com.viaversion.viaversion.api.connection.UserConnection; import com.viaversion.viaversion.api.data.entity.TrackedEntity; -import com.viaversion.viaversion.api.minecraft.metadata.Metadata; +import com.viaversion.viaversion.api.minecraft.entitydata.EntityData; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.checkerframework.checker.nullness.qual.Nullable; -public class MetaHandlerEventImpl implements MetaHandlerEvent { +public class EntityDataHandlerEventImpl implements EntityDataHandlerEvent { private final UserConnection connection; private final TrackedEntity trackedEntity; private final int entityId; - private final List metadataList; - private final Metadata meta; - private List extraData; + private final List metadataList; + private final EntityData meta; + private List extraData; private boolean cancel; - public MetaHandlerEventImpl(UserConnection connection, @Nullable TrackedEntity trackedEntity, int entityId, Metadata meta, List metadataList) { + public EntityDataHandlerEventImpl(UserConnection connection, @Nullable TrackedEntity trackedEntity, int entityId, EntityData meta, List metadataList) { this.connection = connection; this.trackedEntity = trackedEntity; this.entityId = entityId; @@ -59,7 +59,7 @@ public class MetaHandlerEventImpl implements MetaHandlerEvent { } @Override - public Metadata meta() { + public EntityData data() { return meta; } @@ -74,8 +74,8 @@ public class MetaHandlerEventImpl implements MetaHandlerEvent { } @Override - public @Nullable Metadata metaAtIndex(int index) { - for (Metadata meta : metadataList) { + public @Nullable EntityData dataAtIndex(int index) { + for (EntityData meta : metadataList) { if (index == meta.id()) { return meta; } @@ -84,17 +84,17 @@ public class MetaHandlerEventImpl implements MetaHandlerEvent { } @Override - public List metadataList() { + public List dataList() { return Collections.unmodifiableList(metadataList); } @Override - public @Nullable List extraMeta() { + public @Nullable List extraData() { return extraData; } @Override - public void createExtraMeta(Metadata metadata) { + public void createExtraData(EntityData metadata) { if (extraData == null) { extraData = new ArrayList<>(); } diff --git a/common/src/main/java/com/viaversion/viaversion/scheduler/TaskScheduler.java b/common/src/main/java/com/viaversion/viaversion/scheduler/TaskScheduler.java index a1cd9fc30..45fbb9470 100644 --- a/common/src/main/java/com/viaversion/viaversion/scheduler/TaskScheduler.java +++ b/common/src/main/java/com/viaversion/viaversion/scheduler/TaskScheduler.java @@ -29,8 +29,8 @@ public final class TaskScheduler implements Scheduler { private final ExecutorService executorService = Executors.newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat("Via Async Task %d").build()); private final ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool( - 1, // Fix for https://bugs.openjdk.java.net/browse/JDK-8129861 - new ThreadFactoryBuilder().setNameFormat("Via Async Scheduler %d").build() + 1, // Fix for https://bugs.openjdk.java.net/browse/JDK-8129861 + new ThreadFactoryBuilder().setNameFormat("Via Async Scheduler %d").build() ); @Override diff --git a/common/src/main/java/com/viaversion/viaversion/util/ComponentUtil.java b/common/src/main/java/com/viaversion/viaversion/util/ComponentUtil.java index d39d20f39..d06db9f33 100644 --- a/common/src/main/java/com/viaversion/viaversion/util/ComponentUtil.java +++ b/common/src/main/java/com/viaversion/viaversion/util/ComponentUtil.java @@ -17,11 +17,11 @@ */ package com.viaversion.viaversion.util; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; import com.viaversion.nbt.tag.CompoundTag; import com.viaversion.nbt.tag.StringTag; import com.viaversion.nbt.tag.Tag; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import com.viaversion.viaversion.api.Via; import java.util.logging.Level; import net.lenni0451.mcstructs.text.ATextComponent; diff --git a/common/src/main/java/com/viaversion/viaversion/util/DumpUtil.java b/common/src/main/java/com/viaversion/viaversion/util/DumpUtil.java index fb7d78801..8daa6d545 100644 --- a/common/src/main/java/com/viaversion/viaversion/util/DumpUtil.java +++ b/common/src/main/java/com/viaversion/viaversion/util/DumpUtil.java @@ -60,17 +60,17 @@ public final class DumpUtil { final ProtocolVersion protocolVersion = Via.getAPI().getServerVersion().lowestSupportedProtocolVersion(); final ViaPlatform platform = Via.getPlatform(); final VersionInfo version = new VersionInfo( - System.getProperty("java.version"), - System.getProperty("os.name"), - protocolVersion.getVersionType(), - protocolVersion.getVersion(), - protocolVersion.getName(), - Via.getManager().getProtocolManager().getSupportedVersions().stream().map(ProtocolVersion::toString).collect(Collectors.toCollection(LinkedHashSet::new)), - platform.getPlatformName(), - platform.getPlatformVersion(), - platform.getPluginVersion(), - com.viaversion.viaversion.util.VersionInfo.getImplementationVersion(), - Via.getManager().getSubPlatforms() + System.getProperty("java.version"), + System.getProperty("os.name"), + protocolVersion.getVersionType(), + protocolVersion.getVersion(), + protocolVersion.getName(), + Via.getManager().getProtocolManager().getSupportedVersions().stream().map(ProtocolVersion::toString).collect(Collectors.toCollection(LinkedHashSet::new)), + platform.getPlatformName(), + platform.getPlatformVersion(), + platform.getPluginVersion(), + com.viaversion.viaversion.util.VersionInfo.getImplementationVersion(), + Via.getManager().getSubPlatforms() ); final Map configuration = ((Config) Via.getConfig()).getValues(); final DumpTemplate template = new DumpTemplate(version, configuration, platform.getDump(), Via.getManager().getInjector().getDump(), getPlayerSample(playerToSample)); diff --git a/common/src/main/java/com/viaversion/viaversion/util/SerializerVersion.java b/common/src/main/java/com/viaversion/viaversion/util/SerializerVersion.java index 8cdbc57a1..1d1d8fa99 100644 --- a/common/src/main/java/com/viaversion/viaversion/util/SerializerVersion.java +++ b/common/src/main/java/com/viaversion/viaversion/util/SerializerVersion.java @@ -17,8 +17,8 @@ */ package com.viaversion.viaversion.util; -import com.viaversion.nbt.tag.Tag; import com.google.gson.JsonElement; +import com.viaversion.nbt.tag.Tag; import net.lenni0451.mcstructs.snbt.SNbtSerializer; import net.lenni0451.mcstructs.snbt.exceptions.SNbtDeserializeException; import net.lenni0451.mcstructs.snbt.exceptions.SNbtSerializeException; diff --git a/common/src/test/java/com/viaversion/viaversion/common/type/ItemTypeTest.java b/common/src/test/java/com/viaversion/viaversion/common/type/ItemTypeTest.java index 23b5d29b6..5f58930c3 100644 --- a/common/src/test/java/com/viaversion/viaversion/common/type/ItemTypeTest.java +++ b/common/src/test/java/com/viaversion/viaversion/common/type/ItemTypeTest.java @@ -18,7 +18,6 @@ package com.viaversion.viaversion.common.type; import com.viaversion.viaversion.api.minecraft.item.DataItem; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; @@ -39,30 +38,30 @@ class ItemTypeTest { void testNormalItemRead() { // Test item read Assertions.assertEquals( - new DataItem(Short.MAX_VALUE, (byte) -128, (short) 257, null), - Types.ITEM1_8.read(Unpooled.wrappedBuffer(new byte[]{ - 127, -1, - -128, - 1, 1, - 0 - })) + new DataItem(Short.MAX_VALUE, (byte) -128, (short) 257, null), + Types.ITEM1_8.read(Unpooled.wrappedBuffer(new byte[]{ + 127, -1, + -128, + 1, 1, + 0 + })) ); Assertions.assertEquals( - new DataItem(420, (byte) 53, (short) 0, null), - Types.ITEM1_13.read(Unpooled.wrappedBuffer(new byte[]{ - 1, (byte) 164, - 53, - 0 - })) + new DataItem(420, (byte) 53, (short) 0, null), + Types.ITEM1_13.read(Unpooled.wrappedBuffer(new byte[]{ + 1, (byte) 164, + 53, + 0 + })) ); Assertions.assertEquals( - new DataItem(268435456, (byte) 127, (short) 0, null), - Types.ITEM1_13_2.read(Unpooled.wrappedBuffer(new byte[]{ - 1, - -128, -128, -128, -128, 1, - 127, - 0 - })) + new DataItem(268435456, (byte) 127, (short) 0, null), + Types.ITEM1_13_2.read(Unpooled.wrappedBuffer(new byte[]{ + 1, + -128, -128, -128, -128, 1, + 127, + 0 + })) ); } @@ -86,23 +85,23 @@ class ItemTypeTest { // Test item write Types.ITEM1_8.write(buf, new DataItem(Short.MAX_VALUE, (byte) -128, (short) 257, null)); Assertions.assertArrayEquals(toBytes(buf), new byte[]{ - 127, -1, - -128, - 1, 1, - 0 + 127, -1, + -128, + 1, 1, + 0 }); Types.ITEM1_13.write(buf, new DataItem(420, (byte) 53, (short) 0, null)); Assertions.assertArrayEquals(toBytes(buf), new byte[]{ - 1, (byte) 164, - 53, - 0 + 1, (byte) 164, + 53, + 0 }); Types.ITEM1_13_2.write(buf, new DataItem(268435456, (byte) 127, (short) 0, null)); Assertions.assertArrayEquals(toBytes(buf), new byte[]{ - 1, - -128, -128, -128, -128, 1, - 127, - 0 + 1, + -128, -128, -128, -128, 1, + 127, + 0 }); } diff --git a/common/src/test/java/com/viaversion/viaversion/common/type/StringTypeTest.java b/common/src/test/java/com/viaversion/viaversion/common/type/StringTypeTest.java index 608a3fe72..aea897111 100644 --- a/common/src/test/java/com/viaversion/viaversion/common/type/StringTypeTest.java +++ b/common/src/test/java/com/viaversion/viaversion/common/type/StringTypeTest.java @@ -17,7 +17,6 @@ */ package com.viaversion.viaversion.common.type; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufUtil; diff --git a/sponge/src/main/java/com/viaversion/viaversion/sponge/handlers/SpongeChannelInitializer.java b/sponge/src/main/java/com/viaversion/viaversion/sponge/handlers/SpongeChannelInitializer.java index 29d456ba8..ead126943 100644 --- a/sponge/src/main/java/com/viaversion/viaversion/sponge/handlers/SpongeChannelInitializer.java +++ b/sponge/src/main/java/com/viaversion/viaversion/sponge/handlers/SpongeChannelInitializer.java @@ -51,7 +51,7 @@ public class SpongeChannelInitializer extends ChannelInitializer implem protected void initChannel(Channel channel) throws Exception { // Ensure ViaVersion is loaded if (Via.getAPI().getServerVersion().isKnown() - && channel instanceof SocketChannel) { // channel can be LocalChannel on internal server + && channel instanceof SocketChannel) { // channel can be LocalChannel on internal server UserConnection info = new UserConnectionImpl(channel); // init protocol new ProtocolPipelineImpl(info); diff --git a/sponge/src/main/java/com/viaversion/viaversion/sponge/platform/SpongeViaConfig.java b/sponge/src/main/java/com/viaversion/viaversion/sponge/platform/SpongeViaConfig.java index fe3d1ac7a..46e3c6d4c 100644 --- a/sponge/src/main/java/com/viaversion/viaversion/sponge/platform/SpongeViaConfig.java +++ b/sponge/src/main/java/com/viaversion/viaversion/sponge/platform/SpongeViaConfig.java @@ -25,8 +25,8 @@ import java.util.Map; public class SpongeViaConfig extends AbstractViaConfig { private static final List UNSUPPORTED = Arrays.asList("bungee-ping-interval", - "bungee-ping-save", "bungee-servers", "velocity-ping-interval", "velocity-ping-save", "velocity-servers", - "quick-move-action-fix", "change-1_9-hitbox", "change-1_14-hitbox", "blockconnection-method"); + "bungee-ping-save", "bungee-servers", "velocity-ping-interval", "velocity-ping-save", "velocity-servers", + "quick-move-action-fix", "change-1_9-hitbox", "change-1_14-hitbox", "blockconnection-method"); public SpongeViaConfig(File folder, java.util.logging.Logger logger) { super(new File(folder, "config.yml"), logger); diff --git a/template/src/main/java/com/viaversion/viaversion/template/protocols/Protocol1_99To_98.java b/template/src/main/java/com/viaversion/viaversion/template/protocols/Protocol1_99To_98.java index c4a1d406f..5240c8264 100644 --- a/template/src/main/java/com/viaversion/viaversion/template/protocols/Protocol1_99To_98.java +++ b/template/src/main/java/com/viaversion/viaversion/template/protocols/Protocol1_99To_98.java @@ -60,8 +60,8 @@ public final class Protocol1_99To_98 extends AbstractProtocol soundRewriter = new SoundRewriter<>(this); - soundRewriter.register1_19_3Sound(ClientboundPackets1_20_5.SOUND); - soundRewriter.register1_19_3Sound(ClientboundPackets1_20_5.SOUND_ENTITY); + soundRewriter.registerSound1_19_3(ClientboundPackets1_20_5.SOUND); + soundRewriter.registerSound1_19_3(ClientboundPackets1_20_5.SOUND_ENTITY); new StatisticsRewriter<>(this).register(ClientboundPackets1_20_5.AWARD_STATS); new AttributeRewriter<>(this).register1_20_5(ClientboundPackets1_20_5.UPDATE_ATTRIBUTES); @@ -105,7 +105,7 @@ public final class Protocol1_99To_98 extends AbstractProtocol blockRewriter = BlockRewriter.for1_20_2(protocol); - blockRewriter.registerBlockAction(ClientboundPackets1_20_5.BLOCK_EVENT); - blockRewriter.registerBlockChange(ClientboundPackets1_20_5.BLOCK_UPDATE); - blockRewriter.registerVarLongMultiBlockChange1_20(ClientboundPackets1_20_5.SECTION_BLOCKS_UPDATE); - blockRewriter.registerEffect(ClientboundPackets1_20_5.LEVEL_EVENT, 1010, 2001); - blockRewriter.registerChunkData1_19(ClientboundPackets1_20_5.LEVEL_CHUNK_WITH_LIGHT, ChunkType1_20_2::new); + blockRewriter.registerBlockEvent(ClientboundPackets1_20_5.BLOCK_EVENT); + blockRewriter.registerBlockUpdate(ClientboundPackets1_20_5.BLOCK_UPDATE); + blockRewriter.registerSectionBlocksUpdate1_20(ClientboundPackets1_20_5.SECTION_BLOCKS_UPDATE); + blockRewriter.registerLevelEvent(ClientboundPackets1_20_5.LEVEL_EVENT, 1010, 2001); + blockRewriter.registerLevelChunk1_19(ClientboundPackets1_20_5.LEVEL_CHUNK_WITH_LIGHT, ChunkType1_20_2::new); blockRewriter.registerBlockEntityData(ClientboundPackets1_20_5.BLOCK_ENTITY_DATA); // Registers item id changes - // Other places using item ids are: Entity metadata, tags, statistics, effect + // Other places using item ids are: Entity data, tags, statistics, effect // registerOpenWindow(ClientboundPackets1_20_5.OPEN_WINDOW); - If a new container type was added - registerSetCooldown(ClientboundPackets1_20_5.COOLDOWN); - registerWindowItems1_17_1(ClientboundPackets1_20_5.CONTAINER_SET_CONTENT); + registerCooldown(ClientboundPackets1_20_5.COOLDOWN); + registerSetContent1_17_1(ClientboundPackets1_20_5.CONTAINER_SET_CONTENT); registerSetSlot1_17_1(ClientboundPackets1_20_5.CONTAINER_SET_SLOT); registerAdvancements1_20_3(ClientboundPackets1_20_5.UPDATE_ADVANCEMENTS); - registerEntityEquipmentArray(ClientboundPackets1_20_5.SET_EQUIPMENT); - registerClickWindow1_17_1(ServerboundPackets1_20_5.CONTAINER_CLICK); - registerTradeList1_20_5(ClientboundPackets1_20_5.MERCHANT_OFFERS, Types1_20_5.ITEM_COST, Types1_20_5.ITEM_COST, Types1_20_5.OPTIONAL_ITEM_COST, Types1_20_5.OPTIONAL_ITEM_COST); - registerCreativeInvAction(ServerboundPackets1_20_5.SET_CREATIVE_MODE_SLOT); - registerWindowPropertyEnchantmentHandler(ClientboundPackets1_20_5.CONTAINER_SET_DATA); - registerSpawnParticle1_20_5(ClientboundPackets1_20_5.LEVEL_PARTICLES, Types1_20_5.PARTICLE, Types1_20_5.PARTICLE); + registerSetEquipment(ClientboundPackets1_20_5.SET_EQUIPMENT); + registerContainerClick1_17_1(ServerboundPackets1_20_5.CONTAINER_CLICK); + registerMerchantOffers1_20_5(ClientboundPackets1_20_5.MERCHANT_OFFERS, Types1_20_5.ITEM_COST, Types1_20_5.ITEM_COST, Types1_20_5.OPTIONAL_ITEM_COST, Types1_20_5.OPTIONAL_ITEM_COST); + registerSetCreativeModeSlot(ServerboundPackets1_20_5.SET_CREATIVE_MODE_SLOT); + registerContainerSetData(ClientboundPackets1_20_5.CONTAINER_SET_DATA); + registerLevelParticles1_20_5(ClientboundPackets1_20_5.LEVEL_PARTICLES, Types1_20_5.PARTICLE, Types1_20_5.PARTICLE); registerExplosion(ClientboundPackets1_20_5.EXPLODE, Types1_20_5.PARTICLE, Types1_20_5.PARTICLE); // Rewrites the included sound and particles new RecipeRewriter1_20_3<>(protocol).register1_20_5(ClientboundPackets1_20_5.UPDATE_RECIPES); diff --git a/template/src/main/java/com/viaversion/viaversion/template/protocols/rewriter/EntityPacketRewriter1_99.java b/template/src/main/java/com/viaversion/viaversion/template/protocols/rewriter/EntityPacketRewriter1_99.java index ceedde77e..c9a2e27ec 100644 --- a/template/src/main/java/com/viaversion/viaversion/template/protocols/rewriter/EntityPacketRewriter1_99.java +++ b/template/src/main/java/com/viaversion/viaversion/template/protocols/rewriter/EntityPacketRewriter1_99.java @@ -20,7 +20,6 @@ package com.viaversion.viaversion.template.protocols.rewriter; import com.viaversion.viaversion.api.minecraft.entities.EntityType; import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_20_5; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; -import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.api.type.types.version.Types1_20_5; import com.viaversion.viaversion.protocols.v1_20_3to1_20_5.packet.ClientboundConfigurationPackets1_20_5; @@ -40,9 +39,9 @@ public final class EntityPacketRewriter1_99 extends EntityRewriter { + /* Uncomment if entity data classes changed + filter().mapDataType(typeId -> { final int id = typeId; if (id >= SomeAddedIndex) { id++; } - return Types1_20_5.META_TYPES.byId(id); + return Types1_20_5.ENTITY_DATA_TYPES.byId(id); });*/ // Registers registry type id changes - registerMetaTypeHandler( - Types1_20_5.META_TYPES.itemType, - Types1_20_5.META_TYPES.blockStateType, - Types1_20_5.META_TYPES.optionalBlockStateType, - Types1_20_5.META_TYPES.particleType, - Types1_20_5.META_TYPES.particlesType + registerEntityDataTypeHandler( + Types1_20_5.ENTITY_DATA_TYPES.itemType, + Types1_20_5.ENTITY_DATA_TYPES.blockStateType, + Types1_20_5.ENTITY_DATA_TYPES.optionalBlockStateType, + Types1_20_5.ENTITY_DATA_TYPES.particleType, + Types1_20_5.ENTITY_DATA_TYPES.particlesType ); // Minecarts are special - filter().type(EntityTypes1_20_5.ABSTRACT_MINECART).index(11).handler((event, meta) -> { - final int blockState = meta.value(); - meta.setValue(protocol.getMappingData().getNewBlockStateId(blockState)); + filter().type(EntityTypes1_20_5.ABSTRACT_MINECART).index(11).handler((event, data) -> { + final int blockState = data.value(); + data.setValue(protocol.getMappingData().getNewBlockStateId(blockState)); }); } diff --git a/universal/build.gradle.kts b/universal/build.gradle.kts index 6df38013c..a4c087857 100644 --- a/universal/build.gradle.kts +++ b/universal/build.gradle.kts @@ -49,8 +49,8 @@ if (!isRelease || isMainBranch) { // Only publish releases from the main branch modrinth { val mcVersions: List = (property("mcVersions") as String) - .split(",") - .map { it.trim() } + .split(",") + .map { it.trim() } token.set(System.getenv("MODRINTH_TOKEN")) projectId.set("viaversion") versionType.set(if (isRelease) "release" else if (isMainBranch) "beta" else "alpha") diff --git a/velocity/src/main/java/com/viaversion/viaversion/VelocityPlugin.java b/velocity/src/main/java/com/viaversion/viaversion/VelocityPlugin.java index 98b3425dc..e1e187f53 100644 --- a/velocity/src/main/java/com/viaversion/viaversion/VelocityPlugin.java +++ b/velocity/src/main/java/com/viaversion/viaversion/VelocityPlugin.java @@ -54,12 +54,12 @@ import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import org.slf4j.Logger; @Plugin( - id = "viaversion", - name = "ViaVersion", - version = VersionInfo.VERSION, - authors = {"_MylesC", "creeper123123321", "Gerrygames", "kennytv", "Matsv", "EnZaXD", "RK_01"}, - description = "Allow newer Minecraft versions to connect to an older server version.", - url = "https://viaversion.com" + id = "viaversion", + name = "ViaVersion", + version = VersionInfo.VERSION, + authors = {"_MylesC", "creeper123123321", "Gerrygames", "kennytv", "Matsv", "EnZaXD", "RK_01"}, + description = "Allow newer Minecraft versions to connect to an older server version.", + url = "https://viaversion.com" ) public class VelocityPlugin implements ViaServerProxyPlatform { public static final LegacyComponentSerializer COMPONENT_SERIALIZER = LegacyComponentSerializer.builder().character(ChatColorUtil.COLOR_CHAR).extractUrls().build(); @@ -99,10 +99,10 @@ public class VelocityPlugin implements ViaServerProxyPlatform { logger = new LoggerWrapper(loggerslf4j); conf = new VelocityViaConfig(configDir.toFile(), logger); Via.init(ViaManagerImpl.builder() - .platform(this) - .commandHandler(commandHandler) - .loader(new VelocityViaLoader()) - .injector(new VelocityViaInjector()).build()); + .platform(this) + .commandHandler(commandHandler) + .loader(new VelocityViaLoader()) + .injector(new VelocityViaInjector()).build()); conf.reload(); } @@ -143,9 +143,9 @@ public class VelocityPlugin implements ViaServerProxyPlatform { @Override public PlatformTask runRepeatingAsync(final Runnable runnable, final long ticks) { return new VelocityViaTask( - PROXY.getScheduler() - .buildTask(this, runnable) - .repeat(ticks * 50, TimeUnit.MILLISECONDS).schedule() + PROXY.getScheduler() + .buildTask(this, runnable) + .repeat(ticks * 50, TimeUnit.MILLISECONDS).schedule() ); } @@ -157,9 +157,9 @@ public class VelocityPlugin implements ViaServerProxyPlatform { @Override public PlatformTask runSync(Runnable runnable, long delay) { return new VelocityViaTask( - PROXY.getScheduler() - .buildTask(this, runnable) - .delay(delay * 50, TimeUnit.MILLISECONDS).schedule() + PROXY.getScheduler() + .buildTask(this, runnable) + .delay(delay * 50, TimeUnit.MILLISECONDS).schedule() ); } @@ -171,8 +171,8 @@ public class VelocityPlugin implements ViaServerProxyPlatform { @Override public ViaCommandSender[] getOnlinePlayers() { return PROXY.getAllPlayers().stream() - .map(VelocityCommandSender::new) - .toArray(ViaCommandSender[]::new); + .map(VelocityCommandSender::new) + .toArray(ViaCommandSender[]::new); } @Override @@ -219,11 +219,11 @@ public class VelocityPlugin implements ViaServerProxyPlatform { List plugins = new ArrayList<>(); for (PluginContainer p : PROXY.getPluginManager().getPlugins()) { plugins.add(new PluginInfo( - true, - p.getDescription().getName().orElse(p.getDescription().getId()), - p.getDescription().getVersion().orElse("Unknown Version"), - p.getInstance().map(instance -> instance.getClass().getCanonicalName()).orElse("Unknown"), - p.getDescription().getAuthors() + true, + p.getDescription().getName().orElse(p.getDescription().getId()), + p.getDescription().getVersion().orElse("Unknown Version"), + p.getInstance().map(instance -> instance.getClass().getCanonicalName()).orElse("Unknown"), + p.getDescription().getAuthors() )); } extra.add("plugins", GsonUtil.getGson().toJsonTree(plugins)); diff --git a/velocity/src/main/java/com/viaversion/viaversion/velocity/command/subs/ProbeSubCmd.java b/velocity/src/main/java/com/viaversion/viaversion/velocity/command/subs/ProbeSubCmd.java index 00b5b866e..3ccb0b283 100644 --- a/velocity/src/main/java/com/viaversion/viaversion/velocity/command/subs/ProbeSubCmd.java +++ b/velocity/src/main/java/com/viaversion/viaversion/velocity/command/subs/ProbeSubCmd.java @@ -31,8 +31,8 @@ public class ProbeSubCmd implements ViaSubCommand { @Override public String description() { return "Forces ViaVersion to scan server protocol versions " + - (((VelocityViaConfig) Via.getConfig()).getVelocityPingInterval() == -1 ? - "" : "(Also happens at an interval)"); + (((VelocityViaConfig) Via.getConfig()).getVelocityPingInterval() == -1 ? + "" : "(Also happens at an interval)"); } @Override diff --git a/velocity/src/main/java/com/viaversion/viaversion/velocity/listeners/UpdateListener.java b/velocity/src/main/java/com/viaversion/viaversion/velocity/listeners/UpdateListener.java index 1908d79f6..c6950c937 100644 --- a/velocity/src/main/java/com/viaversion/viaversion/velocity/listeners/UpdateListener.java +++ b/velocity/src/main/java/com/viaversion/viaversion/velocity/listeners/UpdateListener.java @@ -26,7 +26,7 @@ public class UpdateListener { @Subscribe public void onJoin(PostLoginEvent e) { if (e.getPlayer().hasPermission("viaversion.update") - && Via.getConfig().isCheckForUpdates()) { + && Via.getConfig().isCheckForUpdates()) { UpdateUtil.sendUpdateMessage(e.getPlayer().getUniqueId()); } } diff --git a/velocity/src/main/java/com/viaversion/viaversion/velocity/platform/VelocityViaInjector.java b/velocity/src/main/java/com/viaversion/viaversion/velocity/platform/VelocityViaInjector.java index b07d77742..804018e2c 100644 --- a/velocity/src/main/java/com/viaversion/viaversion/velocity/platform/VelocityViaInjector.java +++ b/velocity/src/main/java/com/viaversion/viaversion/velocity/platform/VelocityViaInjector.java @@ -64,12 +64,12 @@ public class VelocityViaInjector implements ViaInjector { Object channelInitializerHolder = ReflectionUtil.invoke(connectionManager, "getServerChannelInitializer"); ChannelInitializer originalInitializer = getInitializer(); channelInitializerHolder.getClass().getMethod("set", ChannelInitializer.class) - .invoke(channelInitializerHolder, new VelocityChannelInitializer(originalInitializer, false)); + .invoke(channelInitializerHolder, new VelocityChannelInitializer(originalInitializer, false)); Object backendInitializerHolder = ReflectionUtil.invoke(connectionManager, "getBackendChannelInitializer"); ChannelInitializer backendInitializer = getBackendInitializer(); backendInitializerHolder.getClass().getMethod("set", ChannelInitializer.class) - .invoke(backendInitializerHolder, new VelocityChannelInitializer(backendInitializer, true)); + .invoke(backendInitializerHolder, new VelocityChannelInitializer(backendInitializer, true)); } @Override @@ -98,8 +98,8 @@ public class VelocityViaInjector implements ViaInjector { public static int getLowestSupportedProtocolVersion() { try { if (GET_PLAYER_INFO_FORWARDING_MODE != null - && ((Enum) GET_PLAYER_INFO_FORWARDING_MODE.invoke(VelocityPlugin.PROXY.getConfiguration())) - .name().equals("MODERN")) { + && ((Enum) GET_PLAYER_INFO_FORWARDING_MODE.invoke(VelocityPlugin.PROXY.getConfiguration())) + .name().equals("MODERN")) { return ProtocolVersion.v1_13.getVersion(); } } catch (IllegalAccessException | InvocationTargetException ignored) { diff --git a/velocity/src/main/java/com/viaversion/viaversion/velocity/platform/VelocityViaLoader.java b/velocity/src/main/java/com/viaversion/viaversion/velocity/platform/VelocityViaLoader.java index 1660c37a0..8394a3724 100644 --- a/velocity/src/main/java/com/viaversion/viaversion/velocity/platform/VelocityViaLoader.java +++ b/velocity/src/main/java/com/viaversion/viaversion/velocity/platform/VelocityViaLoader.java @@ -33,7 +33,7 @@ public class VelocityViaLoader implements ViaPlatformLoader { @Override public void load() { Object plugin = VelocityPlugin.PROXY.getPluginManager() - .getPlugin("viaversion").flatMap(PluginContainer::getInstance).get(); + .getPlugin("viaversion").flatMap(PluginContainer::getInstance).get(); final ProtocolVersion protocolVersion = Via.getAPI().getServerVersion().lowestSupportedProtocolVersion(); if (protocolVersion.olderThan(ProtocolVersion.v1_9)) { @@ -49,8 +49,8 @@ public class VelocityViaLoader implements ViaPlatformLoader { int pingInterval = ((VelocityViaConfig) Via.getPlatform().getConf()).getVelocityPingInterval(); if (pingInterval > 0) { Via.getPlatform().runRepeatingAsync( - () -> Via.proxyPlatform().protocolDetectorService().probeAllServers(), - pingInterval * 20L); + () -> Via.proxyPlatform().protocolDetectorService().probeAllServers(), + pingInterval * 20L); } } diff --git a/velocity/src/main/java/com/viaversion/viaversion/velocity/providers/VelocityVersionProvider.java b/velocity/src/main/java/com/viaversion/viaversion/velocity/providers/VelocityVersionProvider.java index 69a6c4fef..a8299a004 100644 --- a/velocity/src/main/java/com/viaversion/viaversion/velocity/providers/VelocityVersionProvider.java +++ b/velocity/src/main/java/com/viaversion/viaversion/velocity/providers/VelocityVersionProvider.java @@ -59,12 +59,12 @@ public class VelocityVersionProvider implements VersionProvider { ProtocolVersion playerVersion = user.getProtocolInfo().protocolVersion(); IntStream versions = com.velocitypowered.api.network.ProtocolVersion.SUPPORTED_VERSIONS.stream() - .mapToInt(com.velocitypowered.api.network.ProtocolVersion::getProtocol); + .mapToInt(com.velocitypowered.api.network.ProtocolVersion::getProtocol); // Modern forwarding mode needs 1.13 Login plugin message if (VelocityViaInjector.GET_PLAYER_INFO_FORWARDING_MODE != null - && ((Enum) VelocityViaInjector.GET_PLAYER_INFO_FORWARDING_MODE.invoke(VelocityPlugin.PROXY.getConfiguration())) - .name().equals("MODERN")) { + && ((Enum) VelocityViaInjector.GET_PLAYER_INFO_FORWARDING_MODE.invoke(VelocityPlugin.PROXY.getConfiguration())) + .name().equals("MODERN")) { versions = versions.filter(ver -> ver >= ProtocolVersion.v1_13.getVersion()); } int[] compatibleProtocols = versions.toArray(); diff --git a/velocity/src/main/java/com/viaversion/viaversion/velocity/storage/VelocityStorage.java b/velocity/src/main/java/com/viaversion/viaversion/velocity/storage/VelocityStorage.java index b34e7cc00..d8cb595f6 100644 --- a/velocity/src/main/java/com/viaversion/viaversion/velocity/storage/VelocityStorage.java +++ b/velocity/src/main/java/com/viaversion/viaversion/velocity/storage/VelocityStorage.java @@ -40,9 +40,9 @@ public class VelocityStorage implements StorableObject { try { clientPlaySessionHandler = Class.forName("com.velocitypowered.proxy.connection.client.ClientPlaySessionHandler"); getServerBossBars = clientPlaySessionHandler - .getDeclaredMethod("getServerBossBars"); + .getDeclaredMethod("getServerBossBars"); getMinecraftConnection = Class.forName("com.velocitypowered.proxy.connection.client.ConnectedPlayer") - .getDeclaredMethod("getMinecraftConnection"); + .getDeclaredMethod("getMinecraftConnection"); } catch (NoSuchMethodException | ClassNotFoundException e) { Via.getPlatform().getLogger().log(Level.SEVERE, "Failed to initialize Velocity bossbar support, bossbars will not work.", e); }