From c0669bb2a46b898141643be6b8f621c964c32c8b Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Mon, 28 May 2018 16:58:39 +1000 Subject: + 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. --- .../handler/events/GeneralTooltipEventHandler.java | 80 ++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 src/Java/gtPlusPlus/core/handler/events/GeneralTooltipEventHandler.java (limited to 'src/Java/gtPlusPlus/core/handler') 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+""+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) {} + } + + } + +} -- cgit