Search in sources :

Example 1 with MinecraftFallingBlockDamageSource

use of org.spongepowered.common.event.damage.MinecraftFallingBlockDamageSource in project SpongeCommon by SpongePowered.

the class MixinEntityFallingBlock method beforeFall.

@Inject(method = "fall(FF)V", at = @At(value = "JUMP", opcode = Opcodes.IFEQ, ordinal = 1))
public void beforeFall(float distance, float damageMultipleier, CallbackInfo callbackInfo) {
    this.isAnvil = this.fallTile.getBlock() == Blocks.ANVIL;
    this.original = this.isAnvil ? DamageSource.ANVIL : DamageSource.FALLING_BLOCK;
    if (this.isAnvil) {
        DamageSource.ANVIL = new MinecraftFallingBlockDamageSource("anvil", (EntityFallingBlock) (Object) this);
    } else {
        DamageSource.FALLING_BLOCK = new MinecraftFallingBlockDamageSource("fallingblock", (EntityFallingBlock) (Object) this);
    }
}
Also used : EntityFallingBlock(net.minecraft.entity.item.EntityFallingBlock) MinecraftFallingBlockDamageSource(org.spongepowered.common.event.damage.MinecraftFallingBlockDamageSource) Inject(org.spongepowered.asm.mixin.injection.Inject)

Aggregations

EntityFallingBlock (net.minecraft.entity.item.EntityFallingBlock)1 Inject (org.spongepowered.asm.mixin.injection.Inject)1 MinecraftFallingBlockDamageSource (org.spongepowered.common.event.damage.MinecraftFallingBlockDamageSource)1