コード例 #1
0
  @Override
  public void onEntityCollidedWithBlock(
      World par1World, BlockPos pos, IBlockState state, Entity par5Entity) {
    super.onEntityCollidedWithBlock(par1World, pos, state, par5Entity);

    if (par5Entity instanceof EntityLivingBase
        && !EntityUtil.isEntityCoralium((EntityLivingBase) par5Entity)
        && ((EntityLivingBase) par5Entity).getActivePotionEffect(AbyssalCraftAPI.coralium_plague)
            == null)
      ((EntityLivingBase) par5Entity)
          .addPotionEffect(new PotionEffect(AbyssalCraftAPI.coralium_plague, 200));
  }
コード例 #2
0
  @Override
  public void afterHit(
      ItemStack tool,
      EntityLivingBase player,
      EntityLivingBase target,
      float damageDealt,
      boolean wasCritical,
      boolean wasHit) {

    if (wasCritical && wasHit)
      if (!EntityUtil.isEntityCoralium(target))
        target.addPotionEffect(new PotionEffect(AbyssalCraftAPI.coralium_plague, 100));
  }