Jump to content




WorldPorter

command

7 replies to this topic

#1 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 06 April 2015 - 08: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 History

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


#2 Lupus590

  • Members
  • 2,029 posts
  • LocationUK

Posted 06 April 2015 - 09:54 AM

Posted Image

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

#3 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 06 April 2015 - 10: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. :)

#4 Rougeminner

  • Members
  • 151 posts

Posted 05 July 2015 - 03:56 AM

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

#5 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 05 July 2015 - 04: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.

#6 Lego Stax

  • Members
  • 136 posts
  • LocationThe dark depths of the web

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.

#7 moomoomoo3O9

  • Members
  • 82 posts
  • LocationPork roll land

Posted 31 May 2016 - 09:52 PM

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.


#8 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 01 June 2016 - 12: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. ^_^





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users