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

I'm trying to move my mod SpawnerCraft over to the new EntityRegistry system: i.e. looking at Strings and checking those against Forge's database instead of using the ID system used by Spawn Eggs as of old. This means that I've moved from using metadata to specify the mob in an item to an NBT tag.

 

I need help creating a NBT sensitive recipe. I have my current recipe registration here but apparently the NBT tag on the ingredient is not considered in this way. It always gives out for creepers (the first on the EntityEgg list).

 

How can I register a recipe that requires the same NBT data and spits out an item with the same NBT data?

 

(To be clear, in abstract I want: four of my items in a square with identical NBT structure. It spits out one of next tier with the same NBT structure.)

  • Author

That's the answer I hoped not to hear, but it wasn't as hard to implement as I feared. Commit of solution here.

 

I can't shake the feeling that I could have done NBTSensitiveShapedRecipe better though. All but 6 lines (effectively less) of the actual work methods are direct rips from the superclass ShapedRecipes, and copy/pasting code is a bad practice -- I mean OOP is about reusing code. The thing is the only way I saw to override checkMatch() (which is what I needed to add those 6 lines to) was to point matches() at a new version, as it is a private member of the superclass and as such cannot be overwritten directly.

 

This is probably the easiest way to do it, but I still feel it could be done better with less repeated code. Even if what I wanted to do originally (@Override checkMatch()) wouldn't even have saved most of the copied lines. It's just those 6 lines of check need to be in that part of the process.

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.