Jump to content

Testing a custom version of Forge


Nephroid

Recommended Posts

 

Hello, I'm writing a Java class to test some functions that I wrote, but it seems that ItemStack.getItem() is returning null.

 

Here is the relevant portion my test class:

public class Test
{
    public static void main(String[] args)
    {
        ItemStack testItem = new ItemStack(Blocks.cobblestone);
        System.out.println(testItem.getItem()); // Prints null
    }
}

 

Is there some special way to get the item, or does testing this way not work?

 

 

Edit:

To be more precise, I'm writing an API for Forge, and I want to test it. I have already followed the instructions here: https://github.com/MinecraftForge/MinecraftForge/wiki/If-you-want-to-contribute-to-Forge

Link to comment
Share on other sites

I'm trying to test an API function, so I don't think setting up a mod is that straightforward.

 

I used this link to set up my project, so I'm not sure where the mods go. (I'm pretty sure this project doesn't have a functioning Minecraft either; I get something about missing lwjgl when I try to run net.minecraft.client.main.Main, so I assume Minecraft isn't installed.)

 

Do I have to run gradlew genPatches, then gradlew setupDecompWorkspace, then create a mod every time I want to test something?

Link to comment
Share on other sites

Setting up mod is "that straightforward". Mods are being loaded by FML - That happens during game initialization. You can't just get something that doesn't exist yet. In this case Blocks.cobblestone is null because it hasn't been initialized yet.

 

Anyway: http://www.minecraftforge.net/forum/index.php?topic=14048.0#post_update_forge

Follow steps, you will get generic mod, then do whetever you want. API is not a program itself, it's an API that need something to run on (MC, thet need to be setup).

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.