diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-05-28 16:58:39 +1000 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-05-28 16:58:39 +1000 |
commit | c0669bb2a46b898141643be6b8f621c964c32c8b (patch) | |
tree | 0163a8ea62a85eb006eea43bd5d4d248202685b5 /src/Java/gtPlusPlus/core/handler | |
parent | 3915e405a70be4d9523ace59a9194a3757cb5a37 (diff) | |
download | GT5-Unofficial-c0669bb2a46b898141643be6b8f621c964c32c8b.tar.gz GT5-Unofficial-c0669bb2a46b898141643be6b8f621c964c32c8b.tar.bz2 GT5-Unofficial-c0669bb2a46b898141643be6b8f621c964c32c8b.zip |
+ Added support for IC2C. (Support means that the game will load if this mod exists.. maybe? Should fix #287, I guess.)
+ Added tooltips to turbines if the animated textures are on, if user holds shift full tooltip will be shown.
- Removed some Thaumcraft logging.
% More changes to fix NEI handler for Multiblocks.
% Moved Tooltip handling for a few things from the EIO handler to a generic handler.
$ Fixed %'s not showing (third time lucky) on NEI pages.
Diffstat (limited to 'src/Java/gtPlusPlus/core/handler')
-rw-r--r-- | src/Java/gtPlusPlus/core/handler/events/GeneralTooltipEventHandler.java | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/core/handler/events/GeneralTooltipEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/GeneralTooltipEventHandler.java new file mode 100644 index 0000000000..6c940371b3 --- /dev/null +++ b/src/Java/gtPlusPlus/core/handler/events/GeneralTooltipEventHandler.java @@ -0,0 +1,80 @@ +package gtPlusPlus.core.handler.events; + +import cpw.mods.fml.common.eventhandler.SubscribeEvent; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +import gregtech.api.enums.ItemList; +import gtPlusPlus.core.handler.events.BlockEventHandler; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.sys.KeyboardUtils; +import net.minecraftforge.event.entity.player.ItemTooltipEvent; + +public class GeneralTooltipEventHandler { + + ItemStack[] mGregtechTurbines = new ItemStack[6]; + String mTurbine; + String mExtra; + + @SubscribeEvent + public void onItemTooltip(ItemTooltipEvent event){ + + if (CORE.ConfigSwitches.chanceToDropFluoriteOre > 0) { + if (!BlockEventHandler.blockLimestone.isEmpty()) { + for (ItemStack h : BlockEventHandler.blockLimestone) { + if (h != null && Block.getBlockFromItem(h.getItem()) == Block.getBlockFromItem(event.itemStack.getItem())) { + if (ItemUtils.getModId(h) != null && !ItemUtils.getModId(h).toLowerCase().contains("biomesoplenty")) { + event.toolTip.add("May contain Fluorite Ore"); + } + } + } + } + if (!BlockEventHandler.oreLimestone.isEmpty()) { + for (ItemStack h : BlockEventHandler.oreLimestone) { + if (h != null && Block.getBlockFromItem(h.getItem()) == Block.getBlockFromItem(event.itemStack.getItem())) { + if (ItemUtils.getModId(h) != null && !ItemUtils.getModId(h).toLowerCase().contains("biomesoplenty")) { + event.toolTip.add("May contain Fluorite Ore"); + } + } + } + } + } + + + if (CORE.ConfigSwitches.enableAnimatedTurbines) { + boolean shift = false; + try { + + if (KeyboardUtils.isShiftKeyDown()) { + shift = true; + mTurbine = "Animated Turbines can be disabled in the GT++ config"; + } + else { + mTurbine = EnumChatFormatting.ITALIC+"<Hold Shift>"+EnumChatFormatting.RESET; + } + for (int t=0;t<6;t++) { + if (mGregtechTurbines[t] != null) { + if (ItemStack.areItemStacksEqual(event.itemStack, mGregtechTurbines[t])){ + event.toolTip.add(mTurbine); + if (shift) { + if (mExtra == null) { + mExtra = CORE.GT_Tooltip; + } + event.toolTip.add(mExtra); + } + } + } + else { + mGregtechTurbines[t] = (t == 0 ? ItemList.Generator_Steam_Turbine_LV.get(1) : (t == 1 ? ItemList.Generator_Steam_Turbine_MV.get(1) : (t == 2 ? ItemList.Generator_Steam_Turbine_HV.get(1) : (t == 3 ? ItemList.Generator_Gas_Turbine_LV.get(1) : (t == 4 ? ItemList.Generator_Gas_Turbine_MV.get(1) : (ItemList.Generator_Gas_Turbine_HV.get(1))))))); + } + } + } + catch (Throwable t) {} + } + + } + +} |