Removed "detailed" Grid view type variant, made detailed tooltips a config option instead, fixes #1559

This commit is contained in:
raoulvdberge
2017-12-07 20:29:26 +01:00
parent 72731a3733
commit 127857d9b5
11 changed files with 29 additions and 72 deletions

View File

@@ -6,6 +6,7 @@
- Fixed Exporter in Regulator Mode not regulating properly when same item is specified multiple times (raoulvdberge) - Fixed Exporter in Regulator Mode not regulating properly when same item is specified multiple times (raoulvdberge)
- Fixed air appearing in Grid (raoulvdberge) - Fixed air appearing in Grid (raoulvdberge)
- Fixed config categories not correctly appearing in ingame config GUI (raoulvdberge) - Fixed config categories not correctly appearing in ingame config GUI (raoulvdberge)
- Removed "detailed" Grid view type variant, made detailed tooltips a config option instead (raoulvdberge)
### 1.5.25 ### 1.5.25
- Fixed not being able to autocraft different Storage Drawers' wood drawers (raoulvdberge) - Fixed not being able to autocraft different Storage Drawers' wood drawers (raoulvdberge)

View File

@@ -58,6 +58,7 @@ public final class RSConfig {
//region Grid //region Grid
public int maxRowsStretch; public int maxRowsStretch;
public boolean largeFont; public boolean largeFont;
public boolean detailedTooltip;
//endregion //endregion
//region Wireless Transmitter //region Wireless Transmitter
@@ -179,7 +180,8 @@ public final class RSConfig {
//region Grid //region Grid
maxRowsStretch = config.getInt("maxRowsStretch", GRID, Integer.MAX_VALUE, 3, Integer.MAX_VALUE, "The maximum amount of rows that the Grid can show when stretched"); maxRowsStretch = config.getInt("maxRowsStretch", GRID, Integer.MAX_VALUE, 3, Integer.MAX_VALUE, "The maximum amount of rows that the Grid can show when stretched");
largeFont = config.getBoolean("largeFont", GRID, false, "Whether the controller should use a large font for stack quantity display"); largeFont = config.getBoolean("largeFont", GRID, false, "Whether the Grid should use a large font for stack quantity display");
detailedTooltip = config.getBoolean("detailedTooltip", GRID, true, "Whether the Grid should display a detailed tooltip when hovering over an item or fluid");
//endregion //endregion
//region Wireless Transmitter //region Wireless Transmitter

View File

@@ -33,12 +33,9 @@ public interface IGrid {
int SEARCH_BOX_MODE_JEI_SYNCHRONIZED = 2; int SEARCH_BOX_MODE_JEI_SYNCHRONIZED = 2;
int SEARCH_BOX_MODE_JEI_SYNCHRONIZED_AUTOSELECTED = 3; int SEARCH_BOX_MODE_JEI_SYNCHRONIZED_AUTOSELECTED = 3;
int VIEW_TYPE_NORMAL_DETAILED = 0; int VIEW_TYPE_NORMAL = 0;
int VIEW_TYPE_NON_CRAFTABLES_DETAILED = 1; int VIEW_TYPE_NON_CRAFTABLES = 1;
int VIEW_TYPE_CRAFTABLES_DETAILED = 2; int VIEW_TYPE_CRAFTABLES = 2;
int VIEW_TYPE_NORMAL = 3;
int VIEW_TYPE_NON_CRAFTABLES = 4;
int VIEW_TYPE_CRAFTABLES = 5;
int SIZE_STRETCH = 0; int SIZE_STRETCH = 0;
int SIZE_SMALL = 1; int SIZE_SMALL = 1;
@@ -219,18 +216,11 @@ public interface IGrid {
boolean isActive(); boolean isActive();
static boolean isValidViewType(int type) { static boolean isValidViewType(int type) {
return isValidViewTypeDetailed(type) || return type == VIEW_TYPE_NORMAL ||
type == VIEW_TYPE_NORMAL ||
type == VIEW_TYPE_CRAFTABLES || type == VIEW_TYPE_CRAFTABLES ||
type == VIEW_TYPE_NON_CRAFTABLES; type == VIEW_TYPE_NON_CRAFTABLES;
} }
static boolean isValidViewTypeDetailed(int type) {
return type == VIEW_TYPE_NORMAL_DETAILED ||
type == VIEW_TYPE_CRAFTABLES_DETAILED ||
type == VIEW_TYPE_NON_CRAFTABLES_DETAILED;
}
static boolean isValidSearchBoxMode(int mode) { static boolean isValidSearchBoxMode(int mode) {
return mode == SEARCH_BOX_MODE_NORMAL || return mode == SEARCH_BOX_MODE_NORMAL ||
mode == SEARCH_BOX_MODE_NORMAL_AUTOSELECTED || mode == SEARCH_BOX_MODE_NORMAL_AUTOSELECTED ||

View File

@@ -95,7 +95,7 @@ public class NetworkNodeGrid extends NetworkNode implements IGrid {
private GridType type; private GridType type;
private int viewType = VIEW_TYPE_NORMAL_DETAILED; private int viewType = VIEW_TYPE_NORMAL;
private int sortingDirection = SORTING_DIRECTION_DESCENDING; private int sortingDirection = SORTING_DIRECTION_DESCENDING;
private int sortingType = SORTING_TYPE_QUANTITY; private int sortingType = SORTING_TYPE_QUANTITY;
private int searchBoxMode = SEARCH_BOX_MODE_NORMAL; private int searchBoxMode = SEARCH_BOX_MODE_NORMAL;

View File

@@ -508,7 +508,7 @@ public class GuiGrid extends GuiBase implements IGridDisplay {
// RS BEGIN // RS BEGIN
List<String> textLines = Lists.newArrayList(gridStack.getTooltip().split("\n")); List<String> textLines = Lists.newArrayList(gridStack.getTooltip().split("\n"));
if (IGrid.isValidViewTypeDetailed(grid.getViewType())) { if (RS.INSTANCE.config.detailedTooltip) {
textLines.add(""); textLines.add("");
if (gridStack.getTrackerEntry() != null) { if (gridStack.getTrackerEntry() != null) {
@@ -549,7 +549,7 @@ public class GuiGrid extends GuiBase implements IGridDisplay {
} }
// RS BEGIN // RS BEGIN
if (IGrid.isValidViewTypeDetailed(grid.getViewType())) { if (RS.INSTANCE.config.detailedTooltip) {
int size = (int) (font.getStringWidth(I18n.format("misc.refinedstorage:total", gridStack.getFormattedFullQuantity())) * textScale); int size = (int) (font.getStringWidth(I18n.format("misc.refinedstorage:total", gridStack.getFormattedFullQuantity())) * textScale);
if (size > tooltipTextWidth) { if (size > tooltipTextWidth) {
@@ -614,7 +614,7 @@ public class GuiGrid extends GuiBase implements IGridDisplay {
MinecraftForge.EVENT_BUS.post(new RenderTooltipEvent.PostText(stack, textLines, tooltipX, tooltipTop, font, tooltipTextWidth, tooltipHeight)); MinecraftForge.EVENT_BUS.post(new RenderTooltipEvent.PostText(stack, textLines, tooltipX, tooltipTop, font, tooltipTextWidth, tooltipHeight));
// RS BEGIN // RS BEGIN
if (IGrid.isValidViewTypeDetailed(grid.getViewType())) { if (RS.INSTANCE.config.detailedTooltip) {
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
GlStateManager.scale(textScale, textScale, 1); GlStateManager.scale(textScale, textScale, 1);

View File

@@ -24,9 +24,9 @@ public final class GridFilterParser {
} }
} }
if (grid.getViewType() == IGrid.VIEW_TYPE_NON_CRAFTABLES_DETAILED || grid.getViewType() == IGrid.VIEW_TYPE_NON_CRAFTABLES) { if (grid.getViewType() == IGrid.VIEW_TYPE_NON_CRAFTABLES) {
gridFilters.add(new GridFilterCraftable(false)); gridFilters.add(new GridFilterCraftable(false));
} else if (grid.getViewType() == IGrid.VIEW_TYPE_CRAFTABLES_DETAILED || grid.getViewType() == IGrid.VIEW_TYPE_CRAFTABLES) { } else if (grid.getViewType() == IGrid.VIEW_TYPE_CRAFTABLES) {
gridFilters.add(new GridFilterCraftable(true)); gridFilters.add(new GridFilterCraftable(true));
} }

View File

@@ -2,7 +2,6 @@ package com.raoulvdberge.refinedstorage.gui.sidebutton;
import com.raoulvdberge.refinedstorage.api.network.grid.IGrid; import com.raoulvdberge.refinedstorage.api.network.grid.IGrid;
import com.raoulvdberge.refinedstorage.gui.GuiBase; import com.raoulvdberge.refinedstorage.gui.GuiBase;
import com.raoulvdberge.refinedstorage.tile.grid.portable.IPortableGrid;
import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TextFormatting;
public class SideButtonGridViewType extends SideButton { public class SideButtonGridViewType extends SideButton {
@@ -28,26 +27,14 @@ public class SideButtonGridViewType extends SideButton {
public void actionPerformed() { public void actionPerformed() {
int type = grid.getViewType(); int type = grid.getViewType();
if (grid instanceof IPortableGrid) { if (type == IGrid.VIEW_TYPE_NORMAL) {
if (type == IGrid.VIEW_TYPE_NORMAL_DETAILED) {
type = IGrid.VIEW_TYPE_NORMAL;
} else {
type = IGrid.VIEW_TYPE_NORMAL_DETAILED;
}
} else {
if (type == IGrid.VIEW_TYPE_NORMAL_DETAILED) {
type = IGrid.VIEW_TYPE_NON_CRAFTABLES_DETAILED;
} else if (type == IGrid.VIEW_TYPE_NON_CRAFTABLES_DETAILED) {
type = IGrid.VIEW_TYPE_CRAFTABLES_DETAILED;
} else if (type == IGrid.VIEW_TYPE_CRAFTABLES_DETAILED) {
type = IGrid.VIEW_TYPE_NORMAL;
} else if (type == IGrid.VIEW_TYPE_NORMAL) {
type = IGrid.VIEW_TYPE_NON_CRAFTABLES; type = IGrid.VIEW_TYPE_NON_CRAFTABLES;
} else if (type == IGrid.VIEW_TYPE_NON_CRAFTABLES) { } else if (type == IGrid.VIEW_TYPE_NON_CRAFTABLES) {
type = IGrid.VIEW_TYPE_CRAFTABLES; type = IGrid.VIEW_TYPE_CRAFTABLES;
} else if (type == IGrid.VIEW_TYPE_CRAFTABLES) { } else if (type == IGrid.VIEW_TYPE_CRAFTABLES) {
type = IGrid.VIEW_TYPE_NORMAL_DETAILED; type = IGrid.VIEW_TYPE_NORMAL;
} } else {
type = IGrid.VIEW_TYPE_NORMAL; // @todo: Remove in 1.13 (1.5.24 -> 1.5.26 conversion, removed detailed grid view type)
} }
grid.onViewTypeChanged(type); grid.onViewTypeChanged(type);

View File

@@ -26,7 +26,7 @@ public class ItemWirelessGrid extends ItemNetworkItem {
} }
public static int getViewType(ItemStack stack) { public static int getViewType(ItemStack stack) {
return (stack.hasTagCompound() && stack.getTagCompound().hasKey(NetworkNodeGrid.NBT_VIEW_TYPE)) ? stack.getTagCompound().getInteger(NetworkNodeGrid.NBT_VIEW_TYPE) : IGrid.VIEW_TYPE_NORMAL_DETAILED; return (stack.hasTagCompound() && stack.getTagCompound().hasKey(NetworkNodeGrid.NBT_VIEW_TYPE)) ? stack.getTagCompound().getInteger(NetworkNodeGrid.NBT_VIEW_TYPE) : IGrid.VIEW_TYPE_NORMAL;
} }
public static int getSortingType(ItemStack stack) { public static int getSortingType(ItemStack stack) {

View File

@@ -55,7 +55,6 @@ public class PortableGrid implements IGrid, IPortableGrid {
private EntityPlayer player; private EntityPlayer player;
private ItemStack stack; private ItemStack stack;
private int viewType;
private int sortingType; private int sortingType;
private int sortingDirection; private int sortingDirection;
private int searchBoxMode; private int searchBoxMode;
@@ -125,7 +124,6 @@ public class PortableGrid implements IGrid, IPortableGrid {
this.stack = stack; this.stack = stack;
if (player != null) { if (player != null) {
this.viewType = ItemWirelessGrid.getViewType(stack);
this.sortingType = ItemWirelessGrid.getSortingType(stack); this.sortingType = ItemWirelessGrid.getSortingType(stack);
this.sortingDirection = ItemWirelessGrid.getSortingDirection(stack); this.sortingDirection = ItemWirelessGrid.getSortingDirection(stack);
this.searchBoxMode = ItemWirelessGrid.getSearchBoxMode(stack); this.searchBoxMode = ItemWirelessGrid.getSearchBoxMode(stack);
@@ -227,7 +225,7 @@ public class PortableGrid implements IGrid, IPortableGrid {
@Override @Override
public int getViewType() { public int getViewType() {
return viewType; return -1;
} }
@Override @Override
@@ -267,11 +265,7 @@ public class PortableGrid implements IGrid, IPortableGrid {
@Override @Override
public void onViewTypeChanged(int type) { public void onViewTypeChanged(int type) {
RS.INSTANCE.network.sendToServer(new MessageGridSettingsUpdate(type, getSortingDirection(), getSortingType(), getSearchBoxMode(), getSize(), getTabSelected(), getTabPage())); // NO OP
this.viewType = type;
GuiGrid.scheduleSort();
} }
@Override @Override

View File

@@ -59,12 +59,6 @@ import java.util.List;
public class TilePortableGrid extends TileBase implements IGrid, IPortableGrid, IRedstoneConfigurable { public class TilePortableGrid extends TileBase implements IGrid, IPortableGrid, IRedstoneConfigurable {
public static final TileDataParameter<Integer, TilePortableGrid> REDSTONE_MODE = RedstoneMode.createParameter(); public static final TileDataParameter<Integer, TilePortableGrid> REDSTONE_MODE = RedstoneMode.createParameter();
public static final TileDataParameter<Integer, TilePortableGrid> ENERGY_STORED = new TileDataParameter<>(DataSerializers.VARINT, 0, t -> t.energyStorage.getEnergyStored()); public static final TileDataParameter<Integer, TilePortableGrid> ENERGY_STORED = new TileDataParameter<>(DataSerializers.VARINT, 0, t -> t.energyStorage.getEnergyStored());
public static final TileDataParameter<Integer, TilePortableGrid> VIEW_TYPE = new TileDataParameter<>(DataSerializers.VARINT, 0, TilePortableGrid::getViewType, (t, v) -> {
if (IGrid.isValidViewType(v)) {
t.setViewType(v);
t.markDirty();
}
}, p -> GuiGrid.scheduleSort());
public static final TileDataParameter<Integer, TilePortableGrid> SORTING_DIRECTION = new TileDataParameter<>(DataSerializers.VARINT, 0, TilePortableGrid::getSortingDirection, (t, v) -> { public static final TileDataParameter<Integer, TilePortableGrid> SORTING_DIRECTION = new TileDataParameter<>(DataSerializers.VARINT, 0, TilePortableGrid::getSortingDirection, (t, v) -> {
if (IGrid.isValidSortingDirection(v)) { if (IGrid.isValidSortingDirection(v)) {
t.setSortingDirection(v); t.setSortingDirection(v);
@@ -123,7 +117,6 @@ public class TilePortableGrid extends TileBase implements IGrid, IPortableGrid,
private RedstoneMode redstoneMode = RedstoneMode.IGNORE; private RedstoneMode redstoneMode = RedstoneMode.IGNORE;
private int viewType;
private int sortingType; private int sortingType;
private int sortingDirection; private int sortingDirection;
private int searchBoxMode; private int searchBoxMode;
@@ -197,7 +190,6 @@ public class TilePortableGrid extends TileBase implements IGrid, IPortableGrid,
public TilePortableGrid() { public TilePortableGrid() {
dataManager.addWatchedParameter(REDSTONE_MODE); dataManager.addWatchedParameter(REDSTONE_MODE);
dataManager.addWatchedParameter(ENERGY_STORED); dataManager.addWatchedParameter(ENERGY_STORED);
dataManager.addWatchedParameter(VIEW_TYPE);
dataManager.addWatchedParameter(SORTING_DIRECTION); dataManager.addWatchedParameter(SORTING_DIRECTION);
dataManager.addWatchedParameter(SORTING_TYPE); dataManager.addWatchedParameter(SORTING_TYPE);
dataManager.addWatchedParameter(SEARCH_BOX_MODE); dataManager.addWatchedParameter(SEARCH_BOX_MODE);
@@ -223,7 +215,6 @@ public class TilePortableGrid extends TileBase implements IGrid, IPortableGrid,
} }
public void onPassItemContext(ItemStack stack) { public void onPassItemContext(ItemStack stack) {
this.viewType = ItemWirelessGrid.getViewType(stack);
this.sortingType = ItemWirelessGrid.getSortingType(stack); this.sortingType = ItemWirelessGrid.getSortingType(stack);
this.sortingDirection = ItemWirelessGrid.getSortingDirection(stack); this.sortingDirection = ItemWirelessGrid.getSortingDirection(stack);
this.searchBoxMode = ItemWirelessGrid.getSearchBoxMode(stack); this.searchBoxMode = ItemWirelessGrid.getSearchBoxMode(stack);
@@ -261,7 +252,6 @@ public class TilePortableGrid extends TileBase implements IGrid, IPortableGrid,
stack.setTagCompound(new NBTTagCompound()); stack.setTagCompound(new NBTTagCompound());
stack.getTagCompound().setInteger(NetworkNodeGrid.NBT_VIEW_TYPE, viewType);
stack.getTagCompound().setInteger(NetworkNodeGrid.NBT_SORTING_DIRECTION, sortingDirection); stack.getTagCompound().setInteger(NetworkNodeGrid.NBT_SORTING_DIRECTION, sortingDirection);
stack.getTagCompound().setInteger(NetworkNodeGrid.NBT_SORTING_TYPE, sortingType); stack.getTagCompound().setInteger(NetworkNodeGrid.NBT_SORTING_TYPE, sortingType);
stack.getTagCompound().setInteger(NetworkNodeGrid.NBT_SEARCH_BOX_MODE, searchBoxMode); stack.getTagCompound().setInteger(NetworkNodeGrid.NBT_SEARCH_BOX_MODE, searchBoxMode);
@@ -308,7 +298,7 @@ public class TilePortableGrid extends TileBase implements IGrid, IPortableGrid,
@Override @Override
public int getViewType() { public int getViewType() {
return world.isRemote ? VIEW_TYPE.getValue() : viewType; return -1;
} }
@Override @Override
@@ -346,10 +336,6 @@ public class TilePortableGrid extends TileBase implements IGrid, IPortableGrid,
return world.isRemote ? SIZE.getValue() : size; return world.isRemote ? SIZE.getValue() : size;
} }
public void setViewType(int viewType) {
this.viewType = viewType;
}
public void setSortingType(int sortingType) { public void setSortingType(int sortingType) {
this.sortingType = sortingType; this.sortingType = sortingType;
} }
@@ -376,7 +362,7 @@ public class TilePortableGrid extends TileBase implements IGrid, IPortableGrid,
@Override @Override
public void onViewTypeChanged(int type) { public void onViewTypeChanged(int type) {
TileDataManager.setParameter(VIEW_TYPE, type); // NO OP
} }
@Override @Override

View File

@@ -136,12 +136,9 @@ sidebutton.refinedstorage:redstone_mode.1=Only work with redstone signal
sidebutton.refinedstorage:redstone_mode.2=Only work without redstone signal sidebutton.refinedstorage:redstone_mode.2=Only work without redstone signal
sidebutton.refinedstorage:grid.view_type=Display sidebutton.refinedstorage:grid.view_type=Display
sidebutton.refinedstorage:grid.view_type.0=Normal (detailed) sidebutton.refinedstorage:grid.view_type.0=Normal
sidebutton.refinedstorage:grid.view_type.1=No craftables (detailed) sidebutton.refinedstorage:grid.view_type.1=No craftables
sidebutton.refinedstorage:grid.view_type.2=Only craftables (detailed) sidebutton.refinedstorage:grid.view_type.2=Only craftables
sidebutton.refinedstorage:grid.view_type.3=Normal
sidebutton.refinedstorage:grid.view_type.4=No craftables
sidebutton.refinedstorage:grid.view_type.5=Only craftables
sidebutton.refinedstorage:grid.sorting.direction=Sorting direction sidebutton.refinedstorage:grid.sorting.direction=Sorting direction
sidebutton.refinedstorage:grid.sorting.direction.0=Ascending sidebutton.refinedstorage:grid.sorting.direction.0=Ascending
sidebutton.refinedstorage:grid.sorting.direction.1=Descending sidebutton.refinedstorage:grid.sorting.direction.1=Descending