From 608609835d7a8498a2fdd942ad6efc58f9a57f08 Mon Sep 17 00:00:00 2001 From: md_5 Date: Tue, 9 Jul 2019 10:10:36 +1000 Subject: [PATCH] SPIGOT-5155: Setting EntityExplodeEvent yield to 0 still causes blocks to drop --- nms-patches/Explosion.patch | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/nms-patches/Explosion.patch b/nms-patches/Explosion.patch index b166c928cb..c15369bfaf 100644 --- a/nms-patches/Explosion.patch +++ b/nms-patches/Explosion.patch @@ -90,13 +90,13 @@ + float yield; + + if (explode != null) { -+ EntityExplodeEvent event = new EntityExplodeEvent(explode, location, blockList, 1.0F / this.size); ++ EntityExplodeEvent event = new EntityExplodeEvent(explode, location, blockList, this.b == Explosion.Effect.DESTROY ? 1.0F / this.size : 1.0F); + this.world.getServer().getPluginManager().callEvent(event); + cancelled = event.isCancelled(); + bukkitBlocks = event.blockList(); + yield = event.getYield(); + } else { -+ BlockExplodeEvent event = new BlockExplodeEvent(location.getBlock(), blockList, 1.0F / this.size); ++ BlockExplodeEvent event = new BlockExplodeEvent(location.getBlock(), blockList, this.b == Explosion.Effect.DESTROY ? 1.0F / this.size : 1.0F); + this.world.getServer().getPluginManager().callEvent(event); + cancelled = event.isCancelled(); + bukkitBlocks = event.blockList(); @@ -118,11 +118,13 @@ iterator = this.blocks.iterator(); while (iterator.hasNext()) { -@@ -226,7 +292,7 @@ +@@ -225,8 +291,8 @@ + TileEntity tileentity = block.isTileEntity() ? this.world.getTileEntity(blockposition) : null; LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.world)).a(this.world.random).set(LootContextParameters.POSITION, blockposition).set(LootContextParameters.TOOL, ItemStack.a).setOptional(LootContextParameters.BLOCK_ENTITY, tileentity); - if (this.b == Explosion.Effect.DESTROY) { +- if (this.b == Explosion.Effect.DESTROY) { - loottableinfo_builder.set(LootContextParameters.EXPLOSION_RADIUS, this.size); ++ if (this.b == Explosion.Effect.DESTROY || yield < 1.0F) { // CraftBukkit - add yield + loottableinfo_builder.set(LootContextParameters.EXPLOSION_RADIUS, 1.0F / yield); // CraftBukkit - add yield }