mirror of
https://github.com/GTNewHorizons/Baubles-Expanded.git
synced 2026-11-26 23:03:07 +00:00
Added Empty/Unused Slot texture/Quick Docs on old layout (#27)
This commit is contained in:
1 parent
94bb06d393
commit
609200fac7
4 files changed
+62
-4
No files matched your search
@@ -52,6 +52,12 @@ public class GuiPlayerExpanded extends GuiContainer implements INEIGuiHandler {
|
||||
private static final ResourceLocation creative_inventory_tabs = new ResourceLocation("textures/gui/container/creative_inventory/tabs.png");
|
||||
|
||||
private static final boolean hasLwjgl3 = Loader.isModLoaded("lwjgl3ify");
|
||||
private static final int UNUSED_SLOT_U = 7;
|
||||
private static final int UNUSED_SLOT_V = 160;
|
||||
private static final int UNUSED_SLOT_SIZE = 24;
|
||||
private static final int UNUSED_SLOT_OFFSET = (UNUSED_SLOT_SIZE - 18) / 2;
|
||||
private static final int UNUSED_SLOT_SHIFT_X = 2;
|
||||
private static final int UNUSED_SLOT_SHIFT_Y = 2;
|
||||
|
||||
/**
|
||||
* x size of the inventory window in pixels. Defined as float, passed as int.
|
||||
@@ -181,13 +187,17 @@ public class GuiPlayerExpanded extends GuiContainer implements INEIGuiHandler {
|
||||
}
|
||||
|
||||
// Bauble slot backgrounds
|
||||
this.mc.getTextureManager().bindTexture(useOldGuiRendering ? background : gui_background);
|
||||
for (int slotIndex = 0; slotIndex < BaubleExpandedSlots.slotLimit; slotIndex++) {
|
||||
String slotType = BaubleExpandedSlots.getSlotType(slotIndex);
|
||||
if (!BaublesConfig.showUnusedSlots && slotType.equals(BaubleExpandedSlots.unknownType)) {
|
||||
continue;
|
||||
}
|
||||
boolean isUnusedSlot = slotType.equals(BaubleExpandedSlots.unknownType);
|
||||
if (useOldGuiRendering) {
|
||||
drawTexturedModalRect(slotStartX + (slotOffset * (slotIndex / 4)), slotStartY + (slotOffset * (slotIndex % 4)), 200, 0, 18, 18);
|
||||
int x = slotStartX + (slotOffset * (slotIndex / 4));
|
||||
int y = slotStartY + (slotOffset * (slotIndex % 4));
|
||||
drawTexturedModalRect(x, y, 200, 0, 18, 18);
|
||||
} else {
|
||||
// Draw the background rect at the slot's actual display position so it
|
||||
// automatically follows scrolling and stays in sync with the item rendering.
|
||||
@@ -195,7 +205,51 @@ public class GuiPlayerExpanded extends GuiContainer implements INEIGuiHandler {
|
||||
if (baubleSlot == null || baubleSlot.yDisplayPosition == -2000) {
|
||||
continue;
|
||||
}
|
||||
drawTexturedModalRect(guiLeft + baubleSlot.xDisplayPosition, guiTop + baubleSlot.yDisplayPosition, 200, 0, 18, 18);
|
||||
int x = guiLeft + baubleSlot.xDisplayPosition;
|
||||
int y = guiTop + baubleSlot.yDisplayPosition;
|
||||
if (isUnusedSlot) {
|
||||
drawTexturedModalRect(
|
||||
x - UNUSED_SLOT_OFFSET + UNUSED_SLOT_SHIFT_X,
|
||||
y - UNUSED_SLOT_OFFSET + UNUSED_SLOT_SHIFT_Y,
|
||||
UNUSED_SLOT_U,
|
||||
UNUSED_SLOT_V,
|
||||
UNUSED_SLOT_SIZE,
|
||||
UNUSED_SLOT_SIZE
|
||||
);
|
||||
} else {
|
||||
drawTexturedModalRect(x, y, 200, 0, 18, 18);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!useOldGuiRendering) {
|
||||
int activeSlots = BaubleExpandedSlots.slotsCurrentlyUsed();
|
||||
int totalRows = (activeSlots + columns - 1) / columns;
|
||||
int renderedCells = totalRows * columns;
|
||||
int slotRowOffset = 0;
|
||||
if (needsScrollBars()) {
|
||||
int shownRows = 8;
|
||||
slotRowOffset = (int) (this.currentScroll * (totalRows - shownRows) + 0.5F);
|
||||
if (slotRowOffset < 0) {
|
||||
slotRowOffset = 0;
|
||||
}
|
||||
}
|
||||
for (int slotIndex = activeSlots; slotIndex < renderedCells; slotIndex++) {
|
||||
int row = slotIndex / columns;
|
||||
int scrolledRow = row - slotRowOffset;
|
||||
int y = guiTop + 12 + (slotOffset * scrolledRow);
|
||||
if (y < guiTop + 12 || y > guiTop + 8 * 18) {
|
||||
continue;
|
||||
}
|
||||
int x = guiLeft - 18 - (18 * (slotIndex % columns));
|
||||
drawTexturedModalRect(
|
||||
x - UNUSED_SLOT_OFFSET + UNUSED_SLOT_SHIFT_X,
|
||||
y - UNUSED_SLOT_OFFSET + UNUSED_SLOT_SHIFT_Y,
|
||||
UNUSED_SLOT_U,
|
||||
UNUSED_SLOT_V,
|
||||
UNUSED_SLOT_SIZE,
|
||||
UNUSED_SLOT_SIZE
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class BaublesConfig {
|
||||
|
||||
//categoryClient
|
||||
useOldGuiButton = config.getBoolean("useOldGuiButton", categoryClient, useOldGuiButton, "Use the old Baubles Button texture and location instead.\n");
|
||||
useOldGuiRendering = config.getBoolean("useOldRendering", categoryClient, useOldGuiRendering, "Display the old Bauble GUI instead of the new sidebar.\n");
|
||||
useOldGuiRendering = config.getBoolean("useOldRendering", categoryClient, useOldGuiRendering, "Display the old Bauble GUI instead of the new sidebar.\nUsing over 20 slots in old rendering is not supported.\n");
|
||||
maxColumns = config.getInt("maxColumns", categoryClient, 4, 1, 5, "Maximum number of columns shown in the baubles inventory (1-5).\n"
|
||||
);
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import baubles.api.IBauble;
|
||||
import baubles.api.expanded.BaubleExpandedSlots;
|
||||
import baubles.api.expanded.IBaubleExpanded;
|
||||
import baubles.common.Baubles;
|
||||
import baubles.common.BaublesConfig;
|
||||
import baubles.common.ItemDebugger;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -77,9 +78,12 @@ public class SlotBauble extends Slot {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getBackgroundIconIndex() {
|
||||
if (!BaublesConfig.useOldGuiRendering && BaubleExpandedSlots.unknownType.equals(slotType)) {
|
||||
return null;
|
||||
}
|
||||
return ((ItemDebugger) Baubles.itemDebugger).getBackgroundIconForSlotType(slotType);
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.7 KiB |
Reference in new issue
Block a user