mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-17 02:55:04 +00:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e93d23e444 | ||
|
|
748cfe3754 | ||
|
|
b64d104d7e |
No files matched your search
@@ -27,6 +27,13 @@ If you have issues with NEI outside of the GTNH modpack you may report them in t
|
||||
* Remove TMI style
|
||||
* Removed inventory Load/Save state
|
||||
|
||||
## Development
|
||||
Before launching, you need to add
|
||||
```
|
||||
-Dfml.coreMods.load=codechicken.nei.asm.NEICorePlugin
|
||||
```
|
||||
as a command line argument to the VM.
|
||||
|
||||
## License
|
||||
|
||||
GTNH Modifications Copyright (c) 2019-2022 mitchej123 and the GTNH Team
|
||||
|
||||
@@ -37,6 +37,11 @@ public class ItemList {
|
||||
|
||||
private static final HashSet<Item> erroredItems = new HashSet<>();
|
||||
private static final HashSet<String> stackTraces = new HashSet<>();
|
||||
/**
|
||||
* Unlike {@link LayoutManager#itemsLoaded}, this indicates whether item loading is
|
||||
* actually finished or not.
|
||||
*/
|
||||
public static boolean loadFinished;
|
||||
|
||||
public static class EverythingItemFilter implements ItemFilter {
|
||||
@Override
|
||||
@@ -179,6 +184,7 @@ public class ItemList {
|
||||
public void execute() {
|
||||
// System.out.println("Executing NEI Item Loading");
|
||||
ThreadOperationTimer timer = getTimer(NEIClientConfig.getItemLoadingTimeout());
|
||||
loadFinished = false;
|
||||
|
||||
LinkedList<ItemStack> items = new LinkedList<>();
|
||||
LinkedList<ItemStack> permutations = new LinkedList<>();
|
||||
@@ -218,6 +224,8 @@ public class ItemList {
|
||||
for (ItemsLoadedCallback callback : loadCallbacks) callback.itemsLoaded();
|
||||
|
||||
updateFilter.restart();
|
||||
|
||||
loadFinished = true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -73,6 +73,11 @@ public class ItemPanel extends PanelWidget {
|
||||
super.drawSlotOutline(focused, slotIdx, rect);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessageOnEmpty() {
|
||||
return ItemList.loadFinished ? null : NEIClientUtils.translate("itempanel.loading");
|
||||
}
|
||||
}
|
||||
|
||||
public ItemPanel() {
|
||||
|
||||
@@ -41,6 +41,8 @@ public class ItemsGrid {
|
||||
|
||||
protected boolean[] invalidSlotMap;
|
||||
|
||||
protected Label messageLabel = new Label(getMessageOnEmpty(), true);
|
||||
|
||||
@Nullable
|
||||
private Framebuffer framebuffer = null;
|
||||
|
||||
@@ -104,6 +106,9 @@ public class ItemsGrid {
|
||||
rows = height / SLOT_SIZE;
|
||||
|
||||
paddingLeft = (width % SLOT_SIZE) / 2;
|
||||
|
||||
messageLabel.x = marginLeft + width / 2;
|
||||
messageLabel.y = marginTop + height / 2;
|
||||
}
|
||||
|
||||
public void shiftPage(int shift) {
|
||||
@@ -305,6 +310,12 @@ public class ItemsGrid {
|
||||
}
|
||||
}
|
||||
|
||||
public void setVisible() {
|
||||
if (getItems().isEmpty() && getMessageOnEmpty() != null) {
|
||||
LayoutManager.addWidget(messageLabel);
|
||||
}
|
||||
}
|
||||
|
||||
protected void drawItem(Rectangle4i rect, int idx) {
|
||||
GuiContainerManager.drawItem(rect.x + 1, rect.y + 1, getItem(idx));
|
||||
}
|
||||
@@ -345,4 +356,8 @@ public class ItemsGrid {
|
||||
|
||||
return r >= rows || c >= columns || !isInvalidSlot(slt);
|
||||
}
|
||||
|
||||
public String getMessageOnEmpty() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -112,6 +112,12 @@ public class LayoutManager
|
||||
|
||||
public static HashMap<Integer, LayoutStyle> layoutStyles = new HashMap<>();
|
||||
|
||||
/**
|
||||
* This is set to true immediately after item loading thread is started,
|
||||
* to prevent duplicated loading thread from being executed.
|
||||
* If you want to know if item list is actually finished loading,
|
||||
* Use {@link ItemList#loadFinished} instead.
|
||||
*/
|
||||
public static boolean itemsLoaded = false;
|
||||
|
||||
/**
|
||||
|
||||
@@ -160,6 +160,7 @@ public abstract class PanelWidget extends Widget {
|
||||
LayoutManager.addWidget(pagePrev);
|
||||
LayoutManager.addWidget(pageNext);
|
||||
LayoutManager.addWidget(pageLabel);
|
||||
grid.setVisible();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -163,6 +163,7 @@ public class GuiPanelSettings extends GuiScreenWidget {
|
||||
final int rows = (h - (PANEL_SIZE + 2) * 2) / ItemsGrid.SLOT_SIZE;
|
||||
final int paddingLeft = (w % ItemsGrid.SLOT_SIZE) / 2;
|
||||
final ArrayList<ItemStack> items = ItemPanels.itemPanel.getItems();
|
||||
if (items.isEmpty()) return;
|
||||
|
||||
for (int r = 0; r < rows; r++) {
|
||||
for (int c = 0; c < columns; c++) {
|
||||
|
||||
@@ -11,6 +11,7 @@ nei.bookmark.toggle.tip=Toggle visibility of the Bookmark Panel
|
||||
nei.bookmark.viewmode.toggle.tip=Toggle Bookmark View Mode
|
||||
|
||||
nei.itempanel.quantity.default=One stack
|
||||
nei.itempanel.loading=Loading Item List...
|
||||
|
||||
nei.enchant=Enchant
|
||||
nei.enchant.level=Level
|
||||
|
||||
Reference in new issue
Block a user