public void createUtilsIfNeeded() { if (bluePrintBuilder == null) { if (!box.isInitialized()) { setBoundaries(loadDefaultBoundaries); } initializeBluePrintBuilder(); } if (builderDone) { box.deleteLasers(); if (arm == null) { createArm(); } if (findTarget(false)) { isDigging = true; } } else { box.createLasers(worldObj, LaserKind.Stripes); isDigging = true; } }
@Override public void destroy() { if (box.isInitialized()) { box.deleteLasers(); } if (builderRobot != null) { builderRobot.setDead(); builderRobot = null; } cleanPathLasers(); }
@Override public void destroy() { if (arm != null) { arm.setDead(); } if (builder != null) { builder.setDead(); } box.deleteLasers(); arm = null; }
@Override public void updateEntity() { super.updateEntity(); if ((bluePrintBuilder == null || bluePrintBuilder.done) && box.isInitialized() && (builderRobot == null || builderRobot.done())) { box.deleteLasers(); box.reset(); if (CoreProxy.proxy.isSimulating(worldObj)) { sendNetworkUpdate(); } return; } if (!box.isInitialized() && bluePrintBuilder == null && builderRobot != null) { builderRobot.setDead(); builderRobot = null; } }
public void iterateBpt() { if (items[0] == null || !(items[0].getItem() instanceof ItemBptBase)) { if (bluePrintBuilder != null) { bluePrintBuilder = null; } if (builderRobot != null) { builderRobot.setDead(); builderRobot = null; } if (box.isInitialized()) { box.deleteLasers(); box.reset(); } if (currentPathIterator != null) { currentPathIterator = null; } return; } if (bluePrintBuilder == null || bluePrintBuilder.done) { if (path != null && path.size() > 1) { if (currentPathIterator == null) { Iterator<BlockIndex> it = path.iterator(); BlockIndex start = it.next(); currentPathIterator = new PathIterator(start, it); } if (bluePrintBuilder != null && builderRobot != null) { builderRobot.markEndOfBlueprint(bluePrintBuilder); } bluePrintBuilder = currentPathIterator.next(); if (bluePrintBuilder != null) { box.deleteLasers(); box.reset(); box.initialize(bluePrintBuilder); box.createLasers(worldObj, LaserKind.Stripes); } if (builderRobot != null) { builderRobot.setBox(box); } if (bluePrintBuilder == null) { currentPathIterator = currentPathIterator.iterate(); } if (currentPathIterator == null) { done = true; } } else { if (bluePrintBuilder != null && bluePrintBuilder.done) { if (builderRobot != null) { builderRobot.markEndOfBlueprint(bluePrintBuilder); } done = true; bluePrintBuilder = null; } else { bluePrintBuilder = instanciateBluePrint( xCoord, yCoord, zCoord, Orientations.values()[worldObj.getBlockMetadata(xCoord, yCoord, zCoord)] .reverse()); if (bluePrintBuilder != null) { box.initialize(bluePrintBuilder); box.createLasers(worldObj, LaserKind.Stripes); } } } } }
@Override public void updateEntity() { super.updateEntity(); if (inProcess && arm != null) { arm.setArmSpeed(0); float energyToUse = 2 + powerProvider.getEnergyStored() / 1000; boolean enoughStep = (0.015 + energyToUse / 200F) > (1F / 32F); // (otherwise the movement is rounded to 0 and the energy absorbed with no // movement) if (enoughStep) { float energy = powerProvider.useEnergy(energyToUse, energyToUse, true); if (energy > 0) { arm.doMove(0.015 + energy / 200F); } } } if (arm != null) { double[] head = arm.getHead(); headPosX = head[0]; headPosY = head[1]; headPosZ = head[2]; speed = arm.getArmSpeed(); } if (ProxyCore.proxy.isSimulating(worldObj)) { sendNetworkUpdate(); } if (inProcess || !isDigging) { return; } createUtilsIfNeeded(); if (bluePrintBuilder != null) { builderDone = bluePrintBuilder.done; if (!builderDone) { buildFrame(); return; } else { if (builder != null && builder.done()) { box.deleteLasers(); builder.setDead(); builder = null; } } } if (builder == null) { dig(); } }