PaperMC/paper-server/patches/sources/net/minecraft/world/effect/WeavingMobEffect.java.patch
2024-12-14 13:12:42 -08:00

24 lines
1.5 KiB
Diff

--- a/net/minecraft/world/effect/WeavingMobEffect.java
+++ b/net/minecraft/world/effect/WeavingMobEffect.java
@@ -25,11 +_,11 @@
@Override
public void onMobRemoved(ServerLevel level, LivingEntity entity, int amplifier, Entity.RemovalReason reason) {
if (reason == Entity.RemovalReason.KILLED && (entity instanceof Player || level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))) {
- this.spawnCobwebsRandomlyAround(level, entity.getRandom(), entity.blockPosition());
+ this.spawnCobwebsRandomlyAround(level, entity.getRandom(), entity.blockPosition(), entity); // Paper - Fire EntityChangeBlockEvent in more places
}
}
- private void spawnCobwebsRandomlyAround(ServerLevel level, RandomSource random, BlockPos pos) {
+ private void spawnCobwebsRandomlyAround(ServerLevel level, RandomSource random, BlockPos pos, LivingEntity entity) { // Paper - Fire EntityChangeBlockEvent in more places
Set<BlockPos> set = Sets.newHashSet();
int i = this.maxCobwebs.applyAsInt(random);
@@ -46,6 +_,7 @@
}
for (BlockPos blockPosx : set) {
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entity, blockPosx, Blocks.COBWEB.defaultBlockState())) continue; // Paper - Fire EntityChangeBlockEvent in more places
level.setBlock(blockPosx, Blocks.COBWEB.defaultBlockState(), 3);
level.levelEvent(3018, blockPosx, 0);
}