mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 06:50:12 +01:00
SPIGOT-5155: Setting EntityExplodeEvent yield to 0 still causes blocks to drop
This commit is contained in:
parent
087a2cf4db
commit
608609835d
1 changed files with 6 additions and 4 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue