Fixed multiple derps in 61ba86d451

This commit is contained in:
bdew committed 2015-03-25 16:18:54 +02:00
1 parent 28de3620a2
commit 516133ee0a
3 files changed
+5 -4

No files matched your search

@@ -34,7 +34,7 @@ case class DataSlotBlockFaceMap(name: String, parent: DataSlotContainer) extends
def load(t: NBTTagCompound, kind: UpdateKind.Value) {
map.clear()
map ++= t.getList[Array[Int]]("name") map arr2ent
map ++= t.getList[Array[Int]](name) map arr2ent
}
def updated() = parent.dataSlotChanged(this)
+3 -2
View File
@@ -17,14 +17,15 @@ object NBTHelper {
import NBTTypes._
class RichNBTTagCompound(x: NBTTagCompound) {
class RichNBTTagCompound(tag: NBTTagCompound) {
def getList[T](name: String)(implicit ev: TypeInList[_, T]): Iterable[T] = {
val list = x.getTagList(name, ev.definition.id)
val list = tag.getTagList(name, ev.definition.id)
for (i <- 0 until list.tagCount()) yield ev.fromList(list, i)
}
def setList[T](name: String, v: Iterable[T])(implicit ev: Type[_ <: NBTBase, T]): Unit = {
val list = new NBTTagList
for (x <- v) list.appendTag(ev.toNBT(x))
tag.setTag(name, list)
}
}
@@ -29,7 +29,7 @@ trait PersistentInventoryTile extends TileExtended with BaseInventory {
})
persistSave.listen((tag: NBTTagCompound) => {
tag.setList("name",
tag.setList("Items",
for ((item, i) <- inv.view.zipWithIndex if item != null)
yield Misc.applyMutator(new NBTTagCompound) { itemNbt =>
itemNbt.setByte("Slot", i.asInstanceOf[Byte])