use of org.spongepowered.common.event.damage.MinecraftBlockDamageSource in project SpongeCommon by SpongePowered.
the class MixinEntity method preSetOnFire.
@Inject(method = "setOnFireFromLava()V", at = @At(value = "FIELD", target = LAVA_DAMAGESOURCE_FIELD, opcode = Opcodes.GETSTATIC))
public // setOnFireFromLava
void preSetOnFire(CallbackInfo callbackInfo) {
if (!this.world.isRemote) {
this.originalLava = DamageSource.LAVA;
AxisAlignedBB bb = this.getEntityBoundingBox().grow(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D);
Location<World> location = DamageEventHandler.findFirstMatchingBlock((net.minecraft.entity.Entity) (Object) this, bb, block -> block.getMaterial() == Material.LAVA);
DamageSource.LAVA = new MinecraftBlockDamageSource("lava", location).setFireDamage();
}
}
use of org.spongepowered.common.event.damage.MinecraftBlockDamageSource in project SpongeCommon by SpongePowered.
the class MixinBlockCactus method preSetOnFire.
@Inject(method = "onEntityCollidedWithBlock", at = @At(value = "FIELD", target = CACTUS_DAMAGE_FIELD, opcode = Opcodes.GETSTATIC))
public void preSetOnFire(net.minecraft.world.World worldIn, BlockPos pos, IBlockState state, Entity entityIn, CallbackInfo callbackInfo) {
if (!worldIn.isRemote) {
this.originalCactus = DamageSource.CACTUS;
Location<World> location = new Location<>((World) worldIn, pos.getX(), pos.getY(), pos.getZ());
DamageSource.CACTUS = new MinecraftBlockDamageSource("cactus", location);
}
}
use of org.spongepowered.common.event.damage.MinecraftBlockDamageSource in project SpongeCommon by SpongePowered.
the class MixinEntity method preFire.
@Inject(method = "dealFireDamage", at = @At(value = "FIELD", target = FIRE_DAMAGESOURCE_FIELD, opcode = Opcodes.GETSTATIC))
public void preFire(CallbackInfo callbackInfo) {
// Sponge Start - Find the fire block!
if (!this.world.isRemote) {
this.originalInFire = DamageSource.IN_FIRE;
AxisAlignedBB bb = this.getEntityBoundingBox().grow(-0.001D, -0.001D, -0.001D);
Location<World> location = DamageEventHandler.findFirstMatchingBlock((net.minecraft.entity.Entity) (Object) this, bb, block -> block.getBlock() == Blocks.FIRE || block.getBlock() == Blocks.FLOWING_LAVA || block.getBlock() == Blocks.LAVA);
DamageSource.IN_FIRE = new MinecraftBlockDamageSource("inFire", location).setFireDamage();
}
}
Aggregations