aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/monster/Creeper.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/monster/Creeper.java.patch')
-rw-r--r--patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/monster/Creeper.java.patch98
1 files changed, 98 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/monster/Creeper.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/monster/Creeper.java.patch
new file mode 100644
index 0000000000..36a4a02c69
--- /dev/null
+++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/monster/Creeper.java.patch
@@ -0,0 +1,98 @@
+--- a/net/minecraft/world/entity/monster/Creeper.java
++++ b/net/minecraft/world/entity/monster/Creeper.java
+@@ -43,6 +43,12 @@
+ import net.minecraft.world.level.Level;
+ import net.minecraft.world.level.gameevent.GameEvent;
+
++// CraftBukkit start;
++import org.bukkit.event.entity.CreatureSpawnEvent;
++import org.bukkit.craftbukkit.event.CraftEventFactory;
++import org.bukkit.event.entity.ExplosionPrimeEvent;
++// CraftBukkit end
++
+ public class Creeper extends Monster implements PowerableMob {
+
+ private static final EntityDataAccessor<Integer> DATA_SWELL_DIR = SynchedEntityData.defineId(Creeper.class, EntityDataSerializers.INT);
+@@ -229,12 +222,22 @@
+ }
+
+ @Override
+- @Override
+- public void thunderHit(ServerLevel serverlevel, LightningBolt lightningbolt) {
+- super.thunderHit(serverlevel, lightningbolt);
++ public void thunderHit(ServerLevel level, LightningBolt lightning) {
++ super.thunderHit(level, lightning);
++ // CraftBukkit start
++ if (CraftEventFactory.callCreeperPowerEvent(this, lightning, org.bukkit.event.entity.CreeperPowerEvent.PowerCause.LIGHTNING).isCancelled()) {
++ return;
++ }
++ // CraftBukkit end
+ this.entityData.set(Creeper.DATA_IS_POWERED, true);
+ }
+
++ // CraftBukkit start
++ public void setPowered(boolean powered) {
++ this.entityData.set(Creeper.DATA_IS_POWERED, powered);
++ }
++ // CraftBukkit end
++
+ @Override
+ @Override
+ protected InteractionResult mobInteract(Player player, InteractionHand interactionhand) {
+@@ -246,7 +248,7 @@
+ this.level().playSound(player, this.getX(), this.getY(), this.getZ(), soundevent, this.getSoundSource(), 1.0F, this.random.nextFloat() * 0.4F + 0.8F);
+ if (!this.level().isClientSide) {
+ this.ignite();
+- if (!itemstack.isDamageableItem()) {
++ if (itemstack.getItem().getMaxDamage() == 0) { // CraftBukkit - fix MC-264285: unbreakable flint and steels are completely consumed when igniting a creeper
+ itemstack.shrink(1);
+ } else {
+ itemstack.hurtAndBreak(1, player, (player1) -> {
+@@ -265,10 +267,19 @@
+ if (!this.level().isClientSide) {
+ float f = this.isPowered() ? 2.0F : 1.0F;
+
++ // CraftBukkit start
++ ExplosionPrimeEvent event = CraftEventFactory.callExplosionPrimeEvent(this, this.explosionRadius * f, false);
++ if (!event.isCancelled()) {
++ // CraftBukkit end
+ this.dead = true;
+- this.level().explode(this, this.getX(), this.getY(), this.getZ(), (float) this.explosionRadius * f, Level.ExplosionInteraction.MOB);
++ this.level().explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Level.a.MOB); // CraftBukkit
+ this.discard();
+ this.spawnLingeringCloud();
++ // CraftBukkit start
++ } else {
++ swell = 0;
++ }
++ // CraftBukkit end
+ }
+
+ }
+@@ -279,11 +290,12 @@
+ if (!collection.isEmpty()) {
+ AreaEffectCloud areaeffectcloud = new AreaEffectCloud(this.level(), this.getX(), this.getY(), this.getZ());
+
+- areaeffectcloud.setRadius(2.5F);
+- areaeffectcloud.setRadiusOnUse(-0.5F);
+- areaeffectcloud.setWaitTime(10);
+- areaeffectcloud.setDuration(areaeffectcloud.getDuration() / 2);
+- areaeffectcloud.setRadiusPerTick(-areaeffectcloud.getRadius() / (float) areaeffectcloud.getDuration());
++ entityareaeffectcloud.setOwner(this); // CraftBukkit
++ entityareaeffectcloud.setRadius(2.5F);
++ entityareaeffectcloud.setRadiusOnUse(-0.5F);
++ entityareaeffectcloud.setWaitTime(10);
++ entityareaeffectcloud.setDuration(entityareaeffectcloud.getDuration() / 2);
++ entityareaeffectcloud.setRadiusPerTick(-entityareaeffectcloud.getRadius() / (float) entityareaeffectcloud.getDuration());
+ Iterator iterator = collection.iterator();
+
+ while (iterator.hasNext()) {
+@@ -292,7 +304,7 @@
+ areaeffectcloud.addEffect(new MobEffectInstance(mobeffectinstance));
+ }
+
+- this.level().addFreshEntity(areaeffectcloud);
++ this.level().addFreshEntity(entityareaeffectcloud, CreatureSpawnEvent.SpawnReason.EXPLOSION); // CraftBukkit
+ }
+
+ }