Additional ExplosiveMinecart API (#8896)

This commit is contained in:
SoSeDiK
2023-02-26 18:01:43 +02:00
parent 6a50027d5d
commit 903747cc3a
2 changed files with 52 additions and 3 deletions

View File

@@ -6,6 +6,7 @@ Subject: [PATCH] Missing Entity Behavior API
Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: William Blake Galbreath <blake.galbreath@gmail.com>
Co-authored-by: SoSeDiK <mrsosedik@gmail.com>
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
@@ -1185,19 +1186,44 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public interface ExplosiveMinecart extends Minecart {
+ // Paper start - Entity API
+ /**
+ * Set the number of ticks until the minecart explodes after being primed.
+ * Set the number of ticks until the Minecart explodes after being primed.
+ *
+ * @param fuseTicks fuse ticks or -1 if the fuse isn't primed
+ */
+ void setFuseTicks(int fuseTicks);
+
+ /**
+ * Retrieve the number of ticks until the explosive minecart explodes
+ * Retrieve the number of ticks until the explosive Minecart explodes.
+ *
+ * @return number of ticks or -1 if the fuse isn't primed
+ */
+ int getFuseTicks();
+ // Paper end
+
+ /**
+ * Checks whether this explosive Minecart is ignited (its fuse is primed).
+ *
+ * @return whether the Minecart is ignited
+ */
+ boolean isIgnited();
+
+ /**
+ * Ignites this explosive Minecart, beginning its fuse.
+ */
+ void ignite();
+
+ /**
+ * Immediately explodes the Minecart.
+ * Power will depend on the Minecart's horizontal speed.
+ */
+ void explode();
+
+ /**
+ * Immediately explodes the Minecart with the specified power.
+ *
+ * @param power explosion power
+ */
+ void explode(double power);
+ // Paper end - Entity API
}
diff --git a/src/main/java/org/bukkit/entity/minecart/HopperMinecart.java b/src/main/java/org/bukkit/entity/minecart/HopperMinecart.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644