diff --git a/api/src/main/java/com/viaversion/viaversion/api/data/MappingData.java b/api/src/main/java/com/viaversion/viaversion/api/data/MappingData.java index b46fa9524..a81d4d33d 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/data/MappingData.java +++ b/api/src/main/java/com/viaversion/viaversion/api/data/MappingData.java @@ -126,10 +126,10 @@ public interface MappingData { @Nullable Mappings getEnchantmentMappings(); - @Nullable Mappings getAttributeMappings(); - @Nullable Mappings getPaintingMappings(); + @Nullable FullMappings getAttributeMappings(); + @Nullable FullMappings getEntityMappings(); @Nullable FullMappings getArgumentTypeMappings(); diff --git a/api/src/main/java/com/viaversion/viaversion/api/data/MappingDataBase.java b/api/src/main/java/com/viaversion/viaversion/api/data/MappingDataBase.java index 06283302e..3df70e39f 100644 --- a/api/src/main/java/com/viaversion/viaversion/api/data/MappingDataBase.java +++ b/api/src/main/java/com/viaversion/viaversion/api/data/MappingDataBase.java @@ -43,10 +43,10 @@ public class MappingDataBase implements MappingData { protected FullMappings entityMappings; protected FullMappings recipeSerializerMappings; protected FullMappings itemDataSerializerMappings; + protected FullMappings attributeMappings; protected ParticleMappings particleMappings; protected BiMappings itemMappings; protected BiMappings blockMappings; - protected BiMappings attributeMappings; protected Mappings blockStateMappings; protected Mappings blockEntityMappings; protected Mappings soundMappings; @@ -76,8 +76,6 @@ public class MappingDataBase implements MappingData { menuMappings = loadMappings(data, "menus"); enchantmentMappings = loadMappings(data, "enchantments"); paintingMappings = loadMappings(data, "paintings"); - attributeMappings = loadBiMappings(data, "attributes"); - final CompoundTag unmappedIdentifierData = readUnmappedIdentifiersFile("identifiers-" + unmappedVersion + ".nbt"); final CompoundTag mappedIdentifierData = readMappedIdentifiersFile("identifiers-" + mappedVersion + ".nbt"); @@ -87,6 +85,7 @@ public class MappingDataBase implements MappingData { argumentTypeMappings = loadFullMappings(data, unmappedIdentifierData, mappedIdentifierData, "argumenttypes"); recipeSerializerMappings = loadFullMappings(data, unmappedIdentifierData, mappedIdentifierData, "recipe_serializers"); itemDataSerializerMappings = loadFullMappings(data, unmappedIdentifierData, mappedIdentifierData, "data_component_type"); + attributeMappings = loadFullMappings(data, unmappedIdentifierData, mappedIdentifierData, "attributes"); final List unmappedParticles = identifiersFromGlobalIds(unmappedIdentifierData, "particles"); final List mappedParticles = identifiersFromGlobalIds(mappedIdentifierData, "particles"); @@ -272,7 +271,7 @@ public class MappingDataBase implements MappingData { } @Override - public @Nullable Mappings getAttributeMappings() { + public @Nullable FullMappings getAttributeMappings() { return attributeMappings; } diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_21to1_21_2/rewriter/EntityPacketRewriter1_21_2.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_21to1_21_2/rewriter/EntityPacketRewriter1_21_2.java index 40693695b..924db27fa 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_21to1_21_2/rewriter/EntityPacketRewriter1_21_2.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_21to1_21_2/rewriter/EntityPacketRewriter1_21_2.java @@ -20,6 +20,7 @@ package com.viaversion.viaversion.protocols.v1_21to1_21_2.rewriter; import com.viaversion.nbt.tag.CompoundTag; import com.viaversion.nbt.tag.ListTag; import com.viaversion.nbt.tag.StringTag; +import com.viaversion.viaversion.api.data.FullMappings; 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; @@ -37,8 +38,6 @@ import com.viaversion.viaversion.rewriter.EntityRewriter; import com.viaversion.viaversion.util.Key; import com.viaversion.viaversion.util.TagUtil; import java.util.Arrays; -import java.util.Set; -import java.util.stream.Collectors; public final class EntityPacketRewriter1_21_2 extends EntityRewriter { @@ -56,17 +55,7 @@ public final class EntityPacketRewriter1_21_2 extends EntityRewriter attributesList = TagUtil.getNamespacedCompoundTagList(effects, "attributes"); if (attributesList == null) { return; } for (final CompoundTag attributeData : attributesList) { - updateAttributeField(attributeData); + updateAttributeField(attributeData, mappings); } } - private void updateLocationChangedAttributes(final CompoundTag effects) { + private static void updateLocationChangedAttributes(final CompoundTag effects, final FullMappings mappings) { final ListTag locationChanged = TagUtil.getNamespacedCompoundTagList(effects, "location_changed"); if (locationChanged == null) { return; @@ -173,28 +176,23 @@ public final class EntityPacketRewriter1_21_2 extends EntityRewriter