Custom Villager Trades [With procedures]

Started by K3vax on Fri, 09/20/2019 - 22:49

Topic category: Bugs and solutions

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

User statistics:

  • Modifications:
  • Mods of the week:
  • Forum topics:
  • Comments:
  • Wiki pages:
  • Tracker tickets:
  • Invalid tickets:
Custom Villager Trades [With procedures]
Fri, 09/20/2019 - 22:49

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

0Upvote this forum topic
Last seen on 08:56, 26. Dec 2019
Joined Jan 2017
User points:

User statistics:

  • Modifications:
  • Mods of the week:
  • Forum topics:
  • Comments:
  • Wiki pages:
  • Tracker tickets:
  • Invalid tickets:
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.

0Upvote this forum topic
Last seen on 04:39, 30. Sep 2019
Joined Aug 2019
User points:

User statistics:

  • Modifications:
  • Mods of the week:
  • Forum topics:
  • Comments:
  • Wiki pages:
  • Tracker tickets:
  • Invalid tickets:
Can you show an example? I…
Sat, 09/21/2019 - 07:46

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

0Upvote this forum topic
Last seen on 21:42, 5. Dec 2019
Joined Aug 2019
User points:

User statistics:

  • Modifications:
  • Mods of the week:
  • Forum topics:
  • Comments:
  • Wiki pages:
  • Tracker tickets:
  • Invalid tickets:
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
0Upvote this forum topic
Last seen on 21:42, 5. Dec 2019
Joined Aug 2019
User points:

User statistics:

  • Modifications:
  • Mods of the week:
  • Forum topics:
  • Comments:
  • Wiki pages:
  • Tracker tickets:
  • Invalid tickets:
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.

0Upvote this forum topic
Last seen on 04:39, 30. Sep 2019
Joined Aug 2019
User points:

User statistics:

  • Modifications:
  • Mods of the week:
  • Forum topics:
  • Comments:
  • Wiki pages:
  • Tracker tickets:
  • Invalid tickets:
Where did you get your AND…
Fri, 09/27/2019 - 22:22

Where did you get your AND piece?

0Upvote this forum topic
Last seen on 01:00, 26. Feb 2020
Joined Aug 2016
User points:

User statistics:

  • Modifications:
  • Mods of the week:
  • Forum topics:
  • Comments:
  • Wiki pages:
  • Tracker tickets:
  • Invalid tickets:
Logic Operations -> First…
Wed, 10/09/2019 - 23:28

Logic Operations -> First procedure Block -> Click on "=" -. Choose "AND"

0Upvote this forum topic