public static void onTextureStitchedPost(TextureMap map) { MinecraftForge.EVENT_BUS.post(new TextureStitchEvent.Post(map)); FluidRegistry.WATER.setIcons( BlockFluid.func_94424_b("water_still"), BlockFluid.func_94424_b("water_flow")); FluidRegistry.LAVA.setIcons( BlockFluid.func_94424_b("lava_still"), BlockFluid.func_94424_b("lava_flow")); }
@Override public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { if (resource.getFluidID() == FluidRegistry.LAVA.getID() && from != ForgeDirection.getOrientation(facing)) { return lavaTank.fill(resource, doFill); } return 0; }
@Override public boolean isItemValidForSlot(int slotID, ItemStack itemstack) { if (slotID == 0) { return getFuel(itemstack) > 0 || (FluidContainerRegistry.getFluidForFilledItem(itemstack) != null && FluidContainerRegistry.getFluidForFilledItem(itemstack).getFluidID() == FluidRegistry.LAVA.getID()); } else if (slotID == 1) { return ChargeUtils.canBeCharged(itemstack); } return true; }
@Override public int fill(ForgeDirection from, FluidStack resource, boolean doFill) { if (worldObj.isRemote) return 0; if (resource == null) // What!? return 0; if (resource.getFluid() == null) return 0; if (resource.getFluid().getID() != FluidRegistry.LAVA.getID()) { return 0; } if (tank != null && tank.getFluid() != null && tank.getFluidAmount() > 0) { if (resource.getFluid().getID() != tank.getFluid().getFluid().getID()) { return 0; } } else if (tank == null) { setTier(getTier()); } return tank.fill(resource, doFill); }
@Override public boolean canDrain(ForgeDirection from, Fluid fluid) { return fluid.getID() == FluidRegistry.LAVA.getID(); }
@Override public void onUpdate() { super.onUpdate(); if (!worldObj.isRemote) { ChargeUtils.charge(1, this); if (inventory[0] != null) { FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(inventory[0]); if (inventory[0].getItem() instanceof IFluidContainerItem) { lavaTank.fill( FluidContainerUtils.extractFluid( lavaTank, inventory[0], FluidChecker.check(FluidRegistry.LAVA)), true); } else if (fluid != null) { if (fluid != null && fluid.getFluidID() == FluidRegistry.LAVA.getID()) { if (lavaTank.getFluid() == null || lavaTank.getFluid().amount + fluid.amount <= lavaTank.getCapacity()) { lavaTank.fill(fluid, true); if (inventory[0].getItem().getContainerItem(inventory[0]) != null) { inventory[0] = inventory[0].getItem().getContainerItem(inventory[0]); } else { inventory[0].stackSize--; } if (inventory[0].stackSize == 0) { inventory[0] = null; } } } } else { int fuel = getFuel(inventory[0]); if (fuel > 0) { int fuelNeeded = lavaTank.getCapacity() - (lavaTank.getFluid() != null ? lavaTank.getFluid().amount : 0); if (fuel <= fuelNeeded) { lavaTank.fill(new FluidStack(FluidRegistry.LAVA, fuel), true); if (inventory[0].getItem().getContainerItem(inventory[0]) != null) { inventory[0] = inventory[0].getItem().getContainerItem(inventory[0]); } else { inventory[0].stackSize--; } if (inventory[0].stackSize == 0) { inventory[0] = null; } } } } } double prev = getEnergy(); transferHeatTo(getBoost()); if (canOperate()) { setActive(true); lavaTank.drain(10, true); transferHeatTo(generators.heatGeneration); } else { setActive(false); } double[] loss = simulateHeat(); applyTemperatureChange(); lastTransferLoss = loss[0]; lastEnvironmentLoss = loss[1]; producingEnergy = getEnergy() - prev; } }