From c64e9acf353826d9ab152b9cd8f4cc29a20ead7a Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Thu, 18 Apr 2024 16:26:03 +0200 Subject: [PATCH] Override getTagRewriter methods --- .../protocol1_13to1_13_1/Protocol1_13To1_13_1.java | 8 +++++++- .../protocol1_14_4to1_15/Protocol1_14_4To1_15.java | 8 +++++++- .../protocol1_15_2to1_16/Protocol1_15_2To1_16.java | 8 +++++++- .../protocol1_16_1to1_16_2/Protocol1_16_1To1_16_2.java | 8 +++++++- .../protocol1_16_4to1_17/Protocol1_16_4To1_17.java | 7 ++++++- .../protocol1_17_1to1_18/Protocol1_17_1To1_18.java | 7 ++++++- .../protocol1_18_2to1_19/Protocol1_18_2To1_19.java | 7 ++++++- .../protocol1_19_1to1_19_3/Protocol1_19_1To1_19_3.java | 7 ++++++- .../protocol1_19_3to1_19_4/Protocol1_19_3To1_19_4.java | 7 ++++++- .../protocol1_19_4to1_20/Protocol1_19_4To1_20.java | 7 ++++++- .../protocol1_20_2to1_20_3/Protocol1_20_2To1_20_3.java | 7 ++++++- .../protocol1_20_3to1_20_5/Protocol1_20_3To1_20_5.java | 7 ++++++- .../protocol1_20to1_20_2/Protocol1_20To1_20_2.java | 7 ++++++- .../template/protocol/Protocol1_98To1_99.java | 7 ++++++- 14 files changed, 88 insertions(+), 14 deletions(-) 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 54164332..e1afa44e 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 @@ -51,6 +51,7 @@ public class Protocol1_13To1_13_1 extends BackwardsProtocol translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON); + private final TagRewriter tagRewriter = new TagRewriter<>(this); public Protocol1_13To1_13_1() { super(ClientboundPackets1_13.class, ClientboundPackets1_13.class, ServerboundPackets1_13.class, ServerboundPackets1_13.class); @@ -198,7 +199,7 @@ public class Protocol1_13To1_13_1 extends BackwardsProtocol(this).register(ClientboundPackets1_13.TAGS, RegistryType.ITEM); + tagRewriter.register(ClientboundPackets1_13.TAGS, RegistryType.ITEM); new StatisticsRewriter<>(this).register(ClientboundPackets1_13.STATISTICS); } @@ -229,4 +230,9 @@ public class Protocol1_13To1_13_1 extends BackwardsProtocol translatableRewriter() { return translatableRewriter; } + + @Override + public TagRewriter getTagRewriter() { + return 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 50e063e8..8087d565 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 @@ -45,6 +45,7 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON); + private final TagRewriter tagRewriter = new TagRewriter<>(this); public Protocol1_14_4To1_15() { super(ClientboundPackets1_15.class, ClientboundPackets1_14_4.class, ServerboundPackets1_14.class, ServerboundPackets1_14.class); @@ -94,7 +95,7 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol(this).register(ClientboundPackets1_15.TAGS, RegistryType.ENTITY); + tagRewriter.register(ClientboundPackets1_15.TAGS, RegistryType.ENTITY); new StatisticsRewriter<>(this).register(ClientboundPackets1_15.STATISTICS); } @@ -120,6 +121,11 @@ public class Protocol1_14_4To1_15 extends BackwardsProtocol getTagRewriter() { + return tagRewriter; + } + @Override public TranslatableRewriter getTranslatableRewriter() { return translatableRewriter; 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 5e55e274..f05da4e9 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 @@ -51,6 +51,7 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol tagRewriter = new TagRewriter<>(this); public Protocol1_15_2To1_16() { super(ClientboundPackets1_16.class, ClientboundPackets1_15.class, ServerboundPackets1_16.class, ServerboundPackets1_14.class); @@ -118,7 +119,7 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol(this).register(ClientboundPackets1_16.TAGS, RegistryType.ENTITY); + tagRewriter.register(ClientboundPackets1_16.TAGS, RegistryType.ENTITY); new StatisticsRewriter<>(this).register(ClientboundPackets1_16.STATISTICS); @@ -192,4 +193,9 @@ public class Protocol1_15_2To1_16 extends BackwardsProtocol getTagRewriter() { + return tagRewriter; + } } 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 f8fc5c3f..cf6a66c8 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 @@ -47,6 +47,7 @@ public class Protocol1_16_1To1_16_2 extends BackwardsProtocol translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON); + private final TagRewriter tagRewriter = new TagRewriter<>(this); public Protocol1_16_1To1_16_2() { super(ClientboundPackets1_16_2.class, ClientboundPackets1_16.class, ServerboundPackets1_16_2.class, ServerboundPackets1_16.class); @@ -101,7 +102,7 @@ public class Protocol1_16_1To1_16_2 extends BackwardsProtocol(this).register(ClientboundPackets1_16_2.TAGS, RegistryType.ENTITY); + tagRewriter.register(ClientboundPackets1_16_2.TAGS, RegistryType.ENTITY); new StatisticsRewriter<>(this).register(ClientboundPackets1_16_2.STATISTICS); } @@ -142,4 +143,9 @@ public class Protocol1_16_1To1_16_2 extends BackwardsProtocol getTagRewriter() { + return 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 40d8750b..1a6c7757 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 @@ -59,6 +59,7 @@ public final class Protocol1_16_4To1_17 extends BackwardsProtocol translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON); + private final TagRewriter tagRewriter = new TagRewriter<>(this); public Protocol1_16_4To1_17() { super(ClientboundPackets1_17.class, ClientboundPackets1_16_2.class, ServerboundPackets1_17.class, ServerboundPackets1_16_2.class); @@ -81,7 +82,6 @@ public final class Protocol1_16_4To1_17 extends BackwardsProtocol tagRewriter = new TagRewriter<>(this); registerClientbound(ClientboundPackets1_17.TAGS, wrapper -> { Map> tags = new HashMap<>(); @@ -249,4 +249,9 @@ public final class Protocol1_16_4To1_17 extends BackwardsProtocol getTagRewriter() { + return tagRewriter; + } } diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_17_1to1_18/Protocol1_17_1To1_18.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_17_1to1_18/Protocol1_17_1To1_18.java index f7eb2607..82178c76 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_17_1to1_18/Protocol1_17_1To1_18.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_17_1to1_18/Protocol1_17_1To1_18.java @@ -42,6 +42,7 @@ public final class Protocol1_17_1To1_18 extends BackwardsProtocol translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON); + private final TagRewriter tagRewriter = new TagRewriter<>(this); public Protocol1_17_1To1_18() { super(ClientboundPackets1_18.class, ClientboundPackets1_17_1.class, ServerboundPackets1_17.class, ServerboundPackets1_17.class); @@ -68,7 +69,6 @@ public final class Protocol1_17_1To1_18 extends BackwardsProtocol tagRewriter = new TagRewriter<>(this); tagRewriter.addEmptyTag(RegistryType.BLOCK, "minecraft:lava_pool_stone_replaceables"); tagRewriter.registerGeneric(ClientboundPackets1_18.TAGS); @@ -154,4 +154,9 @@ public final class Protocol1_17_1To1_18 extends BackwardsProtocol getTranslatableRewriter() { return translatableRewriter; } + + @Override + public TagRewriter getTagRewriter() { + return tagRewriter; + } } diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_18_2to1_19/Protocol1_18_2To1_19.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_18_2to1_19/Protocol1_18_2To1_19.java index 790e279d..67990a89 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_18_2to1_19/Protocol1_18_2To1_19.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_18_2to1_19/Protocol1_18_2To1_19.java @@ -69,6 +69,7 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON); + private final TagRewriter tagRewriter = new TagRewriter<>(this); public Protocol1_18_2To1_19() { super(ClientboundPackets1_19.class, ClientboundPackets1_18.class, ServerboundPackets1_19.class, ServerboundPackets1_17.class); @@ -131,7 +132,6 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol tagRewriter = new TagRewriter<>(this); tagRewriter.removeTags("minecraft:banner_pattern"); tagRewriter.removeTags("minecraft:instrument"); tagRewriter.removeTags("minecraft:cat_variant"); @@ -371,4 +371,9 @@ public final class Protocol1_18_2To1_19 extends BackwardsProtocol getTagRewriter() { + return tagRewriter; + } } diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_19_1to1_19_3/Protocol1_19_1To1_19_3.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_19_1to1_19_3/Protocol1_19_1To1_19_3.java index 8c2005fd..f990d838 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_19_1to1_19_3/Protocol1_19_1To1_19_3.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_19_1to1_19_3/Protocol1_19_1To1_19_3.java @@ -72,6 +72,7 @@ public final class Protocol1_19_1To1_19_3 extends BackwardsProtocol translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON); + private final TagRewriter tagRewriter = new TagRewriter<>(this); public Protocol1_19_1To1_19_3() { super(ClientboundPackets1_19_3.class, ClientboundPackets1_19_1.class, ServerboundPackets1_19_3.class, ServerboundPackets1_19_1.class); @@ -116,7 +117,6 @@ public final class Protocol1_19_1To1_19_3 extends BackwardsProtocol tagRewriter = new TagRewriter<>(this); tagRewriter.addEmptyTag(RegistryType.BLOCK, "minecraft:non_flammable_wood"); tagRewriter.addEmptyTag(RegistryType.ITEM, "minecraft:overworld_natural_logs"); tagRewriter.registerGeneric(ClientboundPackets1_19_3.TAGS); @@ -404,4 +404,9 @@ public final class Protocol1_19_1To1_19_3 extends BackwardsProtocol getTagRewriter() { + return tagRewriter; + } } diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_19_3to1_19_4/Protocol1_19_3To1_19_4.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_19_3to1_19_4/Protocol1_19_3To1_19_4.java index 70712230..7c92fa1a 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_19_3to1_19_4/Protocol1_19_3To1_19_4.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_19_3to1_19_4/Protocol1_19_3To1_19_4.java @@ -47,6 +47,7 @@ public final class Protocol1_19_3To1_19_4 extends BackwardsProtocol translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON); + private final TagRewriter tagRewriter = new TagRewriter<>(this); public Protocol1_19_3To1_19_4() { super(ClientboundPackets1_19_4.class, ClientboundPackets1_19_3.class, ServerboundPackets1_19_4.class, ServerboundPackets1_19_3.class); @@ -96,7 +97,6 @@ public final class Protocol1_19_3To1_19_4 extends BackwardsProtocol tagRewriter = new TagRewriter<>(this); tagRewriter.removeTags("minecraft:damage_type"); tagRewriter.registerGeneric(ClientboundPackets1_19_4.TAGS); @@ -139,4 +139,9 @@ public final class Protocol1_19_3To1_19_4 extends BackwardsProtocol getTranslatableRewriter() { return translatableRewriter; } + + @Override + public TagRewriter getTagRewriter() { + return tagRewriter; + } } \ No newline at end of file diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_19_4to1_20/Protocol1_19_4To1_20.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_19_4to1_20/Protocol1_19_4To1_20.java index 86ee3ec6..f02cf8b4 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_19_4to1_20/Protocol1_19_4To1_20.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_19_4to1_20/Protocol1_19_4To1_20.java @@ -41,6 +41,7 @@ public final class Protocol1_19_4To1_20 extends BackwardsProtocol translatableRewriter = new TranslatableRewriter<>(this, ComponentRewriter.ReadType.JSON); private final EntityPackets1_20 entityRewriter = new EntityPackets1_20(this); private final BlockItemPackets1_20 itemRewriter = new BlockItemPackets1_20(this); + private final TagRewriter tagRewriter = new TagRewriter<>(this); public Protocol1_19_4To1_20() { super(ClientboundPackets1_19_4.class, ClientboundPackets1_19_4.class, ServerboundPackets1_19_4.class, ServerboundPackets1_19_4.class); @@ -50,7 +51,6 @@ public final class Protocol1_19_4To1_20 extends BackwardsProtocol tagRewriter = new TagRewriter<>(this); tagRewriter.addEmptyTag(RegistryType.BLOCK, "minecraft:replaceable_plants"); tagRewriter.registerGeneric(ClientboundPackets1_19_4.TAGS); @@ -115,4 +115,9 @@ public final class Protocol1_19_4To1_20 extends BackwardsProtocol getTranslatableRewriter() { return translatableRewriter; } + + @Override + public TagRewriter getTagRewriter() { + return tagRewriter; + } } \ No newline at end of file diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_2to1_20_3/Protocol1_20_2To1_20_3.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_2to1_20_3/Protocol1_20_2To1_20_3.java index 1dafc9da..5f3b4871 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_2to1_20_3/Protocol1_20_2To1_20_3.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_2to1_20_3/Protocol1_20_2To1_20_3.java @@ -65,6 +65,7 @@ public final class Protocol1_20_2To1_20_3 extends BackwardsProtocol translatableRewriter = new TranslatableRewriter<>(this, ReadType.NBT); + private final TagRewriter tagRewriter = new TagRewriter<>(this); public Protocol1_20_2To1_20_3() { super(ClientboundPacket1_20_3.class, ClientboundPacket1_20_2.class, ServerboundPacket1_20_3.class, ServerboundPacket1_20_2.class); @@ -74,7 +75,6 @@ public final class Protocol1_20_2To1_20_3 extends BackwardsProtocol tagRewriter = new TagRewriter<>(this); tagRewriter.registerGeneric(ClientboundPackets1_20_3.TAGS); final SoundRewriter soundRewriter = new SoundRewriter<>(this); @@ -406,6 +406,11 @@ public final class Protocol1_20_2To1_20_3 extends BackwardsProtocol getTagRewriter() { + return tagRewriter; + } + @Override protected PacketTypesProvider createPacketTypesProvider() { return new SimplePacketTypesProvider<>( diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_3to1_20_5/Protocol1_20_3To1_20_5.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_3to1_20_5/Protocol1_20_3To1_20_5.java index 99f762ea..e8dbdb71 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_3to1_20_5/Protocol1_20_3To1_20_5.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20_3to1_20_5/Protocol1_20_3To1_20_5.java @@ -66,6 +66,7 @@ public final class Protocol1_20_3To1_20_5 extends BackwardsProtocol translatableRewriter = new TranslatableRewriter<>(this, ReadType.NBT); + private final TagRewriter tagRewriter = new TagRewriter<>(this); public Protocol1_20_3To1_20_5() { super(ClientboundPacket1_20_5.class, ClientboundPacket1_20_3.class, ServerboundPacket1_20_5.class, ServerboundPacket1_20_3.class); @@ -75,7 +76,6 @@ public final class Protocol1_20_3To1_20_5 extends BackwardsProtocol tagRewriter = new TagRewriter<>(this); tagRewriter.registerGeneric(ClientboundPackets1_20_5.TAGS); registerClientbound(ClientboundConfigurationPackets1_20_5.UPDATE_TAGS, wrapper -> { // Send off registry data first @@ -202,6 +202,11 @@ public final class Protocol1_20_3To1_20_5 extends BackwardsProtocol getTagRewriter() { + return tagRewriter; + } + @Override protected PacketTypesProvider createPacketTypesProvider() { return new SimplePacketTypesProvider<>( diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20to1_20_2/Protocol1_20To1_20_2.java b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20to1_20_2/Protocol1_20To1_20_2.java index ed97c2bc..df597ba3 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20to1_20_2/Protocol1_20To1_20_2.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/protocol1_20to1_20_2/Protocol1_20To1_20_2.java @@ -51,6 +51,7 @@ public final class Protocol1_20To1_20_2 extends BackwardsProtocol tagRewriter = new TagRewriter<>(this); public Protocol1_20To1_20_2() { super(ClientboundPackets1_20_2.class, ClientboundPackets1_19_4.class, ServerboundPackets1_20_2.class, ServerboundPackets1_19_4.class); @@ -60,7 +61,6 @@ public final class Protocol1_20To1_20_2 extends BackwardsProtocol tagRewriter = new TagRewriter<>(this); tagRewriter.registerGeneric(ClientboundPackets1_20_2.TAGS); final SoundRewriter soundRewriter = new SoundRewriter<>(this); @@ -216,4 +216,9 @@ public final class Protocol1_20To1_20_2 extends BackwardsProtocol getItemRewriter() { return itemPacketRewriter; } + + @Override + public TagRewriter getTagRewriter() { + return tagRewriter; + } } \ No newline at end of file diff --git a/template/src/main/java/com/viaversion/viabackwards/template/protocol/Protocol1_98To1_99.java b/template/src/main/java/com/viaversion/viabackwards/template/protocol/Protocol1_98To1_99.java index 72f499ea..b8d36bd3 100644 --- a/template/src/main/java/com/viaversion/viabackwards/template/protocol/Protocol1_98To1_99.java +++ b/template/src/main/java/com/viaversion/viabackwards/template/protocol/Protocol1_98To1_99.java @@ -51,6 +51,7 @@ public final class Protocol1_98To1_99 extends BackwardsProtocol translatableRewriter = new TranslatableRewriter<>(this, ReadType.NBT); + private final TagRewriter tagRewriter = new TagRewriter<>(this); public Protocol1_98To1_99() { super(ClientboundPacket1_20_5.class, ClientboundPacket1_20_5.class, ServerboundPacket1_20_5.class, ServerboundPacket1_20_5.class); @@ -60,7 +61,6 @@ public final class Protocol1_98To1_99 extends BackwardsProtocol tagRewriter = new TagRewriter<>(this); tagRewriter.registerGeneric(ClientboundPackets1_20_5.TAGS); tagRewriter.registerGeneric(ClientboundConfigurationPackets1_20_5.UPDATE_TAGS); @@ -111,5 +111,10 @@ public final class Protocol1_98To1_99 extends BackwardsProtocol getTagRewriter() { + return tagRewriter; + } + // createPacketTypesProvider } \ No newline at end of file