Various CPU and RAM improvements (#1015)

Co-authored-by: Martin Robertz <[email protected]>
This commit is contained in:
boubou19andMartin Robertz authored and GitHub committed 2026-09-03 00:07:25 +03:00
1 parent 866b796411
commit 3f38e6f39b
9 files changed
+236 -54

No files matched your search

@@ -0,0 +1,36 @@
package codechicken.nei.api;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.Collections;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import org.junit.jupiter.api.Test;
import codechicken.lib.vec.Rectangle4i;
public class GuiInfoTest {
@Test
void checksProvidedHandlerSnapshot() {
GuiContainer gui = mock(GuiContainer.class);
INEIGuiHandler handler = mock(INEIGuiHandler.class);
when(handler.hideItemPanelSlot(gui, 1, 2, 3, 4)).thenReturn(true);
assertTrue(GuiInfo.hideItemPanelSlot(gui, new Rectangle4i(1, 2, 3, 4), new INEIGuiHandler[] { handler }));
}
@Test
void buttonEdgeContactDoesNotOverlap() {
GuiContainer gui = mock(GuiContainer.class);
gui.buttonList = Collections.singletonList(new GuiButton(0, 10, 10, 10, 10, ""));
assertTrue(GuiInfo.hideItemPanelSlot(gui, new Rectangle4i(19, 19, 1, 1), new INEIGuiHandler[0]));
assertFalse(GuiInfo.hideItemPanelSlot(gui, new Rectangle4i(20, 10, 1, 1), new INEIGuiHandler[0]));
}
}