mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-10-26 14:24:07 +00:00
Show Items Loading Message (#745)
This commit is contained in:
1 parent
d5e919a9cd
commit
f7f0596fda
4 files changed
+19
-18
No files matched your search
@@ -281,8 +281,6 @@ public abstract class ItemsGrid<T extends ItemsGrid.ItemsGridSlot, M extends Ite
|
||||
|
||||
protected boolean[] invalidSlotMap;
|
||||
|
||||
protected Label messageLabel = new Label(getMessageOnEmpty(), true);
|
||||
|
||||
protected ScreenCapture screenCapture = null;
|
||||
|
||||
public ArrayList<ItemStack> getItems() {
|
||||
@@ -360,9 +358,6 @@ public abstract class ItemsGrid<T extends ItemsGrid.ItemsGridSlot, M extends Ite
|
||||
rows = height / SLOT_SIZE;
|
||||
|
||||
paddingLeft = (width % SLOT_SIZE) / 2;
|
||||
|
||||
messageLabel.x = marginLeft + width / 2;
|
||||
messageLabel.y = marginTop + height / 2;
|
||||
}
|
||||
|
||||
public void shiftPage(int shift) {
|
||||
@@ -566,12 +561,6 @@ public abstract class ItemsGrid<T extends ItemsGrid.ItemsGridSlot, M extends Ite
|
||||
afterDrawItems(mousex, mousey, mouseContext);
|
||||
}
|
||||
|
||||
public void setVisible() {
|
||||
if (getItems().isEmpty() && getMessageOnEmpty() != null) {
|
||||
LayoutManager.addWidget(messageLabel);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean contains(int px, int py) {
|
||||
final Rectangle4i rect = new Rectangle4i(
|
||||
marginLeft + paddingLeft,
|
||||
@@ -586,7 +575,4 @@ public abstract class ItemsGrid<T extends ItemsGrid.ItemsGridSlot, M extends Ite
|
||||
return !isInvalidSlot(columns * getRowIndex(py) + getColumnIndex(px));
|
||||
}
|
||||
|
||||
public String getMessageOnEmpty() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import java.util.Set;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.ItemsGrid.ItemsGridSlot;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
@@ -237,9 +238,18 @@ public class ItemsPanelGrid extends ItemsGrid<ItemsPanelGrid.ItemsPanelGridSlot,
|
||||
Math.min((int) (color.getAlpha() + (255f / 5) * 2), 255));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessageOnEmpty() {
|
||||
return ItemList.loadFinished ? null : NEIClientUtils.translate("itempanel.loading");
|
||||
public void draw(int mousex, int mousey) {
|
||||
if (ItemList.loadFinished) {
|
||||
super.draw(mousex, mousey);
|
||||
} else {
|
||||
GuiDraw.drawStringC(
|
||||
NEIClientUtils
|
||||
.cropText(GuiDraw.fontRenderer, NEIClientUtils.translate("itempanel.loading"), width - 10),
|
||||
marginLeft + width / 2,
|
||||
marginTop + height / 2,
|
||||
0xffffff,
|
||||
true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -882,6 +882,10 @@ public class NEIClientConfig {
|
||||
}
|
||||
|
||||
public static void unloadWorld() {
|
||||
if (world == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ItemPanels.bookmarkPanel != null) {
|
||||
ItemPanels.bookmarkPanel.save();
|
||||
}
|
||||
@@ -892,6 +896,8 @@ public class NEIClientConfig {
|
||||
|
||||
if (world != null) {
|
||||
world.saveNBT();
|
||||
NEIClientConfig.worldPath = null;
|
||||
world = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -147,7 +147,6 @@ public abstract class PanelWidget<T extends ItemsGrid<? extends ItemsGridSlot, ?
|
||||
LayoutManager.addWidget(pagePrev);
|
||||
LayoutManager.addWidget(pageNext);
|
||||
LayoutManager.addWidget(pageLabel);
|
||||
this.grid.setVisible();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user