Started by
TheTntExpert29
on
Topic category: Help with MCreator software
Hello, I am making a mod where I want to add a villager trade that uses my custom items, How do I make a custom Villager trade with the custom Items with the normal Minecraft Villagers? For the GUI and Mob.
I think you need to edit some kind of vanilla loot table for the villagers, not entirely sure how to do that though :/
This will be simple, I’ve made it myself before,
run a procedure for when right click on entity: open GUI:(the GUI).
And Then the button within the GUI sets of this procedure: If item in slot 0 is “example” Do: set item in slot 1 “example”.
OR, for two items
item in slot 0 is “example” AND item in slot 1 is “example“ Do: set item in slot 2 “example”.
(keep in mind that the slots have to be going from 0 to 1/2 from left to right)
Can u make a tutorial video or explain it better? Please
you can also use Mojang's vanilla villager AI
@Trolmaso
And how do I open a procedure for already existing entity?
@Bananas I'm not entirely sure what you mean, but if you are wondering how to access vanilla villager trading, I believe Trolmaso is saying to make and use an entirely new gui that will be replacing the vanilla villager gui. Remaking the vanilla trading recipes in your new gui if you want to keep them.
@Trolmaso please correct me if I'm wrong.
OK, but sorry, I don't get how to make the new GUI replacing the old. I don't know how to work with vanilla mobs and ad the gui to them. Can you please help me again?
No problem! Just do this:
1. Create a new procedure.
2. Set up the procedure to look like this:
Event trigger ... (global trigger): <Player right clicks on entity>
[IF] is <Event/target entity> (sub)type of <EntityVillager>
[DO] open screen for <source entity> pass location <x> <y> <z> GUI: <WhateverYourGuiNameWillBe>
3. Make a new GUI, setting it up however you want it, and put its name in the place of <WhateverYourGuiNameWillBe> in the new procedure
That's it. Whenever you right click on any entity, that procedure will happen and check if the entity you clicked on was a villager. If it was, then it will open the GUI you made. I assume this will make the vanilla villager GUI un-openable, if I understood Trolmaso correctly, as your GUI will open instead.
Thank you very much! And will this procedure work for all villagers (because that could be problem) or I can set the profession?
You're welcome! I could only find the entity type "EntityVillager" (though I might have missed the subtypes), so you would probably have to either find out if there is an NBT tag you can call on, or make your own professions unfortunately.
I would definitely recommend looking into how Minecraft sets their villager professions to see if you can "get" their current profession. I will look into it as well and comment if I find anything.
what is source entity in procedure ?
In thishthis specific procedure, the entity that is clicked on is the "target entity", while the player is the "source entity" because it is the source of the trigger.
Usually, the entity that the procedure is called in is the "event/target entity", but if there is more than one entity being used in the procedure you have to be sure to stop and think which is which.
Mixing these up is one of the most likely culprits of a procedure like this not working.
yeah but I don't knopw where to have the pin for the player in the procedure
nvm it's in minecraft components