Solved WorldEdit - Replace Specific Block From Schematic

Discussion in 'Spigot Plugin Development' started by kangarko, May 5, 2017.

  1. Problem solved thanks to Empire92

    Dear Spigotters!

    I am experimenting around with a new plugin and would like to replace a certain block in the world with its version stored in WorldEdit's schematics.

    Although I made sure the block is within the schematics location, I am always getting ArrayOutOfBoundsException. Do you have any idea what could I have done wrong here?

    Here's the code:

    How to Reproduce
    1) Save a WorldEdit schematic
    2) Invoke the updateBlock(block) method from my code within the location of your schematic.

    Thank you!
    #1 kangarko, May 5, 2017
    Last edited: May 9, 2017
  2. You shouldn't be using CuboidClipboard, it's deprecated and replaced by the Clipboard class:

    Anywho, the CuboidClipboard is throwing the error because it's from 0,0,0 to whatever its dimensions are. You need to use clipboard.getBlock( vec.subtract(clipboard.getOffset()) ), assuming it is actually inside.
    • Friendly Friendly x 1
  3. It works! Thank you, I appreciate it, really! Thanks also for providing an alternative for the deprecated class, I haven't at first found it but now I know how to use the new API much better.