From 269c73f34f849b97c721773d53a97724a902ba3c Mon Sep 17 00:00:00 2001 From: mezz Date: Wed, 9 Dec 2015 12:58:41 -0800 Subject: [PATCH 1/9] Remove misc forge MDK txt files --- LICENSE-fml.txt | 491 ------------------------------------- MinecraftForge-Credits.txt | 26 -- MinecraftForge-License.txt | 70 ------ 3 files changed, 587 deletions(-) delete mode 100644 LICENSE-fml.txt delete mode 100644 MinecraftForge-Credits.txt delete mode 100644 MinecraftForge-License.txt diff --git a/LICENSE-fml.txt b/LICENSE-fml.txt deleted file mode 100644 index 26cca072e..000000000 --- a/LICENSE-fml.txt +++ /dev/null @@ -1,491 +0,0 @@ -This minecraft mod, Forge Mod Loader, including all parts herein except as noted below, -is licensed under the GNU LGPL v2.1 or later. - -Homepage: https://github.com/MinecraftForge/FML - -This software includes portions from the Apache Maven project at -http://maven.apache.org/ specifically the ComparableVersion.java code. It is -included based on guidelines at -http://www.softwarefreedom.org/resources/2007/gpl-non-gpl-collaboration.html -with notices intact. The only change is a non-functional change of package name. - -This software contains a partial repackaging of javaxdelta, a BSD licensed program for generating -binary differences and applying them, sourced from the subversion at http://sourceforge.net/projects/javaxdelta/ -authored by genman, heikok, pivot. -The only changes are to replace some Trove collection types with standard Java collections, and repackaged. - - -=== MCP Data === -This software includes data from the Minecraft Coder Pack (MCP), with kind permission -from them. The license to MCP data is not transitive - distribution of this data by -third parties requires independent licensing from the MCP team. This data is not -redistributable without permission from the MCP team. - -=== Sharing === -I grant permission for some parts of FML to be redistributed outside the terms of the LGPL, for the benefit of -the minecraft modding community. All contributions to these parts should be licensed under the same additional grant. - --- Runtime patcher -- -License is granted to redistribute the runtime patcher code (common/cpw/mods/fml/patcher and subdirectories) under -any alternative open source license as classified by the OSI (http://opensource.org/licenses) - --- ASM transformers -- -License is granted to redistribute the ASM transformer code (common/cpw/mods/fml/common/asm/ and subdirectories) -under any alternative open source license as classified by the OSI (http://opensource.org/licenses) - -======== - - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS diff --git a/MinecraftForge-Credits.txt b/MinecraftForge-Credits.txt deleted file mode 100644 index d0de5a521..000000000 --- a/MinecraftForge-Credits.txt +++ /dev/null @@ -1,26 +0,0 @@ -* Eloraam * - -* FlowerChild * - -* Hawkye * - -* MALfunction84 * - -Submitted the sleep handler code for his mod (Somnia) and others to use. - -* Scokeev9 * - -Gave permission for ScotTools API to be integrated into MCF, and also supported the Forge by converting his mods to use it. - -ScotTools Background: ScotTools was an API that enabled modders to add blocks to harvesting levels (and many other ease-of-use features to create new tools), and the first tool API that used block material for block breaking efficiency which allowed blocks from mods that didn't use ScotTools API to break with the correct speed. - -* SpaceToad * - -* LexManos * - -* cpw * - -* Minecraft Coder Pack (MCP) * -Forge Mod Loader and Minecraft Forge have permission to distribute and automatically download components of MCP and distribute MCP data files. -This permission is not transitive and others wishing to redistribute the Minecraft Forge source independently should seek permission of MCP or -remove the MCP data files and request their users to download MCP separately. diff --git a/MinecraftForge-License.txt b/MinecraftForge-License.txt deleted file mode 100644 index 1cc2a3e9d..000000000 --- a/MinecraftForge-License.txt +++ /dev/null @@ -1,70 +0,0 @@ -Minecraft Forge Public Licence -============================== - -Version 1.0 - -0. Definitions --------------- - -Minecraft: Denotes a copy of the Minecraft game licensed by Mojang AB - -User: Anybody that interract with the software in one of the following ways: - - play - - decompile - - recompile or compile - - modify - -Minecraft Forge: The Minecraft Forge code, in source form, class file form, as -obtained in a standalone fashion or as part of a wider distribution. - -Dependency: Code required to have Minecraft Forge working properly. That can -include dependencies required to compile the code as well as modifications in -the Minecraft sources that are required to have Minecraft Forge working. - -1. Scope --------- - -The present license is granted to any user of Minecraft Forge, for all files included -unless stated otherwise in the file itself. As a prerequisite, a user of Minecraft -Forge must own a legally aquired copy of Minecraft. - -2. Play rights --------------- - -The user of Minecraft Forge is allowed to install the software on a client or -a server and to play it without restriction. - -3. Modification rights ----------------------- - -The user has the right to decompile the source code, look at either the -decompiled version or the original source code, and to modify it. - -4. Derivation rights --------------------- - -The user has the rights to derive code from Minecraft Forge, that is to say to -write code that either extends Minecraft Forge class and interfaces, -instantiate the objects declared or calls the functions. This code is known as -"derived" code, and can be licensed with conditions different from Minecraft -Forge. - - -5. Distribution rights ----------------------- - -The user of Minecraft Forge is allowed to redistribute Minecraft Forge in -partially, in totallity, or included in a distribution. When distributing -binaries or class files, the user must provide means to obtain the sources of -the distributed version of Minecraft Forge at no costs. This includes the -files as well as any dependency that the code may rely on, including patches to -minecraft original sources. - -Modification of Minecraft Forge as well as dependencies, including patches to -minecraft original sources, has to remain under the terms of the present -license. - -The right to distribute Minecraft Forge does not extend to the right to distribute -MCP data files included within Minecraft Forge. These are the property of the MCP -project and should be removed from any customized distribution of Minecraft Forge -or permission sought separately from the MCP team. From 65316338e808e431f3a12b0dce027e2a9467f3cf Mon Sep 17 00:00:00 2001 From: "Urey.X" Date: Wed, 9 Dec 2015 16:39:58 -0500 Subject: [PATCH 2/9] Update zh_CN.lang --- src/main/resources/assets/jei/lang/zh_CN.lang | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/main/resources/assets/jei/lang/zh_CN.lang b/src/main/resources/assets/jei/lang/zh_CN.lang index c790273ac..3b96aea08 100644 --- a/src/main/resources/assets/jei/lang/zh_CN.lang +++ b/src/main/resources/assets/jei/lang/zh_CN.lang @@ -5,8 +5,36 @@ jei.button.back=返回 # Key Bindings key.jei.toggleOverlay=切换物品列表叠层 key.jei.showRecipe=显示物品合成表 -key.jei.showUses=显示物品可参与合成表 +key.jei.showUses=显示物品用途 # Config config.jei.cheatItemsEnabled=开启物品作弊模式 config.jei.cheatItemsEnabled.description=/给予物品而非显示其合成表 +config.jei.editEnabled=开启物品编辑模式 +config.jei.editEnabled.description=在列表中点击物品以隐藏或取消隐藏 + +config.jei.tooltipModName=工具提示(Tooltip)中显示所属模组 +config.jei.tooltipModName.description=在物品的工具提示中显示其所属的模组名 + +config.jei.nbtKeyIgnoreList=NBT关键字忽略列表 +config.jei.nbtKeyIgnoreList.description=过滤可用合成时,该表所含的NBT关键字将忽略不计。 +config.jei.itemBlacklist=物品黑名单 +config.jei.itemBlacklist.description=该表中物品将不会显示于JEI物品列表。添加格式: modId:name[:meta]。使用编辑模式可自动添加�或删除这里的条目。 + +# Edit Mode +gui.jei.editMode.description=JEI物品列表编辑模式: +gui.jei.editMode.description.hide=按住Ctrl点击以隐藏 +gui.jei.editMode.description.show=已隐藏。按住Ctrl点击以显示。 +gui.jei.editMode.description.hide.wild=按住Ctrl右击以隐藏相同id的物品 +gui.jei.editMode.description.show.wild=相同id物品以隐藏。按住Ctrl右击以显示。 + +# Recipes +gui.jei.craftingTableRecipes=工作台合成 +gui.jei.smeltingRecipes=烧炼 +gui.jei.fuelRecipes=燃料 +gui.jei.furnaceExperience=%s点经验 +gui.jei.furnaceBurnTime=燃烧时间:%s +gui.jei.brewingRecipes=酿造配方 +gui.jei.brewingRecipes.steps=步数:%s +gui.jei.forestry.centrifugeRecipes=林业离心机 +gui.jei.forestry.fabricatorRecipes=林业热电子加工台 From 3bded014e1e4c25ea3d8ee7af8b956b194396940 Mon Sep 17 00:00:00 2001 From: mezz Date: Wed, 9 Dec 2015 23:26:08 -0800 Subject: [PATCH 3/9] Add config button to GUI, improve config, improve localization fallback # Conflicts: # src/main/resources/assets/jei/lang/zh_CN.lang --- src/main/java/mezz/jei/GuiEventHandler.java | 3 + src/main/java/mezz/jei/config/Config.java | 32 ++-- .../java/mezz/jei/config/JEIModConfigGui.java | 32 +++- .../jei/config/LocalizedConfiguration.java | 144 ++++++++++++++++++ src/main/java/mezz/jei/gui/GuiHelper.java | 2 +- .../java/mezz/jei/gui/IRecipeGuiLogic.java | 3 + .../java/mezz/jei/gui/ItemListOverlay.java | 37 ++++- .../java/mezz/jei/gui/RecipeGuiLogic.java | 8 + src/main/java/mezz/jei/gui/RecipesGui.java | 15 +- .../java/mezz/jei/gui/TooltipRenderer.java | 11 ++ .../gui/ingredients/ItemStackRenderer.java | 12 +- .../brewing/BrewingRecipeCategory.java | 6 +- .../vanilla/brewing/BrewingRecipeWrapper.java | 4 +- .../crafting/CraftingRecipeCategory.java | 6 +- .../plugins/vanilla/furnace/FuelRecipe.java | 4 +- .../vanilla/furnace/FurnaceFuelCategory.java | 6 +- .../furnace/FurnaceSmeltingCategory.java | 6 +- .../vanilla/furnace/SmeltingRecipe.java | 4 +- src/main/java/mezz/jei/util/Translator.java | 24 +++ src/main/resources/assets/jei/lang/de_DE.lang | 4 +- src/main/resources/assets/jei/lang/en_US.lang | 35 +++-- src/main/resources/assets/jei/lang/fi_FI.lang | 8 +- src/main/resources/assets/jei/lang/ko_KR.lang | 4 +- src/main/resources/assets/jei/lang/ru_RU.lang | 20 +-- src/main/resources/assets/jei/lang/zh_CN.lang | 20 +-- .../jei/textures/gui/recipeBackground.png | Bin 271 -> 364 bytes 26 files changed, 358 insertions(+), 92 deletions(-) create mode 100644 src/main/java/mezz/jei/config/LocalizedConfiguration.java create mode 100644 src/main/java/mezz/jei/util/Translator.java diff --git a/src/main/java/mezz/jei/GuiEventHandler.java b/src/main/java/mezz/jei/GuiEventHandler.java index 59705abad..42a4138a7 100644 --- a/src/main/java/mezz/jei/GuiEventHandler.java +++ b/src/main/java/mezz/jei/GuiEventHandler.java @@ -140,6 +140,9 @@ public void onGuiKeyboardEvent(GuiScreenEvent.KeyboardInputEvent.Pre event) { @SubscribeEvent public void onGuiMouseEvent(GuiScreenEvent.MouseInputEvent.Pre event) { GuiScreen gui = event.gui; + if (!(gui instanceof GuiContainer)) { + return; + } if (inputHandler != null) { int x = Mouse.getEventX() * gui.width / gui.mc.displayWidth; int y = gui.height - Mouse.getEventY() * gui.height / gui.mc.displayHeight - 1; diff --git a/src/main/java/mezz/jei/config/Config.java b/src/main/java/mezz/jei/config/Config.java index fe5235b96..cf0bbec56 100644 --- a/src/main/java/mezz/jei/config/Config.java +++ b/src/main/java/mezz/jei/config/Config.java @@ -6,20 +6,18 @@ import java.util.Set; import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; -import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import mezz.jei.util.StackUtil; public class Config { - public static Configuration configFile; + public static LocalizedConfiguration configFile; - public static final String categoryMode = Configuration.CATEGORY_GENERAL + ".mode"; - public static final String categoryInterface = Configuration.CATEGORY_GENERAL + ".interface"; - public static final String categoryAdvanced = Configuration.CATEGORY_GENERAL + ".zz_advanced"; + public static final String categoryMode = "mode"; + public static final String categoryInterface = "interface"; + public static final String categoryAdvanced = "advanced"; public static boolean cheatItemsEnabled = false; public static boolean editModeEnabled = false; @@ -31,28 +29,26 @@ public class Config { public static final String[] defaultNbtKeyIgnoreList = new String[]{"BlockEntityTag", "CanPlaceOn"}; public static void preInit(@Nonnull FMLPreInitializationEvent event) { - configFile = new Configuration(event.getSuggestedConfigurationFile()); + configFile = new LocalizedConfiguration("config.jei", event.getSuggestedConfigurationFile(), "0.1.0"); syncConfig(); } public static void syncConfig() { - String cheatItemsEnabledDescription = StatCollector.translateToLocal("config.jei.cheatItemsEnabled.description"); - cheatItemsEnabled = configFile.getBoolean("cheatItemsEnabled", categoryMode, cheatItemsEnabled, cheatItemsEnabledDescription, "config.jei.cheatItemsEnabled"); + configFile.addCategory(categoryMode); + configFile.addCategory(categoryInterface); + configFile.addCategory(categoryAdvanced); - String editModeEnabledDescription = StatCollector.translateToLocal("config.jei.editEnabled.description"); - editModeEnabled = configFile.getBoolean("editEnabled", categoryMode, editModeEnabled, editModeEnabledDescription, "config.jei.editEnabled"); + cheatItemsEnabled = configFile.getBoolean(categoryMode, "cheatItemsEnabled", cheatItemsEnabled); + editModeEnabled = configFile.getBoolean(categoryMode, "editEnabled", editModeEnabled); - String tooltipModNameEnabledDescription = StatCollector.translateToLocal("config.jei.tooltipModName.description"); - tooltipModNameEnabled = configFile.getBoolean("tooltipModName", categoryInterface, tooltipModNameEnabled, tooltipModNameEnabledDescription, "config.jei.tooltipModName"); + tooltipModNameEnabled = configFile.getBoolean(categoryInterface, "tooltipModName", tooltipModNameEnabled); - String nbtKeyIgnoreListDescription = StatCollector.translateToLocal("config.jei.nbtKeyIgnoreList.description"); - String[] nbtKeyIgnoreListArray = configFile.getStringList("nbtKeyIgnoreList", categoryAdvanced, defaultNbtKeyIgnoreList, nbtKeyIgnoreListDescription, null, "config.jei.nbtKeyIgnoreList"); + String[] nbtKeyIgnoreListArray = configFile.getStringList("nbtKeyIgnoreList", categoryAdvanced, defaultNbtKeyIgnoreList); nbtKeyIgnoreList.clear(); Collections.addAll(nbtKeyIgnoreList, nbtKeyIgnoreListArray); - String itemBlacklistDescription = StatCollector.translateToLocal("config.jei.itemBlacklist.description"); - String[] itemBlacklistArray = configFile.getStringList("itemBlacklist", categoryAdvanced, defaultItemBlacklist, itemBlacklistDescription, null, "config.jei.itemBlacklist"); + String[] itemBlacklistArray = configFile.getStringList("itemBlacklist", categoryAdvanced, defaultItemBlacklist); itemBlacklist.clear(); Collections.addAll(itemBlacklist, itemBlacklistArray); @@ -62,7 +58,7 @@ public static void syncConfig() { } private static void updateBlacklist() { - Property property = configFile.get(categoryAdvanced, "itemBlacklist", defaultItemBlacklist); + Property property = configFile.getConfiguration().get(categoryAdvanced, "itemBlacklist", defaultItemBlacklist); String[] currentBlacklist = itemBlacklist.toArray(new String[itemBlacklist.size()]); property.set(currentBlacklist); diff --git a/src/main/java/mezz/jei/config/JEIModConfigGui.java b/src/main/java/mezz/jei/config/JEIModConfigGui.java index d9b19b3b8..1bca76bc6 100644 --- a/src/main/java/mezz/jei/config/JEIModConfigGui.java +++ b/src/main/java/mezz/jei/config/JEIModConfigGui.java @@ -1,17 +1,41 @@ package mezz.jei.config; +import java.util.ArrayList; +import java.util.List; + import net.minecraft.client.gui.GuiScreen; +import net.minecraftforge.common.config.ConfigCategory; import net.minecraftforge.common.config.ConfigElement; -import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.fml.client.GuiModList; import net.minecraftforge.fml.client.config.GuiConfig; +import net.minecraftforge.fml.client.config.IConfigElement; + +import mezz.jei.util.Translator; public class JEIModConfigGui extends GuiConfig { public JEIModConfigGui(GuiScreen parent) { - super(parent, - new ConfigElement(Config.configFile.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(), - Constants.MOD_ID, false, false, GuiConfig.getAbridgedConfigPath(Config.configFile.toString())); + super(parent, getConfigElements(), Constants.MOD_ID, false, false, getTitle(parent)); } + private static List getConfigElements() { + ConfigCategory categoryAdvanced = Config.configFile.getCategory(Config.categoryAdvanced); + ConfigCategory categoryInterface = Config.configFile.getCategory(Config.categoryInterface); + ConfigCategory categoryMode = Config.configFile.getCategory(Config.categoryMode); + + List configElements = new ArrayList<>(); + configElements.addAll(new ConfigElement(categoryMode).getChildElements()); + configElements.addAll(new ConfigElement(categoryInterface).getChildElements()); + configElements.add(new ConfigElement(categoryAdvanced)); + + return configElements; + } + + private static String getTitle(GuiScreen parent) { + if (parent instanceof GuiModList) { + return GuiConfig.getAbridgedConfigPath(Config.configFile.toString()); + } + return Translator.translateToLocal("config.jei.title").replace("%MODNAME", Constants.NAME); + } } diff --git a/src/main/java/mezz/jei/config/LocalizedConfiguration.java b/src/main/java/mezz/jei/config/LocalizedConfiguration.java new file mode 100644 index 000000000..051b44bb2 --- /dev/null +++ b/src/main/java/mezz/jei/config/LocalizedConfiguration.java @@ -0,0 +1,144 @@ +package mezz.jei.config; + +import java.io.File; +import java.util.Arrays; + +import net.minecraftforge.common.config.ConfigCategory; +import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.common.config.Property; + +import mezz.jei.util.Translator; + +public class LocalizedConfiguration { + private static final String commentPostfix = ".comment"; + private final String keyPrefix; + private final String defaultLocalized; + private final String validLocalized; + private final Configuration configuration; + + public LocalizedConfiguration(String keyPrefix, File file, String configVersion) { + this.configuration = new Configuration(file, configVersion); + this.keyPrefix = keyPrefix + '.'; + this.defaultLocalized = Translator.translateToLocal(this.keyPrefix + "default"); + this.validLocalized = Translator.translateToLocal(this.keyPrefix + "valid"); + } + + public void addCategory(String categoryName) { + String categoryKey = keyPrefix + categoryName; + String commentKey = categoryKey + commentPostfix; + String comment = Translator.translateToLocal(commentKey); + configuration.setCategoryComment(categoryName, comment); + configuration.setCategoryLanguageKey(categoryName, categoryKey); + } + + public ConfigCategory getCategory(String categoryName) { + return configuration.getCategory(categoryName); + } + + public boolean getBoolean(String category, String name, boolean defaultValue) { + String langKey = keyPrefix + category + '.' + name; + String commentKey = langKey + commentPostfix; + String comment = Translator.translateToLocal(commentKey); + return configuration.getBoolean(name, category, defaultValue, comment, langKey); + } + + public String getString(String name, String category, String defaultValue) { + String langKey = keyPrefix + category + '.' + name; + String commentKey = langKey + commentPostfix; + String comment = Translator.translateToLocal(commentKey); + return configuration.getString(name, category, defaultValue, comment, langKey); + } + + public String getString(String name, String category, String defaultValue, String[] validValues) { + String langKey = keyPrefix + category + '.' + name; + String commentKey = langKey + commentPostfix; + String comment = Translator.translateToLocal(commentKey); + + Property prop = configuration.get(category, name, defaultValue); + prop.setValidValues(validValues); + prop.setLanguageKey(langKey); + prop.comment = comment + " [" + defaultLocalized + ": " + defaultValue + "] [" + validLocalized + ": " + Arrays.toString(prop.getValidValues()) + ']'; + return prop.getString(); + } + + public > T getEnum(String name, String category, T defaultValue, T[] validEnumValues) { + String langKey = keyPrefix + category + '.' + name; + String commentKey = langKey + commentPostfix; + String comment = Translator.translateToLocal(commentKey); + Property prop = configuration.get(category, name, defaultValue.name()); + + String[] validValues = new String[validEnumValues.length]; + for (int i = 0; i < validEnumValues.length; i++) { + T enumValue = validEnumValues[i]; + validValues[i] = enumValue.name(); + } + + prop.setValidValues(validValues); + prop.setLanguageKey(langKey); + prop.comment = comment + " [" + defaultLocalized + ": " + defaultValue + "] [" + validLocalized + ": " + Arrays.toString(prop.getValidValues()) + ']'; + String stringValue = prop.getString(); + + T enumValue = defaultValue; + for (int i = 0; i < validValues.length; i++) { + if (stringValue.equals(validValues[i])) { + enumValue = validEnumValues[i]; + } + } + + return enumValue; + } + + public String[] getStringList(String name, String category, String[] defaultValue) { + String langKey = keyPrefix + category + '.' + name; + String commentKey = langKey + commentPostfix; + String comment = Translator.translateToLocal(commentKey); + + Property prop = configuration.get(category, name, defaultValue); + prop.setLanguageKey(langKey); + prop.comment = comment + " [" + defaultLocalized + ": " + Arrays.toString(defaultValue) + ']'; + return prop.getStringList(); + } + + public String[] getStringList(String name, String category, String[] defaultValue, String[] validValues) { + String langKey = keyPrefix + category + '.' + name; + String commentKey = langKey + commentPostfix; + String comment = Translator.translateToLocal(commentKey); + + Property prop = configuration.get(category, name, defaultValue); + prop.setLanguageKey(langKey); + prop.setValidValues(validValues); + prop.comment = comment + " [" + defaultLocalized + ": " + Arrays.toString(defaultValue) + "] [" + validLocalized + ": " + Arrays.toString(prop.getValidValues()) + ']'; + return prop.getStringList(); + } + + public float getFloat(String name, String category, float defaultValue, float minValue, float maxValue) { + String langKey = keyPrefix + category + '.' + name; + String commentKey = langKey + commentPostfix; + String comment = Translator.translateToLocal(commentKey); + return configuration.getFloat(name, category, defaultValue, minValue, maxValue, comment, langKey); + } + + public int getInt(String name, String category, int defaultValue, int minValue, int maxValue) { + String langKey = keyPrefix + category + '.' + name; + String commentKey = langKey + commentPostfix; + String comment = Translator.translateToLocal(commentKey); + return configuration.getInt(name, category, defaultValue, minValue, maxValue, comment, langKey); + } + + public Configuration getConfiguration() { + return configuration; + } + + public boolean hasChanged() { + return configuration.hasChanged(); + } + + public void save() { + configuration.save(); + } + + @Override + public String toString() { + return configuration.toString(); + } +} diff --git a/src/main/java/mezz/jei/gui/GuiHelper.java b/src/main/java/mezz/jei/gui/GuiHelper.java index 557536b5d..9e38b3ad5 100644 --- a/src/main/java/mezz/jei/gui/GuiHelper.java +++ b/src/main/java/mezz/jei/gui/GuiHelper.java @@ -14,7 +14,7 @@ public class GuiHelper implements IGuiHelper { private final IDrawable slotDrawable; public GuiHelper() { - ResourceLocation location = new ResourceLocation("minecraft:textures/gui/container/furnace.png"); + ResourceLocation location = new ResourceLocation("minecraft", "textures/gui/container/furnace.png"); slotDrawable = createDrawable(location, 55, 16, 18, 18); } diff --git a/src/main/java/mezz/jei/gui/IRecipeGuiLogic.java b/src/main/java/mezz/jei/gui/IRecipeGuiLogic.java index 824d58b8d..7553ce57f 100644 --- a/src/main/java/mezz/jei/gui/IRecipeGuiLogic.java +++ b/src/main/java/mezz/jei/gui/IRecipeGuiLogic.java @@ -31,6 +31,9 @@ public interface IRecipeGuiLogic { boolean setCategoryFocus(); + @Nullable + Focus getFocus(); + @Nullable IRecipeCategory getRecipeCategory(); diff --git a/src/main/java/mezz/jei/gui/ItemListOverlay.java b/src/main/java/mezz/jei/gui/ItemListOverlay.java index 61046ec03..e902c4abc 100644 --- a/src/main/java/mezz/jei/gui/ItemListOverlay.java +++ b/src/main/java/mezz/jei/gui/ItemListOverlay.java @@ -6,21 +6,28 @@ import javax.annotation.Nullable; import java.awt.Color; import java.util.ArrayList; +import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; +import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.client.config.GuiButtonExt; +import net.minecraftforge.fml.client.config.HoverChecker; import org.lwjgl.input.Keyboard; import mezz.jei.ItemFilter; +import mezz.jei.api.JEIManager; +import mezz.jei.api.gui.IDrawable; +import mezz.jei.config.Constants; +import mezz.jei.config.JEIModConfigGui; import mezz.jei.gui.ingredients.GuiIngredient; import mezz.jei.gui.ingredients.GuiItemStackGroup; import mezz.jei.input.IKeyable; @@ -28,6 +35,7 @@ import mezz.jei.input.IShowsRecipeFocuses; import mezz.jei.util.ItemStackElement; import mezz.jei.util.MathUtil; +import mezz.jei.util.Translator; public class ItemListOverlay implements IShowsRecipeFocuses, IMouseHandler, IKeyable { @@ -45,6 +53,9 @@ public class ItemListOverlay implements IShowsRecipeFocuses, IMouseHandler, IKey private final ArrayList> guiItemStacks = new ArrayList<>(); private GuiButton nextButton; private GuiButton backButton; + private GuiButton configButton; + private IDrawable configButtonIcon; + private HoverChecker configButtonHoverChecker; private GuiTextField searchField; private int pageCount; @@ -73,8 +84,8 @@ public void initGui(@Nonnull GuiContainer guiContainer) { this.screenWidth = guiContainer.width; this.screenHeight = guiContainer.height; - String next = StatCollector.translateToLocal("jei.button.next"); - String back = StatCollector.translateToLocal("jei.button.back"); + String next = Translator.translateToLocal("jei.button.next"); + String back = Translator.translateToLocal("jei.button.back"); FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj; final int nextButtonWidth = 10 + fontRenderer.getStringWidth(next); @@ -92,7 +103,13 @@ public void initGui(@Nonnull GuiContainer guiContainer) { nextButton = new GuiButtonExt(0, rightEdge - nextButtonWidth, 0, nextButtonWidth, buttonHeight, next); backButton = new GuiButtonExt(1, leftEdge, 0, backButtonWidth, buttonHeight, back); - searchField = new GuiTextField(0, fontRenderer, leftEdge, screenHeight - searchHeight - (2 * borderPadding), rightEdge - leftEdge, searchHeight); + int configButtonSize = searchHeight + 4; + configButton = new GuiButtonExt(2, rightEdge - configButtonSize + itemStackPadding, screenHeight - configButtonSize, configButtonSize, configButtonSize, null); + ResourceLocation configButtonIconLocation = new ResourceLocation(Constants.RESOURCE_DOMAIN, Constants.TEXTURE_GUI_PATH + "recipeBackground.png"); + configButtonIcon = JEIManager.guiHelper.createDrawable(configButtonIconLocation, 0, 166, 16, 16); + configButtonHoverChecker = new HoverChecker(configButton, 0); + + searchField = new GuiTextField(0, fontRenderer, leftEdge, screenHeight - searchHeight - (2 * borderPadding), rightEdge - leftEdge - configButtonSize - itemStackPadding, searchHeight); searchField.setMaxStringLength(maxSearchLength); setKeyboardFocus(false); searchField.setText(itemFilter.getFilterText()); @@ -189,6 +206,8 @@ public void drawScreen(@Nonnull Minecraft minecraft, int mouseX, int mouseY) { nextButton.drawButton(minecraft, mouseX, mouseY); backButton.drawButton(minecraft, mouseX, mouseY); + configButton.drawButton(minecraft, mouseX, mouseY); + configButtonIcon.draw(minecraft, configButton.xPosition + 2, configButton.yPosition + 2); for (GuiIngredient guiItemStack : guiItemStacks) { if (hovered == null && guiItemStack.isMouseOver(mouseX, mouseY)) { @@ -197,6 +216,11 @@ public void drawScreen(@Nonnull Minecraft minecraft, int mouseX, int mouseY) { guiItemStack.draw(minecraft); } } + + if (configButtonHoverChecker.checkHover(mouseX, mouseY)) { + List tooltipText = minecraft.fontRendererObj.listFormattedStringToWidth("Config", 300); + TooltipRenderer.drawHoveringText(minecraft, tooltipText, mouseX, mouseY); + } } public void drawHovered(@Nonnull Minecraft minecraft, int mouseX, int mouseY) { @@ -268,6 +292,11 @@ private boolean handleMouseClickedButtons(int mouseX, int mouseY, int mouseButto } else if (backButton.mousePressed(minecraft, mouseX, mouseY)) { previousPage(); return true; + } else if (configButton.mousePressed(minecraft, mouseX, mouseY)) { + close(); + GuiScreen configScreen = new JEIModConfigGui(minecraft.currentScreen); + minecraft.displayGuiScreen(configScreen); + return true; } return false; } diff --git a/src/main/java/mezz/jei/gui/RecipeGuiLogic.java b/src/main/java/mezz/jei/gui/RecipeGuiLogic.java index ed441bae4..b3e693b1f 100644 --- a/src/main/java/mezz/jei/gui/RecipeGuiLogic.java +++ b/src/main/java/mezz/jei/gui/RecipeGuiLogic.java @@ -129,6 +129,14 @@ public boolean setCategoryFocus() { return true; } + @Override + public Focus getFocus() { + if (state == null) { + return null; + } + return state.focus; + } + @Override public void setRecipesPerPage(int recipesPerPage) { if (state == null) { diff --git a/src/main/java/mezz/jei/gui/RecipesGui.java b/src/main/java/mezz/jei/gui/RecipesGui.java index f3630d581..2f95b71c4 100644 --- a/src/main/java/mezz/jei/gui/RecipesGui.java +++ b/src/main/java/mezz/jei/gui/RecipesGui.java @@ -16,6 +16,7 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.client.FMLClientHandler; import net.minecraftforge.fml.client.config.GuiButtonExt; +import net.minecraftforge.fml.client.config.HoverChecker; import org.lwjgl.opengl.GL11; @@ -46,6 +47,7 @@ public class RecipesGui extends GuiScreen implements IShowsRecipeFocuses, IMouse private String pageString; private String title; private ResourceLocation backgroundTexture; + private HoverChecker titleHoverChecker; private GuiButton nextRecipeCategory; private GuiButton previousRecipeCategory; @@ -162,7 +164,7 @@ public boolean handleMouseClicked(int mouseX, int mouseY, int mouseButton) { } if (!guiActionPerformed) { - if ((mouseY < guiTop + titleHeight) && (mouseX > guiLeft + borderPadding + buttonWidth + 12) && (mouseX < guiLeft + xSize - borderPadding - buttonWidth - 12)) { + if (titleHoverChecker.checkHover(mouseX, mouseY)) { boolean success = logic.setCategoryFocus(); if (success) { updateLayout(); @@ -274,6 +276,10 @@ private void updateLayout() { logic.setRecipesPerPage(recipesPerPage); title = recipeCategory.getTitle(); + int titleWidth = fontRendererObj.getStringWidth(title); + int titleX = guiLeft + (xSize - titleWidth) / 2; + int titleY = guiTop + borderPadding; + titleHoverChecker = new HoverChecker(titleY, titleY + fontRendererObj.FONT_HEIGHT, titleX, titleX + titleWidth, 0); int posX = guiLeft + recipeXOffset; int posY = guiTop + headerHeight + recipeSpacing; @@ -338,6 +344,13 @@ public void draw(int mouseX, int mouseY) { if (hovered != null) { hovered.draw(minecraft, mouseX, mouseY); } + if (titleHoverChecker.checkHover(mouseX, mouseY)) { + Focus focus = logic.getFocus(); + if (focus != null && !focus.isBlank()) { + List tooltipText = minecraft.fontRendererObj.listFormattedStringToWidth("Show All Recipes", 300); + TooltipRenderer.drawHoveringText(minecraft, tooltipText, mouseX, mouseY); + } + } } public void drawBackground() { diff --git a/src/main/java/mezz/jei/gui/TooltipRenderer.java b/src/main/java/mezz/jei/gui/TooltipRenderer.java index 27e282485..4ebeadb40 100644 --- a/src/main/java/mezz/jei/gui/TooltipRenderer.java +++ b/src/main/java/mezz/jei/gui/TooltipRenderer.java @@ -5,6 +5,8 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderHelper; /** * Workaround for GuiScreen.drawHoveringText being protected instead of public. @@ -13,9 +15,18 @@ public class TooltipRenderer { private static final TooltipGuiScreen tooltipScreen = new TooltipGuiScreen(); + public static void drawHoveringText(Minecraft minecraft, List textLines, int x, int y) { + drawHoveringText(minecraft, textLines, x, y, minecraft.fontRendererObj); + } + public static void drawHoveringText(Minecraft minecraft, List textLines, int x, int y, FontRenderer font) { tooltipScreen.set(minecraft); tooltipScreen.drawHoveringText(textLines, x, y, font); + + GlStateManager.disableRescaleNormal(); + RenderHelper.disableStandardItemLighting(); + GlStateManager.disableLighting(); + GlStateManager.disableDepth(); } private static class TooltipGuiScreen extends GuiScreen { diff --git a/src/main/java/mezz/jei/gui/ingredients/ItemStackRenderer.java b/src/main/java/mezz/jei/gui/ingredients/ItemStackRenderer.java index e8c133e3d..3a2220aa5 100644 --- a/src/main/java/mezz/jei/gui/ingredients/ItemStackRenderer.java +++ b/src/main/java/mezz/jei/gui/ingredients/ItemStackRenderer.java @@ -9,9 +9,9 @@ import net.minecraft.client.renderer.RenderHelper; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.StatCollector; import mezz.jei.config.Config; +import mezz.jei.util.Translator; public class ItemStackRenderer implements IIngredientRenderer { @Override @@ -49,17 +49,17 @@ public List getTooltip(@Nonnull Minecraft minecraft, @Nonnull ItemStack if (Config.editModeEnabled) { list.add(""); - list.add(EnumChatFormatting.ITALIC + StatCollector.translateToLocal("gui.jei.editMode.description")); + list.add(EnumChatFormatting.ITALIC + Translator.translateToLocal("gui.jei.editMode.description")); if (Config.isItemOnConfigBlacklist(itemStack, false)) { - list.add(EnumChatFormatting.YELLOW + StatCollector.translateToLocal("gui.jei.editMode.description.show")); + list.add(EnumChatFormatting.YELLOW + Translator.translateToLocal("gui.jei.editMode.description.show")); } else { - list.add(EnumChatFormatting.YELLOW + StatCollector.translateToLocal("gui.jei.editMode.description.hide")); + list.add(EnumChatFormatting.YELLOW + Translator.translateToLocal("gui.jei.editMode.description.hide")); } if (Config.isItemOnConfigBlacklist(itemStack, true)) { - list.add(EnumChatFormatting.RED + StatCollector.translateToLocal("gui.jei.editMode.description.show.wild")); + list.add(EnumChatFormatting.RED + Translator.translateToLocal("gui.jei.editMode.description.show.wild")); } else { - list.add(EnumChatFormatting.RED + StatCollector.translateToLocal("gui.jei.editMode.description.hide.wild")); + list.add(EnumChatFormatting.RED + Translator.translateToLocal("gui.jei.editMode.description.hide.wild")); } } diff --git a/src/main/java/mezz/jei/plugins/vanilla/brewing/BrewingRecipeCategory.java b/src/main/java/mezz/jei/plugins/vanilla/brewing/BrewingRecipeCategory.java index b8db4d719..0c58e46e9 100644 --- a/src/main/java/mezz/jei/plugins/vanilla/brewing/BrewingRecipeCategory.java +++ b/src/main/java/mezz/jei/plugins/vanilla/brewing/BrewingRecipeCategory.java @@ -6,7 +6,6 @@ import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; import mezz.jei.api.JEIManager; import mezz.jei.api.gui.IDrawable; @@ -16,6 +15,7 @@ import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.VanillaRecipeCategoryUid; import mezz.jei.util.StackUtil; +import mezz.jei.util.Translator; public class BrewingRecipeCategory implements IRecipeCategory { @@ -34,9 +34,9 @@ public class BrewingRecipeCategory implements IRecipeCategory { private final String localizedName; public BrewingRecipeCategory() { - ResourceLocation location = new ResourceLocation("minecraft:textures/gui/container/brewing_stand.png"); + ResourceLocation location = new ResourceLocation("minecraft", "textures/gui/container/brewing_stand.png"); background = JEIManager.guiHelper.createDrawable(location, 55, 15, 64, 56, 0, 0, 0, 40); - localizedName = StatCollector.translateToLocal("gui.jei.brewingRecipes"); + localizedName = Translator.translateToLocal("gui.jei.brewingRecipes"); } @Nonnull diff --git a/src/main/java/mezz/jei/plugins/vanilla/brewing/BrewingRecipeWrapper.java b/src/main/java/mezz/jei/plugins/vanilla/brewing/BrewingRecipeWrapper.java index 3b14e4769..03126e109 100644 --- a/src/main/java/mezz/jei/plugins/vanilla/brewing/BrewingRecipeWrapper.java +++ b/src/main/java/mezz/jei/plugins/vanilla/brewing/BrewingRecipeWrapper.java @@ -10,9 +10,9 @@ import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; import mezz.jei.plugins.vanilla.VanillaRecipeWrapper; +import mezz.jei.util.Translator; public class BrewingRecipeWrapper extends VanillaRecipeWrapper { private final List ingredients; @@ -57,7 +57,7 @@ public List getOutputs() { @Override public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight) { if (brewingSteps > 0) { - String steps = StatCollector.translateToLocalFormatted("gui.jei.brewingRecipes.steps", brewingSteps); + String steps = Translator.translateToLocalFormatted("gui.jei.brewingRecipes.steps", brewingSteps); minecraft.fontRendererObj.drawString(steps, 70, 28, Color.gray.getRGB()); } } diff --git a/src/main/java/mezz/jei/plugins/vanilla/crafting/CraftingRecipeCategory.java b/src/main/java/mezz/jei/plugins/vanilla/crafting/CraftingRecipeCategory.java index 59ae4d146..4ad19e5fb 100644 --- a/src/main/java/mezz/jei/plugins/vanilla/crafting/CraftingRecipeCategory.java +++ b/src/main/java/mezz/jei/plugins/vanilla/crafting/CraftingRecipeCategory.java @@ -4,7 +4,6 @@ import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; import mezz.jei.api.JEIManager; import mezz.jei.api.gui.ICraftingGridHelper; @@ -17,6 +16,7 @@ import mezz.jei.api.recipe.wrapper.ICraftingRecipeWrapper; import mezz.jei.api.recipe.wrapper.IShapedCraftingRecipeWrapper; import mezz.jei.util.Log; +import mezz.jei.util.Translator; public class CraftingRecipeCategory implements IRecipeCategory { @@ -31,9 +31,9 @@ public class CraftingRecipeCategory implements IRecipeCategory { private final ICraftingGridHelper craftingGridHelper; public CraftingRecipeCategory() { - ResourceLocation location = new ResourceLocation("minecraft:textures/gui/container/crafting_table.png"); + ResourceLocation location = new ResourceLocation("minecraft", "textures/gui/container/crafting_table.png"); background = JEIManager.guiHelper.createDrawable(location, 29, 16, 116, 54); - localizedName = StatCollector.translateToLocal("gui.jei.craftingTableRecipes"); + localizedName = Translator.translateToLocal("gui.jei.craftingTableRecipes"); craftingGridHelper = JEIManager.guiHelper.createCraftingGridHelper(craftInputSlot1, craftOutputSlot); } diff --git a/src/main/java/mezz/jei/plugins/vanilla/furnace/FuelRecipe.java b/src/main/java/mezz/jei/plugins/vanilla/furnace/FuelRecipe.java index 9fdeac8a7..725744212 100644 --- a/src/main/java/mezz/jei/plugins/vanilla/furnace/FuelRecipe.java +++ b/src/main/java/mezz/jei/plugins/vanilla/furnace/FuelRecipe.java @@ -10,9 +10,9 @@ import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; import mezz.jei.plugins.vanilla.VanillaRecipeWrapper; +import mezz.jei.util.Translator; public class FuelRecipe extends VanillaRecipeWrapper { @Nonnull @@ -22,7 +22,7 @@ public class FuelRecipe extends VanillaRecipeWrapper { public FuelRecipe(@Nonnull Collection input, int burnTime) { this.input = new ArrayList<>(input); - this.burnTimeString = StatCollector.translateToLocalFormatted("gui.jei.furnaceBurnTime", burnTime); + this.burnTimeString = Translator.translateToLocalFormatted("gui.jei.furnaceBurnTime", burnTime); } @Nonnull diff --git a/src/main/java/mezz/jei/plugins/vanilla/furnace/FurnaceFuelCategory.java b/src/main/java/mezz/jei/plugins/vanilla/furnace/FurnaceFuelCategory.java index 21bd91ce2..51758e416 100644 --- a/src/main/java/mezz/jei/plugins/vanilla/furnace/FurnaceFuelCategory.java +++ b/src/main/java/mezz/jei/plugins/vanilla/furnace/FurnaceFuelCategory.java @@ -4,7 +4,6 @@ import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; import mezz.jei.api.JEIManager; import mezz.jei.api.gui.IDrawable; @@ -12,6 +11,7 @@ import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.VanillaRecipeCategoryUid; +import mezz.jei.util.Translator; public class FurnaceFuelCategory extends FurnaceRecipeCategory { @Nonnull @@ -20,9 +20,9 @@ public class FurnaceFuelCategory extends FurnaceRecipeCategory { private final String localizedName; public FurnaceFuelCategory() { - ResourceLocation location = new ResourceLocation("minecraft:textures/gui/container/furnace.png"); + ResourceLocation location = new ResourceLocation("minecraft", "textures/gui/container/furnace.png"); background = JEIManager.guiHelper.createDrawable(location, 55, 38, 18, 32, 0, 0, 0, 80); - localizedName = StatCollector.translateToLocal("gui.jei.fuelRecipes"); + localizedName = Translator.translateToLocal("gui.jei.fuelRecipes"); } @Override diff --git a/src/main/java/mezz/jei/plugins/vanilla/furnace/FurnaceSmeltingCategory.java b/src/main/java/mezz/jei/plugins/vanilla/furnace/FurnaceSmeltingCategory.java index d67d0d793..91bdc2102 100644 --- a/src/main/java/mezz/jei/plugins/vanilla/furnace/FurnaceSmeltingCategory.java +++ b/src/main/java/mezz/jei/plugins/vanilla/furnace/FurnaceSmeltingCategory.java @@ -4,7 +4,6 @@ import net.minecraft.client.Minecraft; import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; import mezz.jei.api.JEIManager; import mezz.jei.api.gui.IDrawable; @@ -12,6 +11,7 @@ import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.recipe.IRecipeWrapper; import mezz.jei.api.recipe.VanillaRecipeCategoryUid; +import mezz.jei.util.Translator; public class FurnaceSmeltingCategory extends FurnaceRecipeCategory { @Nonnull @@ -20,9 +20,9 @@ public class FurnaceSmeltingCategory extends FurnaceRecipeCategory { private final String localizedName; public FurnaceSmeltingCategory() { - ResourceLocation location = new ResourceLocation("minecraft:textures/gui/container/furnace.png"); + ResourceLocation location = new ResourceLocation("minecraft", "textures/gui/container/furnace.png"); background = JEIManager.guiHelper.createDrawable(location, 55, 16, 82, 54); - localizedName = StatCollector.translateToLocal("gui.jei.smeltingRecipes"); + localizedName = Translator.translateToLocal("gui.jei.smeltingRecipes"); } @Override diff --git a/src/main/java/mezz/jei/plugins/vanilla/furnace/SmeltingRecipe.java b/src/main/java/mezz/jei/plugins/vanilla/furnace/SmeltingRecipe.java index a46ff825f..89da8cceb 100644 --- a/src/main/java/mezz/jei/plugins/vanilla/furnace/SmeltingRecipe.java +++ b/src/main/java/mezz/jei/plugins/vanilla/furnace/SmeltingRecipe.java @@ -9,9 +9,9 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.item.ItemStack; -import net.minecraft.util.StatCollector; import mezz.jei.plugins.vanilla.VanillaRecipeWrapper; +import mezz.jei.util.Translator; public class SmeltingRecipe extends VanillaRecipeWrapper { @Nonnull @@ -27,7 +27,7 @@ public SmeltingRecipe(@Nonnull List input, @Nonnull ItemStack output, this.outputs = Collections.singletonList(output); if (experience > 0.0) { - experienceString = StatCollector.translateToLocalFormatted("gui.jei.furnaceExperience", experience); + experienceString = Translator.translateToLocalFormatted("gui.jei.furnaceExperience", experience); } else { experienceString = null; } diff --git a/src/main/java/mezz/jei/util/Translator.java b/src/main/java/mezz/jei/util/Translator.java new file mode 100644 index 000000000..2cee65983 --- /dev/null +++ b/src/main/java/mezz/jei/util/Translator.java @@ -0,0 +1,24 @@ +package mezz.jei.util; + +import java.util.IllegalFormatException; + +import net.minecraft.util.StatCollector; + +public class Translator { + public static String translateToLocal(String key) { + if (StatCollector.canTranslate(key)) { + return StatCollector.translateToLocal(key); + } else { + return StatCollector.translateToFallback(key); + } + } + + public static String translateToLocalFormatted(String key, Object... format) { + String s = translateToLocal(key); + try { + return String.format(s, format); + } catch (IllegalFormatException var5) { + return "Format error: " + s; + } + } +} diff --git a/src/main/resources/assets/jei/lang/de_DE.lang b/src/main/resources/assets/jei/lang/de_DE.lang index 26f7af585..988b5b528 100644 --- a/src/main/resources/assets/jei/lang/de_DE.lang +++ b/src/main/resources/assets/jei/lang/de_DE.lang @@ -8,5 +8,5 @@ key.jei.showRecipe=Zeige Item-Rezepte key.jei.showUses=Zeige Item-Nutzung # Config -config.jei.cheatItemsEnabled=Aktiviere Item-Cheating -config.jei.cheatItemsEnabled.description=/give Items, statt das Rezept zu zeigen +config.jei.mode.cheatItemsEnabled=Aktiviere Item-Cheating +config.jei.mode.cheatItemsEnabled.comment=/give Items, statt das Rezept zu zeigen diff --git a/src/main/resources/assets/jei/lang/en_US.lang b/src/main/resources/assets/jei/lang/en_US.lang index 8307e866a..4579879da 100644 --- a/src/main/resources/assets/jei/lang/en_US.lang +++ b/src/main/resources/assets/jei/lang/en_US.lang @@ -8,18 +8,29 @@ key.jei.showRecipe=Show Item Recipe key.jei.showUses=Show Item Uses # Config -config.jei.cheatItemsEnabled=Enable Item Cheating -config.jei.cheatItemsEnabled.description=/give items instead of showing the recipe. -config.jei.editEnabled=Edit Mode -config.jei.editEnabled.description=Hide and unhide items by clicking them in the item list. - -config.jei.tooltipModName=Add Mod Name to Tooltip -config.jei.tooltipModName.description=Adds the name of the item's mod to its tooltip. - -config.jei.nbtKeyIgnoreList=NBT Key Ignore List -config.jei.nbtKeyIgnoreList.description=List of NBT Keys that should be ignored when retrieving recipes. -config.jei.itemBlacklist=Item Blacklist -config.jei.itemBlacklist.description=List of items that should not be displayed in the item list. Format: modId:name[:meta]. Edit Mode will automatically add or remove entries here. +config.jei.default=Default +config.jei.valid=Valid + +config.jei.title=%MODNAME Config + +config.jei.mode=Mode +config.jei.mode.comment=Change the mode that JEI is operating in. +config.jei.mode.cheatItemsEnabled=Enable Item Cheating +config.jei.mode.cheatItemsEnabled.comment=/give items instead of showing the recipe. +config.jei.mode.editEnabled=Enable Item List Edit Mode +config.jei.mode.editEnabled.comment=Hide and unhide items by clicking them in the item list. + +config.jei.interface=Interface +config.jei.interface.comment=Options relating to the User Interface. +config.jei.interface.tooltipModName=Add Mod Name to Tooltip +config.jei.interface.tooltipModName.comment=Adds the name of the item's mod to its tooltip. + +config.jei.advanced=Advanced +config.jei.advanced.comment=Advanced config options to change the way JEI functions. +config.jei.advanced.nbtKeyIgnoreList=NBT Key Ignore List +config.jei.advanced.nbtKeyIgnoreList.comment=List of NBT Keys that should be ignored when retrieving recipes. +config.jei.advanced.itemBlacklist=Item Blacklist +config.jei.advanced.itemBlacklist.comment=List of items that should not be displayed in the item list. Format: modId:name[:meta]. Edit Mode will automatically add or remove entries here. # Edit Mode gui.jei.editMode.description=JEI Item List Edit Mode: diff --git a/src/main/resources/assets/jei/lang/fi_FI.lang b/src/main/resources/assets/jei/lang/fi_FI.lang index 7b82edef0..fba2845e4 100644 --- a/src/main/resources/assets/jei/lang/fi_FI.lang +++ b/src/main/resources/assets/jei/lang/fi_FI.lang @@ -4,9 +4,9 @@ jei.button.back=Takaisin # Key Bindings key.jei.toggleOverlay=Kytke tavaralista -key.jei.showRecipe=Nyt tavaran resepti -key.jei.showUses=Nyt tavaran kytt +key.jei.showRecipe=N�yt� tavaran resepti +key.jei.showUses=N�yt� tavaran k�yt�t # Config -config.jei.cheatItemsEnabled=Kytke plle tavaroiden huijaus -config.jei.cheatItemsEnabled.description=Kyt /give-komentoa tavaroiden antamiseen tavaran reseptin nyttmisen sijaan +config.jei.mode.cheatItemsEnabled=Kytke p��lle tavaroiden huijaus +config.jei.mode.cheatItemsEnabled.comment=K�yt� /give-komentoa tavaroiden antamiseen tavaran reseptin n�ytt�misen sijaan diff --git a/src/main/resources/assets/jei/lang/ko_KR.lang b/src/main/resources/assets/jei/lang/ko_KR.lang index 65685d0e8..0fd3feca6 100644 --- a/src/main/resources/assets/jei/lang/ko_KR.lang +++ b/src/main/resources/assets/jei/lang/ko_KR.lang @@ -8,5 +8,5 @@ key.jei.showRecipe=아이템 레시피 보이기 key.jei.showUses=아이템 사용 보이기 # Config -config.jei.cheatItemsEnabled=치트 활성화 -config.jei.cheatItemsEnabled.description=/give items 자체 레시피 제작 +config.jei.mode.cheatItemsEnabled=치트 활성화 +config.jei.mode.cheatItemsEnabled.comment=/give items 자체 레시피 제작 diff --git a/src/main/resources/assets/jei/lang/ru_RU.lang b/src/main/resources/assets/jei/lang/ru_RU.lang index 613f9ab0a..8e4ca0f6f 100644 --- a/src/main/resources/assets/jei/lang/ru_RU.lang +++ b/src/main/resources/assets/jei/lang/ru_RU.lang @@ -8,18 +8,18 @@ key.jei.showRecipe=Показывать рецепты предметов key.jei.showUses=Показывать применения предметов # Config -config.jei.cheatItemsEnabled=Включить режим жульничества -config.jei.cheatItemsEnabled.description=/give предметы, вместо показа рецепта. -config.jei.editEnabled=Режим редактирования -config.jei.editEnabled.description=Прячьте предметы в списке простым нажатием клавиши. +config.jei.mode.cheatItemsEnabled=Включить режим жульничества +config.jei.mode.cheatItemsEnabled.comment=/give предметы, вместо показа рецепта. +config.jei.mode.editEnabled=Режим редактирования +config.jei.mode.editEnabled.comment=Прячьте предметы в списке простым нажатием клавиши. -config.jei.tooltipModName=Добавить назв. мода к подсказке -config.jei.tooltipModName.description=Добавляет название мода к подсказке предмета. +config.jei.interface.tooltipModName=Добавить назв. мода к подсказке +config.jei.interface.tooltipModName.comment=Добавляет название мода к подсказке предмета. -config.jei.nbtKeyIgnoreList=Чёрный список для NBT -config.jei.nbtKeyIgnoreList.description=Список NBT, которые будут игнорироваться при отображении рецептов. -config.jei.itemBlacklist=Чёрный список для предметов -config.jei.itemBlacklist.description=Список предметов, которые не будут отображаться в списке предметов JEI. Формат: modId:name[:meta]. Режим редактирования будет автоматически добавлять записи сюда, или удалять. +config.jei.advanced.nbtKeyIgnoreList=Чёрный список для NBT +config.jei.advanced.nbtKeyIgnoreList.comment=Список NBT, которые будут игнорироваться при отображении рецептов. +config.jei.advanced.itemBlacklist=Чёрный список для предметов +config.jei.advanced.itemBlacklist.comment=Список предметов, которые не будут отображаться в списке предметов JEI. Формат: modId:name[:meta]. Режим редактирования будет автоматически добавлять записи сюда, или удалять. # Edit Mode gui.jei.editMode.description=Режим редактирования списка предметов JEI: diff --git a/src/main/resources/assets/jei/lang/zh_CN.lang b/src/main/resources/assets/jei/lang/zh_CN.lang index 3b96aea08..8bf7a9c67 100644 --- a/src/main/resources/assets/jei/lang/zh_CN.lang +++ b/src/main/resources/assets/jei/lang/zh_CN.lang @@ -8,18 +8,18 @@ key.jei.showRecipe=显示物品合成表 key.jei.showUses=显示物品用途 # Config -config.jei.cheatItemsEnabled=开启物品作弊模式 -config.jei.cheatItemsEnabled.description=/给予物品而非显示其合成表 -config.jei.editEnabled=开启物品编辑模式 -config.jei.editEnabled.description=在列表中点击物品以隐藏或取消隐藏 +config.jei.mode.cheatItemsEnabled=开启物品作弊模式 +config.jei.mode.cheatItemsEnabled.comment=/给予物品而非显示其合成表 +config.jei.mode.editEnabled=开启物品编辑模式 +config.jei.mode.editEnabled.comment=在列表中点击物品以隐藏或取消隐藏 -config.jei.tooltipModName=工具提示(Tooltip)中显示所属模组 -config.jei.tooltipModName.description=在物品的工具提示中显示其所属的模组名 +config.jei.interface.tooltipModName=工具提示(Tooltip)中显示所属模组 +config.jei.interface.tooltipModName.comment=在物品的工具提示中显示其所属的模组名 -config.jei.nbtKeyIgnoreList=NBT关键字忽略列表 -config.jei.nbtKeyIgnoreList.description=过滤可用合成时,该表所含的NBT关键字将忽略不计。 -config.jei.itemBlacklist=物品黑名单 -config.jei.itemBlacklist.description=该表中物品将不会显示于JEI物品列表。添加格式: modId:name[:meta]。使用编辑模式可自动添加�或删除这里的条目。 +config.jei.advanced.nbtKeyIgnoreList=NBT关键字忽略列表 +config.jei.advanced.nbtKeyIgnoreList.comment=过滤可用合成时,该表所含的NBT关键字将忽略不计。 +config.jei.advanced.itemBlacklist=物品黑名单 +config.jei.advanced.itemBlacklist.comment=该表中物品将不会显示于JEI物品列表。添加格式: modId:name[:meta]。使用编辑模式可自动添加�或删除这里的条目。 # Edit Mode gui.jei.editMode.description=JEI物品列表编辑模式: diff --git a/src/main/resources/assets/jei/textures/gui/recipeBackground.png b/src/main/resources/assets/jei/textures/gui/recipeBackground.png index deace8613f9813741922cd25083ba819c0e15ddb..9ecebaa1cb2fa2c689152c8476dccf593d62e8d5 100644 GIT binary patch literal 364 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K58CaNs)Vi3hp+HI^z$e7@|Ns9$W@umdKI;Vst0QW*cKL7v# From cd138ced1190a8355b9d3e468c5f1428396ba19b Mon Sep 17 00:00:00 2001 From: mezz Date: Wed, 9 Dec 2015 23:36:01 -0800 Subject: [PATCH 4/9] Add config category for JEI addon mods to use --- src/main/java/mezz/jei/config/Config.java | 2 ++ src/main/java/mezz/jei/config/JEIModConfigGui.java | 5 +++++ src/main/resources/assets/jei/lang/en_US.lang | 3 +++ 3 files changed, 10 insertions(+) diff --git a/src/main/java/mezz/jei/config/Config.java b/src/main/java/mezz/jei/config/Config.java index cf0bbec56..f22e2819f 100644 --- a/src/main/java/mezz/jei/config/Config.java +++ b/src/main/java/mezz/jei/config/Config.java @@ -18,6 +18,7 @@ public class Config { public static final String categoryMode = "mode"; public static final String categoryInterface = "interface"; public static final String categoryAdvanced = "advanced"; + public static final String categoryAddons = "addons"; public static boolean cheatItemsEnabled = false; public static boolean editModeEnabled = false; @@ -38,6 +39,7 @@ public static void syncConfig() { configFile.addCategory(categoryMode); configFile.addCategory(categoryInterface); configFile.addCategory(categoryAdvanced); + configFile.addCategory(categoryAddons); cheatItemsEnabled = configFile.getBoolean(categoryMode, "cheatItemsEnabled", cheatItemsEnabled); editModeEnabled = configFile.getBoolean(categoryMode, "editEnabled", editModeEnabled); diff --git a/src/main/java/mezz/jei/config/JEIModConfigGui.java b/src/main/java/mezz/jei/config/JEIModConfigGui.java index 1bca76bc6..7fefa5b08 100644 --- a/src/main/java/mezz/jei/config/JEIModConfigGui.java +++ b/src/main/java/mezz/jei/config/JEIModConfigGui.java @@ -23,12 +23,17 @@ private static List getConfigElements() { ConfigCategory categoryAdvanced = Config.configFile.getCategory(Config.categoryAdvanced); ConfigCategory categoryInterface = Config.configFile.getCategory(Config.categoryInterface); ConfigCategory categoryMode = Config.configFile.getCategory(Config.categoryMode); + ConfigCategory categoryAddons = Config.configFile.getCategory(Config.categoryAddons); List configElements = new ArrayList<>(); configElements.addAll(new ConfigElement(categoryMode).getChildElements()); configElements.addAll(new ConfigElement(categoryInterface).getChildElements()); configElements.add(new ConfigElement(categoryAdvanced)); + if (!categoryAddons.isEmpty()) { + configElements.add(new ConfigElement(categoryAddons)); + } + return configElements; } diff --git a/src/main/resources/assets/jei/lang/en_US.lang b/src/main/resources/assets/jei/lang/en_US.lang index 4579879da..8207d80c5 100644 --- a/src/main/resources/assets/jei/lang/en_US.lang +++ b/src/main/resources/assets/jei/lang/en_US.lang @@ -32,6 +32,9 @@ config.jei.advanced.nbtKeyIgnoreList.comment=List of NBT Keys that should be ign config.jei.advanced.itemBlacklist=Item Blacklist config.jei.advanced.itemBlacklist.comment=List of items that should not be displayed in the item list. Format: modId:name[:meta]. Edit Mode will automatically add or remove entries here. +config.jei.addons=Addons +config.jei.addons.comment=Category for JEI addon config options. + # Edit Mode gui.jei.editMode.description=JEI Item List Edit Mode: gui.jei.editMode.description.hide=Ctrl-click to hide. From ea00acc555956b7c146b8d2aee7b0519f491a8b1 Mon Sep 17 00:00:00 2001 From: mezz Date: Wed, 9 Dec 2015 23:36:28 -0800 Subject: [PATCH 5/9] bump version --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 8b12a470c..76a45d4ef 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,5 +2,5 @@ mcversion=1.8 forgeversion=11.14.4.1577 version_major=1 -version_minor=5 +version_minor=6 version_patch=0 From 68ae3e804fc09a2ffcb98722e8a2b87cca00032b Mon Sep 17 00:00:00 2001 From: mezz Date: Wed, 9 Dec 2015 23:48:09 -0800 Subject: [PATCH 6/9] Display config category for addons in the in-game gui --- src/main/java/mezz/jei/config/JEIModConfigGui.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/mezz/jei/config/JEIModConfigGui.java b/src/main/java/mezz/jei/config/JEIModConfigGui.java index 7fefa5b08..bb7a012d0 100644 --- a/src/main/java/mezz/jei/config/JEIModConfigGui.java +++ b/src/main/java/mezz/jei/config/JEIModConfigGui.java @@ -30,7 +30,7 @@ private static List getConfigElements() { configElements.addAll(new ConfigElement(categoryInterface).getChildElements()); configElements.add(new ConfigElement(categoryAdvanced)); - if (!categoryAddons.isEmpty()) { + if (!categoryAddons.isEmpty() || categoryAddons.getChildren().size() > 0) { configElements.add(new ConfigElement(categoryAddons)); } From 9d276f415d1300f4e9ecd440c81b4db9a668dac1 Mon Sep 17 00:00:00 2001 From: mezz Date: Thu, 10 Dec 2015 00:31:30 -0800 Subject: [PATCH 7/9] update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5cbaff6d7..1df43db58 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,6 @@ dependencies { ``` `` can be `1.8` or `1.8.8`. -See the list of github tags for available JEI versions. +Join IRC for available JEI versions. Soon, they will be auto-uploaded to curse and you can get the version there. Join [#JEI on esper.net IRC](http://webchat.esper.net/?nick=JEIGithub...&channels=JEI&prompt=1) for questions or anything else. From 9de7b2276a5166258593ffe22c8a6b936ce95bca Mon Sep 17 00:00:00 2001 From: mezz Date: Thu, 10 Dec 2015 00:45:27 -0800 Subject: [PATCH 8/9] localize the new tooltips, limit tooltip line width --- src/main/java/mezz/jei/config/Constants.java | 1 + src/main/java/mezz/jei/gui/ItemListOverlay.java | 5 ++--- src/main/java/mezz/jei/gui/RecipesGui.java | 5 +++-- src/main/java/mezz/jei/gui/TooltipRenderer.java | 6 +++++- src/main/resources/assets/jei/lang/en_US.lang | 4 ++++ 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/main/java/mezz/jei/config/Constants.java b/src/main/java/mezz/jei/config/Constants.java index 1d598bf7d..9fcb79c3d 100644 --- a/src/main/java/mezz/jei/config/Constants.java +++ b/src/main/java/mezz/jei/config/Constants.java @@ -13,4 +13,5 @@ public class Constants { public static final String RESOURCE_DOMAIN = MOD_ID.toLowerCase(Locale.ENGLISH); public static final String TEXTURE_GUI_PATH = "textures/gui/"; + public static final int MAX_TOOLTIP_WIDTH = 125; } diff --git a/src/main/java/mezz/jei/gui/ItemListOverlay.java b/src/main/java/mezz/jei/gui/ItemListOverlay.java index e902c4abc..5e6e30c46 100644 --- a/src/main/java/mezz/jei/gui/ItemListOverlay.java +++ b/src/main/java/mezz/jei/gui/ItemListOverlay.java @@ -6,7 +6,6 @@ import javax.annotation.Nullable; import java.awt.Color; import java.util.ArrayList; -import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -218,8 +217,8 @@ public void drawScreen(@Nonnull Minecraft minecraft, int mouseX, int mouseY) { } if (configButtonHoverChecker.checkHover(mouseX, mouseY)) { - List tooltipText = minecraft.fontRendererObj.listFormattedStringToWidth("Config", 300); - TooltipRenderer.drawHoveringText(minecraft, tooltipText, mouseX, mouseY); + String configString = Translator.translateToLocal("jei.tooltip.config"); + TooltipRenderer.drawHoveringText(minecraft, configString, mouseX, mouseY); } } diff --git a/src/main/java/mezz/jei/gui/RecipesGui.java b/src/main/java/mezz/jei/gui/RecipesGui.java index 2f95b71c4..2c9db038b 100644 --- a/src/main/java/mezz/jei/gui/RecipesGui.java +++ b/src/main/java/mezz/jei/gui/RecipesGui.java @@ -28,6 +28,7 @@ import mezz.jei.util.Log; import mezz.jei.util.RecipeTransferUtil; import mezz.jei.util.StringUtil; +import mezz.jei.util.Translator; public class RecipesGui extends GuiScreen implements IShowsRecipeFocuses, IMouseHandler { private static final int borderPadding = 8; @@ -347,8 +348,8 @@ public void draw(int mouseX, int mouseY) { if (titleHoverChecker.checkHover(mouseX, mouseY)) { Focus focus = logic.getFocus(); if (focus != null && !focus.isBlank()) { - List tooltipText = minecraft.fontRendererObj.listFormattedStringToWidth("Show All Recipes", 300); - TooltipRenderer.drawHoveringText(minecraft, tooltipText, mouseX, mouseY); + String showAllRecipesString = Translator.translateToLocal("jei.tooltip.show.all.recipes"); + TooltipRenderer.drawHoveringText(minecraft, showAllRecipesString, mouseX, mouseY); } } } diff --git a/src/main/java/mezz/jei/gui/TooltipRenderer.java b/src/main/java/mezz/jei/gui/TooltipRenderer.java index 4ebeadb40..a05ab56db 100644 --- a/src/main/java/mezz/jei/gui/TooltipRenderer.java +++ b/src/main/java/mezz/jei/gui/TooltipRenderer.java @@ -8,6 +8,8 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.RenderHelper; +import mezz.jei.config.Constants; + /** * Workaround for GuiScreen.drawHoveringText being protected instead of public. * (the method with FontRenderer is added by Forge and can't be AT'd). @@ -15,7 +17,9 @@ public class TooltipRenderer { private static final TooltipGuiScreen tooltipScreen = new TooltipGuiScreen(); - public static void drawHoveringText(Minecraft minecraft, List textLines, int x, int y) { + public static void drawHoveringText(Minecraft minecraft, String textLine, int x, int y) { + @SuppressWarnings("unchecked") + List textLines = minecraft.fontRendererObj.listFormattedStringToWidth(textLine, Constants.MAX_TOOLTIP_WIDTH); drawHoveringText(minecraft, textLines, x, y, minecraft.fontRendererObj); } diff --git a/src/main/resources/assets/jei/lang/en_US.lang b/src/main/resources/assets/jei/lang/en_US.lang index 8207d80c5..d0ed697ca 100644 --- a/src/main/resources/assets/jei/lang/en_US.lang +++ b/src/main/resources/assets/jei/lang/en_US.lang @@ -2,6 +2,10 @@ jei.button.next=Next jei.button.back=Back +# Tooltips +jei.tooltip.config=Config +jei.tooltip.show.all.recipes=Show All Recipes + # Key Bindings key.jei.toggleOverlay=Toggle Item List Overlay (Ctrl + ) key.jei.showRecipe=Show Item Recipe From 7120c5508f0f020e2fdeb58fbf569948d3d6d42d Mon Sep 17 00:00:00 2001 From: mezz Date: Thu, 10 Dec 2015 00:45:41 -0800 Subject: [PATCH 9/9] Only allow wildcard blacklising for items with subitems (no point to) --- .../gui/ingredients/ItemStackRenderer.java | 21 ++++++--- .../java/mezz/jei/input/InputHandler.java | 43 +++++++++++++------ 2 files changed, 45 insertions(+), 19 deletions(-) diff --git a/src/main/java/mezz/jei/gui/ingredients/ItemStackRenderer.java b/src/main/java/mezz/jei/gui/ingredients/ItemStackRenderer.java index 3a2220aa5..02bda07f5 100644 --- a/src/main/java/mezz/jei/gui/ingredients/ItemStackRenderer.java +++ b/src/main/java/mezz/jei/gui/ingredients/ItemStackRenderer.java @@ -7,10 +7,12 @@ import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import mezz.jei.config.Config; +import mezz.jei.config.Constants; import mezz.jei.util.Translator; public class ItemStackRenderer implements IIngredientRenderer { @@ -51,15 +53,22 @@ public List getTooltip(@Nonnull Minecraft minecraft, @Nonnull ItemStack list.add(""); list.add(EnumChatFormatting.ITALIC + Translator.translateToLocal("gui.jei.editMode.description")); if (Config.isItemOnConfigBlacklist(itemStack, false)) { - list.add(EnumChatFormatting.YELLOW + Translator.translateToLocal("gui.jei.editMode.description.show")); + String description = EnumChatFormatting.YELLOW + Translator.translateToLocal("gui.jei.editMode.description.show"); + list.addAll(minecraft.fontRendererObj.listFormattedStringToWidth(description, Constants.MAX_TOOLTIP_WIDTH)); } else { - list.add(EnumChatFormatting.YELLOW + Translator.translateToLocal("gui.jei.editMode.description.hide")); + String description = EnumChatFormatting.YELLOW + Translator.translateToLocal("gui.jei.editMode.description.hide"); + list.addAll(minecraft.fontRendererObj.listFormattedStringToWidth(description, Constants.MAX_TOOLTIP_WIDTH)); } - if (Config.isItemOnConfigBlacklist(itemStack, true)) { - list.add(EnumChatFormatting.RED + Translator.translateToLocal("gui.jei.editMode.description.show.wild")); - } else { - list.add(EnumChatFormatting.RED + Translator.translateToLocal("gui.jei.editMode.description.hide.wild")); + Item item = itemStack.getItem(); + if (item.getHasSubtypes()) { + if (Config.isItemOnConfigBlacklist(itemStack, true)) { + String description = EnumChatFormatting.RED + Translator.translateToLocal("gui.jei.editMode.description.show.wild"); + list.addAll(minecraft.fontRendererObj.listFormattedStringToWidth(description, Constants.MAX_TOOLTIP_WIDTH)); + } else { + String description = EnumChatFormatting.RED + Translator.translateToLocal("gui.jei.editMode.description.hide.wild"); + list.addAll(minecraft.fontRendererObj.listFormattedStringToWidth(description, Constants.MAX_TOOLTIP_WIDTH)); + } } } diff --git a/src/main/java/mezz/jei/input/InputHandler.java b/src/main/java/mezz/jei/input/InputHandler.java index d31f11aea..eb7ff1317 100644 --- a/src/main/java/mezz/jei/input/InputHandler.java +++ b/src/main/java/mezz/jei/input/InputHandler.java @@ -8,6 +8,8 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; @@ -127,19 +129,7 @@ private Focus getFocusUnderMouseForKey(int mouseX, int mouseY) { private boolean handleMouseClickedFocus(int mouseButton, @Nonnull Focus focus) { if (Config.editModeEnabled && GuiScreen.isCtrlKeyDown()) { - Boolean wildcard = null; - if (mouseButton == 0) { - wildcard = false; - } else if (mouseButton == 1) { - wildcard = true; - } - - if (wildcard != null) { - if (Config.isItemOnConfigBlacklist(focus.getStack(), wildcard)) { - Config.removeItemFromConfigBlacklist(focus.getStack(), wildcard); - } else { - Config.addItemToConfigBlacklist(focus.getStack(), wildcard); - } + if (handleClickEditStack(mouseButton, focus)) { return true; } } @@ -169,6 +159,33 @@ private boolean handleMouseClickedFocus(int mouseButton, @Nonnull Focus focus) { return false; } + private boolean handleClickEditStack(int mouseButton, @Nonnull Focus focus) { + ItemStack itemStack = focus.getStack(); + if (itemStack == null) { + return false; + } + + boolean wildcard; + if (mouseButton == 0) { + wildcard = false; + } else if (mouseButton == 1) { + wildcard = true; + } else { + return false; + } + + if (Config.isItemOnConfigBlacklist(focus.getStack(), wildcard)) { + Config.removeItemFromConfigBlacklist(focus.getStack(), wildcard); + } else { + Item item = itemStack.getItem(); + if (wildcard && !item.getHasSubtypes()) { + return false; + } + Config.addItemToConfigBlacklist(focus.getStack(), wildcard); + } + return true; + } + public boolean handleKeyEvent() { boolean cancelEvent = false; if (Keyboard.getEventKeyState()) {