コード例 #1
0
  @Override
  public void updateEntity() {
    super.updateEntity();
    if (redstonePower) return;
    if (worldObj.getWorldTime() % 20 == 0) isProcessing = canProcess();
    if (isProcessing) {
      this.lastItemValue = r.getEnergyValue();
      this.QEnergyItemBuffer = this.lastItemValue;

      if (processTime > 0) processTime--;

      this.QEnergyItemBuffer =
          (int) (((float) processTime / (float) r.getProcessTime()) * (float) this.lastItemValue);
      if (this.processTime == 0) process();

      if (this.processTime == -1) processTime = r.getProcessTime();

    } else {
      processTime = -1;
      QEnergyItemBuffer = 0;
    }

    if (updateNextTick) {
      // All nearby players need to be updated if the status of work
      // changes, or if heat runs out / starts up, in order to change
      // texture.
      updateNextTick = false;
      worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
    }
  }
コード例 #2
0
 private void process() {
   // we need to put in the QEnergyOutput here
   processTime = -1;
   if (inventory[1] == null) {
     inventory[1] = r.getOutputItem().copy();
   } else {
     inventory[1].stackSize++;
   }
   this.addEnergy(r.getEnergyValue());
   this.decrStackSize(0, 1);
 }
コード例 #3
0
  private boolean canProcess() {

    r = QuantumRecipeHandler.getQDERecipeFromInput(inventory[0]);
    boolean flag = true;

    if (r == null) return false;

    if (inventory[0] == null) flag = false;
    if (inventory[0] != null) {
      if (inventory[1] != null) {
        if (inventory[1] != r.getOutputItem()) flag = false;
      }
    }
    if (this.getMaxEnergy() - this.getCurrentEnergy() < r.getEnergyValue()) flag = false;
    return flag;
  }