2021-03-15 23:00:00 +01:00
--- a/net/minecraft/network/PacketDataSerializer.java
+++ b/net/minecraft/network/PacketDataSerializer.java
2024-04-23 17:15:00 +02:00
@@ -139,7 +139,7 @@
2014-11-25 22:32:16 +01:00
2024-04-23 17:15:00 +02:00
public <T, C extends Collection<T>> C readCollection(IntFunction<C> intfunction, StreamDecoder<? super PacketDataSerializer, T> streamdecoder) {
2021-11-21 23:00:00 +01:00
int i = this.readVarInt();
2021-06-11 07:00:00 +02:00
- C c0 = (Collection) intfunction.apply(i);
+ C c0 = intfunction.apply(i); // CraftBukkit - decompile error
for (int j = 0; j < i; ++j) {
2024-04-23 17:15:00 +02:00
c0.add(streamdecoder.decode(this));
@@ -150,7 +150,7 @@
2021-06-11 07:00:00 +02:00
2024-04-23 17:15:00 +02:00
public <T> void writeCollection(Collection<T> collection, StreamEncoder<? super PacketDataSerializer, T> streamencoder) {
2021-11-21 23:00:00 +01:00
this.writeVarInt(collection.size());
2021-06-11 07:00:00 +02:00
- Iterator iterator = collection.iterator();
+ Iterator<T> iterator = collection.iterator(); // CraftBukkit - decompile error
while (iterator.hasNext()) {
T t0 = iterator.next();
2024-04-23 17:15:00 +02:00
@@ -177,12 +177,12 @@
2021-06-11 07:00:00 +02:00
2021-11-21 23:00:00 +01:00
public void writeIntIdList(IntList intlist) {
this.writeVarInt(intlist.size());
- intlist.forEach(this::writeVarInt);
+ intlist.forEach((java.util.function.IntConsumer) this::writeVarInt); // CraftBukkit - decompile error
2021-06-11 07:00:00 +02:00
}
2024-04-23 17:15:00 +02:00
public <K, V, M extends Map<K, V>> M readMap(IntFunction<M> intfunction, StreamDecoder<? super PacketDataSerializer, K> streamdecoder, StreamDecoder<? super PacketDataSerializer, V> streamdecoder1) {
2021-11-21 23:00:00 +01:00
int i = this.readVarInt();
2021-06-11 07:00:00 +02:00
- M m0 = (Map) intfunction.apply(i);
+ M m0 = intfunction.apply(i); // CraftBukkit - decompile error
for (int j = 0; j < i; ++j) {
2024-04-23 17:15:00 +02:00
K k0 = streamdecoder.decode(this);
@@ -216,7 +216,7 @@
2022-12-07 17:00:00 +01:00
}
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) {
2024-04-23 17:15:00 +02:00
@@ -227,7 +227,7 @@
2022-12-07 17:00:00 +01:00
}
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);
2024-04-23 17:15:00 +02:00
@@ -482,7 +482,7 @@
2015-02-26 23:41:06 +01:00
}
2021-11-21 23:00:00 +01:00
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
2015-02-26 23:41:06 +01:00
}
2021-11-21 23:00:00 +01:00
public PacketDataSerializer writeEnum(Enum<?> oenum) {
2024-04-23 17:15:00 +02:00
@@ -549,7 +549,7 @@
2023-09-21 18:40:00 +02:00
try {
2024-04-23 17:15:00 +02:00
NBTCompressedStreamTools.writeAnyTag((NBTBase) nbtbase, new ByteBufOutputStream(bytebuf));
2023-09-21 18:40:00 +02:00
- } catch (IOException ioexception) {
+ } catch (Exception ioexception) { // CraftBukkit - IOException -> Exception
throw new EncoderException(ioexception);
2014-11-25 22:32:16 +01:00
}
2023-09-21 18:40:00 +02:00
}