Fix disk label lost on read-only mode

This commit is contained in:
zeng-github01 2025-08-14 22:51:55 +08:00
parent 19022f95a5
commit 48a43affe2

View File

@ -160,14 +160,18 @@ object FileSystem extends api.detail.FileSystemAPI {
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 getLabel = 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) {
if (label != null) {