mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-16 18:55:03 -04:00
Unified tooltips of items with builtin components a little.
This commit is contained in:
parent
b5183fb2d0
commit
c95196df0e
@ -4,6 +4,7 @@ import java.util
|
|||||||
|
|
||||||
import li.cil.oc.OpenComputers
|
import li.cil.oc.OpenComputers
|
||||||
import li.cil.oc.Settings
|
import li.cil.oc.Settings
|
||||||
|
import li.cil.oc.client.KeyBindings
|
||||||
import li.cil.oc.common.GuiType
|
import li.cil.oc.common.GuiType
|
||||||
import li.cil.oc.common.Tier
|
import li.cil.oc.common.Tier
|
||||||
import li.cil.oc.common.inventory.ServerInventory
|
import li.cil.oc.common.inventory.ServerInventory
|
||||||
@ -34,6 +35,7 @@ class Server(val parent: Delegator, val tier: Int) extends Delegate {
|
|||||||
|
|
||||||
override protected def tooltipExtended(stack: ItemStack, tooltip: util.List[String]) {
|
override protected def tooltipExtended(stack: ItemStack, tooltip: util.List[String]) {
|
||||||
super.tooltipExtended(stack, tooltip)
|
super.tooltipExtended(stack, tooltip)
|
||||||
|
if (KeyBindings.showExtendedTooltips) {
|
||||||
HelperInventory.container = stack
|
HelperInventory.container = stack
|
||||||
HelperInventory.reinitialize()
|
HelperInventory.reinitialize()
|
||||||
val items = mutable.Map.empty[String, Int]
|
val items = mutable.Map.empty[String, Int]
|
||||||
@ -48,6 +50,7 @@ class Server(val parent: Delegator, val tier: Int) extends Delegate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override def onItemRightClick(stack: ItemStack, world: World, player: EntityPlayer) = {
|
override def onItemRightClick(stack: ItemStack, world: World, player: EntityPlayer) = {
|
||||||
if (!player.isSneaking) {
|
if (!player.isSneaking) {
|
||||||
|
@ -34,6 +34,7 @@ import li.cil.oc.util.ExtendedNBT._
|
|||||||
import li.cil.oc.util.ItemUtils
|
import li.cil.oc.util.ItemUtils
|
||||||
import li.cil.oc.util.ItemUtils.TabletData
|
import li.cil.oc.util.ItemUtils.TabletData
|
||||||
import li.cil.oc.util.RotationHelper
|
import li.cil.oc.util.RotationHelper
|
||||||
|
import li.cil.oc.util.Tooltip
|
||||||
import net.minecraft.entity.Entity
|
import net.minecraft.entity.Entity
|
||||||
import net.minecraft.entity.player.EntityPlayer
|
import net.minecraft.entity.player.EntityPlayer
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
@ -75,11 +76,15 @@ class Tablet(val parent: Delegator) extends Delegate {
|
|||||||
if (KeyBindings.showExtendedTooltips) {
|
if (KeyBindings.showExtendedTooltips) {
|
||||||
val info = new ItemUtils.TabletData(stack)
|
val info = new ItemUtils.TabletData(stack)
|
||||||
// Ignore/hide the screen.
|
// Ignore/hide the screen.
|
||||||
info.items.drop(1).collect {
|
val components = info.items.drop(1)
|
||||||
|
if (components.length > 1) {
|
||||||
|
tooltip.addAll(Tooltip.get("Server.Components"))
|
||||||
|
components.collect {
|
||||||
case Some(component) => tooltip.add("- " + component.getDisplayName)
|
case Some(component) => tooltip.add("- " + component.getDisplayName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override def isDamageable = true
|
override def isDamageable = true
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user