mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-15 10:21:45 -04:00
Lesson learned: structural typing and obfuscation don't play nice. Fixes #1492.
This commit is contained in:
parent
e47cc37d38
commit
ffecc8347f
@ -238,7 +238,7 @@ object NetworkControl {
|
||||
nbt.setInteger("y", controller.yCoord)
|
||||
nbt.setInteger("z", controller.zCoord)
|
||||
}
|
||||
nbt.setNewTagList("links", links)
|
||||
nbt.setNewTagList("links", links.map(_.writeToNBT _))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -421,7 +421,7 @@ object DebugCard {
|
||||
checkEnabled()
|
||||
val (x, y, z) = (args.checkInteger(0), args.checkInteger(1), args.checkInteger(2))
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case tileEntity: TileEntity => result(toNbt(tileEntity).toTypedMap)
|
||||
case tileEntity: TileEntity => result(toNbt(tileEntity.writeToNBT _).toTypedMap)
|
||||
case _ => null
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package li.cil.oc.util
|
||||
import com.google.common.base.Charsets
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.nbt._
|
||||
import net.minecraft.tileentity.TileEntity
|
||||
import net.minecraftforge.common.util.Constants.NBT
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
|
||||
@ -36,12 +37,6 @@ object ExtendedNBT {
|
||||
|
||||
implicit def toNbt(value: String): NBTTagString = new NBTTagString(value)
|
||||
|
||||
implicit def toNbt(value: {def writeToNBT(nbt: NBTTagCompound): Unit}): NBTTagCompound = {
|
||||
val nbt = new NBTTagCompound()
|
||||
value.writeToNBT(nbt)
|
||||
nbt
|
||||
}
|
||||
|
||||
implicit def toNbt(value: ItemStack): NBTTagCompound = {
|
||||
val nbt = new NBTTagCompound()
|
||||
if (value != null) {
|
||||
@ -50,6 +45,12 @@ object ExtendedNBT {
|
||||
nbt
|
||||
}
|
||||
|
||||
implicit def toNbt(value: NBTTagCompound => Unit): NBTTagCompound = {
|
||||
val nbt = new NBTTagCompound()
|
||||
value(nbt)
|
||||
nbt
|
||||
}
|
||||
|
||||
implicit def toNbt(value: Map[String, _]): NBTTagCompound = {
|
||||
val nbt = new NBTTagCompound()
|
||||
for ((key, value) <- value) value match {
|
||||
@ -182,7 +183,7 @@ object ExtendedNBT {
|
||||
|
||||
implicit def stringIterableToNbt(value: Iterable[String]): Iterable[NBTTagString] = value.map(toNbt)
|
||||
|
||||
implicit def writableIterableToNbt(value: Iterable[ {def writeToNBT(nbt: NBTTagCompound): Unit}]): Iterable[NBTTagCompound] = value.map(toNbt)
|
||||
implicit def writableIterableToNbt(value: Iterable[NBTTagCompound => Unit]): Iterable[NBTTagCompound] = value.map(toNbt)
|
||||
|
||||
implicit def itemStackIterableToNbt(value: Iterable[ItemStack]): Iterable[NBTTagCompound] = value.map(toNbt)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user