mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-15 02:12:42 -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.Settings
|
||||
import li.cil.oc.client.KeyBindings
|
||||
import li.cil.oc.common.GuiType
|
||||
import li.cil.oc.common.Tier
|
||||
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]) {
|
||||
super.tooltipExtended(stack, tooltip)
|
||||
if (KeyBindings.showExtendedTooltips) {
|
||||
HelperInventory.container = stack
|
||||
HelperInventory.reinitialize()
|
||||
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) = {
|
||||
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.TabletData
|
||||
import li.cil.oc.util.RotationHelper
|
||||
import li.cil.oc.util.Tooltip
|
||||
import net.minecraft.entity.Entity
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
@ -75,11 +76,15 @@ class Tablet(val parent: Delegator) extends Delegate {
|
||||
if (KeyBindings.showExtendedTooltips) {
|
||||
val info = new ItemUtils.TabletData(stack)
|
||||
// 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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override def isDamageable = true
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user