@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/network/PacketDataSerializer.java
|
||||
+++ b/net/minecraft/network/PacketDataSerializer.java
|
||||
@@ -80,6 +80,8 @@
|
||||
@@ -81,6 +81,8 @@
|
||||
import org.joml.Quaternionf;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
public class PacketDataSerializer extends ByteBuf {
|
||||
|
||||
public static final int DEFAULT_NBT_QUOTA = 2097152;
|
||||
@@ -204,7 +206,7 @@
|
||||
@@ -205,7 +207,7 @@
|
||||
|
||||
public <T, C extends Collection<T>> C readCollection(IntFunction<C> intfunction, PacketDataSerializer.a<T> packetdataserializer_a) {
|
||||
int i = this.readVarInt();
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
c0.add(packetdataserializer_a.apply(this));
|
||||
@@ -215,7 +217,7 @@
|
||||
@@ -216,7 +218,7 @@
|
||||
|
||||
public <T> void writeCollection(Collection<T> collection, PacketDataSerializer.b<T> packetdataserializer_b) {
|
||||
this.writeVarInt(collection.size());
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
T t0 = iterator.next();
|
||||
@@ -242,12 +244,12 @@
|
||||
@@ -243,12 +245,12 @@
|
||||
|
||||
public void writeIntIdList(IntList intlist) {
|
||||
this.writeVarInt(intlist.size());
|
||||
@@ -42,7 +42,7 @@
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
K k0 = packetdataserializer_a.apply(this);
|
||||
@@ -281,7 +283,7 @@
|
||||
@@ -282,7 +284,7 @@
|
||||
}
|
||||
|
||||
public <E extends Enum<E>> void writeEnumSet(EnumSet<E> enumset, Class<E> oclass) {
|
||||
@@ -51,7 +51,7 @@
|
||||
BitSet bitset = new BitSet(ae.length);
|
||||
|
||||
for (int i = 0; i < ae.length; ++i) {
|
||||
@@ -292,7 +294,7 @@
|
||||
@@ -293,7 +295,7 @@
|
||||
}
|
||||
|
||||
public <E extends Enum<E>> EnumSet<E> readEnumSet(Class<E> oclass) {
|
||||
@@ -60,7 +60,7 @@
|
||||
BitSet bitset = this.readFixedBitSet(ae.length);
|
||||
EnumSet<E> enumset = EnumSet.noneOf(oclass);
|
||||
|
||||
@@ -530,7 +532,7 @@
|
||||
@@ -529,7 +531,7 @@
|
||||
}
|
||||
|
||||
public <T extends Enum<T>> T readEnum(Class<T> oclass) {
|
||||
@@ -69,7 +69,7 @@
|
||||
}
|
||||
|
||||
public PacketDataSerializer writeEnum(Enum<?> oenum) {
|
||||
@@ -585,7 +587,7 @@
|
||||
@@ -584,7 +586,7 @@
|
||||
try {
|
||||
NBTCompressedStreamTools.writeAnyTag((NBTBase) nbtbase, new ByteBufOutputStream(this));
|
||||
return this;
|
||||
@@ -78,7 +78,7 @@
|
||||
throw new EncoderException(ioexception);
|
||||
}
|
||||
}
|
||||
@@ -613,7 +615,7 @@
|
||||
@@ -612,7 +614,7 @@
|
||||
}
|
||||
|
||||
public PacketDataSerializer writeItem(ItemStack itemstack) {
|
||||
@@ -87,7 +87,7 @@
|
||||
this.writeBoolean(false);
|
||||
} else {
|
||||
this.writeBoolean(true);
|
||||
@@ -642,6 +644,11 @@
|
||||
@@ -641,6 +643,11 @@
|
||||
ItemStack itemstack = new ItemStack(item, b0);
|
||||
|
||||
itemstack.setTag(this.readNbt());
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
--- a/net/minecraft/network/chat/ChatHexColor.java
|
||||
+++ b/net/minecraft/network/chat/ChatHexColor.java
|
||||
@@ -22,7 +22,7 @@
|
||||
});
|
||||
}, ChatHexColor::serialize);
|
||||
@@ -17,7 +17,7 @@
|
||||
private static final String CUSTOM_COLOR_PREFIX = "#";
|
||||
public static final Codec<ChatHexColor> CODEC = Codec.STRING.comapFlatMap(ChatHexColor::parseColor, ChatHexColor::serialize);
|
||||
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;
|
||||
@@ -30,16 +30,22 @@
|
||||
@@ -25,16 +25,22 @@
|
||||
private final int value;
|
||||
@Nullable
|
||||
public final String name;
|
||||
@@ -19,13 +19,13 @@
|
||||
|
||||
- private ChatHexColor(int i, String s) {
|
||||
+ private ChatHexColor(int i, String s, EnumChatFormat format) {
|
||||
this.value = i;
|
||||
this.value = i & 16777215;
|
||||
this.name = s;
|
||||
+ this.format = format;
|
||||
}
|
||||
|
||||
private ChatHexColor(int i) {
|
||||
this.value = i;
|
||||
this.value = i & 16777215;
|
||||
this.name = null;
|
||||
+ this.format = null;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
--- a/net/minecraft/network/chat/IChatBaseComponent.java
|
||||
+++ b/net/minecraft/network/chat/IChatBaseComponent.java
|
||||
@@ -41,7 +41,23 @@
|
||||
import net.minecraft.util.ChatTypeAdapterFactory;
|
||||
@@ -35,7 +35,22 @@
|
||||
import net.minecraft.util.FormattedString;
|
||||
import net.minecraft.world.level.ChunkCoordIntPair;
|
||||
|
||||
-public interface IChatBaseComponent extends Message, IChatFormatted {
|
||||
+// CraftBukkit start
|
||||
+import com.google.common.collect.Streams;
|
||||
+import java.util.stream.Stream;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
@@ -14,7 +13,7 @@
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ default Stream<IChatBaseComponent> stream() {
|
||||
+ return Streams.concat(new Stream[]{Stream.of(this), this.getSiblings().stream().flatMap(IChatBaseComponent::stream)});
|
||||
+ return com.google.common.collect.Streams.concat(new Stream[]{Stream.of(this), this.getSiblings().stream().flatMap(IChatBaseComponent::stream)});
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/network/protocol/PlayerConnectionUtils.java
|
||||
+++ b/net/minecraft/network/protocol/PlayerConnectionUtils.java
|
||||
@@ -8,6 +8,11 @@
|
||||
@@ -9,6 +9,11 @@
|
||||
import net.minecraft.util.thread.IAsyncTaskHandler;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
public class PlayerConnectionUtils {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -21,6 +26,7 @@
|
||||
@@ -22,6 +27,7 @@
|
||||
public static <T extends PacketListener> void ensureRunningOnSameThread(Packet<T> packet, T t0, IAsyncTaskHandler<?> iasynctaskhandler) throws CancelledPacketHandleException {
|
||||
if (!iasynctaskhandler.isSameThread()) {
|
||||
iasynctaskhandler.executeIfPossible(() -> {
|
||||
@@ -20,7 +20,7 @@
|
||||
if (t0.shouldHandleMessage(packet)) {
|
||||
try {
|
||||
packet.handle(t0);
|
||||
@@ -46,6 +52,10 @@
|
||||
@@ -60,6 +66,10 @@
|
||||
|
||||
});
|
||||
throw CancelledPacketHandleException.RUNNING_ON_DIFFERENT_THREAD;
|
||||
|
||||
Reference in New Issue
Block a user