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

79 Zeilen
3.0 KiB
Diff

From a64875c5420b62df4ca8f1362501bb5e7a93b2b9 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 29569805c..0c2c3c730 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
2019-05-05 10:33:44 +02:00
@@ -13,7 +13,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;
2018-08-27 09:01:09 +02:00
- private int fuseTicks;
+ public int fuseTicks; // Paper - public
public int maxFuseTicks = 30;
public int explosionRadius = 3;
2019-05-05 10:33:44 +02:00
private int bD;
@@ -201,6 +201,7 @@ public class EntityCreeper extends EntityMonster {
2018-08-27 09:01:09 +02:00
return super.a(entityhuman, enumhand);
}
2019-05-05 10:33:44 +02:00
+ public void explode() { this.eb(); } // Paper - OBFHELPER
private void eb() {
2018-08-27 09:01:09 +02:00
if (!this.world.isClientSide) {
2019-05-05 10:33:44 +02:00
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);
2018-08-27 09:01:09 +02:00
}
+ // 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()) {
2019-05-05 10:33:44 +02:00
+ this.datawatcher.set(EntityCreeper.d, event.isIgnited());
+ }
+ }
2018-08-27 09:01:09 +02:00
+ }
+
2019-05-05 10:33:44 +02:00
public void dY() {
- this.datawatcher.set(EntityCreeper.d, true);
2018-08-27 09:01:09 +02:00
+ 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 796ee9e40..2d38823c5 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
2019-05-06 04:58:04 +02:00
@@ -78,4 +78,22 @@ 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;
+ }
+
+ public void explode() {
+ getHandle().explode();
+ }
+ // Paper end
}
--
2019-05-05 13:32:20 +02:00
2.21.0
2018-08-27 09:01:09 +02:00