mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-08-03 19:17:27 -04:00
Fixed floppy disks losing their contents when recolored.
This commit is contained in:
parent
2cdedab170
commit
df461d1185
@ -7,7 +7,9 @@ import li.cil.oc.util.{Color, SideTracker}
|
|||||||
import li.cil.oc.{Settings, api}
|
import li.cil.oc.{Settings, api}
|
||||||
import net.minecraft.inventory.InventoryCrafting
|
import net.minecraft.inventory.InventoryCrafting
|
||||||
import net.minecraft.item.{Item, ItemStack}
|
import net.minecraft.item.{Item, ItemStack}
|
||||||
import net.minecraft.nbt.NBTTagCompound
|
import net.minecraft.nbt.{NBTBase, NBTTagCompound}
|
||||||
|
|
||||||
|
import scala.collection.convert.WrapAsScala._
|
||||||
|
|
||||||
object ExtendedRecipe {
|
object ExtendedRecipe {
|
||||||
private lazy val navigationUpgrade = api.Items.get("navigationUpgrade")
|
private lazy val navigationUpgrade = api.Items.get("navigationUpgrade")
|
||||||
@ -41,10 +43,18 @@ object ExtendedRecipe {
|
|||||||
val nbt = craftedStack.getTagCompound
|
val nbt = craftedStack.getTagCompound
|
||||||
for (i <- 0 until inventory.getSizeInventory) {
|
for (i <- 0 until inventory.getSizeInventory) {
|
||||||
val stack = inventory.getStackInSlot(i)
|
val stack = inventory.getStackInSlot(i)
|
||||||
if (stack != null) Color.findDye(stack) match {
|
if (stack != null) {
|
||||||
case Some(oreDictName) =>
|
Color.findDye(stack) match {
|
||||||
nbt.setInteger(Settings.namespace + "color", Color.dyes.indexOf(oreDictName))
|
case Some(oreDictName) =>
|
||||||
case _ =>
|
nbt.setInteger(Settings.namespace + "color", Color.dyes.indexOf(oreDictName))
|
||||||
|
case _ =>
|
||||||
|
}
|
||||||
|
if (api.Items.get(stack) == floppy && stack.hasTagCompound) {
|
||||||
|
val oldData = stack.getTagCompound
|
||||||
|
for (oldTag <- oldData.getTags.map(_.asInstanceOf[NBTBase])) {
|
||||||
|
nbt.setTag(oldTag.getName, oldTag.copy())
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user