コード例 #1
0
 public void updateEntity() {
   super.updateEntity();
   boolean flag = isBurning();
   boolean flag1 = false;
   if (fuel <= 0 && canOperate()) {
     fuel = fuelGague = getFuelValueFor(inventory[1]);
     if (fuel > 0) {
       if (inventory[1].getItem().hasContainerItem()) {
         inventory[1] = new ItemStack(inventory[1].getItem().getContainerItem());
       } else {
         inventory[1].stackSize--;
       }
       if (inventory[1].stackSize <= 0) {
         inventory[1] = null;
       }
       flag1 = true;
     }
   }
   if (isBurning() && canOperate()) {
     progress++;
     if (progress >= 200) {
       progress = 0;
       operate();
       flag1 = true;
     }
   } else {
     progress = 0;
   }
   if (fuel > 0) {
     fuel--;
   }
   if (flag != isBurning()) {
     setActive(isBurning());
     flag1 = true;
   }
   if (flag1) {
     onInventoryChanged();
   }
 }
コード例 #2
0
 public void writeToNBT(NBTTagCompound nbttagcompound) {
   super.writeToNBT(nbttagcompound);
   nbttagcompound.setShort("fuel", fuel);
   nbttagcompound.setShort("fuelGague", fuelGague);
 }
コード例 #3
0
 public void readFromNBT(NBTTagCompound nbttagcompound) {
   super.readFromNBT(nbttagcompound);
   fuel = nbttagcompound.getShort("fuel");
   fuelGague = nbttagcompound.getShort("fuelGague");
 }