ChunkSnapshot & Spawners

Discussion in 'Spigot Plugin Development' started by Digital, Jan 10, 2019.

  1. Hey there,

    I'm looping through a chunk using ChunkSnapshot & 3 for loops. I can only seem to get the block type which is great however we have spawners on our server which are different type (pig, zombie, skeleton etc) how would I get the type of spawner the block is? I'm using 1.13.2 spigot.

    Thanks.
     
  2. Get state
    Check if instance of Spawner
    Cast to Spawner
    Get spawntype
     
    • Agree Agree x 1
    • Optimistic Optimistic x 1
  3. Didn't know that chunksnapshot has an convenient way of getting the type and blockdata.
    I hope you can calculate the location yourself.
     
    • Optimistic Optimistic x 1
  4. Seems like a short coming of the ChunkSnapshot interface and/or the fact we have BlockData and BlockState both of which are trying to do the same thing in different ways.

    The best you can do is build a list/set of locations which contain spawner blocks async and feed that into a sync task which works on the actual chunk rather then the snapshot(s).
     
    • Like Like x 1
  5. drives_a_ford

    Moderator

    • Like Like x 1
  6. I've found a solution kinda similar to this. Basically I find all materials async using ChunkSnapshots and then keeping track of all spawners found. After that has completed, it will run a task on the main thread to loop through those tracked spawners and get their block state.

    Thank you all for the help.
     
  7. How did you get the block state from the ChunkSnapshots?
     
  8. He didn't. But if you read the posts you'll figure it out.