Paper/paper-server/nms-patches/net/minecraft/network/PacketDataSerializer.patch
CraftBukkit/Spigot 65bc2541a3 Update to Minecraft 1.20.5
By: md_5 <git@md-5.net>
2024-04-24 01:15:00 +10:00

72 lines
3.0 KiB
Diff

--- a/net/minecraft/network/PacketDataSerializer.java
+++ b/net/minecraft/network/PacketDataSerializer.java
@@ -139,7 +139,7 @@
public <T, C extends Collection<T>> C readCollection(IntFunction<C> intfunction, StreamDecoder<? super PacketDataSerializer, T> streamdecoder) {
int i = this.readVarInt();
- C c0 = (Collection) intfunction.apply(i);
+ C c0 = intfunction.apply(i); // CraftBukkit - decompile error
for (int j = 0; j < i; ++j) {
c0.add(streamdecoder.decode(this));
@@ -150,7 +150,7 @@
public <T> void writeCollection(Collection<T> collection, StreamEncoder<? super PacketDataSerializer, T> streamencoder) {
this.writeVarInt(collection.size());
- Iterator iterator = collection.iterator();
+ Iterator<T> iterator = collection.iterator(); // CraftBukkit - decompile error
while (iterator.hasNext()) {
T t0 = iterator.next();
@@ -177,12 +177,12 @@
public void writeIntIdList(IntList intlist) {
this.writeVarInt(intlist.size());
- intlist.forEach(this::writeVarInt);
+ intlist.forEach((java.util.function.IntConsumer) this::writeVarInt); // CraftBukkit - decompile error
}
public <K, V, M extends Map<K, V>> M readMap(IntFunction<M> intfunction, StreamDecoder<? super PacketDataSerializer, K> streamdecoder, StreamDecoder<? super PacketDataSerializer, V> streamdecoder1) {
int i = this.readVarInt();
- M m0 = (Map) intfunction.apply(i);
+ M m0 = intfunction.apply(i); // CraftBukkit - decompile error
for (int j = 0; j < i; ++j) {
K k0 = streamdecoder.decode(this);
@@ -216,7 +216,7 @@
}
public <E extends Enum<E>> void writeEnumSet(EnumSet<E> enumset, Class<E> oclass) {
- E[] ae = (Enum[]) oclass.getEnumConstants();
+ E[] ae = oclass.getEnumConstants(); // CraftBukkit - decompile error
BitSet bitset = new BitSet(ae.length);
for (int i = 0; i < ae.length; ++i) {
@@ -227,7 +227,7 @@
}
public <E extends Enum<E>> EnumSet<E> readEnumSet(Class<E> oclass) {
- E[] ae = (Enum[]) oclass.getEnumConstants();
+ E[] ae = oclass.getEnumConstants(); // CraftBukkit - decompile error
BitSet bitset = this.readFixedBitSet(ae.length);
EnumSet<E> enumset = EnumSet.noneOf(oclass);
@@ -482,7 +482,7 @@
}
public <T extends Enum<T>> T readEnum(Class<T> oclass) {
- return ((Enum[]) oclass.getEnumConstants())[this.readVarInt()];
+ return ((T[]) oclass.getEnumConstants())[this.readVarInt()]; // CraftBukkit - fix decompile error
}
public PacketDataSerializer writeEnum(Enum<?> oenum) {
@@ -549,7 +549,7 @@
try {
NBTCompressedStreamTools.writeAnyTag((NBTBase) nbtbase, new ByteBufOutputStream(bytebuf));
- } catch (IOException ioexception) {
+ } catch (Exception ioexception) { // CraftBukkit - IOException -> Exception
throw new EncoderException(ioexception);
}
}