mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-21 12:32:23 +00:00
Fix #492 Add electron tube info to tooltip
This commit is contained in:
1 parent
f6b92ad6ac
commit
62fcb24160
3 files changed
+76
-3
No files matched your search
@@ -73,6 +73,14 @@ public class ItemSolderingIron extends ItemForestry implements ISolderingIron {
|
||||
recipes.add(new CircuitRecipe(layout, resource, circuit));
|
||||
}
|
||||
|
||||
public static ICircuit getCircuit(ICircuitLayout layout, ItemStack resource) {
|
||||
CircuitRecipe circuitRecipe = getMatchingRecipe(layout, resource);
|
||||
if (circuitRecipe == null) {
|
||||
return null;
|
||||
}
|
||||
return circuitRecipe.circuit;
|
||||
}
|
||||
|
||||
public static CircuitRecipe getMatchingRecipe(ICircuitLayout layout, ItemStack resource) {
|
||||
if (layout == null || resource == null) {
|
||||
return null;
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.items;
|
||||
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.circuits.ICircuit;
|
||||
import forestry.api.circuits.ICircuitLayout;
|
||||
import forestry.core.circuits.ItemSolderingIron;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
public class ItemElectronTube extends ItemOverlay {
|
||||
|
||||
public ItemElectronTube(CreativeTabs tab, OverlayInfo... overlays) {
|
||||
super(tab, overlays);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean flag) {
|
||||
|
||||
Multimap<ICircuitLayout, ICircuit> circuits = ArrayListMultimap.create();
|
||||
for (ICircuitLayout circuitLayout : ChipsetManager.circuitRegistry.getRegisteredLayouts().values()) {
|
||||
ICircuit circuit = ItemSolderingIron.SolderManager.getCircuit(circuitLayout, itemstack);
|
||||
if (circuit != null) {
|
||||
circuits.put(circuitLayout, circuit);
|
||||
}
|
||||
}
|
||||
|
||||
if (circuits.size() > 0) {
|
||||
if (Proxies.common.isShiftDown()) {
|
||||
for (ICircuitLayout circuitLayout : circuits.keys()) {
|
||||
String circuitLayoutName = circuitLayout.getUsage();
|
||||
list.add(EnumChatFormatting.WHITE.toString() + EnumChatFormatting.UNDERLINE + circuitLayoutName);
|
||||
for (ICircuit circuit : circuits.get(circuitLayout)) {
|
||||
circuit.addTooltip(list);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
list.add(EnumChatFormatting.ITALIC + "<" + StringUtil.localize("gui.tooltip.tmi") + ">");
|
||||
}
|
||||
} else {
|
||||
list.add("<" + StringUtil.localize("gui.noeffect") + ">");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,9 +66,9 @@ import forestry.core.items.ItemForestryPickaxe;
|
||||
import forestry.core.items.ItemForestryShovel;
|
||||
import forestry.core.items.ItemFruit;
|
||||
import forestry.core.items.ItemMisc;
|
||||
import forestry.core.items.ItemOverlay;
|
||||
import forestry.core.items.ItemOverlay.OverlayInfo;
|
||||
import forestry.core.items.ItemPipette;
|
||||
import forestry.core.items.ItemElectronTube;
|
||||
import forestry.core.items.ItemTypedBlock;
|
||||
import forestry.core.items.ItemWrench;
|
||||
import forestry.core.proxy.Proxies;
|
||||
@@ -216,7 +216,7 @@ public class PluginCore extends ForestryPlugin {
|
||||
Color tubeCoverGold = new Color(0xFFF87E);
|
||||
Color tubeCoverEnder = new Color(0x255661);
|
||||
|
||||
ForestryItem.tubes.registerItem(new ItemOverlay(CreativeTabForestry.tabForestry,
|
||||
ForestryItem.tubes.registerItem(new ItemElectronTube(CreativeTabForestry.tabForestry,
|
||||
new OverlayInfo("ex-0", tubeCoverNormal, new Color(0xe3b78e)),
|
||||
new OverlayInfo("ex-1", tubeCoverNormal, new Color(0xE6F8FF)),
|
||||
new OverlayInfo("ex-2", tubeCoverNormal, new Color(0xddc276)),
|
||||
@@ -229,7 +229,8 @@ public class PluginCore extends ForestryPlugin {
|
||||
new OverlayInfo("ex-9", tubeCoverNormal, new Color(0x00CC41)),
|
||||
new OverlayInfo("ex-10", tubeCoverNormal, new Color(0x579CD9)),
|
||||
new OverlayInfo("ex-11", tubeCoverNormal, new Color(0x1c57c6)),
|
||||
new OverlayInfo("ex-12", tubeCoverEnder, new Color(0x33adad))), "thermionicTubes");
|
||||
new OverlayInfo("ex-12", tubeCoverEnder, new Color(0x33adad))
|
||||
), "thermionicTubes");
|
||||
|
||||
// / CARTONS
|
||||
ForestryItem.carton.registerItem((new ItemForestry()), "carton");
|
||||
|
||||
Reference in new issue
Block a user