|
1 | 1 | --- a/net/minecraft/network/codec/ByteBufCodecs.java |
2 | 2 | +++ b/net/minecraft/network/codec/ByteBufCodecs.java |
| 3 | +@@ -334,7 +_,13 @@ |
| 4 | + return new StreamCodec<ByteBuf, Tag>() { |
| 5 | + @Override |
| 6 | + public Tag decode(final ByteBuf input) { |
| 7 | +- Tag result = FriendlyByteBuf.readNbt(input, accounter.get()); |
| 8 | ++ // Paper start - Track codec depth |
| 9 | ++ final NbtAccounter acc = accounter.get(); |
| 10 | ++ if (input instanceof FriendlyByteBuf friendlyByteBuf && friendlyByteBuf.trackCodecDepth) { |
| 11 | ++ acc.pushDepth(friendlyByteBuf.codecDepth * 3); |
| 12 | ++ } |
| 13 | ++ Tag result = FriendlyByteBuf.readNbt(input, acc); |
| 14 | ++ // Paper end - Track codec depth |
| 15 | + if (result == null) { |
| 16 | + throw new DecoderException("Expected non-null compound tag"); |
| 17 | + } else { |
3 | 18 | @@ -418,6 +_,48 @@ |
4 | 19 | }; |
5 | 20 | } |
|
49 | 64 | static <B extends ByteBuf, V> StreamCodec<B, Optional<V>> optional(final StreamCodec<? super B, V> original) { |
50 | 65 | return new StreamCodec<B, Optional<V>>() { |
51 | 66 | @Override |
| 67 | +@@ -594,7 +_,7 @@ |
| 68 | + } |
| 69 | + |
| 70 | + static <V> StreamCodec.CodecOperation<RegistryFriendlyByteBuf, V, V> registryFriendlyLengthPrefixed(final int maxSize) { |
| 71 | +- return lengthPrefixed(maxSize, (parent, child) -> new RegistryFriendlyByteBuf(child, parent.registryAccess())); |
| 72 | ++ return lengthPrefixed(maxSize, (parent, child) -> new RegistryFriendlyByteBuf(child, parent)); // Paper - Track codec depth |
| 73 | + } |
| 74 | + |
| 75 | + static <T> StreamCodec<ByteBuf, T> idMapper(final IntFunction<T> byId, final ToIntFunction<T> toId) { |
0 commit comments