From dd4ab8082eaf510296375b68fad197623bfc17f9 Mon Sep 17 00:00:00 2001 From: EnZaXD <60033407+FlorianMichael@users.noreply.github.com> Date: Wed, 15 May 2024 11:16:50 +0200 Subject: [PATCH] Update data class names to indicate target version (#749) --- ...ns1_10.java => SplashPotionMappings1_10.java} | 2 +- .../rewriter/BlockItemPacketRewriter1_11.java | 10 +++++----- .../rewriter/EntityPacketRewriter1_11.java | 4 ++-- ...rs1_11_1.java => MapColorMappings1_11_1.java} | 2 +- .../rewriter/BlockItemPacketRewriter1_12.java | 4 ++-- .../v1_13_1to1_13/Protocol1_13_1To1_13.java | 2 +- .../CommandRewriter1_13_1.java | 2 +- .../v1_13to1_12_2/Protocol1_13To1_12_2.java | 4 ++-- .../block_entity_handlers/SpawnerHandler.java | 4 ++-- .../data/BackwardsMappingData1_13.java | 4 ++-- ...eMapping.java => EntityIdMappings1_12_2.java} | 8 ++++---- ...1_12_2.java => EntityNameMappings1_12_2.java} | 2 +- ...apping.java => NamedSoundMappings1_12_2.java} | 8 ++++---- ...intingMapping.java => PaintingNames1_13.java} | 2 +- ...apping.java => ParticleIdMappings1_12_2.java} | 3 +-- .../rewriter/BlockItemPacketRewriter1_13.java | 8 ++++---- .../rewriter/EntityPacketRewriter1_13.java | 16 +++++++--------- .../rewriter/PlayerPacketRewriter1_13.java | 5 ++--- .../rewriter/SoundPacketRewriter1_13.java | 5 ++--- .../v1_14to1_13_2/Protocol1_14To1_13_2.java | 2 +- .../{data => rewriter}/CommandRewriter1_14.java | 2 +- .../data/BackwardsMappingData1_16.java | 4 ++-- ..._17_1.java => BlockEntityMappings1_17_1.java} | 6 +++--- .../rewriter/BlockItemPacketRewriter1_18.java | 4 ++-- .../rewriter/BlockItemPacketRewriter1_20_2.java | 2 +- 25 files changed, 55 insertions(+), 60 deletions(-) rename common/src/main/java/com/viaversion/viabackwards/protocol/v1_11to1_10/data/{SplashPotions1_10.java => SplashPotionMappings1_10.java} (97%) rename common/src/main/java/com/viaversion/viabackwards/protocol/v1_12to1_11_1/data/{MapColors1_11_1.java => MapColorMappings1_11_1.java} (99%) rename common/src/main/java/com/viaversion/viabackwards/protocol/v1_13_1to1_13/{data => rewriter}/CommandRewriter1_13_1.java (96%) rename common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/{EntityTypeMapping.java => EntityIdMappings1_12_2.java} (84%) rename common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/{EntityNames1_12_2.java => EntityNameMappings1_12_2.java} (98%) rename common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/{NamedSoundMapping.java => NamedSoundMappings1_12_2.java} (88%) rename common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/{PaintingMapping.java => PaintingNames1_13.java} (98%) rename common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/{ParticleMapping.java => ParticleIdMappings1_12_2.java} (99%) rename common/src/main/java/com/viaversion/viabackwards/protocol/v1_14to1_13_2/{data => rewriter}/CommandRewriter1_14.java (96%) rename common/src/main/java/com/viaversion/viabackwards/protocol/v1_18to1_17_1/data/{BlockEntityIds1_17_1.java => BlockEntityMappings1_17_1.java} (91%) diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_11to1_10/data/SplashPotions1_10.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_11to1_10/data/SplashPotionMappings1_10.java similarity index 97% rename from common/src/main/java/com/viaversion/viabackwards/protocol/v1_11to1_10/data/SplashPotions1_10.java rename to common/src/main/java/com/viaversion/viabackwards/protocol/v1_11to1_10/data/SplashPotionMappings1_10.java index 6892005c..dd70373f 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_11to1_10/data/SplashPotions1_10.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_11to1_10/data/SplashPotionMappings1_10.java @@ -20,7 +20,7 @@ package com.viaversion.viabackwards.protocol.v1_11to1_10.data; import com.viaversion.viaversion.libs.fastutil.ints.Int2IntMap; import com.viaversion.viaversion.libs.fastutil.ints.Int2IntOpenHashMap; -public class SplashPotions1_10 { +public class SplashPotionMappings1_10 { private static final Int2IntMap DATA = new Int2IntOpenHashMap(14, 0.99F); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_11to1_10/rewriter/BlockItemPacketRewriter1_11.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_11to1_10/rewriter/BlockItemPacketRewriter1_11.java index 88570894..2935a55a 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_11to1_10/rewriter/BlockItemPacketRewriter1_11.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_11to1_10/rewriter/BlockItemPacketRewriter1_11.java @@ -37,7 +37,7 @@ import com.viaversion.viaversion.api.type.Types; import com.viaversion.viaversion.api.type.types.chunk.ChunkType1_9_3; import com.viaversion.nbt.tag.CompoundTag; import com.viaversion.nbt.tag.StringTag; -import com.viaversion.viaversion.protocols.v1_10to1_11.data.EntityNames1_11; +import com.viaversion.viaversion.protocols.v1_10to1_11.data.EntityMappings1_11; import com.viaversion.viaversion.protocols.v1_9_1to1_9_3.packet.ClientboundPackets1_9_3; import com.viaversion.viaversion.protocols.v1_9_1to1_9_3.packet.ServerboundPackets1_9_3; import com.viaversion.viaversion.util.IdAndData; @@ -209,7 +209,7 @@ public class BlockItemPacketRewriter1_11 extends LegacyBlockItemRewriter new MappedLegacyBlockItem(52)); data.setBlockEntityHandler((b, tag) -> { - EntityNames1_11.toClientSpawner(tag, true); + EntityMappings1_11.toClientSpawner(tag, true); return tag; }); @@ -300,7 +300,7 @@ public class BlockItemPacketRewriter1_11 extends LegacyBlockItemRewriter 143) { - color = (short) MapColors1_11_1.getNearestOldColor(color); + color = (short) MapColorMappings1_11_1.getNearestOldColor(color); data[i] = (byte) color; } } diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13_1to1_13/Protocol1_13_1To1_13.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13_1to1_13/Protocol1_13_1To1_13.java index 2f47921a..d811253b 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13_1to1_13/Protocol1_13_1To1_13.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13_1to1_13/Protocol1_13_1To1_13.java @@ -21,7 +21,7 @@ import com.viaversion.viabackwards.ViaBackwards; import com.viaversion.viabackwards.api.BackwardsProtocol; import com.viaversion.viabackwards.api.data.BackwardsMappingData; import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter; -import com.viaversion.viabackwards.protocol.v1_13_1to1_13.data.CommandRewriter1_13_1; +import com.viaversion.viabackwards.protocol.v1_13_1to1_13.rewriter.CommandRewriter1_13_1; import com.viaversion.viabackwards.protocol.v1_13_1to1_13.rewriter.EntityPacketRewriter1_13_1; import com.viaversion.viabackwards.protocol.v1_13_1to1_13.rewriter.ItemPacketRewriter1_13_1; import com.viaversion.viabackwards.protocol.v1_13_1to1_13.rewriter.WorldPacketRewriter1_13_1; diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13_1to1_13/data/CommandRewriter1_13_1.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13_1to1_13/rewriter/CommandRewriter1_13_1.java similarity index 96% rename from common/src/main/java/com/viaversion/viabackwards/protocol/v1_13_1to1_13/data/CommandRewriter1_13_1.java rename to common/src/main/java/com/viaversion/viabackwards/protocol/v1_13_1to1_13/rewriter/CommandRewriter1_13_1.java index 112a5410..81547748 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13_1to1_13/data/CommandRewriter1_13_1.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13_1to1_13/rewriter/CommandRewriter1_13_1.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.viaversion.viabackwards.protocol.v1_13_1to1_13.data; +package com.viaversion.viabackwards.protocol.v1_13_1to1_13.rewriter; import com.viaversion.viabackwards.protocol.v1_13_1to1_13.Protocol1_13_1To1_13; import com.viaversion.viaversion.api.type.Types; diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/Protocol1_13To1_12_2.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/Protocol1_13To1_12_2.java index f0160e6d..8d07e4f7 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/Protocol1_13To1_12_2.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/Protocol1_13To1_12_2.java @@ -22,7 +22,7 @@ import com.viaversion.viabackwards.ViaBackwards; import com.viaversion.viabackwards.api.BackwardsProtocol; import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter; import com.viaversion.viabackwards.protocol.v1_13to1_12_2.data.BackwardsMappingData1_13; -import com.viaversion.viabackwards.protocol.v1_13to1_12_2.data.PaintingMapping; +import com.viaversion.viabackwards.protocol.v1_13to1_12_2.data.PaintingNames1_13; import com.viaversion.viabackwards.protocol.v1_13to1_12_2.provider.BackwardsBlockEntityProvider; import com.viaversion.viabackwards.protocol.v1_13to1_12_2.rewriter.BlockItemPacketRewriter1_13; import com.viaversion.viabackwards.protocol.v1_13to1_12_2.rewriter.EntityPacketRewriter1_13; @@ -83,7 +83,7 @@ public class Protocol1_13To1_12_2 extends BackwardsProtocol { MAPPINGS.load(); - PaintingMapping.init(); + PaintingNames1_13.init(); Via.getManager().getProviders().register(BackwardsBlockEntityProvider.class, new BackwardsBlockEntityProvider()); }); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/block_entity_handlers/SpawnerHandler.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/block_entity_handlers/SpawnerHandler.java index 60f8d287..76ab1475 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/block_entity_handlers/SpawnerHandler.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/block_entity_handlers/SpawnerHandler.java @@ -18,7 +18,7 @@ package com.viaversion.viabackwards.protocol.v1_13to1_12_2.block_entity_handlers; -import com.viaversion.viabackwards.protocol.v1_13to1_12_2.data.EntityNames1_12_2; +import com.viaversion.viabackwards.protocol.v1_13to1_12_2.data.EntityNameMappings1_12_2; import com.viaversion.viabackwards.protocol.v1_13to1_12_2.provider.BackwardsBlockEntityProvider; import com.viaversion.nbt.tag.CompoundTag; import com.viaversion.nbt.tag.StringTag; @@ -31,7 +31,7 @@ public class SpawnerHandler implements BackwardsBlockEntityProvider.BackwardsBlo if (dataTag != null) { StringTag idTag = dataTag.getStringTag("id"); if (idTag != null) { - idTag.setValue(EntityNames1_12_2.rewrite(idTag.getValue())); + idTag.setValue(EntityNameMappings1_12_2.rewrite(idTag.getValue())); } } return tag; diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/BackwardsMappingData1_13.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/BackwardsMappingData1_13.java index a41efe34..7fe3c3e0 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/BackwardsMappingData1_13.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/BackwardsMappingData1_13.java @@ -23,7 +23,7 @@ import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectMap; import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectOpenHashMap; import com.viaversion.nbt.tag.CompoundTag; import com.viaversion.viaversion.protocols.v1_12_2to1_13.Protocol1_12_2To1_13; -import com.viaversion.viaversion.protocols.v1_12_2to1_13.data.StatisticMappings; +import com.viaversion.viaversion.protocols.v1_12_2to1_13.data.StatisticMappings1_13; import java.util.HashMap; import java.util.Map; @@ -39,7 +39,7 @@ public class BackwardsMappingData1_13 extends BackwardsMappingData { public void loadExtras(final CompoundTag data) { super.loadExtras(data); - for (Map.Entry entry : StatisticMappings.CUSTOM_STATS.entrySet()) { + for (Map.Entry entry : StatisticMappings1_13.CUSTOM_STATS.entrySet()) { statisticMappings.put(entry.getValue().intValue(), entry.getKey()); } for (Map.Entry entry : Protocol1_12_2To1_13.MAPPINGS.getTranslateMapping().entrySet()) { diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/EntityTypeMapping.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/EntityIdMappings1_12_2.java similarity index 84% rename from common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/EntityTypeMapping.java rename to common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/EntityIdMappings1_12_2.java index e1c87e82..7abd6d87 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/EntityTypeMapping.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/EntityIdMappings1_12_2.java @@ -19,15 +19,15 @@ package com.viaversion.viabackwards.protocol.v1_13to1_12_2.data; import com.viaversion.viaversion.libs.fastutil.ints.Int2IntMap; import com.viaversion.viaversion.libs.fastutil.ints.Int2IntOpenHashMap; -import com.viaversion.viaversion.protocols.v1_12_2to1_13.data.EntityTypeRewriter; +import com.viaversion.viaversion.protocols.v1_12_2to1_13.data.EntityIdMappings1_13; -public class EntityTypeMapping { +public class EntityIdMappings1_12_2 { private static final Int2IntMap TYPES = new Int2IntOpenHashMap(); static { TYPES.defaultReturnValue(-1); - for (Int2IntMap.Entry entry : EntityTypeRewriter.getEntityTypes().int2IntEntrySet()) { - EntityTypeMapping.TYPES.put(entry.getIntValue(), entry.getIntKey()); + for (Int2IntMap.Entry entry : EntityIdMappings1_13.getEntityTypes().int2IntEntrySet()) { + EntityIdMappings1_12_2.TYPES.put(entry.getIntValue(), entry.getIntKey()); } } diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/EntityNames1_12_2.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/EntityNameMappings1_12_2.java similarity index 98% rename from common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/EntityNames1_12_2.java rename to common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/EntityNameMappings1_12_2.java index d6c46886..38c91089 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/EntityNames1_12_2.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/EntityNameMappings1_12_2.java @@ -23,7 +23,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Objects; -public class EntityNames1_12_2 { +public class EntityNameMappings1_12_2 { private static final Map ENTITY_NAMES = new HashMap<>(); static { diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/NamedSoundMapping.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/NamedSoundMappings1_12_2.java similarity index 88% rename from common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/NamedSoundMapping.java rename to common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/NamedSoundMappings1_12_2.java index 1824c524..2dec5de0 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/NamedSoundMapping.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/NamedSoundMappings1_12_2.java @@ -17,21 +17,21 @@ */ package com.viaversion.viabackwards.protocol.v1_13to1_12_2.data; -import com.viaversion.viaversion.protocols.v1_12_2to1_13.data.NamedSoundRewriter; +import com.viaversion.viaversion.protocols.v1_12_2to1_13.data.NamedSoundMappings1_13; import com.viaversion.viaversion.util.Key; import java.lang.reflect.Field; import java.util.HashMap; import java.util.Map; -public class NamedSoundMapping { +public class NamedSoundMappings1_12_2 { private static final Map SOUNDS = new HashMap<>(); static { try { - Field field = NamedSoundRewriter.class.getDeclaredField("oldToNew"); + Field field = NamedSoundMappings1_13.class.getDeclaredField("oldToNew"); field.setAccessible(true); Map sounds = (Map) field.get(null); - sounds.forEach((sound1_12, sound1_13) -> NamedSoundMapping.SOUNDS.put(sound1_13, sound1_12)); + sounds.forEach((sound1_12, sound1_13) -> NamedSoundMappings1_12_2.SOUNDS.put(sound1_13, sound1_12)); } catch (NoSuchFieldException | IllegalAccessException ex) { ex.printStackTrace(); } diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/PaintingMapping.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/PaintingNames1_13.java similarity index 98% rename from common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/PaintingMapping.java rename to common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/PaintingNames1_13.java index 5edf4c26..35894b9f 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/PaintingMapping.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/PaintingNames1_13.java @@ -20,7 +20,7 @@ package com.viaversion.viabackwards.protocol.v1_13to1_12_2.data; import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectMap; import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectOpenHashMap; -public class PaintingMapping { +public class PaintingNames1_13 { private static final Int2ObjectMap PAINTINGS = new Int2ObjectOpenHashMap<>(26, 0.99F); public static void init() { diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/ParticleMapping.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/ParticleIdMappings1_12_2.java similarity index 99% rename from common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/ParticleMapping.java rename to common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/ParticleIdMappings1_12_2.java index 1e4435ca..ad4091b2 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/ParticleMapping.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/data/ParticleIdMappings1_12_2.java @@ -22,12 +22,11 @@ import com.viaversion.viabackwards.protocol.v1_13to1_12_2.Protocol1_13To1_12_2; import com.viaversion.viaversion.api.minecraft.Particle; import com.viaversion.viaversion.api.minecraft.item.Item; 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.List; import org.checkerframework.checker.nullness.qual.Nullable; -public class ParticleMapping { +public class ParticleIdMappings1_12_2 { private static final ParticleData[] particles; static { diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/rewriter/BlockItemPacketRewriter1_13.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/rewriter/BlockItemPacketRewriter1_13.java index b6fb2d41..bf6e0394 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/rewriter/BlockItemPacketRewriter1_13.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/rewriter/BlockItemPacketRewriter1_13.java @@ -49,12 +49,12 @@ 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.viaversion.viaversion.protocols.v1_12_2to1_13.data.SpawnEggMappings1_13; import com.viaversion.viaversion.protocols.v1_12_2to1_13.packet.ClientboundPackets1_13; import com.viaversion.viaversion.protocols.v1_12to1_12_1.packet.ClientboundPackets1_12_1; import com.viaversion.viaversion.protocols.v1_12to1_12_1.packet.ServerboundPackets1_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.SpawnEggRewriter; import com.viaversion.viaversion.util.ComponentUtil; import com.viaversion.viaversion.util.IdAndData; import com.viaversion.viaversion.util.Key; @@ -100,7 +100,7 @@ public class BlockItemPacketRewriter1_13 extends BackwardsItemRewriter eggEntityId = SpawnEggRewriter.getEntityId(oldId); + Optional eggEntityId = SpawnEggMappings1_13.getEntityId(oldId); if (eggEntityId.isPresent()) { if (tag == null) { item.setTag(tag = new CompoundTag()); @@ -776,7 +776,7 @@ public class BlockItemPacketRewriter1_13 extends BackwardsItemRewriter { @@ -137,7 +135,7 @@ public class EntityPacketRewriter1_13 extends LegacyEntityRewriter { int motive = wrapper.read(Types.VAR_INT); - String title = PaintingMapping.getStringId(motive); + String title = PaintingNames1_13.getStringId(motive); wrapper.write(Types.STRING, title); }); } @@ -326,7 +324,7 @@ public class EntityPacketRewriter1_13 extends LegacyEntityRewriter { Particle particle = (Particle) meta.getValue(); - ParticleMapping.ParticleData data = ParticleMapping.getMapping(particle.id()); + ParticleIdMappings1_12_2.ParticleData data = ParticleIdMappings1_12_2.getMapping(particle.id()); int firstArg = 0; int secondArg = 0; @@ -361,7 +359,7 @@ public class EntityPacketRewriter1_13 extends LegacyEntityRewriter map(Types.FLOAT); // 8 - Particle Data map(Types.INT); // 9 - Particle Count handler(wrapper -> { - ParticleMapping.ParticleData old = ParticleMapping.getMapping(wrapper.get(Types.INT, 0)); + ParticleIdMappings1_12_2.ParticleData old = ParticleIdMappings1_12_2.getMapping(wrapper.get(Types.INT, 0)); wrapper.set(Types.INT, 0, old.getHistoryId()); int[] data = old.rewriteData(protocol, wrapper); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/rewriter/SoundPacketRewriter1_13.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/rewriter/SoundPacketRewriter1_13.java index 87675c0b..21ec0bd2 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/rewriter/SoundPacketRewriter1_13.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/rewriter/SoundPacketRewriter1_13.java @@ -18,10 +18,9 @@ package com.viaversion.viabackwards.protocol.v1_13to1_12_2.rewriter; import com.viaversion.viabackwards.protocol.v1_13to1_12_2.Protocol1_13To1_12_2; -import com.viaversion.viabackwards.protocol.v1_13to1_12_2.data.NamedSoundMapping; +import com.viaversion.viabackwards.protocol.v1_13to1_12_2.data.NamedSoundMappings1_12_2; import com.viaversion.viaversion.api.protocol.remapper.PacketHandlers; 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.protocols.v1_12_2to1_13.packet.ClientboundPackets1_13; import com.viaversion.viaversion.protocols.v1_12to1_12_1.packet.ClientboundPackets1_12_1; @@ -37,7 +36,7 @@ public class SoundPacketRewriter1_13 extends RewriterBase protected void registerPackets() { protocol.registerClientbound(ClientboundPackets1_13.CUSTOM_SOUND, wrapper -> { String sound = wrapper.read(Types.STRING); - String mappedSound = NamedSoundMapping.getOldId(sound); + String mappedSound = NamedSoundMappings1_12_2.getOldId(sound); if (mappedSound != null || (mappedSound = protocol.getMappingData().getMappedNamedSound(sound)) != null) { wrapper.write(Types.STRING, mappedSound); } else { diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_14to1_13_2/Protocol1_14To1_13_2.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_14to1_13_2/Protocol1_14To1_13_2.java index 887b2413..9d3abd78 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_14to1_13_2/Protocol1_14To1_13_2.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_14to1_13_2/Protocol1_14To1_13_2.java @@ -20,7 +20,7 @@ package com.viaversion.viabackwards.protocol.v1_14to1_13_2; import com.viaversion.viabackwards.api.BackwardsProtocol; import com.viaversion.viabackwards.api.data.BackwardsMappingData; import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter; -import com.viaversion.viabackwards.protocol.v1_14to1_13_2.data.CommandRewriter1_14; +import com.viaversion.viabackwards.protocol.v1_14to1_13_2.rewriter.CommandRewriter1_14; import com.viaversion.viabackwards.protocol.v1_14to1_13_2.rewriter.BlockItemPacketRewriter1_14; import com.viaversion.viabackwards.protocol.v1_14to1_13_2.rewriter.EntityPacketRewriter1_14; import com.viaversion.viabackwards.protocol.v1_14to1_13_2.rewriter.PlayerPacketRewriter1_14; diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_14to1_13_2/data/CommandRewriter1_14.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_14to1_13_2/rewriter/CommandRewriter1_14.java similarity index 96% rename from common/src/main/java/com/viaversion/viabackwards/protocol/v1_14to1_13_2/data/CommandRewriter1_14.java rename to common/src/main/java/com/viaversion/viabackwards/protocol/v1_14to1_13_2/rewriter/CommandRewriter1_14.java index f16b5d86..b991e4cb 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_14to1_13_2/data/CommandRewriter1_14.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_14to1_13_2/rewriter/CommandRewriter1_14.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.viaversion.viabackwards.protocol.v1_14to1_13_2.data; +package com.viaversion.viabackwards.protocol.v1_14to1_13_2.rewriter; import com.viaversion.viabackwards.protocol.v1_14to1_13_2.Protocol1_14To1_13_2; import com.viaversion.viaversion.api.type.Types; diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_16to1_15_2/data/BackwardsMappingData1_16.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_16to1_15_2/data/BackwardsMappingData1_16.java index 35b7c7f7..2082160b 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_16to1_15_2/data/BackwardsMappingData1_16.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_16to1_15_2/data/BackwardsMappingData1_16.java @@ -20,7 +20,7 @@ package com.viaversion.viabackwards.protocol.v1_16to1_15_2.data; import com.viaversion.nbt.tag.CompoundTag; import com.viaversion.viabackwards.api.data.BackwardsMappingData; import com.viaversion.viaversion.protocols.v1_15_2to1_16.Protocol1_15_2To1_16; -import com.viaversion.viaversion.protocols.v1_15_2to1_16.data.Attributes1_16; +import com.viaversion.viaversion.protocols.v1_15_2to1_16.data.AttributeMappings1_16; import java.util.HashMap; import java.util.Map; @@ -34,7 +34,7 @@ public class BackwardsMappingData1_16 extends BackwardsMappingData { @Override protected void loadExtras(final CompoundTag data) { super.loadExtras(data); - for (Map.Entry entry : Attributes1_16.attributeIdentifierMappings().entrySet()) { + for (Map.Entry entry : AttributeMappings1_16.attributeIdentifierMappings().entrySet()) { attributeMappings.put(entry.getValue(), entry.getKey()); } } diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_18to1_17_1/data/BlockEntityIds1_17_1.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_18to1_17_1/data/BlockEntityMappings1_17_1.java similarity index 91% rename from common/src/main/java/com/viaversion/viabackwards/protocol/v1_18to1_17_1/data/BlockEntityIds1_17_1.java rename to common/src/main/java/com/viaversion/viabackwards/protocol/v1_18to1_17_1/data/BlockEntityMappings1_17_1.java index 773699ce..ba05b249 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_18to1_17_1/data/BlockEntityIds1_17_1.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_18to1_17_1/data/BlockEntityMappings1_17_1.java @@ -17,15 +17,15 @@ */ package com.viaversion.viabackwards.protocol.v1_18to1_17_1.data; -import com.viaversion.viaversion.protocols.v1_17_1to1_18.data.BlockEntityIds1_18; +import com.viaversion.viaversion.protocols.v1_17_1to1_18.data.BlockEntityMappings1_18; import java.util.Arrays; -public final class BlockEntityIds1_17_1 { +public final class BlockEntityMappings1_17_1 { private static final int[] IDS; static { - final int[] ids = BlockEntityIds1_18.getIds(); + final int[] ids = BlockEntityMappings1_18.getIds(); IDS = new int[Arrays.stream(ids).max().getAsInt() + 1]; Arrays.fill(IDS, -1); for (int i = 0; i < ids.length; i++) { diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_18to1_17_1/rewriter/BlockItemPacketRewriter1_18.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_18to1_17_1/rewriter/BlockItemPacketRewriter1_18.java index bab0361d..1cd94c60 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_18to1_17_1/rewriter/BlockItemPacketRewriter1_18.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_18to1_17_1/rewriter/BlockItemPacketRewriter1_18.java @@ -19,7 +19,7 @@ package com.viaversion.viabackwards.protocol.v1_18to1_17_1.rewriter; import com.viaversion.viabackwards.api.rewriters.BackwardsItemRewriter; import com.viaversion.viabackwards.protocol.v1_18to1_17_1.Protocol1_18To1_17_1; -import com.viaversion.viabackwards.protocol.v1_18to1_17_1.data.BlockEntityIds1_17_1; +import com.viaversion.viabackwards.protocol.v1_18to1_17_1.data.BlockEntityMappings1_17_1; import com.viaversion.viaversion.api.data.ParticleMappings; import com.viaversion.viaversion.api.data.entity.EntityTracker; import com.viaversion.viaversion.api.minecraft.Position; @@ -131,7 +131,7 @@ public final class BlockItemPacketRewriter1_18 extends BackwardsItemRewriter