Exemplo n.º 1
0
 public void updateTick(World world, int i, int j, int k, Random random) {
   if (world.isRemote) {
     return;
   }
   if (world.getBlockLightValue(i, j + 1, k) < 4
       && Block.lightOpacity[world.getBlockId(i, j + 1, k)] > 2) {
     world.setBlockWithNotify(i, j, k, Block.dirt.blockID);
   } else if (world.getBlockLightValue(i, j + 1, k) >= 9) {
     for (int l = 0; l < 4; l++) {
       int i1 = (i + random.nextInt(3)) - 1;
       int j1 = (j + random.nextInt(5)) - 3;
       int k1 = (k + random.nextInt(3)) - 1;
       int l1 = world.getBlockId(i1, j1 + 1, k1);
       if (world.getBlockId(i1, j1, k1) == Block.dirt.blockID
           && world.getBlockLightValue(i1, j1 + 1, k1) >= 4
           && Block.lightOpacity[l1] <= 2) {
         if (blockID == ZooDirts.savannah.blockID) {
           world.setBlockWithNotify(i1, j1, k1, ZooDirts.savannah.blockID);
         }
         if (blockID == ZooDirts.tropical.blockID) {
           world.setBlockWithNotify(i1, j1, k1, ZooDirts.tropical.blockID);
         }
         if (blockID == ZooDirts.coniferous.blockID) {
           world.setBlockWithNotify(i1, j1, k1, ZooDirts.coniferous.blockID);
         }
         if (blockID == ZooDirts.deciduous.blockID) {
           world.setBlockWithNotify(i1, j1, k1, ZooDirts.deciduous.blockID);
         }
       }
     }
   }
 }
 @Override
 public void onNeighborBlockChange(World world, int i, int j, int k, int l) {
   if (l > 0
       && Block.blocksList[l].canProvidePower()
       && world.isBlockIndirectlyGettingPowered(i, j, k)
       && world.getBlockMetadata(i, j, k) != 12
       && world.getBlockMetadata(i, j, k) != 0
       && world.getBlockMetadata(i, j, k) != 15) {
     onBlockDestroyedByExplosion(world, i, j, k);
     world.setBlockWithNotify(i, j, k, 0);
   }
 }
  @Override
  public void onBlockAdded(World world, int i, int j, int k) {
    super.onBlockAdded(world, i, j, k);

    if (world.isBlockIndirectlyGettingPowered(i, j, k)
        && world.getBlockMetadata(i, j, k) != 12
        && world.getBlockMetadata(i, j, k) != 0
        && world.getBlockMetadata(i, j, k) != 15) {
      onBlockDestroyedByExplosion(world, i, j, k);
      world.setBlockWithNotify(i, j, k, 0);
    }
  }
  @Override
  public boolean blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer) {
    int arg = world.getBlockMetadata(i, j, k);

    if (entityplayer != null
        && entityplayer.getCurrentEquippedItem() != null
        && (entityplayer.getCurrentEquippedItem().itemID == Ic2Items.wrench.itemID
            || entityplayer.getCurrentEquippedItem().itemID == Ic2Items.electricWrench.itemID)) {
      this.dropBlockAsItem(world, i, j, k, arg, 1);
      world.setBlockWithNotify(i, j, k, 0);
      world.setBlockWithNotify(i, j + 1, k, 0);
      return false;
    }

    if (arg == 12 || arg == 15 || arg == 0) {
      TileEntityMissile titty = (TileEntityMissile) world.getBlockTileEntity(i, j, k);
      titty.launch(entityplayer);
    }

    return false;
  }
  public ItemStack fillCustomBucket(World w, int i, int j, int k) {
    if (w.getBlockId(i, j, k) == Zoo.saltwaterStill.blockID
        || w.getBlockId(i, j, k) == Zoo.saltwaterMoving.blockID) {
      w.setBlockWithNotify(i, j, k, 0);

      EntityPlayer player = ModLoader.getMinecraftInstance().thePlayer;
      if (!player.capabilities.isCreativeMode) {
        return new ItemStack(this);
      }
    }

    return null;
  }
 @Override
 public void onBlockPlaced(World world, int i, int j, int k, int l) {
   world.setBlockWithNotify(i, j + 1, k, mod_RocketScience.blockWarheadId);
   world.setBlockMetadata(i, j + 1, k, world.getBlockMetadata(i, j, k));
 }