• 0

    posted a message on TechGuy's Modding Tutorials
    Quote from TechGuy543



    Changing biomeDecorator variables will only effect the biome of which's class you edit it in. That variables only effects vanilla trees.




    So would I need to create a class to add new biomeDecorators for my custom trees to set in?
    Posted in: Mapping and Modding Tutorials
  • 0

    posted a message on TechGuy's Modding Tutorials
    Quote from TechGuy543

    Make the static int lines like the ones in my tutorial. If you really don't want to do that then put the stuff relating to them from the constructor inside a static brace.

    static
    {
    groundBottomTexture = ModLoader.addOverride...
    //etc.
    }

    Something like that should work but I recommend you do it like the tutorial shows.


    Ah, ok. I actually figured out the error. I have a question about the biome spawning though. Does the
     biomeDecorator.treesPerChunk = 5;


    code pertain to how many trees that can be spawned in minecraft? I'm trying to spawn my own trees into the biome but I believe that it wouldn't work this way. World generation doesn't seem to do the job either as it spawns a fairly small amount of trees. Does this have to do with the biome?
    Posted in: Mapping and Modding Tutorials
  • 0

    posted a message on TechGuy's Modding Tutorials
    Quote from TechGuy543

    You must declare the blocks before the biome.



    Thanks, that did the job. My multi-textures don't seem to work though...Here's the code again.

    mod File

    package net.minecraft.src;
    import java.util.Random;
    import java.util.Map;
    import net.minecraft.src.forge.*;
    
    public class mod_TGAEM extends NetworkMod
    {
    public static final BiomeGenBase BiomeHallow = (new BiomeGenHallow(30)).setColor(0xb0e2ff).setBiomeName("Hallowed Plains");
    
    //Neutral
    
    public static final Block mithrilOre = new BlockmithrilOre (200, 0).setHardness(1.0F).setResistance(1.0F).setBlockName("MithrilOre");
    //Evil
    
    public static final Block vileLog = new BlockvileLog (201).setHardness(2.0F).setStepSound(Block.soundWoodFootstep).setBlockName("VileLog");
    public static final Block vilePlank = new BlockvilePlank (202, 0).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundWoodFootstep).setBlockName("Vile Planks").setRequiresSelfNotify();
    public static final Block vileSapling = new BlockvileSapling (203, 0).setHardness(1.0F).setResistance(1.0F).setStepSound(Block.soundGrassFootstep).setBlockName("VileSapling");
    public static final Block vileLeaves = new BlockvileLeaves (204, 0).setHardness(0.2F).setLightOpacity(1).setStepSound(Block.soundGrassFootstep).setBlockName("VileLeaves").setRequiresSelfNotify();
    //Good
    
    public static final Block exaltedLog = new BlockexaltedLog (205).setHardness(2.0F).setStepSound(Block.soundWoodFootstep).setBlockName("ExaltedLog");
    public static final Block exaltedPlank = new BlockexaltedPlank (206, 0).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundWoodFootstep).setBlockName("Exalted Planks").setRequiresSelfNotify();
    public static final Block exaltedSapling = new BlockexaltedSapling (207, 0).setHardness(1.0F).setResistance(1.0F).setStepSound(Block.soundGrassFootstep).setBlockName("ExaltedSapling");
    public static final Block exaltedLeaves = new BlockexaltedLeaves (208, 0).setHardness(0.2F).setLightOpacity(1).setStepSound(Block.soundGrassFootstep).setBlockName("ExaltedLeaves").setRequiresSelfNotify();
    
    public static final Block exaltedGround = new BlockexaltedGround (128, 0).setHardness(0.6F).setStepSound(Block.soundGrassFootstep).setBlockName("Consecrated Ground");
    
    public static final Item vileStick = new Item (205).setItemName("Vile Stick");
    public static final Item exaltedStick = new Item (206).setItemName("Exalted Stick");
    //Texture Integers
    public static int vlogside;
    public static int vlogbottom;
    public static int elogside;
    public static int elogbottom;
    public static int eGroundbottom;
    public static int eGroundtop;
    public static int eGroundside;
    
    public mod_TGAEM()
    {
    //Textures
    //EVIL
    vlogside = ModLoader.addOverride("/terrain.png", "/tgaem/evil/vlogside.png");
    vlogbottom = ModLoader.addOverride("/terrain.png", "/tgaem/evil/vlogbottom.png");
    vilePlank.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tgaem/evil/vileplank.png");
    vileSapling.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tgaem/evil/vilesapling.png");
    vileLeaves.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tgaem/evil/vileleaves.png");
    
    vileStick.iconIndex = ModLoader.addOverride("/gui/items.png", "/tgaem/evil/vilestick.png");
    
    //GOOD
    
    
    elogside = ModLoader.addOverride("/terrain.png", "/tgaem/good/elogside.png");
    elogbottom = ModLoader.addOverride("/terrain.png", "/tgaem/good/elogbottom.png");
    exaltedPlank.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tgaem/good/exaltedplank.png");
    exaltedSapling.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tgaem/good/exaltedsapling.png");
    exaltedLeaves.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tgaem/good/exaltedleaves.png");
    
    eGroundbottom = ModLoader.addOverride("/terrain.png", "/tgaem/good/egroundside.png");
    eGroundtop = ModLoader.addOverride("/terrain.png", "/tgaem/good/egroundside.png");
    eGroundside = ModLoader.addOverride("/terrain.png", "/tgaem/good/egroundside.png");
    
    
    exaltedStick.iconIndex = ModLoader.addOverride("/gui/items.png", "/tgaem/good/exaltedstick.png");
    
    
    //NEUTRAL
    
    //Block Registers/Names
    
    //NEUTRAL
    ModLoader.registerBlock(mithrilOre);
    
    ModLoader.addName(mithrilOre, "Mithril Ore");
    
    mithrilOre.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tgaem/item/mithrilore.png");
    //Good Side
    ModLoader.registerBlock(exaltedLog);
    ModLoader.registerBlock(exaltedPlank);
    ModLoader.registerBlock(exaltedSapling);
    ModLoader.registerBlock(exaltedLeaves);
    ModLoader.registerBlock(exaltedGround);
    
    
    ModLoader.addName(exaltedLog, "Exalted Log");
    ModLoader.addName(exaltedPlank, "Exalted Plank");
    ModLoader.addName(exaltedSapling, "Exalted Sapling");
    ModLoader.addName(exaltedLeaves, "Exalted Leaves");
    ModLoader.addName(exaltedStick, "Exalted Stick");
    ModLoader.addName(exaltedGround, "Exalted Ground");
    //Evil Side
    ModLoader.registerBlock(vileLog);
    ModLoader.registerBlock(vilePlank);
    ModLoader.registerBlock(vileSapling);
    ModLoader.registerBlock(vileLeaves);
    
    
    ModLoader.addName(vileLog, "Vile Log");
    ModLoader.addName(vilePlank, "Vile Plank");
    ModLoader.addName(vileSapling, "Vile Sapling");
    ModLoader.addName(vileLeaves, "Vile Leaves");
    ModLoader.addName(vileStick, "Vile Stick");
    
    
    //Recipes
    //EVIL
    ModLoader.addRecipe(new ItemStack(mod_TGAEM.vilePlank, 4), new Object []{
    "#", Character.valueOf('#'), mod_TGAEM.vileLog
    });
    ModLoader.addRecipe(new ItemStack(mod_TGAEM.vileStick, 4), new Object []{
    "#", "#", Character.valueOf('#'), mod_TGAEM.vilePlank
    });
    
    //GOOD
    ModLoader.addRecipe(new ItemStack(mod_TGAEM.exaltedPlank, 4), new Object []{
    "#", Character.valueOf('#'), mod_TGAEM.exaltedLog
    });
    ModLoader.addRecipe(new ItemStack(mod_TGAEM.exaltedStick, 4), new Object []{
    "#", "#", Character.valueOf('#'), mod_TGAEM.exaltedPlank
    });
    ModLoader.addRecipe(new ItemStack(mod_TGAEM.exaltedGround, 4), new Object []{
    "#", Character.valueOf('#'), Block.dirt
    });
    }
    
    //NEUTRAL
    
    public void generateSurface(World world, Random rand, int chunkX, int chunkZ)
    {
    for(int i = 0; i < (13); i++)
    {
    int randPosX = chunkX + rand.nextInt(16);
    int randPosY = rand.nextInt(23);
    int randPosZ = chunkZ + rand.nextInt(16);
    (new WorldGenMinable(mod_TGAEM.mithrilOre.blockID, 7)).generate(world, rand, randPosX, randPosY, randPosZ);
    System.out.println("Mithril Ores Generated.");
    }
    BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(chunkX, chunkZ);
    WorldGenVileTrees tree = new WorldGenVileTrees();
    if((biome instanceof BiomeGenPlains) || (biome instanceof BiomeGenForest) || (biome instanceof BiomeGenHills) ||
    (biome instanceof BiomeGenDesert) || (biome instanceof BiomeGenSwamp) || (biome instanceof BiomeGenTaiga))
    {
    for(int x = 0; x < 2; x++)
    {
    int Xcoord = chunkX + rand.nextInt(16);
    int Zcoord = chunkZ + rand.nextInt(16);
    int i = world.getHeightValue(Xcoord, Zcoord);
    tree.generate(world, rand, Xcoord, i, Zcoord);
    System.out.println("Vile Trees Generated.");
    }
    BiomeGenBase biome1 = world.getWorldChunkManager().getBiomeGenAt(chunkX, chunkZ);
    WorldGenExaltedTrees tree1 = new WorldGenExaltedTrees();
    if((biome1 instanceof BiomeGenPlains) || (biome1 instanceof BiomeGenForest) || (biome1 instanceof BiomeGenHills) ||
    (biome1 instanceof BiomeGenDesert) || (biome1 instanceof BiomeGenSwamp) || (biome1 instanceof BiomeGenTaiga))
    {
    for(int x = 0; x < 2; x++)
    {
    int Xcoord = chunkX + rand.nextInt(16);
    int Zcoord = chunkZ + rand.nextInt(16);
    int i = world.getHeightValue(Xcoord, Zcoord);
    tree1.generate(world, rand, Xcoord, i, Zcoord);
    System.out.println("Exalted Trees Generated.");
    }
    }
    }
    }
    
    public void load()
    {
    ModLoader.addBiome(BiomeHallow);
    
    }
    
    public String getVersion()
    {
    
    return "1.2.5";
    }
    
    }

    BlockexaltedGround

    package net.minecraft.src;
    
    public class BlockexaltedGround extends Block
    {
    public BlockexaltedGround(int i, int j)
    {
    super(i, j, Material.grass);
    }
    
    public int getBlockTextureFromSideAndMetadata(int i, int j)
    {
    return getBlockTextureFromSide(i);
    }
    
    public int getBlockTextureFromSide(int i)
    {
    if (i == 0)
    {
    return mod_TGAEM.eGroundbottom;
    }
    if (i == 1)
    {
    return mod_TGAEM.eGroundtop;
    }
    else
    {
    return mod_TGAEM.eGroundside;
    }
    }
    }
    Posted in: Mapping and Modding Tutorials
  • 0

    posted a message on TechGuy's Modding Tutorials
    Quote from TechGuy543

    Post the error.


    2012-07-01 11:43:39 [INFO] Forge Mod Loader has loaded 2 mods
    Exception in thread "Minecraft main thread" java.lang.ExceptionInInitializerError
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at java.lang.Class.newInstance0(Unknown Source)
        at java.lang.Class.newInstance(Unknown Source)
        at cpw.mods.fml.common.modloader.ModLoaderModContainer.preInit(ModLoaderModContainer.java:107)
        at cpw.mods.fml.common.Loader.preModInit(Loader.java:235)
        at cpw.mods.fml.common.Loader.loadMods(Loader.java:593)
        at cpw.mods.fml.client.FMLClientHandler.onPreLoad(FMLClientHandler.java:193)
        at net.minecraft.client.Minecraft.startGame(Minecraft.java:383)
        at net.minecraft.client.Minecraft.run(Minecraft.java:735)
        at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.NullPointerException
        at net.minecraft.src.BiomeGenHallow.<init>(BiomeGenHallow.java:12)
        at net.minecraft.src.mod_TGAEM.<clinit>(mod_TGAEM.java:8)
        ... 13 more
    Posted in: Mapping and Modding Tutorials
  • 0

    posted a message on TechGuy's Modding Tutorials
    I have an error while creating my own biome. It seems like whenever I try setting my top or my filler block into a custom block I made, it errors out. Also, multi textured blocks aren't working for the block I want to make a biome in for. Here's the code:

    mod File

    package net.minecraft.src;
    import java.util.Random;
    import java.util.Map;
    import net.minecraft.src.forge.*;
    
    public class mod_TGAEM extends NetworkMod
    {
    public static final BiomeGenBase BiomeHallow = (new BiomeGenHallow(30)).setColor(0xb0e2ff).setBiomeName("Hallowed Plains");
    
    //Neutral
    
    public static final Block mithrilOre = new BlockmithrilOre (200, 0).setHardness(1.0F).setResistance(1.0F).setBlockName("MithrilOre");
    //Evil
    
    public static final Block vileLog = new BlockvileLog (201).setHardness(2.0F).setStepSound(Block.soundWoodFootstep).setBlockName("VileLog");
    public static final Block vilePlank = new BlockvilePlank (202, 0).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundWoodFootstep).setBlockName("Vile Planks").setRequiresSelfNotify();
    public static final Block vileSapling = new BlockvileSapling (203, 0).setHardness(1.0F).setResistance(1.0F).setStepSound(Block.soundGrassFootstep).setBlockName("VileSapling");
    public static final Block vileLeaves = new BlockvileLeaves (204, 0).setHardness(0.2F).setLightOpacity(1).setStepSound(Block.soundGrassFootstep).setBlockName("VileLeaves").setRequiresSelfNotify();
    //Good
    
    public static final Block exaltedLog = new BlockexaltedLog (205).setHardness(2.0F).setStepSound(Block.soundWoodFootstep).setBlockName("ExaltedLog");
    public static final Block exaltedPlank = new BlockexaltedPlank (206, 0).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundWoodFootstep).setBlockName("Exalted Planks").setRequiresSelfNotify();
    public static final Block exaltedSapling = new BlockexaltedSapling (207, 0).setHardness(1.0F).setResistance(1.0F).setStepSound(Block.soundGrassFootstep).setBlockName("ExaltedSapling");
    public static final Block exaltedLeaves = new BlockexaltedLeaves (208, 0).setHardness(0.2F).setLightOpacity(1).setStepSound(Block.soundGrassFootstep).setBlockName("ExaltedLeaves").setRequiresSelfNotify();
    
    public static final Block exaltedGround = new BlockexaltedGround (128, 0).setHardness(0.6F).setStepSound(Block.soundGrassFootstep).setBlockName("Consecrated Ground");
    
    public static final Item vileStick = new Item (205).setItemName("Vile Stick");
    public static final Item exaltedStick = new Item (206).setItemName("Exalted Stick");
    //Texture Integers
    public static int vlogside;
    public static int vlogbottom;
    public static int elogside;
    public static int elogbottom;
    public static int eGroundbottom;
    public static int eGroundtop;
    public static int eGroundside;
    
    public mod_TGAEM()
    {
    //Textures
    //EVIL
    vlogside = ModLoader.addOverride("/terrain.png", "/tgaem/evil/vlogside.png");
         vlogbottom = ModLoader.addOverride("/terrain.png", "/tgaem/evil/vlogbottom.png");
         vilePlank.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tgaem/evil/vileplank.png");
         vileSapling.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tgaem/evil/vilesapling.png");
         vileLeaves.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tgaem/evil/vileleaves.png");
    
         vileStick.iconIndex = ModLoader.addOverride("/gui/items.png", "/tgaem/evil/vilestick.png");
    
    //GOOD
    
    
    elogside = ModLoader.addOverride("/terrain.png", "/tgaem/good/elogside.png");
         elogbottom = ModLoader.addOverride("/terrain.png", "/tgaem/good/elogbottom.png");
         exaltedPlank.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tgaem/good/exaltedplank.png");
         exaltedSapling.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tgaem/good/exaltedsapling.png");
         exaltedLeaves.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tgaem/good/exaltedleaves.png");
    
         eGroundbottom = ModLoader.addOverride("/terrain.png", "/tgaem/good/egroundside.png");
         eGroundtop = ModLoader.addOverride("/terrain.png", "/tgaem/good/egroundside.png");
         eGroundside = ModLoader.addOverride("/terrain.png", "/tgaem/good/egroundside.png");
    
    
         exaltedStick.iconIndex = ModLoader.addOverride("/gui/items.png", "/tgaem/good/exaltedstick.png");
    
    
    //NEUTRAL
    
    //Block Registers/Names
    
         //NEUTRAL
    ModLoader.registerBlock(mithrilOre);
    
    ModLoader.addName(mithrilOre, "Mithril Ore");
    
    mithrilOre.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tgaem/item/mithrilore.png");
    //Good Side
    ModLoader.registerBlock(exaltedLog);
    ModLoader.registerBlock(exaltedPlank);
    ModLoader.registerBlock(exaltedSapling);
    ModLoader.registerBlock(exaltedLeaves);
    ModLoader.registerBlock(exaltedGround);
    
    
    ModLoader.addName(exaltedLog, "Exalted Log");
    ModLoader.addName(exaltedPlank, "Exalted Plank");
    ModLoader.addName(exaltedSapling, "Exalted Sapling");
    ModLoader.addName(exaltedLeaves, "Exalted Leaves");
    ModLoader.addName(exaltedStick, "Exalted Stick");
    ModLoader.addName(exaltedGround, "Exalted Ground");
    //Evil Side
    ModLoader.registerBlock(vileLog);
    ModLoader.registerBlock(vilePlank);
    ModLoader.registerBlock(vileSapling);
    ModLoader.registerBlock(vileLeaves);
    
    
    ModLoader.addName(vileLog, "Vile Log");
    ModLoader.addName(vilePlank, "Vile Plank");
    ModLoader.addName(vileSapling, "Vile Sapling");
    ModLoader.addName(vileLeaves, "Vile Leaves");
    ModLoader.addName(vileStick, "Vile Stick");
    
    
    //Recipes
    //EVIL
    ModLoader.addRecipe(new ItemStack(mod_TGAEM.vilePlank, 4), new Object []{
    "#", Character.valueOf('#'), mod_TGAEM.vileLog
    });
    ModLoader.addRecipe(new ItemStack(mod_TGAEM.vileStick, 4), new Object []{
         "#", "#", Character.valueOf('#'), mod_TGAEM.vilePlank
    });
    
    //GOOD
    ModLoader.addRecipe(new ItemStack(mod_TGAEM.exaltedPlank, 4), new Object []{
    "#", Character.valueOf('#'), mod_TGAEM.exaltedLog
    });
    ModLoader.addRecipe(new ItemStack(mod_TGAEM.exaltedStick, 4), new Object []{
         "#", "#", Character.valueOf('#'), mod_TGAEM.exaltedPlank
    });
    ModLoader.addRecipe(new ItemStack(mod_TGAEM.exaltedGround, 4), new Object []{
    "#", Character.valueOf('#'), Block.dirt
    });
    }
    
    //NEUTRAL
    
    public void generateSurface(World world, Random rand, int chunkX, int chunkZ)
    {
         for(int i = 0; i < (13); i++)
         {
             int randPosX = chunkX + rand.nextInt(16);
             int randPosY = rand.nextInt(23);
             int randPosZ = chunkZ + rand.nextInt(16);
             (new WorldGenMinable(mod_TGAEM.mithrilOre.blockID, 7)).generate(world, rand, randPosX, randPosY, randPosZ);
             System.out.println("Mithril Ores Generated.");
         }
    BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(chunkX, chunkZ);
    WorldGenVileTrees tree = new WorldGenVileTrees();
    if((biome instanceof BiomeGenPlains) || (biome instanceof BiomeGenForest) || (biome instanceof BiomeGenHills) ||
    (biome instanceof BiomeGenDesert) || (biome instanceof BiomeGenSwamp) || (biome instanceof BiomeGenTaiga))
    {
    for(int x = 0; x < 2; x++)
    {
    int Xcoord = chunkX + rand.nextInt(16);
    int Zcoord = chunkZ + rand.nextInt(16);
    int i = world.getHeightValue(Xcoord, Zcoord);
    tree.generate(world, rand, Xcoord, i, Zcoord);
    System.out.println("Vile Trees Generated.");
    }
    BiomeGenBase biome1 = world.getWorldChunkManager().getBiomeGenAt(chunkX, chunkZ);
    WorldGenExaltedTrees tree1 = new WorldGenExaltedTrees();
    if((biome1 instanceof BiomeGenPlains) || (biome1 instanceof BiomeGenForest) || (biome1 instanceof BiomeGenHills) ||
         (biome1 instanceof BiomeGenDesert) || (biome1 instanceof BiomeGenSwamp) || (biome1 instanceof BiomeGenTaiga))
    {
    for(int x = 0; x < 2; x++)
    {
    int Xcoord = chunkX + rand.nextInt(16);
    int Zcoord = chunkZ + rand.nextInt(16);
    int i = world.getHeightValue(Xcoord, Zcoord);
    tree1.generate(world, rand, Xcoord, i, Zcoord);
    System.out.println("Exalted Trees Generated.");
    }
    }
    }
    }
    
    public void load()
    {
         ModLoader.addBiome(BiomeHallow);
    
    }
    
    public String getVersion()
    {
    
    return "1.2.5";
    }
    
    }

    BlockexaltedGround

    package net.minecraft.src;
    
    public class BlockexaltedGround extends Block
    {
         public BlockexaltedGround(int i, int j)
         {
                 super(i, j, Material.grass);
         }
    
         public int getBlockTextureFromSideAndMetadata(int i, int j)
         {
                 return getBlockTextureFromSide(i);
         }
    
         public int getBlockTextureFromSide(int i)
         {
         if (i == 0)
                 {
                         return mod_TGAEM.eGroundbottom;
                 }
                 if (i == 1)
                 {
                         return mod_TGAEM.eGroundtop;
                 }
                 else
                 {
                         return mod_TGAEM.eGroundside;
                 }
         }
    }

    BiomeGenHallow
    package net.minecraft.src;
    
    import java.util.List;
    import java.util.Random;
    
    public class BiomeGenHallow extends BiomeGenBase
    {
         public BiomeGenHallow(int par1)
         {
                 super(par1);
                 spawnableCreatureList.clear();
                 topBlock = (byte)mod_TGAEM.exaltedGround.blockID;
                 fillerBlock = (byte)Block.blockSteel.blockID;
    
                 biomeDecorator.treesPerChunk = 5;
                 biomeDecorator.flowersPerChunk = 4;
                 biomeDecorator.grassPerChunk = 10;
         }
    }

    I believe that the tutorial stated to change the block id of the biome block if minecraft ever crashes but that doesn't work either.
    Posted in: Mapping and Modding Tutorials
  • 0

    posted a message on Cannot Generate Trees
    Quote from TechGuy543

    ModLoader methods were changed to follow the camelCase convention in 1.2.3. GenerateSurface should be generateSurface.


    That did the job, thanks for catching my error. They generate nicely now :)
    Posted in: Modification Development
  • 0

    posted a message on Cannot Generate Trees
    Quote from zapmunk

    Well, I'm not entirely sure what's going on, but then again, I didn't give it more than a cursory look.

    If you're using Eclipse, have you tried dropping a breakpoint in the generation code and then debugging it?
    Or maybe you could System.out.println the coords of any trees as they generate?

    That should help you determine if they're actually generating or not, and then you can from there. Program debugging is a messy experience.


    How do you suppose that I could define random coordinates so that the message will pop up with a coordinate for a tree? Well, this is my first time trying this method out but no message popped up. This is assuming I put it in the right place, which is here in the tree generation part in my mod file:


    BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(chunkX, chunkZ); 
    WorldGenVileTrees tree = new WorldGenVileTrees(); 
    if((biome instanceof BiomeGenPlains) || (biome instanceof BiomeGenForest) || (biome instanceof BiomeGenHills) || 
        (biome instanceof BiomeGenDesert) || (biome instanceof BiomeGenSwamp) || (biome instanceof BiomeGenTaiga))
    { 
    for(int x = 0; x < 2; x++)
    {
    int Xcoord = chunkX + rand.nextInt(16); 
    int Zcoord = chunkZ + rand.nextInt(16); 
    int i = world.getHeightValue(Xcoord, Zcoord); 
    tree.generate(world, rand, Xcoord, i, Zcoord);
    System.out.println("Vile Trees Generated.");
    }
    }
    
     }

    No errors, yet I'm still looking at anything I took out. It may be in the leaves code, but I doubt that would change the generation (I only took off methods that would obstruct its color if it were there).
    Posted in: Modification Development
  • 0

    posted a message on Cannot Generate Trees
    I had attempted to add trees to my world, but I could not seem to generate them at all (I enabled it to spawn in the desert biome so that it could be easier to spot). I had no errors, but it just doesn't seem to pop up. Here's the code I used to make the generation:

    Mod File


    package net.minecraft.src;
    import java.util.Random;
    import java.util.Map;
    import net.minecraft.src.forge.*;
    public class mod_TGAEM extends NetworkMod
    {
    //Ores
    public static final Block mithrilOre = new BlockmithrilOre (200, 0).setHardness(1.0F).setResistance(1.0F).setBlockName("MithrilOre");
    //Trees
    
    public static final Block vileLog = new BlockvileLog (201).setHardness(2.0F).setStepSound(Block.soundWoodFootstep).setBlockName("VileLog");
    public static final Block vilePlank = new BlockWood (202).setHardness(2.0F).setStepSound(Block.soundWoodFootstep).setBlockName("Vile Planks").setRequiresSelfNotify();
    public static final Block vileSapling = new BlockvileSapling (203, 0).setHardness(1.0F).setResistance(1.0F).setBlockName("VileSapling");
    public static final Block vileLeaves = new BlockvileLeaves (204, 0).setHardness(0.2F).setLightOpacity(1).setStepSound(Block.soundGrassFootstep).setBlockName("VileLeaves").setRequiresSelfNotify();
    
    public static final Item vileStick = new Item (205).setItemName("Vile Stick");
    //Texture Integers
    public static int vlogside;
    public static int vlogbottom;
    
    public mod_TGAEM()
    {
    //Neutral Items (To be Renamed)
    ModLoader.registerBlock(mithrilOre);
    
    mithrilOre.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tgaem/item/mithrilore.png");
    //Good Side
    
    //Evil Side
    ModLoader.registerBlock(vileLog);
    ModLoader.registerBlock(vilePlank);
    ModLoader.registerBlock(vileSapling);
    ModLoader.registerBlock(vileLeaves);
    
    
    	ModLoader.addName(vileLog, "Vile Log");
    	ModLoader.addName(vilePlank, "Vile Plank");
    	ModLoader.addName(vileSapling, "Vile Sapling");
    	ModLoader.addName(vileLeaves, "Vile Leaves");
    	ModLoader.addName(vileStick, "Vile Stick");
    
    	vlogside = ModLoader.addOverride("/terrain.png", "/tgaem/evil/vlogside.png");
    	vlogbottom = ModLoader.addOverride("/terrain.png", "/tgaem/evil/vlogbottom.png");
    	vilePlank.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tgaem/evil/vileplank.png");
    	vileSapling.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tgaem/evil/vilesapling.png");
    	vileLeaves.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/tgaem/evil/vileleaves.png");
    
    	vileStick.iconIndex = ModLoader.addOverride("/gui/items.png", "/tgaem/evil/vilestick.png");
    }
    
    public void GenerateSurface(World world, Random rand, int chunkX, int chunkZ)
    {
    	 for(int i = 0; i < (10); i++)
    	 {
    		 int randPosX = chunkX + rand.nextInt(5);
    		 int randPosY = rand.nextInt(18);
    		 int randPosZ = chunkZ + rand.nextInt(5);
    		 (new WorldGenMinable(mod_TGAEM.mithrilOre.blockID, 2)).generate(world, rand, randPosX, randPosY, randPosZ);
    	 }
    BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(chunkX, chunkZ);
    WorldGenVileTrees tree = new WorldGenVileTrees();
    if((biome instanceof BiomeGenPlains) || (biome instanceof BiomeGenForest) || (biome instanceof BiomeGenHills) ||
    	(biome instanceof BiomeGenDesert) || (biome instanceof BiomeGenSwamp) || (biome instanceof BiomeGenTaiga))
    {
    for(int x = 0; x < 2; x++)
    {
    int Xcoord = chunkX + rand.nextInt(16);
    int Zcoord = chunkZ + rand.nextInt(16);
    int i = world.getHeightValue(Xcoord, Zcoord);
    tree.generate(world, rand, Xcoord, i, Zcoord);
    }
    }
    
    }
    
    public String getVersion()
    {
    
    return null;
    }
    
    @Override
    public void load() {
    
    
    }
    
    
    }

    BlockvileLeaves


    package net.minecraft.src;
    
    import java.util.ArrayList;
    import java.util.Random;
    
    import net.minecraft.src.forge.IShearable;
    
    public class BlockvileLeaves extends BlockLeavesBase implements IShearable
    {
    	/**
    	 * The base index in terrain.png corresponding to the fancy version of the leaf texture. This is stored so we can
    	 * switch the displayed version between fancy and fast graphics (fast is this index + 1).
    	 */
    	private int baseIndexInPNG;
    	int[] adjacentTreeBlocks;
    
    	protected BlockvileLeaves(int par1, int par2)
    	{
    		super(par1, par2, Material.leaves, false);
    		this.baseIndexInPNG = par2;
    		this.setTickRandomly(true);
    	}
    
    	public int getBlockColor()
    	{
    		double var1 = 0.5D;
    		double var3 = 1.0D;
    		//return ColorizerFoliage.getFoliageColor(var1, var3);
    		return 0;
    	}
    
    	/**
    	 * Returns the color this block should be rendered. Used by leaves.
    	 */
    	/**public int getRenderColor(int par1)
    	{
    		return (par1 & 3) == 1 ? ColorizerFoliage.getFoliageColorPine() : ((par1 & 3) == 2 ? ColorizerFoliage.getFoliageColorBirch() : ColorizerFoliage.getFoliageColorBasic());
    	}
    
    	/**
    	 * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called
    	 * when first determining what to render.
    	 */
    	/*public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
    	{
    		int var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4);
    
    		if ((var5 & 3) == 1)
    		{
    			return ColorizerFoliage.getFoliageColorPine();
    		}
    		else if ((var5 & 3) == 2)
    		{
    			return ColorizerFoliage.getFoliageColorBirch();
    		}
    		else
    		{
    			int var6 = 0;
    			int var7 = 0;
    			int var8 = 0;
    
    			for (int var9 = -1; var9 <= 1; ++var9)
    			{
    				for (int var10 = -1; var10 <= 1; ++var10)
    				{
    					int var11 = par1IBlockAccess.getBiomeGenForCoords(par2 + var10, par4 + var9).getBiomeFoliageColor();
    					var6 += (var11 & 16711680) >> 16;
    					var7 += (var11 & 65280) >> 8;
    					var8 += var11 & 255;
    				}
    			}
    
    			return (var6 / 9 & 255) << 16 | (var7 / 9 & 255) << 8 | var8 / 9 & 255;
    		}
    	}
    
    	/**
    	 * Called whenever the block is removed.
    	 */
    	public void onBlockRemoval(World par1World, int par2, int par3, int par4)
    	{
    		byte var5 = 1;
    		int var6 = var5 + 1;
    
    		if (par1World.checkChunksExist(par2 - var6, par3 - var6, par4 - var6, par2 + var6, par3 + var6, par4 + var6))
    		{
    			for (int var7 = -var5; var7 <= var5; ++var7)
    			{
    				for (int var8 = -var5; var8 <= var5; ++var8)
    				{
    					for (int var9 = -var5; var9 <= var5; ++var9)
    					{
    						int var10 = par1World.getBlockId(par2 + var7, par3 + var8, par4 + var9);
    
    						if (var10 == mod_TGAEM.vileLeaves.blockID)
    						{
    							int var11 = par1World.getBlockMetadata(par2 + var7, par3 + var8, par4 + var9);
    							par1World.setBlockMetadata(par2 + var7, par3 + var8, par4 + var9, var11 | 8);
    						}
    					}
    				}
    			}
    		}
    	}
    
    	/**
    	 * Ticks the block if it's been scheduled
    	 */
    	public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
    	{
    		if (!par1World.isRemote)
    		{
    			int var6 = par1World.getBlockMetadata(par2, par3, par4);
    
    			if ((var6 & 8) != 0 && (var6 & 4) == 0)
    			{
    				byte var7 = 4;
    				int var8 = var7 + 1;
    				byte var9 = 32;
    				int var10 = var9 * var9;
    				int var11 = var9 / 2;
    
    				if (this.adjacentTreeBlocks == null)
    				{
    					this.adjacentTreeBlocks = new int[var9 * var9 * var9];
    				}
    
    				int var12;
    
    				if (par1World.checkChunksExist(par2 - var8, par3 - var8, par4 - var8, par2 + var8, par3 + var8, par4 + var8))
    				{
    					int var13;
    					int var14;
    					int var15;
    
    					for (var12 = -var7; var12 <= var7; ++var12)
    					{
    						for (var13 = -var7; var13 <= var7; ++var13)
    						{
    							for (var14 = -var7; var14 <= var7; ++var14)
    							{
    								var15 = par1World.getBlockId(par2 + var12, par3 + var13, par4 + var14);
    
    								if (var15 == mod_TGAEM.vileLog.blockID)
    								{
    									this.adjacentTreeBlocks[(var12 + var11) * var10 + (var13 + var11) * var9 + var14 + var11] = 0;
    								}
    								else if (var15 == mod_TGAEM.vileLeaves.blockID)
    								{
    									this.adjacentTreeBlocks[(var12 + var11) * var10 + (var13 + var11) * var9 + var14 + var11] = -2;
    								}
    								else
    								{
    									this.adjacentTreeBlocks[(var12 + var11) * var10 + (var13 + var11) * var9 + var14 + var11] = -1;
    								}
    							}
    						}
    					}
    
    					for (var12 = 1; var12 <= 4; ++var12)
    					{
    						for (var13 = -var7; var13 <= var7; ++var13)
    						{
    							for (var14 = -var7; var14 <= var7; ++var14)
    							{
    								for (var15 = -var7; var15 <= var7; ++var15)
    								{
    									if (this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11) * var9 + var15 + var11] == var12 - 1)
    									{
    										if (this.adjacentTreeBlocks[(var13 + var11 - 1) * var10 + (var14 + var11) * var9 + var15 + var11] == -2)
    										{
    											this.adjacentTreeBlocks[(var13 + var11 - 1) * var10 + (var14 + var11) * var9 + var15 + var11] = var12;
    										}
    
    										if (this.adjacentTreeBlocks[(var13 + var11 + 1) * var10 + (var14 + var11) * var9 + var15 + var11] == -2)
    										{
    											this.adjacentTreeBlocks[(var13 + var11 + 1) * var10 + (var14 + var11) * var9 + var15 + var11] = var12;
    										}
    
    										if (this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11 - 1) * var9 + var15 + var11] == -2)
    										{
    											this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11 - 1) * var9 + var15 + var11] = var12;
    										}
    
    										if (this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11 + 1) * var9 + var15 + var11] == -2)
    										{
    											this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11 + 1) * var9 + var15 + var11] = var12;
    										}
    
    										if (this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11) * var9 + (var15 + var11 - 1)] == -2)
    										{
    											this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11) * var9 + (var15 + var11 - 1)] = var12;
    										}
    
    										if (this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11) * var9 + var15 + var11 + 1] == -2)
    										{
    											this.adjacentTreeBlocks[(var13 + var11) * var10 + (var14 + var11) * var9 + var15 + var11 + 1] = var12;
    										}
    									}
    								}
    							}
    						}
    					}
    				}
    
    				var12 = this.adjacentTreeBlocks[var11 * var10 + var11 * var9 + var11];
    
    				if (var12 >= 0)
    				{
    					par1World.setBlockMetadata(par2, par3, par4, var6 & -9);
    				}
    				else
    				{
    					this.removeLeaves(par1World, par2, par3, par4);
    				}
    			}
    		}
    	}
    
    	private void removeLeaves(World par1World, int par2, int par3, int par4)
    	{
    		this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
    		par1World.setBlockWithNotify(par2, par3, par4, 0);
    	}
    
    	/**
    	 * Returns the quantity of items to drop on block destruction.
    	 */
    	public int quantityDropped(Random par1Random)
    	{
    		return par1Random.nextInt(20) == 0 ? 1 : 0;
    	}
    
    	/**
    	 * Returns the ID of the items to drop on destruction.
    	 */
    	public int idDropped(int par1, Random par2Random, int par3)
    	{
    		return mod_TGAEM.vileSapling.blockID;
    	}
    
    	/**
    	 * Drops the block items with a specified chance of dropping the specified items
    	 */
    	public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
    	{
    		if (!par1World.isRemote)
    		{
    			byte var8 = 20;
    
    			if ((par5 & 3) == 3)
    			{
    				var8 = 40;
    			}
    
    			if (par1World.rand.nextInt(var8) == 0)
    			{
    				int var9 = this.idDropped(par5, par1World.rand, par7);
    				this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(var9, 1, this.damageDropped(par5)));
    			}
    
    			if ((par5 & 3) == 0 && par1World.rand.nextInt(200) == 0)
    			{
    				this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(Item.appleRed, 1, 0));
    			}
    		}
    	}
    
    	/**
    	 * Called when the player destroys a block with an item that can harvest it. (i, j, k) are the coordinates of the
    	 * block and l is the block's subtype/damage.
    	 */
    	public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
    	{
    		super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
    	}
    
    	/**
    	 * Determines the damage on the item the block drops. Used in cloth and wood.
    	 */
    	protected int damageDropped(int par1)
    	{
    		return par1 & 3;
    	}
    
    	/**
    	 * Is this block (a) opaque and (  B) a full 1m cube?  This determines whether or not to render the shared face of two
    	 * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
    	 */
    	public boolean isOpaqueCube()
    	{
    		return !this.graphicsLevel;
    	}
    
    	/**
    	 * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
    	 */
    	public int getBlockTextureFromSideAndMetadata(int par1, int par2)
    	{
    		return (par2 & 3) == 1 ? this.blockIndexInTexture : ((par2 & 3) == 3 ? this.blockIndexInTexture : this.blockIndexInTexture);
    	}
    
    	/**
    	 * Pass true to draw this block using fancy graphics, or false for fast graphics.
    	 */
    	public void setGraphicsLevel(boolean par1)
    	{
    		this.graphicsLevel = par1;
    		//this.blockIndexInTexture = this.baseIndexInPNG + (par1 ? 0 : 1);
    	}
    
    	/**
    	 * Called whenever an entity is walking on top of this block. Args: world, x, y, z, entity
    	 */
    	public void onEntityWalking(World par1World, int par2, int par3, int par4, Entity par5Entity)
    	{
    		super.onEntityWalking(par1World, par2, par3, par4, par5Entity);
    	}
    
    	@Override
    	public boolean isShearable(ItemStack item, World world, int x, int y, int z)
    	{
    		return true;
    	}
    
    	@Override
    	public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
    	{
    		ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
    		ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3));
    		return ret;
    	}
    }
    [/spoiler]
    BlockvileLog
    [spoiler]
    
    package net.minecraft.src;
    
    import java.util.Random;
    
    public class BlockvileLog extends Block
    {
    	protected BlockvileLog(int par1)
    	{
    		super(par1, Material.wood);
    		//this.blockIndexInTexture = 20;
    	}
    
    	/**
    	 * Returns the quantity of items to drop on block destruction.
    	 */
    	public int quantityDropped(Random par1Random)
    	{
    		return 1;
    	}
    
    	/**
    	 * Returns the ID of the items to drop on destruction.
    	 */
    	public int idDropped(int par1, Random par2Random, int par3)
    	{
    		return mod_TGAEM.vileLog.blockID;
    	}
    
    	/**
    	 * Called when the player destroys a block with an item that can harvest it. (i, j, k) are the coordinates of the
    	 * block and l is the block's subtype/damage.
    	 */
    	public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
    	{
    		super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
    	}
    
    	/**
    	 * Called whenever the block is removed.
    	 */
    	public void onBlockRemoval(World par1World, int par2, int par3, int par4)
    	{
    		byte var5 = 4;
    		int var6 = var5 + 1;
    
    		if (par1World.checkChunksExist(par2 - var6, par3 - var6, par4 - var6, par2 + var6, par3 + var6, par4 + var6))
    		{
    			for (int var7 = -var5; var7 <= var5; ++var7)
    			{
    				for (int var8 = -var5; var8 <= var5; ++var8)
    				{
    					for (int var9 = -var5; var9 <= var5; ++var9)
    					{
    						int var10 = par1World.getBlockId(par2 + var7, par3 + var8, par4 + var9);
    
    						if (var10 == mod_TGAEM.vileLeaves.blockID)
    						{
    							int var11 = par1World.getBlockMetadata(par2 + var7, par3 + var8, par4 + var9);
    
    							if ((var11 & 8) == 0)
    							{
    								par1World.setBlockMetadata(par2 + var7, par3 + var8, par4 + var9, var11 | 8);
    							}
    						}
    					}
    				}
    			}
    		}
    	}
    
    	/**
    	 * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
    	 */
    	public int getBlockTextureFromSideAndMetadata(int i, int j)  ////////////////
    	{
    	 if(i == 0)
    return mod_TGAEM.vlogbottom;
    if(i == 1)
    return mod_TGAEM.vlogbottom;
    if(i == 2)
    return mod_TGAEM.vlogside;
    if(i == 3)
    return mod_TGAEM.vlogside;
    if(i == 4)
    return mod_TGAEM.vlogside;
    if(i == 5)
    return mod_TGAEM.vlogside;
    
    		if(j == 1)
    		{
    			return 116;
    		}
    		return j != 2 ? 20 : 117;
    	}
    
    	protected int damageDropped(int i)
    	{
    		return i;
    	}
    }

    BlockvileSapling


    package net.minecraft.src;
    
    import java.util.Random;
    
    public class BlockvileSapling extends BlockFlower
    {
    
    	protected BlockvileSapling(int i, int j)
    	{
    		super(i, j);
    		float f = 0.4F;
    		setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f);
    	}
    
    	protected boolean canThisPlantGrowOnThisBlockID(int i)
    	{
    		return i == Block.sand.blockID;
    	}
    
    
    	public void updateTick(World world, int i, int j, int k, Random random)
    	{
    		if(world.isRemote)
    		{
    			return;
    		}
    		super.updateTick(world, i, j, k, random);
    
    		if(world.getBlockLightValue(i, j + 1, k) >= 9 && random.nextInt(7) == 0)
    		{
    			int l = world.getBlockMetadata(i, j, k);
    			if((l & 8) == 0)
    			{
    				world.setBlockMetadataWithNotify(i, j, k, l | 8);
    			} else
    			{
    				growTree(world, i, j, k, random);
    			}
    		}
    	}
    
    	public int getBlockTextureFromSideAndMetadata(int i, int j)
    	{
    		j &= 3;
    		if(j == 1)
    		{
    			return blockIndexInTexture;  //63
    		}
    		if(j == 2)
    		{
    			return blockIndexInTexture; //79
    		} else
    		{
    			//return super.getBlockTextureFromSideAndMetadata(i, j);
    		 return blockIndexInTexture;
    		}
    	}
    
    	public void growTree(World world, int i, int j, int k, Random random)
    	{
    		int l = world.getBlockMetadata(i, j, k) & 3;
    		world.setBlock(i, j, k, 0);
    		Object obj = null;
    		obj = new WorldGenVileTrees();
    		/*if(l == 1)
    		{
    			obj = new WorldGenTaiga2(true);
    		} else
    		if(l == 2)
    		{
    			obj = new WorldGenForest(true);
    		} else
    		{
    			obj = new WorldGenTrees(true);
    			if(random.nextInt(10) == 0)
    			{
    				obj = new WorldGenBigTree(true);
    			}
    		}*/
    		if(!((WorldGenerator) (obj)).generate(world, random, i, j, k))
    		{
    			world.setBlockAndMetadata(i, j, k, blockID, l);
    		}
    	}
    
    	protected int damageDropped(int i)
    	{
    		return i & 3;
    	}
    }

    WorldGenVileTrees


    package net.minecraft.src;
    import java.util.Random;
    
    public class WorldGenVileTrees extends WorldGenerator
    {
    public WorldGenVileTrees()
    {
    }
    
    public boolean generate(World world, Random random, int i, int j, int k)
    	{
    		int l = random.nextInt(3) + 4;
    		boolean flag = true;
    		if(j < 1)
    		{
    			return false;
    		}
    		for(int i1 = j; i1 <= j + 1 + l; i1++)
    		{
    			byte byte0 = 1;
    			if(i1 == j)
    			{
    				byte0 = 0;
    			}
    			if(i1 >= (j + 1 + l) - 2)
    			{
    				byte0 = 2;
    			}
    			for(int i2 = i - byte0; i2 <= i + byte0 && flag; i2++)
    			{
    				for(int l2 = k - byte0; l2 <= k + byte0 && flag; l2++)
    				{
    					if(i1 >= 0)
    					{
    						int j3 = world.getBlockId(i2, i1, l2);
    						if(j3 != 0 && j3 != mod_TGAEM.vileLeaves.blockID)  /////Leaf/////
    						{
    							flag = false;
    						}
    					} else
    					{
    						flag = false;
    					}
    				}
    
    			}
    
    		}
    
    		if(!flag)
    		{
    			return false;
    		}
    		int j1 = world.getBlockId(i, j - 1, k);
    		if(j1 != Block.sand.blockID && j1 != Block.dirt.blockID)
    		 //sand = which block CAN the tree spawn on
    		{
    			return false;
    		}
    		world.setBlock(i, j - 1, k, Block.sand.blockID);   //sand = block created underneath the tree
    		for(int k1 = (j - 3) + l; k1 <= j + l; k1++)
    		{
    			int j2 = k1 - (j + l);
    			int i3 = 1 - j2 / 2;
    			for(int k3 = i - i3; k3 <= i + i3; k3++)
    			{
    				int l3 = k3 - i;
    				for(int i4 = k - i3; i4 <= k + i3; i4++)
    				{
    					int j4 = i4 - k;
    					if((Math.abs(l3) != i3 || Math.abs(j4) != i3 || random.nextInt(2) != 0 && j2 != 0) && !Block.opaqueCubeLookup[world.getBlockId(k3, k1, i4)])
    					{
    					 setBlockAndMetadata(world, k3, k1, i4, mod_TGAEM.vileLeaves.blockID, 0);  //Leaf////
    					}
    				}
    
    			}
    
    		}
    
    		for(int l1 = 0; l1 < l; l1++)
    		{
    			int k2 = world.getBlockId(i, j + l1, k);
    			if(k2 == 0 || k2 == mod_TGAEM.vileLeaves.blockID) ////Leaf/////
    			{
    			 setBlockAndMetadata(world, i, j + l1, k, mod_TGAEM.vileLog.blockID, 0);   //////Log////
    			}
    		}
    
    		return true;
    	}
    }


    Thanks to anyone who can help me out.
    Posted in: Modification Development
  • 0

    posted a message on The Good and Evil Mod [WIP]
    We are still looking for more modders, texture artists, and ideas! Progress will hopefully be made sometime later!
    Posted in: WIP Mods
  • 0

    posted a message on [1.3.2] SDK's Mods [v1] *Aug 18th ModLoaderMP Updated*
    Quote from Ghost Hacker

    Mods loaded: 11
    ModLoader 1.2.5
    mod_CodeChickenCore 0.5.2
    mod_MineAndBlade Battlegear - 0.1.6.1 [1.2.5]
    mod_MinecraftForge 3.1.2.90
    mod_Invasion 0.9.4
    mod_ModLoaderMp 1.2.5v1
    mod_SdkFlasher 1.2.3v1
    mod_SdkFps 1.2.3v1
    mod_SdkGrapplingHook 1.2.3v1
    mod_SdkGuns 1.2.3v1
    mod_SdkUtility 1.2.3v1

    Minecraft has crashed!
    ----------------------

    Minecraft has stopped running because it encountered a problem.




    --- BEGIN ERROR REPORT 5bbab06c --------
    Generated 22/04/12 10:59 AM

    Minecraft: Minecraft 1.2.5
    OS: Windows Vista (x86) version 6.0
    Java: 1.6.0_31, Sun Microsystems Inc.
    VM: Java HotSpotâ„¢ Client VM (mixed mode), Sun Microsystems Inc.
    LWJGL: 2.4.2
    OpenGL: ATI Mobility Radeon HD 2400 XT version 2.1.7981 Release, ATI Technologies Inc.

    java.lang.Exception: No more empty terrain sprite indices left!
    at ModLoader.getUniqueTerrainSpriteIndex(ModLoader.java:738)
    at ModLoader.getUniqueSpriteIndex(ModLoader.java:721)
    at ModLoader.addOverride(ModLoader.java:357)
    at mod_Invasion.load(mod_Invasion.java:98)
    at ModLoader.init(ModLoader.java:891)
    at ModLoader.addAllRenderers(ModLoader.java:189)
    at ahu.<init>(ahu.java:77)
    at ahu.<clinit>(ahu.java:8)
    at net.minecraft.client.Minecraft.a(Minecraft.java:394)
    at net.minecraft.client.Minecraft.run(Minecraft.java:732)
    at java.lang.Thread.run(Unknown Source)
    --- END ERROR REPORT 6c6b1af ----------

    Aw, SDK's gun mod seems to be incompatible with invasion mod.


    Actually, it should work. You just have too many mods installed, like battlegear.
    Posted in: Minecraft Mods
  • 0

    posted a message on Flan's Mod 5.5.2 Update : 1.12.2, 100s of new Skins! : Helicopters, Mechas, Planes, Vehicles, 3D Guns, Multiplayer, TDM, CTF
    Quote from Pr. Awesomoe

    I don't mean to keep spamming, but nobody is helping me at all with my download problem. The website that the download is on is not accessible on my computer, so could anyone who is flan or works with him on this mod/thread please Pm me a download link for this on media fire or something or post it on the thread.


    The mediafire servers should work now, I just downloaded the file from it.

    Quote from TDH117

    I installed this mod correctly and minecraft crashed.


    The issue lies within minecraft forge, not flan's mod. For some reason forge at 1.2.4 doesn't take a liking in 1.2.5 so you have to downgrade if you want to use this mod.
    Posted in: Minecraft Mods
  • 0

    posted a message on Selecting Item/Knockback Question
    Quote from Kave

    There is actually a method within the Item class, which is called onUpdate

    	/**
    	 * Called each tick as long the item is on a player inventory. Uses by maps to check if is on a player hand and
    	 * update it's contents.
    	 */
    	public void onUpdate(ItemStack itemstack, World world, Entity entity, int i, boolean flag)
    	{
    	}

    itemstack is (of course) the item Stack, entity is (i think) the player, i is the position in the quickslot-bar at the bottom (starting at 0), and flag (the important one for you) defines whether the item is currently in the player's hand


    Thanks, that got me somewhere. I have another issue now though, although it relates to the speed of which a person moves at the time when using said weapon.


    public void onUpdate(ItemStack itemstack, World world, Entity entity, int i, boolean flag)
    {
    if (world.isRemote)
    {
        return;
    }
    if (entity instanceof EntityPlayer)
    {
        EntityPlayer entityplayer = (EntityPlayer)entity;
    }
    if (flag)
    {
    entity.motionX *= 1.40000000000000002D;
         entity.motionZ *= 1.40000000000000002D;
    }


    Using the soulsand code, I put the entity.motionX and motionZ together to create the effect on the entity who is using the weapon. However, when it is set to something over 1, the player tends to slide quickly in one direction when they jump. Is there a way to fix this?
    Posted in: Modification Development
  • 0

    posted a message on Selecting Item/Knockback Question
    Hello,

    I was wondering if there was a line of code that indicates an action whereas when someone selects a weapon something will happen to them. For example:


     public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
        {
            itemstack.damageItem(1, entityliving1);
            return true;
        }


    As this code is stating that if it hits an entity it will damage the durability of the item by one. What I want to do with my sword is that when it is selected, it will slow the wearer down, and when it is deselected it will return the owner's speed back to normal. I didn't find anything that would do this, so I was wondering if it were to be possible to do so.

    Also, I've seen some mods that knockback monsters more significantly than the default minecraft weapons. What initiates the knockback rate?

    Thank you for anyone who can help me.
    Posted in: Modification Development
  • 0

    posted a message on Minecraft Modding Made Easy (40+ Videos!)
    Quote from fox_news

    you forgot 1 thing and messed up on 1 thing


    Nope, it's still not holding anything.
    Posted in: Tutorials
  • 0

    posted a message on Minecraft Modding Made Easy (40+ Videos!)
    I tried to add a sword for my mob to hold, but it doesn't pop up when I try to add it in. Here's my code:


    package net.minecraft.src;
    
    import java.util.Random;
    
    public class EntityBandit extends EntityMob
    {
    Random rand = new Random();
    public int chance;
    
        public EntityBandit(World world)
        {
            super(world);
            texture = "/skillinazn/bandit.png";
            moveSpeed = 0.9F;
            attackStrength = 6;
            tasks.addTask(1, new EntityAISwimming(this));
            tasks.addTask(2, new EntityAIAttackOnCollide(this, world, 16F));
            tasks.addTask(3, new EntityAIWander(this));
            tasks.addTask(4, new EntityAIWatchClosest(this, world, 8F));
            tasks.addTask(4, new EntityAILookIdle(this));
        }
    
        public int getMaxHealth()
        {
            return 20;
        }
    
        public int getTotalArmorValue()
        {
            return 2;
        }
    
        protected boolean isAIEnabled()
        {
            return false;
        }
    
        public void onLivingUpdate()
        {
            if (worldObj.isDaytime() && !worldObj.isRemote)
            {
                float f = getEntityBrightness(1.0F);
                if (f > 0.5F && worldObj.canBlockSeeTheSky(MathHelper.floor_double(posX), MathHelper.floor_double(posY), MathHelper.floor_double(posZ)) && rand.nextFloat() * 30F < (f - 0.4F) * 2.0F)
                {
                    //setFire(8); //Decomment if you want mob to be set on fire at day.
                }
            }
            super.onLivingUpdate();
        }
    
        protected String getLivingSound()
        {
            return null;
        }
    
        protected String getHurtSound()
        {
            return "damage.hurtflesh";
        }
    
        protected String getDeathSound()
        {
            return null;
        }
    
        protected int getDropItemId()
        {
         chance = rand.nextInt(20);
         if(chance < 4)
            return Item.swordSteel.shiftedIndex;
            if(chance < 10 && chance > 4)
            return Item.appleRed.shiftedIndex;
            if(chance == 1)
            return Item.diamond.shiftedIndex;
            if(chance < 20 && chance > 15)
            return Item.ingotIron.shiftedIndex;
            else
            return Item.flint.shiftedIndex;
        }
    
        public ItemStack getHeldItem()
        {
        return heldItem;
        }
    
    public static final ItemStack heldItem = new ItemStack(Item.swordSteel, 1);
        
    }


    Any ideas on how to fix this?
    Posted in: Tutorials
  • To post a comment, please .