mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 07:08:47 +01:00
Entity powdered snow API (#6833)
This commit is contained in:
parent
9012ae8880
commit
264b11d9f3
3 changed files with 84 additions and 0 deletions
|
@ -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
|
||||
|
|
44
patches/api/0349-Entity-powdered-snow-API.patch
Normal file
44
patches/api/0349-Entity-powdered-snow-API.patch
Normal file
|
@ -0,0 +1,44 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
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 bafad5764cc3933fcd9602d37bd2e68424cbd575..51ec2e4ec4239659272bba3d6ba2ad73926ebb88 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Entity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Entity.java
|
||||
@@ -794,5 +794,12 @@ 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 01d838a60d056bf4b4a8ef9d0ac18c6f91f412e6..c61eba5f400d146a8643542048904e353df94f4b 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Skeleton.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Skeleton.java
|
||||
@@ -41,6 +41,16 @@ 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.
|
37
patches/server/0835-Entity-powdered-snow-API.patch
Normal file
37
patches/server/0835-Entity-powdered-snow-API.patch
Normal file
|
@ -0,0 +1,37 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
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 5aae88e20bc04560d6ad52cfcaa872d28bfcee8f..5893d2028679d23315a32433f6affa0c8d63c01c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -1286,5 +1286,10 @@ 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 90f34d75f99f31f5c98c499df209979a03e23191..1737857424c5da885c46f39502cafd2a670d3be7 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java
|
||||
@@ -51,4 +51,11 @@ public class CraftSkeleton extends CraftAbstractSkeleton implements Skeleton {
|
||||
public SkeletonType getSkeletonType() {
|
||||
return SkeletonType.NORMAL;
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public int inPowderedSnowTime() {
|
||||
+ return getHandle().inPowderSnowTime;
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
Loading…
Reference in a new issue