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

So I'm designing a mod for Forge 10.13.3.1403 that adds in some of the 1.8 blocks and items, because my server has to run on 1.7.10 but we want some of the new stuff.

 

I've been trying to get my mod's blocks to register as the vanilla blocks, so that they will automatically replace on a world generated in 1.8. I have that successfully working via GameRegistry.addSubstitutionAlias(), but I'm running in to a lot of other problems using that command.

 

For some reason addSubstitutionAlias() registers the block twice on the creative tab. Once in the correct, Vanilla location, and once at the end of the tab.

 

I could deal with that first issue, but the bigger issue is that when substituting blocks with metadata in you can't set recipes using that meta data. If I create the recipe using new ItemStack(ModBlocks.stone, 1, 1), ItemStack.getItem() returns null. If I use new ItemStack(Blocks.stone, 1, 1), it doesn't draw the sprite correctly on the crafting bench and crashes when I craft the item.

 

So does anyone know of a good way to replace vanilla items? Or maybe fix the way I'm using addSubstitutionAlias()? I tried registering the block with the minecraft modID, but those functions are all deprecated.

 

Here's the code I'm registering my block with:

 

//Spawn in new stones
try {
        stone = new ModStone();
GameRegistry.addSubstitutionAlias("minecraft:stone", GameRegistry.Type.BLOCK, stone);
GameRegistry.addSubstitutionAlias("minecraft:stone", GameRegistry.Type.ITEM, new ItemBlockStone(stone));
} catch (ExistingSubstitutionException e) {
 // TODO Auto-generated catch block
e.printStackTrace();
}

I've not ever seen someone with code that works for

addSubstitutionAlias

, so I don't know how it's supposed to work or be used (etc. etc.) and only seen non-working code, one way or another.

 

So that said, my first question is:

What happens if you only call

addSubstitutionAlias

once, either for the Type.Block or Type.Item? (rather than calling both)

 

Second question:

Does your

ModStone

call

setCreativeTab

?  What happens if you comment that out?

 

I imagine that something breaks, but that'd be my first experiment: figure out which line(s) are adding the extra addition to the creative menus, why, and what breaks as a result.

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.

  • Author

Yeah in my research it seems a bit sketchy.

 

If I just call for one, it breaks and throws an error when you try to load the world saying the Mod ID list has been corrupted.

 

My ModStone does call SetCreativeTab, if I comment that out it doesn't show up at all in creative.

 

I've iterated through the actual Item.itemRegistry, and my stone is actually appearing twice on the list, at the beginning and the end.

May have to live with it, then.

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.

but the recipes being broken makes it pretty hard.

 

That would be a problem.

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.

  • Author

Yeah, it throws a null reference exception when creating an itemstack of the modded item.

 

If I create the recipe using new ItemStack(ModBlocks.stone, 1, 1), ItemStack.getItem() returns null. If I use new ItemStack(Blocks.stone, 1, 1), it doesn't draw the sprite correctly on the crafting bench and crashes when I craft the item.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

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.