Add ZombieVillager conversion without entity event (#8111)
The ZombieVillager#setConversionTime API method internally calls startConversion which always broadcasts the entity event responsible for playing the respective sound at the beginning of a conversion. This is not always wanted by developers when modifying already converting zombies in particular. This commit expands the ZombieVillager interface with another overload of the setConversionTime method that also takes a simple toggle flag indicating whether or not the entity event should be published to the world.
This commit is contained in:
parent
c4782f50a3
commit
95ac8745f0
3 changed files with 81 additions and 2 deletions
|
@ -701,3 +701,30 @@ index 0e5decadf31140d6cb121c298f935ccc12c7a7e7..490395f38c4d9977d30a6f48585a4ea0
|
|||
+ boolean isInterested();
|
||||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/entity/ZombieVillager.java b/src/main/java/org/bukkit/entity/ZombieVillager.java
|
||||
index 7cc1d9a966454af70b7c25735fe474fe3eb97eb4..ad2eaee347cd2864aef30d2af48c1be6dc115c22 100644
|
||||
--- a/src/main/java/org/bukkit/entity/ZombieVillager.java
|
||||
+++ b/src/main/java/org/bukkit/entity/ZombieVillager.java
|
||||
@@ -90,4 +90,22 @@ public interface ZombieVillager extends Zombie {
|
||||
* @param conversionPlayer the player
|
||||
*/
|
||||
void setConversionPlayer(@Nullable OfflinePlayer conversionPlayer);
|
||||
+
|
||||
+ // Paper start - missing entity behaviour api - converting without entity event
|
||||
+ /**
|
||||
+ * Sets the amount of ticks until this entity will be converted to a
|
||||
+ * Villager as a result of being cured.
|
||||
+ * <p>
|
||||
+ * When this reaches 0, the entity will be converted. A value of less than 0
|
||||
+ * will stop the current conversion process without converting the current
|
||||
+ * entity.
|
||||
+ *
|
||||
+ * @param time new conversion time
|
||||
+ * @param broadcastEntityEvent whether this conversion time mutation should broadcast the
|
||||
+ * org.bukkit.{@link org.bukkit.EntityEffect#ZOMBIE_TRANSFORM} entity event to the
|
||||
+ * world. If false, no entity event is published, preventing for example the
|
||||
+ * org.bukkit.{@link org.bukkit.Sound#ENTITY_ZOMBIE_VILLAGER_CURE} from playing.
|
||||
+ */
|
||||
+ void setConversionTime(int time, boolean broadcastEntityEvent);
|
||||
+ // Paper stop - missing entity behaviour api - converting without entity event
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue