From bec37bfbe259a440cd3db02121aaac79df9c2ee6 Mon Sep 17 00:00:00 2001 From: Tom E Date: Sun, 8 Oct 2017 16:11:52 +0200 Subject: [PATCH] Add tooltip information to Seismic Reader Added some information about usage to the Seismic Reader, almost the same as the Seismic Vibrator. Adds feature #4743 --- .../common/item/ItemSeismicReader.java | 26 ++++++++++++++++++- .../resources/assets/mekanism/lang/en_us.lang | 1 + 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/main/java/mekanism/common/item/ItemSeismicReader.java b/src/main/java/mekanism/common/item/ItemSeismicReader.java index 67c114622..f82f249bc 100644 --- a/src/main/java/mekanism/common/item/ItemSeismicReader.java +++ b/src/main/java/mekanism/common/item/ItemSeismicReader.java @@ -2,9 +2,13 @@ package mekanism.common.item; import mekanism.api.Chunk3D; import mekanism.api.EnumColor; +import mekanism.client.MekKeyHandler; +import mekanism.client.MekanismKeyHandler; import mekanism.common.Mekanism; import mekanism.common.util.LangUtils; import mekanism.common.util.MekanismUtils; +import net.minecraft.client.settings.GameSettings; +import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; @@ -13,6 +17,8 @@ import net.minecraft.util.EnumHand; import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; +import java.util.List; + public class ItemSeismicReader extends ItemEnergized { public static final double ENERGY_USAGE = 250; @@ -27,7 +33,25 @@ public class ItemSeismicReader extends ItemEnergized { return false; } - + + @Override + public void addInformation(ItemStack itemstack, World world, List list, ITooltipFlag flag) + { + if(!MekKeyHandler.getIsKeyPressed(MekanismKeyHandler.sneakKey)) + { + list.add(LangUtils.localize("tooltip.hold") + " " + EnumColor.INDIGO + GameSettings.getKeyDisplayString(MekanismKeyHandler.sneakKey.getKeyCode()) + EnumColor.GREY + " " + LangUtils.localize("tooltip.forDetails") + "."); + list.add(LangUtils.localize("tooltip.hold") + " " + EnumColor.AQUA + GameSettings.getKeyDisplayString(MekanismKeyHandler.sneakKey.getKeyCode()) + EnumColor.GREY + " " + LangUtils.localize("tooltip.and") + " " + EnumColor.AQUA + GameSettings.getKeyDisplayString(MekanismKeyHandler.modeSwitchKey.getKeyCode()) + EnumColor.GREY + " " + LangUtils.localize("tooltip.forDesc") + "."); + } + else if(!MekKeyHandler.getIsKeyPressed(MekanismKeyHandler.modeSwitchKey)) + { + super.addInformation(itemstack, world, list, flag); + } + else + { + list.addAll(MekanismUtils.splitTooltip(LangUtils.localize("tooltip.mekanism.SeismicReader"), itemstack)); + } + } + @Override public ActionResult onItemRightClick(World world, EntityPlayer entityplayer, EnumHand hand) { diff --git a/src/main/resources/assets/mekanism/lang/en_us.lang b/src/main/resources/assets/mekanism/lang/en_us.lang index 8de28c263..8119323c5 100644 --- a/src/main/resources/assets/mekanism/lang/en_us.lang +++ b/src/main/resources/assets/mekanism/lang/en_us.lang @@ -805,6 +805,7 @@ tooltip.flamethrower.modeBump=Flamethrower mode bumped to tooltip.seismicReader.needsEnergy=Not enough energy to interpret vibration tooltip.seismicReader.noVibrations=Unable to discover any vibrations +tooltip.mekanism.SeismicReader=A portable machine that uses seismic vibrations to provide information on differing layers of the world. tooltip.Bin=A block used to store large quantities of a single type of item. tooltip.TeleporterFrame=The frame used to construct the Teleporter multiblock, allowing a portal to be generated within the structure.