@Override public void updateEntity() { super.updateEntity(); if (!CoreProxy.proxy.isSimulating(worldObj)) return; // If a gate disabled us, remove laser and do nothing. if (lastMode == ActionMachineControl.Mode.Off) { removeLaser(); return; } // Check for available tables if none is linked to this laser. if (!isValidTable()) if (canFindTable()) { findTable(); } // If we still don't have a valid table or the existing has // become invalid, we disable the laser and do nothing. if (!isValidTable()) { removeLaser(); return; } // Disable the laser and do nothing if no energy is available. if (powerHandler.getEnergyStored() == 0) { removeLaser(); return; } // We have a table and can work, so we create a laser if // necessary. if (laser == null) { createLaser(); } // We have a laser and may update it if (laser != null && canUpdateLaser()) { updateLaser(); } // Consume power and transfer it to the table. float power = powerHandler.useEnergy(0, getMaxPowerSent(), true); laserTarget.receiveLaserEnergy(power); if (laser != null) { laser.pushPower(power); } onPowerSent(power); sendNetworkUpdate(); }