Expose some members in GuiContainerManager (#324)

This commit is contained in:
miozune authored and GitHub committed 2022-12-21 10:37:43 +01:00
1 parent 336c7dc621
commit 8c4d609e4c
1 file changed
+13 -10
@@ -152,7 +152,7 @@ public class GuiContainerManager {
return namelist;
}
protected static String itemCountDetails(ItemStack stack) {
public static String itemCountDetails(ItemStack stack) {
final FluidStack fluid = StackInfo.getFluid(stack);
int maxStackSize = stack.getMaxStackSize();
int stackSize = stack.stackSize;
@@ -336,7 +336,7 @@ public class GuiContainerManager {
}
private int clickHandled = 0;
private final List<IContainerTooltipHandler> instanceTooltipHandlers;
public final List<IContainerTooltipHandler> instanceTooltipHandlers;
public GuiContainerManager(GuiContainer screen) {
window = screen;
@@ -479,14 +479,7 @@ public class GuiContainerManager {
font = getFontRenderer(stack);
if (stack != null) {
tooltip = itemDisplayNameMultiline(stack, window, true);
if (stack.stackSize != Integer.MAX_VALUE && NEIClientUtils.shiftKey()) {
final String itemCount = itemCountDetails(stack);
if (itemCount != null) {
tooltip.add(String.format(EnumChatFormatting.GRAY + itemCount + EnumChatFormatting.RESET));
}
}
applyItemCountDetails(tooltip, stack);
}
synchronized (instanceTooltipHandlers) {
@@ -506,6 +499,16 @@ public class GuiContainerManager {
return window.mc.thePlayer.inventory.getItemStack() == null;
}
public static void applyItemCountDetails(List<String> tooltip, ItemStack stack) {
if (stack.stackSize != Integer.MAX_VALUE && NEIClientUtils.shiftKey()) {
final String itemCount = itemCountDetails(stack);
if (itemCount != null) {
tooltip.add(String.format(EnumChatFormatting.GRAY + itemCount + EnumChatFormatting.RESET));
}
}
}
public void renderSlotUnderlay(Slot slot) {
for (IContainerDrawHandler drawHandler : drawHandlers) drawHandler.renderSlotUnderlay(window, slot);
}