Al please post a generic crop card

  • al please post a generic crop card file in the forums i know there some in ic2 but please post a file that is setup right with some basic plant so we can see the basic thing please i can code basic java but my file format is poor and pathetic so if you post a file premade i can see the structure of it and and try making some basic plants and unfortuanetly im pretty fail at file structure like i said and it would be a huge boost



    btw i know some people have posted the code but like most of us while i can make a standard mod for minecraft making a mod for a mod is not something i know how to do and like i said above file format and me dont get along

    The difference between a noob and a scrub is there is hope for a noob they can learn, a scrub on the other hand thinks they know better or dont care enough to learn or get better

  • [spoiler]
    package net.minecraft.src;


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


    public class CropMelumpkin extends CropCard {


    @Override
    public String name() {
    return "Melumpkin";
    }

    @Override
    public String discoveredBy() {
    return "Trintus";
    }


    @Override
    public int tier() {
    return 2; // Same as melons
    }


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


    @Override
    public String[] attributes() {
    return new String[] {"Green", "Orange", "Food", "Decoration", "Stem"}; // Melons *and* pumpkins
    }


    @Override
    public int getSpriteIndex(TECrop crop) {
    // Special handling for harvestable melumpkins
    if (crop.size == 4) {
    int harvest = checkMelumpkinHarvest(crop);
    if (harvest == 1) {
    return 19; // Sprouted pumpkins
    } else if (harvest == 2) {
    return 20; // Sprouted melons
    }
    }
    return crop.size+15; // Otherwise, use the shared pumpkin/melon stem sprite
    }


    @Override
    public boolean canGrow(TECrop crop) {
    return crop.size <= 3; // Can always grow, unless it's already harvestable
    }


    @Override
    public int weightInfluences(TECrop crop, float humidity, float nutrients, float air) {
    // Like melons and pumpkins, melumpkins require slightly more humidity and slightly less nutrients to grow
    return (int) (humidity*1.1+nutrients*0.9+air);
    }

    @Override
    public int growthDuration(TECrop crop) {
    if (crop.size == 3) return 650; // Takes a while for stems to sprout fruit
    return 225; // Stems grow pretty fast though
    }

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


    @Override
    public ItemStack getGain(TECrop crop) {
    // Check to see what it grew
    int harvest = checkMelumpkinHarvest(crop);
    if (harvest == 1) {
    return new ItemStack(Block.pumpkin); // Sprouted pumpkins
    } else if (harvest == 2) {
    return new ItemStack(Block.melon); // Sprouted melons
    } else {
    return null; // Shouldn't happen
    }
    }

    @Override
    public byte getSizeAfterHarvest(TECrop crop) {
    // getSizeAfterHarvest should really be a purely informational function
    // without side effects, but I don't see any other 'after harvest' hook,
    // so resetMelumpkinHarvest goes here for now.
    resetMelumpkinHarvest(crop);
    return 3; // Returns to fully-grown stem size
    }


    /**
    * Checks what the melumpkin plant has sprouted. If it hasn't been decided yet,
    * this is where that happens.
    * @param crop TECrop to check on
    * @return 1 for pumpkins, 2 for melons
    */
    public int checkMelumpkinHarvest(TECrop crop) {
    if (crop.custumData[0] == 0) {
    // Hasn't decided what sprouted yet, time to do that
    // 50/50 chance of sprouting pumpkins (1) or melons (2)
    crop.custumData[0] = (short) (crop.worldObj.rand.nextInt(1)+1);
    }
    return crop.custumData[0];
    }

    /**
    * Resets the harvest type of a melumpkin plant, so that the next call to
    * checkMelumpkinHarvest picks a new value.
    * @param crop TECrop to reset
    */
    public void resetMelumpkinHarvest(TECrop crop) {
    crop.custumData[0] = 0; // Set harvest type back to 0 (undecided) so a different type can be picked next time
    }

    }


    [\spoiler]


    i got that from the crop card request page :)

  • yes i see your post and i have made something similar but i dont know how to structure the java file\class as in i can write the code but dont know how to build it so that it will work most of my research has been about modding minecraft not modding mods for minecraft i know im a newb but trying to learn

    The difference between a noob and a scrub is there is hope for a noob they can learn, a scrub on the other hand thinks they know better or dont care enough to learn or get better

  • Take a chill pill, and put in some caps dude.

    1. OMG CREEPER RUN AWAY!
    2. Go away, you creeper wierdo!
    3. What ever, I'll just go around.
    4. Hup, over their heads I go!
    5. Okay Mister living grenade, I'm going to knock you into those skeletons, and I'll follow through with a nano saber. Understood? FOR THE ALMIGHTLY DRAGON LORD!

  • You download the API, put it into your source directory and create a Crop by extending the CropCard and call the CropCard.addCrop method from your mod_File.
    Easy as that.