From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: BillyGalbreath 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 b89530079751c13894527f21572cc37e3a5548b8..45dfc8104a75f9893c6ee03d507cac80b893249c 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 POWERED = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i); private static final DataWatcherObject d = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i); private static final DataWatcherObject isIgnitedDW = d; // Paper OBFHELPER private int bw; - private int fuseTicks; + public int fuseTicks; // Paper - public public int maxFuseTicks = 30; public int explosionRadius = 3; private int bA; @@ -256,7 +256,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 896405148c489011e4f06c43fe961045b7426377..075a5e77e2c2a873b048b9886d630e71238988da 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 }