Making a tamed mob sit

Started by UtahPlaysYT on

Topic category: Help with modding (Java Edition)

Last seen on 11:23, 9. Jan 2021
Joined Jul 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Making a tamed mob sit

I am trying to make a tamed mob sit. I have created 2 different entity's one that can't move and one that will follow once tamed! However when i make it so it follows me again i need to re-tame it as its going to a different entity's is their anyway i can make it force tame to the closes player so i can tell it to sit and follow?

Thanks!

Last seen on 22:41, 29. Dec 2021
Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
There is no need to make two…
Mon, 11/23/2020 - 14:59

There is no need to make two different mobs, taming is built into MCreator. I believe it's in the AI part of the mob creator. There will be no sitting model though, it will have the same model :/

However, if you ignore everything I just said I think there is a "Tame [entity] to [entity]" procedure block

Last seen on 11:23, 9. Jan 2021
Joined Jul 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
would it be like right…
Mon, 11/23/2020 - 17:23

would it be like right clicked to sit as there is:

Breed

Hurt entitys that hurt player

Hurt entitys that player attacked

Follow playr with a speed factor of.. minimal distance ... Maximal distance if tamed

Follow parents if animal

there is no right click to sit or anything :/

Sorry im still getting used to Mcreator xD

 

Last seen on 11:23, 9. Jan 2021
Joined Jul 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hi i have had a look and it…
Mon, 11/23/2020 - 21:04

Hi i have had a look and it doesn't say anywhere a sit command? if you could send a screen shot of what i should be using i would appericate that :)

Thanks!

Last seen on 16:26, 22. Feb 2022
Joined Feb 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
There is no sit.
Mon, 11/23/2020 - 21:48

There is no sit.

Last seen on 23:41, 3. Jun 2021
Joined Dec 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I think the main problem is…
Sat, 12/05/2020 - 21:17

I think the main problem is that the wolf entity is specifically made to handle sit commands, same with cats. So if you have a custom entity it doesn't work.

Last seen on 21:31, 5. Feb 2021
Joined Dec 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'm a bit late, but…
Fri, 01/08/2021 - 20:57

I'm a bit late, but something you can try is setting a logic NBT tag on the mob called "sitting" and then set it to false or true when you click it, then set the condition to start/continue wandering around to "return: not sitting" so they will only wander around when not sitting. For a different model maybe you can make an animation where the mob is only sitting and play it with geckolib when sitting is true.

Last seen on 23:35, 30. Oct 2023
Joined Jan 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I have a simple solution…
Sat, 01/23/2021 - 16:54

I have a simple solution using procedures:
create a true or false variable for this for the example it will be sitting

Now if the function:

When you right-click the entity:

If sitting = false do:
Give current entity slowness 7 (totally immobile even with speed) for (VERY long as 999999999999999999 or more), set sitting to false
If not: remove slowness on entity, set sitting to true

Of course, the texture and appearance will be the same, but you can try to use geckolib (it did not work for me) or add custom particles for when you are sitting.

Last seen on 16:16, 7. May 2021
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
how to put an animation when…
Wed, 03/10/2021 - 14:05

how to put an animation when it sits? (when mcreator's built-in taming is activated)

Last seen on 19:53, 2. Jun 2021
Joined Sep 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to make your Tameable…
Sun, 04/18/2021 - 01:01

How to make your Tameable mob to Sit:

-First off dont use the MCreator Tame option, dont select it. Open the code to Edit:

add these libraries:

import net.minecraft.util.Hand;

import net.minecraft.entity.LivingEntity;

import net.minecraft.entity.ai.goal.SitGoal;

import net.minecraft.entity.passive.TameableEntity;

 

2) on this line:

public static class CustomEntity extends TameableEntity <---- change AnimalEntity or wtv to TameableEntity

 

3) add these 2 behaviors: (more if you want it to follow owner and stuff, but u can set these others on Mcreator entity creation)

this.sitGoal = new SitGoal(this);
 this.goalSelector.addGoal(1, this.sitGoal);

4) add this code part BELOW your behaviors:

// TAME CODE
        public void setTamed(boolean tamed) {
            super.setTamed(tamed);
            // whatever you want your mob to do when it's tamed e.g. the wolf's class uses
            // this to increase the mob's max health to 20 if it's tamed
        }

        public boolean processInteract(PlayerEntity player, Hand handIn) {
            ItemStack itemstack = player.getHeldItem(handIn);
            if (!this.isTamed() && itemstack.getItem() == Items.MELON_SLICE && !this.isBreedingItem(itemstack)) {  // <--- Tame Item (can be different from breeding one)
                if (!player.abilities.isCreativeMode) {
                    itemstack.shrink(1);
                }
                if (!this.world.isRemote) {
                    if (this.rand.nextInt(3) == 0 && !net.minecraftforge.event.ForgeEventFactory.onAnimalTame(this, player)) {
                        this.setTamedBy(player);
                        this.navigator.clearPath();
                        this.setAttackTarget((LivingEntity) null);
                        this.sitGoal.setSitting(true);
                        this.setHealth(30.0F);
                        this.playTameEffect(true);
                        this.world.setEntityState(this, (byte) 7);
                    } else {
                        this.playTameEffect(false);
                        this.world.setEntityState(this, (byte) 6);
                    }
                }
                return true;
            } else if (this.isOwner(player) && !this.world.isRemote && !this.isBreedingItem(itemstack)) {
                this.sitGoal.setSitting(!this.isSitting());
                this.isJumping = false;
                this.navigator.clearPath();
                this.setAttackTarget((LivingEntity) null);
                return true;
            }
            return super.processInteract(player, handIn);
        }

        // TAME CODE END

 

5) add this part, just above the Rotation animations, at the very end of the file:

 

public void setLivingAnimations(Entity entityIn, float limbSwing, float limbSwingAmount, float partialTickTime) {
            if (((ChimpanzeEntity.CustomEntity) entityIn).isSitting()) {   //<--------- your entity NAME here, put it right or it will crash

             //here you set your rotations when its sitting, like

             this.BodyBack.setRotationPoint(0F, 13.5F, 4F);
                this.BodyBack.rotateAngleX = -1.047198F;           }

} else {        // <----------- here set the animations when its not sitting, moving;

this.DownLeg2.setRotationPoint(2F, 15F, 7F);
                this.Foot2.setRotationPoint(2F, 15F, 7F);
                this.UpperLeg1.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount - 0.0872665F;
                this.DownLeg1.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount - 0.0872665F;

//etc...

         }

}

 

6) finally remove the animations you put here, from the last part of the file (you dont need them in 2 places)

 

 

 

 

 

 

 

Last seen on 19:53, 2. Jun 2021
Joined Sep 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
remember, even thou you dont…
Sun, 04/18/2021 - 01:03

remember, even thou you dont need 2 entities, you still need to make another model (the sitting one), then just export the java, open on notepad++ and copy the RotationPoints and RotationAngles that DIFFER when the mob is Sitting or Moving.

Last seen on 19:53, 2. Jun 2021
Joined Sep 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
btw this do not work for 1…
Sun, 05/02/2021 - 03:43

btw this do not work for 1.16 anymore.. they change the code so much i will prb take ages to update my mod :(

Last seen on 01:25, 14. Feb 2023
Joined Apr 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Sitting pets will still…
Sat, 05/15/2021 - 05:49

Sitting pets will still teleport to me though

Last seen on 16:18, 5. Sep 2023
Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Step 1 Create an entity…
Sat, 12/11/2021 - 01:34

Step 1

Create an entity tameable

Step 2

Create a procedure

- return { NBT logic "follow"

Step 3

At AI and goals set "follow Owner" an press condition, there, use the procedure of step 2

Step 4

At Triggers, "When right click on the entity" create a procedure

- if{ nbt logic "follow" = true

         Do( set nbt logic "follow" false

- else{ set nbt logic "follow" true

 

With that, the entity is going to follow or not, but it hasn't animation or changed model

Last seen on 17:15, 10. Dec 2022
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I know I'm late. But i don't…
Sat, 05/28/2022 - 14:58

I know I'm late. But i don't understand how to do it (I'm new in mcreator), can someone send screenshot of the procedure i should do to sit my pet?

 

PD: Sorry for my english, It isn't my native language.