Jump to content

[1.8.9] Check current villager trade and move correct item


Aulig

Recommended Posts

Hello,

 

is it possible to find out what trade a player is looking at after he clicked the villager?

I only need to know what type of item the villager wants, the amount doesnt matter.

Then id like to move the required item to the villagers "Input" slot.

 

What i dont know is how i find out the trade and how i move the item.

 

Thanks in advance.

 

Link to comment
Share on other sites

Hm... Im getting a Nullpointer Exception with this code:

if(mc.thePlayer.openContainer instanceof ContainerMerchant){

ItemStack requested =((ContainerMerchant) mc.thePlayer.openContainer).getMerchantInventory().getCurrentRecipe().getItemToBuy();

 

The error occurs once i click the villager. Do you know why this is happening?

Link to comment
Share on other sites

So actually (from what ive found out from some testing now) getCurrentRecipe is only then not null when the player puts in enough of the requested item into the villagers input slot so that the trade would be possible. This is kind of problematic as i want to put in the items automatically (before anything is in there). Do you know an alternative?

Link to comment
Share on other sites

Well i doubt anyone will read this thread to the end. also i had a new idea i wanted to include, but youre the moderator - you decide. Feel free to delete it if you dont think its ok, im sorry in that case.

Link to comment
Share on other sites

Well i doubt anyone will read this thread to the end. also i had a new idea i wanted to include, but youre the moderator - you decide. Feel free to delete it if you dont think its ok, im sorry in that case.

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.