#1390: Improve internal handling of damage sources
By: Doc <nachito94@msn.com>
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
|
||||
public static DamageSource getDefaultDamageSource(World world, @Nullable Entity entity) {
|
||||
return world.damageSources().explosion(entity, getIndirectSourceEntityInternal(entity));
|
||||
@@ -86,17 +100,18 @@
|
||||
@@ -86,7 +100,7 @@
|
||||
this.hitPlayers = Maps.newHashMap();
|
||||
this.level = world;
|
||||
this.source = entity;
|
||||
@@ -37,11 +37,7 @@
|
||||
this.x = d0;
|
||||
this.y = d1;
|
||||
this.z = d2;
|
||||
this.fire = flag;
|
||||
this.blockInteraction = explosion_effect;
|
||||
- this.damageSource = damagesource == null ? world.damageSources().explosion(this) : damagesource;
|
||||
+ this.damageSource = damagesource == null ? world.damageSources().explosion(this).customCausingEntity(entity) : damagesource.customCausingEntity(entity); // CraftBukkit - handle source entity
|
||||
this.damageCalculator = explosiondamagecalculator == null ? this.makeDamageCalculator(entity) : explosiondamagecalculator;
|
||||
@@ -97,6 +111,7 @@
|
||||
this.smallExplosionParticles = particleparam;
|
||||
this.largeExplosionParticles = particleparam1;
|
||||
this.explosionSound = holder;
|
||||
@@ -144,7 +140,7 @@
|
||||
+ this.yield = event.getYield();
|
||||
+ } else {
|
||||
+ org.bukkit.block.Block block = location.getBlock();
|
||||
+ org.bukkit.block.BlockState blockState = (damageSource.blockState != null) ? damageSource.blockState : block.getState();
|
||||
+ org.bukkit.block.BlockState blockState = (damageSource.getDirectBlockState() != null) ? damageSource.getDirectBlockState() : block.getState();
|
||||
+ BlockExplodeEvent event = new BlockExplodeEvent(block, blockState, blockList, this.yield);
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ this.wasCanceled = event.isCancelled();
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
if (entityhuman_enumbedresult.getMessage() != null) {
|
||||
entityhuman.displayClientMessage(entityhuman_enumbedresult.getMessage(), true);
|
||||
}
|
||||
@@ -123,8 +133,29 @@
|
||||
@@ -123,8 +133,30 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
+ private EnumInteractionResult explodeBed(IBlockData iblockdata, World world, BlockPosition blockposition) {
|
||||
+ {
|
||||
+ {
|
||||
+ org.bukkit.block.BlockState blockState = org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition).getState(); // CraftBukkit - capture BlockState before remove block
|
||||
+ world.removeBlock(blockposition, false);
|
||||
+ BlockPosition blockposition1 = blockposition.relative(((EnumDirection) iblockdata.getValue(BlockBed.FACING)).getOpposite());
|
||||
+
|
||||
@@ -44,7 +45,7 @@
|
||||
+
|
||||
+ Vec3D vec3d = blockposition.getCenter();
|
||||
+
|
||||
+ world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d, world, iblockdata, blockposition), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, World.a.BLOCK); // CraftBukkit - add state
|
||||
+ world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d, blockState), (ExplosionDamageCalculator) null, vec3d, 5.0F, true, World.a.BLOCK); // CraftBukkit - add state
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ }
|
||||
@@ -58,7 +59,7 @@
|
||||
}
|
||||
|
||||
private boolean kickVillagerOutOfBed(World world, BlockPosition blockposition) {
|
||||
@@ -323,6 +354,11 @@
|
||||
@@ -323,6 +355,11 @@
|
||||
BlockPosition blockposition1 = blockposition.relative((EnumDirection) iblockdata.getValue(BlockBed.FACING));
|
||||
|
||||
world.setBlock(blockposition1, (IBlockData) iblockdata.setValue(BlockBed.PART, BlockPropertyBedPart.HEAD), 3);
|
||||
|
||||
@@ -9,9 +9,11 @@
|
||||
world.playSound((EntityHuman) null, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, SoundEffects.RESPAWN_ANCHOR_SET_SPAWN, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
}
|
||||
@@ -129,14 +129,14 @@
|
||||
@@ -128,15 +128,16 @@
|
||||
}
|
||||
|
||||
private void explode(IBlockData iblockdata, World world, final BlockPosition blockposition) {
|
||||
+ org.bukkit.block.BlockState blockState = org.bukkit.craftbukkit.block.CraftBlock.at(world, blockposition).getState(); // CraftBukkit - capture BlockState before remove block
|
||||
world.removeBlock(blockposition, false);
|
||||
- Stream stream = EnumDirection.EnumDirectionLimit.HORIZONTAL.stream();
|
||||
+ Stream<EnumDirection> stream = EnumDirection.EnumDirectionLimit.HORIZONTAL.stream(); // CraftBukkit - decompile error
|
||||
@@ -26,12 +28,12 @@
|
||||
@Override
|
||||
public Optional<Float> getBlockExplosionResistance(Explosion explosion, IBlockAccess iblockaccess, BlockPosition blockposition1, IBlockData iblockdata1, Fluid fluid) {
|
||||
return blockposition1.equals(blockposition) && flag1 ? Optional.of(Blocks.WATER.getExplosionResistance()) : super.getBlockExplosionResistance(explosion, iblockaccess, blockposition1, iblockdata1, fluid);
|
||||
@@ -144,7 +144,7 @@
|
||||
@@ -144,7 +145,7 @@
|
||||
};
|
||||
Vec3D vec3d = blockposition.getCenter();
|
||||
|
||||
- world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d), explosiondamagecalculator, vec3d, 5.0F, true, World.a.BLOCK);
|
||||
+ world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d, world, iblockdata, blockposition), explosiondamagecalculator, vec3d, 5.0F, true, World.a.BLOCK); // CraftBukkit - add state
|
||||
+ world.explode((Entity) null, world.damageSources().badRespawnPointExplosion(vec3d, blockState), explosiondamagecalculator, vec3d, 5.0F, true, World.a.BLOCK); // CraftBukkit - add state
|
||||
}
|
||||
|
||||
public static boolean canSetSpawn(World world) {
|
||||
|
||||
Reference in New Issue
Block a user