Jump to content

How can I remove certain Mobs? (1.12)


AntoPrime

Recommended Posts

Hi,

 

What I want to do is to remove a Mob (Ghasts for example) when a world is created. I tried different things, I know how to code in C and I understand most of Java, but I don't understand everything in all the code I read from various topics in different forums. That is why I'm coming here to seek help. 

 

The last thing I tried is this:

Quote

@SubscribeEvent
    public void onEntityJoinWorld(EntityJoinWorldEvent event)
    {
        Entity entity = event.getEntity();

        if (entity instanceof EntityPigZombie)
        {
            event.getWorld().removeEntity(entity);
            event.setCanceled(true);
            
        }
    }

 

I put this method in my Main class and I wanted to test this with the Zombie Pigman. (My Mod loads perfectly for 1.12, I followed a tutorial on YouTube to set this up and create blocks and items. But I want to do something else like remove a specific mobs.)

 

I thank you in advance for reading this topic and for your help.

Link to comment
Share on other sites

  • 3 weeks later...

1.12 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support.

It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".

Link to comment
Share on other sites

  • Guest locked this topic
Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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