Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.15.2] Changing the properties of vanilla items.


QcDiablo
 Share

Recommended Posts

New to modding, I'm trying to make a mod to play with friends to add more content in the game. Notably, I'd want to change food items' saturation value and make them unstackable.


To do what I want, I need to be able to change the item properties of existing items, however I haven't figured out how to get an item from the game's registries or using ResourceLocation in order to change its properties.

Link to comment
Share on other sites

Thanks a lot, at least now I'm able to get an item. I knew it would be just as easy but still couldn't get my head around it. However now I'm hard stuck at changing the properties of said item.
If anyone knows a way to either change individual items' properties or an entire classe's (Food especially) that would help tremendously.

Edited by QcDiablo
Link to comment
Share on other sites

17 hours ago, QcDiablo said:

I'd want to change food items' saturation value

These values are stored in the Food class, instances of which are stored in the Foods class. You can use reflection to change the stauration values inside them.

 

17 hours ago, QcDiablo said:

make them unstackable

Set Item#maxStackSize using reflection.

Link to comment
Share on other sites

  • 2 weeks later...
On 4/9/2020 at 9:17 AM, diesieben07 said:

These values are stored in the Food class, instances of which are stored in the Foods class. You can use reflection to change the stauration values inside them.

 

Set Item#maxStackSize using reflection.

I’m trying to do something similar, but I’m even more new to all of this... what do you mean by reflection? Could you give an example please?

Link to comment
Share on other sites

16 minutes ago, Ekksvar said:

what do you mean by reflection?

Reflection is a Java feature we do not teach Java here, Google it.

Edited by Animefan8888

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

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.

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

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.