From a6fdccf802e0bfdff13c249871609f55d7a3af6b Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Sat, 4 Dec 2021 23:11:59 -0800 Subject: [PATCH] Updated Upstream (Bukkit/CraftBukkit) (#7022) --- ... Add-openSign-method-to-HumanEntity.patch} | 15 +++++- ...-get-a-BlockState-without-a-snapshot.patch | 10 ++-- ...d-method-to-open-already-placed-sign.patch | 28 ----------- .../Add-openSign-method-to-HumanEntity.patch | 46 +++++++++++++++++++ patches/server/Adventure.patch | 7 ++- patches/server/Rewrite-the-light-engine.patch | 2 +- ...opy-TESign-isEditable-from-snapshots.patch | 2 +- work/Bukkit | 2 +- work/CraftBukkit | 2 +- 9 files changed, 74 insertions(+), 40 deletions(-) rename patches/api/{Add-method-to-open-already-placed-sign.patch => Add-openSign-method-to-HumanEntity.patch} (58%) delete mode 100644 patches/server/Add-method-to-open-already-placed-sign.patch create mode 100644 patches/server/Add-openSign-method-to-HumanEntity.patch diff --git a/patches/api/Add-method-to-open-already-placed-sign.patch b/patches/api/Add-openSign-method-to-HumanEntity.patch similarity index 58% rename from patches/api/Add-method-to-open-already-placed-sign.patch rename to patches/api/Add-openSign-method-to-HumanEntity.patch index 40f0ce2b34..bcaa717341 100644 --- a/patches/api/Add-method-to-open-already-placed-sign.patch +++ b/patches/api/Add-openSign-method-to-HumanEntity.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Mark Vainomaa Date: Sun, 1 Apr 2018 02:28:43 +0300 -Subject: [PATCH] Add method to open already placed sign +Subject: [PATCH] Add openSign method to HumanEntity diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java @@ -23,3 +23,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 /** * Make the entity drop the item in their hand. +diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM + /** + * Open a Sign for editing by the Player. + * +- * The Sign must be placed in the same world as the player. ++ * The Sign must be in the same world as the player. + * + * @param sign The sign to edit + */ diff --git a/patches/server/API-to-get-a-BlockState-without-a-snapshot.patch b/patches/server/API-to-get-a-BlockState-without-a-snapshot.patch index c84b4e96b9..1f7ce37220 100644 --- a/patches/server/API-to-get-a-BlockState-without-a-snapshot.patch +++ b/patches/server/API-to-get-a-BlockState-without-a-snapshot.patch @@ -138,16 +138,14 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDat index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java +++ b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java -@@ -0,0 +0,0 @@ public final class CraftPersistentDataContainer implements PersistentDataContain +@@ -0,0 +0,0 @@ public class CraftPersistentDataContainer implements PersistentDataContainer { + public Map serialize() { return (Map) CraftNBTTagConfigSerializer.serialize(this.toTagCompound()); } - ++ + // Paper start + public void clear() { + this.customDataTags.clear(); + } + // Paper end -+ - @FunctionalInterface - public interface Callback { - void onValueChange(); + } diff --git a/patches/server/Add-method-to-open-already-placed-sign.patch b/patches/server/Add-method-to-open-already-placed-sign.patch deleted file mode 100644 index 1d6be8e81c..0000000000 --- a/patches/server/Add-method-to-open-already-placed-sign.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mark Vainomaa -Date: Sun, 1 Apr 2018 02:29:37 +0300 -Subject: [PATCH] Add method to open already placed sign - - -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -@@ -0,0 +0,0 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { - } - } - -+ // Paper start - Add method to open already placed sign -+ @Override -+ public void openSign(org.bukkit.block.Sign sign) { -+ org.apache.commons.lang.Validate.isTrue(sign.getWorld().equals(this.getWorld()), "Sign must be in the same world as player is in"); -+ org.bukkit.craftbukkit.block.CraftSign craftSign = (org.bukkit.craftbukkit.block.CraftSign) sign; -+ net.minecraft.world.level.block.entity.SignBlockEntity teSign = craftSign.getTileEntity(); -+ // Make sign editable temporarily, will be set back to false in PlayerConnection later -+ teSign.isEditable = true; -+ this.getHandle().openTextEdit(teSign); -+ } -+ // Paper end - @Override - public boolean dropItem(boolean dropAll) { - if (!(this.getHandle() instanceof ServerPlayer)) return false; diff --git a/patches/server/Add-openSign-method-to-HumanEntity.patch b/patches/server/Add-openSign-method-to-HumanEntity.patch new file mode 100644 index 0000000000..843adeab95 --- /dev/null +++ b/patches/server/Add-openSign-method-to-HumanEntity.patch @@ -0,0 +1,46 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Mark Vainomaa +Date: Sun, 1 Apr 2018 02:29:37 +0300 +Subject: [PATCH] Add openSign method to HumanEntity + + +diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java ++++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java +@@ -0,0 +0,0 @@ public class CraftSign extends CraftBlockEntityState implements + } + } + +- public static void openSign(Sign sign, Player player) { ++ public static void openSign(Sign sign, org.bukkit.entity.HumanEntity player) { // Paper - change move open sign to HumanEntity + Preconditions.checkArgument(sign != null, "sign == null"); +- Preconditions.checkArgument(sign.isPlaced(), "Sign must be placed"); ++ // Preconditions.checkArgument(sign.isPlaced(), "Sign must be placed"); // Paper - don't require placed + Preconditions.checkArgument(sign.getWorld() == player.getWorld(), "Sign must be in same world as Player"); + + SignBlockEntity handle = ((CraftSign) sign).getTileEntity(); + handle.isEditable = true; + +- ((CraftPlayer) player).getHandle().openTextEdit(handle); ++ ((org.bukkit.craftbukkit.entity.CraftHumanEntity) player).getHandle().openTextEdit(handle); // Paper - change move open sign to HumanEntity + } + + // Paper start +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +@@ -0,0 +0,0 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { + } + } + ++ // Paper start - move open sign method to HumanEntity ++ @Override ++ public void openSign(org.bukkit.block.Sign sign) { ++ org.bukkit.craftbukkit.block.CraftSign.openSign(sign, this); ++ } ++ // Paper end + @Override + public boolean dropItem(boolean dropAll) { + if (!(this.getHandle() instanceof ServerPlayer)) return false; diff --git a/patches/server/Adventure.patch b/patches/server/Adventure.patch index c80bea0814..bf5280f2ba 100644 --- a/patches/server/Adventure.patch +++ b/patches/server/Adventure.patch @@ -2004,7 +2004,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java b/src/mai index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java -@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.util.CraftChatMessage; +@@ -0,0 +0,0 @@ import org.bukkit.entity.Player; public class CraftSign extends CraftBlockEntityState implements Sign { // Lazily initialized only if requested: @@ -2099,6 +2099,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } +@@ -0,0 +0,0 @@ public class CraftSign extends CraftBlockEntityState implements + ((CraftPlayer) player).getHandle().openTextEdit(handle); + } + + // Paper start + public static Component[] sanitizeLines(java.util.List lines) { + Component[] components = new Component[4]; @@ -2112,6 +2116,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return components; + } + // Paper end ++ public static Component[] sanitizeLines(String[] lines) { Component[] components = new Component[4]; diff --git a/patches/server/Rewrite-the-light-engine.patch b/patches/server/Rewrite-the-light-engine.patch index 69f3fe746b..09591baebd 100644 --- a/patches/server/Rewrite-the-light-engine.patch +++ b/patches/server/Rewrite-the-light-engine.patch @@ -4806,7 +4806,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java @@ -0,0 +0,0 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom private static final org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry(); - public org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer persistentDataContainer = new org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer(ChunkAccess.DATA_TYPE_REGISTRY); + public org.bukkit.craftbukkit.persistence.DirtyCraftPersistentDataContainer persistentDataContainer = new org.bukkit.craftbukkit.persistence.DirtyCraftPersistentDataContainer(ChunkAccess.DATA_TYPE_REGISTRY); // CraftBukkit end + // Paper start - rewrite light engine + private volatile ca.spottedleaf.starlight.common.light.SWMRNibbleArray[] blockNibbles; diff --git a/patches/server/copy-TESign-isEditable-from-snapshots.patch b/patches/server/copy-TESign-isEditable-from-snapshots.patch index 42d8e2dc64..009df2a106 100644 --- a/patches/server/copy-TESign-isEditable-from-snapshots.patch +++ b/patches/server/copy-TESign-isEditable-from-snapshots.patch @@ -15,4 +15,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + sign.isEditable = getSnapshot().isEditable; // Paper - copy manually } - // Paper start + public static void openSign(Sign sign, org.bukkit.entity.HumanEntity player) { // Paper - change move open sign to HumanEntity diff --git a/work/Bukkit b/work/Bukkit index 1c9ca40548..e4358b8217 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit 1c9ca4054853af6e4210a63cb71fc537d4d4af95 +Subproject commit e4358b8217126bbcc3a38b0d17097ad5ab87c50a diff --git a/work/CraftBukkit b/work/CraftBukkit index 1825cc0b04..f49e9d1932 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit 1825cc0b04ff9e14df7a511aec855ad80a896d19 +Subproject commit f49e9d1932ece8e5a5aaf259d7221e6f99647721