Extract trades from villagers

Started by Pandeo_F1 on

Topic category: Help with modding (Java Edition)

Last seen on 13:59, 18. Mar 2022
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Extract trades from villagers

Hey !
I want to extract trades from pnj. But i have found nothing in "Procedure" part on Mcreator. For the moment i can just detect if the clicked entity is a Villager. But i want to made a program who can return the list of all item (Needed item and given item) on the chat or in a variable when you open a villager interface. 

If you can help me to found a way to get the list of trade item with the entity id of the villager or something like that thanks you ^^.

MC Version : 1.17.1
Client side.
Link for image : https://ibb.co/Wx3W9qf

Last seen on 11:39, 19. Nov 2023
Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hi! The way you checked if…
Mon, 03/14/2022 - 20:35

Hi!

The way you checked if the entity that was right-clicked is a villager isn't right, it could still work, but that solution contains too many blocks in my opinion.

Look at the image below to see what it should look like.

That's all the information I could give to you, for now, you need to be a little clearer if you need me to explain what else you want to do with your procedure, that's it for now though :)

Last seen on 11:39, 19. Nov 2023
Joined Jun 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Also just a reminder! If you…
Mon, 03/14/2022 - 20:38

Also just a reminder!

If you are trying to open a GUI if the player right-clicks on a villager, you probably shouldn't do that since the base game itself, Minecraft, already has a built-in GUI for a villager, at least for the workers.

Last seen on 13:59, 18. Mar 2022
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yeah thanks for your blocks…
Mon, 03/14/2022 - 20:45

Yeah thanks for your blocks i have change by your. I need that when we open the interface of a villager that I can save the trades he offers to be able to save them in a file (the saving part in a file I know how to do it) but I don't know how to retrieve all the trades of the villager in String format

Last seen on 13:59, 18. Mar 2022
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
If its not possible with the…
Mon, 03/14/2022 - 20:47

If its not possible with the block to recover the trades list you can help me in java directly

Last seen on 13:59, 18. Mar 2022
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I have try to get the nbt…
Tue, 03/15/2022 - 17:13

I have try to get the nbt data of the villager but there is nothing inside :/

Last seen on 13:59, 18. Mar 2022
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Why inside CompoundTag tag =…
Tue, 03/15/2022 - 17:33

Why inside CompoundTag tag = entity.getPersistentData();
There is nothing inside : tag.getAsString()
Same for : tag.getDouble("Orders")