From e41d643488dc18e2e4cc9ab7204d8b15e1b631fa Mon Sep 17 00:00:00 2001 From: KennyTV Date: Sun, 6 Jun 2021 17:24:41 +0200 Subject: [PATCH] Update VV usage --- build.gradle.kts | 2 +- .../api/rewriters/LegacySoundRewriter.java | 2 +- .../packets/ChatPackets1_12.java | 2 +- .../packets/PlayerPacket1_13.java | 2 +- .../packets/SoundPackets1_13.java | 2 +- .../packets/PlayerPackets1_14.java | 2 +- .../packets/SoundPackets1_14.java | 2 +- .../Protocol1_13To1_13_1.java | 2 +- .../Protocol1_14_4To1_15.java | 2 +- .../Protocol1_15_2To1_16.java | 2 +- .../Protocol1_16_1To1_16_2.java | 2 +- .../Protocol1_16_4To1_17.java | 33 ++++++++++--------- .../packets/BlockItemPackets1_17.java | 3 +- .../packets/EntityPackets1_17.java | 2 +- gradle/libs.versions.toml | 4 +-- 15 files changed, 34 insertions(+), 30 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 2ad3dc99..b2dd6f1d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,7 +5,7 @@ plugins { allprojects { group = "com.viaversion" - version = "4.0.0-1.17-pre5-SNAPSHOT" + version = "4.0.0-1.17-rc1-SNAPSHOT" description = "Allow older clients to join newer server versions." } diff --git a/common/src/main/java/com/viaversion/viabackwards/api/rewriters/LegacySoundRewriter.java b/common/src/main/java/com/viaversion/viabackwards/api/rewriters/LegacySoundRewriter.java index 5de366f4..1231a919 100644 --- a/common/src/main/java/com/viaversion/viabackwards/api/rewriters/LegacySoundRewriter.java +++ b/common/src/main/java/com/viaversion/viabackwards/api/rewriters/LegacySoundRewriter.java @@ -19,9 +19,9 @@ package com.viaversion.viabackwards.api.rewriters; import com.viaversion.viabackwards.api.BackwardsProtocol; +import com.viaversion.viaversion.api.rewriter.RewriterBase; import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectMap; import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectOpenHashMap; -import com.viaversion.viaversion.api.rewriter.RewriterBase; @Deprecated public abstract class LegacySoundRewriter extends RewriterBase { diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_11_1to1_12/packets/ChatPackets1_12.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_11_1to1_12/packets/ChatPackets1_12.java index b3e2e210..e62cd3a3 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_11_1to1_12/packets/ChatPackets1_12.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_11_1to1_12/packets/ChatPackets1_12.java @@ -21,12 +21,12 @@ package com.viaversion.viabackwards.protocol.protocol1_11_1to1_12.packets; import com.viaversion.viabackwards.protocol.protocol1_11_1to1_12.Protocol1_11_1To1_12; import com.viaversion.viabackwards.protocol.protocol1_11_1to1_12.data.AdvancementTranslations; import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper; +import com.viaversion.viaversion.api.rewriter.RewriterBase; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.libs.gson.JsonElement; import com.viaversion.viaversion.libs.gson.JsonObject; import com.viaversion.viaversion.protocols.protocol1_12to1_11_1.ClientboundPackets1_12; import com.viaversion.viaversion.rewriter.ComponentRewriter; -import com.viaversion.viaversion.api.rewriter.RewriterBase; public class ChatPackets1_12 extends RewriterBase { diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/packets/PlayerPacket1_13.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/packets/PlayerPacket1_13.java index e5fbb4c4..26f7d35d 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/packets/PlayerPacket1_13.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/packets/PlayerPacket1_13.java @@ -30,6 +30,7 @@ import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.packet.State; import com.viaversion.viaversion.api.protocol.remapper.PacketHandler; import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper; +import com.viaversion.viaversion.api.rewriter.RewriterBase; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.libs.gson.JsonElement; import com.viaversion.viaversion.protocols.protocol1_12_1to1_12.ClientboundPackets1_12_1; @@ -38,7 +39,6 @@ import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ChatRewriter; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.packets.InventoryPackets; import com.viaversion.viaversion.rewriter.CommandRewriter; -import com.viaversion.viaversion.api.rewriter.RewriterBase; import java.nio.charset.StandardCharsets; import java.util.ArrayList; diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/packets/SoundPackets1_13.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/packets/SoundPackets1_13.java index 42c9dc55..34e18605 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/packets/SoundPackets1_13.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_12_2to1_13/packets/SoundPackets1_13.java @@ -22,10 +22,10 @@ import com.viaversion.viabackwards.protocol.protocol1_12_2to1_13.Protocol1_12_2T import com.viaversion.viabackwards.protocol.protocol1_12_2to1_13.data.NamedSoundMapping; import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper; +import com.viaversion.viaversion.api.rewriter.RewriterBase; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.protocols.protocol1_12_1to1_12.ClientboundPackets1_12_1; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13; -import com.viaversion.viaversion.api.rewriter.RewriterBase; public class SoundPackets1_13 extends RewriterBase { private static final String[] SOUND_SOURCES = {"master", "music", "record", "weather", "block", "hostile", "neutral", "player", "ambient", "voice"}; diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/PlayerPackets1_14.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/PlayerPackets1_14.java index 304fe7bc..8ed3221c 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/PlayerPackets1_14.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/PlayerPackets1_14.java @@ -22,10 +22,10 @@ import com.viaversion.viaversion.api.minecraft.Position; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.remapper.PacketHandler; import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper; +import com.viaversion.viaversion.api.rewriter.RewriterBase; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ServerboundPackets1_13; import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14; -import com.viaversion.viaversion.api.rewriter.RewriterBase; public class PlayerPackets1_14 extends RewriterBase { diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/SoundPackets1_14.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/SoundPackets1_14.java index bfc2c44a..4a761c0b 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/SoundPackets1_14.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13_2to1_14/packets/SoundPackets1_14.java @@ -24,10 +24,10 @@ import com.viaversion.viabackwards.protocol.protocol1_13_2to1_14.storage.EntityP import com.viaversion.viaversion.api.data.entity.StoredEntityData; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper; +import com.viaversion.viaversion.api.rewriter.RewriterBase; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13; import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ClientboundPackets1_14; -import com.viaversion.viaversion.api.rewriter.RewriterBase; public class SoundPackets1_14 extends RewriterBase { diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13to1_13_1/Protocol1_13To1_13_1.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13to1_13_1/Protocol1_13To1_13_1.java index 8ad291b0..6f7e96fc 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13to1_13_1/Protocol1_13To1_13_1.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_13to1_13_1/Protocol1_13To1_13_1.java @@ -25,6 +25,7 @@ import com.viaversion.viabackwards.protocol.protocol1_13to1_13_1.packets.EntityP import com.viaversion.viabackwards.protocol.protocol1_13to1_13_1.packets.InventoryPackets1_13_1; import com.viaversion.viabackwards.protocol.protocol1_13to1_13_1.packets.WorldPackets1_13_1; import com.viaversion.viaversion.api.connection.UserConnection; +import com.viaversion.viaversion.api.minecraft.RegistryType; import com.viaversion.viaversion.api.minecraft.entities.Entity1_13Types; import com.viaversion.viaversion.api.minecraft.item.Item; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; @@ -42,7 +43,6 @@ import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ChatRewriter; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ClientboundPackets1_13; import com.viaversion.viaversion.protocols.protocol1_13to1_12_2.ServerboundPackets1_13; import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; -import com.viaversion.viaversion.rewriter.RegistryType; import com.viaversion.viaversion.rewriter.StatisticsRewriter; import com.viaversion.viaversion.rewriter.TagRewriter; diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_14_4to1_15/Protocol1_14_4To1_15.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_14_4to1_15/Protocol1_14_4To1_15.java index 24d1d2a0..88127c9f 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_14_4to1_15/Protocol1_14_4To1_15.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_14_4to1_15/Protocol1_14_4To1_15.java @@ -25,6 +25,7 @@ import com.viaversion.viabackwards.protocol.protocol1_14_4to1_15.data.ImmediateR import com.viaversion.viabackwards.protocol.protocol1_14_4to1_15.packets.BlockItemPackets1_15; import com.viaversion.viabackwards.protocol.protocol1_14_4to1_15.packets.EntityPackets1_15; import com.viaversion.viaversion.api.connection.UserConnection; +import com.viaversion.viaversion.api.minecraft.RegistryType; import com.viaversion.viaversion.api.minecraft.entities.Entity1_15Types; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper; @@ -35,7 +36,6 @@ import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ClientboundPacke import com.viaversion.viaversion.protocols.protocol1_14to1_13_2.ServerboundPackets1_14; import com.viaversion.viaversion.protocols.protocol1_15to1_14_4.ClientboundPackets1_15; import com.viaversion.viaversion.protocols.protocol1_15to1_14_4.Protocol1_15To1_14_4; -import com.viaversion.viaversion.rewriter.RegistryType; import com.viaversion.viaversion.rewriter.StatisticsRewriter; import com.viaversion.viaversion.rewriter.TagRewriter; diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_15_2to1_16/Protocol1_15_2To1_16.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_15_2to1_16/Protocol1_15_2To1_16.java index cc21b0d1..ec589aff 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_15_2to1_16/Protocol1_15_2To1_16.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_15_2to1_16/Protocol1_15_2To1_16.java @@ -28,6 +28,7 @@ import com.viaversion.viabackwards.protocol.protocol1_15_2to1_16.packets.BlockIt import com.viaversion.viabackwards.protocol.protocol1_15_2to1_16.packets.EntityPackets1_16; import com.viaversion.viabackwards.protocol.protocol1_15_2to1_16.storage.PlayerSneakStorage; import com.viaversion.viaversion.api.connection.UserConnection; +import com.viaversion.viaversion.api.minecraft.RegistryType; import com.viaversion.viaversion.api.minecraft.entities.Entity1_16Types; import com.viaversion.viaversion.api.protocol.packet.State; import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper; @@ -42,7 +43,6 @@ import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.ClientboundPacke import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.Protocol1_16To1_15_2; import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.ServerboundPackets1_16; import com.viaversion.viaversion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; -import com.viaversion.viaversion.rewriter.RegistryType; import com.viaversion.viaversion.rewriter.StatisticsRewriter; import com.viaversion.viaversion.rewriter.TagRewriter; import com.viaversion.viaversion.util.GsonUtil; diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_1to1_16_2/Protocol1_16_1To1_16_2.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_1to1_16_2/Protocol1_16_1To1_16_2.java index 4d4db68f..fac6b0cd 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_1to1_16_2/Protocol1_16_1To1_16_2.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_1to1_16_2/Protocol1_16_1To1_16_2.java @@ -25,6 +25,7 @@ import com.viaversion.viabackwards.protocol.protocol1_16_1to1_16_2.data.CommandR import com.viaversion.viabackwards.protocol.protocol1_16_1to1_16_2.packets.BlockItemPackets1_16_2; import com.viaversion.viabackwards.protocol.protocol1_16_1to1_16_2.packets.EntityPackets1_16_2; import com.viaversion.viaversion.api.connection.UserConnection; +import com.viaversion.viaversion.api.minecraft.RegistryType; import com.viaversion.viaversion.api.minecraft.entities.Entity1_16_2Types; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.remapper.PacketHandler; @@ -38,7 +39,6 @@ import com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.Protocol1_16_2 import com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ServerboundPackets1_16_2; import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.ClientboundPackets1_16; import com.viaversion.viaversion.protocols.protocol1_16to1_15_2.ServerboundPackets1_16; -import com.viaversion.viaversion.rewriter.RegistryType; import com.viaversion.viaversion.rewriter.StatisticsRewriter; import com.viaversion.viaversion.rewriter.TagRewriter; diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/Protocol1_16_4To1_17.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/Protocol1_16_4To1_17.java index 9479a651..f6decefb 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/Protocol1_16_4To1_17.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/Protocol1_16_4To1_17.java @@ -24,10 +24,13 @@ import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter; import com.viaversion.viabackwards.protocol.protocol1_16_4to1_17.packets.BlockItemPackets1_17; import com.viaversion.viabackwards.protocol.protocol1_16_4to1_17.packets.EntityPackets1_17; import com.viaversion.viaversion.api.connection.UserConnection; +import com.viaversion.viaversion.api.minecraft.RegistryType; +import com.viaversion.viaversion.api.minecraft.TagData; import com.viaversion.viaversion.api.minecraft.entities.Entity1_17Types; import com.viaversion.viaversion.api.protocol.packet.PacketWrapper; import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper; import com.viaversion.viaversion.api.rewriter.EntityRewriter; +import com.viaversion.viaversion.api.rewriter.ItemRewriter; import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.data.entity.EntityTrackerBase; import com.viaversion.viaversion.libs.fastutil.ints.IntArrayList; @@ -38,7 +41,6 @@ import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ClientboundPacke import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.Protocol1_17To1_16_4; import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ServerboundPackets1_17; import com.viaversion.viaversion.rewriter.IdRewriteFunction; -import com.viaversion.viaversion.rewriter.RegistryType; import com.viaversion.viaversion.rewriter.StatisticsRewriter; import com.viaversion.viaversion.rewriter.TagRewriter; @@ -47,7 +49,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -public class Protocol1_16_4To1_17 extends BackwardsProtocol { +public final class Protocol1_16_4To1_17 extends BackwardsProtocol { public static final BackwardsMappings MAPPINGS = new BackwardsMappings("1.17", "1.16.2", Protocol1_17To1_16_4.class, true); private static final int[] EMPTY_ARRAY = {}; @@ -87,7 +89,7 @@ public class Protocol1_16_4To1_17 extends BackwardsProtocol { - Map> tags = new HashMap<>(); + Map> tags = new HashMap<>(); int length = wrapper.read(Type.VAR_INT); for (int i = 0; i < length; i++) { @@ -96,25 +98,25 @@ public class Protocol1_16_4To1_17 extends BackwardsProtocol tagList = new ArrayList<>(); + List tagList = new ArrayList<>(); tags.put(resourceKey, tagList); int tagLength = wrapper.read(Type.VAR_INT); for (int j = 0; j < tagLength; j++) { String identifier = wrapper.read(Type.STRING); int[] entries = wrapper.read(Type.VAR_INT_ARRAY_PRIMITIVE); - tagList.add(new TagRewriter.TagData(identifier, entries)); + tagList.add(new TagData(identifier, entries)); } } // Put them into the hardcoded order of Vanilla tags (and only those), rewrite ids for (RegistryType type : RegistryType.getValues()) { - List tagList = tags.get(type.getResourceLocation()); + List tagList = tags.get(type.getResourceLocation()); IdRewriteFunction rewriter = tagRewriter.getRewriter(type); wrapper.write(Type.VAR_INT, tagList.size()); - for (TagRewriter.TagData tagData : tagList) { - int[] entries = tagData.getEntries(); + for (TagData tagData : tagList) { + int[] entries = tagData.entries(); if (rewriter != null) { // Handle id rewriting now IntList idList = new IntArrayList(entries.length); @@ -127,7 +129,7 @@ public class Protocol1_16_4To1_17 extends BackwardsProtocol { +public final class BlockItemPackets1_17 extends ItemRewriter { public BlockItemPackets1_17(Protocol1_16_4To1_17 protocol, TranslatableRewriter translatableRewriter) { super(protocol, translatableRewriter); diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/packets/EntityPackets1_17.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/packets/EntityPackets1_17.java index 830b07fb..6994ec5a 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/packets/EntityPackets1_17.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_16_4to1_17/packets/EntityPackets1_17.java @@ -38,7 +38,7 @@ import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag; import com.viaversion.viaversion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2; import com.viaversion.viaversion.protocols.protocol1_17to1_16_4.ClientboundPackets1_17; -public class EntityPackets1_17 extends EntityRewriter { +public final class EntityPackets1_17 extends EntityRewriter { public EntityPackets1_17(Protocol1_16_4To1_17 protocol) { super(protocol); diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c08ddfaf..12978d81 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,14 +3,14 @@ metadata.format.version = "1.0" [versions] # ViaVersion -viaver = "4.0.0-1.17-pre5-20210604.101612-2" +viaver = "4.0.0-1.17-rc1-SNAPSHOT" # Common provided netty = "4.0.20.Final" guava = "17.0" log4j = "2.8.1" -checkerQual = "3.12.0" +checkerQual = "3.14.0" # Platforms paper = "1.16.5-R0.1-SNAPSHOT"