From 8604b42e0a2439feed5e5106eee9b3961c7bb123 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 29569805cb..0c2c3c7308 100644 --- a/src/main/java/net/minecraft/server/EntityCreeper.java +++ b/src/main/java/net/minecraft/server/EntityCreeper.java @@ -13,7 +13,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 bz; - private int fuseTicks; + public int fuseTicks; // Paper - public public int maxFuseTicks = 30; public int explosionRadius = 3; private int bD; @@ -201,6 +201,7 @@ public class EntityCreeper extends EntityMonster { return super.a(entityhuman, enumhand); } + public void explode() { this.eb(); } // Paper - OBFHELPER private void eb() { if (!this.world.isClientSide) { Explosion.Effect explosion_effect = this.world.getGameRules().getBoolean("mobGriefing") ? Explosion.Effect.DESTROY : Explosion.Effect.NONE; @@ -252,8 +253,19 @@ public class EntityCreeper extends EntityMonster { return (Boolean) this.datawatcher.get(EntityCreeper.d); } + // Paper start + 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()); + } + } + } + public void dY() { - this.datawatcher.set(EntityCreeper.d, true); + setIgnited(true); + // 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 796ee9e40d..2d38823c57 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java @@ -78,4 +78,22 @@ 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; + } + + public void explode() { + getHandle().explode(); + } + // Paper end } -- 2.21.0