Minecraft – How to give a mob smooth custom motion in MCJE 1.16

minecraft-commandsminecraft-java-edition

I want to make a boss battle, and I wanted the boss to walk smoothly in a certain direction. I have tried:

/summon zombie ~ ~1 ~ {CustomName:"Zombo",CustomNameVisible:1,Motion:[0.0,0.0,-12.0], Attributes:[{Name:generic.movementSpeed,Base:2}

but the zombie does not smoothly move, it actually teleports. I thought of having a bunch of command blocks all in a row that kill the zombie and summon a new one every block, giving it the appearance of smooth motion. However, I would like something that I can run in just a few command blocks. Does anyone have experience with things like this? Thanks!

Best Answer

A little tidbit of information: if an entity that usually walks is teleported relatively every tick, it will play its walking animation to match the speed that it's teleporting.

as an example, let's summon a giant with no AI for funsies:

summon giant ~ ~ ~ {NoAI:1b}

then put this into a repeating command block:

execute as @e[type=minecraft:giant] at @s run teleport @s ^ ^ ^.1

It'll actually make the giant appear to walk.

What you can do if you would like it to track a certain path is place stairs (or any 4-directional block) under the ground and turn the giant accordingly. Example:

execute as @e[type=minecraft:giant] at @s if block ~ ~-2 ~ minecraft:oak_stairs[facing=east] run teleport @s ~ ~ ~ 270 0
execute as @e[type=minecraft:giant] at @s if block ~ ~-2 ~ minecraft:oak_stairs[facing=west] run teleport @s ~ ~ ~ 90 0
execute as @e[type=minecraft:giant] at @s if block ~ ~-2 ~ minecraft:oak_stairs[facing=south] run teleport @s ~ ~ ~ 0 0
execute as @e[type=minecraft:giant] at @s if block ~ ~-2 ~ minecraft:oak_stairs[facing=north] run teleport @s ~ ~ ~ 180 0

This will turn the giant to face whatever direction a stair 2 blocks under it is facing. In conjunction with the other command, this will make the giant walk forward until it hits a stair, then change direction based on where the stair is pointing, and continue until it reaches the next one. I hope this was clear enough