Jump to content

[Workaround Found] [1.7.10] Making a Vanilla Item Usable (Like Food)


Choonster

Recommended Posts

Someone posted here asking for help making Sugar edible, so I thought I'd try to help them; but unfortunately it looks like vanilla breaks things by replacing the player's held item with a copy, which stops the item from being used (you can see a full explanation of the effect here). My code is here.

 

Is there any way around this without resorting to ASM or intercepting packets?

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Someone posted here asking for help making Sugar edible, so I thought I'd try to help them; but unfortunately it looks like vanilla breaks things by replacing the player's held item with a copy, which stops the item from being used (you can see a full explanation of the effect here). My code is here.

 

Is there any way around this without resorting to ASM or intercepting packets?

 

Did you try replacing the held item yourself? Like every player tick check if the held item is sugar and then replace with your own edible sugar item?

 

And the other way is to fully replace the vanilla by removing it from creative tabs, changing recipes to create your version, and ensure that it doesn't generate in chests or get dropped.

 

And yet another way would be to create your own system for eating those items. Like just count if it being used and decrement your own counter field (or NBT on the item stack).

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

Thanks for the advice, jabelar. I decided to add a custom Edible Sugar item and replace all recipes involving Sugar with recipes that output Edible Sugar and/or take either kind of Sugar as input. I also added recipes to convert between regular and Edible Sugar.

 

You can see my implementation of this here. This is the class I used to replace the recipes.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Thanks for the advice, jabelar. I decided to add a custom Edible Sugar item and replace all recipes involving Sugar with recipes that output Edible Sugar and/or take either kind of Sugar as input. I also added recipes to convert between regular and Edible Sugar.

 

You can see my implementation of this here. This is the class I used to replace the recipes.

 

Cool, glad it worked.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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.

Announcements



×
×
  • Create New...

Important Information

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