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