Jump to content

Recommended Posts

Posted

I have been looking for an answer for a little while

How do I check when an item is thrown into a fire then change what the item is?
Example, change potato to cooked potato

Posted

It should be noted that items do burn in fire (You would have to override that). I am slightly confused on what your plan is. Do you want the cooked item to be thrown out from the fire and onto the player once it is finished? You could always make a block similar to the normal Fireplace in Minecraft (which also cooks food). Maybe take a look at that class.

Posted
7 hours ago, PulseBeat_02 said:

It should be noted that items do burn in fire (You would have to override that). I am slightly confused on what your plan is. Do you want the cooked item to be thrown out from the fire and onto the player once it is finished? You could always make a block similar to the normal Fireplace in Minecraft (which also cooks food). Maybe take a look at that class.

I will make it so it doesn't burn, i just want to know how to check if an item is in the fire and its, for example, a potato and change it to another item, cooked potato

Posted

Let them burn in fire...you can use the EntityLeaveWorldEvent, which will be fired also when an ItemEntity collide with a fire block (which causes the entity to disappear)...inside the event handler first check if the Entity is an instaceof ItemEntity. If thats the case check if the ItemEntity represent the item you want to cook (for example your potato). Then check if the position of the ItemEntity coincide with the position of a fire block ----> spawn a new ItemEntity in the world (in your case cooked potato) ...possibly 1 or 2 block away from the fire block or you won't see your item for long time! If instead you want that behaviour for a custom item you made just override onEntityItemUpdate inside your item class. That's just an idea, as there are other ways to do what you want to accomplish

Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port

Posted
19 minutes ago, diesieben07 said:

EntityLeaveWorldEvent is not very reliable... I would suggest using EntityJoinWorldEvent and replacing the item entities for which you want special behavior. Then just program the behavior you want in that custom entity.

Just for curiosity sake, why is EntityLeaveWorldEvent less reliable?

Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port

Posted
3 hours ago, Beethoven92 said:

That makes sense..but i suppose since the player has to be near the fire to throw the item in, is there really a possibility for the entity to be removed in any other way than by fire collision?

Yes, but other items elsewhere in the world might also leave for other reasons at any time.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
2 hours ago, Draco18s said:

Yes, but other items elsewhere in the world might also leave for other reasons at any time.

You are absolutely right, but still inside the event i would check if the last position of the ItemEntity of the type i want (eg. potato) was inside a fire block...so i don't really see how this could eventually fail..the condition for the cooked item to spawn is pretty strict, unless i am missing something very obvious..

Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port

Posted
5 minutes ago, Beethoven92 said:

You are absolutely right, but still inside the event i would check if the last position of the ItemEntity of the type i want (eg. potato) was inside a fire block...so i don't really see how this could eventually fail..the condition for the cooked item to spawn is pretty strict, unless i am missing something very obvious..

Because checking what block is at a position for a chunk that is being unloaded causes the chunk to be loaded again.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.