3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 20:40:07 +01:00

SPIGOT-5155: Setting EntityExplodeEvent yield to 0 still causes blocks to drop

Dieser Commit ist enthalten in:
md_5 2019-07-09 10:10:36 +10:00
Ursprung 087a2cf4db
Commit 608609835d

Datei anzeigen

@ -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
}