@Override public ErrorState canProgress() { if (getMachine().getOwner() == null) { return new ErrorState(GeneticsErrorCode.NO_OWNER, Analyser.SLOT_TARGET); } if (this.getUtil().getSlotCharge(Analyser.SLOT_DYE) == 0.0f) { return new ErrorState(GeneticsErrorCode.ANALYSER_INSUFFICIENT_DYE, new int[]{Analyser.SLOT_DYE}); } return super.canProgress(); }
public ContainerCraftGUI(final Window window) { this.syncedNBT = new HashMap<>(); this.sentNBT = new HashMap<>(); this.syncedTanks = new HashMap<>(); this.syncedPower = new PowerInfo(); this.syncedProcess = new ProcessInfo(); this.errorType = 0; this.error = null; this.mousedOverSlotNumber = -1; this.window = window; final IMachine machine = Machine.getMachine(window.getInventory()); if (this.getSide() == Side.SERVER && machine != null) { final GameProfile user = machine.getOwner(); if (user != null) { final NBTTagCompound nbt = new NBTTagCompound(); nbt.setString("username", user.getName()); this.sendNBTToClient("username", nbt); } } detectAndSendChanges(); }
@Override protected void onFinishTask() { super.onFinishTask(); ItemStack itemStack = this.getUtil().getStack(Analyser.SLOT_TARGET); itemStack = ManagerGenetics.analyse(itemStack, getMachine().getWorld(), getMachine().getOwner()); this.getInventory().setInventorySlotContents(Analyser.SLOT_TARGET, itemStack); }
@Override public ErrorState canProgress() { if (this.getMachine().getOwner() == null) { return new ErrorState(GeneticsErrorCode.NO_OWNER); } if (this.getUtil().getSlotCharge(Sequencer.SLOT_DYE) == 0.0f) { return new ErrorState(GeneticsErrorCode.SEQUENCER_INSUFFICIENT_DYE, Sequencer.SLOT_DYE); } ItemStack stackDone = this.getUtil().getStack(Sequencer.SLOT_DONE); if (!stackDone.isEmpty() && stackDone.getCount() >= 64) { return new ErrorState(GeneticsErrorCode.SEQUENCER_NO_SPACE, new int[]{Sequencer.SLOT_DONE}); } return super.canProgress(); }
@Override protected void onFinishTask() { super.onFinishTask(); this.updateSequence(); ItemStack stack = this.getUtil().getStack(Sequencer.SLOT_TARGET); Preconditions.checkState(!stack.isEmpty()); final SequencerItem seqItem = SequencerItem.create(stack); Preconditions.checkState(seqItem != null); GeneTracker.getTracker(this.getMachine().getWorld(), this.getMachine().getOwner()).registerGene(seqItem.getGene()); this.getUtil().decreaseStack(Sequencer.SLOT_TARGET, 1); if (this.getUtil().getStack(Sequencer.SLOT_DONE).isEmpty()) { this.getUtil().setStack(Sequencer.SLOT_DONE, GeneticsItems.EmptySequencer.get(1)); } else { this.getUtil().decreaseStack(Sequencer.SLOT_DONE, -1); } }