Jump to content

Recommended Posts

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.)

Posted

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.

Announcements



×
×
  • Create New...

Important Information

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