Move setShouldBurnInDay to AbstractSkeleton (#7120)

This commit is contained in:
Jake Potrebic 2021-12-21 16:31:33 -08:00
parent 81cd10fd7e
commit 4bf1124114
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/entity/AbstractSkeleton.java
+++ b/src/main/java/org/bukkit/entity/AbstractSkeleton.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/entity/Phantom.java
@ -29,27 +58,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ 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 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 {
*/
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 0000000000000000000000000000000000000000..00000000000000000000000000000000
// 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractSkeleton.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractSkeleton.java
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
@ -109,24 +129,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
// 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 boolean shouldBurnInDay() {
+ return getHandle().shouldBurnInDay();
+ }
+
+ @Override
+ public void setShouldBurnInDay(boolean shouldBurnInDay) {
+ getHandle().setShouldBurnInDay(shouldBurnInDay);
+ }
+ // Paper end
}