Jump to content

[1.12.2] Water Crafting with dropped items like AE2


CrashDbo

Recommended Posts

I am working on a mod that is based off finding crystals and analyzing them to get different attributes. Some will grant an effect on use some will be used in a form of crafting like the AE2 water crafting. I am having trouble finding the code in AE2 that allows the player to toss items in water and have it spawn a new item stack.

 

My main questions I have now are:

What should I be looking for to detect my crystal is in water?

Secondary is when you drop and item on the ground does is then spawn as an entity item?

 

I'm sure I will have many more questions as this develops, but for now thanks to those reading.

Edited by CrashDbo
Link to comment
Share on other sites

52 minutes ago, CrashDbo said:

What should I be looking for to detect my crystal is in water?

You can subscribe to ItemTossEvent and keep track of relevant items, then check to see if your conditions are met within one of the TickEvents. Keep in mind that there's no guarantee that the items remain in the world once thrown, so your list of items should update to remove those that should no longer exist.

55 minutes ago, CrashDbo said:

Secondary is when you drop and item on the ground does is then spawn as an entity item?

Yes. Within the inventory, items are ItemStack objects, while on the ground they're EntityItem objects. You can get the ItemStack represented by an EntityItem through EntityItem#getItem().

  • Thanks 1

Fancy 3D Graphing Calculator mod, with many different coordinate systems.

Lightweight 3D/2D position/vector transformations library, also with support for different coordinate systems.

Link to comment
Share on other sites

3 hours ago, SerpentDagger said:

You can subscribe to ItemTossEvent and keep track of relevant items, then check to see if your conditions are met within one of the TickEvents

I would recommend creating a custom ItemEntity for your custom item, and return an instance of your ItemEntity in Item#createEntity (as well as override Item#hasCustomEntity to return true).

With this approach you can simply check for water in your EntityItem’s update method.

  • Thanks 1

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

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.