data stick may have null nbt

This commit is contained in:
repo_alt 2020-07-20 16:33:16 +03:00
parent 3141b56472
commit f99044ad18

View File

@ -16,15 +16,15 @@ 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 != null) {
if (nbt.hasKey("prospection_tier"))
nbt.getString("title") match {
case "Raw Prospection Data" => getRawProspectionData(output, nbt)
case "Analyzed Prospection Data" => {
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 _ =>
}
else if (nbt.hasKey("author") && nbt.getString("author") == "Assembling Line Recipe Generator" && nbt.hasKey("output")) {
@ -48,7 +48,8 @@ class ConverterDataStick extends Converter {
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"),