Jump to content




Turtle peripheral persistance


3 replies to this topic

#1 Xfel

    Peripheral Designer

  • Members
  • 515 posts

Posted 27 August 2012 - 06:02 AM

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.

#2 Hackingroelz

    Peripheral Designer

  • Members
  • 213 posts
  • Locationthe Nether(lands)

Posted 27 August 2012 - 03:03 PM

You can already do this using an item to store the information.

#3 Xfel

    Peripheral Designer

  • Members
  • 515 posts

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 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

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