• 1

    posted a message on [1.4.7] Power Craft factory mod
    If you are going to make this mod cheaper, I suggest replacing diamonds with lapiz lupizi blocks, so that we have a purpose to use lapiz lupizi. Especially for the separators...
    Posted in: Minecraft Mods
  • 1

    posted a message on [1.3.2] BetterGravel
    With this mod I can actually terraform the village roads without going out and finding more gravel. Since the roads are always wonky, this is something I always do. So this helps me out a lot. Thanks. ^.^
    Posted in: Minecraft Mods
  • 1

    posted a message on [ModLoader][1.0.*] Metadata/Damage Crafted Blocks [Nov. 30, 2011]
    Quote from Rimevel

    Idk what I'm doing wrong. For some reason I keep getting NullPointers to the addName function.
    I'm using the forge API but as far as I know that should not be the problem?

    Caused by: java.lang.NullPointerException
    	at net.minecraft.src.ModLoader.AddName(ModLoader.java:304)
    	at net.minecraft.src.mod_SMPEP.load(mod_SMPEP.java:65)
    	at net.minecraft.src.ModLoader.init(ModLoader.java:739)
    	... 6 more

    	public void load()
    		//Init Items and Blocks.
    		Item itemCoin = new ItemCoin(itemCoinID - 256);
    		Block blockSMPEPOres = new BlockSMPEPOres(blockSMPEPOresID, 0);
    		//Register Blocks.
    		[b]ModLoader.RegisterBlock(blockSMPEPOres, net.minecraft.src.BlockSMPEPOres.class[/b]);
    		//Add Names.
    		ModLoader.AddName(new ItemStack(blockSMPEPOres, 1, 0), "Copper Ore");
    		ModLoader.AddName(new ItemStack(blockSMPEPOres, 1, 1), "Tin Ore");
    		ModLoader.AddName(new ItemStack(blockSMPEPOres, 1, 2), "Silver Ore");
    		ModLoader.AddName(new ItemStack(blockSMPEPOres, 1, 3), "Mithril Ore");
    		//Preload all texture files so they show up correctly.

    It complains about this part in ModLoader:
                ItemStack itemstack = (ItemStack)obj;
          >>>>  String s2 = Item.itemsList[itemstack.itemID].getItemNameIS(itemstack);
                if(s2 != null)
                    s1 = (new StringBuilder(String.valueOf(s2))).append(".name").toString();

    I'm quite new to this so I'm sure it's some newbie mistake :rolleyes:

    I bolded the line that looks like it has the probable error. The second parameter to ModLoader.RegisterBlock() must be a class for an Item. You have it pointing at the block.

    (If that isn't it, can you point out which line 65 is in your code?)
    Posted in: Tutorials
  • 1

    posted a message on [ModLoader][1.0.*] Metadata/Damage Crafted Blocks [Nov. 30, 2011]
    I have updated this for 1.0.*. Not sure if it is fully upgraded, but I'm pretty sure the only change is to move the code that was in the constructor to the load() method and to rename version to getVersion().
    Posted in: Tutorials
  • 1

    posted a message on [ModLoader][1.0.*] Metadata/Damage Crafted Blocks [Nov. 30, 2011]
    Quote from omgnoobs

    ??? to hard for me just upload the file and make a download link

    I don't actually have a file to upload. This is an abstraction of code I fiddled with to get separate functionality out of the same block. It's a tutorial you cannot just copy and paste without understanding at least a little bit what you are doing.
    Posted in: Tutorials
  • 3

    posted a message on [1.8.1] Labyrinth

    (The lone pillar in this pic is no more, unless enough of you convince me to add it back in.)


    • Cell: a 100x128x100 area in Minecraft.
    • Room: a 9x9x9 area in Minecraft, often with 10x9x1 sized walls on some sides.
    • Pillar: Nine blocks stacked on each other.
    • Braided: A quality of a maze such that you can end up crossing a node you've already crossed without backtracking.
    • Perfect: A quality of a maze such that you cannot end up crossing a node you've already crossed without backtracking.
    • Recursive Division: An algorithm for generating perfect mazes.

    Infinite mazes in minecraft.

    Initial Release targets:

    • Obsidian walls.
    • Every cell is a perfect maze created with a recursive division algorithm.
    • Every cell will connect with the surrounding cells in 2 to 8 locations, making a floor braided on the large scale.
    • Room types + user-defined rooms.
    • Rooms are 9x9x9 blocks big.
    • Persistent generation of rooms, though not room types.

    Second Release targets:

    • Multiple floors. (Entirely braided) [might send it out with just this]
    • Multi-room room-plans.
    • Maybe even room-plans that span multiple floors.
    • Maximum will be 10x10x10 rooms (taking an entire cell).

    Future targets:

    • Cell-door room plans.
    • Spawn in a new dimension instead of the main world.
    • Get to new dimension by blinding yourself.

    I personally will not be making an entities for this mod. Furthermore, I do not believe I shall be adding any new blocks.

    Persistent targets:

    • Work with ModLoader
    • (maybe) Work with MC Forge. Definitely want to make sure that new dimension code works before Forge, since the Forge will probably limit my ability to zero out world gen methods.
    • Persistent labyrinth generation.


    • The world generates below and above you.
    • Rare case of trees generating through the floor.
    • Loading cells will freeze minecraft for a long time. (8 or so seconds on my slow computer)
    • Removing lone pillars in cell walls (when two openings in the cell wall are simultaneous) gets called to often, but removes an already empty pillar.
    • Animals generate above the ground, and fall, taking damage...except the unlucky ones which spawn inside walls. I've seen so far: :Sheep:

    Props goes to jamis for posting the recursive division algorithm in Ruby. If you want to see the algorithm in java, you can find me in #risucraft.
    Posted in: WIP Mods
  • 1

    posted a message on [WIP] The Caverns
    You are going to need to explain the "Not using ModLoader to increase compatibility" statement.
    Posted in: WIP Mods
  • 1

    posted a message on [AdCraft.co] The New Adfly
    Since it is not mentioned here, there is an IRC channel @ irc://irc.esper.net/adcraft
    Posted in: Mods Discussion
  • 3

    posted a message on [ModLoader][1.8.1] Havvy's Block Tutorial (Sept. 23, 2011)
    Hello potential modders. There are many tutorials already on how to create new blocks in Minecraft already, so instead of focusing on just creating a block and done, this tutorial shall focus on explaining some stylistic points with block creation such as block properties in the block class file instead of the mod class file.

    %Anything% is a variable. For example, %mcp% refers to the location of your MCP folder.

    The block we shall implement in this example shall be called "Glowrock". It glows dimly (giving half the light of glowstone), and otherwise behaves and looks like stone. To craft it, you place a torch on stone. We will call the mod itself Glowrock also.

    If this is your first mod, open the spoiler below.

    [spoiler]To start out modding, you need to understand Java. If you don't understand it, learn about it. Learn what methods are, and how inheritance works at the minimum.

    Then, you need to set up your development environment.

    1. Get MCP 4.4 and decompile a jar with ModLoader in it. There are tutorials on how to do this, and MCP has its own readme files. While ModLoader is not strictly necessary, it is helpful.
    2. Fire up Eclispe or whatever IDE you use. Do not use Notepad! Get something with syntax highlighting at the minimum. In Eclipse, point your workspace to the necessary folder, as described by MCP. In other environments, you'll be using %mcp%/src/minecraft/net/src/ for the location of files.
    3. At some point, download Rigusami's JavaDoc and read through it for BaseMod and ModLoader.

    Eclipse gives nice features like autocompletion and error hinting, along with the left sidebar showing files (open "Client" then "src" then the "net.minecraft.src" package) and the right sidebar showing fields and methods (which you can make sort alphabetically). Furthermore, you can click a method or field, and press F3 to go to where it is defined, though it may show the superclass of what class is actually passed.

    If you are going for a Notepad like experience, on Windows use Notepad++. Kate for KDE environments works well. If you understand Emacs or Vim, you can use them. Just don't use Notepad, Wordpad, or other simple text editors that don't, at minimum, color your code. Also, do not use a document editor such as Microsoft Office, Libre Office, ect. Those are for documents, not code.

    Now, since this is your first mod, you will want to know that the base class for your mod is called "[i]mod_%Name%[/i]". This allows ModLoader to find and load your mod. This class has to extend BaseMod, and BaseMod has an abstract method [i]public String Version()[/i]. When the mod is loaded, it will be created from its no-argument constructor. You will need to set up your mod to prepare for that. I call this class the 'mod class'.

    The following chunk of code is a skeleton for all mods:

    [code]package net.minecraft.src; public class mod_Name extends BaseMod { @Override public String Version() { return "%ModVersion% for %MCVersion%"; } mod_Name() { } }[/code]

    %ModVersion% is the version number you want to give it. I either use rNumber or Major.Minor.Point. Examples include r1 and 1.0.0. %MCVersion% is the version of Minecraft. This tutorial is for 1.8.1, so %MCVersion% would be 1.8.1. Strictly speaking, you can return any string you want, but using this format, ModLoader.txt shows:

    [code]FINE: Mod Loaded: "mod_Name %ModVersion% for %MCVersion%" from mod_Name.class[/code][/spoiler]

    [size="6"]1. Gather Block Data Basics[/size]

    [*] Name of the block
    [*] What texture(s) it will use.
    [*] The Block's Material.
    [*] The block's sound, hardness, resistance and light values. (which I shall sometimes call special values)
    [*] BlockID

    [b]Name of the block[/b]: A block has two different names. One will be seen in-game, when in a user's inventory stack. The other is seen by the game or by the TooManyItems mod. Names are important, since they are a strong clue as to the functionality of the block to the player. Think hard about them.

    [b]Texture(s)[/b]: You can use textures from terrain.png or use your own textures.

    [b]Material[/b]: Material's determine whether or not it can be moved by a piston, whether or not it burns, whether or not it's translucent, and a few other properties. Your default choices for materials are as follows:

    [spoiler][code]Material.air Material.grass Material.ground Material.wood Material.rock Material.iron Material.water Material.lava Material.leaves Material.plants Material.vine Material.sponge Material.cloth Material.fire Material.sand Material.circuits Material.glass Material.tnt Material.ice Material.snow Material.craftedSnow Material.cactus Material.clay Material.pumpkin Material.portal Material.cakeMaterial Material.web Material.piston[/code][/spoiler]

    [b]Stepping Sound, Resistance, Hardness, Light[/b]:

    [list][*]Stepping Sound: Sound made when stepped over. See the spoiler for the list of available sounds without using AudioMod.

    [spoiler][code]Block.soundPowderFootstep Block.soundWoodFootstep Block.soundGravelFootstep Block.soundGrassFootstep Block.soundStoneFootstep Block.soundMetalFootstep Block.soundGlassFootstep Block.soundClothFootstep Block.soundSandFootstep[/code][/spoiler]
    [*]Resistance: The blocks resistance to explosions. Default is 0F, Stone-like bricks have 10F, and obsidian has 2000F. Bedrock uses 60000F.
    [*]Hardness: How hard the block is to mine. Ores generally have 3F, leaves have 0.2F, Obsidian has 10F. Bedrock uses a special method to make it unbreakable.
    [*]Light: If your block emits light, you need to know how much. Valid numbers are between 0F and 1.0F. Torches have 0.9375F. Fires and Glowstone have 1.0F. Brown Mushrooms have 0.125F.

    [b]BlockID[/b]: The default block ID. You should make it configurable using MLProp, which involves getting the decompile fix from Rigusami's mod page. These are slowly getting used up with each new version of Minecraft. Minecraft 1.9 takes blocks up to 115.

    For glowrock, we are going to give it a public facing name of "Glowrock" and an internal name of "glowrock". It will have the same material as stone, along with the resistance and hardness. It will have a light value of 0.5F. The texture will also be as stone.

    [size="6"]2. Your Mod File Skeleton[/size]

    [code]package net.minecraft.src; public class mod_Glowrock extends BaseMod { //Using MLProp to create a property file that will show up in //%appdata%/.minecraft/config/mod_NewBlock.cfg @MLProp(min=1.0D, max=255.0D) public static int glowrockId = 255; @Override public String Version() { return "r1 for 1.8.1"; } mod_NewBlock(){ //Add this code block you add to the constructor Block glowrock = new BlockGlowrock(glowrockId); ModLoader.RegisterBlock(glowrock); ModLoader.AddName(glowrock, "Glowrock"); //This here adds a recipe in the same shape as a torch. ModLoader.AddRecipe(new ItemStack(glowrock, 1), new Object[]{ "X", "Y", Character.valueOf('X'), Block.torchWood, Character.valueOf('Y'), Block.stone, }); } }[/code]

    Compared to the default mod skeleton, there are three changes. The first is adding a static integer that can be configured by a config file for the int of the block.

    The second change is the addition of three lines to the constructor. The first line defines the new block with it's ID. Let us look closely at how this first line is written, since there is a lot of repetition of 'new' and 'block'.

    [code]Block %fieldBlock% = new %className%(%propertyName%);[/code]

    [*]%fieldBlock%: The field that holds the block. Call it whatever you want. I generally name it the internal name of the block. You cannot name it the same as another field or class. To avoid naming it as a class, just make sure the first character is not uppercase, which is good practice with fields anyways.
    [*]%className%: The name of the class that implements the block. Following Notch's lead, these classes have names starting with "Block".
    [*]%propertyName%: The name of the property that defines the ID. it is defined as a public static int outside the constructor.

    Compared to most "Create a Block" tutorial, this line seems vacant. The texture, material, internal name, and special properties (lightness, hardness, ect.) of the brick are not defined here, whereas they normally are in other tutorials. It is my opinion that defining those values inside the mod class breaks the data hiding value of Object Oriented programming. They can and should be defined in the block itself.

    Now that you understand what the first line does, let's take a look at the other two lines.

    [code]ModLoader.RegisterBlock(glowrock); ModLoader.AddName(glowrock, "New Block Name");[/code]

    The first line registers the block. It has a signature as follows:


    The other line adds the public facing name to your block. It has a signature as follows. If you know how to move this inside the block class as well, please reply saying how!

    [code]ModLoader.AddName(%fieldBlock%, "%BlockName%");[/code]

    The third change from the base mod skeleton is the addition of a recipe.

    [code]//This here adds a recipe in the same shape as a torch. ModLoader.AddRecipe(new ItemStack(glowrock, 1), new Object[]{ "X", "Y", Character.valueOf('X'), Block.torchWood, Character.valueOf('Y'), Block.stone, });[/code]

    Since this tutorial in not on adding recipes, I'll punt you to HowNot2Play's [url="http://www.youtube.com/watch?v=IBONiyQPkFw"]Youtube video[/url] on recipes.

    [size="6"]3. The Block Class[/size]

    [code]package net.minecraft.src; public class BlockGlowrock extends Block { public static int textureIndex = 1; public BlockGlowrock(int id) { super(id, Material.rock); this.blockIndexInTexture = textureIndex; this.setHardness(1.5F); this.setResistance(10F); this.setStepSound(soundStoneFootstep); this.setBlockName("glowrock"); this.setLightValue(0.5F); } }[/code]

    You will notice that the block class extends Block.

    Outside of the constructor, I have the following line:

    [code]public static int textureIndex = 1;[/code]

    If I was doing anything more advanced than setting the texture to something that is already in the game, this line would be helpful, since I can change '1' to "[i]ModLoader.addOverride("/terrain.png", "/src/to/img.png");[/i]".

    The only other thing in the block is the constructor. The first line of the constructor is very important.

    [code]super(id, Material.rock);[/code]

    The method super must be the first line of this constructor. We pass along the id and the Material to it. As you can see, we use [i]Material.rock[/i] in the example.

    Afterwards, we define the texture on the block, by using the id defined earlier.

    And finally we set the various special properties. All are optional except for "[i]setBlockName(name);[/i]". Furthermore, you do not need to include the '[i]this.[/i] prefix for the properties, but to me, it helps readability.

    This block now glows when placed and looks like stone. It returns itself when you break it and you have to use wooden tools or better to obtain it. It doesn't do anything real fancy, but hopefully you see the separation of logic from the mod logic and the block logic.
    List tags are malformed.
    Posted in: Tutorials
  • 12

    posted a message on [ModLoader][1.0.*] Metadata/Damage Crafted Blocks [Nov. 30, 2011]
    So, you want to make a block like cloth or conserve your block ids? Well, you've come to the right thread. Here, I shall describe the process of creating such a block.

    What you need:

    • MCP 5.0 for 1.0.*
    • ModLoader for 1.0.*

    Files to create:

    We shall call this block "Multifaceted". For this multifaceted block, we will need to create three classes.

    • mod_Multifaceted - Change to the name of your mod.
    • ItemMultifaceted
    • BlockMultifaceted

    Some things to keep in mind:

    • Items have damage values. Blocks have metadata values.
    • Damage values have to be between 0 and 15, inclusive.
    • I register blocks and textures in a more manageable way that most tutorial writers. I'll have to write a tutorial on it.
    • I've rewritten parts of this five times. If something doesn't flow properly, tell me!

    And now, what you shall be learning:

    • Classes needed to make a block with damage values/metadata values.
    • How to give each damage value its own name.
    • How to make each damage value show up in TMI with good names.
    • How to have the texture set by metadata value.

    ">Mod Class (mod_Multifaceted)

    Alright, to start off, we define our mod class.

    package net.minecraft.src;
    * @author YOUR NAME
    public class mod_Multifaceted extends BaseMod {
    	// Define property file.
    	@MLProp(min=133.0D, max=255.0D) public static int MultifacetedBlockId = 129;
            // Define texture overrides.
            public static int texture1 = ModLoader.addOverride("/terrain.png", "/path/to/texture1.png");
            public static int texture2 = ModLoader.addOverride("/terrain.png", "/path/to/texture2.png");
            public static int texture3 = ModLoader.addOverride("/terrain.png", "/path/to/texture3.png");
            //etc. etc.
        public mod_Multifaceted() {
    	public String getVersion() {
    		return "r1 for 1.0.*";
    	public void load(){
    		Block multifaceted = new BlockMultifaceted(MultifacetedBlockId);
    		ModLoader.RegisterBlock(multifaceted, net.minecraft.src.ItemMultifaceted.class);
    		ModLoader.AddName(new ItemStack(multifaceted, 1, 0), "Multifaceted 0");
                    ModLoader.AddName(new ItemStack(multifaceted, 1, 1), "Multifaceted 1");
                    ModLoader.AddName(new ItemStack(multifaceted, 1, 2), "Multifaceted 2");
                    //etc. etc.
    		//Add Recipes (these recipes won't work -- Empty!)
    		ModLoader.AddRecipe(new ItemStack(multifaceted, 1, 0), new Object[]{});		
    		ModLoader.AddRecipe(new ItemStack(multifaceted, 1, 1), new Object[]{});
                    ModLoader.AddRecipe(new ItemStack(multifaceted, 1, 2), new Object[]{});
                    //ect. ect.

    Alright. This is quite a lot of code, so let us break it down.

    The first line is the ever present package line. Then there is an annotation for your name. Use your real name.

    Afterwards, we begin the class for the mod. The first think I do is set a property file. Other tutorials explain how it works. It's not required, but it's user friendly.

    Right after, are static definitions for textures. Use as many as you need. Declaring your textures as their own variable allows you to be well, more declarative. And declarative programming is much easier to read and modify in the future.

    Next is an implementation for the version. This is a required function. These are all standard parts you should have in the mod class file. If you don't understand them, don't ask questions about them here. I'll just direct you to Google.

    The first line defines the block. You'll notice that compared to most tutorials, this definition is extremely bare. You only pass it the block id and you don't set any block properties! You'll find these properties can (and are defined) in the blocks class itself.

    Then register the block for Block Metadata/Item Damage cohesion using the following version of ''registerBlock''.

    ModLoader.registerBlock(block, fully-qualified-name-to-item)

    Using this version of the registerBlock method tells the code the parts necessary to make crafting, placing, and mining of the block work smoothly.

    After defining the block, we add ModLoader names. You see that you pass it an ItemStack of your item. You create a new ItemStack because you get the in-game name of the item from it's damage value in the item class, and you add the name to the damaged version. If you haven't seen this constructor for ItemStack before, here is the signature:

    ItemStack(Item item, int quantity, int damage);

    After registering your blocks, you probably want to register recipes. Use whatever method you use to create the recipe, but remember to use the constructor shown above.

    And with that, you don't have to touch the mod class for modifying this block, unless you are modifying textures. If you really wanted to, you could move the textures to the block class too.

    Item Class (ItemMultifaceted)

    package net.minecraft.src;
    public class ItemMultifaceted extends ItemBlock {
            public static String[] blockNames = { "Multifaceted 1 Name", "Multifaceted 2 Name",
                    "Multifaceted 3 Name" /* ect. ect. */ }
    	public ItemMultifaceted(int id) {
            public int getPlacedBlockMetadata(int damage) {
                    return damage;
            public String getItemNameIS(ItemStack itemstack) {
            return (new StringBuilder())

    The constructor and getPlacedBlockMetadata methods are copy & paste.

    ModLoader will call the constructor for you. I'm not sure if setMaxDamage(0) is necessary or not, but without setHasSubtypes(true), damage values get replaced in ItemStack manipulation in the inventory.

    I'm not sure how getPlacedBlockMetadata works, so I have no comment on it. I cannot guarantee what will happen if you change this method.

    The ''blockNames[]'' String array defines the in-game names of your item. Position n (starting with 0) on the array corresponds to damage value n. The game will crash into a "Saving Chunks" screen if a player picks up a block without one of these names. Adding these names makes these blocks visible from Too Many Items, and this is the name that you will see.

    Block Class (BlockMultifaceted)

    package net.minecraft.src;
    import java.util.Random;
    public class BlockMultifaceted extends Block {
    	public BlockMultifaceted(int id) {
    		super(id, Material.someMaterial);
            public int idDropped(int metadata, Random random) {
                    return blockID;
            protected int damageDropped(int metadata) {
                    return metadata;
            * Pick one of the following 3 code blocks.
            // If you use metadata to change the texture of the block.
            public int getBlockTextureFromSideAndMetadata(int side, int metadata) {
                    switch (metadata){
                    case 0: return mod_Multifaceted.texture1;
                    case 1: return mod_Multifaceted.texture2;
                    case 2: return mod_Multifaceted.texture3;
                    //etc. etc.
            // If you use the side of the block but not metadata.
            public int getBlockTextureFromSide(int side){
                   switch (side){
                   case 0: return mod_Multifaceted.texture1;
                   case 1: return mod_Multifaceted.texture2;
                   case 2: return mod_Multifaceted.texture3;
                   //etc. etc.
            // If you only use one texture at all.
            this.blockIndexInTexture = mod_Multifaceted.texture1;
            // If you choose this one, you can put it with all the other this.* declarations.

    As you can see, special properties, like the block name, step sound, resistance, and hardness are all defined here in the block. The "this." isn't needed, strictly speaking, but I think it helps the readability. These properties really should be defined inside the block, since these properties are logically about the block, and not logically, about the mod. But enough of my tangent, on to the rest of the code.

    The idDropped method is unchanged, but there is a new method called damageDropped. It is passed one integer, the metadata value of the block. This function is called when you break it, and the item of the block will have the damage as specified by the return value.

    And then you see that you have three blocks to choose from. These are where your texture(s) get defined at. The bottom two are hopefully familiar, and you can look at Block.Cloth for another example of different textures based on metadata.
    Posted in: Tutorials
  • To post a comment, please .