use of crazypants.enderio.machines.machine.teleport.telepad.packet.PacketTelePadFluidLevel in project EnderIO by SleepyTrousers.
the class TileTelePad method processTasks.
@Override
protected boolean processTasks(boolean redstoneCheck) {
if (!isMaster()) {
return false;
}
if (target.getDimension() == Integer.MIN_VALUE) {
target.setDimension(world.provider.getDimension());
}
if (!getInventory().getSlot("INPUT").isEmpty() && getInventory().getSlot("OUTPUT").isEmpty()) {
ItemStack stack = getInventory().getSlot("INPUT").get();
setTarget(TelepadTarget.readFromNBT(stack));
getInventory().getSlot("INPUT").clear();
getInventory().getSlot("OUTPUT").set(stack);
}
if (tankDirty && shouldDoWorkThisTick(10)) {
PacketHandler.sendToAllAround(new PacketTelePadFluidLevel(this), this);
tankDirty = false;
}
if (active()) {
if (powerUsed >= requiredPower) {
teleport(toTeleport.poll());
powerUsed = 0;
} else {
int usable = Math.min(Math.min(getUsage(), requiredPower), getEnergy().getEnergyStored());
getEnergy().setEnergyStored(getEnergy().getEnergyStored() - usable);
powerUsed += usable;
}
if (shouldDoWorkThisTick(5)) {
updateQueuedEntities();
}
// we have a very smooth block animation, so all clients need very detailed progress data
// TODO: check if this is really needed for the TelePad
PacketHandler.INSTANCE.sendToAllAround(getProgressPacket(), this);
}
if (coordsChanged) {
coordsChanged = false;
PacketHandler.sendToAllAround(new PacketSetTarget(this, target), this);
}
return false;
}
Aggregations