@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/Explosion.java
|
||||
+++ b/net/minecraft/world/level/Explosion.java
|
||||
@@ -42,6 +42,15 @@
|
||||
@@ -40,6 +40,15 @@
|
||||
import net.minecraft.world.phys.MovingObjectPosition;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@@ -16,15 +16,15 @@
|
||||
public class Explosion {
|
||||
|
||||
private static final ExplosionDamageCalculator EXPLOSION_DAMAGE_CALCULATOR = new ExplosionDamageCalculator();
|
||||
@@ -60,6 +69,7 @@
|
||||
@@ -58,6 +67,7 @@
|
||||
private final ExplosionDamageCalculator damageCalculator;
|
||||
private final List<BlockPosition> toBlow;
|
||||
private final ObjectArrayList<BlockPosition> toBlow;
|
||||
private final Map<EntityHuman, Vec3D> hitPlayers;
|
||||
+ public boolean wasCanceled = false; // CraftBukkit - add field
|
||||
|
||||
public Explosion(World world, @Nullable Entity entity, double d0, double d1, double d2, float f) {
|
||||
this(world, entity, d0, d1, d2, f, false, Explosion.Effect.DESTROY);
|
||||
@@ -84,7 +94,7 @@
|
||||
@@ -82,7 +92,7 @@
|
||||
this.hitPlayers = Maps.newHashMap();
|
||||
this.level = world;
|
||||
this.source = entity;
|
||||
@@ -33,7 +33,7 @@
|
||||
this.x = d0;
|
||||
this.y = d1;
|
||||
this.z = d2;
|
||||
@@ -134,6 +144,11 @@
|
||||
@@ -132,6 +142,11 @@
|
||||
}
|
||||
|
||||
public void explode() {
|
||||
@@ -42,10 +42,10 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.level.gameEvent(this.source, GameEvent.EXPLODE, new BlockPosition(this.x, this.y, this.z));
|
||||
this.level.gameEvent(this.source, GameEvent.EXPLODE, new Vec3D(this.x, this.y, this.z));
|
||||
Set<BlockPosition> set = Sets.newHashSet();
|
||||
boolean flag = true;
|
||||
@@ -217,7 +232,35 @@
|
||||
@@ -215,7 +230,35 @@
|
||||
double d12 = (double) getSeenPercent(vec3d, entity);
|
||||
double d13 = (1.0D - d7) * d12;
|
||||
|
||||
@@ -82,16 +82,16 @@
|
||||
double d14 = d13;
|
||||
|
||||
if (entity instanceof EntityLiving) {
|
||||
@@ -259,6 +302,51 @@
|
||||
@@ -258,6 +301,51 @@
|
||||
|
||||
Collections.shuffle(this.toBlow, this.level.random);
|
||||
Iterator iterator = this.toBlow.iterator();
|
||||
SystemUtils.shuffle(this.toBlow, this.level.random);
|
||||
ObjectListIterator objectlistiterator = this.toBlow.iterator();
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.World bworld = this.level.getWorld();
|
||||
+ org.bukkit.entity.Entity explode = this.source == null ? null : this.source.getBukkitEntity();
|
||||
+ Location location = new Location(bworld, this.x, this.y, this.z);
|
||||
+
|
||||
+ List<org.bukkit.block.Block> blockList = Lists.newArrayList();
|
||||
+ List<org.bukkit.block.Block> blockList = new ObjectArrayList<>();
|
||||
+ for (int i1 = this.toBlow.size() - 1; i1 >= 0; i1--) {
|
||||
+ BlockPosition cpos = (BlockPosition) this.toBlow.get(i1);
|
||||
+ org.bukkit.block.Block bblock = bworld.getBlockAt(cpos.getX(), cpos.getY(), cpos.getZ());
|
||||
@@ -130,23 +130,23 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ iterator = this.toBlow.iterator();
|
||||
+ objectlistiterator = this.toBlow.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
BlockPosition blockposition = (BlockPosition) iterator.next();
|
||||
@@ -273,8 +361,8 @@
|
||||
TileEntity tileentity = iblockdata.hasBlockEntity() ? this.level.getBlockEntity(blockposition) : null;
|
||||
LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.level)).withRandom(this.level.random).withParameter(LootContextParameters.ORIGIN, Vec3D.atCenterOf(blockposition)).withParameter(LootContextParameters.TOOL, ItemStack.EMPTY).withOptionalParameter(LootContextParameters.BLOCK_ENTITY, tileentity).withOptionalParameter(LootContextParameters.THIS_ENTITY, this.source);
|
||||
while (objectlistiterator.hasNext()) {
|
||||
BlockPosition blockposition = (BlockPosition) objectlistiterator.next();
|
||||
@@ -276,8 +364,8 @@
|
||||
TileEntity tileentity = iblockdata.hasBlockEntity() ? this.level.getBlockEntity(blockposition) : null;
|
||||
LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder(worldserver)).withRandom(this.level.random).withParameter(LootContextParameters.ORIGIN, Vec3D.atCenterOf(blockposition)).withParameter(LootContextParameters.TOOL, ItemStack.EMPTY).withOptionalParameter(LootContextParameters.BLOCK_ENTITY, tileentity).withOptionalParameter(LootContextParameters.THIS_ENTITY, this.source);
|
||||
|
||||
- if (this.blockInteraction == Explosion.Effect.DESTROY) {
|
||||
- loottableinfo_builder.withParameter(LootContextParameters.EXPLOSION_RADIUS, this.radius);
|
||||
+ if (this.blockInteraction == Explosion.Effect.DESTROY || yield < 1.0F) { // CraftBukkit - add yield
|
||||
+ loottableinfo_builder.withParameter(LootContextParameters.EXPLOSION_RADIUS, 1.0F / yield); // CraftBukkit - add yield
|
||||
}
|
||||
- if (this.blockInteraction == Explosion.Effect.DESTROY) {
|
||||
- loottableinfo_builder.withParameter(LootContextParameters.EXPLOSION_RADIUS, this.radius);
|
||||
+ if (this.blockInteraction == Explosion.Effect.DESTROY || yield < 1.0F) { // CraftBukkit - add yield
|
||||
+ loottableinfo_builder.withParameter(LootContextParameters.EXPLOSION_RADIUS, 1.0F / yield); // CraftBukkit - add yield
|
||||
}
|
||||
|
||||
iblockdata.getDrops(loottableinfo_builder).forEach((itemstack) -> {
|
||||
@@ -304,7 +392,11 @@
|
||||
BlockPosition blockposition2 = (BlockPosition) iterator1.next();
|
||||
iblockdata.spawnAfterBreak(worldserver, blockposition, ItemStack.EMPTY, flag2);
|
||||
@@ -309,7 +397,11 @@
|
||||
BlockPosition blockposition2 = (BlockPosition) objectlistiterator1.next();
|
||||
|
||||
if (this.random.nextInt(3) == 0 && this.level.getBlockState(blockposition2).isAir() && this.level.getBlockState(blockposition2.below()).isSolidRender(this.level, blockposition2.below())) {
|
||||
- this.level.setBlockAndUpdate(blockposition2, BlockFireAbstract.getState(this.level, blockposition2));
|
||||
@@ -158,7 +158,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -312,6 +404,7 @@
|
||||
@@ -317,6 +409,7 @@
|
||||
}
|
||||
|
||||
private static void addBlockDrops(ObjectArrayList<Pair<ItemStack, BlockPosition>> objectarraylist, ItemStack itemstack, BlockPosition blockposition) {
|
||||
|
||||
Reference in New Issue
Block a user