Advertisement
Guest User

Untitled

a guest
Apr 17th, 2015
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public void updateEntity()
  2.   {
  3.     super.updateEntity();
  4.  
  5.     ticker = ((char)(ticker + '\001'));
  6.     if (ticker % tickRate == 0) {
  7.       tick();
  8.     }
  9.  
  10.     if (dirty) {
  11.       dirty = false;
  12.       worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
  13.       worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord);
  14.       if ((IC2.platform.isSimulating()) &&
  15.         (!IC2.platform.isRendering()))
  16.         for (String field : getNetworkedFields())
  17.           ((NetworkManager)IC2.network.get()).updateTileEntityField(this, field);
  18.     }
  19.   }
  20.  
  21. public void tick()
  22.   {
  23.     if (!IC2.platform.isSimulating()) return;
  24.  
  25.     if (ticker % (tickRate << 2) == 0) {
  26.       humidity = updateHumidity();
  27.     }
  28.  
  29.     if ((ticker + tickRate) % (tickRate << 2) == 0) {
  30.       nutrients = updateNutrients();
  31.     }
  32.  
  33.     if ((ticker + tickRate * 2) % (tickRate << 2) == 0) {
  34.       airQuality = updateAirQuality();
  35.     }
  36.  
  37.     if (crop == null) {
  38.       if ((!upgraded) || (!attemptCrossing())) {
  39.         if ((IC2.random.nextInt(100) == 0) && (!hasEx())) {
  40.           reset();
  41.           crop = IC2Crops.weed;
  42.           size = 1;
  43.         } else {
  44.           if ((exStorage > 0) && (IC2.random.nextInt(10) == 0)) exStorage -= 1;
  45.           return;
  46.         }
  47.       }
  48.  
  49.       assert (crop != null);
  50.     }
  51.  
  52.     crop.tick(this);
  53.  
  54.     if (crop.canGrow(this)) {
  55.       growthPoints += calcGrowthRate();
  56.  
  57.       if ((crop != null) && (growthPoints >= crop.growthDuration(this)))
  58.       {
  59.         growthPoints = 0;
  60.         size += 1;
  61.         dirty = true;
  62.       }
  63.     }
  64.  
  65.     if (nutrientStorage > 0) nutrientStorage -= 1;
  66.     if (waterStorage > 0) waterStorage -= 1;
  67.  
  68.     if ((crop.isWeed(this)) && (IC2.random.nextInt(50) - statGrowth <= 2))
  69.       generateWeed();
  70.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement