Exemplo n.º 1
0
  @Override
  protected void onRandomUpdate(World world, int x, int y, int z, Random r) {
    /*
    if (r.nextInt(20) == 0)
    	this.dropDye(world, x, y, z, 0);

    if (!world.isRemote && r.nextInt(400) == 0 && DyeOptions.RAINBOWSPREAD.getState()) {
    	int rx = ReikaRandomHelper.getRandomPlusMinus(x, 32);
    	int rz = ReikaRandomHelper.getRandomPlusMinus(z, 32);
    	ReikaWorldHelper.setBiomeForXZ(world, rx, rz, DyeTrees.forest);
    	ReikaJavaLibrary.pConsole(rx+", "+rz);
    	for (int i = 0; i < 256; i++) {
    		ReikaWorldHelper.temperatureEnvironment(world, rx, i, rz, ReikaWorldHelper.getBiomeTemp(DyeTrees.forest));
    		world.markBlockForRenderUpdate(rx, i, rz);
    		world.markBlockForUpdate(rx, i, rz);
    	}
    }*/

    if (!world.isRemote) {
      if (ModList.THAUMCRAFT.isLoaded()) {
        if (rand.nextInt(25) == 0) this.fightTaint(world, x, y, z);
        if (rand.nextInt(20) == 0) this.fightEerie(world, x, y, z);
        if (rand.nextInt(10) == 0) this.convertPureNodeMagic(world, x, y, z);
      }
      if (ModList.MYSTCRAFT.isLoaded() && ReikaMystcraftHelper.isMystAge(world)) {
        if (rand.nextInt(20) == 0) this.fightInstability(world, x, y, z);
        if (rand.nextInt(10) == 0) this.fightDecay(world, x, y, z);
      }
      if (DyeOptions.RAINBOWSPREAD.getState() && rand.nextInt(50) == 0)
        this.convertToRainbowForest(world, x, y, z);
    }
  }
 private boolean isValid(ItemStack is) {
   if (ReikaItemHelper.isBlock(is)) return true;
   if (ModList.IC2.isLoaded() && IC2Handler.IC2Stacks.SCRAPBOX.match(is)) return true;
   if (is.getItem().getClass() == lootBagClass) return true;
   if (ModList.MYSTCRAFT.isLoaded() && is.getItem() == MystCraftHandler.getInstance().folderID) {
     return true;
   }
   return false;
 }
 private boolean generateIn(World world, boolean ore) {
   if (world.provider.dimensionId == ExtraChromaIDs.DIMID.getValue()) return true;
   if (ModList.MYSTCRAFT.isLoaded() && ReikaMystcraftHelper.isMystAge(world)) {
     if (ore
         ? !MystPages.Pages.ORES.existsInWorld(world)
         : !MystPages.Pages.PLANTS.existsInWorld(world)) {
       return false;
     }
   }
   return (world.getWorldInfo().getTerrainType() != WorldType.FLAT
           || ChromaOptions.FLATGEN.getState())
       && !world.provider.hasNoSky;
 }
 private void processItem(World world, int x, int y, int z) {
   if (ReikaItemHelper.isBlock(inv[0])) {
     Block b = Block.getBlockFromItem(inv[0].getItem());
     ArrayList<ItemStack> li =
         b.getDrops(
             world, x, y, z, inv[0].getItemDamage(), this.getEnchantment(Enchantment.fortune));
     li = ReikaItemHelper.collateItemList(li);
     if (!li.isEmpty()) {
       inv[1] = li.remove(0);
       overflow.addAll(li);
     }
   } else if (ModList.IC2.isLoaded() && IC2Handler.IC2Stacks.SCRAPBOX.match(inv[0])) {
     inv[1] = Recipes.scrapboxDrops.getDrop(inv[0], false);
   } else if (ModList.MYSTCRAFT.isLoaded()
       && inv[0].getItem() == MystCraftHandler.getInstance().folderID) {
     List<ItemStack> li = ReikaMystcraftHelper.getPagesInFolder(this.getPlacer(), inv[0], true);
     if (!li.isEmpty()) {
       inv[1] = li.remove(0);
       overflow.addAll(li);
     }
   } else if (inv[0].getItem().getClass() == lootBagClass) {
     ArrayList<ItemStack> li = new ArrayList();
     int n = 8 + rand.nextInt(5);
     for (int i = 0; i < n; i++) {
       try {
         ItemStack is = (ItemStack) generateBagLoot.invoke(null, inv[0].getItemDamage(), rand);
         if (is != null) {
           li.add(is);
         }
       } catch (Exception e) {
         e.printStackTrace();
         this.writeError(e);
       }
     }
     li = ReikaItemHelper.collateItemList(li);
     if (!li.isEmpty()) {
       inv[1] = li.remove(0);
       overflow.addAll(li);
     }
   }
   ReikaInventoryHelper.decrStack(0, inv);
 }