Solved Is there anyway to disable baby mobs?

Discussion in 'Spigot Plugin Help' started by Sammie, Apr 28, 2017.

Thread Status:
Not open for further replies.
  1. Heyo,

    i recently came across a massive exploit where players can piston small magmacubes/slimes and if they are stacked up to 1k it can crash my server after they all die from the piston. I know this is a noob question but it'd be nice for a little advance help tysm :)
     
  2. Easiest thing Might be to just not let them spawn and just sell like slime balls and what not in a store.
    EDIT:
    Not sure if you code or not but a simple line like below could fix that.
    Code (Text):
        @EventHandler
        public void entitySpawn(EntitySpawnEvent event) {
            Entity entity = event.getEntity();
            if (entity instanceof Slime) {
                event.setCancelled(true);
            }

        }
     
  3. Does that deny baby slimes? This is a problem I've been trunna look into and thanks for the reply.
     
  4. If you want i can create the plugin, contact me in private
     
  5. You dont need a specific fix for this, just limit the number of mobs per chunk (in config file) and get Mobstacker. Fix the real issue.
     
    • Informative Informative x 1
  6. It denies all Slimes, but @FlyingLlama is right, there's a simpler answer to your problem
     
  7. WAS

    WAS

    There is Slime#getSize()

    Code (Java):
        @EventHandler
        public void entitySpawn(EntitySpawnEvent event) {
            Entity entity = event.getEntity();
            // Where X is the size and under you don't want spawning
            if (entity instanceof Slime && ((Slime)entity).getSize() <= X ) {
                event.setCancelled(true);
            }

        }
     
  8. Hmm, true could be a way but i'd rather deny baby mobs all up as i just want a grinder/magma grinder that has a specific size/age.
     
  9. WAS

    WAS

    Welp, that's how you do that... There is no such thing as a baby magmacube/slimecube. They are sizes.
     
  10. I believe there could be a worldguard flag for mobs that arent adult
     
  11. I wouldn't have a clue what the baby mob names/ids are, i've tried everything for that already
     
  12. Slime dont have the status Baby or Adult. It's indicated by the Entity Size. For the baby the Size is 1 (the default others: 2 and 4)
     
Thread Status:
Not open for further replies.