From ba5ef6e1ac70e95f0f63a380c8a7b3baa7fdb881 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Tue, 21 Dec 2021 19:52:54 -0800 Subject: [PATCH] Entity powdered snow API (#6833) --- build-data/paper.at | 3 ++ patches/api/Entity-powdered-snow-API.patch | 44 +++++++++++++++++++ patches/server/Entity-powdered-snow-API.patch | 37 ++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 patches/api/Entity-powdered-snow-API.patch create mode 100644 patches/server/Entity-powdered-snow-API.patch diff --git a/build-data/paper.at b/build-data/paper.at index 8213dae874..73cb1ac04e 100644 --- a/build-data/paper.at +++ b/build-data/paper.at @@ -289,3 +289,6 @@ public net.minecraft.world.level.levelgen.SurfaceSystem getOrCreateRandomFactory # Fix removing recipes public net.minecraft.world.item.crafting.RecipeManager byName + +# Entity powdered snow API +public net.minecraft.world.entity.monster.Skeleton inPowderSnowTime diff --git a/patches/api/Entity-powdered-snow-API.patch b/patches/api/Entity-powdered-snow-API.patch new file mode 100644 index 0000000000..f618c7335e --- /dev/null +++ b/patches/api/Entity-powdered-snow-API.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sun, 24 Oct 2021 20:58:52 -0700 +Subject: [PATCH] Entity powdered snow API + + +diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/entity/Entity.java ++++ b/src/main/java/org/bukkit/entity/Entity.java +@@ -0,0 +0,0 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent + * @return Whether the entity was successfully spawned. + */ + public boolean spawnAt(@NotNull Location location, @NotNull org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason); ++ ++ /** ++ * Check if entity is inside powdered snow. ++ * ++ * @return true if in powdered snow. ++ */ ++ boolean isInPowderedSnow(); + // Paper end + } +diff --git a/src/main/java/org/bukkit/entity/Skeleton.java b/src/main/java/org/bukkit/entity/Skeleton.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/entity/Skeleton.java ++++ b/src/main/java/org/bukkit/entity/Skeleton.java +@@ -0,0 +0,0 @@ public interface Skeleton extends AbstractSkeleton { + */ + void setConversionTime(int time); + ++ // Paper start ++ /** ++ * Gets the time the skeleton ++ * has been inside powdered snow. ++ * ++ * @return time in ticks ++ */ ++ int inPowderedSnowTime(); ++ // Paper end ++ + /** + * A legacy enum that defines the different variances of skeleton-like + * entities on the server. diff --git a/patches/server/Entity-powdered-snow-API.patch b/patches/server/Entity-powdered-snow-API.patch new file mode 100644 index 0000000000..ea6d0221f2 --- /dev/null +++ b/patches/server/Entity-powdered-snow-API.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Sun, 24 Oct 2021 20:58:43 -0700 +Subject: [PATCH] Entity powdered snow API + + +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +@@ -0,0 +0,0 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { + entity.setRot(location.getYaw(), location.getPitch()); + return !entity.valid && entity.level.addFreshEntity(entity, reason); + } ++ ++ @Override ++ public boolean isInPowderedSnow() { ++ return getHandle().isInPowderSnow || getHandle().wasInPowderSnow; // depending on the location in the entity "tick" either could be needed. ++ } + // Paper end + } +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java +@@ -0,0 +0,0 @@ public class CraftSkeleton extends CraftAbstractSkeleton implements Skeleton { + public SkeletonType getSkeletonType() { + return SkeletonType.NORMAL; + } ++ ++ // Paper start ++ @Override ++ public int inPowderedSnowTime() { ++ return getHandle().inPowderSnowTime; ++ } ++ // Paper end + }