Quick question about modding

Discussion in 'Mod Development' started by midgetassin, Dec 19, 2014.

  1. midgetassin

    midgetassin New Member

    Ok this is going to be a very dumb question but do you have to code a item and then the block. For example
    If you want to add a table do you have to go throught the whole itemTable then go through blockTable
     
  2. SatanicSanta

    SatanicSanta New Member

    Short answer: No.
    Long answer: No, unless you also need it to have item functions that blocks cannot do.
     
  3. midgetassin

    midgetassin New Member

    If you cant tell I'm new to moding and have taken on a huge project for the first mod to be done. So thank you for replying to me so quickly so i could get back to it. I probally will be asking more questions later in this tread but real quick if its not to much of a hassel what kind of things would items be able to do that blocks can't
     
  4. SatanicSanta

    SatanicSanta New Member

  5. midgetassin

    midgetassin New Member

    Thank you a ton agin but looks like i have to restart my mod agin everything i have done is gone (yes i was saving) after my power just flickered for some reason
     
  6. SatanicSanta

    SatanicSanta New Member

    http://github.com or http://bitbucket.org
     
    VapourDrive likes this.
  7. midgetassin

    midgetassin New Member

    Srry to bother you guys agin but I need help getting my textures to show up in game. I'm fellowing Mr.Crayfishes tutorial and did wht he said but it still didn't show up.

    This is the line of code im useing is there something wrong with it .setTextureName("XY:itemBlackXychoriditeShard"

    Edit: its also not showing that there is any errors
     
  8. SatanicSanta

    SatanicSanta New Member

    Uh, there's no closing parentheses.
     
  9. midgetassin

    midgetassin New Member

    I have that just forgot to type it on here.

    Thanks for the very quick reply
     
  10. SatanicSanta

    SatanicSanta New Member

    Do you have a repository or something that I can look at? That one snippet isn't really enough for me to help.
     
  11. InfinityRaider

    InfinityRaider New Member

    Override this method in your block class
    Code:
    @[email protected](Side.CLIENT)
    public void registerBlockIcons(IIconRegister reg) {
    this.blockIcon = reg.registerIcon(this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf('.') + 1));
    }
    
    Use this to register your block
    Code:
    public static void registerBlock(Block block,String name) {
    block.setBlockName(<modid>.toLowerCase()+':'+name);
    GameRegistry.registerBlock(block, name);
    }
    
    The texture should then go in the assets/<modid>/textures/blocks folder, with the name you specified when registering the block: <name>.png

    EDIT: if it's an item, just do the analogous, but for items.
     
  12. SatanicSanta

    SatanicSanta New Member

    This is so overly complicated.

    To register blocks I do:
    Code:
    GameRegistry.registerBlock(blockName, blockName);
    
    And for textures, in the block's constructor:
    Code:
    this.setBlockTextureName("modid:texture_name");
    
     
    midgetassin likes this.
  13. InfinityRaider

    InfinityRaider New Member

    Matter of personal preference I suppose.
     
    VapourDrive and SatanicSanta like this.
  14. midgetassin

    midgetassin New Member

    I will set it up but have no clue how so it may be a little while
     
  15. midgetassin

    midgetassin New Member

    I'm doing it the same way as you
     
  16. midgetassin

    midgetassin New Member

    I couldnt figure out how to do the repository so wil this work
    package midgetassin.ProjectXy;

    import net.minecraft.block.Block;
    import net.minecraft.block.material.Material;
    import net.minecraft.item.Item;
    import cpw.mods.fml.common.Mod;
    import cpw.mods.fml.common.Mod.EventHandler;
    import cpw.mods.fml.common.event.FMLInitializationEvent;
    import cpw.mods.fml.common.event.FMLPostInitializationEvent;
    import cpw.mods.fml.common.event.FMLPreInitializationEvent;
    import cpw.mods.fml.common.registry.GameRegistry;

    @Mod(modid = "XY", name = "Project XY", version = "1.0")
    public class ProjectXY {

    public static Item itemBlueXychoriditeShard;
    public static Item itemRedXychoriditeShard;
    public static Item itemGreenXychoriditeShard;
    public static Item itemWhiteXychoriditeShard;
    public static Item itemBlackXychoriditeShard;
    public static Block blockBlueXychoriditeStone;

    @EventHandler
    public void preIint(FMLPreInitializationEvent event){
    //Item/block init and registering, config handling
    itemBlueXychoriditeShard = new ItemBlueXychoriditeShard().setUnlocalizedName("ItemBlueXychoriditeShard").setTextureName("XY:itemBlueXychoriditeShard");
    GameRegistry.registerItem(itemBlueXychoriditeShard, itemBlueXychoriditeShard.getUnlocalizedName().substring(5));

    itemRedXychoriditeShard = new ItemRedXychoriditeShard().setUnlocalizedName("ItemRedXychoriditeShard").setTextureName("XY:itemRedXychoriditeShard");
    GameRegistry.registerItem(itemRedXychoriditeShard, itemRedXychoriditeShard.getUnlocalizedName().substring(5));

    itemGreenXychoriditeShard = new ItemGreenXychoridite().setUnlocalizedName("ItemGreenXychoriditeShard").setTextureName("XY:itemGreenXychoriditeShard");
    GameRegistry.registerItem(itemGreenXychoriditeShard, itemGreenXychoriditeShard.getUnlocalizedName().substring(5));

    itemWhiteXychoriditeShard = new ItemWhiteXychoridite().setUnlocalizedName("ItemWhiteXychoriditeShard").setTextureName("XY:itemWhiteXychoriditeShard");
    GameRegistry.registerItem(itemWhiteXychoriditeShard, itemWhiteXychoriditeShard.getUnlocalizedName().substring(5));

    itemBlackXychoriditeShard = new ItemBlackXychoridite().setUnlocalizedName("ItemBlackXychoriditeshard").setTextureName("XY:itemBlackXychoriditeShard");
    GameRegistry.registerItem(itemBlackXychoriditeShard, itemBlackXychoriditeShard.getUnlocalizedName().substring(5));

    blockBlueXychoriditeStone = new BlockBlueXychoriditeStone(Material.ground).setBlockName("BlockBlueXychoriditeStone");
    GameRegistry.registerBlock(blockBlueXychoriditeStone, blockBlueXychoriditeStone.getUnlocalizedName().substring(5));
    }


    @EventHandler
    public void Init(FMLInitializationEvent event){
    //Proxy, Tile entity, entity Gui and packet registry
    }



    @EventHandler
    public void postInit(FMLPostInitializationEvent event){
    //list of blocks add
    }
    }
     
  17. SatanicSanta

    SatanicSanta New Member

    I can't see any blaring issues from that one class.
     
  18. VapourDrive

    VapourDrive New Member

    Have you made sure your IDE has a refreshed resource folder? All of my assets get added after I make them in gimp so they don't show up in the project until after a refresh or restart. This has caused me many a heart-ache.
     

Share This Page