mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-16 10:14:39 +00:00
Compare commits
27
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7cfa4ae4ca | ||
|
|
8c858b5842 | ||
|
|
6734326ec9 | ||
|
|
4dc5832d34 | ||
|
|
abfcdbb3f2 | ||
|
|
2fae9f0968 | ||
|
|
2fe5ad7275 | ||
|
|
e67e134726 | ||
|
|
5b35ce5575 | ||
|
|
a2d469b411 | ||
|
|
5ddfdeafcc | ||
|
|
2062a79a2a | ||
|
|
23173070c9 | ||
|
|
4c37971a2b | ||
|
|
458947628c | ||
|
|
6e23c51868 | ||
|
|
c2acfb7d8a | ||
|
|
edcd410ee1 | ||
|
|
8e366e1982 | ||
|
|
f9c627fdda | ||
|
|
ee04d3786f | ||
|
|
e294cbfd54 | ||
|
|
ce5928ce7e | ||
|
|
0311599a34 | ||
|
|
3bb594ba11 | ||
|
|
4b2f944617 | ||
|
|
8db8fa1b72 |
No files matched your search
+8
-3
@@ -1,7 +1,12 @@
|
||||
build/build/*
|
||||
build/run/*
|
||||
build/.gradle/*
|
||||
./build/
|
||||
NotEnoughItems.iml
|
||||
NotEnoughItems.ipr
|
||||
NotEnoughItems.iws
|
||||
*.ipr
|
||||
*.iml
|
||||
*.iws
|
||||
.idea/**
|
||||
run/*
|
||||
.gradle/
|
||||
|
||||
*.bat
|
||||
@@ -56,7 +56,7 @@ minecraft {
|
||||
version = config.mc_version + "-" + config.forge_version
|
||||
}
|
||||
|
||||
def root = project.projectDir.parentFile
|
||||
def root = project.projectDir;
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
@@ -2,4 +2,4 @@ mc_version=1.7.10
|
||||
forge_version=10.13.4.1614-1.7.10
|
||||
ccl_version=1.1.3.138
|
||||
ccc_version=1.0.7.+
|
||||
mod_version=2.0.0-beta-6-GTNH
|
||||
mod_version=2.0.6-GTNH
|
||||
Binary file not shown.
File renamed without changes.
Vendored
File renamed without changes.
Vendored
+84
-84
@@ -1,84 +1,84 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="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!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="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!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@@ -1,11 +1,16 @@
|
||||
nei.load=载入
|
||||
nei.save=保存
|
||||
nei.bookmark.toggle=书签
|
||||
|
||||
nei.enchant=附魔
|
||||
nei.enchant.level=等级
|
||||
nei.enchant.locked=锁定
|
||||
nei.enchant.unlocked=解锁
|
||||
|
||||
nei.potion.favourite=最爱的药水
|
||||
nei.potion.duration=持续时间
|
||||
nei.potion.level=等级
|
||||
|
||||
nei.inventory.options=选项
|
||||
nei.inventory.prev=上一页
|
||||
nei.inventory.next=下一页
|
||||
@@ -39,7 +44,7 @@ nei.inventory.gamemode.3=设置为冒险模式
|
||||
nei.chat.gamemode.0=生存模式开启
|
||||
nei.chat.gamemode.1=创造模式开启
|
||||
nei.chat.gamemode.2=创造模式+开启
|
||||
nei.hat.gamemode.3=冒险模式开启
|
||||
nei.chat.gamemode.3=冒险模式开启
|
||||
nei.chat.rain.on=开启雨雪
|
||||
nei.chat.rain.off=关闭雨雪
|
||||
nei.chat.time=白天 %d. %d:00
|
||||
@@ -55,16 +60,22 @@ nei.options.wbutton.tip.0=使用全局设置
|
||||
nei.options.wbutton.tip.1=覆写全局设置
|
||||
|
||||
nei.options.keys=按键绑定
|
||||
nei.options.keys.showenchant=显示附魔
|
||||
nei.options.keys.gui=物品栏
|
||||
nei.options.keys.gui.recipe=查看合成
|
||||
nei.options.keys.gui.usage=查看用途
|
||||
nei.options.keys.gui.enchant=附魔
|
||||
nei.options.keys.gui.potion=药水
|
||||
nei.options.keys.gui.back=上一个合成表
|
||||
nei.options.keys.gui.back=返回上一合成表
|
||||
nei.options.keys.gui.prev=上一页
|
||||
nei.options.keys.gui.next=下一页
|
||||
nei.options.keys.gui.hide=隐藏/显示NEI界面
|
||||
ei.options.keys.gui.search=跳转到搜索框
|
||||
nei.options.keys.gui.next_recipe=下一合成表
|
||||
nei.options.keys.gui.prev_recipe=上一合成表
|
||||
nei.options.keys.gui.next_machine=下一机器
|
||||
nei.options.keys.gui.prev_machine=上一机器
|
||||
nei.options.keys.gui.search=跳转到搜索框
|
||||
nei.options.keys.gui.bookmark=添加书签
|
||||
nei.options.keys.world=世界
|
||||
nei.options.keys.world.chunkoverlay=区块(chunks)边界显示
|
||||
nei.options.keys.world.moboverlay=刷怪区域显示
|
||||
@@ -84,7 +95,7 @@ nei.options.inventory.widgetsenabled.false=禁用NEI
|
||||
nei.options.inventory.cheatmode.0=合成模式
|
||||
nei.options.inventory.cheatmode.1=实用模式
|
||||
nei.options.inventory.cheatmode.2=作弊模式
|
||||
|
||||
nei.options.inventory.layoutstyle=界面风格
|
||||
nei.options.inventory.profileRecipes=合成查阅性能分析
|
||||
nei.options.inventory.profileRecipes.true=开启
|
||||
nei.options.inventory.profileRecipes.false=关闭
|
||||
@@ -129,6 +140,7 @@ nei.options.command.heal.tip={0}=玩家
|
||||
nei.options.world.highlight_tips=高亮显示
|
||||
nei.options.world.highlight_tips.hide=隐藏
|
||||
nei.options.world.highlight_tips.show=显示
|
||||
nei.options.world.highlight_tips.sample=样本
|
||||
|
||||
nei.options.tools=工具
|
||||
nei.options.tools.dump=数据存储
|
||||
@@ -152,11 +164,15 @@ nei.options.tools.dump.itempanel.dumped=物品面板内容已保存到.minecraft
|
||||
nei.options.tools.dump.itempanel.mode.0=CSV
|
||||
nei.options.tools.dump.itempanel.mode.1=NBT
|
||||
nei.options.tools.dump.itempanel.mode.2=Json
|
||||
nei.options.tools.dump.itempanel.mode.3=PNG
|
||||
nei.options.tools.dump.itempanel.icon.dumped=物品面板图标已保存到.minecraft/e%s
|
||||
nei.options.tools.dump.itempanel.icon.cancelled=保存取消
|
||||
|
||||
|
||||
|
||||
nei.layoutstyle.minecraft=Minecraft风格
|
||||
nei.layoutstyle.oldtmi=老式TMI风格
|
||||
|
||||
nei.recipe.page=页数 %s/%s
|
||||
nei.recipe.tooltip=合成表
|
||||
nei.recipe.shaped=有序合成
|
||||
nei.recipe.shapeless=无序合成
|
||||
nei.recipe.furnace=烧制
|
||||
@@ -180,4 +196,31 @@ nei.itemsort.id=按物品ID排序
|
||||
nei.itemsort.default=默认
|
||||
nei.itemsort.default.tip=保留每个物品的自然顺序
|
||||
nei.itemsort.damage=按照物品耐久(metadata)排序
|
||||
nei.itemsort.name=按显示名称排序
|
||||
nei.itemsort.name=按显示名称排序
|
||||
|
||||
nei.subsets.Blocks=方块
|
||||
nei.subsets.Blocks.MobSpawners=刷怪笼
|
||||
nei.subsets.CreativeTabs=创造模式标签页
|
||||
nei.subsets.Items=物品
|
||||
nei.subsets.Items.Armor=装甲
|
||||
nei.subsets.Items.Armor.Boots=靴子
|
||||
nei.subsets.Items.Armor.Chestplates=胸甲
|
||||
nei.subsets.Items.Armor.Helmets=头盔
|
||||
nei.subsets.Items.Armor.Leggings=腿甲
|
||||
nei.subsets.Items.Food=食物
|
||||
nei.subsets.Items.Potions=药水
|
||||
nei.subsets.Items.Potions.Ingredients=原料
|
||||
nei.subsets.Items.Potions.Negative=负面效果
|
||||
nei.subsets.Items.Potions.Neutral=中立效果
|
||||
nei.subsets.Items.Potions.Positive=正面效果
|
||||
nei.subsets.Items.Potions.Splash=喷溅
|
||||
nei.subsets.Items.Tools=工具
|
||||
nei.subsets.Items.Tools.Axes=斧
|
||||
nei.subsets.Items.Tools.Hoes=锄
|
||||
nei.subsets.Items.Tools.Other=其他
|
||||
nei.subsets.Items.Tools.Pickaxes=镐
|
||||
nei.subsets.Items.Tools.Shovels=铲
|
||||
nei.subsets.Items.Weapons=武器
|
||||
nei.subsets.Items.Weapons.Ranged=远程
|
||||
nei.subsets.Items.Weapons.Swords=剑
|
||||
nei.subsets.Mod=Mod
|
||||
File renamed without changes.
@@ -554,6 +554,11 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void markItemsDirty() {
|
||||
// If anything has modified data this depends on, we'll need to reload the item list
|
||||
itemsLoaded = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(GuiContainer gui) {
|
||||
|
||||
@@ -143,7 +143,7 @@ public class LayoutStyleMinecraft extends LayoutStyle
|
||||
}
|
||||
|
||||
public void layoutButton(Button button) {
|
||||
button.x = 6 + (buttonCount % numButtons) * 20;
|
||||
button.x = 2 + (buttonCount % numButtons) * 20;
|
||||
button.y = 3 + (buttonCount / numButtons) * 18;
|
||||
|
||||
button.h = 17;
|
||||
|
||||
@@ -242,21 +242,25 @@ public class NEIClientConfig
|
||||
|
||||
configLoaded = true;
|
||||
|
||||
ClassDiscoverer classDiscoverer = new ClassDiscoverer(test -> test.startsWith("NEI") && test.endsWith("Config.class"), IConfigureNEI.class);
|
||||
new Thread("NEI Plugin Loader") {
|
||||
@Override
|
||||
public void run() {
|
||||
ClassDiscoverer classDiscoverer = new ClassDiscoverer(test -> test.startsWith("NEI") && test.endsWith("Config.class"), IConfigureNEI.class);
|
||||
|
||||
classDiscoverer.findClasses();
|
||||
classDiscoverer.findClasses();
|
||||
|
||||
for (Class<?> clazz : classDiscoverer.classes) {
|
||||
try {
|
||||
IConfigureNEI config = (IConfigureNEI) clazz.newInstance();
|
||||
config.loadConfig();
|
||||
NEIModContainer.plugins.add(config);
|
||||
logger.debug("Loaded " + clazz.getName());
|
||||
} catch (Exception e) {
|
||||
logger.error("Failed to Load " + clazz.getName(), e);
|
||||
for (Class<?> clazz : classDiscoverer.classes) {
|
||||
try {
|
||||
IConfigureNEI config = (IConfigureNEI) clazz.newInstance();
|
||||
config.loadConfig();
|
||||
NEIModContainer.plugins.add(config);
|
||||
logger.debug("Loaded " + clazz.getName());
|
||||
} catch (Exception e) {
|
||||
logger.error("Failed to Load " + clazz.getName(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}.start();
|
||||
ItemSorter.loadConfig();
|
||||
}
|
||||
|
||||
|
||||
@@ -121,6 +121,7 @@ public class API
|
||||
*/
|
||||
public static void hideItem(ItemStack item) {
|
||||
ItemInfo.hiddenItems.add(item);
|
||||
LayoutManager.markItemsDirty();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -128,6 +129,7 @@ public class API
|
||||
*/
|
||||
public static void setOverrideName(ItemStack item, String name) {
|
||||
ItemInfo.nameOverrides.put(item, name);
|
||||
LayoutManager.markItemsDirty();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -136,6 +138,7 @@ public class API
|
||||
*/
|
||||
public static void addItemListEntry(ItemStack item) {
|
||||
ItemInfo.itemOverrides.put(item.getItem(), item);
|
||||
LayoutManager.markItemsDirty();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -145,6 +148,7 @@ public class API
|
||||
if(items == null)
|
||||
items = Collections.emptyList();
|
||||
ItemInfo.itemOverrides.replaceValues(item, items);
|
||||
LayoutManager.markItemsDirty();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -273,5 +277,6 @@ public class API
|
||||
*/
|
||||
public static void addItemVariant(Item item, ItemStack variant) {
|
||||
ItemInfo.itemVariants.put(item, variant);
|
||||
LayoutManager.markItemsDirty();
|
||||
}
|
||||
}
|
||||
@@ -65,7 +65,7 @@ public class FuelRecipeHandler extends FurnaceRecipeHandler
|
||||
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
for (FuelPair fuel : afuels)
|
||||
if (fuel.stack.contains(ingredient))
|
||||
if (fuel.stack != null && fuel.stack.contains(ingredient))
|
||||
arecipes.add(new CachedFuelRecipe(fuel));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,27 +1,37 @@
|
||||
package codechicken.nei.recipe;
|
||||
|
||||
import codechicken.core.TaskProfiler;
|
||||
import codechicken.nei.ItemList;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class GuiCraftingRecipe extends GuiRecipe
|
||||
{
|
||||
public static boolean openRecipeGui(String outputId, Object... results) {
|
||||
Minecraft mc = NEIClientUtils.mc();
|
||||
GuiContainer prevscreen = mc.currentScreen instanceof GuiContainer ? (GuiContainer) mc.currentScreen : null;
|
||||
GuiScreen prevscreen = mc.currentScreen;// instanceof GuiContainer ? (GuiContainer) mc.currentScreen : null;
|
||||
|
||||
ArrayList<ICraftingHandler> handlers;
|
||||
TaskProfiler profiler = ProfilerRecipeHandler.getProfiler();
|
||||
ArrayList<ICraftingHandler> handlers = new ArrayList<>();
|
||||
for (ICraftingHandler craftinghandler : craftinghandlers) {
|
||||
profiler.start(craftinghandler.getRecipeName());
|
||||
ICraftingHandler handler = craftinghandler.getRecipeHandler(outputId, results);
|
||||
if (handler.numRecipes() > 0)
|
||||
handlers.add(handler);
|
||||
try {
|
||||
profiler.start("recipe.concurrent.crafting");
|
||||
handlers = ItemList.forkJoinPool.submit(() -> craftinghandlers.parallelStream()
|
||||
.map(h -> h.getRecipeHandler(outputId, results))
|
||||
.filter(h -> h.numRecipes() > 0)
|
||||
.collect(Collectors.toCollection(ArrayList::new))).get();
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
} finally {
|
||||
profiler.end();
|
||||
}
|
||||
profiler.end();
|
||||
|
||||
if (handlers.isEmpty())
|
||||
return false;
|
||||
|
||||
@@ -29,7 +39,7 @@ public class GuiCraftingRecipe extends GuiRecipe
|
||||
return true;
|
||||
}
|
||||
|
||||
private GuiCraftingRecipe(GuiContainer prevgui, ArrayList<ICraftingHandler> handlers) {
|
||||
private GuiCraftingRecipe(GuiScreen prevgui, ArrayList<ICraftingHandler> handlers) {
|
||||
super(prevgui);
|
||||
currenthandlers = handlers;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import codechicken.nei.guihook.IContainerTooltipHandler;
|
||||
import codechicken.nei.guihook.IGuiClientSide;
|
||||
import codechicken.nei.guihook.IGuiHandleMouseWheel;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -34,18 +35,20 @@ public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOve
|
||||
public int recipetype;
|
||||
public ContainerRecipe slotcontainer;
|
||||
public GuiContainer firstGui;
|
||||
public GuiContainer prevGui;
|
||||
public GuiScreen prevGui;
|
||||
public GuiButton nextpage;
|
||||
public GuiButton prevpage;
|
||||
public GuiButton overlay1;
|
||||
public GuiButton overlay2;
|
||||
|
||||
protected GuiRecipe(GuiContainer prevgui) {
|
||||
protected GuiRecipe(GuiScreen prevgui) {
|
||||
super(new ContainerRecipe());
|
||||
slotcontainer = (ContainerRecipe) inventorySlots;
|
||||
|
||||
this.prevGui = prevgui;
|
||||
this.firstGui = prevgui;
|
||||
if(prevgui instanceof GuiContainer)
|
||||
this.firstGui = (GuiContainer)prevgui;
|
||||
|
||||
if (prevgui instanceof IGuiContainerOverlay)
|
||||
this.firstGui = ((IGuiContainerOverlay) prevgui).getFirstScreen();
|
||||
}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package codechicken.nei.recipe;
|
||||
|
||||
import codechicken.core.TaskProfiler;
|
||||
import codechicken.nei.ItemList;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class GuiUsageRecipe extends GuiRecipe
|
||||
{
|
||||
@@ -13,15 +16,21 @@ public class GuiUsageRecipe extends GuiRecipe
|
||||
Minecraft mc = NEIClientUtils.mc();
|
||||
GuiContainer prevscreen = mc.currentScreen instanceof GuiContainer ? (GuiContainer) mc.currentScreen : null;
|
||||
|
||||
ArrayList<IUsageHandler> handlers;
|
||||
TaskProfiler profiler = ProfilerRecipeHandler.getProfiler();
|
||||
ArrayList<IUsageHandler> handlers = new ArrayList<>();
|
||||
for (IUsageHandler usagehandler : usagehandlers) {
|
||||
profiler.start(usagehandler.getRecipeName());
|
||||
IUsageHandler handler = usagehandler.getUsageHandler(inputId, ingredients);
|
||||
if (handler.numRecipes() > 0)
|
||||
handlers.add(handler);
|
||||
try {
|
||||
profiler.start("recipe.concurrent.usage");
|
||||
handlers = ItemList.forkJoinPool.submit(() -> usagehandlers.parallelStream()
|
||||
.map(h -> h.getUsageHandler(inputId, ingredients))
|
||||
.filter(h -> h.numRecipes() > 0)
|
||||
.collect(Collectors.toCollection(ArrayList::new))).get();
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
} finally {
|
||||
profiler.end();
|
||||
}
|
||||
profiler.end();
|
||||
|
||||
if (handlers.isEmpty())
|
||||
return false;
|
||||
|
||||
|
||||
@@ -49,7 +49,12 @@ public class ShapelessRecipeHandler extends ShapedRecipeHandler
|
||||
|
||||
public void setIngredients(List<?> items) {
|
||||
ingredients.clear();
|
||||
for (int ingred = 0; ingred < items.size(); ingred++) {
|
||||
int itemsSize = items.size();
|
||||
if (itemsSize > stackorder.length) {
|
||||
NEIClientConfig.logger.error("RECIPE BUG: Too many items (" + itemsSize + ") for " + this.result.toString());
|
||||
itemsSize = stackorder.length;
|
||||
}
|
||||
for (int ingred = 0; ingred < itemsSize; ingred++) {
|
||||
PositionedStack stack = new PositionedStack(items.get(ingred), 25 + stackorder[ingred][0] * 18, 6 + stackorder[ingred][1] * 18);
|
||||
stack.setMaxSize(1);
|
||||
ingredients.add(stack);
|
||||
|
||||
@@ -83,9 +83,13 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
|
||||
*/
|
||||
public List<PositionedStack> getOtherStacks() {
|
||||
ArrayList<PositionedStack> stacks = new ArrayList<>();
|
||||
PositionedStack stack = getOtherStack();
|
||||
if (stack != null)
|
||||
stacks.add(stack);
|
||||
try {
|
||||
PositionedStack stack = getOtherStack();
|
||||
if (stack != null)
|
||||
stacks.add(stack);
|
||||
} catch (ArithmeticException e) {
|
||||
NEIClientConfig.logger.error("Error in getOtherStacks: " + e);
|
||||
}
|
||||
return stacks;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user