geforkt von Mirrors/Paper
Add entity heal API (#10267)
Dieser Commit ist enthalten in:
Ursprung
ea9c42406e
Commit
2cc4c182ae
@ -12,6 +12,7 @@ Co-authored-by: Amin <amin.haddou@frg.wwschool.de>
|
||||
Co-authored-by: TrollyLoki <trollyloki@gmail.com>
|
||||
Co-authored-by: FireInstall <kettnerl@hu-berlin.de>
|
||||
Co-authored-by: maxcom1 <46265094+maxcom1@users.noreply.github.com>
|
||||
Co-authored-by: TotalledZebra <Holappa57@gmail.com>
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/entity/SchoolableFish.java b/src/main/java/io/papermc/paper/entity/SchoolableFish.java
|
||||
new file mode 100644
|
||||
@ -348,6 +349,36 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
*/
|
||||
-public interface Cod extends Fish { }
|
||||
+public interface Cod extends io.papermc.paper.entity.SchoolableFish { } // Paper - Schooling Fish API
|
||||
diff --git a/src/main/java/org/bukkit/entity/Damageable.java b/src/main/java/org/bukkit/entity/Damageable.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Damageable.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Damageable.java
|
||||
@@ -0,0 +0,0 @@ public interface Damageable extends Entity {
|
||||
*/
|
||||
void setHealth(double health);
|
||||
|
||||
+ // Paper start - entity heal API
|
||||
+ /**
|
||||
+ * Heal this entity by the given amount. This will call {@link org.bukkit.event.entity.EntityRegainHealthEvent}.
|
||||
+ *
|
||||
+ * @param amount heal amount
|
||||
+ */
|
||||
+ default void heal(final double amount) {
|
||||
+ this.heal(amount, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.CUSTOM);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Heal this entity by the given amount. This will call {@link org.bukkit.event.entity.EntityRegainHealthEvent}.
|
||||
+ *
|
||||
+ * @param amount heal amount
|
||||
+ * @param reason heal reason
|
||||
+ */
|
||||
+ void heal(double amount, @NotNull org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason reason);
|
||||
+ // Paper end - entity heal API
|
||||
+
|
||||
/**
|
||||
* Gets the entity's absorption amount.
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/entity/Enderman.java b/src/main/java/org/bukkit/entity/Enderman.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Enderman.java
|
||||
|
@ -42,6 +42,7 @@ Co-authored-by: Amin <amin.haddou@frg.wwschool.de>
|
||||
Co-authored-by: TrollyLoki <trollyloki@gmail.com>
|
||||
Co-authored-by: FireInstall <kettnerl@hu-berlin.de>
|
||||
Co-authored-by: maxcom1 <46265094+maxcom1@users.noreply.github.com>
|
||||
Co-authored-by: TotalledZebra <Holappa57@gmail.com>
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
@ -632,6 +633,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ // Paper end - Missing Dolphin API
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragonPart.java
|
||||
@@ -0,0 +0,0 @@ public class CraftEnderDragonPart extends CraftComplexPart implements EnderDrago
|
||||
this.getParent().setHealth(health);
|
||||
}
|
||||
|
||||
+ // Paper start - entity heal API
|
||||
+ @Override
|
||||
+ public void heal(final double amount, final org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason reason) {
|
||||
+ this.getParent().heal(amount, reason);
|
||||
+ }
|
||||
+ // Paper end - entity heal API
|
||||
+
|
||||
@Override
|
||||
public double getAbsorptionAmount() {
|
||||
return this.getParent().getAbsorptionAmount();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java
|
||||
@ -832,6 +851,20 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start - entity heal API
|
||||
+ @Override
|
||||
+ public void heal(final double amount, final org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason reason) {
|
||||
+ this.getHandle().heal((float) amount, reason);
|
||||
+ }
|
||||
+ // Paper end - entity heal API
|
||||
+
|
||||
@Override
|
||||
public double getAbsorptionAmount() {
|
||||
return this.getHandle().getAbsorptionAmount();
|
||||
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
|
||||
@Override
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren