aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0295-Add-More-Creeper-API.patch
blob: 2c3aa6ad632b31b44ded64fcfdeb6b4bcaa518e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
From 57b5375c57af7f8abc4f1071d3a284a8a0f07e5f Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Fri, 24 Aug 2018 11:50:26 -0500
Subject: [PATCH] Add More Creeper API


diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java
index ae4dd98ee1..bcb7276308 100644
--- a/src/main/java/net/minecraft/server/EntityCreeper.java
+++ b/src/main/java/net/minecraft/server/EntityCreeper.java
@@ -14,7 +14,7 @@ public class EntityCreeper extends EntityMonster {
     private static final DataWatcherObject<Boolean> POWERED = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i);
     private static final DataWatcherObject<Boolean> d = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i); private static final DataWatcherObject<Boolean> isIgnitedDW = d; // Paper OBFHELPER
     private int bz;
-    private int fuseTicks;
+    public int fuseTicks; // Paper - public
     public int maxFuseTicks = 30;
     public int explosionRadius = 3;
     private int bD;
@@ -254,7 +254,18 @@ public class EntityCreeper extends EntityMonster {
     }
 
     public void ignite() {
-        this.datawatcher.set(EntityCreeper.d, true);
+        // Paper start
+        setIgnited(true);
+    }
+
+    public void setIgnited(boolean ignited) {
+        if (isIgnited() != ignited) {
+            com.destroystokyo.paper.event.entity.CreeperIgniteEvent event = new com.destroystokyo.paper.event.entity.CreeperIgniteEvent((org.bukkit.entity.Creeper) getBukkitEntity(), ignited);
+            if (event.callEvent()) {
+                this.datawatcher.set(EntityCreeper.d, event.isIgnited());
+            }
+        }
+        // Paper end
     }
 
     public boolean canCauseHeadDrop() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java
index 896405148c..075a5e77e2 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java
@@ -88,4 +88,18 @@ public class CraftCreeper extends CraftMonster implements Creeper {
     public EntityType getType() {
         return EntityType.CREEPER;
     }
+
+    // Paper start
+    public void setIgnited(boolean ignited) {
+        getHandle().setIgnited(ignited);
+    }
+
+    public boolean isIgnited() {
+        return getHandle().isIgnited();
+    }
+
+    public int getFuseTicks() {
+        return getHandle().fuseTicks;
+    }
+    // Paper end
 }
-- 
2.22.0