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

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2023-03-04 11:47:05 +11:00
parent b6f6246c5d
commit 7bf6f20cec

View File

@ -109,13 +109,13 @@
+ float yield;
+
+ 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);
+ cancelled = event.isCancelled();
+ bukkitBlocks = event.blockList();
+ yield = event.getYield();
+ } 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);
+ cancelled = event.isCancelled();
+ bukkitBlocks = event.blockList();
@ -144,7 +144,7 @@
- if (this.blockInteraction == Explosion.Effect.DESTROY_WITH_DECAY) {
- 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
}