mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-16 18:54:45 +00:00
Compare commits
24
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f0a554bcc1 | ||
|
|
65781a1649 | ||
|
|
6ad8f05323 | ||
|
|
d61a545d9d | ||
|
|
1774685af6 | ||
|
|
a63a227c3c | ||
|
|
0f115d5439 | ||
|
|
0fad93fb3b | ||
|
|
b1a34c761b | ||
|
|
cc9715d9f2 | ||
|
|
be253a00d2 | ||
|
|
5dde3b2e2f | ||
|
|
8da541460f | ||
|
|
dc4426d9c9 | ||
|
|
d05a9eafb3 | ||
|
|
5056fe5437 | ||
|
|
9fd9aad357 | ||
|
|
acaead41ee | ||
|
|
951f1b0d0d | ||
|
|
daab313288 | ||
|
|
25eaa492f7 | ||
|
|
1b34b24495 | ||
|
|
b9cd48f8f9 | ||
|
|
b2afc8c9e0 |
No files matched your search
+1
-2
@@ -1,7 +1,6 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:CodeChickenLib:1.2.1:dev')
|
||||
api('com.github.GTNewHorizons:CodeChickenCore:1.2.1:dev')
|
||||
api('com.github.GTNewHorizons:CodeChickenCore:1.3.6:dev')
|
||||
shadowImplementation('org.apache.commons:commons-csv:1.10.0')
|
||||
}
|
||||
+14
-3
@@ -85,6 +85,11 @@ accessTransformersFile = nei_at.cfg
|
||||
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
||||
usesMixins = false
|
||||
|
||||
# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
|
||||
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
|
||||
# Mixin classes will have access to "main" classes, but not the other way around.
|
||||
separateMixinSourceSet =
|
||||
|
||||
# Adds some debug arguments like verbose output and class export.
|
||||
usesMixinDebug = false
|
||||
|
||||
@@ -117,9 +122,15 @@ minimizeShadowedDependencies = true
|
||||
# If disabled, won't rename the shadowed classes.
|
||||
relocateShadowedDependencies = true
|
||||
|
||||
# Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories.
|
||||
# Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
|
||||
includeWellKnownRepositories = true
|
||||
|
||||
# A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated
|
||||
# list of strings, with the acceptable keys being(case does not matter):
|
||||
# cursemaven
|
||||
# modrinth
|
||||
excludeWellKnownRepositories =
|
||||
|
||||
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
|
||||
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
|
||||
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
|
||||
@@ -141,7 +152,7 @@ modrinthProjectId = notenoughitems-unofficial
|
||||
# and the name is the Modrinth project or version slug/id of the other mod.
|
||||
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
|
||||
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
|
||||
modrinthRelations = required-project\:codechickenlib-unofficial;required-project\:codechickencore-unofficial
|
||||
modrinthRelations = required-project\:codechickencore-unofficial
|
||||
|
||||
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
|
||||
#
|
||||
@@ -155,7 +166,7 @@ curseForgeProjectId = 358228
|
||||
# and the name is the CurseForge project slug of the other mod.
|
||||
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
|
||||
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
|
||||
curseForgeRelations = requiredDependency\:codechickencore-unofficial;requiredDependency\:codechickenlib-unofficial
|
||||
curseForgeRelations = requiredDependency\:codechickencore-unofficial
|
||||
|
||||
# Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older
|
||||
# projects. New projects should not use this parameter.
|
||||
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
@@ -55,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@@ -84,7 +86,8 @@ done
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
||||
' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
Vendored
+2
@@ -13,6 +13,8 @@
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.15'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.26'
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -14,11 +14,13 @@ import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@@ -98,8 +100,7 @@ public class BookmarkPanel extends PanelWidget {
|
||||
ItemStackMetadata meta = topItemIndex >= 0 ? BGrid.metadata.get(topItemIndex) : null;
|
||||
|
||||
if (meta != null && meta.recipeId != null) {
|
||||
while (topItemIndex > 0 && meta.groupId == BGrid.metadata.get(topItemIndex - 1).groupId
|
||||
&& meta.recipeId.equals(BGrid.metadata.get(topItemIndex - 1).recipeId)) {
|
||||
while (topItemIndex > 0 && meta.equalsRecipe(BGrid.metadata.get(topItemIndex - 1))) {
|
||||
topItemIndex--;
|
||||
}
|
||||
|
||||
@@ -118,8 +119,7 @@ public class BookmarkPanel extends PanelWidget {
|
||||
if (meta != null && meta.recipeId != null) {
|
||||
int size = BGrid.size();
|
||||
|
||||
while (bottomItemIndex < size - 1 && meta.groupId == BGrid.metadata.get(bottomItemIndex + 1).groupId
|
||||
&& meta.recipeId.equals(BGrid.metadata.get(bottomItemIndex + 1).recipeId)) {
|
||||
while (bottomItemIndex < size - 1 && meta.equalsRecipe(BGrid.metadata.get(bottomItemIndex + 1))) {
|
||||
bottomItemIndex++;
|
||||
}
|
||||
|
||||
@@ -148,9 +148,21 @@ public class BookmarkPanel extends PanelWidget {
|
||||
this.fluidDisplay = fluidDisplay;
|
||||
}
|
||||
|
||||
public ItemStackMetadata(BookmarkRecipeId recipeId, NBTTagCompound nbTag, boolean ingredient, Integer groupId) {
|
||||
this(recipeId, nbTag.getInteger("Count"), ingredient, groupId, nbTag.hasKey("gtFluidName"));
|
||||
}
|
||||
|
||||
public ItemStackMetadata copy() {
|
||||
return new ItemStackMetadata(this.recipeId, this.factor, this.ingredient, this.groupId, this.fluidDisplay);
|
||||
}
|
||||
|
||||
public boolean equalsRecipe(ItemStackMetadata meta) {
|
||||
return equalsRecipe(meta.recipeId, meta.groupId);
|
||||
}
|
||||
|
||||
public boolean equalsRecipe(BookmarkRecipeId recipeId, int groupId) {
|
||||
return groupId == this.groupId && recipeId != null && recipeId.equals(this.recipeId);
|
||||
}
|
||||
}
|
||||
|
||||
public static enum BookmarkViewMode {
|
||||
@@ -163,6 +175,26 @@ public class BookmarkPanel extends PanelWidget {
|
||||
LOADED
|
||||
}
|
||||
|
||||
public static class BookmarkRecipe {
|
||||
|
||||
public String handlerName = "";
|
||||
public List<ItemStack> result = new ArrayList<>();
|
||||
public List<ItemStack> ingredients = new ArrayList<>();
|
||||
|
||||
public BookmarkRecipe(ItemStack... result) {
|
||||
this.result.addAll(Arrays.asList(result));
|
||||
}
|
||||
|
||||
public BookmarkRecipeId getRecipeId() {
|
||||
|
||||
if (!handlerName.isEmpty() && !ingredients.isEmpty()) {
|
||||
return new BookmarkRecipeId(handlerName, ingredients);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected static class BookmarkGroup {
|
||||
|
||||
public BookmarkCraftingChain crafting = null;
|
||||
@@ -607,8 +639,7 @@ public class BookmarkPanel extends PanelWidget {
|
||||
final ArrayList<Integer> items = new ArrayList<>();
|
||||
|
||||
for (int index = idx; index < size; index++) {
|
||||
if (this.metadata.get(index).groupId == groupId
|
||||
&& meta.recipeId.equals(this.metadata.get(index).recipeId)) {
|
||||
if (meta.equalsRecipe(this.metadata.get(index))) {
|
||||
sortingRank.put(index, (this.metadata.get(index).ingredient ? 1 : -1) * dir);
|
||||
items.add(index);
|
||||
}
|
||||
@@ -756,7 +787,7 @@ public class BookmarkPanel extends PanelWidget {
|
||||
final ItemStackMetadata meta = getMetadata(idx);
|
||||
if (meta.groupId == groupId
|
||||
&& (recipeId == null && meta.recipeId == null
|
||||
|| recipeId != null && meta.recipeId != null && recipeId.equals(meta.recipeId))
|
||||
|| recipeId != null && recipeId.equals(meta.recipeId))
|
||||
&& StackInfo.equalItemAndNBT(stackA, getItem(idx), true)) {
|
||||
return idx;
|
||||
}
|
||||
@@ -797,9 +828,15 @@ public class BookmarkPanel extends PanelWidget {
|
||||
}
|
||||
|
||||
protected void removeRecipe(int idx, boolean removeFullRecipe) {
|
||||
final ItemStackMetadata meta = getMetadata(idx);
|
||||
final ItemStackMetadata meta = this.metadata.get(idx);
|
||||
|
||||
if (meta.recipeId != null && (removeFullRecipe || !meta.ingredient)) {
|
||||
if (!removeFullRecipe && meta.recipeId != null && !meta.ingredient) {
|
||||
final Optional<ItemStackMetadata> result = this.metadata.stream()
|
||||
.filter(m -> m != meta && !m.ingredient && meta.equalsRecipe(m)).findAny();
|
||||
removeFullRecipe = !result.isPresent();
|
||||
}
|
||||
|
||||
if (meta.recipeId != null && removeFullRecipe) {
|
||||
removeRecipe(meta.recipeId, meta.groupId);
|
||||
} else {
|
||||
removeItem(idx);
|
||||
@@ -807,12 +844,9 @@ public class BookmarkPanel extends PanelWidget {
|
||||
}
|
||||
|
||||
protected void removeRecipe(BookmarkRecipeId recipeIdA, int groupId) {
|
||||
BookmarkRecipeId recipeIdB;
|
||||
|
||||
for (int slotIndex = metadata.size() - 1; slotIndex >= 0; slotIndex--) {
|
||||
recipeIdB = metadata.get(slotIndex).recipeId;
|
||||
|
||||
if (recipeIdB != null && metadata.get(slotIndex).groupId == groupId && recipeIdB.equals(recipeIdA)) {
|
||||
if (metadata.get(slotIndex).equalsRecipe(recipeIdA, groupId)) {
|
||||
removeItem(slotIndex);
|
||||
}
|
||||
}
|
||||
@@ -889,14 +923,12 @@ public class BookmarkPanel extends PanelWidget {
|
||||
drawRect(rect.x, rect.y, rect.w, rect.h, 0x9966CCFF); // exports
|
||||
}
|
||||
|
||||
} else if (focus != null && meta.recipeId != null
|
||||
&& meta.groupId == getMetadata(focus.slotIndex).groupId
|
||||
&& meta.recipeId.equals(this.getRecipeId(focus.slotIndex))) {
|
||||
drawRect(rect.x, rect.y, rect.w, rect.h, meta.ingredient ? 0x6645DA75 : 0x9966CCFF); // highlight
|
||||
// recipe
|
||||
} else {
|
||||
super.beforeDrawSlot(focus, idx, rect);
|
||||
}
|
||||
} else if (focus != null && meta.equalsRecipe(getMetadata(focus.slotIndex))) {
|
||||
drawRect(rect.x, rect.y, rect.w, rect.h, meta.ingredient ? 0x6645DA75 : 0x9966CCFF); // highlight
|
||||
// recipe
|
||||
} else {
|
||||
super.beforeDrawSlot(focus, idx, rect);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -920,11 +952,9 @@ public class BookmarkPanel extends PanelWidget {
|
||||
if (groupMeta.crafting != null && meta.groupId == this.focusedGroupId
|
||||
&& groupMeta.crafting.multiplier.containsKey(stack)) {
|
||||
multiplier = this.groups.get(meta.groupId).crafting.multiplier.get(stack);
|
||||
} else if (focus != null && meta.factor > 0
|
||||
&& meta.groupId == this.metadata.get(focus.slotIndex).groupId
|
||||
&& meta.recipeId.equals(this.metadata.get(focus.slotIndex).recipeId)) {
|
||||
multiplier = StackInfo.itemStackToNBT(stack).getInteger("Count") / meta.factor;
|
||||
}
|
||||
} else if (focus != null && meta.factor > 0 && meta.equalsRecipe(getMetadata(focus.slotIndex))) {
|
||||
multiplier = StackInfo.itemStackToNBT(stack).getInteger("Count") / meta.factor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1219,7 +1249,7 @@ public class BookmarkPanel extends PanelWidget {
|
||||
addItem(itemStack, true);
|
||||
}
|
||||
|
||||
public void addItem(ItemStack itemStack, boolean saveStackSize) {
|
||||
public void addItem(ItemStack itemStack, boolean saveSize) {
|
||||
final BookmarkGrid BGrid = (BookmarkGrid) grid;
|
||||
int idx = BGrid.indexOf(itemStack, true);
|
||||
|
||||
@@ -1227,7 +1257,7 @@ public class BookmarkPanel extends PanelWidget {
|
||||
BGrid.removeItem(idx);
|
||||
}
|
||||
|
||||
addOrRemoveItem(itemStack, null, null, false, saveStackSize);
|
||||
addOrRemoveItem(itemStack, null, null, false, saveSize);
|
||||
}
|
||||
|
||||
public void addOrRemoveItem(ItemStack stackA) {
|
||||
@@ -1235,7 +1265,7 @@ public class BookmarkPanel extends PanelWidget {
|
||||
}
|
||||
|
||||
public void addOrRemoveItem(ItemStack stackover, final String handlerName, final List<PositionedStack> ingredients,
|
||||
boolean saveIngredients, boolean saveStackSize) {
|
||||
boolean saveIngredients, boolean saveSize) {
|
||||
loadBookmarksIfNeeded();
|
||||
|
||||
final Point mousePos = getMousePosition();
|
||||
@@ -1245,61 +1275,35 @@ public class BookmarkPanel extends PanelWidget {
|
||||
if (slot != null && StackInfo.equalItemAndNBT(slot.item, stackover, true)) {
|
||||
BGrid.removeRecipe(slot.slotIndex, saveIngredients);
|
||||
} else {
|
||||
final NBTTagCompound nbTagA = StackInfo.itemStackToNBT(stackover, saveStackSize);
|
||||
final ItemStack normalizedA = StackInfo.loadFromNBT(nbTagA, saveStackSize ? nbTagA.getInteger("Count") : 0);
|
||||
BookmarkRecipeId recipeId = null;
|
||||
|
||||
if (handlerName != "" && ingredients != null) {
|
||||
if (handlerName != null && !handlerName.isEmpty() && ingredients != null) {
|
||||
recipeId = new BookmarkRecipeId(handlerName, ingredients);
|
||||
}
|
||||
|
||||
final int idx = BGrid.indexOf(normalizedA, recipeId);
|
||||
final int idx = BGrid.indexOf(stackover, recipeId);
|
||||
|
||||
if (idx != -1) {
|
||||
BGrid.removeRecipe(idx, saveIngredients);
|
||||
} else {
|
||||
} else if (saveIngredients && handlerName != null && !handlerName.isEmpty() && ingredients != null) {
|
||||
BookmarkRecipe recipe = new BookmarkRecipe(stackover);
|
||||
recipe.handlerName = handlerName;
|
||||
|
||||
if (saveIngredients && handlerName != "" && ingredients != null) {
|
||||
final Map<String, Integer> ingredientCount = new HashMap<>();
|
||||
final Map<String, NBTTagCompound> uniqueIngredients = new LinkedHashMap<>();
|
||||
|
||||
BGrid.removeRecipe(recipeId, BookmarkGrid.DEFAULT_GROUP_ID);
|
||||
|
||||
for (PositionedStack stack : ingredients) {
|
||||
final NBTTagCompound nbTag = StackInfo.itemStackToNBT(stack.item, saveStackSize);
|
||||
final String GUID = StackInfo.getItemStackGUID(stack.item);
|
||||
|
||||
if (!uniqueIngredients.containsKey(GUID)) {
|
||||
ingredientCount.put(GUID, nbTag.getInteger("Count"));
|
||||
uniqueIngredients.put(GUID, nbTag);
|
||||
} else {
|
||||
ingredientCount.put(GUID, ingredientCount.get(GUID) + nbTag.getInteger("Count"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (String GUID : uniqueIngredients.keySet()) {
|
||||
BGrid.addItem(
|
||||
StackInfo.loadFromNBT(
|
||||
uniqueIngredients.get(GUID),
|
||||
saveStackSize ? ingredientCount.get(GUID) : 0),
|
||||
new ItemStackMetadata(
|
||||
recipeId != null ? recipeId.copy() : null,
|
||||
ingredientCount.get(GUID),
|
||||
true,
|
||||
BookmarkGrid.DEFAULT_GROUP_ID,
|
||||
uniqueIngredients.get(GUID).hasKey("gtFluidName")));
|
||||
}
|
||||
for (PositionedStack stack : ingredients) {
|
||||
recipe.ingredients.add(stack.item);
|
||||
}
|
||||
|
||||
BGrid.addItem(
|
||||
normalizedA,
|
||||
new ItemStackMetadata(
|
||||
recipeId,
|
||||
nbTagA.getInteger("Count"),
|
||||
false,
|
||||
BookmarkGrid.DEFAULT_GROUP_ID,
|
||||
nbTagA.hasKey("gtFluidName")));
|
||||
addRecipe(recipe, saveSize);
|
||||
} else {
|
||||
final NBTTagCompound nbTag = StackInfo.itemStackToNBT(stackover);
|
||||
final ItemStack normalized = StackInfo.loadFromNBT(nbTag, saveSize ? nbTag.getInteger("Count") : 0);
|
||||
final ItemStackMetadata metadata = new ItemStackMetadata(
|
||||
recipeId,
|
||||
nbTag,
|
||||
false,
|
||||
BookmarkGrid.DEFAULT_GROUP_ID);
|
||||
|
||||
BGrid.addItem(normalized, metadata);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1307,6 +1311,92 @@ public class BookmarkPanel extends PanelWidget {
|
||||
saveBookmarks();
|
||||
}
|
||||
|
||||
public void addRecipe(BookmarkRecipe recipe, boolean saveSize) {
|
||||
addRecipe(recipe, saveSize, BookmarkGrid.DEFAULT_GROUP_ID);
|
||||
}
|
||||
|
||||
public void addRecipe(BookmarkRecipe recipe, boolean saveSize, int groupId) {
|
||||
final BookmarkGrid BGrid = (BookmarkGrid) grid;
|
||||
final BookmarkRecipeId recipeId = recipe.getRecipeId();
|
||||
|
||||
if (!BGrid.groups.containsKey(groupId)) {
|
||||
groupId = BookmarkGrid.DEFAULT_GROUP_ID;
|
||||
}
|
||||
|
||||
if (recipeId != null) {
|
||||
final Map<String, NBTTagCompound> uniqueIngredients = new LinkedHashMap<>();
|
||||
|
||||
BGrid.removeRecipe(recipeId, groupId);
|
||||
|
||||
for (ItemStack stack : recipe.ingredients) {
|
||||
final String GUID = StackInfo.getItemStackGUID(stack);
|
||||
final NBTTagCompound nbTagU = uniqueIngredients.get(GUID);
|
||||
final NBTTagCompound nbTagS = StackInfo.itemStackToNBT(stack);
|
||||
|
||||
if (nbTagU == null) {
|
||||
uniqueIngredients.put(GUID, nbTagS);
|
||||
} else {
|
||||
nbTagU.setInteger("Count", nbTagU.getInteger("Count") + nbTagS.getInteger("Count"));
|
||||
}
|
||||
}
|
||||
|
||||
for (String GUID : uniqueIngredients.keySet()) {
|
||||
final NBTTagCompound nbTag = uniqueIngredients.get(GUID);
|
||||
final ItemStack normalized = StackInfo.loadFromNBT(nbTag, saveSize ? nbTag.getInteger("Count") : 0);
|
||||
final ItemStackMetadata metadata = new ItemStackMetadata(recipeId.copy(), nbTag, true, groupId);
|
||||
|
||||
BGrid.addItem(normalized, metadata);
|
||||
}
|
||||
}
|
||||
|
||||
for (ItemStack stack : recipe.result) {
|
||||
final NBTTagCompound nbTag = StackInfo.itemStackToNBT(stack);
|
||||
final ItemStack normalized = StackInfo.loadFromNBT(nbTag, saveSize ? nbTag.getInteger("Count") : 0);
|
||||
final ItemStackMetadata metadata = new ItemStackMetadata(recipeId, nbTag, false, groupId);
|
||||
|
||||
BGrid.addItem(normalized, metadata);
|
||||
}
|
||||
|
||||
fixCountOfNamespaces();
|
||||
saveBookmarks();
|
||||
}
|
||||
|
||||
public void addBookmarkGroup(List<ItemStack> items, BookmarkViewMode viewMode) {
|
||||
List<BookmarkRecipe> recipes = new ArrayList<>();
|
||||
|
||||
for (ItemStack stack : items) {
|
||||
recipes.add(new BookmarkRecipe(stack));
|
||||
}
|
||||
|
||||
addBookmarkGroup(recipes, viewMode, false);
|
||||
}
|
||||
|
||||
public void addBookmarkGroup(List<BookmarkRecipe> recipes, BookmarkViewMode viewMode, boolean crafting) {
|
||||
if (recipes.isEmpty()) return;
|
||||
|
||||
final BookmarkGrid BGrid = (BookmarkGrid) grid;
|
||||
int groupId = BookmarkGrid.DEFAULT_GROUP_ID;
|
||||
|
||||
if (viewMode == null) {
|
||||
viewMode = BGrid.getViewMode(BookmarkGrid.DEFAULT_GROUP_ID);
|
||||
}
|
||||
|
||||
for (ItemStackMetadata meta : BGrid.metadata) {
|
||||
if (meta.groupId > groupId) {
|
||||
groupId = meta.groupId;
|
||||
}
|
||||
}
|
||||
|
||||
BGrid.groups.put(++groupId, new BookmarkGroup(viewMode, crafting));
|
||||
|
||||
for (BookmarkRecipe recipe : recipes) {
|
||||
addRecipe(recipe, true, groupId);
|
||||
}
|
||||
|
||||
fixCountOfNamespaces();
|
||||
saveBookmarks();
|
||||
}
|
||||
|
||||
public BookmarkRecipeId getBookmarkRecipeId(int slotIndex) {
|
||||
ItemStackMetadata meta = ((BookmarkGrid) grid).getMetadata(slotIndex);
|
||||
return meta.ingredient ? null : meta.recipeId;
|
||||
@@ -1774,8 +1864,7 @@ public class BookmarkPanel extends PanelWidget {
|
||||
} else {
|
||||
|
||||
for (int i = 0; i < BGrid.metadata.size(); i++) {
|
||||
if (BGrid.metadata.get(i).recipeId != null && meta.groupId == BGrid.metadata.get(i).groupId
|
||||
&& meta.recipeId.equals(BGrid.metadata.get(i).recipeId)) {
|
||||
if (meta.equalsRecipe(BGrid.getMetadata(i))) {
|
||||
items.add(BGrid.realItems.get(i));
|
||||
metadata.add(BGrid.metadata.get(i));
|
||||
}
|
||||
@@ -1822,7 +1911,7 @@ public class BookmarkPanel extends PanelWidget {
|
||||
} else if (ySlot <= 0.25) {
|
||||
|
||||
if (BGrid.getViewMode(beforeGroupId) == BookmarkViewMode.TODO_LIST
|
||||
&& !existsRecipeIdInGroupId(beforeGroupId, sortMeta.recipeId)) {
|
||||
&& !existsRecipeIdInGroupId(sortMeta.recipeId, beforeGroupId)) {
|
||||
BGrid.moveItem(this.sortableItem, mouseOverSlot.slotIndex, beforeGroupId, true);
|
||||
}
|
||||
|
||||
@@ -1832,12 +1921,12 @@ public class BookmarkPanel extends PanelWidget {
|
||||
&& (afterGroupId != BookmarkGrid.DEFAULT_GROUP_ID
|
||||
|| BGrid.getViewMode(overGroupId) == BookmarkViewMode.DEFAULT)
|
||||
&& BGrid.getViewMode(BookmarkGrid.DEFAULT_GROUP_ID) == BookmarkViewMode.TODO_LIST
|
||||
&& !existsRecipeIdInGroupId(BookmarkGrid.DEFAULT_GROUP_ID, sortMeta.recipeId)) {
|
||||
&& !existsRecipeIdInGroupId(sortMeta.recipeId, BookmarkGrid.DEFAULT_GROUP_ID)) {
|
||||
beforeGroupId = BookmarkGrid.DEFAULT_GROUP_ID;
|
||||
}
|
||||
|
||||
if (BGrid.getViewMode(beforeGroupId) == BookmarkViewMode.TODO_LIST
|
||||
&& !existsRecipeIdInGroupId(beforeGroupId, sortMeta.recipeId)) {
|
||||
&& !existsRecipeIdInGroupId(sortMeta.recipeId, beforeGroupId)) {
|
||||
BGrid.moveItem(this.sortableItem, mouseOverSlot.slotIndex, beforeGroupId, true);
|
||||
}
|
||||
|
||||
@@ -1848,12 +1937,12 @@ public class BookmarkPanel extends PanelWidget {
|
||||
|| BGrid.getViewMode(overGroupId) == BookmarkViewMode.DEFAULT)
|
||||
&& afterGroupId != BookmarkGrid.DEFAULT_GROUP_ID
|
||||
&& BGrid.getViewMode(BookmarkGrid.DEFAULT_GROUP_ID) == BookmarkViewMode.TODO_LIST
|
||||
&& !existsRecipeIdInGroupId(BookmarkGrid.DEFAULT_GROUP_ID, sortMeta.recipeId)) {
|
||||
&& !existsRecipeIdInGroupId(sortMeta.recipeId, BookmarkGrid.DEFAULT_GROUP_ID)) {
|
||||
afterGroupId = BookmarkGrid.DEFAULT_GROUP_ID;
|
||||
}
|
||||
|
||||
if (BGrid.getViewMode(afterGroupId) == BookmarkViewMode.TODO_LIST
|
||||
&& !existsRecipeIdInGroupId(afterGroupId, sortMeta.recipeId)) {
|
||||
&& !existsRecipeIdInGroupId(sortMeta.recipeId, afterGroupId)) {
|
||||
BGrid.moveItem(
|
||||
this.sortableItem,
|
||||
BGrid.getRowItemIndex(overRowIndex, false),
|
||||
@@ -1864,7 +1953,7 @@ public class BookmarkPanel extends PanelWidget {
|
||||
} else if (ySlot >= 0.75) {
|
||||
|
||||
if (BGrid.getViewMode(afterGroupId) == BookmarkViewMode.TODO_LIST
|
||||
&& !existsRecipeIdInGroupId(afterGroupId, sortMeta.recipeId)) {
|
||||
&& !existsRecipeIdInGroupId(sortMeta.recipeId, afterGroupId)) {
|
||||
BGrid.moveItem(
|
||||
this.sortableItem,
|
||||
BGrid.getRowItemIndex(overRowIndex, false),
|
||||
@@ -1909,12 +1998,11 @@ public class BookmarkPanel extends PanelWidget {
|
||||
super.mouseDragged(mousex, mousey, button, heldTime);
|
||||
}
|
||||
|
||||
private boolean existsRecipeIdInGroupId(int groupId, BookmarkRecipeId recipeId) {
|
||||
private boolean existsRecipeIdInGroupId(BookmarkRecipeId recipeId, int groupId) {
|
||||
if (recipeId == null) return false;
|
||||
|
||||
for (ItemStackMetadata meta : ((BookmarkGrid) grid).metadata) {
|
||||
if (meta.groupId == groupId && this.sortableItem.metadata.indexOf(meta) == -1
|
||||
&& recipeId.equals(meta.recipeId)) {
|
||||
if (meta.equalsRecipe(recipeId, groupId) && this.sortableItem.metadata.indexOf(meta) == -1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -2060,7 +2148,7 @@ public class BookmarkPanel extends PanelWidget {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (NEIClientUtils.controlKey()) {
|
||||
if (!inEditingState() && NEIClientUtils.controlKey()) {
|
||||
final ItemPanelSlot slot = getSlotMouseOver(mousex, mousey);
|
||||
|
||||
if (slot != null) {
|
||||
@@ -2077,18 +2165,12 @@ public class BookmarkPanel extends PanelWidget {
|
||||
}
|
||||
|
||||
if (NEIClientUtils.shiftKey()) {
|
||||
ItemStackMetadata ingrMeta;
|
||||
|
||||
for (int slotIndex = grid.size() - 1; slotIndex >= 0; slotIndex--) {
|
||||
ingrMeta = BGrid.getMetadata(slotIndex);
|
||||
|
||||
if (ingrMeta.recipeId != null && ingrMeta.groupId == overMeta.groupId
|
||||
&& ingrMeta.recipeId.equals(overMeta.recipeId)
|
||||
&& slotIndex != slot.slotIndex) {
|
||||
if (overMeta.equalsRecipe(BGrid.getMetadata(slotIndex)) && slotIndex != slot.slotIndex) {
|
||||
items.put(slotIndex, shiftStackSize(BGrid, slotIndex, shift, shiftMultiplier));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
items.put(slot.slotIndex, shiftStackSize(BGrid, slot.slotIndex, shift, shiftMultiplier));
|
||||
|
||||
@@ -149,6 +149,7 @@ public class ClientHandler {
|
||||
loadSerialHandlers();
|
||||
loadHeightHackHandlers();
|
||||
loadHiddenHandlers();
|
||||
loadEnableAutoFocus();
|
||||
ItemInfo.preInit();
|
||||
StackInfo.loadGuidFilters();
|
||||
}
|
||||
@@ -225,6 +226,30 @@ public class ClientHandler {
|
||||
}
|
||||
}
|
||||
|
||||
public static void loadEnableAutoFocus() {
|
||||
File file = NEIClientConfig.enableAutoFocusFile;
|
||||
if (!file.exists()) {
|
||||
try (FileWriter writer = new FileWriter(file)) {
|
||||
NEIClientConfig.logger.info("Creating default enable auto focus list {}", file);
|
||||
URL defaultEnableAutoFocusResource = ClientHandler.class
|
||||
.getResource("/assets/nei/cfg/enableautofocus.cfg");
|
||||
if (defaultEnableAutoFocusResource != null) {
|
||||
IOUtils.copy(defaultEnableAutoFocusResource.openStream(), writer);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
NEIClientConfig.logger.error("Failed to save default enable auto focus list to file {}", file, e);
|
||||
}
|
||||
}
|
||||
|
||||
try (FileReader reader = new FileReader(file)) {
|
||||
NEIClientConfig.logger.info("Loading enable auto focus from file {}", file);
|
||||
NEIClientConfig.enableAutoFocusPrefixes = IOUtils.readLines(reader).stream()
|
||||
.filter((line) -> !line.startsWith("#")).collect(Collectors.toCollection(ArrayList::new));
|
||||
} catch (IOException e) {
|
||||
NEIClientConfig.logger.error("Failed to load enable auto focus from file {}", file, e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void load() {
|
||||
instance = new ClientHandler();
|
||||
|
||||
|
||||
@@ -0,0 +1,364 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import codechicken.nei.ItemList.AllMultiItemFilter;
|
||||
import codechicken.nei.ItemList.AnyMultiItemFilter;
|
||||
import codechicken.nei.ItemList.EverythingItemFilter;
|
||||
import codechicken.nei.ItemList.NegatedItemFilter;
|
||||
import codechicken.nei.ItemList.NothingItemFilter;
|
||||
import codechicken.nei.PresetsList.Preset;
|
||||
import codechicken.nei.PresetsList.PresetMode;
|
||||
import codechicken.nei.api.ItemFilter;
|
||||
import cpw.mods.fml.common.registry.GameData;
|
||||
|
||||
public class CollapsibleItems {
|
||||
|
||||
protected static interface ISearchParserProvider {
|
||||
|
||||
public ItemFilter getFilter(String searchText);
|
||||
|
||||
default Predicate<String> getMatcher(String searchText) {
|
||||
|
||||
if (searchText.length() >= 3 && searchText.startsWith("r/") && searchText.endsWith("/")) {
|
||||
|
||||
try {
|
||||
Pattern pattern = Pattern.compile(
|
||||
searchText.substring(2, searchText.length() - 1),
|
||||
Pattern.MULTILINE | Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);
|
||||
return value -> pattern.matcher(value).find();
|
||||
} catch (PatternSyntaxException ignored) {}
|
||||
|
||||
} else if (!searchText.isEmpty()) {
|
||||
return value -> value.toLowerCase().contains(searchText);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected static class GroupTokenParser {
|
||||
|
||||
protected final HashMap<Character, ISearchParserProvider> searchProviders = new HashMap<>();
|
||||
|
||||
public void addProvider(char prefix, ISearchParserProvider provider) {
|
||||
this.searchProviders.put(prefix, provider);
|
||||
}
|
||||
|
||||
public ItemFilter getFilter(String filterText) {
|
||||
final String[] parts = filterText.toLowerCase().trim().split("\\|");
|
||||
final List<ItemFilter> searchTokens = Arrays.stream(parts).map(s -> parseSearchText(s))
|
||||
.filter(s -> s != null && !s.filters.isEmpty()).collect(Collectors.toCollection(ArrayList::new));
|
||||
|
||||
if (searchTokens.isEmpty()) {
|
||||
return new EverythingItemFilter();
|
||||
} else if (searchTokens.size() == 1) {
|
||||
return searchTokens.get(0);
|
||||
} else {
|
||||
return new AnyMultiItemFilter(searchTokens);
|
||||
}
|
||||
}
|
||||
|
||||
private AllMultiItemFilter parseSearchText(String filterText) {
|
||||
|
||||
if (filterText.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final String[] tokens = filterText.split("\\s+");
|
||||
final AllMultiItemFilter searchTokens = new AllMultiItemFilter();
|
||||
|
||||
for (String token : tokens) {
|
||||
token = token.trim();
|
||||
boolean ignore = token.startsWith("!");
|
||||
|
||||
if (ignore) {
|
||||
token = token.substring(1);
|
||||
}
|
||||
|
||||
if (token.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ISearchParserProvider provider = this.searchProviders.get(token.charAt(0));
|
||||
|
||||
if (provider != null) {
|
||||
token = token.substring(1);
|
||||
} else {
|
||||
provider = this.searchProviders.get('\0');
|
||||
}
|
||||
|
||||
ItemFilter filter = parseToken(ignore ? "!" + token : token, provider);
|
||||
|
||||
if (filter != null) {
|
||||
searchTokens.filters.add(filter);
|
||||
}
|
||||
}
|
||||
|
||||
return searchTokens;
|
||||
}
|
||||
|
||||
private ItemFilter parseToken(String token, ISearchParserProvider provider) {
|
||||
final String[] parts = token.split(",");
|
||||
final AnyMultiItemFilter includeFilter = new AnyMultiItemFilter();
|
||||
final AnyMultiItemFilter expludeFilter = new AnyMultiItemFilter();
|
||||
final AllMultiItemFilter groupFilter = new AllMultiItemFilter();
|
||||
|
||||
for (String part : parts) {
|
||||
boolean ignore = part.startsWith("!");
|
||||
|
||||
if (ignore) {
|
||||
part = part.substring(1);
|
||||
}
|
||||
|
||||
ItemFilter filter = provider.getFilter(part);
|
||||
|
||||
if (filter == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ignore) {
|
||||
expludeFilter.filters.add(filter);
|
||||
} else {
|
||||
includeFilter.filters.add(filter);
|
||||
}
|
||||
}
|
||||
|
||||
if (!includeFilter.filters.isEmpty()) {
|
||||
groupFilter.filters.add(includeFilter);
|
||||
}
|
||||
|
||||
if (!expludeFilter.filters.isEmpty()) {
|
||||
groupFilter.filters.add(new NegatedItemFilter(expludeFilter));
|
||||
}
|
||||
|
||||
return groupFilter.filters.isEmpty() ? null : groupFilter;
|
||||
}
|
||||
}
|
||||
|
||||
protected static class IdentifierFilter implements ISearchParserProvider {
|
||||
|
||||
@Override
|
||||
public ItemFilter getFilter(String searchText) {
|
||||
|
||||
if (Pattern.matches("^\\d+(-\\d+)*$", searchText)) {
|
||||
final Predicate<Integer> filter = generateDamageFilter(searchText);
|
||||
return (stack) -> filter.test(stack.getItemDamage());
|
||||
}
|
||||
|
||||
Predicate<String> matcher = getMatcher(searchText);
|
||||
|
||||
if (matcher != null) {
|
||||
return stack -> matcher.test(getStringIdentifier(stack));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected String getStringIdentifier(ItemStack stack) {
|
||||
String name = GameData.getItemRegistry().getNameForObject(stack.getItem());
|
||||
return name == null || name.isEmpty() ? "Unknown:Unknown" : name;
|
||||
}
|
||||
|
||||
protected Predicate<Integer> generateDamageFilter(String searchText) {
|
||||
String[] range = searchText.split("-");
|
||||
|
||||
if (range.length == 1) {
|
||||
final int damage = Integer.parseInt(range[0]);
|
||||
return (dmg) -> dmg == damage;
|
||||
} else {
|
||||
final int damageStart = Integer.parseInt(range[0]);
|
||||
final int damageEnd = Integer.parseInt(range[1]);
|
||||
return (dmg) -> dmg >= damageStart && dmg <= damageEnd;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected static class OreDictionaryFilter implements ISearchParserProvider {
|
||||
|
||||
@Override
|
||||
public ItemFilter getFilter(String searchText) {
|
||||
Predicate<String> matcher = getMatcher(searchText);
|
||||
|
||||
if (matcher != null) {
|
||||
return stack -> matches(stack, matcher);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected boolean matches(ItemStack stack, Predicate<String> matcher) {
|
||||
return IntStream.of(OreDictionary.getOreIDs(stack))
|
||||
.anyMatch(id -> matcher.test(OreDictionary.getOreName(id)));
|
||||
}
|
||||
}
|
||||
|
||||
protected static class GroupItem {
|
||||
|
||||
protected static int lastGroupIndex = 0;
|
||||
|
||||
public final int groupIndex;
|
||||
public final ItemFilter filter;
|
||||
public boolean expanded = false;
|
||||
|
||||
public GroupItem(ItemFilter filter) {
|
||||
this.groupIndex = lastGroupIndex++;
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
public boolean matches(ItemStack stack) {
|
||||
return this.filter.matches(stack);
|
||||
}
|
||||
}
|
||||
|
||||
protected static final GroupTokenParser groupParser = new GroupTokenParser();
|
||||
protected final Map<Integer, GroupItem> groups = new ConcurrentHashMap<>();
|
||||
protected final Map<ItemStack, Integer> cache = new ConcurrentHashMap<>();
|
||||
|
||||
static {
|
||||
groupParser.addProvider('\0', new IdentifierFilter());
|
||||
groupParser.addProvider('$', new OreDictionaryFilter());
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
GroupItem.lastGroupIndex = 0;
|
||||
this.groups.clear();
|
||||
this.cache.clear();
|
||||
|
||||
for (int i = PresetsList.presets.size() - 1; i >= 0; i--) {
|
||||
Preset preset = PresetsList.presets.get(i);
|
||||
if (preset.enabled && preset.mode == PresetMode.GROUP) {
|
||||
addGroup(preset);
|
||||
}
|
||||
}
|
||||
|
||||
loadCollapsibleItems();
|
||||
|
||||
if (ItemList.loadFinished) {
|
||||
LayoutManager.markItemsDirty();
|
||||
}
|
||||
}
|
||||
|
||||
protected void loadCollapsibleItems() {
|
||||
File file = NEIClientConfig.collapsibleItemsFile;
|
||||
if (!file.exists()) {
|
||||
try (FileWriter writer = new FileWriter(file)) {
|
||||
NEIClientConfig.logger.info("Creating default collapsible items list {}", file);
|
||||
URL defaultCollapsibleItemsResource = ClientHandler.class
|
||||
.getResource("/assets/nei/cfg/collapsibleitems.cfg");
|
||||
if (defaultCollapsibleItemsResource != null) {
|
||||
IOUtils.copy(defaultCollapsibleItemsResource.openStream(), writer);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
NEIClientConfig.logger.error("Failed to save default collapsible items list to file {}", file, e);
|
||||
}
|
||||
}
|
||||
|
||||
try (FileReader reader = new FileReader(file)) {
|
||||
NEIClientConfig.logger.info("Loading collapsible items from file {}", file);
|
||||
IOUtils.readLines(reader).stream().filter((line) -> !line.startsWith("#") && !line.trim().isEmpty())
|
||||
.forEach(this::addGroup);
|
||||
} catch (IOException e) {
|
||||
NEIClientConfig.logger.error("Failed to load collapsible items from file {}", file, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void addGroup(String filterText) {
|
||||
addGroup(CollapsibleItems.groupParser.getFilter(filterText.trim()));
|
||||
}
|
||||
|
||||
protected void addGroup(ItemFilter filter) {
|
||||
if (filter == null || filter instanceof EverythingItemFilter || filter instanceof NothingItemFilter) return;
|
||||
GroupItem group = new GroupItem(filter);
|
||||
this.groups.put(group.groupIndex, group);
|
||||
}
|
||||
|
||||
public ItemFilter getItemFilter() {
|
||||
AnyMultiItemFilter filter = new AnyMultiItemFilter();
|
||||
|
||||
for (GroupItem group : this.groups.values()) {
|
||||
filter.filters.add(group.filter);
|
||||
}
|
||||
|
||||
return filter;
|
||||
}
|
||||
|
||||
public void updateCache(final List<ItemStack> items) {
|
||||
this.cache.clear();
|
||||
|
||||
try {
|
||||
|
||||
ItemList.forkJoinPool.submit(() -> items.parallelStream().forEach(stack -> {
|
||||
GroupItem group = this.groups.values().stream().filter(g -> g.matches(stack)).findFirst().orElse(null);
|
||||
|
||||
if (group != null) {
|
||||
this.cache.put(stack, group.groupIndex);
|
||||
}
|
||||
})).get();
|
||||
|
||||
} catch (Exception e) {
|
||||
NEIClientConfig.logger.error("Error create collapsible items groups", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int getGroupIndex(ItemStack stack) {
|
||||
|
||||
if (stack == null) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return this.cache.getOrDefault(stack, -1);
|
||||
}
|
||||
|
||||
public boolean isExpanded(int groupIndex) {
|
||||
|
||||
if (this.groups.containsKey(groupIndex)) {
|
||||
return this.groups.get(groupIndex).expanded;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setExpanded(int groupIndex, boolean expanded) {
|
||||
|
||||
if (this.groups.containsKey(groupIndex)) {
|
||||
this.groups.get(groupIndex).expanded = expanded;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void toggleGroups(Boolean expanded) {
|
||||
|
||||
if (expanded == null) {
|
||||
expanded = !this.groups.values().stream().filter(g -> g.expanded).findAny().isPresent();
|
||||
}
|
||||
|
||||
for (GroupItem group : this.groups.values()) {
|
||||
group.expanded = expanded;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,251 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class FormattedTextField extends GuiTextField {
|
||||
|
||||
public static interface TextFormatter {
|
||||
|
||||
TextFormatter DEFAULT = (text) -> text;
|
||||
|
||||
public String format(String text);
|
||||
}
|
||||
|
||||
protected FontRenderer fontRenderer;
|
||||
protected String rawText = "";
|
||||
protected String formattedText = "";
|
||||
protected boolean editable = true;
|
||||
protected int editableColor = 14737632;
|
||||
protected int notEditableColor = 7368816;
|
||||
protected TextFormatter formatter = TextFormatter.DEFAULT;
|
||||
protected int lineScrollOffset = 0;
|
||||
protected int frame = 0;
|
||||
|
||||
public FormattedTextField(FontRenderer fontRenderer, int xPosition, int yPosition, int width, int height) {
|
||||
super(fontRenderer, xPosition, yPosition, width, height);
|
||||
this.fontRenderer = fontRenderer;
|
||||
}
|
||||
|
||||
public void setFormatter(TextFormatter formatter) {
|
||||
this.formatter = formatter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCursorCounter() {
|
||||
super.updateCursorCounter();
|
||||
++this.frame;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFocused(boolean focus) {
|
||||
if (focus && !this.isFocused()) {
|
||||
this.frame = 0;
|
||||
}
|
||||
|
||||
super.setFocused(focus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelectionPos(int p_146199_1_) {
|
||||
String text = this.getText();
|
||||
int j = text.length();
|
||||
|
||||
super.setSelectionPos(p_146199_1_);
|
||||
|
||||
p_146199_1_ = Math.max(0, Math.min(p_146199_1_, j));
|
||||
|
||||
if (this.fontRenderer != null) {
|
||||
|
||||
if (this.lineScrollOffset > j) {
|
||||
this.lineScrollOffset = j;
|
||||
}
|
||||
|
||||
int k = this.getWidth();
|
||||
String s = this.fontRenderer.trimStringToWidth(text.substring(this.lineScrollOffset), k);
|
||||
int l = s.length() + this.lineScrollOffset;
|
||||
|
||||
if (p_146199_1_ == this.lineScrollOffset) {
|
||||
this.lineScrollOffset -= this.fontRenderer.trimStringToWidth(text, k, true).length();
|
||||
}
|
||||
|
||||
if (p_146199_1_ > l) {
|
||||
this.lineScrollOffset += p_146199_1_ - l;
|
||||
} else if (p_146199_1_ <= this.lineScrollOffset) {
|
||||
this.lineScrollOffset -= this.lineScrollOffset - p_146199_1_;
|
||||
}
|
||||
|
||||
this.lineScrollOffset = Math.max(0, Math.min(this.lineScrollOffset, j));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTextColor(int p_146193_1_) {
|
||||
super.setTextColor(p_146193_1_);
|
||||
this.editableColor = p_146193_1_;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDisabledTextColour(int p_146204_1_) {
|
||||
super.setDisabledTextColour(p_146204_1_);
|
||||
this.notEditableColor = p_146204_1_;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnabled(boolean p_146184_1_) {
|
||||
super.setEnabled(p_146184_1_);
|
||||
this.editable = p_146184_1_;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTextBox() {
|
||||
if (this.getVisible()) {
|
||||
if (this.getEnableBackgroundDrawing()) {
|
||||
drawRect(
|
||||
this.xPosition - 1,
|
||||
this.yPosition - 1,
|
||||
this.xPosition + this.width + 1,
|
||||
this.yPosition + this.height + 1,
|
||||
-6250336);
|
||||
drawRect(
|
||||
this.xPosition,
|
||||
this.yPosition,
|
||||
this.xPosition + this.width,
|
||||
this.yPosition + this.height,
|
||||
-16777216);
|
||||
}
|
||||
|
||||
if (!this.rawText.equals(getText())) {
|
||||
this.rawText = getText();
|
||||
this.formattedText = this.formatter.format(this.rawText);
|
||||
if (!EnumChatFormatting.getTextWithoutFormattingCodes(this.formattedText).toLowerCase()
|
||||
.equals(this.rawText.toLowerCase())) {
|
||||
this.formattedText = this.rawText;
|
||||
}
|
||||
}
|
||||
|
||||
int firstCharacterIndex = getFormattedTextShift(this.lineScrollOffset);
|
||||
String rawTextClipped = this.fontRenderer
|
||||
.trimStringToWidth(this.rawText.substring(this.lineScrollOffset), this.getWidth());
|
||||
String textClipped = this.formattedText.substring(
|
||||
firstCharacterIndex,
|
||||
getFormattedTextShift(this.lineScrollOffset + rawTextClipped.length()));
|
||||
int cursorPosition = getFormattedTextShift(this.getCursorPosition());
|
||||
int selectionEnd = getFormattedTextShift(this.getSelectionEnd());
|
||||
|
||||
int color = this.editable ? this.editableColor : this.notEditableColor;
|
||||
int cursorA = cursorPosition - firstCharacterIndex;
|
||||
int cursorB = selectionEnd - firstCharacterIndex;
|
||||
boolean flag = cursorA >= 0 && cursorA <= textClipped.length();
|
||||
boolean flag1 = this.isFocused() && this.frame / 6 % 2 == 0 && flag;
|
||||
boolean flag2 = this.getCursorPosition() < this.rawText.length()
|
||||
|| this.rawText.length() >= this.getMaxStringLength();
|
||||
int x = this.getEnableBackgroundDrawing() ? this.xPosition + 4 : this.xPosition;
|
||||
int y = this.getEnableBackgroundDrawing() ? this.yPosition + (this.height - 8) / 2 : this.yPosition;
|
||||
int x2 = x;
|
||||
|
||||
if (cursorB > textClipped.length()) {
|
||||
cursorB = textClipped.length();
|
||||
}
|
||||
|
||||
if (textClipped.length() > 0) {
|
||||
String s1 = flag ? textClipped.substring(0, cursorA) : textClipped;
|
||||
String colorA = getPreviousColor(firstCharacterIndex);
|
||||
x2 = this.fontRenderer.drawStringWithShadow(colorA + s1, x, y, color);
|
||||
}
|
||||
|
||||
int k1 = x2;
|
||||
|
||||
if (!flag) {
|
||||
k1 = cursorA > 0 ? x + this.width : x;
|
||||
} else if (flag2) {
|
||||
k1 = x2 - 1;
|
||||
--x2;
|
||||
}
|
||||
|
||||
if (textClipped.length() > 0 && flag && cursorA < textClipped.length()) {
|
||||
String colorB = getPreviousColor(firstCharacterIndex + cursorA);
|
||||
this.fontRenderer.drawStringWithShadow(colorB + textClipped.substring(cursorA), x2, y, color);
|
||||
}
|
||||
|
||||
if (flag1) {
|
||||
if (flag2) {
|
||||
Gui.drawRect(k1, y - 1, k1 + 1, y + 1 + this.fontRenderer.FONT_HEIGHT, -3092272);
|
||||
} else {
|
||||
this.fontRenderer.drawStringWithShadow("_", k1, y, color);
|
||||
}
|
||||
}
|
||||
|
||||
if (cursorB != cursorA) {
|
||||
int l1 = x + this.fontRenderer.getStringWidth(textClipped.substring(0, cursorB));
|
||||
drawCursorVertical(k1, y - 1, l1 - 1, y + 1 + this.fontRenderer.FONT_HEIGHT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void drawCursorVertical(int x1, int y1, int x2, int y2) {
|
||||
int i1;
|
||||
|
||||
if (x1 < x2) {
|
||||
i1 = x1;
|
||||
x1 = x2;
|
||||
x2 = i1;
|
||||
}
|
||||
|
||||
if (y1 < y2) {
|
||||
i1 = y1;
|
||||
y1 = y2;
|
||||
y2 = i1;
|
||||
}
|
||||
|
||||
if (x2 > this.xPosition + this.width) {
|
||||
x2 = this.xPosition + this.width;
|
||||
}
|
||||
|
||||
if (x1 > this.xPosition + this.width) {
|
||||
x1 = this.xPosition + this.width;
|
||||
}
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glColor4f(0.0F, 0.0F, 255.0F, 255.0F);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_COLOR_LOGIC_OP);
|
||||
GL11.glLogicOp(GL11.GL_OR_REVERSE);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertex((double) x1, (double) y2, 0.0D);
|
||||
tessellator.addVertex((double) x2, (double) y2, 0.0D);
|
||||
tessellator.addVertex((double) x2, (double) y1, 0.0D);
|
||||
tessellator.addVertex((double) x1, (double) y1, 0.0D);
|
||||
tessellator.draw();
|
||||
GL11.glDisable(GL11.GL_COLOR_LOGIC_OP);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
private int getFormattedTextShift(int position) {
|
||||
int shift = 0;
|
||||
|
||||
for (int i = 0; i < position; i++) {
|
||||
while (this.formattedText.length() > i + shift && this.formattedText.charAt(i + shift) == '\u00a7') {
|
||||
shift += 2;
|
||||
}
|
||||
}
|
||||
|
||||
return position + shift;
|
||||
}
|
||||
|
||||
private String getPreviousColor(int position) {
|
||||
while (position >= 0) {
|
||||
if (this.formattedText.charAt(position) == '\u00a7') {
|
||||
return this.formattedText.substring(position, position + 2);
|
||||
}
|
||||
position--;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,10 +12,11 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.lib.render.CCRenderState;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.api.INEIAutoFocusSearchEnable;
|
||||
import codechicken.nei.api.INEIGuiHandler;
|
||||
import codechicken.nei.api.TaggedInventoryArea;
|
||||
|
||||
public class GuiExtendedCreativeInv extends GuiContainer implements INEIGuiHandler {
|
||||
public class GuiExtendedCreativeInv extends GuiContainer implements INEIGuiHandler, INEIAutoFocusSearchEnable {
|
||||
|
||||
public GuiExtendedCreativeInv(Container par1Container) {
|
||||
super(par1Container);
|
||||
|
||||
@@ -2,14 +2,17 @@ package codechicken.nei;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.StringJoiner;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
@@ -21,7 +24,6 @@ import codechicken.nei.ThreadOperationTimer.TimeoutException;
|
||||
import codechicken.nei.api.ItemFilter;
|
||||
import codechicken.nei.api.ItemFilter.ItemFilterProvider;
|
||||
import codechicken.nei.api.ItemInfo;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
|
||||
public class ItemList {
|
||||
|
||||
@@ -37,11 +39,12 @@ public class ItemList {
|
||||
* Updates to this should be synchronised on this
|
||||
*/
|
||||
public static final List<ItemFilterProvider> itemFilterers = new LinkedList<>();
|
||||
|
||||
public static final List<ItemsLoadedCallback> loadCallbacks = new LinkedList<>();
|
||||
public static final CollapsibleItems collapsibleItems = new CollapsibleItems();
|
||||
|
||||
private static final HashSet<Item> erroredItems = new HashSet<>();
|
||||
private static final HashSet<String> stackTraces = new HashSet<>();
|
||||
private static final HashMap<ItemStack, Integer> ordering = new HashMap<>();
|
||||
/**
|
||||
* Unlike {@link LayoutManager#itemsLoaded}, this indicates whether item loading is actually finished or not.
|
||||
*/
|
||||
@@ -63,6 +66,20 @@ public class ItemList {
|
||||
}
|
||||
}
|
||||
|
||||
public static class NegatedItemFilter implements ItemFilter {
|
||||
|
||||
public ItemFilter filter;
|
||||
|
||||
public NegatedItemFilter(ItemFilter filter) {
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(ItemStack item) {
|
||||
return this.filter == null || !this.filter.matches(item);
|
||||
}
|
||||
}
|
||||
|
||||
public static class PatternItemFilter implements ItemFilter {
|
||||
|
||||
public Pattern pattern;
|
||||
@@ -73,7 +90,7 @@ public class ItemList {
|
||||
|
||||
@Override
|
||||
public boolean matches(ItemStack item) {
|
||||
return pattern.matcher(ItemInfo.getSearchName(item)).find();
|
||||
return pattern.matcher(item.getDisplayName()).find();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +178,9 @@ public class ItemList {
|
||||
public static List<ItemFilter> getItemFilters() {
|
||||
LinkedList<ItemFilter> filters = new LinkedList<>();
|
||||
synchronized (itemFilterers) {
|
||||
for (ItemFilterProvider p : itemFilterers) filters.add(p.getFilter());
|
||||
for (ItemFilterProvider p : itemFilterers) {
|
||||
filters.add(p.getFilter());
|
||||
}
|
||||
}
|
||||
return filters;
|
||||
}
|
||||
@@ -173,7 +192,7 @@ public class ItemList {
|
||||
for (int damage = 0; damage < 16; damage++) try {
|
||||
ItemStack itemstack = new ItemStack(item, 1, damage);
|
||||
IIcon icon = item.getIconIndex(itemstack);
|
||||
String name = GuiContainerManager.concatenatedDisplayName(itemstack, false);
|
||||
String name = getTooltip(itemstack);
|
||||
String s = name + "@" + (icon == null ? 0 : icon.hashCode());
|
||||
if (!damageIconSet.contains(s)) {
|
||||
damageIconSet.add(s);
|
||||
@@ -190,6 +209,54 @@ public class ItemList {
|
||||
}
|
||||
}
|
||||
|
||||
private String getTooltip(ItemStack stack) {
|
||||
try {
|
||||
@SuppressWarnings("unchecked")
|
||||
final List<String> namelist = stack.getTooltip(Minecraft.getMinecraft().thePlayer, false);
|
||||
final StringJoiner sb = new StringJoiner("\n");
|
||||
|
||||
for (String name : namelist) {
|
||||
sb.add(name);
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
} catch (Throwable ignored) {}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
private void updateOrdering(List<ItemStack> items) {
|
||||
ItemList.ordering.clear();
|
||||
|
||||
ItemSorter.sort(items);
|
||||
|
||||
if (NEIClientConfig.enableCollapsibleItems()) {
|
||||
HashMap<Integer, Integer> groups = new HashMap<>();
|
||||
int orderIndex = 0;
|
||||
|
||||
for (ItemStack stack : items) {
|
||||
final int groupIndex = ItemList.collapsibleItems.getGroupIndex(stack);
|
||||
|
||||
if (groupIndex == -1) {
|
||||
ItemList.ordering.put(stack, orderIndex++);
|
||||
} else {
|
||||
|
||||
if (!groups.containsKey(groupIndex)) {
|
||||
groups.put(groupIndex, orderIndex++);
|
||||
}
|
||||
|
||||
ItemList.ordering.put(stack, groups.get(groupIndex));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int orderIndex = 0;
|
||||
|
||||
for (ItemStack stack : items) {
|
||||
ItemList.ordering.put(stack, orderIndex++);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void execute() {
|
||||
@@ -197,8 +264,8 @@ public class ItemList {
|
||||
ThreadOperationTimer timer = getTimer(NEIClientConfig.getItemLoadingTimeout());
|
||||
loadFinished = false;
|
||||
|
||||
LinkedList<ItemStack> items = new LinkedList<>();
|
||||
LinkedList<ItemStack> permutations = new LinkedList<>();
|
||||
List<ItemStack> items = new LinkedList<>();
|
||||
List<ItemStack> permutations = new LinkedList<>();
|
||||
ListMultimap<Item, ItemStack> itemMap = ArrayListMultimap.create();
|
||||
|
||||
timer.setLimit(NEIClientConfig.getItemLoadingTimeout());
|
||||
@@ -234,9 +301,12 @@ public class ItemList {
|
||||
ItemList.itemMap = itemMap;
|
||||
for (ItemsLoadedCallback callback : loadCallbacks) callback.itemsLoaded();
|
||||
|
||||
updateFilter.restart();
|
||||
if (interrupted()) return;
|
||||
ItemList.collapsibleItems.updateCache(items);
|
||||
updateOrdering(items);
|
||||
|
||||
loadFinished = true;
|
||||
updateFilter.restart();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -251,11 +321,15 @@ public class ItemList {
|
||||
|
||||
public static final RestartableTask updateFilter = new RestartableTask("NEI Item Filtering") {
|
||||
|
||||
private int compare(ItemStack o1, ItemStack o2) {
|
||||
return Integer.compare(ItemList.ordering.get(o1), ItemList.ordering.get(o2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
// System.out.println("Executing NEI Item Filtering");
|
||||
ArrayList<ItemStack> filtered;
|
||||
if (!loadFinished) return;
|
||||
ItemFilter filter = getItemListFilter();
|
||||
ArrayList<ItemStack> filtered;
|
||||
|
||||
try {
|
||||
filtered = ItemList.forkJoinPool.submit(
|
||||
@@ -269,7 +343,7 @@ public class ItemList {
|
||||
}
|
||||
|
||||
if (interrupted()) return;
|
||||
ItemSorter.sort(filtered);
|
||||
filtered.sort(this::compare);
|
||||
if (interrupted()) return;
|
||||
ItemPanel.updateItemList(filtered);
|
||||
}
|
||||
|
||||
@@ -1,17 +1,27 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.drawRect;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.guihook.IContainerTooltipHandler;
|
||||
|
||||
public class ItemPanel extends PanelWidget {
|
||||
public class ItemPanel extends PanelWidget implements IContainerTooltipHandler {
|
||||
|
||||
/**
|
||||
* Backwards compat :-/
|
||||
@@ -35,6 +45,7 @@ public class ItemPanel extends PanelWidget {
|
||||
public Button less;
|
||||
public ItemQuantityField quantity;
|
||||
public ItemHistoryPanel historyPanel;
|
||||
public Button toggleGroups;
|
||||
|
||||
public static class ItemPanelSlot {
|
||||
|
||||
@@ -52,9 +63,29 @@ public class ItemPanel extends PanelWidget {
|
||||
}
|
||||
}
|
||||
|
||||
protected static class MaskMetadata {
|
||||
|
||||
public int groupIndex = -1;
|
||||
public boolean extended = false;
|
||||
|
||||
public Color bgColor = null;
|
||||
public Color color = null;
|
||||
|
||||
public boolean left = false;
|
||||
public boolean top = false;
|
||||
public boolean right = false;
|
||||
public boolean bottom = false;
|
||||
|
||||
}
|
||||
|
||||
protected static class ItemPanelGrid extends ItemsGrid {
|
||||
|
||||
public ArrayList<ItemStack> newItems;
|
||||
public ArrayList<ItemStack> rawItems;
|
||||
|
||||
protected final HashMap<Integer, List<ItemStack>> groupItems = new HashMap<>();
|
||||
protected final HashMap<Integer, MaskMetadata> maskMetadata = new HashMap<>();
|
||||
protected boolean forceExpand = false;
|
||||
|
||||
public void setItems(ArrayList<ItemStack> items) {
|
||||
newItems = items;
|
||||
@@ -62,9 +93,48 @@ public class ItemPanel extends PanelWidget {
|
||||
|
||||
public void refresh(GuiContainer gui) {
|
||||
|
||||
if (newItems != null) {
|
||||
realItems = newItems;
|
||||
newItems = null;
|
||||
if (this.newItems != null) {
|
||||
this.groupItems.clear();
|
||||
this.forceExpand = false;
|
||||
|
||||
if (NEIClientConfig.enableCollapsibleItems() && !this.newItems.isEmpty()) {
|
||||
final Set<Integer> groups = new HashSet<>();
|
||||
boolean outsideGroup = false;
|
||||
|
||||
this.realItems = new ArrayList<>();
|
||||
this.rawItems = new ArrayList<>(this.newItems);
|
||||
|
||||
for (ItemStack stack : this.newItems) {
|
||||
final int groupIndex = ItemList.collapsibleItems.getGroupIndex(stack);
|
||||
|
||||
if (groupIndex == -1) {
|
||||
this.realItems.add(stack);
|
||||
outsideGroup = true;
|
||||
} else {
|
||||
|
||||
if (!groups.contains(groupIndex) || ItemList.collapsibleItems.isExpanded(groupIndex)) {
|
||||
this.realItems.add(stack);
|
||||
groups.add(groupIndex);
|
||||
}
|
||||
|
||||
if (!this.groupItems.containsKey(groupIndex)) {
|
||||
this.groupItems.put(groupIndex, new ArrayList<>());
|
||||
}
|
||||
|
||||
this.groupItems.get(groupIndex).add(stack);
|
||||
}
|
||||
}
|
||||
|
||||
// automatically opens if there are elements from only one group
|
||||
if (!outsideGroup && groups.size() == 1) {
|
||||
this.realItems = new ArrayList<>(this.newItems);
|
||||
this.forceExpand = true;
|
||||
}
|
||||
} else {
|
||||
this.realItems = new ArrayList<>(this.newItems);
|
||||
}
|
||||
|
||||
this.newItems = null;
|
||||
onItemsChanged();
|
||||
}
|
||||
|
||||
@@ -72,11 +142,170 @@ public class ItemPanel extends PanelWidget {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void beforeDrawSlot(@Nullable ItemPanelSlot focused, int slotIdx, Rectangle4i rect) {
|
||||
if (PresetsWidget.inEditMode()) {
|
||||
if (!PresetsWidget.isHidden(getItem(slotIdx))) drawRect(rect.x, rect.y, rect.w, rect.h, 0xee555555);
|
||||
protected List<Integer> getMask() {
|
||||
final boolean updateBorders = this.gridMask == null;
|
||||
final List<Integer> mask = super.getMask();
|
||||
|
||||
if (updateBorders) {
|
||||
calculateGroupBorders(mask);
|
||||
}
|
||||
|
||||
return mask;
|
||||
}
|
||||
|
||||
protected void calculateGroupBorders(List<Integer> mask) {
|
||||
this.maskMetadata.clear();
|
||||
|
||||
if (mask.isEmpty() || this.groupItems.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
final HashMap<Integer, Integer> maskGroup = new HashMap<>();
|
||||
final Color collapsedColor = new Color(
|
||||
NEIClientConfig.getSetting("inventory.collapsibleItems.collapsedColor").getHexValue(),
|
||||
true);
|
||||
final Color expandedColor = new Color(
|
||||
NEIClientConfig.getSetting("inventory.collapsibleItems.expandedColor").getHexValue(),
|
||||
true);
|
||||
|
||||
for (int slotIndex = 0; slotIndex < mask.size(); slotIndex++) {
|
||||
if (mask.get(slotIndex) == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int idx = mask.get(slotIndex);
|
||||
maskGroup.put(idx, ItemList.collapsibleItems.getGroupIndex(getItem(idx)));
|
||||
}
|
||||
|
||||
for (int slotIndex = 0; slotIndex < mask.size(); slotIndex++) {
|
||||
if (mask.get(slotIndex) == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int idx = mask.get(slotIndex);
|
||||
int groupIndex = maskGroup.get(idx);
|
||||
|
||||
if (groupIndex == -1 || this.groupItems.get(groupIndex).size() == 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int column = slotIndex % this.columns;
|
||||
int row = slotIndex / this.columns;
|
||||
int prevSlotIndex = (row - 1) * this.columns + column;
|
||||
int nextSlotIndex = (row + 1) * this.columns + column;
|
||||
MaskMetadata metadata = new MaskMetadata();
|
||||
|
||||
metadata.groupIndex = groupIndex;
|
||||
metadata.extended = this.forceExpand || ItemList.collapsibleItems.isExpanded(groupIndex);
|
||||
metadata.bgColor = metadata.extended ? expandedColor : collapsedColor;
|
||||
metadata.color = darkerColor(metadata.bgColor);
|
||||
metadata.left = column == 0 || idx == 0
|
||||
|| mask.get(slotIndex - 1) == null
|
||||
|| maskGroup.getOrDefault(idx - 1, -1) != groupIndex;
|
||||
metadata.right = column == this.columns - 1 || maskGroup.getOrDefault(idx + 1, -1) != groupIndex;
|
||||
|
||||
if (prevSlotIndex >= 0) {
|
||||
Integer previdx = mask.get(prevSlotIndex);
|
||||
metadata.top = previdx == null || maskGroup.getOrDefault(previdx, -1) != groupIndex;
|
||||
} else {
|
||||
metadata.top = true;
|
||||
}
|
||||
|
||||
if (nextSlotIndex < mask.size()) {
|
||||
Integer nextidx = mask.get(nextSlotIndex);
|
||||
metadata.bottom = nextidx == null || maskGroup.getOrDefault(nextidx, -1) != groupIndex;
|
||||
} else {
|
||||
metadata.bottom = true;
|
||||
}
|
||||
|
||||
this.maskMetadata.put(idx, metadata);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void beforeDrawItems(int mousex, int mousey, @Nullable ItemPanelSlot focused) {
|
||||
final List<Integer> mask = getMask();
|
||||
|
||||
super.beforeDrawItems(mousex, mousey, focused);
|
||||
|
||||
for (int i = 0; i < mask.size(); i++) {
|
||||
if (mask.get(i) != null) {
|
||||
drawBorder(mask.get(i), getSlotRect(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void drawBorder(int slotIdx, Rectangle4i rect) {
|
||||
final MaskMetadata metadata = this.maskMetadata.get(slotIdx);
|
||||
|
||||
if (metadata != null) {
|
||||
final float LINE_WIDTH = 0.75f;
|
||||
|
||||
drawRect(rect.x, rect.y, rect.w, rect.h, metadata.bgColor);
|
||||
|
||||
if (metadata.left) {
|
||||
float leftBottom = metadata.bottom ? -LINE_WIDTH : 0;
|
||||
drawRect(rect.x, rect.y, LINE_WIDTH, rect.h + leftBottom, metadata.color);
|
||||
}
|
||||
|
||||
if (metadata.right) {
|
||||
float rightTop = metadata.top ? LINE_WIDTH : 0;
|
||||
drawRect(rect.x + rect.w, rect.y - rightTop, LINE_WIDTH, rect.h + rightTop, metadata.color);
|
||||
}
|
||||
|
||||
if (metadata.top) {
|
||||
drawRect(rect.x, rect.y - LINE_WIDTH, rect.w, LINE_WIDTH, metadata.color);
|
||||
}
|
||||
|
||||
if (metadata.bottom) {
|
||||
drawRect(rect.x, rect.y + rect.h - LINE_WIDTH, rect.w, LINE_WIDTH, metadata.color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Color darkerColor(Color color) {
|
||||
return new Color(
|
||||
color.getRed(),
|
||||
color.getGreen(),
|
||||
color.getBlue(),
|
||||
Math.min((int) (color.getAlpha() + (255f / 5) * 2), 255));
|
||||
}
|
||||
|
||||
private static void drawRect(double left, double top, double width, double height, Color color) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
GL11.glColor4f(
|
||||
color.getRed() / 255f,
|
||||
color.getGreen() / 255f,
|
||||
color.getBlue() / 255f,
|
||||
color.getAlpha() / 255f);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertex(left, top + height, 0.0D);
|
||||
tessellator.addVertex(left + width, top + height, 0.0D);
|
||||
tessellator.addVertex(left + width, top, 0.0D);
|
||||
tessellator.addVertex(left, top, 0.0D);
|
||||
tessellator.draw();
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawItem(Rectangle4i rect, int slotIdx) {
|
||||
final MaskMetadata metadata = this.maskMetadata.get(slotIdx);
|
||||
|
||||
if (metadata != null && !metadata.extended) {
|
||||
final List<ItemStack> groupItems = this.groupItems.get(metadata.groupIndex);
|
||||
|
||||
GuiContainerManager.drawItems.zLevel -= 10F;
|
||||
GuiContainerManager.drawItem(rect.x + 1, rect.y - 1, groupItems.get(groupItems.size() - 1), true, "");
|
||||
GuiContainerManager.drawItems.zLevel += 10F;
|
||||
|
||||
GuiContainerManager.drawItem(rect.x - 1, rect.y + 1, getItem(slotIdx), true, "");
|
||||
} else {
|
||||
super.beforeDrawSlot(focused, slotIdx, rect);
|
||||
super.drawItem(rect, slotIdx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,6 +317,7 @@ public class ItemPanel extends PanelWidget {
|
||||
|
||||
public ItemPanel() {
|
||||
grid = new ItemPanelGrid();
|
||||
GuiContainerManager.addTooltipHandler(this);
|
||||
}
|
||||
|
||||
public static void updateItemList(ArrayList<ItemStack> newItems) {
|
||||
@@ -99,6 +329,21 @@ public class ItemPanel extends PanelWidget {
|
||||
public void init() {
|
||||
super.init();
|
||||
|
||||
toggleGroups = new Button("G") {
|
||||
|
||||
@Override
|
||||
public String getButtonTip() {
|
||||
return NEIClientUtils.translate("itempanel.collapsed.button.tip");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onButtonPress(boolean rightclick) {
|
||||
ItemList.collapsibleItems.toggleGroups(rightclick ? false : null);
|
||||
ItemList.updateFilter.restart();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
more = new Button("+") {
|
||||
|
||||
@Override
|
||||
@@ -167,8 +412,23 @@ public class ItemPanel extends PanelWidget {
|
||||
return gui.height - getMarginTop(gui) - PADDING;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int resizeHeader(GuiContainer gui) {
|
||||
int marginTop = super.resizeHeader(gui);
|
||||
|
||||
toggleGroups.w = pageNext.w;
|
||||
toggleGroups.h = pageNext.h;
|
||||
toggleGroups.y = pageNext.y;
|
||||
toggleGroups.x = pageNext.x - toggleGroups.w - 2;
|
||||
|
||||
return marginTop;
|
||||
}
|
||||
|
||||
protected int resizeFooter(GuiContainer gui) {
|
||||
if (!NEIClientConfig.showItemQuantityWidget() && NEIClientConfig.isSearchWidgetCentered()) return 0;
|
||||
if (!NEIClientConfig.showItemQuantityWidget() && NEIClientConfig.isSearchWidgetCentered()
|
||||
&& !NEIClientConfig.showHistoryPanelWidget()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
final int BUTTON_SIZE = 20;
|
||||
more.w = less.w = BUTTON_SIZE;
|
||||
@@ -197,8 +457,14 @@ public class ItemPanel extends PanelWidget {
|
||||
historyPanel.x = x;
|
||||
historyPanel.w = w;
|
||||
historyPanel.h = ItemsGrid.SLOT_SIZE * NEIClientConfig.getIntSetting("inventory.history.useRows");
|
||||
historyPanel.y = quantity.y - PanelWidget.PADDING - historyPanel.h;
|
||||
return quantity.h + historyPanel.h + PanelWidget.PADDING * 2;
|
||||
|
||||
if (NEIClientConfig.showItemQuantityWidget() || !NEIClientConfig.isSearchWidgetCentered()) {
|
||||
historyPanel.y = quantity.y - historyPanel.h - PanelWidget.PADDING;
|
||||
return quantity.h + historyPanel.h + PanelWidget.PADDING * 2;
|
||||
} else {
|
||||
historyPanel.y = y + h - historyPanel.h;
|
||||
return historyPanel.h + PanelWidget.PADDING;
|
||||
}
|
||||
}
|
||||
|
||||
return quantity.h + PanelWidget.PADDING;
|
||||
@@ -215,6 +481,10 @@ public class ItemPanel extends PanelWidget {
|
||||
LayoutManager.addWidget(quantity);
|
||||
}
|
||||
|
||||
if (NEIClientConfig.enableCollapsibleItems()) {
|
||||
LayoutManager.addWidget(toggleGroups);
|
||||
}
|
||||
|
||||
if (NEIClientConfig.showHistoryPanelWidget()) {
|
||||
LayoutManager.addWidget(historyPanel);
|
||||
}
|
||||
@@ -242,4 +512,65 @@ public class ItemPanel extends PanelWidget {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleTooltip(GuiContainer gui, int mousex, int mousey, List<String> currenttip) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleItemDisplayName(GuiContainer gui, ItemStack itemstack, List<String> currenttip) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleItemTooltip(GuiContainer gui, ItemStack itemstack, int mousex, int mousey,
|
||||
List<String> currenttip) {
|
||||
final ItemPanelGrid panelGrid = ((ItemPanelGrid) this.grid);
|
||||
|
||||
if (!panelGrid.forceExpand && !NEIClientConfig.isHidden() && !currenttip.isEmpty()) {
|
||||
final ItemPanelSlot hoverSlot = getSlotMouseOver(mousex, mousey);
|
||||
|
||||
if (hoverSlot != null) {
|
||||
final MaskMetadata metadata = panelGrid.maskMetadata.get(hoverSlot.slotIndex);
|
||||
|
||||
if (metadata != null) {
|
||||
final List<ItemStack> items = panelGrid.groupItems.get(metadata.groupIndex);
|
||||
|
||||
if (items != null && items.size() > 1) {
|
||||
String message = metadata.extended ? "itempanel.collapsed.hint.collapse"
|
||||
: "itempanel.collapsed.hint.expand";
|
||||
currenttip.add(
|
||||
1,
|
||||
EnumChatFormatting.GRAY + NEIClientUtils.translate(message, items.size())
|
||||
+ EnumChatFormatting.RESET);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleClick(int mousex, int mousey, int button) {
|
||||
final ItemPanelGrid panelGrid = ((ItemPanelGrid) this.grid);
|
||||
|
||||
if (NEIClientUtils.altKey() && button == 0 && !panelGrid.forceExpand) {
|
||||
final ItemPanelSlot hoverSlot = grid.getSlotMouseOver(mousex, mousey);
|
||||
|
||||
if (hoverSlot != null) {
|
||||
final MaskMetadata metadata = panelGrid.maskMetadata.get(hoverSlot.slotIndex);
|
||||
|
||||
if (metadata != null) {
|
||||
ItemList.collapsibleItems.setExpanded(metadata.groupIndex, !metadata.extended);
|
||||
panelGrid.setItems(panelGrid.rawItems);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return super.handleClick(mousex, mousey, button);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -46,7 +46,7 @@ public class ItemSorter implements Comparator<ItemStack>, ItemsLoadedCallback {
|
||||
// optimisations
|
||||
public HashMap<ItemStack, Integer> ordering = null;
|
||||
|
||||
public static void sort(ArrayList<ItemStack> items) {
|
||||
public static void sort(List<ItemStack> items) {
|
||||
try {
|
||||
// items = (ArrayList<ItemStack>)
|
||||
// items.parallelStream().sorted(instance).collect(Collectors.toList());
|
||||
@@ -123,8 +123,8 @@ public class ItemSorter implements Comparator<ItemStack>, ItemsLoadedCallback {
|
||||
return compareInt(id1, id2);
|
||||
});
|
||||
API.addSortOption("nei.itemsort.name", (o1, o2) -> {
|
||||
String name1 = ItemInfo.getSearchName(o1);
|
||||
String name2 = ItemInfo.getSearchName(o2);
|
||||
String name1 = o1.getDisplayName();
|
||||
String name2 = o2.getDisplayName();
|
||||
return name1.compareTo(name2);
|
||||
});
|
||||
tag.getTag("inventory.itemsort").setDefaultValue(getSaveString(list));
|
||||
|
||||
@@ -173,11 +173,13 @@ public class ItemsGrid {
|
||||
invalidSlotMap = new boolean[rows * columns];
|
||||
perPage = columns * rows;
|
||||
|
||||
if (NEIClientConfig.optimizeGuiOverlapComputation()) {
|
||||
checkGuiOverlap(gui, 0, columns - 2, 1);
|
||||
checkGuiOverlap(gui, columns - 1, 1, -1);
|
||||
} else {
|
||||
checkGuiOverlap(gui, 0, columns, 1);
|
||||
if (gui != null) {
|
||||
if (NEIClientConfig.optimizeGuiOverlapComputation()) {
|
||||
checkGuiOverlap(gui, 0, columns - 2, 1);
|
||||
checkGuiOverlap(gui, columns - 1, 1, -1);
|
||||
} else {
|
||||
checkGuiOverlap(gui, 0, columns, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (oldRows != rows || oldColumns != columns || !Arrays.equals(oldSlotMap, invalidSlotMap)) {
|
||||
@@ -247,7 +249,7 @@ public class ItemsGrid {
|
||||
return this.gridMask;
|
||||
}
|
||||
|
||||
private void beforeDrawItems(int mousex, int mousey, @Nullable ItemPanelSlot focused) {
|
||||
protected void beforeDrawItems(int mousex, int mousey, @Nullable ItemPanelSlot focused) {
|
||||
|
||||
final List<Integer> mask = getMask();
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.gui.inventory.GuiContainerCreative;
|
||||
import net.minecraft.client.renderer.InventoryEffectRenderer;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -52,6 +53,7 @@ import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.KeyManager.IKeyStateTracker;
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.GuiInfo;
|
||||
import codechicken.nei.api.INEIAutoFocusSearchEnable;
|
||||
import codechicken.nei.api.IRecipeOverlayRenderer;
|
||||
import codechicken.nei.api.ItemInfo;
|
||||
import codechicken.nei.api.LayoutStyle;
|
||||
@@ -85,8 +87,10 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
public static ItemPanel itemPanel;
|
||||
public static BookmarkPanel bookmarkPanel;
|
||||
public static SubsetWidget dropDown;
|
||||
public static PresetsWidget presetsPanel;
|
||||
public static SearchField searchField;
|
||||
public static boolean searchInitFocusedCancellable = false;
|
||||
protected static int mousePriorX;
|
||||
protected static int mousePriorY;
|
||||
|
||||
public static ButtonCycled options;
|
||||
public static ButtonCycled bookmarksButton;
|
||||
@@ -163,10 +167,38 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
return getSideWidth(gui);
|
||||
}
|
||||
|
||||
protected boolean isAllowedGuiAutoSearchFocus(GuiContainer gui) {
|
||||
if (gui instanceof INEIAutoFocusSearchEnable) {
|
||||
return true;
|
||||
}
|
||||
String guiClassName = gui.getClass().getName();
|
||||
for (String prefix : NEIClientConfig.enableAutoFocusPrefixes) {
|
||||
if (guiClassName.startsWith(prefix)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Maybe make this an option to make it easier to figure out what GPU class to add to the configuration?
|
||||
// NEIClientConfig.logger.info("Checking for autofocus on " + guiClassName + " had no match");
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void searchFocusInitCancelCheck() {
|
||||
if (searchInitFocusedCancellable) {
|
||||
if (searchField.isVisible() && NEIClientConfig.searchWidgetAutofocus()
|
||||
&& getInputFocused() == searchField) {
|
||||
searchField.setFocus(false);
|
||||
setInputFocused(null);
|
||||
}
|
||||
searchInitFocusedCancellable = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseClicked(GuiContainer gui, int mousex, int mousey, int button) {
|
||||
if (isHidden()) return;
|
||||
|
||||
searchFocusInitCancelCheck();
|
||||
|
||||
for (Widget widget : controlWidgets) widget.onGuiClick(mousex, mousey);
|
||||
}
|
||||
|
||||
@@ -176,6 +208,8 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
|
||||
if (!isEnabled()) return options.contains(mousex, mousey) && options.handleClick(mousex, mousey, button);
|
||||
|
||||
searchFocusInitCancelCheck();
|
||||
|
||||
for (Widget widget : controlWidgets) {
|
||||
widget.onGuiClick(mousex, mousey);
|
||||
if (widget.contains(mousex, mousey) ? widget.handleClick(mousex, mousey, button)
|
||||
@@ -196,6 +230,14 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
|
||||
public boolean keyTyped(GuiContainer gui, char keyChar, int keyID) {
|
||||
if (isEnabled() && !isHidden()) {
|
||||
if (searchInitFocusedCancellable) {
|
||||
searchInitFocusedCancellable = false;
|
||||
if (NEIClientConfig.isFirstInvCloseClosesInSearch()
|
||||
&& GameSettings.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindInventory)) {
|
||||
searchField.setFocus(false);
|
||||
setInputFocused(null);
|
||||
}
|
||||
}
|
||||
if (inputFocused != null) return inputFocused.handleKeyPress(keyID, keyChar);
|
||||
|
||||
for (Widget widget : controlWidgets) if (widget.handleKeyPress(keyID, keyChar)) return true;
|
||||
@@ -234,6 +276,7 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
|
||||
public void onMouseUp(GuiContainer gui, int mx, int my, int button) {
|
||||
if (!isHidden() && isEnabled()) {
|
||||
searchFocusInitCancelCheck();
|
||||
for (Widget widget : controlWidgets) widget.mouseUp(mx, my, button);
|
||||
}
|
||||
}
|
||||
@@ -241,6 +284,7 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
@Override
|
||||
public void onMouseDragged(GuiContainer gui, int mx, int my, int button, long heldTime) {
|
||||
if (!isHidden() && isEnabled()) {
|
||||
searchFocusInitCancelCheck();
|
||||
for (Widget widget : controlWidgets) widget.mouseDragged(mx, my, button, heldTime);
|
||||
}
|
||||
}
|
||||
@@ -259,6 +303,14 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
public void renderObjects(GuiContainer gui, int mousex, int mousey) {
|
||||
if (!isHidden()) {
|
||||
layout(gui);
|
||||
if (mousePriorX == -1) {
|
||||
mousePriorX = mousex;
|
||||
mousePriorY = mousey;
|
||||
} else if (mousePriorX != mousex || mousePriorY != mousey) {
|
||||
searchFocusInitCancelCheck();
|
||||
mousePriorX = mousex;
|
||||
mousePriorY = mousey;
|
||||
}
|
||||
if (isEnabled()) {
|
||||
getLayoutStyle().drawBackground(GuiContainerManager.getManager(gui));
|
||||
for (Widget widget : drawWidgets) widget.draw(mousex, mousey);
|
||||
@@ -328,12 +380,8 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
|
||||
if (visiblity.showBookmarkPanel || gui.guiTop <= 20) visiblity.showSubsetDropdown = false;
|
||||
|
||||
if (!visiblity.showBookmarkPanel || gui.guiTop <= 20) visiblity.showPresetsDropdown = false;
|
||||
|
||||
if (gui.guiLeft - 4 < 76) visiblity.showWidgets = false;
|
||||
|
||||
if (!itemsLoaded) visiblity.showPresetsDropdown = false;
|
||||
|
||||
try {
|
||||
GuiInfo.readLock.lock();
|
||||
GuiInfo.guiHandlers.forEach(handler -> handler.modifyVisiblity(gui, visiblity));
|
||||
@@ -356,8 +404,8 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
bookmarkPanel.init();
|
||||
|
||||
dropDown = new SubsetWidget();
|
||||
presetsPanel = new PresetsWidget();
|
||||
searchField = new SearchField("search");
|
||||
API.addItemFilter(searchField);
|
||||
|
||||
options = new ButtonCycled(3) {
|
||||
|
||||
@@ -620,6 +668,15 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
|
||||
getLayoutStyle().init();
|
||||
layout(gui);
|
||||
mousePriorX = -1;
|
||||
mousePriorY = -1;
|
||||
|
||||
if (searchField.isVisible() && NEIClientConfig.searchWidgetAutofocus()
|
||||
&& isAllowedGuiAutoSearchFocus(gui)) {
|
||||
searchField.setFocus(true);
|
||||
setInputFocused(searchField);
|
||||
searchInitFocusedCancellable = true;
|
||||
}
|
||||
}
|
||||
|
||||
NEIController.load(gui);
|
||||
@@ -652,13 +709,7 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
addWidget(options);
|
||||
addWidget(bookmarksButton);
|
||||
if (visiblity.showItemPanel) {
|
||||
|
||||
if (PresetsWidget.inEditMode()) {
|
||||
drawWidgets.add(itemPanel);
|
||||
} else {
|
||||
addWidget(itemPanel);
|
||||
}
|
||||
|
||||
addWidget(itemPanel);
|
||||
itemPanel.setVisible();
|
||||
}
|
||||
|
||||
@@ -667,10 +718,6 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
bookmarkPanel.setVisible();
|
||||
}
|
||||
|
||||
if (visiblity.showPresetsDropdown) {
|
||||
addWidget(presetsPanel);
|
||||
}
|
||||
|
||||
searchField.setVisible(visiblity.showSearchSection);
|
||||
if (visiblity.showSearchSection) {
|
||||
addWidget(searchField);
|
||||
@@ -721,6 +768,7 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
@Override
|
||||
public boolean mouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) {
|
||||
if (isHidden() || !isEnabled()) return false;
|
||||
searchFocusInitCancelCheck();
|
||||
|
||||
for (Widget widget : drawWidgets) if (widget.onMouseWheel(scrolled, mousex, mousey)) return true;
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ import static codechicken.nei.LayoutManager.itemPanel;
|
||||
import static codechicken.nei.LayoutManager.itemPresenceOverlays;
|
||||
import static codechicken.nei.LayoutManager.magnet;
|
||||
import static codechicken.nei.LayoutManager.options;
|
||||
import static codechicken.nei.LayoutManager.presetsPanel;
|
||||
import static codechicken.nei.LayoutManager.rain;
|
||||
import static codechicken.nei.LayoutManager.searchField;
|
||||
import static codechicken.nei.LayoutManager.timeButtons;
|
||||
@@ -121,11 +120,6 @@ public class LayoutStyleMinecraft extends LayoutStyle {
|
||||
dropDown.y = 0;
|
||||
dropDown.x = (gui.width - gui.xSize) / 2 + gui.xSize - dropDown.w;
|
||||
|
||||
presetsPanel.h = 16;
|
||||
presetsPanel.w = 150;
|
||||
presetsPanel.y = 2;
|
||||
presetsPanel.x = (gui.width - gui.xSize) / 2 + gui.xSize - presetsPanel.w;
|
||||
|
||||
searchField.h = 20;
|
||||
if (NEIClientConfig.isSearchWidgetCentered()) {
|
||||
searchField.w = 150;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@@ -14,6 +15,7 @@ import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.storage.SaveFormatComparator;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
@@ -41,6 +43,7 @@ import codechicken.nei.config.GuiHighlightTips;
|
||||
import codechicken.nei.config.GuiNEIOptionList;
|
||||
import codechicken.nei.config.GuiOptionList;
|
||||
import codechicken.nei.config.GuiPanelSettings;
|
||||
import codechicken.nei.config.OptionButton;
|
||||
import codechicken.nei.config.OptionCycled;
|
||||
import codechicken.nei.config.OptionGamemodes;
|
||||
import codechicken.nei.config.OptionIntegerField;
|
||||
@@ -50,6 +53,7 @@ import codechicken.nei.config.OptionTextField;
|
||||
import codechicken.nei.config.OptionToggleButton;
|
||||
import codechicken.nei.config.OptionToggleButtonBoubs;
|
||||
import codechicken.nei.config.OptionUtilities;
|
||||
import codechicken.nei.config.preset.GuiPresetList;
|
||||
import codechicken.nei.event.NEIConfigsLoadedEvent;
|
||||
import codechicken.nei.recipe.GuiRecipeTab;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
@@ -76,6 +80,8 @@ public class NEIClientConfig {
|
||||
public static final File heightHackHandlersFile = new File(configDir, "heighthackhandlers.cfg");
|
||||
public static final File handlerOrderingFile = new File(configDir, "handlerordering.csv");
|
||||
public static final File hiddenHandlersFile = new File(configDir, "hiddenhandlers.csv");
|
||||
public static final File enableAutoFocusFile = new File(configDir, "enableautofocus.cfg");
|
||||
public static final File collapsibleItemsFile = new File(configDir, "collapsibleitems.cfg");
|
||||
|
||||
@Deprecated
|
||||
public static File bookmarkFile;
|
||||
@@ -95,6 +101,9 @@ public class NEIClientConfig {
|
||||
// Any handler not in the map will be assigned to 0, and negative numbers are fine.
|
||||
public static HashMap<String, Integer> handlerOrdering = new HashMap<>();
|
||||
|
||||
// List of prefixes of classes that should enable the autofocus search widget on open.
|
||||
public static ArrayList<String> enableAutoFocusPrefixes = new ArrayList<>();
|
||||
|
||||
// Function that extracts the handler ID from a handler, with special logic for
|
||||
// TemplateRecipeHandler: prefer using the overlay ID if it exists.
|
||||
public static final Function<IRecipeHandler, String> HANDLER_ID_FUNCTION = handler -> Objects
|
||||
@@ -163,6 +172,76 @@ public class NEIClientConfig {
|
||||
|
||||
ItemSorter.initConfig(tag);
|
||||
|
||||
tag.getTag("inventory.search.widgetPosition").setComment("Widget Position").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.search.widgetPosition", true));
|
||||
|
||||
tag.getTag("inventory.search.widgetAutofocus")
|
||||
.setComment(
|
||||
"Focus Search Widget on Open, blurs/unfocuses on mouse move unless typing has started first")
|
||||
.getBooleanValue(false);
|
||||
API.addOption(new OptionToggleButton("inventory.search.widgetAutofocus", true));
|
||||
|
||||
tag.getTag("inventory.search.patternMode").setComment("Search Mode").getIntValue(1);
|
||||
API.addOption(new OptionCycled("inventory.search.patternMode", 3, true));
|
||||
|
||||
tag.getTag("inventory.search.quoteDropItemName").setComment("Quote Drop Item Name").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.search.quoteDropItemName", true));
|
||||
|
||||
tag.getTag("inventory.search.modNameSearchMode").setComment("Search mode for Mod Names (prefix: @)")
|
||||
.getIntValue(1);
|
||||
API.addOption(new OptionCycled("inventory.search.modNameSearchMode", 3, true) {
|
||||
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return translateN(name + "." + value(), EnumChatFormatting.LIGHT_PURPLE + "@");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
tag.getTag("inventory.search.tooltipSearchMode").setComment("Search mode for Tooltips (prefix: #)")
|
||||
.getIntValue(0);
|
||||
API.addOption(new OptionCycled("inventory.search.tooltipSearchMode", 3, true) {
|
||||
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return translateN(name + "." + value(), EnumChatFormatting.YELLOW + "#");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
tag.getTag("inventory.search.identifierSearchMode").setComment("Search mode for identifier (prefix: &)")
|
||||
.getIntValue(0);
|
||||
API.addOption(new OptionCycled("inventory.search.identifierSearchMode", 3, true) {
|
||||
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return translateN(name + "." + value(), EnumChatFormatting.GOLD + "&");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
tag.getTag("inventory.search.oreDictSearchMode").setComment("Search mode for Tag Names (prefix: $)")
|
||||
.getIntValue(0);
|
||||
API.addOption(new OptionCycled("inventory.search.oreDictSearchMode", 3, true) {
|
||||
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return translateN(name + "." + value(), EnumChatFormatting.AQUA + "$");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
tag.getTag("inventory.search.subsetsSearchMode").setComment("Search mode for Item Subsets (prefix: %)")
|
||||
.getIntValue(2);
|
||||
API.addOption(new OptionCycled("inventory.search.subsetsSearchMode", 3, true) {
|
||||
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return translateN(name + "." + value(), EnumChatFormatting.DARK_PURPLE + "%");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
tag.getTag("inventory.history.enabled").setComment("Enable/disable History Panel").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.history.enabled", true));
|
||||
|
||||
@@ -176,12 +255,40 @@ public class NEIClientConfig {
|
||||
tag.getTag("inventory.history.splittingMode").getIntValue(1);
|
||||
API.addOption(new OptionCycled("inventory.history.splittingMode", 2, true));
|
||||
|
||||
tag.getTag("inventory.collapsibleItems.enabled").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.collapsibleItems.enabled", true) {
|
||||
|
||||
@Override
|
||||
public boolean onClick(int button) {
|
||||
LayoutManager.markItemsDirty();
|
||||
return super.onClick(button);
|
||||
}
|
||||
});
|
||||
|
||||
tag.getTag("inventory.collapsibleItems.expandedColor")
|
||||
.setComment("Color of the collapsible item expanded state").getHexValue(0x335555EE);
|
||||
API.addOption(new OptionIntegerField("inventory.collapsibleItems.expandedColor"));
|
||||
|
||||
tag.getTag("inventory.collapsibleItems.collapsedColor")
|
||||
.setComment("Color of the collapsible item collapsed state").getHexValue(0x335555EE);
|
||||
API.addOption(new OptionIntegerField("inventory.collapsibleItems.collapsedColor"));
|
||||
|
||||
API.addOption(
|
||||
new OptionButton(
|
||||
"inventory.collapsibleItems.reloadLabel",
|
||||
"inventory.collapsibleItems.reloadButton",
|
||||
"inventory.collapsibleItems.reloadTip") {
|
||||
|
||||
@Override
|
||||
public boolean onClick(int button) {
|
||||
LayoutManager.markItemsDirty();
|
||||
return super.onClick(button);
|
||||
}
|
||||
});
|
||||
|
||||
tag.getTag("inventory.itemIDs").getIntValue(1);
|
||||
API.addOption(new OptionCycled("inventory.itemIDs", 3, true));
|
||||
|
||||
tag.getTag("inventory.searchmode").getIntValue(1);
|
||||
API.addOption(new OptionCycled("inventory.searchmode", 3, true));
|
||||
|
||||
tag.getTag("world.highlight_tips").getBooleanValue(false);
|
||||
tag.getTag("world.highlight_tips.x").getIntValue(5000);
|
||||
tag.getTag("world.highlight_tips.y").getIntValue(100);
|
||||
@@ -199,6 +306,8 @@ public class NEIClientConfig {
|
||||
|
||||
API.addOption(new OptionOpenGui("world.panels", GuiPanelSettings.class));
|
||||
|
||||
API.addOption(new OptionOpenGui("world.presets", GuiPresetList.class));
|
||||
|
||||
tag.getTag("inventory.profileRecipes").getBooleanValue(false);
|
||||
API.addOption(new OptionToggleButton("inventory.profileRecipes", true));
|
||||
|
||||
@@ -270,8 +379,10 @@ public class NEIClientConfig {
|
||||
tag.getTag("inventory.showItemQuantityWidget").setComment("Show Item Quantity Widget").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.showItemQuantityWidget", true));
|
||||
|
||||
tag.getTag("inventory.centerSearchWidget").setComment("Center Search Widget").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.centerSearchWidget", true));
|
||||
tag.getTag("inventory.firstInvCloseClosesInSearch").setComment(
|
||||
"Pressing the open inventory key when the inventory was just opened when the search is focused will close it instead of typing in the search")
|
||||
.getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.firstInvCloseClosesInSearch", true));
|
||||
|
||||
tag.getTag("inventory.jei_style_tabs").setComment("Enable/disable JEI Style Tabs").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButtonBoubs("inventory.jei_style_tabs", true));
|
||||
@@ -570,7 +681,7 @@ public class NEIClientConfig {
|
||||
worldPath = "global";
|
||||
}
|
||||
|
||||
PresetsWidget.loadPresets(worldPath);
|
||||
PresetsList.setPresetsFile(worldPath);
|
||||
}
|
||||
|
||||
public static boolean isWorldSpecific(String setting) {
|
||||
@@ -612,7 +723,15 @@ public class NEIClientConfig {
|
||||
}
|
||||
|
||||
public static boolean isSearchWidgetCentered() {
|
||||
return getBooleanSetting("inventory.centerSearchWidget");
|
||||
return getBooleanSetting("inventory.search.widgetPosition");
|
||||
}
|
||||
|
||||
public static boolean searchWidgetAutofocus() {
|
||||
return getBooleanSetting("inventory.search.widgetAutofocus");
|
||||
}
|
||||
|
||||
public static boolean isFirstInvCloseClosesInSearch() {
|
||||
return getBooleanSetting("inventory.firstInvCloseClosesInSearch");
|
||||
}
|
||||
|
||||
public static boolean areJEIStyleTabsVisible() {
|
||||
@@ -667,6 +786,10 @@ public class NEIClientConfig {
|
||||
return !getBooleanSetting("tools.catalyst_load_from_config");
|
||||
}
|
||||
|
||||
public static boolean isProfileRecipeEnabled() {
|
||||
return NEIClientConfig.getBooleanSetting("inventory.profileRecipes");
|
||||
}
|
||||
|
||||
public static void setEnabled(boolean flag) {
|
||||
getSetting("inventory.widgetsenabled").setBooleanValue(flag);
|
||||
}
|
||||
@@ -746,6 +869,10 @@ public class NEIClientConfig {
|
||||
return getBooleanSetting("inventory.cacheItemRendering") && OpenGlHelper.framebufferSupported;
|
||||
}
|
||||
|
||||
public static boolean enableCollapsibleItems() {
|
||||
return getBooleanSetting("inventory.collapsibleItems.enabled");
|
||||
}
|
||||
|
||||
public static boolean getMagnetMode() {
|
||||
return enabledActions.contains("magnet");
|
||||
}
|
||||
|
||||
@@ -42,11 +42,14 @@ public abstract class PanelWidget extends Widget {
|
||||
pagePrev = new Button("Prev") {
|
||||
|
||||
public boolean onButtonPress(boolean rightclick) {
|
||||
if (!rightclick) {
|
||||
|
||||
if (rightclick) {
|
||||
grid.setPage(0);
|
||||
} else {
|
||||
grid.shiftPage(-1);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -57,11 +60,14 @@ public abstract class PanelWidget extends Widget {
|
||||
pageNext = new Button("Next") {
|
||||
|
||||
public boolean onButtonPress(boolean rightclick) {
|
||||
if (!rightclick) {
|
||||
|
||||
if (rightclick) {
|
||||
grid.setPage(grid.getNumPages() - 1);
|
||||
} else {
|
||||
grid.shiftPage(1);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,295 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
|
||||
import codechicken.core.CommonUtils;
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.IRecipeFilter;
|
||||
import codechicken.nei.api.IRecipeFilter.IRecipeFilterProvider;
|
||||
import codechicken.nei.api.ItemFilter;
|
||||
import codechicken.nei.api.ItemFilter.ItemFilterProvider;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import codechicken.nei.recipe.StackInfo;
|
||||
import codechicken.nei.util.NBTJson;
|
||||
|
||||
public class PresetsList {
|
||||
|
||||
public static enum PresetMode {
|
||||
HIDE,
|
||||
REMOVE,
|
||||
GROUP;
|
||||
}
|
||||
|
||||
public static class Preset implements ItemFilter {
|
||||
|
||||
public String name = "";
|
||||
public boolean enabled = true;
|
||||
public PresetMode mode = PresetMode.HIDE;
|
||||
public Set<String> items = new HashSet<>();
|
||||
|
||||
public static String getIdentifier(ItemStack stack) {
|
||||
return StackInfo.getItemStackGUID(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(ItemStack item) {
|
||||
return items.contains(Preset.getIdentifier(item));
|
||||
}
|
||||
|
||||
public Preset copy() {
|
||||
Preset preset = new Preset();
|
||||
|
||||
preset.name = name;
|
||||
preset.enabled = enabled;
|
||||
preset.mode = mode;
|
||||
preset.items = new HashSet<>(items);
|
||||
|
||||
return preset;
|
||||
}
|
||||
}
|
||||
|
||||
protected static class RecipesFilter implements IRecipeFilterProvider, IRecipeFilter {
|
||||
|
||||
public Set<String> cache;
|
||||
|
||||
public IRecipeFilter getFilter() {
|
||||
|
||||
if (cache == null) {
|
||||
cache = PresetsList.presets.stream().filter(p -> p.enabled && p.mode == PresetMode.REMOVE)
|
||||
.flatMap(p -> p.items.stream()).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
return cache.isEmpty() ? null : this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(IRecipeHandler handler, List<PositionedStack> ingredients, PositionedStack result,
|
||||
List<PositionedStack> others) {
|
||||
|
||||
if (matchPositionedStack(ingredients, false)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (result != null && matchPositionedStack(result)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!others.isEmpty() && matchPositionedStack(others, true)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return result == null && others.isEmpty();
|
||||
}
|
||||
|
||||
private boolean matchPositionedStack(List<PositionedStack> items, boolean dir) {
|
||||
for (PositionedStack pStack : items) {
|
||||
if (matchPositionedStack(pStack) == dir) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean matchPositionedStack(PositionedStack pStack) {
|
||||
for (ItemStack stack : pStack.items) {
|
||||
if (!cache.contains(Preset.getIdentifier(stack))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected static class ItemPanelFilter implements ItemFilterProvider, ItemFilter {
|
||||
|
||||
public Set<String> cache;
|
||||
|
||||
public ItemFilter getFilter() {
|
||||
|
||||
if (cache == null) {
|
||||
cache = PresetsList.presets.stream()
|
||||
.filter(p -> p.enabled && (p.mode == PresetMode.HIDE || p.mode == PresetMode.REMOVE))
|
||||
.flatMap(p -> p.items.stream()).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
return cache.isEmpty() ? null : this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(ItemStack stack) {
|
||||
return !cache.contains(Preset.getIdentifier(stack));
|
||||
}
|
||||
}
|
||||
|
||||
public static final List<Preset> presets = new ArrayList<>();
|
||||
|
||||
protected static File presetsFile;
|
||||
protected static RecipesFilter recipeFilter = new RecipesFilter();
|
||||
protected static ItemPanelFilter itemFilter = new ItemPanelFilter();
|
||||
|
||||
static {
|
||||
API.addItemFilter(itemFilter);
|
||||
API.addRecipeFilter(recipeFilter);
|
||||
ItemList.loadCallbacks.add(PresetsList::itemsLoaded);
|
||||
}
|
||||
|
||||
public static ItemFilter getItemFilter() {
|
||||
return itemFilter.getFilter();
|
||||
}
|
||||
|
||||
public static void itemsLoaded() {
|
||||
recipeFilter.cache = null;
|
||||
itemFilter.cache = null;
|
||||
ItemList.collapsibleItems.reload();
|
||||
}
|
||||
|
||||
public static void setPresetsFile(String worldPath) {
|
||||
final File dir = new File(CommonUtils.getMinecraftDir(), "saves/NEI/" + worldPath);
|
||||
|
||||
if (!dir.exists()) {
|
||||
dir.mkdirs();
|
||||
}
|
||||
|
||||
presetsFile = new File(dir, "presets.ini");
|
||||
|
||||
if (!presetsFile.exists()) {
|
||||
final File globalPresets = new File(CommonUtils.getMinecraftDir(), "saves/NEI/global/presets.ini");
|
||||
final File configPresets = new File(NEIClientConfig.configDir, "presets.ini");
|
||||
final File defaultBookmarks = configPresets.exists() ? configPresets : globalPresets;
|
||||
|
||||
if (defaultBookmarks.exists()) {
|
||||
|
||||
try {
|
||||
presetsFile.createNewFile();
|
||||
|
||||
InputStream src = new FileInputStream(defaultBookmarks);
|
||||
OutputStream dst = new FileOutputStream(presetsFile);
|
||||
|
||||
IOUtils.copy(src, dst);
|
||||
|
||||
src.close();
|
||||
dst.close();
|
||||
|
||||
} catch (IOException e) {}
|
||||
}
|
||||
}
|
||||
|
||||
loadPresets();
|
||||
}
|
||||
|
||||
protected static void loadPresets() {
|
||||
|
||||
if (presetsFile == null || !presetsFile.exists()) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> itemStrings;
|
||||
try (FileInputStream reader = new FileInputStream(presetsFile)) {
|
||||
NEIClientConfig.logger.info("Loading presets from file {}", presetsFile);
|
||||
itemStrings = IOUtils.readLines(reader, StandardCharsets.UTF_8);
|
||||
} catch (IOException e) {
|
||||
NEIClientConfig.logger.error("Failed to load presets from file {}", presetsFile, e);
|
||||
return;
|
||||
}
|
||||
|
||||
JsonParser parser = new JsonParser();
|
||||
Preset preset = new Preset();
|
||||
presets.clear();
|
||||
|
||||
for (String itemStr : itemStrings) {
|
||||
|
||||
try {
|
||||
|
||||
if (itemStr.isEmpty()) {
|
||||
itemStr = "; {}";
|
||||
}
|
||||
|
||||
if (itemStr.startsWith("; ")) {
|
||||
JsonObject settings = parser.parse(itemStr.substring(2)).getAsJsonObject();
|
||||
|
||||
if (!preset.items.isEmpty()) {
|
||||
// do not create empty namespaces
|
||||
presets.add(preset);
|
||||
preset = new Preset();
|
||||
}
|
||||
|
||||
if (settings.get("name") != null) {
|
||||
preset.name = settings.get("name").getAsString();
|
||||
}
|
||||
|
||||
if (settings.get("enabled") != null) {
|
||||
preset.enabled = settings.get("enabled").getAsBoolean();
|
||||
}
|
||||
|
||||
if (settings.get("mode") != null) {
|
||||
preset.mode = PresetMode.valueOf(settings.get("mode").getAsString());
|
||||
}
|
||||
|
||||
} else {
|
||||
preset.items.add(itemStr);
|
||||
}
|
||||
|
||||
} catch (IllegalArgumentException | JsonSyntaxException | IllegalStateException e) {
|
||||
NEIClientConfig.logger.error("Failed to load presets ItemStack from json string:\n{}", itemStr);
|
||||
}
|
||||
}
|
||||
|
||||
if (!preset.items.isEmpty()) {
|
||||
presets.add(preset);
|
||||
}
|
||||
|
||||
itemsLoaded();
|
||||
}
|
||||
|
||||
public static void savePresets() {
|
||||
|
||||
if (presetsFile == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> strings = new ArrayList<>();
|
||||
|
||||
for (Preset preset : presets) {
|
||||
JsonObject settings = new JsonObject();
|
||||
|
||||
settings.add("name", new JsonPrimitive(preset.name));
|
||||
settings.add("enabled", new JsonPrimitive(preset.enabled));
|
||||
settings.add("mode", new JsonPrimitive(preset.mode.toString()));
|
||||
|
||||
strings.add("; " + NBTJson.toJson(settings));
|
||||
strings.addAll(preset.items);
|
||||
}
|
||||
|
||||
try (FileOutputStream output = new FileOutputStream(presetsFile)) {
|
||||
IOUtils.writeLines(strings, "\n", output, StandardCharsets.UTF_8);
|
||||
} catch (IOException e) {
|
||||
NEIClientConfig.logger.error("Filed to save presets list to file {}", presetsFile, e);
|
||||
}
|
||||
|
||||
itemsLoaded();
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -2,6 +2,7 @@ package codechicken.nei;
|
||||
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import codechicken.nei.SearchField.GuiSearchField;
|
||||
import codechicken.nei.api.ItemFilter;
|
||||
import codechicken.nei.util.TextHistory;
|
||||
|
||||
@@ -14,6 +15,13 @@ public abstract class RecipeSearchField extends TextField {
|
||||
this.field.setVisible(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initInternalTextField() {
|
||||
field = new GuiSearchField();
|
||||
field.setMaxStringLength(maxSearchLength);
|
||||
field.setCursorPositionZero();
|
||||
}
|
||||
|
||||
public boolean isVisible() {
|
||||
return this.field.getVisible();
|
||||
}
|
||||
@@ -51,7 +59,7 @@ public abstract class RecipeSearchField extends TextField {
|
||||
}
|
||||
|
||||
public ItemFilter getFilter() {
|
||||
return SearchField.getFilter(text());
|
||||
return ((GuiSearchField) field).getFilter();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,21 +1,24 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import static codechicken.nei.NEIClientConfig.world;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.ItemList.AnyMultiItemFilter;
|
||||
import codechicken.nei.ItemList.EverythingItemFilter;
|
||||
import codechicken.nei.ItemList.PatternItemFilter;
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.ItemList.NothingItemFilter;
|
||||
import codechicken.nei.SearchTokenParser.ISearchParserProvider;
|
||||
import codechicken.nei.SearchTokenParser.SearchMode;
|
||||
import codechicken.nei.api.ItemFilter;
|
||||
import codechicken.nei.api.ItemFilter.ItemFilterProvider;
|
||||
import codechicken.nei.recipe.StackInfo;
|
||||
import codechicken.nei.util.TextHistory;
|
||||
|
||||
public class SearchField extends TextField implements ItemFilterProvider {
|
||||
@@ -23,6 +26,7 @@ public class SearchField extends TextField implements ItemFilterProvider {
|
||||
/**
|
||||
* Interface for returning a custom filter based on search field text
|
||||
*/
|
||||
@Deprecated
|
||||
public static interface ISearchProvider {
|
||||
|
||||
/**
|
||||
@@ -36,34 +40,98 @@ public class SearchField extends TextField implements ItemFilterProvider {
|
||||
public ItemFilter getFilter(String searchText);
|
||||
}
|
||||
|
||||
private static class DefaultSearchProvider implements ISearchProvider {
|
||||
public static class SearchParserProvider implements ISearchParserProvider {
|
||||
|
||||
@Override
|
||||
public boolean isPrimary() {
|
||||
return false;
|
||||
protected final Function<Pattern, ItemFilter> createFilter;
|
||||
protected final String name;
|
||||
protected final char prefix;
|
||||
protected final EnumChatFormatting highlightedColor;
|
||||
|
||||
public SearchParserProvider(char prefix, String name, EnumChatFormatting highlightedColor,
|
||||
Function<Pattern, ItemFilter> createFilter) {
|
||||
this.prefix = prefix;
|
||||
this.name = name;
|
||||
this.highlightedColor = highlightedColor;
|
||||
this.createFilter = createFilter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemFilter getFilter(String searchText) {
|
||||
Pattern pattern = getPattern(searchText);
|
||||
return pattern == null ? null : new PatternItemFilter(pattern);
|
||||
Pattern pattern = SearchField.getPattern(searchText);
|
||||
|
||||
if (pattern != null) {
|
||||
return this.createFilter(pattern);
|
||||
}
|
||||
|
||||
return new NothingItemFilter();
|
||||
}
|
||||
|
||||
protected ItemFilter createFilter(Pattern pattern) {
|
||||
final ItemFilter filter = this.createFilter.apply(pattern);
|
||||
|
||||
return filter == null ? new NothingItemFilter() : filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public char getPrefix() {
|
||||
return this.prefix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumChatFormatting getHighlightedColor() {
|
||||
return this.highlightedColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SearchMode getSearchMode() {
|
||||
return SearchMode.fromInt(NEIClientConfig.getIntSetting("inventory.search." + this.name + "SearchMode"));
|
||||
}
|
||||
}
|
||||
|
||||
public static class GuiSearchField extends FormattedTextField {
|
||||
|
||||
protected final SearchTokenParser searchParser;
|
||||
|
||||
public GuiSearchField() {
|
||||
this(SearchField.searchParser);
|
||||
}
|
||||
|
||||
public GuiSearchField(SearchTokenParser searchParser) {
|
||||
super(Minecraft.getMinecraft().fontRenderer, 0, 0, 0, 0);
|
||||
this.searchParser = searchParser;
|
||||
setFormatter(new SearchTextFormatter(searchParser));
|
||||
}
|
||||
|
||||
public ItemFilter getFilter() {
|
||||
return getFilter(getText());
|
||||
}
|
||||
|
||||
public ItemFilter getFilter(String filterText) {
|
||||
return this.searchParser.getFilter(filterText);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static List<ISearchProvider> searchProviders = new LinkedList<>();
|
||||
public static final SearchTokenParser searchParser = new SearchTokenParser();
|
||||
private static final TextHistory history = new TextHistory();
|
||||
private boolean isVisible = true;
|
||||
|
||||
long lastclicktime;
|
||||
private long lastclicktime;
|
||||
|
||||
public SearchField(String ident) {
|
||||
super(ident);
|
||||
API.addItemFilter(this);
|
||||
API.addSearchProvider(new DefaultSearchProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initInternalTextField() {
|
||||
field = new GuiSearchField();
|
||||
field.setMaxStringLength(maxSearchLength);
|
||||
field.setCursorPositionZero();
|
||||
}
|
||||
|
||||
public static boolean searchInventories() {
|
||||
return world.nbt.getBoolean("searchinventories");
|
||||
return NEIClientConfig.world.nbt.getBoolean("searchinventories");
|
||||
}
|
||||
|
||||
public boolean isVisible() {
|
||||
@@ -85,14 +153,37 @@ public class SearchField extends TextField implements ItemFilterProvider {
|
||||
|
||||
@Override
|
||||
public void draw(int mousex, int mousey) {
|
||||
|
||||
super.draw(mousex, mousey);
|
||||
|
||||
if (searchInventories()) {
|
||||
GuiDraw.drawGradientRect(x - 1, y - 1, 1, h + 2, 0xFFFFFF00, 0xFFC0B000); // Left
|
||||
GuiDraw.drawGradientRect(x - 1, y - 1, w + 2, 1, 0xFFFFFF00, 0xFFC0B000); // Top
|
||||
GuiDraw.drawGradientRect(x + w, y - 1, 1, h + 2, 0xFFFFFF00, 0xFFC0B000); // Left
|
||||
GuiDraw.drawGradientRect(x - 1, y + h, w + 2, 1, 0xFFFFFF00, 0xFFC0B000); // Bottom
|
||||
GuiDraw.drawGradientRect(
|
||||
field.xPosition - 1,
|
||||
field.yPosition - 1,
|
||||
1,
|
||||
field.height + 2,
|
||||
0xFFFFFF00,
|
||||
0xFFC0B000); // Left
|
||||
GuiDraw.drawGradientRect(
|
||||
field.xPosition - 1,
|
||||
field.yPosition - 1,
|
||||
field.width + 2,
|
||||
1,
|
||||
0xFFFFFF00,
|
||||
0xFFC0B000); // Top
|
||||
GuiDraw.drawGradientRect(
|
||||
field.xPosition + field.width,
|
||||
field.yPosition - 1,
|
||||
1,
|
||||
field.height + 2,
|
||||
0xFFFFFF00,
|
||||
0xFFC0B000); // Left
|
||||
GuiDraw.drawGradientRect(
|
||||
field.xPosition - 1,
|
||||
field.yPosition + field.height,
|
||||
field.width + 2,
|
||||
1,
|
||||
0xFFFFFF00,
|
||||
0xFFC0B000); // Bottom
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,10 +201,11 @@ public class SearchField extends TextField implements ItemFilterProvider {
|
||||
@Override
|
||||
public void onTextChange(String oldText) {
|
||||
final String newText = text();
|
||||
if (newText.length() > 0) NEIClientConfig.logger.debug("Searching for " + text());
|
||||
|
||||
NEIClientConfig.setSearchExpression(newText);
|
||||
ItemList.updateFilter.restart();
|
||||
if (!newText.equals(oldText)) {
|
||||
if (newText.length() > 0) NEIClientConfig.logger.debug("Searching for " + newText);
|
||||
NEIClientConfig.setSearchExpression(newText);
|
||||
ItemList.updateFilter.restart();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -137,47 +229,93 @@ public class SearchField extends TextField implements ItemFilterProvider {
|
||||
}
|
||||
|
||||
public static Pattern getPattern(String search) {
|
||||
switch (NEIClientConfig.getIntSetting("inventory.searchmode")) {
|
||||
return getPattern(search, NEIClientConfig.getIntSetting("inventory.search.patternMode"));
|
||||
}
|
||||
|
||||
public static Pattern getPattern(String search, int patternMode) {
|
||||
switch (patternMode) {
|
||||
case 0: // plain
|
||||
search = "\\Q" + search + "\\E";
|
||||
search = Pattern.quote(search);
|
||||
break;
|
||||
case 1:
|
||||
search = search.replace(".", "").replace("?", ".").replace("*", ".+?");
|
||||
case 1: // extended
|
||||
|
||||
if (search.length() >= 3 && search.startsWith("r/") && search.endsWith("/")) {
|
||||
search = search.substring(2, search.length() - 1);
|
||||
} else {
|
||||
final Matcher matcher = Pattern.compile("(\\?|\\*)").matcher(search);
|
||||
String cleanedString = "";
|
||||
int lastEndIndex = 0;
|
||||
|
||||
while (matcher.find()) {
|
||||
cleanedString += Pattern.quote(search.substring(lastEndIndex, matcher.start()));
|
||||
|
||||
switch (matcher.group(0).charAt(0)) {
|
||||
case '?':
|
||||
cleanedString += ".";
|
||||
break;
|
||||
case '*':
|
||||
cleanedString += ".+?";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
lastEndIndex = matcher.end();
|
||||
}
|
||||
|
||||
search = cleanedString + Pattern.quote(search.substring(lastEndIndex, search.length()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Pattern pattern = null;
|
||||
try {
|
||||
pattern = Pattern.compile(search);
|
||||
} catch (PatternSyntaxException ignored) {}
|
||||
if (!search.isEmpty()) {
|
||||
try {
|
||||
return Pattern.compile(search, Pattern.MULTILINE | Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);
|
||||
} catch (PatternSyntaxException ignored) {}
|
||||
}
|
||||
|
||||
return pattern == null || pattern.toString().length() == 0 ? null : pattern;
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getEscapedSearchText(ItemStack stack) {
|
||||
final FluidStack fluidStack = StackInfo.isFluidContainer(stack) ? null : StackInfo.getFluid(stack);
|
||||
String displayName;
|
||||
|
||||
if (fluidStack != null) {
|
||||
displayName = fluidStack.getLocalizedName();
|
||||
} else {
|
||||
displayName = stack.getDisplayName();
|
||||
}
|
||||
|
||||
return getEscapedSearchText(displayName);
|
||||
}
|
||||
|
||||
public static String getEscapedSearchText(String text) {
|
||||
text = EnumChatFormatting.getTextWithoutFormattingCodes(text);
|
||||
|
||||
switch (NEIClientConfig.getIntSetting("inventory.search.patternMode")) {
|
||||
case 1:
|
||||
text = text.replaceAll("[\\?|\\*]", "\\\\$0");
|
||||
break;
|
||||
case 2:
|
||||
text = text.replaceAll("[{}()\\[\\].+*?^$\\\\|]", "\\\\$0");
|
||||
break;
|
||||
}
|
||||
|
||||
if (text.contains(" ") && NEIClientConfig.getBooleanSetting("inventory.search.quoteDropItemName")) {
|
||||
text = "\"" + text + "\"";
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemFilter getFilter() {
|
||||
return getFilter(text());
|
||||
return ((GuiSearchField) field).getFilter();
|
||||
}
|
||||
|
||||
public static ItemFilter getFilter(String s_filter) {
|
||||
List<ItemFilter> primary = new LinkedList<>();
|
||||
List<ItemFilter> secondary = new LinkedList<>();
|
||||
s_filter = s_filter.toLowerCase();
|
||||
|
||||
for (ISearchProvider p : searchProviders) {
|
||||
ItemFilter filter = p.getFilter(s_filter);
|
||||
if (filter != null) (p.isPrimary() ? primary : secondary).add(filter);
|
||||
}
|
||||
|
||||
if (!primary.isEmpty()) {
|
||||
return new AnyMultiItemFilter(primary);
|
||||
}
|
||||
|
||||
if (!secondary.isEmpty()) {
|
||||
return new AnyMultiItemFilter(secondary);
|
||||
}
|
||||
|
||||
return new EverythingItemFilter();
|
||||
public static ItemFilter getFilter(String filterText) {
|
||||
return SearchField.searchParser.getFilter(filterText);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import java.util.StringJoiner;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import codechicken.nei.FormattedTextField.TextFormatter;
|
||||
|
||||
public class SearchTextFormatter implements TextFormatter {
|
||||
|
||||
protected final SearchTokenParser searchParser;
|
||||
|
||||
public SearchTextFormatter(SearchTokenParser searchParser) {
|
||||
this.searchParser = searchParser;
|
||||
}
|
||||
|
||||
public String format(String text) {
|
||||
final String[] parts = text.split("\\|");
|
||||
final Pattern splitPattern = searchParser.getSplitPattern();
|
||||
StringJoiner formattedText = new StringJoiner(EnumChatFormatting.GRAY + "|");
|
||||
|
||||
for (String filterText : parts) {
|
||||
Matcher filterMatcher = splitPattern.matcher(filterText);
|
||||
StringBuilder formattedPart = new StringBuilder();
|
||||
int startIndex = 0;
|
||||
|
||||
while (filterMatcher.find()) {
|
||||
boolean ignore = "-".equals(filterMatcher.group(2));
|
||||
String firstChar = filterMatcher.group(3);
|
||||
String token = filterMatcher.group(4);
|
||||
boolean quotes = token.length() > 1 && token.startsWith("\"") && token.endsWith("\"");
|
||||
|
||||
if (quotes) {
|
||||
token = token.substring(1, token.length() - 1);
|
||||
}
|
||||
|
||||
formattedPart.append(filterText.substring(startIndex, filterMatcher.start()));
|
||||
EnumChatFormatting tokenColor = EnumChatFormatting.RESET;
|
||||
|
||||
if (!firstChar.isEmpty()) {
|
||||
tokenColor = searchParser.getProvider(firstChar.charAt(0)).getHighlightedColor();
|
||||
}
|
||||
|
||||
if (ignore) {
|
||||
formattedPart.append(EnumChatFormatting.BLUE + "-");
|
||||
}
|
||||
|
||||
if (!firstChar.isEmpty()) {
|
||||
formattedPart.append(tokenColor + firstChar);
|
||||
}
|
||||
|
||||
if (quotes) {
|
||||
formattedPart.append(EnumChatFormatting.GOLD + "\"");
|
||||
}
|
||||
|
||||
if (!token.isEmpty()) {
|
||||
formattedPart.append(tokenColor + token);
|
||||
}
|
||||
|
||||
if (quotes) {
|
||||
formattedPart.append(EnumChatFormatting.GOLD + "\"");
|
||||
}
|
||||
|
||||
startIndex = filterMatcher.end();
|
||||
}
|
||||
|
||||
formattedPart.append(filterText.substring(startIndex, filterText.length()));
|
||||
formattedText.add(formattedPart);
|
||||
}
|
||||
|
||||
if (text.endsWith("|")) {
|
||||
formattedText.add("");
|
||||
}
|
||||
|
||||
return formattedText.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.StringJoiner;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.Language;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import codechicken.nei.ItemList.AllMultiItemFilter;
|
||||
import codechicken.nei.ItemList.AnyMultiItemFilter;
|
||||
import codechicken.nei.ItemList.EverythingItemFilter;
|
||||
import codechicken.nei.ItemList.NegatedItemFilter;
|
||||
import codechicken.nei.ItemList.NothingItemFilter;
|
||||
import codechicken.nei.api.ItemFilter;
|
||||
|
||||
public class SearchTokenParser {
|
||||
|
||||
public enum SearchMode {
|
||||
|
||||
ALWAYS,
|
||||
PREFIX,
|
||||
NEVER;
|
||||
|
||||
public static SearchMode fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0:
|
||||
return ALWAYS;
|
||||
case 1:
|
||||
return PREFIX;
|
||||
case 2:
|
||||
return NEVER;
|
||||
default:
|
||||
return ALWAYS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static interface ISearchParserProvider {
|
||||
|
||||
public ItemFilter getFilter(String searchText);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static List<Language> getAllLanguages() {
|
||||
return new ArrayList<>(Minecraft.getMinecraft().getLanguageManager().getLanguages());
|
||||
}
|
||||
|
||||
default List<Language> getMatchingLanguages() {
|
||||
return getAllLanguages();
|
||||
}
|
||||
|
||||
public char getPrefix();
|
||||
|
||||
public EnumChatFormatting getHighlightedColor();
|
||||
|
||||
public SearchMode getSearchMode();
|
||||
}
|
||||
|
||||
private static class ProvidersCache {
|
||||
|
||||
public String languageCode = null;
|
||||
public List<ISearchParserProvider> providers = new ArrayList<>();
|
||||
|
||||
public void clear() {
|
||||
this.languageCode = null;
|
||||
this.providers.clear();
|
||||
}
|
||||
}
|
||||
|
||||
protected final List<ISearchParserProvider> searchProviders;
|
||||
protected final ProvidersCache providersCache = new ProvidersCache();
|
||||
|
||||
public SearchTokenParser(List<ISearchParserProvider> searchProviders) {
|
||||
this.searchProviders = searchProviders;
|
||||
}
|
||||
|
||||
public SearchTokenParser() {
|
||||
this(new ArrayList<>());
|
||||
}
|
||||
|
||||
public void addProvider(ISearchParserProvider provider) {
|
||||
this.searchProviders.add(provider);
|
||||
this.providersCache.clear();
|
||||
}
|
||||
|
||||
protected List<ISearchParserProvider> getProviders() {
|
||||
Language currentLanguage = Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage();
|
||||
|
||||
if (!currentLanguage.getLanguageCode().equals(providersCache.languageCode)) {
|
||||
Map<Character, ISearchParserProvider> providers = new HashMap<>();
|
||||
|
||||
for (int index = this.searchProviders.size() - 1; index >= 0; index--) {
|
||||
ISearchParserProvider provider = this.searchProviders.get(index);
|
||||
|
||||
if (!providers.containsKey(provider.getPrefix())
|
||||
&& provider.getMatchingLanguages().contains(currentLanguage)) {
|
||||
providers.put(provider.getPrefix(), provider);
|
||||
}
|
||||
}
|
||||
|
||||
providersCache.providers = new ArrayList<>(providers.values());
|
||||
providersCache.languageCode = currentLanguage.getLanguageCode();
|
||||
}
|
||||
|
||||
return providersCache.providers;
|
||||
}
|
||||
|
||||
public ISearchParserProvider getProvider(char ch) {
|
||||
return getProviders().stream()
|
||||
.filter(provider -> provider.getSearchMode() == SearchMode.PREFIX && provider.getPrefix() == ch)
|
||||
.findFirst().orElse(null);
|
||||
}
|
||||
|
||||
public ItemFilter getFilter(String filterText) {
|
||||
final String[] parts = EnumChatFormatting.getTextWithoutFormattingCodes(filterText).toLowerCase().split("\\|");
|
||||
final List<ItemFilter> searchTokens = Arrays.stream(parts).map(s -> parseSearchText(s)).filter(s -> s != null)
|
||||
.collect(Collectors.toCollection(ArrayList::new));
|
||||
|
||||
if (searchTokens.isEmpty()) {
|
||||
return new EverythingItemFilter();
|
||||
} else if (searchTokens.size() == 1) {
|
||||
return searchTokens.get(0);
|
||||
} else {
|
||||
return new AnyMultiItemFilter(searchTokens);
|
||||
}
|
||||
}
|
||||
|
||||
public Pattern getSplitPattern() {
|
||||
StringJoiner prefixes = new StringJoiner("");
|
||||
prefixes.add(String.valueOf('\0'));
|
||||
|
||||
for (ISearchParserProvider provider : getProviders()) {
|
||||
if (provider.getSearchMode() == SearchMode.PREFIX) {
|
||||
prefixes.add(String.valueOf(provider.getPrefix()));
|
||||
}
|
||||
}
|
||||
|
||||
return Pattern.compile("((-*)([" + Pattern.quote(prefixes.toString()) + "]*)(\\\".*?(?:\\\"|$)|\\S+))");
|
||||
}
|
||||
|
||||
private ItemFilter parseSearchText(String filterText) {
|
||||
|
||||
if (filterText.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final Matcher filterMatcher = getSplitPattern().matcher(filterText);
|
||||
final AllMultiItemFilter searchTokens = new AllMultiItemFilter();
|
||||
|
||||
while (filterMatcher.find()) {
|
||||
boolean ignore = "-".equals(filterMatcher.group(2));
|
||||
String firstChar = filterMatcher.group(3);
|
||||
String token = filterMatcher.group(4);
|
||||
boolean quotes = token.length() > 1 && token.startsWith("\"") && token.endsWith("\"");
|
||||
|
||||
if (quotes) {
|
||||
token = token.substring(1, token.length() - 1);
|
||||
}
|
||||
|
||||
if (!token.isEmpty()) {
|
||||
ItemFilter result = parseToken(firstChar, token);
|
||||
|
||||
if (ignore) {
|
||||
searchTokens.filters.add(new NegatedItemFilter(result));
|
||||
} else {
|
||||
searchTokens.filters.add(result);
|
||||
}
|
||||
} else if (!ignore) {
|
||||
searchTokens.filters.add(new NothingItemFilter());
|
||||
}
|
||||
}
|
||||
|
||||
return searchTokens;
|
||||
}
|
||||
|
||||
private ItemFilter parseToken(String firstChar, String token) {
|
||||
final ISearchParserProvider provider = firstChar.isEmpty() ? null : this.getProvider(firstChar.charAt(0));
|
||||
|
||||
if (provider == null || provider.getSearchMode() == SearchMode.NEVER) {
|
||||
final List<ItemFilter> filters = new ArrayList<>();
|
||||
|
||||
for (ISearchParserProvider _provider : getProviders()) {
|
||||
if (_provider.getSearchMode() == SearchMode.ALWAYS) {
|
||||
filters.add(_provider.getFilter(token));
|
||||
}
|
||||
}
|
||||
|
||||
return filters.isEmpty() ? new NothingItemFilter() : new AnyMultiItemFilter(filters);
|
||||
} else {
|
||||
return provider.getFilter(token);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,14 +28,15 @@ import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.ItemList.AnyMultiItemFilter;
|
||||
import codechicken.nei.ItemList.ItemsLoadedCallback;
|
||||
import codechicken.nei.ItemList.NothingItemFilter;
|
||||
import codechicken.nei.SearchField.ISearchProvider;
|
||||
import codechicken.nei.SearchTokenParser.ISearchParserProvider;
|
||||
import codechicken.nei.SearchTokenParser.SearchMode;
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.ItemFilter;
|
||||
import codechicken.nei.api.ItemFilter.ItemFilterProvider;
|
||||
import codechicken.nei.api.ItemInfo;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
|
||||
public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoadedCallback, ISearchProvider {
|
||||
public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoadedCallback {
|
||||
|
||||
public static ReentrantReadWriteLock hiddenItemLock = new ReentrantReadWriteLock();
|
||||
public static Lock writeLock = hiddenItemLock.writeLock();
|
||||
@@ -70,14 +71,20 @@ public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoa
|
||||
protected void slotClicked(int slot, int button, int mx, int my, int count) {
|
||||
if (slot < sorted.size()) {
|
||||
SubsetTag tag = sorted.get(slot);
|
||||
if (NEIClientUtils.shiftKey())
|
||||
codechicken.nei.LayoutManager.searchField.setText("@" + tag.fullname);
|
||||
else if (button == 0 && count >= 2) SubsetWidget.showOnly(tag);
|
||||
else SubsetWidget.setHidden(tag, button == 1);
|
||||
if (NEIClientUtils.shiftKey()) {
|
||||
codechicken.nei.LayoutManager.searchField.setText("%" + tag.fullname);
|
||||
} else if (button == 0 && count >= 2) {
|
||||
SubsetWidget.showOnly(tag);
|
||||
} else {
|
||||
SubsetWidget.setHidden(tag, button == 1);
|
||||
}
|
||||
} else {
|
||||
ItemStack item = state.items.get(slot - sorted.size());
|
||||
if (NEIClientUtils.controlKey()) NEIClientUtils.cheatItem(item, button, -1);
|
||||
else SubsetWidget.setHidden(state.items.get(slot - sorted.size()), button == 1);
|
||||
if (NEIClientUtils.controlKey()) {
|
||||
NEIClientUtils.cheatItem(item, button, -1);
|
||||
} else {
|
||||
SubsetWidget.setHidden(state.items.get(slot - sorted.size()), button == 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,7 +177,7 @@ public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoa
|
||||
private SubsetTag getTag(String name) {
|
||||
int idx = name.indexOf('.');
|
||||
String childname = idx > 0 ? name.substring(0, idx) : name;
|
||||
SubsetTag child = children.get(childname.toLowerCase());
|
||||
SubsetTag child = children.get(childname.replaceAll(" ", "").toLowerCase());
|
||||
if (child == null) return null;
|
||||
|
||||
return idx > 0 ? child.getTag(name.substring(idx + 1)) : child;
|
||||
@@ -187,7 +194,7 @@ public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoa
|
||||
int idx = name.indexOf('.');
|
||||
|
||||
if (idx < 0) { // add or replace tag
|
||||
SubsetTag prev = children.put(name.toLowerCase(), tag);
|
||||
SubsetTag prev = children.put(name.replaceAll(" ", "").toLowerCase(), tag);
|
||||
if (prev != null) { // replaced, load children
|
||||
tag.children = prev.children;
|
||||
tag.sorted = prev.sorted;
|
||||
@@ -195,10 +202,12 @@ public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoa
|
||||
recacheChildren();
|
||||
} else {
|
||||
String childname = name.substring(0, idx);
|
||||
SubsetTag child = children.get(childname.toLowerCase());
|
||||
if (child == null) children.put(
|
||||
childname.toLowerCase(),
|
||||
child = new SubsetTag(fullname == null ? childname : fullname + '.' + childname));
|
||||
SubsetTag child = children.get(childname.replaceAll(" ", "").toLowerCase());
|
||||
if (child == null) {
|
||||
children.put(
|
||||
childname.replaceAll(" ", "").toLowerCase(),
|
||||
child = new SubsetTag(fullname == null ? childname : fullname + '.' + childname));
|
||||
}
|
||||
recacheChildren();
|
||||
child.addTag(tag);
|
||||
}
|
||||
@@ -209,16 +218,6 @@ 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);
|
||||
|
||||
@@ -356,6 +355,45 @@ public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoa
|
||||
}
|
||||
}
|
||||
|
||||
private static class DefaultParserProvider implements ISearchParserProvider {
|
||||
|
||||
public ItemFilter getFilter(String searchText) {
|
||||
final AnyMultiItemFilter filter = new AnyMultiItemFilter();
|
||||
final SubsetTag tag = getTag(searchText);
|
||||
|
||||
if (tag != null) {
|
||||
// We've got an exact match
|
||||
tag.addFilters(filter.filters);
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
|
||||
return filter;
|
||||
}
|
||||
|
||||
public char getPrefix() {
|
||||
return '%';
|
||||
}
|
||||
|
||||
public EnumChatFormatting getHighlightedColor() {
|
||||
return EnumChatFormatting.DARK_PURPLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SearchMode getSearchMode() {
|
||||
return SearchMode.fromInt(NEIClientConfig.getIntSetting("inventory.search.subsetsSearchMode"));
|
||||
}
|
||||
}
|
||||
|
||||
protected static final SubsetTag root = new SubsetTag(null);
|
||||
public static Rectangle4i area = new Rectangle4i();
|
||||
public static ItemStack hoverStack;
|
||||
@@ -659,7 +697,7 @@ public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoa
|
||||
public SubsetWidget() {
|
||||
super("NEI Subsets");
|
||||
API.addItemFilter(this);
|
||||
API.addSearchProvider(this);
|
||||
API.addSearchProvider(new DefaultParserProvider());
|
||||
ItemList.loadCallbacks.add(this);
|
||||
}
|
||||
|
||||
@@ -774,44 +812,6 @@ public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoa
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPrimary() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemFilter getFilter(String searchText) {
|
||||
if (!searchText.startsWith("@")) 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) {
|
||||
// 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.addFiltersWithItem(filter.filters, itemSearch);
|
||||
}
|
||||
}
|
||||
|
||||
return filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void itemsLoaded() {
|
||||
updateState.reallocate();
|
||||
|
||||
@@ -9,7 +9,7 @@ public abstract class TextField extends Widget {
|
||||
|
||||
protected GuiTextField field;
|
||||
|
||||
private static final int maxSearchLength = 256;
|
||||
protected static final int maxSearchLength = 256;
|
||||
|
||||
public boolean centered;
|
||||
public String identifier;
|
||||
|
||||
@@ -15,10 +15,6 @@ public class VisiblityData {
|
||||
* Subset dropdown
|
||||
*/
|
||||
public boolean showSubsetDropdown = true;
|
||||
/**
|
||||
* Presets dropdown
|
||||
*/
|
||||
public boolean showPresetsDropdown = true;
|
||||
/**
|
||||
* Item and search section
|
||||
*/
|
||||
@@ -44,7 +40,6 @@ public class VisiblityData {
|
||||
public void translateDependancies() {
|
||||
if (!showNEI) showWidgets = false;
|
||||
if (!showWidgets) showItemSection = showUtilityButtons = false;
|
||||
if (!showItemSection)
|
||||
showBookmarkPanel = showSubsetDropdown = showPresetsDropdown = showSearchSection = showItemPanel = false;
|
||||
if (!showItemSection) showBookmarkPanel = showSubsetDropdown = showSearchSection = showItemPanel = false;
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,7 @@ import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.OffsetPositioner;
|
||||
import codechicken.nei.SearchField;
|
||||
import codechicken.nei.SearchField.ISearchProvider;
|
||||
import codechicken.nei.SearchTokenParser.ISearchParserProvider;
|
||||
import codechicken.nei.SubsetWidget;
|
||||
import codechicken.nei.SubsetWidget.SubsetTag;
|
||||
import codechicken.nei.api.IRecipeFilter.IRecipeFilterProvider;
|
||||
@@ -314,11 +315,14 @@ public class API {
|
||||
SubsetWidget.addTag(tag);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void addSearchProvider(ISearchProvider provider) {}
|
||||
|
||||
/**
|
||||
* Adds a new search provider to the search field
|
||||
*/
|
||||
public static void addSearchProvider(ISearchProvider provider) {
|
||||
SearchField.searchProviders.add(provider);
|
||||
public static void addSearchProvider(ISearchParserProvider provider) {
|
||||
SearchField.searchParser.addProvider(provider);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package codechicken.nei.api;
|
||||
|
||||
/**
|
||||
* Implement this interface on a GuiContainer to enable the autofocus search in NEI (if the autofocus option is enabled)
|
||||
* without needing to add the classname to the config file .
|
||||
*/
|
||||
public interface INEIAutoFocusSearchEnable {
|
||||
}
|
||||
@@ -6,7 +6,6 @@ import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
@@ -45,11 +44,14 @@ import codechicken.core.featurehack.GameDataManipulator;
|
||||
import codechicken.nei.InfiniteStackSizeHandler;
|
||||
import codechicken.nei.InfiniteToolHandler;
|
||||
import codechicken.nei.ItemList;
|
||||
import codechicken.nei.ItemList.PatternItemFilter;
|
||||
import codechicken.nei.ItemMobSpawner;
|
||||
import codechicken.nei.ItemStackMap;
|
||||
import codechicken.nei.ItemStackSet;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.PopupInputHandler;
|
||||
import codechicken.nei.SearchField.SearchParserProvider;
|
||||
import codechicken.nei.SearchTokenParser.SearchMode;
|
||||
import codechicken.nei.config.ArrayDumper;
|
||||
import codechicken.nei.config.HandlerDumper;
|
||||
import codechicken.nei.config.ItemPanelDumper;
|
||||
@@ -57,6 +59,10 @@ import codechicken.nei.config.RegistryDumper;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.recipe.BrewingRecipeHandler;
|
||||
import codechicken.nei.recipe.RecipeItemInputHandler;
|
||||
import codechicken.nei.search.IdentifierFilter;
|
||||
import codechicken.nei.search.ModNameFilter;
|
||||
import codechicken.nei.search.OreDictionaryFilter;
|
||||
import codechicken.nei.search.TooltipFilter;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
@@ -86,36 +92,6 @@ public class ItemInfo {
|
||||
|
||||
public static final HashMap<Item, String> itemOwners = new HashMap<>();
|
||||
|
||||
private static class ItemStackKey {
|
||||
|
||||
public final ItemStack stack;
|
||||
|
||||
public ItemStackKey(ItemStack stack) {
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
if (this.stack == null) return 1;
|
||||
int hashCode = 1;
|
||||
hashCode = 31 * hashCode + stack.stackSize;
|
||||
hashCode = 31 * hashCode + Item.getIdFromItem(stack.getItem());
|
||||
hashCode = 31 * hashCode + stack.getItemDamage();
|
||||
hashCode = 31 * hashCode + (!stack.hasTagCompound() ? 0 : stack.getTagCompound().hashCode());
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o == this) return true;
|
||||
if (!(o instanceof ItemStackKey)) return false;
|
||||
return ItemStack.areItemStacksEqual(this.stack, ((ItemStackKey) o).stack);
|
||||
}
|
||||
}
|
||||
|
||||
// lookup optimisation
|
||||
public static final ConcurrentHashMap<ItemStackKey, String> itemSearchNames = new ConcurrentHashMap<>();
|
||||
|
||||
public static boolean isHidden(ItemStack stack) {
|
||||
return hiddenItems.contains(stack);
|
||||
}
|
||||
@@ -155,28 +131,54 @@ public class ItemInfo {
|
||||
addInputHandlers();
|
||||
addIDDumps();
|
||||
addHiddenItemFilter();
|
||||
addSearchOptimisation();
|
||||
}
|
||||
|
||||
private static void addSearchOptimisation() {
|
||||
ItemList.loadCallbacks.add(ItemInfo::populateSearchMap);
|
||||
}
|
||||
|
||||
private static void populateSearchMap() {
|
||||
/* Create a snapshot of the current keys in the cache */
|
||||
HashSet<ItemStackKey> oldItems = new HashSet<>(itemSearchNames.keySet());
|
||||
for (ItemStack stack : ItemList.items) {
|
||||
/* Populate each entry and remove it from the snapshot */
|
||||
getSearchName(stack);
|
||||
oldItems.remove(new ItemStackKey(stack));
|
||||
}
|
||||
itemSearchNames.keySet().removeAll(oldItems);
|
||||
addSearchProviders();
|
||||
ItemList.loadCallbacks.add(TooltipFilter::populateSearchMap);
|
||||
}
|
||||
|
||||
private static void addHiddenItemFilter() {
|
||||
API.addItemFilter(() -> item -> !hiddenItems.contains(item));
|
||||
}
|
||||
|
||||
private static void addSearchProviders() {
|
||||
API.addSearchProvider(
|
||||
new SearchParserProvider(
|
||||
'\0',
|
||||
"default",
|
||||
EnumChatFormatting.RESET,
|
||||
(pattern) -> new PatternItemFilter(pattern)) {
|
||||
|
||||
@Override
|
||||
public SearchMode getSearchMode() {
|
||||
return SearchMode.ALWAYS;
|
||||
}
|
||||
|
||||
});
|
||||
API.addSearchProvider(
|
||||
new SearchParserProvider(
|
||||
'@',
|
||||
"modName",
|
||||
EnumChatFormatting.LIGHT_PURPLE,
|
||||
(pattern) -> new ModNameFilter(pattern)));
|
||||
API.addSearchProvider(
|
||||
new SearchParserProvider(
|
||||
'$',
|
||||
"oreDict",
|
||||
EnumChatFormatting.AQUA,
|
||||
(pattern) -> new OreDictionaryFilter(pattern)));
|
||||
API.addSearchProvider(
|
||||
new SearchParserProvider(
|
||||
'#',
|
||||
"tooltip",
|
||||
EnumChatFormatting.YELLOW,
|
||||
(pattern) -> new TooltipFilter(pattern)));
|
||||
API.addSearchProvider(
|
||||
new SearchParserProvider(
|
||||
'&',
|
||||
"identifier",
|
||||
EnumChatFormatting.GOLD,
|
||||
(pattern) -> new IdentifierFilter(pattern)));
|
||||
}
|
||||
|
||||
private static void addIDDumps() {
|
||||
API.addOption(new RegistryDumper<Item>("tools.dump.item") {
|
||||
|
||||
@@ -516,10 +518,8 @@ public class ItemInfo {
|
||||
return retString;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static String getSearchName(ItemStack stack) {
|
||||
return itemSearchNames.computeIfAbsent(
|
||||
new ItemStackKey(stack),
|
||||
key -> EnumChatFormatting.getTextWithoutFormattingCodes(
|
||||
GuiContainerManager.concatenatedDisplayName(key.stack, true).toLowerCase()));
|
||||
return GuiContainerManager.concatenatedDisplayName(stack, true);
|
||||
}
|
||||
}
|
||||
@@ -113,8 +113,13 @@ public class GuiItemSorter extends GuiOptionPane {
|
||||
if (nslot != list.indexOf(dragged.e)) {
|
||||
list.remove(dragged.e);
|
||||
list.add(nslot, dragged.e);
|
||||
|
||||
opt.getTag().setValue(ItemSorter.getSaveString(list));
|
||||
if (opt.activeTag() == opt.getTag()) ItemSorter.list = new ArrayList<>(list);
|
||||
LayoutManager.markItemsDirty();
|
||||
|
||||
if (opt.activeTag() == opt.getTag()) {
|
||||
ItemSorter.list = new ArrayList<>(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public class OptionTextField extends Option {
|
||||
public List<String> handleTooltip(int mousex, int mousey, List<String> currenttip) {
|
||||
if (new Rectangle4i(10, 0, textField.x - 10, 20).contains(mousex, mousey)) {
|
||||
String tip = translateN(name + ".tip");
|
||||
if (!tip.equals(name + ".tip")) currenttip.add(tip);
|
||||
if (!tip.equals(namespaced(name + ".tip"))) currenttip.add(tip);
|
||||
}
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package codechicken.nei.config.preset;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.drawStringC;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.nei.Button;
|
||||
import codechicken.nei.LayoutManager;
|
||||
|
||||
public abstract class CheckboxButton extends Button {
|
||||
|
||||
protected boolean checked = false;
|
||||
|
||||
public CheckboxButton(String s) {
|
||||
super(s);
|
||||
}
|
||||
|
||||
public void setChecked(boolean checked) {
|
||||
this.checked = checked;
|
||||
this.onChange();
|
||||
}
|
||||
|
||||
public boolean isChecked() {
|
||||
return this.checked;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int mousex, int mousey) {
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
int tex;
|
||||
|
||||
if ((this.state & 0x3) == 2) {
|
||||
tex = 0;
|
||||
} else if ((this.state & 0x4) == 0 && contains(mousex, mousey) || (this.state & 0x3) == 1) {
|
||||
tex = 2;
|
||||
} else {
|
||||
tex = 1;
|
||||
}
|
||||
|
||||
int colour = tex == 2 ? 0xffffa0 : tex == 0 ? 0x601010 : 0xe0e0e0;
|
||||
LayoutManager.drawButtonBackground(x, y, w, h, true, isChecked() ? 0 : tex);
|
||||
drawStringC(getRenderLabel(), x + w / 2, y + (h - 8) / 2, colour);
|
||||
}
|
||||
|
||||
public boolean onButtonPress(boolean rightclick) {
|
||||
this.setChecked(!isChecked());
|
||||
return true;
|
||||
}
|
||||
|
||||
protected abstract void onChange();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,239 @@
|
||||
package codechicken.nei.config.preset;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.getStringWidth;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.core.gui.GuiCCButton;
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.LayoutManager;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.PresetsList;
|
||||
import codechicken.nei.PresetsList.Preset;
|
||||
import codechicken.nei.config.GuiOptionPane;
|
||||
import codechicken.nei.config.Option;
|
||||
|
||||
public class GuiPresetList extends GuiOptionPane {
|
||||
|
||||
private final Option opt;
|
||||
protected final static int SLOT_HEIGHT = 24;
|
||||
protected final static int BUTTON_HEIGHT = 20;
|
||||
protected GuiCCButton createButton;
|
||||
protected int sortingItemIndex = -1;
|
||||
|
||||
public GuiPresetList(Option opt) {
|
||||
this.opt = opt;
|
||||
this.createButton = new GuiCCButton(0, 2, 0, 16, NEIClientUtils.translate("presets.new"))
|
||||
.setActionCommand("create");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
this.createButton.width = getStringWidth(this.createButton.text) + 15;
|
||||
this.createButton.x = width - this.createButton.width - 15;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addWidgets() {
|
||||
super.addWidgets();
|
||||
add(this.createButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(String ident, Object... params) {
|
||||
super.actionPerformed(ident, params);
|
||||
|
||||
if (ident.equals("create")) {
|
||||
cretePreset();
|
||||
}
|
||||
}
|
||||
|
||||
protected void mouseClicked(int x, int y, int button) {
|
||||
super.mouseClicked(x, y, button);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseMovedOrUp(int x, int y, int button) {
|
||||
super.mouseMovedOrUp(x, y, button);
|
||||
|
||||
if (sortingItemIndex >= 0) {
|
||||
PresetsList.savePresets();
|
||||
} else if (button == 0) {
|
||||
int slot = getSlotMouseOver(x, y);
|
||||
|
||||
if (slot != -1) {
|
||||
Rectangle w = pane.windowBounds();
|
||||
int mx = x - w.x;
|
||||
|
||||
if (mx <= BUTTON_HEIGHT) {
|
||||
Preset preset = PresetsList.presets.get(slot);
|
||||
preset.enabled = !preset.enabled;
|
||||
PresetsList.savePresets();
|
||||
} else if (mx >= 26 && mx <= w.width - 26 * 2) {
|
||||
openPreset(slot);
|
||||
} else if (mx >= w.width - BUTTON_HEIGHT) {
|
||||
PresetsList.presets.remove(slot);
|
||||
PresetsList.savePresets();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sortingItemIndex = -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClickMove(int x, int y, int button, long time) {
|
||||
super.mouseClickMove(x, y, button, time);
|
||||
|
||||
if (sortingItemIndex == -1) {
|
||||
Rectangle w = pane.windowBounds();
|
||||
int mx = x - w.x;
|
||||
|
||||
if (mx >= 26 && mx <= w.width - 26 * 2) {
|
||||
sortingItemIndex = getSlotMouseOver(x, y);
|
||||
} else {
|
||||
sortingItemIndex = -2;
|
||||
}
|
||||
} else if (sortingItemIndex >= 0) {
|
||||
Rectangle w = pane.windowBounds();
|
||||
|
||||
if (y >= w.y && y <= w.y + w.height) {
|
||||
int my = y + pane.scrolledPixels() - w.y;
|
||||
int slot = my / SLOT_HEIGHT;
|
||||
|
||||
if (my % SLOT_HEIGHT < BUTTON_HEIGHT && slot < PresetsList.presets.size()
|
||||
&& slot != -1
|
||||
&& slot != sortingItemIndex) {
|
||||
PresetsList.presets.add(slot, PresetsList.presets.remove(sortingItemIndex));
|
||||
sortingItemIndex = slot;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected int getSlotMouseOver(int x, int y) {
|
||||
Rectangle w = pane.windowBounds();
|
||||
|
||||
if (x >= w.x && x <= w.x + w.width && y >= w.y && y <= w.y + w.height) {
|
||||
int my = y + pane.scrolledPixels() - w.y;
|
||||
int slot = my / SLOT_HEIGHT;
|
||||
|
||||
if (my % SLOT_HEIGHT < BUTTON_HEIGHT && slot < PresetsList.presets.size()) {
|
||||
return slot;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected void cretePreset() {
|
||||
Minecraft.getMinecraft().displayGuiScreen(new GuiPresetSettings(this, -1));
|
||||
}
|
||||
|
||||
protected void openPreset(int slot) {
|
||||
Minecraft.getMinecraft().displayGuiScreen(new GuiPresetSettings(this, slot));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int contentHeight() {
|
||||
return PresetsList.presets.size() * SLOT_HEIGHT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawContent(int mx, int my, float frame) {
|
||||
int scrolled = pane.scrolledPixels();
|
||||
Rectangle w = pane.windowBounds();
|
||||
int y = 0;
|
||||
|
||||
for (int slot = 0; slot < PresetsList.presets.size(); ++slot) {
|
||||
|
||||
if (y + SLOT_HEIGHT > scrolled && y < scrolled + w.height) {
|
||||
|
||||
if (sortingItemIndex != slot) {
|
||||
drawSlot(w, slot, w.x, w.y + y - scrolled, mx, my - y);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
y += SLOT_HEIGHT;
|
||||
}
|
||||
|
||||
if (sortingItemIndex >= 0) {
|
||||
drawSlot(w, sortingItemIndex, w.x, w.y + my - scrolled - BUTTON_HEIGHT / 2, mx, my - y);
|
||||
}
|
||||
}
|
||||
|
||||
protected void drawSlot(Rectangle w, int slot, int x, int y, int mx, int my) {
|
||||
final Rectangle4i delete = new Rectangle4i(x + w.width - BUTTON_HEIGHT, y, BUTTON_HEIGHT, BUTTON_HEIGHT);
|
||||
final Rectangle4i enabled = new Rectangle4i(x, y, BUTTON_HEIGHT, BUTTON_HEIGHT);
|
||||
final Rectangle4i option = new Rectangle4i(x + 26, y, w.width - 26 * 2, BUTTON_HEIGHT);
|
||||
|
||||
final int enabledState = y + my >= w.y && y + my <= w.y + w.height && enabled.contains(x + mx, y + my) ? 2 : 1;
|
||||
final int optionState = y + my >= w.y && y + my <= w.y + w.height && option.contains(x + mx, y + my) ? 2 : 1;
|
||||
final int deleteState = y + my >= w.y && y + my <= w.y + w.height && delete.contains(x + mx, y + my) ? 2 : 1;
|
||||
final Preset preset = PresetsList.presets.get(slot);
|
||||
|
||||
final String displayName = preset.name;
|
||||
final String modeName;
|
||||
|
||||
switch (preset.mode) {
|
||||
case HIDE:
|
||||
modeName = NEIClientUtils.translate("presets.mode.hide.char");
|
||||
break;
|
||||
case REMOVE:
|
||||
modeName = NEIClientUtils.translate("presets.mode.remove.char");
|
||||
break;
|
||||
case GROUP:
|
||||
modeName = NEIClientUtils.translate("presets.mode.group.char");
|
||||
break;
|
||||
default:
|
||||
modeName = "?";
|
||||
break;
|
||||
}
|
||||
|
||||
// enabled icon
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
LayoutManager.drawButtonBackground(
|
||||
enabled.x,
|
||||
enabled.y,
|
||||
enabled.w,
|
||||
enabled.h,
|
||||
true,
|
||||
preset.enabled ? 0 : enabledState);
|
||||
GuiDraw.drawString("✔", enabled.x + 7, enabled.y + 6, enabledState == 2 ? 0xFFFFFFA0 : 0xFFE0E0E0);
|
||||
|
||||
// preset name
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
LayoutManager.drawButtonBackground(option.x, option.y, option.w, option.h, true, optionState);
|
||||
GuiDraw.drawString("⋮⋮", option.x + 4, option.y + 5, optionState == 2 ? 0xFFFFFFA0 : 0xFFE0E0E0);
|
||||
GuiDraw.drawString(
|
||||
NEIClientUtils.cropText(this.fontRendererObj, modeName + ": " + displayName, option.w - 16),
|
||||
option.x + 6 + 4,
|
||||
option.y + 6,
|
||||
optionState == 2 ? 0xFFFFFFA0 : 0xFFE0E0E0);
|
||||
|
||||
// remove icon
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
LayoutManager.drawButtonBackground(delete.x, delete.y, delete.w, delete.h, true, deleteState);
|
||||
GuiDraw.drawString("✕", delete.x + 7, delete.y + 6, deleteState == 2 ? 0xFFFFFFA0 : 0xFFE0E0E0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiScreen getParentScreen() {
|
||||
return opt.slot.getGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return opt.translateN(opt.name);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,228 @@
|
||||
package codechicken.nei.config.preset;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.util.Rectangle;
|
||||
|
||||
import codechicken.core.gui.GuiScreenWidget;
|
||||
import codechicken.nei.Button;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.PresetsList;
|
||||
import codechicken.nei.PresetsList.Preset;
|
||||
import codechicken.nei.config.OptionScrollPane;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
|
||||
public class GuiPresetSettings extends GuiScreenWidget {
|
||||
|
||||
protected final Preset preset;
|
||||
protected final GuiScreen parent;
|
||||
protected final int slotIndex;
|
||||
|
||||
public int marginleft;
|
||||
public int margintop;
|
||||
public int marginright;
|
||||
public int marginbottom;
|
||||
|
||||
protected LeftPanel leftPanel;
|
||||
protected RightPanel rightPanel;
|
||||
|
||||
protected Button backButton;
|
||||
protected Button saveButton;
|
||||
|
||||
public GuiPresetSettings(GuiScreen parent, int slotIndex) {
|
||||
this.parent = parent;
|
||||
this.setMargins(6, 20, 6, 30);
|
||||
|
||||
this.slotIndex = slotIndex;
|
||||
|
||||
if (slotIndex == -1) {
|
||||
preset = new Preset();
|
||||
} else {
|
||||
preset = PresetsList.presets.get(slotIndex).copy();
|
||||
}
|
||||
|
||||
leftPanel = new LeftPanel(preset) {
|
||||
|
||||
@Override
|
||||
protected void onItemsChanges() {
|
||||
leftPanel.grid.restartFilter();
|
||||
}
|
||||
};
|
||||
rightPanel = new RightPanel(preset, slotIndex) {
|
||||
|
||||
@Override
|
||||
protected void onItemsChanges() {
|
||||
leftPanel.grid.restartFilter();
|
||||
}
|
||||
};
|
||||
|
||||
backButton = new Button(NEIClientUtils.translate("options.back")) {
|
||||
|
||||
public boolean onButtonPress(boolean rightclick) {
|
||||
Minecraft.getMinecraft().displayGuiScreen(parent);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
saveButton = new Button(NEIClientUtils.translate("options.save")) {
|
||||
|
||||
public boolean onButtonPress(boolean rightclick) {
|
||||
if (state == 0) {
|
||||
|
||||
if (slotIndex == -1) {
|
||||
PresetsList.presets.add(preset);
|
||||
} else {
|
||||
PresetsList.presets.set(slotIndex, preset);
|
||||
}
|
||||
|
||||
PresetsList.savePresets();
|
||||
Minecraft.getMinecraft().displayGuiScreen(parent);
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
add(this.leftPanel);
|
||||
add(this.rightPanel);
|
||||
}
|
||||
|
||||
protected void setMargins(int left, int top, int right, int bottom) {
|
||||
this.marginleft = left;
|
||||
this.margintop = top;
|
||||
this.marginright = right;
|
||||
this.marginbottom = bottom;
|
||||
}
|
||||
|
||||
protected Rectangle windowBounds() {
|
||||
return new Rectangle(
|
||||
this.marginleft,
|
||||
this.margintop,
|
||||
this.width - this.marginleft - this.marginright,
|
||||
this.height - this.margintop - this.marginbottom);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesGuiPauseGame() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScreen() {
|
||||
final Rectangle bounds = windowBounds();
|
||||
final int panelWidth = bounds.getWidth() * 2 / 5;
|
||||
|
||||
this.leftPanel.setSize(bounds.getX(), bounds.getY() + 4, panelWidth, bounds.getHeight() - 6);
|
||||
this.rightPanel.setSize(
|
||||
bounds.getX() + bounds.getWidth() - panelWidth,
|
||||
bounds.getY() + 4,
|
||||
panelWidth,
|
||||
bounds.getHeight() - 6);
|
||||
|
||||
final int w = Math.min(200, width - 40);
|
||||
|
||||
backButton.w = w / 2 - 3;
|
||||
backButton.h = 20;
|
||||
backButton.x = (width - w) / 2;
|
||||
backButton.y = height - 25;
|
||||
|
||||
saveButton.state = preset.name.isEmpty() || preset.mode == null || preset.items.isEmpty() ? 2 : 0;
|
||||
|
||||
saveButton.w = w / 2 - 3;
|
||||
saveButton.h = 20;
|
||||
saveButton.x = width / 2 + 3;
|
||||
saveButton.y = height - 25;
|
||||
|
||||
super.updateScreen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resize() {
|
||||
this.guiLeft = this.guiTop = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mousex, int mousey, float f) {
|
||||
Rectangle bounds = windowBounds();
|
||||
drawDefaultBackground();
|
||||
|
||||
drawOverlay(bounds.getY(), bounds.getHeight(), width, zLevel);
|
||||
drawCenteredString(
|
||||
Minecraft.getMinecraft().fontRenderer,
|
||||
NEIClientUtils.translate(this.slotIndex == -1 ? "presets.create" : "presets.update"),
|
||||
width / 2,
|
||||
6,
|
||||
-1);
|
||||
|
||||
backButton.draw(mousex, mousey);
|
||||
saveButton.draw(mousex, mousey);
|
||||
|
||||
super.drawScreen(mousex, mousey, f);
|
||||
|
||||
List<String> tooltip = new LinkedList<>();
|
||||
tooltip = leftPanel.handleTooltip(mousex, mousey, tooltip);
|
||||
tooltip = rightPanel.handleTooltip(mousex, mousey, tooltip);
|
||||
|
||||
GuiContainerManager.drawPagedTooltip(Minecraft.getMinecraft().fontRenderer, mousex + 12, mousey - 12, tooltip);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int x, int y, int button) {
|
||||
super.mouseClicked(x, y, button);
|
||||
|
||||
if (backButton.contains(x, y)) {
|
||||
backButton.handleClick(x, y, button);
|
||||
}
|
||||
|
||||
if (saveButton.contains(x, y)) {
|
||||
saveButton.handleClick(x, y, button);
|
||||
}
|
||||
}
|
||||
|
||||
public static void drawOverlay(int y, int height, int screenwidth, float zLevel) {
|
||||
OptionScrollPane.drawOverlayTex(0, 0, screenwidth, y, zLevel);
|
||||
OptionScrollPane.drawOverlayTex(0, y + height, screenwidth, screenwidth - y - height, zLevel);
|
||||
OptionScrollPane.drawOverlayGrad(0, screenwidth, y, y + 4, zLevel);
|
||||
OptionScrollPane.drawOverlayGrad(0, screenwidth, y + height, y + height - 4, zLevel);
|
||||
}
|
||||
|
||||
public static void drawOverlayTex(int x, int y, int w, int h, float zLevel) {
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(Gui.optionsBackground);
|
||||
Tessellator t = Tessellator.instance;
|
||||
t.startDrawingQuads();
|
||||
t.addVertexWithUV(x, y, zLevel, 0, 0);
|
||||
t.addVertexWithUV(x, y + h, zLevel, 0, h / 16D);
|
||||
t.addVertexWithUV(x + w, y + h, zLevel, w / 16D, h / 16D);
|
||||
t.addVertexWithUV(x + w, y, zLevel, w / 16D, 0);
|
||||
t.draw();
|
||||
}
|
||||
|
||||
public static void drawOverlayGrad(int x1, int x2, int y1, int y2, float zLevel) {
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
Tessellator t = Tessellator.instance;
|
||||
t.startDrawingQuads();
|
||||
t.setColorRGBA_I(0, 255);
|
||||
t.addVertex(x2, y1, zLevel);
|
||||
t.addVertex(x1, y1, zLevel);
|
||||
t.setColorRGBA_I(0, 0);
|
||||
t.addVertex(x1, y2, zLevel);
|
||||
t.addVertex(x2, y2, zLevel);
|
||||
t.draw();
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,327 @@
|
||||
package codechicken.nei.config.preset;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import codechicken.core.gui.GuiWidget;
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.ItemList.AllMultiItemFilter;
|
||||
import codechicken.nei.ItemPanel.ItemPanelSlot;
|
||||
import codechicken.nei.ItemsGrid;
|
||||
import codechicken.nei.Label;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.PresetsList.Preset;
|
||||
import codechicken.nei.PresetsList.PresetMode;
|
||||
import codechicken.nei.TextField;
|
||||
import codechicken.nei.api.ItemFilter;
|
||||
import codechicken.nei.api.ItemInfo;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.guihook.IContainerTooltipHandler;
|
||||
|
||||
public class LeftPanel extends GuiWidget {
|
||||
|
||||
protected static class MouseSelection {
|
||||
|
||||
public int startX = -1;
|
||||
public int startY = -1;
|
||||
public int startIndex = -1;
|
||||
public int endIndex = -1;
|
||||
|
||||
public Set<ItemStack> items = new HashSet<>();
|
||||
|
||||
public MouseSelection(int slotIndex, Rectangle4i rec) {
|
||||
endIndex = slotIndex;
|
||||
startIndex = slotIndex;
|
||||
startX = rec.x;
|
||||
startY = rec.y;
|
||||
}
|
||||
}
|
||||
|
||||
protected static final int INPUT_HEIGHT = 20;
|
||||
|
||||
public final PresetItemsGrid grid = new PresetItemsGrid() {
|
||||
|
||||
@Override
|
||||
protected ItemFilter getFilter() {
|
||||
Set<String> identifiers = preset.items;
|
||||
return new AllMultiItemFilter(
|
||||
item -> !ItemInfo.hiddenItems.contains(item),
|
||||
item -> identifiers.contains(Preset.getIdentifier(item)));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isSelected(ItemStack stack) {
|
||||
return mouseSelection != null && mouseSelection.items.contains(stack);
|
||||
}
|
||||
};
|
||||
|
||||
protected Label nameLabel = new Label(NEIClientUtils.translate("presets.name"), false);
|
||||
|
||||
protected TextField nameField = new TextField("name") {
|
||||
|
||||
@Override
|
||||
public void onTextChange(String oldText) {
|
||||
preset.name = text();
|
||||
}
|
||||
};
|
||||
|
||||
protected Label modeLabel = new Label(NEIClientUtils.translate("presets.mode"), false);
|
||||
|
||||
protected CheckboxButton modeHide;
|
||||
protected CheckboxButton modeRemove;
|
||||
protected CheckboxButton modeGroup;
|
||||
|
||||
protected CheckboxButton enabledButton;
|
||||
|
||||
protected final Preset preset;
|
||||
protected MouseSelection mouseSelection;
|
||||
|
||||
public LeftPanel(Preset preset) {
|
||||
super(1, 0, 2, 2);
|
||||
|
||||
this.preset = preset;
|
||||
|
||||
nameField.setText(preset.name);
|
||||
|
||||
modeHide = new CheckboxButton(NEIClientUtils.translate("presets.mode.hide")) {
|
||||
|
||||
@Override
|
||||
public boolean isChecked() {
|
||||
return preset.mode == PresetMode.HIDE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onChange() {
|
||||
preset.mode = this.checked ? PresetMode.HIDE : null;
|
||||
}
|
||||
};
|
||||
|
||||
modeRemove = new CheckboxButton(NEIClientUtils.translate("presets.mode.remove")) {
|
||||
|
||||
@Override
|
||||
public boolean isChecked() {
|
||||
return preset.mode == PresetMode.REMOVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onChange() {
|
||||
preset.mode = this.checked ? PresetMode.REMOVE : null;
|
||||
}
|
||||
};
|
||||
|
||||
modeGroup = new CheckboxButton(NEIClientUtils.translate("presets.mode.group")) {
|
||||
|
||||
@Override
|
||||
public boolean isChecked() {
|
||||
return preset.mode == PresetMode.GROUP;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onChange() {
|
||||
preset.mode = this.checked ? PresetMode.GROUP : null;
|
||||
}
|
||||
};
|
||||
|
||||
enabledButton = new CheckboxButton(NEIClientUtils.translate("presets.enabled")) {
|
||||
|
||||
@Override
|
||||
public boolean isChecked() {
|
||||
return preset.enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onChange() {
|
||||
preset.enabled = this.checked;
|
||||
}
|
||||
};
|
||||
|
||||
grid.restartFilter();
|
||||
}
|
||||
|
||||
public void mouseClicked(int x, int y, int button) {
|
||||
grid.mouseClicked(x, y, button);
|
||||
|
||||
if (modeHide.contains(x, y)) {
|
||||
modeHide.handleClick(x, y, button);
|
||||
}
|
||||
|
||||
if (modeRemove.contains(x, y)) {
|
||||
modeRemove.handleClick(x, y, button);
|
||||
}
|
||||
|
||||
if (modeGroup.contains(x, y)) {
|
||||
modeGroup.handleClick(x, y, button);
|
||||
}
|
||||
|
||||
if (enabledButton.contains(x, y)) {
|
||||
enabledButton.handleClick(x, y, button);
|
||||
}
|
||||
|
||||
if (nameField.contains(x, y)) {
|
||||
nameField.handleClick(x, y, button);
|
||||
} else {
|
||||
nameField.onGuiClick(x, y);
|
||||
}
|
||||
|
||||
if (mouseSelection == null && button == 0) {
|
||||
ItemPanelSlot slot = grid.getSlotMouseOver(x, y);
|
||||
|
||||
if (slot != null) {
|
||||
mouseSelection = new MouseSelection(slot.slotIndex, grid.getItemRect(slot.slotIndex));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void onItemsChanges() {}
|
||||
|
||||
public void mouseMovedOrUp(int x, int y, int button) {
|
||||
nameField.mouseUp(x, y, button);
|
||||
|
||||
if (mouseSelection != null && button == 0) {
|
||||
ItemPanelSlot hoverSlot = grid.getSlotMouseOver(x, y);
|
||||
|
||||
if (hoverSlot != null && hoverSlot.slotIndex == mouseSelection.startIndex) {
|
||||
preset.items.remove(Preset.getIdentifier(hoverSlot.item));
|
||||
} else if (!mouseSelection.items.isEmpty()) {
|
||||
|
||||
for (ItemStack stack : mouseSelection.items) {
|
||||
preset.items.remove(Preset.getIdentifier(stack));
|
||||
}
|
||||
}
|
||||
|
||||
mouseSelection = null;
|
||||
onItemsChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public void mouseDragged(int x, int y, int button, long time) {
|
||||
nameField.mouseDragged(x, y, button, time);
|
||||
|
||||
if (mouseSelection != null && button == 0) {
|
||||
final ItemPanelSlot slot = grid.getSlotMouseOver(x, y);
|
||||
|
||||
if (slot != null && slot.slotIndex != mouseSelection.endIndex) {
|
||||
mouseSelection.endIndex = slot.slotIndex;
|
||||
mouseSelection.items.clear();
|
||||
|
||||
final Rectangle4i rec = grid.getItemRect(slot.slotIndex);
|
||||
final Rectangle4i sel = new Rectangle4i(
|
||||
Math.min(rec.x, mouseSelection.startX),
|
||||
Math.min(rec.y, mouseSelection.startY),
|
||||
Math.max(rec.x, mouseSelection.startX) - Math.min(rec.x, mouseSelection.startX),
|
||||
Math.max(rec.y, mouseSelection.startY) - Math.min(rec.y, mouseSelection.startY));
|
||||
|
||||
for (int ix = sel.x; ix <= sel.x + sel.w; ix += ItemsGrid.SLOT_SIZE) {
|
||||
for (int iy = sel.y; iy <= sel.y + sel.h; iy += ItemsGrid.SLOT_SIZE) {
|
||||
ItemPanelSlot over = grid.getSlotMouseOver(ix, iy);
|
||||
|
||||
if (over != null) {
|
||||
mouseSelection.items.add(over.item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void update() {
|
||||
int CHECKBOX_WIDTH = (this.width - 12) / 3;
|
||||
nameLabel.x = this.x + 2;
|
||||
nameLabel.y = this.y + 4;
|
||||
nameLabel.w = this.width;
|
||||
nameLabel.h = 10;
|
||||
|
||||
nameField.x = this.x;
|
||||
nameField.y = nameLabel.y + nameLabel.h;
|
||||
nameField.w = this.width - CHECKBOX_WIDTH - 6;
|
||||
nameField.h = INPUT_HEIGHT;
|
||||
|
||||
enabledButton.x = nameField.x + nameField.w + 6;
|
||||
enabledButton.y = nameField.y;
|
||||
enabledButton.w = CHECKBOX_WIDTH;
|
||||
enabledButton.h = INPUT_HEIGHT;
|
||||
|
||||
modeLabel.x = this.x + 2;
|
||||
modeLabel.y = nameField.y + nameField.h + 6;
|
||||
modeLabel.w = this.width;
|
||||
modeLabel.h = 10;
|
||||
|
||||
modeHide.w = modeRemove.w = modeGroup.w = CHECKBOX_WIDTH;
|
||||
modeHide.h = modeRemove.h = modeGroup.h = INPUT_HEIGHT;
|
||||
modeHide.y = modeRemove.y = modeGroup.y = modeLabel.y + modeLabel.h;
|
||||
|
||||
modeHide.x = this.x + 1;
|
||||
modeRemove.x = modeHide.x + modeHide.w + 6;
|
||||
modeGroup.x = modeRemove.x + modeRemove.w + 6;
|
||||
|
||||
grid.setGridSize(
|
||||
this.x + 1,
|
||||
modeHide.y + modeHide.h + 2,
|
||||
this.width - 2,
|
||||
this.height - (modeHide.y + modeHide.h + 2));
|
||||
grid.refresh(null);
|
||||
}
|
||||
|
||||
public void draw(int mousex, int mousey, float frame) {
|
||||
nameLabel.draw(mousex, mousey);
|
||||
nameField.draw(mousex, mousey);
|
||||
|
||||
modeLabel.draw(mousex, mousey);
|
||||
modeHide.draw(mousex, mousey);
|
||||
modeRemove.draw(mousex, mousey);
|
||||
modeGroup.draw(mousex, mousey);
|
||||
|
||||
enabledButton.draw(mousex, mousey);
|
||||
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
grid.draw(mousex, mousey);
|
||||
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glPopMatrix();
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
}
|
||||
|
||||
public List<String> handleTooltip(int mousex, int mousey, List<String> tooltip) {
|
||||
ItemPanelSlot over = grid.getSlotMouseOver(mousex, mousey);
|
||||
|
||||
if (over != null) {
|
||||
tooltip = GuiContainerManager.itemDisplayNameMultiline(over.item, null, true);
|
||||
|
||||
synchronized (GuiContainerManager.tooltipHandlers) {
|
||||
for (IContainerTooltipHandler handler : GuiContainerManager.tooltipHandlers) {
|
||||
tooltip = handler.handleItemTooltip(null, over.item, mousex, mousey, tooltip);
|
||||
}
|
||||
}
|
||||
|
||||
if (tooltip.size() > 0) {
|
||||
tooltip.set(0, tooltip.get(0) + GuiDraw.TOOLTIP_LINESPACE); // add space after 'title'
|
||||
}
|
||||
|
||||
} else if (modeHide.contains(mousex, mousey)) {
|
||||
tooltip.add(NEIClientUtils.translate("presets.mode.hide.tip"));
|
||||
} else if (modeRemove.contains(mousex, mousey)) {
|
||||
tooltip.add(NEIClientUtils.translate("presets.mode.remove.tip"));
|
||||
} else if (modeGroup.contains(mousex, mousey)) {
|
||||
tooltip.add(NEIClientUtils.translate("presets.mode.group.tip"));
|
||||
}
|
||||
|
||||
return tooltip;
|
||||
}
|
||||
|
||||
public void keyTyped(char c, int keycode) {
|
||||
nameField.handleKeyPress(keycode, c);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
package codechicken.nei.config.preset;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.Button;
|
||||
import codechicken.nei.ItemList;
|
||||
import codechicken.nei.ItemPanel.ItemPanelSlot;
|
||||
import codechicken.nei.ItemSorter;
|
||||
import codechicken.nei.ItemsGrid;
|
||||
import codechicken.nei.Label;
|
||||
import codechicken.nei.RestartableTask;
|
||||
import codechicken.nei.api.ItemFilter;
|
||||
|
||||
public abstract class PresetItemsGrid extends ItemsGrid {
|
||||
|
||||
protected static final int BUTTON_SIZE = 16;
|
||||
|
||||
public Button pagePrev;
|
||||
public Label pageLabel;
|
||||
public Button pageNext;
|
||||
|
||||
protected ArrayList<ItemStack> newItems;
|
||||
|
||||
protected final RestartableTask updateFilter = new RestartableTask("NEI Presets Item Filtering") {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
ArrayList<ItemStack> filtered;
|
||||
ItemFilter filter = getFilter();
|
||||
|
||||
try {
|
||||
filtered = ItemList.forkJoinPool.submit(
|
||||
() -> ItemList.items.parallelStream().filter(filter::matches)
|
||||
.collect(Collectors.toCollection(ArrayList::new)))
|
||||
.get();
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
filtered = new ArrayList<>();
|
||||
e.printStackTrace();
|
||||
stop();
|
||||
}
|
||||
|
||||
if (interrupted()) return;
|
||||
ItemSorter.sort(filtered);
|
||||
if (interrupted()) return;
|
||||
updateItemList(filtered);
|
||||
}
|
||||
};
|
||||
|
||||
public PresetItemsGrid() {
|
||||
|
||||
pageLabel = new Label("0/0", true);
|
||||
|
||||
pagePrev = new Button("<") {
|
||||
|
||||
public boolean onButtonPress(boolean rightclick) {
|
||||
|
||||
if (rightclick) {
|
||||
setPage(0);
|
||||
} else {
|
||||
shiftPage(-1);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
pageNext = new Button(">") {
|
||||
|
||||
public boolean onButtonPress(boolean rightclick) {
|
||||
|
||||
if (rightclick) {
|
||||
setPage(getNumPages() - 1);
|
||||
} else {
|
||||
shiftPage(1);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
protected String getLabelText() {
|
||||
return String.format("%d/%d", getPage(), Math.max(1, getNumPages()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGridSize(int mleft, int mtop, int w, int h) {
|
||||
pageLabel.text = getLabelText();
|
||||
|
||||
pagePrev.w = pageNext.w = BUTTON_SIZE;
|
||||
pagePrev.h = pageNext.h = BUTTON_SIZE;
|
||||
pagePrev.y = pageNext.y = mtop;
|
||||
|
||||
pagePrev.x = mleft;
|
||||
pageNext.x = mleft + w - pageNext.w;
|
||||
|
||||
pageLabel.x = mleft + w / 2;
|
||||
pageLabel.y = pagePrev.y + 5;
|
||||
|
||||
super.setGridSize(mleft, mtop + BUTTON_SIZE + 2, w, h - BUTTON_SIZE - 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int mousex, int mousey) {
|
||||
pagePrev.draw(mousex, mousey);
|
||||
pageNext.draw(mousex, mousey);
|
||||
pageLabel.draw(mousex, mousey);
|
||||
|
||||
super.draw(mousex, mousey);
|
||||
}
|
||||
|
||||
public void mouseClicked(int x, int y, int button) {
|
||||
|
||||
if (pagePrev.contains(x, y)) {
|
||||
pagePrev.handleClick(x, y, button);
|
||||
}
|
||||
|
||||
if (pageNext.contains(x, y)) {
|
||||
pageNext.handleClick(x, y, button);
|
||||
}
|
||||
}
|
||||
|
||||
public void restartFilter() {
|
||||
updateFilter.restart();
|
||||
}
|
||||
|
||||
protected void updateItemList(List<ItemStack> newItems) {
|
||||
this.newItems = new ArrayList<>(newItems);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh(GuiContainer gui) {
|
||||
|
||||
if (this.newItems != null) {
|
||||
this.realItems = this.newItems;
|
||||
this.newItems = null;
|
||||
onItemsChanged();
|
||||
}
|
||||
|
||||
super.refresh(gui);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void beforeDrawSlot(@Nullable ItemPanelSlot focused, int slotIdx, Rectangle4i rect) {
|
||||
if (isSelected(getItem(slotIdx))) {
|
||||
GuiDraw.drawRect(rect.x, rect.y, rect.w, rect.h, 0xee555555);
|
||||
} else {
|
||||
super.beforeDrawSlot(focused, slotIdx, rect);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract boolean isSelected(ItemStack stack);
|
||||
|
||||
protected abstract ItemFilter getFilter();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,396 @@
|
||||
package codechicken.nei.config.preset;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import codechicken.core.gui.GuiWidget;
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.ItemList;
|
||||
import codechicken.nei.ItemList.AllMultiItemFilter;
|
||||
import codechicken.nei.ItemList.AnyMultiItemFilter;
|
||||
import codechicken.nei.ItemList.NegatedItemFilter;
|
||||
import codechicken.nei.ItemPanel.ItemPanelSlot;
|
||||
import codechicken.nei.ItemsGrid;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.PresetsList;
|
||||
import codechicken.nei.PresetsList.Preset;
|
||||
import codechicken.nei.SearchField.GuiSearchField;
|
||||
import codechicken.nei.TextField;
|
||||
import codechicken.nei.api.ItemFilter;
|
||||
import codechicken.nei.api.ItemInfo;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.guihook.IContainerTooltipHandler;
|
||||
import codechicken.nei.util.TextHistory;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class RightPanel extends GuiWidget {
|
||||
|
||||
protected static class MouseSelection {
|
||||
|
||||
public int startX = -1;
|
||||
public int startY = -1;
|
||||
public int startIndex = -1;
|
||||
public int endIndex = -1;
|
||||
|
||||
public Set<ItemStack> items = new HashSet<>();
|
||||
public boolean append = true;
|
||||
|
||||
public MouseSelection(int slotIndex, Rectangle4i rec, boolean ppnd) {
|
||||
append = ppnd;
|
||||
endIndex = slotIndex;
|
||||
startIndex = slotIndex;
|
||||
startX = rec.x;
|
||||
startY = rec.y;
|
||||
}
|
||||
}
|
||||
|
||||
protected static abstract class PresetSearchField extends TextField {
|
||||
|
||||
private static final TextHistory history = new TextHistory();
|
||||
|
||||
public PresetSearchField(String ident) {
|
||||
super(ident);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initInternalTextField() {
|
||||
field = new GuiSearchField();
|
||||
field.setMaxStringLength(maxSearchLength);
|
||||
field.setCursorPositionZero();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTextColour() {
|
||||
if (!text().isEmpty()) {
|
||||
return focused() ? 0xFFcc3300 : 0xFF993300;
|
||||
} else {
|
||||
return focused() ? 0xFFE0E0E0 : 0xFF909090;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void lastKeyTyped(int keyID, char keyChar) {
|
||||
|
||||
if (!focused() && NEIClientConfig.isKeyHashDown("gui.search")) {
|
||||
setFocus(true);
|
||||
}
|
||||
|
||||
if (focused() && NEIClientConfig.isKeyHashDown("gui.getprevioussearch")) {
|
||||
handleNavigateHistory(TextHistory.Direction.PREVIOUS);
|
||||
}
|
||||
|
||||
if (focused() && NEIClientConfig.isKeyHashDown("gui.getnextsearch")) {
|
||||
handleNavigateHistory(TextHistory.Direction.NEXT);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String filterText(String s) {
|
||||
return EnumChatFormatting.getTextWithoutFormattingCodes(s);
|
||||
}
|
||||
|
||||
public ItemFilter getFilter() {
|
||||
return ((GuiSearchField) field).getFilter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFocus(boolean focus) {
|
||||
final boolean previousFocus = field.isFocused();
|
||||
|
||||
if (previousFocus != focus) {
|
||||
history.add(text());
|
||||
}
|
||||
|
||||
super.setFocus(focus);
|
||||
}
|
||||
|
||||
private boolean handleNavigateHistory(TextHistory.Direction direction) {
|
||||
if (focused()) {
|
||||
return history.get(direction, text()).map(newText -> {
|
||||
setText(newText);
|
||||
return true;
|
||||
}).orElse(false);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected static final int INPUT_HEIGHT = 20;
|
||||
protected static final int BUTTON_SIZE = 16;
|
||||
|
||||
protected final PresetItemsGrid grid = new PresetItemsGrid() {
|
||||
|
||||
@Override
|
||||
protected ItemFilter getFilter() {
|
||||
AllMultiItemFilter filter = new AllMultiItemFilter();
|
||||
filter.filters.add(item -> !ItemInfo.hiddenItems.contains(item));
|
||||
filter.filters.add(searchField.getFilter());
|
||||
|
||||
if (enabledPresets.isChecked()) {
|
||||
AllMultiItemFilter andFilter = new AllMultiItemFilter();
|
||||
AnyMultiItemFilter orFilter = new AnyMultiItemFilter();
|
||||
Set<String> identifiers = PresetsList.presets.stream().flatMap(p -> p.items.stream())
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
andFilter.filters.add(item -> !identifiers.contains(Preset.getIdentifier(item)));
|
||||
andFilter.filters.add(new NegatedItemFilter(ItemList.collapsibleItems.getItemFilter()));
|
||||
|
||||
if (slotIndex != -1) {
|
||||
orFilter.filters.add(PresetsList.presets.get(slotIndex));
|
||||
}
|
||||
|
||||
orFilter.filters.add(andFilter);
|
||||
filter.filters.add(orFilter);
|
||||
}
|
||||
|
||||
return filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isSelected(ItemStack stack) {
|
||||
|
||||
if (mouseSelection != null && mouseSelection.items.contains(stack)) {
|
||||
return mouseSelection.append != false;
|
||||
}
|
||||
|
||||
return preset.items.contains(Preset.getIdentifier(stack));
|
||||
}
|
||||
};
|
||||
|
||||
protected CheckboxButton enabledPresets;
|
||||
|
||||
protected final Preset preset;
|
||||
protected final int slotIndex;
|
||||
protected MouseSelection mouseSelection;
|
||||
|
||||
protected final PresetSearchField searchField = new PresetSearchField("preset-search") {
|
||||
|
||||
@Override
|
||||
public void onTextChange(String oldText) {
|
||||
final String newText = text();
|
||||
if (!newText.equals(oldText)) {
|
||||
grid.restartFilter();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
public RightPanel(Preset preset, int slotIndex) {
|
||||
super(1, 0, 2, 2);
|
||||
|
||||
this.slotIndex = slotIndex;
|
||||
this.preset = preset;
|
||||
|
||||
enabledPresets = new CheckboxButton(NEIClientUtils.translate("presets.filter")) {
|
||||
|
||||
@Override
|
||||
protected void onChange() {
|
||||
grid.restartFilter();
|
||||
}
|
||||
};
|
||||
|
||||
enabledPresets.setChecked(true);
|
||||
|
||||
grid.restartFilter();
|
||||
}
|
||||
|
||||
public void mouseClicked(int x, int y, int button) {
|
||||
grid.mouseClicked(x, y, button);
|
||||
|
||||
if (enabledPresets.contains(x, y)) {
|
||||
enabledPresets.handleClick(x, y, button);
|
||||
}
|
||||
|
||||
if (searchField.contains(x, y)) {
|
||||
searchField.handleClick(x, y, button);
|
||||
} else {
|
||||
searchField.onGuiClick(x, y);
|
||||
}
|
||||
|
||||
if (mouseSelection == null && (button == 0 || button == 1)) {
|
||||
ItemPanelSlot slot = grid.getSlotMouseOver(x, y);
|
||||
|
||||
if (slot != null) {
|
||||
mouseSelection = new MouseSelection(slot.slotIndex, grid.getItemRect(slot.slotIndex), button == 0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void onItemsChanges() {}
|
||||
|
||||
public void mouseMovedOrUp(int x, int y, int button) {
|
||||
searchField.mouseUp(x, y, button);
|
||||
|
||||
if (mouseSelection != null && (button == 0 || button == 1)) {
|
||||
ItemPanelSlot hoverSlot = grid.getSlotMouseOver(x, y);
|
||||
|
||||
if (hoverSlot != null && hoverSlot.slotIndex == mouseSelection.startIndex) {
|
||||
setHidden(hoverSlot.item, button == 0);
|
||||
} else if (!mouseSelection.items.isEmpty()) {
|
||||
|
||||
for (ItemStack stack : mouseSelection.items) {
|
||||
hideItem(stack, mouseSelection.append);
|
||||
}
|
||||
}
|
||||
|
||||
mouseSelection = null;
|
||||
onItemsChanges();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void setHidden(final ItemStack stack, final boolean append) {
|
||||
|
||||
if (NEIClientUtils.shiftKey()) {
|
||||
final List<ItemStack> items = grid.getItems();
|
||||
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
if (stack.getItem().equals(items.get(i).getItem())) {
|
||||
hideItem(items.get(i), append);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (NEIClientUtils.controlKey()) {
|
||||
final String modId = getModId(stack);
|
||||
|
||||
if (modId == null) {
|
||||
hideItem(stack, append);
|
||||
} else {
|
||||
final List<ItemStack> items = grid.getItems();
|
||||
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
final String mod = getModId(items.get(i));
|
||||
if (mod != null && mod.equals(modId)) {
|
||||
hideItem(items.get(i), append);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
hideItem(stack, append);
|
||||
}
|
||||
}
|
||||
|
||||
protected void hideItem(final ItemStack stack, boolean append) {
|
||||
if (append) {
|
||||
preset.items.add(Preset.getIdentifier(stack));
|
||||
} else {
|
||||
preset.items.remove(Preset.getIdentifier(stack));
|
||||
}
|
||||
}
|
||||
|
||||
protected static String getModId(final ItemStack stack) {
|
||||
try {
|
||||
return GameRegistry.findUniqueIdentifierFor(stack.getItem()).modId;
|
||||
} catch (Exception ignored) {}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void mouseDragged(int x, int y, int button, long time) {
|
||||
searchField.mouseDragged(x, y, button, time);
|
||||
|
||||
if (mouseSelection != null && (button == 0 || button == 1)) {
|
||||
final ItemPanelSlot slot = grid.getSlotMouseOver(x, y);
|
||||
|
||||
if (slot != null && slot.slotIndex != mouseSelection.endIndex) {
|
||||
mouseSelection.endIndex = slot.slotIndex;
|
||||
mouseSelection.items.clear();
|
||||
|
||||
final Rectangle4i rec = grid.getItemRect(slot.slotIndex);
|
||||
final Rectangle4i sel = new Rectangle4i(
|
||||
Math.min(rec.x, mouseSelection.startX),
|
||||
Math.min(rec.y, mouseSelection.startY),
|
||||
Math.max(rec.x, mouseSelection.startX) - Math.min(rec.x, mouseSelection.startX),
|
||||
Math.max(rec.y, mouseSelection.startY) - Math.min(rec.y, mouseSelection.startY));
|
||||
|
||||
for (int ix = sel.x; ix <= sel.x + sel.w; ix += ItemsGrid.SLOT_SIZE) {
|
||||
for (int iy = sel.y; iy <= sel.y + sel.h; iy += ItemsGrid.SLOT_SIZE) {
|
||||
ItemPanelSlot over = grid.getSlotMouseOver(ix, iy);
|
||||
|
||||
if (over != null) {
|
||||
mouseSelection.items.add(over.item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void update() {
|
||||
enabledPresets.w = 20;
|
||||
enabledPresets.h = INPUT_HEIGHT;
|
||||
enabledPresets.x = this.x;
|
||||
enabledPresets.y = this.y + this.height - 2 - INPUT_HEIGHT;
|
||||
|
||||
searchField.w = this.width - enabledPresets.w - 3;
|
||||
searchField.h = INPUT_HEIGHT;
|
||||
searchField.x = enabledPresets.x + enabledPresets.w + 3;
|
||||
searchField.y = enabledPresets.y;
|
||||
|
||||
grid.setGridSize(this.x, this.y, this.width, searchField.y - this.y);
|
||||
grid.refresh(null);
|
||||
}
|
||||
|
||||
public void draw(int mousex, int mousey, float frame) {
|
||||
enabledPresets.draw(mousex, mousey);
|
||||
searchField.draw(mousex, mousey);
|
||||
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
grid.draw(mousex, mousey);
|
||||
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glPopMatrix();
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
}
|
||||
|
||||
public List<String> handleTooltip(int mousex, int mousey, List<String> tooltip) {
|
||||
ItemPanelSlot over = grid.getSlotMouseOver(mousex, mousey);
|
||||
|
||||
if (over != null) {
|
||||
tooltip = GuiContainerManager.itemDisplayNameMultiline(over.item, null, true);
|
||||
|
||||
synchronized (GuiContainerManager.tooltipHandlers) {
|
||||
for (IContainerTooltipHandler handler : GuiContainerManager.tooltipHandlers) {
|
||||
tooltip = handler.handleItemTooltip(null, over.item, mousex, mousey, tooltip);
|
||||
}
|
||||
}
|
||||
|
||||
if (tooltip.size() > 0) {
|
||||
tooltip.set(0, tooltip.get(0) + GuiDraw.TOOLTIP_LINESPACE); // add space after 'title'
|
||||
}
|
||||
|
||||
} else if (enabledPresets.contains(mousex, mousey)) {
|
||||
tooltip.add(NEIClientUtils.translate("presets.filter.tip"));
|
||||
}
|
||||
|
||||
return tooltip;
|
||||
}
|
||||
|
||||
public void keyTyped(char c, int keycode) {
|
||||
searchField.handleKeyPress(keycode, c);
|
||||
}
|
||||
|
||||
public void mouseScrolled(int x, int y, int scroll) {
|
||||
if (grid.contains(x, y)) {
|
||||
grid.shiftPage(-scroll);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.StringJoiner;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@@ -133,6 +134,7 @@ public class GuiContainerManager {
|
||||
* @param includeHandlers If true tooltip handlers will add to the item tip
|
||||
* @return A list of Strings representing the text to be displayed on each line of the tool tip.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static List<String> itemDisplayNameMultiline(ItemStack stack, GuiContainer gui, boolean includeHandlers) {
|
||||
List<String> namelist = null;
|
||||
try {
|
||||
@@ -218,8 +220,18 @@ public class GuiContainerManager {
|
||||
* @return The first line of the multiline display name.
|
||||
*/
|
||||
public static String itemDisplayNameShort(ItemStack itemstack) {
|
||||
List<String> list = itemDisplayNameMultiline(itemstack, null, false);
|
||||
return list.get(0);
|
||||
|
||||
try {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> namelist = itemstack.getTooltip(Minecraft.getMinecraft().thePlayer, false);
|
||||
|
||||
if (!namelist.isEmpty() && !"".equals(namelist.get(0))) {
|
||||
return itemstack.getRarity().rarityColor.toString() + namelist.get(0) + EnumChatFormatting.RESET;
|
||||
}
|
||||
|
||||
} catch (Throwable ignored) {}
|
||||
|
||||
return "Unnamed";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -229,18 +241,17 @@ public class GuiContainerManager {
|
||||
* @param itemstack The stack to get the name for
|
||||
* @return The multiline display name of this item separated by '#'
|
||||
*/
|
||||
@Deprecated
|
||||
public static String concatenatedDisplayName(ItemStack itemstack, boolean includeHandlers) {
|
||||
List<String> list = itemDisplayNameMultiline(itemstack, null, includeHandlers);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
boolean first = true;
|
||||
StringJoiner sb = new StringJoiner("#");
|
||||
|
||||
for (String name : list) {
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
sb.append("#");
|
||||
if (!name.isEmpty()) {
|
||||
sb.add(name);
|
||||
}
|
||||
sb.append(name);
|
||||
}
|
||||
|
||||
return EnumChatFormatting.getTextWithoutFormattingCodes(sb.toString());
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,9 @@ public class GuiCraftingRecipe extends GuiRecipe<ICraftingHandler> {
|
||||
final BookmarkRecipeId recipeId;
|
||||
|
||||
if ("item".equals(outputId)) {
|
||||
results = Arrays.asList(results).stream().map(rslt -> normalizeItemStack((ItemStack) rslt)).toArray();
|
||||
for (int i = 0; i < results.length; i++) {
|
||||
results[i] = normalizeItemStack((ItemStack) results[i]);
|
||||
}
|
||||
recipeId = getRecipeId(mc.currentScreen, (ItemStack) results[0]);
|
||||
} else if ("recipeId".equals(outputId)) {
|
||||
recipeId = (BookmarkRecipeId) results[1];
|
||||
@@ -103,7 +105,7 @@ public class GuiCraftingRecipe extends GuiRecipe<ICraftingHandler> {
|
||||
"outputId: " + outputId,
|
||||
"results: " + Arrays.toString(results));
|
||||
|
||||
return recipeQuery.runWithProfiling("recipe.concurrent.crafting");
|
||||
return recipeQuery.runWithProfiling(NEIClientUtils.translate("recipe.concurrent.crafting"));
|
||||
}
|
||||
|
||||
private static ArrayList<ICraftingHandler> filterByHandlerName(ArrayList<ICraftingHandler> craftinghandlers,
|
||||
|
||||
@@ -11,7 +11,6 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
@@ -22,8 +21,6 @@ import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -38,6 +35,7 @@ import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.RecipeSearchField;
|
||||
import codechicken.nei.RestartableTask;
|
||||
import codechicken.nei.SearchField;
|
||||
import codechicken.nei.VisiblityData;
|
||||
import codechicken.nei.api.IGuiContainerOverlay;
|
||||
import codechicken.nei.api.INEIGuiHandler;
|
||||
@@ -416,8 +414,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
nextpage = new GuiNEIButton(2, leftButtonX, guiTop + 17, buttonWidth, buttonHeight, "<");
|
||||
prevpage = new GuiNEIButton(3, rightButtonX, guiTop + 17, buttonWidth, buttonHeight, ">");
|
||||
|
||||
toggleSearch.icon = new DrawableBuilder("nei:textures/nei_sprites.png", 0, 38, 8, 8).setTextureSize(128, 128)
|
||||
.build();
|
||||
toggleSearch.icon = new DrawableBuilder("nei:textures/nei_sprites.png", 0, 76, 10, 10).build();
|
||||
|
||||
buttonList.addAll(Arrays.asList(nexttype, prevtype, nextpage, prevpage));
|
||||
|
||||
@@ -1213,25 +1210,13 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
public boolean handleDragNDrop(GuiContainer gui, int mousex, int mousey, ItemStack draggedStack, int button) {
|
||||
|
||||
if (searchField.isVisible() && searchField.contains(mousex - guiLeft, mousey - guiTop)) {
|
||||
final FluidStack fluidStack = StackInfo.getFluid(draggedStack);
|
||||
|
||||
if (fluidStack != null) {
|
||||
searchField.setText(formattingText(fluidStack.getLocalizedName()));
|
||||
} else {
|
||||
searchField.setText(formattingText(draggedStack.getDisplayName()));
|
||||
}
|
||||
|
||||
searchField.setText(SearchField.getEscapedSearchText(draggedStack));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected String formattingText(String displayName) {
|
||||
return Pattern.compile("[{}()\\[\\].+*?^$\\\\|]")
|
||||
.matcher(EnumChatFormatting.getTextWithoutFormattingCodes(displayName)).replaceAll("\\\\$0");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int w, int h) {
|
||||
// Because some of the handlers *cough avaritia* are oversized
|
||||
|
||||
@@ -18,8 +18,9 @@ public class GuiUsageRecipe extends GuiRecipe<IUsageHandler> {
|
||||
public static boolean openRecipeGui(String inputId, Object... ingredients) {
|
||||
|
||||
if ("item".equals(inputId)) {
|
||||
ingredients = Arrays.asList(ingredients).stream().map(ingr -> normalizeItemStack((ItemStack) ingr))
|
||||
.toArray();
|
||||
for (int i = 0; i < ingredients.length; i++) {
|
||||
ingredients[i] = normalizeItemStack((ItemStack) ingredients[i]);
|
||||
}
|
||||
}
|
||||
|
||||
final ArrayList<IUsageHandler> handlers = getUsageHandlers(inputId, ingredients);
|
||||
@@ -52,7 +53,7 @@ public class GuiUsageRecipe extends GuiRecipe<IUsageHandler> {
|
||||
"inputId: " + inputId,
|
||||
"ingredients: " + Arrays.toString(ingredients));
|
||||
|
||||
return recipeQuery.runWithProfiling("recipe.concurrent.usage");
|
||||
return recipeQuery.runWithProfiling(NEIClientUtils.translate("recipe.concurrent.usage"));
|
||||
}
|
||||
|
||||
private static ItemStack normalizeItemStack(ItemStack stack) {
|
||||
|
||||
@@ -81,7 +81,7 @@ class ItemsHistoryHandler implements ICraftingHandler, IUsageHandler {
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return null;
|
||||
return "Items History";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,29 +3,26 @@ package codechicken.nei.recipe;
|
||||
import static codechicken.lib.gui.GuiDraw.drawString;
|
||||
import static codechicken.lib.gui.GuiDraw.getStringWidth;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import codechicken.core.TaskProfiler;
|
||||
import codechicken.core.TaskProfiler.ProfilerResult;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.api.IOverlayHandler;
|
||||
import codechicken.nei.api.IRecipeOverlayRenderer;
|
||||
import codechicken.nei.util.AsyncTaskProfiler;
|
||||
|
||||
public class ProfilerRecipeHandler implements ICraftingHandler, IUsageHandler {
|
||||
|
||||
private static final TaskProfiler profiler = new TaskProfiler();
|
||||
private static final AsyncTaskProfiler profiler = new AsyncTaskProfiler();
|
||||
|
||||
public static TaskProfiler getProfiler() {
|
||||
profiler.clear();
|
||||
public static AsyncTaskProfiler getProfiler() {
|
||||
return profiler;
|
||||
}
|
||||
|
||||
@@ -42,7 +39,7 @@ public class ProfilerRecipeHandler implements ICraftingHandler, IUsageHandler {
|
||||
|
||||
@Override
|
||||
public int numRecipes() {
|
||||
if (!NEIClientConfig.getBooleanSetting("inventory.profileRecipes")) return 0;
|
||||
if (!NEIClientConfig.isProfileRecipeEnabled()) return 0;
|
||||
|
||||
return (int) Math.ceil(
|
||||
((crafting ? GuiCraftingRecipe.craftinghandlers.size() : GuiUsageRecipe.usagehandlers.size()) - 1)
|
||||
@@ -55,8 +52,7 @@ public class ProfilerRecipeHandler implements ICraftingHandler, IUsageHandler {
|
||||
@Override
|
||||
public void drawForeground(int recipe) {
|
||||
List<ProfilerResult> results = profiler.getResults();
|
||||
for (Iterator<ProfilerResult> it = results.iterator(); it.hasNext();)
|
||||
if (it.next().name.equals(getRecipeName())) it.remove();
|
||||
results.removeIf(profilerResult -> getRecipeName().equals(profilerResult.name));
|
||||
|
||||
results.sort((o1, o2) -> o1.time < o2.time ? 1 : -1);
|
||||
|
||||
@@ -65,10 +61,9 @@ public class ProfilerRecipeHandler implements ICraftingHandler, IUsageHandler {
|
||||
int y = (i % 6) * 20 + 6;
|
||||
drawString(r.name, 8, y, 0xFF808080, false);
|
||||
|
||||
DecimalFormat format = new DecimalFormat("0.00");
|
||||
String s = format.format(r.fraction * 100) + "%";
|
||||
if (r.time < 1000000L) s += " (" + (r.time / 1000) + "us)";
|
||||
else s += " (" + (r.time / 1000000) + "ms)";
|
||||
String s;
|
||||
if (r.time < 1000000L) s = (r.time / 1000) + "us";
|
||||
else s = (r.time / 1000000) + "ms";
|
||||
|
||||
drawString(s, 156 - getStringWidth(s), y + 10, 0xFF404040, false);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import net.minecraft.util.IChatComponent;
|
||||
import codechicken.core.TaskProfiler;
|
||||
import codechicken.nei.ItemList;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.util.AsyncTaskProfiler;
|
||||
|
||||
class RecipeHandlerQuery<T extends IRecipeHandler> {
|
||||
|
||||
@@ -34,7 +35,15 @@ class RecipeHandlerQuery<T extends IRecipeHandler> {
|
||||
|
||||
ArrayList<T> runWithProfiling(String profilerSection) {
|
||||
TaskProfiler profiler = ProfilerRecipeHandler.getProfiler();
|
||||
profiler.start(profilerSection);
|
||||
|
||||
// Save the current config state here, as it may be altered
|
||||
// if getRecipeHandlesParallel took so long and player accidentally changed config.
|
||||
boolean profileRecipes = NEIClientConfig.isProfileRecipeEnabled();
|
||||
if (profileRecipes) {
|
||||
profiler.clear();
|
||||
profiler.start(profilerSection);
|
||||
}
|
||||
|
||||
try {
|
||||
ArrayList<T> handlers = getRecipeHandlersParallel();
|
||||
|
||||
@@ -47,7 +56,7 @@ class RecipeHandlerQuery<T extends IRecipeHandler> {
|
||||
displayRecipeLookupError();
|
||||
return new ArrayList<>(0);
|
||||
} finally {
|
||||
profiler.end();
|
||||
if (profileRecipes) profiler.end();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,12 +72,17 @@ class RecipeHandlerQuery<T extends IRecipeHandler> {
|
||||
private ArrayList<T> getSerialHandlersWithRecipes() {
|
||||
|
||||
return serialRecipeHandlers.stream().map(handler -> {
|
||||
AsyncTaskProfiler profiler = ProfilerRecipeHandler.getProfiler();
|
||||
profiler.clearCurrent();
|
||||
profiler.start(handler.getRecipeName());
|
||||
try {
|
||||
return isHidden(handler) ? null : recipeHandlerFunction.apply(handler);
|
||||
} catch (Throwable t) {
|
||||
printLog(t);
|
||||
error = true;
|
||||
return null;
|
||||
} finally {
|
||||
profiler.end();
|
||||
}
|
||||
}).filter(h -> h != null && h.numRecipes() > 0 && SearchRecipeHandler.findFirst(h, (recipeIndex) -> true) != -1)
|
||||
.collect(Collectors.toCollection(ArrayList::new));
|
||||
@@ -77,12 +91,17 @@ class RecipeHandlerQuery<T extends IRecipeHandler> {
|
||||
private ArrayList<T> getHandlersWithRecipes() throws InterruptedException, ExecutionException {
|
||||
|
||||
return ItemList.forkJoinPool.submit(() -> recipeHandlers.parallelStream().map(handler -> {
|
||||
AsyncTaskProfiler profiler = ProfilerRecipeHandler.getProfiler();
|
||||
profiler.clearCurrent();
|
||||
profiler.start(handler.getRecipeName());
|
||||
try {
|
||||
return isHidden(handler) ? null : recipeHandlerFunction.apply(handler);
|
||||
} catch (Throwable t) {
|
||||
printLog(t);
|
||||
error = true;
|
||||
return null;
|
||||
} finally {
|
||||
profiler.end();
|
||||
}
|
||||
}).filter(h -> h != null && h.numRecipes() > 0 && SearchRecipeHandler.findFirst(h, (recipeIndex) -> true) != -1)
|
||||
.collect(Collectors.toCollection(ArrayList::new))).get();
|
||||
|
||||
@@ -4,8 +4,8 @@ import static codechicken.nei.LayoutManager.searchField;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import codechicken.nei.SearchField;
|
||||
import codechicken.nei.api.INEIGuiAdapter;
|
||||
|
||||
public class SearchInputDropHandler extends INEIGuiAdapter {
|
||||
@@ -14,14 +14,7 @@ public class SearchInputDropHandler extends INEIGuiAdapter {
|
||||
public boolean handleDragNDrop(GuiContainer gui, int mouseX, int mouseY, ItemStack draggedStack, int button) {
|
||||
|
||||
if (searchField.isVisible() && searchField.contains(mouseX, mouseY)) {
|
||||
final FluidStack fluidStack = StackInfo.getFluid(draggedStack);
|
||||
|
||||
if (fluidStack != null) {
|
||||
searchField.setText(formattingText(fluidStack.getLocalizedName()));
|
||||
} else {
|
||||
searchField.setText(formattingText(draggedStack.getDisplayName()));
|
||||
}
|
||||
|
||||
searchField.setText(SearchField.getEscapedSearchText(draggedStack));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
@@ -23,6 +22,7 @@ import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import codechicken.nei.ItemStackMap;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.api.IStackStringifyHandler;
|
||||
import codechicken.nei.recipe.stackinfo.DefaultStackStringifyHandler;
|
||||
@@ -32,7 +32,7 @@ public class StackInfo {
|
||||
|
||||
public static final ArrayList<IStackStringifyHandler> stackStringifyHandlers = new ArrayList<>();
|
||||
private static final HashMap<String, HashMap<String, String[]>> guidfilters = new HashMap<>();
|
||||
private static final WeakHashMap<ItemStack, String> guidcache = new WeakHashMap<>();
|
||||
private static final ItemStackMap<String> guidcache = new ItemStackMap<>();
|
||||
private static final LinkedHashMap<ItemStack, FluidStack> fluidcache = new LinkedHashMap<ItemStack, FluidStack>() {
|
||||
|
||||
@Override
|
||||
@@ -119,64 +119,67 @@ public class StackInfo {
|
||||
}
|
||||
|
||||
public static String getItemStackGUID(ItemStack stack) {
|
||||
if (!guidcache.containsKey(stack)) {
|
||||
String guid = guidcache.get(stack);
|
||||
|
||||
final NBTTagCompound nbTag = itemStackToNBT(stack, false);
|
||||
if (guid != null) {
|
||||
return guid;
|
||||
}
|
||||
|
||||
if (nbTag == null) {
|
||||
return null;
|
||||
}
|
||||
final NBTTagCompound nbTag = itemStackToNBT(stack, false);
|
||||
|
||||
nbTag.removeTag("Count");
|
||||
if (nbTag == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (nbTag.getShort("Damage") == 0) {
|
||||
nbTag.removeTag("Damage");
|
||||
}
|
||||
nbTag.removeTag("Count");
|
||||
|
||||
if (nbTag.hasKey("tag") && nbTag.getCompoundTag("tag").hasNoTags()) {
|
||||
nbTag.removeTag("tag");
|
||||
}
|
||||
if (nbTag.getShort("Damage") == 0) {
|
||||
nbTag.removeTag("Damage");
|
||||
}
|
||||
|
||||
if (nbTag.hasKey("strId") && guidfilters.containsKey(nbTag.getString("strId"))) {
|
||||
final ArrayList<String> keys = new ArrayList<>();
|
||||
final String strId = nbTag.getString("strId");
|
||||
if (nbTag.hasKey("tag") && nbTag.getCompoundTag("tag").hasNoTags()) {
|
||||
nbTag.removeTag("tag");
|
||||
}
|
||||
|
||||
keys.add(strId);
|
||||
if (nbTag.hasKey("strId") && guidfilters.containsKey(nbTag.getString("strId"))) {
|
||||
final ArrayList<String> keys = new ArrayList<>();
|
||||
final String strId = nbTag.getString("strId");
|
||||
|
||||
guidfilters.get(strId).forEach((key, rule) -> {
|
||||
Object local = nbTag;
|
||||
keys.add(strId);
|
||||
|
||||
for (int i = 0; i < rule.length; i++) {
|
||||
guidfilters.get(strId).forEach((key, rule) -> {
|
||||
Object local = nbTag;
|
||||
|
||||
try {
|
||||
for (int i = 0; i < rule.length; i++) {
|
||||
|
||||
if (local instanceof NBTTagCompound) {
|
||||
local = ((NBTTagCompound) local).getTag(rule[i]);
|
||||
} else if (local instanceof NBTTagList) {
|
||||
local = ((NBTTagList) local).tagList.get(Integer.parseInt(rule[i]));
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
try {
|
||||
|
||||
} catch (Throwable e) {
|
||||
if (local instanceof NBTTagCompound) {
|
||||
local = ((NBTTagCompound) local).getTag(rule[i]);
|
||||
} else if (local instanceof NBTTagList) {
|
||||
local = ((NBTTagList) local).tagList.get(Integer.parseInt(rule[i]));
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (local instanceof NBTBase) {
|
||||
keys.add(((NBTBase) local).toString());
|
||||
} else if (local != null) {
|
||||
keys.add(String.valueOf(local));
|
||||
} catch (Throwable e) {
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
synchronized (guidcache) {
|
||||
guidcache.put(stack, keys.toString());
|
||||
}
|
||||
} else {
|
||||
synchronized (guidcache) {
|
||||
guidcache.put(stack, nbTag.toString());
|
||||
if (local instanceof NBTBase) {
|
||||
keys.add(((NBTBase) local).toString());
|
||||
} else if (local != null) {
|
||||
keys.add(String.valueOf(local));
|
||||
}
|
||||
});
|
||||
|
||||
synchronized (guidcache) {
|
||||
guidcache.put(stack, keys.toString());
|
||||
}
|
||||
} else {
|
||||
synchronized (guidcache) {
|
||||
guidcache.put(stack, nbTag.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,11 +35,11 @@ import com.google.common.base.Stopwatch;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.ItemList;
|
||||
import codechicken.nei.ItemList.AllMultiItemFilter;
|
||||
import codechicken.nei.LayoutManager;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.PresetsList;
|
||||
import codechicken.nei.api.DefaultOverlayRenderer;
|
||||
import codechicken.nei.api.IOverlayHandler;
|
||||
import codechicken.nei.api.IRecipeOverlayRenderer;
|
||||
@@ -197,7 +197,7 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
|
||||
return ingredients;
|
||||
}
|
||||
|
||||
protected void randomRenderPermutation(List<PositionedStack> stacks, long cycle) {
|
||||
public void randomRenderPermutation(List<PositionedStack> stacks, long cycle) {
|
||||
final ItemFilter filter = getItemFilter();
|
||||
final int randCycle = Math.abs(new Random(cycle + offset).nextInt());
|
||||
|
||||
@@ -228,7 +228,7 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
protected void randomRenderPermutation(PositionedStack stack, long cycle) {
|
||||
public void randomRenderPermutation(PositionedStack stack, long cycle) {
|
||||
Random rand = new Random(cycle + offset);
|
||||
stack.setPermutationToRender((int) (Math.abs(rand.nextInt()) % stack.items.length));
|
||||
}
|
||||
@@ -433,7 +433,7 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
|
||||
protected static ItemFilter getItemFilter() {
|
||||
return new AllMultiItemFilter(
|
||||
item -> !ItemInfo.hiddenItems.contains(item),
|
||||
LayoutManager.presetsPanel != null ? LayoutManager.presetsPanel.getFilter() : null,
|
||||
PresetsList.getItemFilter(),
|
||||
GuiRecipe.searchField != null ? GuiRecipe.searchField.getFilter() : null);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package codechicken.nei.search;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import codechicken.nei.api.ItemFilter;
|
||||
import cpw.mods.fml.common.registry.GameData;
|
||||
|
||||
public class IdentifierFilter implements ItemFilter {
|
||||
|
||||
private final Pattern pattern;
|
||||
|
||||
public IdentifierFilter(Pattern pattern) {
|
||||
this.pattern = pattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(ItemStack stack) {
|
||||
return this.pattern.matcher(getStringIdentifier(stack) + "\n" + getIdentifier(stack)).find();
|
||||
}
|
||||
|
||||
protected String getIdentifier(ItemStack stack) {
|
||||
return Item.getIdFromItem(stack.getItem()) + ":" + stack.getItemDamage();
|
||||
}
|
||||
|
||||
protected String getStringIdentifier(ItemStack stack) {
|
||||
String name = GameData.getItemRegistry().getNameForObject(stack.getItem());
|
||||
return name == null || name.isEmpty() ? "Unknown:Unknown" : name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package codechicken.nei.search;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.api.ItemFilter;
|
||||
import codechicken.nei.api.ItemInfo;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier;
|
||||
|
||||
public class ModNameFilter implements ItemFilter {
|
||||
|
||||
private final Pattern pattern;
|
||||
|
||||
public ModNameFilter(Pattern pattern) {
|
||||
this.pattern = pattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(ItemStack itemStack) {
|
||||
return this.pattern.matcher(nameFromStack(itemStack.getItem())).find();
|
||||
}
|
||||
|
||||
protected static String nameFromStack(Item item) {
|
||||
try {
|
||||
ModContainer mod = Loader.instance().getIndexedModList().get(getModId(item));
|
||||
return mod == null ? "Minecraft" : mod.getName();
|
||||
} catch (NullPointerException e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
protected static String getModId(Item item) {
|
||||
|
||||
if (!ItemInfo.itemOwners.containsKey(item)) {
|
||||
try {
|
||||
UniqueIdentifier ident = GameRegistry.findUniqueIdentifierFor(item);
|
||||
ItemInfo.itemOwners.put(item, ident.modId);
|
||||
} catch (Exception ignored) {
|
||||
NEIClientConfig.logger.error("Failed to find identifier for: " + item);
|
||||
ItemInfo.itemOwners.put(item, "Unknown");
|
||||
}
|
||||
}
|
||||
|
||||
return ItemInfo.itemOwners.get(item);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package codechicken.nei.search;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import codechicken.nei.api.ItemFilter;
|
||||
|
||||
public class OreDictionaryFilter implements ItemFilter {
|
||||
|
||||
private final Pattern pattern;
|
||||
|
||||
public OreDictionaryFilter(Pattern pattern) {
|
||||
this.pattern = pattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(ItemStack stack) {
|
||||
return IntStream.of(OreDictionary.getOreIDs(stack))
|
||||
.anyMatch(id -> this.pattern.matcher(OreDictionary.getOreName(id)).find());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package codechicken.nei.search;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.StringJoiner;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import codechicken.nei.ItemList;
|
||||
import codechicken.nei.api.ItemFilter;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
|
||||
public class TooltipFilter implements ItemFilter {
|
||||
|
||||
// lookup optimisation
|
||||
private static final ConcurrentHashMap<ItemStackKey, String> itemSearchNames = new ConcurrentHashMap<>();
|
||||
|
||||
private static class ItemStackKey {
|
||||
|
||||
public final ItemStack stack;
|
||||
|
||||
public ItemStackKey(ItemStack stack) {
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
if (this.stack == null) return 1;
|
||||
int hashCode = 1;
|
||||
hashCode = 31 * hashCode + stack.stackSize;
|
||||
hashCode = 31 * hashCode + Item.getIdFromItem(stack.getItem());
|
||||
hashCode = 31 * hashCode + stack.getItemDamage();
|
||||
hashCode = 31 * hashCode + (!stack.hasTagCompound() ? 0 : stack.getTagCompound().hashCode());
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o == this) return true;
|
||||
if (!(o instanceof ItemStackKey)) return false;
|
||||
return ItemStack.areItemStacksEqual(this.stack, ((ItemStackKey) o).stack);
|
||||
}
|
||||
}
|
||||
|
||||
private final Pattern pattern;
|
||||
|
||||
public TooltipFilter(Pattern pattern) {
|
||||
this.pattern = pattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(ItemStack itemStack) {
|
||||
return pattern.matcher(getSearchTooltip(itemStack)).find();
|
||||
}
|
||||
|
||||
public static void populateSearchMap() {
|
||||
/* Create a snapshot of the current keys in the cache */
|
||||
HashSet<ItemStackKey> oldItems = new HashSet<>(itemSearchNames.keySet());
|
||||
|
||||
for (ItemStack stack : ItemList.items) {
|
||||
oldItems.remove(new ItemStackKey(stack));
|
||||
}
|
||||
|
||||
itemSearchNames.keySet().removeAll(oldItems);
|
||||
}
|
||||
|
||||
protected static String getSearchTooltip(ItemStack stack) {
|
||||
return itemSearchNames.computeIfAbsent(new ItemStackKey(stack), key -> getTooltip(key.stack));
|
||||
}
|
||||
|
||||
private static String getTooltip(ItemStack itemstack) {
|
||||
final List<String> list = GuiContainerManager.itemDisplayNameMultiline(itemstack, null, true);
|
||||
final StringJoiner sb = new StringJoiner("\n");
|
||||
final int size = list.size();
|
||||
|
||||
for (int i = 1; i < size; i++) {
|
||||
sb.add(list.get(i));
|
||||
}
|
||||
|
||||
return EnumChatFormatting.getTextWithoutFormattingCodes(sb.toString());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package codechicken.nei.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import codechicken.core.TaskProfiler;
|
||||
|
||||
public class AsyncTaskProfiler extends TaskProfiler {
|
||||
|
||||
public ThreadLocal<TaskProfiler> threadedProfiler = ThreadLocal.withInitial(TaskProfiler::new);
|
||||
|
||||
public Map<String, Long> times = new ConcurrentHashMap<>();
|
||||
|
||||
@Override
|
||||
public void start(String section) {
|
||||
if (section == null) section = "<unnamed>";
|
||||
threadedProfiler.get().start(section);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void end() {
|
||||
TaskProfiler profiler = threadedProfiler.get();
|
||||
if (profiler != null) {
|
||||
profiler.end();
|
||||
if (profiler.times != null && !profiler.times.isEmpty()) {
|
||||
times.putAll(threadedProfiler.get().times);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProfilerResult> getResults() {
|
||||
ArrayList<ProfilerResult> results = new ArrayList<>(times.size());
|
||||
long totalTime = times.values().stream().reduce(0L, Long::sum);
|
||||
for (Entry<String, Long> e : times.entrySet())
|
||||
results.add(new ProfilerResult(e.getKey(), e.getValue(), totalTime));
|
||||
return results;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
if (threadedProfiler.get().currentSection != null) threadedProfiler.get().end();
|
||||
threadedProfiler.get().clear();
|
||||
times.clear();
|
||||
}
|
||||
|
||||
public void clearCurrent() {
|
||||
if (threadedProfiler.get().currentSection != null) threadedProfiler.get().end();
|
||||
threadedProfiler.get().clear();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
# Collapsible Items Filters
|
||||
#
|
||||
# One line - one group
|
||||
# Item added in first valid group
|
||||
# | - logical or. multi-item search (wrench|hammer)
|
||||
# $ - search by ore dictionary ($ore)
|
||||
# ! - logical not. exclude items that match the following expression (-@minecraft)
|
||||
# r/.../ - standard java regex (@r/m\w{6}ft/ = @minecraft)
|
||||
# 0 - damage filter
|
||||
# 0-12 - damage range filter
|
||||
# , - logical or in token
|
||||
#
|
||||
#
|
||||
minecraft:spawn_egg
|
||||
minecraft:mob_spawner
|
||||
minecraft:record_
|
||||
#splash
|
||||
minecraft:potion >16000
|
||||
#lingering
|
||||
minecraft:potion >8000 <9000
|
||||
@@ -0,0 +1,5 @@
|
||||
# Each line in this file should either be a comment (line starts with '#'), or a prefix of a fully-qualified class name
|
||||
# (that includes the package name) for a Minecraft GUI Container screen.
|
||||
# If you delete this file, it will be regenerated with the default enable autofocus list.
|
||||
net.minecraft.client.gui.inventory.GuiInventory
|
||||
makamys.satchels.gui.GuiSatchelsInventory
|
||||
@@ -10,6 +10,7 @@ ic2.neiIntegration.core.recipehandler.*
|
||||
mariculture.plugins.nei.*
|
||||
redgear.brewcraft.plugins.nei.*
|
||||
tconstruct.plugins.nei.*
|
||||
tonius.neiintegration.mods.railcraft.*
|
||||
WayofTime.alchemicalWizardry.client.nei.*
|
||||
exnihilo.compatibility.nei.*
|
||||
blusunrize.immersiveengineering.client.nei.*
|
||||
@@ -96,10 +96,10 @@ nei.options.inventory.itemIDs=IDčka předmětů
|
||||
nei.options.inventory.itemIDs.0=Skryté
|
||||
nei.options.inventory.itemIDs.1=Automatické
|
||||
nei.options.inventory.itemIDs.2=Zobrazené
|
||||
nei.options.inventory.searchmode=Vyhledavací mód
|
||||
nei.options.inventory.searchmode.0=Prostý
|
||||
nei.options.inventory.searchmode.1=Rozšířený
|
||||
nei.options.inventory.searchmode.2=Regexy
|
||||
nei.options.inventory.search.patternMode=Vyhledavací mód
|
||||
nei.options.inventory.search.patternMode.0=Prostý
|
||||
nei.options.inventory.search.patternMode.1=Rozšířený
|
||||
nei.options.inventory.search.patternMode.2=Regexy
|
||||
nei.options.inventory.utilities=Nástroje
|
||||
nei.options.inventory.utilities.tip=Vyber doplňky pro mód nástrojů
|
||||
nei.options.inventory.utilities.time=Čas
|
||||
|
||||
@@ -100,10 +100,10 @@ nei.options.inventory.itemIDs=Item-IDs
|
||||
nei.options.inventory.itemIDs.0=Versteckt
|
||||
nei.options.inventory.itemIDs.1=Auto
|
||||
nei.options.inventory.itemIDs.2=Gezeigt
|
||||
nei.options.inventory.searchmode=Suchmodus
|
||||
nei.options.inventory.searchmode.0=Gewöhnlich
|
||||
nei.options.inventory.searchmode.1=Erweitert
|
||||
nei.options.inventory.searchmode.2=Regex
|
||||
nei.options.inventory.search.patternMode=Suchmodus
|
||||
nei.options.inventory.search.patternMode.0=Gewöhnlich
|
||||
nei.options.inventory.search.patternMode.1=Erweitert
|
||||
nei.options.inventory.search.patternMode.2=Regex
|
||||
nei.options.inventory.utilities=Nützliches
|
||||
nei.options.inventory.utilities.tip=Wähle Inhalte für den Mehrzweckmodus
|
||||
nei.options.inventory.utilities.time=Zeit
|
||||
|
||||
@@ -13,6 +13,9 @@ nei.bookmark.pullBookmarkedItems.tip=Pull all bookmarked items from storage to i
|
||||
|
||||
nei.itempanel.quantity.default=One stack
|
||||
nei.itempanel.loading=Loading Item List...
|
||||
nei.itempanel.collapsed.button.tip=Toggle Groups
|
||||
nei.itempanel.collapsed.hint.expand=Alt-Click to expand (%d items)
|
||||
nei.itempanel.collapsed.hint.collapse=Alt-Click to collapse (%d items)
|
||||
|
||||
nei.enchant=Enchant
|
||||
nei.enchant.level=Level
|
||||
@@ -85,6 +88,7 @@ nei.chat.chunkoverlay.3=Chunk Overlay: GT Ore Veins
|
||||
|
||||
nei.options=NEI Options
|
||||
nei.options.back=Back
|
||||
nei.options.save=Save
|
||||
nei.options.world=World
|
||||
nei.options.global=Global
|
||||
nei.options.global.tip.0=Options apply to all worlds
|
||||
@@ -176,9 +180,43 @@ nei.options.inventory.showRecipeMarker.false=No
|
||||
nei.options.inventory.showItemQuantityWidget=Show Item Quantity Widget
|
||||
nei.options.inventory.showItemQuantityWidget.true=Yes
|
||||
nei.options.inventory.showItemQuantityWidget.false=No
|
||||
nei.options.inventory.centerSearchWidget=Center Search Widget
|
||||
nei.options.inventory.centerSearchWidget.true=Yes
|
||||
nei.options.inventory.centerSearchWidget.false=No
|
||||
nei.options.inventory.search=Search Widget
|
||||
nei.options.inventory.search.widgetPosition=Widget Position
|
||||
nei.options.inventory.search.widgetPosition.true=Center
|
||||
nei.options.inventory.search.widgetPosition.false=Right
|
||||
nei.options.inventory.search.widgetAutofocus=Autofocus
|
||||
nei.options.inventory.search.widgetAutofocus.true=Yes
|
||||
nei.options.inventory.search.widgetAutofocus.false=No
|
||||
nei.options.inventory.search.patternMode=Search Mode
|
||||
nei.options.inventory.search.patternMode.0=Plain
|
||||
nei.options.inventory.search.patternMode.1=Extended
|
||||
nei.options.inventory.search.patternMode.2=Regex
|
||||
nei.options.inventory.search.quoteDropItemName=Quote Drop Item Name
|
||||
nei.options.inventory.search.quoteDropItemName.true=Yes
|
||||
nei.options.inventory.search.quoteDropItemName.false=No
|
||||
nei.options.inventory.search.modNameSearchMode=Mod Name Search
|
||||
nei.options.inventory.search.modNameSearchMode.0=Always
|
||||
nei.options.inventory.search.modNameSearchMode.1=Prefix: %s
|
||||
nei.options.inventory.search.modNameSearchMode.2=Never
|
||||
nei.options.inventory.search.tooltipSearchMode=Tooltip Search
|
||||
nei.options.inventory.search.tooltipSearchMode.0=Always
|
||||
nei.options.inventory.search.tooltipSearchMode.1=Prefix: %s
|
||||
nei.options.inventory.search.tooltipSearchMode.2=Never
|
||||
nei.options.inventory.search.identifierSearchMode=Resource ID Search
|
||||
nei.options.inventory.search.identifierSearchMode.0=Always
|
||||
nei.options.inventory.search.identifierSearchMode.1=Prefix: %s
|
||||
nei.options.inventory.search.identifierSearchMode.2=Never
|
||||
nei.options.inventory.search.oreDictSearchMode=OreDict Search
|
||||
nei.options.inventory.search.oreDictSearchMode.0=Always
|
||||
nei.options.inventory.search.oreDictSearchMode.1=Prefix: %s
|
||||
nei.options.inventory.search.oreDictSearchMode.2=Never
|
||||
nei.options.inventory.search.subsetsSearchMode=Item Subsets Search
|
||||
nei.options.inventory.search.subsetsSearchMode.0=Always
|
||||
nei.options.inventory.search.subsetsSearchMode.1=Prefix: %s
|
||||
nei.options.inventory.search.subsetsSearchMode.2=Never
|
||||
nei.options.inventory.firstInvCloseClosesInSearch=First Inventory Close Closes in Search
|
||||
nei.options.inventory.firstInvCloseClosesInSearch.true=Yes
|
||||
nei.options.inventory.firstInvCloseClosesInSearch.false=No
|
||||
nei.options.inventory.creative_tab_style=Creative or JEI tab style
|
||||
nei.options.inventory.creative_tab_style.true=Creative
|
||||
nei.options.inventory.creative_tab_style.false=JEI
|
||||
@@ -207,10 +245,6 @@ nei.options.inventory.itemIDs=Item IDs
|
||||
nei.options.inventory.itemIDs.0=Hidden
|
||||
nei.options.inventory.itemIDs.1=Auto
|
||||
nei.options.inventory.itemIDs.2=Shown
|
||||
nei.options.inventory.searchmode=Search Mode
|
||||
nei.options.inventory.searchmode.0=Plain
|
||||
nei.options.inventory.searchmode.1=Extended
|
||||
nei.options.inventory.searchmode.2=Regex
|
||||
nei.options.inventory.utilities=Utilities
|
||||
nei.options.inventory.utilities.tip=Select features for utility mode
|
||||
nei.options.inventory.utilities.time=Time
|
||||
@@ -236,6 +270,14 @@ nei.options.inventory.invertMouseScrollTransfer.false=False
|
||||
nei.options.inventory.cacheItemRendering=Cache Item Rendering
|
||||
nei.options.inventory.cacheItemRendering.true=True
|
||||
nei.options.inventory.cacheItemRendering.false=False
|
||||
nei.options.inventory.collapsibleItems=Collapsible Items
|
||||
nei.options.inventory.collapsibleItems.enabled=Collapsible Items
|
||||
nei.options.inventory.collapsibleItems.enabled.true=Enabled
|
||||
nei.options.inventory.collapsibleItems.enabled.false=Disabled
|
||||
nei.options.inventory.collapsibleItems.expandedColor=Expanded Color
|
||||
nei.options.inventory.collapsibleItems.collapsedColor=Collapsed Color
|
||||
nei.options.inventory.collapsibleItems.reloadLabel=Reload
|
||||
nei.options.inventory.collapsibleItems.reloadButton=Run
|
||||
nei.options.inventory.history=History Panel
|
||||
nei.options.inventory.history.enabled=History Panel Visibility
|
||||
nei.options.inventory.history.enabled.true=Enabled
|
||||
@@ -264,6 +306,7 @@ nei.options.world.highlight_tips.show=Shown
|
||||
nei.options.world.highlight_tips.sample=Sample
|
||||
|
||||
nei.options.world.panels=Panels Settings
|
||||
nei.options.world.presets=Presets List
|
||||
|
||||
nei.options.tools=Tools
|
||||
nei.options.tools.handler_load_from_config=Load handlers from Config
|
||||
@@ -321,6 +364,8 @@ nei.recipe.firework.tooltip2=Multiple charges can be spawned from one rocket
|
||||
nei.recipe.brewing=Brewing
|
||||
nei.recipe.profiler.crafting=Crafting Profiling
|
||||
nei.recipe.profiler.usage=Usage Profiling
|
||||
nei.recipe.concurrent.usage=Concurrent Usage - Total
|
||||
nei.recipe.concurrent.crafting=Concurrent Crafting - Total
|
||||
|
||||
nei.itemsort.minecraft=Minecraft
|
||||
nei.itemsort.minecraft.tip=Sorts items from vanilla minecraft first
|
||||
@@ -359,13 +404,20 @@ nei.subsets.Items.Weapons.Ranged=Ranged
|
||||
nei.subsets.Items.Weapons.Swords=Swords
|
||||
nei.subsets.Mod=Mod
|
||||
|
||||
nei.presets.blacklist.label=B
|
||||
nei.presets.blacklist.tooltip=Blacklist
|
||||
nei.presets.whitelist.label=W
|
||||
nei.presets.whitelist.tooltip=Whitelist
|
||||
nei.presets.blacklistPlus.label=B+
|
||||
nei.presets.blacklistPlus.tooltip=Blacklist Plus
|
||||
nei.presets.textfield.tooltip.1=Enter - save
|
||||
nei.presets.textfield.tooltip.2=Escape - cancel
|
||||
nei.presets.label.tooltip=Double click to edit
|
||||
nei.presets.label.selected=%s Presets
|
||||
nei.presets.new=New Preset
|
||||
nei.presets.create=Create Preset
|
||||
nei.presets.update=Update Preset
|
||||
nei.presets.enabled=Enabled
|
||||
nei.presets.filter=F
|
||||
nei.presets.filter.tip=Hide items from another active presets
|
||||
nei.presets.name=Preset Name
|
||||
nei.presets.mode=Mode
|
||||
nei.presets.mode.hide=Hide
|
||||
nei.presets.mode.hide.char=H
|
||||
nei.presets.mode.hide.tip=Hide items in panel
|
||||
nei.presets.mode.remove=Remove
|
||||
nei.presets.mode.remove.tip=Hide items in panel and it recipes
|
||||
nei.presets.mode.remove.char=R
|
||||
nei.presets.mode.group=Group
|
||||
nei.presets.mode.group.tip=Create custom collapsible items group
|
||||
nei.presets.mode.group.char=G
|
||||
@@ -99,10 +99,10 @@ nei.options.inventory.itemIDs=Asja ID-d
|
||||
nei.options.inventory.itemIDs.0=Peidetud
|
||||
nei.options.inventory.itemIDs.1=Auto
|
||||
nei.options.inventory.itemIDs.2=Näidatud
|
||||
nei.options.inventory.searchmode=Otsimis mood
|
||||
nei.options.inventory.searchmode.0=Plain
|
||||
nei.options.inventory.searchmode.1=Extended
|
||||
nei.options.inventory.searchmode.2=Regex
|
||||
nei.options.inventory.search.patternMode=Otsimis mood
|
||||
nei.options.inventory.search.patternMode.0=Plain
|
||||
nei.options.inventory.search.patternMode.1=Extended
|
||||
nei.options.inventory.search.patternMode.2=Regex
|
||||
nei.options.inventory.utilities=Utiliidid
|
||||
nei.options.inventory.utilities.tip=Vali funktsioonid utiliidi moodi jaoks
|
||||
nei.options.inventory.utilities.time=Aeg
|
||||
|
||||
@@ -97,10 +97,10 @@ nei.options.inventory.itemIDs=Objet IDs
|
||||
nei.options.inventory.itemIDs.0=Cachés
|
||||
nei.options.inventory.itemIDs.1=Auto
|
||||
nei.options.inventory.itemIDs.2=Montrés
|
||||
nei.options.inventory.searchmode=Mode de recherche
|
||||
nei.options.inventory.searchmode.0=Simple
|
||||
nei.options.inventory.searchmode.1=Avancé
|
||||
nei.options.inventory.searchmode.2=Expression rationnelle
|
||||
nei.options.inventory.search.patternMode=Mode de recherche
|
||||
nei.options.inventory.search.patternMode.0=Simple
|
||||
nei.options.inventory.search.patternMode.1=Avancé
|
||||
nei.options.inventory.search.patternMode.2=Expression rationnelle
|
||||
nei.options.inventory.utilities=Utilitaires
|
||||
nei.options.inventory.utilities.tip=Sélectionnez les fonctions pour le mode utilitaire
|
||||
nei.options.inventory.utilities.time=Heure
|
||||
|
||||
@@ -100,10 +100,10 @@ nei.options.inventory.itemIDs=ID degli oggetti
|
||||
nei.options.inventory.itemIDs.0=Nascosti
|
||||
nei.options.inventory.itemIDs.1=Auto
|
||||
nei.options.inventory.itemIDs.2=Mostrati
|
||||
nei.options.inventory.searchmode=Modalità di ricerca
|
||||
nei.options.inventory.searchmode.0=Piatto
|
||||
nei.options.inventory.searchmode.1=Esteso
|
||||
nei.options.inventory.searchmode.2=Regex
|
||||
nei.options.inventory.search.patternMode=Modalità di ricerca
|
||||
nei.options.inventory.search.patternMode.0=Piatto
|
||||
nei.options.inventory.search.patternMode.1=Esteso
|
||||
nei.options.inventory.search.patternMode.2=Regex
|
||||
nei.options.inventory.utilities=Utilità
|
||||
nei.options.inventory.utilities.tip=Seleziona funzioni per modalità utilità
|
||||
nei.options.inventory.utilities.time=Tempo
|
||||
@@ -219,4 +219,4 @@ nei.subsets.Items.Tools.Shovels=Pale
|
||||
nei.subsets.Items.Weapons=Armi
|
||||
nei.subsets.Items.Weapons.Ranged=Da lancio
|
||||
nei.subsets.Items.Weapons.Swords=Spade
|
||||
nei.subsets.Mod=Mod
|
||||
nei.subsets.Mod=Mod
|
||||
@@ -95,10 +95,10 @@ nei.options.inventory.itemIDs=아이템 ID
|
||||
nei.options.inventory.itemIDs.0= 숨기기
|
||||
nei.options.inventory.itemIDs.1=자동
|
||||
nei.options.inventory.itemIDs.2=보이기
|
||||
nei.options.inventory.searchmode=검색모드
|
||||
nei.options.inventory.searchmode.0=모두
|
||||
nei.options.inventory.searchmode.1=확장
|
||||
nei.options.inventory.searchmode.2=정규표현식
|
||||
nei.options.inventory.search.patternMode=검색모드
|
||||
nei.options.inventory.search.patternMode.0=모두
|
||||
nei.options.inventory.search.patternMode.1=확장
|
||||
nei.options.inventory.search.patternMode.2=정규표현식
|
||||
nei.options.inventory.utilities=유틸리티
|
||||
nei.options.inventory.utilities.tip=유틸리티 모드기능을 선택
|
||||
nei.options.inventory.utilities.time=시간
|
||||
|
||||
@@ -97,10 +97,10 @@ nei.options.inventory.itemIDs=ID przedmiotów
|
||||
nei.options.inventory.itemIDs.0=Ukryte
|
||||
nei.options.inventory.itemIDs.1=Automatyczne
|
||||
nei.options.inventory.itemIDs.2=Pokazane
|
||||
nei.options.inventory.searchmode=Tryb wyszukiwania
|
||||
nei.options.inventory.searchmode.0=Prosty
|
||||
nei.options.inventory.searchmode.1=Rozszerzony
|
||||
nei.options.inventory.searchmode.2=Wyrażenia regularne
|
||||
nei.options.inventory.search.patternMode=Tryb wyszukiwania
|
||||
nei.options.inventory.search.patternMode.0=Prosty
|
||||
nei.options.inventory.search.patternMode.1=Rozszerzony
|
||||
nei.options.inventory.search.patternMode.2=Wyrażenia regularne
|
||||
nei.options.inventory.utilities=Narzędzia
|
||||
nei.options.inventory.utilities.tip=Wybierz cechy trybu użytkowego
|
||||
nei.options.inventory.utilities.time=Czas
|
||||
|
||||
@@ -97,10 +97,10 @@ nei.options.inventory.itemIDs=IDs de Itens
|
||||
nei.options.inventory.itemIDs.0=Escondido
|
||||
nei.options.inventory.itemIDs.1=Auto
|
||||
nei.options.inventory.itemIDs.2=Mostrado
|
||||
nei.options.inventory.searchmode=Modo de Pesquisa
|
||||
nei.options.inventory.searchmode.0=Plano
|
||||
nei.options.inventory.searchmode.1=Extendido
|
||||
nei.options.inventory.searchmode.2=Regex
|
||||
nei.options.inventory.search.patternMode=Modo de Pesquisa
|
||||
nei.options.inventory.search.patternMode.0=Plano
|
||||
nei.options.inventory.search.patternMode.1=Extendido
|
||||
nei.options.inventory.search.patternMode.2=Regex
|
||||
nei.options.inventory.utilities=Utilidades
|
||||
nei.options.inventory.utilities.tip=Selecionar funções para o modo utilidade
|
||||
nei.options.inventory.utilities.time=Tempo
|
||||
|
||||
@@ -1,147 +1,375 @@
|
||||
nei.load=Загрузить
|
||||
nei.save=Сохранить
|
||||
|
||||
nei.enchant=Зачаровывание
|
||||
# Клавиша управления для ПК/Linux
|
||||
nei.key.ctrl=CTRL
|
||||
# Клавиша Command для Mac
|
||||
nei.key.ctrl.mac=CMD
|
||||
nei.showHotkeys=Удерживайте %s для отображения горячих клавиш
|
||||
|
||||
nei.bookmark.toggle=Закладки
|
||||
nei.bookmark.toggle.tip=Переключить видимость панели закладок
|
||||
nei.bookmark.pullBookmarkedItems.tip=Переместить все отмеченные предметы из хранилища в инвентарь
|
||||
|
||||
nei.bookmark.group=Группа закладок
|
||||
nei.bookmark.group.include_group=Создать/Включить группу
|
||||
nei.bookmark.group.include_group.key=ЛКМ + Перетаскивание
|
||||
nei.bookmark.group.exclude_group=Удалить/Исключить группу
|
||||
nei.bookmark.group.exclude_group.key=ПКМ + Перетаскивание
|
||||
nei.bookmark.group.toggle_mode=Переключить режим группы
|
||||
nei.bookmark.group.toggle_mode.key=Левый клик
|
||||
nei.bookmark.group.toggle_crafting_chain=Переключить цепочку крафта
|
||||
nei.bookmark.group.toggle_crafting_chain.key=Правый клик
|
||||
nei.bookmark.group.sorting=Сортировка
|
||||
nei.bookmark.group.sorting.key=SHIFT + ЛКМ + Перетаскивание
|
||||
nei.bookmark.group.remove_recipe=Удалить группу
|
||||
nei.bookmark.group.pull_items=Переместить все предметы
|
||||
nei.bookmark.group.pull_items_ingredients=Переместить все ингредиенты
|
||||
nei.bookmark.crafting_chain=Цепочка крафта
|
||||
nei.bookmark.crafting_chain.input=Ингредиенты
|
||||
nei.bookmark.crafting_chain.output=Результаты
|
||||
nei.bookmark.crafting_chain.remainder=Остатки
|
||||
|
||||
nei.itempanel.quantity.default=Одна стопка
|
||||
nei.itempanel.loading=Загрузка списка предметов...
|
||||
nei.itempanel.deleteItem=Удалить предмет
|
||||
nei.itempanel.collapsed.button.tip=Свернуть/Развернуть все группы предметов
|
||||
nei.itempanel.collapsed.hint.expand=Alt-Клик для разворачивания (%d предметов)
|
||||
nei.itempanel.collapsed.hint.collapse=Alt-Клик для сворачивания (%d предметов)
|
||||
|
||||
nei.enchant=Зачаровать
|
||||
nei.enchant.level=Уровень
|
||||
nei.enchant.locked=Открытые
|
||||
nei.enchant.unlocked=Закрытые
|
||||
nei.enchant.locked=Заблокировано
|
||||
nei.enchant.unlocked=Разблокировано
|
||||
|
||||
nei.potion.favourite=Любимые зелья
|
||||
nei.potion.duration=Длительность
|
||||
nei.potion.level=Уровень
|
||||
|
||||
nei.inventory.options=Опции
|
||||
nei.inventory.prev=Предыдущая
|
||||
nei.inventory.next=Следующая
|
||||
nei.inventory.options=Настройки
|
||||
nei.inventory.options.tip=Конфигурация NEI
|
||||
nei.inventory.options.tip.cheatmode.0=Режим рецептов
|
||||
nei.inventory.options.tip.cheatmode.1=Утилитарный режим
|
||||
nei.inventory.options.tip.cheatmode.2=Режим читов
|
||||
nei.inventory.options.tip.cheatmode.disable=%s-клик здесь для переключения между режимами рецептов, утилитарным и читами.
|
||||
nei.inventory.prev=Предыдущий
|
||||
nei.inventory.next=Следующий
|
||||
nei.inventory.item_subsets=Подмножества предметов
|
||||
nei.inventory.delete.inv=УДАЛИТЬ ВСЕ ПРЕДМЕТЫ с текущего экрана инвентаря
|
||||
nei.inventory.delete.one=Удалить %s
|
||||
nei.inventory.delete.all=Удалить ВСЕ %s
|
||||
nei.inventory.delete.enable=Режим удаления
|
||||
nei.inventory.delete.enable=Включить режим удаления
|
||||
nei.inventory.delete.1=Включить режим удаления
|
||||
nei.inventory.delete.0=Выключить режим удаления
|
||||
nei.inventory.rain.enable=Дождь
|
||||
nei.inventory.rain.enable=Включить дождь
|
||||
nei.inventory.rain.1=Включить дождь
|
||||
nei.inventory.rain.0=Выключить дождь
|
||||
nei.inventory.magnet.enable=Режим магнита
|
||||
nei.inventory.magnet.enable=Включить режим магнита
|
||||
nei.inventory.magnet.1=Включить режим магнита
|
||||
nei.inventory.magnet.0=Выключить режим магнита
|
||||
nei.inventory.dawn.enable=Включить рассвет-полдень
|
||||
nei.inventory.dawn.disable=ПКМ: Отключить фазу рассвет-полдень
|
||||
nei.inventory.dawn.set=Установить время на рассвет
|
||||
nei.inventory.noon.enable=Включить полдень-сумерки
|
||||
nei.inventory.noon.disable=ПКМ: Отключить фазу полдень-сумерки
|
||||
nei.inventory.noon.set=Установить время на полдень
|
||||
nei.inventory.dusk.enable=Включить сумерки-полночь
|
||||
nei.inventory.dusk.disable=ПКМ: Отключить фазу сумерки-полночь
|
||||
nei.inventory.dusk.set=Установить время на сумерки
|
||||
nei.inventory.midnight.enable=Включить полночь-рассвет
|
||||
nei.inventory.midnight.disable=ПКМ: Отключить фазу полночь-рассвет
|
||||
nei.inventory.midnight.set=Установить время на полночь
|
||||
nei.inventory.heal=Исцелить игрока
|
||||
nei.inventory.gamemode.0=Установить игровой режим на выживание
|
||||
nei.inventory.gamemode.1=Установить игровой режим на творческий
|
||||
nei.inventory.gamemode.2=Установить игровой режим на творческий+
|
||||
nei.inventory.gamemode.3=Установить игровой режим на приключение
|
||||
nei.inventory.heal=Вылечить игрока
|
||||
nei.inventory.current.gamemode.0=Текущий режим игры: выживание
|
||||
nei.inventory.current.gamemode.1=Текущий режим игры: творческий
|
||||
nei.inventory.current.gamemode.2=Текущий режим игры: творческий+
|
||||
nei.inventory.current.gamemode.3=Текущий режим игры: приключение
|
||||
nei.inventory.tooltip.page=Страница: %s / %s [Нажмите %s для перехода на следующую страницу]
|
||||
|
||||
nei.chat.gamemode.0=Теперь Вы играете в режиме выживание
|
||||
nei.chat.gamemode.1=Теперь Вы играете в режиме творчество
|
||||
nei.chat.gamemode.2=Теперь Вы играете в режиме творчество+
|
||||
nei.chat.gamemode.3=Теперь Вы играете в режиме приключение
|
||||
nei.chat.rain.on=Дождь включён
|
||||
nei.inventory.gamemode.0=Клик: Установить режим игры на выживание
|
||||
nei.inventory.gamemode.1=Клик: Установить режим игры на творческий
|
||||
nei.inventory.gamemode.2=Клик: Установить режим игры на творческий+
|
||||
nei.inventory.gamemode.3=Клик: Установить режим игры на приключение
|
||||
|
||||
nei.chat.gamemode.0=Теперь вы играете в режиме выживания
|
||||
nei.chat.gamemode.1=Теперь вы играете в творческом режиме
|
||||
nei.chat.gamemode.2=Теперь вы играете в творческом+ режиме
|
||||
nei.chat.gamemode.3=Теперь вы играете в режиме приключений
|
||||
nei.chat.rain.on=Дождь включен
|
||||
nei.chat.rain.off=Дождь выключен
|
||||
nei.chat.time=День %d. %d:00
|
||||
nei.chat.give.noitem=Нет такого предмета.
|
||||
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.give.noitem=Такого предмета нет.
|
||||
nei.chat.recipe.error=Произошла ошибка при загрузке рецепта. Пожалуйста, проверьте файл журнала для получения подробной информации.
|
||||
nei.chat.render.error=Произошла ошибка при рендеринге предмета. Пожалуйста, проверьте файл журнала для получения подробной информации.
|
||||
nei.chat.chunkoverlay.0=Отображение чанков: Выключено
|
||||
nei.chat.chunkoverlay.1=Отображение чанков: Углы чанков
|
||||
nei.chat.chunkoverlay.2=Отображение чанков: Чанки
|
||||
nei.chat.chunkoverlay.3=Отображение чанков: Жилы руды GT
|
||||
|
||||
nei.options=Опции NEI
|
||||
nei.options=Настройки NEI
|
||||
nei.options.back=Назад
|
||||
nei.options.world=Мировые
|
||||
nei.options.save=Сохранить
|
||||
nei.options.world=Мир
|
||||
nei.options.global=Глобальные
|
||||
nei.options.global.tip.0=Настройки применяются ко всем мирам
|
||||
nei.options.global.tip.1=Нажмите W рядом с:опцией, чтобы включить:перезапись для этого мира
|
||||
nei.options.wbutton.tip.0=Использование глобальных настроек
|
||||
nei.options.wbutton.tip.1=Перезапись глобальных настроек
|
||||
nei.options.global.tip.1=Нажмите W рядом с опцией, чтобы включить переопределение для этого мира
|
||||
nei.options.wbutton.tip.0=Используются глобальные настройки
|
||||
nei.options.wbutton.tip.1=Переопределение глобальной настройки
|
||||
|
||||
nei.options.keys=Назначения клавиш
|
||||
nei.options.keys=Привязки клавиш
|
||||
nei.options.keys.showenchant=Показать зачарование
|
||||
nei.options.keys.gui=Инвентарь
|
||||
nei.options.keys.gui.recipe=Рецепт
|
||||
nei.options.keys.gui.usage=Использование
|
||||
nei.options.keys.gui.enchant=Чары
|
||||
nei.options.keys.gui.enchant=Зачарования
|
||||
nei.options.keys.gui.potion=Зелья
|
||||
nei.options.keys.gui.back=Предыдущий рецепт
|
||||
nei.options.keys.gui.prev=Предыдущая страница
|
||||
nei.options.keys.gui.next=Следующая страница
|
||||
nei.options.keys.gui.back=Назад к последнему рецепту
|
||||
nei.options.keys.gui.prev=Предыдущая страница панели предметов
|
||||
nei.options.keys.gui.next=Следующая страница панели предметов
|
||||
nei.options.keys.gui.hide=Переключить видимость NEI
|
||||
nei.options.keys.gui.search=Сфокусироваться на панели поиска
|
||||
nei.options.keys.gui.next_recipe=Следующий рецепт
|
||||
nei.options.keys.gui.prev_recipe=Предыдущий рецепт
|
||||
nei.options.keys.gui.next_machine=Следующая машина
|
||||
nei.options.keys.gui.prev_machine=Предыдущая машина
|
||||
nei.options.keys.gui.search=Сфокусироваться на строке поиска
|
||||
nei.options.keys.gui.bookmark=Добавить закладку
|
||||
nei.options.keys.gui.remove_recipe=Удалить группу из закладок
|
||||
nei.options.keys.gui.bookmark_recipe=Добавить закладку с рецептом
|
||||
nei.options.keys.gui.bookmark_count=Добавить закладку с учётом количества
|
||||
nei.options.keys.gui.bookmark_pull_items=Переместить все отмеченные предметы
|
||||
nei.options.keys.gui.bookmark_pull_items_ingredients=Переместить все отмеченные ингредиенты
|
||||
nei.options.keys.gui.bookmark_recipe_count=Добавить закладку с рецептом, учитывающую количество
|
||||
nei.options.keys.gui.hide_bookmarks=Переключить видимость панели закладок
|
||||
nei.options.keys.gui.overlay=Отображение рецепта
|
||||
nei.options.keys.gui.overlay_hide=Скрыть отображение рецепта
|
||||
nei.options.keys.gui.overlay_use=Использовать отображение рецепта
|
||||
nei.options.keys.gui.getprevioussearch=Предыдущий поиск
|
||||
nei.options.keys.gui.getnextsearch=Следующий поиск
|
||||
nei.options.keys.gui.next_tooltip=Следующая подсказка
|
||||
nei.options.keys.gui.copy_name=Скопировать название предмета
|
||||
nei.options.keys.gui.copy_oredict=Скопировать OreDictionary предмета
|
||||
nei.options.keys.gui.itemzoom_toggle=Переключить увеличение предмета
|
||||
nei.options.keys.gui.itemzoom_hold=Удерживать для отображения увеличения предмета
|
||||
nei.options.keys.gui.itemzoom_zoom_in=Увеличить предмет
|
||||
nei.options.keys.gui.itemzoom_zoom_out=Уменьшить предмет
|
||||
nei.options.keys.world=Мир
|
||||
nei.options.keys.world.chunkoverlay=Наложение границ чанков
|
||||
nei.options.keys.world.moboverlay=Наложение появления мобов
|
||||
nei.options.keys.world.highlight_tips=Показывать всплывающие подсказки
|
||||
nei.options.keys.world.chunkoverlay=Отображение границ чанков
|
||||
nei.options.keys.world.moboverlay=Отображение спавна мобов
|
||||
nei.options.keys.world.highlight_tips=Подсветка подсказок
|
||||
nei.options.keys.world.dawn=Рассвет
|
||||
nei.options.keys.world.noon=Полдень
|
||||
nei.options.keys.world.dusk=Сумерки
|
||||
nei.options.keys.world.midnight=Полночь
|
||||
nei.options.keys.world.rain=Дождь
|
||||
nei.options.keys.world.heal=Исцеление
|
||||
nei.options.keys.world.creative=Игровой режим
|
||||
nei.options.keys.world.creative.tip=Круг игровых режимов
|
||||
nei.options.keys.world.heal=Вылечить
|
||||
nei.options.keys.world.creative=Режим игры
|
||||
nei.options.keys.world.creative.tip=Переключение режима игры
|
||||
|
||||
nei.options.inventory=Инвентарь
|
||||
nei.options.inventory.widgetsenabled.true=NEI включён
|
||||
nei.options.inventory.bookmarks=Панель закладок
|
||||
nei.options.inventory.bookmarks.enabled=Видимость панели закладок
|
||||
nei.options.inventory.bookmarks.enabled.true=Видимая
|
||||
nei.options.inventory.bookmarks.enabled.false=Скрытая
|
||||
nei.options.inventory.bookmarks.animation=Анимация в стиле REI в закладках
|
||||
nei.options.inventory.bookmarks.animation.true=Да
|
||||
nei.options.inventory.bookmarks.animation.false=Нет
|
||||
nei.options.inventory.bookmarks.craftingChainDir=Направление информации о цепочке крафта
|
||||
nei.options.inventory.bookmarks.craftingChainDir.0=Сначала ингредиенты
|
||||
nei.options.inventory.bookmarks.craftingChainDir.1=Сначала результат
|
||||
nei.options.inventory.bookmarks.recipeTooltipsMode=Показывать подсказки рецептов в закладках
|
||||
nei.options.inventory.bookmarks.recipeTooltipsMode.0=Нет
|
||||
nei.options.inventory.bookmarks.recipeTooltipsMode.1=В горизонтальном виде
|
||||
nei.options.inventory.bookmarks.recipeTooltipsMode.2=В вертикальном виде
|
||||
nei.options.inventory.bookmarks.recipeTooltipsMode.3=Всегда
|
||||
nei.options.inventory.bookmarks.showRecipeMarker=Показывать маркер рецепта
|
||||
nei.options.inventory.bookmarks.showRecipeMarker.true=Да
|
||||
nei.options.inventory.bookmarks.showRecipeMarker.false=Нет
|
||||
nei.options.inventory.bookmarks.ignorePotionOverlap=Игнорировать перекрытие с HUD эффектов зелий
|
||||
nei.options.inventory.bookmarks.ignorePotionOverlap.true=Да
|
||||
nei.options.inventory.bookmarks.ignorePotionOverlap.false=Нет
|
||||
nei.options.inventory.bookmarks.worldSpecific=Закладки для конкретного мира
|
||||
nei.options.inventory.bookmarks.worldSpecific.true=Да
|
||||
nei.options.inventory.bookmarks.worldSpecific.false=Нет
|
||||
nei.options.inventory.worldSpecificPresets=Пресеты для конкретного мира
|
||||
nei.options.inventory.worldSpecificPresets.true=Да
|
||||
nei.options.inventory.worldSpecificPresets.false=Нет
|
||||
nei.options.inventory.guirecipe=Интерфейс рецептов
|
||||
nei.options.inventory.guirecipe.jeiStyleTabs=Вкладки в стиле JEI
|
||||
nei.options.inventory.guirecipe.jeiStyleTabs.true=Да
|
||||
nei.options.inventory.guirecipe.jeiStyleTabs.false=Нет [Странно]
|
||||
nei.options.inventory.guirecipe.itemPresenceOverlay=Подсвечивать предметы при наведении на "?"
|
||||
nei.options.inventory.guirecipe.itemPresenceOverlay.0=Нет
|
||||
nei.options.inventory.guirecipe.itemPresenceOverlay.1=Иконка
|
||||
nei.options.inventory.guirecipe.itemPresenceOverlay.2=Фон
|
||||
nei.options.inventory.guirecipe.slotHighlightPresent=Подсвечивать присутствующие предметы
|
||||
nei.options.inventory.guirecipe.slotHighlightPresent.true=Да
|
||||
nei.options.inventory.guirecipe.slotHighlightPresent.false=Нет
|
||||
nei.options.inventory.guirecipe.jeiStyleRecipeCatalyst=Катализаторы рецептов в стиле JEI
|
||||
nei.options.inventory.guirecipe.jeiStyleRecipeCatalyst.true=Да
|
||||
nei.options.inventory.guirecipe.jeiStyleRecipeCatalyst.false=Нет
|
||||
nei.options.inventory.guirecipe.cycledIngredientsTooltip=Подсказка циклических ингредиентов
|
||||
nei.options.inventory.guirecipe.cycledIngredientsTooltip.true=Показывать
|
||||
nei.options.inventory.guirecipe.cycledIngredientsTooltip.false=Скрыть
|
||||
nei.options.inventory.showItemQuantityWidget=Показывать виджет количества предметов
|
||||
nei.options.inventory.showItemQuantityWidget.true=Да
|
||||
nei.options.inventory.showItemQuantityWidget.false=Нет
|
||||
nei.options.inventory.search=Виджет поиска
|
||||
nei.options.inventory.search.widgetPosition=Позиция виджета
|
||||
nei.options.inventory.search.widgetPosition.true=Центр
|
||||
nei.options.inventory.search.widgetPosition.false=Справа
|
||||
nei.options.inventory.search.widgetAutofocus=Автофокус
|
||||
nei.options.inventory.search.widgetAutofocus.0=Нет
|
||||
nei.options.inventory.search.widgetAutofocus.1=Да
|
||||
nei.options.inventory.search.widgetAutofocus.2=Расширенный
|
||||
nei.options.inventory.search.patternMode=Режим поиска
|
||||
nei.options.inventory.search.patternMode.0=Простой
|
||||
nei.options.inventory.search.patternMode.1=Расширенный
|
||||
nei.options.inventory.search.patternMode.2=Регулярные выражения
|
||||
nei.options.inventory.search.quoteDropItemName=Цитировать название выброшенного предмета
|
||||
nei.options.inventory.search.quoteDropItemName.true=Да
|
||||
nei.options.inventory.search.quoteDropItemName.false=Нет
|
||||
nei.options.inventory.search.modNameSearchMode=Поиск по названию мода
|
||||
nei.options.inventory.search.modNameSearchMode.0=Всегда
|
||||
nei.options.inventory.search.modNameSearchMode.1=Префикс: %s
|
||||
nei.options.inventory.search.modNameSearchMode.2=Никогда
|
||||
nei.options.inventory.search.tooltipSearchMode=Поиск по подсказкам
|
||||
nei.options.inventory.search.tooltipSearchMode.0=Всегда
|
||||
nei.options.inventory.search.tooltipSearchMode.1=Префикс: %s
|
||||
nei.options.inventory.search.tooltipSearchMode.2=Никогда
|
||||
nei.options.inventory.search.identifierSearchMode=Поиск по идентификатору ресурса
|
||||
nei.options.inventory.search.identifierSearchMode.0=Всегда
|
||||
nei.options.inventory.search.identifierSearchMode.1=Префикс: %s
|
||||
nei.options.inventory.search.identifierSearchMode.2=Никогда
|
||||
nei.options.inventory.search.oreDictSearchMode=Поиск по OreDict
|
||||
nei.options.inventory.search.oreDictSearchMode.0=Всегда
|
||||
nei.options.inventory.search.oreDictSearchMode.1=Префикс: %s
|
||||
nei.options.inventory.search.oreDictSearchMode.2=Никогда
|
||||
nei.options.inventory.search.subsetsSearchMode=Поиск по подмножествам предметов
|
||||
nei.options.inventory.search.subsetsSearchMode.0=Всегда
|
||||
nei.options.inventory.search.subsetsSearchMode.1=Префикс: %s
|
||||
nei.options.inventory.search.subsetsSearchMode.2=Никогда
|
||||
nei.options.inventory.guirecipe.creativeTabStyle=Стиль вкладок: Творческий или JEI
|
||||
nei.options.inventory.guirecipe.creativeTabStyle.true=Творческий
|
||||
nei.options.inventory.guirecipe.creativeTabStyle.false=JEI
|
||||
nei.options.inventory.optimize_gui_overlap_computation=Оптимизация вычислений при перекрытии GUI
|
||||
nei.options.inventory.optimize_gui_overlap_computation.true=Да
|
||||
nei.options.inventory.optimize_gui_overlap_computation.false=Нет
|
||||
nei.options.inventory.guirecipe.jeiStyleCycledIngredients=Циклические ингредиенты в стиле JEI
|
||||
nei.options.inventory.guirecipe.jeiStyleCycledIngredients.true=Да
|
||||
nei.options.inventory.guirecipe.jeiStyleCycledIngredients.false=Нет
|
||||
nei.options.inventory.guirecipe.shiftOverlayRecipe=Требовать удержание Shift для перемещения предметов при отображении рецепта
|
||||
nei.options.inventory.guirecipe.shiftOverlayRecipe.true=Да
|
||||
nei.options.inventory.guirecipe.shiftOverlayRecipe.false=Нет
|
||||
nei.options.inventory.widgetsenabled.true=NEI включен
|
||||
nei.options.inventory.widgetsenabled.false=NEI выключен
|
||||
nei.options.inventory.cheatmode.0=Режим рецептов
|
||||
nei.options.inventory.cheatmode.1=Режим полезностей
|
||||
nei.options.inventory.cheatmode.2=Чит-режим
|
||||
|
||||
nei.options.inventory.profileRecipes=Рецепты профиля
|
||||
nei.options.inventory.profileRecipes.true=Да
|
||||
nei.options.inventory.profileRecipes.false=Нет
|
||||
nei.options.inventory.itemsort=Панель сортировки предметов
|
||||
nei.options.inventory.cheatmode.1=Утилитарный режим
|
||||
nei.options.inventory.cheatmode.2=Режим читов
|
||||
nei.options.inventory.guirecipe.profile=Профилировать рецепты
|
||||
nei.options.inventory.guirecipe.profile.true=Да
|
||||
nei.options.inventory.guirecipe.profile.false=Нет
|
||||
nei.options.inventory.itemsort=Сортировка панели предметов
|
||||
nei.options.inventory.itemIDs=ID предметов
|
||||
nei.options.inventory.itemIDs.0=Спрятаны
|
||||
nei.options.inventory.itemIDs.0=Скрыто
|
||||
nei.options.inventory.itemIDs.1=Авто
|
||||
nei.options.inventory.itemIDs.2=Показаны
|
||||
nei.options.inventory.searchmode=Режим поиска
|
||||
nei.options.inventory.searchmode.0=Обычный
|
||||
nei.options.inventory.searchmode.1=Расширенный
|
||||
nei.options.inventory.searchmode.2=Регулярные выражения
|
||||
nei.options.inventory.utilities=Полезности
|
||||
nei.options.inventory.utilities.tip=Выберете функции для режима полезностей
|
||||
nei.options.inventory.itemIDs.2=Показано
|
||||
nei.options.inventory.utilities=Утилиты
|
||||
nei.options.inventory.utilities.tip=Выберите функции для утилитарного режима
|
||||
nei.options.inventory.utilities.time=Время
|
||||
nei.options.inventory.utilities.rain=Дождь
|
||||
nei.options.inventory.utilities.heal=Исцеление
|
||||
nei.options.inventory.utilities.heal=Лечение
|
||||
nei.options.inventory.utilities.delete=Удаление
|
||||
nei.options.inventory.utilities.magnet=Магнит
|
||||
nei.options.inventory.utilities.gamemode=Игровой режим
|
||||
nei.options.inventory.utilities.enchant=Зачаровывание
|
||||
nei.options.inventory.utilities.gamemode=Режим игры
|
||||
nei.options.inventory.utilities.enchant=Зачарование
|
||||
nei.options.inventory.utilities.potion=Зелья
|
||||
nei.options.inventory.utilities.item=Предметы
|
||||
nei.options.inventory.gamemodes=Игровые режимы
|
||||
nei.options.inventory.gamemodes.tip=Выберете игровые режимы для переключения между ними
|
||||
nei.options.inventory.gamemodes=Режимы игры
|
||||
nei.options.inventory.gamemodes.tip=Выберите режимы игры для переключения
|
||||
nei.options.inventory.gamemodes.creative=Творческий
|
||||
nei.options.inventory.gamemodes.creative+=Творческий+
|
||||
nei.options.inventory.gamemodes.adventure=Приключение
|
||||
nei.options.inventory.disableMouseScrollTransfer=Отключить перенос колесиком мыши
|
||||
nei.options.inventory.disableMouseScrollTransfer.true=Да
|
||||
nei.options.inventory.disableMouseScrollTransfer.false=Нет
|
||||
nei.options.inventory.invertMouseScrollTransfer=Инвертировать направление переноса колесиком мыши
|
||||
nei.options.inventory.invertMouseScrollTransfer.true=Да
|
||||
nei.options.inventory.invertMouseScrollTransfer.false=Нет
|
||||
nei.options.inventory.cacheItemRendering=Кэширование рендеринга предметов
|
||||
nei.options.inventory.cacheItemRendering.true=Да
|
||||
nei.options.inventory.cacheItemRendering.false=Нет
|
||||
nei.options.inventory.collapsibleItems=Группирование предметов
|
||||
nei.options.inventory.collapsibleItems.enabled=Группирование предметов
|
||||
nei.options.inventory.collapsibleItems.enabled.true=Включено
|
||||
nei.options.inventory.collapsibleItems.enabled.false=Отключено
|
||||
nei.options.inventory.collapsibleItems.customName=Показать пользовательское название группы
|
||||
nei.options.inventory.collapsibleItems.customName.true=Да
|
||||
nei.options.inventory.collapsibleItems.customName.false=Нет
|
||||
nei.options.inventory.collapsibleItems.expandedColor=Цвет развернутого
|
||||
nei.options.inventory.collapsibleItems.collapsedColor=Цвет свернутого
|
||||
nei.options.inventory.collapsibleItems.reloadLabel=Перезагрузить
|
||||
nei.options.inventory.collapsibleItems.reloadButton=Запустить
|
||||
nei.options.inventory.history=Панель истории
|
||||
nei.options.inventory.history.enabled=Видимость панели истории
|
||||
nei.options.inventory.history.enabled.true=Включено
|
||||
nei.options.inventory.history.enabled.false=Отключено
|
||||
nei.options.inventory.history.historyColor=Цвет
|
||||
nei.options.inventory.history.useRows=Строки
|
||||
nei.options.inventory.history.splittingMode=Режим разделения
|
||||
nei.options.inventory.history.splittingMode.0=Фон
|
||||
nei.options.inventory.history.splittingMode.1=Пунктирная линия
|
||||
nei.options.inventory.itemzoom=Панель увеличения предметов
|
||||
nei.options.inventory.itemzoom.enabled=Видимость панели увеличения предметов
|
||||
nei.options.inventory.itemzoom.enabled.true=Включено
|
||||
nei.options.inventory.itemzoom.enabled.false=Отключено
|
||||
nei.options.inventory.itemzoom.neiOnly=Только подсветка NEI
|
||||
nei.options.inventory.itemzoom.neiOnly.true=Включено
|
||||
nei.options.inventory.itemzoom.neiOnly.false=Отключено
|
||||
nei.options.inventory.itemzoom.neiOnly.tip=Увеличивать предметы только из списка ингредиентов и закладок JEI.
|
||||
nei.options.inventory.itemzoom.onlySolid=Показывать только твердые предметы
|
||||
nei.options.inventory.itemzoom.onlySolid.true=Включено
|
||||
nei.options.inventory.itemzoom.onlySolid.false=Отключено
|
||||
nei.options.inventory.itemzoom.helpText=Показывать текст помощи
|
||||
nei.options.inventory.itemzoom.helpText.true=Включено
|
||||
nei.options.inventory.itemzoom.helpText.false=Отключено
|
||||
nei.options.inventory.itemzoom.helpText.tip=Показывать название "Увеличение предмета" и горячую клавишу для переключения этого мода под увеличенным предметом.
|
||||
nei.options.inventory.itemzoom.zoom=Уровень увеличения
|
||||
nei.options.inventory.itemzoom.zoom.tip=Установите меньшее значение, чтобы уменьшить увеличение предмета.
|
||||
nei.options.inventory.itemzoom.showName=Показывать название
|
||||
nei.options.inventory.itemzoom.showName.true=Показывать
|
||||
nei.options.inventory.itemzoom.showName.false=Скрыть
|
||||
nei.options.inventory.itemzoom.nameColor=Цвет названия
|
||||
|
||||
nei.options.command=Команды
|
||||
nei.options.command.creative=Игровой режим
|
||||
nei.options.command.creative.tip={0} = 1 для творческого, 0 для выживания, {1} = игрок
|
||||
nei.options.command.creative=Режим игры
|
||||
nei.options.command.creative.tip={0} = 1 для творческого режима, 0 для выживания, {1} = игрок
|
||||
nei.options.command.item=Предмет
|
||||
nei.options.command.item.tip={0} = игрок, {1} = id, {2} = количество, {3} = урон, {4} = nbt, {5} = имя
|
||||
nei.options.command.item.tip={0} = игрок, {1} = id, {2} = количество, {3} = урон, {4} = nbt, {5} = название
|
||||
nei.options.command.time=Время
|
||||
nei.options.command.time.tip={0} = мировое время
|
||||
nei.options.command.time.tip={0} = время в мире
|
||||
nei.options.command.rain=Дождь
|
||||
nei.options.command.rain.tip={0} = 1 для включения, 0 для выключения
|
||||
nei.options.command.heal=Исцеление
|
||||
nei.options.command.heal=Лечение
|
||||
nei.options.command.heal.tip={0} = игрок
|
||||
|
||||
nei.options.world.highlight_tips=Всплывающие подсказки
|
||||
nei.options.world.highlight_tips.hide=Спрятаны
|
||||
nei.options.world.highlight_tips.show=Показаны
|
||||
nei.options.world.highlight_tips=Подсветка подсказок
|
||||
nei.options.world.highlight_tips.hide=Скрыто
|
||||
nei.options.world.highlight_tips.show=Показано
|
||||
nei.options.world.highlight_tips.sample=Пример
|
||||
|
||||
nei.options.world.panels=Настройки панелей
|
||||
nei.options.world.presets=Список пресетов
|
||||
|
||||
nei.options.tools=Инструменты
|
||||
nei.options.tools.dump=Дампы памяти
|
||||
nei.options.tools.dump.dump=Дамп
|
||||
nei.options.tools.dump.dumped=ID %s сохранены в %s
|
||||
nei.options.tools.handler_load_from_config=Загрузить обработчики из конфигурации
|
||||
nei.options.tools.handler_load_from_config.true=Конфигурация
|
||||
nei.options.tools.handler_load_from_config.false=JAR
|
||||
nei.options.tools.catalyst_load_from_config=Загрузить катализаторы из конфигурации
|
||||
nei.options.tools.catalyst_load_from_config.true=Конфигурация
|
||||
nei.options.tools.catalyst_load_from_config.false=JAR
|
||||
nei.options.tools.dump=Выгрузка данных
|
||||
nei.options.tools.dump.dump=Выгрузить
|
||||
nei.options.tools.dump.dumped=%s ID сохранены в %s
|
||||
nei.options.tools.dump.mode.0=Используемые
|
||||
nei.options.tools.dump.mode.1=Свободные
|
||||
nei.options.tools.dump.mode.2=Все
|
||||
@@ -162,50 +390,68 @@ nei.options.tools.dump.itempanel.mode.1=NBT
|
||||
nei.options.tools.dump.itempanel.mode.2=Json
|
||||
nei.options.tools.dump.itempanel.mode.3=PNG
|
||||
nei.options.tools.dump.itempanel.icon.dumped=Иконки панели предметов сохранены в %s
|
||||
nei.options.tools.dump.itempanel.icon.cancelled=Дамп отменён
|
||||
|
||||
|
||||
|
||||
nei.options.tools.dump.itempanel.icon.cancelled=Выгрузка отменена
|
||||
nei.options.tools.dump.handlers=Обработчики NEI
|
||||
nei.options.tools.dump.handlers.dumped=обработчики были сохранены в %s
|
||||
nei.options.tools.dump.handlers.mode.0=CSV
|
||||
nei.options.tools.dump.handlers.mode.1=Json
|
||||
|
||||
nei.recipe.page=Страница %s/%s
|
||||
nei.recipe.tooltip=Рецепты
|
||||
nei.recipe.shaped=Форменное создание
|
||||
nei.recipe.shapeless=Бесформенное создание
|
||||
nei.recipe.furnace=Выплавка
|
||||
nei.recipe.shaped=Формованный крафт
|
||||
nei.recipe.shapeless=Бесформенный крафт
|
||||
nei.recipe.furnace=Плавка
|
||||
nei.recipe.fuel=Топливо
|
||||
nei.recipe.fuel.required=Требуется: %s
|
||||
nei.recipe.fuel.processed=Обработано: %s
|
||||
nei.recipe.fuel.produced=Произведено: %s
|
||||
nei.recipe.fuel.smeltCount=Переплавляет %s предметов
|
||||
# Устарело
|
||||
nei.recipe.fuel.required=Требуется %s
|
||||
# Устарело
|
||||
nei.recipe.fuel.processed=Обработано %s
|
||||
# Устарело
|
||||
nei.recipe.fuel.produced=Произведено %s
|
||||
nei.recipe.firework=Фейерверки
|
||||
nei.recipe.firework.tooltip0=Красители добавляют цвета на звёздочку
|
||||
nei.recipe.firework.tooltip1=Перекрашивание добавляет исчезающие цвета к заряду
|
||||
nei.recipe.firework.tooltip2=Одна ракета может выпустить несколько зарядов
|
||||
nei.recipe.brewing=Зельеварение
|
||||
nei.recipe.profiler.crafting=Профилирование создания
|
||||
nei.recipe.profiler.usage=Использование профилирования
|
||||
nei.recipe.firework.tooltip0=Красители добавляют цвета к зарядам
|
||||
nei.recipe.firework.tooltip1=Перекрашивание добавляет цвета затухания к заряду
|
||||
nei.recipe.firework.tooltip2=Из одной ракеты могут появиться несколько зарядов
|
||||
nei.recipe.brewing=Варка
|
||||
nei.recipe.profiler.crafting=Профилирование крафта
|
||||
nei.recipe.profiler.usage=Профилирование использования
|
||||
nei.recipe.concurrent.usage=Одновременное использование - всего
|
||||
nei.recipe.concurrent.crafting=Одновременный крафт - всего
|
||||
nei.recipe.accepts=Принимает следующее
|
||||
|
||||
nei.recipe.overlay=отображение рецепта
|
||||
nei.recipe.overlay.missing=Отсутствует следующее
|
||||
nei.recipe.overlay.mismatch=Несоответствие сетки крафта
|
||||
nei.recipe.overlay.fillCraftingGrid=Заполнить сетку крафта
|
||||
nei.recipe.overlay.fillCraftingGrid.key=SHIFT + Клик
|
||||
nei.recipe.overlay.bookmark=Сохранить в закладки
|
||||
nei.recipe.overlay.bookmarkRecipe=Сохранить с рецептом
|
||||
nei.recipe.overlay.bookmarkAmount=Сохранить с учётом количества
|
||||
nei.recipe.overlay.bookmarkRecipeAndAmount=Сохранить с рецептом и количеством
|
||||
|
||||
nei.itemsort.minecraft=Minecraft
|
||||
nei.itemsort.minecraft.tip=Сортирует предметы сначала из оригинального Minecraft
|
||||
nei.itemsort.mod=По модификации
|
||||
nei.itemsort.mod.tip=Группирует предметы в один мод, на основе имени мода
|
||||
nei.itemsort.minecraft.tip=Сортирует предметы из ванильного Minecraft первыми
|
||||
nei.itemsort.mod=Мод
|
||||
nei.itemsort.mod.tip=Группирует предметы из одного мода, сортируя по названию мода
|
||||
nei.itemsort.id=ID предмета
|
||||
nei.itemsort.default=По-умолчанию
|
||||
nei.itemsort.default.tip=Обычный порядок предметов
|
||||
nei.itemsort.damage=Повреждение предмета
|
||||
nei.itemsort.default=По умолчанию
|
||||
nei.itemsort.default.tip=Оставить естественный порядок каждого предмета неизменным
|
||||
nei.itemsort.damage=Урон предмета
|
||||
nei.itemsort.name=Отображаемое имя
|
||||
|
||||
nei.subsets.Blocks=Блоки
|
||||
nei.subsets.Blocks.MobSpawners=Спаунеры
|
||||
nei.subsets.Blocks.MobSpawners=Спавнеры мобов
|
||||
nei.subsets.CreativeTabs=Творческие вкладки
|
||||
nei.subsets.Items=Предметы
|
||||
nei.subsets.Items.Armor=Броня
|
||||
nei.subsets.Items.Armor.Boots=Ботинки
|
||||
nei.subsets.Items.Armor.Chestplates=Кирасы
|
||||
nei.subsets.Items.Armor.Chestplates=Нагрудники
|
||||
nei.subsets.Items.Armor.Helmets=Шлемы
|
||||
nei.subsets.Items.Armor.Leggings=Поножи
|
||||
nei.subsets.Items.Food=Еда
|
||||
nei.subsets.Items.Potions=Зелья
|
||||
nei.subsets.Items.Potions.Ingredients=Ингридиенты
|
||||
nei.subsets.Items.Potions.Ingredients=Ингредиенты
|
||||
nei.subsets.Items.Potions.Negative=Негативные
|
||||
nei.subsets.Items.Potions.Neutral=Нейтральные
|
||||
nei.subsets.Items.Potions.Positive=Полезные
|
||||
@@ -213,10 +459,31 @@ nei.subsets.Items.Potions.Splash=Взрывные
|
||||
nei.subsets.Items.Tools=Инструменты
|
||||
nei.subsets.Items.Tools.Axes=Топоры
|
||||
nei.subsets.Items.Tools.Hoes=Мотыги
|
||||
nei.subsets.Items.Tools.Other=Другие
|
||||
nei.subsets.Items.Tools.Other=Прочее
|
||||
nei.subsets.Items.Tools.Pickaxes=Кирки
|
||||
nei.subsets.Items.Tools.Shovels=Лопаты
|
||||
nei.subsets.Items.Weapons=Оружие
|
||||
nei.subsets.Items.Weapons.Ranged=Дальнего боя
|
||||
nei.subsets.Items.Weapons.Ranged=Дальнобойное
|
||||
nei.subsets.Items.Weapons.Swords=Мечи
|
||||
nei.subsets.Mod=Модификации
|
||||
nei.subsets.Mod=Мод
|
||||
|
||||
nei.presets.new=Новый пресет
|
||||
nei.presets.toggle=Переключить пресеты
|
||||
nei.presets.create=Создать пресет
|
||||
nei.presets.update=Обновить пресет
|
||||
nei.presets.enabled=Включено
|
||||
nei.presets.filter=Ф
|
||||
nei.presets.filter.tip=Скрыть предметы из других активных пресетов
|
||||
nei.presets.name=Название пресета
|
||||
nei.presets.mode=Режим
|
||||
nei.presets.mode.hide=Скрыть
|
||||
nei.presets.mode.hide.char=С
|
||||
nei.presets.mode.hide.tip=Скрыть предметы на панели
|
||||
nei.presets.mode.remove=Удалить
|
||||
nei.presets.mode.remove.tip=Скрыть предметы на панели и их рецепты
|
||||
nei.presets.mode.remove.char=У
|
||||
nei.presets.mode.group=Группа
|
||||
nei.presets.mode.group.tip=Создать пользовательскую группу сворачиваемых предметов
|
||||
nei.presets.mode.group.char=Г
|
||||
|
||||
nei.itemzoom.toggle=Используйте %s для переключения увеличения предмета
|
||||
@@ -97,10 +97,10 @@ nei.options.inventory.itemIDs=ID itemov
|
||||
nei.options.inventory.itemIDs.0=Skryté
|
||||
nei.options.inventory.itemIDs.1=Automatické
|
||||
nei.options.inventory.itemIDs.2=Zobrazené
|
||||
nei.options.inventory.searchmode=Spôsob vyhľadávania
|
||||
nei.options.inventory.searchmode.0=Jednoduchý
|
||||
nei.options.inventory.searchmode.1=Rozšírený
|
||||
nei.options.inventory.searchmode.2=Regulárne výrazy
|
||||
nei.options.inventory.search.patternMode=Spôsob vyhľadávania
|
||||
nei.options.inventory.search.patternMode.0=Jednoduchý
|
||||
nei.options.inventory.search.patternMode.1=Rozšírený
|
||||
nei.options.inventory.search.patternMode.2=Regulárne výrazy
|
||||
nei.options.inventory.utilities=Utility
|
||||
nei.options.inventory.utilities.tip=Zvoľ funkcie pre úžitkový mód
|
||||
nei.options.inventory.utilities.time=Čas
|
||||
|
||||
@@ -19,14 +19,14 @@ nei.inventory.delete.0=Silme modunu kapat
|
||||
nei.inventory.rain.enable=Yağmuru Aktif Et
|
||||
nei.inventory.rain.1=Yağmur yağdır
|
||||
nei.inventory.rain.0=Yağmuru durdur
|
||||
nei.inventory.magnet.enable=Mıknatısı aktif et
|
||||
nei.inventory.magnet.enable=Mıknatısı aktif et
|
||||
nei.inventory.magnet.1=Mıknatısı aç
|
||||
nei.inventory.magnet.0=Mıknatısı kapat
|
||||
nei.inventory.dawn.enable=Sabah-Öğle aktif et
|
||||
nei.inventory.dawn.set=Sabah yap
|
||||
nei.inventory.noon.enable=Öğlen-akşam aktif et
|
||||
nei.inventory.noon.set=Öğlen yap
|
||||
nei.inventory.dusk.enable=Akşam-Gece aktif et
|
||||
nei.inventory.dusk.enable=Akşam-Gece aktif et
|
||||
nei.inventory.dusk.set=Akşam yap
|
||||
nei.inventory.midnight.enable=Gece-Sabah aktif et
|
||||
nei.inventory.midnight.set=Gece yarısı yap
|
||||
@@ -97,10 +97,10 @@ nei.options.inventory.itemIDs=Item IDleri
|
||||
nei.options.inventory.itemIDs.0=Gizli
|
||||
nei.options.inventory.itemIDs.1=Otomatik
|
||||
nei.options.inventory.itemIDs.2=Göster
|
||||
nei.options.inventory.searchmode=Arama Modu
|
||||
nei.options.inventory.searchmode.0=Normal
|
||||
nei.options.inventory.searchmode.1=Gelişmiş
|
||||
nei.options.inventory.searchmode.2=Regex
|
||||
nei.options.inventory.search.patternMode=Arama Modu
|
||||
nei.options.inventory.search.patternMode.0=Normal
|
||||
nei.options.inventory.search.patternMode.1=Gelişmiş
|
||||
nei.options.inventory.search.patternMode.2=Regex
|
||||
nei.options.inventory.utilities=Yardımcılar
|
||||
nei.options.inventory.utilities.tip=Yardımcıları seç
|
||||
nei.options.inventory.utilities.time=Saat
|
||||
@@ -152,7 +152,7 @@ nei.options.tools.dump.enchantments=Büyüler
|
||||
nei.options.tools.dump.biome=Biyom
|
||||
nei.options.tools.dump.biomes=Biyomlar
|
||||
nei.options.tools.dump.itempanel=Item Paneli
|
||||
nei.options.tools.dump.itempanel.dumped=Item panelinden %s kadar silindi
|
||||
nei.options.tools.dump.itempanel.dumped=Item panelinden %s kadar silindi
|
||||
nei.options.tools.dump.itempanel.mode.0=CSV
|
||||
nei.options.tools.dump.itempanel.mode.1=NBT
|
||||
nei.options.tools.dump.itempanel.mode.2=Json
|
||||
|
||||
@@ -174,10 +174,10 @@ nei.options.inventory.itemIDs=物品ID
|
||||
nei.options.inventory.itemIDs.0=隐藏
|
||||
nei.options.inventory.itemIDs.1=自动
|
||||
nei.options.inventory.itemIDs.2=显示
|
||||
nei.options.inventory.searchmode=搜索模式
|
||||
nei.options.inventory.searchmode.0=简单
|
||||
nei.options.inventory.searchmode.1=扩展
|
||||
nei.options.inventory.searchmode.2=正则表达式
|
||||
nei.options.inventory.search.patternMode=搜索模式
|
||||
nei.options.inventory.search.patternMode.0=简单
|
||||
nei.options.inventory.search.patternMode.1=扩展
|
||||
nei.options.inventory.search.patternMode.2=正则表达式
|
||||
nei.options.inventory.utilities=按钮
|
||||
nei.options.inventory.utilities.tip=选择实用模式的功能
|
||||
nei.options.inventory.utilities.time=时间
|
||||
@@ -316,12 +316,3 @@ nei.subsets.Items.Weapons=武器
|
||||
nei.subsets.Items.Weapons.Ranged=远程
|
||||
nei.subsets.Items.Weapons.Swords=剑
|
||||
nei.subsets.Mod=Mod
|
||||
|
||||
nei.presets.blacklist.label=黑
|
||||
nei.presets.blacklist.tooltip=黑名单
|
||||
nei.presets.whitelist.label=白
|
||||
nei.presets.whitelist.tooltip=白名单
|
||||
nei.presets.textfield.tooltip.1=Enter - 保存
|
||||
nei.presets.textfield.tooltip.2=Esc - 取消
|
||||
nei.presets.label.tooltip=双击编辑
|
||||
nei.presets.label.selected=%s 预设
|
||||
@@ -96,10 +96,10 @@ nei.options.inventory.itemIDs=物品ID
|
||||
nei.options.inventory.itemIDs.0=隱藏
|
||||
nei.options.inventory.itemIDs.1=自動
|
||||
nei.options.inventory.itemIDs.2=顯示
|
||||
nei.options.inventory.searchmode=搜索模式
|
||||
nei.options.inventory.searchmode.0=簡單
|
||||
nei.options.inventory.searchmode.1=擴展
|
||||
nei.options.inventory.searchmode.2=正則表達式
|
||||
nei.options.inventory.search.patternMode=搜索模式
|
||||
nei.options.inventory.search.patternMode.0=簡單
|
||||
nei.options.inventory.search.patternMode.1=擴展
|
||||
nei.options.inventory.search.patternMode.2=正則表達式
|
||||
nei.options.inventory.utilities=按鈕
|
||||
nei.options.inventory.utilities.tip=選擇實用模式的功能
|
||||
nei.options.inventory.utilities.time=時間
|
||||
@@ -176,7 +176,7 @@ nei.recipe.profiler.crafting=合成查詢性能分析
|
||||
nei.recipe.profiler.usage=用途查詢性能分析
|
||||
|
||||
nei.itemsort.minecraft=Minecraft
|
||||
nei.itemsort.minecraft.tip=從原版物品開始排序
|
||||
nei.itemsort.minecraft.tip=從原版物品開始排序
|
||||
nei.itemsort.mod=Mod
|
||||
nei.itemsort.mod.tip=將每一個mod分為一組,按照mod名稱排序
|
||||
nei.itemsort.id=按物品ID排序
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
Reference in new issue
Block a user