This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Bomb Bloke's profile picture

WorldPorter

Started by Bomb Bloke, 06 April 2015 - 07:09 AM
Bomb Bloke #1
Posted 06 April 2015 - 09:09 AM
pastebin get pXjdQDf6 worldporter

A script initially kludged together to speed-test Command Computers, now refined into something which perhaps might even be useful? Eh, that's probably hoping for too much… ;)/>

WorldPorter, if fed a set of co-ordinates, will scan the blocks in the area and save the resulting data to disk. It can then reconstruct them most anywhere you like.

As it requires a Command Computer to operate, it can only be used by game OPs playing in creative mode.



You can download a set of example build files with the following command:

pastebin run cUYTGbpb get NW35LQaE

Some notes:
  • When building, the option to "pre-clear terrain" will likely slow things down slightly (and throw off the time estimate the script provides, typically making it quote higher than it should), but it'll help prevent pre-existing blocks from interfering.
  • There's (currently?) no functionality in ComputerCraft which allows the reading of NBT tags from blocks, so its ability to reconstruct the likes of eg Carpenter's Blocks (which make heavy use of such tags) is poor. Chest contents, writing on signs and so on cannot be captured. Likewise, it can only read data from blocks, so entities such as paintings are ignored.
  • It may not be able to correctly orientate all blocks. This partly has to do with some blocks using NBT tags to store their facings (eg turtles), and partly has to do with a bug in MC 1.7.10.
  • The file format it uses to store structures incorporates non-ASCII characters, meaning you can't upload / download them using ComputerCraft's regular "pastebin" script. Use something like BBPack instead.
  • It can rotate the structures it builds, but when it comes to the individual rotatable blocks within the structures, this only fully works on those which rely on metadata for their facing - and those have to have their metadata translations coded into the script. I believe I've covered all the vanilla blocks, but I'm unlikely to research more translations myself. I'll gladly incorporate lists for mods if they're provided to me (along with the relevant version numbers), however.
  • Likewise, some blocks must be placed in special ways - eg doors, liquids, torches. Vanilla blocks should all be accounted for, lists for mod blocks are welcome. Bear in mind it's all case-sensitive!
  • When building, the script will suggest a default layer for each file based on where it was scanned from, but the best way to tell how a given build will come out is to test it - preferably in a new CSP world. Ditto if you want to try rotating.

Version History2015/04/06
1.0.0
Initial release.

2015/09/15
1.0.1
Scanning is now over 15x faster, thanks to this discussion.
Edited on 09 June 2017 - 12:21 PM
Lupus590 #2
Posted 06 April 2015 - 10:54 AM


That's cool, the missing and errored blocks can be done by hand, a lot quicker then building by hand/turtle.
Bomb Bloke #3
Posted 06 April 2015 - 11:53 AM
… and WorldEdit would likely be much faster again (though I confess, I've not tried that). ;)/>

Still, fun to play around with, I think. :)/>
Rougeminner #4
Posted 05 July 2015 - 04:56 AM
interesting… isn't there a command in minecraft to get nbt data of a block though?
Bomb Bloke #5
Posted 05 July 2015 - 05:17 AM
In MineCraft 1.8, it's possible to perform true/false tests on NBT data. This may also be true (to a rather more limited extent) under MC 1.7.10 (the build ComputerCraft's currently compatible with), but either way, you can't just "get the NBT data of a block", unfortunately.

Heck, commands.getBlockInfo() doesn't even have anything to do with "MineCraft commands". It's just an extra something Dan decided to give to Command Computers.
Lego Stax #6
Posted 25 November 2015 - 10:59 PM
Now, nobody needs to install WorldEdit. This is so useful! I'll definitely be using it in the future.
moomoomoo3O9 #7
Posted 31 May 2016 - 10:52 PM
In MineCraft 1.8, it's possible to perform true/false tests on NBT data. This may also be true (to a rather more limited extent) under MC 1.7.10 (the build ComputerCraft's currently compatible with), but either way, you can't just "get the NBT data of a block", unfortunately.

Heck, commands.getBlockInfo() doesn't even have anything to do with "MineCraft commands". It's just an extra something Dan decided to give to Command Computers.
commands.blockData(x,y,z,{}) disagrees with you ;)/>
Also, for entities, commands.entitydata("@e",{}) disagrees.

Technically, you could do that command to get the entities with an area, especially if you add better parameters to the @e. You could also parse the NBT into a table, then remove the UUIDLeast, UUIDMost, UUID, and modify anything you'd like, and you could easily respawn those entities.
Edited on 31 May 2016 - 08:57 PM
Bomb Bloke #8
Posted 01 June 2016 - 01:56 AM
Yes, I did discover blockdata's full capabilities some time over the last year. Set out to add NBT reading support to WorldPorter but got sidetracked and wrote this with it instead.

One day I'll finish my (currently somewhat limited) parser, and then it'll be possible to import / export pretty much any structure. Well, except maybe multiblocks. Those are probably a server crash waiting to happen. ^_^/>