mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-18 11:48:02 -04:00
Don't display empty stacks.
This commit is contained in:
parent
a766c6f213
commit
ac756b6770
@ -36,7 +36,7 @@ class Drone(val parent: Delegator) extends traits.Delegate with CustomModel {
|
|||||||
override protected def tooltipExtended(stack: ItemStack, tooltip: util.List[String]): Unit = {
|
override protected def tooltipExtended(stack: ItemStack, tooltip: util.List[String]): Unit = {
|
||||||
if (KeyBindings.showExtendedTooltips) {
|
if (KeyBindings.showExtendedTooltips) {
|
||||||
val info = new DroneData(stack)
|
val info = new DroneData(stack)
|
||||||
for (component <- info.components if component != null) {
|
for (component <- info.components if !component.isEmpty) {
|
||||||
tooltip.add("- " + component.getDisplayName)
|
tooltip.add("- " + component.getDisplayName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
package li.cil.oc.util
|
package li.cil.oc.util
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack
|
||||||
|
|
||||||
import scala.math.ScalaNumber
|
import scala.math.ScalaNumber
|
||||||
|
|
||||||
object ResultWrapper {
|
object ResultWrapper {
|
||||||
def result(args: Any*): Array[AnyRef] = {
|
def result(args: Any*): Array[AnyRef] = {
|
||||||
def unwrap(arg: Any): AnyRef = arg match {
|
def unwrap(arg: Any): AnyRef = arg match {
|
||||||
case x: ScalaNumber => x.underlying
|
case x: ScalaNumber => x.underlying
|
||||||
|
case x: ItemStack if x.isEmpty => null
|
||||||
case x => x.asInstanceOf[AnyRef]
|
case x => x.asInstanceOf[AnyRef]
|
||||||
}
|
}
|
||||||
Array(args map unwrap: _*)
|
Array(args map unwrap: _*)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user