From f439382ee54454938ec07f1f93d68bc26ba3b03d Mon Sep 17 00:00:00 2001 From: RaphiMC <50594595+RaphiMC@users.noreply.github.com> Date: Sun, 16 Jun 2024 18:27:05 +0200 Subject: [PATCH] Added 1.21 client and server support --- build.gradle | 14 +++++++------- .../mixins/MixinBlockItemPacketRewriter1_20_5.java | 4 ++-- .../mixins/MixinEntityPacketRewriter1_20_5.java | 3 +-- .../mixins/MixinItemPacketRewriter1_9.java | 12 ++++++------ 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/build.gradle b/build.gradle index bb537db..1182617 100644 --- a/build.gradle +++ b/build.gradle @@ -53,16 +53,16 @@ repositories { } dependencies { - include "com.viaversion:viaversion-common:5.0.0-SNAPSHOT" - include "com.viaversion:viabackwards-common:5.0.0-SNAPSHOT" - include "com.viaversion:viarewind-common:4.0.0-SNAPSHOT" - include "net.raphimc:ViaLegacy:3.0.0-SNAPSHOT" - include "net.raphimc:ViaAprilFools:3.0.0-SNAPSHOT" - include("net.raphimc:ViaBedrock:0.0.8-SNAPSHOT") { + include "com.viaversion:viaversion-common:5.0.0" + include "com.viaversion:viabackwards-common:5.0.0" + include "com.viaversion:viarewind-common:4.0.0" + include "net.raphimc:ViaLegacy:3.0.0" + include "net.raphimc:ViaAprilFools:3.0.0" + include("net.raphimc:ViaBedrock:0.0.9-SNAPSHOT") { exclude group: "io.netty" exclude group: "io.jsonwebtoken" } - include("net.raphimc:ViaLoader:3.0.0-SNAPSHOT") { + include("net.raphimc:ViaLoader:3.0.0") { exclude group: "org.slf4j", module: "slf4j-api" } diff --git a/src/main/java/net/raphimc/viaproxy/injection/mixins/MixinBlockItemPacketRewriter1_20_5.java b/src/main/java/net/raphimc/viaproxy/injection/mixins/MixinBlockItemPacketRewriter1_20_5.java index 4e80d16..519a21a 100644 --- a/src/main/java/net/raphimc/viaproxy/injection/mixins/MixinBlockItemPacketRewriter1_20_5.java +++ b/src/main/java/net/raphimc/viaproxy/injection/mixins/MixinBlockItemPacketRewriter1_20_5.java @@ -139,7 +139,7 @@ public abstract class MixinBlockItemPacketRewriter1_20_5 extends ItemRewriter itemIdentifiers = new Int2ObjectOpenHashMap<>(); @Unique - private final Map>> itemAttributes = new HashMap<>(); + private final Map>> itemAttributes = new HashMap<>(); // TODO: ClassTransform bug: Constructor merging is broken /*public MixinItemPacketRewriter1_9(Protocol1_8To1_9 protocol, Type itemType, Type itemArrayType, Type mappedItemType, Type mappedItemArrayType) { @@ -72,11 +72,11 @@ public abstract class MixinItemPacketRewriter1_9 extends ItemRewriter itemEntry : itemAttributes.entrySet()) { final String itemIdentifier = itemEntry.getKey(); - final Map> attributes = new HashMap<>(); + final Map> attributes = new HashMap<>(); for (Map.Entry attributeEntry : itemEntry.getValue().getAsJsonObject().entrySet()) { final String attribute = attributeEntry.getKey(); final JsonObject attributeData = attributeEntry.getValue().getAsJsonObject(); - final ModifierData modifierData = new ModifierData(UUID.fromString(attributeData.get("id").getAsString()), attributeData.get("name").getAsString(), attributeData.get("amount").getAsDouble(), attributeData.get("operation").getAsInt()); + final AttributeModifiers1_20_5.ModifierData modifierData = new AttributeModifiers1_20_5.ModifierData(UUID.fromString(attributeData.get("id").getAsString()), attributeData.get("name").getAsString(), attributeData.get("amount").getAsDouble(), attributeData.get("operation").getAsInt()); final String slot = attributeData.get("slot").getAsString(); attributes.put(attribute, new Pair<>(slot, modifierData)); } @@ -91,7 +91,7 @@ public abstract class MixinItemPacketRewriter1_9 extends ItemRewriter> attributes = this.itemAttributes.get(identifier); + final Map> attributes = this.itemAttributes.get(identifier); final CompoundTag attributeFixTag = new CompoundTag(); CompoundTag tag = item.tag(); if (tag == null) { @@ -104,7 +104,7 @@ public abstract class MixinItemPacketRewriter1_9 extends ItemRewriter attributeModifiers = tag.getListTag("AttributeModifiers", CompoundTag.class); if (attributeModifiers == null) { attributeModifiers = new ListTag<>(CompoundTag.class); - for (Map.Entry> entry : attributes.entrySet()) { + for (Map.Entry> entry : attributes.entrySet()) { final CompoundTag attributeModifier = new CompoundTag(); attributeModifier.putString("AttributeName", entry.getKey()); attributeModifier.putString("Name", entry.getValue().value().name());