• 2

    posted a message on How to change the color of an item when right click?
    Try doing this:
    private int count = 0;
    private int[] textures = {ModLoader.addOverride("/gui/items.png", "/sword1.png"),ModLoader.addOverride("/gui/items.png", "/sword2.png"),ModLoader.addOverride("/gui/items.png", "/sword3.png"),ModLoader.addOverride("/gui/items.png", "/sword4.png")};
    
    public ItemStack onItemRightClick(ItemStack itemStack, World par2World, EntityPlayre ep){
    switch(count){
    case 0:
    	 this.setIconIndex(textures[count]);
    	 count = 1;
    	 break;
    case 1:
    	 this.setIconIndex(textures[count]);
    	 count = 2;
    	 break;
    case 2:
    	 this.setIconIndex(textures[count]);
    	 count = 3;
    	 break;
    case 3:
    	 this.setIconIndex(textures[count]);
    	 count = 0;
    	 break;
    deault:
    	 this.setIconIndex(textures[count]);
    	 count = 0;
    	 break;
    }
    return itemStack;
    }


    This worked for me, hopefully it works for you too.
    Posted in: Modification Development
  • 0

    posted a message on i need the code for checking if a certain helmet is on. please help
    Put this in onTickInGame(float f, Minecraft mc) method:
    if(ModLoader.getMinecraftInstance().thePlayer.inventory.armorInventory[3] != null){
    if(ModLoader.getMinecraftInstance.thePlayer.inventory.armorInventory[3].itemID == yourHelmet.shiftedIndex){
    	 //code to give abilities to player
    }
    }
    Posted in: Modification Development
  • 0

    posted a message on Coding Help-Doesn't Recognize Diamond
    Quote from MK-Blitzkrieg

    package net.minecraft.src;

    import java.util.Map;
    import java.util.Random;

    public class mod_AngelStone extends BaseMod{

    //declaring
    public static final Block Shard = new BlockShard(200, 0).setBlockName("Shard").setHardness(2F).setResistance(3F).setLightValue(0.2F);

    public void load(){
    //tells minecraft that you are using a custom texture
    Shard.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Shardstoneblock.png");
    //adds the block into minecraft and creates all of its variables
    ModLoader.registerBlock(Shard);
    //sets the name of the block
    ModLoader.addName(Shard, "Angel Stone");
    //creates a crafting recipe for our block
    ModLoader.addRecipe(new ItemStack(Block.Shard, 1), new Object[] {"###", "#X#", "###", '#', Block.obsidian, 'X', Block.diamond});


    }

    //sets the version number of our whole mod
    public String getVersion(){
    return "AngelStone mod v0.1";

    }

    }

    As of the time of posting, this is the full file. Cutter, stay calm. Go for a walk if you must.


    Use code tags for code.

    There is no Block.Shard, it should just be Shard. There is also no Block.diamond, it should be Item.diamond
    Posted in: Modification Development
  • 0

    posted a message on Help with a mod
    Are you getting any errors? That code works fine for me.

    Please use Code tags when posting code, it makes it easier to read.
    Posted in: Modification Development
  • 0

    posted a message on Removing a recipe without editing base classes
    CraftingManager.getInstance().getRecipeList().remove(int index);
    Posted in: Modification Development
  • 0

    posted a message on Making item ids like dyes
    Quote from kyle7273

    I was trying to figure out where to place the code i.e. shitediconindex??? goes in my mod_ file???

    I told you where to put
    this.setHasSubtypes(true);

    The methods should be in your item class.
    Posted in: Modification Development
  • 0

    posted a message on Making item ids like dyes
    Quote from kyle7273

    Perhaps you can give me an example?

    Here is the code in the file i think you are talking about...

    For example:

    Emptytoken.java

    package net.minecraft.src;
    
    public class Emptytoken extends Item
    {public Emptytoken(int i)
    {
    super(i);
    maxStackSize = 64;
    }
    }



    You didn't add anything that I told you to, and I told you everything that you need.

    All you needed to do was to go into the ItemDye class and copy the methods that I told you to, and make some minor adjustments to fit your item, but instead you just posted some code that can mostly be auto-generated by Eclipse.

    I'm not going to write your code for you.

    If you try to do what I told you and get errors, post here and I will help you sort them out.
    Posted in: Modification Development
  • 0

    posted a message on Making item ids like dyes
    You will need this in the item constructor:
    this.setHasSubtypes(true);


    You're gonna need these methods:
    getIconFromDamage(int par1);
    getItemNameIS(ItemStack par1ItemStack);
    getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List);


    To see what these methods need just check the ItemDye class.
    Posted in: Modification Development
  • 0

    posted a message on onTickInGame[1.3.2]
    You need to also add the ModLoader.setInGameHook(this, true, false) in the load() method.
    Posted in: Modification Development
  • 1

    posted a message on Sword mod help
    Quote from happyfeet015

    Two more questions,
    1. Do you know any good tutorials for this matter?
    2. I'm not completely sure, was this the class I was supposed to make?
    package net.minecraft.src;
    public class mod_SnowSwordSlow {
    }


    AND...
    I meant to say each sword is its own class, not its own java file!


    Each sword is not its own class (there is only one ItemSword class in the Minecraft source).


    Quote from happyfeet015

    I'm sorry if you think that I am a pain.
    I just want to know what I should add to my code to make it do things, not for you to teach me java!
    you don't even have to write out the code for me, you could just link some one else's tutorial or tell me what i should do to make my mod work.
    You both have your points and I think i will try a little harder (on my own) to get this to work
    Also, i have been following some of the java tutorials that Olikimah linked to me
    I thank you for your help. :steve_joyous:


    Here's a tutorial to a bunch of tutorials that you can use, http://www.minecraftforum.net/topic/1030464-131-125-theinstitutions-advanced-modding-tutorials/. This was the fifth topic in the Tutorials forum, all you have to do is take some time to search for the resources you need.
    Posted in: Modification Development
  • 1

    posted a message on Sword mod help
    Quote from happyfeet015

    Wouldn't it be easier to tell me how or post what I should add to the code
    BTW, each sword is its own java file
    Also, i made a new class, so now what?


    It would be easier for you, yes, but you won't learn anything from it.
    Each sword is not its own java file...
    Now that you made a new class, you can find a tutorial (can be found in the Tutorials section, or on Youtube) on your subject.

    If you actually learn some Java you would have a much easier time modding and fixing the errors you experience, but if you are not willing to learn then there is no reason to continue modding because no Java knowledge will get you no where.
    Posted in: Modification Development
  • 0

    posted a message on Sword mod help
    Quote from happyfeet015

    How?


    To be honest, if you have to ask "How?" after someone tells you to make a new class, you should probably learn some basic Java before beginning a mod.
    http://docs.oracle.com/javase/tutorial/
    Posted in: Modification Development
  • 0

    posted a message on .displayGUIDrug(var10); ERROR
    ModLoader.openGUI(new GUIname());
    GUIname is the name of the GUI that you want to open.
    Posted in: Modification Development
  • 0

    posted a message on .displayGUIDrug(var10); ERROR
    Quote from stegnokilla345

    Yes I made guidrug tileentitydrug blockdrug containerdrug and so on


    I didn't mean if you made all the classes, but if you registered your TileEntityDrug in your mod_**** file using:

    ModLoader.registerTileEntity(tileEntityClass, id)

    If your block doesn't have a custom render model, and using:

    ModLoader.registerTileEntity(tileEntityClass, id, renderer)

    If it does.
    Posted in: Modification Development
  • 0

    posted a message on .displayGUIDrug(var10); ERROR
    Did you register TileEntityDrug?
    Posted in: Modification Development
  • To post a comment, please or register a new account.