@Override public void process(double time) { ElectricalDrillDescriptor drill = (ElectricalDrillDescriptor) ElectricalDrillDescriptor.getDescriptor( miner.inventory.getStackInSlot(AutoMinerContainer.electricalDrillSlotId)); OreScanner scanner = (OreScanner) ElectricalDrillDescriptor.getDescriptor( miner.inventory.getStackInSlot(AutoMinerContainer.OreScannerSlotId)); MiningPipeDescriptor pipe = (MiningPipeDescriptor) ElectricalDrillDescriptor.getDescriptor( miner.inventory.getStackInSlot(AutoMinerContainer.MiningPipeSlotId)); energyCounter += miner.inPowerLoad.getRpPower() * time; if (job != jobType.none) { if (energyCounter >= energyTarget || (job == jobType.ore && drill == null)) { setupJob(); } if (energyCounter >= energyTarget) { switch (job) { case ore: Block block = Block.blocksList[jobCoord.world().getBlockId(jobCoord.x, jobCoord.y, jobCoord.z)]; int meta = jobCoord.world().getBlockMetadata(jobCoord.x, jobCoord.y, jobCoord.z); ArrayList<ItemStack> drop = block.getBlockDropped( jobCoord.world(), jobCoord.x, jobCoord.y, jobCoord.z, meta, 0); for (ItemStack stack : drop) { drop(stack); } jobCoord.world().setBlock(jobCoord.x, jobCoord.y, jobCoord.z, 0); energyCounter -= energyTarget; setupJob(); break; case pipeAdd: Eln.ghostManager.createGhost(jobCoord, miner.node.coordonate, jobCoord.y); miner.inventory.decrStackSize(AutoMinerContainer.MiningPipeSlotId, 1); pipeLength++; miner.needPublish(); energyCounter -= energyTarget; setupJob(); break; case pipeRemove: Eln.ghostManager.removeGhostAndBlock(jobCoord); if (miner.inventory.getStackInSlot(AutoMinerContainer.MiningPipeSlotId) == null) { miner.inventory.setInventorySlotContents( AutoMinerContainer.MiningPipeSlotId, Eln.miningPipeDescriptor.newItemStack(1)); } else { miner.inventory.decrStackSize(AutoMinerContainer.MiningPipeSlotId, -1); } pipeLength--; miner.needPublish(); energyCounter -= energyTarget; setupJob(); break; default: break; } } } else { setupJob(); } switch (job) { case none: miner.inPowerLoad.setRp(Double.POSITIVE_INFINITY); break; case ore: if (drill == null) { miner.inPowerLoad.setRp(Double.POSITIVE_INFINITY); } else { miner.inPowerLoad.setRp(drill.getRp(scanner != null ? scanner.OperationEnergy : 0)); } break; case pipeAdd: miner.inPowerLoad.setRp(miner.descriptor.pipeOperationRp); break; case pipeRemove: miner.inPowerLoad.setRp(miner.descriptor.pipeOperationRp); break; } }
void destroyPipe(int jumpY) { dropPipe(jumpY); Eln.ghostManager.removeGhostAndBlockWithObserver(miner.node.coordonate); pipeLength = 0; miner.needPublish(); }