Paper/Spigot-Server-Patches/0275-Add-More-Creeper-API.patch
jmp 1718f61bf8 Updated Upstream (CraftBukkit/Spigot)
Doesn't compile yet.

CraftBukkit Changes:
90d6905b Repackage NMS
69cf961d Repackage patches

Spigot Changes:
79d53c28 Repackage NMS
2021-03-18 18:03:22 +01:00

63 lines
2.7 KiB
Diff

From 0000000000000000000000000000000000000000 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/world/entity/monster/EntityCreeper.java b/src/main/java/net/minecraft/world/entity/monster/EntityCreeper.java
index ea15f54b70361bca529936e6d2e9bc555c60a657..9c8abb18c0ed850939b6691396f5d551e13c7af9 100644
--- a/src/main/java/net/minecraft/world/entity/monster/EntityCreeper.java
+++ b/src/main/java/net/minecraft/world/entity/monster/EntityCreeper.java
@@ -50,7 +50,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 bo;
- private int fuseTicks;
+ public int fuseTicks; // Paper - public
public int maxFuseTicks = 30;
public int explosionRadius = 3;
private int bs;
@@ -290,7 +290,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 013e0b1bca7cb348316bf3917455b160af0c57cc..8499a37611d7bb4f0a6598d6e78de1d52ae5ea02 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
}