Updated Upstream (Bukkit/CraftBukkit) (#7022)

This commit is contained in:
Jake Potrebic 2021-12-04 23:11:59 -08:00
parent eef6df3fff
commit a6fdccf802
9 changed files with 74 additions and 40 deletions

View file

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
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
*/

View file

@ -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<String, Object> serialize() {
return (Map<String, Object>) CraftNBTTagConfigSerializer.serialize(this.toTagCompound());
}
+
+ // Paper start
+ public void clear() {
+ this.customDataTags.clear();
+ }
+ // Paper end
+
@FunctionalInterface
public interface Callback {
void onValueChange();
}

View file

@ -1,28 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
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;

View file

@ -0,0 +1,46 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
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<SignBlockEntity> 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;

View file

@ -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<SignBlockEntity> implements Sign {
// Lazily initialized only if requested:
@ -2099,6 +2099,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
}
}
@@ -0,0 +0,0 @@ public class CraftSign extends CraftBlockEntityState<SignBlockEntity> implements
((CraftPlayer) player).getHandle().openTextEdit(handle);
}
+ // Paper start
+ public static Component[] sanitizeLines(java.util.List<net.kyori.adventure.text.Component> 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];

View file

@ -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;

View file

@ -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

@ -1 +1 @@
Subproject commit 1c9ca4054853af6e4210a63cb71fc537d4d4af95
Subproject commit e4358b8217126bbcc3a38b0d17097ad5ab87c50a

@ -1 +1 @@
Subproject commit 1825cc0b04ff9e14df7a511aec855ad80a896d19
Subproject commit f49e9d1932ece8e5a5aaf259d7221e6f99647721