Exemplo n.º 1
0
 public ItemStack getCurrentEquippedItem() {
   return inventory.getCurrentItem();
 }
Exemplo n.º 2
0
 public void onUpdate() {
   if (itemInUse != null) {
     ItemStack itemstack = inventory.getCurrentItem();
     if (itemstack != itemInUse) {
       clearItemInUse();
     } else {
       if (itemInUseCount <= 25 && itemInUseCount % 4 == 0) {
         func_35201_a(itemstack, 5);
       }
       if (--itemInUseCount == 0 && !worldObj.multiplayerWorld) {
         func_35208_ae();
       }
     }
   }
   if (xpCooldown > 0) {
     xpCooldown--;
   }
   if (isPlayerSleeping()) {
     sleepTimer++;
     if (sleepTimer > 100) {
       sleepTimer = 100;
     }
     if (!worldObj.multiplayerWorld) {
       if (!isInBed()) {
         wakeUpPlayer(true, true, false);
       } else if (worldObj.isDaytime()) {
         wakeUpPlayer(false, true, true);
       }
     }
   } else if (sleepTimer > 0) {
     sleepTimer++;
     if (sleepTimer >= 110) {
       sleepTimer = 0;
     }
   }
   super.onUpdate();
   if (!worldObj.multiplayerWorld
       && craftingInventory != null
       && !craftingInventory.canInteractWith(this)) {
     closeScreen();
     craftingInventory = inventorySlots;
   }
   if (capabilities.isFlying) {
     for (int i = 0; i < 8; i++) {}
   }
   if (isBurning() && capabilities.disableDamage) {
     extinguish();
   }
   field_20066_r = field_20063_u;
   field_20065_s = field_20062_v;
   field_20064_t = field_20061_w;
   double d = posX - field_20063_u;
   double d1 = posY - field_20062_v;
   double d2 = posZ - field_20061_w;
   double d3 = 10D;
   if (d > d3) {
     field_20066_r = field_20063_u = posX;
   }
   if (d2 > d3) {
     field_20064_t = field_20061_w = posZ;
   }
   if (d1 > d3) {
     field_20065_s = field_20062_v = posY;
   }
   if (d < -d3) {
     field_20066_r = field_20063_u = posX;
   }
   if (d2 < -d3) {
     field_20064_t = field_20061_w = posZ;
   }
   if (d1 < -d3) {
     field_20065_s = field_20062_v = posY;
   }
   field_20063_u += d * 0.25D;
   field_20061_w += d2 * 0.25D;
   field_20062_v += d1 * 0.25D;
   addStat(StatList.minutesPlayedStat, 1);
   if (ridingEntity == null) {
     startMinecartRidingCoordinate = null;
   }
   if (!worldObj.multiplayerWorld) {
     foodStats.onUpdate(this);
   }
 }