Advertisement
Guest User

Untitled

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