Add more entity api (#7564)

This commit is contained in:
Nassim Jahnke 2022-03-11 15:24:45 +01:00 committed by GitHub
parent 657d163740
commit d714682f8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
410 changed files with 459 additions and 163 deletions

View File

@ -221,10 +221,10 @@ index 0000000000000000000000000000000000000000..abeb24fccda2acfdb0dfdadacb8fe688
+ }
+}
diff --git a/src/main/java/org/bukkit/entity/Turtle.java b/src/main/java/org/bukkit/entity/Turtle.java
index 0a4cd29930c2f1c28f5a3e6884c7dec45b5cac11..5375ea14097f4f10b2294488b92924a35a72d4d7 100644
index 0a4cd29930c2f1c28f5a3e6884c7dec45b5cac11..8bee07c81172e189fab9b82b398983f509099474 100644
--- a/src/main/java/org/bukkit/entity/Turtle.java
+++ b/src/main/java/org/bukkit/entity/Turtle.java
@@ -1,6 +1,55 @@
@@ -1,6 +1,62 @@
package org.bukkit.entity;
+import org.bukkit.Location;
@ -279,5 +279,12 @@ index 0a4cd29930c2f1c28f5a3e6884c7dec45b5cac11..5375ea14097f4f10b2294488b92924a3
+ * @param hasEgg True if carrying egg
+ */
+ void setHasEgg(boolean hasEgg);
+
+ /**
+ * Returns whether the turtle is currently laying an egg.
+ *
+ * @return whether the turtle is laying an egg
+ */
+ boolean isLayingEgg();
+ // Paper end
+}

View File

@ -1,45 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sun, 5 Jul 2020 15:39:40 -0700
Subject: [PATCH] added Wither API
diff --git a/src/main/java/org/bukkit/entity/Wither.java b/src/main/java/org/bukkit/entity/Wither.java
index 426d3693317cd303d35d8203026b528d87e401d5..8c95cd6933f11076de936854f379e6fc8600b525 100644
--- a/src/main/java/org/bukkit/entity/Wither.java
+++ b/src/main/java/org/bukkit/entity/Wither.java
@@ -6,4 +6,34 @@ import com.destroystokyo.paper.entity.RangedEntity;
* Represents a Wither boss
*/
public interface Wither extends Monster, Boss, RangedEntity { // Paper
+ // Paper start
+ /**
+ * @return whether the wither is charged
+ */
+ boolean isCharged();
+
+ /**
+ * @return ticks the wither is invulnerable for
+ */
+ int getInvulnerableTicks();
+
+ /**
+ * Sets for how long in the future, the wither should be invulnerable.
+ *
+ * @param ticks ticks the wither is invulnerable for
+ */
+ void setInvulnerableTicks(int ticks);
+
+ /**
+ * @return whether the wither can travel through portals
+ */
+ boolean canTravelThroughPortals();
+
+ /**
+ * Sets whether the wither can travel through portals.
+ *
+ * @param value whether the wither can travel through portals
+ */
+ void setCanTravelThroughPortals(boolean value);
+ // Paper end
}

View File

@ -28,7 +28,7 @@ index 0aa141c590cf61a1fc99bec4cf8d5590a3ab6519..c8ea04b06d7178c6cc992a9a1b0355a7
/**
* Gets the map from the given item ID.
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index b1cfea011efa985f644328486196edf5c73e72cd..67c6443c5639beafade19bc39932f30bf1001a8d 100644
index 76e42cc79bf3f7e677e06f136fd6c1fe0d94f260..75aba8c3db5198c11e0bb9c262388632a47d93e6 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -673,6 +673,17 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi

View File

@ -89,7 +89,7 @@ index c8ea04b06d7178c6cc992a9a1b0355a70a035152..7732d26277ca8b845898cb01c7623a2f
@NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 67c6443c5639beafade19bc39932f30bf1001a8d..ca4a9428e89b084436ef43099974ae7684648776 100644
index 75aba8c3db5198c11e0bb9c262388632a47d93e6..1d2970dc4d18122e95db8cc9830aa5c41a59e24b 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1961,5 +1961,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi

View File

@ -3,6 +3,8 @@ From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Date: Fri, 28 May 2021 21:06:59 -0400
Subject: [PATCH] Missing Entity Behavior API
Co-authored-by: Nassim Jahnke <jahnke.nassim@gmail.com>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/org/bukkit/entity/AbstractHorse.java b/src/main/java/org/bukkit/entity/AbstractHorse.java
index 0d88dce9978243a1f995c5fb448c5d71b01136eb..cad47139de57642fb3bb483e7a5acaa7fea78cb4 100644
@ -108,6 +110,47 @@ index c2a566b864c82ffb094b7334d9e6e25a1bfc87d1..c340fecb61bac66baf0f44189d21bc85
+ public boolean isHeadUp();
+ // Paper End - More cat api
}
diff --git a/src/main/java/org/bukkit/entity/Enderman.java b/src/main/java/org/bukkit/entity/Enderman.java
index 821c690f8a32918bdb284ffec4af98f411f76ccc..f4664855f22ba9d6c5aa1db4f8551fe28b7d980c 100644
--- a/src/main/java/org/bukkit/entity/Enderman.java
+++ b/src/main/java/org/bukkit/entity/Enderman.java
@@ -50,4 +50,36 @@ public interface Enderman extends Monster {
* @param blockData data to set the carried block to, or null to remove
*/
public void setCarriedBlock(@Nullable BlockData blockData);
+
+ // Paper start
+ /**
+ * Returns whether the enderman is screaming/angry.
+ *
+ * @return whether the enderman is screaming
+ */
+ boolean isScreaming();
+
+ /**
+ * Sets whether the enderman is screaming/angry.
+ *
+ * @param screaming whether the enderman is screaming
+ */
+ void setScreaming(boolean screaming);
+
+ /**
+ * Returns whether the enderman has been stared at.
+ * If set to true, players will hear an ambient sound.
+ *
+ * @return whether the enderman has been stared at
+ */
+ boolean hasBeenStaredAt();
+
+ /**
+ * Sets whether the enderman has been stared at.
+ * If set to true, players will hear an ambient sound.
+ *
+ * @param hasBeenStaredAt whether the enderman has been stared at
+ */
+ void setHasBeenStaredAt(boolean hasBeenStaredAt);
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/entity/Fox.java b/src/main/java/org/bukkit/entity/Fox.java
index 498e182846b81d50b3a594254e8b341fb23e8763..3826363a1954afcddaadec7f96ac18300f8e89e9 100644
--- a/src/main/java/org/bukkit/entity/Fox.java
@ -357,3 +400,140 @@ index a6a7429ed2e1eefb2b12b7480ed74fcc3963a864..1dcc2c8f4899da029af8b1c1b2ff1b5e
+ boolean isSitting();
+ // Paper end - Panda API
}
diff --git a/src/main/java/org/bukkit/entity/PolarBear.java b/src/main/java/org/bukkit/entity/PolarBear.java
index 479f7a7c54c85cb685f56e60906650d1989c03ff..60267ee382de80fab86b440ff72a2455f427d148 100644
--- a/src/main/java/org/bukkit/entity/PolarBear.java
+++ b/src/main/java/org/bukkit/entity/PolarBear.java
@@ -3,4 +3,21 @@ package org.bukkit.entity;
/**
* Represents a polar bear.
*/
-public interface PolarBear extends Animals {}
+// Paper start
+public interface PolarBear extends Animals {
+
+ /**
+ * Returns whether the polar bear is standing.
+ *
+ * @return whether the polar bear is standing
+ */
+ boolean isStanding();
+
+ /**
+ * Sets whether the polar bear is standing.
+ *
+ * @param standing whether the polar bear should be standing
+ */
+ void setStanding(boolean standing);
+}
+// Paper end
diff --git a/src/main/java/org/bukkit/entity/Raider.java b/src/main/java/org/bukkit/entity/Raider.java
index 9a99b8ca1ec9c3c88b29275c88b1221e1b22bcef..756b4a7794ea0905abd4e4fe777f69ffe36658f5 100644
--- a/src/main/java/org/bukkit/entity/Raider.java
+++ b/src/main/java/org/bukkit/entity/Raider.java
@@ -47,4 +47,20 @@ public interface Raider extends Monster {
* @param join CanJoinRaid status
*/
void setCanJoinRaid(boolean join);
+
+ // Paper start
+ /**
+ * Returns whether the raider is celebrating a raid victory.
+ *
+ * @return whether the raider is celebrating a raid victory
+ */
+ boolean isCelebrating();
+
+ /**
+ * Sets whether the raider is celebrating a raid victory.
+ *
+ * @param celebrating whether the raider is celebrating a raid victory
+ */
+ void setCelebrating(boolean celebrating);
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/entity/Trident.java b/src/main/java/org/bukkit/entity/Trident.java
index 28cdb3b544572ba7aeb9061e3163e3895ac7d4e6..c8015ff610e3c1222cb368ea1d8a0c2f3785d9c7 100644
--- a/src/main/java/org/bukkit/entity/Trident.java
+++ b/src/main/java/org/bukkit/entity/Trident.java
@@ -3,4 +3,40 @@ package org.bukkit.entity;
/**
* Represents a thrown trident.
*/
-public interface Trident extends AbstractArrow, ThrowableProjectile { }
+// Paper start
+public interface Trident extends AbstractArrow, ThrowableProjectile {
+
+ /**
+ * Returns whether the trident has an enchanted glow.
+ * This can be separate from the underlying item having any enchantments.
+ *
+ * @return whether the trident has an enchanted glow
+ */
+ boolean hasGlint();
+
+ /**
+ * Sets whether the trident has an enchanted glow.
+ * This is separate from the underlying item having any enchantments.
+ *
+ * @param glint whether the trident should have an enchanted glow
+ */
+ void setGlint(boolean glint);
+
+ /**
+ * Returns the loyalty level of the trident.
+ * This can be separate from the underlying item's enchantments.
+ *
+ * @return loyalty level of the trident
+ */
+ int getLoyaltyLevel();
+
+ /**
+ * Sets the loyalty level of the trident.
+ * This is separate from the underlying item's enchantments.
+ *
+ * @param loyaltyLevel loyalty level
+ * @throws IllegalArgumentException if the loyalty level is lower than 0 or greater than 127
+ */
+ void setLoyaltyLevel(int loyaltyLevel);
+}
+// Paper end
diff --git a/src/main/java/org/bukkit/entity/Wither.java b/src/main/java/org/bukkit/entity/Wither.java
index 426d3693317cd303d35d8203026b528d87e401d5..8c95cd6933f11076de936854f379e6fc8600b525 100644
--- a/src/main/java/org/bukkit/entity/Wither.java
+++ b/src/main/java/org/bukkit/entity/Wither.java
@@ -6,4 +6,34 @@ import com.destroystokyo.paper.entity.RangedEntity;
* Represents a Wither boss
*/
public interface Wither extends Monster, Boss, RangedEntity { // Paper
+ // Paper start
+ /**
+ * @return whether the wither is charged
+ */
+ boolean isCharged();
+
+ /**
+ * @return ticks the wither is invulnerable for
+ */
+ int getInvulnerableTicks();
+
+ /**
+ * Sets for how long in the future, the wither should be invulnerable.
+ *
+ * @param ticks ticks the wither is invulnerable for
+ */
+ void setInvulnerableTicks(int ticks);
+
+ /**
+ * @return whether the wither can travel through portals
+ */
+ boolean canTravelThroughPortals();
+
+ /**
+ * Sets whether the wither can travel through portals.
+ *
+ * @param value whether the wither can travel through portals
+ */
+ void setCanTravelThroughPortals(boolean value);
+ // Paper end
}

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add Raw Byte Entity Serialization
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 329612597a2cdf556f5ca970f5409e1c77a5d911..ec8328ecd1d4d555d1f411c70f15347cd7aacf67 100644
index 54b0fe21d3b6379e6550a3b1dc81c2a44e7699da..b39d1474210da1974d7e95f10daaf496a9330442 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -112,6 +112,14 @@ public interface UnsafeValues {

View File

@ -34,7 +34,7 @@ index 2af2a948dc9c0d4ad28fccb1c9a2b28d5db99203..416d402b7e885ccc9b187a8e8111da23
* Creates a boss bar instance to display to players. The progress
* defaults to 1.0
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index ca4a9428e89b084436ef43099974ae7684648776..32f84a04add01a244e4abba4c7e1c1183aa62db1 100644
index 1d2970dc4d18122e95db8cc9830aa5c41a59e24b..d90026c9331321ca749f7090b76c21b4608b2ee8 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1553,6 +1553,22 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi

View File

@ -37,7 +37,7 @@ index 75acd6f8f3d774bb79e8e513125e801c5569a244..b93b1b0428d11589605c8edf5c053369
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/scoreboard/Scoreboard.java b/src/main/java/org/bukkit/scoreboard/Scoreboard.java
index f7754ab421c7b452a53c28d1e2fafdccfbba24bf..9a395b138be3f6fa9a52639f0ac4070c23f7d77c 100644
index 1ada91d790abedbc9b3aeb6e96467a0d78560f15..fc3456bb79f2fe1504359455b937c162780110c2 100644
--- a/src/main/java/org/bukkit/scoreboard/Scoreboard.java
+++ b/src/main/java/org/bukkit/scoreboard/Scoreboard.java
@@ -163,9 +163,8 @@ public interface Scoreboard {

Some files were not shown because too many files have changed in this diff Show More