mirror of
https://github.com/PaperMC/Paper.git
synced 2024-09-06 03:48:05 +02:00
Upstream has released updates that appears to apply and compile correctly. This update has been tested to ensure that World Conversion still occurs correctly. Bukkit Changes: 0812ce2c SPIGOT-4397: isChunkGenerated API CraftBukkit Changes:4824655c
SPIGOT-4398: Upgrade to ASM 6.2.1 for better Java 11 supporteea43870
MC-134115: Fix issues converting tile entities1a7f2d10
SPIGOT-4397: isChunkGenerated API40aed54d
SPIGOT-4396: Improve vehicle movement Spigot Changes: f6a273b1 Rebuild patches
123 lines
4.6 KiB
Diff
123 lines
4.6 KiB
Diff
From 2119c70bba9ab8b30512b576b6f9f157adb7fe0d 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/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java
|
|
index 19022b6e24..e070e7b2d2 100644
|
|
--- 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 {
|
|
private static final DataWatcherObject<Boolean> b = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i);
|
|
private static final DataWatcherObject<Boolean> c = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i);private static final DataWatcherObject<Boolean> isIgnitedDW = c; // Paper OBFHELPER
|
|
private int bC;
|
|
- private int fuseTicks;
|
|
+ public int fuseTicks; // Paper - public
|
|
public int maxFuseTicks = 30;
|
|
public int explosionRadius = 3;
|
|
private int bG;
|
|
@@ -92,9 +92,12 @@ public class EntityCreeper extends EntityMonster {
|
|
public void tick() {
|
|
if (this.isAlive()) {
|
|
this.bC = this.fuseTicks;
|
|
- if (this.isIgnited()) {
|
|
- this.a(1);
|
|
- }
|
|
+ // Paper start - This is no longer needed as the state is being set in setIgnited() now.
|
|
+ // Ensures the CreeperIgniteEvent is not spammed every tick
|
|
+ //if (this.isIgnited()) {
|
|
+ // this.a(1);
|
|
+ //}
|
|
+ // Paper end
|
|
|
|
int i = this.dz();
|
|
|
|
@@ -102,7 +105,7 @@ public class EntityCreeper extends EntityMonster {
|
|
this.a(SoundEffects.ENTITY_CREEPER_PRIMED, 1.0F, 0.5F);
|
|
}
|
|
|
|
- this.fuseTicks += i;
|
|
+ this.fuseTicks += this.isIgnited() ? 1 : i; // Paper - workaround now that we aren't letting it get re-set every tick - GH-1389
|
|
if (this.fuseTicks < 0) {
|
|
this.fuseTicks = 0;
|
|
}
|
|
@@ -151,12 +154,21 @@ public class EntityCreeper extends EntityMonster {
|
|
return LootTables.x;
|
|
}
|
|
|
|
+ public int getState() { return dz(); } // Paper - OBFHELPER
|
|
public int dz() {
|
|
return ((Integer) this.datawatcher.get(EntityCreeper.a)).intValue();
|
|
}
|
|
|
|
+ public void setState(int state) { a(state); } // Paper - OBFHELPER
|
|
public void a(int i) {
|
|
- this.datawatcher.set(EntityCreeper.a, Integer.valueOf(i));
|
|
+ // Paper start
|
|
+ if (getState() != i) {
|
|
+ com.destroystokyo.paper.event.entity.CreeperIgniteEvent event = new com.destroystokyo.paper.event.entity.CreeperIgniteEvent((org.bukkit.entity.Creeper) getBukkitEntity(), i == 1);
|
|
+ if (event.callEvent()) {
|
|
+ this.datawatcher.set(EntityCreeper.a, event.isIgnited() ? 1 : -1);
|
|
+ }
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
|
|
public void onLightningStrike(EntityLightning entitylightning) {
|
|
@@ -190,6 +202,7 @@ public class EntityCreeper extends EntityMonster {
|
|
return super.a(entityhuman, enumhand);
|
|
}
|
|
|
|
+ public void explode() { this.dE(); } // Paper - OBFHELPER
|
|
private void dE() {
|
|
if (!this.world.isClientSide) {
|
|
boolean flag = this.world.getGameRules().getBoolean("mobGriefing");
|
|
@@ -241,8 +254,15 @@ public class EntityCreeper extends EntityMonster {
|
|
return ((Boolean) this.datawatcher.get(EntityCreeper.c)).booleanValue();
|
|
}
|
|
|
|
+ // Paper start
|
|
+ public void setIgnited(boolean ignited) {
|
|
+ this.datawatcher.set(EntityCreeper.c, ignited);
|
|
+ setState(ignited ? 1 : -1);
|
|
+ }
|
|
+
|
|
public void dB() {
|
|
- this.datawatcher.set(EntityCreeper.c, Boolean.valueOf(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 ffebb54caa..ab2b20a0d4 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java
|
|
@@ -76,4 +76,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.19.0
|
|
|