mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-16 18:54:45 +00:00
Compare commits
23
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
58117fa368 | ||
|
|
db339e94f4 | ||
|
|
7126a6d3b0 | ||
|
|
b00f4d1514 | ||
|
|
5b3a255be9 | ||
|
|
65710c959a | ||
|
|
95ee685b93 | ||
|
|
888f86f2da | ||
|
|
b4780716ec | ||
|
|
52fb89daf6 | ||
|
|
dd18d2b775 | ||
|
|
1cf8f4c1d2 | ||
|
|
a016795056 | ||
|
|
f8d492e5f5 | ||
|
|
8b073543b3 | ||
|
|
8ef7978044 | ||
|
|
afd25919c5 | ||
|
|
1bd64bc1b8 | ||
|
|
45d0621da4 | ||
|
|
4a34aa1796 | ||
|
|
fe7066eeb8 | ||
|
|
c80ab9d6ab | ||
|
|
475fda6ceb |
No files matched your search
@@ -145,6 +145,12 @@ task devJar(type: Jar) {
|
||||
from sourceSets.main.output
|
||||
getArchiveClassifier().set("dev")
|
||||
manifest commonManifest
|
||||
|
||||
configurations.shade.each { dep ->
|
||||
from(project.zipTree(dep)){
|
||||
exclude 'META-INF', 'META-INF/**'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Tell the artifact system about our extra jars
|
||||
|
||||
+1
-1
@@ -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.1.5-GTNH
|
||||
mod_version=2.1.13-GTNH
|
||||
@@ -22,14 +22,14 @@ WayofTime.alchemicalWizardry.client.nei.NEIAltarRecipeHandler,Blood Magic,AWWayo
|
||||
WayofTime.alchemicalWizardry.client.nei.NEIBindingRitualHandler,Blood Magic,AWWayofTime:sacrificialKnife,,AWWayofTime,TRUE,,,50,,6,,,,,,
|
||||
WayofTime.alchemicalWizardry.client.nei.NEIBloodOrbShapedHandler,Blood Magic,AWWayofTime:AlchemicalWizardrybloodRune:3,,AWWayofTime,TRUE,,,65,,5,,,,,,
|
||||
WayofTime.alchemicalWizardry.client.nei.NEIBloodOrbShapelessHandler,Blood Magic,AWWayofTime:AlchemicalWizardrybloodRune:4,,AWWayofTime,TRUE,,,65,,5,,,,,,
|
||||
bw.fuels.acidgens,BartWorks,gregtech:gt.blockmachines:12726,,bartworks,TRUE,,,145,,2,,,,,,
|
||||
bw.recipe.cal,BartWorks,gregtech:gt.blockmachines:12735,,bartworks,TRUE,,,135,,2,,,,,,
|
||||
bw.fuels.acidgens,BartWorks,gregtech:gt.blockmachines:12726,,bartworks,TRUE,,6,145,,2,,,,,,
|
||||
bw.recipe.cal,BartWorks,gregtech:gt.blockmachines:12735,,bartworks,TRUE,,6,135,,2,,,,,,
|
||||
gg.recipe.naquadah_reactor,Good Generator,gregtech:gt.blockmachines:12732,,GoodGenerator,TRUE,,,145,,1,,,,,,
|
||||
gg.recipe.naquadah_fuel_refine_factory,Good Generator,gregtech:gt.blockmachines:16999,,GoodGenerator,TRUE,,,145,,1,,,,,,
|
||||
com.github.bartimaeusnek.bartworks.neiHandler.BW_NEI_BioLabHandler,BartWorks,gregtech:gt.blockmachines:12699,,bartworks,TRUE,,,145,,2,,,,,,
|
||||
com.github.bartimaeusnek.bartworks.neiHandler.BW_NEI_BioVatHandler,BartWorks,gregtech:gt.blockmachines:12712,,bartworks,TRUE,,,140,,2,,,,,,
|
||||
com.github.bartimaeusnek.bartworks.neiHandler.BW_NEI_BioLabHandler,BartWorks,gregtech:gt.blockmachines:12699,,bartworks,TRUE,,6,145,,2,,,,,,
|
||||
com.github.bartimaeusnek.bartworks.neiHandler.BW_NEI_BioVatHandler,BartWorks,gregtech:gt.blockmachines:12712,,bartworks,TRUE,,6,140,,2,,,,,,
|
||||
com.github.bartimaeusnek.bartworks.neiHandler.BW_NEI_OreHandler,BartWorks,bartworks:bw.blockores.01:89,,bartworks,TRUE,,,135,,2,,,,,,
|
||||
gt.recipe.electricimplosioncompressor,BartWorks,gregtech:gt.blockmachines:12734,,bartworks,TRUE,,,135,,2,,,,,,
|
||||
gt.recipe.electricimplosioncompressor,BartWorks,gregtech:gt.blockmachines:12734,,bartworks,TRUE,,6,135,,2,,,,,,
|
||||
net.bdew.neiaddons.botany.flowers.FlowerBreedingHandler,Botany,Botany:flower,,Botany,TRUE,,,65,,5,,,,,,
|
||||
buildcraft.compat.nei.RecipeHandlerRefinery,BuildCraft,BuildCraft|Factory:refineryBlock,,BuildCraft|Factory,TRUE,,,60,,5,,,,,,There's only 2 recipes though
|
||||
buildcraft.compat.nei.RecipeHandlerAssemblyTable,BuildCraft,BuildCraft|Silicon:laserTableBlock,,BuildCraft|Silicon,TRUE,,,100,,3,,,,,,
|
||||
@@ -179,7 +179,7 @@ ic2.neiIntegration.core.recipehandler.MetalFormerRecipeHandlerRolling,Industrial
|
||||
ic2.neiIntegration.core.recipehandler.OreWashingRecipeHandler,IndustrialCraft 2,IC2:blockMachine2:5,,IC2,TRUE,,,,,,,,,,,
|
||||
ic2.neiIntegration.core.recipehandler.ScrapboxRecipeHandler,IndustrialCraft 2,IC2:itemScrapbox,,IC2,TRUE,,,50,,6,,,,,,
|
||||
ic2.neiIntegration.core.recipehandler.SolidCannerRecipeHandler,IndustrialCraft 2,IC2:blockMachine2:9,,IC2,TRUE,,,,,,,,,,,
|
||||
speiger.src.crops.prediction.NEIPlugin,IC2CropsNEI,IC2:blockCrop,,Ic2Nei,TRUE,,,135,,2,,,,,,Not actual recipes, just info
|
||||
speiger.src.crops.prediction.NEIPlugin,IC2CropsNEI,IC2:blockCrop,,Ic2Nei,TRUE,,,135,,2,,,,,,"Not actual recipes, just info"
|
||||
tonius.neiintegration.mods.mcforge.RecipeHandlerFluidRegistry,Minecraft,minecraft:water,,minecraft,FALSE,,,,,,,,,,,
|
||||
tonius.neiintegration.mods.mcforge.RecipeHandlerOreDictionary,Minecraft,minecraft:iron_ore,,minecraft,FALSE,,,,,,,,,,,
|
||||
gt.recipe.alloyblastsmelter,GT++,gregtech:gt.blockmachines:810,,miscutils,TRUE,,6,135,166,2,,,,,,ABS
|
||||
@@ -422,3 +422,30 @@ mekanism.client.nei.SolarNeutronRecipeHandler,Mekanism,Mekanism:MachineBlock3:1,
|
||||
mekanism.client.nei.ThermalEvaporationRecipeHandler,Mekanism,Mekanism:BasicBlock:14,,Mekanism,TRUE,,,62,,5,,,,,,
|
||||
exnihilo.compatibility.nei.RecipeHandlerHammer,Ex Nihilo,exnihilo:hammer_iron,,exnihilo,TRUE,,,58,,5,,,,,,
|
||||
exnihilo.compatibility.nei.RecipeHandlerSieve,Ex Nihilo,exnihilo:sifting_table,,exnihilo,TRUE,,,130,,2,,,,,,
|
||||
gregtechmod.mistaqur.nei.handlers.AlloySmelterRecipeHandler,GregTech-Addon,gregtech_addon:machine:56,,gregtech_addon,TRUE,,15,145,166,2,,,,,,
|
||||
gregtechmod.mistaqur.nei.handlers.AssemblerRecipeHandler,GregTech-Addon,gregtech_addon:machine:60,,gregtech_addon,TRUE,,15,145,166,2,,,,,,
|
||||
gregtechmod.mistaqur.nei.handlers.BenderRecipeHandler,GregTech-Addon,gregtech_addon:machine:59,,gregtech_addon,TRUE,,15,145,166,2,,,,,,
|
||||
gregtechmod.mistaqur.nei.handlers.BlastRecipeHandler,GregTech-Addon,gregtech_addon:machine:29,,gregtech_addon,TRUE,,15,145,166,2,,,,,,
|
||||
gregtechmod.mistaqur.nei.handlers.BronzeBlastRecipeHandler,GregTech-Addon,gregtech_addon:machine:136,,gregtech_addon,TRUE,,15,145,166,2,,,,,,
|
||||
gregtechmod.mistaqur.nei.handlers.CannerRecipeHandler,GregTech-Addon,gregtech_addon:machine:57,,gregtech_addon,TRUE,,15,145,166,2,,,,,,
|
||||
gregtechmod.mistaqur.nei.handlers.CentrifugeRecipeHandler,GregTech-Addon,gregtech_addon:machine:62,,gregtech_addon,TRUE,,15,145,166,2,,,,,,
|
||||
gregtechmod.mistaqur.nei.handlers.ChemicalRecipeHandler,GregTech-Addon,gregtech_addon:machine:41,,gregtech_addon,TRUE,,15,145,166,2,,,,,,
|
||||
gregtechmod.mistaqur.nei.handlers.CutterRecipeHandler,GregTech-Addon,gregtech_addon:machine:113,,gregtech_addon,TRUE,,15,145,166,2,,,,,,
|
||||
gregtechmod.mistaqur.nei.handlers.DistillationRecipeHandler,GregTech-Addon,gregtech_addon:machine:44,,gregtech_addon,TRUE,,15,145,166,2,,,,,,
|
||||
gregtechmod.mistaqur.nei.handlers.ElectrolyzerRecipeHandler,GregTech-Addon,gregtech_addon:machine:25,,gregtech_addon,TRUE,,15,145,166,2,,,,,,
|
||||
gregtechmod.mistaqur.nei.handlers.ExtruderRecipeHandler,GregTech-Addon,gregtech_addon:machine:115,,gregtech_addon,TRUE,,15,145,166,2,,,,,,
|
||||
gregtechmod.mistaqur.nei.handlers.FusionRecipeHandler,GregTech-Addon,gregtech_addon:machine:80,,gregtech_addon,TRUE,,15,145,166,2,,,,,,
|
||||
gregtechmod.mistaqur.nei.handlers.GeneratorHandler,GregTech-Addon,,,gregtech_addon,TRUE,,15,145,166,2,nei:textures/nei_tabbed_sprites.png,80,0,14,14,
|
||||
gregtechmod.mistaqur.nei.handlers.GrinderRecipeHandler,GregTech-Addon,gregtech_addon:machine:28,,gregtech_addon,TRUE,,15,145,166,2,,,,,,
|
||||
gregtechmod.mistaqur.nei.handlers.ImplosionRecipeHandler,GregTech-Addon,gregtech_addon:machine:31,,gregtech_addon,TRUE,,15,145,166,2,,,,,,
|
||||
gregtechmod.mistaqur.nei.handlers.LatheRecipeHandler,GregTech-Addon,gregtech_addon:machine:111,,gregtech_addon,TRUE,,15,145,166,2,,,,,,
|
||||
gregtechmod.mistaqur.nei.handlers.SawmillRecipeHandler,GregTech-Addon,gregtech_addon:machine:32,,gregtech_addon,TRUE,,15,145,166,2,,,,,,
|
||||
gregtechmod.mistaqur.nei.handlers.VacuumFreezerRecipeHandler,GregTech-Addon,gregtech_addon:machine:38,,gregtech_addon,TRUE,,15,145,166,2,,,,,,
|
||||
gregtechmod.mistaqur.nei.handlers.WiremillRecipeHandler,GregTech-Addon,gregtech_addon:machine:55,,gregtech_addon,TRUE,,15,145,166,2,,,,,,
|
||||
cofh.thermaldynamics.plugins.nei.RecipeHandlerCover,Thermal Dynamics,ThermalDynamics:cover,"{Block:""minecraft:glass"",Meta:0b}",ThermalDynamics,TRUE,,,65,166,5,,,,,,
|
||||
neresources.nei.NEIAdvSeedHandler,Not Enough Resources,minecraft:wheat,,neresources,TRUE,,,65,166,5,,,,,,
|
||||
neresources.nei.NEIDungeonHandler,Not Enough Resources,minecraft:chest,,neresources,TRUE,,,130,166,2,,,,,,
|
||||
neresources.nei.NEIEnchantmentHandler,Not Enough Resources,minecraft:anvil,,neresources,TRUE,,,130,166,2,,,,,,
|
||||
neresources.nei.NEIMobHandler,Not Enough Resources,minecraft:skull:4,,neresources,TRUE,,,130,166,2,,,,,,
|
||||
neresources.nei.NEIOreHandler,Not Enough Resources,minecraft:diamond_ore,,neresources,TRUE,,,65,166,5,,,,,,
|
||||
neresources.nei.NEIPlantHandler,Not Enough Resources,minecraft:wheat,,neresources,TRUE,,,130,166,2,,,,,,
|
||||
|
@@ -1,6 +1,13 @@
|
||||
nei.load=载入
|
||||
nei.save=保存
|
||||
|
||||
# PC/Linux Control Key
|
||||
nei.key.ctrl=CTRL
|
||||
# Mac Command Key
|
||||
nei.key.ctrl.mac=CMD
|
||||
|
||||
nei.bookmark.toggle=书签
|
||||
nei.bookmark.toggle.tip=显示/隐藏书签页
|
||||
|
||||
nei.enchant=附魔
|
||||
nei.enchant.level=等级
|
||||
@@ -12,6 +19,11 @@ nei.potion.duration=持续时间
|
||||
nei.potion.level=等级
|
||||
|
||||
nei.inventory.options=选项
|
||||
nei.inventory.options.tip=NEI设置
|
||||
nei.inventory.options.tip.cheatmode.0=合成模式
|
||||
nei.inventory.options.tip.cheatmode.1=实用模式
|
||||
nei.inventory.options.tip.cheatmode.2=作弊模式
|
||||
nei.inventory.options.tip.cheatmode.disable=%s-点击此处以循环切换合成/实用/作弊模式.
|
||||
nei.inventory.prev=上一页
|
||||
nei.inventory.next=下一页
|
||||
nei.inventory.item_subsets=物品分类
|
||||
@@ -36,10 +48,15 @@ nei.inventory.dusk.set=设置时间为黄昏
|
||||
nei.inventory.midnight.enable=激活午夜时间设置
|
||||
nei.inventory.midnight.set=设置时间为午夜
|
||||
nei.inventory.heal=治愈玩家并回满饱食度
|
||||
nei.inventory.gamemode.0=设置为生存模式
|
||||
nei.inventory.gamemode.1=设置为创造模式
|
||||
nei.inventory.gamemode.2=设置为创造模式+
|
||||
nei.inventory.gamemode.3=设置为冒险模式
|
||||
nei.inventory.current.gamemode.0=当前游戏模式: 生存
|
||||
nei.inventory.current.gamemode.1=当前游戏模式: 创造
|
||||
nei.inventory.current.gamemode.2=当前游戏模式: 创造+
|
||||
nei.inventory.current.gamemode.3=当前游戏模式: 冒险
|
||||
|
||||
nei.inventory.gamemode.0=点击设置为生存模式
|
||||
nei.inventory.gamemode.1=点击设置为创造模式
|
||||
nei.inventory.gamemode.2=点击设置为创造+模式
|
||||
nei.inventory.gamemode.3=点击设置为冒险模式
|
||||
|
||||
nei.chat.gamemode.0=生存模式开启
|
||||
nei.chat.gamemode.1=创造模式开启
|
||||
@@ -76,6 +93,7 @@ nei.options.keys.gui.next_machine=下一机器
|
||||
nei.options.keys.gui.prev_machine=上一机器
|
||||
nei.options.keys.gui.search=跳转到搜索框
|
||||
nei.options.keys.gui.bookmark=添加书签
|
||||
nei.options.keys.gui.hide_bookmarks=显示/隐藏书签页
|
||||
nei.options.keys.world=世界
|
||||
nei.options.keys.world.chunkoverlay=区块(chunks)边界显示
|
||||
nei.options.keys.world.moboverlay=刷怪区域显示
|
||||
@@ -90,12 +108,23 @@ nei.options.keys.world.creative=游戏模式
|
||||
nei.options.keys.world.creative.tip=循环游戏模式
|
||||
|
||||
nei.options.inventory=物品栏
|
||||
nei.options.inventory.bookmarksEnabled=显示/隐藏书签页
|
||||
nei.options.inventory.bookmarksEnabled.true=显示
|
||||
nei.options.inventory.bookmarksEnabled.false=隐藏
|
||||
nei.options.inventory.jei_style_tabs=JEI标签页
|
||||
nei.options.inventory.jei_style_tabs.true=是
|
||||
nei.options.inventory.jei_style_tabs.false=否 [不会吧]
|
||||
nei.options.inventory.jei_style_item_presence_overlay=JEI风格物品覆盖?-悬停
|
||||
nei.options.inventory.jei_style_item_presence_overlay.true=是
|
||||
nei.options.inventory.jei_style_item_presence_overlay.false=否
|
||||
nei.options.inventory.creative_tab_style=创造模式/JEI标签页
|
||||
nei.options.inventory.creative_tab_style.true=创造模式
|
||||
nei.options.inventory.creative_tab_style.false=JEI
|
||||
nei.options.inventory.widgetsenabled.true=激活NEI
|
||||
nei.options.inventory.widgetsenabled.false=禁用NEI
|
||||
nei.options.inventory.cheatmode.0=合成模式
|
||||
nei.options.inventory.cheatmode.1=实用模式
|
||||
nei.options.inventory.cheatmode.2=作弊模式
|
||||
nei.options.inventory.layoutstyle=界面风格
|
||||
nei.options.inventory.profileRecipes=合成查阅性能分析
|
||||
nei.options.inventory.profileRecipes.true=开启
|
||||
nei.options.inventory.profileRecipes.false=关闭
|
||||
@@ -124,6 +153,12 @@ nei.options.inventory.gamemodes.tip=选择游戏模式循环调整时的选项
|
||||
nei.options.inventory.gamemodes.creative=创造模式
|
||||
nei.options.inventory.gamemodes.creative+=创造模式+
|
||||
nei.options.inventory.gamemodes.adventure=冒险模式
|
||||
nei.options.inventory.disableMouseScrollTransfer=禁用鼠标滚轮移动物品
|
||||
nei.options.inventory.disableMouseScrollTransfer.true=开启
|
||||
nei.options.inventory.disableMouseScrollTransfer.false=关闭
|
||||
nei.options.inventory.invertMouseScrollTransfer=反转鼠标滚轮方向
|
||||
nei.options.inventory.invertMouseScrollTransfer.true=开启
|
||||
nei.options.inventory.invertMouseScrollTransfer.false=关闭
|
||||
|
||||
nei.options.command=指令
|
||||
nei.options.command.creative=游戏模式
|
||||
@@ -143,6 +178,9 @@ nei.options.world.highlight_tips.show=显示
|
||||
nei.options.world.highlight_tips.sample=样本
|
||||
|
||||
nei.options.tools=工具
|
||||
nei.options.tools.handler_load_from_config=从Config加载预设(handler)
|
||||
nei.options.tools.handler_load_from_config.true=Config
|
||||
nei.options.tools.handler_load_from_config.false=JAR
|
||||
nei.options.tools.dump=数据存储
|
||||
nei.options.tools.dump.dump=存储
|
||||
nei.options.tools.dump.dumped=%s ID已保存到.minecraft/%s
|
||||
@@ -167,9 +205,10 @@ 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.options.tools.dump.handlers=NEI预设
|
||||
nei.options.tools.dump.handlers.dumped=预设(handlers)已存至 %s
|
||||
nei.options.tools.dump.handlers.mode.0=CSV
|
||||
nei.options.tools.dump.handlers.mode.1=Json
|
||||
|
||||
nei.recipe.page=页数 %s/%s
|
||||
nei.recipe.tooltip=合成表
|
||||
|
||||
@@ -136,14 +136,7 @@ public class ItemPanel extends Widget {
|
||||
}
|
||||
|
||||
public int getHeight(GuiContainer gui) {
|
||||
return gui.height - 15 - y + getHightAdjustment();
|
||||
}
|
||||
|
||||
public int getHightAdjustment() {
|
||||
int hAdj = 0;
|
||||
if (!canPerformAction("item"))
|
||||
hAdj += 15;
|
||||
return hAdj;
|
||||
return gui.height - 15 - y;
|
||||
}
|
||||
|
||||
public int getWidth(GuiContainer gui) {
|
||||
|
||||
@@ -7,30 +7,25 @@ public class ItemQuantityField extends TextField
|
||||
centered = true;
|
||||
}
|
||||
|
||||
// Find a way to work this this back in
|
||||
public boolean isValid(String string) {
|
||||
if (string.equals(""))
|
||||
return true;
|
||||
|
||||
try {
|
||||
return Integer.parseInt(string) >= 0;
|
||||
} catch (NumberFormatException nfe) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int intValue() {
|
||||
return intValue(text());
|
||||
}
|
||||
|
||||
public int intValue(String s) {
|
||||
try {
|
||||
return Integer.parseInt(s);
|
||||
return Math.max(0, Integer.parseInt(s));
|
||||
} catch (NumberFormatException nfe) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void gainFocus() {
|
||||
if (text().equals("0")) {
|
||||
setText("");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loseFocus() {
|
||||
setText(Integer.toString(NEIClientConfig.getItemQuantity()));
|
||||
@@ -38,7 +33,6 @@ public class ItemQuantityField extends TextField
|
||||
|
||||
@Override
|
||||
public void onTextChange(String oldText) {
|
||||
if (intValue(oldText) != intValue())//hacky recursion stopper
|
||||
NEIClientUtils.setItemQuantity(intValue());
|
||||
NEIClientUtils.setItemQuantity(intValue());
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,9 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
{
|
||||
private static LayoutManager instance;
|
||||
|
||||
/** Note: this variable isn't actually used by this mod, but NEI add-ons might need it. */
|
||||
private static Widget inputFocused;
|
||||
|
||||
/**
|
||||
* Sorted bottom first
|
||||
*/
|
||||
@@ -423,7 +425,7 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
if (quantity < 0)
|
||||
quantity = 0;
|
||||
|
||||
setItemQuantity(quantity);
|
||||
LayoutManager.quantity.setText(Integer.toString(quantity));
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -440,7 +442,7 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
if (quantity < 0)
|
||||
quantity = 0;
|
||||
|
||||
setItemQuantity(quantity);
|
||||
LayoutManager.quantity.setText(Integer.toString(quantity));
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -673,11 +675,9 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
addWidget(itemPanel);
|
||||
itemPanel.setVisible();
|
||||
|
||||
if (canPerformAction("item")) {
|
||||
addWidget(more);
|
||||
addWidget(less);
|
||||
addWidget(quantity);
|
||||
}
|
||||
addWidget(more);
|
||||
addWidget(less);
|
||||
addWidget(quantity);
|
||||
}
|
||||
|
||||
if (visiblity.showBookmarkPanel) {
|
||||
@@ -764,10 +764,12 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
return itemPanel.draggedStack == null;
|
||||
}
|
||||
|
||||
/** Note: this method isn't actually used by this mod, but NEI add-ons might need it. */
|
||||
public static Widget getInputFocused() {
|
||||
return inputFocused;
|
||||
}
|
||||
|
||||
/** Note: this method isn't actually used by this mod, but NEI add-ons might need it. */
|
||||
public static void setInputFocused(Widget widget) {
|
||||
if (inputFocused != null)
|
||||
inputFocused.loseFocus();
|
||||
|
||||
@@ -24,6 +24,7 @@ import codechicken.nei.config.OptionTextField;
|
||||
import codechicken.nei.config.OptionToggleButton;
|
||||
import codechicken.nei.config.OptionToggleButtonBoubs;
|
||||
import codechicken.nei.config.OptionUtilities;
|
||||
import codechicken.nei.event.NEIConfigsLoadedEvent;
|
||||
import codechicken.nei.recipe.GuiRecipeTab;
|
||||
import codechicken.nei.recipe.RecipeInfo;
|
||||
import codechicken.obfuscator.ObfuscationRun;
|
||||
@@ -33,6 +34,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.storage.SaveFormatComparator;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
@@ -297,6 +299,8 @@ public class NEIClientConfig {
|
||||
logger.error("Failed to Load " + clazz.getName(), e);
|
||||
}
|
||||
}
|
||||
|
||||
MinecraftForge.EVENT_BUS.post(new NEIConfigsLoadedEvent());
|
||||
}
|
||||
}.start();
|
||||
ItemSorter.loadConfig();
|
||||
|
||||
@@ -352,7 +352,6 @@ public class NEIClientUtils extends NEIServerUtils
|
||||
public static void setItemQuantity(int i) {
|
||||
world.nbt.setInteger("quantity", i);
|
||||
world.saveNBT();
|
||||
LayoutManager.quantity.setText(Integer.toString(i));
|
||||
}
|
||||
|
||||
public static GuiContainer getGuiContainer() {
|
||||
|
||||
@@ -6,8 +6,6 @@ import codechicken.nei.api.IConfigureNEI;
|
||||
import codechicken.nei.asm.NEICorePlugin;
|
||||
import codechicken.nei.config.IMCHandler;
|
||||
import codechicken.nei.recipe.GuiRecipeTab;
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.eventbus.EventBus;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import cpw.mods.fml.client.FMLFileResourcePack;
|
||||
@@ -26,7 +24,6 @@ import cpw.mods.fml.common.versioning.VersionRange;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@@ -102,24 +99,13 @@ public class NEIModContainer extends DummyModContainer
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
if (CommonUtils.isClient())
|
||||
GuiRecipeTab.loadHandlerInfo();
|
||||
handleIMCMessages();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void handleIMCMessages() {
|
||||
try {
|
||||
/* Pay no attention to these unholy hacks:
|
||||
* NEI Apparently doesn't have a registered mod container, so let's use some reflection to simulate what `fetchRuntimeMessages` does
|
||||
*/
|
||||
Field modMessagesField = FMLInterModComms.class.getDeclaredField("modMessages");
|
||||
modMessagesField.setAccessible(true);
|
||||
IMCHandler.processIMC(ImmutableList.copyOf(((ArrayListMultimap<String, FMLInterModComms.IMCMessage>)modMessagesField.get(FMLInterModComms.class)).removeAll("NotEnoughItems")));
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@Subscribe
|
||||
public void handleIMCMessages(FMLInterModComms.IMCEvent event) {
|
||||
IMCHandler.processIMC(event.getMessages());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public VersionRange acceptableMinecraftVersionRange() {
|
||||
return VersionParser.parseRange(CodeChickenCorePlugin.mcVersion);
|
||||
|
||||
@@ -22,8 +22,7 @@ public class PositionedStack
|
||||
|
||||
private boolean permutated = false;
|
||||
|
||||
public PositionedStack(Object object, int x, int y, boolean genPerms)
|
||||
{
|
||||
public PositionedStack(Object object, int x, int y, boolean genPerms) {
|
||||
items = NEIServerUtils.extractRecipeItems(object);
|
||||
relx = x;
|
||||
rely = y;
|
||||
@@ -39,27 +38,22 @@ public class PositionedStack
|
||||
this(object, x, y, true);
|
||||
}
|
||||
|
||||
public void generatePermutations()
|
||||
{
|
||||
public void generatePermutations() {
|
||||
if(permutated)
|
||||
return;
|
||||
|
||||
ArrayList<ItemStack> stacks = new ArrayList<>();
|
||||
for(ItemStack item : items)
|
||||
{
|
||||
for(ItemStack item : items) {
|
||||
if(item == null || item.getItem() == null)
|
||||
continue;
|
||||
|
||||
if(item.getItemDamage() == Short.MAX_VALUE)
|
||||
{
|
||||
if(item.getItemDamage() == Short.MAX_VALUE) {
|
||||
List<ItemStack> permutations = ItemList.itemMap.get(item.getItem());
|
||||
if(!permutations.isEmpty())
|
||||
{
|
||||
if(!permutations.isEmpty()) {
|
||||
for(ItemStack stack : permutations)
|
||||
stacks.add(stack.copy());
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
ItemStack base = new ItemStack(item.getItem(), item.stackSize);
|
||||
base.stackTagCompound = item.stackTagCompound;
|
||||
stacks.add(base);
|
||||
@@ -78,20 +72,17 @@ public class PositionedStack
|
||||
setPermutationToRender(0);
|
||||
}
|
||||
|
||||
public void setMaxSize(int i)
|
||||
{
|
||||
public void setMaxSize(int i) {
|
||||
for(ItemStack item : items)
|
||||
if(item.stackSize > i)
|
||||
item.stackSize = i;
|
||||
}
|
||||
|
||||
public PositionedStack copy()
|
||||
{
|
||||
public PositionedStack copy() {
|
||||
return new PositionedStack(items, relx, rely);
|
||||
}
|
||||
|
||||
public void setPermutationToRender(int index)
|
||||
{
|
||||
public void setPermutationToRender(int index) {
|
||||
item = items[index].copy();
|
||||
if(item.getItem() == null)
|
||||
item = new ItemStack(Blocks.fire);
|
||||
@@ -99,8 +90,7 @@ public class PositionedStack
|
||||
item.setItemDamage(0);
|
||||
}
|
||||
|
||||
public boolean contains(ItemStack ingredient)
|
||||
{
|
||||
public boolean contains(ItemStack ingredient) {
|
||||
for(ItemStack item : items)
|
||||
if(NEIServerUtils.areStacksSameTypeCrafting(item, ingredient))
|
||||
return true;
|
||||
@@ -108,12 +98,16 @@ public class PositionedStack
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean contains(Item ingred)
|
||||
{
|
||||
public boolean contains(Item ingred) {
|
||||
for(ItemStack item : items)
|
||||
if(item.getItem() == ingred)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PositionedStack(output='" + item.toString() + "')";
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,7 @@ public class SpawnerRenderer implements IItemRenderer
|
||||
|
||||
String bossName = BossStatus.bossName;
|
||||
int bossTimeout = BossStatus.statusBarTime;
|
||||
boolean bossHasColorModifier = BossStatus.hasColorModifier;
|
||||
try
|
||||
{
|
||||
World world = NEIClientUtils.mc().theWorld;
|
||||
@@ -66,6 +67,7 @@ public class SpawnerRenderer implements IItemRenderer
|
||||
}
|
||||
BossStatus.bossName = bossName;
|
||||
BossStatus.statusBarTime = bossTimeout;
|
||||
BossStatus.hasColorModifier = bossHasColorModifier;
|
||||
}
|
||||
|
||||
@SuppressWarnings("incomplete-switch")
|
||||
|
||||
@@ -79,6 +79,7 @@ public abstract class TextField extends Widget
|
||||
if (!focused())
|
||||
return false;
|
||||
|
||||
String oldText = text();
|
||||
boolean handled = field.textboxKeyTyped(keyChar, keyID);
|
||||
if(!handled) {
|
||||
if (keyID == Keyboard.KEY_RETURN || keyID == Keyboard.KEY_NUMPADENTER || keyID == Keyboard.KEY_ESCAPE) {
|
||||
@@ -88,7 +89,7 @@ public abstract class TextField extends Widget
|
||||
}
|
||||
|
||||
if(handled) {
|
||||
onTextChange(text());
|
||||
onTextChange(oldText);
|
||||
}
|
||||
|
||||
return handled;
|
||||
@@ -120,8 +121,10 @@ public abstract class TextField extends Widget
|
||||
if (focus) {
|
||||
previousKeyboardRepeatEnabled = Keyboard.areRepeatEventsEnabled();
|
||||
Keyboard.enableRepeatEvents(true);
|
||||
gainFocus();
|
||||
} else {
|
||||
Keyboard.enableRepeatEvents(previousKeyboardRepeatEnabled);
|
||||
loseFocus();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -55,8 +55,11 @@ public class ThreadOperationTimer extends Thread
|
||||
|
||||
while (thread.isAlive()) {
|
||||
synchronized (this) {
|
||||
if (operation != null && System.currentTimeMillis() - opTime > limit)
|
||||
thread.stop(new TimeoutException("Operation took too long", operation));
|
||||
if (operation != null && System.currentTimeMillis() - opTime > limit) {
|
||||
// Thread.stop(Throwable) is hard-deprecated and IntelliJ complains about it.
|
||||
//thread.stop(new TimeoutException("Operation took too long", operation));
|
||||
thread.stop();
|
||||
}
|
||||
}
|
||||
try {
|
||||
Thread.sleep(50);
|
||||
|
||||
@@ -36,7 +36,7 @@ public class HandlerDumper extends DataDumper
|
||||
public Iterable<String[]> dump(int mode) {
|
||||
LinkedList<String[]> list = new LinkedList<>();
|
||||
for (IRecipeHandler handler : GuiUsageRecipe.usagehandlers) {
|
||||
final String handlerName = handler.toString().split("@")[0];
|
||||
final String handlerName = handler.getHandlerId();
|
||||
final String handlerId = Objects.firstNonNull(handler instanceof TemplateRecipeHandler ? ((TemplateRecipeHandler)handler).getOverlayIdentifier() : null, "null");
|
||||
HandlerInfo info = GuiRecipeTab.getHandlerInfo(handlerName, handlerId);
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package codechicken.nei.config;
|
||||
|
||||
import codechicken.core.CommonUtils;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.recipe.GuiRecipeTab;
|
||||
import codechicken.nei.recipe.HandlerInfo;
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import java.util.List;
|
||||
@@ -17,69 +19,78 @@ public class IMCHandler {
|
||||
for (FMLInterModComms.IMCMessage message : messages) {
|
||||
String type = message.key;
|
||||
if (type == null || type.isEmpty()) continue;
|
||||
|
||||
if(type.equals("registerHandlerInfo")) {
|
||||
if (!message.isNBTMessage()) {
|
||||
logInvalidMessage(message, "NBT");
|
||||
continue;
|
||||
if (CommonUtils.isClient()) {
|
||||
if (type.equals("registerHandlerInfo")) {
|
||||
handleRegisterHandlerInfo(message);
|
||||
} else if (type.equals("removeHandlerInfo")) {
|
||||
handleRemoveHandlerInfo(message);
|
||||
}
|
||||
final NBTTagCompound tag = message.getNBTValue();
|
||||
final String handler = tag.getString("handler");
|
||||
NEIClientConfig.logger.info("Processing registerHandlerInfo `" + handler + "` from " + message.getSender());
|
||||
|
||||
final String modName = tag.getString("modName");
|
||||
final String modId = tag.getString("modId");
|
||||
final boolean requiresMod = tag.getBoolean("modRequired");
|
||||
final String excludedModId = tag.hasKey("excludedModId") ? tag.getString("excludedModId") : null;
|
||||
|
||||
if(handler.equals("") || modName.equals("") || modId.equals("")) {
|
||||
NEIClientConfig.logger.warn("Missing relevant information to registerHandlerInfo!");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (requiresMod && !Loader.isModLoaded(modId)) continue;
|
||||
if (excludedModId != null && Loader.isModLoaded(excludedModId)) continue;
|
||||
|
||||
HandlerInfo info = new HandlerInfo(handler, modName, modId, requiresMod, excludedModId);
|
||||
final String imageResource = tag.hasKey("imageResource") ? tag.getString("imageResource") : null;
|
||||
if(imageResource != null && !imageResource.equals("")) {
|
||||
info.setImage(imageResource, tag.getInteger("imageX"), tag.getInteger("imageY"), tag.getInteger("imageWidth"), tag.getInteger("imageHeight"));
|
||||
}
|
||||
if(!info.hasImageOrItem()) {
|
||||
final String itemName = tag.getString("itemName");
|
||||
if (itemName != null && !itemName.equals("")) {
|
||||
info.setItem(itemName, tag.hasKey("nbtInfo") ? tag.getString("nbtInfo") : null);
|
||||
}
|
||||
}
|
||||
final int yShift = tag.hasKey("yShift") ? tag.getInteger("yShift") : 0;
|
||||
info.setYShift(yShift);
|
||||
|
||||
try {
|
||||
final int imageHeight = tag.hasKey("handlerHeight") ? tag.getInteger("handlerHeight") : HandlerInfo.DEFAULT_HEIGHT;
|
||||
final int imageWidth = tag.hasKey("handlerWidth") ? tag.getInteger("handlerWidth") : HandlerInfo.DEFAULT_WIDTH;
|
||||
final int maxRecipesPerPage = tag.hasKey("maxRecipesPerPage") ? tag.getInteger("maxRecipesPerPage") : HandlerInfo.DEFAULT_MAX_PER_PAGE;
|
||||
info.setHandlerDimensions(imageHeight, imageWidth, maxRecipesPerPage);
|
||||
} catch (NumberFormatException ignored) {
|
||||
NEIClientConfig.logger.info("Error setting handler dimensions for " + handler);
|
||||
}
|
||||
|
||||
GuiRecipeTab.handlerMap.remove(handler);
|
||||
GuiRecipeTab.handlerMap.put(handler, info);
|
||||
} else if(type.equals("removeHandlerInfo")) {
|
||||
if (!message.isNBTMessage()) {
|
||||
logInvalidMessage(message, "NBT");
|
||||
continue;
|
||||
}
|
||||
final NBTTagCompound tag = message.getNBTValue();
|
||||
final String handler = tag.getString("handler");
|
||||
NEIClientConfig.logger.info("Processing removeHandlerInfo `" + handler + "` from " + message.getSender());
|
||||
|
||||
GuiRecipeTab.handlerMap.remove(handler);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private static void handleRegisterHandlerInfo(IMCMessage message) {
|
||||
if (!message.isNBTMessage()) {
|
||||
logInvalidMessage(message, "NBT");
|
||||
return;
|
||||
}
|
||||
final NBTTagCompound tag = message.getNBTValue();
|
||||
final String handler = tag.getString("handler");
|
||||
NEIClientConfig.logger.info("Processing registerHandlerInfo `" + handler + "` from " + message.getSender());
|
||||
|
||||
final String modName = tag.getString("modName");
|
||||
final String modId = tag.getString("modId");
|
||||
final boolean requiresMod = tag.getBoolean("modRequired");
|
||||
final String excludedModId = tag.hasKey("excludedModId") ? tag.getString("excludedModId") : null;
|
||||
|
||||
if(handler.equals("") || modName.equals("") || modId.equals("")) {
|
||||
NEIClientConfig.logger.warn("Missing relevant information to registerHandlerInfo!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (requiresMod && !Loader.isModLoaded(modId)) return;
|
||||
if (excludedModId != null && Loader.isModLoaded(excludedModId)) return;
|
||||
|
||||
HandlerInfo info = new HandlerInfo(handler, modName, modId, requiresMod, excludedModId);
|
||||
final String imageResource = tag.hasKey("imageResource") ? tag.getString("imageResource") : null;
|
||||
if(imageResource != null && !imageResource.equals("")) {
|
||||
info.setImage(imageResource, tag.getInteger("imageX"), tag.getInteger("imageY"), tag.getInteger("imageWidth"), tag.getInteger("imageHeight"));
|
||||
}
|
||||
if(!info.hasImageOrItem()) {
|
||||
final String itemName = tag.getString("itemName");
|
||||
if (itemName != null && !itemName.equals("")) {
|
||||
info.setItem(itemName, tag.hasKey("nbtInfo") ? tag.getString("nbtInfo") : null);
|
||||
}
|
||||
}
|
||||
final int yShift = tag.hasKey("yShift") ? tag.getInteger("yShift") : 0;
|
||||
info.setYShift(yShift);
|
||||
|
||||
try {
|
||||
final int imageHeight = tag.hasKey("handlerHeight") ? tag.getInteger("handlerHeight") : HandlerInfo.DEFAULT_HEIGHT;
|
||||
final int imageWidth = tag.hasKey("handlerWidth") ? tag.getInteger("handlerWidth") : HandlerInfo.DEFAULT_WIDTH;
|
||||
final int maxRecipesPerPage = tag.hasKey("maxRecipesPerPage") ? tag.getInteger("maxRecipesPerPage") : HandlerInfo.DEFAULT_MAX_PER_PAGE;
|
||||
info.setHandlerDimensions(imageHeight, imageWidth, maxRecipesPerPage);
|
||||
} catch (NumberFormatException ignored) {
|
||||
NEIClientConfig.logger.info("Error setting handler dimensions for " + handler);
|
||||
}
|
||||
|
||||
GuiRecipeTab.handlerAdderFromIMC.remove(handler);
|
||||
GuiRecipeTab.handlerAdderFromIMC.put(handler, info);
|
||||
}
|
||||
|
||||
private static void handleRemoveHandlerInfo(IMCMessage message) {
|
||||
if (!message.isNBTMessage()) {
|
||||
logInvalidMessage(message, "NBT");
|
||||
return;
|
||||
}
|
||||
final NBTTagCompound tag = message.getNBTValue();
|
||||
final String handler = tag.getString("handler");
|
||||
NEIClientConfig.logger.info("Processing removeHandlerInfo `" + handler + "` from " + message.getSender());
|
||||
|
||||
GuiRecipeTab.handlerRemoverFromIMC.add(handler);
|
||||
}
|
||||
|
||||
|
||||
private static void logInvalidMessage(FMLInterModComms.IMCMessage message, String type) {
|
||||
FMLLog.bigWarning(String.format("Received invalid IMC '%s' from %s. Not a %s Message.", message.key, message.getSender(), type));
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package codechicken.nei.event;
|
||||
|
||||
import codechicken.nei.api.IConfigureNEI;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
/**
|
||||
* Event is posted from <font color=red>NEI Plugin Loader Thread</font> after all {@link IConfigureNEI} were loaded.
|
||||
* <br>
|
||||
* This event does not have a result. {@link HasResult}<br>
|
||||
* <br>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
*/
|
||||
public class NEIConfigsLoadedEvent extends Event {
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package codechicken.nei.event;
|
||||
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.recipe.GuiRecipeTab;
|
||||
import codechicken.nei.recipe.HandlerInfo;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* Event is posted every time the handler infos got registered or reloaded.
|
||||
* During it, you can safely register your custom handler info.
|
||||
*
|
||||
* <br>
|
||||
* This event does not have a result. {@link HasResult}<br>
|
||||
* <br>
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
||||
*/
|
||||
public class NEIRegisterHandlerInfosEvent extends Event {
|
||||
public void registerHandlerInfo(String handlerName, String modName, String modId, Consumer<HandlerInfo.Builder> builder) {
|
||||
HandlerInfo.Builder b = new HandlerInfo.Builder(handlerName, modName, modId);
|
||||
builder.accept(b);
|
||||
HandlerInfo info = b.build();
|
||||
if (GuiRecipeTab.handlerMap.put(info.getHandlerName(), info) != null) {
|
||||
NEIClientConfig.logger.info("Replaced handler info for {}", info.getHandlerName());
|
||||
} else {
|
||||
NEIClientConfig.logger.info("Added handler info for {}", info.getHandlerName());
|
||||
}
|
||||
}
|
||||
|
||||
public void registerHandlerInfo(Class<? extends IRecipeHandler> handlerClazz, String modName, String modId, Consumer<HandlerInfo.Builder> builder) {
|
||||
registerHandlerInfo(handlerClazz.getName(), modName, modId, builder);
|
||||
}
|
||||
}
|
||||
@@ -54,12 +54,11 @@ public class GuiCraftingRecipe extends GuiRecipe
|
||||
}
|
||||
|
||||
public static void registerRecipeHandler(ICraftingHandler handler) {
|
||||
final Class<? extends ICraftingHandler> handlerClass = handler.getClass();
|
||||
if(craftinghandlers.stream().anyMatch(h -> h.getClass() == handlerClass) || serialCraftingHandlers.stream().anyMatch(h -> h.getClass() == handlerClass))
|
||||
final String handlerId = handler.getHandlerId();
|
||||
if(craftinghandlers.stream().anyMatch(h -> h.getHandlerId().equals(handlerId)) || serialCraftingHandlers.stream().anyMatch(h -> h.getHandlerId().equals(handlerId)))
|
||||
return;
|
||||
|
||||
final String handlerClassStr = handlerClass.getName();
|
||||
if(NEIClientConfig.serialHandlers.contains(handlerClassStr))
|
||||
if(NEIClientConfig.serialHandlers.contains(handlerId))
|
||||
serialCraftingHandlers.add(handler);
|
||||
else
|
||||
craftinghandlers.add(handler);
|
||||
|
||||
@@ -36,6 +36,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOverlay, IGuiClientSide, IGuiHandleMouseWheel, IContainerTooltipHandler, INEIGuiHandler {
|
||||
// Background image calculations
|
||||
@@ -172,6 +173,18 @@ public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOve
|
||||
initOverlayButtons();
|
||||
}
|
||||
|
||||
public IRecipeHandler getHandler() {
|
||||
return handler;
|
||||
}
|
||||
|
||||
public List<Integer> getRecipeIndices() {
|
||||
final int recipesPerPage = getRecipesPerPage();
|
||||
int minIndex = page * recipesPerPage;
|
||||
int maxIndex = Math.min(handler.numRecipes(), (page + 1) * recipesPerPage);
|
||||
|
||||
return IntStream.range(minIndex, maxIndex).boxed().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void keyTyped(char c, int i) {
|
||||
@@ -183,8 +196,7 @@ public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOve
|
||||
if (GuiContainerManager.getManager(this).lastKeyTyped(i, c))
|
||||
return;
|
||||
|
||||
final int recipesPerPage = getRecipesPerPage();
|
||||
for (int recipe = page * recipesPerPage; recipe < handler.numRecipes() && recipe < (page + 1) * recipesPerPage; recipe++)
|
||||
for (int recipe : getRecipeIndices())
|
||||
if (handler.keyTyped(this, c, i, recipe))
|
||||
return;
|
||||
|
||||
@@ -205,8 +217,7 @@ public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOve
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int x, int y, int button) {
|
||||
final int recipesPerPage = getRecipesPerPage();
|
||||
for (int recipe = page * recipesPerPage; recipe < handler.numRecipes() && recipe < (page + 1) * recipesPerPage; recipe++)
|
||||
for (int recipe : getRecipeIndices())
|
||||
if (handler.mouseClicked(this, button, recipe))
|
||||
return;
|
||||
if (recipeTabs.mouseClicked(x, y, button))
|
||||
@@ -214,10 +225,21 @@ public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOve
|
||||
super.mouseClicked(x, y, button);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseScrolled(int i) {
|
||||
for (int recipe : getRecipeIndices())
|
||||
if (handler.mouseScrolled(this, i, recipe))
|
||||
return;
|
||||
|
||||
if (new Rectangle(guiLeft, guiTop, xSize, ySize).contains(GuiDraw.getMousePosition())) {
|
||||
if (i > 0) prevPage();
|
||||
else nextPage();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
super.actionPerformed(guibutton);
|
||||
final int recipesPerPage = getRecipesPerPage();
|
||||
switch (guibutton.id) {
|
||||
case 0:
|
||||
prevType();
|
||||
@@ -233,7 +255,7 @@ public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOve
|
||||
return;
|
||||
}
|
||||
if (overlayButtons != null && guibutton.id >= OVERLAY_BUTTON_ID_START && guibutton.id < OVERLAY_BUTTON_ID_START + overlayButtons.length) {
|
||||
overlayRecipe(page * recipesPerPage + guibutton.id - OVERLAY_BUTTON_ID_START);
|
||||
overlayRecipe(page * getRecipesPerPage() + guibutton.id - OVERLAY_BUTTON_ID_START);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,8 +268,7 @@ public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOve
|
||||
|
||||
@Override
|
||||
public List<String> handleTooltip(GuiContainer gui, int mousex, int mousey, List<String> currenttip) {
|
||||
final int recipesPerPage = getRecipesPerPage();
|
||||
/*
|
||||
/*
|
||||
* Several mods try to figure out the relative mouse position for fluid tooltips. This worked fine
|
||||
* when it was a static 166.. however now that we're scaling it this no longer works. Rather than
|
||||
* patching the individual mods (so that we can be as compatible as possible), we'll just fake
|
||||
@@ -257,9 +278,8 @@ public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOve
|
||||
// Begin Hax
|
||||
final int oldHeight = this.height;
|
||||
this.height = 166 + handlerInfo.getHeight() + 18 + (guiTop - 44) * 2;
|
||||
for (int i = page * recipesPerPage; i < handler.numRecipes() && i < (page + 1) * recipesPerPage; i++) {
|
||||
for (int i : getRecipeIndices())
|
||||
currenttip = handler.handleTooltip(this, currenttip, i);
|
||||
}
|
||||
recipeTabs.handleTooltip(mousex, mousey, currenttip);
|
||||
this.height = oldHeight;
|
||||
// End Hax
|
||||
@@ -269,8 +289,7 @@ public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOve
|
||||
|
||||
@Override
|
||||
public List<String> handleItemTooltip(GuiContainer gui, ItemStack stack, int mousex, int mousey, List<String> currenttip) {
|
||||
final int recipesPerPage = getRecipesPerPage();
|
||||
for (int i = page * recipesPerPage; i < handler.numRecipes() && i < (page + 1) * recipesPerPage; i++)
|
||||
for (int i : getRecipeIndices())
|
||||
currenttip = handler.handleItemTooltip(this, stack, currenttip, i);
|
||||
|
||||
return currenttip;
|
||||
@@ -299,16 +318,14 @@ public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOve
|
||||
setRecipePage(--recipetype);
|
||||
}
|
||||
|
||||
|
||||
public HandlerInfo getHandlerInfo(IRecipeHandler handler) {
|
||||
final String handlerName = handler.toString().split("@")[0];
|
||||
final String handlerID;
|
||||
if(handler instanceof TemplateRecipeHandler) {
|
||||
handlerID = (((TemplateRecipeHandler)handler).getOverlayIdentifier());
|
||||
} else {
|
||||
handlerID = null;
|
||||
}
|
||||
HandlerInfo info = GuiRecipeTab.getHandlerInfo(handlerName, handlerID);
|
||||
HandlerInfo info = GuiRecipeTab.getHandlerInfo(handler.getHandlerId(), handlerID);
|
||||
|
||||
if (info == null)
|
||||
return GuiRecipeTab.DEFAULT_HANDLER_INFO;
|
||||
@@ -394,7 +411,7 @@ public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOve
|
||||
itemPresenceCacheSlots.clear();
|
||||
List<PositionedStack> ingredients = handler.getIngredientStacks(recipe);
|
||||
ArrayList<ItemStack> invStacks = ((List<Slot>) firstGui.inventorySlots.inventorySlots).stream()
|
||||
.filter(s -> s != null && s.getStack() != null && s.getStack().stackSize > 0 && s.isItemValid(s.getStack()))
|
||||
.filter(s -> s != null && s.getStack() != null && s.getStack().stackSize > 0 && s.isItemValid(s.getStack()) && s.canTakeStack(mc.thePlayer))
|
||||
.map(s -> s.getStack().copy())
|
||||
.collect(Collectors.toCollection(ArrayList::new));
|
||||
for (PositionedStack stack : ingredients) {
|
||||
@@ -534,14 +551,6 @@ public abstract class GuiRecipe extends GuiContainer implements IGuiContainerOve
|
||||
return new Point(5, 32 + yShift + ((recipe % getRecipesPerPage()) * handlerInfo.getHeight()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseScrolled(int i) {
|
||||
if (new Rectangle(guiLeft, guiTop, xSize, ySize).contains(GuiDraw.getMousePosition())) {
|
||||
if (i > 0) prevPage();
|
||||
else nextPage();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract ArrayList<? extends IRecipeHandler> getCurrentRecipeHandlers();
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,20 +5,22 @@ import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.Widget;
|
||||
import codechicken.nei.drawable.DrawableResource;
|
||||
import codechicken.nei.event.NEIRegisterHandlerInfosEvent;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import org.apache.commons.csv.CSVFormat;
|
||||
import org.apache.commons.csv.CSVParser;
|
||||
import org.apache.commons.csv.CSVRecord;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
@@ -27,12 +29,13 @@ import java.net.URL;
|
||||
import java.nio.channels.Channels;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.nio.channels.ReadableByteChannel;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
public abstract class GuiRecipeTab extends Widget {
|
||||
public static HandlerInfo DEFAULT_HANDLER_INFO = getDefaultHandlerInfo();
|
||||
public static HashMap<String, HandlerInfo> handlerMap = new HashMap<>();
|
||||
public static HashMap<String, HandlerInfo> handlerAdderFromIMC = new HashMap<>();
|
||||
public static Set<String> handlerRemoverFromIMC = new HashSet<>();
|
||||
|
||||
private final GuiRecipe guiRecipe;
|
||||
private final IRecipeHandler handler;
|
||||
@@ -58,7 +61,7 @@ public abstract class GuiRecipeTab extends Widget {
|
||||
this.w = getWidth();
|
||||
this.h = getHeight();
|
||||
this.handler = handler;
|
||||
this.handlerName = handler.toString().split("@")[0];
|
||||
this.handlerName = handler.getHandlerId();
|
||||
this.guiRecipe = guiRecipe;
|
||||
this.selected = false;
|
||||
|
||||
@@ -100,9 +103,13 @@ public abstract class GuiRecipeTab extends Widget {
|
||||
if (icon != null) {
|
||||
icon.draw(iconX + 1, iconY + 1);
|
||||
} else if (itemStack != null) {
|
||||
boolean isEnabled = GL11.glIsEnabled(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GuiContainerManager.drawItems.zLevel += 100;
|
||||
GuiContainerManager.drawItem(iconX, iconY, itemStack);
|
||||
GuiContainerManager.drawItems.zLevel -= 100;
|
||||
if (!isEnabled)
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
} else {
|
||||
// Text fallback
|
||||
String text = handler.getRecipeName();
|
||||
@@ -171,7 +178,7 @@ public abstract class GuiRecipeTab extends Widget {
|
||||
NEIClientConfig.logger.info("Loading handler info from " + (fromJar ? "JAR" : "Config"));
|
||||
handlerMap.clear();
|
||||
URL handlerUrl = Thread.currentThread().getContextClassLoader().getResource("assets/nei/csv/handlers.csv");
|
||||
|
||||
|
||||
URL url;
|
||||
if (fromJar) {
|
||||
url = handlerUrl;
|
||||
@@ -254,9 +261,13 @@ public abstract class GuiRecipeTab extends Widget {
|
||||
} catch (Exception e) {
|
||||
NEIClientConfig.logger.info("Error parsing CSV");
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
handlerMap.keySet().removeAll(handlerRemoverFromIMC);
|
||||
handlerMap.putAll(handlerAdderFromIMC);
|
||||
|
||||
NEIClientConfig.logger.info("Sending {}", NEIRegisterHandlerInfosEvent.class.getSimpleName());
|
||||
MinecraftForge.EVENT_BUS.post(new NEIRegisterHandlerInfosEvent());
|
||||
}
|
||||
|
||||
private static HandlerInfo getDefaultHandlerInfo() {
|
||||
|
||||
@@ -54,12 +54,11 @@ public class GuiUsageRecipe extends GuiRecipe
|
||||
}
|
||||
|
||||
public static void registerUsageHandler(IUsageHandler handler) {
|
||||
final Class<? extends IUsageHandler> handlerClass = handler.getClass();
|
||||
if(usagehandlers.stream().anyMatch(h -> h.getClass() == handlerClass) || serialUsageHandlers.stream().anyMatch(h -> h.getClass() == handlerClass))
|
||||
final String handlerId = handler.getHandlerId();
|
||||
if(usagehandlers.stream().anyMatch(h -> h.getHandlerId().equals(handlerId)) || serialUsageHandlers.stream().anyMatch(h -> h.getHandlerId().equals(handlerId)))
|
||||
return;
|
||||
|
||||
final String handlerClassStr = handlerClass.getName();
|
||||
if(NEIClientConfig.serialHandlers.contains(handlerClassStr))
|
||||
if(NEIClientConfig.serialHandlers.contains(handlerId))
|
||||
serialUsageHandlers.add(handler);
|
||||
else
|
||||
usagehandlers.add(handler);
|
||||
|
||||
@@ -10,6 +10,7 @@ import net.minecraft.nbt.JsonToNBT;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTException;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
public class HandlerInfo {
|
||||
@@ -17,11 +18,11 @@ public class HandlerInfo {
|
||||
public static int DEFAULT_WIDTH = 166;
|
||||
public static int DEFAULT_MAX_PER_PAGE = 2;
|
||||
|
||||
private String handler;
|
||||
private String handlerName;
|
||||
|
||||
private String modName;
|
||||
private String modId;
|
||||
private boolean requiresMod = true;
|
||||
private boolean requiresMod;
|
||||
private String excludedModId;
|
||||
|
||||
private String itemId;
|
||||
@@ -35,8 +36,8 @@ public class HandlerInfo {
|
||||
private ItemStack itemStack = null;
|
||||
private DrawableResource image = null;
|
||||
|
||||
public HandlerInfo(String handler, String modName, String modId, boolean requiresMod, String excludedModId) {
|
||||
this.handler = handler;
|
||||
public HandlerInfo(String handlerName, String modName, String modId, boolean requiresMod, String excludedModId) {
|
||||
this.handlerName = handlerName;
|
||||
this.modName = modName;
|
||||
this.modId = modId;
|
||||
this.requiresMod = requiresMod;
|
||||
@@ -55,7 +56,7 @@ public class HandlerInfo {
|
||||
|
||||
int meta = -1;
|
||||
if (!itemId.contains(":")) {
|
||||
NEIClientConfig.logger.info("Item ID missing colon for handler " + handler + " - " + modName);
|
||||
NEIClientConfig.logger.info("Item ID missing colon for handler " + handlerName + " - " + modName);
|
||||
return false;
|
||||
}
|
||||
final String[] split = itemId.split(":");
|
||||
@@ -125,7 +126,6 @@ public class HandlerInfo {
|
||||
return modId;
|
||||
}
|
||||
|
||||
|
||||
public int getHeight() {
|
||||
return height;
|
||||
}
|
||||
@@ -142,6 +142,10 @@ public class HandlerInfo {
|
||||
return yShift;
|
||||
}
|
||||
|
||||
public String getHandlerName() {
|
||||
return handlerName;
|
||||
}
|
||||
|
||||
public boolean hasImageOrItem() {
|
||||
if (image != null) return true;
|
||||
if (itemStack != null) return true;
|
||||
@@ -149,8 +153,56 @@ public class HandlerInfo {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public void setYShift(int yShift) {
|
||||
this.yShift = yShift;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private final HandlerInfo info;
|
||||
|
||||
public Builder(String handlerName, String modName, String modId) {
|
||||
this.info = new HandlerInfo(handlerName, modName, modId, true, null);
|
||||
setMaxRecipesPerPage(Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
public Builder(Class<? extends IRecipeHandler> handlerClazz, String modName, String modId) {
|
||||
this(handlerClazz.getName(), modName, modId);
|
||||
}
|
||||
|
||||
public Builder setDisplayStack(ItemStack stack) {
|
||||
info.image = null;
|
||||
info.itemStack = stack;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setDisplayImage(ResourceLocation location, int imageX, int imageY, int imageWidth, int imageHeight) {
|
||||
info.itemStack = null;
|
||||
info.setImage(location.toString(), imageX, imageY, imageWidth, imageHeight);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setShiftY(int shiftY) {
|
||||
info.setYShift(shiftY);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setWidth(int width) {
|
||||
info.setHandlerDimensions(info.height, width, info.maxRecipesPerPage);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setHeight(int height) {
|
||||
info.setHandlerDimensions(height, info.width, info.maxRecipesPerPage);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setMaxRecipesPerPage(int maxRecipesPerPage) {
|
||||
info.setHandlerDimensions(info.height, info.width, maxRecipesPerPage);
|
||||
return this;
|
||||
}
|
||||
|
||||
public HandlerInfo build() {
|
||||
return info;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,15 @@ import java.util.List;
|
||||
*/
|
||||
public interface IRecipeHandler
|
||||
{
|
||||
/**
|
||||
* For legacy compatibility reasons, this method's default implementation returns the class name.
|
||||
*
|
||||
* @return A unique identifier for this handler, used for finding duplicate handlers as well as GUI tab {@link HandlerInfo}.
|
||||
*/
|
||||
default String getHandlerId() {
|
||||
return getClass().getName();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return The name of this inventory.
|
||||
@@ -111,6 +120,7 @@ public interface IRecipeHandler
|
||||
* @return true to terminate further processing of this event.
|
||||
*/
|
||||
public boolean keyTyped(GuiRecipe gui, char keyChar, int keyCode, int recipe);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param gui An instance of the currentscreen
|
||||
@@ -118,4 +128,15 @@ public interface IRecipeHandler
|
||||
* @return true to terminate further processing of this event.
|
||||
*/
|
||||
public boolean mouseClicked(GuiRecipe gui, int button, int recipe);
|
||||
|
||||
/**
|
||||
* For legacy compatibility reasons, this method has a do-nothing default implementation.
|
||||
*
|
||||
* @param gui An instance of the currentscreen
|
||||
* @param scroll The scroll direction, {> 0 = Up, < 0 = Down}
|
||||
* @return true to terminate further processing of this event.
|
||||
*/
|
||||
default boolean mouseScrolled(GuiRecipe gui, int scroll, int recipe) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -16,13 +16,13 @@ public class RecipeItemInputHandler implements IContainerInputHandler
|
||||
ItemStack stackover = GuiContainerManager.getStackMouseOver(gui);
|
||||
if(stackover == null)
|
||||
return false;
|
||||
|
||||
if(keyCode == NEIClientConfig.getKeyBinding("gui.usage") || (keyCode == NEIClientConfig.getKeyBinding("gui.recipe") && NEIClientUtils.shiftKey()))
|
||||
return GuiUsageRecipe.openRecipeGui("item", stackover.copy());
|
||||
|
||||
|
||||
if(keyCode == NEIClientConfig.getKeyBinding("gui.recipe"))
|
||||
return GuiCraftingRecipe.openRecipeGui("item", stackover.copy());
|
||||
|
||||
if(keyCode == NEIClientConfig.getKeyBinding("gui.usage"))
|
||||
return GuiUsageRecipe.openRecipeGui("item", stackover.copy());
|
||||
|
||||
if(keyCode == NEIClientConfig.getKeyBinding("gui.bookmark")) {
|
||||
NEIClientConfig.logger.debug("Adding or removing {} from bookmarks", stackover.getDisplayName());
|
||||
ItemPanels.bookmarkPanel.addOrRemoveItem(stackover.copy());
|
||||
|
||||
@@ -639,6 +639,11 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseScrolled(GuiRecipe gui, int scroll, int recipe) {
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean transferRect(GuiRecipe gui, int recipe, boolean usage) {
|
||||
Point offset = gui.getRecipePosition(recipe);
|
||||
return transferRect(gui, transferRects, offset.x, offset.y, usage);
|
||||
|
||||
Reference in new issue
Block a user