Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[Solved] [1.12] subItems appear in creative delete slot


PegBeard
 Share

Recommended Posts

This is the first time I have done meta items. Everything works, except the first subitem appears in in the creative inventory 'Delete Item' slot, and at the end of every creative tab.
For testing purposes, I stripped the class down to the essentials, but the error persists.

 

	public static ItemStack item1;
    public static ItemStack item2;

    public DTTest(String name)
    {
		this.setUnlocalizedName(Reference.MOD_ID + ":" + name);
		this.setCreativeTab(DTCreativeTab.DT_TAB);
		this.setMaxDamage(0);
		setContainerItem(this);
		setHasSubtypes(true);
	    
		item1 = new ItemStack(this);
		item1.setItemDamage(0);
        
		item2 = new ItemStack(this);
		item2.setItemDamage(1);
    }

    @SideOnly(Side.CLIENT)
    @Override
    public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> items)
    {
        items.add(item1);
        items.add(item2);
    }

 

The item is registered thusly, and called during preInit (haven't switched to events yet):

public static Item test = new DTTest(Names.Items.TEST);

ForgeRegistries.ITEMS.register(test.setRegistryName(Names.Items.TEST));

 

Edited by PegBeard
Link to comment
Share on other sites

Item#getSubItems is now called for every Item on every creative tab, you need to call Item#isInCreativeTab and only add the items to the list if it returns true.

 

It's also no longer a client-only method, you should remove the @SideOnly annotation from it.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

  • 5 months later...

Okay, so I would really like to know why people use # in front of function calls when describing them, instead of the period you ACTUALLY use. But regardless, Item.isInCreativeTab does not appear to exist in forge-1.12-14.21.1.2443. How does one go about resolving this problem? - As I'm having it too.

Link to comment
Share on other sites

24 minutes ago, Sataniq said:

Okay, so I would really like to know why people use # in front of function calls when describing them, instead of the period you ACTUALLY use.

Because the method is not a static method:

Item.isInCreativeTab() can't be invoked directly.

You need an instance:

Item i = ...;

i.isInCreativeTab();

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Ah, I see. I have a reference to an item but the function still doesn't show in the IDE's suggestions list. I've found it in the Item class, but it's protected. My item does extend a class that extends net.minecraft.item.Item, so surely this should be visible to me? I'm not sure if IDEA is being strange, or I'm just being stupid. Also, how do we actually get the single ItemStack in the getSubItems() function? It's passing a NonNullList<ItemStack>

 

EDIT: I figured I had to cast the item to the class type to get access to the function. This is why you don't program at 8am :D

Edited by Sataniq
I derped
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Every time when i close my inventory in search mode the game crashes. i have many mods installed, but it has nothing to do with the mods.   here is the crash report: pastebin
    • I have a problem and that when I open forge it stays loading in the model manager and there it stays until I close the game then the game appears to have ended incorrectly Exit code 1
    • forge-1.16.4-35.1.4-installer.jar will not install. My 11 y/o son has been working on a world for months and all the mods need this specific version. Is there a way to get the missing files and install them manually? Please review this log file and reply with links if possible:   JVM info: Oracle Corporation - 12.0.2 - 12.0.2+10 java.net.preferIPv4Stack=true Found java version 12.0.2 Extracting json Considering minecraft client jar Downloading libraries Considering library net.minecraftforge:forge:1.16.4-35.1.4   File exists: Checksum validated. Considering library org.ow2.asm:asm:7.2   File exists: Checksum validated. Considering library org.ow2.asm:asm-commons:7.2   File exists: Checksum validated. Considering library org.ow2.asm:asm-tree:7.2   File exists: Checksum validated. Considering library org.ow2.asm:asm-util:7.2   File exists: Checksum validated. Considering library org.ow2.asm:asm-analysis:7.2   File exists: Checksum validated. Considering library cpw.mods:modlauncher:8.0.6   File exists: Checksum validated. Considering library cpw.mods:grossjava9hacks:1.3.0   File exists: Checksum validated. Considering library net.minecraftforge:accesstransformers:2.2.0-shadowed   Downloading library from https://maven.creeperhost.net/net/minecraftforge/accesstransformers/2.2.0-shadowed/accesstransformers-2.2.0-shadowed.jar java.io.FileNotFoundException: https://maven.creeperhost.net/net/minecraftforge/accesstransformers/2.2.0-shadowed/accesstransformers-2.2.0-shadowed.jar     at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)     at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)     at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)     at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)     at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)     at java.base/sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1969)     at java.base/sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1964)     at java.base/java.security.AccessController.doPrivileged(AccessController.java:552)     at java.base/sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1963)     at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1531)     at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1515)     at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:251)     at net.minecraftforge.installer.DownloadUtils.download(DownloadUtils.java:146)     at net.minecraftforge.installer.DownloadUtils.download(DownloadUtils.java:134)     at net.minecraftforge.installer.DownloadUtils.downloadLibrary(DownloadUtils.java:123)     at net.minecraftforge.installer.actions.Action.downloadLibraries(Action.java:79)     at net.minecraftforge.installer.actions.ClientInstall.run(ClientInstall.java:108)     at net.minecraftforge.installer.InstallerPanel.run(InstallerPanel.java:428)     at net.minecraftforge.installer.SimpleInstaller.launchGui(SimpleInstaller.java:170)     at net.minecraftforge.installer.SimpleInstaller.main(SimpleInstaller.java:143) Caused by: java.io.FileNotFoundException: https://maven.creeperhost.net/net/minecraftforge/accesstransformers/2.2.0-shadowed/accesstransformers-2.2.0-shadowed.jar     at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1915)     at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1515)     at java.base/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:527)     at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:335)     at net.minecraftforge.installer.DownloadUtils.getConnection(DownloadUtils.java:203)     at net.minecraftforge.installer.DownloadUtils.download(DownloadUtils.java:144)     ... 7 more Considering library net.minecraftforge:eventbus:3.0.5-service   Downloading library from https://maven.creeperhost.net/net/minecraftforge/eventbus/3.0.5-service/eventbus-3.0.5-service.jar java.io.FileNotFoundException: https://maven.creeperhost.net/net/minecraftforge/eventbus/3.0.5-service/eventbus-3.0.5-service.jar     at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)     at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)     at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)     at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)     at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)     at java.base/sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1969)     at java.base/sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1964)     at java.base/java.security.AccessController.doPrivileged(AccessController.java:552)     at java.base/sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1963)     at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1531)     at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1515)     at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:251)     at net.minecraftforge.installer.DownloadUtils.download(DownloadUtils.java:146)     at net.minecraftforge.installer.DownloadUtils.download(DownloadUtils.java:134)     at net.minecraftforge.installer.DownloadUtils.downloadLibrary(DownloadUtils.java:123)     at net.minecraftforge.installer.actions.Action.downloadLibraries(Action.java:79)     at net.minecraftforge.installer.actions.ClientInstall.run(ClientInstall.java:108)     at net.minecraftforge.installer.InstallerPanel.run(InstallerPanel.java:428)     at net.minecraftforge.installer.SimpleInstaller.launchGui(SimpleInstaller.java:170)     at net.minecraftforge.installer.SimpleInstaller.main(SimpleInstaller.java:143) Caused by: java.io.FileNotFoundException: https://maven.creeperhost.net/net/minecraftforge/eventbus/3.0.5-service/eventbus-3.0.5-service.jar     at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1915)     at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1515)     at java.base/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:527)     at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:335)     at net.minecraftforge.installer.DownloadUtils.getConnection(DownloadUtils.java:203)     at net.minecraftforge.installer.DownloadUtils.download(DownloadUtils.java:144)     ... 7 more Considering library net.minecraftforge:forgespi:3.2.0   File exists: Checksum validated. Considering library net.minecraftforge:coremods:3.0.0   File exists: Checksum validated. Considering library net.minecraftforge:unsafe:0.2.0   File exists: Checksum validated. Considering library com.electronwill.night-config:core:3.6.2   File exists: Checksum validated. Considering library com.electronwill.night-config:toml:3.6.2   File exists: Checksum validated. Considering library org.jline:jline:3.12.1   File exists: Checksum validated. Considering library org.apache.maven:maven-artifact:3.6.0   File exists: Checksum validated. Considering library net.jodah:typetools:0.8.1   File exists: Checksum validated. Considering library org.apache.logging.log4j:log4j-api:2.11.2   File exists: Checksum validated. Considering library org.apache.logging.log4j:log4j-core:2.11.2   File exists: Checksum validated. Considering library net.minecrell:terminalconsoleappender:1.2.0   File exists: Checksum validated. Considering library net.sf.jopt-simple:jopt-simple:5.0.4   File exists: Checksum validated. Considering library org.spongepowered:mixin:0.8.2   File exists: Checksum validated. Considering library com.github.jponge:lzma-java:1.3   File exists: Checksum validated. Considering library com.google.code.findbugs:jsr305:3.0.2   File exists: Checksum validated. Considering library com.google.code.gson:gson:2.8.0   File exists: Checksum validated. Considering library com.google.errorprone:error_prone_annotations:2.1.3   File exists: Checksum validated. Considering library com.google.guava:guava:20.0   File exists: Checksum validated. Considering library com.google.guava:guava:25.1-jre   File exists: Checksum validated. Considering library com.google.j2objc:j2objc-annotations:1.1   File exists: Checksum validated. Considering library com.nothome:javaxdelta:2.0.1   File exists: Checksum validated. Considering library commons-io:commons-io:2.4   File exists: Checksum validated. Considering library de.oceanlabs.mcp:mcp_config:1.16.4-20201102.104115@zip   File exists: Checksum validated. Considering library de.siegmar:fastcsv:1.0.2   File exists: Checksum validated. Considering library net.md-5:SpecialSource:1.8.5   File exists: Checksum validated. Considering library net.minecraftforge:binarypatcher:1.0.12   File exists: Checksum validated. Considering library net.minecraftforge:forge:1.16.4-35.1.4:universal   File exists: Checksum validated. Considering library net.minecraftforge:installertools:1.1.11   File exists: Checksum validated. Considering library net.minecraftforge:jarsplitter:1.1.2   File exists: Checksum validated. Considering library net.sf.jopt-simple:jopt-simple:4.9   File exists: Checksum validated. Considering library net.sf.jopt-simple:jopt-simple:5.0.4   File exists: Checksum validated. Considering library net.sf.opencsv:opencsv:2.3   File exists: Checksum validated. Considering library org.checkerframework:checker-qual:2.0.0   File exists: Checksum validated. Considering library org.codehaus.mojo:animal-sniffer-annotations:1.14   File exists: Checksum validated. Considering library org.ow2.asm:asm-analysis:6.1.1   File exists: Checksum validated. Considering library org.ow2.asm:asm-commons:6.1.1   File exists: Checksum validated. Considering library org.ow2.asm:asm-tree:6.1.1   File exists: Checksum validated. Considering library org.ow2.asm:asm:6.1.1   File exists: Checksum validated. Considering library trove:trove:1.0.2   File exists: Checksum validated. These libraries failed to download. Try again. net.minecraftforge:accesstransformers:2.2.0-shadowed net.minecraftforge:eventbus:3.0.5-service
    • Sad, so there isnt any working 1.8 ones not 1.8.9
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.