Making a tamed mob sit

Started by UtahPlaysYT on Sun, 11/22/2020 - 12:48

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:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Making a tamed mob sit
Sun, 11/22/2020 - 12:48

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 02:22, 9. Sep 2021
Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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:
  • Tracker tickets:
  • 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:
  • Tracker tickets:
  • 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 18:40, 27. Feb 2021
Joined Feb 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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:
  • Tracker tickets:
  • 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:
  • Tracker tickets:
  • 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 16:46, 13. Sep 2021
Joined Jan 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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:
  • Tracker tickets:
  • 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:
  • Tracker tickets:
  • 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:
  • Tracker tickets:
  • 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:
  • Tracker tickets:
  • 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 15:47, 8. Jun 2021
Joined Apr 2021
Points:

User statistics:

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

Sitting pets will still teleport to me though