mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-31 00:20:44 +01:00
Add More Creeper API
This commit is contained in:
parent
f6b20dccfc
commit
bfd8b7bcef
2 changed files with 43 additions and 0 deletions
|
@ -22,6 +22,15 @@
|
||||||
|
|
||||||
public Creeper(EntityType<? extends Creeper> type, Level world) {
|
public Creeper(EntityType<? extends Creeper> type, Level world) {
|
||||||
super(type, world);
|
super(type, world);
|
||||||
|
@@ -125,7 +133,7 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nbt.getBoolean("ignited")) {
|
||||||
|
- this.ignite();
|
||||||
|
+ this.entityData.set(Creeper.DATA_IS_IGNITED, true); // Paper - set directly to avoid firing event
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -214,9 +222,20 @@
|
@@ -214,9 +222,20 @@
|
||||||
@Override
|
@Override
|
||||||
public void thunderHit(ServerLevel world, LightningBolt lightning) {
|
public void thunderHit(ServerLevel world, LightningBolt lightning) {
|
||||||
|
@ -99,3 +108,25 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -284,9 +315,20 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ignite() {
|
||||||
|
- this.entityData.set(Creeper.DATA_IS_IGNITED, true);
|
||||||
|
+ // Paper start - CreeperIgniteEvent
|
||||||
|
+ 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.entityData.set(Creeper.DATA_IS_IGNITED, event.isIgnited());
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ // Paper end - CreeperIgniteEvent
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
public boolean canDropMobsSkull() {
|
||||||
|
return this.isPowered() && this.droppedSkulls < 1;
|
||||||
|
}
|
||||||
|
|
|
@ -101,4 +101,16 @@ public class CraftCreeper extends CraftMonster implements Creeper {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "CraftCreeper";
|
return "CraftCreeper";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Paper start
|
||||||
|
@Override
|
||||||
|
public void setIgnited(boolean ignited) {
|
||||||
|
getHandle().setIgnited(ignited);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isIgnited() {
|
||||||
|
return getHandle().isIgnited();
|
||||||
|
}
|
||||||
|
// Paper end
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue