←  Command Programs

ComputerCraft | Programmable Computers for Minecraft

»

WorldPorter

Bomb Bloke's Photo Bomb Bloke 06 Apr 2015

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 History

Edited by Bomb Bloke, 09 June 2017 - 01:21 PM.
Quote

Lupus590's Photo Lupus590 06 Apr 2015

Posted Image

That's cool, the missing and errored blocks can be done by hand, a lot quicker then building by hand/turtle.
Quote

Bomb Bloke's Photo Bomb Bloke 06 Apr 2015

... and WorldEdit would likely be much faster again (though I confess, I've not tried that). ;)

Still, fun to play around with, I think. :)
Quote

Rougeminner's Photo Rougeminner 05 Jul 2015

interesting... isn't there a command in minecraft to get nbt data of a block though?
Quote

Bomb Bloke's Photo Bomb Bloke 05 Jul 2015

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.
Quote

Lego Stax's Photo Lego Stax 25 Nov 2015

Now, nobody needs to install WorldEdit. This is so useful! I'll definitely be using it in the future.
Quote

moomoomoo3O9's Photo moomoomoo3O9 31 May 2016

View PostBomb Bloke, on 05 July 2015 - 04:17 AM, said:

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 by moomoomoo309, 31 May 2016 - 09:57 PM.
Quote

Bomb Bloke's Photo Bomb Bloke 01 Jun 2016

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. ^_^
Quote