Jump to content

EntityJoinWorldEvent EntityJoinWorldEvent not working


Ian Battistoni

Recommended Posts

I'm creating a mod but it doesn't recognize EntityJoinWorldEvent in 1.20


package com.lunaroom.illagernew.init; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal; import net.minecraft.world.entity.monster.Pillager; import net.minecraft.world.entity.monster.Zombie; import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; @Mod.EventBusSubscriber(modid = "illagernew") public class Illagermodify { @SubscribeEvent public static void onEntityJoinWorld(EntityJoinWorldEvent event) { if (event.getEntity() instanceof Pillager) { Pillager pillager = (Pillager) event.getEntity(); // Agrega una tarea para atacar a los Zombies. pillager.targetSelector.addGoal(4, new NearestAttackableTargetGoal<>(pillager, Zombie.class, true)); // Agrega una tarea para atacar a los jugadores y aldeanos. pillager.targetSelector.addGoal(4, new NearestAttackableTargetGoal<>(pillager, LivingEntity.class, 10, true, false, entity -> entity instanceof LivingEntity && !(entity instanceof Pillager))); // Agrega una tarea para responder al ser atacado. pillager.targetSelector.addGoal(1, new HurtByTargetGoal(pillager)); } } }

Link to comment
Share on other sites

  • 2 weeks later...

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.