SPIGOT-7220: TNT drop rate isn't 100%

This commit is contained in:
md_5 2023-03-04 11:47:05 +11:00
parent e8010dc93f
commit f150cfbd45
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11

View File

@ -109,13 +109,13 @@
+ float yield; + float yield;
+ +
+ if (explode != null) { + if (explode != null) {
+ EntityExplodeEvent event = new EntityExplodeEvent(explode, location, blockList, this.blockInteraction == Explosion.Effect.DESTROY ? 1.0F / this.radius : 1.0F); + EntityExplodeEvent event = new EntityExplodeEvent(explode, location, blockList, this.blockInteraction == Explosion.Effect.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F);
+ this.level.getCraftServer().getPluginManager().callEvent(event); + this.level.getCraftServer().getPluginManager().callEvent(event);
+ cancelled = event.isCancelled(); + cancelled = event.isCancelled();
+ bukkitBlocks = event.blockList(); + bukkitBlocks = event.blockList();
+ yield = event.getYield(); + yield = event.getYield();
+ } else { + } else {
+ BlockExplodeEvent event = new BlockExplodeEvent(location.getBlock(), blockList, this.blockInteraction == Explosion.Effect.DESTROY ? 1.0F / this.radius : 1.0F); + BlockExplodeEvent event = new BlockExplodeEvent(location.getBlock(), blockList, this.blockInteraction == Explosion.Effect.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F);
+ this.level.getCraftServer().getPluginManager().callEvent(event); + this.level.getCraftServer().getPluginManager().callEvent(event);
+ cancelled = event.isCancelled(); + cancelled = event.isCancelled();
+ bukkitBlocks = event.blockList(); + bukkitBlocks = event.blockList();
@ -144,7 +144,7 @@
- if (this.blockInteraction == Explosion.Effect.DESTROY_WITH_DECAY) { - if (this.blockInteraction == Explosion.Effect.DESTROY_WITH_DECAY) {
- loottableinfo_builder.withParameter(LootContextParameters.EXPLOSION_RADIUS, this.radius); - loottableinfo_builder.withParameter(LootContextParameters.EXPLOSION_RADIUS, this.radius);
+ if (this.blockInteraction == Explosion.Effect.DESTROY_WITH_DECAY || yield < 1.0F) { // CraftBukkit - add yield + if (yield < 1.0F) { // CraftBukkit - add yield
+ loottableinfo_builder.withParameter(LootContextParameters.EXPLOSION_RADIUS, 1.0F / yield); // CraftBukkit - add yield + loottableinfo_builder.withParameter(LootContextParameters.EXPLOSION_RADIUS, 1.0F / yield); // CraftBukkit - add yield
} }