Fixed bauble tooltips breaking with certain bindings

Prevents some items tooltips and in-inventory rendering from breaking if the Baubles key is unbound, bound to a mouse button, or an abnormal keyboard key.
This commit is contained in:
jss2a98aj committed 2022-12-24 02:35:48 -05:00
1 parent 84e758e450
commit 4111e5c3fe
2 files changed
+4 -3

No files matched your search

@@ -17,11 +17,11 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.core.handler.ClientTickHandler;
@@ -243,7 +243,7 @@ public final class RenderHelper {
KeyBinding[] keys = Minecraft.getMinecraft().gameSettings.keyBindings;
for(KeyBinding otherKey : keys)
if(otherKey.getKeyDescription().equals(keyName)) {
key = Keyboard.getKeyName(otherKey.getKeyCode());
key = GameSettings.getKeyDisplayString(otherKey.getKeyCode());
break;
}
@@ -94,8 +94,9 @@ public abstract class ItemBauble extends ItemMod implements IBauble, ICosmeticAt
String key = vazkii.botania.client.core.helper.RenderHelper.getKeyDisplayString("Baubles Inventory");
if(key != null)
if(key != null && !key.equals("NONE")) {
addStringToTooltip(StatCollector.translateToLocal("botania.baubletooltip").replaceAll("%key%", key), par3List);
}
ItemStack cosmetic = getCosmeticItem(par1ItemStack);
if(cosmetic != null)