mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-12 00:35:56 -04:00
Make lore entry of items readable via the item stack converter.
This commit is contained in:
parent
4dab10de3f
commit
dcb6cce1d9
@ -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._
|
||||
|
||||
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user