mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-18 03:25:38 +00:00
fix hover crash to unnamed item
This commit is contained in:
1 parent
83696ca9ae
commit
3b3227b09d
1 file changed
+9
-2
@@ -30,6 +30,7 @@ public class ItemZoom extends Widget implements IContainerInputHandler {
|
||||
private Boolean previousKeyboardRepeatEnabled = null;
|
||||
|
||||
private ItemStack stack = null;
|
||||
private String displayName = "";
|
||||
private int availableAreaWidth = 0;
|
||||
private float xPosition = 0;
|
||||
private float yPosition = 0;
|
||||
@@ -61,8 +62,7 @@ public class ItemZoom extends Widget implements IContainerInputHandler {
|
||||
GL11.glPopMatrix();
|
||||
|
||||
if (NEIClientConfig.getBooleanSetting("inventory.itemzoom.showName")) {
|
||||
String dispalyName = NEIClientUtils
|
||||
.cropText(fontRenderer, this.stack.getDisplayName(), this.availableAreaWidth);
|
||||
String dispalyName = NEIClientUtils.cropText(fontRenderer, this.displayName, this.availableAreaWidth);
|
||||
drawStringC(
|
||||
dispalyName,
|
||||
(int) ((this.xPosition + size / 2) * screenScale),
|
||||
@@ -114,9 +114,16 @@ public class ItemZoom extends Widget implements IContainerInputHandler {
|
||||
this.xPosition += (gui.guiLeft + gui.xSize) * screenScale;;
|
||||
}
|
||||
|
||||
try {
|
||||
this.displayName = stack.getDisplayName();
|
||||
} catch (Throwable ignored) {
|
||||
this.displayName = "Unnamed";
|
||||
}
|
||||
|
||||
this.stack = StackInfo.loadFromNBT(StackInfo.itemStackToNBT(stack), 0);
|
||||
} else {
|
||||
this.stack = null;
|
||||
this.displayName = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user