mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-18 19:39:06 +00:00
Compare commits
18
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
acaead41ee | ||
|
|
951f1b0d0d | ||
|
|
daab313288 | ||
|
|
25eaa492f7 | ||
|
|
1b34b24495 | ||
|
|
b9cd48f8f9 | ||
|
|
b2afc8c9e0 | ||
|
|
dc400ea560 | ||
|
|
ea03cfa17d | ||
|
|
94676e0934 | ||
|
|
f7ba34c0af | ||
|
|
db1fd255bb | ||
|
|
94ca7f3134 | ||
|
|
dea024173f | ||
|
|
af320a6c9f | ||
|
|
dcb10bb79d | ||
|
|
d3b6603d06 | ||
|
|
adf2065305 |
No files matched your search
+2
-1621
File diff suppressed because it is too large.
Load diff
+134
-40
@@ -1,90 +1,137 @@
|
||||
# ExampleMod tag to use as Blowdryer (Spotless, etc.) settings version, leave empty to disable.
|
||||
# LOCAL to test local config updates.
|
||||
gtnh.settings.blowdryerTag = 0.2.0
|
||||
|
||||
# Human-readable mod name, available for mcmod.info population.
|
||||
modName = NotEnoughItems
|
||||
|
||||
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
|
||||
# Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation.
|
||||
# Conventionally lowercase.
|
||||
modId = NotEnoughItems
|
||||
|
||||
# Root package of the mod, used to find various classes in other properties,
|
||||
# mcmod.info substitution, enabling assertions in run tasks, etc.
|
||||
modGroup = codechicken.nei
|
||||
|
||||
# WHY is there no version field?
|
||||
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
|
||||
# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
|
||||
# Whether to use modGroup as the maven publishing group.
|
||||
# Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods.
|
||||
useModGroupForPublishing = false
|
||||
|
||||
# Will update your build.gradle automatically whenever an update is available
|
||||
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
|
||||
autoUpdateBuildScript = false
|
||||
|
||||
# Version of Minecraft to target
|
||||
minecraftVersion = 1.7.10
|
||||
|
||||
# Version of Minecraft Forge to target
|
||||
forgeVersion = 10.13.4.1614
|
||||
|
||||
# Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you
|
||||
# restart Minecraft in development. Choose this dependent on your mod:
|
||||
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
|
||||
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
|
||||
# Specify an MCP channel for dependency deobfuscation and the deobfParams task.
|
||||
channel = stable
|
||||
|
||||
# Specify an MCP mappings version for dependency deobfuscation and the deobfParams task.
|
||||
mappingsVersion = 12
|
||||
|
||||
# Defines other MCP mappings for dependency deobfuscation.
|
||||
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
|
||||
|
||||
# Select a default username for testing your mod. You can always override this per-run by running
|
||||
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
||||
developmentEnvironmentUserName = Developer
|
||||
|
||||
# Define a source file of your project with:
|
||||
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
|
||||
# version in @Mod([...], version = VERSION, [...])
|
||||
# Leave these properties empty to skip individual token replacements
|
||||
# Generate a class with String fields for the mod id, name, version and group name named with the fields below
|
||||
# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
|
||||
# See https://github.com/bsideup/jabel for details on how this works.
|
||||
enableModernJavaSyntax = false
|
||||
|
||||
# Enables injecting missing generics into the decompiled source code for a better coding experience.
|
||||
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
|
||||
enableGenericInjection = false
|
||||
|
||||
# Generate a class with a String field for the mod version named as defined below.
|
||||
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
|
||||
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
|
||||
generateGradleTokenClass = codechicken.nei.Tags
|
||||
gradleTokenModId =
|
||||
gradleTokenModName =
|
||||
|
||||
# Name of the token containing the project's current version to generate/replace.
|
||||
gradleTokenVersion = VERSION
|
||||
gradleTokenGroupName =
|
||||
|
||||
# [DEPRECATED] Mod ID replacement token.
|
||||
gradleTokenModId =
|
||||
|
||||
# [DEPRECATED] Mod name replacement token.
|
||||
gradleTokenModName =
|
||||
|
||||
# [DEPRECATED] Mod Group replacement token.
|
||||
gradleTokenGroupName =
|
||||
|
||||
# [DEPRECATED]
|
||||
# Multiple source files can be defined here by providing a comma-seperated list: Class1.java,Class2.java,Class3.java
|
||||
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
|
||||
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
|
||||
# version in @Mod([...], version = VERSION, [...])
|
||||
# Leave these properties empty to skip individual token replacements
|
||||
# version in @Mod([...], version = VERSION, [...]).
|
||||
# Leave these properties empty to skip individual token replacements.
|
||||
replaceGradleTokenInFile =
|
||||
|
||||
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
|
||||
# leave this property empty.
|
||||
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
|
||||
# Example value: (apiPackage = api) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.api
|
||||
apiPackage =
|
||||
|
||||
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
|
||||
# Example value: mymodid_at.cfg
|
||||
# There can be multiple files in a space-separated list.
|
||||
# Example value: mymodid_at.cfg nei_at.cfg
|
||||
accessTransformersFile = nei_at.cfg
|
||||
|
||||
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
||||
usesMixins = false
|
||||
# Specify the location of your implementation of IMixinPlugin. Leave it empty otherwise.
|
||||
|
||||
# Adds some debug arguments like verbose output and class export.
|
||||
usesMixinDebug = false
|
||||
|
||||
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
||||
mixinPlugin =
|
||||
|
||||
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
|
||||
mixinsPackage =
|
||||
|
||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||
# This parameter is for legacy compatibility only
|
||||
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
|
||||
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
|
||||
coreModClass = asm.NEICorePlugin
|
||||
|
||||
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
|
||||
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
|
||||
containsMixinsAndOrCoreModOnly = true
|
||||
|
||||
# If enabled, you may use 'shadowImplementation' for dependencies. They will be integrated in your jar. It is your
|
||||
# responsibility check the licence and request permission for distribution, if required.
|
||||
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
|
||||
forceEnableMixins = false
|
||||
|
||||
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated into your jar. It is your
|
||||
# responsibility to check the license and request permission for distribution if required.
|
||||
usesShadowedDependencies = true
|
||||
|
||||
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
|
||||
# If disabled, won't remove unused classes from shadowed dependencies. Some libraries use reflection to access
|
||||
# their own classes, making the minimization unreliable.
|
||||
minimizeShadowedDependencies = true
|
||||
|
||||
# The project's numeric ID on CurseForge. You can find this in the About Project box.
|
||||
# Leave this empty if you don't want to publish on CurseForge.
|
||||
curseForgeProjectId = 358228
|
||||
# If disabled, won't rename the shadowed classes.
|
||||
relocateShadowedDependencies = true
|
||||
|
||||
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
|
||||
# Syntax: type1:name1;type2:name2;...
|
||||
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
||||
# and the name is the CurseForge project id of the other mod.
|
||||
curseForgeRelations = requiredDependency:codechickencore-unofficial;requiredDependency:codechickenlib-unofficial
|
||||
# Adds the GTNH maven, CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
|
||||
includeWellKnownRepositories = true
|
||||
|
||||
# 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.
|
||||
usesMavenPublishing = true
|
||||
|
||||
# Publishing to modrinth requires you to set the MODRINTH_TOKEN environment variable to your current modrinth API token.
|
||||
# Maven repository to publish the mod to.
|
||||
# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/
|
||||
|
||||
# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
|
||||
#
|
||||
# The project's ID on Modrinth. Can be either the slug or the ID.
|
||||
# Leave this empty if you don't want to publish on Modrinth.
|
||||
|
||||
# Leave this empty if you don't want to publish to Modrinth.
|
||||
modrinthProjectId = notenoughitems-unofficial
|
||||
|
||||
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
|
||||
@@ -92,7 +139,54 @@ modrinthProjectId = notenoughitems-unofficial
|
||||
# Where scope can be one of [required, optional, incompatible, embedded],
|
||||
# type can be one of [project, version],
|
||||
# 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:codechickenlib-unofficial;required-project:codechickencore-unofficial
|
||||
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
|
||||
#
|
||||
# The project's numeric ID on CurseForge. You can find this in the About Project box.
|
||||
# Leave this empty if you don't want to publish on CurseForge.
|
||||
curseForgeProjectId = 358228
|
||||
|
||||
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
|
||||
# Syntax: type1:name1;type2:name2;...
|
||||
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
||||
# 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
|
||||
|
||||
# Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older
|
||||
# projects. New projects should not use this parameter.
|
||||
# customArchiveBaseName =
|
||||
|
||||
# Optional parameter to have the build automatically fail if an illegal version is used.
|
||||
# This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'.
|
||||
# The check is ONLY performed if the version is a git tag.
|
||||
# Note: the specified string must be escaped, so e.g. 1\\.1\\.\\d+ instead of 1\.1\.\d+
|
||||
# versionPattern =
|
||||
|
||||
# Uncomment to prevent the source code from being published.
|
||||
# noPublishedSources = true
|
||||
|
||||
# Uncomment this to disable Spotless checks.
|
||||
# This should only be uncommented to keep it easier to sync with upstream/other forks.
|
||||
# That is, if there is no other active fork/upstream, NEVER change this.
|
||||
# disableSpotless = true
|
||||
|
||||
# Uncomment this to disable Checkstyle checks (currently wildcard import check).
|
||||
# disableCheckstyle = true
|
||||
|
||||
# Override the IDEA build type. Valid values are: "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle"
|
||||
# (force use delegated build).
|
||||
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
||||
# e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be native build.
|
||||
# WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want!
|
||||
# Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you.
|
||||
# ideaOverrideBuildType = idea
|
||||
|
||||
# Whether IDEA should run spotless checks when pressing the Build button.
|
||||
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
||||
# ideaCheckSpotlessOnBuild = true
|
||||
|
||||
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.5-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
Vendored
+10
-10
@@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
@@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
|
||||
+3
-7
@@ -6,6 +6,7 @@ pluginManagement {
|
||||
name "GTNH Maven"
|
||||
url "https://nexus.gtnewhorizons.com/repository/public/"
|
||||
mavenContent {
|
||||
includeGroup("com.gtnewhorizons")
|
||||
includeGroupByRegex("com\\.gtnewhorizons\\..+")
|
||||
}
|
||||
}
|
||||
@@ -16,15 +17,10 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.diffplug.blowdryerSetup' version '1.7.1'
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' // Provides java toolchains
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.21'
|
||||
}
|
||||
|
||||
blowdryerSetup {
|
||||
repoSubfolder 'gtnhShared'
|
||||
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.2.0')
|
||||
//devLocal '.' // Use this when testing config updates locally
|
||||
}
|
||||
|
||||
|
||||
rootProject.name = "NotEnoughItems"
|
||||
|
||||
@@ -29,7 +29,7 @@ public class BookmarkCraftingChain {
|
||||
public int factor = 0;
|
||||
public int count = 0;
|
||||
public boolean ingredient = false;
|
||||
public boolean fluidCell = false;
|
||||
public int fluidCellAmount = 1;
|
||||
public ItemStack stack = null;
|
||||
|
||||
public CraftingChainItem(ItemStack stack, ItemStackMetadata stackMetadata) {
|
||||
@@ -40,9 +40,9 @@ public class BookmarkCraftingChain {
|
||||
|
||||
if (fluid != null) {
|
||||
this.stackIndex = getStackIndex(fluid);
|
||||
this.count = fluid.amount * Math.max(1, stack.stackSize);
|
||||
this.fluidCell = StackInfo.isFluidContainer(stack);
|
||||
this.factor = this.fluidCell ? fluid.amount : stackMetadata.factor;
|
||||
this.count = fluid.amount * Math.max(0, stack.stackSize);
|
||||
this.fluidCellAmount = StackInfo.isFluidContainer(stack) ? fluid.amount : 1;
|
||||
this.factor = this.fluidCellAmount * stackMetadata.factor;
|
||||
} else {
|
||||
this.stackIndex = getStackIndex(stack);
|
||||
this.count = StackInfo.itemStackToNBT(stack).getInteger("Count");
|
||||
@@ -55,7 +55,7 @@ public class BookmarkCraftingChain {
|
||||
public ItemStack getItemStack(long count) {
|
||||
return StackInfo.loadFromNBT(
|
||||
StackInfo.itemStackToNBT(this.stack),
|
||||
this.factor > 0 ? (this.fluidCell ? (count / this.factor) : count) : 0);
|
||||
this.factor > 0 ? (count / this.fluidCellAmount) : 0);
|
||||
}
|
||||
|
||||
public static void clearStatic() {
|
||||
@@ -144,6 +144,7 @@ public class BookmarkCraftingChain {
|
||||
|
||||
for (int index = 0; index < items.size(); index++) {
|
||||
CraftingChainItem item = new CraftingChainItem(items.get(index), metadata.get(index));
|
||||
item.guid = item.ingredient ? "i" + item.guid : "r" + item.guid;
|
||||
this.items.add(item);
|
||||
|
||||
if (this.multiplier.get(item.recipeIndex) == null) {
|
||||
@@ -274,9 +275,9 @@ public class BookmarkCraftingChain {
|
||||
|
||||
for (CraftingChainItem item : request.outputs.get(stackIndex)) {
|
||||
if (!request.initialItems.contains(item.recipeIndex) && item.factor > 0) {
|
||||
long ingrCount = calculateCount(request, request.inputs.get(item.stackIndex));
|
||||
long ingrCount = calculateCount(request, request.inputs.get(item.stackIndex), item.recipeIndex);
|
||||
long outputCount = calculateCount(request, request.outputs.get(item.stackIndex));
|
||||
long shift = (ingrCount - outputCount) / item.factor;
|
||||
long shift = (long) Math.ceil((ingrCount - outputCount) / (double) item.factor);
|
||||
|
||||
if (shift > 0 && shift < minShift) {
|
||||
minShift = (int) shift;
|
||||
@@ -294,11 +295,17 @@ public class BookmarkCraftingChain {
|
||||
}
|
||||
|
||||
private long calculateCount(CraftingChainRequest request, HashSet<CraftingChainItem> items) {
|
||||
return calculateCount(request, items, -1);
|
||||
}
|
||||
|
||||
private long calculateCount(CraftingChainRequest request, HashSet<CraftingChainItem> items, int recipeIndex) {
|
||||
long count = 0L;
|
||||
|
||||
if (items != null) {
|
||||
for (CraftingChainItem item : items) {
|
||||
count += request.counts.get(item.guid) + item.factor * request.multiplier.get(item.recipeIndex);
|
||||
if (item.recipeIndex != recipeIndex || recipeIndex == -1) {
|
||||
count += request.counts.get(item.guid) + item.factor * request.multiplier.get(item.recipeIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -91,6 +91,44 @@ public class BookmarkPanel extends PanelWidget {
|
||||
this.ungroup = ungroup;
|
||||
this.rowIndexA = rowIndexA;
|
||||
}
|
||||
|
||||
public int getTopRowIndex(BookmarkGrid BGrid) {
|
||||
int topRowIndex = Math.min(this.rowIndexA, this.rowIndexB);
|
||||
int topItemIndex = BGrid.getRowItemIndex(topRowIndex, true);
|
||||
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)) {
|
||||
topItemIndex--;
|
||||
}
|
||||
|
||||
int index = BGrid.getMask().indexOf(topItemIndex);
|
||||
topRowIndex = index == -1 ? 0 : index / BGrid.columns;
|
||||
}
|
||||
|
||||
return topRowIndex;
|
||||
}
|
||||
|
||||
public int getBottomRowIndex(BookmarkGrid BGrid) {
|
||||
int bottomRowIndex = Math.max(this.rowIndexA, this.rowIndexB);
|
||||
int bottomItemIndex = BGrid.getRowItemIndex(bottomRowIndex, false);
|
||||
ItemStackMetadata meta = bottomItemIndex >= 0 ? BGrid.metadata.get(bottomItemIndex) : null;
|
||||
|
||||
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)) {
|
||||
bottomItemIndex++;
|
||||
}
|
||||
|
||||
int index = BGrid.getMask().indexOf(bottomItemIndex);
|
||||
bottomRowIndex = index == -1 ? BGrid.getLastRowIndex() : index / BGrid.columns;
|
||||
}
|
||||
|
||||
return bottomRowIndex;
|
||||
}
|
||||
}
|
||||
|
||||
protected static class ItemStackMetadata {
|
||||
@@ -179,7 +217,9 @@ public class BookmarkPanel extends PanelWidget {
|
||||
|
||||
private static class RecipeTooltipRenderer {
|
||||
|
||||
public int slotIndex = 0;
|
||||
public ItemStack stack = null;
|
||||
public BookmarkRecipeId recipeId = null;
|
||||
|
||||
public GuiRecipe<?> gui = null;
|
||||
public Runnable createRecipeGui = null;
|
||||
}
|
||||
@@ -281,6 +321,7 @@ public class BookmarkPanel extends PanelWidget {
|
||||
|
||||
if (c == 0 && (meta.recipeId == null || meta.ingredient == false
|
||||
|| index + 1 < rows * columns && isInvalidSlot(index + 1)
|
||||
|| previousMeta.groupId != meta.groupId
|
||||
|| meta.ingredient && !meta.recipeId.equals(previousMeta.recipeId))) {
|
||||
// In first column must be an item without recipe, a recipe result, or an ingredient
|
||||
// if the second column is occupied
|
||||
@@ -402,8 +443,8 @@ public class BookmarkPanel extends PanelWidget {
|
||||
int previoudGroupId = DEFAULT_GROUP_ID;
|
||||
|
||||
if (groupingItem != null && groupingItem.rowIndexB != -1) {
|
||||
int topRowIndex = Math.min(groupingItem.rowIndexA, groupingItem.rowIndexB);
|
||||
int bottomRowIndex = Math.max(groupingItem.rowIndexA, groupingItem.rowIndexB);
|
||||
int topRowIndex = groupingItem.getTopRowIndex(this);
|
||||
int bottomRowIndex = groupingItem.getBottomRowIndex(this);
|
||||
int groupIdA = groupMask.get(groupingItem.rowIndexA);
|
||||
int groupId = groupingItem.ungroup ? DEFAULT_GROUP_ID : (groupIdA == DEFAULT_GROUP_ID ? -1 : groupIdA);
|
||||
groupMask = new ArrayList<>(groupMask);
|
||||
@@ -414,12 +455,12 @@ public class BookmarkPanel extends PanelWidget {
|
||||
|
||||
if (groupIdA != DEFAULT_GROUP_ID && !groupingItem.ungroup
|
||||
&& groupingItem.rowIndexA != groupingItem.rowIndexB) {
|
||||
if (groupingItem.rowIndexB == topRowIndex) {
|
||||
if (groupingItem.rowIndexB < groupingItem.rowIndexA) {
|
||||
for (int rowIndex = topRowIndex - 1; rowIndex >= 0
|
||||
&& groupMask.get(rowIndex) == groupIdA; rowIndex--) {
|
||||
groupMask.set(rowIndex, DEFAULT_GROUP_ID);
|
||||
}
|
||||
} else if (groupingItem.rowIndexB == bottomRowIndex) {
|
||||
} else if (groupingItem.rowIndexB > groupingItem.rowIndexA) {
|
||||
for (int rowIndex = bottomRowIndex + 1; rowIndex < groupMask.size()
|
||||
&& groupMask.get(rowIndex) == groupIdA; rowIndex++) {
|
||||
groupMask.set(rowIndex, DEFAULT_GROUP_ID);
|
||||
@@ -633,8 +674,8 @@ public class BookmarkPanel extends PanelWidget {
|
||||
|
||||
protected void createGroup(GroupingItem groupingItem) {
|
||||
final List<Integer> mask = getMask();
|
||||
final int topRowIndex = Math.min(groupingItem.rowIndexA, groupingItem.rowIndexB);
|
||||
final int bottomRowIndex = Math.max(groupingItem.rowIndexA, groupingItem.rowIndexB);
|
||||
final int topRowIndex = groupingItem.getTopRowIndex(this);
|
||||
final int bottomRowIndex = groupingItem.getBottomRowIndex(this);
|
||||
final int groupIdA = getRowGroupId(groupingItem.rowIndexA);
|
||||
final int startMaskIndex = topRowIndex * columns;
|
||||
final int endMaskIntex = Math.min((bottomRowIndex + 1) * columns, mask.size());
|
||||
@@ -1032,16 +1073,17 @@ public class BookmarkPanel extends PanelWidget {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.recipeTooltipRenderer == null || this.recipeTooltipRenderer.slotIndex != focused.slotIndex) {
|
||||
|
||||
if (this.recipeTooltipRenderer == null || this.recipeTooltipRenderer.recipeId != meta.recipeId) {
|
||||
this.recipeTooltipRenderer = new RecipeTooltipRenderer();
|
||||
this.recipeTooltipRenderer.slotIndex = focused.slotIndex;
|
||||
this.recipeTooltipRenderer.stack = this.realItems.get(focused.slotIndex);
|
||||
this.recipeTooltipRenderer.recipeId = meta.recipeId;
|
||||
|
||||
this.recipeTooltipRenderer.createRecipeGui = () -> {
|
||||
final int slotIndex = this.recipeTooltipRenderer.slotIndex;
|
||||
final BookmarkRecipeId recipeId = this.metadata.get(slotIndex).recipeId;
|
||||
GuiRecipe<?> gui = GuiCraftingRecipe
|
||||
.createRecipeGui("recipeId", false, this.realItems.get(slotIndex), recipeId);
|
||||
GuiRecipe<?> gui = GuiCraftingRecipe.createRecipeGui(
|
||||
"recipeId",
|
||||
false,
|
||||
this.recipeTooltipRenderer.stack,
|
||||
this.recipeTooltipRenderer.recipeId);
|
||||
|
||||
if (gui != null) {
|
||||
gui.initGui();
|
||||
@@ -1285,12 +1327,21 @@ public class BookmarkPanel extends PanelWidget {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected int getHoveredGroupId() {
|
||||
public int getHoveredGroupId(boolean groupPanel) {
|
||||
final BookmarkGrid BGrid = (BookmarkGrid) grid;
|
||||
final int overRowIndex = BGrid.getHoveredRowIndex(true);
|
||||
final int overRowIndex = BGrid.getHoveredRowIndex(groupPanel);
|
||||
return overRowIndex >= 0 ? BGrid.getRowGroupId(overRowIndex) : -1;
|
||||
}
|
||||
|
||||
public void removeGroup(int groupId) {
|
||||
final BookmarkGrid BGrid = (BookmarkGrid) grid;
|
||||
|
||||
if (groupId >= 0 || groupId < BGrid.groups.size()) {
|
||||
BGrid.removeGroup(groupId);
|
||||
saveBookmarks();
|
||||
}
|
||||
}
|
||||
|
||||
protected String getNamespaceLabelText(boolean shortFormat) {
|
||||
String activePage = String.valueOf(activeNamespaceIndex + 1);
|
||||
|
||||
@@ -1580,7 +1631,7 @@ public class BookmarkPanel extends PanelWidget {
|
||||
itemStr);
|
||||
}
|
||||
|
||||
} catch (IllegalArgumentException | JsonSyntaxException e) {
|
||||
} catch (IllegalArgumentException | JsonSyntaxException | IllegalStateException e) {
|
||||
NEIClientConfig.logger.error("Failed to load bookmarked ItemStack from json string:\n{}", itemStr);
|
||||
}
|
||||
}
|
||||
@@ -1951,32 +2002,6 @@ public class BookmarkPanel extends PanelWidget {
|
||||
return super.handleTooltip(mx, my, tooltip);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleKeyPress(int keyID, char keyChar) {
|
||||
|
||||
if (NEIClientConfig.isKeyHashDown("gui.bookmark_pull_items")) {
|
||||
return this.pullBookmarkItems(this.getHoveredGroupId(), false);
|
||||
}
|
||||
|
||||
if (NEIClientConfig.isKeyHashDown("gui.bookmark_pull_items_ingredients")) {
|
||||
return this.pullBookmarkItems(this.getHoveredGroupId(), true);
|
||||
}
|
||||
|
||||
if (NEIClientConfig.isKeyHashDown("gui.bookmark_recipe")) {
|
||||
final BookmarkGrid BGrid = (BookmarkGrid) grid;
|
||||
final int overRowIndex = BGrid.getHoveredRowIndex(true);
|
||||
|
||||
if (overRowIndex >= 0) {
|
||||
BGrid.removeGroup(BGrid.getRowGroupId(overRowIndex));
|
||||
saveBookmarks();
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return super.handleKeyPress(keyID, keyChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseUp(int mousex, int mousey, int button) {
|
||||
|
||||
@@ -2005,6 +2030,7 @@ public class BookmarkPanel extends PanelWidget {
|
||||
|
||||
this.mouseDownSlot = -1;
|
||||
this.groupingItem = null;
|
||||
grid.onItemsChanged(); /* make sure grid redraws the new item */
|
||||
saveBookmarks();
|
||||
} else {
|
||||
super.mouseUp(mousex, mousey, button);
|
||||
@@ -2092,7 +2118,7 @@ public class BookmarkPanel extends PanelWidget {
|
||||
* meta.factor;
|
||||
|
||||
if (count <= Integer.MAX_VALUE) {
|
||||
return StackInfo.loadFromNBT(nbTag, Math.max((int) count, 0));
|
||||
return StackInfo.loadFromNBT(nbTag, Math.max(count, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2109,7 +2135,7 @@ public class BookmarkPanel extends PanelWidget {
|
||||
|
||||
final BookmarkGrid BGrid = (BookmarkGrid) grid;
|
||||
final ArrayList<ItemStack> items = new ArrayList<>();
|
||||
final ItemStackMap<Integer> uniqueItems = new ItemStackMap<>();
|
||||
final ItemStackMap<Long> uniqueItems = new ItemStackMap<>();
|
||||
final BookmarkGroup group = groupId >= 0 ? BGrid.groups.get(groupId) : null;
|
||||
ItemStackMetadata meta;
|
||||
|
||||
@@ -2121,16 +2147,21 @@ public class BookmarkPanel extends PanelWidget {
|
||||
|
||||
if (!onlyIngredients || meta.ingredient && (group == null || group.crafting == null
|
||||
|| group.crafting.inputs.containsKey(BGrid.realItems.get(idx)))) {
|
||||
final NBTTagCompound nbTag = StackInfo.itemStackToNBT(stack);
|
||||
uniqueItems.put(stack, uniqueItems.getOrDefault(stack, 0) + nbTag.getInteger("Count"));
|
||||
uniqueItems.put(
|
||||
stack,
|
||||
uniqueItems.getOrDefault(stack, 0L) + StackInfo.itemStackToNBT(stack).getInteger("Count"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
for (ItemStackMap.Entry<Integer> entry : uniqueItems.entries()) {
|
||||
final NBTTagCompound nbTag = StackInfo.itemStackToNBT(entry.key);
|
||||
items.add(StackInfo.loadFromNBT(nbTag, entry.value));
|
||||
for (ItemStackMap.Entry<Long> entry : uniqueItems.entries()) {
|
||||
if (entry.value > 0) {
|
||||
items.add(
|
||||
StackInfo.loadFromNBT(
|
||||
StackInfo.itemStackToNBT(entry.key),
|
||||
Math.min(entry.value, 9 * 4 * entry.key.getMaxStackSize())));
|
||||
}
|
||||
}
|
||||
|
||||
if (items.isEmpty()) {
|
||||
|
||||
@@ -0,0 +1,205 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.drawRect;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.nei.ItemPanel.ItemPanelSlot;
|
||||
import codechicken.nei.recipe.GuiCraftingRecipe;
|
||||
import codechicken.nei.recipe.GuiRecipe;
|
||||
import codechicken.nei.recipe.GuiUsageRecipe;
|
||||
import codechicken.nei.recipe.StackInfo;
|
||||
|
||||
public class ItemHistoryPanel extends Widget {
|
||||
|
||||
protected int mouseDownSlot = -1;
|
||||
protected ItemsGrid grid;
|
||||
|
||||
public ItemHistoryPanel() {
|
||||
grid = new ItemsGrid();
|
||||
}
|
||||
|
||||
public void draw(int mousex, int mousey) {
|
||||
|
||||
if (NEIClientConfig.getIntSetting("inventory.history.splittingMode") == 0) {
|
||||
drawRect(x, y, w, h, NEIClientConfig.getSetting("inventory.history.historyColor").getHexValue());
|
||||
} else {
|
||||
drawSplittingArea(x, y, w, h, NEIClientConfig.getSetting("inventory.history.historyColor").getHexValue());
|
||||
}
|
||||
|
||||
grid.draw(mousex, mousey);
|
||||
}
|
||||
|
||||
public void update() {
|
||||
grid.update();
|
||||
}
|
||||
|
||||
public void addItem(ItemStack stack) {
|
||||
if (stack != null) {
|
||||
ItemStack is = StackInfo.loadFromNBT(StackInfo.itemStackToNBT(stack), 0);
|
||||
|
||||
grid.realItems.removeIf(historyStack -> StackInfo.equalItemAndNBT(historyStack, stack, true));
|
||||
grid.realItems.add(0, is);
|
||||
|
||||
if (grid.realItems.size() > (grid.rows * grid.columns)) {
|
||||
grid.realItems.remove(grid.rows * grid.columns);
|
||||
}
|
||||
|
||||
grid.onItemsChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public void resize(GuiContainer gui) {
|
||||
grid.setGridSize(x, y, w, h);
|
||||
grid.refresh(gui);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackMouseOver(int mousex, int mousey) {
|
||||
ItemPanelSlot slot = getSlotMouseOver(mousex, mousey);
|
||||
return slot == null ? null : slot.item;
|
||||
}
|
||||
|
||||
public ItemPanelSlot getSlotMouseOver(int mousex, int mousey) {
|
||||
return grid.getSlotMouseOver(mousex, mousey);
|
||||
}
|
||||
|
||||
private void drawSplittingArea(int x, int y, int width, int height, int color) {
|
||||
|
||||
float alpha = (float) (color >> 24 & 255) / 255.0F;
|
||||
float red = (float) (color >> 16 & 255) / 255.0F;
|
||||
float green = (float) (color >> 8 & 255) / 255.0F;
|
||||
float blue = (float) (color & 255) / 255.0F;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_LINE_STIPPLE);
|
||||
GL11.glColor4f(red, green, blue, alpha);
|
||||
GL11.glLineWidth(2F);
|
||||
GL11.glLineStipple(2, (short) 0x00FF);
|
||||
|
||||
GL11.glBegin(GL11.GL_LINE_LOOP);
|
||||
|
||||
GL11.glVertex2i(x, y);
|
||||
GL11.glVertex2i(x + width, y);
|
||||
GL11.glVertex2i(x + width, y + height);
|
||||
GL11.glVertex2i(x, y + height);
|
||||
|
||||
GL11.glEnd();
|
||||
|
||||
GL11.glLineStipple(1, (short) 0xFFFF);
|
||||
GL11.glLineWidth(1F);
|
||||
GL11.glDisable(GL11.GL_LINE_STIPPLE);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseDragged(int mousex, int mousey, int button, long heldTime) {
|
||||
|
||||
if (mouseDownSlot >= 0 && ItemPanels.itemPanel.draggedStack == null
|
||||
&& NEIClientUtils.getHeldItem() == null
|
||||
&& NEIClientConfig.hasSMPCounterPart()) {
|
||||
|
||||
ItemPanelSlot mouseOverSlot = getSlotMouseOver(mousex, mousey);
|
||||
|
||||
if (mouseOverSlot == null || mouseOverSlot.slotIndex != mouseDownSlot || heldTime > 500) {
|
||||
ItemPanels.itemPanel.draggedStack = getDraggedStackWithQuantity(mouseDownSlot);
|
||||
mouseDownSlot = -1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleClick(int mousex, int mousey, int button) {
|
||||
|
||||
if (handleClickExt(mousex, mousey, button)) return true;
|
||||
|
||||
if (NEIClientUtils.getHeldItem() != null) {
|
||||
|
||||
if (!grid.contains(mousex, mousey)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (NEIClientConfig.canPerformAction("delete") && NEIClientConfig.canPerformAction("item")) {
|
||||
if (button == 1) {
|
||||
NEIClientUtils.decreaseSlotStack(-999);
|
||||
} else {
|
||||
NEIClientUtils.deleteHeldItem();
|
||||
}
|
||||
} else {
|
||||
NEIClientUtils.dropHeldItem();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
ItemPanelSlot hoverSlot = getSlotMouseOver(mousex, mousey);
|
||||
if (hoverSlot != null) {
|
||||
|
||||
if (button == 2) {
|
||||
|
||||
if (hoverSlot.item != null) {
|
||||
ItemPanels.itemPanel.draggedStack = getDraggedStackWithQuantity(hoverSlot.slotIndex);
|
||||
}
|
||||
|
||||
} else {
|
||||
mouseDownSlot = hoverSlot.slotIndex;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseUp(int mousex, int mousey, int button) {
|
||||
ItemPanelSlot hoverSlot = getSlotMouseOver(mousex, mousey);
|
||||
|
||||
if (hoverSlot != null && hoverSlot.slotIndex == mouseDownSlot && ItemPanels.itemPanel.draggedStack == null) {
|
||||
ItemStack item = hoverSlot.item.copy();
|
||||
|
||||
if (NEIController.manager.window instanceof GuiRecipe || !NEIClientConfig.canCheatItem(item)) {
|
||||
|
||||
if (button == 0) {
|
||||
GuiCraftingRecipe.openRecipeGui("item", item);
|
||||
} else if (button == 1) {
|
||||
GuiUsageRecipe.openRecipeGui("item", item);
|
||||
}
|
||||
|
||||
mouseDownSlot = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
NEIClientUtils.cheatItem(getDraggedStackWithQuantity(hoverSlot.slotIndex), button, -1);
|
||||
}
|
||||
|
||||
mouseDownSlot = -1;
|
||||
}
|
||||
|
||||
protected ItemStack getDraggedStackWithQuantity(int mouseDownSlot) {
|
||||
ItemStack stack = grid.getItem(mouseDownSlot);
|
||||
|
||||
if (stack != null) {
|
||||
int amount = NEIClientConfig.showItemQuantityWidget() ? NEIClientConfig.getItemQuantity() : 0;
|
||||
|
||||
if (amount == 0) {
|
||||
amount = stack.getMaxStackSize();
|
||||
}
|
||||
|
||||
return NEIServerUtils.copyStack(stack, amount);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@@ -84,20 +85,18 @@ public class ItemList {
|
||||
this.filters = filters;
|
||||
}
|
||||
|
||||
public AllMultiItemFilter() {
|
||||
this(new LinkedList<>());
|
||||
public AllMultiItemFilter(ItemFilter... filters) {
|
||||
this(Arrays.asList(filters));
|
||||
}
|
||||
|
||||
public AllMultiItemFilter(ItemFilter a, ItemFilter b) {
|
||||
this.filters = new ArrayList<>();
|
||||
this.filters.add(a);
|
||||
this.filters.add(b);
|
||||
public AllMultiItemFilter() {
|
||||
this(new LinkedList<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(ItemStack item) {
|
||||
for (ItemFilter filter : filters) try {
|
||||
if (!filter.matches(item)) return false;
|
||||
if (filter != null && !filter.matches(item)) return false;
|
||||
} catch (Exception e) {
|
||||
NEIClientConfig.logger.error("Exception filtering " + item + " with " + filter, e);
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ public class ItemPanel extends PanelWidget {
|
||||
public Button more;
|
||||
public Button less;
|
||||
public ItemQuantityField quantity;
|
||||
public ItemHistoryPanel historyPanel;
|
||||
|
||||
public static class ItemPanelSlot {
|
||||
|
||||
@@ -134,6 +135,7 @@ public class ItemPanel extends PanelWidget {
|
||||
};
|
||||
|
||||
quantity = new ItemQuantityField("quantity");
|
||||
historyPanel = new ItemHistoryPanel();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@@ -166,7 +168,10 @@ public class ItemPanel extends PanelWidget {
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -191,20 +196,46 @@ public class ItemPanel extends PanelWidget {
|
||||
less.y = more.y + more.h;
|
||||
}
|
||||
|
||||
return BUTTON_SIZE + 2;
|
||||
if (NEIClientConfig.showHistoryPanelWidget()) {
|
||||
historyPanel.x = x;
|
||||
historyPanel.w = w;
|
||||
historyPanel.h = ItemsGrid.SLOT_SIZE * NEIClientConfig.getIntSetting("inventory.history.useRows");
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisible() {
|
||||
super.setVisible();
|
||||
|
||||
if (grid.getPerPage() > 0 && NEIClientConfig.showItemQuantityWidget()) {
|
||||
LayoutManager.addWidget(more);
|
||||
LayoutManager.addWidget(less);
|
||||
LayoutManager.addWidget(quantity);
|
||||
if (grid.getPerPage() > 0) {
|
||||
if (NEIClientConfig.showItemQuantityWidget()) {
|
||||
LayoutManager.addWidget(more);
|
||||
LayoutManager.addWidget(less);
|
||||
LayoutManager.addWidget(quantity);
|
||||
}
|
||||
|
||||
if (NEIClientConfig.showHistoryPanelWidget()) {
|
||||
LayoutManager.addWidget(historyPanel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resize(GuiContainer gui) {
|
||||
super.resize(gui);
|
||||
historyPanel.resize(gui);
|
||||
}
|
||||
|
||||
protected ItemStack getDraggedStackWithQuantity(int mouseDownSlot) {
|
||||
ItemStack stack = grid.getItem(mouseDownSlot);
|
||||
|
||||
|
||||
@@ -825,9 +825,21 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
drawTexturedModalRect(x2, y2, tx2, ty2, w2, h2); // bottom right
|
||||
}
|
||||
|
||||
public static void drawItemPresenceOverlay(int slotX, int slotY, boolean isPresent) {
|
||||
Image icon = itemPresenceOverlays[isPresent ? 1 : 0];
|
||||
drawIcon(slotX + 16 - icon.width, slotY + 16 - icon.height, icon);
|
||||
public static void drawItemPresenceOverlay(int slotX, int slotY, boolean isPresent, boolean slotHighlight) {
|
||||
|
||||
if (slotHighlight) {
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glTranslatef(0, 0, -150);
|
||||
drawRect(slotX, slotY, 16, 16, isPresent ? 0x8000AA00 : 0x80AA0000);
|
||||
GL11.glTranslatef(0, 0, 150);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
} else {
|
||||
Image icon = itemPresenceOverlays[isPresent ? 1 : 0];
|
||||
drawIcon(slotX + 16 - icon.width, slotY + 16 - icon.height, icon);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static LayoutManager instance() {
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@@ -42,6 +43,7 @@ import codechicken.nei.config.GuiOptionList;
|
||||
import codechicken.nei.config.GuiPanelSettings;
|
||||
import codechicken.nei.config.OptionCycled;
|
||||
import codechicken.nei.config.OptionGamemodes;
|
||||
import codechicken.nei.config.OptionIntegerField;
|
||||
import codechicken.nei.config.OptionList;
|
||||
import codechicken.nei.config.OptionOpenGui;
|
||||
import codechicken.nei.config.OptionTextField;
|
||||
@@ -161,6 +163,19 @@ public class NEIClientConfig {
|
||||
|
||||
ItemSorter.initConfig(tag);
|
||||
|
||||
tag.getTag("inventory.history.enabled").setComment("Enable/disable History Panel").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.history.enabled", true));
|
||||
|
||||
tag.getTag("inventory.history.historyColor").setComment("Color of the history area display")
|
||||
.getHexValue(0xee555555);
|
||||
API.addOption(new OptionIntegerField("inventory.history.historyColor"));
|
||||
|
||||
tag.getTag("inventory.history.useRows").setComment("Rows used in historical areas").getIntValue(2);
|
||||
API.addOption(new OptionIntegerField("inventory.history.useRows", 1, 5));
|
||||
|
||||
tag.getTag("inventory.history.splittingMode").getIntValue(1);
|
||||
API.addOption(new OptionCycled("inventory.history.splittingMode", 2, true));
|
||||
|
||||
tag.getTag("inventory.itemIDs").getIntValue(1);
|
||||
API.addOption(new OptionCycled("inventory.itemIDs", 3, true));
|
||||
|
||||
@@ -261,9 +276,11 @@ public class NEIClientConfig {
|
||||
tag.getTag("inventory.jei_style_tabs").setComment("Enable/disable JEI Style Tabs").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButtonBoubs("inventory.jei_style_tabs", true));
|
||||
|
||||
tag.getTag("inventory.jei_style_item_presence_overlay")
|
||||
.setComment("Enable/disable JEI Style item presence overlay on ?-hover").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.jei_style_item_presence_overlay", true));
|
||||
tag.getTag("inventory.itemPresenceOverlay").setComment("Item presence overlay on ?-hover").getIntValue(1);
|
||||
API.addOption(new OptionCycled("inventory.itemPresenceOverlay", 3, true));
|
||||
|
||||
tag.getTag("inventory.slotHighlightPresent").setComment("Highlight Present Item").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.slotHighlightPresent", true));
|
||||
|
||||
tag.getTag("inventory.jei_style_recipe_catalyst").setComment("Enable/disable JEI Style Recipe Catalysts")
|
||||
.getBooleanValue(true);
|
||||
@@ -380,6 +397,8 @@ public class NEIClientConfig {
|
||||
API.addKeyBind("world.rain", 0);
|
||||
API.addKeyBind("world.heal", 0);
|
||||
API.addKeyBind("world.creative", 0);
|
||||
API.addHashBind("gui.copy_name", Keyboard.KEY_C + NEIClientUtils.CTRL_HASH);
|
||||
API.addHashBind("gui.copy_oredict", Keyboard.KEY_D + NEIClientUtils.CTRL_HASH);
|
||||
}
|
||||
|
||||
public static OptionList getOptionList() {
|
||||
@@ -432,12 +451,20 @@ public class NEIClientConfig {
|
||||
}
|
||||
|
||||
public static void unloadWorld() {
|
||||
ItemPanels.bookmarkPanel.saveBookmarks();
|
||||
world.saveNBT();
|
||||
if (ItemPanels.bookmarkPanel != null) {
|
||||
ItemPanels.bookmarkPanel.saveBookmarks();
|
||||
}
|
||||
|
||||
if (world != null) {
|
||||
world.saveNBT();
|
||||
}
|
||||
}
|
||||
|
||||
private static final Map<String, String> keySettings = new HashMap<>();
|
||||
|
||||
public static int getKeyBinding(String string) {
|
||||
return getSetting("keys." + string).getIntValue(Keyboard.KEY_NONE);
|
||||
final String key = keySettings.computeIfAbsent(string, (s) -> "keys." + s);
|
||||
return getSetting(key).getIntValue(Keyboard.KEY_NONE);
|
||||
}
|
||||
|
||||
public static void setDefaultKeyBinding(String string, int key) {
|
||||
@@ -592,8 +619,12 @@ public class NEIClientConfig {
|
||||
return getBooleanSetting("inventory.jei_style_tabs");
|
||||
}
|
||||
|
||||
public static boolean isJEIStyleItemPresenceOverlayVisible() {
|
||||
return getBooleanSetting("inventory.jei_style_item_presence_overlay");
|
||||
public static int itemPresenceOverlay() {
|
||||
return getIntSetting("inventory.itemPresenceOverlay");
|
||||
}
|
||||
|
||||
public static boolean isSlotHighlightPresent() {
|
||||
return getBooleanSetting("inventory.slotHighlightPresent");
|
||||
}
|
||||
|
||||
public static boolean areJEIStyleRecipeCatalystsVisible() {
|
||||
@@ -707,6 +738,10 @@ public class NEIClientConfig {
|
||||
return !getBooleanSetting("inventory.invertMouseScrollTransfer");
|
||||
}
|
||||
|
||||
public static boolean showHistoryPanelWidget() {
|
||||
return getBooleanSetting("inventory.history.enabled");
|
||||
}
|
||||
|
||||
public static boolean shouldCacheItemRendering() {
|
||||
return getBooleanSetting("inventory.cacheItemRendering") && OpenGlHelper.framebufferSupported;
|
||||
}
|
||||
|
||||
@@ -1,54 +1,14 @@
|
||||
package codechicken.nei.api;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
public interface IRecipeFilter {
|
||||
|
||||
public static interface IRecipeFilterProvider {
|
||||
|
||||
static HashMap<String, Boolean> override = new HashMap<>();
|
||||
|
||||
static boolean filteringAvailable(IRecipeHandler handler) {
|
||||
return handler instanceof TemplateRecipeHandler && !overrideMethod(handler.getClass().getName());
|
||||
}
|
||||
|
||||
static boolean overrideMethod(String className) {
|
||||
try {
|
||||
|
||||
if (override.containsKey(className)) {
|
||||
return override.get(className);
|
||||
}
|
||||
|
||||
String[] methods = new String[] { "getResultStack", "getOtherStacks", "getIngredientStacks" };
|
||||
Class<?> cls = Class.forName(className);
|
||||
|
||||
for (String method : methods) {
|
||||
Method m = cls.getMethod(method, Integer.TYPE);
|
||||
if (!m.getDeclaringClass().getName().equals("codechicken.nei.recipe.TemplateRecipeHandler")) {
|
||||
override.put(className, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Method m = cls.getMethod("numRecipes");
|
||||
if (!m.getDeclaringClass().getName().equals("codechicken.nei.recipe.TemplateRecipeHandler")) {
|
||||
override.put(className, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
override.put(className, false);
|
||||
return false;
|
||||
} catch (Throwable e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public IRecipeFilter getFilter();
|
||||
}
|
||||
|
||||
|
||||
@@ -3,10 +3,13 @@ package codechicken.nei.api;
|
||||
import static codechicken.lib.gui.GuiDraw.getMousePosition;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.datatransfer.StringSelection;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
@@ -20,8 +23,6 @@ import codechicken.nei.recipe.BookmarkRecipeId;
|
||||
import codechicken.nei.recipe.GuiCraftingRecipe;
|
||||
import codechicken.nei.recipe.GuiRecipe;
|
||||
import codechicken.nei.recipe.GuiUsageRecipe;
|
||||
import codechicken.nei.recipe.StackInfo;
|
||||
import codechicken.nei.recipe.stackinfo.GTFluidStackStringifyHandler;
|
||||
|
||||
public abstract class ShortcutInputHandler {
|
||||
|
||||
@@ -35,6 +36,23 @@ public abstract class ShortcutInputHandler {
|
||||
return hideOverlayRecipe();
|
||||
}
|
||||
|
||||
if (NEIClientConfig.isKeyHashDown("gui.bookmark_pull_items")) {
|
||||
return ItemPanels.bookmarkPanel.pullBookmarkItems(ItemPanels.bookmarkPanel.getHoveredGroupId(true), false);
|
||||
}
|
||||
|
||||
if (NEIClientConfig.isKeyHashDown("gui.bookmark_pull_items_ingredients")) {
|
||||
return ItemPanels.bookmarkPanel.pullBookmarkItems(ItemPanels.bookmarkPanel.getHoveredGroupId(true), true);
|
||||
}
|
||||
|
||||
if (stackover == null && NEIClientConfig.isKeyHashDown("gui.bookmark_recipe")) {
|
||||
final int groupId = ItemPanels.bookmarkPanel.getHoveredGroupId(true);
|
||||
|
||||
if (groupId != -1) {
|
||||
ItemPanels.bookmarkPanel.removeGroup(groupId);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (stackover == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -45,16 +63,24 @@ public abstract class ShortcutInputHandler {
|
||||
return openOverlayRecipe(stackover, false);
|
||||
}
|
||||
|
||||
if (NEIClientConfig.isKeyHashDown("gui.copy_name")) {
|
||||
return copyItemStackName(stackover);
|
||||
}
|
||||
|
||||
if (NEIClientConfig.isKeyHashDown("gui.copy_oredict")) {
|
||||
return copyItemStackOreDictionary(stackover);
|
||||
}
|
||||
|
||||
if (NEIClientConfig.isKeyHashDown("gui.overlay_use")) {
|
||||
return openOverlayRecipe(stackover, true);
|
||||
}
|
||||
|
||||
if (NEIClientConfig.isKeyHashDown("gui.recipe")) {
|
||||
return GuiCraftingRecipe.openRecipeGui("item", normalizeItemStack(stackover));
|
||||
return GuiCraftingRecipe.openRecipeGui("item", stackover);
|
||||
}
|
||||
|
||||
if (NEIClientConfig.isKeyHashDown("gui.usage")) {
|
||||
return GuiUsageRecipe.openRecipeGui("item", normalizeItemStack(stackover));
|
||||
return GuiUsageRecipe.openRecipeGui("item", stackover);
|
||||
}
|
||||
|
||||
if (NEIClientConfig.isKeyHashDown("gui.bookmark")) {
|
||||
@@ -84,7 +110,6 @@ public abstract class ShortcutInputHandler {
|
||||
|
||||
if (stackover != null) {
|
||||
final int button = Mouse.getEventButton();
|
||||
stackover = stackover.copy();
|
||||
|
||||
if (button == 0) {
|
||||
return GuiCraftingRecipe.openRecipeGui("item", stackover);
|
||||
@@ -106,6 +131,30 @@ public abstract class ShortcutInputHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean copyItemStackName(ItemStack stackover) {
|
||||
Toolkit.getDefaultToolkit().getSystemClipboard()
|
||||
.setContents(new StringSelection(stackover.getDisplayName()), null);
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean copyItemStackOreDictionary(ItemStack stackover) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
for (int id : OreDictionary.getOreIDs(stackover)) {
|
||||
String oreDictionaryName = OreDictionary.getOreName(id);
|
||||
if (!"Unknown".equals(oreDictionaryName)) {
|
||||
builder.append(oreDictionaryName).append(",");
|
||||
}
|
||||
}
|
||||
|
||||
if (builder.length() > 0) {
|
||||
builder.deleteCharAt(builder.length() - 1);
|
||||
}
|
||||
|
||||
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(builder.toString()), null);
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean openOverlayRecipe(ItemStack stackover, boolean shift) {
|
||||
final GuiContainer gui = NEIClientUtils.getGuiContainer();
|
||||
|
||||
@@ -150,10 +199,4 @@ public abstract class ShortcutInputHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static ItemStack normalizeItemStack(ItemStack stack) {
|
||||
GTFluidStackStringifyHandler.replaceAE2FCFluidDrop = true;
|
||||
stack = StackInfo.loadFromNBT(StackInfo.itemStackToNBT(stack));
|
||||
GTFluidStackStringifyHandler.replaceAE2FCFluidDrop = false;
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,11 @@ public class OptionIntegerField extends OptionTextField {
|
||||
if (s.length() == 0) return true;
|
||||
|
||||
try {
|
||||
Integer.parseInt(s);
|
||||
if (s.startsWith("0x")) {
|
||||
Long.parseLong(s.substring(2), 16);
|
||||
} else {
|
||||
Integer.parseInt(s);
|
||||
}
|
||||
return true;
|
||||
} catch (NumberFormatException nfe) {
|
||||
return false;
|
||||
@@ -30,8 +34,14 @@ public class OptionIntegerField extends OptionTextField {
|
||||
@Override
|
||||
public boolean isValidValue(String s) {
|
||||
if (s.length() == 0 || !isValidInput(s)) return false;
|
||||
int i = 0;
|
||||
|
||||
if (s.startsWith("0x")) {
|
||||
i = (int) Long.parseLong(s.substring(2), 16);
|
||||
} else {
|
||||
i = Integer.parseInt(s);
|
||||
}
|
||||
|
||||
int i = Integer.parseInt(s);
|
||||
return i >= min && i <= max;
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,6 @@ import codechicken.nei.config.GuiOptionList.OptionScrollSlot;
|
||||
|
||||
public class OptionTextField extends Option {
|
||||
|
||||
private boolean focused = false;
|
||||
private TextField textField = new TextField("test") {
|
||||
|
||||
@Override
|
||||
@@ -25,16 +24,11 @@ public class OptionTextField extends Option {
|
||||
getTag().setValue(text());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean focused() {
|
||||
return focused;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFocus(boolean focus) {
|
||||
if (!focus && !isValidValue(text())) setText(renderTag().getValue());
|
||||
|
||||
focused = focus;
|
||||
super.setFocus(focus);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.recipe.StackInfo;
|
||||
import codechicken.nei.util.ReadableNumberConverter;
|
||||
|
||||
public class GuiContainerManager {
|
||||
|
||||
@@ -269,17 +270,33 @@ public class GuiContainerManager {
|
||||
boolean glRescale = GL11.glGetBoolean(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
float zLevel = drawItems.zLevel += 100F;
|
||||
float scale = smallAmount ? 0.5f : 1f;
|
||||
|
||||
try {
|
||||
drawItems.renderItemAndEffectIntoGUI(fontRenderer, renderEngine, itemstack, i, j);
|
||||
|
||||
if (stackSize == null) {
|
||||
stackSize = itemstack.stackSize > 1 ? String.valueOf(itemstack.stackSize) : "";
|
||||
if (itemstack.stackSize > 1) {
|
||||
stackSize = ReadableNumberConverter.INSTANCE.toWideReadableForm(itemstack.stackSize);
|
||||
|
||||
if (stackSize.length() == 3) {
|
||||
scale = 0.8f;
|
||||
} else if (stackSize.length() == 4) {
|
||||
scale = 0.6f;
|
||||
} else if (stackSize.length() > 4) {
|
||||
scale = 0.5f;
|
||||
}
|
||||
|
||||
} else {
|
||||
stackSize = "";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (smallAmount) {
|
||||
if (scale != 1f) {
|
||||
|
||||
if (!stackSize.isEmpty()) {
|
||||
drawBigStackSize(i, j, stackSize);
|
||||
drawBigStackSize(i, j, stackSize, scale);
|
||||
}
|
||||
|
||||
// stackSize = "". it needed for correct draw item with alpha and blend
|
||||
@@ -311,16 +328,15 @@ public class GuiContainerManager {
|
||||
}
|
||||
|
||||
// copy from appeng.client.render.AppEngRenderItem
|
||||
protected static void drawBigStackSize(int offsetX, int offsetY, String stackSize) {
|
||||
final float scaleFactor = fontRenderer.getUnicodeFlag() ? 0.85f : 0.5f;
|
||||
final float inverseScaleFactor = 1.0f / scaleFactor;
|
||||
protected static void drawBigStackSize(int offsetX, int offsetY, String stackSize, float scale) {
|
||||
final float inverseScaleFactor = 1.0f / scale;
|
||||
|
||||
enable2DRender();
|
||||
GL11.glScaled(scaleFactor, scaleFactor, scaleFactor);
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
|
||||
final int X = (int) (((float) offsetX + 16.0f - fontRenderer.getStringWidth(stackSize) * scaleFactor)
|
||||
final int X = (int) (((float) offsetX + 16.0f - fontRenderer.getStringWidth(stackSize) * scale)
|
||||
* inverseScaleFactor);
|
||||
final int Y = (int) (((float) offsetY + 16.0f - 7.0f * scaleFactor) * inverseScaleFactor);
|
||||
final int Y = (int) (((float) offsetY + 16.0f - 7.0f * scale) * inverseScaleFactor);
|
||||
fontRenderer.drawStringWithShadow(stackSize, X, Y, 16777215);
|
||||
|
||||
GL11.glScaled(inverseScaleFactor, inverseScaleFactor, inverseScaleFactor);
|
||||
|
||||
@@ -18,6 +18,7 @@ import codechicken.nei.ItemPanels;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.stackinfo.GTFluidStackStringifyHandler;
|
||||
|
||||
public class GuiCraftingRecipe extends GuiRecipe<ICraftingHandler> {
|
||||
|
||||
@@ -33,6 +34,7 @@ public class GuiCraftingRecipe extends GuiRecipe<ICraftingHandler> {
|
||||
final BookmarkRecipeId recipeId;
|
||||
|
||||
if ("item".equals(outputId)) {
|
||||
results = Arrays.asList(results).stream().map(rslt -> normalizeItemStack((ItemStack) rslt)).toArray();
|
||||
recipeId = getRecipeId(mc.currentScreen, (ItemStack) results[0]);
|
||||
} else if ("recipeId".equals(outputId)) {
|
||||
recipeId = (BookmarkRecipeId) results[1];
|
||||
@@ -114,6 +116,13 @@ public class GuiCraftingRecipe extends GuiRecipe<ICraftingHandler> {
|
||||
return GuiRecipeTab.getHandlerInfo(handler).getHandlerName();
|
||||
}
|
||||
|
||||
private static ItemStack normalizeItemStack(ItemStack stack) {
|
||||
GTFluidStackStringifyHandler.replaceAE2FCFluidDrop = true;
|
||||
stack = StackInfo.loadFromNBT(StackInfo.itemStackToNBT(stack));
|
||||
GTFluidStackStringifyHandler.replaceAE2FCFluidDrop = false;
|
||||
return stack;
|
||||
}
|
||||
|
||||
protected static BookmarkRecipeId getRecipeId(GuiScreen gui, ItemStack stackover) {
|
||||
|
||||
if (gui instanceof GuiRecipe) {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package codechicken.nei.recipe;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.fontRenderer;
|
||||
import static codechicken.nei.NEIClientUtils.translate;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
@@ -14,7 +13,6 @@ import java.util.Optional;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
@@ -31,6 +29,7 @@ import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.Button;
|
||||
import codechicken.nei.GuiNEIButton;
|
||||
import codechicken.nei.LayoutManager;
|
||||
import codechicken.nei.NEICPH;
|
||||
@@ -112,7 +111,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
private final Rectangle area = new Rectangle();
|
||||
private final GuiRecipeTabs recipeTabs;
|
||||
private final GuiRecipeCatalyst guiRecipeCatalyst;
|
||||
private H handler;
|
||||
private SearchRecipeHandler<H> handler;
|
||||
private HandlerInfo handlerInfo;
|
||||
|
||||
private int yShift = 0;
|
||||
@@ -175,10 +174,8 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
this.filters = filters;
|
||||
}
|
||||
|
||||
public AllMultiRecipeFilter(IRecipeFilter a, IRecipeFilter b) {
|
||||
this.filters = new ArrayList<>();
|
||||
this.filters.add(a);
|
||||
this.filters.add(b);
|
||||
public AllMultiRecipeFilter(IRecipeFilter filters) {
|
||||
this(Arrays.asList(filters));
|
||||
}
|
||||
|
||||
public AllMultiRecipeFilter() {
|
||||
@@ -207,22 +204,24 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
|
||||
if (currentScreen instanceof GuiRecipe) {
|
||||
final GuiRecipe<?> guiRecipe = (GuiRecipe<?>) currentScreen;
|
||||
final IRecipeHandler handler = guiRecipe.handler;
|
||||
final SearchRecipeHandler<?> searchHandler = guiRecipe.handler;
|
||||
|
||||
if (handler != null && IRecipeFilterProvider.filteringAvailable(handler)) {
|
||||
if (searchHandler != null && searchHandler.searchingAvailable()) {
|
||||
|
||||
if (GuiRecipe.searchField.text().isEmpty()) {
|
||||
guiRecipe.updateRecipeList(handler, null);
|
||||
searchHandler.setSearchIndices(null);
|
||||
guiRecipe.changePage(0);
|
||||
} else {
|
||||
final IRecipeFilter filter = new ItemRecipeFilter(GuiRecipe.searchField.getFilter());
|
||||
ArrayList<Integer> filtered = ((TemplateRecipeHandler) handler).getSearchResult(filter);
|
||||
ArrayList<Integer> filtered = searchHandler.getSearchResult(filter);
|
||||
|
||||
if (filtered == null) {
|
||||
stop();
|
||||
}
|
||||
|
||||
if (interrupted()) return;
|
||||
guiRecipe.updateRecipeList(handler, filtered);
|
||||
searchHandler.setSearchIndices(filtered);
|
||||
guiRecipe.changePage(0);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -233,12 +232,12 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
|
||||
};
|
||||
|
||||
public static final RecipeSearchField searchField = new RecipeSearchField("") {
|
||||
protected static final RecipeSearchField searchField = new RecipeSearchField("") {
|
||||
|
||||
@Override
|
||||
protected boolean noResults() {
|
||||
GuiScreen currentScreen = NEIClientUtils.mc().currentScreen;
|
||||
return !(currentScreen instanceof GuiRecipe) || ((GuiRecipe<?>) currentScreen).handler.numRecipes() > 0;
|
||||
return !(currentScreen instanceof GuiRecipe) || ((GuiRecipe<?>) currentScreen).numRecipes() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -248,6 +247,28 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
|
||||
};
|
||||
|
||||
protected static final Button toggleSearch = new Button() {
|
||||
|
||||
@Override
|
||||
public boolean onButtonPress(boolean rightclick) {
|
||||
if (rightclick) return false;
|
||||
|
||||
if (searchField.isVisible()) {
|
||||
searchField.setText("");
|
||||
searchField.setFocus(false);
|
||||
searchField.setVisible(false);
|
||||
state = 0;
|
||||
} else {
|
||||
searchField.setVisible(true);
|
||||
searchField.setFocus(true);
|
||||
state = 2;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* This will only be true iff height hacking has been configured for the current recipe handler AND we are currently
|
||||
* within the scope of an active {@link CompatibilityHacks} instance.
|
||||
@@ -310,7 +331,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
trueGuiTop = guiTop;
|
||||
|
||||
isHeightHackApplied = NEIClientConfig.heightHackHandlerRegex.stream()
|
||||
.map(pattern -> pattern.matcher(handler.getHandlerId())).anyMatch(Matcher::matches);
|
||||
.map(pattern -> pattern.matcher(handler.original.getHandlerId())).anyMatch(Matcher::matches);
|
||||
if (isHeightHackApplied) {
|
||||
// guiTop is the top edge of the recipe screen on the y-axis. Old recipe handlers expect a single paging
|
||||
// widget at the top and at the bottom of the recipe screen with a height of 16px each, but GTNH NEI
|
||||
@@ -395,6 +416,8 @@ 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, 76, 10, 10).build();
|
||||
|
||||
buttonList.addAll(Arrays.asList(nexttype, prevtype, nextpage, prevpage));
|
||||
|
||||
if (currenthandlers.size() == 1) {
|
||||
@@ -437,34 +460,23 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
itemPresenceCacheRecipe = -1;
|
||||
}
|
||||
|
||||
public static IRecipeFilter getRecipeListFilter(IRecipeHandler handler) {
|
||||
if (IRecipeFilterProvider.filteringAvailable(handler)) {
|
||||
LinkedList<IRecipeFilter> filters = new LinkedList<>();
|
||||
public static IRecipeFilter getRecipeListFilter() {
|
||||
if (recipeFilterers.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
synchronized (recipeFilterers) {
|
||||
for (IRecipeFilterProvider p : recipeFilterers) {
|
||||
IRecipeFilter filter = p.getFilter();
|
||||
if (filter != null) {
|
||||
filters.add(filter);
|
||||
}
|
||||
final AllMultiRecipeFilter recipeFilter = new AllMultiRecipeFilter();
|
||||
|
||||
synchronized (recipeFilterers) {
|
||||
for (IRecipeFilterProvider p : recipeFilterers) {
|
||||
IRecipeFilter filter = p.getFilter();
|
||||
if (filter != null) {
|
||||
recipeFilter.filters.add(filter);
|
||||
}
|
||||
}
|
||||
|
||||
if (!filters.isEmpty()) {
|
||||
return filters.size() == 1 ? filters.get(0) : new AllMultiRecipeFilter(filters);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void updateRecipeList(IRecipeHandler h, ArrayList<Integer> filtered) {
|
||||
synchronized (handler) {
|
||||
if (handler != null && handler == h && IRecipeFilterProvider.filteringAvailable(handler)) {
|
||||
((TemplateRecipeHandler) handler).applySearch(filtered);
|
||||
changePage(0);
|
||||
}
|
||||
}
|
||||
return recipeFilter.filters.size() == 1 ? recipeFilter.filters.get(0) : recipeFilter;
|
||||
}
|
||||
|
||||
private void checkYShift() {
|
||||
@@ -475,18 +487,19 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
setRecipePage(idx, 0);
|
||||
}
|
||||
|
||||
public void setRecipePage(int idx, int recipe) {
|
||||
public void setRecipePage(int idx, int refIndex) {
|
||||
recipetype = (currenthandlers.size() + idx) % currenthandlers.size();
|
||||
|
||||
handler = currenthandlers.get(recipetype);
|
||||
handlerInfo = GuiRecipeTab.getHandlerInfo(handler);
|
||||
handler = new SearchRecipeHandler<>(currenthandlers.get(recipetype));
|
||||
handlerInfo = GuiRecipeTab.getHandlerInfo(handler.original);
|
||||
|
||||
if (!limitToOneRecipe) {
|
||||
searchField.setText("");
|
||||
searchField.setVisible(false);
|
||||
toggleSearch.state = 0;
|
||||
}
|
||||
|
||||
page = Math.min(Math.max(0, recipe), handler.numRecipes() - 1) / getRecipesPerPage();
|
||||
page = Math.min(Math.max(0, refIndex), this.numRecipes() - 1) / getRecipesPerPage();
|
||||
changePage(0);
|
||||
recipeTabs.calcPageNumber();
|
||||
checkYShift();
|
||||
@@ -498,26 +511,24 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
}
|
||||
|
||||
public int openTargetRecipe(BookmarkRecipeId recipeId) {
|
||||
int recipe = -1;
|
||||
int refIndex = -1;
|
||||
int recipetype = 0;
|
||||
|
||||
this.recipeId = recipeId;
|
||||
|
||||
if (this.recipeId != null) {
|
||||
for (int j = 0; j < currenthandlers.size(); j++) {
|
||||
IRecipeHandler localHandler = currenthandlers.get(j);
|
||||
H localHandler = currenthandlers.get(j);
|
||||
HandlerInfo localHandlerInfo = GuiRecipeTab.getHandlerInfo(localHandler);
|
||||
|
||||
if (localHandlerInfo.getHandlerName().equals(this.recipeId.handlerName)) {
|
||||
recipetype = j;
|
||||
|
||||
if (!this.recipeId.ingredients.isEmpty()) {
|
||||
for (int i = 0; i < localHandler.numRecipes(); i++) {
|
||||
if (this.recipeId.equalsIngredients(localHandler.getIngredientStacks(i))) {
|
||||
recipetype = j;
|
||||
recipe = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
refIndex = SearchRecipeHandler.findFirst(
|
||||
localHandler,
|
||||
(recipeIndex) -> this.recipeId
|
||||
.equalsIngredients(localHandler.getIngredientStacks(recipeIndex)));
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -525,16 +536,18 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
}
|
||||
}
|
||||
|
||||
setRecipePage(recipetype, Math.max(0, recipe));
|
||||
setRecipePage(recipetype, Math.max(0, refIndex));
|
||||
|
||||
return recipe;
|
||||
return refIndex;
|
||||
}
|
||||
|
||||
public List<PositionedStack> getFocusedRecipeIngredients() {
|
||||
List<Integer> indices = getRecipeIndices();
|
||||
|
||||
for (int idx : getRecipeIndices()) {
|
||||
if (recipeInFocus(idx)) {
|
||||
return handler.getIngredientStacks(idx);
|
||||
for (int refIndex = 0; refIndex < indices.size(); refIndex++) {
|
||||
final int recipeIndex = indices.get(refIndex);
|
||||
if (recipeInFocus(refIndex, recipeIndex)) {
|
||||
return handler.original.getIngredientStacks(recipeIndex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -542,17 +555,19 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
}
|
||||
|
||||
public int prepareFocusedRecipeResultStackSize(ItemStack stackover) {
|
||||
List<Integer> indices = getRecipeIndices();
|
||||
|
||||
for (int idx : getRecipeIndices()) {
|
||||
if (recipeInFocus(idx)) {
|
||||
final PositionedStack result = handler.getResultStack(idx);
|
||||
for (int refIndex = 0; refIndex < indices.size(); refIndex++) {
|
||||
final int recipeIndex = indices.get(refIndex);
|
||||
if (recipeInFocus(refIndex, recipeIndex)) {
|
||||
final PositionedStack result = handler.original.getResultStack(recipeIndex);
|
||||
int stackSize = 0;
|
||||
|
||||
if (result != null && StackInfo.equalItemAndNBT(result.item, stackover, true)) {
|
||||
stackSize += result.item.stackSize;
|
||||
}
|
||||
|
||||
final List<PositionedStack> stacks = handler.getOtherStacks(idx);
|
||||
final List<PositionedStack> stacks = handler.original.getOtherStacks(recipeIndex);
|
||||
for (PositionedStack pStack : stacks) {
|
||||
if (StackInfo.equalItemAndNBT(pStack.item, stackover, true)) {
|
||||
stackSize += pStack.item.stackSize;
|
||||
@@ -566,15 +581,16 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
return stackover.stackSize;
|
||||
}
|
||||
|
||||
protected boolean recipeInFocus(int idx) {
|
||||
final PositionedStack result = handler.getResultStack(idx);
|
||||
if (result != null && isMouseOver(result, idx)) {
|
||||
protected boolean recipeInFocus(int refIndex, int recipeIndex) {
|
||||
final PositionedStack result = handler.original.getResultStack(recipeIndex);
|
||||
|
||||
if (result != null && isMouseOver(result, refIndex)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
final List<PositionedStack> stacks = handler.getOtherStacks(idx);
|
||||
final List<PositionedStack> stacks = handler.original.getOtherStacks(recipeIndex);
|
||||
for (PositionedStack stack : stacks) {
|
||||
if (isMouseOver(stack, idx)) {
|
||||
if (isMouseOver(stack, refIndex)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -587,15 +603,24 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
}
|
||||
|
||||
public H getHandler() {
|
||||
return handler;
|
||||
return handler.original;
|
||||
}
|
||||
|
||||
public List<Integer> getRecipeIndices() {
|
||||
final int recipesPerPage = getRecipesPerPage();
|
||||
int minIndex = page * recipesPerPage;
|
||||
int maxIndex = Math.min(handler.numRecipes(), (page + 1) * recipesPerPage);
|
||||
final int minIndex = page * recipesPerPage;
|
||||
final int maxIndex = Math.min(this.numRecipes(), (page + 1) * recipesPerPage);
|
||||
final ArrayList<Integer> range = new ArrayList<>();
|
||||
|
||||
return IntStream.range(minIndex, maxIndex).boxed().collect(Collectors.toList());
|
||||
for (int index = minIndex; index < maxIndex; index++) {
|
||||
range.add(handler.ref(index));
|
||||
}
|
||||
|
||||
return range;
|
||||
}
|
||||
|
||||
private int numRecipes() {
|
||||
return handler == null ? 0 : handler.numRecipes();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -621,8 +646,8 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
}
|
||||
|
||||
try (CompatibilityHacks compatibilityHacks = new CompatibilityHacks()) {
|
||||
for (int recipe : getRecipeIndices()) {
|
||||
if (handler.keyTyped(this, c, i, recipe)) {
|
||||
for (int recipeIndex : getRecipeIndices()) {
|
||||
if (handler.original.keyTyped(this, c, i, recipeIndex)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -647,33 +672,33 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
@Override
|
||||
protected void mouseClicked(int mousex, int mousey, int button) {
|
||||
|
||||
if (!limitToOneRecipe && handler != null && IRecipeFilterProvider.filteringAvailable(handler)) {
|
||||
if (new Rectangle(borderPadding + buttonWidth - 2, 15, xSize - (borderPadding + buttonWidth) * 2 + 2, 16)
|
||||
.contains(mousex - guiLeft, mousey - guiTop)) {
|
||||
searchField.setVisible(true);
|
||||
if (!limitToOneRecipe && handler != null && handler.searchingAvailable()) {
|
||||
if (toggleSearch.contains(mousex - guiLeft, mousey - guiTop)) {
|
||||
toggleSearch.handleClick(mousex - guiLeft, mousey - guiTop, button);
|
||||
} else if (searchField.contains(mousex - guiLeft, mousey - guiTop)) {
|
||||
searchField.handleClick(mousex - guiLeft, mousey - guiTop, button);
|
||||
if (!searchField.focused()) {
|
||||
searchField.setFocus(true);
|
||||
}
|
||||
} else {
|
||||
searchField.onGuiClick(mousex - guiLeft, mousey - guiTop);
|
||||
if (searchField.text().isEmpty() && !searchField.focused()) {
|
||||
searchField.setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try (CompatibilityHacks compatibilityHacks = new CompatibilityHacks()) {
|
||||
for (int recipe : getRecipeIndices()) if (handler.mouseClicked(this, button, recipe)) return;
|
||||
for (int recipeIndex : getRecipeIndices()) {
|
||||
if (handler.original.mouseClicked(this, button, recipeIndex)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (recipeTabs.mouseClicked(mousex, mousey, button)) return;
|
||||
if (recipeTabs.mouseClicked(mousex, mousey, button)) {
|
||||
return;
|
||||
}
|
||||
|
||||
super.mouseClicked(mousex, mousey, button);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseScrolled(int i) {
|
||||
public void mouseScrolled(int scroll) {
|
||||
// Height hacking is not necessary here since mouse scrolling is a new feature, added in
|
||||
// GTNH NEI. So no old mods will use this. Though not hacking the height here does mean that
|
||||
// the value of the height field will be different from in other mouseover methods, which
|
||||
@@ -681,14 +706,18 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
|
||||
// First, invoke scroll handling over recipe handler tabbar. Makes sure it is not overwritten by recipe
|
||||
// handler-specific scroll behavior.
|
||||
if (recipeTabs.mouseScrolled(i)) return;
|
||||
if (recipeTabs.mouseScrolled(scroll)) return;
|
||||
|
||||
for (int recipe : getRecipeIndices()) if (handler.mouseScrolled(this, i, recipe)) return;
|
||||
for (int recipeIndex : getRecipeIndices()) {
|
||||
if (handler.original.mouseScrolled(this, scroll, recipeIndex)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// If shift is held, try switching to the next recipe handler. Replicates the GuiRecipeTabs.mouseScrolled()
|
||||
// without the checking for the cursor being inside the tabbar.
|
||||
if (NEIClientUtils.shiftKey()) {
|
||||
if (i < 0) {
|
||||
if (scroll < 0) {
|
||||
nextType();
|
||||
} else {
|
||||
prevType();
|
||||
@@ -699,7 +728,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
|
||||
// Finally, if nothing else has handled scrolling, try changing to the next recipe page.
|
||||
if (new Rectangle(guiLeft, guiTop, xSize, ySize).contains(GuiDraw.getMousePosition())) {
|
||||
if (i > 0) {
|
||||
if (scroll > 0) {
|
||||
prevPage();
|
||||
} else {
|
||||
nextPage();
|
||||
@@ -727,10 +756,13 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
|
||||
if (overlayButtons != null && guibutton.id >= OVERLAY_BUTTON_ID_START
|
||||
&& guibutton.id < OVERLAY_BUTTON_ID_START + overlayButtons.length) {
|
||||
mc.displayGuiScreen(firstGui);
|
||||
overlayRecipe(
|
||||
page * getRecipesPerPage() + guibutton.id - OVERLAY_BUTTON_ID_START,
|
||||
NEIClientUtils.shiftKey());
|
||||
final List<Integer> indices = getRecipeIndices();
|
||||
final int refIndex = guibutton.id - OVERLAY_BUTTON_ID_START;
|
||||
|
||||
if (refIndex >= 0 && refIndex < indices.size()) {
|
||||
mc.displayGuiScreen(firstGui);
|
||||
overlayRecipe(indices.get(refIndex), NEIClientUtils.shiftKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -742,25 +774,30 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
|
||||
/** updateScreen() that's safe to call when this isn't the currently open GUI */
|
||||
public void updateAsTooltip() {
|
||||
handler.onUpdate();
|
||||
handler.original.onUpdate();
|
||||
refreshPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleTooltip(GuiContainer gui, int mousex, int mousey, List<String> currenttip) {
|
||||
|
||||
try (CompatibilityHacks compatibilityHacks = new CompatibilityHacks()) {
|
||||
for (int i : getRecipeIndices()) currenttip = handler.handleTooltip(this, currenttip, i);
|
||||
for (int recipeIndex : getRecipeIndices()) {
|
||||
currenttip = handler.original.handleTooltip(this, currenttip, recipeIndex);
|
||||
}
|
||||
}
|
||||
|
||||
recipeTabs.handleTooltip(mousex, mousey, currenttip);
|
||||
|
||||
if (currenttip.isEmpty()
|
||||
&& new Rectangle(borderPadding + buttonWidth - 2, 15, xSize - (borderPadding + buttonWidth) * 2 + 2, 16)
|
||||
if (currenttip.isEmpty() && searchField.isVisible()
|
||||
&& new Rectangle(searchField.x + searchField.w, 15, 44, 16)
|
||||
.contains(mousex - guiLeft, mousey - guiTop)) {
|
||||
|
||||
if (!searchField.isVisible() && IRecipeFilterProvider.filteringAvailable(handler)) {
|
||||
currenttip.add(translate("recipe.search.show"));
|
||||
}
|
||||
final String s = String.format("%d/%d", page + 1, (this.numRecipes() - 1) / getRecipesPerPage() + 1);
|
||||
|
||||
if (fontRendererObj.getStringWidth(s) >= 45) {
|
||||
currenttip.add(s);
|
||||
}
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
@@ -769,8 +806,11 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
@Override
|
||||
public List<String> handleItemTooltip(GuiContainer gui, ItemStack stack, int mousex, int mousey,
|
||||
List<String> currenttip) {
|
||||
|
||||
try (CompatibilityHacks compatibilityHacks = new CompatibilityHacks()) {
|
||||
for (int i : getRecipeIndices()) currenttip = handler.handleItemTooltip(this, stack, currenttip, i);
|
||||
for (int recipeIndex : getRecipeIndices()) {
|
||||
currenttip = handler.original.handleItemTooltip(this, stack, currenttip, recipeIndex);
|
||||
}
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
@@ -797,19 +837,19 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
setRecipePage(--recipetype);
|
||||
}
|
||||
|
||||
protected void overlayRecipe(int recipe, final boolean shift) {
|
||||
protected void overlayRecipe(int recipeIndex, final boolean shift) {
|
||||
|
||||
if (handler == null || !handler.hasOverlay(firstGui, firstGui.inventorySlots, recipe)) {
|
||||
if (handler == null || !handler.original.hasOverlay(firstGui, firstGui.inventorySlots, recipeIndex)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final boolean moveItems = shift || !NEIClientConfig.requireShiftForOverlayRecipe();
|
||||
final IRecipeOverlayRenderer renderer = handler.getOverlayRenderer(firstGui, recipe);
|
||||
final IOverlayHandler overlayHandler = handler.getOverlayHandler(firstGui, recipe);
|
||||
final IRecipeOverlayRenderer renderer = handler.original.getOverlayRenderer(firstGui, recipeIndex);
|
||||
final IOverlayHandler overlayHandler = handler.original.getOverlayHandler(firstGui, recipeIndex);
|
||||
|
||||
if (renderer == null || moveItems) {
|
||||
if (overlayHandler != null) {
|
||||
overlayHandler.overlayRecipe(firstGui, handler, recipe, moveItems);
|
||||
overlayHandler.overlayRecipe(firstGui, handler.original, recipeIndex, moveItems);
|
||||
}
|
||||
} else {
|
||||
LayoutManager.overlayRenderer = renderer;
|
||||
@@ -818,7 +858,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
|
||||
protected void changePage(int shift) {
|
||||
final int recipesPerPage = getRecipesPerPage();
|
||||
final int numRecipes = handler != null ? handler.numRecipes() : 0;
|
||||
final int numRecipes = this.numRecipes();
|
||||
|
||||
if (numRecipes > 0) {
|
||||
final int numPages = (int) Math.ceil(numRecipes / (float) recipesPerPage);
|
||||
@@ -835,8 +875,8 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
changePage(0);
|
||||
refreshSlots();
|
||||
final int recipesPerPage = getRecipesPerPage();
|
||||
final boolean multiplepages = handler.numRecipes() > recipesPerPage;
|
||||
final int numRecipes = Math.min(handler.numRecipes() - (page * recipesPerPage), recipesPerPage);
|
||||
final boolean multiplepages = this.numRecipes() > recipesPerPage;
|
||||
final int numRecipes = Math.min(this.numRecipes() - (page * recipesPerPage), recipesPerPage);
|
||||
|
||||
area.width = handlerInfo.getWidth();
|
||||
area.height = handlerInfo.getHeight() * numRecipes;
|
||||
@@ -845,9 +885,13 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
checkYShift();
|
||||
|
||||
if (!limitToOneRecipe) {
|
||||
toggleSearch.w = toggleSearch.h = 12;
|
||||
toggleSearch.x = borderPadding + buttonWidth;
|
||||
toggleSearch.y = 17;
|
||||
|
||||
searchField.y = 16;
|
||||
searchField.x = borderPadding + buttonWidth - 2;
|
||||
searchField.w = xSize - (borderPadding + buttonWidth) * 2 + 1 - 45;
|
||||
searchField.x = borderPadding + buttonWidth + toggleSearch.w - 1;
|
||||
searchField.w = xSize - (borderPadding + buttonWidth) * 2 + 1 - toggleSearch.w - 45;
|
||||
searchField.h = 14;
|
||||
}
|
||||
|
||||
@@ -858,12 +902,13 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
overlay.visible = false;
|
||||
}
|
||||
} else {
|
||||
final List<Integer> indices = getRecipeIndices();
|
||||
for (int i = 0; i < overlayButtons.length; i++) {
|
||||
if (i >= numRecipes) {
|
||||
if (i >= indices.size()) {
|
||||
overlayButtons[i].visible = false;
|
||||
} else {
|
||||
final int curRecipe = page * recipesPerPage + i;
|
||||
overlayButtons[i].visible = handler.hasOverlay(firstGui, firstGui.inventorySlots, curRecipe);
|
||||
overlayButtons[i].visible = handler.original
|
||||
.hasOverlay(firstGui, firstGui.inventorySlots, indices.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -873,8 +918,11 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
|
||||
private void refreshSlots() {
|
||||
slotcontainer.inventorySlots.clear();
|
||||
for (int i : getRecipeIndices()) {
|
||||
Point p = getRecipePosition(i);
|
||||
final List<Integer> indices = getRecipeIndices();
|
||||
|
||||
for (int refIndex = 0; refIndex < indices.size(); refIndex++) {
|
||||
int recipeIndex = indices.get(refIndex);
|
||||
Point p = getRecipePosition(refIndex);
|
||||
// Legacy recipe handlers only expect a single paging widget at the top of the recipe screen, in contrast,
|
||||
// GTNH NEI moves the recipe paging widget from the bottom to the top, which means said legacy handlers will
|
||||
// position item slots 16px too high in the screen.
|
||||
@@ -882,36 +930,40 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
p.translate(0, 16);
|
||||
}
|
||||
|
||||
List<PositionedStack> stacks = handler.getIngredientStacks(i);
|
||||
TemplateRecipeHandler.disableCycledIngredients = false;
|
||||
|
||||
List<PositionedStack> stacks = handler.original.getIngredientStacks(recipeIndex);
|
||||
for (PositionedStack stack : stacks) slotcontainer.addSlot(stack, p.x, p.y);
|
||||
|
||||
stacks = handler.getOtherStacks(i);
|
||||
stacks = handler.original.getOtherStacks(recipeIndex);
|
||||
for (PositionedStack stack : stacks) slotcontainer.addSlot(stack, p.x, p.y);
|
||||
|
||||
PositionedStack result = handler.getResultStack(i);
|
||||
PositionedStack result = handler.original.getResultStack(recipeIndex);
|
||||
if (result != null) slotcontainer.addSlot(result, p.x, p.y);
|
||||
|
||||
if (!limitToOneRecipe) {
|
||||
List<PositionedStack> catalysts = RecipeCatalysts.getRecipeCatalysts(handler);
|
||||
List<PositionedStack> catalysts = RecipeCatalysts.getRecipeCatalysts(handler.original);
|
||||
for (PositionedStack catalyst : catalysts) {
|
||||
int xOffset = -GuiRecipeCatalyst.ingredientSize + 1;
|
||||
int yOffset = BG_TOP_Y + GuiRecipeCatalyst.fullBorder;
|
||||
slotcontainer.addSlot(catalyst, xOffset, yOffset);
|
||||
}
|
||||
}
|
||||
|
||||
TemplateRecipeHandler.disableCycledIngredients = true;
|
||||
}
|
||||
}
|
||||
|
||||
private int itemPresenceCacheRecipe = -1;
|
||||
private ArrayList<Boolean> itemPresenceCacheSlots;
|
||||
|
||||
private void updateItemPresenceCache(int recipe) {
|
||||
private void updateItemPresenceCache(int recipeIndex) {
|
||||
if (itemPresenceCacheSlots == null) {
|
||||
itemPresenceCacheSlots = new ArrayList<>();
|
||||
}
|
||||
itemPresenceCacheRecipe = recipe;
|
||||
itemPresenceCacheRecipe = recipeIndex;
|
||||
itemPresenceCacheSlots.clear();
|
||||
List<PositionedStack> ingredients = handler.getIngredientStacks(recipe);
|
||||
List<PositionedStack> ingredients = handler.original.getIngredientStacks(recipeIndex);
|
||||
ArrayList<ItemStack> invStacks = ((List<Slot>) firstGui.inventorySlots.inventorySlots).stream()
|
||||
.filter(
|
||||
s -> s != null && s.getStack() != null
|
||||
@@ -937,14 +989,18 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
final int ySkip = limitToOneRecipe ? 25 : 0;
|
||||
|
||||
if (!limitToOneRecipe) {
|
||||
String s = handler.getRecipeName().trim();
|
||||
String s = handler.original.getRecipeName().trim();
|
||||
fontRendererObj.drawStringWithShadow(s, (xSize - fontRendererObj.getStringWidth(s)) / 2, 5, 0xffffff);
|
||||
|
||||
if (!limitToOneRecipe && searchField.isVisible()) {
|
||||
if (handler.searchingAvailable()) {
|
||||
toggleSearch.draw(mouseX - guiLeft, mouseY - guiTop);
|
||||
}
|
||||
|
||||
if (searchField.isVisible()) {
|
||||
searchField.draw(mouseX - guiLeft, mouseY - guiTop);
|
||||
s = NEIClientUtils.cropText(
|
||||
fontRendererObj,
|
||||
String.format("%d/%d", page + 1, (handler.numRecipes() - 1) / recipesPerPage + 1),
|
||||
String.format("%d/%d", page + 1, (this.numRecipes() - 1) / recipesPerPage + 1),
|
||||
45);
|
||||
fontRendererObj.drawStringWithShadow(
|
||||
s,
|
||||
@@ -952,33 +1008,44 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
19,
|
||||
0xffffff);
|
||||
} else {
|
||||
s = NEIClientUtils.translate("recipe.page", page + 1, (handler.numRecipes() - 1) / recipesPerPage + 1);
|
||||
s = NEIClientUtils.translate("recipe.page", page + 1, (this.numRecipes() - 1) / recipesPerPage + 1);
|
||||
fontRendererObj.drawStringWithShadow(s, (xSize - fontRendererObj.getStringWidth(s)) / 2, 19, 0xffffff);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
final boolean drawItemPresence = NEIClientConfig.isJEIStyleItemPresenceOverlayVisible();
|
||||
final int presenceOverlay = NEIClientConfig.itemPresenceOverlay();
|
||||
final boolean highlightPresentItem = NEIClientConfig.isSlotHighlightPresent();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(5, 32 - ySkip + yShift, 0);
|
||||
try (CompatibilityHacks compatibilityHacks = new CompatibilityHacks()) {
|
||||
List<Integer> indices = getRecipeIndices();
|
||||
|
||||
for (int i : getRecipeIndices()) {
|
||||
handler.drawForeground(i);
|
||||
for (int refIndex = 0; refIndex < indices.size(); refIndex++) {
|
||||
int recipeIndex = indices.get(refIndex);
|
||||
|
||||
if (drawItemPresence && firstGui != null
|
||||
handler.original.drawForeground(recipeIndex);
|
||||
|
||||
if (presenceOverlay > 0 && firstGui != null
|
||||
&& firstGui.inventorySlots != null
|
||||
&& (isMouseOverOverlayButton(i - page * recipesPerPage) || limitToOneRecipe)) {
|
||||
List<PositionedStack> ingredients = handler.getIngredientStacks(i);
|
||||
if (itemPresenceCacheRecipe != i || itemPresenceCacheSlots == null
|
||||
&& (isMouseOverOverlayButton(refIndex) || limitToOneRecipe)) {
|
||||
|
||||
List<PositionedStack> ingredients = handler.original.getIngredientStacks(recipeIndex);
|
||||
|
||||
if (itemPresenceCacheRecipe != recipeIndex || itemPresenceCacheSlots == null
|
||||
|| itemPresenceCacheSlots.size() != ingredients.size()) {
|
||||
updateItemPresenceCache(i);
|
||||
updateItemPresenceCache(recipeIndex);
|
||||
}
|
||||
|
||||
for (int j = 0; j < ingredients.size(); j++) {
|
||||
PositionedStack stack = ingredients.get(j);
|
||||
boolean isPresent = itemPresenceCacheSlots.get(j);
|
||||
LayoutManager.drawItemPresenceOverlay(stack.relx, stack.rely, isPresent);
|
||||
|
||||
if (highlightPresentItem || !isPresent) {
|
||||
LayoutManager
|
||||
.drawItemPresenceOverlay(stack.relx, stack.rely, isPresent, presenceOverlay == 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -986,6 +1053,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@@ -1023,8 +1091,8 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
GL11.glTranslatef(guiLeft + 5, guiTop - ySkip + 32 + yShift, 0);
|
||||
try (CompatibilityHacks compatibilityHacks = new CompatibilityHacks()) {
|
||||
|
||||
for (int i : getRecipeIndices()) {
|
||||
handler.drawBackground(i);
|
||||
for (int recipeIndex : getRecipeIndices()) {
|
||||
handler.original.drawBackground(recipeIndex);
|
||||
GL11.glTranslatef(0, handlerInfo.getHeight(), 0);
|
||||
}
|
||||
|
||||
@@ -1073,10 +1141,10 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
return firstGuiGeneral;
|
||||
}
|
||||
|
||||
public boolean isMouseOver(PositionedStack stack, int recipe) {
|
||||
Slot stackSlot = slotcontainer
|
||||
.getSlotWithStack(stack, getRecipePosition(recipe).x, getRecipePosition(recipe).y);
|
||||
public boolean isMouseOver(PositionedStack stack, int refIndex) {
|
||||
Point p = getRecipePosition(refIndex);
|
||||
Point mousepos = GuiDraw.getMousePosition();
|
||||
Slot stackSlot = slotcontainer.getSlotWithStack(stack, p.x, p.y);
|
||||
Slot mouseoverSlot = getSlotAtPosition(mousepos.x, mousepos.y);
|
||||
|
||||
return stackSlot == mouseoverSlot;
|
||||
@@ -1107,12 +1175,12 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
handlerInfo.getMaxRecipesPerPage()),
|
||||
1);
|
||||
} else if (handler != null) {
|
||||
return handler.recipiesPerPage();
|
||||
return handler.original.recipiesPerPage();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
public Point getRecipePosition(int recipe) {
|
||||
public Point getRecipePosition(int refIndex) {
|
||||
// Legacy recipe handlers using the height hack might use getRecipePosition in combination with guiTop/height to
|
||||
// position certain elements like tooltips. Since guiTop is moved down by 16px during height hacking, we need to
|
||||
// reduce the vertical shift here to 16px instead of 32px.
|
||||
@@ -1120,7 +1188,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
5,
|
||||
(isHeightHackApplied ? 16 : 32) - (limitToOneRecipe ? 25 : 0)
|
||||
+ yShift
|
||||
+ ((recipe % getRecipesPerPage()) * handlerInfo.getHeight()));
|
||||
+ ((refIndex % getRecipesPerPage()) * handlerInfo.getHeight()));
|
||||
}
|
||||
|
||||
public abstract ArrayList<H> getCurrentRecipeHandlers();
|
||||
@@ -1143,10 +1211,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
@Override
|
||||
public boolean handleDragNDrop(GuiContainer gui, int mousex, int mousey, ItemStack draggedStack, int button) {
|
||||
|
||||
if (!limitToOneRecipe && handler != null
|
||||
&& new Rectangle(borderPadding + buttonWidth - 2, 15, xSize - (borderPadding + buttonWidth) * 2 + 2, 16)
|
||||
.contains(mousex - guiLeft, mousey - guiTop)
|
||||
&& IRecipeFilterProvider.filteringAvailable(handler)) {
|
||||
if (searchField.isVisible() && searchField.contains(mousex - guiLeft, mousey - guiTop)) {
|
||||
final FluidStack fluidStack = StackInfo.getFluid(draggedStack);
|
||||
|
||||
if (fluidStack != null) {
|
||||
@@ -1155,7 +1220,6 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
searchField.setText(formattingText(draggedStack.getDisplayName()));
|
||||
}
|
||||
|
||||
searchField.setVisible(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1175,11 +1239,14 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
|
||||
protected static BookmarkRecipeId getCurrentRecipe(GuiScreen gui) {
|
||||
|
||||
if (gui instanceof GuiRecipe && !((GuiRecipe<?>) gui).handler.isEmpty()) {
|
||||
GuiRecipe<?> gRecipe = (GuiRecipe<?>) gui;
|
||||
if (gui instanceof GuiRecipe && ((GuiRecipe<?>) gui).handler.numRecipes() > 0) {
|
||||
final GuiRecipe<?> gRecipe = (GuiRecipe<?>) gui;
|
||||
final List<Integer> indices = gRecipe.getRecipeIndices();
|
||||
final int curRecipe = indices.isEmpty() ? 0 : indices.get(0);
|
||||
|
||||
return new BookmarkRecipeId(
|
||||
gRecipe.handlerInfo.getHandlerName(),
|
||||
gRecipe.handler.getIngredientStacks(gRecipe.page * gRecipe.getRecipesPerPage()));
|
||||
gRecipe.handler.original.getIngredientStacks(curRecipe));
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -4,9 +4,11 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.recipe.stackinfo.GTFluidStackStringifyHandler;
|
||||
|
||||
public class GuiUsageRecipe extends GuiRecipe<IUsageHandler> {
|
||||
|
||||
@@ -14,29 +16,50 @@ public class GuiUsageRecipe extends GuiRecipe<IUsageHandler> {
|
||||
public static ArrayList<IUsageHandler> serialUsageHandlers = new ArrayList<>();
|
||||
|
||||
public static boolean openRecipeGui(String inputId, Object... ingredients) {
|
||||
RecipeHandlerQuery<IUsageHandler> recipeQuery = new RecipeHandlerQuery<>(
|
||||
|
||||
if ("item".equals(inputId)) {
|
||||
ingredients = Arrays.asList(ingredients).stream().map(ingr -> normalizeItemStack((ItemStack) ingr))
|
||||
.toArray();
|
||||
}
|
||||
|
||||
final ArrayList<IUsageHandler> handlers = getUsageHandlers(inputId, ingredients);
|
||||
|
||||
if (!handlers.isEmpty()) {
|
||||
final Minecraft mc = NEIClientUtils.mc();
|
||||
final BookmarkRecipeId recipeId = getCurrentRecipe(mc.currentScreen);
|
||||
final GuiUsageRecipe gui = new GuiUsageRecipe(handlers);
|
||||
|
||||
mc.displayGuiScreen(gui);
|
||||
gui.openTargetRecipe(recipeId);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private GuiUsageRecipe(ArrayList<IUsageHandler> handlers) {
|
||||
super(NEIClientUtils.mc().currentScreen);
|
||||
this.currenthandlers = handlers;
|
||||
}
|
||||
|
||||
public static ArrayList<IUsageHandler> getUsageHandlers(String inputId, Object... ingredients) {
|
||||
|
||||
final RecipeHandlerQuery<IUsageHandler> recipeQuery = new RecipeHandlerQuery<>(
|
||||
h -> getUsageOrCatalystHandler(h, inputId, ingredients),
|
||||
usagehandlers,
|
||||
serialUsageHandlers,
|
||||
"Error while looking up usage recipe",
|
||||
"inputId: " + inputId,
|
||||
"ingredients: " + Arrays.toString(ingredients));
|
||||
ArrayList<IUsageHandler> handlers = recipeQuery.runWithProfiling("recipe.concurrent.usage");
|
||||
if (handlers.isEmpty()) return false;
|
||||
|
||||
Minecraft mc = NEIClientUtils.mc();
|
||||
BookmarkRecipeId recipeId = getCurrentRecipe(mc.currentScreen);
|
||||
GuiUsageRecipe gui = new GuiUsageRecipe(handlers);
|
||||
|
||||
mc.displayGuiScreen(gui);
|
||||
gui.openTargetRecipe(recipeId);
|
||||
|
||||
return true;
|
||||
return recipeQuery.runWithProfiling("recipe.concurrent.usage");
|
||||
}
|
||||
|
||||
private GuiUsageRecipe(ArrayList<IUsageHandler> handlers) {
|
||||
super(NEIClientUtils.mc().currentScreen);
|
||||
this.currenthandlers = handlers;
|
||||
private static ItemStack normalizeItemStack(ItemStack stack) {
|
||||
GTFluidStackStringifyHandler.replaceAE2FCFluidDrop = true;
|
||||
stack = StackInfo.loadFromNBT(StackInfo.itemStackToNBT(stack));
|
||||
GTFluidStackStringifyHandler.replaceAE2FCFluidDrop = false;
|
||||
return stack;
|
||||
}
|
||||
|
||||
public static void registerUsageHandler(IUsageHandler handler) {
|
||||
|
||||
@@ -50,14 +50,6 @@ public interface IRecipeHandler {
|
||||
*/
|
||||
int numRecipes();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return <tt>true</tt> if this list contains no elements
|
||||
*/
|
||||
default boolean isEmpty() {
|
||||
return numRecipes() == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the background of this recipe handler (basically the slot layout image).
|
||||
*
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
package codechicken.nei.recipe;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import codechicken.nei.ItemPanels;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.api.IOverlayHandler;
|
||||
import codechicken.nei.api.IRecipeOverlayRenderer;
|
||||
|
||||
class ItemsHistoryHandler implements ICraftingHandler, IUsageHandler {
|
||||
|
||||
@Override
|
||||
public ICraftingHandler getRecipeHandler(String outputId, Object... results) {
|
||||
|
||||
if (NEIClientConfig.showHistoryPanelWidget() && "item".equals(outputId) && results[0] instanceof ItemStack) {
|
||||
ItemPanels.itemPanel.historyPanel.addItem((ItemStack) results[0]);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IUsageHandler getUsageHandler(String inputId, Object... ingredients) {
|
||||
|
||||
if (NEIClientConfig.showHistoryPanelWidget() && "item".equals(inputId) && ingredients[0] instanceof ItemStack) {
|
||||
ItemPanels.itemPanel.historyPanel.addItem((ItemStack) ingredients[0]);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasOverlay(GuiContainer gui, Container container, int recipe) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeOverlayRenderer getOverlayRenderer(GuiContainer gui, int recipe) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOverlayHandler getOverlayHandler(GuiContainer gui, int recipe) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int recipiesPerPage() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleTooltip(GuiRecipe<?> gui, List<String> currenttip, int recipe) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleItemTooltip(GuiRecipe<?> gui, ItemStack stack, List<String> currenttip, int recipe) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyTyped(GuiRecipe gui, char keyChar, int keyCode, int recipe) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(GuiRecipe gui, int button, int recipe) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int numRecipes() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(int recipe) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawForeground(int recipe) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredientStacks(int recipe) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getOtherStacks(int recipeType) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResultStack(int recipe) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,8 +12,6 @@ import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
import codechicken.core.TaskProfiler;
|
||||
import codechicken.nei.ItemList;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
@@ -36,7 +34,6 @@ class RecipeHandlerQuery<T extends IRecipeHandler> {
|
||||
|
||||
ArrayList<T> runWithProfiling(String profilerSection) {
|
||||
TaskProfiler profiler = ProfilerRecipeHandler.getProfiler();
|
||||
TemplateRecipeHandler.disableCycledIngredients = true;
|
||||
profiler.start(profilerSection);
|
||||
try {
|
||||
ArrayList<T> handlers = getRecipeHandlersParallel();
|
||||
@@ -50,7 +47,6 @@ class RecipeHandlerQuery<T extends IRecipeHandler> {
|
||||
displayRecipeLookupError();
|
||||
return new ArrayList<>(0);
|
||||
} finally {
|
||||
TemplateRecipeHandler.disableCycledIngredients = false;
|
||||
profiler.end();
|
||||
}
|
||||
}
|
||||
@@ -74,7 +70,8 @@ class RecipeHandlerQuery<T extends IRecipeHandler> {
|
||||
error = true;
|
||||
return null;
|
||||
}
|
||||
}).filter(h -> h != null && !h.isEmpty()).collect(Collectors.toCollection(ArrayList::new));
|
||||
}).filter(h -> h != null && h.numRecipes() > 0 && SearchRecipeHandler.findFirst(h, (recipeIndex) -> true) != -1)
|
||||
.collect(Collectors.toCollection(ArrayList::new));
|
||||
}
|
||||
|
||||
private ArrayList<T> getHandlersWithRecipes() throws InterruptedException, ExecutionException {
|
||||
@@ -87,12 +84,14 @@ class RecipeHandlerQuery<T extends IRecipeHandler> {
|
||||
error = true;
|
||||
return null;
|
||||
}
|
||||
}).filter(h -> h != null && !h.isEmpty()).collect(Collectors.toCollection(ArrayList::new))).get();
|
||||
}).filter(h -> h != null && h.numRecipes() > 0 && SearchRecipeHandler.findFirst(h, (recipeIndex) -> true) != -1)
|
||||
.collect(Collectors.toCollection(ArrayList::new))).get();
|
||||
}
|
||||
|
||||
private boolean isHidden(T handler) {
|
||||
final String handlerId = Objects.firstNonNull(handler.getOverlayIdentifier(), handler.getHandlerId());
|
||||
return NEIClientConfig.hiddenHandlers.stream().anyMatch(h -> h.equals(handlerId));
|
||||
final String handlerName = handler.getHandlerId();
|
||||
final String handlerId = handler.getOverlayIdentifier();
|
||||
return NEIClientConfig.hiddenHandlers.stream().anyMatch(h -> h.equals(handlerId) || h.equals(handlerName));
|
||||
}
|
||||
|
||||
private void printLog(Throwable t) {
|
||||
|
||||
@@ -113,5 +113,7 @@ public class RecipeInfo {
|
||||
|
||||
API.registerRecipeHandler(new ProfilerRecipeHandler(true));
|
||||
API.registerUsageHandler(new ProfilerRecipeHandler(false));
|
||||
API.registerRecipeHandler(new ItemsHistoryHandler());
|
||||
API.registerUsageHandler(new ItemsHistoryHandler());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
package codechicken.nei.recipe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import codechicken.nei.ItemList;
|
||||
import codechicken.nei.api.IRecipeFilter;
|
||||
|
||||
class SearchRecipeHandler<H extends IRecipeHandler> {
|
||||
|
||||
public H original;
|
||||
|
||||
private ArrayList<Integer> filteredRecipes;
|
||||
|
||||
private ArrayList<Integer> searchRecipes;
|
||||
|
||||
public SearchRecipeHandler(H handler) {
|
||||
this.original = handler;
|
||||
|
||||
if (this.original.numRecipes() == 0) {
|
||||
this.filteredRecipes = new ArrayList<>();
|
||||
} else {
|
||||
final Stream<Integer> items = IntStream.range(0, this.original.numRecipes()).boxed();
|
||||
final IRecipeFilter filter = this.searchingAvailable() ? GuiRecipe.getRecipeListFilter() : null;
|
||||
|
||||
if (filter == null) {
|
||||
this.filteredRecipes = items.collect(Collectors.toCollection(ArrayList::new));
|
||||
} else {
|
||||
this.filteredRecipes = items.filter(recipe -> mathRecipe(this.original, recipe, filter))
|
||||
.collect(Collectors.toCollection(ArrayList::new));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected static boolean mathRecipe(IRecipeHandler handler, int recipe, IRecipeFilter filter) {
|
||||
return filter.matches(
|
||||
handler,
|
||||
handler.getIngredientStacks(recipe),
|
||||
handler.getResultStack(recipe),
|
||||
handler.getOtherStacks(recipe));
|
||||
}
|
||||
|
||||
public boolean searchingAvailable() {
|
||||
return SearchRecipeHandler.searchingAvailable(this.original);
|
||||
}
|
||||
|
||||
private static boolean searchingAvailable(IRecipeHandler handler) {
|
||||
return handler instanceof TemplateRecipeHandler;
|
||||
}
|
||||
|
||||
public static int findFirst(IRecipeHandler handler, Predicate<Integer> predicate) {
|
||||
final IRecipeFilter filter = searchingAvailable(handler) ? GuiRecipe.getRecipeListFilter() : null;
|
||||
int refIndex = -1;
|
||||
|
||||
for (int recipeIndex = 0; recipeIndex < handler.numRecipes(); recipeIndex++) {
|
||||
if (filter == null || mathRecipe(handler, recipeIndex, filter)) {
|
||||
refIndex++;
|
||||
|
||||
if (predicate.test(recipeIndex)) {
|
||||
return refIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public ArrayList<Integer> getSearchResult(IRecipeFilter filter) {
|
||||
|
||||
if (filteredRecipes.isEmpty() || !this.searchingAvailable()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ArrayList<Integer> filtered = null;
|
||||
final ArrayList<Integer> recipes = IntStream.range(0, filteredRecipes.size()).boxed()
|
||||
.collect(Collectors.toCollection(ArrayList::new));
|
||||
|
||||
try {
|
||||
filtered = ItemList.forkJoinPool.submit(
|
||||
() -> recipes.parallelStream()
|
||||
.filter(recipe -> mathRecipe(this.original, filteredRecipes.get(recipe), filter))
|
||||
.collect(Collectors.toCollection(ArrayList::new)))
|
||||
.get();
|
||||
|
||||
filtered.sort((a, b) -> a - b);
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
return filtered;
|
||||
}
|
||||
|
||||
public void setSearchIndices(ArrayList<Integer> searchRecipes) {
|
||||
this.searchRecipes = searchRecipes;
|
||||
}
|
||||
|
||||
public int ref(int index) {
|
||||
|
||||
if (searchRecipes != null) {
|
||||
index = searchRecipes.get(index);
|
||||
}
|
||||
|
||||
return filteredRecipes.get(index);
|
||||
}
|
||||
|
||||
public int numRecipes() {
|
||||
|
||||
if (searchRecipes != null) {
|
||||
return searchRecipes.size();
|
||||
}
|
||||
|
||||
return filteredRecipes.size();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -64,7 +64,7 @@ public class StackInfo {
|
||||
|
||||
if (nbtTag != null) {
|
||||
nbtTag = (NBTTagCompound) nbtTag.copy();
|
||||
nbtTag.setInteger("Count", Math.max(customCount <= Integer.MAX_VALUE ? (int) customCount : 0, 0));
|
||||
nbtTag.setInteger("Count", (int) Math.max(Math.min(customCount, Integer.MAX_VALUE), 0));
|
||||
return loadFromNBT(nbtTag);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,6 @@ import java.util.Set;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -37,16 +35,17 @@ 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.api.DefaultOverlayRenderer;
|
||||
import codechicken.nei.api.IOverlayHandler;
|
||||
import codechicken.nei.api.IRecipeFilter;
|
||||
import codechicken.nei.api.IRecipeOverlayRenderer;
|
||||
import codechicken.nei.api.IStackPositioner;
|
||||
import codechicken.nei.api.ItemFilter;
|
||||
import codechicken.nei.api.ItemInfo;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.guihook.IContainerInputHandler;
|
||||
import codechicken.nei.guihook.IContainerTooltipHandler;
|
||||
@@ -199,9 +198,7 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
|
||||
}
|
||||
|
||||
protected void randomRenderPermutation(List<PositionedStack> stacks, long cycle) {
|
||||
final ItemFilter filter = new AllMultiItemFilter(
|
||||
ItemList.getItemListFilter(),
|
||||
GuiRecipe.searchField.getFilter());
|
||||
final ItemFilter filter = getItemFilter();
|
||||
final int randCycle = Math.abs(new Random(cycle + offset).nextInt());
|
||||
|
||||
for (PositionedStack stack : stacks) {
|
||||
@@ -217,9 +214,7 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
|
||||
}
|
||||
|
||||
protected void jeiStyledRenderPermutation(List<PositionedStack> stacks, long cycle) {
|
||||
final ItemFilter filter = new AllMultiItemFilter(
|
||||
ItemList.getItemListFilter(),
|
||||
GuiRecipe.searchField.getFilter());
|
||||
final ItemFilter filter = getItemFilter();
|
||||
|
||||
for (PositionedStack stack : stacks) {
|
||||
if (stack.items.length <= 1) continue;
|
||||
@@ -428,17 +423,20 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
|
||||
*/
|
||||
public LinkedList<RecipeTransferRect> transferRects = new LinkedList<>();
|
||||
|
||||
public static boolean disableCycledIngredients = false;
|
||||
|
||||
protected ArrayList<Integer> filteredRecipes;
|
||||
|
||||
protected ArrayList<Integer> searchRecipes;
|
||||
public static boolean disableCycledIngredients = true;
|
||||
|
||||
public TemplateRecipeHandler() {
|
||||
loadTransferRects();
|
||||
RecipeTransferRectHandler.registerRectsToGuis(getRecipeTransferRectGuis(), transferRects);
|
||||
}
|
||||
|
||||
protected static ItemFilter getItemFilter() {
|
||||
return new AllMultiItemFilter(
|
||||
item -> !ItemInfo.hiddenItems.contains(item),
|
||||
LayoutManager.presetsPanel != null ? LayoutManager.presetsPanel.getFilter() : null,
|
||||
GuiRecipe.searchField != null ? GuiRecipe.searchField.getFilter() : null);
|
||||
}
|
||||
|
||||
protected static ArrayList<Integer> getFilteredIngredientAlternatives(PositionedStack stack, ItemFilter filter) {
|
||||
final ArrayList<Integer> filtered = new ArrayList<>();
|
||||
|
||||
@@ -591,7 +589,8 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
|
||||
|
||||
public TemplateRecipeHandler newInstance() {
|
||||
try {
|
||||
// Use the non parallel version since we might already be using the forkJoinPool and might have no threads
|
||||
// Use the non parallel version since we might already be using the forkJoinPool
|
||||
// and might have no threads
|
||||
// available
|
||||
// This will ideally have been pre-cached elsewhere and will be a NOOP
|
||||
findFuelsOnce();
|
||||
@@ -644,129 +643,8 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
|
||||
if (arecipes.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
final IRecipeFilter filter = GuiRecipe.getRecipeListFilter(this);
|
||||
|
||||
if (filter == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final boolean disableCycledIngredients = TemplateRecipeHandler.disableCycledIngredients;
|
||||
TemplateRecipeHandler.disableCycledIngredients = true;
|
||||
|
||||
boolean isEmpty = !IntStream.range(0, arecipes.size()).boxed().anyMatch(
|
||||
recipe -> filter.matches(
|
||||
this,
|
||||
arecipes.get(recipe).getIngredients(),
|
||||
arecipes.get(recipe).getResult(),
|
||||
arecipes.get(recipe).getOtherStacks()));
|
||||
|
||||
TemplateRecipeHandler.disableCycledIngredients = disableCycledIngredients;
|
||||
|
||||
return isEmpty;
|
||||
}
|
||||
|
||||
protected synchronized void applyFilter() {
|
||||
|
||||
if (arecipes.isEmpty() && this.filteredRecipes == null) {
|
||||
this.filteredRecipes = new ArrayList<>();
|
||||
}
|
||||
|
||||
if (this.filteredRecipes != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Stream<Integer> items = IntStream.range(0, arecipes.size()).boxed();
|
||||
final IRecipeFilter filter = GuiRecipe.getRecipeListFilter(this);
|
||||
|
||||
if (filter == null) {
|
||||
this.filteredRecipes = items.collect(Collectors.toCollection(ArrayList::new));
|
||||
} else {
|
||||
final boolean disableCycledIngredients = TemplateRecipeHandler.disableCycledIngredients;
|
||||
TemplateRecipeHandler.disableCycledIngredients = true;
|
||||
|
||||
this.filteredRecipes = items
|
||||
.filter(
|
||||
recipe -> filter.matches(
|
||||
this,
|
||||
arecipes.get(recipe).getIngredients(),
|
||||
arecipes.get(recipe).getResult(),
|
||||
arecipes.get(recipe).getOtherStacks()))
|
||||
.collect(Collectors.toCollection(ArrayList::new));
|
||||
|
||||
TemplateRecipeHandler.disableCycledIngredients = disableCycledIngredients;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void applySearch(ArrayList<Integer> searchRecipes) {
|
||||
this.searchRecipes = searchRecipes;
|
||||
}
|
||||
|
||||
public ArrayList<Integer> getSearchResult(IRecipeFilter filter) {
|
||||
if (filteredRecipes == null) {
|
||||
applyFilter();
|
||||
}
|
||||
|
||||
ArrayList<Integer> filtered = null;
|
||||
|
||||
if (!filteredRecipes.isEmpty()) {
|
||||
final ArrayList<Integer> recipes = IntStream.range(0, filteredRecipes.size()).boxed()
|
||||
.collect(Collectors.toCollection(ArrayList::new));
|
||||
final boolean disableCycledIngredients = TemplateRecipeHandler.disableCycledIngredients;
|
||||
TemplateRecipeHandler.disableCycledIngredients = true;
|
||||
|
||||
try {
|
||||
filtered = ItemList.forkJoinPool.submit(
|
||||
() -> recipes.parallelStream()
|
||||
.filter(
|
||||
(recipe) -> filter.matches(
|
||||
this,
|
||||
arecipes.get(filteredRecipes.get(recipe)).getIngredients(),
|
||||
arecipes.get(filteredRecipes.get(recipe)).getResult(),
|
||||
arecipes.get(filteredRecipes.get(recipe)).getOtherStacks()))
|
||||
.collect(Collectors.toCollection(ArrayList::new)))
|
||||
.get();
|
||||
filtered.sort((a, b) -> a - b);
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
TemplateRecipeHandler.disableCycledIngredients = disableCycledIngredients;
|
||||
}
|
||||
|
||||
return filtered;
|
||||
}
|
||||
|
||||
private int ref(int index) {
|
||||
|
||||
if (filteredRecipes == null) {
|
||||
applyFilter();
|
||||
}
|
||||
|
||||
if (searchRecipes != null) {
|
||||
index = searchRecipes.get(index);
|
||||
}
|
||||
|
||||
return filteredRecipes.get(index);
|
||||
}
|
||||
|
||||
public int numRecipes() {
|
||||
|
||||
if (filteredRecipes == null) {
|
||||
applyFilter();
|
||||
}
|
||||
|
||||
if (searchRecipes != null) {
|
||||
return searchRecipes.size();
|
||||
}
|
||||
|
||||
return filteredRecipes.size();
|
||||
return arecipes.size();
|
||||
}
|
||||
|
||||
public void drawBackground(int recipe) {
|
||||
@@ -783,19 +661,19 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
|
||||
}
|
||||
|
||||
public List<PositionedStack> getIngredientStacks(int recipe) {
|
||||
return arecipes.get(ref(recipe)).getIngredients();
|
||||
return arecipes.get(recipe).getIngredients();
|
||||
}
|
||||
|
||||
public PositionedStack getResultStack(int recipe) {
|
||||
try {
|
||||
return arecipes.get(ref(recipe)).getResult();
|
||||
return arecipes.get(recipe).getResult();
|
||||
} catch (ArrayIndexOutOfBoundsException ignored) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public List<PositionedStack> getOtherStacks(int recipe) {
|
||||
return arecipes.get(ref(recipe)).getOtherStacks();
|
||||
return arecipes.get(recipe).getOtherStacks();
|
||||
}
|
||||
|
||||
public void onUpdate() {
|
||||
@@ -871,9 +749,7 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
|
||||
final PositionedStack overStack = getIngredientMouseOver(relMouse.x, relMouse.y, recipe);
|
||||
|
||||
if (overStack != null && overStack.items.length > 1) {
|
||||
final ItemFilter filter = new AllMultiItemFilter(
|
||||
ItemList.getItemListFilter(),
|
||||
GuiRecipe.searchField.getFilter());
|
||||
final ItemFilter filter = getItemFilter();
|
||||
|
||||
if (NEIClientConfig.useJEIStyledCycledIngredients()) {
|
||||
ItemStack stack = overStack.item;
|
||||
|
||||
@@ -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.*
|
||||
@@ -121,6 +121,8 @@ nei.options.keys.gui.overlay_use=Use Overlay Recipe
|
||||
nei.options.keys.gui.getprevioussearch=Previous Search
|
||||
nei.options.keys.gui.getnextsearch=Next Search
|
||||
nei.options.keys.gui.next_tooltip=Next Tooltip
|
||||
nei.options.keys.gui.copy_name=Copy Item Name
|
||||
nei.options.keys.gui.copy_oredict=Copy Item OreDictionary
|
||||
nei.options.keys.world=World
|
||||
nei.options.keys.world.chunkoverlay=Chunk Boundary Overlay
|
||||
nei.options.keys.world.moboverlay=Mob Spawn Overlay
|
||||
@@ -147,9 +149,13 @@ nei.options.inventory.bookmarksEnabled.false=Hidden
|
||||
nei.options.inventory.jei_style_tabs=JEI Style Tabs
|
||||
nei.options.inventory.jei_style_tabs.true=Yes
|
||||
nei.options.inventory.jei_style_tabs.false=No [Weirdo]
|
||||
nei.options.inventory.jei_style_item_presence_overlay=JEI Style Item Overlay on ?-Hover
|
||||
nei.options.inventory.jei_style_item_presence_overlay.true=Yes
|
||||
nei.options.inventory.jei_style_item_presence_overlay.false=No
|
||||
nei.options.inventory.itemPresenceOverlay=Item Overlay on ?-Hover
|
||||
nei.options.inventory.itemPresenceOverlay.0=None
|
||||
nei.options.inventory.itemPresenceOverlay.1=Icon
|
||||
nei.options.inventory.itemPresenceOverlay.2=Background
|
||||
nei.options.inventory.slotHighlightPresent=Highlight Present Item
|
||||
nei.options.inventory.slotHighlightPresent.true=Yes
|
||||
nei.options.inventory.slotHighlightPresent.false=No
|
||||
nei.options.inventory.jei_style_recipe_catalyst=JEI Style Recipe Catalysts
|
||||
nei.options.inventory.jei_style_recipe_catalyst.true=Yes
|
||||
nei.options.inventory.jei_style_recipe_catalyst.false=No
|
||||
@@ -230,6 +236,15 @@ 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.history=History Panel
|
||||
nei.options.inventory.history.enabled=History Panel Visibility
|
||||
nei.options.inventory.history.enabled.true=Enabled
|
||||
nei.options.inventory.history.enabled.false=Disabled
|
||||
nei.options.inventory.history.historyColor=Color
|
||||
nei.options.inventory.history.useRows=Rows
|
||||
nei.options.inventory.history.splittingMode=Splitting Mode
|
||||
nei.options.inventory.history.splittingMode.0=Background
|
||||
nei.options.inventory.history.splittingMode.1=Dotted Line
|
||||
|
||||
nei.options.command=Commands
|
||||
nei.options.command.creative=Gamemode
|
||||
@@ -288,7 +303,6 @@ nei.options.tools.dump.handlers.mode.1=Json
|
||||
|
||||
nei.recipe.page=Page %s/%s
|
||||
nei.recipe.tooltip=Recipes
|
||||
nei.recipe.search.show=Click to Search
|
||||
nei.recipe.shaped=Shaped Crafting
|
||||
nei.recipe.shapeless=Shapeless Crafting
|
||||
nei.recipe.furnace=Smelting
|
||||
|
||||
@@ -112,6 +112,8 @@ 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.copy_name=复制物品名称
|
||||
nei.options.keys.gui.copy_oredict=复制物品矿词词典
|
||||
nei.options.keys.world=世界
|
||||
nei.options.keys.world.chunkoverlay=区块(chunks)边界显示
|
||||
nei.options.keys.world.moboverlay=刷怪区域显示
|
||||
@@ -138,9 +140,6 @@ nei.options.inventory.bookmarksEnabled.false=隐藏
|
||||
nei.options.inventory.jei_style_tabs=JEI标签页
|
||||
nei.options.inventory.jei_style_tabs.true=是
|
||||
nei.options.inventory.jei_style_tabs.false=否 [不会吧]
|
||||
nei.options.inventory.jei_style_item_presence_overlay=JEI风格物品覆盖?-悬停
|
||||
nei.options.inventory.jei_style_item_presence_overlay.true=是
|
||||
nei.options.inventory.jei_style_item_presence_overlay.false=否
|
||||
nei.options.inventory.jei_style_recipe_catalyst=JEI风格可执行合成表机器显示[测试中]
|
||||
nei.options.inventory.jei_style_recipe_catalyst.true=是
|
||||
nei.options.inventory.jei_style_recipe_catalyst.false=否
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 34 KiB |
Reference in new issue
Block a user