Important information regarding cancelling creature spawns

Discussion in 'Resources' started by bergerkiller, May 12, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    blablubbabc

    That doesn't make any difference:
    No matter if you cancle the event or manually call entity.remove() -> the entity object was already initialized before the event was even called and is left for the garbage collector to remove it aferwards..
     
  2. Offline

    craftik7

    But the method will remove the entity object, I think.

    What about e.getEntity().setHealth(0); ?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 1, 2016
  3. Offline

    Ultimate_n00b

    The point isn't removing the entity using ways that you wouldn't normally use. We're saying you have to actually remove him BEFORE the event happens.
     
    bergerkiller and TheGreenGamerHD like this.
  4. Offline

    marwzoor

    bergerkiller
    I know this thread hasn't been active for a while, but I hope you could answer my question!

    I am creating my own spawning system and would like yo cancel the vanilla spawning all together. It might not be a good idea to cancel the creaturespawnevent considering the information you provided. How would I cancel all spawn events made by the vanilla spawning without the entity being created?

    Thanks for any help!
     
  5. Offline

    bergerkiller

    marwzoor
    Easiest way is setting the animal/monster spawning to False for the World. This can be done using:
    Code:java
    1. world.setSpawnFlags(false, false);
     
  6. Offline

    marwzoor

    bergerkiller
    Okey, can I manually spawn in that world then? :)
    Or is all spawning disabled?

    Thanks for helping btw!
     
  7. Offline

    marwzoor

    bergerkiller
    What I am trying to do is override vanilla spawning, if I set the spawnFlags to false, will I be able to do:
    world.spawn(loc, Zombie.class) in that world then? Or is all sorts of spawning disabled?
     
  8. Offline

    bergerkiller

    marwzoor
    That sort of spawning is still possible, the limits/toggle only affect natural spawning. (this includes mob spawners)
     
  9. Offline

    KollegahDerBoss

    bergerkiller
    Sorry for bumping this inactive thread, but I hope you can answer my question!

    I basically want to cancel normal spawning, however keeping the mobspawner behaviour.
    If this isn't possible, how I can spawn the mobs manually for every spawner?

    Thanks in advance!
     
  10. Offline

    Ultimate_n00b

    Just use his plugin and the custom event.
    Aangiix3
     
  11. Ultimate_n00b bergerkiller
    Sorry, this is probably a dumb question, but how do I import BKCommonLib's methods? Specifically I want to use the CreaturePreSpawnEvent. How would I import this into my plugin? Thanks.
     
  12. Offline

    Ultimate_n00b

    Add it to your build path, then use the event like you would use a CreatureSpawnEvent.
     
  13. Offline

    BlackBeltPanda

    Is this still happening in 1.7.10?
     
  14. Offline

    lenis0012

    Knowing bukkit i would guess it does.
     
    Hawktasard likes this.
  15. Offline

    BlackBeltPanda

    Does this occur when cancelling mob spawning from mob spawners?
     
  16. Offline

    xTrollxDudex

    BlackBeltPanda
    If it is called, then it can happen, and as far as I know, it is called.
     
  17. Offline

    BlackBeltPanda


    I know setting monster-spawning to false in the server.properties still allows monster spawning from mob spawners, so wasn't sure if it's called differently.
     
  18. Offline

    techkatz

    When added to the build path could you essentially copy and paste the class right in, register it in your main?
     
Thread Status:
Not open for further replies.

Share This Page