Add config for large fonts & max rows in Grid
This commit is contained in:
@@ -5,7 +5,8 @@
|
||||
- Added option to use a mod filter in the Grid Filter (raoulvdberge)
|
||||
- Added option to use a whitelist or blacklist in the Grid Filter (raoulvdberge)
|
||||
- Added Grid tabs using Grid Filters (raoulvdberge)
|
||||
- The Grid now resizes based on screen size (raoulvdberge)
|
||||
- The Grid now resizes based on screen size (max rows can be configured) (raoulvdberge)
|
||||
- Added configuration option to enable large fonts in Grid (raoulvdberge)
|
||||
|
||||
### 1.3.3
|
||||
- Updated Forge to 2188 (raoulvdberge)
|
||||
|
||||
@@ -53,6 +53,11 @@ public final class RSConfig {
|
||||
public boolean controllerUsesEnergy;
|
||||
//endregion
|
||||
|
||||
//region Grid
|
||||
public int maxRows;
|
||||
public boolean largeFont;
|
||||
//endregion
|
||||
|
||||
//region Wireless Transmitter
|
||||
public int wirelessTransmitterBaseRange;
|
||||
public int wirelessTransmitterRangePerUpgrade;
|
||||
@@ -85,11 +90,11 @@ public final class RSConfig {
|
||||
//region Categories
|
||||
private static final String ENERGY = "energy";
|
||||
private static final String CONTROLLER = "controller";
|
||||
private static final String GRID = "grid";
|
||||
private static final String WIRELESS_TRANSMITTER = "wirelessTransmitter";
|
||||
private static final String WIRELESS_GRID = "wirelessGrid";
|
||||
private static final String WIRELESS_CRAFTING_MONITOR = "wirelessCraftingMonitor";
|
||||
private static final String UPGRADES = "upgrades";
|
||||
private static final String MISC = "misc";
|
||||
//endregion
|
||||
|
||||
public RSConfig(File configFile) {
|
||||
@@ -151,6 +156,11 @@ public final class RSConfig {
|
||||
controllerUsesEnergy = config.getBoolean("usesEnergy", CONTROLLER, true, "Whether the Controller uses energy");
|
||||
//endregion
|
||||
|
||||
//region Grid
|
||||
maxRows = config.getInt("maxRows", GRID, Integer.MAX_VALUE, 3, Integer.MAX_VALUE, "The maximum amount of rows that the Grid can show");
|
||||
largeFont = config.getBoolean("largeFont", GRID, false, "Whether the controller should use a large font for stack quantity display");
|
||||
//endregion
|
||||
|
||||
//region Wireless Transmitter
|
||||
wirelessTransmitterBaseRange = config.getInt("range", WIRELESS_TRANSMITTER, 16, 0, Integer.MAX_VALUE, "The base range of the Wireless Transmitter");
|
||||
wirelessTransmitterRangePerUpgrade = config.getInt("rangePerUpgrade", WIRELESS_TRANSMITTER, 8, 0, Integer.MAX_VALUE, "The additional range per Range Upgrade in the Wireless Transmitter");
|
||||
@@ -194,7 +204,7 @@ public final class RSConfig {
|
||||
list.addAll(new ConfigElement(config.getCategory(UPGRADES)).getChildElements());
|
||||
list.addAll(new ConfigElement(config.getCategory(WIRELESS_TRANSMITTER)).getChildElements());
|
||||
list.addAll(new ConfigElement(config.getCategory(WIRELESS_GRID)).getChildElements());
|
||||
list.addAll(new ConfigElement(config.getCategory(MISC)).getChildElements());
|
||||
list.addAll(new ConfigElement(config.getCategory(GRID)).getChildElements());
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -256,10 +256,12 @@ public abstract class GuiBase extends GuiContainer {
|
||||
}
|
||||
|
||||
public void drawQuantity(int x, int y, String qty) {
|
||||
boolean large = fontRendererObj.getUnicodeFlag() || RS.INSTANCE.config.largeFont;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(x, y, 1);
|
||||
|
||||
if (!fontRendererObj.getUnicodeFlag()) {
|
||||
if (!large) {
|
||||
GlStateManager.scale(0.5f, 0.5f, 1);
|
||||
}
|
||||
|
||||
@@ -270,7 +272,7 @@ public abstract class GuiBase extends GuiContainer {
|
||||
GlStateManager.blendFunc(770, 771);
|
||||
GlStateManager.disableDepth();
|
||||
|
||||
fontRendererObj.drawStringWithShadow(qty, (fontRendererObj.getUnicodeFlag() ? 16 : 30) - fontRendererObj.getStringWidth(qty), fontRendererObj.getUnicodeFlag() ? 8 : 22, 16777215);
|
||||
fontRendererObj.drawStringWithShadow(qty, (large ? 16 : 30) - fontRendererObj.getStringWidth(qty), large ? 8 : 22, 16777215);
|
||||
|
||||
GlStateManager.enableDepth();
|
||||
GlStateManager.enableTexture2D();
|
||||
|
||||
@@ -10,7 +10,6 @@ import com.raoulvdberge.refinedstorage.container.ContainerGrid;
|
||||
import com.raoulvdberge.refinedstorage.gui.GuiBase;
|
||||
import com.raoulvdberge.refinedstorage.gui.Scrollbar;
|
||||
import com.raoulvdberge.refinedstorage.gui.grid.filtering.GridFilterParser;
|
||||
import com.raoulvdberge.refinedstorage.gui.grid.filtering.IGridFilter;
|
||||
import com.raoulvdberge.refinedstorage.gui.grid.sorting.GridSortingName;
|
||||
import com.raoulvdberge.refinedstorage.gui.grid.sorting.GridSortingQuantity;
|
||||
import com.raoulvdberge.refinedstorage.gui.grid.stack.GridStackFluid;
|
||||
@@ -41,6 +40,7 @@ import org.lwjgl.input.Keyboard;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class GuiGrid extends GuiBase implements IGridDisplay {
|
||||
private static final GridSortingQuantity SORTING_QUANTITY = new GridSortingQuantity();
|
||||
@@ -161,7 +161,7 @@ public class GuiGrid extends GuiBase implements IGridDisplay {
|
||||
if (grid.isActive()) {
|
||||
stacks.addAll(grid.getType() == EnumGridType.FLUID ? FLUIDS.values() : ITEMS.values());
|
||||
|
||||
List<IGridFilter> filters = GridFilterParser.getFilters(
|
||||
List<Predicate<IGridStack>> filters = GridFilterParser.getFilters(
|
||||
grid,
|
||||
searchField.getText(),
|
||||
(grid.getTabSelected() >= 0 && grid.getTabSelected() < grid.getTabs().size()) ? grid.getTabs().get(grid.getTabSelected()).getFilters() : grid.getFilteredItems()
|
||||
@@ -172,8 +172,8 @@ public class GuiGrid extends GuiBase implements IGridDisplay {
|
||||
while (t.hasNext()) {
|
||||
IGridStack stack = t.next();
|
||||
|
||||
for (IGridFilter filter : filters) {
|
||||
if (!filter.accepts(stack)) {
|
||||
for (Predicate<IGridStack> filter : filters) {
|
||||
if (!filter.test(stack)) {
|
||||
t.remove();
|
||||
|
||||
break;
|
||||
@@ -259,7 +259,7 @@ public class GuiGrid extends GuiBase implements IGridDisplay {
|
||||
public int getVisibleRows() {
|
||||
int screenSpaceAvailable = height - getHeader() - getFooter() - (hadTabs ? ContainerGrid.TAB_HEIGHT : 0);
|
||||
|
||||
return Math.max(3, (screenSpaceAvailable / 18) - 3);
|
||||
return Math.max(3, Math.min((screenSpaceAvailable / 18) - 3, RS.INSTANCE.config.maxRows));
|
||||
}
|
||||
|
||||
private boolean isOverSlotWithItem() {
|
||||
|
||||
Reference in New Issue
Block a user