Misc. 1.19 fixes (#7881)

This commit is contained in:
Noah van der Aa 2022-06-08 10:45:59 +02:00 committed by GitHub
parent cc7979a6e0
commit b464e02ba4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 51 additions and 67 deletions

View File

@ -4279,7 +4279,7 @@ index 0db7fe1b9fe5621ceed3f4f046691e359f5949dd..47b10df619ad2520b9bb673e2220f363
/**
diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java
index c6a8a37a933cfc5a5885602a8a70fdda8fb6aa10..7f57b95727d0336f1f1548055574e0c129fe9643 100644
index c6a8a37a933cfc5a5885602a8a70fdda8fb6aa10..93498307004b68b934fbfa1aeb3aaf0e97cbdac7 100644
--- a/src/test/java/org/bukkit/AnnotationTest.java
+++ b/src/test/java/org/bukkit/AnnotationTest.java
@@ -26,6 +26,12 @@ import org.objectweb.asm.tree.ParameterNode;
@ -4300,7 +4300,7 @@ index c6a8a37a933cfc5a5885602a8a70fdda8fb6aa10..7f57b95727d0336f1f1548055574e0c1
for (final org.objectweb.asm.tree.TypeAnnotationNode invisibleTypeAnnotation : method.invisibleTypeAnnotations) {
final org.objectweb.asm.TypeReference ref = new org.objectweb.asm.TypeReference(invisibleTypeAnnotation.typeRef);
- if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_FORMAL_PARAMETER && ref.getTypeParameterIndex() == i && java.util.Arrays.binarySearch(ACCEPTED_ANNOTATIONS, invisibleTypeAnnotation.desc) >= 0) {
+ if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_FORMAL_PARAMETER && ref.getTypeParameterIndex() == i && org.apache.commons.lang.ArrayUtils.contains(ACCEPTED_ANNOTATIONS, invisibleTypeAnnotation.desc)) {
+ if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_FORMAL_PARAMETER && ref.getTypeParameterIndex() == i && java.util.Arrays.asList(ACCEPTED_ANNOTATIONS).contains(invisibleTypeAnnotation.desc)) {
continue dancing;
}
}

View File

@ -2044,7 +2044,7 @@ index 9d55f36f146435f0cfb4e62ffa7c94eab404a596..c186a44b927188ed222f8b2f8f76aaef
public String getCustomName() {
BeaconBlockEntity beacon = this.getSnapshot();
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java
index 02fc6b189541fdedd0acef6700722eb7e53346c4..5df1e8c7277759bda57253db449907eb1185cce3 100644
index 02fc6b189541fdedd0acef6700722eb7e53346c4..c4ea6760f489e6171f9e6e170160b932597f842f 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java
@@ -30,4 +30,16 @@ public class CraftCommandBlock extends CraftBlockEntityState<CommandBlockEntity>
@ -2060,7 +2060,7 @@ index 02fc6b189541fdedd0acef6700722eb7e53346c4..5df1e8c7277759bda57253db449907eb
+
+ @Override
+ public void name(net.kyori.adventure.text.Component name) {
+ getSnapshot().getCommandBlock().setName(name == null ? new net.minecraft.network.chat.TextComponent("@") : io.papermc.paper.adventure.PaperAdventure.asVanilla(name));
+ getSnapshot().getCommandBlock().setName(name == null ? net.minecraft.network.chat.Component.literal("@") : io.papermc.paper.adventure.PaperAdventure.asVanilla(name));
+ }
+ // Paper end
}
@ -2113,7 +2113,7 @@ index 0beb96dc896f63003e1b1ae458b73902bdbe648a..102eb86bad3000f258775ac06ecd1a6d
public String getCustomName() {
EnchantmentTableBlockEntity enchant = this.getSnapshot();
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
index 3f5292deeeddb8a6a5df57aac01f48ba11be6d7c..541f943d307f5307460ea049294fd98d53054d52 100644
index 3f5292deeeddb8a6a5df57aac01f48ba11be6d7c..911843bf38ab750edd4a63417ba7a9deb6b64cb1 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java
@@ -13,34 +13,60 @@ import org.bukkit.entity.Player;
@ -2222,7 +2222,7 @@ index 3f5292deeeddb8a6a5df57aac01f48ba11be6d7c..541f943d307f5307460ea049294fd98d
+ if (i < lines.size() && lines.get(i) != null) {
+ components[i] = io.papermc.paper.adventure.PaperAdventure.asVanilla(lines.get(i));
+ } else {
+ components[i] = new TextComponent("");
+ components[i] = net.minecraft.network.chat.Component.literal("");
+ }
+ }
+ return components;
@ -2480,7 +2480,7 @@ index 446fdca49a5a6999626a7ee3a1d5c168b15a09dd..f9863e138994f6c7a7975a852f106faa
public boolean isOp() {
return true;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index fe392a144edc3282793449cac6c9c953d9648a9e..4c939de8822b064f0e44b741c4b3807ba13e5e9e 100644
index fe392a144edc3282793449cac6c9c953d9648a9e..aff5fa1fe20b4b3aa7562cafa4117b43bc904d0a 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -269,14 +269,39 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -2726,10 +2726,10 @@ index fe392a144edc3282793449cac6c9c953d9648a9e..4c939de8822b064f0e44b741c4b3807b
+ public void sendMessage(final net.kyori.adventure.identity.Identity identity, final net.kyori.adventure.text.Component message, final net.kyori.adventure.audience.MessageType type) {
+ if (getHandle().connection == null) return;
+ // TODO this needs to be checked
+ final net.minecraft.core.Registry<ChatType> chatTypeRegistry = this.getHandle().level.registryAccess().registryOrThrow(net.minecraft.core.Registry.CHAT_TYPE_REGISTRY);
+ final net.minecraft.core.Registry<net.minecraft.network.chat.ChatType> chatTypeRegistry = this.getHandle().level.registryAccess().registryOrThrow(net.minecraft.core.Registry.CHAT_TYPE_REGISTRY);
+ final net.minecraft.network.protocol.Packet<?> packet;
+ if (identity.equals(net.kyori.adventure.identity.Identity.nil()) || type == net.kyori.adventure.audience.MessageType.SYSTEM) {
+ packet = new net.minecraft.network.protocol.game.ClientboundSystemChatPacket(message, chatTypeRegistry.getId(chatTypeRegistry.get(ChatType.SYSTEM)));
+ packet = new net.minecraft.network.protocol.game.ClientboundSystemChatPacket(message, chatTypeRegistry.getId(chatTypeRegistry.get(net.minecraft.network.chat.ChatType.SYSTEM)));
+ } else {
+ final @Nullable Player source = this.getServer().getPlayer(identity.uuid());
+ final ChatSender sender;
@ -2738,7 +2738,7 @@ index fe392a144edc3282793449cac6c9c953d9648a9e..4c939de8822b064f0e44b741c4b3807b
+ } else {
+ sender = new ChatSender(identity.uuid(), Component.empty(), null);
+ }
+ packet = new net.minecraft.network.protocol.game.ClientboundPlayerChatPacket(message, chatTypeRegistry.getId(chatTypeRegistry.get(ChatType.CHAT)), sender, java.time.Instant.now());
+ packet = new net.minecraft.network.protocol.game.ClientboundPlayerChatPacket(message, chatTypeRegistry.getId(chatTypeRegistry.get(net.minecraft.network.chat.ChatType.CHAT)), sender, java.time.Instant.now());
+ }
+ this.getHandle().connection.send(packet);
+ }

View File

@ -6,18 +6,10 @@ Subject: [PATCH] Send attack SoundEffects only to players who can see the
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index b876bbb08c868bc6984a395b84b0c0aaf1666912..c468e3406bd50b58e4cccba955e3fa9a5a3cb22e 100644
index b876bbb08c868bc6984a395b84b0c0aaf1666912..30ffb7b02bef4d4c5fe54c4306539b12fed73627 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -35,6 +35,7 @@ import net.minecraft.network.chat.ClickEvent;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket;
+import net.minecraft.network.protocol.game.ClientboundSoundPacket;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
@@ -1247,7 +1248,7 @@ public abstract class Player extends LivingEntity {
@@ -1247,7 +1247,7 @@ public abstract class Player extends LivingEntity {
int i = b0 + EnchantmentHelper.getKnockbackBonus(this);
if (this.isSprinting() && flag) {
@ -26,7 +18,7 @@ index b876bbb08c868bc6984a395b84b0c0aaf1666912..c468e3406bd50b58e4cccba955e3fa9a
++i;
flag1 = true;
}
@@ -1322,7 +1323,7 @@ public abstract class Player extends LivingEntity {
@@ -1322,7 +1322,7 @@ public abstract class Player extends LivingEntity {
}
}
@ -35,7 +27,7 @@ index b876bbb08c868bc6984a395b84b0c0aaf1666912..c468e3406bd50b58e4cccba955e3fa9a
this.sweepAttack();
}
@@ -1350,15 +1351,15 @@ public abstract class Player extends LivingEntity {
@@ -1350,15 +1350,15 @@ public abstract class Player extends LivingEntity {
}
if (flag2) {
@ -54,7 +46,7 @@ index b876bbb08c868bc6984a395b84b0c0aaf1666912..c468e3406bd50b58e4cccba955e3fa9a
}
}
@@ -1410,7 +1411,7 @@ public abstract class Player extends LivingEntity {
@@ -1410,7 +1410,7 @@ public abstract class Player extends LivingEntity {
this.causeFoodExhaustion(level.spigotConfig.combatExhaustion, EntityExhaustionEvent.ExhaustionReason.ATTACK); // CraftBukkit - EntityExhaustionEvent // Spigot - Change to use configurable value
} else {
@ -63,7 +55,7 @@ index b876bbb08c868bc6984a395b84b0c0aaf1666912..c468e3406bd50b58e4cccba955e3fa9a
if (flag4) {
target.clearFire();
}
@@ -1863,6 +1864,14 @@ public abstract class Player extends LivingEntity {
@@ -1863,6 +1863,14 @@ public abstract class Player extends LivingEntity {
public int getXpNeededForNextLevel() {
return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2);
}
@ -71,7 +63,7 @@ index b876bbb08c868bc6984a395b84b0c0aaf1666912..c468e3406bd50b58e4cccba955e3fa9a
+ private static void sendSoundEffect(Player fromEntity, double x, double y, double z, SoundEvent soundEffect, SoundSource soundCategory, float volume, float pitch) {
+ fromEntity.level.playSound(fromEntity, x, y, z, soundEffect, soundCategory, volume, pitch); // This will not send the effect to the entity himself
+ if (fromEntity instanceof ServerPlayer) {
+ ((ServerPlayer) fromEntity).connection.send(new ClientboundSoundPacket(soundEffect, soundCategory, x, y, z, volume, pitch));
+ ((ServerPlayer) fromEntity).connection.send(new net.minecraft.network.protocol.game.ClientboundSoundPacket(soundEffect, soundCategory, x, y, z, volume, pitch, fromEntity.random.nextLong()));
+ }
+ }
+ // Paper end

View File

@ -21,10 +21,10 @@ index 99ce64e4d01b58d887506841451e561c2796c413..665b7f4cddfef1631ba2fad6eebeb193
private void allChunksAreSlimeChunks() {
allChunksAreSlimeChunks = getBoolean("all-chunks-are-slime-chunks", false);
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index c468e3406bd50b58e4cccba955e3fa9a5a3cb22e..3008f0ac5aee6443645b7c888a5e8e5b630138e7 100644
index 30ffb7b02bef4d4c5fe54c4306539b12fed73627..da304cae8734b44f559df0161f6769e2fcdf555f 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1255,6 +1255,7 @@ public abstract class Player extends LivingEntity {
@@ -1254,6 +1254,7 @@ public abstract class Player extends LivingEntity {
boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity;

View File

@ -20,10 +20,10 @@ index 665b7f4cddfef1631ba2fad6eebeb19392cf8759..7dbd03897bf98ef19509972fb8d09aa0
+ }
}
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 3008f0ac5aee6443645b7c888a5e8e5b630138e7..ff91d886f26dbce576ae70ab010ee99888595b85 100644
index da304cae8734b44f559df0161f6769e2fcdf555f..4935450ff2023779912853e16ad6c6f93fdcf1ef 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1304,7 +1304,11 @@ public abstract class Player extends LivingEntity {
@@ -1303,7 +1303,11 @@ public abstract class Player extends LivingEntity {
}
this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D));

View File

@ -7,10 +7,10 @@ Called when a player is firing a bow and the server is choosing an arrow to use.
Plugins can skip selection of certain arrows and control which is used.
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index ff91d886f26dbce576ae70ab010ee99888595b85..0183d170f4a776eb0424adca6c57b37e96975db8 100644
index 4935450ff2023779912853e16ad6c6f93fdcf1ef..796f248d03e73be8adc289bf57093fa15dbf48e5 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -2247,6 +2247,17 @@ public abstract class Player extends LivingEntity {
@@ -2246,6 +2246,17 @@ public abstract class Player extends LivingEntity {
return ImmutableList.of(Pose.STANDING, Pose.CROUCHING, Pose.SWIMMING);
}
@ -28,7 +28,7 @@ index ff91d886f26dbce576ae70ab010ee99888595b85..0183d170f4a776eb0424adca6c57b37e
@Override
public ItemStack getProjectile(ItemStack stack) {
if (!(stack.getItem() instanceof ProjectileWeaponItem)) {
@@ -2263,7 +2274,7 @@ public abstract class Player extends LivingEntity {
@@ -2262,7 +2273,7 @@ public abstract class Player extends LivingEntity {
for (int i = 0; i < this.inventory.getContainerSize(); ++i) {
ItemStack itemstack2 = this.inventory.getItem(i);

View File

@ -82,10 +82,10 @@ index 3380b95e0eff5a6b1b683b8233b8991eb817b638..de8485df1c23e903ff0721fdb682b98d
serverLevel.playSound((Player)null, goat, this.getImpactSound.apply(goat), SoundSource.HOSTILE, 1.0F, 1.0F);
} else if (this.hasRammedHornBreakingBlock(serverLevel, goat)) {
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 0183d170f4a776eb0424adca6c57b37e96975db8..11e7443bfdd178f23b08529d6c90988113b4ea5e 100644
index 796f248d03e73be8adc289bf57093fa15dbf48e5..a721a1e1eb1d604eec4e64ebcc6c50b01c522c66 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1298,7 +1298,7 @@ public abstract class Player extends LivingEntity {
@@ -1297,7 +1297,7 @@ public abstract class Player extends LivingEntity {
if (flag5) {
if (i > 0) {
if (target instanceof LivingEntity) {
@ -94,7 +94,7 @@ index 0183d170f4a776eb0424adca6c57b37e96975db8..11e7443bfdd178f23b08529d6c909881
} else {
target.push((double) (-Mth.sin(this.getYRot() * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (Mth.cos(this.getYRot() * 0.017453292F) * (float) i * 0.5F));
}
@@ -1322,7 +1322,7 @@ public abstract class Player extends LivingEntity {
@@ -1321,7 +1321,7 @@ public abstract class Player extends LivingEntity {
if (entityliving != this && entityliving != target && !this.isAlliedTo((Entity) entityliving) && (!(entityliving instanceof ArmorStand) || !((ArmorStand) entityliving).isMarker()) && this.distanceToSqr((Entity) entityliving) < 9.0D) {
// CraftBukkit start - Only apply knockback if the damage hits
if (entityliving.hurt(DamageSource.playerAttack(this).sweep(), f4)) {

View File

@ -118,10 +118,10 @@ index fe1636a73f1af09314a200b99c196984d09a4b4a..d35de56c2110c8dcdf6104010f2edb01
PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, com.destroystokyo.paper.PaperConfig.useDisplayNameInQuit ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getScoreboardName())));
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 11e7443bfdd178f23b08529d6c90988113b4ea5e..8215717bd7267fe553319b03d73416732a07485b 100644
index a721a1e1eb1d604eec4e64ebcc6c50b01c522c66..d44d472326d70fe60c5c975109aa7dc5f1971b5d 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -273,7 +273,7 @@ public abstract class Player extends LivingEntity {
@@ -272,7 +272,7 @@ public abstract class Player extends LivingEntity {
this.updateIsUnderwater();
super.tick();
if (!this.level.isClientSide && this.containerMenu != null && !this.containerMenu.stillValid(this)) {
@ -130,7 +130,7 @@ index 11e7443bfdd178f23b08529d6c90988113b4ea5e..8215717bd7267fe553319b03d7341673
this.containerMenu = this.inventoryMenu;
}
@@ -497,6 +497,13 @@ public abstract class Player extends LivingEntity {
@@ -496,6 +496,13 @@ public abstract class Player extends LivingEntity {
}
@ -174,7 +174,7 @@ index 6c708f65b3a3718c7b53e0c2cc12ee8ad62ff2b9..a6ac2fdcda24ec031d5d2ea9e4492614
@Override
public boolean isBlocking() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 7a7fe687f4d6d0439024b58651a7815d951625cb..47abdbaa2663efb4817396d49389f7f3719c5f74 100644
index 0d08b1dee73c59edfa385241e5e0f9407b9b00b6..c99e40cac8f843dcf2804f721edeee0a2708d229 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1060,7 +1060,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

View File

@ -114,10 +114,10 @@ index 370ec54f5c6741e7c9f3630e7f42ea7d7a7d1423..3ea28ff50d409d1d234d17f62207b058
this.dismountVehicle(entity);
}
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 8215717bd7267fe553319b03d73416732a07485b..6eb7240850d50528d8fad8dff79ee578e3f9b588 100644
index d44d472326d70fe60c5c975109aa7dc5f1971b5d..9b8c73b06850e40f69b70bdb6c8a3a86d678b645 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1162,7 +1162,13 @@ public abstract class Player extends LivingEntity {
@@ -1161,7 +1161,13 @@ public abstract class Player extends LivingEntity {
@Override
public void removeVehicle() {

View File

@ -7,10 +7,10 @@ This fixes a lot of game state issues where packets were delayed for processing
due to 1.15's new queue but processed while dead.
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 6eb7240850d50528d8fad8dff79ee578e3f9b588..fba9636e670300e31b5348de9cf3bc23e0eb6e6a 100644
index 9b8c73b06850e40f69b70bdb6c8a3a86d678b645..b9eb4d650272566cae6b2239f381da7761bcc986 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1174,7 +1174,7 @@ public abstract class Player extends LivingEntity {
@@ -1173,7 +1173,7 @@ public abstract class Player extends LivingEntity {
@Override
protected boolean isImmobile() {

View File

@ -46,7 +46,7 @@ index 0778fdd4f47015787f7ffbfb39c31ec0e1c039bd..912fd5135e89348bdd3c0a8b6c07860e
return tag != null && tag.getType() == IntArrayTag.TYPE && ((IntArrayTag)tag).getAsIntArray().length == 4;
}
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java
index 2df77845b78b9d5fae0a36103d42c8202ee2af9e..07abc6f2edab5a5750199dd9c24b890becc4d073 100644
index 2df77845b78b9d5fae0a36103d42c8202ee2af9e..73ee50e05a1c8d432d9967d4e879b5bb373740ad 100644
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
@@ -74,6 +74,11 @@ public final class NbtUtils {
@ -54,8 +54,8 @@ index 2df77845b78b9d5fae0a36103d42c8202ee2af9e..07abc6f2edab5a5750199dd9c24b890b
string = nbt.getString("Name");
}
+ // Paper start - support string UUID's
+ if (compound.contains("Id", 8)) {
+ uUID = UUID.fromString(compound.getString("Id"));
+ if (nbt.contains("Id", 8)) {
+ uUID = UUID.fromString(nbt.getString("Id"));
+ }
+ // Paper end

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Update itemstack legacy name and lore
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index db8db2ab4c81cbf6eb4f21b8916e487c4e2d51fb..bdd2e7e723e1f90bf2b7f6067f6b2f2855c2065f 100644
index db8db2ab4c81cbf6eb4f21b8916e487c4e2d51fb..7c41d18004bd4ef980e0c142d59a5563e77f257f 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -168,6 +168,44 @@ public final class ItemStack {
@ -34,7 +34,7 @@ index db8db2ab4c81cbf6eb4f21b8916e487c4e2d51fb..bdd2e7e723e1f90bf2b7f6067f6b2f28
+ try {
+ list.set(index, convert(json));
+ } catch (com.google.gson.JsonParseException e) {
+ list.set(index, net.minecraft.nbt.StringTag.valueOf(org.bukkit.craftbukkit.util.CraftChatMessage.toJSON(new TextComponent(""))));
+ list.set(index, net.minecraft.nbt.StringTag.valueOf(org.bukkit.craftbukkit.util.CraftChatMessage.toJSON(net.minecraft.network.chat.Component.literal(""))));
+ }
+ }
+ }

View File

@ -42,7 +42,7 @@ index 99b581052f937b0f2d6b5d73de699008c1d51774..ed54479b14dcfc736ac90749106557f0
for(int i = 0; i < bs.length; ++i) {
diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
index 049e64c355d5f064009b1107ad15d28c44f999dd..97b05b7145c6a3a379de31b8988c909da9b21139 100644
index 049e64c355d5f064009b1107ad15d28c44f999dd..a34f22cadc09e53ea4de787b04d050b99dddbcac 100644
--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java
+++ b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
@@ -30,11 +30,17 @@ public class PacketUtils {
@ -59,7 +59,7 @@ index 049e64c355d5f064009b1107ad15d28c44f999dd..97b05b7145c6a3a379de31b8988c909d
}
-
- PacketUtils.LOGGER.error("Failed to handle packet {}, suppressing error", packet, exception);
+ net.minecraft.network.chat.TextComponent error = new net.minecraft.network.chat.TextComponent("Packet processing error");
+ net.minecraft.network.chat.Component error = net.minecraft.network.chat.Component.literal("Packet processing error");
+ networkmanager.send(new net.minecraft.network.protocol.game.ClientboundDisconnectPacket(error), (future) -> {
+ networkmanager.disconnect(error);
+ });

View File

@ -983,7 +983,7 @@ index 0000000000000000000000000000000000000000..d4273df8124d9d6d4a122f5ecef6f3d0
+ }
+}
diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
index 74241146a034c5817cddc608c095d829d765f06a..70b87dc8214815f0163a16b80526ae9be4839fe8 100644
index 74241146a034c5817cddc608c095d829d765f06a..f7cda51086043bf4b1b613450639d8b44b418013 100644
--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
@@ -253,6 +253,121 @@ public class RedStoneWireBlock extends Block {
@ -1139,7 +1139,7 @@ index 74241146a034c5817cddc608c095d829d765f06a..70b87dc8214815f0163a16b80526ae9b
if (!world.isClientSide) {
if (state.canSurvive(world, pos)) {
- this.updatePowerStrength(world, pos, state);
+ this.updateSurroundingRedstone(world, pos, state, fromPos); // Paper - Optimize redstone
+ this.updateSurroundingRedstone(world, pos, state, sourcePos); // Paper - Optimize redstone
} else {
dropResources(state, world, pos);
world.removeBlock(pos, false);

View File

@ -23,7 +23,7 @@ index 4bd335699f5f53b8303a86758a9dedae75bf8464..ccc60a5465efa2b71fc2593d75af62c0
public static boolean velocityOnlineMode;
public static byte[] velocitySecretKey;
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 4b144b1b17ea6f498eeeaa8cd4795fa5ce2c4e0f..ac3219f3a26f9f7fab57de0f9277695423ef46d7 100644
index 4b144b1b17ea6f498eeeaa8cd4795fa5ce2c4e0f..a9a6583d5d853623b863d61f663044437a936e55 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -247,6 +247,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@ -49,7 +49,7 @@ index 4b144b1b17ea6f498eeeaa8cd4795fa5ce2c4e0f..ac3219f3a26f9f7fab57de0f92776954
+ // Paper start
+ if (!org.bukkit.Bukkit.isPrimaryThread()) {
+ if (recipeSpamPackets.addAndGet(com.destroystokyo.paper.PaperConfig.autoRecipeIncrement) > com.destroystokyo.paper.PaperConfig.autoRecipeLimit) {
+ server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]))); // Paper
+ server.scheduleOnMain(() -> this.disconnect(net.minecraft.network.chat.Component.translatable("disconnect.spam", new Object[0]))); // Paper
+ return;
+ }
+ }

View File

@ -6,18 +6,10 @@ Subject: [PATCH] Return chat component with empty text instead of throwing
diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
index f1438e527d6291a789d2ec821481f6ec142d1c0b..295bb2f0b853f41089ea233b8a4017198bc38caf 100644
index f1438e527d6291a789d2ec821481f6ec142d1c0b..79d8bcf3f9b0fe4a65ad7899f858efefac6feaa7 100644
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
@@ -22,6 +22,7 @@ import net.minecraft.ReportedException;
import net.minecraft.core.NonNullList;
import net.minecraft.core.Registry;
import net.minecraft.network.chat.Component;
+import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.util.Mth;
@@ -88,7 +89,12 @@ public abstract class AbstractContainerMenu {
@@ -88,7 +88,12 @@ public abstract class AbstractContainerMenu {
}
private Component title;
public final Component getTitle() {
@ -25,7 +17,7 @@ index f1438e527d6291a789d2ec821481f6ec142d1c0b..295bb2f0b853f41089ea233b8a401719
+ // Paper start - return chat component with empty text instead of throwing error
+ // Preconditions.checkState(this.title != null, "Title not set");
+ if(this.title == null){
+ return new TextComponent("");
+ return Component.literal("");
+ }
+ // Paper end
return this.title;

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Added PlayerDeepSleepEvent
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index fba9636e670300e31b5348de9cf3bc23e0eb6e6a..3ed54b50e7d1b88cd5fc63d22906dfb2dc17a478 100644
index b9eb4d650272566cae6b2239f381da7761bcc986..b8077f26c8705b78ff7bd91a15bf6deac922b85b 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -256,6 +256,11 @@ public abstract class Player extends LivingEntity {
@@ -255,6 +255,11 @@ public abstract class Player extends LivingEntity {
if (this.isSleeping()) {
++this.sleepCounter;