From c27f720316a4cc4d046f675ba4c94429b9f3ec98 Mon Sep 17 00:00:00 2001 From: FlorianMichael <60033407+FlorianMichael@users.noreply.github.com> Date: Sun, 12 May 2024 17:49:15 +0200 Subject: [PATCH] Update Via API usage Question to EntityPacketRewriter1_16_2: is it intended that the LOGIN handler doesn't copy the written dimensions tag or was that just forgotten? --- .../viaversion/viabackwards/ViaBackwardsConfig.java | 5 +++-- .../viabackwards/api/ViaBackwardsPlatform.java | 2 +- .../rewriter/BlockItemPacketRewriter1_11.java | 11 +++++------ .../rewriter/EntityPacketRewriter1_16_2.java | 5 ++--- .../v1_16to1_15_2/data/BackwardsMappingData1_16.java | 4 ++-- .../v1_18to1_17_1/data/BackwardsMappingData1_18.java | 4 ++-- .../protocol/v1_18to1_17_1/data/BlockEntityIds.java | 3 ++- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/common/src/main/java/com/viaversion/viabackwards/ViaBackwardsConfig.java b/common/src/main/java/com/viaversion/viabackwards/ViaBackwardsConfig.java index dff53446..5bd6b83e 100644 --- a/common/src/main/java/com/viaversion/viabackwards/ViaBackwardsConfig.java +++ b/common/src/main/java/com/viaversion/viabackwards/ViaBackwardsConfig.java @@ -24,6 +24,7 @@ import java.net.URL; import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.logging.Logger; public class ViaBackwardsConfig extends Config implements com.viaversion.viabackwards.api.ViaBackwardsConfig { @@ -34,8 +35,8 @@ public class ViaBackwardsConfig extends Config implements com.viaversion.viaback private boolean fix1_13FormattedInventoryTitles; private boolean handlePingsAsInvAcknowledgements; - public ViaBackwardsConfig(File configFile) { - super(configFile); + public ViaBackwardsConfig(File configFile, Logger logger) { + super(configFile, logger); } @Override diff --git a/common/src/main/java/com/viaversion/viabackwards/api/ViaBackwardsPlatform.java b/common/src/main/java/com/viaversion/viabackwards/api/ViaBackwardsPlatform.java index d515f4f1..21f60927 100644 --- a/common/src/main/java/com/viaversion/viabackwards/api/ViaBackwardsPlatform.java +++ b/common/src/main/java/com/viaversion/viabackwards/api/ViaBackwardsPlatform.java @@ -74,7 +74,7 @@ public interface ViaBackwardsPlatform { * Initialize ViaBackwards. */ default void init(final File configFile) { - ViaBackwardsConfig config = new ViaBackwardsConfig(configFile); + ViaBackwardsConfig config = new ViaBackwardsConfig(configFile, getLogger()); config.reload(); Via.getManager().getConfigurationProvider().register(config); 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 c0d32074..06b1392a 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 @@ -33,12 +33,11 @@ import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_11; import com.viaversion.viaversion.api.minecraft.item.DataItem; import com.viaversion.viaversion.api.minecraft.item.Item; 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_9_3; import com.viaversion.nbt.tag.CompoundTag; import com.viaversion.nbt.tag.StringTag; -import com.viaversion.viaversion.protocols.v1_10to1_11.rewriter.EntityIdRewriter; +import com.viaversion.viaversion.protocols.v1_10to1_11.data.EntityNames1_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; @@ -210,7 +209,7 @@ public class BlockItemPacketRewriter1_11 extends LegacyBlockItemRewriter new MappedLegacyBlockItem(52)); data.setBlockEntityHandler((b, tag) -> { - EntityIdRewriter.toClientSpawner(tag, true); + EntityNames1_11.toClientSpawner(tag, true); return tag; }); @@ -301,7 +300,7 @@ public class BlockItemPacketRewriter1_11 extends LegacyBlockItemRewriter entry : AttributeMappings.attributeIdentifierMappings().entrySet()) { + for (Map.Entry entry : Attributes1_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/BackwardsMappingData1_18.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_18to1_17_1/data/BackwardsMappingData1_18.java index a32f5cd7..0c1795f4 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_18to1_17_1/data/BackwardsMappingData1_18.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_18to1_17_1/data/BackwardsMappingData1_18.java @@ -23,7 +23,7 @@ import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectOpenHashMap; import com.viaversion.viaversion.libs.fastutil.objects.Object2IntMap; import com.viaversion.nbt.tag.CompoundTag; import com.viaversion.viaversion.protocols.v1_17_1to1_18.Protocol1_17_1To1_18; -import com.viaversion.viaversion.protocols.v1_17_1to1_18.data.BlockEntities; +import com.viaversion.viaversion.protocols.v1_17_1to1_18.data.BlockEntities1_18; public final class BackwardsMappingData1_18 extends BackwardsMappingData { @@ -37,7 +37,7 @@ public final class BackwardsMappingData1_18 extends BackwardsMappingData { protected void loadExtras(final CompoundTag data) { super.loadExtras(data); - for (final Object2IntMap.Entry entry : BlockEntities.blockEntityIds().object2IntEntrySet()) { + for (final Object2IntMap.Entry entry : BlockEntities1_18.blockEntityIds().object2IntEntrySet()) { blockEntities.put(entry.getIntValue(), entry.getKey()); } } diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_18to1_17_1/data/BlockEntityIds.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_18to1_17_1/data/BlockEntityIds.java index 0f1b979c..f08fe16b 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_18to1_17_1/data/BlockEntityIds.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_18to1_17_1/data/BlockEntityIds.java @@ -17,6 +17,7 @@ */ package com.viaversion.viabackwards.protocol.v1_18to1_17_1.data; +import com.viaversion.viaversion.protocols.v1_17_1to1_18.data.BlockEntityIds1_18; import java.util.Arrays; public final class BlockEntityIds { @@ -24,7 +25,7 @@ public final class BlockEntityIds { private static final int[] IDS; static { - final int[] ids = com.viaversion.viaversion.protocols.v1_17_1to1_18.data.BlockEntityIds.getIds(); + final int[] ids = BlockEntityIds1_18.getIds(); IDS = new int[Arrays.stream(ids).max().getAsInt() + 1]; Arrays.fill(IDS, -1); for (int i = 0; i < ids.length; i++) {