Skip to content

Commit

Permalink
Merge branch 'master-MC1.7.10' of github.com:MightyPirates/OpenComput…
Browse files Browse the repository at this point in the history
…ers into OC1.5-MC1.7.10
  • Loading branch information
fnuecke committed Mar 31, 2015
2 parents 4259c8a + dcb6cce commit cdde065
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ import java.util

import li.cil.oc.Settings
import li.cil.oc.api
import li.cil.oc.util.ExtendedNBT._
import net.minecraft.item
import net.minecraft.item.Item
import net.minecraft.nbt.CompressedStreamTools
import net.minecraft.nbt.NBTTagString
import net.minecraftforge.common.util.Constants.NBT

import scala.collection.convert.WrapAsScala._

Expand All @@ -24,6 +27,14 @@ object ConverterItemStack extends api.driver.Converter {
output += "hasTag" -> Boolean.box(stack.hasTagCompound)
output += "name" -> Item.itemRegistry.getNameForObject(stack.getItem)
output += "label" -> stack.getDisplayName
if (stack.hasTagCompound &&
stack.getTagCompound.hasKey("display", NBT.TAG_COMPOUND) &&
stack.getTagCompound.getCompoundTag("display").hasKey("Lore", NBT.TAG_LIST)) {
output += "lore" -> stack.getTagCompound.
getCompoundTag("display").
getTagList("Lore", NBT.TAG_STRING).map((tag: NBTTagString) => tag.func_150285_a_()).
mkString("\n")
}

if (stack.hasTagCompound && Settings.get.allowItemStackNBTTags) {
output += "tag" -> CompressedStreamTools.compress(stack.getTagCompound)
Expand Down

0 comments on commit cdde065

Please sign in to comment.