Custom Villager Trades [With procedures]

Started by K3vax on

Topic category: Troubleshooting, bugs, and solutions

Last seen on 04:39, 30. Sep 2019
Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Custom Villager Trades [With procedures]

Hey, everyone!

 

So I am aware that we can't simply add custom trades with villagers or with created villagers. But I am making a mod with a special villager that opens up a GUI for trades.

 

Now in the GUI, the player can choose from a selection of buttons to make a trade. I've added a procedure where the GUI would then close, the 'currency' item is removed from the player's inventory and the 'product' item is then added in.

 

Now when I try this in-game, the button doesn't do anything.

Does anyone know how to make this work?

The custom procedure

Last seen on 15:27, 10. Oct 2022
Joined Jan 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
If you're using it for GUI…
Fri, 09/20/2019 - 22:56

If you're using it for GUI with slots, bind it with a block that has inventory, even if its a non unobtainable block, as long as its binded to a block you'll be fine, then you can make the entity open the gui, and it will work.

Last seen on 04:39, 30. Sep 2019
Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Can you show an example? I…
Sat, 09/21/2019 - 07:46

Can you show an example? I have no clue what you mean

Last seen on 20:25, 8. May 2020
Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
K3vax, DaleksOfSkar is right…
Sat, 09/21/2019 - 21:57

K3vax, DaleksOfSkar is right. Currently the way to do trading is through blocks that have inventory.

However, I found a way through which you can trade with a mob without the use of any blocks.

From: https://mcreator.net/forum/53182/very-strange-things-happen-when-working-gui-procedures?page=1

GUI:

Input slot (0) > Picture of diamond > Picture of  trade_arrow > Picture of sand > button

PROCEDURE:

Set NumOfItems to Get numbers of items from slot 0 of inventory [TraderInventory]

if Get item from slot 0 of inventory [TraderInventory] = [diamond] AND Get NumOfItems >= 1

do repeat NumOfItems times:

      spawn gem [sand] at x y z

do Clear slot 0 of inventory [TraderInventory]

do Close any UI open for the current entity
Last seen on 20:25, 8. May 2020
Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
https://ibb.co/0XSL84Y This…
Sat, 09/21/2019 - 22:04

https://ibb.co/0XSL84Y

This procedure is called when the trade button is pressed.

Last seen on 04:39, 30. Sep 2019
Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Where did you get your AND…
Fri, 09/27/2019 - 22:22

Where did you get your AND piece?

Last seen on 02:11, 28. Mar 2024
Joined Aug 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You could Use Run command…
Wed, 02/02/2022 - 00:48

You could Use Run command procedure and Make a Custom Villager spawn with an item or Ritual i plan on add it to my mod Gr33n's Magica in one of the next updates using this > /summon villager ~ ~1 ~ {VillagerData:{profession:toolsmith,level:5,type:plains},Invulnerable:1,PersistenceRequired:1,NoAI:1,Offers:{Recipes:[{buy:{id:diamond_block,Count:1},buyB:{id:diamond_block,Count:1},sell:{id:emerald_block,Count:1},maxUses:9999999}} 9may be messed up lol use a Villger generator and Replace where it says diamond_block and emerald_block with "Modname:Item_name" the Quotation marks are required for it to work

 

Last seen on 08:00, 17. Jul 2022
Joined Jun 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to make buttons with…
Sun, 06/05/2022 - 13:08

How to make buttons with icons? I moved them (icons and buttons) in component list, but buttons are always cover icons