mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-16 18:54:45 +00:00
Compare commits
16
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c472a02cb | ||
|
|
382278bebb | ||
|
|
55c9811a2b | ||
|
|
0ec87a8b9e | ||
|
|
939845a9ed | ||
|
|
c9db437dd1 | ||
|
|
b1f20104a6 | ||
|
|
ab8d5f275f | ||
|
|
9e87f2b158 | ||
|
|
ab512d3fd8 | ||
|
|
4a9f17590b | ||
|
|
a845e6c3e5 | ||
|
|
4f3a0826fe | ||
|
|
6cd7697ca0 | ||
|
|
38dc14eca1 | ||
|
|
1fc824410b |
No files matched your search
+3
-1
@@ -28,6 +28,7 @@ whitelist.json
|
||||
*.iws
|
||||
src/main/resources/mixins.*([!.]).json
|
||||
*.bat
|
||||
*.sh
|
||||
*.DS_Store
|
||||
!gradlew.bat
|
||||
.factorypath
|
||||
@@ -35,4 +36,5 @@ addon.local.gradle
|
||||
addon.local.gradle.kts
|
||||
addon.late.local.gradle
|
||||
addon.late.local.gradle.kts
|
||||
layout.json
|
||||
layout.json
|
||||
|
||||
+10
-5
@@ -5,8 +5,8 @@ configurations.create('gtnhlibEmbed') {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:CodeChickenCore:1.4.17:dev')
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:GTNHLib:0.11.37:dev')
|
||||
api('com.github.GTNewHorizons:CodeChickenCore:1.4.21:dev')
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:GTNHLib:0.11.49:dev')
|
||||
|
||||
shadowImplementation('org.apache.commons:commons-csv:1.10.0')
|
||||
|
||||
@@ -23,13 +23,18 @@ dependencies {
|
||||
testRuntimeOnly('org.junit.platform:junit-platform-launcher')
|
||||
testRuntimeOnly("org.lwjgl.lwjgl:lwjgl:2.9.3");
|
||||
|
||||
compileOnly("com.github.GTNewHorizons:GTNHLib:0.11.37") { transitive = false }
|
||||
gtnhlibEmbed("com.github.GTNewHorizons:GTNHLib:0.11.37") { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:GTNHLib:0.11.49") { transitive = false }
|
||||
gtnhlibEmbed("com.github.GTNewHorizons:GTNHLib:0.11.49") { transitive = false }
|
||||
}
|
||||
|
||||
def embedArchiveOperations = gtnhGradle.archiveOperations
|
||||
def gtnhlibEmbedContents = configurations.gtnhlibEmbed.elements.map { files ->
|
||||
files.collect { embedArchiveOperations.zipTree(it.asFile) }
|
||||
}
|
||||
|
||||
[tasks.jar, tasks.shadowJar].each {
|
||||
it.configure {
|
||||
from({ project.configurations.getByName('gtnhlibEmbed').collect { zipTree(it) } }) {
|
||||
from(gtnhlibEmbedContents) {
|
||||
include 'com/gtnewhorizon/gtnhlib/color/ColorResource.class'
|
||||
include 'com/gtnewhorizon/gtnhlib/color/ColorResource$*.class'
|
||||
}
|
||||
|
||||
@@ -186,6 +186,11 @@ modrinthRelations = required-project\:codechickencore-unofficial
|
||||
# Leave this empty if you don't want to publish on CurseForge.
|
||||
curseForgeProjectId = 358228
|
||||
|
||||
# Comma-separated supported CurseForge environments: client, server (case-insensitive).
|
||||
# Use client or server for mods that only support one environment. Defaults to client,server.
|
||||
# These tags describe where the mod can run, not whether installation is required on both sides.
|
||||
curseForgeEnvironments = client,server
|
||||
|
||||
# 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],
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#This file is generated by updateDaemonJvm
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/97d46b5ff4df0bf61e95652a190a5567/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/9ef54a08e06b0754cee9fc95ed3a3134/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/97d46b5ff4df0bf61e95652a190a5567/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/9ef54a08e06b0754cee9fc95ed3a3134/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1df82b76031285ef2e6a4f59ffe9299d/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/c7d5be6a02945ac2e045048ee54a7d32/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/97d46b5ff4df0bf61e95652a190a5567/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/9ef54a08e06b0754cee9fc95ed3a3134/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/643f404f769811f5f265fd66f7af5d89/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/38256085a73e137cb4937ea9c4807fec/redirect
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/9064f22734b42ac03e85df04b632e167/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/4d0277c49991306ac78048580fe34bcf/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/a9fa3b809e484a1e1ac4308a5dda661a/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/aa99913fa6d767d899ffc96082da01ca/redirect
|
||||
toolchainVersion=25
|
||||
Vendored
BIN
Binary file not shown.
+3
-1
@@ -1,7 +1,9 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip
|
||||
networkTimeout=10000
|
||||
retries=0
|
||||
retryBackOffMs=500
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
# gradlew start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
@@ -29,7 +29,7 @@
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
# ksh gradlew
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
@@ -57,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/b631911858264c0b6e4d6603d677ff5218766cee/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
|
||||
Vendored
+12
-23
@@ -19,12 +19,12 @@
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem gradlew startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
@rem Set local scope for the variables, and ensure extensions are enabled
|
||||
setlocal EnableExtensions
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@@ -51,7 +51,7 @@ 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
|
||||
"%COMSPEC%" /c exit 1
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
@@ -65,29 +65,18 @@ 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
|
||||
"%COMSPEC%" /c exit 1
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
@rem Execute gradlew
|
||||
@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
|
||||
@rem which allows us to clear the local environment before executing the java command
|
||||
endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
:exitWithErrorLevel
|
||||
@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
|
||||
"%COMSPEC%" /c exit %ERRORLEVEL%
|
||||
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.29'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.31'
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -7,8 +7,10 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.util.ChatAllowedCharacters;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
@@ -30,6 +32,8 @@ public class AutoFocusWidget implements IContainerInputHandler {
|
||||
|
||||
protected boolean autofocus = false;
|
||||
protected Point mouse;
|
||||
protected Point pendingMouse;
|
||||
protected GuiTextField textInputHolder;
|
||||
|
||||
public AutoFocusWidget() {
|
||||
GuiContainerManager.addInputHandler(this);
|
||||
@@ -38,32 +42,83 @@ public class AutoFocusWidget implements IContainerInputHandler {
|
||||
public void load(GuiContainer gui) {
|
||||
this.autofocus = LayoutManager.searchField.isVisible() && NEIClientConfig.searchWidgetAutofocus() != 0
|
||||
&& isAllowedGuiAutoSearchFocus(gui);
|
||||
this.mouse = getMousePosition();
|
||||
this.mouse = null;
|
||||
this.pendingMouse = null;
|
||||
|
||||
if (this.autofocus) {
|
||||
beginTextInput();
|
||||
}
|
||||
}
|
||||
|
||||
protected void beginTextInput() {
|
||||
if (this.textInputHolder == null) {
|
||||
this.textInputHolder = new GuiTextField(Minecraft.getMinecraft().fontRenderer, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
this.textInputHolder.setFocused(true);
|
||||
}
|
||||
|
||||
protected void endTextInput() {
|
||||
if (this.textInputHolder != null) {
|
||||
this.textInputHolder.setFocused(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void guiTick() {
|
||||
if (!this.autofocus) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Point current = getMousePosition();
|
||||
|
||||
if (this.mouse == null) {
|
||||
if (current.equals(this.pendingMouse)) {
|
||||
this.mouse = current;
|
||||
}
|
||||
|
||||
this.pendingMouse = current;
|
||||
} else if (!this.mouse.equals(current)) {
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
|
||||
protected void cancel() {
|
||||
if (this.autofocus) {
|
||||
this.autofocus = false;
|
||||
endTextInput();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyTyped(GuiContainer gui, char keyChar, int keyCode) {
|
||||
|
||||
if (this.autofocus) {
|
||||
this.autofocus = false;
|
||||
|
||||
if (!this.mouse.equals(getMousePosition())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (NEIClientConfig.searchWidgetAutofocus() == 2
|
||||
&& GameSettings.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindInventory)) {
|
||||
cancel();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (keyCode == Keyboard.KEY_RETURN || keyCode == Keyboard.KEY_NUMPADENTER
|
||||
|| keyCode == Keyboard.KEY_ESCAPE) {
|
||||
cancel();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ChatAllowedCharacters.isAllowedCharacter(keyChar)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.autofocus = false;
|
||||
|
||||
LayoutManager.searchField.setFocus(true);
|
||||
endTextInput();
|
||||
|
||||
final String oldText = LayoutManager.searchField.text();
|
||||
LayoutManager.searchField.handleKeyPress(keyCode, keyChar);
|
||||
return true;
|
||||
|
||||
return !LayoutManager.searchField.text().equals(oldText);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -76,13 +131,13 @@ public class AutoFocusWidget implements IContainerInputHandler {
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(GuiContainer gui, int mousex, int mousey, int button) {
|
||||
this.autofocus = false;
|
||||
cancel();
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) {
|
||||
this.autofocus = false;
|
||||
cancel();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -91,22 +146,22 @@ public class AutoFocusWidget implements IContainerInputHandler {
|
||||
|
||||
@Override
|
||||
public void onMouseClicked(GuiContainer gui, int mousex, int mousey, int button) {
|
||||
this.autofocus = false;
|
||||
cancel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseDragged(GuiContainer gui, int mousex, int mousey, int button, long heldTime) {
|
||||
this.autofocus = false;
|
||||
cancel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) {
|
||||
this.autofocus = false;
|
||||
cancel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseUp(GuiContainer gui, int mousex, int mousey, int button) {
|
||||
this.autofocus = false;
|
||||
cancel();
|
||||
}
|
||||
|
||||
protected boolean isAllowedGuiAutoSearchFocus(GuiContainer gui) {
|
||||
|
||||
@@ -10,6 +10,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTBase.NBTPrimitive;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
@@ -227,17 +228,17 @@ public class CollapsibleItems {
|
||||
|
||||
if (NEIClientConfig.world.nbt.hasKey(STATE_KEY)) {
|
||||
NBTTagCompound states = NEIClientConfig.world.nbt.getCompoundTag(STATE_KEY);
|
||||
@SuppressWarnings("unchecked")
|
||||
final Map<String, NBTPrimitive> list = (Map<String, NBTPrimitive>) states.tagMap;
|
||||
final Map<String, NBTBase> list = states.tagMap;
|
||||
final Map<String, GroupItem> mapping = new HashMap<>();
|
||||
|
||||
for (GroupItem group : CollapsibleItems.groups) {
|
||||
mapping.put(group.guid, group);
|
||||
}
|
||||
|
||||
for (Map.Entry<String, NBTPrimitive> nbtEntry : list.entrySet()) {
|
||||
for (Map.Entry<String, NBTBase> nbtEntry : list.entrySet()) {
|
||||
if (mapping.containsKey(nbtEntry.getKey())) {
|
||||
mapping.get(nbtEntry.getKey()).expanded = nbtEntry.getValue().func_150290_f() == 1;
|
||||
mapping.get(nbtEntry.getKey()).expanded = ((NBTPrimitive) nbtEntry.getValue()).func_150290_f()
|
||||
== 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.lib.gui.GuiDraw.ITooltipLineHandler;
|
||||
|
||||
public abstract class CompositeTooltipLineHandler implements ITooltipLineHandler {
|
||||
|
||||
protected static final int SCREEN_MARGIN = 8 * 2 + 10;
|
||||
protected static final int RESERVED_HEIGHT = 40;
|
||||
|
||||
protected final List<ItemsTooltipLineHandler> lines = new ArrayList<>();
|
||||
protected final Dimension size = new Dimension();
|
||||
|
||||
protected boolean created = false;
|
||||
protected int screenHeight = 0;
|
||||
|
||||
protected abstract void createLines();
|
||||
|
||||
protected boolean needsUpdate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getSize() {
|
||||
ensureCreated();
|
||||
return this.size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int x, int y) {
|
||||
if (this.size.height == 0) return;
|
||||
|
||||
for (ItemsTooltipLineHandler line : this.lines) {
|
||||
line.draw(x, y);
|
||||
y += line.getSize().height;
|
||||
}
|
||||
}
|
||||
|
||||
protected void ensureCreated() {
|
||||
boolean update = needsUpdate();
|
||||
update = this.screenHeight != (this.screenHeight = GuiDraw.displaySize().height) || update;
|
||||
|
||||
if (this.created && !update) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.created = true;
|
||||
this.lines.clear();
|
||||
this.size.setSize(0, 0);
|
||||
|
||||
createLines();
|
||||
fitToScreen();
|
||||
|
||||
for (ItemsTooltipLineHandler line : this.lines) {
|
||||
this.size.width = Math.max(this.size.width, line.getSize().width);
|
||||
this.size.height += line.getSize().height;
|
||||
}
|
||||
}
|
||||
|
||||
protected void fitToScreen() {
|
||||
if (this.lines.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
final List<ItemsTooltipLineHandler> ordered = new ArrayList<>(this.lines);
|
||||
ordered.sort(Comparator.comparingInt(ItemsTooltipLineHandler::getRows));
|
||||
|
||||
int budget = availableHeight() / ItemsTooltipLineHandler.SLOT_SIZE;
|
||||
int rest = ordered.size();
|
||||
|
||||
for (ItemsTooltipLineHandler line : ordered) {
|
||||
final int fair = Math.max(1, budget / rest);
|
||||
|
||||
if (line.getRows() > fair) {
|
||||
line.setMaxRows(fair);
|
||||
}
|
||||
|
||||
budget -= line.getRows();
|
||||
rest--;
|
||||
}
|
||||
}
|
||||
|
||||
protected int availableHeight() {
|
||||
return GuiDraw.displaySize().height - SCREEN_MARGIN
|
||||
- RESERVED_HEIGHT
|
||||
- this.lines.size() * ItemsTooltipLineHandler.headerHeight();
|
||||
}
|
||||
|
||||
protected static int maxLineRows() {
|
||||
final int height = GuiDraw.displaySize().height - SCREEN_MARGIN
|
||||
- RESERVED_HEIGHT
|
||||
- ItemsTooltipLineHandler.headerHeight();
|
||||
return Math.max(1, height / ItemsTooltipLineHandler.SLOT_SIZE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,11 +6,14 @@ import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.ItemsGrid.ItemsGridSlot;
|
||||
@@ -21,7 +24,6 @@ import codechicken.nei.recipe.GuiCraftingRecipe;
|
||||
import codechicken.nei.recipe.GuiRecipe;
|
||||
import codechicken.nei.recipe.ICraftingHandler;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import codechicken.nei.recipe.Recipe;
|
||||
import codechicken.nei.recipe.Recipe.RecipeId;
|
||||
import codechicken.nei.recipe.RecipeInfo;
|
||||
import codechicken.nei.recipe.StackInfo;
|
||||
@@ -82,6 +84,42 @@ public class ItemCraftablesPanel
|
||||
|
||||
}
|
||||
|
||||
private static class CraftablesSnapshot {
|
||||
|
||||
final GuiContainer guiContainer;
|
||||
final ItemStackAmount inventory;
|
||||
final boolean showOnlyFavorites;
|
||||
final int maxCandidates;
|
||||
|
||||
CraftablesSnapshot(GuiContainer guiContainer, ItemStackAmount inventory, boolean showOnlyFavorites,
|
||||
int maxCandidates) {
|
||||
this.guiContainer = guiContainer;
|
||||
this.inventory = inventory;
|
||||
this.showOnlyFavorites = showOnlyFavorites;
|
||||
this.maxCandidates = maxCandidates;
|
||||
}
|
||||
}
|
||||
|
||||
private static class RecipeCandidate {
|
||||
|
||||
final IRecipeHandler handler;
|
||||
final int recipeIndex;
|
||||
final List<PositionedStack> ingredientStacks;
|
||||
final ItemStack sortKeyItem;
|
||||
|
||||
RecipeCandidate(IRecipeHandler handler, int recipeIndex, List<PositionedStack> ingredientStacks,
|
||||
ItemStack sortKeyItem) {
|
||||
this.handler = handler;
|
||||
this.recipeIndex = recipeIndex;
|
||||
this.ingredientStacks = ingredientStacks;
|
||||
this.sortKeyItem = sortKeyItem;
|
||||
}
|
||||
}
|
||||
|
||||
private static final Comparator<ItemStack> ITEM_SORT_COMPARATOR = Comparator
|
||||
.comparing(FavoriteRecipes::containsManual).thenComparing(FavoriteRecipes::contains).reversed()
|
||||
.thenComparing(ItemSorter.instance);
|
||||
|
||||
public static List<String> guiBlacklist = new ArrayList<>();
|
||||
private final int MIN_DELAY = 600;
|
||||
|
||||
@@ -93,6 +131,16 @@ public class ItemCraftablesPanel
|
||||
private long lastPlayerInventorySync = 0;
|
||||
private int lastFavoritesCount = 0;
|
||||
|
||||
private volatile CraftablesSnapshot pendingSnapshot;
|
||||
private final AtomicReference<Map<ItemStack, RecipeId>> pendingResult = new AtomicReference<>();
|
||||
private final RestartableTask task = new RestartableTask("NEI Craftables Panel") {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
pendingResult.set(generateCraftables(ItemCraftablesPanel.this.pendingSnapshot));
|
||||
}
|
||||
};
|
||||
|
||||
public ItemCraftablesPanel() {
|
||||
this.grid = new ItemsGrid<>() {
|
||||
|
||||
@@ -114,12 +162,7 @@ public class ItemCraftablesPanel
|
||||
|
||||
if (!ItemCraftablesPanel.this.availableRecipes.isEmpty()) {
|
||||
final List<Map.Entry<ItemStack, RecipeId>> entries = ItemCraftablesPanel.this.availableRecipes
|
||||
.entrySet().stream()
|
||||
.sorted(
|
||||
Map.Entry.comparingByKey(
|
||||
Comparator.comparing(FavoriteRecipes::containsManual)
|
||||
.thenComparing(FavoriteRecipes::contains).reversed()
|
||||
.thenComparing(ItemSorter.instance)))
|
||||
.entrySet().stream().sorted(Map.Entry.comparingByKey(ITEM_SORT_COMPARATOR))
|
||||
.limit(maxSlotIndex).collect(Collectors.toList());
|
||||
int slotIndex = 0;
|
||||
int itemIndex = 0;
|
||||
@@ -195,10 +238,20 @@ public class ItemCraftablesPanel
|
||||
|
||||
public void update() {
|
||||
this.splittingLineColor = NEIClientConfig.getSetting("inventory.craftables.color").getHexValue();
|
||||
applyPendingResult();
|
||||
updateCraftables();
|
||||
super.update();
|
||||
}
|
||||
|
||||
private void applyPendingResult() {
|
||||
final Map<ItemStack, RecipeId> result = this.pendingResult.getAndSet(null);
|
||||
|
||||
if (result != null && NEIClientConfig.showCraftablesPanelWidget()) {
|
||||
this.availableRecipes = result;
|
||||
this.grid.onGridChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateCraftables() {
|
||||
|
||||
if (!NEIClientConfig.showCraftablesPanelWidget()) {
|
||||
@@ -219,8 +272,14 @@ public class ItemCraftablesPanel
|
||||
this.lastPlayerInventory = inv;
|
||||
this.lastGuiContainer = firstGui;
|
||||
this.lastFavoritesCount = FavoriteRecipes.size();
|
||||
this.availableRecipes = generateCraftables(firstGui);
|
||||
this.grid.onGridChanged();
|
||||
final int maxRows = NEIClientConfig.getIntSetting("inventory.craftables.useRows") + 2;
|
||||
final int maxCandidates = Math.max(this.grid.columns, 1) * maxRows;
|
||||
this.pendingSnapshot = new CraftablesSnapshot(
|
||||
firstGui,
|
||||
inv,
|
||||
showOnlyFavorites,
|
||||
maxCandidates);
|
||||
this.task.restart();
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -244,17 +303,28 @@ public class ItemCraftablesPanel
|
||||
return (firstGui instanceof GuiRecipe<?>gui) ? gui.firstGui : firstGui;
|
||||
}
|
||||
|
||||
private Map<ItemStack, RecipeId> generateCraftables(GuiContainer firstGui) {
|
||||
final List<IRecipeHandler> availableHandlers = getAvailableHandlers(firstGui);
|
||||
private Map<ItemStack, RecipeId> generateCraftables(CraftablesSnapshot snapshot) {
|
||||
final List<IRecipeHandler> availableHandlers = getAvailableHandlers(snapshot.guiContainer);
|
||||
final Map<ItemStack, RecipeId> availableRecipes = new HashMap<>();
|
||||
|
||||
if (!availableHandlers.isEmpty()) {
|
||||
final List<ItemStack> invStacks = ItemCraftablesPanel.this.lastPlayerInventory.values();
|
||||
final Map<Item, List<ItemStack>> invByItem = indexInventoryByItem(snapshot.inventory.values());
|
||||
|
||||
for (IRecipeHandler handler : availableHandlers) {
|
||||
availableRecipes.putAll(filterHandlerRecipes(handler, firstGui, invStacks));
|
||||
if (snapshot.showOnlyFavorites) {
|
||||
for (IRecipeHandler handler : availableHandlers) {
|
||||
availableRecipes.putAll(filterHandlerRecipes(handler, invByItem, true));
|
||||
}
|
||||
} else {
|
||||
final List<RecipeCandidate> candidates = Collections.synchronizedList(new ArrayList<>());
|
||||
|
||||
for (IRecipeHandler handler : availableHandlers) {
|
||||
collectHandlerCandidates(handler, invByItem, candidates);
|
||||
}
|
||||
|
||||
candidates.sort(Comparator.comparing(c -> c.sortKeyItem, ITEM_SORT_COMPARATOR));
|
||||
candidates.subList(0, Math.min(candidates.size(), snapshot.maxCandidates)).parallelStream()
|
||||
.forEach(candidate -> buildCandidate(candidate, availableRecipes));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return availableRecipes;
|
||||
@@ -270,19 +340,126 @@ public class ItemCraftablesPanel
|
||||
return availableHandlers;
|
||||
}
|
||||
|
||||
private Map<ItemStack, RecipeId> filterHandlerRecipes(IRecipeHandler handler, GuiContainer firstGui,
|
||||
List<ItemStack> invStacks) {
|
||||
private static Map<Item, List<ItemStack>> indexInventoryByItem(List<ItemStack> invStacks) {
|
||||
final Map<Item, List<ItemStack>> index = new HashMap<>();
|
||||
|
||||
for (ItemStack stack : invStacks) {
|
||||
index.computeIfAbsent(stack.getItem(), i -> new ArrayList<>()).add(stack);
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
private void collectHandlerCandidates(IRecipeHandler handler, Map<Item, List<ItemStack>> invByItem,
|
||||
List<RecipeCandidate> candidates) {
|
||||
IntStream.range(0, handler.numRecipes()).parallel().forEach(recipeIndex -> {
|
||||
final List<PositionedStack> ingredientStacks = handler.getIngredientStacks(recipeIndex);
|
||||
|
||||
if (existsIngredients(ingredientStacks, invByItem)) {
|
||||
final ItemStack sortKeyItem = getCheapResultItem(handler, recipeIndex);
|
||||
|
||||
if (sortKeyItem != null) {
|
||||
candidates.add(new RecipeCandidate(handler, recipeIndex, ingredientStacks, sortKeyItem));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void buildCandidate(RecipeCandidate candidate, Map<ItemStack, RecipeId> availableRecipes) {
|
||||
final ItemStack result = getCheapResult(candidate.handler, candidate.recipeIndex);
|
||||
|
||||
if (result != null) {
|
||||
final RecipeId recipeId = RecipeId.of(candidate.handler, candidate.recipeIndex, candidate.ingredientStacks);
|
||||
|
||||
synchronized (availableRecipes) {
|
||||
availableRecipes.put(result, recipeId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static ItemStack getCheapResultItem(IRecipeHandler handler, int recipeIndex) {
|
||||
final PositionedStack resultStack = handler.getResultStack(recipeIndex);
|
||||
|
||||
if (resultStack != null) {
|
||||
return resultStack.item;
|
||||
}
|
||||
|
||||
final List<PositionedStack> otherStacks = handler.getOtherStacks(recipeIndex);
|
||||
|
||||
for (PositionedStack otherStack : otherStacks) {
|
||||
if (!FluidContainerRegistry.isContainer(otherStack.items[0])
|
||||
|| StackInfo.getFluid(otherStack.items[0]) != null) {
|
||||
return otherStack.item;
|
||||
}
|
||||
}
|
||||
|
||||
return otherStacks.isEmpty() ? null : otherStacks.get(0).item;
|
||||
}
|
||||
|
||||
private static ItemStack getCheapResult(IRecipeHandler handler, int recipeIndex) {
|
||||
final PositionedStack resultStack = handler.getResultStack(recipeIndex);
|
||||
final List<PositionedStack> results = resultStack != null ? Collections.singletonList(resultStack)
|
||||
: handler.getOtherStacks(recipeIndex);
|
||||
|
||||
if (results.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ItemStack stack = null;
|
||||
|
||||
if (results.size() > 1) {
|
||||
for (PositionedStack result : results) {
|
||||
if (!FluidContainerRegistry.isContainer(result.item) || StackInfo.getFluid(result.item) != null) {
|
||||
stack = result.item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (stack == null) {
|
||||
stack = results.get(0).item;
|
||||
}
|
||||
|
||||
int stackSize = 0;
|
||||
|
||||
for (PositionedStack result : results) {
|
||||
if (containsSameType(result, stack)) {
|
||||
stackSize += StackInfo.getAmount(result.item);
|
||||
}
|
||||
}
|
||||
|
||||
return StackInfo.withAmount(stack, stackSize);
|
||||
}
|
||||
|
||||
private static boolean containsSameType(PositionedStack pStack, ItemStack stack) {
|
||||
final ItemStack normalized = StackInfo.withAmount(stack, 0);
|
||||
|
||||
for (ItemStack permutation : pStack.items) {
|
||||
if (NEIServerUtils.areStacksSameTypeWithNBT(StackInfo.withAmount(permutation, 0), normalized)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private Map<ItemStack, RecipeId> filterHandlerRecipes(IRecipeHandler handler, Map<Item, List<ItemStack>> invByItem,
|
||||
boolean showOnlyFavorites) {
|
||||
final Map<ItemStack, RecipeId> availableRecipes = new HashMap<>();
|
||||
final boolean showOnlyFavorites = NEIClientConfig.getBooleanSetting("inventory.craftables.favoritesOnly");
|
||||
|
||||
IntStream.range(0, handler.numRecipes()).parallel().forEach(recipeIndex -> {
|
||||
if (existsIngredients(firstGui, handler.getIngredientStacks(recipeIndex), invStacks)) {
|
||||
final Recipe recipe = Recipe.of(handler, recipeIndex);
|
||||
final List<PositionedStack> ingredientStacks = handler.getIngredientStacks(recipeIndex);
|
||||
|
||||
if (!recipe.getResults().isEmpty()
|
||||
&& (!showOnlyFavorites || FavoriteRecipes.getFavorite(recipe.getRecipeId()) != null)) {
|
||||
synchronized (availableRecipes) {
|
||||
availableRecipes.put(recipe.getResult(), recipe.getRecipeId());
|
||||
if (existsIngredients(ingredientStacks, invByItem)) {
|
||||
final ItemStack result = getCheapResult(handler, recipeIndex);
|
||||
|
||||
if (result != null) {
|
||||
final RecipeId recipeId = RecipeId.of(handler, recipeIndex, ingredientStacks);
|
||||
|
||||
if (!showOnlyFavorites || FavoriteRecipes.getFavorite(recipeId) != null) {
|
||||
synchronized (availableRecipes) {
|
||||
availableRecipes.put(result, recipeId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -291,14 +468,27 @@ public class ItemCraftablesPanel
|
||||
return availableRecipes;
|
||||
}
|
||||
|
||||
private boolean existsIngredients(GuiContainer firstGui, List<PositionedStack> ingredients,
|
||||
List<ItemStack> invStacks) {
|
||||
private boolean existsIngredients(List<PositionedStack> ingredients, Map<Item, List<ItemStack>> invByItem) {
|
||||
final Map<ItemStack, Integer> usedItems = new HashMap<>();
|
||||
|
||||
for (PositionedStack pStack : ingredients) {
|
||||
final ItemStack used = invStacks.stream().filter(
|
||||
is -> usedItems.getOrDefault(is, is.stackSize) >= pStack.item.stackSize && pStack.contains(is))
|
||||
.findAny().orElse(null);
|
||||
ItemStack used = null;
|
||||
|
||||
for (ItemStack permutation : pStack.items) {
|
||||
final List<ItemStack> candidates = invByItem.get(permutation.getItem());
|
||||
|
||||
if (candidates == null) continue;
|
||||
|
||||
for (ItemStack is : candidates) {
|
||||
if (usedItems.getOrDefault(is, is.stackSize) >= pStack.item.stackSize
|
||||
&& NEIServerUtils.areStacksSameTypeCrafting(permutation, is)) {
|
||||
used = is;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (used != null) break;
|
||||
}
|
||||
|
||||
if (used != null) {
|
||||
usedItems.put(used, usedItems.getOrDefault(used, used.stackSize) - pStack.item.stackSize);
|
||||
|
||||
@@ -4,6 +4,7 @@ import static codechicken.lib.gui.GuiDraw.fontRenderer;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.util.ArrayList;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -17,56 +18,269 @@ import org.lwjgl.opengl.GL12;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.lib.gui.GuiDraw.ITooltipLineHandler;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.NEIClientUtils.Alignment;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.recipe.StackInfo;
|
||||
import codechicken.nei.util.ReadableNumberConverter;
|
||||
|
||||
public class ItemsTooltipLineHandler implements ITooltipLineHandler {
|
||||
|
||||
protected static final int SLOT_SIZE = 18;
|
||||
protected static final int MAX_COLUMNS = 11;
|
||||
protected static final int MARGIN_TOP = 2;
|
||||
@FunctionalInterface
|
||||
public interface AmountRenderer {
|
||||
|
||||
protected String label;
|
||||
protected EnumChatFormatting labelColor = EnumChatFormatting.GRAY;
|
||||
protected List<ItemStack> items;
|
||||
protected int activeStackIndex = -1;
|
||||
protected Dimension size = new Dimension();
|
||||
protected boolean saveStackSize = false;
|
||||
protected int columns = 0;
|
||||
protected int count = 0;
|
||||
protected int rows = 0;
|
||||
protected int length = 0;
|
||||
|
||||
public ItemsTooltipLineHandler(String label, List<ItemStack> items) {
|
||||
this(label, items, true, 5);
|
||||
void draw(int x, int y, ItemStack stack, long amount);
|
||||
}
|
||||
|
||||
public ItemsTooltipLineHandler(String label, List<ItemStack> items, boolean saveStackSize, int maxRows) {
|
||||
this.label = label;
|
||||
this.items = groupingItemStacks(items);
|
||||
this.saveStackSize = saveStackSize;
|
||||
this.length = this.items.size();
|
||||
public static class NoAmountRenderer implements AmountRenderer {
|
||||
|
||||
if (this.length > 0) {
|
||||
this.columns = Math.min(MAX_COLUMNS, this.length);
|
||||
this.rows = Math.min(maxRows, (int) Math.ceil((float) this.length / this.columns));
|
||||
@Override
|
||||
public void draw(int x, int y, ItemStack stack, long amount) {
|
||||
GuiContainerManager.drawItem(x, y, stack, true, "");
|
||||
}
|
||||
|
||||
this.size.width = Math.max(this.columns * SLOT_SIZE, fontRenderer.getStringWidth(this.label) + 15);
|
||||
this.size.height = this.rows * SLOT_SIZE + fontRenderer.FONT_HEIGHT + 2 + MARGIN_TOP;
|
||||
protected static void drawAmountText(String text, Rectangle4i rect, int color, Alignment alignment) {
|
||||
NEIClientUtils.drawNEIOverlayText(text, rect, 1, color, true, alignment);
|
||||
}
|
||||
}
|
||||
|
||||
this.count = Math.min(
|
||||
this.length,
|
||||
Math.min(
|
||||
this.columns * this.rows,
|
||||
this.length > MAX_COLUMNS * maxRows ? (MAX_COLUMNS * maxRows) : Integer.MAX_VALUE));
|
||||
public static class TotalAmountRenderer extends NoAmountRenderer {
|
||||
|
||||
if (this.items.size() > this.count) {
|
||||
String text = "+" + (this.items.size() - this.count);
|
||||
this.count -= (int) Math.ceil((float) (fontRenderer.getStringWidth(text) - 2) / SLOT_SIZE);
|
||||
private static class AmountText {
|
||||
|
||||
public final String text;
|
||||
public final Alignment alignment;
|
||||
|
||||
public AmountText(String text, Alignment alignment) {
|
||||
this.text = text;
|
||||
this.alignment = alignment;
|
||||
}
|
||||
}
|
||||
|
||||
private final Map<ItemStack, AmountText> cache = new IdentityHashMap<>();
|
||||
|
||||
@Override
|
||||
public void draw(int x, int y, ItemStack stack, long amount) {
|
||||
super.draw(x, y, stack, amount);
|
||||
drawAmount(new Rectangle4i(x, y, SLOT_SIZE - 2, SLOT_SIZE - 2), stack, amount);
|
||||
}
|
||||
|
||||
protected void drawAmount(Rectangle4i rect, ItemStack stack, long amount) {
|
||||
final AmountText amountText = this.cache.computeIfAbsent(stack, key -> {
|
||||
final boolean isFluidDisplay = StackInfo.isFluidDisplayItem(key);
|
||||
final String text = formatAmount(key, amount);
|
||||
|
||||
return new AmountText(
|
||||
isFluidDisplay && !text.isEmpty() ? text + "L" : text,
|
||||
isFluidDisplay ? Alignment.BottomLeft : Alignment.BottomRight);
|
||||
});
|
||||
|
||||
if (!amountText.text.isEmpty()) {
|
||||
drawAmountText(amountText.text, rect, 0xFFFFFF, amountText.alignment);
|
||||
}
|
||||
}
|
||||
|
||||
protected String formatAmount(ItemStack stack, long amount) {
|
||||
return amount == 0 ? "" : ReadableNumberConverter.INSTANCE.toWideReadableForm(amount);
|
||||
}
|
||||
}
|
||||
|
||||
public static class StacksAmountRenderer extends NoAmountRenderer {
|
||||
|
||||
private static class StacksText {
|
||||
|
||||
public final String stacks;
|
||||
public final String remainder;
|
||||
public final int color;
|
||||
|
||||
public StacksText(String stacks, String remainder, int color) {
|
||||
this.stacks = stacks;
|
||||
this.remainder = remainder;
|
||||
this.color = color;
|
||||
}
|
||||
}
|
||||
|
||||
private final Map<ItemStack, StacksText> cache = new IdentityHashMap<>();
|
||||
|
||||
@Override
|
||||
public void draw(int x, int y, ItemStack stack, long amount) {
|
||||
super.draw(x, y, stack, amount);
|
||||
drawAmount(new Rectangle4i(x, y, SLOT_SIZE - 2, SLOT_SIZE - 2), stack, amount);
|
||||
}
|
||||
|
||||
protected void drawAmount(Rectangle4i rect, ItemStack stack, long amount) {
|
||||
final StacksText stacksText = this.cache.computeIfAbsent(stack, key -> formatAmount(key, amount));
|
||||
|
||||
if (!stacksText.stacks.isEmpty()) {
|
||||
drawAmountText(stacksText.stacks, rect, stacksText.color, Alignment.TopLeft);
|
||||
}
|
||||
|
||||
if (!stacksText.remainder.isEmpty()) {
|
||||
drawAmountText(stacksText.remainder, rect, stacksText.color, Alignment.BottomRight);
|
||||
}
|
||||
}
|
||||
|
||||
private StacksText formatAmount(ItemStack stack, long amount) {
|
||||
final long stackSize = StackInfo.isFluidDisplayItem(stack) ? FLUID_STACK_SIZE
|
||||
: Math.max(1, stack.getMaxStackSize());
|
||||
final long stacks = amount / stackSize;
|
||||
final long remainder = amount % stackSize;
|
||||
final String prefix = getPrefix(stack);
|
||||
|
||||
return new StacksText(
|
||||
stacks > 0 ? prefix + "x" + ReadableNumberConverter.INSTANCE.toWideReadableForm(stacks) : "",
|
||||
remainder > 0
|
||||
? (stacks > 0 ? "+" : prefix)
|
||||
+ ReadableNumberConverter.INSTANCE.toWideReadableForm(remainder)
|
||||
: "",
|
||||
getColor(stack));
|
||||
}
|
||||
|
||||
protected String getPrefix(ItemStack stack) {
|
||||
return "";
|
||||
}
|
||||
|
||||
protected int getColor(ItemStack stack) {
|
||||
return 0xFFFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
protected static final int SLOT_SIZE = 18;
|
||||
protected static final int ICON_SIZE = 16;
|
||||
protected static final int ICON_OFFSET = 1;
|
||||
protected static final int MAX_COLUMNS = 11;
|
||||
protected static final int MARGIN_TOP = 2;
|
||||
protected static final int LABEL_MARGIN = 15;
|
||||
protected static final int NAME_MARGIN = 2;
|
||||
protected static final int DEFAULT_MAX_ROWS = 5;
|
||||
protected static final int FLUID_STACK_SIZE = 144;
|
||||
|
||||
protected final List<ItemStack> items;
|
||||
protected final List<Long> amounts = new ArrayList<>();
|
||||
protected final List<String> names = new ArrayList<>();
|
||||
|
||||
protected AmountRenderer amountRenderer;
|
||||
|
||||
protected String label;
|
||||
protected EnumChatFormatting labelColor = EnumChatFormatting.GRAY;
|
||||
|
||||
protected int activeStackIndex = -1;
|
||||
protected Dimension size = new Dimension();
|
||||
|
||||
protected final boolean showNames;
|
||||
|
||||
protected int length = 0;
|
||||
protected int rows = 0;
|
||||
protected int nameRows = 0;
|
||||
protected int gridColumns = 0;
|
||||
protected int gridCount = 0;
|
||||
|
||||
public static ItemsTooltipLineHandler grid(String label, List<ItemStack> items, int maxRows) {
|
||||
return new ItemsTooltipLineHandler(label, items, true, maxRows, false);
|
||||
}
|
||||
|
||||
public static ItemsTooltipLineHandler list(String label, List<ItemStack> items, int maxRows) {
|
||||
return new ItemsTooltipLineHandler(label, items, true, maxRows, true);
|
||||
}
|
||||
|
||||
public ItemsTooltipLineHandler(String label, List<ItemStack> items) {
|
||||
this(label, items, true, DEFAULT_MAX_ROWS, false);
|
||||
}
|
||||
|
||||
public ItemsTooltipLineHandler(String label, List<ItemStack> items, boolean saveStackSize, int maxRows) {
|
||||
this(label, items, saveStackSize, maxRows, false);
|
||||
}
|
||||
|
||||
protected ItemsTooltipLineHandler(String label, List<ItemStack> items, boolean saveStackSize, int maxRows,
|
||||
boolean showNames) {
|
||||
this.label = label;
|
||||
this.items = groupingItemStacks(items);
|
||||
this.amountRenderer = saveStackSize ? new TotalAmountRenderer() : new NoAmountRenderer();
|
||||
this.length = this.items.size();
|
||||
this.showNames = showNames;
|
||||
|
||||
setMaxRows(maxRows);
|
||||
}
|
||||
|
||||
protected static int headerHeight() {
|
||||
return fontRenderer.FONT_HEIGHT + 2 + MARGIN_TOP;
|
||||
}
|
||||
|
||||
public ItemsTooltipLineHandler setMaxRows(int maxRows) {
|
||||
if (this.length == 0) {
|
||||
return this;
|
||||
}
|
||||
|
||||
this.names.clear();
|
||||
this.nameRows = 0;
|
||||
|
||||
if (!this.showNames || !layoutWithNames(maxRows)) {
|
||||
layoutAsGrid(maxRows);
|
||||
}
|
||||
|
||||
this.size.height = this.rows * SLOT_SIZE + headerHeight();
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getRows() {
|
||||
return this.rows;
|
||||
}
|
||||
|
||||
protected boolean layoutWithNames(int maxRows) {
|
||||
final int maxNames = this.length <= maxRows ? this.length : maxRows - 1;
|
||||
final int[] lineWidth = new int[maxNames + 1];
|
||||
lineWidth[0] = labelWidth();
|
||||
|
||||
for (int index = 0; index < maxNames; index++) {
|
||||
final String name = this.items.get(index).getDisplayName();
|
||||
this.names.add(name);
|
||||
lineWidth[index + 1] = Math
|
||||
.max(lineWidth[index], SLOT_SIZE + NAME_MARGIN + fontRenderer.getStringWidth(name));
|
||||
}
|
||||
|
||||
for (int named = maxNames; named >= 0; named--) {
|
||||
final int rest = this.length - named;
|
||||
final int width = Math.max(lineWidth[named], Math.min(rest, MAX_COLUMNS) * SLOT_SIZE);
|
||||
final int columns = Math.max(1, width / SLOT_SIZE);
|
||||
final int restRows = (int) Math.ceil((float) rest / columns);
|
||||
|
||||
if (named + restRows <= maxRows) {
|
||||
this.nameRows = named;
|
||||
this.gridColumns = columns;
|
||||
this.gridCount = rest;
|
||||
this.rows = named + restRows;
|
||||
this.size.width = width;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
this.names.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void layoutAsGrid(int maxRows) {
|
||||
this.gridColumns = Math.min(MAX_COLUMNS, this.length);
|
||||
this.rows = Math.min(maxRows, (int) Math.ceil((float) this.length / this.gridColumns));
|
||||
this.gridCount = Math.min(this.length, this.gridColumns * this.rows);
|
||||
this.size.width = Math.max(this.gridColumns * SLOT_SIZE, labelWidth());
|
||||
|
||||
if (this.gridCount < this.length) {
|
||||
this.gridCount -= reservedColumns(this.length - this.gridCount);
|
||||
}
|
||||
}
|
||||
|
||||
protected int labelWidth() {
|
||||
return fontRenderer.getStringWidth(this.label) + LABEL_MARGIN;
|
||||
}
|
||||
|
||||
protected int reservedColumns(int hidden) {
|
||||
return (int) Math.ceil((float) (fontRenderer.getStringWidth("+" + hidden) - 2) / SLOT_SIZE);
|
||||
}
|
||||
|
||||
public ItemsTooltipLineHandler setAmountRenderer(AmountRenderer amountRenderer) {
|
||||
this.amountRenderer = amountRenderer;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setActiveStack(ItemStack activeStack) {
|
||||
@@ -98,7 +312,7 @@ public class ItemsTooltipLineHandler implements ITooltipLineHandler {
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
this.size.width = Math.max(this.columns * SLOT_SIZE, fontRenderer.getStringWidth(this.label) + 15);
|
||||
this.size.width = Math.max(this.size.width, labelWidth());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -119,63 +333,79 @@ public class ItemsTooltipLineHandler implements ITooltipLineHandler {
|
||||
final int zTranslation = GuiContainerManager.TOOLTIP_Z_OFFSET;
|
||||
GL11.glTranslatef(xTranslation, yTranslation, zTranslation);
|
||||
|
||||
int indexShift = 0;
|
||||
final int gridShift = gridIndexShift();
|
||||
|
||||
if (this.activeStackIndex != -1) {
|
||||
indexShift = Math.max(0, Math.min(this.items.size() - this.count, this.activeStackIndex - this.count + 2));
|
||||
for (int index = 0; index < this.nameRows; index++) {
|
||||
drawSlot(0, index * SLOT_SIZE, index);
|
||||
}
|
||||
|
||||
for (int index = 0; index < this.count && index + indexShift < this.items.size(); index++) {
|
||||
ItemStack drawStack = this.items.get(index + indexShift);
|
||||
int col = index % this.columns;
|
||||
int row = index / this.columns;
|
||||
for (int index = 0; index < this.gridCount; index++) {
|
||||
drawSlot(
|
||||
(index % this.gridColumns) * SLOT_SIZE,
|
||||
(this.nameRows + index / this.gridColumns) * SLOT_SIZE,
|
||||
this.nameRows + gridShift + index);
|
||||
}
|
||||
|
||||
String stackSize = !this.saveStackSize || drawStack.stackSize == 0 ? ""
|
||||
: ReadableNumberConverter.INSTANCE.toWideReadableForm(drawStack.stackSize);
|
||||
NEIClientUtils.gl2DRenderContext(() -> {
|
||||
final int textShift = ICON_OFFSET + Math.round((ICON_SIZE - fontRenderer.FONT_HEIGHT) / 2f);
|
||||
|
||||
if (this.activeStackIndex == index + indexShift) {
|
||||
NEIClientUtils.gl2DRenderContext(
|
||||
() -> GuiDraw.drawRect(col * SLOT_SIZE - 1, row * SLOT_SIZE - 1, 18, 18, 0x66555555));
|
||||
for (int index = 0; index < this.nameRows; index++) {
|
||||
fontRenderer.drawStringWithShadow(
|
||||
EnumChatFormatting.GRAY + this.names.get(index),
|
||||
SLOT_SIZE + NAME_MARGIN,
|
||||
index * SLOT_SIZE + textShift,
|
||||
0xFFFFFF);
|
||||
}
|
||||
|
||||
drawItem(col * SLOT_SIZE, row * SLOT_SIZE, drawStack, stackSize);
|
||||
}
|
||||
final int hidden = this.length - this.nameRows - this.gridCount;
|
||||
|
||||
if (this.count < this.items.size()) {
|
||||
final String text = "+" + (this.items.size() - this.count);
|
||||
|
||||
NEIClientUtils.gl2DRenderContext(() -> {
|
||||
if (hidden > 0) {
|
||||
final String text = "+" + hidden;
|
||||
fontRenderer.drawStringWithShadow(
|
||||
text,
|
||||
MAX_COLUMNS * SLOT_SIZE - fontRenderer.getStringWidth(text) - 2,
|
||||
(this.rows - 1) * SLOT_SIZE + (SLOT_SIZE - fontRenderer.FONT_HEIGHT) / 2,
|
||||
0xee555555);
|
||||
});
|
||||
}
|
||||
EnumChatFormatting.GRAY + text,
|
||||
this.size.width - fontRenderer.getStringWidth(text) - 2,
|
||||
(this.rows - 1) * SLOT_SIZE + textShift,
|
||||
0xFFFFFF);
|
||||
}
|
||||
});
|
||||
|
||||
GL11.glTranslatef(-xTranslation, -yTranslation, -zTranslation);
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
protected void drawItem(int x, int y, ItemStack drawStack, String stackSize) {
|
||||
GuiContainerManager.drawItem(x, y, drawStack, true, stackSize);
|
||||
protected int gridIndexShift() {
|
||||
if (this.nameRows > 0 || this.activeStackIndex == -1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return Math.max(0, Math.min(this.length - this.gridCount, this.activeStackIndex - this.gridCount + 2));
|
||||
}
|
||||
|
||||
protected void drawSlot(int x, int y, int index) {
|
||||
if (this.activeStackIndex == index) {
|
||||
NEIClientUtils.gl2DRenderContext(() -> GuiDraw.drawRect(x, y, SLOT_SIZE, SLOT_SIZE, 0x66555555));
|
||||
}
|
||||
|
||||
drawStackWithAmount(x, y, index);
|
||||
}
|
||||
|
||||
protected void drawStackWithAmount(int x, int y, int index) {
|
||||
this.amountRenderer.draw(x + ICON_OFFSET, y + ICON_OFFSET, this.items.get(index), this.amounts.get(index));
|
||||
}
|
||||
|
||||
private List<ItemStack> groupingItemStacks(List<ItemStack> items) {
|
||||
final List<ItemStack> result = new ArrayList<>();
|
||||
|
||||
for (Map.Entry<NBTTagCompound, Long> entry : ItemStackAmount.of(items).entrySet()) {
|
||||
final ItemStack stack = StackInfo.loadFromNBT(entry.getKey(), Math.max(0, entry.getValue()));
|
||||
|
||||
if (stack != null && StackInfo.isFluidDisplayItem(stack)) {
|
||||
stack.stackSize = 0;
|
||||
}
|
||||
|
||||
result.add(stack);
|
||||
result.add(StackInfo.loadFromNBT(entry.getKey(), 0));
|
||||
this.amounts.add(Math.max(0, entry.getValue()));
|
||||
}
|
||||
|
||||
if (result.isEmpty()) {
|
||||
result.addAll(items);
|
||||
for (ItemStack stack : items) {
|
||||
result.add(stack);
|
||||
this.amounts.add(0L);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -803,6 +803,8 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
|
||||
if (!isEnabled()) return;
|
||||
|
||||
AutoFocusWidget.instance.guiTick();
|
||||
|
||||
for (Widget widget : drawWidgets) widget.update();
|
||||
}
|
||||
|
||||
|
||||
@@ -212,9 +212,6 @@ public class NEIClientConfig {
|
||||
.getBooleanValue(false);
|
||||
API.addOption(new OptionToggleButton("inventory.bookmarks.showRecipeHandlerIcon", true));
|
||||
|
||||
tag.getTag("inventory.bookmarks.recipeChainDir").getIntValue(1);
|
||||
API.addOption(new OptionCycled("inventory.bookmarks.recipeChainDir", 2, true));
|
||||
|
||||
tag.getTag("inventory.bookmarks.ignorePotionOverlap").setComment("Ignore overlap with potion effect HUD")
|
||||
.getBooleanValue(false);
|
||||
API.addOption(new OptionToggleButton("inventory.bookmarks.ignorePotionOverlap", true));
|
||||
@@ -1153,10 +1150,6 @@ public class NEIClientConfig {
|
||||
return getBooleanSetting("inventory.bookmarks.ignorePotionOverlap");
|
||||
}
|
||||
|
||||
public static int recipeChainDir() {
|
||||
return getIntSetting("inventory.bookmarks.recipeChainDir");
|
||||
}
|
||||
|
||||
public static boolean optimizeGuiOverlapComputation() {
|
||||
return getBooleanSetting("inventory.optimize_gui_overlap_computation");
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ public class NEIController implements IContainerSlotClickHandler, IContainerInpu
|
||||
|
||||
if (GuiInfo.hasCustomSlots(gui)) return false;
|
||||
|
||||
if (NEIClientUtils.shiftKey()) {
|
||||
if (NEIClientUtils.shiftKey() && button != 2) { // MMB is used by other mods when an itemstack is picked.
|
||||
// fix small mouse movement while clicking causing slotIndex to be -999
|
||||
if (slotIndex == -999) {
|
||||
final Point mouse = GuiDraw.getMousePosition();
|
||||
|
||||
@@ -102,6 +102,7 @@ public class NEIModContainer extends DummyModContainer {
|
||||
gregTech5Loaded = Loader.isModLoaded("gregtech") && !Loader.isModLoaded("gregapi_post");
|
||||
gtnhLibLoaded = Loader.isModLoaded("gtnhlib");
|
||||
cubicChunksLoaded = Loader.isModLoaded("cubicchunks");
|
||||
ServerHandler.preInit();
|
||||
if (CommonUtils.isClient()) ClientHandler.preInit();
|
||||
asmDataTable = event.getAsmData();
|
||||
}
|
||||
|
||||
@@ -6,22 +6,18 @@ import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.nei.api.ItemFilter;
|
||||
import codechicken.nei.api.ItemInfo;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.item.FluidDrawer;
|
||||
import codechicken.nei.item.FluidDrawer.FillDirection;
|
||||
import codechicken.nei.recipe.Badge;
|
||||
import codechicken.nei.recipe.GuiRecipe;
|
||||
import codechicken.nei.recipe.StackInfo;
|
||||
@@ -255,7 +251,9 @@ public class PositionedStack implements Cloneable {
|
||||
public static class Fluid extends PositionedStack {
|
||||
|
||||
/** The tank size the fill level is measured against, in mB. 0 means "always render full". */
|
||||
public int capacity = 0;
|
||||
protected int capacity = 0;
|
||||
protected boolean flowingTexture = false;
|
||||
protected FillDirection fillDirection = FillDirection.AUTO;
|
||||
|
||||
private ItemStack cachedFluidItem;
|
||||
private FluidStack cachedFluidStack;
|
||||
@@ -272,7 +270,34 @@ public class PositionedStack implements Cloneable {
|
||||
super(object, x, y, false);
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.capacity = capacity;
|
||||
setCapacity(capacity);
|
||||
}
|
||||
|
||||
public int getCapacity() {
|
||||
return this.capacity;
|
||||
}
|
||||
|
||||
public Fluid setCapacity(int capacity) {
|
||||
this.capacity = Math.max(capacity, 0);
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean hasFlowingTexture() {
|
||||
return this.flowingTexture;
|
||||
}
|
||||
|
||||
public Fluid setFlowingTexture(boolean flowingTexture) {
|
||||
this.flowingTexture = flowingTexture;
|
||||
return this;
|
||||
}
|
||||
|
||||
public FillDirection getFillDirection() {
|
||||
return this.fillDirection;
|
||||
}
|
||||
|
||||
public Fluid setFillDirection(FillDirection fillDirection) {
|
||||
this.fillDirection = fillDirection == null ? FillDirection.AUTO : fillDirection;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected FluidStack getFluidStack() {
|
||||
@@ -313,62 +338,15 @@ public class PositionedStack implements Cloneable {
|
||||
return;
|
||||
}
|
||||
|
||||
final int tankCapacity = this.capacity > 0 ? this.capacity : fluidStack.amount;
|
||||
int fillHeight = tankCapacity > 0
|
||||
? (int) ((long) this.height * Math.min(fluidStack.amount, tankCapacity) / tankCapacity)
|
||||
: 0;
|
||||
|
||||
if (fluidStack.amount > 0 && fillHeight <= 0) {
|
||||
fillHeight = 1;
|
||||
}
|
||||
|
||||
if (fillHeight > 0) {
|
||||
drawFluid(this.relx, this.rely, this.width, this.height, fillHeight, fluidStack);
|
||||
}
|
||||
}
|
||||
|
||||
private static void drawFluid(int x, int y, int width, int height, int fillHeight, FluidStack fluidStack) {
|
||||
final IIcon icon = fluidStack.getFluid().getIcon(fluidStack);
|
||||
|
||||
if (icon == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final int color = fluidStack.getFluid().getColor(fluidStack);
|
||||
final float red = (color >> 16 & 0xFF) / 255F;
|
||||
final float green = (color >> 8 & 0xFF) / 255F;
|
||||
final float blue = (color & 0xFF) / 255F;
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
|
||||
GL11.glColor4f(red, green, blue, 1F);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
for (int tx = 0; tx < width; tx += 16) {
|
||||
final int tileWidth = Math.min(16, width - tx);
|
||||
final double u2 = icon.getMinU() + (icon.getMaxU() - icon.getMinU()) * tileWidth / 16D;
|
||||
|
||||
for (int ty = 0; ty < fillHeight; ty += 16) {
|
||||
final int tileHeight = Math.min(16, fillHeight - ty);
|
||||
final double v2 = icon.getMinV() + (icon.getMaxV() - icon.getMinV()) * tileHeight / 16D;
|
||||
final int bottomY = y + height - ty;
|
||||
final int topY = bottomY - tileHeight;
|
||||
|
||||
tessellator.addVertexWithUV(x + tx, bottomY, 0, icon.getMinU(), v2);
|
||||
tessellator.addVertexWithUV(x + tx + tileWidth, bottomY, 0, u2, v2);
|
||||
tessellator.addVertexWithUV(x + tx + tileWidth, topY, 0, u2, icon.getMinV());
|
||||
tessellator.addVertexWithUV(x + tx, topY, 0, icon.getMinU(), icon.getMinV());
|
||||
}
|
||||
}
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
FluidDrawer.drawFluid(
|
||||
this.relx,
|
||||
this.rely,
|
||||
this.width,
|
||||
this.height,
|
||||
this.capacity,
|
||||
fluidStack,
|
||||
this.flowingTexture,
|
||||
this.fillDirection);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import net.minecraftforge.event.world.WorldEvent;
|
||||
|
||||
import codechicken.core.CommonUtils;
|
||||
import codechicken.lib.packet.PacketCustom;
|
||||
import codechicken.nei.item.ItemFluidDisplay;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerChangedDimensionEvent;
|
||||
@@ -18,6 +19,7 @@ import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedOutEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerRespawnEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.Phase;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class ServerHandler {
|
||||
|
||||
@@ -31,6 +33,14 @@ public class ServerHandler {
|
||||
NEIActions.init();
|
||||
}
|
||||
|
||||
public static void preInit() {
|
||||
registerFluidDisplayItem();
|
||||
}
|
||||
|
||||
private static void registerFluidDisplayItem() {
|
||||
GameRegistry.registerItem(new ItemFluidDisplay(), "neiFluidDisplay");
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void tickEvent(TickEvent.WorldTickEvent event) {
|
||||
if (event.phase == Phase.START && !event.world.isRemote
|
||||
|
||||
@@ -146,14 +146,14 @@ public class API {
|
||||
* Hide an item from the item panel Damage values of OreDictionary.WILDCARD_VALUE and ItemStackMap.WILDCARD_TAG tags
|
||||
* function as wildcards for their respective variables
|
||||
*/
|
||||
public static void hideItem(ItemStack item) {
|
||||
public static synchronized void hideItem(ItemStack item) {
|
||||
if (!ItemInfo.hiddenItems.contains(item)) {
|
||||
ItemInfo.hiddenItems.add(item);
|
||||
LayoutManager.markItemsDirty();
|
||||
}
|
||||
}
|
||||
|
||||
public static void hideItem(String rule) {
|
||||
public static synchronized void hideItem(String rule) {
|
||||
ItemFilter filter = ItemStackFilterParser.parse(rule);
|
||||
if (filter != null) {
|
||||
ItemInfo.hiddenItemsRules.filters.add(filter);
|
||||
|
||||
@@ -36,6 +36,7 @@ import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.RegistryNamespaced;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
import net.minecraftforge.common.IShearable;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
@@ -60,6 +61,7 @@ import codechicken.nei.config.HandlerDumper;
|
||||
import codechicken.nei.config.ItemPanelDumper;
|
||||
import codechicken.nei.config.RegistryDumper;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.item.FluidDisplayRenderer;
|
||||
import codechicken.nei.item.ItemFluidDisplay;
|
||||
import codechicken.nei.recipe.BrewingRecipeHandler;
|
||||
import codechicken.nei.recipe.RecipeItemInputHandler;
|
||||
@@ -134,7 +136,7 @@ public class ItemInfo {
|
||||
|
||||
public static void preInit() {
|
||||
addMobSpawnerItem();
|
||||
addFluidDisplayItem();
|
||||
setupFluidDisplayItemClient();
|
||||
}
|
||||
|
||||
public static void load() {
|
||||
@@ -320,8 +322,9 @@ public class ItemInfo {
|
||||
GameDataManipulator.replaceItem(Block.getIdFromBlock(Blocks.mob_spawner), new ItemMobSpawner());
|
||||
}
|
||||
|
||||
private static void addFluidDisplayItem() {
|
||||
GameRegistry.registerItem(new ItemFluidDisplay(), "neiFluidDisplay");
|
||||
private static void setupFluidDisplayItemClient() {
|
||||
ItemFluidDisplay.INSTANCE.setCreativeTab(ItemFluidDisplay.tabFluids);
|
||||
MinecraftForgeClient.registerItemRenderer(ItemFluidDisplay.INSTANCE, new FluidDisplayRenderer());
|
||||
}
|
||||
|
||||
private static void addInfiniteHandlers() {
|
||||
|
||||
@@ -13,7 +13,6 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
@@ -67,6 +66,7 @@ import codechicken.nei.recipe.GuiRecipeButton.UpdateRecipeButtonsEvent;
|
||||
import codechicken.nei.recipe.GuiRecipeTab;
|
||||
import codechicken.nei.recipe.Recipe;
|
||||
import codechicken.nei.recipe.Recipe.RecipeId;
|
||||
import codechicken.nei.recipe.RecipeItemsTooltipLineHandler;
|
||||
import codechicken.nei.recipe.RecipeTooltipLineHandler;
|
||||
import codechicken.nei.recipe.StackInfo;
|
||||
import codechicken.nei.util.EmptyContainer;
|
||||
@@ -115,7 +115,7 @@ public class GuiCraftingTree extends GuiContainer implements INEIGuiHandler, IGu
|
||||
private static final int PADDING = 9;
|
||||
private static final int PADDING_TOP = 22;
|
||||
|
||||
private static LRUCache<String, String> handlerTitleCache = new LRUCache<>(100);
|
||||
private final LRUCache<String, String> handlerTitleCache = new LRUCache<>(100);
|
||||
|
||||
private GuiScreen prevGui;
|
||||
private boolean isFirstScreen = true;
|
||||
@@ -134,6 +134,7 @@ public class GuiCraftingTree extends GuiContainer implements INEIGuiHandler, IGu
|
||||
|
||||
private RecipeTooltipLineHandler recipeTooltipLineHandler;
|
||||
private AcceptsFollowingTooltipLineHandler acceptsFollowingTooltipLineHandler;
|
||||
private RecipeItemsTooltipLineHandler recipeItemsTooltipLineHandler;
|
||||
|
||||
private final CraftingTreeState uiState = new CraftingTreeState();
|
||||
private final CraftingTreeToolbar toolbar;
|
||||
@@ -917,15 +918,8 @@ public class GuiCraftingTree extends GuiContainer implements INEIGuiHandler, IGu
|
||||
super.keyTyped(typedChar, keyCode);
|
||||
}
|
||||
|
||||
private static String getHandlerTitle(String handlerName) {
|
||||
return handlerTitleCache.computeIfAbsent(
|
||||
handlerName,
|
||||
hname -> Stream
|
||||
.concat(
|
||||
GuiCraftingRecipe.craftinghandlers.stream(),
|
||||
GuiCraftingRecipe.serialCraftingHandlers.stream())
|
||||
.filter(handler -> hname.equals(GuiRecipeTab.getHandlerInfo(handler).getHandlerName()))
|
||||
.findFirst().map(handler -> handler.getRecipeName().trim()).orElse(hname));
|
||||
private String getHandlerTitle(String handlerName) {
|
||||
return this.handlerTitleCache.computeIfAbsent(handlerName, GuiRecipeTab::getHandlerTitle);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -939,12 +933,15 @@ public class GuiCraftingTree extends GuiContainer implements INEIGuiHandler, IGu
|
||||
if (toolbarTooltip != null) {
|
||||
currenttip.add(toolbarTooltip);
|
||||
} else if (this.hoveredBadgeHandler != null) {
|
||||
final RecipeId recipeId = this.hoveredBadgeHandler.prefItem != null
|
||||
? this.hoveredBadgeHandler.prefItem.recipeId
|
||||
: null;
|
||||
final long multiplier = this.hoveredBadgeHandler.multiplier;
|
||||
final ItemTreeSlot node = this.hoveredBadgeHandler;
|
||||
final RecipeId recipeId = node.prefItem != null ? node.prefItem.recipeId : null;
|
||||
|
||||
if (recipeId != null && NEIClientUtils.shiftKey()) {
|
||||
addRecipeItemsTooltipLine(recipeId, node.multiplier, currenttip);
|
||||
} else {
|
||||
addRecipeTooltipLine(recipeId, node.multiplier, currenttip);
|
||||
}
|
||||
|
||||
addRecipeTooltipLine(recipeId, multiplier, currenttip);
|
||||
} else {
|
||||
|
||||
if (this.statsPanelVisible) {
|
||||
@@ -960,6 +957,14 @@ public class GuiCraftingTree extends GuiContainer implements INEIGuiHandler, IGu
|
||||
EnumChatFormatting.GRAY + NEIClientUtils.translate(
|
||||
"bookmark.tree.stats.handler_iterations",
|
||||
handlerStatsSlot.stats.iterations));
|
||||
} else if (widget instanceof StatsPanel.ItemStatsSlot itemStatsSlot && itemStatsSlot.recipeId != null) {
|
||||
if (NEIClientUtils.shiftKey()) {
|
||||
addRecipeItemsTooltipLine(itemStatsSlot.recipeId, itemStatsSlot.multiplier, currenttip);
|
||||
} else {
|
||||
currenttip.add(itemStatsSlot.stack.getDisplayName() + GuiDraw.TOOLTIP_LINESPACE);
|
||||
|
||||
addRecipeTooltipLine(itemStatsSlot.recipeId, itemStatsSlot.multiplier, currenttip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -968,6 +973,19 @@ public class GuiCraftingTree extends GuiContainer implements INEIGuiHandler, IGu
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
private void addRecipeItemsTooltipLine(RecipeId recipeId, long multiplier, List<String> currenttip) {
|
||||
|
||||
if (this.recipeItemsTooltipLineHandler == null
|
||||
|| this.recipeItemsTooltipLineHandler.getMultiplier() != multiplier
|
||||
|| !this.recipeItemsTooltipLineHandler.getRecipeId().equals(recipeId)) {
|
||||
this.recipeItemsTooltipLineHandler = new RecipeItemsTooltipLineHandler(recipeId, multiplier)
|
||||
.setUseInventory(true);
|
||||
}
|
||||
|
||||
currenttip.add(this.recipeItemsTooltipLineHandler.getTitle() + GuiDraw.TOOLTIP_LINESPACE);
|
||||
currenttip.add(GuiDraw.TOOLTIP_HANDLER + GuiDraw.getTipLineId(this.recipeItemsTooltipLineHandler));
|
||||
}
|
||||
|
||||
private void addRecipeTooltipLine(RecipeId recipeId, long multiplier, List<String> currenttip) {
|
||||
|
||||
if (recipeId == null) {
|
||||
@@ -1078,14 +1096,6 @@ public class GuiCraftingTree extends GuiContainer implements INEIGuiHandler, IGu
|
||||
|
||||
} else {
|
||||
this.acceptsFollowingTooltipLineHandler = null;
|
||||
|
||||
if (this.statsPanelVisible) {
|
||||
final Widget widget = this.statsPanel.getWidgetUnderMouse(mousex, mousey);
|
||||
if (widget instanceof StatsPanel.ItemStatsSlot itemStatsSlot) {
|
||||
addRecipeTooltipLine(itemStatsSlot.recipeId, itemStatsSlot.multiplier, currenttip);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
|
||||
@@ -3,6 +3,7 @@ package codechicken.nei.bookmark.tree;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -88,6 +89,10 @@ class StatsPanel extends ScrollContainer {
|
||||
this(stack, stackSize, icon, null, 1);
|
||||
}
|
||||
|
||||
public ItemStack getStack() {
|
||||
return StackInfo.withAmount(this.stack, stackSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int mx, int my) {
|
||||
|
||||
@@ -118,7 +123,7 @@ class StatsPanel extends ScrollContainer {
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
GL11.glTranslatef(badgeX, y - 6 * scale, 3.0f);
|
||||
GL11.glTranslatef(badgeX, y - 6 * scale, 10.0f);
|
||||
GL11.glScalef(scale, scale, 1.0f);
|
||||
|
||||
if (this.info.hasImageOrItem()) {
|
||||
@@ -519,7 +524,7 @@ class StatsPanel extends ScrollContainer {
|
||||
|
||||
public ItemStack getStackMouseOver(int mouseX, int mouseY) {
|
||||
final Widget widget = getWidgetUnderMouse(mouseX, mouseY);
|
||||
return widget instanceof ItemStatsSlot slot ? slot.stack : null;
|
||||
return widget instanceof ItemStatsSlot slot && slot.recipeId == null ? slot.getStack() : null;
|
||||
}
|
||||
|
||||
public void setHighlight(SearchResult searchResult) {
|
||||
@@ -711,8 +716,14 @@ class StatsPanel extends ScrollContainer {
|
||||
private List<Widget> collectHandlers(RecipeChainMath math) {
|
||||
final Map<String, HandlerStats> handlerStats = new HashMap<>();
|
||||
final List<Widget> widgets = new ArrayList<>();
|
||||
final Set<RecipeId> countedRecipes = new HashSet<>();
|
||||
|
||||
for (BookmarkItem item : math.recipeResults) {
|
||||
// a recipe adds one result item per output, count it only once
|
||||
if (!countedRecipes.add(item.recipeId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
final HandlerStats stats = handlerStats
|
||||
.computeIfAbsent(item.recipeId.getHandlerName(), k -> new HandlerStats());
|
||||
stats.iterations += item.getMultiplier();
|
||||
|
||||
@@ -2,17 +2,20 @@ package codechicken.nei.item;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.nei.util.ReadableNumberConverter;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class FluidDisplayRenderer implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
@@ -49,7 +52,8 @@ public class FluidDisplayRenderer implements IItemRenderer {
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
|
||||
GL11.glColor4f(red, green, blue, 1F);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
OpenGlHelper
|
||||
.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
@@ -64,17 +68,17 @@ public class FluidDisplayRenderer implements IItemRenderer {
|
||||
}
|
||||
|
||||
private void renderAmountOverlay(ItemStack item, ItemFluidDisplay fluidDisplay) {
|
||||
final FluidStack fluidStack = fluidDisplay.getFluid(item);
|
||||
if (fluidStack == null || fluidStack.amount <= 0) {
|
||||
final long amount = fluidDisplay.getAmountLong(item);
|
||||
if (amount <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
String amountString = "";
|
||||
|
||||
if (fluidStack.amount < 10_000) {
|
||||
amountString = String.valueOf(fluidStack.amount) + "L";
|
||||
if (amount < 10_000) {
|
||||
amountString = String.valueOf(amount) + "L";
|
||||
} else {
|
||||
amountString = ReadableNumberConverter.INSTANCE.toWideReadableForm(fluidStack.amount) + "L";
|
||||
amountString = ReadableNumberConverter.INSTANCE.toWideReadableForm(amount) + "L";
|
||||
}
|
||||
|
||||
final FontRenderer fontRender = Minecraft.getMinecraft().fontRenderer;
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
package codechicken.nei.item;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class FluidDrawer {
|
||||
|
||||
public enum FillDirection {
|
||||
|
||||
AUTO,
|
||||
UP,
|
||||
DOWN,
|
||||
LEFT,
|
||||
RIGHT;
|
||||
|
||||
public boolean isHorizontal() {
|
||||
return this == LEFT || this == RIGHT;
|
||||
}
|
||||
|
||||
public FillDirection resolve(FluidStack fluidStack) {
|
||||
if (this != AUTO) return this;
|
||||
return fluidStack.getFluid().isGaseous(fluidStack) ? DOWN : UP;
|
||||
}
|
||||
}
|
||||
|
||||
private FluidDrawer() {}
|
||||
|
||||
public static void drawFluid(int x, int y, int width, int height, int capacity, FluidStack fluidStack,
|
||||
boolean flowing, FillDirection direction) {
|
||||
final Fluid fluid = fluidStack.getFluid();
|
||||
IIcon icon = flowing ? fluid.getFlowingIcon() : null;
|
||||
|
||||
if (icon == null) {
|
||||
icon = fluid.getIcon(fluidStack);
|
||||
}
|
||||
|
||||
if (icon == null || fluidStack.amount <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
direction = direction.resolve(fluidStack);
|
||||
|
||||
final int tankSize = direction.isHorizontal() ? width : height;
|
||||
final int tankCapacity = capacity > 0 ? capacity : fluidStack.amount;
|
||||
final int fillSize = Math
|
||||
.max(1, (int) ((long) tankSize * Math.min(fluidStack.amount, tankCapacity) / tankCapacity));
|
||||
|
||||
final int fillWidth = direction.isHorizontal() ? Math.min(fillSize, width) : width;
|
||||
final int fillHeight = direction.isHorizontal() ? height : Math.min(fillSize, height);
|
||||
final int fillX = direction == FillDirection.LEFT ? x + width - fillWidth : x;
|
||||
final int fillY = direction == FillDirection.DOWN ? y : y + height - fillHeight;
|
||||
final boolean anchorRight = direction == FillDirection.LEFT;
|
||||
final boolean anchorBottom = direction != FillDirection.DOWN;
|
||||
|
||||
final int color = fluid.getColor(fluidStack);
|
||||
final float red = (color >> 16 & 0xFF) / 255F;
|
||||
final float green = (color >> 8 & 0xFF) / 255F;
|
||||
final float blue = (color & 0xFF) / 255F;
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
|
||||
GL11.glColor3f(red, green, blue);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
for (int tx = 0; tx < fillWidth; tx += 16) {
|
||||
final int tileWidth = Math.min(16, fillWidth - tx);
|
||||
// a cropped tile keeps the texture edge that stays seamless against the neighbouring tile
|
||||
final double uSize = (icon.getMaxU() - icon.getMinU()) * tileWidth / 16D;
|
||||
final double uMin = anchorRight ? icon.getMaxU() - uSize : icon.getMinU();
|
||||
final double uMax = anchorRight ? icon.getMaxU() : icon.getMinU() + uSize;
|
||||
final int leftX = anchorRight ? fillX + fillWidth - tx - tileWidth : fillX + tx;
|
||||
final int rightX = leftX + tileWidth;
|
||||
|
||||
for (int ty = 0; ty < fillHeight; ty += 16) {
|
||||
final int tileHeight = Math.min(16, fillHeight - ty);
|
||||
final double vSize = (icon.getMaxV() - icon.getMinV()) * tileHeight / 16D;
|
||||
final double vMin = anchorBottom ? icon.getMaxV() - vSize : icon.getMinV();
|
||||
final double vMax = anchorBottom ? icon.getMaxV() : icon.getMinV() + vSize;
|
||||
final int bottomY = anchorBottom ? fillY + fillHeight - ty : fillY + ty + tileHeight;
|
||||
final int topY = bottomY - tileHeight;
|
||||
|
||||
tessellator.addVertexWithUV(leftX, bottomY, 0, uMin, vMax);
|
||||
tessellator.addVertexWithUV(rightX, bottomY, 0, uMax, vMax);
|
||||
tessellator.addVertexWithUV(rightX, topY, 0, uMax, vMin);
|
||||
tessellator.addVertexWithUV(leftX, topY, 0, uMin, vMin);
|
||||
}
|
||||
}
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
@@ -40,36 +39,32 @@ public class ItemFluidDisplay extends Item implements IFluidContainerItem {
|
||||
};
|
||||
|
||||
public ItemFluidDisplay() {
|
||||
setMaxStackSize(1);
|
||||
setUnlocalizedName("nei.fluidDisplay");
|
||||
setMaxStackSize(1);
|
||||
INSTANCE = this;
|
||||
|
||||
setCreativeTab(tabFluids);
|
||||
MinecraftForgeClient.registerItemRenderer(this, new FluidDisplayRenderer());
|
||||
}
|
||||
|
||||
public static ItemStack createStack(FluidStack fluidStack) {
|
||||
if (fluidStack == null || fluidStack.getFluid() == null) {
|
||||
return fluidStack == null ? null : createStack(fluidStack.getFluid(), fluidStack.amount);
|
||||
}
|
||||
|
||||
public static ItemStack createStack(Fluid fluid, long amount) {
|
||||
if (fluid == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int fluidId;
|
||||
|
||||
try {
|
||||
fluidId = FluidRegistry.getFluidID(fluidStack.getFluid());
|
||||
fluidId = FluidRegistry.getFluidID(fluid);
|
||||
} catch (Exception e) {
|
||||
NEIClientConfig.logger.error("Failed to get fluid id for: " + fluidStack.getFluid().getName(), e);
|
||||
NEIClientConfig.logger.error("Failed to get fluid id for: " + fluid.getName(), e);
|
||||
return null;
|
||||
}
|
||||
|
||||
final ItemStack stack = new ItemStack(INSTANCE, 1, fluidId);
|
||||
final NBTTagCompound nbtTag = new NBTTagCompound();
|
||||
|
||||
if (fluidStack.tag != null) {
|
||||
nbtTag.setTag("FluidTag", fluidStack.tag.copy());
|
||||
}
|
||||
|
||||
nbtTag.setInteger("neiFluidDisplayAmount", fluidStack.amount);
|
||||
nbtTag.setLong("neiFluidDisplayAmount", amount);
|
||||
stack.setTagCompound(nbtTag);
|
||||
return stack;
|
||||
}
|
||||
@@ -88,23 +83,25 @@ public class ItemFluidDisplay extends Item implements IFluidContainerItem {
|
||||
}
|
||||
|
||||
final NBTTagCompound nbTag = stack.getTagCompound();
|
||||
final FluidStack fluidStack = new FluidStack(fluid, nbTag.getInteger("neiFluidDisplayAmount"));
|
||||
|
||||
if (nbTag.hasKey("FluidTag")) {
|
||||
fluidStack.tag = nbTag.getCompoundTag("FluidTag");
|
||||
}
|
||||
final FluidStack fluidStack = new FluidStack(
|
||||
fluid,
|
||||
(int) Math.min(nbTag.getLong("neiFluidDisplayAmount"), Integer.MAX_VALUE));
|
||||
|
||||
return fluidStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity(ItemStack stack) {
|
||||
public long getAmountLong(ItemStack stack) {
|
||||
|
||||
if (stack == null || !(stack.getItem() instanceof ItemFluidDisplay) || !stack.hasTagCompound()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return stack.getTagCompound().getInteger("neiFluidDisplayAmount");
|
||||
return stack.getTagCompound().getLong("neiFluidDisplayAmount");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity(ItemStack stack) {
|
||||
return (int) Math.min(getAmountLong(stack), Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -180,7 +177,7 @@ public class ItemFluidDisplay extends Item implements IFluidContainerItem {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item aItem, CreativeTabs aTab, List<ItemStack> aList) {
|
||||
for (int i = 0, j = FluidRegistry.getMaxID(); i < j; i++) {
|
||||
for (int i = 0, j = FluidRegistry.getMaxID(); i <= j; i++) {
|
||||
final Fluid fluid = FluidRegistry.getFluid(i);
|
||||
if (fluid == null) {
|
||||
continue;
|
||||
|
||||
@@ -20,6 +20,7 @@ public class AcceptsFollowingTooltipLineHandler extends ItemsTooltipLineHandler
|
||||
super(NEIClientUtils.translate("recipe.accepts"), items, false, maxRows);
|
||||
this.tooltipGUID = tooltipGUID;
|
||||
setActiveStack(activeStack);
|
||||
setAmountRenderer(new FavoriteAmountRenderer());
|
||||
}
|
||||
|
||||
public static AcceptsFollowingTooltipLineHandler of(Object tooltipGUID, List<ItemStack> items,
|
||||
@@ -38,12 +39,15 @@ public class AcceptsFollowingTooltipLineHandler extends ItemsTooltipLineHandler
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawItem(int x, int y, ItemStack drawStack, String stackSize) {
|
||||
super.drawItem(x, y, drawStack, stackSize);
|
||||
protected static class FavoriteAmountRenderer extends NoAmountRenderer {
|
||||
|
||||
if (FavoriteRecipes.containsManual(drawStack)) {
|
||||
NEIClientUtils.drawNEIOverlayText("F", x, y);
|
||||
@Override
|
||||
public void draw(int x, int y, ItemStack stack, long amount) {
|
||||
super.draw(x, y, stack, amount);
|
||||
|
||||
if (FavoriteRecipes.containsManual(stack)) {
|
||||
NEIClientUtils.drawNEIOverlayText("F", x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ public class GuiOverlayButton extends GuiRecipeButton {
|
||||
|
||||
if (format == ItemOverlayFormat.BACKGROUND) {
|
||||
NEIClientUtils.gl2DRenderContext(
|
||||
() -> drawRect(
|
||||
() -> GuiDraw.drawRect(
|
||||
this.slot.relx,
|
||||
this.slot.rely,
|
||||
this.slot.width,
|
||||
@@ -262,11 +262,8 @@ public class GuiOverlayButton extends GuiRecipeButton {
|
||||
.map(state -> state.getSlot().item).collect(Collectors.toList());
|
||||
|
||||
if (!items.isEmpty()) {
|
||||
this.missedMaterialsTooltipLineHandler = new ItemsTooltipLineHandler(
|
||||
NEIClientUtils.translate("recipe.overlay.missing"),
|
||||
items,
|
||||
true,
|
||||
Integer.MAX_VALUE);
|
||||
this.missedMaterialsTooltipLineHandler = ItemsTooltipLineHandler
|
||||
.grid(NEIClientUtils.translate("recipe.overlay.missing"), items, Integer.MAX_VALUE);
|
||||
} else {
|
||||
this.missedMaterialsTooltipLineHandler = null;
|
||||
}
|
||||
|
||||
@@ -181,6 +181,24 @@ public abstract class GuiRecipeTab extends Widget {
|
||||
return res;
|
||||
}
|
||||
|
||||
public static String getHandlerTitle(String handlerName) {
|
||||
String title = findRecipeName(GuiCraftingRecipe.craftinghandlers, handlerName);
|
||||
if (title == null) title = findRecipeName(GuiCraftingRecipe.serialCraftingHandlers, handlerName);
|
||||
if (title == null) title = findRecipeName(GuiUsageRecipe.usagehandlers, handlerName);
|
||||
if (title == null) title = findRecipeName(GuiUsageRecipe.serialUsageHandlers, handlerName);
|
||||
|
||||
return title != null ? title : handlerName;
|
||||
}
|
||||
|
||||
private static String findRecipeName(List<? extends IRecipeHandler> handlers, String handlerName) {
|
||||
for (int index = 0; index < handlers.size(); index++) {
|
||||
final IRecipeHandler handler = handlers.get(index);
|
||||
if (handlerName.equals(getHandlerInfo(handler).getHandlerName())) return handler.getRecipeName().trim();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getHandlerMod(String name, String name2) {
|
||||
HandlerInfo info = getHandlerInfo(name, name2);
|
||||
if (info == null) return "Unknown";
|
||||
|
||||
@@ -4,7 +4,9 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
@@ -43,7 +45,13 @@ public class Recipe {
|
||||
|
||||
if (!isShapedRecipe()) {
|
||||
// sort to ignore ingredients position in shapeless recipes
|
||||
this.ingredients.sort(Comparator.comparing(StackInfo::getItemStackGUID));
|
||||
final Map<ItemStack, String> guids = new IdentityHashMap<>();
|
||||
|
||||
for (ItemStack ingredient : this.ingredients) {
|
||||
guids.put(ingredient, StackInfo.getItemStackGUID(ingredient));
|
||||
}
|
||||
|
||||
this.ingredients.sort(Comparator.comparing(guids::get));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +60,10 @@ public class Recipe {
|
||||
}
|
||||
|
||||
public static RecipeId of(IRecipeHandler handler, int recipeIndex) {
|
||||
final List<PositionedStack> ingredients = handler.getIngredientStacks(recipeIndex);
|
||||
return of(handler, recipeIndex, handler.getIngredientStacks(recipeIndex));
|
||||
}
|
||||
|
||||
public static RecipeId of(IRecipeHandler handler, int recipeIndex, List<PositionedStack> ingredients) {
|
||||
final String handlerName = GuiRecipeTab.getHandlerInfo(handler).getHandlerName();
|
||||
PositionedStack pStackResult = handler.getResultStack(recipeIndex);
|
||||
|
||||
|
||||
@@ -0,0 +1,291 @@
|
||||
package codechicken.nei.recipe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.CompositeTooltipLineHandler;
|
||||
import codechicken.nei.ItemStackAmount;
|
||||
import codechicken.nei.ItemsTooltipLineHandler;
|
||||
import codechicken.nei.ItemsTooltipLineHandler.StacksAmountRenderer;
|
||||
import codechicken.nei.ItemsTooltipLineHandler.TotalAmountRenderer;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.api.IGuiContainerOverlay;
|
||||
import codechicken.nei.recipe.Recipe.RecipeId;
|
||||
import codechicken.nei.recipe.Recipe.RecipeIngredient;
|
||||
import codechicken.nei.util.ReadableNumberConverter;
|
||||
|
||||
public class RecipeItemsTooltipLineHandler extends CompositeTooltipLineHandler {
|
||||
|
||||
protected static class ChanceTotalAmountRenderer extends TotalAmountRenderer {
|
||||
|
||||
protected final Set<ItemStack> approximate;
|
||||
|
||||
public ChanceTotalAmountRenderer(Set<ItemStack> approximate) {
|
||||
this.approximate = approximate;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String formatAmount(ItemStack stack, long amount) {
|
||||
final String text = super.formatAmount(stack, amount);
|
||||
|
||||
if (!this.approximate.contains(stack)) {
|
||||
return text;
|
||||
} else if (!text.isEmpty()) {
|
||||
return EnumChatFormatting.GOLD + "~" + text;
|
||||
} else if (amount == 0) {
|
||||
return EnumChatFormatting.GOLD + "~0";
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
}
|
||||
|
||||
protected static class ChanceStacksAmountRenderer extends StacksAmountRenderer {
|
||||
|
||||
protected static final int APPROXIMATE_COLOR = 0xFFAA00;
|
||||
|
||||
protected final Set<ItemStack> approximate;
|
||||
|
||||
public ChanceStacksAmountRenderer(Set<ItemStack> approximate) {
|
||||
this.approximate = approximate;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawAmount(Rectangle4i rect, ItemStack stack, long amount) {
|
||||
if (amount == 0) {
|
||||
Badge.notConsumed().draw(rect);
|
||||
} else {
|
||||
super.drawAmount(rect, stack, amount);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getPrefix(ItemStack stack) {
|
||||
return this.approximate.contains(stack) ? "~" : "";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getColor(ItemStack stack) {
|
||||
return this.approximate.contains(stack) ? APPROXIMATE_COLOR : super.getColor(stack);
|
||||
}
|
||||
}
|
||||
|
||||
protected final RecipeId recipeId;
|
||||
protected final long multiplier;
|
||||
protected boolean useInventory = false;
|
||||
protected String title = "";
|
||||
|
||||
public RecipeItemsTooltipLineHandler(RecipeId recipeId, long multiplier) {
|
||||
this.recipeId = recipeId;
|
||||
this.multiplier = multiplier;
|
||||
}
|
||||
|
||||
public RecipeItemsTooltipLineHandler setUseInventory(boolean useInventory) {
|
||||
this.useInventory = useInventory;
|
||||
this.created = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RecipeId getRecipeId() {
|
||||
return this.recipeId;
|
||||
}
|
||||
|
||||
public long getMultiplier() {
|
||||
return this.multiplier;
|
||||
}
|
||||
|
||||
public boolean isUseInventory() {
|
||||
return this.useInventory;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
ensureCreated();
|
||||
return this.title;
|
||||
}
|
||||
|
||||
protected static int getIngredientOrder(ItemStack stack) {
|
||||
return StackInfo.isFluidDisplayItem(stack) ? 2 : stack.stackSize == 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createLines() {
|
||||
final RecipeHandlerRef handlerRef = RecipeHandlerRef.of(this.recipeId);
|
||||
|
||||
if (handlerRef == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Recipe recipe = Recipe.of(handlerRef);
|
||||
final Set<NBTTagCompound> approximateResults = new HashSet<>();
|
||||
final Set<NBTTagCompound> approximateIngredients = new HashSet<>();
|
||||
final List<ItemStack> results = multiplyItems(recipe.getResults(), false, approximateResults);
|
||||
final List<ItemStack> ingredients = multiplyItems(recipe.getIngredients(), true, approximateIngredients);
|
||||
final ItemStackAmount ingredientsAmount = ItemStackAmount.of(ingredients);
|
||||
|
||||
ingredients.sort(Comparator.comparingInt(RecipeItemsTooltipLineHandler::getIngredientOrder));
|
||||
|
||||
this.title = handlerRef.handler.getRecipeName().trim() + " (x"
|
||||
+ ReadableNumberConverter.INSTANCE.toWideReadableForm(this.multiplier)
|
||||
+ ")";
|
||||
|
||||
addResultLine(results, approximateResults);
|
||||
addRequiredLine(ingredients, approximateIngredients);
|
||||
|
||||
if (this.useInventory) {
|
||||
final List<ItemStack> needed = subtractItems(ingredientsAmount, getInventoryItems());
|
||||
final ItemStackAmount neededAmount = ItemStackAmount.of(needed);
|
||||
final ItemStackAmount consumedAmount = ItemStackAmount.of(ingredientsAmount);
|
||||
consumedAmount.removeIf(entry -> entry.getValue() <= 0);
|
||||
|
||||
if (!neededAmount.equals(consumedAmount)) {
|
||||
addNeededLine(
|
||||
needed,
|
||||
approximateIngredients,
|
||||
needed.size() == 1 || ingredientsAmount.size() + neededAmount.size() <= maxLineRows());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void addResultLine(List<ItemStack> items, Set<NBTTagCompound> approximate) {
|
||||
final String label = NEIClientUtils.translate("recipe.items.results");
|
||||
final ItemsTooltipLineHandler line = items.size() == 1
|
||||
? ItemsTooltipLineHandler.list(label, items, maxLineRows())
|
||||
: ItemsTooltipLineHandler.grid(label, items, maxLineRows());
|
||||
|
||||
if (line.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
line.setLabelColor(EnumChatFormatting.GREEN);
|
||||
|
||||
final Set<ItemStack> approximateItems = Collections.newSetFromMap(new IdentityHashMap<>());
|
||||
|
||||
for (ItemStack stack : line.getItems()) {
|
||||
if (approximate.contains(StackInfo.itemStackToNBT(stack, false))) {
|
||||
approximateItems.add(stack);
|
||||
}
|
||||
}
|
||||
|
||||
line.setAmountRenderer(new ChanceTotalAmountRenderer(approximateItems));
|
||||
|
||||
this.lines.add(line);
|
||||
}
|
||||
|
||||
protected void addRequiredLine(List<ItemStack> items, Set<NBTTagCompound> approximate) {
|
||||
final String label = NEIClientUtils.translate("recipe.items.ingredients");
|
||||
final ItemsTooltipLineHandler line = ItemsTooltipLineHandler.list(label, items, maxLineRows());
|
||||
|
||||
if (line.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
line.setLabelColor(EnumChatFormatting.YELLOW);
|
||||
|
||||
final Set<ItemStack> approximateItems = Collections.newSetFromMap(new IdentityHashMap<>());
|
||||
|
||||
for (ItemStack stack : line.getItems()) {
|
||||
if (approximate.contains(StackInfo.itemStackToNBT(stack, false))) {
|
||||
approximateItems.add(stack);
|
||||
}
|
||||
}
|
||||
|
||||
line.setAmountRenderer(new ChanceStacksAmountRenderer(approximateItems));
|
||||
|
||||
this.lines.add(line);
|
||||
}
|
||||
|
||||
protected void addNeededLine(List<ItemStack> items, Set<NBTTagCompound> approximate, boolean vertical) {
|
||||
final String label = NEIClientUtils.translate("recipe.items.ingredients_needed");
|
||||
final ItemsTooltipLineHandler line = vertical ? ItemsTooltipLineHandler.list(label, items, maxLineRows())
|
||||
: ItemsTooltipLineHandler.grid(label, items, maxLineRows());
|
||||
|
||||
if (line.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
line.setLabelColor(EnumChatFormatting.RED);
|
||||
|
||||
final Set<ItemStack> approximateItems = Collections.newSetFromMap(new IdentityHashMap<>());
|
||||
|
||||
for (ItemStack stack : line.getItems()) {
|
||||
if (approximate.contains(StackInfo.itemStackToNBT(stack, false))) {
|
||||
approximateItems.add(stack);
|
||||
}
|
||||
}
|
||||
|
||||
line.setAmountRenderer(new ChanceStacksAmountRenderer(approximateItems));
|
||||
|
||||
this.lines.add(line);
|
||||
}
|
||||
|
||||
protected List<ItemStack> multiplyItems(List<RecipeIngredient> items, boolean ingredients,
|
||||
Set<NBTTagCompound> approximate) {
|
||||
final ItemStackAmount chanceAmounts = new ItemStackAmount();
|
||||
final List<ItemStack> result = new ArrayList<>();
|
||||
|
||||
for (RecipeIngredient item : items) {
|
||||
chanceAmounts.add(item.getItemStack(), (long) item.getAmount() * item.getChance());
|
||||
}
|
||||
|
||||
for (Map.Entry<NBTTagCompound, Long> entry : chanceAmounts.entrySet()) {
|
||||
final long amount = entry.getValue() * this.multiplier;
|
||||
final long entryAmount = ingredients
|
||||
? (amount + PositionedStack.CHANCE_FULL - 1) / PositionedStack.CHANCE_FULL
|
||||
: amount / PositionedStack.CHANCE_FULL;
|
||||
final ItemStack stack = StackInfo.loadFromNBT(entry.getKey(), entryAmount);
|
||||
|
||||
if (amount % PositionedStack.CHANCE_FULL != 0) {
|
||||
approximate.add(entry.getKey());
|
||||
}
|
||||
|
||||
result.add(stack);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
protected static ItemStackAmount getInventoryItems() {
|
||||
GuiScreen screen = NEIClientUtils.mc().currentScreen;
|
||||
|
||||
if (screen instanceof IGuiContainerOverlay overlay) {
|
||||
screen = overlay.getFirstScreen();
|
||||
}
|
||||
|
||||
if (screen instanceof GuiContainer container) {
|
||||
return AutoCraftingManager.getInventoryItems(container);
|
||||
}
|
||||
|
||||
return new ItemStackAmount();
|
||||
}
|
||||
|
||||
protected static List<ItemStack> subtractItems(ItemStackAmount items, ItemStackAmount subtrahend) {
|
||||
final List<ItemStack> result = new ArrayList<>();
|
||||
|
||||
for (Map.Entry<NBTTagCompound, Long> entry : items.entrySet()) {
|
||||
final ItemStack stack = StackInfo.loadFromNBT(entry.getKey(), 0);
|
||||
final long amount = entry.getValue() - subtrahend.getOrDefault(stack, 0L);
|
||||
|
||||
if (amount > 0) {
|
||||
result.add(StackInfo.withAmount(stack, amount));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,13 +2,17 @@ package codechicken.nei.recipe;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.client.gui.GuiRepair;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import codechicken.nei.ItemList;
|
||||
@@ -35,14 +39,17 @@ public class RepairRecipeHandler extends TemplateRecipeHandler {
|
||||
private static class ItemStackKey {
|
||||
|
||||
private final ItemStack stack;
|
||||
private final int hashCode;
|
||||
|
||||
public ItemStackKey(ItemStack stack) {
|
||||
this.stack = stack;
|
||||
this.hashCode = stack.isItemStackDamageable() ? stack.getItem().hashCode()
|
||||
: 31 * stack.getItem().hashCode() + stack.getItemDamage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return stack.getItem().hashCode();
|
||||
return this.hashCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -104,22 +111,48 @@ public class RepairRecipeHandler extends TemplateRecipeHandler {
|
||||
reloadRepairRecipesTask.restart();
|
||||
}
|
||||
|
||||
private void buildCache() {
|
||||
final Map<ItemStackKey, RepairPair> recipes = new HashMap<>();
|
||||
private static final Set<Integer> knownBrokenItemTypes = ConcurrentHashMap.newKeySet();
|
||||
private static volatile List<ItemStack> uniqueMaterials;
|
||||
|
||||
for (ItemStack itemstack1 : ItemList.items) {
|
||||
recipes.computeIfAbsent(new ItemStackKey(itemstack1), key -> this.getRepairRecipe(key.stack));
|
||||
private void buildCache() {
|
||||
if (cachedRecipes != null) return;
|
||||
|
||||
uniqueMaterials = collectUniqueMaterials();
|
||||
|
||||
final Map<ItemStackKey, RepairPair> recipes = new ConcurrentHashMap<>();
|
||||
|
||||
try {
|
||||
ItemList.forkJoinPool.submit(
|
||||
() -> ItemList.items.parallelStream().forEach(
|
||||
itemstack1 -> recipes
|
||||
.computeIfAbsent(new ItemStackKey(itemstack1), key -> getRepairRecipe(key.stack))))
|
||||
.get();
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
NEIClientConfig.logger.error("Failed to build repair recipe cache", e);
|
||||
}
|
||||
|
||||
cachedRecipes = recipes.values().stream().filter(recipe -> recipe != null).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private static List<ItemStack> collectUniqueMaterials() {
|
||||
final Map<Long, ItemStack> unique = new LinkedHashMap<>();
|
||||
for (ItemStack stack : ItemList.items) {
|
||||
final long key = ((long) Item.getIdFromItem(stack.getItem()) << 32) | (stack.getItemDamage() & 0xFFFFFFFFL);
|
||||
unique.putIfAbsent(key, stack);
|
||||
}
|
||||
return new ArrayList<>(unique.values());
|
||||
}
|
||||
|
||||
private RepairPair getRepairRecipe(ItemStack itemstack1) {
|
||||
if (!itemstack1.isItemStackDamageable()) return null;
|
||||
|
||||
final List<ItemStack> permutations = new ArrayList<>();
|
||||
final int itemId = Item.getIdFromItem(itemstack1.getItem());
|
||||
if (knownBrokenItemTypes.contains(itemId)) return null;
|
||||
|
||||
for (ItemStack itemstack2 : ItemList.items) {
|
||||
final List<ItemStack> permutations = new ArrayList<>();
|
||||
final List<ItemStack> candidates = uniqueMaterials != null ? uniqueMaterials : collectUniqueMaterials();
|
||||
|
||||
for (ItemStack itemstack2 : candidates) {
|
||||
try {
|
||||
if (itemstack1.getItem().getIsRepairable(itemstack1, itemstack2)) {
|
||||
final ItemStack right = itemstack2.copy();
|
||||
@@ -127,7 +160,8 @@ public class RepairRecipeHandler extends TemplateRecipeHandler {
|
||||
permutations.add(right);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// Catch exceptions from mods that don't properly implement getIsRepairable
|
||||
knownBrokenItemTypes.add(itemId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ public class StackInfo {
|
||||
|
||||
if (nbtTag != null) {
|
||||
nbtTag = (NBTTagCompound) nbtTag.copy();
|
||||
nbtTag.setInteger("Count", (int) Math.max(Math.min(customCount, Integer.MAX_VALUE), 0));
|
||||
nbtTag.setLong("Count", Math.max(customCount, 0));
|
||||
return loadFromNBT(nbtTag);
|
||||
}
|
||||
|
||||
@@ -150,6 +150,10 @@ public class StackInfo {
|
||||
}
|
||||
|
||||
public static synchronized FluidStack getFluid(ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ItemStackKey key = new ItemStackKey(stack);
|
||||
FluidStack fluid = fluidcache.get(key);
|
||||
|
||||
|
||||
@@ -1,30 +1,123 @@
|
||||
package codechicken.nei.recipe.chain;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.lib.gui.GuiDraw.ITooltipLineHandler;
|
||||
import codechicken.nei.ColorUtils;
|
||||
import codechicken.nei.CompositeTooltipLineHandler;
|
||||
import codechicken.nei.ItemSorter;
|
||||
import codechicken.nei.ItemStackAmount;
|
||||
import codechicken.nei.ItemsTooltipLineHandler;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.ItemsTooltipLineHandler.AmountRenderer;
|
||||
import codechicken.nei.ItemsTooltipLineHandler.StacksAmountRenderer;
|
||||
import codechicken.nei.ItemsTooltipLineHandler.TotalAmountRenderer;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.bookmark.BookmarkItem;
|
||||
import codechicken.nei.drawable.DrawableResource;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.recipe.AutoCraftingManager;
|
||||
import codechicken.nei.recipe.GuiRecipe;
|
||||
import codechicken.nei.recipe.GuiRecipeTab;
|
||||
import codechicken.nei.recipe.HandlerInfo;
|
||||
import codechicken.nei.recipe.Recipe.RecipeId;
|
||||
import codechicken.nei.recipe.StackInfo;
|
||||
|
||||
public class RecipeChainTooltipLineHandler implements ITooltipLineHandler {
|
||||
public class RecipeChainTooltipLineHandler extends CompositeTooltipLineHandler {
|
||||
|
||||
protected static class MissingStacksAmountRenderer extends StacksAmountRenderer {
|
||||
|
||||
protected static final int MISSING_COLOR = 0xFF5555;
|
||||
|
||||
protected final Set<NBTTagCompound> missing;
|
||||
private final Map<ItemStack, Boolean> cache = new IdentityHashMap<>();
|
||||
|
||||
public MissingStacksAmountRenderer(Set<NBTTagCompound> missing) {
|
||||
this.missing = missing;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getColor(ItemStack stack) {
|
||||
return this.cache.computeIfAbsent(stack, key -> this.missing.contains(StackInfo.itemStackToNBT(key, false)))
|
||||
? MISSING_COLOR
|
||||
: super.getColor(stack);
|
||||
}
|
||||
}
|
||||
|
||||
protected static class HandlerIconRenderer extends TotalAmountRenderer {
|
||||
|
||||
protected static final int ICON_SIZE = 16;
|
||||
protected static final float BADGE_SCALE = 0.6f;
|
||||
protected static final float BADGE_OFFSET = 3f;
|
||||
// slots are drawn edge to edge, so the badge has to clear the 3d model of the neighbour slot
|
||||
protected static final float BADGE_Z = 10f;
|
||||
|
||||
protected final Map<NBTTagCompound, HandlerInfo> handlers;
|
||||
private final Map<ItemStack, HandlerInfo> cache = new IdentityHashMap<>();
|
||||
private final Map<String, String> titleCache = new HashMap<>();
|
||||
|
||||
public HandlerIconRenderer(Map<NBTTagCompound, HandlerInfo> handlers) {
|
||||
this.handlers = handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int x, int y, ItemStack stack, long amount) {
|
||||
super.draw(x, y, stack, amount);
|
||||
drawHandlerBadge(
|
||||
x,
|
||||
y,
|
||||
this.cache.computeIfAbsent(stack, key -> this.handlers.get(StackInfo.itemStackToNBT(key, false))));
|
||||
}
|
||||
|
||||
protected void drawHandlerBadge(int x, int y, HandlerInfo handlerInfo) {
|
||||
if (handlerInfo == null) return;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glColor4f(1, 1, 1, 1);
|
||||
GL11.glTranslatef(x - BADGE_OFFSET * BADGE_SCALE, y - BADGE_OFFSET * BADGE_SCALE, BADGE_Z);
|
||||
GL11.glScalef(BADGE_SCALE, BADGE_SCALE, 1.0f);
|
||||
|
||||
if (handlerInfo.hasImageOrItem()) {
|
||||
final DrawableResource image = handlerInfo.getImage();
|
||||
|
||||
if (image != null) {
|
||||
NEIClientUtils.gl2DRenderContext(() -> image.draw(0, 0));
|
||||
} else {
|
||||
GuiContainerManager.drawItem(0, 0, handlerInfo.getItemStack(), true, "");
|
||||
}
|
||||
|
||||
} else {
|
||||
drawBadgeText(handlerInfo.getHandlerName());
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
protected void drawBadgeText(String handlerName) {
|
||||
final String title = this.titleCache.computeIfAbsent(handlerName, GuiRecipeTab::getHandlerTitle);
|
||||
final String text = title.isEmpty() ? "??" : title.substring(0, Math.min(2, title.length()));
|
||||
|
||||
NEIClientUtils.gl2DRenderContext(
|
||||
() -> GuiDraw.fontRenderer.drawStringWithShadow(
|
||||
text,
|
||||
(ICON_SIZE - GuiDraw.fontRenderer.getStringWidth(text)) / 2,
|
||||
(ICON_SIZE - GuiDraw.fontRenderer.FONT_HEIGHT) / 2,
|
||||
ColorUtils.buttonLabelNormal.getColor()));
|
||||
}
|
||||
}
|
||||
|
||||
public final int groupId;
|
||||
public final boolean crafting;
|
||||
@@ -32,16 +125,9 @@ public class RecipeChainTooltipLineHandler implements ITooltipLineHandler {
|
||||
protected final List<BookmarkItem> initialItems;
|
||||
protected final Map<RecipeId, Long> outputRecipes;
|
||||
|
||||
protected ItemsTooltipLineHandler available;
|
||||
protected ItemsTooltipLineHandler inputs;
|
||||
protected ItemsTooltipLineHandler outputs;
|
||||
protected ItemsTooltipLineHandler remainder;
|
||||
protected ItemsTooltipLineHandler craftingNeeded;
|
||||
protected boolean lastShiftKey = false;
|
||||
protected boolean lastControlKey = false;
|
||||
|
||||
protected Dimension size = new Dimension();
|
||||
|
||||
public RecipeChainTooltipLineHandler(int groupId, boolean crafting, RecipeChainMath math) {
|
||||
this.groupId = groupId;
|
||||
this.crafting = crafting;
|
||||
@@ -50,20 +136,32 @@ public class RecipeChainTooltipLineHandler implements ITooltipLineHandler {
|
||||
this.outputRecipes = new HashMap<>(this.math.outputRecipes);
|
||||
}
|
||||
|
||||
private void onUpdate() {
|
||||
@Override
|
||||
protected boolean needsUpdate() {
|
||||
final boolean shiftChanged = this.lastShiftKey != (this.lastShiftKey = NEIClientUtils.shiftKey());
|
||||
return this.lastControlKey != (this.lastControlKey = NEIClientUtils.controlKey()) || shiftChanged;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createLines() {
|
||||
if (this.outputRecipes.isEmpty() && !this.lastShiftKey) {
|
||||
return;
|
||||
}
|
||||
|
||||
final List<ItemStack> available = new ArrayList<>();
|
||||
final List<ItemStack> inputs = new ArrayList<>();
|
||||
final List<ItemStack> outputs = new ArrayList<>();
|
||||
final List<ItemStack> remainder = new ArrayList<>();
|
||||
final List<ItemStack> craftingNeeded = new ArrayList<>();
|
||||
final Map<NBTTagCompound, HandlerInfo> craftingHandlers = new HashMap<>();
|
||||
final ItemStackAmount inventory = new ItemStackAmount();
|
||||
final GuiContainer currentGui = NEIClientUtils.getGuiContainer();
|
||||
|
||||
if (this.lastShiftKey && !(currentGui instanceof GuiRecipe<?>)) {
|
||||
if (this.lastShiftKey && currentGui != null && !(currentGui instanceof GuiRecipe<?>)) {
|
||||
inventory.putAll(AutoCraftingManager.getInventoryItems(currentGui));
|
||||
}
|
||||
|
||||
if (!this.math.outputRecipes.isEmpty()) {
|
||||
if (!this.outputRecipes.isEmpty()) {
|
||||
this.math.initialItems.clear();
|
||||
this.math.outputRecipes.clear();
|
||||
this.math.outputRecipes.putAll(this.outputRecipes);
|
||||
@@ -105,7 +203,7 @@ public class RecipeChainTooltipLineHandler implements ITooltipLineHandler {
|
||||
}
|
||||
|
||||
} else {
|
||||
this.math.initialItems.addAll(initialItems);
|
||||
this.math.initialItems.addAll(this.initialItems);
|
||||
}
|
||||
|
||||
this.math.refresh();
|
||||
@@ -138,26 +236,24 @@ public class RecipeChainTooltipLineHandler implements ITooltipLineHandler {
|
||||
if (amount > 0) {
|
||||
if (math.outputRecipes.containsKey(item.recipeId)) {
|
||||
outputs.add(item.getItemStack(amount));
|
||||
} else if (this.lastShiftKey) {
|
||||
} else {
|
||||
remainder.add(item.getItemStack(amount));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.lastShiftKey) {
|
||||
for (ItemStack stack : math.containerItemsInventory) {
|
||||
if (stack != null) {
|
||||
remainder.add(stack.copy());
|
||||
}
|
||||
for (ItemStack stack : math.containerItemsInventory) {
|
||||
if (stack != null) {
|
||||
remainder.add(stack.copy());
|
||||
}
|
||||
for (ItemStack stack : math.containerItemsCrafting) {
|
||||
if (stack != null) {
|
||||
remainder.add(stack.copy());
|
||||
}
|
||||
}
|
||||
for (ItemStack stack : math.containerItemsCrafting) {
|
||||
if (stack != null) {
|
||||
remainder.add(stack.copy());
|
||||
}
|
||||
}
|
||||
|
||||
} else if (this.lastShiftKey) {
|
||||
} else {
|
||||
|
||||
for (BookmarkItem item : this.math.initialItems) {
|
||||
if (inventory.contains(item.itemStack)) {
|
||||
@@ -175,161 +271,100 @@ public class RecipeChainTooltipLineHandler implements ITooltipLineHandler {
|
||||
inputs.add(item.getItemStack());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (this.lastShiftKey) {
|
||||
for (Map.Entry<BookmarkItem, Long> item : this.math.requiredAmount.entrySet()) {
|
||||
if (item.getKey().type == BookmarkItem.BookmarkItemType.RESULT && item.getValue() != 0)
|
||||
craftingNeeded.add(item.getKey().getItemStack(item.getValue()));
|
||||
if (item.getKey().type == BookmarkItem.BookmarkItemType.RESULT && item.getValue() != 0) {
|
||||
final ItemStack stack = item.getKey().getItemStack(item.getValue());
|
||||
|
||||
craftingNeeded.add(stack);
|
||||
putHandlerInfo(craftingHandlers, stack, item.getKey().recipeId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inputs.sort(
|
||||
Comparator.comparing((ItemStack stack) -> StackInfo.getFluid(stack) != null)
|
||||
.thenComparingInt(stack -> -1 * stack.stackSize).thenComparing(ItemSorter.instance));
|
||||
outputs.sort(
|
||||
Comparator.comparing((ItemStack stack) -> StackInfo.getFluid(stack) != null)
|
||||
.thenComparingInt(stack -> -1 * stack.stackSize).thenComparing(ItemSorter.instance));
|
||||
remainder.sort(
|
||||
Comparator.comparing((ItemStack stack) -> StackInfo.getFluid(stack) != null)
|
||||
.thenComparingInt(stack -> -1 * stack.stackSize).thenComparing(ItemSorter.instance));
|
||||
|
||||
this.inputs = new ItemsTooltipLineHandler(
|
||||
this.lastShiftKey ? NEIClientUtils.translate("bookmark.crafting_chain.missing")
|
||||
: NEIClientUtils.translate("bookmark.crafting_chain.input"),
|
||||
inputs,
|
||||
true,
|
||||
Integer.MAX_VALUE);
|
||||
|
||||
this.available = new ItemsTooltipLineHandler(
|
||||
NEIClientUtils.translate("bookmark.crafting_chain.available"),
|
||||
available,
|
||||
true,
|
||||
Integer.MAX_VALUE);
|
||||
|
||||
this.outputs = new ItemsTooltipLineHandler(
|
||||
NEIClientUtils.translate("bookmark.crafting_chain.output"),
|
||||
outputs,
|
||||
true,
|
||||
Integer.MAX_VALUE);
|
||||
|
||||
this.remainder = new ItemsTooltipLineHandler(
|
||||
NEIClientUtils.translate("bookmark.crafting_chain.remainder"),
|
||||
remainder,
|
||||
true,
|
||||
Integer.MAX_VALUE);
|
||||
|
||||
this.craftingNeeded = new ItemsTooltipLineHandler(
|
||||
NEIClientUtils.translate("bookmark.crafting_chain.needed"),
|
||||
craftingNeeded,
|
||||
true,
|
||||
Integer.MAX_VALUE);
|
||||
final Set<NBTTagCompound> missing = new HashSet<>();
|
||||
|
||||
if (this.lastShiftKey) {
|
||||
this.inputs.setLabelColor(EnumChatFormatting.RED);
|
||||
this.available.setLabelColor(EnumChatFormatting.GREEN);
|
||||
this.craftingNeeded.setLabelColor(EnumChatFormatting.BLUE);
|
||||
}
|
||||
|
||||
this.size.height = this.size.width = 0;
|
||||
|
||||
if (!this.inputs.isEmpty() || !this.outputs.isEmpty()
|
||||
|| !this.remainder.isEmpty()
|
||||
|| !this.available.isEmpty()) {
|
||||
|
||||
if (!this.math.outputRecipes.isEmpty()) {
|
||||
this.size.height = 2 + GuiDraw.fontRenderer.FONT_HEIGHT;
|
||||
for (ItemStack stack : inputs) {
|
||||
missing.add(StackInfo.itemStackToNBT(stack, false));
|
||||
}
|
||||
this.size.width = Math.max(
|
||||
this.inputs.getSize().width,
|
||||
Math.max(
|
||||
this.outputs.getSize().width,
|
||||
Math.max(
|
||||
this.remainder.getSize().width,
|
||||
Math.max(this.available.getSize().width, this.craftingNeeded.getSize().width))));
|
||||
|
||||
this.size.height += this.inputs.getSize().height + this.outputs.getSize().height
|
||||
+ this.remainder.getSize().height
|
||||
+ this.available.getSize().height
|
||||
+ this.craftingNeeded.getSize().height;
|
||||
}
|
||||
|
||||
// items with a shortage are already in the inputs list, holding the missing amount instead of the required one
|
||||
final List<ItemStack> covered = new ArrayList<>();
|
||||
|
||||
for (ItemStack stack : available) {
|
||||
if (!missing.contains(StackInfo.itemStackToNBT(stack, false))) {
|
||||
covered.add(stack);
|
||||
}
|
||||
}
|
||||
|
||||
final Comparator<ItemStack> comparator = Comparator
|
||||
.comparing((ItemStack stack) -> StackInfo.getFluid(stack) != null)
|
||||
.thenComparingInt(stack -> -1 * stack.stackSize).thenComparing(ItemSorter.instance);
|
||||
|
||||
inputs.sort(comparator);
|
||||
covered.sort(comparator);
|
||||
outputs.sort(comparator);
|
||||
remainder.sort(comparator);
|
||||
|
||||
// missing items stay on top of the list
|
||||
inputs.addAll(covered);
|
||||
|
||||
if (this.lastShiftKey) {
|
||||
outputs.addAll(remainder);
|
||||
}
|
||||
|
||||
addLine(
|
||||
NEIClientUtils.translate("bookmark.crafting_chain"),
|
||||
outputs,
|
||||
outputs.size() == 1,
|
||||
EnumChatFormatting.AQUA,
|
||||
new TotalAmountRenderer());
|
||||
|
||||
addLine(
|
||||
NEIClientUtils.translate("bookmark.crafting_chain.needed"),
|
||||
craftingNeeded,
|
||||
false,
|
||||
EnumChatFormatting.BLUE,
|
||||
new HandlerIconRenderer(craftingHandlers));
|
||||
|
||||
addLine(
|
||||
NEIClientUtils.translate("bookmark.crafting_chain.input"),
|
||||
inputs,
|
||||
this.lastShiftKey,
|
||||
EnumChatFormatting.YELLOW,
|
||||
this.lastShiftKey ? new MissingStacksAmountRenderer(missing) : new TotalAmountRenderer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getSize() {
|
||||
boolean update = this.outputs == null;
|
||||
update = this.lastShiftKey != (this.lastShiftKey = NEIClientUtils.shiftKey()) || update;
|
||||
update = this.lastControlKey != (this.lastControlKey = NEIClientUtils.controlKey()) || update;
|
||||
|
||||
if (update) {
|
||||
onUpdate();
|
||||
protected static void putHandlerInfo(Map<NBTTagCompound, HandlerInfo> handlers, ItemStack stack,
|
||||
RecipeId recipeId) {
|
||||
if (recipeId == null) {
|
||||
return;
|
||||
}
|
||||
return this.size;
|
||||
|
||||
final HandlerInfo handlerInfo = GuiRecipeTab.getHandlerInfo(recipeId.getHandlerName(), null);
|
||||
|
||||
handlers.put(
|
||||
StackInfo.itemStackToNBT(stack, false),
|
||||
handlerInfo != null ? handlerInfo : GuiRecipeTab.DEFAULT_HANDLER_INFO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int x, int y) {
|
||||
if (this.size.height == 0) return;
|
||||
protected void addLine(String label, List<ItemStack> items, boolean vertical, EnumChatFormatting labelColor,
|
||||
AmountRenderer amountRenderer) {
|
||||
final ItemsTooltipLineHandler line = vertical ? ItemsTooltipLineHandler.list(label, items, maxLineRows())
|
||||
: ItemsTooltipLineHandler.grid(label, items, maxLineRows());
|
||||
|
||||
if (!this.math.outputRecipes.isEmpty()) {
|
||||
GuiDraw.fontRenderer.drawStringWithShadow(
|
||||
EnumChatFormatting.AQUA + NEIClientUtils.translate("bookmark.crafting_chain"),
|
||||
x,
|
||||
y + 2,
|
||||
0xee555555);
|
||||
|
||||
y += 2 + GuiDraw.fontRenderer.FONT_HEIGHT;
|
||||
if (line.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (NEIClientConfig.recipeChainDir() == 0) {
|
||||
if (!this.inputs.isEmpty()) {
|
||||
this.inputs.draw(x, y);
|
||||
y += this.inputs.getSize().height;
|
||||
}
|
||||
|
||||
if (!this.available.isEmpty()) {
|
||||
this.available.draw(x, y);
|
||||
y += this.available.getSize().height;
|
||||
}
|
||||
|
||||
if (!this.craftingNeeded.isEmpty()) {
|
||||
this.craftingNeeded.draw(x, y);
|
||||
y += this.craftingNeeded.getSize().height;
|
||||
}
|
||||
|
||||
if (!this.outputs.isEmpty()) {
|
||||
this.outputs.draw(x, y);
|
||||
y += this.outputs.getSize().height;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (!this.outputs.isEmpty()) {
|
||||
this.outputs.draw(x, y);
|
||||
y += this.outputs.getSize().height;
|
||||
}
|
||||
|
||||
if (!this.inputs.isEmpty()) {
|
||||
this.inputs.draw(x, y);
|
||||
y += this.inputs.getSize().height;
|
||||
}
|
||||
|
||||
if (!this.craftingNeeded.isEmpty()) {
|
||||
this.craftingNeeded.draw(x, y);
|
||||
y += this.craftingNeeded.getSize().height;
|
||||
}
|
||||
|
||||
if (!this.available.isEmpty()) {
|
||||
this.available.draw(x, y);
|
||||
y += this.available.getSize().height;
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.remainder.isEmpty()) {
|
||||
this.remainder.draw(x, y);
|
||||
}
|
||||
line.setLabelColor(labelColor);
|
||||
line.setAmountRenderer(amountRenderer);
|
||||
|
||||
this.lines.add(line);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -45,7 +45,7 @@ public class DefaultStackStringifyHandler implements IStackStringifyHandler {
|
||||
final ItemStack stack = ItemStack.loadItemStackFromNBT(nbtTag);
|
||||
|
||||
if (stack != null) {
|
||||
stack.stackSize = nbtTag.getInteger("Count");
|
||||
stack.stackSize = (int) Math.min(nbtTag.getLong("Count"), Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
return stack;
|
||||
|
||||
+3
-12
@@ -31,13 +31,10 @@ public class FluidDisplayStackStringifyHandler implements IStackStringifyHandler
|
||||
return null;
|
||||
}
|
||||
|
||||
final long amount = ((ItemFluidDisplay) stack.getItem()).getAmountLong(stack);
|
||||
final NBTTagCompound nbTag = new NBTTagCompound();
|
||||
nbTag.setString(NBT_FLUID_NAME, fluidStack.getFluid().getName());
|
||||
nbTag.setInteger("Count", saveStackSize ? fluidStack.amount : 1);
|
||||
|
||||
if (fluidStack.tag != null) {
|
||||
nbTag.setTag("FluidTag", fluidStack.tag.copy());
|
||||
}
|
||||
nbTag.setLong("Count", saveStackSize ? amount : 1);
|
||||
|
||||
return nbTag;
|
||||
}
|
||||
@@ -55,13 +52,7 @@ public class FluidDisplayStackStringifyHandler implements IStackStringifyHandler
|
||||
return null;
|
||||
}
|
||||
|
||||
final FluidStack fluidStack = new FluidStack(fluid, nbtTag.getInteger("Count"));
|
||||
|
||||
if (nbtTag.hasKey("FluidTag")) {
|
||||
fluidStack.tag = nbtTag.getCompoundTag("FluidTag");
|
||||
}
|
||||
|
||||
return ItemFluidDisplay.createStack(fluidStack);
|
||||
return ItemFluidDisplay.createStack(fluid, nbtTag.getLong("Count"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -67,10 +67,9 @@ public class GTFluidStackStringifyHandler implements IStackStringifyHandler {
|
||||
if (nbtTag.hasKey("gtFluidName")) {
|
||||
final String fluidName = nbtTag.getString("gtFluidName");
|
||||
final Fluid fluid = FluidRegistry.getFluid(fluidName);
|
||||
final int amount = nbtTag.getInteger("Count");
|
||||
|
||||
if (fluid != null) {
|
||||
return ItemFluidDisplay.createStack(new FluidStack(fluid, amount));
|
||||
return ItemFluidDisplay.createStack(fluid, nbtTag.getLong("Count"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,11 +97,7 @@ public class GTFluidStackStringifyHandler implements IStackStringifyHandler {
|
||||
Fluid fluid = FluidRegistry.getFluid(nbtTag.getString("Fluid").toLowerCase());
|
||||
|
||||
if (fluid != null) {
|
||||
FluidStack fluidStack = new FluidStack(fluid, stack.stackSize);
|
||||
if (nbtTag.hasKey("FluidTag")) {
|
||||
fluidStack.tag = nbtTag.getCompoundTag("FluidTag");
|
||||
}
|
||||
return fluidStack;
|
||||
return new FluidStack(fluid, stack.stackSize);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {}
|
||||
|
||||
@@ -228,11 +228,11 @@ com.djgiannuzz.thaumcraftneiplugin.nei.recipehandler.InfusionRecipeHandler,Thaum
|
||||
ru.timeconqueror.tcneiadditions.nei.arcaneworkbench.ArcaneCraftingShapedHandler,Thaumcraft,Thaumcraft:blockTable:15,,Thaumcraft,TRUE,,4,138,,2,,,,,,,
|
||||
ru.timeconqueror.tcneiadditions.nei.AspectCombinationHandler,Thaumcraft,Thaumcraft:ItemResearchNotes,,Thaumcraft,TRUE,,,130,,2,,,,,,In sets of 5. Each one is ~30 height,
|
||||
ru.timeconqueror.tcneiadditions.nei.AspectFromItemStackHandler,Thaumcraft,Thaumcraft:ItemResearchNotes,,Thaumcraft,TRUE,,,140,,2,,,,,,,
|
||||
tconstruct.plugins.nei.RecipeHandlerAlloying,Tinker's Construct,TConstruct:Smeltery,,TConstruct,TRUE,,,65,,5,,,,,,,
|
||||
tconstruct.plugins.nei.RecipeHandlerCastingBasin,Tinker's Construct,TConstruct:SearedBlock:2,,TConstruct,TRUE,,,65,,5,,,,,,,
|
||||
tconstruct.plugins.nei.RecipeHandlerCastingTable,Tinker's Construct,TConstruct:SearedBlock,,TConstruct,TRUE,,,65,,5,,,,,,,
|
||||
tconstruct.plugins.nei.RecipeHandlerAlloying,Tinker's Construct,TConstruct:Smeltery,,TConstruct,TRUE,,3,63,,5,,,,,,,
|
||||
tconstruct.plugins.nei.RecipeHandlerCastingBasin,Tinker's Construct,TConstruct:SearedBlock:2,,TConstruct,TRUE,,2,57,,5,,,,,,,
|
||||
tconstruct.plugins.nei.RecipeHandlerCastingTable,Tinker's Construct,TConstruct:SearedBlock,,TConstruct,TRUE,,2,57,,5,,,,,,,
|
||||
tconstruct.plugins.nei.RecipeHandlerDryingRack,Tinker's Construct,TConstruct:Armor.DryingRack,,TConstruct,TRUE,,,55,,5,,,,,,,
|
||||
tconstruct.plugins.nei.RecipeHandlerMelting,Tinker's Construct,TConstruct:LavaTank:2,,TConstruct,TRUE,,,65,,5,,,,,,,
|
||||
tconstruct.plugins.nei.RecipeHandlerMelting,Tinker's Construct,TConstruct:LavaTank:2,,TConstruct,TRUE,,-1,60,,5,,,,,,,
|
||||
tconstruct.plugins.nei.RecipeHandlerToolMaterials,Tinker's Construct,TConstruct:ToolStationBlock,,TConstruct,TRUE,,,110,,3,,,,,,"Longer if more modifiers, I went through the whole list",
|
||||
net.p455w0rd.wirelesscraftingterminal.integration.modules.NEIHelpers.NEIAEShapedRecipeHandler,Wireless Crafting Terminal,ae2wct:wirelessCraftingTerminal,,ae2wct,TRUE,,,,,,,,,,,,
|
||||
alkalus.main.nei.NEI_Handler_Cauldron,Witchery,witchery:cauldron,,WitcheryExtras,TRUE,,,65,,5,,,,,,,
|
||||
|
||||
|
@@ -59,7 +59,7 @@ nei.options.wbutton.tip.0=Používám globální nastavení
|
||||
nei.options.wbutton.tip.1=Přepisuji globální nastavení
|
||||
|
||||
nei.options.keys=Nastavení kláves
|
||||
nei.options.keys.gui=Inventář
|
||||
nei.options.keys.gui=NEI Inventář
|
||||
nei.options.keys.recipe.recipe=Recept
|
||||
nei.options.keys.recipe.usage=Použití
|
||||
nei.options.keys.gui.enchant=Očarování
|
||||
@@ -69,7 +69,7 @@ nei.options.keys.gui.prev=Předchozí stránka
|
||||
nei.options.keys.gui.next=Další stránka
|
||||
nei.options.keys.gui.hide=Přepnout viditelnost NEI
|
||||
nei.options.keys.gui.search=Zaměřit vyhledávací pole
|
||||
nei.options.keys.world=Svět
|
||||
nei.options.keys.world=NEI Svět
|
||||
nei.options.keys.world.chunkoverlay=Ohraničení chunku
|
||||
nei.options.keys.world.moboverlay=Označení míst spawnu monster
|
||||
nei.options.keys.world.highlight_tips=Informace o bloku
|
||||
|
||||
@@ -63,7 +63,7 @@ nei.options.wbutton.tip.0=Nutzt globale Einstellungen
|
||||
nei.options.wbutton.tip.1=Übergeht globale Einstellungen
|
||||
|
||||
nei.options.keys=Tastenbelegung
|
||||
nei.options.keys.gui=Inventar
|
||||
nei.options.keys.gui=NEI Inventar
|
||||
nei.options.keys.recipe.recipe=Rezept
|
||||
nei.options.keys.recipe.usage=Nutzung
|
||||
nei.options.keys.gui.enchant=Verzauberungen
|
||||
@@ -73,7 +73,7 @@ nei.options.keys.gui.prev=Vorherige Seite
|
||||
nei.options.keys.gui.next=Nächste Seite
|
||||
nei.options.keys.gui.hide=Verstelle NEI-Sichtbarkeit
|
||||
nei.options.keys.gui.search=Fokussiere Such-Leiste
|
||||
nei.options.keys.world=Welt
|
||||
nei.options.keys.world=NEI Welt
|
||||
nei.options.keys.world.chunkoverlay=Chunk-Grenzen-Overlay
|
||||
nei.options.keys.world.moboverlay=Mob-Spawn-Overlay
|
||||
nei.options.keys.world.highlight_tips=Highlight-Tooltips
|
||||
|
||||
@@ -48,11 +48,7 @@ nei.bookmark.recipe.toggle_collapse=Toggle Collapse/Expand
|
||||
nei.bookmark.recipe.chat_link=Send Recipe to Chat
|
||||
nei.bookmark.crafting_chain=Crafting Chain
|
||||
nei.bookmark.crafting_chain.input=Ingredients
|
||||
nei.bookmark.crafting_chain.missing=Missing Items
|
||||
nei.bookmark.crafting_chain.output=Results
|
||||
nei.bookmark.crafting_chain.remainder=Remainders
|
||||
nei.bookmark.crafting_chain.needed=Required Crafts
|
||||
nei.bookmark.crafting_chain.available=Available Items
|
||||
nei.bookmark.tree.title=Crafting Tree
|
||||
nei.bookmark.tree.empty=No crafting chain to display
|
||||
nei.bookmark.tree.overlay=Use for recipe tree
|
||||
@@ -284,9 +280,6 @@ nei.options.inventory.bookmarks.enabled.false=Hidden
|
||||
nei.options.inventory.bookmarks.animation=REI Style Animation in Bookmarks
|
||||
nei.options.inventory.bookmarks.animation.true=Yes
|
||||
nei.options.inventory.bookmarks.animation.false=No
|
||||
nei.options.inventory.bookmarks.recipeChainDir=Crafting Chain Info Direction
|
||||
nei.options.inventory.bookmarks.recipeChainDir.0=Input First
|
||||
nei.options.inventory.bookmarks.recipeChainDir.1=Output First
|
||||
nei.options.inventory.bookmarks.recipeTooltipsMode=Show Recipe Tooltips in Bookmarks
|
||||
nei.options.inventory.bookmarks.recipeTooltipsMode.0=None
|
||||
nei.options.inventory.bookmarks.recipeTooltipsMode.1=In Horizontal View
|
||||
@@ -667,6 +660,10 @@ nei.recipe.badge.ncp.tooltip=Considered in parallel calculation, but not get con
|
||||
nei.recipe.badge.chance.consume=Consume Chance: %s
|
||||
nei.recipe.badge.chance.output=Output Chance: %s
|
||||
|
||||
nei.recipe.items.results=Results
|
||||
nei.recipe.items.ingredients=Ingredients
|
||||
nei.recipe.items.ingredients_needed=Ingredients Needed
|
||||
|
||||
# Deprecated
|
||||
nei.recipe.fuel.required=%s required
|
||||
# Deprecated
|
||||
|
||||
@@ -62,7 +62,7 @@ nei.options.wbutton.tip.0=Kasutab globaalseid seadeid
|
||||
nei.options.wbutton.tip.1=Globaalsete seadmete ületegemine
|
||||
|
||||
nei.options.keys=Klahviseosed
|
||||
nei.options.keys.gui=Seljakott
|
||||
nei.options.keys.gui=NEI Seljakott
|
||||
nei.options.keys.recipe.recipe=Retsept
|
||||
nei.options.keys.recipe.usage=Kasutus
|
||||
nei.options.keys.gui.enchant=Loitsud
|
||||
@@ -72,7 +72,7 @@ nei.options.keys.gui.prev=Eel. Leht
|
||||
nei.options.keys.gui.next=Järg. Leht
|
||||
nei.options.keys.gui.hide=Lülita NEI nähtavust
|
||||
nei.options.keys.gui.search=Fokuseeri otsingu riba
|
||||
nei.options.keys.world=Maailm
|
||||
nei.options.keys.world=NEI Maailm
|
||||
nei.options.keys.world.chunkoverlay=Chunk'i ääre ülekate
|
||||
nei.options.keys.world.moboverlay=Koletiste sündimis ülekate
|
||||
nei.options.keys.world.highlight_tips=Highlight Tooltips
|
||||
|
||||
@@ -60,7 +60,7 @@ nei.options.wbutton.tip.0=Utilisation des paramètres globaux
|
||||
nei.options.wbutton.tip.1=Annuler l'utilisation des paramètres globaux
|
||||
|
||||
nei.options.keys=Raccourcis clavier
|
||||
nei.options.keys.gui=Inventaire
|
||||
nei.options.keys.gui=NEI Inventaire
|
||||
nei.options.keys.recipe.recipe=Recette
|
||||
nei.options.keys.recipe.usage=Usage
|
||||
nei.options.keys.gui.enchant=Enchantements
|
||||
@@ -70,7 +70,7 @@ nei.options.keys.gui.prev=Recette suivante
|
||||
nei.options.keys.gui.next=Page suivante
|
||||
nei.options.keys.gui.hide=Afficher ou cacher NEI
|
||||
nei.options.keys.gui.search=Sélectionner la barre de recherche
|
||||
nei.options.keys.world=Monde
|
||||
nei.options.keys.world=NEI Monde
|
||||
nei.options.keys.world.chunkoverlay=Overlay limitation des chunks
|
||||
nei.options.keys.world.moboverlay=Overlay spawn des monstres
|
||||
nei.options.keys.world.highlight_tips=Mettez en surbrillance les info-bulles
|
||||
|
||||
@@ -63,7 +63,7 @@ nei.options.wbutton.tip.0=Usando le opzioni globali
|
||||
nei.options.wbutton.tip.1=Sovrascrivendo le opzioni globali
|
||||
|
||||
nei.options.keys=Controlli
|
||||
nei.options.keys.gui=Inventario
|
||||
nei.options.keys.gui=NEI Inventario
|
||||
nei.options.keys.recipe.recipe=Ricetta
|
||||
nei.options.keys.recipe.usage=Usi
|
||||
nei.options.keys.gui.enchant=Incantare
|
||||
@@ -73,7 +73,7 @@ nei.options.keys.gui.prev=Pagina precedente
|
||||
nei.options.keys.gui.next=Pagina successiva
|
||||
nei.options.keys.gui.hide=Modifica visibilità NEI
|
||||
nei.options.keys.gui.search=Attiva barra di ricerca
|
||||
nei.options.keys.world=Mondo
|
||||
nei.options.keys.world=NEI Mondo
|
||||
nei.options.keys.world.chunkoverlay=Mostra confini dei chunk
|
||||
nei.options.keys.world.moboverlay=Mostra spawn dei mob
|
||||
nei.options.keys.world.highlight_tips=Esalta tooltips
|
||||
|
||||
@@ -58,7 +58,7 @@ nei.options.wbutton.tip.0=글로벌로 세팅
|
||||
nei.options.wbutton.tip.1=전역 설정
|
||||
|
||||
nei.options.keys=키 바인딩
|
||||
nei.options.keys.gui=인벤토리
|
||||
nei.options.keys.gui=NEI 인벤토리
|
||||
nei.options.keys.recipe.recipe=레시피
|
||||
nei.options.keys.recipe.usage=사용법
|
||||
nei.options.keys.gui.enchant=인첸트
|
||||
@@ -68,7 +68,7 @@ nei.options.keys.gui.prev=이전 페이지
|
||||
nei.options.keys.gui.next=다음 페이지
|
||||
nei.options.keys.gui.hide=NEI 활성/비활성화
|
||||
nei.options.keys.gui.search=빠른 검색
|
||||
nei.options.keys.world=월드
|
||||
nei.options.keys.world=NEI 월드
|
||||
nei.options.keys.world.chunkoverlay=청크경계 확인
|
||||
nei.options.keys.world.moboverlay=몹스폰 확인
|
||||
nei.options.keys.world.highlight_tips=하이라이트 툴팁
|
||||
|
||||
@@ -59,7 +59,7 @@ nei.options.wbutton.tip.0=Używanie ustawień globalnych
|
||||
nei.options.wbutton.tip.1=Nadpisywanie ustawienia globalnego
|
||||
|
||||
nei.options.keys=Ustawienia klawiszy
|
||||
nei.options.keys.gui=Ekwipunek
|
||||
nei.options.keys.gui=NEI Ekwipunek
|
||||
nei.options.keys.recipe.recipe=Recepta
|
||||
nei.options.keys.recipe.usage=Użytek
|
||||
nei.options.keys.gui.enchant=Zaklęcia
|
||||
@@ -69,7 +69,7 @@ nei.options.keys.gui.prev=Poprzednia strona
|
||||
nei.options.keys.gui.next=Następna strona
|
||||
nei.options.keys.gui.hide=Przełącz widzialność NEI
|
||||
nei.options.keys.gui.search=Ustaw ostrość na pasek wyszukiwania
|
||||
nei.options.keys.world=Świat
|
||||
nei.options.keys.world=NEI Świat
|
||||
nei.options.keys.world.chunkoverlay=Nakładka granic chunków
|
||||
nei.options.keys.world.moboverlay=Nakładka pojawiania się mobów
|
||||
nei.options.keys.world.highlight_tips=Podpowiedzi podświetleń
|
||||
|
||||
@@ -59,7 +59,7 @@ nei.options.wbutton.tip.0=Usando configurações globais
|
||||
nei.options.wbutton.tip.1=Substituindo configurações globais
|
||||
|
||||
nei.options.keys=Atalhos de Teclado
|
||||
nei.options.keys.gui=Inventário
|
||||
nei.options.keys.gui=NEI Inventário
|
||||
nei.options.keys.recipe.recipe=Receita
|
||||
nei.options.keys.recipe.usage=Uso
|
||||
nei.options.keys.gui.enchant=Encantamentos
|
||||
@@ -69,7 +69,7 @@ nei.options.keys.gui.prev=Pág. Anterior
|
||||
nei.options.keys.gui.next=Próxima Pág.
|
||||
nei.options.keys.gui.hide=Trocar Visibilidade do NEI
|
||||
nei.options.keys.gui.search=Focar na Barra de Buscas
|
||||
nei.options.keys.world=Mundo
|
||||
nei.options.keys.world=NEI Mundo
|
||||
nei.options.keys.world.chunkoverlay=Sobreposição de Fronteira de Chunks
|
||||
nei.options.keys.world.moboverlay=Sobreposição de Spawn de Mobs
|
||||
nei.options.keys.world.highlight_tips=Destacar Dicas
|
||||
|
||||
@@ -23,8 +23,6 @@ nei.bookmark.group.pull_items_shift=Переместить недостающи
|
||||
nei.bookmark.group.chat_link=Отправить группу в чат
|
||||
nei.bookmark.crafting_chain=Цепочка крафта
|
||||
nei.bookmark.crafting_chain.input=Ингредиенты
|
||||
nei.bookmark.crafting_chain.output=Результаты
|
||||
nei.bookmark.crafting_chain.remainder=Остатки
|
||||
|
||||
nei.itempanel.quantity.default=Одна стопка
|
||||
nei.itempanel.loading=Загрузка списка предметов...
|
||||
@@ -184,9 +182,6 @@ nei.options.inventory.bookmarks.enabled.false=Скрытая
|
||||
nei.options.inventory.bookmarks.animation=Анимация в стиле REI в закладках
|
||||
nei.options.inventory.bookmarks.animation.true=Да
|
||||
nei.options.inventory.bookmarks.animation.false=Нет
|
||||
nei.options.inventory.bookmarks.recipeChainDir=Направление информации о цепочке крафта
|
||||
nei.options.inventory.bookmarks.recipeChainDir.0=Сначала ингредиенты
|
||||
nei.options.inventory.bookmarks.recipeChainDir.1=Сначала результат
|
||||
nei.options.inventory.bookmarks.recipeTooltipsMode=Показывать подсказки рецептов в закладках
|
||||
nei.options.inventory.bookmarks.recipeTooltipsMode.0=Нет
|
||||
nei.options.inventory.bookmarks.recipeTooltipsMode.1=В горизонтальном виде
|
||||
|
||||
@@ -59,7 +59,7 @@ nei.options.wbutton.tip.0=Používajú sa globálne nastavenia
|
||||
nei.options.wbutton.tip.1=Globálne nastavenia sú nahradené
|
||||
|
||||
nei.options.keys=Klávesové skratky
|
||||
nei.options.keys.gui=Inventár
|
||||
nei.options.keys.gui=NEI Inventár
|
||||
nei.options.keys.recipe.recipe=Recept
|
||||
nei.options.keys.recipe.usage=Použitie
|
||||
nei.options.keys.gui.enchant=Očarovania
|
||||
@@ -69,7 +69,7 @@ nei.options.keys.gui.prev=Predchádzajúca strana
|
||||
nei.options.keys.gui.next=Nasledujúca strana
|
||||
nei.options.keys.gui.hide=Prepni viditeľnosť NEI
|
||||
nei.options.keys.gui.search=Zamerania na vyhľadávací riadok
|
||||
nei.options.keys.world=Svet
|
||||
nei.options.keys.world=NEI Svet
|
||||
nei.options.keys.world.chunkoverlay=Vrstva hraníc chunkov
|
||||
nei.options.keys.world.moboverlay=Vrstva zrodenia sa monštier
|
||||
nei.options.keys.world.highlight_tips=Zvýraznenie opisov
|
||||
|
||||
@@ -59,7 +59,7 @@ nei.options.wbutton.tip.0=Genel ayarları kullanıyorsunuz
|
||||
nei.options.wbutton.tip.1=Genel ayarların üstüne yazılıyor
|
||||
|
||||
nei.options.keys=Tuşlar
|
||||
nei.options.keys.gui=Envanter
|
||||
nei.options.keys.gui=NEI Envanter
|
||||
nei.options.keys.recipe.recipe=Tarifler
|
||||
nei.options.keys.recipe.usage=Kullanım yeri
|
||||
nei.options.keys.gui.enchant=Büylüler
|
||||
@@ -69,7 +69,7 @@ nei.options.keys.gui.prev=Önceki sayfa
|
||||
nei.options.keys.gui.next=Sonraki sayfa
|
||||
nei.options.keys.gui.hide=Nei görünürlük ayarı
|
||||
nei.options.keys.gui.search=Arama çubuğu odağı
|
||||
nei.options.keys.world=Dünya
|
||||
nei.options.keys.world=NEI Dünya
|
||||
nei.options.keys.world.chunkoverlay=Chunk sınır yerleşimi
|
||||
nei.options.keys.world.moboverlay=Mob Spawn yerleşimi
|
||||
nei.options.keys.world.highlight_tips=Nesne ipucu
|
||||
|
||||
@@ -47,11 +47,7 @@ nei.bookmark.recipe.toggle_collapse=Згорнути/Розгорнути
|
||||
nei.bookmark.recipe.chat_link=Надіслати рецепт у чат
|
||||
nei.bookmark.crafting_chain=Ланцюжок крафту
|
||||
nei.bookmark.crafting_chain.input=Інгредієнти
|
||||
nei.bookmark.crafting_chain.missing=Відсутні предмети
|
||||
nei.bookmark.crafting_chain.output=Результати
|
||||
nei.bookmark.crafting_chain.remainder=Залишки
|
||||
nei.bookmark.crafting_chain.needed=Необхідні крафти
|
||||
nei.bookmark.crafting_chain.available=Доступні предмети
|
||||
nei.inventory.search.placeholder=Пошук...
|
||||
nei.itempanel.quantity.default=Один стек
|
||||
nei.itempanel.loading=Завантаження списку предметів...
|
||||
@@ -236,9 +232,6 @@ nei.options.inventory.bookmarks.enabled.false=Прихована
|
||||
nei.options.inventory.bookmarks.animation=Анімація закладок у стилі REI
|
||||
nei.options.inventory.bookmarks.animation.true=Так
|
||||
nei.options.inventory.bookmarks.animation.false=Ні
|
||||
nei.options.inventory.bookmarks.recipeChainDir=Напрямок ланцюжка крафту
|
||||
nei.options.inventory.bookmarks.recipeChainDir.0=Спочатку інгредієнти
|
||||
nei.options.inventory.bookmarks.recipeChainDir.1=Спочатку результат
|
||||
nei.options.inventory.bookmarks.recipeTooltipsMode=Показувати підказки рецептів у закладках
|
||||
nei.options.inventory.bookmarks.recipeTooltipsMode.0=Ніколи
|
||||
nei.options.inventory.bookmarks.recipeTooltipsMode.1=У горизонтальному вигляді
|
||||
|
||||
@@ -88,7 +88,7 @@ nei.options.wbutton.tip.1=覆写全局设置
|
||||
|
||||
nei.options.keys=按键绑定
|
||||
nei.options.keys.showenchant=显示附魔值
|
||||
nei.options.keys.gui=物品栏
|
||||
nei.options.keys.gui=NEI 物品栏
|
||||
nei.options.keys.recipe.recipe=查看合成
|
||||
nei.options.keys.recipe.usage=查看用途
|
||||
nei.options.keys.gui.enchant=附魔
|
||||
@@ -110,7 +110,7 @@ nei.options.keys.gui.getnextsearch=下一个搜索
|
||||
nei.options.keys.copy.name=复制物品名称 (Ctrl +)
|
||||
nei.options.keys.copy.oredict=复制物品矿词词典 (Ctrl +)
|
||||
nei.options.keys.copy.identifier=复制物品ID (Ctrl +)
|
||||
nei.options.keys.world=世界
|
||||
nei.options.keys.world=NEI 世界
|
||||
nei.options.keys.world.chunkoverlay=区块(chunks)边界显示
|
||||
nei.options.keys.world.moboverlay=刷怪区域显示
|
||||
nei.options.keys.world.highlight_tips=显示选中方块名称
|
||||
|
||||
@@ -58,7 +58,7 @@ nei.options.wbutton.tip.0=使用全局設定
|
||||
nei.options.wbutton.tip.1=覆蓋全局設定
|
||||
|
||||
nei.options.keys=按鍵設定
|
||||
nei.options.keys.gui=物品欄
|
||||
nei.options.keys.gui=NEI 物品欄
|
||||
nei.options.keys.recipe.recipe=合成表
|
||||
nei.options.keys.recipe.usage=用途
|
||||
nei.options.keys.gui.enchant=附魔
|
||||
@@ -68,7 +68,7 @@ nei.options.keys.gui.prev=上一頁
|
||||
nei.options.keys.gui.next=下一頁
|
||||
nei.options.keys.gui.hide=隱藏/顯示NEI界面
|
||||
nei.options.keys.gui.search=焦點搜索欄
|
||||
nei.options.keys.world=世界
|
||||
nei.options.keys.world=NEI 世界
|
||||
nei.options.keys.world.chunkoverlay=區塊邊界顯示
|
||||
nei.options.keys.world.moboverlay=怪物生成區域顯示
|
||||
nei.options.keys.world.highlight_tips=高亮工具提示
|
||||
|
||||
Reference in new issue
Block a user