Added a "detailed" variant for every Grid view type option, to disable the modified information on the tooltip

This commit is contained in:
raoulvdberge
2017-11-25 13:20:11 +01:00
parent 4b68fbf977
commit 1cb72d9cb3
8 changed files with 65 additions and 39 deletions

View File

@@ -3,6 +3,7 @@
### 1.5.24
- The Grid now displays last modified information (player name and date) and size on tooltips of stacks (raoulvdberge)
- Added "Last modified" sorting option in the Grid (raoulvdberge)
- Added a "detailed" variant for every Grid view type option, to disable the modified information on the tooltip (raoulvdberge)
- Removed craft-only mode for the Exporter (raoulvdberge)
- Fixed Exporter with Stack Upgrade not working correctly in Regulator Mode (raoulvdberge)

View File

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

View File

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

View File

@@ -508,10 +508,12 @@ public class GuiGrid extends GuiBase implements IGridDisplay {
// RS BEGIN
List<String> textLines = Lists.newArrayList(gridStack.getTooltip().split("\n"));
textLines.add("");
if (gridStack.getTrackerEntry() != null) {
if (IGrid.isValidViewTypeDetailed(grid.getViewType())) {
textLines.add("");
if (gridStack.getTrackerEntry() != null) {
textLines.add("");
}
}
ItemStack stack = gridStack instanceof GridStackItem ? ((GridStackItem) gridStack).getStack() : ItemStack.EMPTY;
@@ -547,18 +549,20 @@ public class GuiGrid extends GuiBase implements IGridDisplay {
}
// RS BEGIN
int size = (int) (font.getStringWidth(I18n.format("misc.refinedstorage:total", gridStack.getFormattedFullQuantity())) * textScale);
if (size > tooltipTextWidth) {
tooltipTextWidth = size;
}
if (gridStack.getTrackerEntry() != null) {
size = (int) (font.getStringWidth(TimeUtils.getAgo(gridStack.getTrackerEntry().getTime(), gridStack.getTrackerEntry().getName())) * textScale);
if (IGrid.isValidViewTypeDetailed(grid.getViewType())) {
int size = (int) (font.getStringWidth(I18n.format("misc.refinedstorage:total", gridStack.getFormattedFullQuantity())) * textScale);
if (size > tooltipTextWidth) {
tooltipTextWidth = size;
}
if (gridStack.getTrackerEntry() != null) {
size = (int) (font.getStringWidth(TimeUtils.getAgo(gridStack.getTrackerEntry().getTime(), gridStack.getTrackerEntry().getName())) * textScale);
if (size > tooltipTextWidth) {
tooltipTextWidth = size;
}
}
}
// RS END
@@ -610,26 +614,28 @@ public class GuiGrid extends GuiBase implements IGridDisplay {
MinecraftForge.EVENT_BUS.post(new RenderTooltipEvent.PostText(stack, textLines, tooltipX, tooltipTop, font, tooltipTextWidth, tooltipHeight));
// RS BEGIN
GlStateManager.pushMatrix();
GlStateManager.scale(textScale, textScale, 1);
if (IGrid.isValidViewTypeDetailed(grid.getViewType())) {
GlStateManager.pushMatrix();
GlStateManager.scale(textScale, textScale, 1);
font.drawStringWithShadow(
TextFormatting.GRAY + I18n.format("misc.refinedstorage:total", gridStack.getFormattedFullQuantity()),
RenderUtils.getOffsetOnScale(tooltipX, textScale),
RenderUtils.getOffsetOnScale(tooltipTop + tooltipHeight - (gridStack.getTrackerEntry() != null ? 15 : 6) - (font.getUnicodeFlag() ? 2 : 0), textScale),
-1
);
if (gridStack.getTrackerEntry() != null) {
font.drawStringWithShadow(
TextFormatting.GRAY + TimeUtils.getAgo(gridStack.getTrackerEntry().getTime(), gridStack.getTrackerEntry().getName()),
TextFormatting.GRAY + I18n.format("misc.refinedstorage:total", gridStack.getFormattedFullQuantity()),
RenderUtils.getOffsetOnScale(tooltipX, textScale),
RenderUtils.getOffsetOnScale(tooltipTop + tooltipHeight - 6 - (font.getUnicodeFlag() ? 2 : 0), textScale),
RenderUtils.getOffsetOnScale(tooltipTop + tooltipHeight - (gridStack.getTrackerEntry() != null ? 15 : 6) - (font.getUnicodeFlag() ? 2 : 0), textScale),
-1
);
}
GlStateManager.popMatrix();
if (gridStack.getTrackerEntry() != null) {
font.drawStringWithShadow(
TextFormatting.GRAY + TimeUtils.getAgo(gridStack.getTrackerEntry().getTime(), gridStack.getTrackerEntry().getName()),
RenderUtils.getOffsetOnScale(tooltipX, textScale),
RenderUtils.getOffsetOnScale(tooltipTop + tooltipHeight - 6 - (font.getUnicodeFlag() ? 2 : 0), textScale),
-1
);
}
GlStateManager.popMatrix();
}
// RS END
GlStateManager.enableLighting();

View File

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

View File

@@ -20,19 +20,25 @@ public class SideButtonGridViewType extends SideButton {
@Override
protected void drawButtonIcon(int x, int y) {
gui.drawTexture(x, y, grid.getViewType() * 16, 112, 16, 16);
gui.drawTexture(x, y, (grid.getViewType() - (grid.getViewType() >= 3 ? 3 : 0)) * 16, 112, 16, 16);
}
@Override
public void actionPerformed() {
int type = grid.getViewType();
if (type == IGrid.VIEW_TYPE_NORMAL) {
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;
} else if (type == IGrid.VIEW_TYPE_NON_CRAFTABLES) {
type = IGrid.VIEW_TYPE_CRAFTABLES;
} else if (type == IGrid.VIEW_TYPE_CRAFTABLES) {
type = IGrid.VIEW_TYPE_NORMAL;
type = IGrid.VIEW_TYPE_NORMAL_DETAILED;
}
grid.onViewTypeChanged(type);

View File

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

View File

@@ -136,9 +136,12 @@ sidebutton.refinedstorage:redstone_mode.1=Only work with redstone signal
sidebutton.refinedstorage:redstone_mode.2=Only work without redstone signal
sidebutton.refinedstorage:grid.view_type=Display
sidebutton.refinedstorage:grid.view_type.0=Normal
sidebutton.refinedstorage:grid.view_type.1=No craftables
sidebutton.refinedstorage:grid.view_type.2=Only craftables
sidebutton.refinedstorage:grid.view_type.0=Normal (detailed)
sidebutton.refinedstorage:grid.view_type.1=No craftables (detailed)
sidebutton.refinedstorage:grid.view_type.2=Only craftables (detailed)
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.0=Ascending
sidebutton.refinedstorage:grid.sorting.direction.1=Descending