protected void onImpact(MovingObjectPosition par1MovingObjectPosition) {
    if (par1MovingObjectPosition.entityHit != null) {
      int i0 = StuffWorthThrowingConfig.rockMinDamage;
      int i1 = StuffWorthThrowingConfig.rockMaxDamage - i0 + 1;
      int i2 = this.rand.nextInt(i1) + i0 + StuffWorthThrowingConfig.brokenBrickStronger;
      int i3 = StuffWorthThrowingConfig.dizzyMultiplier;
      int i4 = StuffWorthThrowingConfig.debuffMultiplier;

      if (!this.worldObj.isRemote && StuffWorthThrowingConfig.itemStatusEffects) {
        EntityLivingBase entityLiving = (EntityLivingBase) par1MovingObjectPosition.entityHit;

        entityLiving.setFire(i2 * i4 / 20);
        if (StuffWorthThrowingConfig.dizzyBricks) {
          entityLiving.addPotionEffect(new PotionEffect(Potion.confusion.getId(), i2 * i3, 0));
        }
      }

      par1MovingObjectPosition.entityHit.attackEntityFrom(
          DamageSource.causeThrownDamage(this, this.getThrower()), (byte) i2);
    }

    for (int i = 0; i < 8; ++i) {
      this.worldObj.spawnParticle("smoke", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
    }

    if (!this.worldObj.isRemote) {
      this.setDead();
    }
  }
  public boolean attackEntityAsMob(Entity par1Entity) {
    if (super.attackEntityAsMob(par1Entity)) {
      ((EntityLivingBase) par1Entity).setFire(6);
    }

    return true;
  }
  /**
   * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack,
   * world, entityPlayer
   */
  public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) {
    world.playSoundAtEntity(entityplayer, "morecreeps:firegem", 1.0F, 1.0F);
    itemstack.damageItem(1, entityplayer);
    entityplayer.swingItem();
    List list =
        world.getEntitiesWithinAABB(
            EntityLivingBase.class,
            new AxisAlignedBB(
                    entityplayer.posX,
                    entityplayer.posY,
                    entityplayer.posZ,
                    entityplayer.posX + 1.0D,
                    entityplayer.posY + 1.0D,
                    entityplayer.posZ + 1.0D)
                .expand(10D, 10D, 10D));

    for (int i = 0; i < list.size(); i++) {
      Entity entity = (Entity) list.get(i);

      if (!(entity instanceof EntityLivingBase)) {
        continue;
      }

      EntityLivingBase entityliving = (EntityLivingBase) entity;

      if ((entityliving instanceof CREEPSEntityHotdog)
          || (entityliving instanceof CREEPSEntityHunchback)
          || (entityliving instanceof EntityPlayer)
          || (entityliving instanceof CREEPSEntityGuineaPig)
          || (entityliving instanceof CREEPSEntityPreacher)) {
        continue;
      }

      if (world.isRemote) {
        for (int j = 0; j < 10; j++) {
          double d = random.nextGaussian() * 0.02D;
          double d1 = random.nextGaussian() * 0.02D;
          double d2 = random.nextGaussian() * 0.02D;
          world.spawnParticle(
              EnumParticleTypes.SMOKE_NORMAL,
              entityliving.posX + (double) (random.nextFloat() * 1.5F),
              entityliving.posY + 0.5D + (double) (random.nextFloat() * 2.5F),
              entityliving.posZ + (double) (random.nextFloat() * 1.5F),
              d,
              d1,
              d2);
        }
      }

      entityliving.attackEntityFrom(DamageSource.inFire, 2F);
      entityliving.motionY += 0.5D;
      entityliving.setFire(15);
    }

    return itemstack;
  }
示例#4
0
  @Override
  public void updateEntity(World world, int x, int y, int z, int meta) {
    super.updateTileEntity();
    int temp = (int) (15 * this.getArraySize() * this.getArrayOverallBrightness());
    for (int i = -3; i <= 3; i++) {
      for (int j = -3; j <= 3; j++) {
        if (ConfigRegistry.BLOCKDAMAGE.getState()) {
          ReikaWorldHelper.temperatureEnvironment(world, x + i, y + 1, z + j, Math.min(temp, 1750));
          if (temp >= 1500) {
            this.delete();
            world.setBlock(x, y, z, Blocks.flowing_lava);
          }
        }
        AxisAlignedBB above =
            AxisAlignedBB.getBoundingBox(x + i, y + 1, z + j, x + i + 1, y + 2, z + j + 1);
        List<EntityLivingBase> in = world.getEntitiesWithinAABB(EntityLivingBase.class, above);
        for (EntityLivingBase e : in) {
          if (temp > 400) e.setFire(3);
        }
      }
    }
    if (world.getBlock(x, y - 1, z) == Blocks.air
        || MachineRegistry.getMachine(world, x, y - 1, z) != this.getMachine()) {
      // ReikaJavaLibrary.pConsole("TOWER: "+this.getTowerHeight()+";  SIZE: "+this.getArraySize());
      this.generatePower(world, x, y, z);
    } else {
      write = null;
    }
    if (world.getBlock(x, y + 1, z) != Blocks.air) return;

    mirrorTimer.update();
    if (mirrorTimer.checkCap()) {
      if (solarBlocks.isEmpty()) {
        lightMultiplier = 0;
        solarBlocks.recursiveAdd(world, x, y, z, this.getTileEntityBlockID());
        numberMirrors = solarBlocks.getSize();
        while (solarBlocks.getSize() > 0) {
          Coordinate c = solarBlocks.getNextAndMoveOn();
          MachineRegistry m = MachineRegistry.getMachine(world, c.xCoord, c.yCoord, c.zCoord);
          if (m == MachineRegistry.MIRROR) {
            TileEntityMirror te =
                (TileEntityMirror) world.getTileEntity(c.xCoord, c.yCoord, c.zCoord);
            te.targetloc = new Coordinate(x, y, z);
            float light = te.getLightLevel();
            lightMultiplier += light;
          } else numberMirrors--;
        }
        lightMultiplier /= 15F;
        lightMultiplier /= numberMirrors;
      }
    }

    if (write != null) {
      this.basicPowerReceiver();
    }
  }
 @Override
 public boolean hitEntity(
     ItemStack itemstack, EntityLivingBase entityliving, EntityLivingBase entityliving1) {
   boolean flag = super.hitEntity(itemstack, entityliving, entityliving1);
   if (flag) {
     entityliving.setFire(
         12 + weapon.getItemRand().nextInt(3)); // TODO add fire instead of set fire
   }
   return flag;
 }
示例#6
0
 public boolean hitEntity(ItemStack item, EntityLivingBase target, EntityLivingBase player) {
   target.addVelocity(0, 1, 0);
   player.addPotionEffect(new PotionEffect(1, 10, 150));
   // EntityLightningBolt lightning = new EntityLightningBolt(target.worldObj, target.posX,
   // target.posY, target.posZ);
   // player.worldObj.addWeatherEffect(lightning);
   // target.worldObj.createExplosion(null, target.posX, target.posY, target.posZ, 4.0f, true);
   target.setFire(4);
   return true;
 }
  @Override
  public void onHit(
      float damage, ItemStack weapon, EntityLivingBase target, EntityLivingBase attacker) {
    if (getMaterial() == ToolMaterialMedieval.DRAGONFORGE) {
      target.setFire(20);
    }

    if (getMaterial() == ToolMaterialMedieval.IGNOTUMITE) {
      attacker.heal(1F);
    }
  }
示例#8
0
 @Override
 public boolean hitEntity(ItemStack itemStack, EntityLivingBase target, EntityLivingBase player) {
   itemStack.damageItem(1, player);
   if (hammerType.equals(EnumHammerType.POGO)) {
     target.motionY = Math.abs(player.motionY) + target.motionY + 0.5;
     player.motionY = 0;
     player.fallDistance = 0;
   } else if (hammerType.equals(EnumHammerType.SCARLET)) target.setFire(50);
   else if (hammerType.equals(EnumHammerType.POPAMATIC))
     target.attackEntityFrom(
         DamageSource.magic,
         (float) (player.worldObj.rand.nextInt(6) + 1) * (player.worldObj.rand.nextInt(6) + 1));
   else if (hammerType.equals(EnumHammerType.FEARNOANVIL)
       && player.worldObj.rand.nextGaussian() > 0.9) // Just a suggestion, keep it if you like it.
   target.addPotionEffect(
         new PotionEffect(
             2, 100, 3)); // Would prefer it being triggered by a critical hit instead, if it can.
   return true;
 }
  @Override
  public boolean hitEntity(
      ItemStack par1ItemStack,
      EntityLivingBase par2EntityLivingBase,
      EntityLivingBase par3EntityLivingBase) {
    if (par1ItemStack.getItem().equals(RioVItems.axeOfAunTun)) {
      par2EntityLivingBase.setFire(30);
    }

    if (par1ItemStack.getItem().equals(RioVItems.swordOfFlame)) {
      par2EntityLivingBase.setFire(10);
    }

    if (par1ItemStack.getItem().equals(RioVItems.daetoriSword)) {
      par2EntityLivingBase.addPotionEffect(new PotionEffect(Potion.wither.id, 100, 3));
    }

    if (par1ItemStack.getItem().equals(RioVItems.alerisSword)) {
      par2EntityLivingBase.motionY = 1;
    }

    if (EnchantmentHelper.getEnchantmentLevel(Enchantments.kanuutu.effectId, par1ItemStack) == 2) {
      par2EntityLivingBase.motionY = 0.8;
    }

    if (EnchantmentHelper.getEnchantmentLevel(Enchantments.kanuutu.effectId, par1ItemStack) == 1) {
      par2EntityLivingBase.motionY = 0.7;
    }

    if (EnchantmentHelper.getEnchantmentLevel(Enchantments.frost.effectId, par1ItemStack) == 2) {
      par2EntityLivingBase.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 4));
    }

    if (EnchantmentHelper.getEnchantmentLevel(Enchantments.frost.effectId, par1ItemStack) == 1) {
      par2EntityLivingBase.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 100, 2));
    }

    if (EnchantmentHelper.getEnchantmentLevel(Enchantments.venom.effectId, par1ItemStack) == 2) {
      par2EntityLivingBase.addPotionEffect(new PotionEffect(Potion.poison.id, 100, 4));
    }

    if (EnchantmentHelper.getEnchantmentLevel(Enchantments.venom.effectId, par1ItemStack) == 1) {
      par2EntityLivingBase.addPotionEffect(new PotionEffect(Potion.poison.id, 100, 2));
    }

    if (EnchantmentHelper.getEnchantmentLevel(Enchantments.confusion.effectId, par1ItemStack)
        == 2) {
      par2EntityLivingBase.addPotionEffect(new PotionEffect(Potion.wither.id, 100, 4));
    }

    if (EnchantmentHelper.getEnchantmentLevel(Enchantments.confusion.effectId, par1ItemStack)
        == 1) {
      par2EntityLivingBase.addPotionEffect(new PotionEffect(Potion.wither.id, 100, 2));
    }

    if (TheMistsOfRioV.getInstance().aether) {
      if (par1ItemStack.getItem().equals(RioVItems.infusedGravititeSword)) {
        if (par3EntityLivingBase != null
            && par3EntityLivingBase instanceof EntityPlayer
            && (par2EntityLivingBase.hurtTime > 0 || par2EntityLivingBase.deathTime > 0)) {
          par2EntityLivingBase.addVelocity(0.0D, 1.0D, 0.0D);
          par1ItemStack.damageItem(1, par3EntityLivingBase);
        }
      }
    }
    par1ItemStack.damageItem(1, par3EntityLivingBase);
    return true;
  }