From 8b532bad3afcc378dbd3eea2747429a811941a29 Mon Sep 17 00:00:00 2001 From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Date: Sat, 20 Jan 2024 00:01:12 +0100 Subject: [PATCH] Add visual blockdata api for primed tnt (#10146) --- patches/api/Missing-Entity-API.patch | 31 +++++++++++++++++++++++++ patches/server/Missing-Entity-API.patch | 22 ++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/patches/api/Missing-Entity-API.patch b/patches/api/Missing-Entity-API.patch index 10b7d93383..78b85e4cd9 100644 --- a/patches/api/Missing-Entity-API.patch +++ b/patches/api/Missing-Entity-API.patch @@ -1115,6 +1115,37 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 */ -public interface Salmon extends Fish { } +public interface Salmon extends io.papermc.paper.entity.SchoolableFish { } // Paper - Schooling Fish API +diff --git a/src/main/java/org/bukkit/entity/TNTPrimed.java b/src/main/java/org/bukkit/entity/TNTPrimed.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/entity/TNTPrimed.java ++++ b/src/main/java/org/bukkit/entity/TNTPrimed.java +@@ -0,0 +0,0 @@ public interface TNTPrimed extends Explosive { + default org.bukkit.Location getSourceLoc() { + return this.getOrigin(); + } ++ ++ // Paper start ++ /** ++ * Sets the visual block data of this ++ * primed tnt. ++ *
++ * The explosion of the tnt stays the ++ * same and is not affected by this change. ++ * ++ * @param data the visual block data ++ */ ++ void setBlockData(@org.jetbrains.annotations.NotNull org.bukkit.block.data.BlockData data); ++ ++ /** ++ * Gets the visual block data of this ++ * primed tnt. ++ * ++ * @return the visual block data ++ */ ++ @org.jetbrains.annotations.NotNull ++ org.bukkit.block.data.BlockData getBlockData(); ++ // Paper end + } diff --git a/src/main/java/org/bukkit/entity/Tadpole.java b/src/main/java/org/bukkit/entity/Tadpole.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Tadpole.java diff --git a/patches/server/Missing-Entity-API.patch b/patches/server/Missing-Entity-API.patch index 3a1787a80c..fc7f79dd80 100644 --- a/patches/server/Missing-Entity-API.patch +++ b/patches/server/Missing-Entity-API.patch @@ -1118,6 +1118,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public CraftSalmon(CraftServer server, net.minecraft.world.entity.animal.Salmon entity) { super(server, entity); +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java +@@ -0,0 +0,0 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed { + this.getHandle().owner = null; + } + } ++ ++ // Paper start ++ @Override ++ public void setBlockData(org.bukkit.block.data.BlockData data) { ++ com.google.common.base.Preconditions.checkArgument(data != null, "The visual block data of this tnt cannot be null. To reset it just set to the TNT default block data"); ++ this.getHandle().setBlockState(((org.bukkit.craftbukkit.block.data.CraftBlockData) data).getState()); ++ } ++ ++ @Override ++ public org.bukkit.block.data.BlockData getBlockData() { ++ return org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(this.getHandle().getBlockState()); ++ } ++ // Paper end + } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTadpole.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTadpole.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTadpole.java