Topic category: User side tutorials
Hello! Here I am with one more Tutorial!
Today I will teach you how to make a villager who has an inventory (GUI) with functional changes!
Workspace: https://www.mediafire.com/file/jqz3tqcnha4j4jl/Villager_Trade_Tutorial_…
How did I do it?
1 - I used: gold and emerald 32x32 texture and a model of "Traveler Villager (made by me)"
2 - Create your Villager (Type: Creature / AI base: NONE)
3 - Create a procedure to check the item and change in the player's inventory:
If = Has provided entity (item for exchange) in inventory
do = Add "Value" (item result of exchange) to provided players
inventory
Remove "Value" (item for exchange) to provided players inventory
4 - Create a GUI using item textures (32x32) and a button to activate the exchange
5 - Finally, create a Procedure to open the GUI:
Open GUI to provided player. GUI: (select the Villager GUI that
you created)
We have reached the end of this tutorial, I hope I have helped!
Any questions, leave a comment!
Thanks IGOR_LIVE96
Nice tutorial workspace and idea :)
Klemen, because when I get out of the GUI and walk back, does the villager give it back?
No, because the inventory is not bound to the villager. As far as I know.
You could analyze what is wrong, the workspace is there for download, the exchange works, but when I open the GUI again, it picks up the golds and returns the emeralds!
As I said the issue is that you can't bind GUI to entity yet and therefore there are issues with slot management procedures. We plan to add support for inventory to items first, but later to entities too.
Oh then my procedure is correct but the error happens because of this! Okay, I'm glad I'm right!
Thank you for your help!
Thank you! This was very useful.
how to import the file?
Hello ! I can't open your workspace because it is a ".mcr" file and MCreator only wants to open ".mcreator" files :( Can you update the link please ?
https://mcreator.net/wiki/mcr-legacy-converter
You might want to check this up-to-date tutorial: https://www.youtube.com/watch?v=0_eqw9VAl3I&list=PLAeL-oIFIEni-O5D8ooqR-tBQgEn-Qi8L&index=6
Thanks a lot ;)