mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-25 22:14:09 -04:00
Added Seismic Prospector data reading support
This commit is contained in:
parent
e9e6cfda25
commit
ebfb80c5a6
@ -0,0 +1,38 @@
|
||||
package li.cil.oc.integration.gregtech
|
||||
|
||||
import java.util
|
||||
|
||||
import li.cil.oc.api.driver.Converter
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.nbt.{NBTTagCompound, NBTTagList, NBTTagString}
|
||||
import li.cil.oc.util.ExtendedNBT._
|
||||
import net.minecraftforge.common.util.Constants.NBT
|
||||
|
||||
import scala.collection.convert.WrapAsScala._
|
||||
|
||||
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'))
|
||||
}
|
||||
case _ =>
|
||||
}
|
||||
}
|
||||
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"),
|
||||
"prospection_ores" -> nbt.getString("prospection_ores").split('|'),
|
||||
"prospection_oils" -> nbt.getString("prospection_oils").split('|'),
|
||||
"prospection_oils_pos" -> nbt.getString("prospection_oils_pos"),
|
||||
"prospection_radius" -> Integer.parseInt(nbt.getString("prospection_radius"))
|
||||
)
|
||||
}
|
@ -15,6 +15,7 @@ object ModGregtech extends ModProxy {
|
||||
MinecraftForge.EVENT_BUS.register(EventHandlerGregTech)
|
||||
|
||||
Driver.add(new DriverEnergyContainer)
|
||||
Driver.add(new ConverterDataStick)
|
||||
|
||||
RecipeHandler.init()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user