Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

 

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

-.-

 

Maybe try putting it in an actual mod. Minecraft needs to initialize these classes first.

  • Author

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?

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.

Guest
This topic is now closed to further replies.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.