Jump to content

When eating food u get item


McSpank

Recommended Posts

58 minutes ago, McSpank said:

So i want to be able to make an item that when you eat it u get an item or an item is put in your armor slot is this possible

Yes it is possible.

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

Just now, McSpank said:

o two things one r u like the only one that responds on these forums

No, I just do it more often than other people probably. I have the tab open whenever I'm online typically.

2 minutes ago, McSpank said:

two how would i add that to my code

What MC version are you modding for? 1.12.2 or 1.14.4?

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

Just now, McSpank said:

1.12.2

Ok that might be the simpler one to explain. You just need to extend ItemFood and override ItemFood#onFoodEaten, call the super, and use the player parameter to add an Item to the EntityPlayer#additemStackToInventory or use EntityPlayer#setItemStackToSlot to just put it in the armor slot. Make sure to check if there is something there though. Also addItemStackToInventory returns a boolean of whether it fit in the players inventory if it returns false you'll want to spawn them into the world as EntityItems.

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

1 hour ago, Animefan8888 said:

Ok that might be the simpler one to explain. You just need to extend ItemFood and override ItemFood#onFoodEaten, call the super, and use the player parameter to add an Item to the EntityPlayer#additemStackToInventory or use EntityPlayer#setItemStackToSlot to just put it in the armor slot. Make sure to check if there is something there though. Also addItemStackToInventory returns a boolean of whether it fit in the players inventory if it returns false you'll want to spawn them into the world as EntityItems.

so like im super new so i know what some of it means but not all could u please try and explain more 

Link to comment
Share on other sites

1 minute ago, McSpank said:

so like im super new

To forge or java? Or both? Because if you are new to java I'm not gonna explain that to you. There is already plenty of info online you can use for that.

 

2 minutes ago, McSpank said:

but not all could u please try and explain more 

Why not tell me where you need more help?

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

7 minutes ago, Animefan8888 said:

To forge or java? Or both? Because if you are new to java I'm not gonna explain that to you. There is already plenty of info online you can use for that.

 

Why not tell me where you need more help?

ok ill try and find something

 

7 minutes ago, Animefan8888 said:

To forge or java? Or both? Because if you are new to java I'm not gonna explain that to you. There is already plenty of info online you can use for that.

 

Why not tell me where you need more help?

 

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.