Adding persistant data to a normal peripheral is easy, as they simply extend the TileEntity class. However, turtle peripherals don't have that option. All data saved in them is lost when the turtle gets unloaded. Commands scheduled through the issueCommand method are lost, too. So, my suggestion would be to add readFromNBT and writeToNBT methods to the ITurtlePeripheral interface. The data would be saved in a sub-tag of the turtle's own nbt tag. When it's loaded again, the read method would be called on the new peripheral object.
If a named turtle gets destroyed, the nbt saving mechanism could even be used to persist the peripheral data, too.
0
Turtle peripheral persistance
Started by Xfel, Aug 27 2012 06:02 AM
3 replies to this topic
#1
Posted 27 August 2012 - 06:02 AM
#2
Posted 27 August 2012 - 03:03 PM
You can already do this using an item to store the information.
#3
Posted 27 August 2012 - 04:31 PM
Er.. yes, but that is a very dirty way of doing this, you know? It would not so difficult to support this properly.
#4
Posted 27 August 2012 - 05:36 PM
Good idea. Will see if can implement it for 1.3 port (as will be an API breaking change!).
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users