Esempio n. 1
0
 @Override
 public void readFromNBT(NBTTagCompound nbttc) {
   super.readFromNBT(nbttc);
   this.silktouch = nbttc.getBoolean("silktouch");
   this.fortune = nbttc.getByte("fortune");
   this.efficiency = nbttc.getByte("efficiency");
   this.unbreaking = nbttc.getByte("unbreaking");
   this.pp.readFromNBT(nbttc);
   this.src1 = FluidStack.loadFluidStackFromNBT(nbttc.getCompoundTag("src1"));
   this.src2 = FluidStack.loadFluidStackFromNBT(nbttc.getCompoundTag("src2"));
   this.res = FluidStack.loadFluidStackFromNBT(nbttc.getCompoundTag("res"));
   this.animationSpeed = nbttc.getFloat("animationSpeed");
   this.animationStage = nbttc.getInteger("animationStage");
   this.buf = (int) (FluidContainerRegistry.BUCKET_VOLUME * 4 * Math.pow(1.3, this.fortune));
   PowerManager.configureR(this.pp, this.efficiency, this.unbreaking);
 }
Esempio n. 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;
   }
 }
Esempio n. 3
0
 @Override
 public void G_reinit() {
   PowerManager.configureR(this.pp, this.efficiency, this.unbreaking);
   this.buf = (int) (FluidContainerRegistry.BUCKET_VOLUME * 4 * Math.pow(1.3, this.fortune));
 }