blob: 0bfb974e10df97e025891d5f8bcc0fb057fbf654 [file] [log] [blame] [raw]
package li.cil.oc.integration.vanilla
import java.util
import li.cil.oc.Settings
import li.cil.oc.api
import scala.collection.convert.WrapAsScala._
object ConverterFluidStack extends api.driver.Converter {
override def convert(value: scala.Any, output: util.Map[AnyRef, AnyRef]) =
value match {
case stack: net.minecraftforge.fluids.FluidStack =>
if (Settings.get.insertIdsInConverters) {
output += "id" -> Int.box(stack.fluidID)
}
output += "amount" -> Int.box(stack.amount)
output += "hasTag" -> Boolean.box(stack.tag != null)
val fluid = stack.getFluid
if (fluid != null) {
output += "name" -> fluid.getName
output += "label" -> fluid.getLocalizedName(stack)
}
case _ =>
}
}