Started by
el_m4gician
on
Topic category: Help with MCreator software
Hello everyone, I wonder if someone can resolve this problem. I have a custom entity that can be tamed. But I want that the entity allows you to get in his inventory only if that entity is tamed. I have already a little GUI made for this, I just want to make a horse-inventory-like for the entity. Any suggestions?
My version is V2022.1.
here I found this and it might help if you haven't figured it out yet https://www.youtube.com/watch?v=zsNqAfZAUnI&t=262s
You have to edit the entity code, but it is just one extra if statement. In your entityname.java class find the Interaction Result
@Override public InteractionResult mobInteract(Player sourceentity, InteractionHand hand) {directly after this line add to tell if the entity is tamed by the source entity
if (entity instanceof TamableAnimal _tamIsTamedBy && sourceentity instanceof LivingEntity _livEnt ? _tamIsTamedBy.isOwnedBy(_livEnt) : false) {Then add a bracket at the end of the class to close the if statement and your good to go! Allows a binding gui on an entity where it only opens if the entity is tamed by the player. In a similar manner, you can prevent a binded gui from opening for just about any if statement you can think of.