Jump to content

[1.9]How can I get the subtypes of an Item instance server-side?


UntouchedWagons

Recommended Posts

I'm making a mod that gets all the available items and their recipes and send them to the client to be stored in text files as JSON. This mod will be part of my replacement to my http://mcresourcecalculator.info/ website which I made ~2 years ago. Now I know I could collect the items and recipes client side but I considered that to be potentially problematic because a client can have more mods installed than the server it is connected to and I'm not sure how I'd deal with that. The whole process is kicked off by a chat command rather than at startup in the postInit event (or similar) because of mods like MineTweaker.

I like trains.

Link to comment
Share on other sites

On previous servers I've played on, we've tweaked the pack by simply disabling mods server side and leaving them installed client side. If an admin were to use my mod in such a setup, the mods that have been removed server-side would have their items and recipes show up in the data files which I wouldn't want. Filtering the items I would be easy if I could get the server-side list of installed mods, but filtering recipes I suspect would be difficult.

I like trains.

Link to comment
Share on other sites

I'm making a mod that gets all the available items and their recipes...

Then you don't want getSubItems anyway. That would give you several types of fish, none of which has a recipe (unless you include smelting/cooking).

 

If I understand your goal of resource management, then you really do want recipes... on the server. Start with the server's authoritative recipe list and let it lead you to the items both input and output. You might desire some sorting at the end, but that's what maps are for.

 

If that's not right, then I must not grok your purpose.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

That would give you several types of fish, none of which has a recipe (unless you include smelting/cooking).

 

Not so. Botania lets you transmute one type of fish into another, and some fish are used as ingredients in recipes. For example to make Thaumcraft's Boots of the Traveller you need some sort of fish. So my mod would need to know about all the different sorts of fish for those recipes to be valid. Although I'd probably cull the transmutation recipes because those would cause infinite recursion issues.

 

If I understand your goal of resource management, then you really do want recipes... on the server. Start with the server's authoritative recipe list and let it lead you to the items both input and output. You might desire some sorting at the end, but that's what maps are for.

 

If that's not right, then I must not grok your purpose.

 

Yes this is correct and why I wanted to get all the stuff server side since it's authoritative. The main problem is that the recipe list could get quite large and would need to be split up across multiple packets since packets have a limit of 1 megabyte. I'd need a way to break the big recipe list into 1048572B blocks and somehow make the receiver smart enough to rebuild the list client side.

I like trains.

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

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



×
×
  • Create New...

Important Information

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