Example #1
0
  public static void effect(TileTotemIntelligence totem, int i, int upgrades) {
    if (totem.worldObj.getWorldTime() % 40L == 0L) {
      if (EntityUtil.getEntitiesInRange(
              totem.worldObj,
              totem.xCoord,
              totem.yCoord,
              totem.zCoord,
              10 + (upgrades * 5),
              10 + (upgrades * 5))
          != null) {
        for (Entity entityArea :
            EntityUtil.getEntitiesInRange(
                totem.worldObj, totem.xCoord, totem.yCoord, totem.zCoord, 10, 10)) {
          if (entityArea instanceof EntityPlayer) {
            ((EntityPlayer) entityArea).posY += 20;
            ((EntityPlayer) entityArea).setPosition(totem.xCoord, totem.yCoord + 10, totem.zCoord);

            ((EntityPlayer) entityArea).capabilities.allowFlying = true;

            totem.worldObj.updateEntity(entityArea);

            // ((EntityPlayer) entityArea).capabilities.setFlySpeed(10);

            // System.out.println(":P");

            totem.decreaseChlorophyll(TotemUtil.decrementAmount(i));
          }
        }
      }
    }
  }
Example #2
0
  public static void effect(TileTotemIntelligence totem, int i, int upgrades) {
    if (totem.worldObj.getWorldTime() % 80L == 0) {
      if (EntityUtil.getEntitiesInRange(
              totem.worldObj,
              totem.xCoord,
              totem.yCoord,
              totem.zCoord,
              10 + (upgrades * 5),
              10 + (upgrades * 5))
          != null) {
        for (Entity entity :
            EntityUtil.getEntitiesInRange(
                totem.worldObj,
                totem.xCoord,
                totem.yCoord,
                totem.zCoord,
                10 + (upgrades * 5),
                10 + (upgrades * 5))) {
          if (entity instanceof EntityPlayer) {
            if (entity.isBurning()) {
              Random rand = new Random();
              ((EntityPlayer) entity).heal(4 + rand.nextInt(4));
            }

            ((EntityPlayer) entity)
                .addPotionEffect(new PotionEffect(Potion.fireResistance.id, 200, 0));

            totem.decreaseChlorophyll(TotemUtil.decrementAmount(i));
          }
        }
      }
    }
  }