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