• 0

    posted a message on [1.2.5 ModLoader] Muserae's Modding Tutorial
    Basic Item

    You'll want to make a new java file and name it Item* replacing * with a name. Make sure you have a mod_ file.
    This tutorial will use an example of ItemTutorial. You can use an item file with multiple items. For example, ItemSword is used for all types of swords.

    ItemTutorial
    package net.minecraft.src;
    public class ItemTutorial extends Item
    {
    	  
    		public ItemTutorial (int i)
    		{
    				super (i);
    				maxStackSize = 64;  //You can change 64 to anything from 1-64
    		}
    	  
    }


    mod_Tutorial
    You can delete the crafting recipe if you don't want it.
    Refer to the mod_ Template Explained for help on textures, crafting recipes, etc.
    package net.minecraft.src;
    import java.util.Map;
    
    public class mod_Tutorial extends BaseMod{
    		public mod_Tutorial()
    		{
    			//<Item Name>
    		 tutorialItem.iconIndex = ModLoader.addOverride("/gui/items.png", "/folder/tutorialItem.png");
    		 ModLoader.addName(tutorialItem, "Tutorial Item");
    				ModLoader.addRecipe(new ItemStack(tutorial, 1), new Object[] {
    							  "MMM", "MSM", "MMM", Character.valueOf('M'), Block.stone, Character.valueOf('S'), Item.stick});
    		}
    		public static Item tutorial = (new ItemTutorial(500)).setItemName("tutorialItem");
    
            public String getVersion(){return "Mod name and version here";}
            public void load(){}
    }
    Posted in: Tutorials
  • 0

    posted a message on [1.2.5 ModLoader] Muserae's Modding Tutorial
    Basic Block

    You'll want to make a new java named Block* replacing the * with a name. You'll also need to make sure you have a mod_ class. You can use your Block* class for related blocks. If you use BlockOre as an example, multiple Blocks are created there (Gold Ore, Iron Ore, Diamond Ore, ect)
    This example will be BlockTutorial.

    package net.minecraft.src;
    import java.util.Random;
    public class BlockTutorial extends Block
    {
    	public BlockTutorial(int i, int j, Material material)
    	{
    	 super(i, Material.rock);
    	 //You can replace rock with other materials, refer to the Block Materials tutorial for a list of materials
    	 //And a definition of what each material does
    	}
    
    	public int idDropped(int par1, Random par2Random, int par3)
    	{
    		return <<BlockIDHere>>;
    		//For a custom item or block, you want mod_Tutorial.yourBlock.blockID/mod_Tutorial.yourItem.shiftedIndex;
    		//For a Block, you want Block.dirt.blockID;
    		//For an Item, you want Item.stick.shiftedIndex;
    	}
    }


    mod_Tutorial
    You can delete the crafting recipe if you don't want it.
    Refer to the mod_ Template Explained tutorial for help on textures, crafting recipes, etc.
    package net.minecraft.src;
    import java.util.Map;
    public class mod_Tutorial extends BaseMod{
    		public mod_Tutorial()
    		{
    		 tutorialBlock.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/folder/tutorialBlock.png");
    			ModLoader.addName(tutorialBlock, "Block Tutorial");
    			ModLoader.registerBlock(tutorialBlock);
    			ModLoader.addRecipe(new ItemStack(tutorialBlock, 1), new Object[] {
    						"MMM", "MSM", "MNM", Character.valueOf('M'), Item.ingotIron, Character.valueOf('S'), Block.dirt, Character.valueOf('N'), Item.stick});
    		}
    		public static Block tutorialBlock = new BlockTutorial(200, 0, Material.rock).setHardness(0.6F).setResistance(5F).setBlockName("tutorialBlock");
    
            public String getVersion(){return "Mod name and version here";}
            public void load() {}
    }
    Posted in: Tutorials
  • 0

    posted a message on [1.2.5 ModLoader] Muserae's Modding Tutorial
    Basic mod_ Template

    First, you want to create a new .java and name it mod_*, replacing * with whatever you want.
    This tutorial will be based off the java named mod_Tutorial

    package net.minecraft.src;
    import java.util.Map;
    
    
    import net.minecraft.client.Minecraft;
    public class mod_Tutorial extends BaseMod{
    
    		public mod_Tutorial()
    		{
    				//Block and item "Description" goes here.
    		}
    	  
            //If you don't know, a // means it's a comment and is ignored in game
    		//Declaring blocks and items go here
    	  
    		public String getVersion(){return "Mod name and version here";}
    		public void load() {}
    }
    Posted in: Tutorials
  • 2

    posted a message on [1.2.5 ModLoader] Muserae's Modding Tutorial
    Muserae's Minecraft Modding Tutorials

    This Tutorial was last updated: May 27, 2012
    This tutorial is an updated version of the old Muserae's Minecraft Tutorial, found Here.

    Since displaying codes on the forums text wraps, the codes might be hard to read. I recommend copy pasting the code into Eclipse or NotePad++ if you're having trouble reading it.
    Table of Content

    mod_ File

    Blocks

    Items

    GUI

    Other
    Posted in: Tutorials
  • 0

    posted a message on [May 23, 2012][ModLoader]Muserae's Modding Tutorials
    I have a few hours free right now, so I'll start fixing these tutorials. I'm going to start off with adding textures, the template, etc

    Quote from Windikite

    Thanks~


    in the static method, that's where you'd put like
    pencil = new ItemPencil etc etc, but ignore it. Give me a few hours and I'll have it fixed, and the template will be a lot easier imo. Instead of it being sorted by recipe, texture, etc, it'll be sorted by item and block

    Quote from DNORTH

    Let me know when you fix the flower code, and I will take a look at it :)


    I have a few hours, so I'll fix the flower code when I can. I'm going to do the main stuff first, then skip ahead to the flower.
    Posted in: Tutorials
  • 0

    posted a message on [May 23, 2012][ModLoader]Muserae's Modding Tutorials
    Quote from DNORTH

    -snip-


    I'm thinking it's something to do with the texture being in there. the block you use only has 1 int in it I believe, which would be the Block ID. I've never done textures the way you're doing it, so I don't know if that's entirely true.


    Also, When I get time, I'll redo every tutorial and make sure everything is fixed. I knew about the AddRecipe to addRecipe thing, but forgot to change that in the tutorial.
    Posted in: Tutorials
  • 0

    posted a message on [May 23, 2012][ModLoader]Muserae's Modding Tutorials
    Quote from DNORTH

    here it is:
    public static final BlockCaldori caldori = (BlockCaldori) (new BlockCaldori(234, ModLoader.addOverride("/terrain.png", "/Vegetation/caldori.png"))).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setBlockName("caldori");		


    Get rid of (BlockCaldori)

    Quote from subflame11

    ive tried it being as high as 75 or 65 but it still wont work


    Idk then, it should be working
    Posted in: Tutorials
  • 0

    posted a message on [May 23, 2012][ModLoader]Muserae's Modding Tutorials
    Quote from subflame11

    int randPosY = rand.nextInt(25);


    Try changing the number I have quoted to higher. By it being 25, it can only spawn in Y 25 and lower

    Quote from DNORTH

    Thanks for the help :)


    Can I see line 36 of mod_Vegetation?

    Quote from BloodyRiku

    can you make a grenade tutorial please?
    i really need it :)


    I need to make something like this eventually. Once I make that (which might not be for a long time) then I'll make a tutorial on it.
    Posted in: Tutorials
  • 0

    posted a message on [May 23, 2012][ModLoader]Muserae's Modding Tutorials
    Quote from DNORTH

    Hello, making a flower, and I got this error code:


    change setTickOnLoad(true); in the Block class to
    setTickRandomly(true);
    Posted in: Tutorials
  • 0

    posted a message on [May 23, 2012][ModLoader]Muserae's Modding Tutorials
    Quote from Dylpickle373

    -snip-

    If I remember right, you change the material to something like whatever obsidian is. material.rock makes so you need any pickaxe for example, iron makes a stone pick+ needed
    Posted in: Tutorials
  • 0

    posted a message on [May 23, 2012][ModLoader]Muserae's Modding Tutorials
    Quote from Elyssia001

    -snip-


    I forgot about biomes :P
    Those are fairly easy, only thing I'll have to figure out is how to add custom tree type gens and whatnot.

    Mobs, I will eventually go over how to make the model, in little detail. (basically how to get Techne and add new blocks, set up texture, etc)
    As I don't know anything about AI, I can't do anything on that unless I figure anything out. The reason why I haven't done mobs is because in 1.8.1 the mob spawn system was messed up, and I think it's still broken.
    Posted in: Tutorials
  • 0

    posted a message on [May 23, 2012][ModLoader]Muserae's Modding Tutorials
    Making a Block Usable with Redstone

    Add this to your BlockWhatever.java
    The comments will explain what to change and what not

    	public int tickRate()
    	{
            //How often it refreshes.  If you return 20, that's one second.
    		return 1;
    	}
      
    	public void onNeighborBlockChange(World world, int i, int j, int k, int l)
    	{
    		if(l > 0 && Block.blocksList[l].canProvidePower())
    		{
                //Which direction the power can come from, i is the x coord, j is y, and k is z.
    			boolean flag = world.isBlockIndirectlyGettingPowered(i, j, k) || world.isBlockIndirectlyGettingPowered(i, j - 1, k);
    			if(flag)
    			{
    				world.scheduleBlockUpdate(i, j, k, blockID, tickRate());
    			}
    		}
    	}
    
    	public void updateTick(World world, int i, int j, int k, Random random)
    	{
    		if(world.isBlockIndirectlyGettingPowered(i, j, k) || world.isBlockIndirectlyGettingPowered(i, j - 1, k))
    		{
    		 //Whatever you put here is what happens when it's powered
    		}
    	}
    Posted in: Tutorials
  • 0

    posted a message on [May 23, 2012][ModLoader]Muserae's Modding Tutorials
    Adding Buttons to a GUI

    All of these will go into your GuiWhatever.java in the initGui and actionPerformed methods

    //This will be used later for making buttons disabled
    private GuiButton buttonName;
    
    	public void initGui()
    	{
    	 controlList.clear();
    	 //the 1 is the button ID, width / 2 is width location, height / 2 is height location, 98 is button size (length)
    	 //20 is button size (height)(don't change this), and Button Name is what is displayed on the button
    	 controlList.add(buttonName = new GuiButton(1, width / 2, height / 2, 98, 20, "Button Name"));
    	}
    
    
    	protected void actionPerformed(GuiButton guibutton)
    	{
    	   if(guibutton.id == 1)
    	   {
    			 //if true, you can click.  If false, you can't
    			 buttonName.enabled = false;
    	   }
    	}
    Posted in: Tutorials
  • 0

    posted a message on [May 23, 2012][ModLoader]Muserae's Modding Tutorials
    Adding Text to a GUI

    All of these would go into your GuiWhatever.java in the drawScreen method
    This tutorial will teach you how to add centered and non-centered texts and strings

        public void drawScreen(int i, int j, float f)
    {
    drawDefaultBackground();
    try
    {
    int pic = mc.renderEngine.getTexture(backgroundImg); 
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.renderEngine.bindTexture(pic);
    drawTexturedModalRect(x, y, 0, 0, 176, 166);
    }
    finally
    {
    }
            //This adds the text to the game.  It will add whatever is within the " "
            //width / 2 is the width location, height / 2 is the height location, and 0xffffff is the text color.
            //If you wanted it centered, change drawString to drawCenteredString
            drawString(fontRenderer, "Whatever Text You Want Here", (width / 2, height / 2 , 0xffffff);
            //The difference with this one is instead of " ", it's displaying a string.  A string example is your score because the int changes.
            drawString(fontRenderer, stringNameHere, (width / 2, height / 2, 0xffffff);
            super.drawScreen(i, j, f);
    }
    Posted in: Tutorials
  • 0

    posted a message on [May 23, 2012][ModLoader]Muserae's Modding Tutorials
    Adding a Basic GUI

    What you need to do first is make a new class, like GuiMuserae.java
    This tutorial is just the Template for a basic GUI, the next one will be with buttons and text.

    I've added comments to the code so each method can be explained

    package net.minecraft.src;
    
    import org.lwjgl.opengl.GL11;
    
    public class GuiMuserae extends GuiScreen
    {
    int x = (width - 176 ) / 2;
    int y = (height - 166) / 2;
    
    private static String backgroundImg;
    
    public GuiMuserae()
    {
    super();
    //Calls which image to display
    backgroundImg = "/Folder/GuiImage.png";
    }
    
    //If false, won't pause the game when the GUI is open.
    //If true, it will pause the game when open.
        public boolean doesGuiPauseGame()
        {
            return false;
        }
    
        //When the GUI closes, x happens
        public void onGuiClosed(){}
    
        //This is where you put buttons
        public void initGui()
        {
         controlList.clear();
        }
    
        //This is where buttons are told what to do when clicked
        protected void actionPerformed(GuiButton guibutton)
        {
        }
    
        //This is where it says what text and image to use
        public void drawScreen(int i, int j, float f)
    {
    drawDefaultBackground();
    try
    {
    int pic = mc.renderEngine.getTexture(backgroundImg); 
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.renderEngine.bindTexture(pic);
    drawTexturedModalRect(x, y, 0, 0, 176, 166);
    }
    finally
    {
    }
            super.drawScreen(i, j, f);
    }
    }
    Posted in: Tutorials
  • To post a comment, please .