mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-10-25 20:32:20 +00:00
Beta13:
* @Mod->item searching has been added using item subsets, allowing for things like `@Blocks.MobSpawners->zombie` * DoubleFilteredFilter - Requires both filters to apply (Subset & Pattern) * Finally updated the README.md
This commit is contained in:
1 parent
427793b41d
commit
63d6d20c96
6 files changed
+64
-8
No files matched your search
@@ -1,4 +1,4 @@
|
||||
# NotEnoughItems - GTNH
|
||||
# NotEnoughItems Unofficial - By the GTNH Team
|
||||
|
||||
A continuation of NotEnoughItems for 1.7.10 by the developers of Gregtech: New Horizons modpack, with features either inspired and/or backported from JustEnoughItems
|
||||
|
||||
@@ -10,12 +10,19 @@ We've tested this against all of the mods included in GTNH, as well as a limited
|
||||
|
||||
## New Features:
|
||||
|
||||
* Speed - Uses a parallel stream to search the item list over multiple cores, resulting in 2-6x faster searches on average [Feels instantaneous]
|
||||
* Speed
|
||||
- Uses a parallel stream to search the item list over multiple cores, resulting in 2-6x faster searches on average
|
||||
- Loads the recipe handlers in parallel
|
||||
* A textbox for search with most of the features you'd expect - moving forward, backwards, selection, etc
|
||||
* Bookmarks! What are you in the process of crafting? Bookmark it using either 'A' or configure your own key.
|
||||
* Toggle bookmark pane. Default shortcut key `B`. Item Subsets menu is only available if bookmarks are not visible.
|
||||
* Utility/Cheat buttons line up and wrap based on GUI size
|
||||
* ItemList is no longer regenerated from the ItemRegistry on every inventory load
|
||||
|
||||
* JEI (Or Creative) Style tabs [Optional] Note: Requires explicit support to be added for an ItemStack to render, otherwise falls back to the first two letters of the handler name.
|
||||
* Tabs/Handlers are loaded from a CSV config in the JAR (or optionally from the config folder). IMCEvent for mod authors to register this information is planned.
|
||||
* `@[Mod]->[item]` searching. ex: `@Gregtech->iron ingot`
|
||||
* Cycle between Recipe, Utility, and Cheat mode by cntrl clicking on the Wrench Icon
|
||||
|
||||
## Other items of note:
|
||||
|
||||
* Licensed under LGPL - Use this however you want, but please give back any modifications
|
||||
|
||||
+1
-1
@@ -2,4 +2,4 @@ mc_version=1.7.10
|
||||
forge_version=10.13.4.1614-1.7.10
|
||||
ccl_version=1.1.3.138
|
||||
ccc_version=1.0.7.+
|
||||
mod_version=2.1.0-GTNH-beta12
|
||||
mod_version=2.1.0-GTNH-beta13
|
||||
@@ -0,0 +1,22 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import codechicken.nei.api.ItemFilter;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class DoubleFilteredFilter implements ItemFilter {
|
||||
private ItemFilter filter;
|
||||
private ItemList.PatternItemFilter patternFilter;
|
||||
|
||||
public DoubleFilteredFilter(ItemFilter filter, String itemFilter) {
|
||||
this.filter = filter;
|
||||
this.patternFilter = new ItemList.PatternItemFilter(SearchField.getPattern(itemFilter));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(ItemStack item) {
|
||||
if(filter.matches(item)) {
|
||||
return patternFilter.matches(item);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -182,6 +182,7 @@ public class ItemList
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void execute() {
|
||||
// System.out.println("Executing NEI Item Loading");
|
||||
ThreadOperationTimer timer = getTimer(500);
|
||||
|
||||
@@ -217,7 +217,18 @@ public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoa
|
||||
for(SubsetTag tag : sorted)
|
||||
tag.cacheState();
|
||||
}
|
||||
public void addFiltersWithItem(List<ItemFilter> filters, String itemSearch) {
|
||||
if(itemSearch == null) {
|
||||
addFilters(filters);
|
||||
} else {
|
||||
if(filter != null)
|
||||
filters.add(new DoubleFilteredFilter(filter, itemSearch));
|
||||
|
||||
for(SubsetTag child : sorted)
|
||||
child.addFiltersWithItem(filters, itemSearch);
|
||||
|
||||
}
|
||||
}
|
||||
public void addFilters(List<ItemFilter> filters) {
|
||||
if(filter != null)
|
||||
filters.add(filter);
|
||||
@@ -826,20 +837,32 @@ public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoa
|
||||
return null;
|
||||
|
||||
searchText = searchText.substring(1);
|
||||
String itemSearch = null;
|
||||
if(searchText.contains("->")) {
|
||||
String[] split = searchText.split("->");
|
||||
searchText = split[0];
|
||||
if(split.length > 1) itemSearch = split[1];
|
||||
}
|
||||
|
||||
AnyMultiItemFilter filter = new AnyMultiItemFilter();
|
||||
SubsetTag tag = getTag(searchText);
|
||||
if(tag != null)
|
||||
tag.addFilters(filter.filters);
|
||||
if(tag != null) {
|
||||
// We've got an exact match
|
||||
tag.addFiltersWithItem(filter.filters, itemSearch);
|
||||
}
|
||||
else {
|
||||
// Try searching for a substring
|
||||
Pattern p = SearchField.getPattern(searchText);
|
||||
if(p == null) return null;
|
||||
|
||||
List<SubsetTag> matching = new LinkedList<>();
|
||||
root.search(matching, p);
|
||||
if(matching.isEmpty()) return null;
|
||||
for(SubsetTag tag2 : matching)
|
||||
tag2.addFilters(filter.filters);
|
||||
for(SubsetTag tag2 : matching) {
|
||||
tag2.addFiltersWithItem(filter.filters, itemSearch);
|
||||
}
|
||||
}
|
||||
|
||||
return filter;
|
||||
}
|
||||
|
||||
|
||||
@@ -265,6 +265,7 @@ public class ItemInfo
|
||||
API.addOption(new HandlerDumper("tools.dump.handlers"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static void parseModItems() {
|
||||
HashMap<String, ItemStackSet> modSubsets = new HashMap<>();
|
||||
for (Item item : (Iterable<Item>) Item.itemRegistry) {
|
||||
@@ -330,6 +331,7 @@ public class ItemInfo
|
||||
API.addSubset("Blocks.MobSpawners", ItemStackSet.of(Blocks.mob_spawner));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static void searchItems() {
|
||||
ItemStackSet tools = new ItemStackSet();
|
||||
ItemStackSet picks = new ItemStackSet();
|
||||
@@ -452,6 +454,7 @@ public class ItemInfo
|
||||
addEntityEgg(EntityIronGolem.class, 0xC5C2C1, 0xffe1cc);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static void addEntityEgg(Class<?> entity, int i, int j) {
|
||||
int id = (Integer)EntityList.classToIDMapping.get(entity);
|
||||
EntityList.entityEggs.put(id, new EntityEggInfo(id, i, j));
|
||||
|
||||
Reference in new issue
Block a user