Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void updateEntity()
- {
- super.updateEntity();
- ticker = ((char)(ticker + '\001'));
- if (ticker % tickRate == 0) {
- tick();
- }
- if (dirty) {
- dirty = false;
- worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
- worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord);
- if ((IC2.platform.isSimulating()) &&
- (!IC2.platform.isRendering()))
- for (String field : getNetworkedFields())
- ((NetworkManager)IC2.network.get()).updateTileEntityField(this, field);
- }
- }
- public void tick()
- {
- if (!IC2.platform.isSimulating()) return;
- if (ticker % (tickRate << 2) == 0) {
- humidity = updateHumidity();
- }
- if ((ticker + tickRate) % (tickRate << 2) == 0) {
- nutrients = updateNutrients();
- }
- if ((ticker + tickRate * 2) % (tickRate << 2) == 0) {
- airQuality = updateAirQuality();
- }
- if (crop == null) {
- if ((!upgraded) || (!attemptCrossing())) {
- if ((IC2.random.nextInt(100) == 0) && (!hasEx())) {
- reset();
- crop = IC2Crops.weed;
- size = 1;
- } else {
- if ((exStorage > 0) && (IC2.random.nextInt(10) == 0)) exStorage -= 1;
- return;
- }
- }
- assert (crop != null);
- }
- crop.tick(this);
- if (crop.canGrow(this)) {
- growthPoints += calcGrowthRate();
- if ((crop != null) && (growthPoints >= crop.growthDuration(this)))
- {
- growthPoints = 0;
- size += 1;
- dirty = true;
- }
- }
- if (nutrientStorage > 0) nutrientStorage -= 1;
- if (waterStorage > 0) waterStorage -= 1;
- if ((crop.isWeed(this)) && (IC2.random.nextInt(50) - statGrowth <= 2))
- generateWeed();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement