Move setShouldBurnInDay to AbstractSkeleton (#7120)

This commit is contained in:
Jake Potrebic 2021-12-21 16:31:33 -08:00 committed by GitHub
parent 3d9385e665
commit 75f4cb074a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 49 additions and 45 deletions

View file

@ -5,6 +5,35 @@ Subject: [PATCH] Add a "should burn in sunlight" API for Phantoms and
Skeletons
diff --git a/src/main/java/org/bukkit/entity/AbstractSkeleton.java b/src/main/java/org/bukkit/entity/AbstractSkeleton.java
index 4f4f1e48cdaee0d845f60666569e48731be3fbb9..504fd761e5863c09fe785300a5c3e68e00baf2b0 100644
--- a/src/main/java/org/bukkit/entity/AbstractSkeleton.java
+++ b/src/main/java/org/bukkit/entity/AbstractSkeleton.java
@@ -32,4 +32,24 @@ public interface AbstractSkeleton extends Monster, com.destroystokyo.paper.entit
@Deprecated
@Contract("_ -> fail")
public void setSkeletonType(Skeleton.SkeletonType type);
+
+ // Paper start
+ /**
+ * Check if this skeleton will burn in the sunlight. This
+ * does not take into account an entity's natural fire
+ * immunity.
+ *
+ * @return True if skeleton will burn in sunlight
+ */
+ boolean shouldBurnInDay();
+
+ /**
+ * Set if this skeleton should burn in the sunlight. This
+ * will not override an entity's natural fire
+ * immunity.
+ *
+ * @param shouldBurnInDay True to burn in sunlight
+ */
+ void setShouldBurnInDay(boolean shouldBurnInDay);
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/entity/Phantom.java b/src/main/java/org/bukkit/entity/Phantom.java
index ed4d417c2deefb78807cb61b01df5afcd334d754..a40b045f08b85e22e75459b547e7e7c0b95103ed 100644
--- a/src/main/java/org/bukkit/entity/Phantom.java
@ -29,27 +58,3 @@ index ed4d417c2deefb78807cb61b01df5afcd334d754..a40b045f08b85e22e75459b547e7e7c0
+ public void setShouldBurnInDay(boolean shouldBurnInDay);
// Paper end
}
diff --git a/src/main/java/org/bukkit/entity/Skeleton.java b/src/main/java/org/bukkit/entity/Skeleton.java
index 01d838a60d056bf4b4a8ef9d0ac18c6f91f412e6..6d515726532ad7417fba9d3e01bcb1167539b23c 100644
--- a/src/main/java/org/bukkit/entity/Skeleton.java
+++ b/src/main/java/org/bukkit/entity/Skeleton.java
@@ -64,4 +64,19 @@ public interface Skeleton extends AbstractSkeleton {
*/
STRAY;
}
+ // Paper start
+ /**
+ * Check if this skeleton will burn in the sunlight
+ *
+ * @return True if skeleton will burn in sunlight
+ */
+ boolean shouldBurnInDay();
+
+ /**
+ * Set if this skeleton should burn in the sunlight
+ *
+ * @param shouldBurnInDay True to burn in sunlight
+ */
+ void setShouldBurnInDay(boolean shouldBurnInDay);
+ // Paper end
}

View file

@ -89,6 +89,26 @@ index 573107f1281e68c7ba00d4dea8fac02f2d18504d..5c35b73c13c3826be9705e0515407681
// Paper end
private static enum AttackPhase {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractSkeleton.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractSkeleton.java
index 5ff566186431440c25a26900aba14e4adb642031..5beaa2bb0d58fe477ce8d2de8b77600d3b416d8c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractSkeleton.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractSkeleton.java
@@ -20,4 +20,15 @@ public abstract class CraftAbstractSkeleton extends CraftMonster implements Abst
return (net.minecraft.world.entity.monster.AbstractSkeleton) super.getHandle();
}
// Paper end
+ // Paper start
+ @Override
+ public boolean shouldBurnInDay() {
+ return getHandle().shouldBurnInDay();
+ }
+
+ @Override
+ public void setShouldBurnInDay(boolean shouldBurnInDay) {
+ getHandle().setShouldBurnInDay(shouldBurnInDay);
+ }
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
index c9dab70b0b284fe1c1daafd3c1f5bd08b14fa35d..dce23f3878b1588c26b6116d80e597d08070edbc 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
@ -109,24 +129,3 @@ index c9dab70b0b284fe1c1daafd3c1f5bd08b14fa35d..dce23f3878b1588c26b6116d80e597d0
+ }
// 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..0e8e1a85697bbe9ca92466ca0a39e4e9478f31bf 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java
@@ -51,4 +51,16 @@ public class CraftSkeleton extends CraftAbstractSkeleton implements Skeleton {
public SkeletonType getSkeletonType() {
return SkeletonType.NORMAL;
}
+
+ // Paper start
+ @Override
+ public boolean shouldBurnInDay() {
+ return getHandle().shouldBurnInDay();
+ }
+
+ @Override
+ public void setShouldBurnInDay(boolean shouldBurnInDay) {
+ getHandle().setShouldBurnInDay(shouldBurnInDay);
+ }
+ // Paper end
}