示例#1
0
  private void updateSlots() {

    Fluid filter0 = container.getFilter(0);
    Fluid filter1 = container.getFilter(1);

    ((FluidSlot) slots[0]).fluid = filter0;
    ((FluidSlot) slots[1]).fluid = filter1;

    FluidStack liquid0 = null;
    FluidStack liquid1 = null;

    if (filter0 != null) {
      liquid0 = new FluidStack(filter0, FluidContainerRegistry.BUCKET_VOLUME);
    }
    if (filter1 != null) {
      liquid1 = new FluidStack(filter1, FluidContainerRegistry.BUCKET_VOLUME);
    }

    Recipe recipe = RefineryRecipes.findRefineryRecipe(liquid0, liquid1);

    if (recipe != null) {
      ((FluidSlot) slots[2]).fluid = recipe.result.getFluid();
    } else {
      ((FluidSlot) slots[2]).fluid = null;
    }
  }
示例#2
0
 @Override
 public void updateEntity() {
   if (this.worldObj.isRemote) {
     simpleAnimationIterate();
     return;
   }
   if (this.worldObj.getWorldTime() % 20 == 7) {
     PacketDispatcher.sendPacketToAllAround(
         this.xCoord,
         this.yCoord,
         this.zCoord,
         256,
         this.worldObj.provider.dimensionId,
         PacketHandler.getPacketFromNBT(this));
   }
   this.ticks++;
   for (int i = this.efficiency + 1; i > 0; i--) {
     Recipe r = RefineryRecipes.findRefineryRecipe(this.src1, this.src2);
     if (r == null) {
       decreaseAnimation();
       this.ticks = 0;
       return;
     }
     if (this.res != null && r.result.amount > (this.buf - this.res.amount)) {
       decreaseAnimation();
       return;
     }
     if (r.delay > this.ticks) return;
     if (i == 1) this.ticks = 0;
     if (!PowerManager.useEnergyR(this.pp, r.energy, this.unbreaking)) {
       decreaseAnimation();
       return;
     }
     increaseAnimation();
     if (r.ingredient1.isFluidEqual(this.src1)) this.src1.amount -= r.ingredient1.amount;
     else this.src2.amount -= r.ingredient1.amount;
     if (r.ingredient2 != null) {
       if (r.ingredient2.isFluidEqual(this.src2)) this.src2.amount -= r.ingredient2.amount;
       else this.src1.amount -= r.ingredient2.amount;
     }
     if (this.src1 != null && this.src1.amount == 0) this.src1 = null;
     if (this.src2 != null && this.src2.amount == 0) this.src2 = null;
     if (this.res == null) this.res = r.result.copy();
     else this.res.amount += r.result.amount;
   }
 }