Jump to content

Recommended Posts

Posted

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.

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.