public boolean canConsume() { if (this.isActive() && !this.isInversed) { return FortronHelper.getAmount(this.fortronTank) < this.fortronTank.getCapacity(); } return false; }
@Override public void updateEntity() { super.updateEntity(); if (!this.worldObj.isRemote) { if (!this.isDisabled() && this.isActive()) { if (this.isInversed && Settings.ENABLE_ELECTRICITY) { // Convert Fortron to Electricity double watts = Math.min(this.getFortronEnergy() * FORTRON_UE_RATIO, WATTAGE); ElectricityPack remainder = this.produce(watts); double electricItemGiven = 0; if (remainder.getWatts() > 0) { electricItemGiven = ElectricItemHelper.chargeItem( this.getStackInSlot(SLOT_BATTERY), remainder.getWatts(), this.getVoltage()); } this.requestFortron( (int) ((watts - (remainder.getWatts() - electricItemGiven)) / FORTRON_UE_RATIO), true); this.animation++; } else { // Convert Electricity to Fortron this.wattsReceived += ElectricItemHelper.dechargeItem( this.getStackInSlot(SLOT_BATTERY), WATTAGE, this.getVoltage()); if (this.wattsReceived >= TileEntityCoercionDeriver.WATTAGE || !Settings.ENABLE_ELECTRICITY) { int production = 3; if (this.isStackValidForSlot(SLOT_FUEL, this.getStackInSlot(SLOT_FUEL))) { production *= NORMAL_PRODUCTION; } this.fortronTank.fill( FortronHelper.getFortron(production + this.worldObj.rand.nextInt(production)), true); if (this.processTime == 0) { this.decrStackSize(SLOT_FUEL, 1); this.processTime = REQUIRED_TIME; if (this.getModuleCount(ModularForceFieldSystem.itemModuleSpeed) > 0) { this.processTime = this.processTime * this.getModuleCount(ModularForceFieldSystem.itemModuleSpeed) / 30; } } if (this.processTime > 0) { // We are processing this.processTime--; if (this.processTime < 1) { this.processTime = 0; } } else { this.processTime = 0; } this.wattsReceived -= WATTAGE; } } } } else if (this.isActive()) { this.animation++; } }