@Override public ArrayList getNetworkedData(ArrayList data) { super.getNetworkedData(data); data.add(isActive); data.add(controlType.ordinal()); data.add(operatingTicks); if (injectTank.getGas() != null) { data.add(true); data.add(injectTank.getGas().getGas().getID()); data.add(injectTank.getStored()); } else { data.add(false); } if (outputTank.getGas() != null) { data.add(true); data.add(outputTank.getGas().getGas().getID()); data.add(outputTank.getStored()); } else { data.add(false); } return data; }
@Override public ArrayList<Object> getNetworkedData(ArrayList<Object> data) { if (collectedGas.getGasType() != null) { data.add(collectedGas.getGasType().getID()); data.add(collectedGas.getStored()); } else { data.add(-1); data.add(0); } return data; }
@Override public ArrayList getNetworkedData(ArrayList data) { super.getNetworkedData(data); data.add(getReactor() != null && getReactor().isFormed()); if (getReactor() != null) { data.add(getReactor().getPlasmaTemp()); data.add(getReactor().getCaseTemp()); data.add(getReactor().getInjectionRate()); data.add(getReactor().isBurning()); data.add(fuelTank.getStored()); data.add(deuteriumTank.getStored()); data.add(tritiumTank.getStored()); data.add(waterTank.getCapacity()); data.add(waterTank.getFluidAmount()); data.add(steamTank.getCapacity()); data.add(steamTank.getFluidAmount()); } return data; }
@Override public void onUpdate() { if (worldObj.isRemote) { Mekanism.proxy.registerSound(this); if (updateDelay > 0) { updateDelay--; if (updateDelay == 0 && clientActive != isActive) { isActive = clientActive; MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord); } } } if (!worldObj.isRemote) { if (updateDelay > 0) { updateDelay--; if (updateDelay == 0 && clientActive != isActive) { Mekanism.packetHandler.sendToAll( new TileEntityMessage(Coord4D.get(this), getNetworkedData(new ArrayList()))); } } ChargeUtils.discharge(3, this); if (inventory[0] != null && (injectTank.getGas() == null || injectTank.getStored() < injectTank.getMaxGas())) { injectTank.receive( GasTransmission.removeGas( inventory[0], GasRegistry.getGas("sulfuricAcid"), injectTank.getNeeded()), true); } if (inventory[2] != null && outputTank.getGas() != null) { outputTank.draw(GasTransmission.addGas(inventory[2], outputTank.getGas()), true); } boolean changed = false; if (canOperate() && getEnergy() >= MekanismUtils.getEnergyPerTick(this, ENERGY_USAGE) && injectTank.getStored() >= INJECT_USAGE && MekanismUtils.canFunction(this)) { setActive(true); setEnergy(getEnergy() - MekanismUtils.getEnergyPerTick(this, ENERGY_USAGE)); if (operatingTicks < MekanismUtils.getTicks(this, TICKS_REQUIRED)) { operatingTicks++; injectTank.draw(INJECT_USAGE, true); } else { GasStack stack = RecipeHandler.getItemToGasOutput( inventory[1], true, Recipe.CHEMICAL_DISSOLUTION_CHAMBER.get()); outputTank.receive(stack, true); injectTank.draw(INJECT_USAGE, true); operatingTicks = 0; if (inventory[1].stackSize <= 0) { inventory[1] = null; } markDirty(); } } else { if (prevEnergy >= getEnergy()) { changed = true; setActive(false); } } if (changed && !canOperate()) { operatingTicks = 0; } prevEnergy = getEnergy(); if (outputTank.getGas() != null) { GasStack toSend = new GasStack(outputTank.getGas().getGas(), Math.min(outputTank.getStored(), gasOutput)); TileEntity tileEntity = Coord4D.get(this).getFromSide(MekanismUtils.getRight(facing)).getTileEntity(worldObj); if (tileEntity instanceof IGasHandler) { if (((IGasHandler) tileEntity) .canReceiveGas( MekanismUtils.getRight(facing).getOpposite(), outputTank.getGas().getGas())) { outputTank.draw( ((IGasHandler) tileEntity) .receiveGas(MekanismUtils.getRight(facing).getOpposite(), toSend), true); } } } } }
public int getScaledOutputGasLevel(int i) { return outputTank.getGas() != null ? outputTank.getStored() * i / MAX_GAS : 0; }
public int getScaledInjectGasLevel(int i) { return injectTank.getGas() != null ? injectTank.getStored() * i / MAX_GAS : 0; }