Paper/Spigot-Server-Patches/0287-Add-More-Creeper-API.patch

66 lines
2.5 KiB
Diff
Raw Normal View History

2019-12-13 21:41:01 +01:00
From 6136f3073915b4d39f24dd6b1011ddcec6b3f62e Mon Sep 17 00:00:00 2001
2018-08-27 09:01:09 +02:00
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 317c1998e..77ba92333 100644
2018-08-27 09:01:09 +02:00
--- 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 {
2019-05-05 10:33:44 +02:00
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 bw;
2018-08-27 09:01:09 +02:00
- 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 {
2018-08-27 09:01:09 +02:00
}
public void ignite() {
- this.datawatcher.set(EntityCreeper.d, true);
+ // Paper start
+ setIgnited(true);
+ }
+
2018-08-27 09:01:09 +02:00
+ 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()) {
2019-05-05 10:33:44 +02:00
+ this.datawatcher.set(EntityCreeper.d, event.isIgnited());
+ }
+ }
2018-08-27 09:01:09 +02:00
+ // 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 896405148..075a5e77e 100644
2018-08-27 09:01:09 +02:00
--- 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 {
2018-08-27 09:01:09 +02:00
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
}
--
2019-12-13 21:41:01 +01:00
2.24.1
2018-08-27 09:01:09 +02:00