diff --git a/gradle.properties b/gradle.properties index 448520d..a773582 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,7 +11,7 @@ loader_version=0.15.11 fabric_version=0.100.4+1.21 # Mod Properties -mod_version=3.0.0 +mod_version=3.0.1 maven_group=systems.brn archives_base_name=Server_storage diff --git a/src/main/java/systems/brn/server_storage/screens/StorageScreen.java b/src/main/java/systems/brn/server_storage/screens/StorageScreen.java index 7614abe..35f7f31 100644 --- a/src/main/java/systems/brn/server_storage/screens/StorageScreen.java +++ b/src/main/java/systems/brn/server_storage/screens/StorageScreen.java @@ -61,15 +61,15 @@ public class StorageScreen extends PagedGui { @Override protected int getPageAmount() { - return Math.ceilDivExact(blockEntity.network.itemStackMap.size(), 9 * 6); + return Math.ceilDivExact(blockEntity.network.filteredItemStackMap.size(), 9 * 6); } @Override protected DisplayElement getElement(int id) { - if (blockEntity.network.itemStackMap.size() > id) { - ItemStack itemStackKey = (ItemStack) blockEntity.network.itemStackMap.keySet().toArray()[id]; + if (blockEntity.network.filteredItemStackMap.size() > id) { + ItemStack itemStackKey = (ItemStack) blockEntity.network.filteredItemStackMap.keySet().toArray()[id]; ItemStack aestheticStack = itemStackKey.copy(); - int count = blockEntity.network.itemStackMap.get(itemStackKey); + int count = blockEntity.network.filteredItemStackMap.get(itemStackKey); aestheticStack.setCount(Math.min(aestheticStack.getMaxCount(), count)); ItemStack newStack = addCountToLore(count, aestheticStack, null); GuiElementBuilder guiElement = new GuiElementBuilder(newStack); @@ -137,9 +137,13 @@ public class StorageScreen extends PagedGui { @Override protected DisplayElement search() { + String searchString = blockEntity.searchString; + if (searchString == null || searchString.isEmpty() || searchString.equals("*")) { + searchString = "Filter not set"; + } return DisplayElement.of( new GuiElementBuilder(Items.PLAYER_HEAD) - .setName(Text.translatable("itemGroup.search").formatted(Formatting.WHITE)) + .setName(Text.literal(searchString).formatted(Formatting.WHITE)) .hideDefaultTooltip().noDefaults() .setSkullOwner(GUI_QUESTION_MARK) .setCallback((x, y, z) -> {