diff options
| author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-10-03 16:47:35 +0100 |
|---|---|---|
| committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-10-03 16:47:35 +0100 |
| commit | 734e7a1498ef6ca48f95f075aaa66372639c9618 (patch) | |
| tree | e18d6ec9acaf4aee2d85155d03a91df9769fe9be /src/Java/gtPlusPlus/xmod/galacticraft/handler | |
| parent | a5d2b84eabdd5b75d409d8519b7831ecfd0061b9 (diff) | |
| download | GT5-Unofficial-734e7a1498ef6ca48f95f075aaa66372639c9618.tar.gz GT5-Unofficial-734e7a1498ef6ca48f95f075aaa66372639c9618.tar.bz2 GT5-Unofficial-734e7a1498ef6ca48f95f075aaa66372639c9618.zip | |
$ Fixed COFH OreDictionaryArbiter via ASM.
$ Cleaned up GC Fuel ASM, Rockets are now tiered.
% Added ability for Rover to use Diesel still.
% Added Tooltip to the GC Fuel Loader, showing what Tier requires which fuel.
> Bug still exists on sending packets, which may cause the client to boot the player back to the menu.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/galacticraft/handler')
| -rw-r--r-- | src/Java/gtPlusPlus/xmod/galacticraft/handler/HandlerTooltip_GC.java | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/xmod/galacticraft/handler/HandlerTooltip_GC.java b/src/Java/gtPlusPlus/xmod/galacticraft/handler/HandlerTooltip_GC.java new file mode 100644 index 0000000000..9075666b8b --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/galacticraft/handler/HandlerTooltip_GC.java @@ -0,0 +1,73 @@ +package gtPlusPlus.xmod.galacticraft.handler; + +import java.lang.reflect.Field; + +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import gtPlusPlus.core.item.chemistry.RocketFuels; +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import net.minecraftforge.event.entity.player.ItemTooltipEvent; +import net.minecraftforge.fluids.Fluid; + +public class HandlerTooltip_GC { + + private static Item mItemBlock; + private static Block mBlock; + private static Class<?> oMainClass; + private static Class<?> oFuelLoaderClass; + private static String[] mFuelNames; + + @SubscribeEvent + public void onItemTooltip(ItemTooltipEvent event) { + if (LoadedMods.GalacticraftCore) { + + if (mBlock == null) { + try { + Class<?> GCBlocks = Class.forName("micdoodle8.mods.galacticraft.core.blocks.GCBlocks"); + if (GCBlocks != null) { + oMainClass = GCBlocks; + + Class<?> GCFuelLoader = Class + .forName("micdoodle8.mods.galacticraft.core.blocks.BlockFuelLoader"); + + if (GCFuelLoader != null) { + oFuelLoaderClass = GCFuelLoader; + } + + Field aField = ReflectionUtils.getField(GCBlocks, "fuelLoader"); + if (aField != null) { + Block aBlock = (Block) aField.get(null); + if (aBlock != null) { + mBlock = aBlock; + mItemBlock = Item.getItemFromBlock(mBlock); + } + } + } + } catch (Throwable t) { + } + } + if (mFuelNames == null || mFuelNames.length == 0) { + mFuelNames = new String[RocketFuels.mValidRocketFuels.size()]; + int slot = 0; + for (Fluid f : RocketFuels.mValidRocketFuels.values()) { + mFuelNames[slot++] = f.getLocalizedName(); + } + } + if (mItemBlock != null) { + Item aTempItem = event.itemStack.getItem(); + Block aTempBlock = Block.getBlockFromItem(aTempItem); + if (aTempItem == mItemBlock || oFuelLoaderClass.isInstance(aTempBlock) + || event.itemStack.getUnlocalizedName().toLowerCase().contains("fuelloader")) { + int aTier = 0; + for (String s : mFuelNames) { + if (s != null) { + event.toolTip.add("Tier "+aTier+": "+s); + } + } + } + } + } + } +} |
