Easy way to set block to snow?

Discussion in 'Plugin Development' started by pokekart2014, Dec 5, 2015.

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

    pokekart2014

    So, I'm setting the block under the player to snow (those thin ones, not blocks), and trying to make a Snowman kind of thing.

    Now, I have it so that it will not place snow if the block under it is air, but when jumping on top of grass patches, snow gets placed on top of them, and it does look aesthetically un-pleasing.

    I would like it so that the snow removes the grass and replaces it with the snow, if the block is grass, or any other similar types.

    Is there an easier method to achieve this, instead of going through the "if(!block==BLAH)", for every single block type that I can think of, and still miss some out?

    Any suggestions?
     
  2. Offline

    Scimiguy

    If you don't check each block, how would you know what the blocks are?

    Just run a repeating task using a BukkitScheduler, and check the block underneath the entity, do what you need to.

    If it's a player, you could also listen to PlayerMoveEvent, up to you.
    I'd probably still go the scheduler route though
     
  3. Offline

    pokekart2014

    Thanks for the advise.
    I already have my full code inside a PlayerMoveEvent, and if the block isn't air, set to snow.

    But my method caused many kind of glitches (Slabs into snows, Snow on top of grass, Snow on water, Snow under water, etc)

    So, maybe the best way to do it is just checking the block using my Move Event, and checking if they are on water, if the block above is water, if it's grass, etc.... :(
     
  4. Offline

    Scimiguy

    Correct.

    Unless you're tracking all the players at the same time though, you're far better off using a scheduler
     
  5. Offline

    pokekart2014

    If I call a scheduler, where would I place it?


    EDIT: Never mind.
     
    Last edited: Dec 6, 2015
Thread Status:
Not open for further replies.

Share This Page