Solved Prevent Snowgolem from making snowtrail

Discussion in 'Plugin Development' started by hugokk, Nov 19, 2013.

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

    hugokk

    Hello guys,
    I was wondering how to stop a snowgolem from leaving a snow trail behind.
    I tried this, but it doesn't seem to work
    Code:java
    1. @EventHandler
    2. public void snow(EntityBlockFormEvent e)
    3. {
    4. if(e.getEntity() instanceof Snowman)
    5. if(e.getBlock().getType() == Material.SNOW)
    6. e.setCancelled(true);
    7. }

    Thanks for the help
    Hugo
     
  2. Offline

    AtomSponge

    hugokk
    Try using
    Code:java
    1. e.getNewState().getType()
    instead of
    Code:java
    1. e.getBlock().getType()
     
  3. Offline

    hugokk

    Nope doesn't work....
    And btw the event is never called
    Because if I change it to this:
    Code:java
    1. @EventHandler
    2. public void snow(EntityBlockFormEvent e)
    3. {
    4. if(e.getEntity() instanceof Snowman)
    5. if(e.getNewState().getType() == Material.SNOW)
    6. e.setCancelled(true);
    7. Bukkit.getLogger().info(e.getEventName() + " " + e.getBlock().toString());
    8. }

    The problem isn't with registering the listener, because I have tons of events in the same class which are working fine.
     
  4. Offline

    AtomSponge

    hugokk Are you sure you are in the correct biome? Snowmans don't leave a snow trail in every biome.
     
  5. Offline

    hugokk

    I'm in ice plains biome, and i fixed the error with the event not begin called.
    Also .setCancelled(true); changed it for the server, but doesn't send a packet to the client that the event has been undone,
    However when I run a task 1 tick later, and set the block to air, it will work.
    But thanks for all your help guys!
     
Thread Status:
Not open for further replies.

Share This Page