Update to Minecraft 1.19.3

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2022-12-08 03:00:00 +11:00
parent a13136ada2
commit 8b26bb8f3e
305 changed files with 3331 additions and 2864 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/network/PacketDataSerializer.java
+++ b/net/minecraft/network/PacketDataSerializer.java
@@ -68,6 +68,8 @@
@@ -74,6 +74,8 @@
import net.minecraft.world.phys.MovingObjectPositionBlock;
import net.minecraft.world.phys.Vec3D;
@@ -9,7 +9,7 @@
public class PacketDataSerializer extends ByteBuf {
private static final int MAX_VARINT_SIZE = 5;
@@ -158,7 +160,7 @@
@@ -195,7 +197,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));
@@ -169,7 +171,7 @@
@@ -206,7 +208,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();
@@ -196,12 +198,12 @@
@@ -233,12 +235,12 @@
public void writeIntIdList(IntList intlist) {
this.writeVarInt(intlist.size());
@@ -42,7 +42,25 @@
for (int j = 0; j < i; ++j) {
K k0 = packetdataserializer_a.apply(this);
@@ -437,7 +439,7 @@
@@ -272,7 +274,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) {
@@ -283,7 +285,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);
@@ -499,7 +501,7 @@
}
public <T extends Enum<T>> T readEnum(Class<T> oclass) {
@@ -51,7 +69,7 @@
}
public PacketDataSerializer writeEnum(Enum<?> oenum) {
@@ -514,7 +516,7 @@
@@ -576,7 +578,7 @@
} else {
try {
NBTCompressedStreamTools.write(nbttagcompound, (DataOutput) (new ByteBufOutputStream(this)));
@@ -60,7 +78,7 @@
throw new EncoderException(ioexception);
}
}
@@ -551,7 +553,7 @@
@@ -613,7 +615,7 @@
}
public PacketDataSerializer writeItem(ItemStack itemstack) {
@@ -69,7 +87,7 @@
this.writeBoolean(false);
} else {
this.writeBoolean(true);
@@ -580,6 +582,11 @@
@@ -642,6 +644,11 @@
ItemStack itemstack = new ItemStack(item, b0);
itemstack.setTag(this.readNbt());

View File

@@ -15,16 +15,12 @@
+ public static final ResourceKey<ChatMessageType> RAW = create("raw"); // CraftBukkit
private static ResourceKey<ChatMessageType> create(String s) {
return ResourceKey.create(IRegistry.CHAT_TYPE_REGISTRY, new MinecraftKey(s));
@@ -39,7 +41,10 @@
RegistryGeneration.register(iregistry, ChatMessageType.MSG_COMMAND_OUTGOING, new ChatMessageType(ChatDecoration.outgoingDirectMessage("commands.message.display.outgoing"), ChatDecoration.withSender("chat.type.text.narrate")));
RegistryGeneration.register(iregistry, ChatMessageType.TEAM_MSG_COMMAND_INCOMING, new ChatMessageType(ChatDecoration.teamMessage("chat.type.team.text"), ChatDecoration.withSender("chat.type.text.narrate")));
RegistryGeneration.register(iregistry, ChatMessageType.TEAM_MSG_COMMAND_OUTGOING, new ChatMessageType(ChatDecoration.teamMessage("chat.type.team.sent"), ChatDecoration.withSender("chat.type.text.narrate")));
- return RegistryGeneration.register(iregistry, ChatMessageType.EMOTE_COMMAND, new ChatMessageType(ChatDecoration.withSender("chat.type.emote"), ChatDecoration.withSender("chat.type.emote")));
+ // CraftBukkit start
+ RegistryGeneration.register(iregistry, ChatMessageType.EMOTE_COMMAND, new ChatMessageType(ChatDecoration.withSender("chat.type.emote"), ChatDecoration.withSender("chat.type.emote")));
+ return RegistryGeneration.register(iregistry, ChatMessageType.RAW, new ChatMessageType(new ChatDecoration("%s", List.of(ChatDecoration.a.CONTENT), ChatModifier.EMPTY), new ChatDecoration("%s", List.of(ChatDecoration.a.CONTENT), ChatModifier.EMPTY)));
+ // CraftBukkit end
return ResourceKey.create(Registries.CHAT_TYPE, new MinecraftKey(s));
@@ -40,6 +42,7 @@
bootstapcontext.register(ChatMessageType.TEAM_MSG_COMMAND_INCOMING, new ChatMessageType(ChatDecoration.teamMessage("chat.type.team.text"), ChatDecoration.withSender("chat.type.text.narrate")));
bootstapcontext.register(ChatMessageType.TEAM_MSG_COMMAND_OUTGOING, new ChatMessageType(ChatDecoration.teamMessage("chat.type.team.sent"), ChatDecoration.withSender("chat.type.text.narrate")));
bootstapcontext.register(ChatMessageType.EMOTE_COMMAND, new ChatMessageType(ChatDecoration.withSender("chat.type.emote"), ChatDecoration.withSender("chat.type.emote")));
+ bootstapcontext.register(ChatMessageType.RAW, new ChatMessageType(new ChatDecoration("%s", List.of(ChatDecoration.a.CONTENT), ChatModifier.EMPTY), new ChatDecoration("%s", List.of(ChatDecoration.a.CONTENT), ChatModifier.EMPTY))); // CraftBukkit
}
public static ChatMessageType.a bind(ResourceKey<ChatMessageType> resourcekey, Entity entity) {

View File

@@ -1,6 +1,18 @@
--- a/net/minecraft/network/syncher/DataWatcher.java
+++ b/net/minecraft/network/syncher/DataWatcher.java
@@ -142,6 +142,13 @@
@@ -24,6 +24,11 @@
import org.apache.commons.lang3.ObjectUtils;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata;
+import net.minecraft.server.level.EntityPlayer;
+// CraftBukkit end
+
public class DataWatcher {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -138,6 +143,13 @@
}
@@ -14,12 +26,40 @@
public boolean isDirty() {
return this.isDirty;
}
@@ -274,7 +281,7 @@
if (!Objects.equals(datawatcher_item1.accessor.getSerializer(), datawatcher_item.accessor.getSerializer())) {
throw new IllegalStateException(String.format(Locale.ROOT, "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()));
@@ -218,7 +230,7 @@
if (!Objects.equals(datawatcher_b.serializer(), datawatcher_item.accessor.getSerializer())) {
throw new IllegalStateException(String.format(Locale.ROOT, "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_b.value, datawatcher_b.value.getClass()));
} else {
- datawatcher_item.setValue(datawatcher_item1.getValue());
+ datawatcher_item.setValue((T) datawatcher_item1.getValue()); // CraftBukkit - decompile error
- datawatcher_item.setValue(datawatcher_b.value);
+ datawatcher_item.setValue((T) datawatcher_b.value); // CraftBukkit - decompile error
}
}
@@ -226,6 +238,18 @@
return this.itemsById.isEmpty();
}
+ // CraftBukkit start
+ public void refresh(EntityPlayer to) {
+ if (!this.isEmpty()) {
+ List<DataWatcher.b<?>> list = this.getNonDefaultValues();
+
+ if (list != null) {
+ to.connection.send(new PacketPlayOutEntityMetadata(this.entity.getId(), list));
+ }
+ }
+ }
+ // CraftBukkit end
+
public static class Item<T> {
final DataWatcherObject<T> accessor;
@@ -268,7 +292,7 @@
}
}
- public static record b<T> (int id, DataWatcherSerializer<T> serializer, T value) {
+ public static record b<T>(int id, DataWatcherSerializer<T> serializer, T value) { // CraftBukkit - decompile error
public static <T> DataWatcher.b<T> create(DataWatcherObject<T> datawatcherobject, T t0) {
DataWatcherSerializer<T> datawatcherserializer = datawatcherobject.getSerializer();