I am making a 'vampire' mob for a datapack I'm writing. It is a husk where I've set the attributes and everything to make it faster, hit harder, and have more health, and tagged it so I could recognize it from the other husks:

summon minecraft:husk ~ ~ ~ {Tags:["DM_vampire"],Silent:1b,DeathLootTable:"dark_magic:vampire",Health:60.0f,Attributes:[{Name:"generic.maxHealth",Base:20.0,Modifiers:[{Name:"tripleHealth",Amount:2,Operation:1}]},{Name:"generic.movementSpeed",Base:0.23000000417232513,Modifiers:[{Name:"speedBoost",Amount:1,Operation:1}]},{Name:"generic.attackDamage",Base:3.0,Modifiers:[{Name:"bigPunch",Amount:2.5,Operation:1}]}]}

My problem is that every tick I run
execute as @e[tag=DM_vampire] run effect give @s minecraft:jump_boost 1 1 true,
but the mob doesn't make use of it. For example, if I am in survival standing on top of a two block high wall, the husk can jump on top, but doesn't, and just stands running at the wall, because its pathfinding doesn't take the effects into account.

Is there a way for me to get around this? I've thought of trying to manually adjust the pathfinding by conditionally applying levitation, so if the husk has not been moving for a few seconds, but is in pursuit of a player. However, I'm a bit stuck because as far as I can tell there is no NBT tag for when a mob is chasing a player.

Is there a trick to force mobs to jump other than when their pathfinding dicatates?

  • Short answer: No. Long answer: You can probably simulate it somehow, like you already tried with the levitation. For the best effect, it might be necessary to reimplement pathfinding completely, like SethBling did long ago with his "creeping vines" invention. Or maybe you could check if a zombie is looking in the direction of a player, either with raytracing or by having a dummy armour stand that you rotate towards the player and then check the rotation tags of both entities in comparison, with a bit of range, in case it's not exact. But I don't know if that would be reliable. There might also – Fabian Röling Aug 3 at 17:40
  • … be other possibilities, but I currently don't have more ideas. – Fabian Röling Aug 3 at 17:40
  • You might be able to exploit the AI of spiders somehow. – Fabian Röling Aug 3 at 17:44
  • I experimented a bit and yes, this should definitely be possible. The view direction of the zombie is directed towards the player's eyes and a spider does climb up. So you basically first have to check whether the zombie looks at the player while not moving, then teleport a spider to it (with some distance to the wall, because spiders are bigger), wait until the spider notices the player and climbs up, then give the zombie Levitation, it should start moving in the direction of the player on its own. Then remove the spider again, otherwise it attacks the player. Definitely not a simple answer … – Fabian Röling Aug 5 at 16:36
  • … with a single trick, but a somewhat complex commands system that requires quite a bit of fine-tuning. I currently have a lot of things to do, but I'll probably come back to this one day, if you don't do it yourself until then. – Fabian Röling Aug 5 at 16:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.