Fixes
This commit is contained in:
@@ -121,64 +121,49 @@ public class GuiGrid extends GuiBase {
|
|||||||
|
|
||||||
String query = searchField.getText().trim().toLowerCase();
|
String query = searchField.getText().trim().toLowerCase();
|
||||||
|
|
||||||
if (!query.isEmpty()) {
|
Iterator<ClientStack> t = items.iterator();
|
||||||
Iterator<ClientStack> t = items.iterator();
|
|
||||||
|
|
||||||
while (t.hasNext()) {
|
while (t.hasNext()) {
|
||||||
ClientStack stack = t.next();
|
ClientStack stack = t.next();
|
||||||
|
|
||||||
switch (grid.getViewType()) {
|
if (grid.getViewType() == TileGrid.VIEW_TYPE_NON_CRAFTABLES && stack.isCraftable()) {
|
||||||
case TileGrid.VIEW_TYPE_NORMAL:
|
t.remove();
|
||||||
break;
|
} else if (grid.getViewType() == TileGrid.VIEW_TYPE_CRAFTABLES && !stack.isCraftable()) {
|
||||||
case TileGrid.VIEW_TYPE_NON_CRAFTABLES:
|
t.remove();
|
||||||
if (stack.isCraftable()) {
|
}
|
||||||
t.remove();
|
|
||||||
|
|
||||||
continue;
|
if (query.startsWith("@")) {
|
||||||
|
String[] parts = query.split(" ");
|
||||||
|
|
||||||
|
String modId = parts[0].substring(1);
|
||||||
|
String modIdFromItem = Item.REGISTRY.getNameForObject(stack.getStack().getItem()).getResourceDomain();
|
||||||
|
|
||||||
|
if (!modIdFromItem.contains(modId)) {
|
||||||
|
t.remove();
|
||||||
|
} else if (parts.length >= 2) {
|
||||||
|
StringBuilder itemFromMod = new StringBuilder();
|
||||||
|
|
||||||
|
for (int i = 1; i < parts.length; ++i) {
|
||||||
|
itemFromMod.append(parts[i]);
|
||||||
|
|
||||||
|
if (i != parts.length - 1) {
|
||||||
|
itemFromMod.append(" ");
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
case TileGrid.VIEW_TYPE_CRAFTABLES:
|
|
||||||
if (!stack.isCraftable()) {
|
|
||||||
t.remove();
|
|
||||||
|
|
||||||
continue;
|
if (!stack.getStack().getDisplayName().toLowerCase().contains(itemFromMod.toString())) {
|
||||||
}
|
t.remove();
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
|
} else if (query.startsWith("#")) {
|
||||||
|
String tooltip = query.substring(1);
|
||||||
|
String tooltipFromItem = StringUtils.join(stack.getStack().getTooltip(container.getPlayer(), true), "\n");
|
||||||
|
|
||||||
if (query.startsWith("@")) {
|
if (!tooltipFromItem.contains(tooltip)) {
|
||||||
String[] parts = query.split(" ");
|
|
||||||
|
|
||||||
String modId = parts[0].substring(1);
|
|
||||||
String modIdFromItem = Item.REGISTRY.getNameForObject(stack.getStack().getItem()).getResourceDomain();
|
|
||||||
|
|
||||||
if (!modIdFromItem.contains(modId)) {
|
|
||||||
t.remove();
|
|
||||||
} else if (parts.length >= 2) {
|
|
||||||
StringBuilder itemFromMod = new StringBuilder();
|
|
||||||
|
|
||||||
for (int i = 1; i < parts.length; ++i) {
|
|
||||||
itemFromMod.append(parts[i]);
|
|
||||||
|
|
||||||
if (i != parts.length - 1) {
|
|
||||||
itemFromMod.append(" ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!stack.getStack().getDisplayName().toLowerCase().contains(itemFromMod.toString())) {
|
|
||||||
t.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (query.startsWith("#")) {
|
|
||||||
String tooltip = query.substring(1);
|
|
||||||
String tooltipFromItem = StringUtils.join(stack.getStack().getTooltip(container.getPlayer(), true), "\n");
|
|
||||||
|
|
||||||
if (!tooltipFromItem.contains(tooltip)) {
|
|
||||||
t.remove();
|
|
||||||
}
|
|
||||||
} else if (!stack.getStack().getDisplayName().toLowerCase().contains(query)) {
|
|
||||||
t.remove();
|
t.remove();
|
||||||
}
|
}
|
||||||
|
} else if (!stack.getStack().getDisplayName().toLowerCase().contains(query)) {
|
||||||
|
t.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -304,22 +304,22 @@ public class TileGrid extends TileNode implements IGrid {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewTypeChanged(int type) {
|
public void onViewTypeChanged(int type) {
|
||||||
RefinedStorage.INSTANCE.network.sendToServer(new MessageGridSettingsUpdate(this, sortingDirection, sortingType, searchBoxMode, type));
|
RefinedStorage.INSTANCE.network.sendToServer(new MessageGridSettingsUpdate(this, type, sortingDirection, sortingType, searchBoxMode));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSortingTypeChanged(int type) {
|
public void onSortingTypeChanged(int type) {
|
||||||
RefinedStorage.INSTANCE.network.sendToServer(new MessageGridSettingsUpdate(this, sortingDirection, type, searchBoxMode, viewType));
|
RefinedStorage.INSTANCE.network.sendToServer(new MessageGridSettingsUpdate(this, viewType, sortingDirection, type, searchBoxMode));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSortingDirectionChanged(int direction) {
|
public void onSortingDirectionChanged(int direction) {
|
||||||
RefinedStorage.INSTANCE.network.sendToServer(new MessageGridSettingsUpdate(this, direction, sortingType, searchBoxMode, viewType));
|
RefinedStorage.INSTANCE.network.sendToServer(new MessageGridSettingsUpdate(this, viewType, direction, sortingType, searchBoxMode));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSearchBoxModeChanged(int searchBoxMode) {
|
public void onSearchBoxModeChanged(int searchBoxMode) {
|
||||||
RefinedStorage.INSTANCE.network.sendToServer(new MessageGridSettingsUpdate(this, sortingDirection, sortingType, searchBoxMode, viewType));
|
RefinedStorage.INSTANCE.network.sendToServer(new MessageGridSettingsUpdate(this, viewType, sortingDirection, sortingType, searchBoxMode));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -73,28 +73,28 @@ public class WirelessGrid implements IGrid {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewTypeChanged(int type) {
|
public void onViewTypeChanged(int type) {
|
||||||
RefinedStorage.INSTANCE.network.sendToServer(new MessageWirelessGridSettingsUpdate(RefinedStorageUtils.getIdFromHand(hand), getSortingDirection(), getSortingType(), getSearchBoxMode(), type));
|
RefinedStorage.INSTANCE.network.sendToServer(new MessageWirelessGridSettingsUpdate(RefinedStorageUtils.getIdFromHand(hand), type, getSortingDirection(), getSortingType(), getSearchBoxMode()));
|
||||||
|
|
||||||
this.viewType = type;
|
this.viewType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSortingTypeChanged(int type) {
|
public void onSortingTypeChanged(int type) {
|
||||||
RefinedStorage.INSTANCE.network.sendToServer(new MessageWirelessGridSettingsUpdate(RefinedStorageUtils.getIdFromHand(hand), getSortingDirection(), type, getSearchBoxMode(), getViewType()));
|
RefinedStorage.INSTANCE.network.sendToServer(new MessageWirelessGridSettingsUpdate(RefinedStorageUtils.getIdFromHand(hand), getViewType(), getSortingDirection(), type, getSearchBoxMode()));
|
||||||
|
|
||||||
this.sortingType = type;
|
this.sortingType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSortingDirectionChanged(int direction) {
|
public void onSortingDirectionChanged(int direction) {
|
||||||
RefinedStorage.INSTANCE.network.sendToServer(new MessageWirelessGridSettingsUpdate(RefinedStorageUtils.getIdFromHand(hand), direction, getSortingType(), getSearchBoxMode(), getViewType()));
|
RefinedStorage.INSTANCE.network.sendToServer(new MessageWirelessGridSettingsUpdate(RefinedStorageUtils.getIdFromHand(hand), getViewType(), direction, getSortingType(), getSearchBoxMode()));
|
||||||
|
|
||||||
this.sortingDirection = direction;
|
this.sortingDirection = direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSearchBoxModeChanged(int searchBoxMode) {
|
public void onSearchBoxModeChanged(int searchBoxMode) {
|
||||||
RefinedStorage.INSTANCE.network.sendToServer(new MessageWirelessGridSettingsUpdate(RefinedStorageUtils.getIdFromHand(hand), getSortingDirection(), getSortingType(), searchBoxMode, getViewType()));
|
RefinedStorage.INSTANCE.network.sendToServer(new MessageWirelessGridSettingsUpdate(RefinedStorageUtils.getIdFromHand(hand), getViewType(), getSortingDirection(), getSortingType(), searchBoxMode));
|
||||||
|
|
||||||
this.searchBoxMode = searchBoxMode;
|
this.searchBoxMode = searchBoxMode;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user