Jump to content

[1.7.10] Changing a dropped item when it comes in contact with a fluid?


Toastrackenigma

Recommended Posts

Hey,

I have my fluid registered and working (it works in a bucket and also shows up in the world), but I want to know how to make it change items that are dropped in it (like PneumaticCraft's etching acid, or the fluix seeds in AE2). I have looked all over the internet and can't find a reference as to how to do something like this anywhere. I would imagine that the fluid could have some sort of function which fires when an item is dropped into it and gives me back the ItemStack to play with, but that sounds too easy :P

 

I'm thinking along the lines of the

public ItemStack onItemRightClick(ItemStack is, World world, EntityPlayer ep) 

function for items, but I could be completely wrong. Any suggestions?

 

Thanks,

-Toastrackenigma

Link to comment
Share on other sites

Since liquid don't have collision bounding box, 'ontemRightClick' would not work.

Instead, you have to do it on PlayerInteractEvent, and check for collision into the fluid block. (Also, it would be CLICK_AIR mode)

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

@Abastro I wasn't wanting a right-click to happen anyway, I was just using that method as an example of something similar to what I want to do. To put it in clearer terms, I want the liquid to alter items dropped into it using the Q key - for example, if I drop in four gold the ItemStack changes into one diamond. I was wondering if there was a method similar to onItemRightClick but for detecting if an item was dropped into a liquid (onItemDropped maybe)

Link to comment
Share on other sites

Since liquid don't have collision bounding box, 'ontemRightClick' would not work.

Instead, you have to do it on PlayerInteractEvent, and check for collision into the fluid block. (Also, it would be CLICK_AIR mode)

 

Actually it does.  Just not most of the time.  How do you think the boat item works?

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.

Link to comment
Share on other sites

There seems to be no event for that. You should use EntityItem#onUpdate().

EDIT: You should spawn custom EntityItem when the item is dropped.

@Draco18s: Oh. I didn't know that;

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

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.

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.

×
×
  • Create New...

Important Information

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