Topic category: Help with Minecraft modding (Java Edition)
Hi, I'm making a custom hostile mob called the Splinter that should
freeze when the player looks at it, similar to the Weeping Angels
from Doctor Who.
I'm using Snail's Plugin for the "Has [entity] line of sight to
[entity]" block. My procedure is set up like this:
- Global trigger: On player tick update
- For each entity in square cube size 32
- If Entity iterator is type Splinter
- If Has Event/target entity line of sight to Entity iterator
- Attempt to stop navigation of Entity iterator
The problem is the Splinter does a step-pause-step-pause movement
instead of moving smoothly. It seems like the procedure is
constantly interrupting the mob's pathfinding even when the player
is not looking at it.
I have these AI tasks set up on the Splinter:
- Attack entities of type Player
- Do melee/contact attack speed 1.5
- Wander around speed 0.5
- Watch closest entity Player radius 32
- Look around
Code view:package net.mcreator.thebackwoods.procedures;/* imports omitted */@EventBusSubscriber public class SplinterOnEntityTickUpdateProcedure { @SubscribeEvent public static void onPlayerTick(PlayerTickEvent.Post event) { execute(event, event.getEntity().level(), event.getEntity().getX(), event.getEntity().getY(), event.getEntity().getZ(), event.getEntity()); } public static void execute(LevelAccessor world, double x, double y, double z, Entity entity) { execute(null, world, x, y, z, entity); } private static void execute(@Nullable Event event, LevelAccessor world, double x, double y, double z, Entity entity) { if (entity == null) return; boolean blocked = false; double zc = 0; double zc2 = 0; double yc = 0; double yc2 = 0; double Grow = 0; double d = 0; { final Vec3 _center = new Vec3(x, y, z); for (Entity entityiterator : world.getEntitiesOfClass(Entity.class, new AABB(_center, _center).inflate(32 / 2d), e -> true).stream().sorted(Comparator.comparingDouble(_entcnd -> _entcnd.distanceToSqr(_center))).toList()) { if (entityiterator instanceof SplinterEntity) { if (entity instanceof LivingEntity _entity ? _entity.hasLineOfSight(entityiterator) : false) { if (entityiterator instanceof Mob _entity) _entity.getNavigation().stop(); } } } } } }
MCreator version: 2025.3
NeoForge: 1.21.1
Any help appreciated.
Actually I made my own.
Template
do you need the addon for your template?
i dont need plugins for that anymore since its now fully custom coded now