mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-16 02:04:59 +00:00
Add option to cache item grid rendering (#250)
* Add option to cache item grid rendering * Fix highlighting for bookmarks * Tweak GL state slightly * Fix focus box being in the wrong place * Fix flickering for one frame when searching * Prevent potion effects from rendering over NEI slots Fixes #231 * Invalidate the buffer if `invalidSlotMap` changes * Clean up imports * Delay blitting until after the buffer is refreshed but still avoid waiting for the next frame * Refactor slot focus logic to handle highlighting multiple slots * Refresh grid when sorting bookmarks * Minor code cleanup, fix some more hovering issues * Remove `slotNeedsOutline`, it is now redundant * Remove focus parameter from drawItem
This commit is contained in:
1 parent
72d44fd711
commit
8f7d698e7d
7 files changed
+192
-41
No files matched your search
@@ -4,6 +4,8 @@ import codechicken.lib.vec.Rectangle4i;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.drawRect;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -67,23 +69,21 @@ public class ItemPanel extends PanelWidget
|
||||
if (newItems != null) {
|
||||
realItems = newItems;
|
||||
newItems = null;
|
||||
refreshBuffer = true;
|
||||
}
|
||||
|
||||
super.refresh(gui);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawItem(Rectangle4i rect, int idx, ItemPanelSlot focus)
|
||||
{
|
||||
|
||||
if (PresetsWidget.inEditMode() && !PresetsWidget.isHidden(getItem(idx))) {
|
||||
drawRect(rect.x, rect.y, rect.w, rect.h, 0xee555555);
|
||||
protected void drawSlotOutline(@Nullable ItemPanelSlot focused, int slotIdx, Rectangle4i rect) {
|
||||
if (PresetsWidget.inEditMode()) {
|
||||
if(!PresetsWidget.isHidden(getItem(slotIdx)))
|
||||
drawRect(rect.x, rect.y, rect.w, rect.h, 0xee555555);
|
||||
} else {
|
||||
super.drawSlotOutline(focused, slotIdx, rect);
|
||||
}
|
||||
|
||||
super.drawItem(rect, idx, PresetsWidget.inEditMode()? null: focus);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public ItemPanel()
|
||||
|
||||
Reference in new issue
Block a user