mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 13:07:06 +01:00
57dd397155
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: b999860d SPIGOT-2304: Add LootGenerateEvent CraftBukkit Changes:77fd87e4
SPIGOT-2304: Implement LootGenerateEventa1a705ee
SPIGOT-5566: Doused campfires & fires should call EntityChangeBlockEvent41712edd
SPIGOT-5707: PersistentDataHolder not Persistent on API dropped Item
107 lines
2.8 KiB
Diff
107 lines
2.8 KiB
Diff
From 6951e644dd75d4299f00deddba74e92daafebb66 Mon Sep 17 00:00:00 2001
|
|
From: Anthony MacAllister <anthonymmacallister@gmail.com>
|
|
Date: Thu, 26 Jul 2018 15:28:53 -0400
|
|
Subject: [PATCH] EntityTransformedEvent
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityTransformedEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityTransformedEvent.java
|
|
new file mode 100644
|
|
index 000000000..12194f1fc
|
|
--- /dev/null
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityTransformedEvent.java
|
|
@@ -0,0 +1,92 @@
|
|
+package com.destroystokyo.paper.event.entity;
|
|
+
|
|
+
|
|
+import org.bukkit.entity.Entity;
|
|
+import org.bukkit.event.Cancellable;
|
|
+import org.bukkit.event.HandlerList;
|
|
+import org.bukkit.event.entity.EntityEvent;
|
|
+import org.bukkit.event.entity.EntityTransformEvent;
|
|
+
|
|
+/**
|
|
+ * Fired when an entity transforms into another entity
|
|
+ * <p>
|
|
+ * If the event is cancelled, the entity will not transform
|
|
+ * @deprecated Bukkit has added {@link EntityTransformEvent}, you should start using that
|
|
+ */
|
|
+@Deprecated
|
|
+public class EntityTransformedEvent extends EntityEvent implements Cancellable {
|
|
+ private static final HandlerList handlers = new HandlerList();
|
|
+ private boolean cancelled;
|
|
+ private final Entity transformed;
|
|
+ private final TransformedReason reason;
|
|
+
|
|
+ public EntityTransformedEvent(Entity entity, Entity transformed, TransformedReason reason) {
|
|
+ super(entity);
|
|
+ this.transformed = transformed;
|
|
+ this.reason = reason;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * The entity after it has transformed
|
|
+ *
|
|
+ * @return Transformed entity
|
|
+ * @deprecated see {@link EntityTransformEvent#getTransformedEntity()}
|
|
+ */
|
|
+ @Deprecated
|
|
+ public Entity getTransformed() {
|
|
+ return transformed;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * @return The reason for the transformation
|
|
+ * @deprecated see {@link EntityTransformEvent#getTransformReason()}
|
|
+ */
|
|
+ @Deprecated
|
|
+ public TransformedReason getReason() {
|
|
+ return reason;
|
|
+ }
|
|
+
|
|
+
|
|
+ @Override
|
|
+ public HandlerList getHandlers(){
|
|
+ return handlers;
|
|
+ }
|
|
+
|
|
+ public static HandlerList getHandlerList(){
|
|
+ return handlers;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean isCancelled(){
|
|
+ return cancelled;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setCancelled(boolean cancel){
|
|
+ cancelled = cancel;
|
|
+ }
|
|
+
|
|
+ public enum TransformedReason {
|
|
+ /**
|
|
+ * When a zombie drowns
|
|
+ */
|
|
+ DROWNED,
|
|
+ /**
|
|
+ * When a zombie villager is cured
|
|
+ */
|
|
+ CURED,
|
|
+ /**
|
|
+ * When a villager turns to a zombie villager
|
|
+ */
|
|
+ INFECTED,
|
|
+ /**
|
|
+ * When a mooshroom turns to a cow
|
|
+ */
|
|
+ SHEARED,
|
|
+ /**
|
|
+ * When a pig turns to a zombiepigman
|
|
+ */
|
|
+ LIGHTNING
|
|
+
|
|
+ }
|
|
+}
|
|
--
|
|
2.26.2
|
|
|