Setting a Blocks BlockState for TileEntity Blocks

Discussion in 'Plugin Development' started by Weasel_Squeezer, Jun 19, 2013.

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

    Weasel_Squeezer

    ok so I need to clone blocks throughout a world which is easy to do with block.setTypeIdAndData, but this does not account for any TileEntities. For instance, any signs will not have the text copied, or any chests will not have the contents copied. So I am trying to set the blocks MaterialData which I believe contains this necessary TileEntity data, and I can get this data from BlockState. However, there is no method in the Block class to set MaterialData or BlockState. I can only do it to the exact TileEntity objects such as Chest and Sign. I could check to see if the block was an instanceof each of the several TileEntities, but that seems to be an unnecessary amount of if else statements.
    So is there a way to set a blocks TileEntity data that is easier or better than this way?
     
  2. Offline

    caseif

    Like you said, there isn't really a way to set the state of a block, so I believe your only alternative would be to check the block's type and take appropriate action (e.g. if it's a sign, record the lines).
     
Thread Status:
Not open for further replies.

Share This Page