@Override protected void updateTemperature(World world, int x, int y, int z) { super.updateTemperature(world, x, y, z); int Tamb = ReikaBiomeHelper.getBiomeTemp(world, x, z); int dT = temperature - Tamb; if (dT != 0 && ReikaWorldHelper.checkForAdjBlock(world, x, y, z, 0) != null) temperature -= (1 + dT / 32); if (dT > 0) { for (int i = 2; i < 6; i++) { ForgeDirection dir = dirs[i]; int dx = x + dir.offsetX; int dy = y + dir.offsetY; int dz = z + dir.offsetZ; int id = world.getBlockId(dx, dy, dz); int meta = world.getBlockMetadata(dx, dy, dz); if (id == ReactorTiles.COOLANT.getBlockID() && meta == ReactorTiles.COOLANT.getBlockMetadata()) { TileEntityWaterCell te = (TileEntityWaterCell) world.getBlockTileEntity(dx, dy, dz); if (te.getLiquidState().isWater() && temperature >= 100 && ReikaRandomHelper.doWithChance(40)) { te.setLiquidState(LiquidStates.EMPTY); temperature -= 20; } } if (id == this.getTileEntityBlockID() && meta == ReactorTiles.TEList[this.getIndex()].getBlockMetadata()) { TileEntityNuclearCore te = (TileEntityNuclearCore) world.getBlockTileEntity(dx, dy, dz); int dTemp = temperature - te.temperature; if (dTemp > 0) { temperature -= dTemp / 16; te.temperature += dTemp / 16; } } } } if (hydrogen > 0) hydrogen--; if (temperature >= 500) { ReactorAchievements.HOTCORE.triggerAchievement(this.getPlacer()); } if (temperature > this.getMaxTemperature()) { this.onMeltdown(world, x, y, z); ReactorAchievements.MELTDOWN.triggerAchievement(this.getPlacer()); } if (temperature > HYDROGEN) { hydrogen += 1; if (hydrogen > 200) { this.onMeltdown(world, x, y, z); } } }
@Override public final void dropBlockAsItemWithChance( World world, int x, int y, int z, int metadata, float chance, int fortune) { if (!world.isRemote) { ArrayList<ItemStack> li = this.getBlockDropped(world, x, y, z, metadata, fortune); for (int i = 0; i < li.size(); i++) { if (chance >= 1 || ReikaRandomHelper.doWithChance(chance)) this.dropBlockAsItem_do(world, x, y, z, li.get(i)); } } }
private int getSmeltNumber(int stage, OreType ore, ItemStack is) { if (bedrock && stage == 0) return 2; // ReikaJavaLibrary.pConsole(RotaryConfig.getDifficulty()); if (ore != null) { if (ore.getRarity() == OreRarity.RARE) { if (ReikaRandomHelper.doWithChance(oreCopyRare / 100D)) return 2; else return 1; } boolean nether = ore instanceof ModOreList && ((ModOreList) ore).isNetherOres(); if (is.getItemDamage() == 1 && (ore == ModOreList.FORCE || ore == ModOreList.MIMICHITE)) nether = true; if (ReikaItemHelper.matchStackWithBlock(is, MagicCropHandler.getInstance().netherOreID)) nether = true; if (nether) { // .isNetherOres() if (ReikaRandomHelper.doWithChance(oreCopyNether / 100D)) return 2; else return 1; } } return ReikaRandomHelper.doWithChance(oreCopy / 100D) ? 2 : 1; }
private final ArrayList<ItemStack> getDyes(World world, int x, int y, int z, int fortune) { int drop = this.getDyeDropCount(fortune); ArrayList<ItemStack> li = new ArrayList(); for (int i = 0; i < drop; i++) { if (ReikaRandomHelper.doWithChance(DyeOptions.DYEFRAC.getValue())) { li.add(new ItemStack(Item.dyePowder.itemID, 1, rand.nextInt(16))); } else { li.add(new ItemStack(DyeItems.DYE.getShiftedItemID(), 1, rand.nextInt(16))); } } return li; }
@Override public final ArrayList<ItemStack> getBlockDropped( World world, int x, int y, int z, int meta, int fortune) { ArrayList<ItemStack> li = new ArrayList(); float saplingChance = 0.0125F; float appleChance = 0.1F; float goldAppleChance = 0.025F; float rareGoldAppleChance = 0.0025F; saplingChance *= (1 + fortune); appleChance *= (1 + fortune * 5); goldAppleChance *= (1 + fortune * 3); rareGoldAppleChance *= (1 + fortune * 3); if (ReikaRandomHelper.doWithChance(saplingChance)) li.add(new ItemStack(DyeBlocks.RAINBOWSAPLING.getBlockID(), 1, meta)); if (ReikaRandomHelper.doWithChance(appleChance)) li.add(new ItemStack(Item.appleRed, 1, 0)); if (ReikaRandomHelper.doWithChance(goldAppleChance)) li.add(new ItemStack(Item.appleGold, 1, 0)); if (ReikaRandomHelper.doWithChance(rareGoldAppleChance)) li.add(new ItemStack(Item.appleGold, 1, 1)); li.addAll(this.getDyes(world, x, y, z, fortune)); return li; }
private Collection<ItemStack> getDrops(World world, int x, int y, int z, Block b, int meta) { float f = this.getYield(b, meta); if (ReikaRandomHelper.doWithChance(f)) { Collection<ItemStack> ret = b.getDrops(world, x, y, z, meta, this.getEnchantment(Enchantment.fortune)); if (tree.getTreeType() == ModWoodList.SLIME) { Block log = tree.getTreeType().getLogID(); if (b == log) { ret.clear(); ret.add(new ItemStack(Items.slime_ball)); } } return ret; } else return new ArrayList(); }
@Override public void updateEntity(World world, int x, int y, int z, int meta) { if (!world.isRemote && this.isFissile() && rand.nextInt(20) == 0) world.spawnEntityInWorld(new EntityNeutron(world, x, y, z, this.getRandomDirection())); // ReikaInventoryHelper.clearInventory(this); // ReikaInventoryHelper.addToIInv(ReactorItems.FUEL.getStackOf(), this); this.feed(); tempTimer.update(); if (tempTimer.checkCap()) { this.updateTemperature(world, x, y, z); } // ReikaJavaLibrary.pConsole(temperature); if (temperature > CLADDING) { if (rand.nextInt(20) == 0) ReikaSoundHelper.playSoundAtBlock(world, x, y, z, "random.fizz"); ReikaParticleHelper.SMOKE.spawnAroundBlockWithOutset(world, x, y, z, 9, 0.0625); } else if (temperature > 500 && ReikaRandomHelper.doWithChance(20)) { if (rand.nextInt(20) == 0) ReikaSoundHelper.playSoundAtBlock(world, x, y, z, "random.fizz"); ReikaParticleHelper.SMOKE.spawnAroundBlockWithOutset(world, x, y, z, 4, 0.0625); } }
private int droppedXP() { int factor = ReactorOptions.RAINBOW.getState() ? 6 : 1; return ReikaRandomHelper.doWithChance(ReactorOres.FLUORITE.xpDropped * factor) ? 1 : 0; }