@@ -3,15 +3,15 @@
|
||||
@@ -156,7 +156,7 @@
|
||||
}
|
||||
|
||||
private static <T extends PacketListener> void a(Packet<T> packet, PacketListener packetlistener) {
|
||||
- packet.a(packetlistener);
|
||||
+ packet.a((T) packetlistener); // CraftBukkit - decompile error
|
||||
private static <T extends PacketListener> void genericsFtw(Packet<T> packet, PacketListener packetlistener) {
|
||||
- packet.handle(packetlistener);
|
||||
+ packet.handle((T) packetlistener); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public void setPacketListener(PacketListener packetlistener) {
|
||||
public void setListener(PacketListener packetlistener) {
|
||||
@@ -268,7 +268,7 @@
|
||||
|
||||
public void close(IChatBaseComponent ichatbasecomponent) {
|
||||
public void disconnect(IChatBaseComponent ichatbasecomponent) {
|
||||
if (this.channel.isOpen()) {
|
||||
- this.channel.close().awaitUninterruptibly();
|
||||
+ this.channel.close(); // We can't wait as this may be called from an event loop.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/network/PacketDataSerializer.java
|
||||
+++ b/net/minecraft/network/PacketDataSerializer.java
|
||||
@@ -55,6 +55,8 @@
|
||||
@@ -54,6 +54,8 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -9,79 +9,79 @@
|
||||
public class PacketDataSerializer extends ByteBuf {
|
||||
|
||||
private static final int MAX_VARINT_SIZE = 5;
|
||||
@@ -123,7 +125,7 @@
|
||||
@@ -122,7 +124,7 @@
|
||||
|
||||
public <T, C extends Collection<T>> C a(IntFunction<C> intfunction, Function<PacketDataSerializer, T> function) {
|
||||
int i = this.j();
|
||||
public <T, C extends Collection<T>> C readCollection(IntFunction<C> intfunction, Function<PacketDataSerializer, T> function) {
|
||||
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(function.apply(this));
|
||||
@@ -134,7 +136,7 @@
|
||||
@@ -133,7 +135,7 @@
|
||||
|
||||
public <T> void a(Collection<T> collection, BiConsumer<PacketDataSerializer, T> biconsumer) {
|
||||
this.d(collection.size());
|
||||
public <T> void writeCollection(Collection<T> collection, BiConsumer<PacketDataSerializer, T> biconsumer) {
|
||||
this.writeVarInt(collection.size());
|
||||
- Iterator iterator = collection.iterator();
|
||||
+ Iterator<T> iterator = collection.iterator(); // CraftBukkit - decompile error
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
T t0 = iterator.next();
|
||||
@@ -145,7 +147,7 @@
|
||||
@@ -144,7 +146,7 @@
|
||||
}
|
||||
|
||||
public <T> List<T> a(Function<PacketDataSerializer, T> function) {
|
||||
- return (List) this.a(Lists::newArrayListWithCapacity, function);
|
||||
+ return (List) this.a((java.util.function.IntFunction) Lists::newArrayListWithCapacity, function); // CraftBukkit - decompile error
|
||||
public <T> List<T> readList(Function<PacketDataSerializer, T> function) {
|
||||
- return (List) this.readCollection(Lists::newArrayListWithCapacity, function);
|
||||
+ return (List) this.readCollection((java.util.function.IntFunction) Lists::newArrayListWithCapacity, function); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public IntList a() {
|
||||
@@ -161,12 +163,12 @@
|
||||
public IntList readIntIdList() {
|
||||
@@ -160,12 +162,12 @@
|
||||
|
||||
public void a(IntList intlist) {
|
||||
this.d(intlist.size());
|
||||
- intlist.forEach(this::d);
|
||||
+ intlist.forEach((java.util.function.IntConsumer) this::d); // CraftBukkit - decompile error
|
||||
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 a(IntFunction<M> intfunction, Function<PacketDataSerializer, K> function, Function<PacketDataSerializer, V> function1) {
|
||||
int i = this.j();
|
||||
public <K, V, M extends Map<K, V>> M readMap(IntFunction<M> intfunction, Function<PacketDataSerializer, K> function, Function<PacketDataSerializer, V> function1) {
|
||||
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 = function.apply(this);
|
||||
@@ -355,7 +357,7 @@
|
||||
@@ -354,7 +356,7 @@
|
||||
}
|
||||
|
||||
public <T extends Enum<T>> T a(Class<T> oclass) {
|
||||
- return ((Enum[]) oclass.getEnumConstants())[this.j()];
|
||||
+ return ((T[]) oclass.getEnumConstants())[this.j()]; // CraftBukkit - fix decompile error
|
||||
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 a(Enum<?> oenum) {
|
||||
@@ -432,7 +434,7 @@
|
||||
public PacketDataSerializer writeEnum(Enum<?> oenum) {
|
||||
@@ -431,7 +433,7 @@
|
||||
} else {
|
||||
try {
|
||||
NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) (new ByteBufOutputStream(this)));
|
||||
NBTCompressedStreamTools.write(nbttagcompound, (DataOutput) (new ByteBufOutputStream(this)));
|
||||
- } catch (IOException ioexception) {
|
||||
+ } catch (Exception ioexception) { // CraftBukkit - IOException -> Exception
|
||||
throw new EncoderException(ioexception);
|
||||
}
|
||||
}
|
||||
@@ -469,7 +471,7 @@
|
||||
@@ -468,7 +470,7 @@
|
||||
}
|
||||
|
||||
public PacketDataSerializer a(ItemStack itemstack) {
|
||||
public PacketDataSerializer writeItem(ItemStack itemstack) {
|
||||
- if (itemstack.isEmpty()) {
|
||||
+ if (itemstack.isEmpty() || itemstack.getItem() == null) { // CraftBukkit - NPE fix itemstack.getItem()
|
||||
this.writeBoolean(false);
|
||||
} else {
|
||||
this.writeBoolean(true);
|
||||
@@ -498,6 +500,11 @@
|
||||
ItemStack itemstack = new ItemStack(Item.getById(i), b0);
|
||||
@@ -497,6 +499,11 @@
|
||||
ItemStack itemstack = new ItemStack(Item.byId(i), b0);
|
||||
|
||||
itemstack.setTag(this.m());
|
||||
itemstack.setTag(this.readNbt());
|
||||
+ // CraftBukkit start
|
||||
+ if (itemstack.getTag() != null) {
|
||||
+ CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack));
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
private static final String CUSTOM_COLOR_PREFIX = "#";
|
||||
private static final Map<EnumChatFormat, ChatHexColor> LEGACY_FORMAT_TO_COLOR = (Map) Stream.of(EnumChatFormat.values()).filter(EnumChatFormat::d).collect(ImmutableMap.toImmutableMap(Function.identity(), (enumchatformat) -> {
|
||||
- return new ChatHexColor(enumchatformat.e(), enumchatformat.f());
|
||||
+ return new ChatHexColor(enumchatformat.e(), enumchatformat.f(), enumchatformat); // CraftBukkit
|
||||
private static final Map<EnumChatFormat, ChatHexColor> LEGACY_FORMAT_TO_COLOR = (Map) Stream.of(EnumChatFormat.values()).filter(EnumChatFormat::isColor).collect(ImmutableMap.toImmutableMap(Function.identity(), (enumchatformat) -> {
|
||||
- return new ChatHexColor(enumchatformat.getColor(), enumchatformat.getName());
|
||||
+ return new ChatHexColor(enumchatformat.getColor(), enumchatformat.getName(), enumchatformat); // CraftBukkit
|
||||
}));
|
||||
private static final Map<String, ChatHexColor> NAMED_COLORS = (Map) ChatHexColor.LEGACY_FORMAT_TO_COLOR.values().stream().collect(ImmutableMap.toImmutableMap((chathexcolor) -> {
|
||||
return chathexcolor.name;
|
||||
@@ -31,5 +31,5 @@
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
public int a() {
|
||||
public int getValue() {
|
||||
return this.value;
|
||||
|
||||
@@ -23,5 +23,5 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
ChatModifier getChatModifier();
|
||||
ChatModifier getStyle();
|
||||
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -20,6 +25,7 @@
|
||||
public static <T extends PacketListener> void ensureMainThread(Packet<T> packet, T t0, IAsyncTaskHandler<?> iasynctaskhandler) throws CancelledPacketHandleException {
|
||||
if (!iasynctaskhandler.isMainThread()) {
|
||||
public static <T extends PacketListener> void ensureRunningOnSameThread(Packet<T> packet, T t0, IAsyncTaskHandler<?> iasynctaskhandler) throws CancelledPacketHandleException {
|
||||
if (!iasynctaskhandler.isSameThread()) {
|
||||
iasynctaskhandler.execute(() -> {
|
||||
+ if (MinecraftServer.getServer().hasStopped() || (t0 instanceof PlayerConnection && ((PlayerConnection) t0).processedDisconnect)) return; // CraftBukkit, MC-142590
|
||||
if (t0.a().isConnected()) {
|
||||
packet.a(t0);
|
||||
if (t0.getConnection().isConnected()) {
|
||||
packet.handle(t0);
|
||||
} else {
|
||||
@@ -28,6 +34,10 @@
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
- this.newCenterX = worldborder.getCenterX();
|
||||
- this.newCenterZ = worldborder.getCenterZ();
|
||||
+ // CraftBukkit start - multiply out nether border
|
||||
+ this.newCenterX = worldborder.getCenterX() * worldborder.world.getDimensionManager().getCoordinateScale();
|
||||
+ this.newCenterZ = worldborder.getCenterZ() * worldborder.world.getDimensionManager().getCoordinateScale();
|
||||
+ this.newCenterX = worldborder.getCenterX() * worldborder.world.dimensionType().coordinateScale();
|
||||
+ this.newCenterZ = worldborder.getCenterZ() * worldborder.world.dimensionType().coordinateScale();
|
||||
+ // CraftBukkit end
|
||||
this.oldSize = worldborder.getSize();
|
||||
this.newSize = worldborder.k();
|
||||
this.lerpTime = worldborder.j();
|
||||
this.newSize = worldborder.getLerpTarget();
|
||||
this.lerpTime = worldborder.getLerpRemainingTime();
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
- this.newCenterX = worldborder.getCenterX();
|
||||
- this.newCenterZ = worldborder.getCenterZ();
|
||||
+ // CraftBukkit start - multiply out nether border
|
||||
+ this.newCenterX = worldborder.getCenterX() * worldborder.world.getDimensionManager().getCoordinateScale();
|
||||
+ this.newCenterZ = worldborder.getCenterZ() * worldborder.world.getDimensionManager().getCoordinateScale();
|
||||
+ this.newCenterX = worldborder.getCenterX() * worldborder.world.dimensionType().coordinateScale();
|
||||
+ this.newCenterZ = worldborder.getCenterZ() * worldborder.world.dimensionType().coordinateScale();
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
}
|
||||
|
||||
public PacketPlayInChat(PacketDataSerializer packetdataserializer) {
|
||||
- this.message = packetdataserializer.e(256);
|
||||
+ this.message = org.apache.commons.lang3.StringUtils.normalizeSpace(packetdataserializer.e(256)); // CraftBukkit - see PlayerConnection
|
||||
- this.message = packetdataserializer.readUtf(256);
|
||||
+ this.message = org.apache.commons.lang3.StringUtils.normalizeSpace(packetdataserializer.readUtf(256)); // CraftBukkit - see PlayerConnection
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
short short0 = (Short) shortiterator.next();
|
||||
|
||||
this.positions[j] = short0;
|
||||
- this.states[j] = chunksection.getType(SectionPosition.a(short0), SectionPosition.b(short0), SectionPosition.c(short0));
|
||||
+ this.states[j] = (chunksection != null) ? chunksection.getType(SectionPosition.a(short0), SectionPosition.b(short0), SectionPosition.c(short0)) : net.minecraft.world.level.block.Blocks.AIR.getBlockData(); // CraftBukkit - SPIGOT-6076, Mojang bug when empty chunk section notified
|
||||
- this.states[j] = chunksection.getBlockState(SectionPosition.sectionRelativeX(short0), SectionPosition.sectionRelativeY(short0), SectionPosition.sectionRelativeZ(short0));
|
||||
+ this.states[j] = (chunksection != null) ? chunksection.getBlockState(SectionPosition.sectionRelativeX(short0), SectionPosition.sectionRelativeY(short0), SectionPosition.sectionRelativeZ(short0)) : net.minecraft.world.level.block.Blocks.AIR.defaultBlockState(); // CraftBukkit - SPIGOT-6076, Mojang bug when empty chunk section notified
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,20 +6,20 @@
|
||||
|
||||
+ // CraftBukkit start - add method from above
|
||||
+ public <T> void markDirty(DataWatcherObject<T> datawatcherobject) {
|
||||
+ this.b(datawatcherobject).a(true);
|
||||
+ this.getItem(datawatcherobject).setDirty(true);
|
||||
+ this.isDirty = true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public boolean a() {
|
||||
public boolean isDirty() {
|
||||
return this.isDirty;
|
||||
}
|
||||
@@ -273,7 +280,7 @@
|
||||
if (!Objects.equals(datawatcher_item1.accessor.b(), datawatcher_item.accessor.b())) {
|
||||
throw new IllegalStateException(String.format("Invalid entity data item type for field %d on entity %s: old=%s(%s), new=%s(%s)", datawatcher_item.accessor.a(), this.entity, datawatcher_item.value, datawatcher_item.value.getClass(), datawatcher_item1.value, datawatcher_item1.value.getClass()));
|
||||
if (!Objects.equals(datawatcher_item1.accessor.getSerializer(), datawatcher_item.accessor.getSerializer())) {
|
||||
throw new IllegalStateException(String.format("Invalid entity data item type for field %d on entity %s: old=%s(%s), new=%s(%s)", datawatcher_item.accessor.getId(), this.entity, datawatcher_item.value, datawatcher_item.value.getClass(), datawatcher_item1.value, datawatcher_item1.value.getClass()));
|
||||
} else {
|
||||
- datawatcher_item.a(datawatcher_item1.b());
|
||||
+ datawatcher_item.a((T) datawatcher_item1.b()); // CraftBukkit - decompile error
|
||||
- datawatcher_item.setValue(datawatcher_item1.getValue());
|
||||
+ datawatcher_item.setValue((T) datawatcher_item1.getValue()); // CraftBukkit - decompile error
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user