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.

nullcity

Members
  • Joined

  • Last visited

  1. Actually, I forgot to mention this but I already fixed it by initialising the items before the CreativeTab gets initialised and I fixed up the NCTab.java structure because all I did was just copy and paste it from main class to another class. And I no longer have the NPE! So turns out it was cause I registered the items and blocks after the creative tab, but thanks for pointing out I had the setNoScrollbar(); there. i didnt even notice that! PS: The items and blocks DO NOT get ordered in the way they registered them. I already initalised and registered ores first, then blocks, then ingots, then tools and I had a pickaxe right next to an ore and the rest of the tool set for brass as the last 3 slots. Which is why I decided to see if there was a method then saw a text tutorial that was on this forum and tried following it EDIT: Turns out LanguageRegistry also effects the order in how the items are placed in the CreativeTab. So by registered in alphabetical and by type (blocks, items, tools, misc). Now its all ordered!
  2. So I followed a tutorial displayed on here on how to organise a CreativeTab using Comparators and Item[] arrays. The list is kept short and all for now, and I decided to run it just to get a glimpse on how the comparators will work out the list being displayed in the creative tab. But I seem to be getting a NullPointerException... I am guessing is because the custom creative tab file (NCTab.java) is trying to order items that have not been declared in the main class yet. This is how mods main class works first before I show source code of both files. 1. Materials, CreativeTab, Blocks, and Items are initialised. 2. preInit(), custom code to check if mod is up to date and the CreativeTab gets some a parameter switched up [ ncTab.setNoScrollbar(); ]. Not going to have more stuff than what I already coded and I have a reasonable amount of space to disable the scroll bar. Then a world generator gets setup, fluid gets declared and registered (doesnt get registered later cause itll cause an NPE), Then blocks and items and tool get defined all in alphabetical order. (Blocks get ore defined first then their block). Next, GameRegistry registers the blocks, items, then tools. After that LanguageRegistry (I know I should not be using this anymore but I will replace it soon) adds the names for each block and item, then shapeless recipes are set up, then the shaped recipes, then the furnace recipes. 3. Init(), The events for buckets gets registered. 4. postInit(). outputs an "mod activated! message" showing the name and version, then a last check for update is done and logs one last time whether the mod is up to date or not. Possible reasons for this NPE I think is either cause (going from most likely to least likely): - All blocks and items should be declared in their proper class. - I miscoded the Comparator when troubleshooting an error I got when following the text tutorial. - The arrays are not setup properly as instead of using Array.asList(items...) I used Array.asList(new Item[]{items...}) as an alternative cause Array.asList(items...) gave a variable-type error. Now here are the source files. Yes I am aware that I did squish in far too much code which is why I will now state that this mod is nowhere near even an 8th done. And yes I have been able to troubleshoot and fix every problem I have had (even with the fluid NPE) except for this one. mod_NCElectromagnetism.java: NCTab.java: Any help is appreciated and thanks!

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.