Skip to content

Commit

Permalink
fix custom payload & mixins
Browse files Browse the repository at this point in the history
  • Loading branch information
acrylic-style committed Jul 30, 2024
1 parent 78a4e8c commit 006f93d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public static void sendToClient(@NotNull ServerGamePacketListenerImpl connection
connection.send(customPayloadPacket);
}

@SuppressWarnings("JavaReflectionMemberAccess")
@SuppressWarnings("JavaReflectionMemberAccess") // constructor is defined in Blueberry-Client
private static @NotNull DiscardedPayload createCustomPayload(ResourceLocation id, ByteBuf buf) {
byte[] bytes = new byte[buf.readableBytes()];
buf.readBytes(bytes);
Expand Down
15 changes: 13 additions & 2 deletions MagmaCube-Patches/0005-Mods-support.patch
Original file line number Diff line number Diff line change
Expand Up @@ -687,10 +687,10 @@ index 33827434b04f08893431f622c5aeed89b6471c74..d45f7e26f20272b0bfc02f0ca821ed3a
iterable.forEach(blockState -> this.modelGroups.put(blockState, i));
}
diff --git a/src/main/java/net/minecraft/network/protocol/common/custom/DiscardedPayload.java b/src/main/java/net/minecraft/network/protocol/common/custom/DiscardedPayload.java
index 5fda67ba06ee75fe0c62a00e0b9ca2a82827e97c..ee8e117c6d2e11f55d86a3c4817bd665cb214551 100644
index 5fda67ba06ee75fe0c62a00e0b9ca2a82827e97c..4b179c0be98e26007704253052e4310a750b2ca0 100644
--- a/src/main/java/net/minecraft/network/protocol/common/custom/DiscardedPayload.java
+++ b/src/main/java/net/minecraft/network/protocol/common/custom/DiscardedPayload.java
@@ -4,7 +4,24 @@ import net.minecraft.network.FriendlyByteBuf;
@@ -4,14 +4,33 @@ import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.resources.ResourceLocation;

Expand All @@ -715,7 +715,18 @@ index 5fda67ba06ee75fe0c62a00e0b9ca2a82827e97c..ee8e117c6d2e11f55d86a3c4817bd665
+
public static <T extends FriendlyByteBuf> StreamCodec<T, DiscardedPayload> codec(ResourceLocation resourceLocation, int i) {
return CustomPacketPayload.codec((discardedPayload, friendlyByteBuf) -> {
+ friendlyByteBuf.writeBytes(discardedPayload.payload());
}, friendlyByteBuf -> {
int j = friendlyByteBuf.readableBytes();
if (j >= 0 && j <= i) {
- friendlyByteBuf.skipBytes(j);
- return new DiscardedPayload(resourceLocation);
+ byte[] bytes = new byte[j];
+ friendlyByteBuf.readBytes(bytes);
+ return new DiscardedPayload(resourceLocation, bytes);
} else {
throw new IllegalArgumentException("Payload may not be larger than " + i + " bytes");
}
diff --git a/src/main/java/net/minecraft/network/protocol/status/ClientStatusPacketListener.java b/src/main/java/net/minecraft/network/protocol/status/ClientStatusPacketListener.java
index 8a52addea7666e52c7e396cde2d69b69d5da11c4..445b9aa0e77bfee21057cfd1c43a2a23aac67f4e 100644
--- a/src/main/java/net/minecraft/network/protocol/status/ClientStatusPacketListener.java
Expand Down
11 changes: 11 additions & 0 deletions scripts/files/version.json
Original file line number Diff line number Diff line change
Expand Up @@ -1686,6 +1686,17 @@
},
"name": "org.ow2.asm:asm-util:9.7"
},
{
"downloads": {
"artifact": {
"path": "org/ow2/asm/asm-analysis/9.7/asm-analysis-9.7.jar",
"sha1": "e4a258b7eb96107106c0599f0061cfc1832fe07a",
"size": 34776,
"url": "https://repository.ow2.org/nexus/content/repositories/releases/org/ow2/asm/asm-analysis/9.7/asm-analysis-9.7.jar"
}
},
"name": "org.ow2.asm:asm-analysis:9.7"
},
{
"downloads": {
"artifact": {
Expand Down

0 comments on commit 006f93d

Please sign in to comment.