Skip to content

Commit ab99393

Browse files
authored
Fix charged creeper explosions not dropping mob skulls (#13167)
1 parent e5cc256 commit ab99393

File tree

7 files changed

+24
-17
lines changed

7 files changed

+24
-17
lines changed

build-data/paper.at

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ public net.minecraft.world.entity.item.ItemEntity target
365365
public net.minecraft.world.entity.item.ItemEntity thrower
366366
public net.minecraft.world.entity.item.PrimedTnt explosionPower
367367
public net.minecraft.world.entity.item.PrimedTnt owner
368+
public net.minecraft.world.entity.monster.Creeper droppedSkulls
368369
public net.minecraft.world.entity.monster.Creeper explodeCreeper()V
369370
public net.minecraft.world.entity.monster.Creeper explosionRadius
370371
public net.minecraft.world.entity.monster.Creeper maxSwell

paper-server/patches/features/0001-Moonrise-optimisation-patches.patch

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28098,7 +28098,7 @@ index 8cc5c0716392ba06501542ff5cbe71ee43979e5d..09fd99c9cbd23b5f3c899bfb00c9b896
2809828098
+ // Paper end - block counting
2809928099
}
2810028100
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
28101-
index 86d3cd1dc2a866e078e449f077c9ea1a852fcd98..7eda7cb9e7030e31279a94b0c1087e800f025b46 100644
28101+
index 75f8f00c4b05390e0884f33aac260ed76c49123c..8f9af51af8457f1356efd401ea46565310e25059 100644
2810228102
--- a/net/minecraft/world/entity/Entity.java
2810328103
+++ b/net/minecraft/world/entity/Entity.java
2810428104
@@ -149,7 +149,7 @@ import net.minecraft.world.waypoints.WaypointTransmitter;
@@ -28451,7 +28451,7 @@ index 86d3cd1dc2a866e078e449f077c9ea1a852fcd98..7eda7cb9e7030e31279a94b0c1087e80
2845128451
}
2845228452

2845328453
private static float[] collectCandidateStepUpHeights(AABB box, List<VoxelShape> colliders, float deltaY, float maxUpStep) {
28454-
@@ -2705,21 +2853,110 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
28454+
@@ -2704,21 +2852,110 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
2845528455
}
2845628456

2845728457
public boolean isInWall() {
@@ -28573,7 +28573,7 @@ index 86d3cd1dc2a866e078e449f077c9ea1a852fcd98..7eda7cb9e7030e31279a94b0c1087e80
2857328573
}
2857428574

2857528575
public InteractionResult interact(Player player, InteractionHand hand) {
28576-
@@ -4332,15 +4569,17 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
28576+
@@ -4331,15 +4568,17 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
2857728577
}
2857828578

2857928579
public Iterable<Entity> getIndirectPassengers() {
@@ -28599,7 +28599,7 @@ index 86d3cd1dc2a866e078e449f077c9ea1a852fcd98..7eda7cb9e7030e31279a94b0c1087e80
2859928599
}
2860028600

2860128601
public int countPlayerPassengers() {
28602-
@@ -4483,77 +4722,126 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
28602+
@@ -4482,77 +4721,126 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
2860328603
return Mth.lerp(partialTick, this.yRotO, this.yRot);
2860428604
}
2860528605

@@ -28784,7 +28784,7 @@ index 86d3cd1dc2a866e078e449f077c9ea1a852fcd98..7eda7cb9e7030e31279a94b0c1087e80
2878428784

2878528785
public boolean touchingUnloadedChunk() {
2878628786
AABB aabb = this.getBoundingBox().inflate(1.0);
28787-
@@ -4709,6 +4997,15 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
28787+
@@ -4708,6 +4996,15 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
2878828788
}
2878928789

2879028790
public final void setPosRaw(double x, double y, double z, boolean forceBoundingBoxUpdate) {
@@ -28800,7 +28800,7 @@ index 86d3cd1dc2a866e078e449f077c9ea1a852fcd98..7eda7cb9e7030e31279a94b0c1087e80
2880028800
if (!checkPosition(this, x, y, z)) {
2880128801
return;
2880228802
}
28803-
@@ -4860,6 +5157,12 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
28803+
@@ -4859,6 +5156,12 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
2880428804

2880528805
@Override
2880628806
public final void setRemoved(Entity.RemovalReason removalReason, @Nullable org.bukkit.event.entity.EntityRemoveEvent.Cause cause) { // CraftBukkit - add Bukkit remove cause
@@ -28813,7 +28813,7 @@ index 86d3cd1dc2a866e078e449f077c9ea1a852fcd98..7eda7cb9e7030e31279a94b0c1087e80
2881328813
org.bukkit.craftbukkit.event.CraftEventFactory.callEntityRemoveEvent(this, cause); // CraftBukkit
2881428814
final boolean alreadyRemoved = this.removalReason != null; // Paper - Folia schedulers
2881528815
if (this.removalReason == null) {
28816-
@@ -4870,7 +5173,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
28816+
@@ -4869,7 +5172,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
2881728817
this.stopRiding();
2881828818
}
2881928819

@@ -28822,7 +28822,7 @@ index 86d3cd1dc2a866e078e449f077c9ea1a852fcd98..7eda7cb9e7030e31279a94b0c1087e80
2882228822
this.levelCallback.onRemove(removalReason);
2882328823
this.onRemoval(removalReason);
2882428824
// Paper start - Folia schedulers
28825-
@@ -4904,7 +5207,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
28825+
@@ -4903,7 +5206,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
2882628826
public boolean shouldBeSaved() {
2882728827
return (this.removalReason == null || this.removalReason.shouldSave())
2882828828
&& !this.isPassenger()

paper-server/patches/features/0005-Entity-Activation-Range-2.0.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ index 35e852c4bb5e632ac4e1dc8c9e89f7a366ba7c09..f500e724034b330b590825c07b7dd615
464464
public void tick() {
465465
super.tick();
466466
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
467-
index c5d45f86eda48ee18986c4198b96d031b8028bb2..450fdc0df04cbcc8f0c6ecbfc015f0d744e4a96d 100644
467+
index 8f9af51af8457f1356efd401ea46565310e25059..07f27ff55628eef2caa28c96aa15e46cb9db2392 100644
468468
--- a/net/minecraft/world/entity/Entity.java
469469
+++ b/net/minecraft/world/entity/Entity.java
470470
@@ -368,6 +368,15 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
@@ -523,10 +523,10 @@ index c5d45f86eda48ee18986c4198b96d031b8028bb2..450fdc0df04cbcc8f0c6ecbfc015f0d7
523523
movement = this.maybeBackOffFromEdge(movement, type);
524524
Vec3 vec3 = this.collide(movement);
525525
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
526-
index 0e64b71f653135162296bda070a4a87385cec6ca..be602f3d82960fc5e2592dc688418b0ac3c670a1 100644
526+
index 3de638d16192262f1b172a1f15101daf6a72aaf4..d9c7b7cc01fe4a7d6554e93c939e657994054249 100644
527527
--- a/net/minecraft/world/entity/LivingEntity.java
528528
+++ b/net/minecraft/world/entity/LivingEntity.java
529-
@@ -3246,6 +3246,14 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
529+
@@ -3252,6 +3252,14 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
530530
return false;
531531
}
532532

paper-server/patches/features/0026-Optimise-EntityScheduler-ticking.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ index d5f3083354d70c4da3c39e2f909ce4c7e170295c..4b1ffb5396138fc0d165ac647797b83f
6767
io.papermc.paper.adventure.providers.ClickCallbackProviderImpl.DIALOG_CLICK_MANAGER.handleQueue(this.tickCount); // Paper
6868
profilerFiller.push("commandFunctions");
6969
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
70-
index 16070e63d1a8e4d32aa0d812bb11f8f41e09fe3c..218395a721cbf1d39a52f1a8f2b30be1b3885250 100644
70+
index 07f27ff55628eef2caa28c96aa15e46cb9db2392..afacfc6fe52842c49ca3a63e2a37891a6c2f4867 100644
7171
--- a/net/minecraft/world/entity/Entity.java
7272
+++ b/net/minecraft/world/entity/Entity.java
73-
@@ -5224,6 +5224,11 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
73+
@@ -5223,6 +5223,11 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name
7474
this.getBukkitEntity().taskScheduler.retire();
7575
}
7676
// Paper end - Folia schedulers

paper-server/patches/sources/net/minecraft/world/entity/Entity.java.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,7 @@
956956
protected abstract void addAdditionalSaveData(ValueOutput output);
957957

958958
@Nullable
959-
@@ -2092,11 +_,63 @@
959+
@@ -2092,11 +_,62 @@
960960

961961
@Nullable
962962
public ItemEntity spawnAtLocation(ServerLevel level, ItemStack stack, Vec3 offset) {
@@ -985,6 +985,7 @@
985985
return null;
986986
} else {
987987
- ItemEntity itemEntity = new ItemEntity(level, this.getX() + offset.x, this.getY() + offset.y, this.getZ() + offset.z, stack);
988+
- itemEntity.setDefaultPickUpDelay();
988989
+ // CraftBukkit start - Capture drops for death event
989990
+ if (this instanceof net.minecraft.world.entity.LivingEntity && !this.forceDrops) {
990991
+ // Paper start - Restore vanilla drops behavior
@@ -1001,7 +1002,6 @@
10011002
+ ItemEntity itemEntity = new ItemEntity(level, this.getX() + offset.x, this.getY() + offset.y, this.getZ() + offset.z, stack.copy()); // Paper - copy so we can destroy original
10021003
+ stack.setCount(0); // Paper - destroy this item - if this ever leaks due to game bugs, ensure it doesn't dupe
10031004
+
1004-
itemEntity.setDefaultPickUpDelay();
10051005
+ itemEntity.setDefaultPickUpDelay(); // Paper - diff on change (in dropConsumer)
10061006
+ // Paper start - Call EntityDropItemEvent
10071007
+ return this.spawnAtLocation(level, itemEntity);

paper-server/patches/sources/net/minecraft/world/entity/LivingEntity.java.patch

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@
795795
if (killCredit != null) {
796796
killCredit.awardKillScore(this, damageSource);
797797
}
798-
@@ -1439,68 +_,141 @@
798+
@@ -1439,68 +_,147 @@
799799
}
800800

801801
if (!this.level().isClientSide() && this.hasCustomName()) {
@@ -811,6 +811,9 @@
811811
- if (entity == null || entity.killedEntity(serverLevel, this, damageSource)) {
812812
+ // Paper - move below into if for onKill
813813
+ // Paper start
814+
+ if (entity instanceof net.minecraft.world.entity.monster.Creeper creeper) { // Creeper has logic for drops we need capture
815+
+ creeper.killedEntity((ServerLevel) this.level(), this, damageSource);
816+
+ }
814817
+ org.bukkit.event.entity.EntityDeathEvent deathEvent = this.dropAllDeathLoot(serverLevel, damageSource);
815818
+ if (deathEvent == null || !deathEvent.isCancelled()) {
816819
+ //if (entityliving != null) { // Paper - Fix item duplication and teleport issues; moved to be run earlier in #dropAllDeathLoot before destroying the drop items in CraftEventFactory#callEntityDeathEvent
@@ -842,6 +845,9 @@
842845
+ } else {
843846
+ this.dead = false;
844847
+ this.setHealth((float) deathEvent.getReviveHealth());
848+
+ if (entity instanceof net.minecraft.world.entity.monster.Creeper creeper && creeper.droppedSkulls) { // Creeper has logic for drops skull and need revert that flag
849+
+ creeper.droppedSkulls = false;
850+
+ }
845851
+ }
846852
+ // Paper end
847853
this.createWitherRose(killCredit);

paper-server/patches/sources/net/minecraft/world/entity/monster/Creeper.java.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
@@ -55,6 +_,7 @@
44
public int maxSwell = 30;
55
public int explosionRadius = 3;
6-
private boolean droppedSkulls;
6+
public boolean droppedSkulls;
77
+ public @Nullable Entity entityIgniter; // CraftBukkit
88

99
public Creeper(EntityType<? extends Creeper> type, Level level) {

0 commit comments

Comments
 (0)