Solved Making eggs spawn nothing

Discussion in 'Plugin Development' started by DS_STORE, Feb 3, 2016.

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

    DS_STORE

    I got a special egg with a special displayName.
    To capture if this special egg is thrown, I use a PlayerInteractEvent instead of a PlayerThrowEggEvent.
    The only problem now is, that I do not longer can set event.setHatching(false).

    Is there a workaround for this?

    Pseudocode (open)

    Code:
    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent event) {
        if (event.getItem().hasItemMeta()) {
            if event.getItem().getItemMeta().getDisplayName().equals("Gods Potato")) {
                // Make eggs spawn nothing
                // do own stuff
            }
        }
    }
     
  2. Offline

    teej107

    @DS_STORE Did the PlayerThrowEggEvent fire for spawn eggs?
     
  3. Offline

    vhbob

    @DS_STORE just have a mob spawn event and check if the cause of the mob spawning was through a spawn egg and if it is, set the event to canceled
     
    teej107 likes this.
  4. Offline

    teej107

    But you would then need to go through the trouble of telling if the spawn egg was a special egg which would be more trouble than it's worth since the event doesn't provide an ItemStack getter.
     
  5. Offline

    DS_STORE

    And that's exactly the problem!
    I just need to stop 'em spawning from the special egg.

    @teej107 yaeh it did. But just when the egg landed and I havent got the possibility to get the name of the egg.
     
    Last edited by a moderator: Feb 4, 2016
  6. Offline

    Xerox262

    Can't you use ProjectileHitEvent, check if it's an egg then check if it's got your custom name? Then cancel, remove and run custom code.
     
  7. Offline

    DS_STORE

    Dude. You are my ┬žkfucking hero!
     
  8. Offline

    Xerox262

    @DS_STORE If the thread is solved set it to solved please :)
     
Thread Status:
Not open for further replies.

Share This Page