• 0

    posted a message on [Creating Mods] Chewy2014's Modding Tutorials
    that's because anything between /* and */ are comments, and are not part of the script, remove them, they seem to get put there somehow by the MCP, it happened to me as well and I remove them and it works.
    Posted in: Tutorials
  • 0

    posted a message on [ModLoader]Zid's Tutorials - Not Just ModLoader[12/04/2011]
    Quote from icemanfire

    i did the client and posted the coding above

    because you edited the CLIENT and not the SERVER your mod will only work in the SINGLEPLAYER, becuase the server would need to know the new block, meaning modding the SERVER AND the CLIENT, all people that use the server would still need the client mod. Test it in singleplayer to see if you find any of your new block. if not make sure you also added it to the generator in ChunkProviderGenerate.java
    Posted in: Tutorials
  • 0

    posted a message on [ModLoader]Zid's Tutorials - Not Just ModLoader[12/04/2011]
    Quote from Zacharias3

    What is a "null check"?
    when i did this i just got the same errors plus one new:

    src\minecraft\net\minecraft\src\mod_Silver.java:21: cannot find symbol
    symbol  : class Random
    location: class net.minecraft.src.mod_Silver
    rand=new Random(25);
    ^

    here is my code now:
    package net.minecraft.src;
    
    public class mod_Silver extends BaseMod
    {
       public static final Block SilverOre = new BlockSilverOre(97, 0).setHardness(2.0F).setResistance(5.0F).setBlockName("SilverOre");
       public static final Item Silver = new Item(2000).setItemName("Silvr");
       
    public mod_Silver()
    {
    ModLoader.RegisterBlock(SilverOre);
    SilverOre.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Mods/SilverOre.png");
    Silver.iconIndex = ModLoader.addOverride("/gui/items.png", "/Mods/Silver.png");
       ModLoader.AddName(SilverOre, "Silver Ore");
       ModLoader.AddName(Silver, "Silver Ingot");
       ModLoader.AddSmelting(SilverOre.blockID, new ItemStack(Silver, 1));
       }
    
    public void GenerateSurface(World world, Random rand, int chunkX, int chunkZ)
        {
    	    if(rand==null){
                rand=new Random(25);
    		}
            for(int i = 0; i < 11; i++)
    		{
                int randPosX = chunkX + rand.nextInt(16);
    			int randPosY = rand.nextInt(30);
    			int randPosZ = chunkZ + rand.nextInt(16);
    			(new WorldGenMinable(mod_Silver.SilverOre.blockID, 6)).generate(world, rand, randPosX, randPosY, randPosZ);
    		}
        }
    
       public String Version()
       {
       return "1.7_02";
       }
    }



    null means nothing, it is absolutly nothing, and you can not do stuff with null, for example if rand == null then you can't use rand.somemethod() because null does not have any methods. A null check is when you check to see if smethin is null, meaning empty, blank, nothing, etc... by using if(rand==null) you are checking to see if rand is null, if it is you assign it to new Random(seed) the seed just decides the randomness simmmilar to how the minecraft seed for level generation works. if Random is unknown, that means you need to import it, at the top of your script, right afer the package declaration type:

    import java.util.Random;


    importing basically makes a reference to another class, meaning you can use all of its functions, importing is not needed for classes that are in the same package, which is why you do not need to import net.minecraft.src.Block; in order to make a class that extends it. but you know there is:

    net.minecraft.client
    net.minecraft.src
    net.minecraft.isom

    if you were making a class in client and needed to use a class in src you'd need to import it because they are in different packages.

    as seeing you do not have Random imported, inside the function declaration:

    public void GenerateSurface(World world, Random rand, int chunkX, int chunkZ)


    it does not know what Random is, and therefore rand will = null because there's an error, nothing was passed through. import Random it now know what it is and then allows you to use Random.

    so 1 line should fix all those errors.
    Posted in: Tutorials
  • 0

    posted a message on [ModLoader]Zid's Tutorials - Not Just ModLoader[12/04/2011]
    Quote from Zacharias3

    I was trying to get my ore generate, when i got these recompile-errors:

    src\minecraft\net\minecraft\src\mod_Silver.java:17: cannot find symbol
    symbol  : class Random
    location: class net.minecraft.src.mod_Silver
    public void GenerateSurface(World world, Random rand, int chunkX, int chunkZ)
    ^
    
    src\minecraft\net\minecraft\src\mod_Silver.java:21: operator + cannot be applied
     to int,Random.nextInt
    int randPosX = chunkX + rand.nextInt(16);
    ^
    
    src\minecraft\net\minecraft\src\mod_Silver.java:21: incompatible types
    found   : <nulltype>
    required: int
    int randPosX = chunkX + rand.nextInt(16);
    ^
    
    src\minecraft\net\minecraft\src\mod_Silver.java:23: operator + cannot be applied
     to int,Random.nextInt
    int randPosZ = chunkZ + rand.nextInt(16);
    ^
    
    src\minecraft\net\minecraft\src\mod_Silver.java:23: incompatible types
    found   : <nulltype>
    required: int
    int randPosZ = chunkZ + rand.nextInt(16);
    ^

    Here is the code:

    package net.minecraft.src;
    
    public class mod_Silver extends BaseMod
    {
       public static final Block SilverOre = new BlockSilverOre(97, 0).setHardness(2.0F).setResistance(5.0F).setBlockName("SilverOre");
       public static final Item Silver = new Item(2000).setItemName("Silvr");
       
    public mod_Silver()
    {
    ModLoader.RegisterBlock(SilverOre);
    SilverOre.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/Mods/SilverOre.png");
    Silver.iconIndex = ModLoader.addOverride("/gui/items.png", "/Mods/Silver.png");
       ModLoader.AddName(SilverOre, "Silver Ore");
       ModLoader.AddName(Silver, "Silver Ingot");
       }
    
    public void GenerateSurface(World world, Random rand, int chunkX, int chunkZ)
        {
            for(int i = 0; i < 11; i++)
    		{
                int randPosX = chunkX + rand.nextInt(16);
    			int randPosY = rand.nextInt(30);
    			int randPosZ = chunkZ + rand.nextInt(16);
    			(new WorldGenMinable(mod_Silver.SilverOre.blockID, 6)).generate(world, rand, randPosX, randPosY, randPosZ);
    		}
        }
    
       public String Version()
       {
       return "1.7_02";
       }
    }



    A lot of those seem to be simple fixes, I believe the reason you are getting errors for the ChunkX and rand.nextInt(16) is that rand seems to be null, like it's getting passed into the generate as null. you might want to do a null check before doing anything something like:

        public void GenerateSurface(World world, Random rand, int chunkX, int chunkZ)
       {
            if(rand==null){
                rand=new Random(25);
            }
            for(int i = 0; i < 11; i++)
    		{
                int randPosX = chunkX + rand.nextInt(16);
    			int randPosY = rand.nextInt(30);
    			int randPosZ = chunkZ + rand.nextInt(16);
    			(new WorldGenMinable(mod_Silver.SilverOre.blockID, 6)).generate(world, rand, randPosX, randPosY, randPosZ);
    		}
        }
    Posted in: Tutorials
  • 0

    posted a message on [ModLoader]Zid's Tutorials - Not Just ModLoader[12/04/2011]
    Quote from drawingdrewfly

    I have a problem with my mod since I updated it to MCP 1.7.2
    I am at school, so I cannot check the exact error right now.
    Its something like:

    Unnasigned method h() for BlockRail
    And the error is based in RenderBlocks.java

    Now: I first searched on the MCP IRC for an answer.
    They told me to change h() to getIsPowered()
    But then when I reobfuscated: THOUSANDS of Notch clases were changed!
    And I so did not want this.
    Now, what can I do?


    re-obfuscation takes EVERY class and reobfuscates them, not only the ones that were changed, so how do you know that 1000's were changed? because it's still going to go through all of them. If you want to only see the classes you changed I BELIEVE(not sure) that you can move the others out of the folder before obfuscation and then it'll only find the classes you want to obfuscate. once again, not sure.
    Posted in: Tutorials
  • 0

    posted a message on [ModLoader]Zid's Tutorials - Not Just ModLoader[12/04/2011]
    Quote from Sneeshy

    Okay @Deadkyller or anyone else (Like chewy) I can't find Block.class is it in MCP? or minecraft.jar? and also everytime I try to decompile in MCP it says system cannot find path specified when I did everything it told me in the read ne. It worked for me for minecraft 1.6.6 and mcp 1.6.6 but now since the 1.7.2 update it doesnt work please help!


    first it's Block.java until you compile it. When you compile it it packs them into the test jar, when you re-obfuscate the classes they get renamed back to their aa.class, ab.class etc...

    If you are meaning you can't find Block.java after decompiling it then idk, make sure you are looking in the src/minecraft/net/minecraft/src/Block.java.

    I do not belive there physically is a Block.class that is made, unless it's under temp/
    Posted in: Tutorials
  • 0

    posted a message on [Creating Mods] Chewy2014's Modding Tutorials
    @Chewy2014 it's not an error in his code necessarily, but I keep getting errors that OpenGL is not found, anything that draws images or renders the items throws me errors, and when I try hitting play it gives me same error, even though just taking the java files and compiling them and running the client work perfectly.
    Posted in: Tutorials
  • 0

    posted a message on [Creating Mods] Chewy2014's Modding Tutorials
    Quote from LimblessQuasar

    Like I said, that's what I remembered, I really haven't messed with any base classes in a couple of months. I'm not sure what he's trying to do, so I just threw that out there. Either way, the best approach when trying something new that is advanced, is looking around and immersing yourself in the code.

    But anyway, thanks Dread, you just now inadvertently gave me some ideas! and also for explaining what python is, in a different thread....

    Oo about the python, I explained that it was a scripting language, anyways, I used to program in Python, my first language, I make games with it and a few 3D Engines. It's what got me into scripting. Once you learn python you know 60% of java, once you know C++ you know 70% together you know the syntax(C++) and the object orientation(python) it is easy to pick up almost any language.

    And what might be these ideas we hear about, if they are awesome I hope to see them sometime, sounds like you have an interesting idea even though I don't know what it is.
    Posted in: Tutorials
  • 0

    posted a message on [Creating Mods] Chewy2014's Modding Tutorials
    GameSettings holds the info for the keys, but does nothing about actually applying them, no where in GameSettings does it have anything of the type like onKeyPress() or to deal with calling events. Finding the script that calls the EntityPlayer's key sensing event and then making it call another void you make in some class of yours and have that handle the keypress based on the key code. For more info on keys and what each int stands for look up ASII Key Values, which is basically a list of keys and what key is what number, for example Space is 32, which is the one most people know.
    Posted in: Tutorials
  • 0

    posted a message on [ModLoader]Zid's Tutorials - Not Just ModLoader[12/04/2011]
    Quote from Sneeshy

    Thank you so much! What do I need to add to this
    public class RedstoneBlock extends Block{
        public YourBlock(int i, int j, Material m){
            super(i, j, m);
    public void onNeighborBlockChange(World world, int i, int j, int k, int l)
        {
            if(world.multiplayerWorld)
            {
                return;
            }
    		public void onNeighborBlockChange(World world, int i, int j, int k, int l)
        {
            if(world.multiplayerWorld)
            {
                return;
            }
            if(world.isBlockGettingPowered(i, j, k)){
                setLightLevel(8.5F);//can be different
            else{
                setLightLevel(0F);

    (sorry I'm new at minecraft modding but I have modded other games) Also what do i have to do to fill in the code for singleplayer compatibility
    First off replace:

    public YourBlock(int i, int j, Material m){
        super(i, j, m);
    }

    with:
    public RedstoneBlock(int i, int j, Material m){
        super(i, j, m);
    }


    I put YourBlock there as a placeholder, it is meant to be replaced by your class, it's the constructor.

    also this is ONLY single player, this code will not work in multiplayer unless everyone has the mod, because there will be blocks in the game that others will not be able to render and the game will crash.

    If you're new to minecraft modding start more simple and build up.

    you basically use this class, which I do not think anything else needs to be added, and in Block.class write this at the bottom before the "static{":

    public static Block redstoneBlock;


    and then at the bottom of and inside the static{ write this:

    redstoneBlock = (new RedstoneBlock(getLowestBlankID(), yourTextureIndex, Material.stone).setHardness(2F).setName("redstoneBlock");


    replace yourTextureIndex by some number that defines the place the texture for your item will be. If you use a archive program and open minecraft.jar you will see an image called "terrain.png" view that and find a place not taken by something already, to find the number follow this like pattern:

     0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10| 11| 12| 13| 14| 15
     16| 17| 18| 19| 20| 21| 22| 23| 24| 25| 26| 27| 28| 29| 30| 31
     32| 33| 34| 35| 36| 37| 38| 39| 40| 41| 42| 43| 44| 45| 46| 47
     48| 49| 50| 51| 52| 53| 54| 55| 56| 57| 58| 59| 60| 61| 62| 63

    etc... etc... it goes in order across and then goes down to the next level and starts over again with the next number, each row has 16 images and each column has 16, just like each picture by default is 16X16 the grid is 16X16 meaning that there are 256 images, but seeing they are by index the highest you can go is 255, 256 belongs to items and not blocks. As with images there are also 256 possible block ID's, meaning the max id you can choose is 255.

    getLowestBlankID() does not exist, because it is not there by default, but I've recently used it because it helps and I don't have to figure out an id that's not already taken. write this somewhere above all the static declarations and stuff.

    public static int getLowestBlankID(){
        for(int i=0;i<blocksList.length;i++){
            if(blocksList[i]==null){return i;}
        }
        return -1;
    }


    the size of blocksList is 256, meaning it can hold 256 items in the array, the max index is 255. as seeing we go up until i!<256 means the max number we do the loop for is 255, so we don't go over, so it will scan each index from 0-255 to check for the first empty slot. It can be inversed to do getLastEmptySlot by replacing the for loop with:

    for(int i=blocksList.length-1;i>=0;i--)
    that will got down from the highest number to 0, and the first null item it hits will be the last slot available.

    I hope I have helped some
    Posted in: Tutorials
  • 0

    posted a message on [Creating Mods] Chewy2014's Modding Tutorials
    you'd have to look into how other events are done. take a look for example at the player classes to find out how they movve, if you can't figure it out then just add another if statment for whatever key you want.
    Posted in: Tutorials
  • 0

    posted a message on [Creating Mods] Chewy2014's Modding Tutorials
    LOL, I found the problem, I feel so stupid, I accidentally did this:

    public static Item CsycrylChunk = (new Item(-261));


    so it tried to render it as a block as ID of -5 because I accidentally put a minus sign. It's working now...
    Posted in: Tutorials
  • 0

    posted a message on [Creating Mods] Chewy2014's Modding Tutorials
    I'll pm you a zip file with all of the code if you want, but I don't want it to take up space in the thread. Thanks for your help. Awaiting your reply.
    Posted in: Tutorials
  • 0

    posted a message on [Creating Mods] Chewy2014's Modding Tutorials
    the stack trace has no help, it deals with the RenderItem.doRender(), but I'll post it anyways, I'm just wondering why my items is considered null.

    Ingame crash report:

          Minecraft has crashed!      
          ----------------------      
    
    Minecraft has stopped running because it encountered a problem.
    
    If you wish to report this, please copy this entire text and email it to [email protected]
    Please include a description of what you did when the error occured.
    
    
    
    --- BEGIN ERROR REPORT a1dce528 --------
    Generated 7/5/11 1:18 PM
    
    Minecraft: Minecraft Beta 1.6.6
    OS: Windows Vista (x86) version 6.0
    Java: 1.6.0_24, Sun Microsystems Inc.
    VM: Java HotSpot(TM) Client VM (mixed mode), Sun Microsystems Inc.
    LWJGL: 2.4.2
    OpenGL: Mobile Intel(R) 4 Series Express Chipset Family version 2.1.0 - Build 8.15.10.2302, Intel
    
    java.lang.NullPointerException
    	at net.minecraft.src.ItemStack.getIconIndex(ItemStack.java:72)
    	at net.minecraft.src.RenderItem.doRenderItem(RenderItem.java:77)
    	at net.minecraft.src.RenderItem.doRender(RenderItem.java:240)
    	at net.minecraft.src.RenderManager.renderEntityWithPosYaw(RenderManager.java:133)
    	at net.minecraft.src.RenderManager.renderEntity(RenderManager.java:124)
    	at net.minecraft.src.RenderGlobal.renderEntities(RenderGlobal.java:307)
    	at net.minecraft.src.EntityRenderer.renderWorld(EntityRenderer.java:567)
    	at net.minecraft.src.EntityRenderer.updateCameraAndRender(EntityRenderer.java:427)
    	at net.minecraft.client.Minecraft.run(Minecraft.java:514)
    	at java.lang.Thread.run(Thread.java:662)
    --- END ERROR REPORT 48890f35 ----------


    Console:

    == MCP v4.1 ==
    [13:17] 16 achievements
    [13:17] 155 recipes
    [13:17] Loading: net.java.games.input.DirectAndRawInputEnvironmentPlugin
    [13:17]
    [13:17] Starting up SoundSystem...
    [13:17] Initializing LWJGL OpenAL
    [13:17] (The LWJGL binding of OpenAL.  For more information, see http://www.lwjg
    l.org)
    [13:18] OpenAL initialized.
    [13:18]
    [13:18] java.lang.NullPointerException
    [13:18] at net.minecraft.src.ItemStack.getIconIndex(ItemStack.java:72)
    [13:18] at net.minecraft.src.RenderItem.doRenderItem(RenderItem.java:77)
    [13:18] at net.minecraft.src.RenderItem.doRender(RenderItem.java:240)
    [13:18] at net.minecraft.src.RenderManager.renderEntityWithPosYaw(RenderManager.
    java:133)
    [13:18] at net.minecraft.src.RenderManager.renderEntity(RenderManager.java:124)
    [13:18] at net.minecraft.src.RenderGlobal.renderEntities(RenderGlobal.java:307)
    [13:18] at net.minecraft.src.EntityRenderer.renderWorld(EntityRenderer.java:567)
    
    [13:18] at net.minecraft.src.EntityRenderer.updateCameraAndRender(EntityRenderer
    .java:427)
    [13:18] at net.minecraft.client.Minecraft.run(Minecraft.java:514)
    [13:18] at java.lang.Thread.run(Thread.java:662)
    [13:18] Stopping!
    [13:18]
    [13:18] SoundSystem shutting down...
    [13:18] Author: Paul Lamb, www.paulscode.com
    [13:18]
    Posted in: Tutorials
  • 0

    posted a message on [Creating Mods] Chewy2014's Modding Tutorials
    dang, I'm having trouble with the items, I made another if statement on the BlockOre saying to drop my item if the item ID is my blocks' however when I break it instant crash and can't get back into that world, because the game is having trouble drawing the item, it says NullPointerException, but I look through my script and absolutely nothing is left null at all.

    The process for my ore:

    Break ore with ironPickaxe+ and get a Csycryl Chunk of metal
    Put the Csycryl Chunk in a furnace and you'll get 2 Csycrly Gems, put 6 gems in a crafting table like this to make a Csycryl Ingot:

    # # #
    # # #

    then use the ingots to make a pickaxe. it will take:

    9 ores to make a pickaxe
    9 ores to make an axe
    6 ores to make a hoe
    6 ores to make a sword
    3 ores to make a spade/shovel

    here is the code I added into the BlockOre.java:

    if(blockID == Block.oreCsycryl.blockID)
            {
                return Item.CsycrylChunk.shiftedIndex;
            }


    here is the code I added into Item.java:

    public static Item CsycrylChunk = (new Item(261)).setIconCoord(0, 10).setItemName("csycrylMetalChunk");
        public static Item CsycrylGem = (new Item(262)).setIconCoord(1, 10).setItemName("csycrylGem");
        public static Item CsycrylIngot = (new Item(263)).setIconCoord(2, 10).setItemName("csycrylIngot");


    is there anything else I need? because it just doesn't find the item somehow, it keeps getting null.
    Posted in: Tutorials
  • To post a comment, please .