Turtle NBT editor Peripheral [Suggestion][WIP]
#1
Posted 05 February 2013 - 03:18 AM
beacuse of a bug in the current version of RedPower2 I had to manually set many RedBusIds this weekend using an InGame NBT editor which became annoying quickly. Today I came with an epic idea solving this and maybe lots of other problems. A peripheral, that can be crafted onto a turtle, that adds the following functions:
getNBTData() - would return a multidimensional Array containing the values of the NBTData of the block in front of the Turtle. (Maybe a getNBTDataUp() and getNBTDataDown())
getNBTDataTypes() - would return a multidimensional Array containing the types ("double", "byte", ...) of the NBTData of the block in front of the Turtle. (Maybe a getNBTDataTypesUp() and
getNBTDataTypesDown())
setNBTData() - would allow setting values to the NBT fields
of course the name of the functions could be different but I hope you get my point.
This peripheral would allow not only setting many RP2 BusIds but also setting much Metadata of Blocks like setting the rotation or the inventory or ....
What do you think about this idea guys?
Is someone interested/willing to create this peripheral?
Thanks in advance Chris
#2
Posted 05 February 2013 - 03:58 AM
#3
Posted 05 February 2013 - 03:59 AM
its not gona happen, you can easily crash and burn a server
get someone to make a peripheral for it
#4
Posted 05 February 2013 - 04:18 AM
Cranium, on 05 February 2013 - 03:58 AM, said:
Yes, he did. It wouldn't let him for some reason, something I'm going to look into.
#5
#6
Posted 05 February 2013 - 04:42 AM
Cranium, on 05 February 2013 - 04:20 AM, said:
The Problem has been fixed. I can now create threads on my own again. Thanks
#7
Posted 06 February 2013 - 07:29 AM
I worked on a peripheral for this. It works great. But I'm currently too lazy to write a documentation and because it can harm your minecraft world I won't release it just now. However, if you're interested in using it or develop this further here https://drive.google...WURjWjlvdDFLT0U you can find the binaries and the source code. You can use it in anyway you want but please mention my name or put a link. You can retrieve NBT data and edit values. You can't delete or create new NBT Tags or array elements.
Note it is using the Turtle Upgrade id 254 though I don't reserve it currently.
Chris
#8
Posted 06 February 2013 - 08:28 AM
thanks, im testing it now :3
EDIT: cant place it 3:
i tried 65024
and 254 damage values but it still reverts to a normal turtle when i place it >_>
EDIT2:
derp Dx forgot to restart server when installing
EDIT3:
this is awesome
one problem: you have to do this to get the table:
loadstring(editor.getNBTData())()()
#9
Posted 06 February 2013 - 08:32 AM
#10
Posted 06 February 2013 - 08:41 AM
PixelToast, on 06 February 2013 - 08:28 AM, said:
thanks, im testing it now :3
EDIT: cant place it 3:
i tried 65024
and 254 damage values but it still reverts to a normal turtle when i place it >_>
Try crafting it using a turtle and a Bottle o' Enchanting this should work
Orwell, on 06 February 2013 - 08:32 AM, said:
This is intended to be used in creative only or for special purposes. I think ppl should decided on their own for what they use it. For example I used it o set many RedPower BusIds.
Of course this should not be used on a public server. But when you're building stuff alone or with friends it could be useful. However if ppl wanna use it for getting items illegally I see no reason to stop them.
#11
Posted 06 February 2013 - 08:47 AM
xuma202, on 06 February 2013 - 08:41 AM, said:
PixelToast, on 06 February 2013 - 08:28 AM, said:
thanks, im testing it now :3
EDIT: cant place it 3:
i tried 65024
and 254 damage values but it still reverts to a normal turtle when i place it >_>
Try crafting it using a turtle and a Bottle o' Enchanting this should work
Orwell, on 06 February 2013 - 08:32 AM, said:
This is intended to be used in creative only or for special purposes. I think ppl should decided on their own for what they use it. For example I used it o set many RedPower BusIds.
Of course this should not be used on a public server. But when you're building stuff alone or with friends it could be useful. However if ppl wanna use it for getting items illegally I see no reason to stop them.
#12
Posted 06 February 2013 - 09:13 AM
#13
Posted 06 February 2013 - 09:28 AM
PixelToast, on 06 February 2013 - 08:28 AM, said:
this is awesome
one problem: you have to do this to get the table:
loadstring(editor.getNBTData())()()
Yes I know but I don't know of a better way since I can't give a table as a function return. Though I'll make an API for this. At this point I wanna thank Espen. His mod "ccDB" is using a similar technique which inspired me.
PixelToast, on 06 February 2013 - 09:13 AM, said:
This is one of the reasons why it's not an officially released peripheral.
#14
Posted 06 February 2013 - 09:34 AM
xuma202, on 06 February 2013 - 09:28 AM, said:
#15
Posted 06 February 2013 - 09:41 AM
dosent return any useful information
#16
Posted 06 February 2013 - 10:04 AM
Orwell, on 06 February 2013 - 09:34 AM, said:
Oh really?! In the javadocs it just says
Quote
Integers, Doubles, Floats, Strings, Booleans and null be converted to their corresponding lua type.
All other types will be converted to nil.
You may return null to indicate no values should be returned.
But I'll try it. Thanks for the hint.
PixelToast, on 06 February 2013 - 09:41 AM, said:
dosent return any useful information
Well, using the set function is a bit tricky. I'll give you an example:
Let's say the data is
{name="", type="TAG_Compound", value={{name="rbaddr", type="TAG_Int", value=4}, {name="x", type="TAG_Int", value=85}, {name="data", type="TAG_IntArray", value={3, 6, 9}}, {name="compound", type="TAG_Compound", value={{name="tag", type="TAG_String", value="I'm a string"}} [...]}}
rbaddr = 4
x = 85
data
3
6
9
compound
tag = I'm a string
[...]
now if you want to change the value of rbaddr you'll call setNBTTagValue(x,"rbaddr")
where x is the new value and all following parameter the name of the element.
If you'd like to change the value of a Tag inside an IntArray or ByteArray, use the name of the Array and as the next parameter the id of the field.
So changing the 6 into a 13 would be done this way:
setNBTTagValue(13,"data",1) because 1 is the index. (STARTING WITH 0 NOT WITH 1)
If you'd like to change the value of a Tag inside a compound do it this way:
setNBTTagValue("I'm another string","compound","tag")
or
setNBTTagValue(<newValue>,<name of the compound>,[<name another compound>][...],<name of the Tag>)
However, how would you'd like to set the values. Have you got a way doing this which is simpler?
Chris
#17
Posted 06 February 2013 - 12:42 PM
#18
Posted 06 February 2013 - 11:47 PM
#19
Posted 07 February 2013 - 04:35 AM
local chest=peripheral.call("right","getNBTData")
chest.x.value="something"
and have a function to set the entire table because when you dochest=tablethe actual data of the chest isnt modified, its just setting the variable to a new table
#20
Posted 07 February 2013 - 04:40 AM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











