mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-26 14:35:04 -04:00
data stick may have null nbt
This commit is contained in:
parent
3141b56472
commit
f99044ad18
@ -16,39 +16,40 @@ class ConverterDataStick extends Converter {
|
||||
override def convert(value: Any, output: util.Map[AnyRef, AnyRef]): Unit = if (value.isInstanceOf[ItemStack]) {
|
||||
val stack = value.asInstanceOf[ItemStack]
|
||||
val nbt = stack.stackTagCompound
|
||||
if (nbt.hasKey("prospection_tier"))
|
||||
nbt.getString("title") match {
|
||||
case "Raw Prospection Data" => getRawProspectionData(output, nbt)
|
||||
case "Analyzed Prospection Data" => {
|
||||
getRawProspectionData(output, nbt)
|
||||
output += "Analyzed Prospection Data" ->
|
||||
nbt.getTagList("pages", NBT.TAG_STRING)
|
||||
.toArray[NBTTagString].map( (tag: NBTTagString) => tag.func_150285_a_().split('\n'))
|
||||
if (nbt != null) {
|
||||
if (nbt.hasKey("prospection_tier"))
|
||||
nbt.getString("title") match {
|
||||
case "Raw Prospection Data" => getRawProspectionData(output, nbt)
|
||||
case "Analyzed Prospection Data" =>
|
||||
getRawProspectionData(output, nbt)
|
||||
output += "Analyzed Prospection Data" ->
|
||||
nbt.getTagList("pages", NBT.TAG_STRING)
|
||||
.toArray[NBTTagString].map((tag: NBTTagString) => tag.func_150285_a_().split('\n'))
|
||||
case _ =>
|
||||
}
|
||||
case _ =>
|
||||
else if (nbt.hasKey("author") && nbt.getString("author") == "Assembling Line Recipe Generator" && nbt.hasKey("output")) {
|
||||
val outputItem = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("output"))
|
||||
output += "output" -> outputItem.getDisplayName
|
||||
output += "time" -> nbt.getInteger("time").toString
|
||||
output += "eu" -> nbt.getInteger("eu").toString
|
||||
val inputs = new ArrayBuffer[ItemStack]()
|
||||
var index = 0
|
||||
while (nbt.hasKey(index.toString)) {
|
||||
inputs += ItemStack.loadItemStackFromNBT(nbt.getCompoundTag(index.toString))
|
||||
index += 1
|
||||
}
|
||||
output += "inputItems" -> inputs.map((s: ItemStack) => s.getDisplayName -> s.stackSize)
|
||||
index = 0
|
||||
val inputFluids = new ArrayBuffer[FluidStack]()
|
||||
while (nbt.hasKey("f" + index)) {
|
||||
inputFluids += FluidStack.loadFluidStackFromNBT(nbt.getCompoundTag("f" + index))
|
||||
index += 1
|
||||
}
|
||||
output += "inputFluids" -> inputFluids.map((s: FluidStack) => s.getLocalizedName -> s.amount)
|
||||
}
|
||||
else if (nbt.hasKey("author") && nbt.getString("author") == "Assembling Line Recipe Generator" && nbt.hasKey("output")) {
|
||||
val outputItem = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("output"))
|
||||
output += "output" -> outputItem.getDisplayName
|
||||
output += "time" -> nbt.getInteger("time").toString
|
||||
output += "eu" -> nbt.getInteger("eu").toString
|
||||
val inputs = new ArrayBuffer[ItemStack]()
|
||||
var index = 0
|
||||
while (nbt.hasKey(index.toString)) {
|
||||
inputs += ItemStack.loadItemStackFromNBT(nbt.getCompoundTag(index.toString))
|
||||
index += 1
|
||||
}
|
||||
output += "inputItems" -> inputs.map((s:ItemStack) => s.getDisplayName -> s.stackSize)
|
||||
index = 0
|
||||
val inputFluids = new ArrayBuffer[FluidStack]()
|
||||
while (nbt.hasKey("f" + index)) {
|
||||
inputFluids += FluidStack.loadFluidStackFromNBT(nbt.getCompoundTag("f" + index))
|
||||
index += 1
|
||||
}
|
||||
output += "inputFluids" -> inputFluids.map((s:FluidStack) => s.getLocalizedName -> s.amount)
|
||||
}
|
||||
}
|
||||
def getRawProspectionData(output: util.Map[AnyRef, AnyRef], nbt: NBTTagCompound) =
|
||||
private def getRawProspectionData(output: util.Map[AnyRef, AnyRef], nbt: NBTTagCompound) =
|
||||
output += "Raw Prospection Data" -> Map(
|
||||
"prospection_tier" -> nbt.getByte("prospection_tier"),
|
||||
"prospection_pos" -> nbt.getString("prospection_pos"),
|
||||
|
Loading…
x
Reference in New Issue
Block a user