blob: e849bc48f945e6a20e5445e57503fcd03e6ad0be [file] [log] [blame] [raw]
package li.cil.oc.common.block
import java.util
import cpw.mods.fml.common.Optional
import li.cil.oc.common.tileentity
import li.cil.oc.util.mods.Mods
import li.cil.oc.{Localization, Settings}
import mcp.mobius.waila.api.{IWailaConfigHandler, IWailaDataAccessor}
import net.minecraft.item.ItemStack
import net.minecraft.nbt.NBTTagCompound
import net.minecraft.world.World
class AccessPoint(parent: SimpleDelegator) extends Switch(parent) {
override protected def customTextures = Array(
None,
Some("AccessPointTop"),
Some("SwitchSide"),
Some("SwitchSide"),
Some("SwitchSide"),
Some("SwitchSide")
)
@Optional.Method(modid = Mods.IDs.Waila)
override def wailaBody(stack: ItemStack, tooltip: util.List[String], accessor: IWailaDataAccessor, config: IWailaConfigHandler) {
val nbt = accessor.getNBTData
val node = nbt.getTagList(Settings.namespace + "componentNodes").tagAt(accessor.getSide.ordinal).asInstanceOf[NBTTagCompound]
if (node.hasKey("address")) {
tooltip.add(Localization.Analyzer.Address(node.getString("address")).toString)
}
if (nbt.hasKey(Settings.namespace + "strength")) {
tooltip.add(Localization.Analyzer.WirelessStrength(nbt.getDouble(Settings.namespace + "strength")).toString)
}
}
// ----------------------------------------------------------------------- //
override def createTileEntity(world: World) = Some(new tileentity.AccessPoint())
}