nbt in lua - Printable Version +- Cuberite Forum (https://forum.cuberite.org) +-- Forum: Cuberite (https://forum.cuberite.org/forum-4.html) +--- Forum: Development (https://forum.cuberite.org/forum-13.html) +--- Thread: nbt in lua (/thread-2013.html) |
nbt in lua - warmist - 06-14-2015 Is there any way to access/write nbt in lua? If not i suggest adding that. Not only would it allow easier customization of many things but also allow another (automatically syncronized) way of saving information about world. E.g. had an idea for meteors. It would be easiest to make ghast fireballs rain from sky, but tracking which ones are spawned by plugin which are natural is somewhat troublesome. RE: nbt in lua - xoft - 06-14-2015 That's not only about reading and writing NBT, it's also about attaching foreign information to practically any object in the server. That would be a huge undertaking. (Also, consider that it's theoretically possible, although not used at this moment, to have a different world storage schema that's not using NBT). Is it so important to track which fireballs are natural? Is there any special processing you'd be doing for the plugin's ones? I'd just go with not bothering, at least for the first version of the plugin. RE: nbt in lua - warmist - 06-14-2015 About world storage: if we want to have comparability with vanilla minecraft we would have to have some system of having custom data attached to objects (specifically all entities) even if using different world storage. Also it does not need to be as flexible as NBT. E.g. storing any string in any entity seems excessive. Lastly it's not necessary to differentiate the two fireballs, however it would seem very strange that ghast shot a fireball that destroyed HUGE amount of terrain and left ores in the crater... (also somewhat related: there is no scale for entities?) RE: nbt in lua - xoft - 06-14-2015 Eventually, yes, we'll need something like that, but it won't make it the Lua Challenge deadline I'd recommend keeping track of the spawned meteors in the plugin, and only process those ghast fireballs that are found in that table as meteors. So if there is indeed a world save / load event in the middle of this, the fireballs get converted to regular ones. It shouldn't be much of a problem since natural fireballs only occur in the Nether and the Nether has a roof where meteors are quite unlikely anyway RE: nbt in lua - warmist - 06-14-2015 I just hope not to leak something (e.g. meteors that get unloaded?) RE: nbt in lua - xoft - 06-14-2015 You could timestamp the entries and remove them after a timeout. RE: nbt in lua - warmist - 06-14-2015 (06-14-2015, 07:15 PM)xoft Wrote: You could timestamp the entries and remove them after a timeout. Simple and effective. I like it. |