mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-18 03:36:47 -04:00
Fix disk label lost on read-only mode
This commit is contained in:
parent
19022f95a5
commit
48a43affe2
@ -160,14 +160,18 @@ object FileSystem extends api.detail.FileSystemAPI {
|
|||||||
|
|
||||||
abstract class ItemLabel(val stack: ItemStack) extends Label
|
abstract class ItemLabel(val stack: ItemStack) extends Label
|
||||||
|
|
||||||
class ReadOnlyLabel(val label: String) extends Label {
|
class ReadOnlyLabel(private var label: String) extends Label {
|
||||||
def setLabel(value: String) = throw new IllegalArgumentException("label is read only")
|
def setLabel(value: String) = throw new IllegalArgumentException("label is read only")
|
||||||
|
|
||||||
def getLabel = label
|
def getLabel = label
|
||||||
|
|
||||||
private final val LabelTag = Settings.namespace + "fs.label"
|
private final val LabelTag = Settings.namespace + "fs.label"
|
||||||
|
|
||||||
override def load(nbt: NBTTagCompound) {}
|
override def load(nbt: NBTTagCompound): Unit = {
|
||||||
|
if (nbt.hasKey(LabelTag)) {
|
||||||
|
label = nbt.getString(LabelTag)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override def save(nbt: NBTTagCompound) {
|
override def save(nbt: NBTTagCompound) {
|
||||||
if (label != null) {
|
if (label != null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user