@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/network/NetworkManager.java
|
||||
+++ b/net/minecraft/network/NetworkManager.java
|
||||
@@ -137,7 +137,7 @@
|
||||
@@ -156,7 +156,7 @@
|
||||
}
|
||||
|
||||
private static <T extends PacketListener> void a(Packet<T> packet, PacketListener packetlistener) {
|
||||
@@ -9,12 +9,12 @@
|
||||
}
|
||||
|
||||
public void setPacketListener(PacketListener packetlistener) {
|
||||
@@ -247,7 +247,7 @@
|
||||
@@ -268,7 +268,7 @@
|
||||
|
||||
public void close(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.
|
||||
this.m = ichatbasecomponent;
|
||||
this.disconnectedReason = ichatbasecomponent;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/network/PacketDataSerializer.java
|
||||
+++ b/net/minecraft/network/PacketDataSerializer.java
|
||||
@@ -39,6 +39,8 @@
|
||||
@@ -54,6 +54,8 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -8,17 +8,59 @@
|
||||
+
|
||||
public class PacketDataSerializer extends ByteBuf {
|
||||
|
||||
private final ByteBuf a;
|
||||
@@ -167,7 +169,7 @@
|
||||
private static final int MAX_VARINT_SIZE = 5;
|
||||
@@ -112,7 +114,7 @@
|
||||
|
||||
public <T, C extends Collection<T>> C a(IntFunction<C> intfunction, Function<PacketDataSerializer, T> function) {
|
||||
int i = this.j();
|
||||
- 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));
|
||||
@@ -123,7 +125,7 @@
|
||||
|
||||
public <T> void a(Collection<T> collection, BiConsumer<PacketDataSerializer, T> biconsumer) {
|
||||
this.d(collection.size());
|
||||
- Iterator iterator = collection.iterator();
|
||||
+ Iterator<T> iterator = collection.iterator(); // CraftBukkit - decompile error
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
T t0 = iterator.next();
|
||||
@@ -134,7 +136,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 IntList a() {
|
||||
@@ -150,12 +152,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 <K, V, M extends Map<K, V>> M a(IntFunction<M> intfunction, Function<PacketDataSerializer, K> function, Function<PacketDataSerializer, V> function1) {
|
||||
int i = this.j();
|
||||
- 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);
|
||||
@@ -330,7 +332,7 @@
|
||||
}
|
||||
|
||||
public <T extends Enum<T>> T a(Class<T> oclass) {
|
||||
- return ((Enum[]) oclass.getEnumConstants())[this.i()];
|
||||
+ return ((T[]) oclass.getEnumConstants())[this.i()]; // CraftBukkit - fix decompile error
|
||||
- return ((Enum[]) oclass.getEnumConstants())[this.j()];
|
||||
+ return ((T[]) oclass.getEnumConstants())[this.j()]; // CraftBukkit - fix decompile error
|
||||
}
|
||||
|
||||
public PacketDataSerializer a(Enum<?> oenum) {
|
||||
@@ -244,7 +246,7 @@
|
||||
@@ -407,7 +409,7 @@
|
||||
} else {
|
||||
try {
|
||||
NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) (new ByteBufOutputStream(this)));
|
||||
@@ -27,7 +69,7 @@
|
||||
throw new EncoderException(ioexception);
|
||||
}
|
||||
}
|
||||
@@ -281,7 +283,7 @@
|
||||
@@ -444,7 +446,7 @@
|
||||
}
|
||||
|
||||
public PacketDataSerializer a(ItemStack itemstack) {
|
||||
@@ -36,10 +78,10 @@
|
||||
this.writeBoolean(false);
|
||||
} else {
|
||||
this.writeBoolean(true);
|
||||
@@ -310,6 +312,11 @@
|
||||
@@ -473,6 +475,11 @@
|
||||
ItemStack itemstack = new ItemStack(Item.getById(i), b0);
|
||||
|
||||
itemstack.setTag(this.l());
|
||||
itemstack.setTag(this.m());
|
||||
+ // CraftBukkit start
|
||||
+ if (itemstack.getTag() != null) {
|
||||
+ CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack));
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
--- a/net/minecraft/network/chat/ChatHexColor.java
|
||||
+++ b/net/minecraft/network/chat/ChatHexColor.java
|
||||
@@ -11,7 +11,7 @@
|
||||
public final class ChatHexColor {
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
private static final Map<EnumChatFormat, ChatHexColor> a = (Map) Stream.of(EnumChatFormat.values()).filter(EnumChatFormat::d).collect(ImmutableMap.toImmutableMap(Function.identity(), (enumchatformat) -> {
|
||||
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<String, ChatHexColor> b = (Map) ChatHexColor.a.values().stream().collect(ImmutableMap.toImmutableMap((chathexcolor) -> {
|
||||
private static final Map<String, ChatHexColor> NAMED_COLORS = (Map) ChatHexColor.LEGACY_FORMAT_TO_COLOR.values().stream().collect(ImmutableMap.toImmutableMap((chathexcolor) -> {
|
||||
return chathexcolor.name;
|
||||
@@ -19,16 +19,22 @@
|
||||
private final int rgb;
|
||||
@@ -20,16 +20,22 @@
|
||||
private final int value;
|
||||
@Nullable
|
||||
public final String name;
|
||||
+ // CraftBukkit start
|
||||
@@ -19,17 +19,17 @@
|
||||
|
||||
- private ChatHexColor(int i, String s) {
|
||||
+ private ChatHexColor(int i, String s, EnumChatFormat format) {
|
||||
this.rgb = i;
|
||||
this.value = i;
|
||||
this.name = s;
|
||||
+ this.format = format;
|
||||
}
|
||||
|
||||
private ChatHexColor(int i) {
|
||||
this.rgb = i;
|
||||
this.value = i;
|
||||
this.name = null;
|
||||
+ this.format = null;
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
public String b() {
|
||||
return this.name != null ? this.name : this.c();
|
||||
public int a() {
|
||||
return this.value;
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
--- a/net/minecraft/network/chat/ChatModifier.java
|
||||
+++ b/net/minecraft/network/chat/ChatModifier.java
|
||||
@@ -118,6 +118,20 @@
|
||||
return new ChatModifier(this.color, this.bold, obool, this.underlined, this.strikethrough, this.obfuscated, this.clickEvent, this.hoverEvent, this.insertion, this.font);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public ChatModifier setStrikethrough(@Nullable Boolean obool) {
|
||||
+ return new ChatModifier(this.color, this.bold, this.italic, this.underlined, obool, this.obfuscated, this.clickEvent, this.hoverEvent, this.insertion, this.font);
|
||||
+ }
|
||||
+
|
||||
+ public ChatModifier setUnderline(@Nullable Boolean obool) {
|
||||
+ return new ChatModifier(this.color, this.bold, this.italic, obool, this.strikethrough, this.obfuscated, this.clickEvent, this.hoverEvent, this.insertion, this.font);
|
||||
+ }
|
||||
+
|
||||
+ public ChatModifier setRandom(@Nullable Boolean obool) {
|
||||
+ return new ChatModifier(this.color, this.bold, this.italic, this.underlined, this.strikethrough, obool, this.clickEvent, this.hoverEvent, this.insertion, this.font);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public ChatModifier setChatClickable(@Nullable ChatClickable chatclickable) {
|
||||
return new ChatModifier(this.color, this.bold, this.italic, this.underlined, this.strikethrough, this.obfuscated, chatclickable, this.hoverEvent, this.insertion, this.font);
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/network/chat/IChatBaseComponent.java
|
||||
+++ b/net/minecraft/network/chat/IChatBaseComponent.java
|
||||
@@ -27,7 +27,23 @@
|
||||
import net.minecraft.util.ChatDeserializer;
|
||||
@@ -29,7 +29,23 @@
|
||||
import net.minecraft.util.ChatTypeAdapterFactory;
|
||||
import net.minecraft.util.FormattedString;
|
||||
|
||||
-public interface IChatBaseComponent extends Message, IChatFormatted {
|
||||
+// CraftBukkit start
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
public class PlayerConnectionUtils {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -18,6 +23,7 @@
|
||||
@@ -20,6 +25,7 @@
|
||||
public static <T extends PacketListener> void ensureMainThread(Packet<T> packet, T t0, IAsyncTaskHandler<?> iasynctaskhandler) throws CancelledPacketHandleException {
|
||||
if (!iasynctaskhandler.isMainThread()) {
|
||||
iasynctaskhandler.execute(() -> {
|
||||
@@ -20,13 +20,13 @@
|
||||
if (t0.a().isConnected()) {
|
||||
packet.a(t0);
|
||||
} else {
|
||||
@@ -26,6 +32,10 @@
|
||||
@@ -28,6 +34,10 @@
|
||||
|
||||
});
|
||||
throw CancelledPacketHandleException.INSTANCE;
|
||||
throw CancelledPacketHandleException.RUNNING_ON_DIFFERENT_THREAD;
|
||||
+ // CraftBukkit start - SPIGOT-5477, MC-142590
|
||||
+ } else if (MinecraftServer.getServer().hasStopped() || (t0 instanceof PlayerConnection && ((PlayerConnection) t0).processedDisconnect)) {
|
||||
+ throw CancelledPacketHandleException.INSTANCE;
|
||||
+ throw CancelledPacketHandleException.RUNNING_ON_DIFFERENT_THREAD;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
--- a/net/minecraft/network/protocol/game/ClientboundInitializeBorderPacket.java
|
||||
+++ b/net/minecraft/network/protocol/game/ClientboundInitializeBorderPacket.java
|
||||
@@ -27,8 +27,10 @@
|
||||
}
|
||||
|
||||
public ClientboundInitializeBorderPacket(WorldBorder worldborder) {
|
||||
- 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();
|
||||
+ // CraftBukkit end
|
||||
this.oldSize = worldborder.getSize();
|
||||
this.newSize = worldborder.k();
|
||||
this.lerpTime = worldborder.j();
|
||||
@@ -0,0 +1,15 @@
|
||||
--- a/net/minecraft/network/protocol/game/ClientboundSetBorderCenterPacket.java
|
||||
+++ b/net/minecraft/network/protocol/game/ClientboundSetBorderCenterPacket.java
|
||||
@@ -10,8 +10,10 @@
|
||||
private final double newCenterZ;
|
||||
|
||||
public ClientboundSetBorderCenterPacket(WorldBorder worldborder) {
|
||||
- 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();
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public ClientboundSetBorderCenterPacket(PacketDataSerializer packetdataserializer) {
|
||||
@@ -4,4 +4,4 @@
|
||||
+// mc-dev import
|
||||
package net.minecraft.network.protocol.game;
|
||||
|
||||
import java.io.IOException;
|
||||
import net.minecraft.network.PacketDataSerializer;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/network/protocol/game/PacketPlayInChat.java
|
||||
+++ b/net/minecraft/network/protocol/game/PacketPlayInChat.java
|
||||
@@ -20,7 +20,7 @@
|
||||
@@ -17,7 +17,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(PacketDataSerializer packetdataserializer) throws IOException {
|
||||
- this.a = packetdataserializer.e(256);
|
||||
+ this.a = org.apache.commons.lang3.StringUtils.normalizeSpace(packetdataserializer.e(256)); // CraftBukkit - see PlayerConnection
|
||||
public PacketPlayInChat(PacketDataSerializer packetdataserializer) {
|
||||
- this.message = packetdataserializer.e(256);
|
||||
+ this.message = org.apache.commons.lang3.StringUtils.normalizeSpace(packetdataserializer.e(256)); // CraftBukkit - see PlayerConnection
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
--- a/net/minecraft/network/protocol/game/PacketPlayInCloseWindow.java
|
||||
+++ b/net/minecraft/network/protocol/game/PacketPlayInCloseWindow.java
|
||||
@@ -10,6 +10,12 @@
|
||||
|
||||
public PacketPlayInCloseWindow() {}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public PacketPlayInCloseWindow(int id) {
|
||||
+ this.id = id;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public void a(PacketListenerPlayIn packetlistenerplayin) {
|
||||
packetlistenerplayin.a(this);
|
||||
}
|
||||
@@ -4,4 +4,4 @@
|
||||
+// mc-dev import
|
||||
package net.minecraft.network.protocol.game;
|
||||
|
||||
import java.io.IOException;
|
||||
import net.minecraft.network.PacketDataSerializer;
|
||||
|
||||
@@ -4,4 +4,4 @@
|
||||
+// mc-dev import
|
||||
package net.minecraft.network.protocol.game;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/network/protocol/game/PacketPlayOutMultiBlockChange.java
|
||||
+++ b/net/minecraft/network/protocol/game/PacketPlayOutMultiBlockChange.java
|
||||
@@ -31,7 +31,7 @@
|
||||
@@ -32,7 +32,7 @@
|
||||
short short0 = (Short) shortiterator.next();
|
||||
|
||||
this.b[i] = short0;
|
||||
- this.c[i] = chunksection.getType(SectionPosition.a(short0), SectionPosition.b(short0), SectionPosition.c(short0));
|
||||
+ this.c[i] = (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.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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
--- a/net/minecraft/network/protocol/game/PacketPlayOutWorldBorder.java
|
||||
+++ b/net/minecraft/network/protocol/game/PacketPlayOutWorldBorder.java
|
||||
@@ -21,8 +21,10 @@
|
||||
|
||||
public PacketPlayOutWorldBorder(WorldBorder worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction packetplayoutworldborder_enumworldborderaction) {
|
||||
this.a = packetplayoutworldborder_enumworldborderaction;
|
||||
- this.c = worldborder.getCenterX();
|
||||
- this.d = worldborder.getCenterZ();
|
||||
+ // CraftBukkit start - multiply out nether border
|
||||
+ this.c = worldborder.getCenterX() * worldborder.world.getDimensionManager().getCoordinateScale();
|
||||
+ this.d = worldborder.getCenterZ() * worldborder.world.getDimensionManager().getCoordinateScale();
|
||||
+ // CraftBukkit end
|
||||
this.f = worldborder.getSize();
|
||||
this.e = worldborder.k();
|
||||
this.g = worldborder.j();
|
||||
@@ -4,4 +4,4 @@
|
||||
+// mc-dev import
|
||||
package net.minecraft.network.protocol.handshake;
|
||||
|
||||
import java.io.IOException;
|
||||
import net.minecraft.SharedConstants;
|
||||
|
||||
@@ -1,16 +1,25 @@
|
||||
--- a/net/minecraft/network/syncher/DataWatcher.java
|
||||
+++ b/net/minecraft/network/syncher/DataWatcher.java
|
||||
@@ -134,6 +134,13 @@
|
||||
@@ -141,6 +141,13 @@
|
||||
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - add method from above
|
||||
+ public <T> void markDirty(DataWatcherObject<T> datawatcherobject) {
|
||||
+ this.b(datawatcherobject).a(true);
|
||||
+ this.g = true;
|
||||
+ this.isDirty = true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public boolean a() {
|
||||
return this.g;
|
||||
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()));
|
||||
} else {
|
||||
- datawatcher_item.a(datawatcher_item1.b());
|
||||
+ datawatcher_item.a((T) datawatcher_item1.b()); // CraftBukkit - decompile error
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user