setTypeIdAndData deprecated, need way of converting Byte data into Material

Discussion in 'Plugin Development' started by Caedus, Jun 29, 2020.

  1. Offline



    I've been looking at implement this code into my plugin. Unfortunately, the method setTypeIdAndData is deprecated so I need to find another way. In the solutions I have found online, people suggest using BlockData instead.

    This solution should work fine, but I need a way of converting the existing byte data I have (which the code pulls from the schematic) into a Material. Is there a way of doing this? Perhaps an inbuilt functionality I have missed?

  2. Offline


    @Caedus You can set the BlockData using:

    Version 1.13 removed item IDs so no, there's no way to do that.
    If you're using a version below 1.13, you'll have the Material#getMaterial(int id) method.
    Last edited: Jun 29, 2020
  3. Offline


    Unless blockdata is now stored different in schematics, how do WorldEdit and other APIs correctly interpret & paste byte data into blocks? It must still be possible somehow, right?
  4. Offline


    @Caedus Although it's deprecated, you should still be able to use BlockState#getRawData() and BlockState#setRawData(byte).

Share This Page