Hide items, add info in tooltip

This commit is contained in:
kuba6000 committed 2022-10-09 16:14:32 +02:00
1 parent 6a71f7ce94
commit b1ea699fd8
13 files changed
+45 -16

No files matched your search

+1 -1
View File
@@ -2,7 +2,7 @@
dependencies {
compile("com.github.GTNewHorizons:CodeChickenLib:1.1.5.1:dev")
compile("com.github.GTNewHorizons:NotEnoughItems:2.1.22-GTNH:dev")
compile("com.github.GTNewHorizons:NotEnoughItems:2.3.7-GTNH:dev")
compile("com.github.GTNewHorizons:bdlib:1.9.6:dev")
compile("com.github.GTNewHorizons:ForestryMC:4.4.4:dev") {
exclude group: "net.industrial-craft", module: "industrialcraft-2"
@@ -11,7 +11,7 @@ package net.bdew.gendustry.config
import net.bdew.gendustry.Gendustry
import net.bdew.gendustry.compat.ForestryHelper
import net.bdew.gendustry.custom.{CustomHoneyComb, CustomHoneyDrop}
import net.bdew.gendustry.custom.{CustomHoneyComb, CustomHoneyDrop, CustomUpgradeFrame}
import net.bdew.gendustry.items._
import net.bdew.gendustry.items.covers.{EjectCover, ErrorSensorCover, ImportCover}
import net.bdew.gendustry.machines.apiary.upgrades.ItemApiaryUpgrade
@@ -39,7 +39,7 @@ object Items extends ItemManager(GendustryCreativeTabs.main) {
regSimpleItem("PowerModule")
regSimpleItem("GeneticsProcessor")
regSimpleItem("EnvProcessor")
regSimpleItem("UpgradeFrame")
regItem(CustomUpgradeFrame)
regSimpleItem("ClimateModule")
if (ForestryHelper.haveRoot("Trees")) {
@@ -0,0 +1,14 @@
package net.bdew.gendustry.custom
import net.bdew.lib.items.SimpleItem
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.item.ItemStack
import net.minecraft.util.EnumChatFormatting
import java.util
object CustomUpgradeFrame extends SimpleItem("UpgradeFrame"){
override def addInformation(p_77624_1_ : ItemStack, p_77624_2_ : EntityPlayer, p_77624_3_ : util.List[_], p_77624_4_ : Boolean): Unit ={
p_77624_3_.asInstanceOf[util.List[String]].add(EnumChatFormatting.RED + "DEPRECATED: Put in crafting table to get back !")
}
}
@@ -21,7 +21,7 @@ import net.minecraft.block.Block
import net.minecraft.client.renderer.texture.IIconRegister
import net.minecraft.entity.player.{EntityPlayer, EntityPlayerMP}
import net.minecraft.item.ItemStack
import net.minecraft.util.IIcon
import net.minecraft.util.{EnumChatFormatting, IIcon}
import net.minecraft.world.{IBlockAccess, World}
object BlockApiary extends Block(MachineMaterial) with HasTE[TileApiary] with BlockCoverable[TileApiary] with BlockGuiWrenchable with BlockTooltip with BlockKeepData {
@@ -52,6 +52,7 @@ object BlockApiary extends Block(MachineMaterial) with HasTE[TileApiary] with Bl
}
override def getTooltip(stack: ItemStack, player: EntityPlayer, advanced: Boolean): List[String] = {
return List(EnumChatFormatting.RED + "DEPRECATED: Put in crafting table to get back !")
if (stack.hasTagCompound && stack.getTagCompound.hasKey("data")) {
val data = stack.getTagCompound.getCompoundTag("data")
val inv = BlockTooltipHelper.getInventory(data)
@@ -10,7 +10,6 @@
package net.bdew.gendustry.machines.apiary.upgrades
import java.util
import cpw.mods.fml.relauncher.{Side, SideOnly}
import net.bdew.gendustry.Gendustry
import net.bdew.gendustry.api.ApiaryModifiers
@@ -21,7 +20,7 @@ import net.minecraft.client.renderer.texture.IIconRegister
import net.minecraft.creativetab.CreativeTabs
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.item.{Item, ItemStack}
import net.minecraft.util.IIcon
import net.minecraft.util.{EnumChatFormatting, IIcon}
object ItemApiaryUpgrade extends Item with IApiaryUpgrade with NamedItem {
var icons = Map.empty[Int, IIcon]
@@ -84,7 +83,8 @@ object ItemApiaryUpgrade extends Item with IApiaryUpgrade with NamedItem {
def getStackingId(stack: ItemStack) = Item.getIdFromItem(this) * Int.MaxValue + stack.getItemDamage
override def addInformation(stack: ItemStack, player: EntityPlayer, list: util.List[_], par4: Boolean) {
list.asInstanceOf[util.List[String]].addAll(getDisplayDetails(stack))
//list.asInstanceOf[util.List[String]].addAll(getDisplayDetails(stack))
list.asInstanceOf[util.List[String]].add(EnumChatFormatting.RED + "DEPRECATED: Put in crafting table to get back !")
}
def getMaxNumber(stack: ItemStack): Int = {
@@ -39,14 +39,14 @@ abstract class BaseRecipeHandler(val offX: Int, val offY: Int) extends TemplateR
super.drawExtras(recipe)
}
override def mouseClicked(gui: GuiRecipe, button: Int, recipe: Int): Boolean = {
override def mouseClicked(gui: GuiRecipe[_], button: Int, recipe: Int): Boolean = {
val relative = getMousePosition - gui.getRecipePosition(recipe) +(offX, offY) -(gui.guiLeft, gui.guiTop)
for (component <- arecipes.get(recipe).asInstanceOf[CachedRecipeWithComponents].components)
if (component.rect.contains(relative) && component.mouseClick(button)) return true
super.mouseClicked(gui, button, recipe)
}
override def handleTooltip(gui: GuiRecipe, tip: util.List[String], recipe: Int) = {
override def handleTooltip(gui: GuiRecipe[_], tip: util.List[String], recipe: Int) = {
import scala.collection.JavaConversions._
val relative = getMousePosition - gui.getRecipePosition(recipe) +(offX, offY) -(gui.guiLeft, gui.guiTop)
for (component <- arecipes.get(recipe).asInstanceOf[CachedRecipeWithComponents].components)
@@ -103,7 +103,7 @@ class ExtractorHandler extends BaseRecipeHandler(5, 13) {
}
}
override def handleItemTooltip(gui: GuiRecipe, stack: ItemStack, tip: util.List[String], recipe: Int): util.List[String] = {
override def handleItemTooltip(gui: GuiRecipe[_], stack: ItemStack, tip: util.List[String], recipe: Int): util.List[String] = {
if (stack == getRecipe(recipe).labware.item)
tip.add(Misc.toLocalF("gendustry.label.consume", MachineExtractor.labwareConsumeChance.toInt))
super.handleItemTooltip(gui, stack, tip, recipe)
@@ -100,7 +100,7 @@ class ImprinterHandler extends BaseRecipeHandler(5, 13) {
}
}
override def handleItemTooltip(gui: GuiRecipe, stack: ItemStack, tip: util.List[String], recipe: Int): util.List[String] = {
override def handleItemTooltip(gui: GuiRecipe[_], stack: ItemStack, tip: util.List[String], recipe: Int): util.List[String] = {
if (stack == getRecipe(recipe).labware.item)
tip += Misc.toLocalF("gendustry.label.consume", MachineImprinter.labwareConsumeChance.toInt)
super.handleItemTooltip(gui, stack, tip, recipe)
@@ -121,7 +121,7 @@ class MutatronHandler extends BaseRecipeHandler(5, 13) {
}
}
override def handleItemTooltip(gui: GuiRecipe, stack: ItemStack, tip: util.List[String], recipe: Int): util.List[String] = {
override def handleItemTooltip(gui: GuiRecipe[_], stack: ItemStack, tip: util.List[String], recipe: Int): util.List[String] = {
if (stack == getRecipe(recipe).labware.item)
tip += Misc.toLocalF("gendustry.label.consume", MachineMutatron.labwareConsumeChance.toInt)
if (stack == getRecipe(recipe).getResult.item) {
@@ -15,7 +15,10 @@ import codechicken.nei.recipe.{ICraftingHandler, IUsageHandler}
import cpw.mods.fml.common.event.FMLInterModComms
import net.bdew.gendustry.Gendustry
import net.bdew.gendustry.config.Config
import net.bdew.gendustry.custom.CustomUpgradeFrame
import net.bdew.gendustry.items.GeneSample
import net.bdew.gendustry.machines.apiary.BlockApiary
import net.bdew.gendustry.machines.apiary.upgrades.ItemApiaryUpgrade
import net.bdew.gendustry.machines.extractor.MachineExtractor
import net.bdew.gendustry.machines.imprinter.MachineImprinter
import net.bdew.gendustry.machines.liquifier.MachineLiquifier
@@ -25,6 +28,10 @@ import net.bdew.gendustry.machines.replicator.MachineReplicator
import net.bdew.gendustry.machines.sampler.MachineSampler
import net.bdew.gendustry.machines.transposer.MachineTransposer
import net.bdew.gendustry.misc.GeneticsCache
import net.minecraft.item.ItemStack
import java.util
import scala.collection.JavaConverters.collectionAsScalaIterableConverter
class NEIGendustryConfig extends IConfigureNEI {
def getName: String = "Gendustry"
@@ -82,5 +89,12 @@ class NEIGendustryConfig extends IConfigureNEI {
}
GuiContainerManager.addTooltipHandler(new SmeltingTooltipHandler)
API.hideItem(new ItemStack(BlockApiary))
val upgradelist = new util.ArrayList[ItemStack]()
ItemApiaryUpgrade.getSubItems(null, null, upgradelist)
for(i <- upgradelist.asScala.toList)
API.hideItem(i)
API.hideItem(new ItemStack(CustomUpgradeFrame))
}
}
@@ -105,7 +105,7 @@ import scala.collection.JavaConversions._
}
}
override def handleItemTooltip(gui: GuiRecipe, stack: ItemStack, tip: util.List[String], recipe: Int): util.List[String] = {
override def handleItemTooltip(gui: GuiRecipe[_], stack: ItemStack, tip: util.List[String], recipe: Int): util.List[String] = {
if (stack == getRecipe(recipe).labware.item)
tip += Misc.toLocalF("gendustry.label.consume", MachineSampler.labwareConsumeChance.toInt)
super.handleItemTooltip(gui, stack, tip, recipe)
@@ -22,8 +22,8 @@ class SmeltingTooltipHandler extends IContainerTooltipHandler {
override def handleItemDisplayName(gui: GuiContainer, stack: ItemStack, tip: util.List[String]) = tip
override def handleTooltip(gui: GuiContainer, mouseX: Int, mouseY: Int, tip: util.List[String]) = tip
override def handleItemTooltip(gui: GuiContainer, itemStack: ItemStack, mouseX: Int, mouseY: Int, tip: util.List[String]) = {
if (gui.isInstanceOf[GuiRecipe] && itemStack != null) {
val gr = gui.asInstanceOf[GuiRecipe]
if (gui.isInstanceOf[GuiRecipe[_]] && itemStack != null) {
val gr = gui.asInstanceOf[GuiRecipe[_]]
val handler = gr.currenthandlers.get(gr.recipetype)
if (handler.isInstanceOf[FurnaceRecipeHandler]) {
if (itemStack.getItem == GeneSample)
@@ -108,7 +108,7 @@ class TransposerHandler extends BaseRecipeHandler(5, 13) {
}
}
override def handleItemTooltip(gui: GuiRecipe, stack: ItemStack, tip: util.List[String], recipe: Int): util.List[String] = {
override def handleItemTooltip(gui: GuiRecipe[_], stack: ItemStack, tip: util.List[String], recipe: Int): util.List[String] = {
if (stack == getRecipe(recipe).labware.item)
tip += Misc.toLocalF("gendustry.label.consume", MachineTransposer.labwareConsumeChance.toInt)
super.handleItemTooltip(gui, stack, tip, recipe)