Compare commits

...
7 changed files with 52 additions and 23 deletions

No files matched your search

@@ -23,6 +23,7 @@ public abstract class RecipeSearchField extends TextField implements ItemFilterP
final GuiSearchField field = new GuiSearchField();
field.setMaxStringLength(maxSearchLength);
field.setCursorPositionZero();
field.setSkipRecipeTokens(true);
((SearchTextFormatter) field.getFormatter()).setContextToken("<>");
this.field = field;
}
@@ -93,6 +93,7 @@ public class SearchField extends TextField implements ItemFilterProvider {
public static class GuiSearchField extends FormattedTextField implements ItemFilterProvider, IRecipeFilterProvider {
protected final SearchTokenParser searchParser;
protected boolean skipRecipeTokens = false;
public GuiSearchField() {
this(SearchField.searchParser);
@@ -106,6 +107,10 @@ public class SearchField extends TextField implements ItemFilterProvider {
setPlaceholder(NEIClientUtils.translate("inventory.search.placeholder"));
}
public void setSkipRecipeTokens(boolean skipRecipeTokens) {
this.skipRecipeTokens = skipRecipeTokens;
}
@Override
public ItemFilter getFilter() {
return getFilter(getText());
@@ -117,7 +122,7 @@ public class SearchField extends TextField implements ItemFilterProvider {
}
public ItemFilter getFilter(String filterText) {
return this.searchParser.getFilter(filterText);
return this.searchParser.getFilter(filterText, this.skipRecipeTokens);
}
public IRecipeFilter getRecipeFilter(String filterText) {
@@ -42,7 +42,9 @@ public class SearchTextFormatter implements TextFormatter {
if (!contextPart[0].isEmpty()) {
formattedText.append(
SearchExpressionUtils.HIGHLIGHTS.RECIPE + contextPart[0] + EnumChatFormatting.RESET);
SearchExpressionUtils.HIGHLIGHTS.RECIPE + contextPart[0].substring(0, 1)
+ EnumChatFormatting.RESET);
contextPart[1] = contextPart[0].substring(1) + contextPart[1];
}
if (contextPart[1].isEmpty()) {
@@ -173,7 +173,11 @@ public class SearchTokenParser {
}
public synchronized ItemFilter getFilter(String filterText) {
filterText = EnumChatFormatting.getTextWithoutFormattingCodes(filterText).toLowerCase();
return getFilter(filterText, false);
}
public synchronized ItemFilter getFilter(String rawText, boolean skipRecipeTokens) {
final String filterText = EnumChatFormatting.getTextWithoutFormattingCodes(rawText).toLowerCase();
if (filterText == null || filterText.isEmpty()) {
return new EverythingItemFilter();
@@ -182,10 +186,10 @@ public class SearchTokenParser {
final int patternMode = NEIClientConfig.getIntSetting("inventory.search.patternMode");
if (patternMode != 3) {
return this.filtersCache.computeIfAbsent(filterText, text -> {
return this.filtersCache.computeIfAbsent(skipRecipeTokens + ":" + filterText, _t -> {
final List<ItemFilter> searchTokens = new ArrayList<>();
for (String[] subQuery : splitByDelimiters(text, "|", false)) {
for (String[] subQuery : splitByDelimiters(filterText, "|", false)) {
if (subQuery[1].isEmpty()) {
continue;
@@ -193,11 +197,22 @@ public class SearchTokenParser {
final List<ItemFilter> tokens = new ArrayList<>();
for (SearchToken token : splitSearchText(subQuery[1])) {
final ItemFilter result = token.getFilter(this);
for (String[] contextQuery : splitByDelimiters(subQuery[1], skipRecipeTokens ? "<>" : "", false)) {
if (result != null) {
tokens.add(result);
if (contextQuery[1].isEmpty() || contextQuery[0].startsWith(">")) {
continue;
}
if (!contextQuery[0].isEmpty()) {
contextQuery[0] = contextQuery[0].substring(1);
}
for (SearchToken token : splitSearchText(contextQuery[0] + contextQuery[1])) {
final ItemFilter result = token.getFilter(this);
if (result != null) {
tokens.add(result);
}
}
}
@@ -38,7 +38,11 @@ public class WorldOverlayRenderer implements IKeyStateTracker {
public void tickKeyStates() {
if (Minecraft.getMinecraft().currentScreen != null) return;
if (KeyManager.keyStates.get("world.moboverlay").down) mobOverlay = (mobOverlay + 1) % 2;
if (KeyManager.keyStates.get("world.moboverlay").down) {
mobOverlay = (mobOverlay + 1) % 2;
NEIClientUtils
.printChatMessage(new ChatComponentText(NEIClientUtils.translate("chat.moboverlay." + mobOverlay)));
}
if (KeyManager.keyStates.get("world.chunkoverlay").down) {
chunkOverlay = (chunkOverlay + 1) % (NEIModContainer.isGT5Loaded() ? 4 : 3);
// 0-2 (or 3 with gt)
@@ -73,9 +77,11 @@ public class WorldOverlayRenderer implements IKeyStateTracker {
}
World world = entity.worldObj;
int worldHeight = world.getHeight();
int x1 = (int) entity.posX;
int z1 = (int) entity.posZ;
int y1 = (int) MathHelper.clip(entity.posY, 16, world.getHeight() - 16);
int y1 = (int) MathHelper.clip(entity.posY, 16, worldHeight - 16);
for (int i = 0; i <= 32; i++) {
int x = x1 - 16 + i;
@@ -94,6 +100,12 @@ public class WorldOverlayRenderer implements IKeyStateTracker {
for (int k = 0; k <= 32; k++) {
int y = y1 - 16 + k;
if (y >= worldHeight) {
mobSpawnCache[bufIndex + k] = -1;
continue;
}
if (y > maxHeight) {
mobSpawnCache[bufIndex + k] = -1;
break;
@@ -177,6 +189,10 @@ public class WorldOverlayRenderer implements IKeyStateTracker {
private static final AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(0, 0, 0, 0, 0, 0);
private static byte getSpawnMode(Chunk chunk, int x, int y, int z) {
if (y >= chunk.worldObj.getHeight()) {
return 0;
}
if (chunk.getSavedLightValue(EnumSkyBlock.Block, x & 15, y, z & 15) >= 8
|| !SpawnerAnimals.canCreatureTypeSpawnAtLocation(EnumCreatureType.monster, chunk.worldObj, x, y, z)) {
return 0;
@@ -557,7 +557,6 @@ connor135246.campfirebackport.client.compat.nei.NEICampfireStateChangerHandler,c
smelting,Natura:NetherFurnace,,Natura,TRUE,,,,,,
crafting,gregtech:gt.metaitem.01:32744,,gregtech,TRUE,gregapi_post,,,,,"GT5 start: for readability, keep all GTNH-related catalysts below"
gt.recipe.primitiveblastfurnace,gregtech:gt.blockmachines:140,,gregtech,TRUE,gregapi_post,,,,,
gt.recipe.primitiveblastfurnace,gregtech:gt.blockmachines:108,,gregtech,TRUE,gregapi_post,,,,,
smelting,gregtech:gt.blockmachines:103,,gregtech,TRUE,gregapi_post,,,,,
smelting,gregtech:gt.blockmachines:104,,gregtech,TRUE,gregapi_post,,,,,
gt.recipe.macerator,gregtech:gt.blockmachines:106,,gregtech,TRUE,gregapi_post,,,,,
@@ -1172,11 +1171,8 @@ gt.recipe.circuitassembler,gregtech:gt.blockmachines:12096,,dreamcraft,TRUE,,,,,
gt.recipe.alloysmelter,gregtech:gt.blockmachines:31023,,miscutils,TRUE,,,,,,
gt.recipe.assembler,gregtech:gt.blockmachines:876,,miscutils,TRUE,,,,,,
gt.recipe.metalbender,gregtech:gt.blockmachines:792,,miscutils,TRUE,,,,,,
gt.recipe.compressor,gregtech:gt.blockmachines:860,,miscutils,TRUE,,,,,,
gt.recipe.cuttingsaw,gregtech:gt.blockmachines:992,,miscutils,TRUE,,,,,,
gt.recipe.extractor,gregtech:gt.blockmachines:860,,miscutils,TRUE,,,,,,
gt.recipe.extruder,gregtech:gt.blockmachines:859,,miscutils,TRUE,,,,,,
gt.recipe.lathe,gregtech:gt.blockmachines:860,,miscutils,TRUE,,,,,,
gt.recipe.macerator,gregtech:gt.blockmachines:31041,,miscutils,TRUE,,,,,,
gt.recipe.macerator,gregtech:gt.blockmachines:797,,miscutils,TRUE,,,,,,
ic2.recycler,gregtech:gt.blockmachines:799,,miscutils,TRUE,,,,,,
@@ -1185,15 +1181,9 @@ gt.recipe.thermalcentrifuge,gregtech:gt.blockmachines:849,,miscutils,TRUE,,,,,,
gt.recipe.orewasher,gregtech:gt.blockmachines:850,,miscutils,TRUE,,,,,,
gt.recipe.packager,gregtech:gt.blockmachines:942,,miscutils,TRUE,,,,,,
gt.recipe.rockbreaker,gregtech:gt.blockmachines:31065,,miscutils,TRUE,,,,,,
gt.recipe.fermenter,gregtech:gt.blockmachines:860,,miscutils,TRUE,,,,,,
gt.recipe.fluidextractor,gregtech:gt.blockmachines:860,,miscutils,TRUE,,,,,,
gt.recipe.fluidsolidifier,gregtech:gt.blockmachines:860,,miscutils,TRUE,,,,,,
gt.recipe.distillery,gregtech:gt.blockmachines:31021,,miscutils,TRUE,,,,,,
gt.recipe.distillationtower,gregtech:gt.blockmachines:31021,,miscutils,TRUE,,,,,,
gt.recipe.chemicalbath,gregtech:gt.blockmachines:850,,miscutils,TRUE,,,,,,
gt.recipe.polarizer,gregtech:gt.blockmachines:860,,miscutils,TRUE,,,,,,
gt.recipe.autoclave,gregtech:gt.blockmachines:860,,miscutils,TRUE,,,,,,
gt.recipe.laserengraver,gregtech:gt.blockmachines:860,,miscutils,TRUE,,,,,,
gt.recipe.press,gregtech:gt.blockmachines:792,,miscutils,TRUE,,,,,,
gt.recipe.slicer,gregtech:gt.blockmachines:992,,miscutils,TRUE,,,,,,
gt.recipe.sifter,gregtech:gt.blockmachines:840,,miscutils,TRUE,,,,,,
@@ -1201,8 +1191,6 @@ gt.recipe.arcfurnace,gregtech:gt.blockmachines:862,,miscutils,TRUE,,,,,,
gt.recipe.plasmaarcfurnace,gregtech:gt.blockmachines:862,,miscutils,TRUE,,,,,,
gt.recipe.blastfurnace,gregtech:gt.blockmachines:963,,miscutils,TRUE,,,,,,
gt.recipe.implosioncompressor,gregtech:gt.blockmachines:964,,miscutils,TRUE,,,,,,
gt.recipe.dieselgeneratorfuel,gregtech:gt.blockmachines:960,,miscutils,TRUE,,10,,,,
gt.recipe.gasturbinefuel,gregtech:gt.blockmachines:961,,miscutils,TRUE,,10,,,,
gtpp.recipe.chemicaldehydrator,gregtech:gt.blockmachines:911,,miscutils,TRUE,,,,,,
gtpp.recipe.chemicaldehydrator,gregtech:gt.blockmachines:912,,miscutils,TRUE,,,,,,
gtpp.recipe.chemicaldehydrator,gregtech:gt.blockmachines:813,,miscutils,TRUE,,,,,,
1 handler itemName nbtInfo modId modRequired excludedModId priority minVersion maxVersion forceClassName itemNotes
557 smelting Natura:NetherFurnace Natura TRUE
558 crafting gregtech:gt.metaitem.01:32744 gregtech TRUE gregapi_post GT5 start: for readability, keep all GTNH-related catalysts below
559 gt.recipe.primitiveblastfurnace gregtech:gt.blockmachines:140 gregtech TRUE gregapi_post
gt.recipe.primitiveblastfurnace gregtech:gt.blockmachines:108 gregtech TRUE gregapi_post
560 smelting gregtech:gt.blockmachines:103 gregtech TRUE gregapi_post
561 smelting gregtech:gt.blockmachines:104 gregtech TRUE gregapi_post
562 gt.recipe.macerator gregtech:gt.blockmachines:106 gregtech TRUE gregapi_post
1171 gt.recipe.alloysmelter gregtech:gt.blockmachines:31023 miscutils TRUE
1172 gt.recipe.assembler gregtech:gt.blockmachines:876 miscutils TRUE
1173 gt.recipe.metalbender gregtech:gt.blockmachines:792 miscutils TRUE
gt.recipe.compressor gregtech:gt.blockmachines:860 miscutils TRUE
1174 gt.recipe.cuttingsaw gregtech:gt.blockmachines:992 miscutils TRUE
gt.recipe.extractor gregtech:gt.blockmachines:860 miscutils TRUE
1175 gt.recipe.extruder gregtech:gt.blockmachines:859 miscutils TRUE
gt.recipe.lathe gregtech:gt.blockmachines:860 miscutils TRUE
1176 gt.recipe.macerator gregtech:gt.blockmachines:31041 miscutils TRUE
1177 gt.recipe.macerator gregtech:gt.blockmachines:797 miscutils TRUE
1178 ic2.recycler gregtech:gt.blockmachines:799 miscutils TRUE
1181 gt.recipe.orewasher gregtech:gt.blockmachines:850 miscutils TRUE
1182 gt.recipe.packager gregtech:gt.blockmachines:942 miscutils TRUE
1183 gt.recipe.rockbreaker gregtech:gt.blockmachines:31065 miscutils TRUE
gt.recipe.fermenter gregtech:gt.blockmachines:860 miscutils TRUE
gt.recipe.fluidextractor gregtech:gt.blockmachines:860 miscutils TRUE
gt.recipe.fluidsolidifier gregtech:gt.blockmachines:860 miscutils TRUE
1184 gt.recipe.distillery gregtech:gt.blockmachines:31021 miscutils TRUE
1185 gt.recipe.distillationtower gregtech:gt.blockmachines:31021 miscutils TRUE
1186 gt.recipe.chemicalbath gregtech:gt.blockmachines:850 miscutils TRUE
gt.recipe.polarizer gregtech:gt.blockmachines:860 miscutils TRUE
gt.recipe.autoclave gregtech:gt.blockmachines:860 miscutils TRUE
gt.recipe.laserengraver gregtech:gt.blockmachines:860 miscutils TRUE
1187 gt.recipe.press gregtech:gt.blockmachines:792 miscutils TRUE
1188 gt.recipe.slicer gregtech:gt.blockmachines:992 miscutils TRUE
1189 gt.recipe.sifter gregtech:gt.blockmachines:840 miscutils TRUE
1191 gt.recipe.plasmaarcfurnace gregtech:gt.blockmachines:862 miscutils TRUE
1192 gt.recipe.blastfurnace gregtech:gt.blockmachines:963 miscutils TRUE
1193 gt.recipe.implosioncompressor gregtech:gt.blockmachines:964 miscutils TRUE
gt.recipe.dieselgeneratorfuel gregtech:gt.blockmachines:960 miscutils TRUE 10
gt.recipe.gasturbinefuel gregtech:gt.blockmachines:961 miscutils TRUE 10
1194 gtpp.recipe.chemicaldehydrator gregtech:gt.blockmachines:911 miscutils TRUE
1195 gtpp.recipe.chemicaldehydrator gregtech:gt.blockmachines:912 miscutils TRUE
1196 gtpp.recipe.chemicaldehydrator gregtech:gt.blockmachines:813 miscutils TRUE
@@ -137,6 +137,8 @@ nei.chat.chunkoverlay.0=Chunk Overlay: Off
nei.chat.chunkoverlay.1=Chunk Overlay: Chunk Corners
nei.chat.chunkoverlay.2=Chunk Overlay: Chunks
nei.chat.chunkoverlay.3=Chunk Overlay: GT Ore Veins
nei.chat.moboverlay.0=Mob Spawning Overlay: §cOff
nei.chat.moboverlay.1=Mob Spawning Overlay: §2On
nei.chat.item_link.text=<%s> §6Click to add bookmark: %s
nei.chat.bookmark_added.text=Bookmark added!