Пример #1
0
  @Override
  public ItemStack onItemRightClick(
      ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
    PropertyDoom doom = PropertyDoom.get(par3EntityPlayer);

    Vec3 vec = WorldHelper.getVecFromEntity(par3EntityPlayer);
    if (vec == null) return par1ItemStack;

    if (doom != null && !par2World.isRemote && getStackCooldown(par1ItemStack) == 0) {
      double d4 = vec.xCoord - par3EntityPlayer.posX;
      double d5 = vec.yCoord - (par3EntityPlayer.posY + par3EntityPlayer.height / 2.0F);
      double d6 = vec.zCoord - par3EntityPlayer.posZ;

      if (!par3EntityPlayer.isSneaking()) {
        if (canUseAbility(doom, TragicConfig.doomAbilityCost[35]) && TragicConfig.doomAbility[35]) {
          if (!par3EntityPlayer.capabilities.isCreativeMode)
            doom.increaseDoom(-TragicConfig.doomAbilityCost[35]);
          setStackCooldown(par1ItemStack, 5);

          EntityWitherSkull skull = new EntityWitherSkull(par2World, par3EntityPlayer, d4, d5, d6);
          skull.posY += par3EntityPlayer.getEyeHeight();
          par2World.spawnEntityInWorld(skull);
          return par1ItemStack;
        }
      } else {
        if (canUseAbility(doom, TragicConfig.doomAbilityCost[36]) && TragicConfig.doomAbility[36]) {
          if (!par3EntityPlayer.capabilities.isCreativeMode)
            doom.increaseDoom(-TragicConfig.doomAbilityCost[36]);
          setStackCooldown(par1ItemStack, 5);

          EntityWitherSkull skull = new EntityWitherSkull(par2World, par3EntityPlayer, d4, d5, d6);
          skull.posY += par3EntityPlayer.getEyeHeight();
          skull.setInvulnerable(true);
          par2World.spawnEntityInWorld(skull);
          return par1ItemStack;
        }
      }
    }

    return par1ItemStack;
  }
Пример #2
0
  private void func_82209_a(
      int p_82209_1_, double p_82209_2_, double p_82209_4_, double p_82209_6_, boolean p_82209_8_) {
    this.worldObj.playAuxSFXAtEntity(
        (EntityPlayer) null, 1014, (int) this.posX, (int) this.posY, (int) this.posZ, 0);
    double d3 = this.func_82214_u(p_82209_1_);
    double d4 = this.func_82208_v(p_82209_1_);
    double d5 = this.func_82213_w(p_82209_1_);
    double d6 = p_82209_2_ - d3;
    double d7 = p_82209_4_ - d4;
    double d8 = p_82209_6_ - d5;
    EntityWitherSkull entitywitherskull = new EntityWitherSkull(this.worldObj, this, d6, d7, d8);

    if (p_82209_8_) {
      entitywitherskull.setInvulnerable(true);
    }

    entitywitherskull.posY = d4;
    entitywitherskull.posX = d3;
    entitywitherskull.posZ = d5;
    this.worldObj.spawnEntityInWorld(entitywitherskull);
  }