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));
          }
        }
      }
    }
  }
Example #3
0
 public static void breakStuffs(int x, int y, int z, World world) {
   if (!world.isRemote) {
     if (world.getTileEntity(x, y, z) instanceof TileWindChime) {
       if (!world.isAirBlock(x, y - 1, z) || world.isAirBlock(x, y + 1, z)) {
         world.setBlockToAir(x, y, z);
         EntityUtil.spawnEntityInWorld(world, x, y, z, new ItemStack(ModBlocks.windChime, 1, 0));
       }
     }
   }
 }