Solved Creating imaginary blocks

Discussion in 'Plugin Development' started by Betagear, Nov 10, 2015.

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

    Betagear

    Hi.
    I need to create fake block to use their properties to update other blocks. But when I do so, it creates a block in the world. I tried that :
    Code:
                    Block ib = block;
                    ib.setData((byte) Inactive2);
    But it does modifies the block on the world. How can I do it ?
     
  2. Offline

    timtower Moderator Moderator

    @Betagear What is the end result that you want to achieve
     
  3. Offline

    Betagear

    I want to have a block with certain stats without modifying the block I've copied at the beginning.
     
  4. Offline

    JRL1004

    @Betagear Behold the magic of BlockStates! When you call Block#getState(), a massive amount of the block's information is copied into a new BlockState object (location, type, and all the good stuff) but, since it is a copy, you can modify the blockstate as much as you desire without changing the block that exists in the minecraft world.
     
Thread Status:
Not open for further replies.

Share This Page