Hi guys, I've been trying to get this to work for a few hours now, I just can't seem to get it to work. I'm trying to restore an area in my minigame arena after the game completes. So basically I need a way to store broken blocks, and when the arena ends, restore that arena's blocks. I've already been searching for a while, and tried out some of the resources, but I still can't seem to get any of them to work. Any ideas? Figured it out. No need to help! EDIT by Moderator: merged posts, please use the edit button instead of double posting.
mattrick How did you do it? I also want to learn how to do this, but I haven't done much research. Just curious.
Wizehh Is there a way to reload a world from a previous save? Say have a template and whenever the game is over, have a plugin delete that world that the game was played on and is now partially destroyed, the copy and rename the template world ready for the next game?
Jugglernaught I'll post my code once I get back to my computer Wizehh That method is quite hacky, and may not always work. My way is pretty simple and efficient.
mattrick Sweet! Thanks. Looking forward to seeing it mattrick So how did you do it? EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Jugglernaught Sorry, I haven't been able to get on my computer lately, I should be back on it tonight. Jugglernaught I still haven't been able to get on my computer, but I'll try to help from my memory. First you should instantiate an empty List<BlockState>. Then whenever a block is broken add it using block.getState(). Then when your want to restore the blocks, loop through the block list, get the blocks location and set that to the correct block. EDIT by Moderator: merged posts, please use the edit button instead of double posting.
mattrick Keep in mind that a BlockState is a snapshot of a block before it is updated, if you that snapshot, it resets the block back to the snapshot the BlockState represents. In simple terms, yes.