@Override public void updateEntity(World world, int x, int y, int z, int meta) { super.updateTileEntity(); this.getPowerBelow(); timer.update(); if (timer.checkCap()) this.updateTemperature(world, x, y, z, meta); if (temperature > this.getMeltingTemperature()) energy += power; else energy *= 0.85; // ReikaJavaLibrary.pConsole(this.getMeltingTemperature()+":"+energy/20F/MELT_ENERGY, // Side.SERVER); tickcount++; if (omega > 0 && power > 0) { if (tickcount > 98) { SoundRegistry.FRICTION.playSoundAtBlock( world, x, y, z, RotaryAux.isMuffled(this) ? 0.1F : 0.5F, 0.5F); tickcount = 0; } world.spawnParticle( "crit", x + rand.nextDouble(), y, z + rand.nextDouble(), -0.2 + 0.4 * rand.nextDouble(), 0.4 * rand.nextDouble(), -0.2 + 0.4 * rand.nextDouble()); } for (int i = 0; i < inv.length; i++) { ItemStack is = inv[i]; if (is != null) { FluidStack fs = RecipesLavaMaker.getRecipes().getMelting(is); long melt_energy = RecipesLavaMaker.getRecipes().getMeltingEnergy(is); // ReikaJavaLibrary.pConsole(energy/20L+":"+melt_energy, Side.SERVER); if (fs != null) { if (this.canMake(fs) && energy >= melt_energy * 20) { tank.addLiquid(fs.amount, fs.getFluid()); ReikaInventoryHelper.decrStack(i, inv); energy -= melt_energy * 20; return; } } } } }
private boolean canMake() { for (int i = 0; i < inv.length; i++) { ItemStack is = inv[i]; if (is != null) { FluidStack fs = RecipesLavaMaker.getRecipes().getMelting(is); if (fs != null) if (this.canMake(fs)) return true; } } return false; }
private int getMeltingTemperature() { for (int i = 0; i < inv.length; i++) { ItemStack is = inv[i]; if (is != null) { int temp = RecipesLavaMaker.getRecipes().getMeltTemperature(is); if (temp > Integer.MIN_VALUE) { return temp; } } } return Integer.MAX_VALUE; }
@Override public boolean isItemValidForSlot(int slot, ItemStack is) { return RecipesLavaMaker.getRecipes().isValidFuel(is); }