Skip to content

Commit

Permalink
Fix creepers being able to blow up watered blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Samsuik committed Feb 20, 2025
1 parent daa5c1f commit 886ff86
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--- a/net/minecraft/world/entity/monster/Creeper.java
+++ b/net/minecraft/world/entity/monster/Creeper.java
@@ -250,7 +_,12 @@
if (!event.isCancelled()) {
// CraftBukkit end
this.dead = true;
- serverLevel.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.MOB); // CraftBukkit // Paper - fix DamageSource API (revert to vanilla, no, just no, don't change this)
+ // Sakura start - fix creepers blowing up watered blocks
+ // Entities can clip up to 1.0e-7 inside blocks which can be abused to cegg watered blocks.
+ // This is patched by adding a slight offset to the explosion position.
+ final double explosionY = this.getY() + 1.0e-5;
+ serverLevel.explode(this, this.getX(), explosionY, this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.MOB); // CraftBukkit // Paper - fix DamageSource API (revert to vanilla, no, just no, don't change this)
+ // Sakura end - fix creepers blowing up watered blocks
this.spawnLingeringCloud();
this.triggerOnDeathMobEffects(serverLevel, Entity.RemovalReason.KILLED);
this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.EXPLODE); // CraftBukkit - add Bukkit remove cause

0 comments on commit 886ff86

Please sign in to comment.