From 4f78e7ecc8a5247459ea38511ba1996b168371a0 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Thu, 15 Oct 2020 20:52:59 +0200 Subject: [PATCH] added a mod filter modifier --- .../prettypipes/misc/ItemEqualityType.java | 3 ++- .../ellpeck/prettypipes/misc/ItemOrder.java | 2 +- .../terminal/containers/ItemTerminalGui.java | 2 +- .../assets/prettypipes/lang/en_us.json | 2 ++ .../models/item/mod_filter_modifier.json | 6 +++++ .../textures/item/mod_filter_modifier.png | Bin 0 -> 310 bytes .../recipes/mod_filter_modifier.json | 22 ++++++++++++++++++ 7 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 src/main/resources/assets/prettypipes/models/item/mod_filter_modifier.json create mode 100644 src/main/resources/assets/prettypipes/textures/item/mod_filter_modifier.png create mode 100644 src/main/resources/data/prettypipes/recipes/mod_filter_modifier.json diff --git a/src/main/java/de/ellpeck/prettypipes/misc/ItemEqualityType.java b/src/main/java/de/ellpeck/prettypipes/misc/ItemEqualityType.java index 56bd97e..4d40313 100644 --- a/src/main/java/de/ellpeck/prettypipes/misc/ItemEqualityType.java +++ b/src/main/java/de/ellpeck/prettypipes/misc/ItemEqualityType.java @@ -17,7 +17,8 @@ public enum ItemEqualityType { if (filterTags.isEmpty()) return false; return stackTags.containsAll(filterTags); - }, true); + }, true), + MOD((stack, filter) -> stack.getItem().getCreatorModId(stack).equals(filter.getItem().getCreatorModId(filter)), true); public final BiFunction filter; public final boolean ignoreItemEquality; diff --git a/src/main/java/de/ellpeck/prettypipes/misc/ItemOrder.java b/src/main/java/de/ellpeck/prettypipes/misc/ItemOrder.java index f6ae889..0337238 100644 --- a/src/main/java/de/ellpeck/prettypipes/misc/ItemOrder.java +++ b/src/main/java/de/ellpeck/prettypipes/misc/ItemOrder.java @@ -7,7 +7,7 @@ import java.util.Comparator; public enum ItemOrder { AMOUNT(Comparator.comparingInt(ItemStack::getCount)), NAME(Comparator.comparing(s -> s.getDisplayName().getString())), - MOD(Comparator.comparing(s -> s.getItem().getRegistryName().getNamespace())); + MOD(Comparator.comparing(s -> s.getItem().getCreatorModId(s))); public final Comparator comparator; diff --git a/src/main/java/de/ellpeck/prettypipes/terminal/containers/ItemTerminalGui.java b/src/main/java/de/ellpeck/prettypipes/terminal/containers/ItemTerminalGui.java index d59e998..6faa555 100644 --- a/src/main/java/de/ellpeck/prettypipes/terminal/containers/ItemTerminalGui.java +++ b/src/main/java/de/ellpeck/prettypipes/terminal/containers/ItemTerminalGui.java @@ -173,7 +173,7 @@ public class ItemTerminalGui extends ContainerScreen { String search = searchText; String toCompare; if (search.startsWith("@")) { - toCompare = s.getLeft().getItem().getRegistryName().getNamespace(); + toCompare = s.getLeft().getItem().getCreatorModId(s.getLeft()); search = search.substring(1); } else { // don't use formatted text here since we want to search for name diff --git a/src/main/resources/assets/prettypipes/lang/en_us.json b/src/main/resources/assets/prettypipes/lang/en_us.json index 672266d..f475d51 100644 --- a/src/main/resources/assets/prettypipes/lang/en_us.json +++ b/src/main/resources/assets/prettypipes/lang/en_us.json @@ -25,6 +25,7 @@ "item.prettypipes.damage_filter_modifier": "Damage Filter Modifier", "item.prettypipes.nbt_filter_modifier": "Data Filter Modifier", "item.prettypipes.tag_filter_modifier": "Tag Filter Modifier", + "item.prettypipes.mod_filter_modifier": "Mod Filter Modifier", "item.prettypipes.redstone_module": "Redstone Module", "item.prettypipes.filter_increase_modifier": "Filter Increase Modifier", "info.prettypipes.extraction_module": "Pulls items from adjacent inventories\nFilters and pull rates vary by tier\nHigh tiers prevent over-sending", @@ -36,6 +37,7 @@ "info.prettypipes.damage_filter_modifier": "Causes any filter slots to filter by item damage", "info.prettypipes.nbt_filter_modifier": "Causes any filter slots to filter by item data (NBT)", "info.prettypipes.tag_filter_modifier": "Causes any filter slots to filter by tags\n(Modern equivalent of the Ore Dictionary)", + "info.prettypipes.mod_filter_modifier": "Causes any filter slots to filter by mod", "info.prettypipes.redstone_module": "Allows disabling the pipe with a redstone signal\nWorks for both extraction and retrieval", "info.prettypipes.item_terminal": "Allows viewing and requesting all items in a pipe network\nAlso has slots for putting items into the network", "info.prettypipes.crafting_terminal": "Allows requesting ingredients for crafting recipes\nSupports auto-filling from JEI if installed", diff --git a/src/main/resources/assets/prettypipes/models/item/mod_filter_modifier.json b/src/main/resources/assets/prettypipes/models/item/mod_filter_modifier.json new file mode 100644 index 0000000..904b7ba --- /dev/null +++ b/src/main/resources/assets/prettypipes/models/item/mod_filter_modifier.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "prettypipes:item/mod_filter_modifier" + } +} diff --git a/src/main/resources/assets/prettypipes/textures/item/mod_filter_modifier.png b/src/main/resources/assets/prettypipes/textures/item/mod_filter_modifier.png new file mode 100644 index 0000000000000000000000000000000000000000..1edb5beaa64f4f018bbd329bb1ae902e842b13d3 GIT binary patch literal 310 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|K6tt~hFJ6_ zCnzx2=n4JfPu_e$;`a8OAN{eGVjJ`&&!x0v)_r}Z>sWiwJy=o#2yRreO4ilY^}k}0 zNJvdQnt5OsyTDF`*6#&o!W(CSR8%}lH~w(sd|Cn!RHQ|ony~G+y0UPbEKAIx0}V&H z4GaoDg{*n>bLUNg@H@L&?>4k86Jv99bmZxMe}8}b=KB9XdDD|C7A{=J=4$9u>>SJM z48&~*BMvj%708kLClT>Bhc>*p00i_>zopr0185PegFUf literal 0 HcmV?d00001 diff --git a/src/main/resources/data/prettypipes/recipes/mod_filter_modifier.json b/src/main/resources/data/prettypipes/recipes/mod_filter_modifier.json new file mode 100644 index 0000000..3558171 --- /dev/null +++ b/src/main/resources/data/prettypipes/recipes/mod_filter_modifier.json @@ -0,0 +1,22 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + " H ", + "RMR", + " R " + ], + "key": { + "R": { + "item": "minecraft:redstone" + }, + "H": { + "item": "minecraft:anvil" + }, + "M": { + "item": "prettypipes:blank_module" + } + }, + "result": { + "item": "prettypipes:mod_filter_modifier" + } +} \ No newline at end of file