• 0

    posted a message on Item not being crafted
    Quote from Tj3

    META-INF has been deleted, the game isn't blackscreening. It's an error with the code somewhere.


    Well looking at the code I see two things that might be causing it.

    First remove:
    .setIconCoord(13, 10)

    Since you use PizzaSlice.iconIndex = ModLoader.AddOverride("/gui/items.png", "/Food/PizzaSlice.png");

    Second Change your recipe code to this:
    ModLoader.AddRecipe(new ItemStack(PizzaSlice, 1), new Object[]
    { "###", "XXX", "###", Character.valueOf('#'), Block.dirt, Character.valueOf('X'), Block.cobblestone });


    You already defined # as being Block.dirt, so there was no need to define it again as a different symbol, which I assume was the culprit.
    Posted in: Modification Development
  • 0

    posted a message on help with modding how do i make an new ore and make it generate
    Quote from and18rew

    :soil: I am gonna make a hidden dirt bllock that is overpowered and dropps alot of ores how would I make it modloader compatible


    Check out Strength's Tutorials located here. He goes through how to create a Block and how to make a block generate like ores.
    Posted in: Modification Development
  • 0

    posted a message on Item not being crafted
    Quote from Tj3

    Isn't there something similar to ModLoader.RegisterBlock() for items you need to do? Otherwise, I'm not sure. Are you sure you are using the right recipe?


    No there isn't, at least I never have.

    OP have you made sure that A) You have ModLoader installed and :cool.gif: META-INF was deleted(it's located in your minecraft.jar).
    Posted in: Modification Development
  • 0

    posted a message on Help with Java please? :D
    Quote from Zurchi

    Ok so i figured out one major error but i still get a error on
    ModLoader.AddRecipe(new ItemStack(redwoodenSword, 1), new Object []{
    			" $ ", " $ ", " % ", Character.valueOf('$'), Item.dyePowder, 1, 0) Character.valueOf('%'), Item.swordWood
    		});

    it wants me to put
    ModLoader.AddRecipe(new ItemStack(redwoodenSword, 1), new Object []{
    			" $ ", " $ ", " % ", Character.valueOf('$'), Item.dyePowder, 1, 0")" Character.valueOf('%'), Item.swordWood
    		});

    The difference being
    Item.dyePowder, 1, 0")"



    The problem with the recipe is the ) after 0". When using a dye as a ingredient you need to do this:
    new ItemStack(Item.dyePowder, 1, x),


    X being the damage value (or the ID of the color you want).

    Also just so you know, 0 is the color ID for Black. In the tutorial I posted there is a list of colors with their corresponding damage values(or again ID's).
    Posted in: Modification Development
  • 0

    posted a message on Can anyone tell me whats wrong?
    Hmm I don't understand why you placed everything in it's own method, I'm guessing that's the problem.

    So delete everything within:
    public mod_Tools()
    {
    //todo list
    addNames(); //Done
    setTextures(); //Done
    addFuel();
    registerBlocks();
    addRecipes(); //Done
    addSmelting();
    }


    And change your source to this:

    package net.minecraft.src;
    import java.util.Random;
    
    public class mod_Tools extends BaseMod
    {
    	public mod_Tools()
    	{
    		ModLoader.AddName(SteelPickaxe, "Smooth Pickaxe");
    		ModLoader.AddName(SteelAxe, "Smooth Axe");
    		ModLoader.AddName(SteelShovel, "Smooth Shovel");
    		ModLoader.AddName(SteelHoe, "Smooth Hoe");
    		ModLoader.AddName(SteelSword, "Smooth Sword");
    		ModLoader.AddName(SteelIngot, "Steel Ingot");
    		
    		SteelPickaxe.iconIndex = ModLoader.addOverride("/gui/items.png", "/Tools/SteelPickaxe.png");
    		SteelAxe.iconIndex = ModLoader.addOverride("/gui/items.png", "/Tools/SteelAxe.png");
    		SteelShovel.iconIndex = ModLoader.addOverride("/gui/items.png", "/Tools/SteelShovel.png");
    		SteelHoe.iconIndex = ModLoader.addOverride("/gui/items.png", "/Tools/SteelHoe.png");
    		SteelSword.iconIndex = ModLoader.addOverride("/gui/items.png", "/Tools/SteelSword.png");
    		SteelIngot.iconIndex = ModLoader.addOverride("/gui/items.png", "/Tools/SteelIngot.png");
    
    		ModLoader.AddRecipe(new ItemStack(SteelPickaxe, 1), new Object[] {
    		"MMM", " S ", " S ", Character.valueOf('M'), mod_SteelIngot.steelIngot, Character.valueOf('S'), Item.stick
    		});
    		ModLoader.AddRecipe(new ItemStack(SteelAxe, 1), new Object[] {
    		"MM ", "MS ", " S ", Character.valueOf('M'), mod_SteelIngot.steelIngot, Character.valueOf('S'), Item.stick
    		});
    		ModLoader.AddRecipe(new ItemStack(SteelShovel, 1), new Object[] {
    		" M ", " S ", " S ", Character.valueOf('M'), mod_SteelIngot.steelIngot, Character.valueOf('S'), Item.stick
    		});
    		ModLoader.AddRecipe(new ItemStack(SteelHoe, 1), new Object[] {
    		"MM ", " S ", " S ", Character.valueOf('M'), mod_SteelIngot.steelIngot, Character.valueOf('S'), Item.stick
    		});
    		ModLoader.AddRecipe(new ItemStack(SteelSword, 1), new Object[] {
    		" M ", " M ", " S ", Character.valueOf('M'), mod_SteelIngot.steelIngot, Character.valueOf('S'), Item.stick
    		});
    		
    		ModLoader.AddSmelting(Block.stone.blockID, new ItemStack(SteelIngot, 1));
    	}
    	
    	public String Version()
    	{
    	        return "mod_Tools v.1";
    	}
    
    	public static Item SteelPickaxe = new ItemPickaxe(2000, EnumToolMaterial.SSTEEL).setItemName("SteelPickaxe");
    	public static Item SteelShovel = new ItemSpade(2001, EnumToolMaterial.SSTEEL).setItemName("SteelShovel");
    	public static Item SteelAxe = new ItemAxe(2002, EnumToolMaterial.SSTEEL).setItemName("SteelAxe");
    	public static Item SteelSword = new ItemSword(2004, EnumToolMaterial.SSTEEL).setItemName("SteelSword");
    	public static Item SteelHoe = new ItemHoe(2003, EnumToolMaterial.SSTEEL).setItemName("SteelHoe");
    	public static Item SteelIngot = new Item(2005).setMaxStackSize(64).setItemName("Steel Ingot");
    
    
    }


    Also note how I changed this line:
    public static Item SteelPickaxe;
    public static Item SteelShovel;
    public static Item SteelAxe;
    public static Item SteelSword;
    public static Item SteelHoe;
    public static Item SteelIngot;
    static
    {
    SteelPickaxe = new ItemPickaxe(2000, EnumToolMaterial.SSTEEL).setItemName("SteelPickaxe");
    SteelShovel = new ItemSpade(2001, EnumToolMaterial.SSTEEL).setItemName("SteelShovel");
    SteelAxe = new ItemAxe(2002, EnumToolMaterial.SSTEEL).setItemName("SteelAxe");
    SteelHoe = new ItemHoe(2003, EnumToolMaterial.SSTEEL).setItemName("SteelHoe");
    SteelSword = new ItemSword(2004, EnumToolMaterial.SSTEEL).setItemName("SteelSword");
    SteelIngot = new Item(2005).setMaxStackSize(64).setItemName("Steel Ingot");
    }


    In my experience using that:
    static
    {
    }

    Only seems to cause problems, you can change it back if you want but it should still work as expected.
    Posted in: Modification Development
  • 0

    posted a message on Help
    From looking at this line:
    at net.minecraft.src.mod_Hamburger.<init>(mod_Hamburger.java:13)


    I'm going to assume the error is in mod_Hamburger.java and is located somewhere around the line 13 (so either it is line 13 or above or below it). I'm also going to assume it's an error with a recipe from looking at the other lines with the error log. So go back into mod_Hamburger.java and double check everything around line 13 and see if you can resolve it yourself. If not post the source here so someone can assist you.
    Posted in: Modification Development
  • 7

    posted a message on [1.8.1] Some Turtle's *Not your average tutorials*
    Update (Please Read): I'm going to start using this as a place to store any tutorials I create. My main goal is to provide tutorials that are rarely covered are aren't covered at all(so no new block, new item tutorials). I'm still learning and as I learn I don't mind sharing the information I've learned. I do ask you do one thing and that is learn from these tutorials! Don't just copy and paste and never look at the code again, try and understand what is happening and what you are doing.

    These tutorials are for ModLoader!

    Easy Tutorials


    Using Dyes in Recipes (This can be applied to all blocks containing damage values like Wool for instance!)
    If you noticed Dyes and Wools are stored using damage values, which allows multiple items/blocks to be stored on a single ID. Because of this the basic Item.dyePowder or Block.wool doesn't work in recipes because your not providing the Damage Value.

    To do so is actually really simple.

    Here is an example of a recipe that won't work:
    ModLoader.AddRecipe(new ItemStack(Item.dyePowder, 9), new Object[]
    { "#", Character.valueOf('#'), Block.dirt });


    To make it work you would need to replace "Item.dyePowder, 9" with "Item.dyePowder, 9, 0", so the new recipe would look like this:
    ModLoader.AddRecipe(new ItemStack(Item.dyePowder, 9, 0), new Object[]
    { "#", Character.valueOf('#'), Block.dirt });


    The 9 is the amount that will be crafted after fulfilling the recipe and the 0 is the damage value(which you could also consider the "ID" in some sense) of the Item.dyePowder. With this recipe 1 dirt block will craft 9 Black Dyes.

    Now there is a minor tweak that needs to be made when making a dye part of the recipe.

    This is an example of a recipe that won't work:
    ModLoader.AddRecipe(new ItemStack(Block.dirt, 9), new Object[]
    { "#", Character.valueOf('#'), Item.dyePowder });


    To make it work you would need to replace "Item.dyePowder" with "new ItemStack(Item.dyePowder, 1, 0)", so the new recipe would look like this.
    ModLoader.AddRecipe(new ItemStack(Block.dirt, 9), new Object[]
    { "#", Character.valueOf('#'), new ItemStack(Item.dyePowder, 1, 0) });


    The 1 always has to be there, it doesn't change, the 0 is the damage value of Item.dyePowder. With this recipe 1 Black Dye would craft 1 dirt block.

    The damage values for Item.dyePowder and their corresponding color.
    Black - 0
    Red - 1
    Green - 2
    Brown - 3
    Blue - 4
    Purple - 5
    Cyan - 6
    Light Gray - 7
    Gray - 8
    Pink - 9
    Lime Green - 10
    Yellow - 11
    Light Blue - 12
    Magenta - 13
    Orange - 14
    White - 15
    Using Weapons/Tools/Armors in Recipes
    Now for the most part using Weapons/Tools/Armors in recipes is pretty straight forward.

    Here is an example of a recipe where 1 Iron Pickaxe will create 1 Dirt Block (Just for examples sake):
    ModLoader.AddShapelessRecipe(Block.dirt, 1), new Object[]
    { Item.pickaxeSteel });


    Now this will work fine except for 1 problem, if the tool has taken any damage the recipe won't work. So to fix that we are going to have to change "Item.pickaxeSteel" to "new ItemStack(Item.pickaxeSteel, 1, -1)".

    Doing so would give us this recipe:
    ModLoader.AddShapelessRecipe(Block.dirt, 1), new Object[]
    { new ItemStack(Item.pickaxeSteel, 1, -1) });


    Now whether or not the tool has taken any damage, when crafted it will produce 1 dirt block. Now I'm not a 100% certain why this works, but I know for a fact it does.

    This can be used with all tools/weapons/armors, simply change "pickaxeSteel" to what tool/weapon/armor you would like to use.

    Adding New Fuel Sources

    Now I've only seen a few tutorials on creating few but some of them aren't really descriptive and could use just a tad bit more information, so I created this quick tutorial on the subject.

    We'll start out by creating a new mod_***.java file, we'll call this one mod_NewFuel:
    package net.minecraft.src;
    
    public class mod_NewFuel extends BaseMod
    {
    	public mod_NewFuel()
    	{
    	}
    	public String Version()
    	{
    		return "New Fuel 1.8.1";
    	}
    }


    Now lets take a look at the code that you use to add fuel:
       public int AddFuel(int i, int j)
       {
          if(i == Name.IDtype) 
          {
             return fuelAmount;
          }
          return 0;
       }


    Name = The name of the item or block you want to become a fuel source.
    IDtype = If "Name" is an item, IDtype would become shiftedIndex. If "Name" is a block, IDtype would be blockID.
    fuelAmount = Fuel amount is the amount of fuel the new item/block will possess. Each item takes 200 FA to smelt, Coal can smelt 8 items therefore it has 1600 FA.

    Now to get this to work, you would place this inside of your mod_NewFuel class but outside of your mod_NewFuel constructor, like so:
    package net.minecraft.src;
    
    public class mod_NewFuel extends BaseMod
    {
    	public int AddFuel(int i, int j)
            {
    		if(i == Block.dirt.blockID) 
    		{
    			return 400;
    		}
    		return 0;
            }
    	public mod_NewFuel()
    	{
    	}
    	public String Version()
    	{
    		return "New Fuel 1.8.1";
    	}
    }

    This would make it so dirt can be used as a fuel, it will be able to smelt 2 items.

    Now let's say you want to add more then one block or item as fuel, it's as simple as adding a new if command.
    package net.minecraft.src;
    
    public class mod_NewFuel extends BaseMod
    {
    	public int AddFuel(int i, int j)
            {
    		if(i == Block.dirt.blockID) 
    		{
    			return 400;
    		}
    		if(i == Item.ingotIron.shiftedIndex)
    		{
    			return 1000;
    		}
    		return 0;
            }
    	public mod_NewFuel()
    	{
    	}
    	public String Version()
    	{
    		return "New Fuel 1.8.1";
    	}
    }


    Now with this code, Dirt would become a fuel source that smelts 2 items while Iron Bars would become a fuel source that smelts 5 items.

    Intermediate Tutorials

    Creating a Block With Randomized Drop

    In this tutorial I'm going to show you how to make a block drop more then one item. On top of that we are going to randomize the amount that is dropped each time as well as randomize which items are dropped. Keep in mind I don't know exactly what every bit of coding does so if I state something wrong please feel free to correct me.

    Here is an example, using a mod I recently released, of what we are going to be doing:

    First we need to create a mod_Test.java file. Place the following within this file:

    package net.minecraft.src;
    
    public class mod_Test extends BaseMod
    {	
    	public mod_Test()
    	{
    	}
    	
    
    	public String Version()
    	{
    		return "1.8.1";
    	}
    }


    Now we need to create the block file, we'll name it BlockTest.java. Place the following within this file:

    package net.minecraft.src;
    
    import java.util.Random;
    
    public class BlockTest extends Block
    {
    
        public BlockTest(int i, int j)
        {
            super(i, j, Material.ground);           
        }
        public int idDropped(int i, Random random)
        {
           return mod_Test.Test.blockID;
        }
        public int quantityDropped(Random random)
        {
                return 0;
        }
    }


    Pretty basic so far, before we go any further lets go ahead and register our block, give it a name, a texture, and recipe within mod_Test.java.

    package net.minecraft.src;
    
    public class mod_Test extends BaseMod
    {	
    	public static Block Test = new BlockTest(230, 0).setHardness(1.0F).setResistance(60.0F).setBlockName("Test");
    	
    	public mod_Test()
    	{
    		ModLoader.RegisterBlock(Test);
    		Test.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/test.png");
    		ModLoader.AddRecipe(new ItemStack(Test, 1), new Object[]
    		{ "#", Character.valueOf('#'), Block.dirt });
    	}
    	
    
    	public String Version()
    	{
    		return "1.8.1";
    	}
    }


    Good now we don't need to edit mod_Test.java anymore, once we finish up with BlockTest.java we can recompile and test.

    Now back to BlockTest.java, in order to make this work we are going to have to add a few methods, the first one we'll add is called dropBlockAsItemWithChance.
    package net.minecraft.src;
    
    import java.util.Random;
    
    public class BlockTest extends Block
    {
    
        public BlockTest(int i, int j)
        {
            super(i, j, Material.ground);           
        }
        public int idDropped(int i, Random random)
        {
           return mod_Test.Test.blockID;
        }
        public int quantityDropped(Random random)
        {
                return 0;
        }
        public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f)
        {
            super.dropBlockAsItemWithChance(world, i, j, k, l, f);
            if(world.multiplayerWorld)
            {
                return;
            }
        }
    }


    To the best of my knowledge, this method is what allows us to initiate multiple drops. Now before we move on let's think of what items we are going to allow our block to drop.
    I think we'll go with Coal, Iron Ingot(bars), and Gold Ingot(bars). For each item we want to drop we are going to have to make it's own method. We'll create the method for coal first so I can break down what's going on(to the best of my knowledge).
    	public void dropCoal(World world, int i, int j, int k, int l, float f) //This creates a void method called dropCoal, the void is there so we don't need to have a return within the method.
    	{                                                                      //Within the ()'s we are telling what information needs to get passed down to the method, in this case it's identical to the dropBlockAsItemWithChance method.
    		float f1 = 0.7F;
            float f2 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
            float f3 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
            float f4 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;  	   //Now I'm not 100% sure, but I believe these varibles are set to be used to make the items pop out of the block in random directions.
    		EntityItem entityitem1 = new EntityItem(world, (float)i + f2, (float)j + f3, (float)k + f4, new ItemStack(Item.coal)); //This creates a new instance of EntityItem called entityitem1, it then passes the above variables as well as which item is going to drop onto EntityItem.
            entityitem1.delayBeforeCanPickup = 10; //This sets the delay before the item can be picked up, I assume this is in place so players can see the items that come out before it is sucked into their inventory.
            world.entityJoinedWorld(entityitem1); //This is what actually makes the item appear after breaking our block.
    	}


    So now we just have to create the methods for our Iron and Gold Ingot drops. The only difference between the 3 methods is the method name and item within new ItemStack(). With all 3 methods added, our BlockTest.java should look like this:
    package net.minecraft.src;
    
    import java.util.Random;
    
    public class BlockTest extends Block
    {
    
        public BlockTest(int i, int j)
        {
            super(i, j, Material.ground);           
        }
        public int idDropped(int i, Random random)
        {
           return mod_Test.Test.blockID;
        }
        public int quantityDropped(Random random)
        {
                return 0;
        }
        public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f)
        {
            super.dropBlockAsItemWithChance(world, i, j, k, l, f);
            if(world.multiplayerWorld)
            {
                return;
            }
        }
    	public void dropCoal(World world, int i, int j, int k, int l, float f)
    	{
    		float f1 = 0.7F;
            float f2 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
            float f3 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
            float f4 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
    		EntityItem entityitem1 = new EntityItem(world, (float)i + f2, (float)j + f3, (float)k + f4, new ItemStack(Item.coal));
            entityitem1.delayBeforeCanPickup = 10;
            world.entityJoinedWorld(entityitem1);
    	}
    	
    	public void dropIron(World world, int i, int j, int k, int l, float f)
    	{
    		float f1 = 0.7F;
            float f2 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
            float f3 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
            float f4 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
    		EntityItem entityitem1 = new EntityItem(world, (float)i + f2, (float)j + f3, (float)k + f4, new ItemStack(Item.ingotIron));
            entityitem1.delayBeforeCanPickup = 10;
            world.entityJoinedWorld(entityitem1);
    	}
    	
    	public void dropGold(World world, int i, int j, int k, int l, float f)
    	{
    		float f1 = 0.7F;
            float f2 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
            float f3 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
            float f4 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
    		EntityItem entityitem1 = new EntityItem(world, (float)i + f2, (float)j + f3, (float)k + f4, new ItemStack(Item.ingotGold));
            entityitem1.delayBeforeCanPickup = 10;
            world.entityJoinedWorld(entityitem1);
    	}
    }


    We're almost done, but now we need to create one last method. This method is going to be responsible for deciding which items should be dropped and actually dropping the items. We're going to call it getDrops and we are going to utilize a For loop and the random function to accomplish this. Before we create this method, we need to declare two variables we are going to use for the rest of the tutorial. Place the following witin the BlockTest class file(either at the top or the bottom):
    private int dropAmount;
    private int dropType;


    Now on to the to our last method, we are going to call this method getDrops. Place the following within your BlockTest class file:
    	public void getDrops(World world, int dropNumber, int i, int j, int k, int l, float f) //This creates a public method called getDrops, the void is there so we don't need a return within the method.
    	{																					   //Within the ()'s we are still feeding the same information to the method as dropBlockAsItemWithChance with the addition of dropNumber, which is going to be the amount of drops that will occur.
    		for(int z=0; z<dropNumber; z++)  //This is our For loop. It firsts sets a varible, in this case z, to 0.
    		{								//The next part is the condition that needs to be met for the For loop to, well loop. In this case if z is less than dropNumber, it will loop through the code within the {} until z is the same as dropNumber.
    										//The last little bit adds 1 to z each time the For loop loops.
    			int dropType = world.rand.nextInt(180); //This assigns a random number to the variable dropType between 0-180.
    			if (dropType <= 80) //If dropType value is less than or equal to 80, execute the code within the {}'s below.
    			{
    				dropCoal(world, i, j, k, l, f); //This calls our dropCoal method and executes it.
    			}
    			if (dropType > 80 && dropType <= 140) //If dropType value is greater then 80 and less than or equal to 140, execute the code within the {}'s below.
    			{
    				dropIron(world, i, j, k, l, f); //This calls our dropIron method and executes it.
    			}
    			if (dropType > 140 && dropType <= 180) //If dropType is greater then 140 and less than or equal to 180, execute the code within the {}'s below.
    			{
    				dropGold(world, i, j, k, l, f); //This calls our dropGold method and executes it.
    			}
    			else //If neither of the above conditions are met, execute the code within the {}'s below.
    			{
    				dropCoal(world, i, j, k, l, f);
    			}
    		}
    	}

    Now you can play around with the values that are required to get a certain drop, decreasing the range a dropType needs to fall within to get a certain item will make it more "rare". Increasing the range will make it more common. Just make sure you change the line, int dropType = world.rand.nextInt(180);, to accomdate your changes.

    We are so close to being done I can almost taste the Cooked Porkchops, sorry pig!. As of right now, when you break our Test block nothing will happen. We are going to have to call the method that makes all of the magic happen, getDrops. Before we put in the final snippet of code, verify that your BlockTest.java looks the same as below:
    package net.minecraft.src;
    
    import java.util.Random;
    
    public class BlockTest extends Block
    {
    
        public BlockTest(int i, int j)
        {
            super(i, j, Material.ground);           
        }
        public int idDropped(int i, Random random)
        {
           return mod_Test.Test.blockID;
        }
        public int quantityDropped(Random random)
        {
                return 0;
        }
        public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f)
        {
            super.dropBlockAsItemWithChance(world, i, j, k, l, f);
            if(world.multiplayerWorld)
            {
                return;
            }
        }
    	public void dropCoal(World world, int i, int j, int k, int l, float f)
    	{
    		float f1 = 0.7F;
            float f2 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
            float f3 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
            float f4 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
    		EntityItem entityitem1 = new EntityItem(world, (float)i + f2, (float)j + f3, (float)k + f4, new ItemStack(Item.coal));
            entityitem1.delayBeforeCanPickup = 10;
            world.entityJoinedWorld(entityitem1);
    	}
    	
    	public void dropIron(World world, int i, int j, int k, int l, float f)
    	{
    		float f1 = 0.7F;
            float f2 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
            float f3 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
            float f4 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
    		EntityItem entityitem1 = new EntityItem(world, (float)i + f2, (float)j + f3, (float)k + f4, new ItemStack(Item.ingotIron));
            entityitem1.delayBeforeCanPickup = 10;
            world.entityJoinedWorld(entityitem1);
    	}
    	
    	public void dropGold(World world, int i, int j, int k, int l, float f)
    	{
    		float f1 = 0.7F;
            float f2 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
            float f3 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
            float f4 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
    		EntityItem entityitem1 = new EntityItem(world, (float)i + f2, (float)j + f3, (float)k + f4, new ItemStack(Item.ingotGold));
            entityitem1.delayBeforeCanPickup = 10;
            world.entityJoinedWorld(entityitem1);
    	}
    		public void getDrops(World world, int dropNumber, int i, int j, int k, int l, float f)
    	{																					   
    		for(int z=0; z<dropNumber; z++)  
    		{								
    										
    			int dropType = world.rand.nextInt(180); 
    			if (dropType <= 80) 
    			{
    				dropCoal(world, i, j, k, l, f); 
    			}
    			if (dropType > 80 && dropType <= 140) 
    			{
    				dropIron(world, i, j, k, l, f); 
    			}
    			if (dropType > 140 && dropType <= 180) 
    			{
    				dropGold(world, i, j, k, l, f); 
    			}
    			else 
    			{
    				dropCoal(world, i, j, k, l, f);
    			}
    		}
    	}
    }


    Onto the final part, all we have left to do is to call our getDrops method within our dropBlockAsItemWithChance method. Change dropBlockAsItemWithChance so it looks like the following:
        public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f)
        {
            super.dropBlockAsItemWithChance(world, i, j, k, l, f);
            if(world.multiplayerWorld)
            {
                return;
            }
    			int dropAmount = world.rand.nextInt(10); //This sets dropAmount with a random number between 0-10. This is also the max amount of drops that will be allowed when the block is destroyed. Decrease of increase this value to satisfy your needs.
    			if (dropAmount == 0) //This is here to make sure that if dropAmount's value is 0, we give a player at least 1 drop.
    			{
    				getDrops(world, 1, i, j, k, l, f); //If dropAmount's value is zero, this executes getDrops and allows for only 1 item to be dropped.
    			}
    			else
    			{
    			getDrops(world, dropAmount, i, j, k, l, f); //If getAmount isn't zero, it passes off it's value to getDrops and runs the method.
    			}
        }


    There we have it, it's done, we have finally completed it. Just to be sure everything was done properly, compare your finished BlockTest.java file with the code below:
    package net.minecraft.src;
    
    import java.util.Random;
    
    public class BlockTest extends Block
    {
    
        public BlockTest(int i, int j)
        {
            super(i, j, Material.ground);           
        }
        public int idDropped(int i, Random random)
        {
           return mod_Test.Test.blockID;
        }
        public int quantityDropped(Random random)
        {
                return 0;
        }
        public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f)
        {
            super.dropBlockAsItemWithChance(world, i, j, k, l, f);
            if(world.multiplayerWorld)
            {
                return;
            }
    			int dropAmount = world.rand.nextInt(10); 
    			if (dropAmount == 0) 
    			{
    				getDrops(world, 1, i, j, k, l, f);
    			}
    			else
    			{
    			getDrops(world, dropAmount, i, j, k, l, f);
    			}
        }
    	public void dropCoal(World world, int i, int j, int k, int l, float f)
    	{
    		float f1 = 0.7F;
            float f2 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
            float f3 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
            float f4 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
    		EntityItem entityitem1 = new EntityItem(world, (float)i + f2, (float)j + f3, (float)k + f4, new ItemStack(Item.coal));
            entityitem1.delayBeforeCanPickup = 10;
            world.entityJoinedWorld(entityitem1);
    	}
    	
    	public void dropIron(World world, int i, int j, int k, int l, float f)
    	{
    		float f1 = 0.7F;
            float f2 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
            float f3 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
            float f4 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
    		EntityItem entityitem1 = new EntityItem(world, (float)i + f2, (float)j + f3, (float)k + f4, new ItemStack(Item.ingotIron));
            entityitem1.delayBeforeCanPickup = 10;
            world.entityJoinedWorld(entityitem1);
    	}
    	
    	public void dropGold(World world, int i, int j, int k, int l, float f)
    	{
    		float f1 = 0.7F;
            float f2 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
            float f3 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
            float f4 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
    		EntityItem entityitem1 = new EntityItem(world, (float)i + f2, (float)j + f3, (float)k + f4, new ItemStack(Item.ingotGold));
            entityitem1.delayBeforeCanPickup = 10;
            world.entityJoinedWorld(entityitem1);
    	}
    		public void getDrops(World world, int dropNumber, int i, int j, int k, int l, float f)
    	{																					   
    		for(int z=0; z<dropNumber; z++)  
    		{								
    										
    			int dropType = world.rand.nextInt(180); 
    			if (dropType <= 80) 
    			{
    				dropCoal(world, i, j, k, l, f); 
    			}
    			if (dropType > 80 && dropType <= 140) 
    			{
    				dropIron(world, i, j, k, l, f); 
    			}
    			if (dropType > 140 && dropType <= 180) 
    			{
    				dropGold(world, i, j, k, l, f); 
    			}
    			else 
    			{
    				dropCoal(world, i, j, k, l, f);
    			}
    		}
    	}
    }


    One last thing, if you wanted to have the drop amount and types fixed, you could skip making the getDrops method and just make a method for each item you want to drop. Then within dropBlockAsItemWithChance call the method of the item you want as many times as you want it. Like so:
        public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f)
        {
            super.dropBlockAsItemWithChance(world, i, j, k, l, f);
            if(world.multiplayerWorld)
            {
                return;
            }
    		dropCoal(world, i, j, k, l, f);
    		dropCoal(world, i, j, k, l, f);
    		dropIron(world, i, j, k, l, f);
    		dropGold(world, i, j, k, l, f);
    		dropGold(world, i, j, k, l, f);
        }


    This would drop 2 pieces of coal, 1 Iron Ingot, and 2 Gold Ingots.


    I tried to make this tutorial as easy and descriptive as possible, any questions or concerns feel free to leave a message and I'll do my best to help. If throughout this tutorial I've put false information please inform me with the correct information so I can fix it, I don't want to misinform people!

    *Also, I did not steal this tutorial from Mad's Modding Tutorials, check the credits, I wrote it, I just wanted to port it over here to show I'm capable of doing more "complex" things* or things that are widely covered.

    Advanced/Hard Tutorials

    If you used these tutorials or learned from them, either leave a comment or give me +rep. I do these on my own time, just as other tutorial/mod creators do, and it's the least you could do. If you find any mistakes or incorrect information, politely correct me and I will fix it. I don't want to misinform anyone.

    Also, check out Mad's Modding Tutorials as well as Strength's Modding Tutorials! They got me started in modding and are a great resource.

    Check out my Mod Page!
    Posted in: Tutorials
  • 0

    posted a message on Help with Java please? :D
    Using Dyes(and Wool because it works the same) in Recipes
    If you noticed Dyes and Wools are stored using damage values, which allows multiple items/blocks to be stored on a single ID. Because of this the basic Item.dyePowder or Block.wool doesn't work in recipes because your not providing the Damage Value.

    To do so is actually really simple.

    Here is an example of a recipe that won't work:
    ModLoader.AddRecipe(new ItemStack(Item.dyePowder, 9), new Object[]
    { "#", Character.valueOf('#'), Block.dirt });


    To make it work you would need to replace "Item.dyePowder, 9" with "Item.dyePowder, 9, 0", so the new recipe would look like this:
    ModLoader.AddRecipe(new ItemStack(Item.dyePowder, 9, 0), new Object[]
    { "#", Character.valueOf('#'), Block.dirt });


    The 9 is the amount that will be crafted after fulfilling the recipe and the 0 is the damage value(which you could also consider the "ID" in some sense) of the Item.dyePowder. With this recipe 1 dirt block will craft 9 Black Dyes.

    Now there is a minor tweak that needs to be made when making a dye part of the recipe.

    This is an example of a recipe that won't work:
    ModLoader.AddRecipe(new ItemStack(Block.dirt, 9), new Object[]
    { "#", Character.valueOf('#'), Item.dyePowder });


    To make it work you would need to replace "Item.dyePowder" with "new ItemStack(Item.dyePowder, 1, 0)", so the new recipe would look like this.
    ModLoader.AddRecipe(new ItemStack(Block.dirt, 9), new Object[]
    { "#", Character.valueOf('#'), new ItemStack(Item.dyePowder, 1, 0) });


    The 1 always has to be there, it doesn't change, the 0 is the damage value of Item.dyePowder. With this recipe 1 Black Dye would craft 1 dirt block.

    The damage values for Item.dyePowder and their corresponding color.
    Black - 0
    Red - 1
    Green - 2
    Brown - 3
    Blue - 4
    Purple - 5
    Cyan - 6
    Light Gray - 7
    Gray - 8
    Pink - 9
    Lime Green - 10
    Yellow - 11
    Light Blue - 12
    Magenta - 13
    Orange - 14
    White - 15
    Posted in: Modification Development
  • 1

    posted a message on Help with Java please? :D
    There's a couple of things I can see.

    First:
    package net.minecraft.src;
    import java.util.Random;
    
    public class mod_ColorCraft extends BaseMod
    {
            public static final Item sword = new ItemSword(1337,EnumToolMaterial.WOOD).setItemName("BlueWooden");
            public static final Item sword = new ItemSword(1338,EnumToolMaterial.WOOD).setItemName("CyanWooden");
            public static final Item sword = new ItemSword(1339,EnumToolMaterial.WOOD).setItemName("GrayWooden");
            public static final Item Sword = new ItemSword(1340,EnumToolMaterial.WOOD).setItemName("GreenWooden");
            public static final Item Sword = new ItemSword(1341,EnumToolMaterial.WOOD).setItemName("OrangeWooden");
            public static final Item Sword = new ItemSword(1342,EnumToolMaterial.WOOD).setItemName("PinkWooden");
            public static final Item Sword = new ItemSword(1343,EnumToolMaterial.WOOD).setItemName("RedWooden");
            public static final Item Sword = new ItemSword(1344,EnumToolMaterial.WOOD).setItemName("SugarWooden");
            public static final Item Sword = new ItemSword(1345,EnumToolMaterial.WOOD).setItemName("YellowWooden");
    
    
                    

    This is the first problem, all though the .setItemName's are different, you actually don't refer to these when coding, at least from what I've experienced. Each one of these swords needs a unique name that isn't "Sword". I usually give each item the same name as the setItemName. So for instance instead of:
    public static final Item sword = new ItemSword(1337,EnumToolMaterial.WOOD).setItemName("BlueWooden");

    Change it to:
    public static final Item BlueWooden = new ItemSword(1337,EnumToolMaterial.WOOD).setItemName("BlueWooden");


    After you go through all of those your going to have to change these:
    		Sword.iconIndex = ModLoader.addOverride("gui/items.png", "/BlueWooden.png");
    		Sword.iconIndex = ModLoader.addOverride("gui/items.png", "/CyanWooden.png");
    		Sword.iconIndex = ModLoader.addOverride("gui/items.png", "/GrayWooden.png");
    		Sword.iconIndex = ModLoader.addOverride("gui/items.png", "/GreenWooden.png");
    		Sword.iconIndex = ModLoader.addOverride("gui/items.png", "/OrangeWooden.png");
    		Sword.iconIndex = ModLoader.addOverride("gui/items.png", "/PinkWooden.png");
    		Sword.iconIndex = ModLoader.addOverride("gui/items.png", "/RedWooden.png");
    		Sword.iconIndex = ModLoader.addOverride("gui/items.png", "/SugarWooden.png");
    		Sword.iconIndex = ModLoader.addOverride("gui/items.png", "/YellowWooden.png");
    		
    		ModLoader.AddName(Sword,"Blue Wooden Sword");
    		ModLoader.AddName(Sword,"Cyan Wooden Sword");
    		ModLoader.AddName(Sword,"Gray Wooden Sword");
    		ModLoader.AddName(Sword,"Green Wooden Sword");
    		ModLoader.AddName(Sword,"Orange Wooden Sword");
    		ModLoader.AddName(Sword,"Pink Wooden Sword");
    		ModLoader.AddName(Sword,"Red Wooden Sword");
    		ModLoader.AddName(Sword,"Sugar Wooden Sword");
    		ModLoader.AddName(Sword,"Yellow Wooden Sword");

    So using the example above instead of:
    Sword.iconIndex = ModLoader.addOverride("gui/items.png", "/BlueWooden.png");
    ModLoader.AddName(Sword,"Blue Wooden Sword");

    Change it to:
    BlueWooden.iconIndex = ModLoader.addOverride("gui/items.png", "/BlueWooden.png");
    ModLoader.AddName(BlueWooden,"Blue Wooden Sword");


    Now the last problem I see are within your recipes
    ModLoader.AddRecipe(new ItemStack(BlueWooden, 1), new Object []{
    " $ ", " $ ", " % ", Character.valueOf('$'), Item.dyePowder['blue'] Character.valueOf('%'), Item.swordWood


    There are two problems, one that is not how you use the different dye colors in recipes, after this post I'll post the tutorial I made on the subject that should clear that up for. Second each one of your recipes is not closed out. Your forgot the }); at the end so instead of the above it should be:
    ModLoader.AddRecipe(new ItemStack(BlueWooden, 1), new Object []{
    " $ ", " $ ", " % ", Character.valueOf('$'), Item.dyePowder['blue'] Character.valueOf('%'), Item.swordWood });


    Hope this helps, I'll post the tutorial in just a second for you.
    Posted in: Modification Development
  • 0

    posted a message on Monkeyss334 error dump
    Do you have the String Version method within the brackets of your mod_***.java class?

    public class mod_*** extends BaseMod
    {
         public mod_***()
         {
         }
         public String Version()
         {
              return "Stuff";
         }
    }


    It should look something like that. If your getting new errors then you should provide the source code as well as the error log. And don't forget the code tags please.
    Posted in: Modification Development
  • 2

    posted a message on Monkeyss334 error dump
    I'm sorry Monkey, although a topic like this is a good and bad idea, you really need to learn to try and solve your own errors. Like I said in the topic that was deleted, you mine as well have us make the mod for you.

    I assume this is the same error you were getting from the last two topics and in the first one, the one that didn't get deleted, I even hinted at what needed to be done. If you couldn't figure it out then maybe modding isn't for you right now.

    Sorry if I sound like a jerk but it's the truth, needing help after you've exhausted every option is fine, needing help for every single error on the other hand I don't approve of.

    Also only providing bits and pieces isn't always the best solution because although you give us where the error is indicated, it's very possible that the error is a few lines above or below the code provided.

    And again Monkey, please learn to use the code tags.

    {code}
    code/error's here
    {/code}

    But replace the {}'s with []'s...
    Posted in: Modification Development
  • 0

    posted a message on WTF! My mod is being redistributed without permisson! What do I do?!
    Quote from hajduckowy

    Hello. I'm owner of that site. Sure, i will take it out of the site. Sorry for any problems. Articule was sumbitted by second redactor - i speaked with him.

    So once again, sory for problem. Peace :wink.gif:

    BTW. You don't need to translate your words :wink.gif: I'm not good at english, but either i'm not very bad at it. and also, don't spam comment box :wink.gif: If you want to, do it in english, not in polish that... just can't be readed.

    If you encounter any more problems - write on [email protected]


    See this person seems like a reasonable person and does have a point about you guys spamming. I do only have one thing to say, if they used your adfly links, I.E. supporting you and helping you get more downloads, did it really matter if they took it down. I would of just requested credit and allowed them to keep doing so.
    Posted in: Mods Discussion
  • 0

    posted a message on Minecraft new mod
    I don't know how to do it manually like the way your trying to do it, as well I don't see what the problem with deleting ItemSausage. Your going to condense around 21 lines of code into 1 and reduce the amount of class files your mod contains.

    I mean the only thing your changing with your mod_Name.java file is your replacing
        public static Item Sausage = new Item(211).setItemName("SausageItem");


    with

    public static final Item Sausage = new ItemFood(211, 6, false).setItemName("Sausage");


    Everything else within mod_Name.java will remain and still function.
    Posted in: Mods Discussion
  • 0

    posted a message on Minecraft new mod
    Just going to copy and paste a tutorial I wrote on the subject, delete your ItemSausage, as it's unneeded with this tutorial.

    Tutorial for ModLoder

    So I had a hard time finding one so I decided to create a tutorial on creating a new food item for 1.8.1.

    Create a new file called mod_Food.java with this code:
    package net.minecraft.src
    
    public class mod_Food extends BaseMod
    {
    	public mod_Food()
    	{
    	}
    	
    	public String Version()
    	{
    		return "Food Mod for 1.8.1";
    	}
    }


    Now we need to first create the food, we do so by adding the following line within the mod_Food class:
    public static final Item DirtPie = new ItemFood(601, 6, false).setItemName("DirtPie");

    The 601 is the ID for the new food item.
    The 6 is how many "hunger bar slots" it will fill. 1 would be half of a "hunger bar slot", 2 would be a whole "hunger bar slot". The maximum number is 20 (or 10 "hunger bar slots"). Just for reference:
    1 = ½ "hunger bar slot"
    2 = 1 "hunger bar slot"
    3 = 1 ½ "hunger bar slots"
    4 = 2 "hunger bar slots"
    etc.
    The false represents whether or not a Wolf can eat it to heal. Put true if you want Wolfs to be able to heal with the new food item.

    Now we need to set the food items texture and name, place the following code within the mod_Food constructor:
    DirtPie.iconIndex = ModLoader.addOverride("/gui/items.png", "/Food/DirtPie.png");
    ModLoader.AddName(DirtPie, "Dirt Pie");

    All this does is set the DirtPie's icon to "/Food/DirtPie.png" and then assigns the in-game name "Dirt Pie" to the new food item.

    Last, we'll make a quick recipe so we can craft the new food item.
    Add the following code within the mod_Food constructor:
    ModLoader.AddRecipe(new ItemStack(DirtPie, 1), new Object[]
    { "###", "###", "###", Character.valueOf('#'), Block.dirt});


    Now your mod_Food.java file should look just like the one below:
    public class mod_Food extends BaseMod
    {
    	
    	public static final Item DirtPie = new ItemFood(601, 6, false).setItemName("DirtPie");
    	
    	public mod_Food()
    	{
    		DirtPie.iconIndex = ModLoader.addOverride("/gui/items.png", "/Food/DirtPie.png");
    		ModLoader.AddName(DirtPie, "Dirt Pie");
    		
    		ModLoader.AddRecipe(new ItemStack(DirtPie, 1), new Object[]
    		{ "###", "###", "###", Character.valueOf('#'), Block.dirt});
    	}
    	
    	public String Version()
    	{
    		return "Food Mod for 1.8.1";
    	}
    }



    Just as a reference, when I say "hunger bar slots" I mean these:


    Keep in mind you won't be able to eat it until you've depleted some of the hunger bar.
    Posted in: Mods Discussion
  • 0

    posted a message on RECIPE PROBLEM???
    Why do you have a mod_UBlock and a mod_ingot? This is probably why you are having problems. You should only have one mod_Name.java file that contains things like recipes, registering blocks, declaring items and block and declaring their textures.

    Your block and your item, for the most part, should have separate files like BlockUBlock, ItemitemU. What I want you to do is go to the link I gave you for Strength's tutorials, read the block tutorial and the item tutorial, then you should see what the problem is.
    Posted in: Modification Development
  • To post a comment, please or register a new account.