mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-17 02:45:13 +00:00
Use vanilla keybind textcomp to get key names instead of our own method
This commit is contained in:
1 parent
00ec6f8b08
commit
fbba1ffe7e
3 files changed
+9
-21
No files matched your search
@@ -302,19 +302,6 @@ public final class RenderHelper {
|
||||
GL11.glDisable(GL11.GL_STENCIL_TEST);
|
||||
}
|
||||
|
||||
public static String getKeyDisplayString(String keyName) {
|
||||
String key = null;
|
||||
KeyBinding[] keys = Minecraft.getInstance().gameSettings.keyBindings;
|
||||
for (KeyBinding otherKey : keys) {
|
||||
if (otherKey.getKeyDescription().equals(keyName)) {
|
||||
key = otherKey.getLocalizedName();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param color Must include alpha
|
||||
*/
|
||||
|
||||
@@ -15,6 +15,8 @@ import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.KeybindTextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
import vazkii.botania.api.recipe.IManaInfusionRecipe;
|
||||
@@ -91,9 +93,10 @@ public class ManaInfusionProcessor implements IComponentProcessor {
|
||||
case "drop":
|
||||
return I18n.format("botaniamisc.drop") + TextFormatting.BOLD + " (?)";
|
||||
case "dropTip0":
|
||||
case "dropTip1":
|
||||
return I18n.format("botaniamisc.dropTip" + key.substring(7),
|
||||
TextFormatting.GREEN + RenderHelper.getKeyDisplayString("key.drop") + TextFormatting.WHITE);
|
||||
case "dropTip1": {
|
||||
String drop = new KeybindTextComponent("key.drop").applyTextStyle(TextFormatting.GREEN).getFormattedText();
|
||||
return I18n.format("botaniamisc.dropTip" + key.substring(7), drop);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.potion.Effects;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.KeybindTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
@@ -67,11 +68,8 @@ public abstract class ItemBauble extends Item implements ICosmeticAttachable, IP
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void addHiddenTooltip(ItemStack stack, World world, List<ITextComponent> tooltip, ITooltipFlag flags) {
|
||||
String key = vazkii.botania.client.core.helper.RenderHelper.getKeyDisplayString("key.curios.open.desc");
|
||||
|
||||
if (key != null) {
|
||||
tooltip.add(new TranslationTextComponent("botania.baubletooltip", key));
|
||||
}
|
||||
ITextComponent key = new KeybindTextComponent("key.curios.open.desc");
|
||||
tooltip.add(new TranslationTextComponent("botania.baubletooltip", key));
|
||||
|
||||
ItemStack cosmetic = getCosmeticItem(stack);
|
||||
if (!cosmetic.isEmpty()) {
|
||||
|
||||
Reference in new issue
Block a user