Posted August 25, 20196 yr So in my code for 1.8.1, I used to be able to change Creepers AI tasks like so: @SubscribeEvent public void onEntitySpawn(EntityJoinWorldEvent event) { if (event.entity instanceof EntityCreeper){ EntityCreeper entity = (EntityCreeper) event.entity; for (Object entry : entity.targetTasks.taskEntries.toArray()){ EntityAIBase ai = ((EntityAITasks.EntityAITaskEntry) entry).action; if (ai instanceof EntityAINearestAttackableTarget) entity.targetTasks.removeTask(ai); } for (Object entry : entity.tasks.taskEntries.toArray()){ EntityAIBase ai = ((EntityAITasks.EntityAITaskEntry) entry).action; if (ai instanceof EntityAIAttackOnCollide) entity.tasks.removeTask(ai); } entity.tasks.addTask(1, new EntityAITempt(entity, 1.0D, Items.gunpowder, false)); entity.tasks.addTask(2, new EntityAIPanic(entity, 1.4D)); } } But now, in 1.14.4, i cannot for the life of me figure out how to use the "goal" system in the AI. I have tried different events, new registry of the mob, overriding creeperEntites... Here is a failure chunk of code I tried to rework the 1.8 function to (knowing it would fail): (Also, if it doesn't make any sense its because it's literally me changing tiny things to see what happens after weeks of trying) @SubscribeEvent public void onEntitySpawn(EntityJoinWorldEvent event) { if (event.getEntity() instanceof CreeperEntity){ CreeperEntity creeper = (CreeperEntity) event.getEntity(); for (Task task : creeper.goalSelector.getRunningGoals().filter(PrioritizedGoalPrioritizedGoal).getgoal()){ GoalSelector ai = ((GoalSelector) entry).action; if (ai instanceof EntityAINearestAttackableTarget) entity.targetTasks.removeTask(ai); } } } The Mod in its base form is just to make creepers friendly and maybe attack other things. I just can't get the Goal system right. Edited August 25, 20196 yr by max2461
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.