
import net.minecraft.src.ic2.api.CropCard;
import net.minecraft.src.ic2.api.TECrop;
import net.minecraft.src.*;
import net.minecraft.src.forge.*;

public abstract class BasicBerryCrop extends CropCard {
    public ItemStack seed;
    public int spriteIndex;

    public BasicBerryCrop(int id, ItemStack seed, int spriteIndex) {
        CropCard.registerBaseSeed(seed, id, 1, 10, 10, 10);

        this.seed = seed;
        this.spriteIndex = spriteIndex;

        CropCard.registerCrop(this, id);
    }

    @Override
    public int tier() {
        return 2;
    }

    @Override
    public int stat(int n) {
        switch(n) {
        case 0: return 0;   // not chemical
        case 1: return 1;   // edible
        case 2: return 0;   // no defensive properties
        case 3: return 2;   // primarily decorative (TODO)
        case 4: return 0;   // not particularly weed-like
        default: return 0;
        }
    }

    @Override
    public int getSpriteIndex(TECrop crop) {
        return crop.size - 1 + spriteIndex;
    }

    @Override
    public String getTextureFile() {
        return "/berries_crops.png";
    }

    @Override
    public boolean canGrow(TECrop crop) {
        // Grows in three stages:
        // 1 - initially planted
        // 2 - partially grown
        // 3 - fully grown and harvestable
        return crop.size < 3;
    }

    @Override
    public boolean canBeHarvested(TECrop crop) {
        return crop.size == 3;
    }

    @Override
    public int weightInfluences(TECrop crop, float humidity, float nutrients, float air) {
        // TODO: require more humidity, not as much nutrients or air
        return (int)(humidity*1.1 + nutrients*0.9 + air);
    }

    @Override
    public int growthDuration(TECrop crop) {
        //return 225;     // as fast as pumpkin stems
        return 40;
    }

    @Override
    public ItemStack getGain(TECrop crop) {
        ItemStack drop = new ItemStack(seed.itemID, 5, seed.getItemDamage());  // TODO: + random quantity

        return drop;
    }

    @Override
    public byte getSizeAfterHarvest(TECrop crop) {
        // return to partially grown state when harvested
        return 2;
    }
}

@@ -141,16 +141,42 @@
 rge.*;%0A%0A
+import java.util.Random;%0A%0A
 public a
@@ -273,24 +273,50 @@
 spriteIndex;
+%0A    public Random random;
 %0A%0A    public
@@ -500,16 +500,52 @@
 teIndex;
+%0A        this.random = new Random();
 %0A%0A      
@@ -783,15 +783,20 @@
 urn 
-1
+4
 ;   //
+ very
  edi
@@ -881,43 +881,30 @@
 urn 
-2
+4
 ;   // 
-primarily decorative (TODO)
+quite colorful
 %0A   
@@ -1329,16 +1329,30 @@
  planted
+ at seed stage
 %0A       
@@ -1374,16 +1374,27 @@
 ly grown
+ but unripe
 %0A       
@@ -1413,16 +1413,21 @@
 y grown 
+ripe 
 and harv
@@ -1433,16 +1433,17 @@
 vestable
+ 
 %0A       
@@ -1693,21 +1693,16 @@
  // 
-TODO: r
+R
 equire
+s
  mor
@@ -1715,21 +1715,13 @@
 dity
-, not as much
+ than
  nut
@@ -1733,16 +1733,35 @@
 s or air
+, but not much more
 %0A       
@@ -1785,17 +1785,17 @@
 idity*1.
-1
+2
  + nutri
@@ -1808,16 +1808,20 @@
 .9 + air
+*0.9
 );%0A    %7D
@@ -1895,60 +1895,209 @@
   //
-return 225;     // as fast as pumpkin stems%0A
+ Same growth stages as melons and pumpkins%0A        if (crop.size == 2) %7B%0A            // Ripens quickly%0A            return 200;%0A        %7D else %7B%0A            // Takes a while to grow from seed%0A  
         
 retu
@@ -2096,18 +2096,31 @@
     
+  
 return 
-40;
+700;%0A        %7D
 %0A   
@@ -2173,32 +2173,133 @@
 (TECrop crop) %7B%0A
+        // Harvest up to 10 berries when ripe; has 16 in picture but 6 remain unripe, and some spoil%0A
         ItemStac
@@ -2335,16 +2335,36 @@
 temID, 5
+ + random.nextInt(5)
 , seed.g
@@ -2384,35 +2384,8 @@
 )); 
- // TODO: + random quantity
 %0A%0A  
@@ -2556,11 +2556,178 @@
 2;%0A    %7D
+%0A%0A    @Override%0A    public boolean onEntityCollision(TECrop crop, Entity entity) %7B%0A        // you can walk through berries! they don't mind%0A        return false;%0A    %7D
 %0A%7D%0A

Tweak stats, growth, drops, collisions