From 4ed25ab0765dc0a2fae2e593c59dc695fc093cd2 Mon Sep 17 00:00:00 2001 From: Marwane Kalam-Alami Date: Tue, 20 Nov 2012 12:54:24 +0100 Subject: [PATCH 01/30] Deobfuscate sources & Refactor them for MCP --- .gitignore | 40 +- docs/make.bat | 190 ------- {docs => invtweaks_docs}/Makefile | 0 {docs => invtweaks_docs}/README.md | 0 .../_static/img/button10px.png | Bin {docs => invtweaks_docs}/_static/img/demo.jpg | Bin {docs => invtweaks_docs}/_static/img/dl.png | Bin .../_static/img/flag/cn.png | Bin .../_static/img/flag/dk.png | Bin .../_static/img/flag/es.png | Bin .../_static/img/flag/fr.png | Bin .../_static/img/flag/it.png | Bin .../_static/img/flag/jp.png | Bin .../_static/img/flag/kr.png | Bin .../_static/img/flag/nl.png | Bin .../_static/img/flag/pl.png | Bin .../_static/img/flag/pt.png | Bin .../_static/img/flag/ru.png | Bin .../_static/img/flag/tw.png | Bin .../_static/img/flag/us.png | Bin .../_static/img/invtweaks.png | Bin .../_themes/nature-custom/static/nature.css_t | 0 .../_themes/nature-custom/static/pygments.css | 0 .../_themes/nature-custom/theme.conf | 0 {docs => invtweaks_docs}/changelog.txt | 0 {docs => invtweaks_docs}/conf.py | 0 {docs => invtweaks_docs}/download.txt | 0 {docs => invtweaks_docs}/index.txt | 0 {docs => invtweaks_docs}/index_cn.txt | 0 {docs => invtweaks_docs}/index_de.txt | 0 {docs => invtweaks_docs}/index_dk.txt | 0 {docs => invtweaks_docs}/index_es.txt | 0 {docs => invtweaks_docs}/index_fr.txt | 0 {docs => invtweaks_docs}/index_it.txt | 0 {docs => invtweaks_docs}/index_jp.txt | 0 {docs => invtweaks_docs}/index_kr.txt | 0 {docs => invtweaks_docs}/index_nl.txt | 0 {docs => invtweaks_docs}/index_pl.txt | 0 {docs => invtweaks_docs}/index_pt.txt | 0 {docs => invtweaks_docs}/index_ru.txt | 0 {docs => invtweaks_docs}/index_tw.txt | 0 {docs => invtweaks_docs}/langs.txt | 0 mcp/pom.xml | 148 +++++ obfutils.sh | 22 - pom.xml | 8 +- src/InvTweaksObfuscation.java | 492 ----------------- src/InvTweaksObfuscationGuiButton.java | 55 -- src/doc/README.txt | 9 - src/doc/license.txt | 24 - .../invtweaks}/DefaultConfig.dat | 0 src/{ => minecraft/invtweaks}/DefaultTree.dat | 0 src/{ => minecraft/invtweaks}/InvTweaks.java | 54 +- .../invtweaks}/InvTweaksConfig.java | 2 + .../InvTweaksConfigInventoryRuleset.java | 3 +- .../invtweaks}/InvTweaksConfigManager.java | 3 +- .../invtweaks}/InvTweaksConfigProperties.java | 2 +- .../InvTweaksConfigSortingRule.java | 5 +- .../InvTweaksConfigSortingRuleType.java | 2 + .../invtweaks/InvTweaksConst.java | 7 +- .../invtweaks}/InvTweaksContainerManager.java | 63 ++- .../invtweaks}/InvTweaksContainerSection.java | 2 + .../InvTweaksContainerSectionManager.java | 13 +- .../invtweaks}/InvTweaksGuiIconButton.java | 10 +- .../invtweaks}/InvTweaksGuiSettings.java | 28 +- .../InvTweaksGuiSettingsAbstract.java | 27 +- .../InvTweaksGuiSettingsAdvanced.java | 30 +- .../InvTweaksGuiSettingsButton.java | 19 +- .../invtweaks}/InvTweaksGuiShortcutsHelp.java | 33 +- .../invtweaks}/InvTweaksGuiSortingButton.java | 14 +- .../invtweaks}/InvTweaksGuiTooltipButton.java | 14 +- .../InvTweaksHandlerAutoRefill.java | 8 +- .../invtweaks}/InvTweaksHandlerShortcuts.java | 23 +- .../invtweaks}/InvTweaksHandlerSorting.java | 37 +- .../invtweaks/InvTweaksItemTree.java | 0 .../invtweaks/InvTweaksItemTreeCategory.java | 0 .../invtweaks/InvTweaksItemTreeItem.java | 0 .../invtweaks/InvTweaksItemTreeListener.java | 0 .../invtweaks/InvTweaksItemTreeLoader.java | 0 .../invtweaks}/InvTweaksLocalization.java | 4 + .../invtweaks}/InvTweaksModCompatibility.java | 26 +- .../InvTweaksObfuscationGuiButton.java | 44 ++ .../invtweaks}/InvTweaksShortcutMapping.java | 2 + .../invtweaks}/InvTweaksShortcutType.java | 2 + .../invtweaks/lang/_README.txt | 0 .../invtweaks/lang/da_DK.properties | 0 .../invtweaks/lang/de_DE.properties | 0 .../invtweaks/lang/en_US.properties | 0 .../invtweaks/lang/es_ES.properties | 0 .../invtweaks/lang/fr_FR.properties | 0 .../invtweaks/lang/ja_JP.properties | 0 .../invtweaks/lang/ko_KR.properties | 0 .../invtweaks/lang/nb_NO.properties | 0 .../invtweaks/lang/nl_NL.properties | 0 .../invtweaks/lang/pl_PL.properties | 0 .../invtweaks/lang/pt_BR.properties | 0 .../invtweaks/lang/pt_PT.properties | 0 .../invtweaks/lang/ru_RU.properties | 0 .../invtweaks/lang/sv_SE.properties | 0 .../invtweaks/lang/tr_TR.properties | 0 .../invtweaks/lang/uk_UA.properties | 0 .../invtweaks/lang/zh_CN.properties | 0 .../invtweaks/lang/zh_TW.properties | 0 .../minecraft/src/InvTweaksObfuscation.java | 509 ++++++++++++++++++ .../net/minecraft/src}/mod_InvTweaks.java | 7 +- 104 files changed, 990 insertions(+), 991 deletions(-) delete mode 100755 docs/make.bat rename {docs => invtweaks_docs}/Makefile (100%) mode change 100755 => 100644 rename {docs => invtweaks_docs}/README.md (100%) rename {docs => invtweaks_docs}/_static/img/button10px.png (100%) rename {docs => invtweaks_docs}/_static/img/demo.jpg (100%) mode change 100755 => 100644 rename {docs => invtweaks_docs}/_static/img/dl.png (100%) rename {docs => invtweaks_docs}/_static/img/flag/cn.png (100%) mode change 100755 => 100644 rename {docs => invtweaks_docs}/_static/img/flag/dk.png (100%) mode change 100755 => 100644 rename {docs => invtweaks_docs}/_static/img/flag/es.png (100%) mode change 100755 => 100644 rename {docs => invtweaks_docs}/_static/img/flag/fr.png (100%) mode change 100755 => 100644 rename {docs => invtweaks_docs}/_static/img/flag/it.png (100%) mode change 100755 => 100644 rename {docs => invtweaks_docs}/_static/img/flag/jp.png (100%) mode change 100755 => 100644 rename {docs => invtweaks_docs}/_static/img/flag/kr.png (100%) mode change 100755 => 100644 rename {docs => invtweaks_docs}/_static/img/flag/nl.png (100%) mode change 100755 => 100644 rename {docs => invtweaks_docs}/_static/img/flag/pl.png (100%) mode change 100755 => 100644 rename {docs => invtweaks_docs}/_static/img/flag/pt.png (100%) mode change 100755 => 100644 rename {docs => invtweaks_docs}/_static/img/flag/ru.png (100%) mode change 100755 => 100644 rename {docs => invtweaks_docs}/_static/img/flag/tw.png (100%) mode change 100755 => 100644 rename {docs => invtweaks_docs}/_static/img/flag/us.png (100%) mode change 100755 => 100644 rename {docs => invtweaks_docs}/_static/img/invtweaks.png (100%) mode change 100755 => 100644 rename {docs => invtweaks_docs}/_themes/nature-custom/static/nature.css_t (100%) rename {docs => invtweaks_docs}/_themes/nature-custom/static/pygments.css (100%) rename {docs => invtweaks_docs}/_themes/nature-custom/theme.conf (100%) rename {docs => invtweaks_docs}/changelog.txt (100%) mode change 100755 => 100644 rename {docs => invtweaks_docs}/conf.py (100%) mode change 100755 => 100644 rename {docs => invtweaks_docs}/download.txt (100%) rename {docs => invtweaks_docs}/index.txt (100%) mode change 100755 => 100644 rename {docs => invtweaks_docs}/index_cn.txt (100%) rename {docs => invtweaks_docs}/index_de.txt (100%) rename {docs => invtweaks_docs}/index_dk.txt (100%) rename {docs => invtweaks_docs}/index_es.txt (100%) rename {docs => invtweaks_docs}/index_fr.txt (100%) rename {docs => invtweaks_docs}/index_it.txt (100%) rename {docs => invtweaks_docs}/index_jp.txt (100%) rename {docs => invtweaks_docs}/index_kr.txt (100%) rename {docs => invtweaks_docs}/index_nl.txt (100%) rename {docs => invtweaks_docs}/index_pl.txt (100%) rename {docs => invtweaks_docs}/index_pt.txt (100%) rename {docs => invtweaks_docs}/index_ru.txt (100%) rename {docs => invtweaks_docs}/index_tw.txt (100%) rename {docs => invtweaks_docs}/langs.txt (100%) create mode 100644 mcp/pom.xml delete mode 100755 obfutils.sh delete mode 100755 src/InvTweaksObfuscation.java delete mode 100755 src/InvTweaksObfuscationGuiButton.java delete mode 100644 src/doc/README.txt delete mode 100644 src/doc/license.txt rename src/{ => minecraft/invtweaks}/DefaultConfig.dat (100%) rename src/{ => minecraft/invtweaks}/DefaultTree.dat (100%) rename src/{ => minecraft/invtweaks}/InvTweaks.java (95%) rename src/{ => minecraft/invtweaks}/InvTweaksConfig.java (99%) rename src/{ => minecraft/invtweaks}/InvTweaksConfigInventoryRuleset.java (99%) rename src/{ => minecraft/invtweaks}/InvTweaksConfigManager.java (99%) rename src/{ => minecraft/invtweaks}/InvTweaksConfigProperties.java (97%) mode change 100755 => 100644 rename src/{ => minecraft/invtweaks}/InvTweaksConfigSortingRule.java (99%) rename src/{ => minecraft/invtweaks}/InvTweaksConfigSortingRuleType.java (96%) mode change 100755 => 100644 rename src/{ => minecraft}/invtweaks/InvTweaksConst.java (93%) rename src/{ => minecraft/invtweaks}/InvTweaksContainerManager.java (90%) mode change 100755 => 100644 rename src/{ => minecraft/invtweaks}/InvTweaksContainerSection.java (97%) mode change 100755 => 100644 rename src/{ => minecraft/invtweaks}/InvTweaksContainerSectionManager.java (90%) mode change 100755 => 100644 rename src/{ => minecraft/invtweaks}/InvTweaksGuiIconButton.java (91%) mode change 100755 => 100644 rename src/{ => minecraft/invtweaks}/InvTweaksGuiSettings.java (87%) rename src/{ => minecraft/invtweaks}/InvTweaksGuiSettingsAbstract.java (71%) mode change 100755 => 100644 rename src/{ => minecraft/invtweaks}/InvTweaksGuiSettingsAdvanced.java (81%) mode change 100755 => 100644 rename src/{ => minecraft/invtweaks}/InvTweaksGuiSettingsButton.java (86%) mode change 100755 => 100644 rename src/{ => minecraft/invtweaks}/InvTweaksGuiShortcutsHelp.java (78%) mode change 100755 => 100644 rename src/{ => minecraft/invtweaks}/InvTweaksGuiSortingButton.java (89%) mode change 100755 => 100644 rename src/{ => minecraft/invtweaks}/InvTweaksGuiTooltipButton.java (93%) mode change 100755 => 100644 rename src/{ => minecraft/invtweaks}/InvTweaksHandlerAutoRefill.java (97%) rename src/{ => minecraft/invtweaks}/InvTweaksHandlerShortcuts.java (96%) mode change 100755 => 100644 rename src/{ => minecraft/invtweaks}/InvTweaksHandlerSorting.java (95%) rename src/{ => minecraft}/invtweaks/InvTweaksItemTree.java (100%) rename src/{ => minecraft}/invtweaks/InvTweaksItemTreeCategory.java (100%) rename src/{ => minecraft}/invtweaks/InvTweaksItemTreeItem.java (100%) rename src/{ => minecraft}/invtweaks/InvTweaksItemTreeListener.java (100%) mode change 100755 => 100644 rename src/{ => minecraft}/invtweaks/InvTweaksItemTreeLoader.java (100%) rename src/{ => minecraft/invtweaks}/InvTweaksLocalization.java (96%) rename src/{ => minecraft/invtweaks}/InvTweaksModCompatibility.java (82%) mode change 100755 => 100644 create mode 100644 src/minecraft/invtweaks/InvTweaksObfuscationGuiButton.java rename src/{ => minecraft/invtweaks}/InvTweaksShortcutMapping.java (98%) mode change 100755 => 100644 rename src/{ => minecraft/invtweaks}/InvTweaksShortcutType.java (94%) mode change 100755 => 100644 rename src/{ => minecraft}/invtweaks/lang/_README.txt (100%) mode change 100755 => 100644 rename src/{ => minecraft}/invtweaks/lang/da_DK.properties (100%) mode change 100755 => 100644 rename src/{ => minecraft}/invtweaks/lang/de_DE.properties (100%) mode change 100755 => 100644 rename src/{ => minecraft}/invtweaks/lang/en_US.properties (100%) mode change 100755 => 100644 rename src/{ => minecraft}/invtweaks/lang/es_ES.properties (100%) mode change 100755 => 100644 rename src/{ => minecraft}/invtweaks/lang/fr_FR.properties (100%) mode change 100755 => 100644 rename src/{ => minecraft}/invtweaks/lang/ja_JP.properties (100%) mode change 100755 => 100644 rename src/{ => minecraft}/invtweaks/lang/ko_KR.properties (100%) mode change 100755 => 100644 rename src/{ => minecraft}/invtweaks/lang/nb_NO.properties (100%) rename src/{ => minecraft}/invtweaks/lang/nl_NL.properties (100%) mode change 100755 => 100644 rename src/{ => minecraft}/invtweaks/lang/pl_PL.properties (100%) mode change 100755 => 100644 rename src/{ => minecraft}/invtweaks/lang/pt_BR.properties (100%) mode change 100755 => 100644 rename src/{ => minecraft}/invtweaks/lang/pt_PT.properties (100%) mode change 100755 => 100644 rename src/{ => minecraft}/invtweaks/lang/ru_RU.properties (100%) mode change 100755 => 100644 rename src/{ => minecraft}/invtweaks/lang/sv_SE.properties (100%) mode change 100755 => 100644 rename src/{ => minecraft}/invtweaks/lang/tr_TR.properties (100%) mode change 100755 => 100644 rename src/{ => minecraft}/invtweaks/lang/uk_UA.properties (100%) mode change 100755 => 100644 rename src/{ => minecraft}/invtweaks/lang/zh_CN.properties (100%) mode change 100755 => 100644 rename src/{ => minecraft}/invtweaks/lang/zh_TW.properties (100%) mode change 100755 => 100644 create mode 100644 src/minecraft/net/minecraft/src/InvTweaksObfuscation.java rename src/{ => minecraft/net/minecraft/src}/mod_InvTweaks.java (91%) diff --git a/.gitignore b/.gitignore index 967255e4..b3f5c26e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,19 +1,43 @@ +# Filter Minecraft sources +/src/minecraft/* +!/src/minecraft/invtweaks +!/src/minecraft/net +/src/minecraft/net/minecraft/client +/src/minecraft/net/minecraft/server +/src/minecraft/net/minecraft/src/* +!/src/minecraft/net/minecraft/src/InvTweaks* + +# Builds & binaries bin/ target/ lib/ -client/ -isom/ -InvTweaks-*/ -files/ +invtweaks_docs/_build launcher/ -docs/_build *.zip *.jar -minecraft/net/minecraft/src/*.java -*# + +# Tmp files *~ -*.rej +*# + +# IDEs .classpath .project .settings .pydevproject + +# MCP Files +docs/ +conf/ +eclipse/ +jars/ +logs/ +runtime/ +temp/ +CHANGELOG +LICENSE.txt +*.bat +*.sh + +# Misc +*.rej diff --git a/docs/make.bat b/docs/make.bat deleted file mode 100755 index 61f12477..00000000 --- a/docs/make.bat +++ /dev/null @@ -1,190 +0,0 @@ -@ECHO OFF - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set BUILDDIR=_build -set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . -set I18NSPHINXOPTS=%SPHINXOPTS% . -if NOT "%PAPER%" == "" ( - set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% - set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% -) - -if "%1" == "" goto help - -if "%1" == "help" ( - :help - echo.Please use `make ^` where ^ is one of - echo. html to make standalone HTML files - echo. dirhtml to make HTML files named index.html in directories - echo. singlehtml to make a single large HTML file - echo. pickle to make pickle files - echo. json to make JSON files - echo. htmlhelp to make HTML files and a HTML help project - echo. qthelp to make HTML files and a qthelp project - echo. devhelp to make HTML files and a Devhelp project - echo. epub to make an epub - echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter - echo. text to make text files - echo. man to make manual pages - echo. texinfo to make Texinfo files - echo. gettext to make PO message catalogs - echo. changes to make an overview over all changed/added/deprecated items - echo. linkcheck to check all external links for integrity - echo. doctest to run all doctests embedded in the documentation if enabled - goto end -) - -if "%1" == "clean" ( - for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i - del /q /s %BUILDDIR%\* - goto end -) - -if "%1" == "html" ( - %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/html. - goto end -) - -if "%1" == "dirhtml" ( - %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. - goto end -) - -if "%1" == "singlehtml" ( - %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. - goto end -) - -if "%1" == "pickle" ( - %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can process the pickle files. - goto end -) - -if "%1" == "json" ( - %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can process the JSON files. - goto end -) - -if "%1" == "htmlhelp" ( - %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can run HTML Help Workshop with the ^ -.hhp project file in %BUILDDIR%/htmlhelp. - goto end -) - -if "%1" == "qthelp" ( - %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can run "qcollectiongenerator" with the ^ -.qhcp project file in %BUILDDIR%/qthelp, like this: - echo.^> qcollectiongenerator %BUILDDIR%\qthelp\InventoryTweaks.qhcp - echo.To view the help file: - echo.^> assistant -collectionFile %BUILDDIR%\qthelp\InventoryTweaks.ghc - goto end -) - -if "%1" == "devhelp" ( - %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. - goto end -) - -if "%1" == "epub" ( - %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The epub file is in %BUILDDIR%/epub. - goto end -) - -if "%1" == "latex" ( - %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. - goto end -) - -if "%1" == "text" ( - %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The text files are in %BUILDDIR%/text. - goto end -) - -if "%1" == "man" ( - %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The manual pages are in %BUILDDIR%/man. - goto end -) - -if "%1" == "texinfo" ( - %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. - goto end -) - -if "%1" == "gettext" ( - %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The message catalogs are in %BUILDDIR%/locale. - goto end -) - -if "%1" == "changes" ( - %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes - if errorlevel 1 exit /b 1 - echo. - echo.The overview file is in %BUILDDIR%/changes. - goto end -) - -if "%1" == "linkcheck" ( - %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck - if errorlevel 1 exit /b 1 - echo. - echo.Link check complete; look for any errors in the above output ^ -or in %BUILDDIR%/linkcheck/output.txt. - goto end -) - -if "%1" == "doctest" ( - %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest - if errorlevel 1 exit /b 1 - echo. - echo.Testing of doctests in the sources finished, look at the ^ -results in %BUILDDIR%/doctest/output.txt. - goto end -) - -:end diff --git a/docs/Makefile b/invtweaks_docs/Makefile old mode 100755 new mode 100644 similarity index 100% rename from docs/Makefile rename to invtweaks_docs/Makefile diff --git a/docs/README.md b/invtweaks_docs/README.md similarity index 100% rename from docs/README.md rename to invtweaks_docs/README.md diff --git a/docs/_static/img/button10px.png b/invtweaks_docs/_static/img/button10px.png similarity index 100% rename from docs/_static/img/button10px.png rename to invtweaks_docs/_static/img/button10px.png diff --git a/docs/_static/img/demo.jpg b/invtweaks_docs/_static/img/demo.jpg old mode 100755 new mode 100644 similarity index 100% rename from docs/_static/img/demo.jpg rename to invtweaks_docs/_static/img/demo.jpg diff --git a/docs/_static/img/dl.png b/invtweaks_docs/_static/img/dl.png similarity index 100% rename from docs/_static/img/dl.png rename to invtweaks_docs/_static/img/dl.png diff --git a/docs/_static/img/flag/cn.png b/invtweaks_docs/_static/img/flag/cn.png old mode 100755 new mode 100644 similarity index 100% rename from docs/_static/img/flag/cn.png rename to invtweaks_docs/_static/img/flag/cn.png diff --git a/docs/_static/img/flag/dk.png b/invtweaks_docs/_static/img/flag/dk.png old mode 100755 new mode 100644 similarity index 100% rename from docs/_static/img/flag/dk.png rename to invtweaks_docs/_static/img/flag/dk.png diff --git a/docs/_static/img/flag/es.png b/invtweaks_docs/_static/img/flag/es.png old mode 100755 new mode 100644 similarity index 100% rename from docs/_static/img/flag/es.png rename to invtweaks_docs/_static/img/flag/es.png diff --git a/docs/_static/img/flag/fr.png b/invtweaks_docs/_static/img/flag/fr.png old mode 100755 new mode 100644 similarity index 100% rename from docs/_static/img/flag/fr.png rename to invtweaks_docs/_static/img/flag/fr.png diff --git a/docs/_static/img/flag/it.png b/invtweaks_docs/_static/img/flag/it.png old mode 100755 new mode 100644 similarity index 100% rename from docs/_static/img/flag/it.png rename to invtweaks_docs/_static/img/flag/it.png diff --git a/docs/_static/img/flag/jp.png b/invtweaks_docs/_static/img/flag/jp.png old mode 100755 new mode 100644 similarity index 100% rename from docs/_static/img/flag/jp.png rename to invtweaks_docs/_static/img/flag/jp.png diff --git a/docs/_static/img/flag/kr.png b/invtweaks_docs/_static/img/flag/kr.png old mode 100755 new mode 100644 similarity index 100% rename from docs/_static/img/flag/kr.png rename to invtweaks_docs/_static/img/flag/kr.png diff --git a/docs/_static/img/flag/nl.png b/invtweaks_docs/_static/img/flag/nl.png old mode 100755 new mode 100644 similarity index 100% rename from docs/_static/img/flag/nl.png rename to invtweaks_docs/_static/img/flag/nl.png diff --git a/docs/_static/img/flag/pl.png b/invtweaks_docs/_static/img/flag/pl.png old mode 100755 new mode 100644 similarity index 100% rename from docs/_static/img/flag/pl.png rename to invtweaks_docs/_static/img/flag/pl.png diff --git a/docs/_static/img/flag/pt.png b/invtweaks_docs/_static/img/flag/pt.png old mode 100755 new mode 100644 similarity index 100% rename from docs/_static/img/flag/pt.png rename to invtweaks_docs/_static/img/flag/pt.png diff --git a/docs/_static/img/flag/ru.png b/invtweaks_docs/_static/img/flag/ru.png old mode 100755 new mode 100644 similarity index 100% rename from docs/_static/img/flag/ru.png rename to invtweaks_docs/_static/img/flag/ru.png diff --git a/docs/_static/img/flag/tw.png b/invtweaks_docs/_static/img/flag/tw.png old mode 100755 new mode 100644 similarity index 100% rename from docs/_static/img/flag/tw.png rename to invtweaks_docs/_static/img/flag/tw.png diff --git a/docs/_static/img/flag/us.png b/invtweaks_docs/_static/img/flag/us.png old mode 100755 new mode 100644 similarity index 100% rename from docs/_static/img/flag/us.png rename to invtweaks_docs/_static/img/flag/us.png diff --git a/docs/_static/img/invtweaks.png b/invtweaks_docs/_static/img/invtweaks.png old mode 100755 new mode 100644 similarity index 100% rename from docs/_static/img/invtweaks.png rename to invtweaks_docs/_static/img/invtweaks.png diff --git a/docs/_themes/nature-custom/static/nature.css_t b/invtweaks_docs/_themes/nature-custom/static/nature.css_t similarity index 100% rename from docs/_themes/nature-custom/static/nature.css_t rename to invtweaks_docs/_themes/nature-custom/static/nature.css_t diff --git a/docs/_themes/nature-custom/static/pygments.css b/invtweaks_docs/_themes/nature-custom/static/pygments.css similarity index 100% rename from docs/_themes/nature-custom/static/pygments.css rename to invtweaks_docs/_themes/nature-custom/static/pygments.css diff --git a/docs/_themes/nature-custom/theme.conf b/invtweaks_docs/_themes/nature-custom/theme.conf similarity index 100% rename from docs/_themes/nature-custom/theme.conf rename to invtweaks_docs/_themes/nature-custom/theme.conf diff --git a/docs/changelog.txt b/invtweaks_docs/changelog.txt old mode 100755 new mode 100644 similarity index 100% rename from docs/changelog.txt rename to invtweaks_docs/changelog.txt diff --git a/docs/conf.py b/invtweaks_docs/conf.py old mode 100755 new mode 100644 similarity index 100% rename from docs/conf.py rename to invtweaks_docs/conf.py diff --git a/docs/download.txt b/invtweaks_docs/download.txt similarity index 100% rename from docs/download.txt rename to invtweaks_docs/download.txt diff --git a/docs/index.txt b/invtweaks_docs/index.txt old mode 100755 new mode 100644 similarity index 100% rename from docs/index.txt rename to invtweaks_docs/index.txt diff --git a/docs/index_cn.txt b/invtweaks_docs/index_cn.txt similarity index 100% rename from docs/index_cn.txt rename to invtweaks_docs/index_cn.txt diff --git a/docs/index_de.txt b/invtweaks_docs/index_de.txt similarity index 100% rename from docs/index_de.txt rename to invtweaks_docs/index_de.txt diff --git a/docs/index_dk.txt b/invtweaks_docs/index_dk.txt similarity index 100% rename from docs/index_dk.txt rename to invtweaks_docs/index_dk.txt diff --git a/docs/index_es.txt b/invtweaks_docs/index_es.txt similarity index 100% rename from docs/index_es.txt rename to invtweaks_docs/index_es.txt diff --git a/docs/index_fr.txt b/invtweaks_docs/index_fr.txt similarity index 100% rename from docs/index_fr.txt rename to invtweaks_docs/index_fr.txt diff --git a/docs/index_it.txt b/invtweaks_docs/index_it.txt similarity index 100% rename from docs/index_it.txt rename to invtweaks_docs/index_it.txt diff --git a/docs/index_jp.txt b/invtweaks_docs/index_jp.txt similarity index 100% rename from docs/index_jp.txt rename to invtweaks_docs/index_jp.txt diff --git a/docs/index_kr.txt b/invtweaks_docs/index_kr.txt similarity index 100% rename from docs/index_kr.txt rename to invtweaks_docs/index_kr.txt diff --git a/docs/index_nl.txt b/invtweaks_docs/index_nl.txt similarity index 100% rename from docs/index_nl.txt rename to invtweaks_docs/index_nl.txt diff --git a/docs/index_pl.txt b/invtweaks_docs/index_pl.txt similarity index 100% rename from docs/index_pl.txt rename to invtweaks_docs/index_pl.txt diff --git a/docs/index_pt.txt b/invtweaks_docs/index_pt.txt similarity index 100% rename from docs/index_pt.txt rename to invtweaks_docs/index_pt.txt diff --git a/docs/index_ru.txt b/invtweaks_docs/index_ru.txt similarity index 100% rename from docs/index_ru.txt rename to invtweaks_docs/index_ru.txt diff --git a/docs/index_tw.txt b/invtweaks_docs/index_tw.txt similarity index 100% rename from docs/index_tw.txt rename to invtweaks_docs/index_tw.txt diff --git a/docs/langs.txt b/invtweaks_docs/langs.txt similarity index 100% rename from docs/langs.txt rename to invtweaks_docs/langs.txt diff --git a/mcp/pom.xml b/mcp/pom.xml new file mode 100644 index 00000000..cbeb664f --- /dev/null +++ b/mcp/pom.xml @@ -0,0 +1,148 @@ + + 4.0.0 + + net.jimeowan + inventory-tweaks + 1.45-1.4.4 + jar + Inventory Tweaks + + + UTF-8 + InvTweaks-${project.version} + + + + ${archive.name} + + + src + + + . + false + src + + doc/* + invtweaks/lang/* + *.dat + + + *.java + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + 1.6 + 1.6 + + + + org.apache.maven.plugins + maven-antrun-plugin + 1.6 + + + + move + + run + + package + + + + + + + + + deploy + + run + + install + + + + + + + + + + + + + + + + + + + minecraft-path-windows + + + windows + + + + ${user.home}/AppData/Roaming/.minecraft/ + ${minecraft.path}bin/ + + + + minecraft-path-linux + + + unix + + + + ${user.home}/.minecraft/ + ${minecraft.path}bin/ + + + + minecraft-path-mac + + + unix + mac os x + + + + ${user.home}/Library/Application Support/minecraft/ + ${minecraft.path}bin/ + + + + + + + + net.minecraft + lwjgl + 1.8 + system + ${minecraft.bin.path}lwjgl.jar + + + net.minecraft + lwjgl_util + 1.8 + system + ${minecraft.bin.path}lwjgl_util.jar + + + + diff --git a/obfutils.sh b/obfutils.sh deleted file mode 100755 index 356a6ef1..00000000 --- a/obfutils.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -# Replacement utils, helpful when updating the mod. -# @author Jimeo Wan -# License: MIT - -# Replace class names -if [[ ($1 == "-class") && $2 && $3 ]] -then - sed -i "s/\([(< ]\)$2\([)> ]\)/\1$3\2/" src/*.java - -else - HELP=1 -fi - -# Help -if [ $help ] -then - echo 'Usage:' - echo 'obfutils.sh -class FROMCLASS TOCLASS' -fi - diff --git a/pom.xml b/pom.xml index de1dfc8a..d8a01134 100755 --- a/pom.xml +++ b/pom.xml @@ -18,7 +18,7 @@ ${archive.name} - src + src/minecraft . @@ -134,21 +134,21 @@ minecraft any system - ${minecraft.bin.path}minecraft.jar + ${basedir}/jars/bin/minecraft.jar net.minecraft lwjgl 1.8 system - ${minecraft.bin.path}lwjgl.jar + ${basedir}/jars/bin/lwjgl.jar net.minecraft lwjgl_util 1.8 system - ${minecraft.bin.path}lwjgl_util.jar + ${basedir}/jars/bin/lwjgl_util.jar diff --git a/src/InvTweaksObfuscation.java b/src/InvTweaksObfuscation.java deleted file mode 100755 index 5df19d1f..00000000 --- a/src/InvTweaksObfuscation.java +++ /dev/null @@ -1,492 +0,0 @@ -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.logging.Logger; - -import net.minecraft.client.Minecraft; - -/** - * Minecraft 1.3 Obfuscation layer - * - * @author Jimeo Wan - * - */ -public class InvTweaksObfuscation { - - private static final Logger log = Logger.getLogger("InvTweaks"); - - protected Minecraft mc; - - protected InvTweaksModCompatibility mods; - - private static Map fieldsMap = new HashMap(); - - static { - // CreativeSlot.underlyingSlot - makeFieldPublic(avn.class, "b"); - // RenderEngine.texturePack - makeFieldPublic(bap.class, "k"); - } - - public InvTweaksObfuscation(Minecraft mc) { - this.mc = mc; - this.mods = new InvTweaksModCompatibility(this); - } - - // Minecraft members - - protected void addChatMessage(String message) { - if (mc.v != null) { - mc.v.b().a(message); - } - } - protected ayk getThePlayer() { // EntityPlayer - return mc.g; - } - protected ayh getTheWorld() { // World - return mc.e; - } - protected ayg getPlayerController() { // PlayerController - return mc.b; - } - protected aue getCurrentScreen() { // GuiScreen - return mc.r; - } - protected atj getFontRenderer() { // FontRenderer - return mc.p; - } - protected void displayGuiScreen(aue parentScreen) { - mc.a(parentScreen); - } - protected int getDisplayWidth() { - return mc.c; - } - protected int getDisplayHeight() { - return mc.d; - } - protected asl getGameSettings() { - return mc.y; - } - public arn[] getRegisteredBindings() { - return getGameSettings().P; - } - public void setRegisteredBindings(arn[] bindings) { - getGameSettings().P = bindings; - } - protected int getKeyBindingForwardKeyCode() { - return getKeyCode(getGameSettings().B); - } - protected int getKeyBindingBackKeyCode() { - return getKeyCode(getGameSettings().D); - } - - // EntityPlayer members - - protected qw getInventoryPlayer() { // InventoryPlayer - return getThePlayer().bI; - } - protected um getCurrentEquippedItem() { // ItemStack - return getThePlayer().bT(); - } - protected rp getCraftingInventory() { // Container - return getThePlayer().bJ; - } - protected rp getPlayerContainer() { // ContainerPlayer - return (rp) getThePlayer().bJ; // MCP name: inventorySlots // XXX Why the same as craftying inventory? - } - - // InventoryPlayer members - - protected um[] getMainInventory() { - return getInventoryPlayer().a; - } - protected void setMainInventory(um[] value) { - getInventoryPlayer().a = value; - } - protected void setHasInventoryChanged(boolean value) { - getInventoryPlayer().e = value; - } - protected void setHeldStack(um stack) { - getInventoryPlayer().b(stack); // setItemStack - } - protected boolean hasInventoryChanged() { - return getInventoryPlayer().e; - } - protected um getHeldStack() { - return getInventoryPlayer().n(); // getItemStack - } - protected um getFocusedStack() { - return getInventoryPlayer().g(); // getCurrentItem - } - protected int getFocusedSlot() { - return getInventoryPlayer().c; // currentItem - } - - // GuiScreen members - - protected int getWindowWidth(aue guiScreen) { - return guiScreen.g; - } - protected int getWindowHeight(aue guiScreen) { - return guiScreen.h; - } - protected int getGuiX(auy guiContainer) { // GuiContainer - return guiContainer.n; - } - protected int getGuiY(auy guiContainer) { - return guiContainer.o; - } - protected int getGuiWidth(auy guiContainer) { // GuiContainer - return guiContainer.b; - } - protected int getGuiHeight(auy guiContainer) { - return guiContainer.c; - } - @SuppressWarnings("unchecked") - protected List getControlList(aue guiScreen) { - return guiScreen.i; - } - protected void setControlList(aue guiScreen, List controlList) { - guiScreen.i = controlList; - } - protected auy asGuiContainer(aue guiScreen) { - return (auy) guiScreen; - } - - // FontRenderer members - - protected int getStringWidth(atj fontRenderer, String line) { - return fontRenderer.a(line); - } - protected void drawStringWithShadow(atj fontRenderer, - String s, int i, int j, int k) { - fontRenderer.a(s, i, j, k); - } - - // ItemStack members - - protected um createItemStack(int id, int size, int damage) { - return new um(id, size, damage); - } - protected um copy(um itemStack) { - return itemStack.l(); - } - protected int getItemDamage(um itemStack) { - return itemStack.j(); - } - protected int getMaxStackSize(um itemStack) { - return itemStack.d(); - } - protected boolean hasDataTags(um itemStack) { - return itemStack.o(); - } - protected int getStackSize(um itemStack) { - return itemStack.a; - } - protected int getItemID(um itemStack) { - return itemStack.c; - } - protected boolean areItemStacksEqual(um itemStack1, um itemStack2) { - return itemStack1.a(itemStack2) && getStackSize(itemStack1) == getStackSize(itemStack2); - } - protected boolean isItemStackDamageable(um itemStack) { - return itemStack.f(); - } - protected boolean areSameItemType(um itemStack1, um itemStack2) { - return areItemsEqual(itemStack1, itemStack2) || - (isItemStackDamageable(itemStack1) - && getItemID(itemStack1) == getItemID(itemStack2)); - } - protected boolean areItemsEqual(um itemStack1, um itemStack2) { - return itemStack1.a(itemStack2); // isItemEqual - } - protected int getAnimationsToGo(um itemStack) { - return itemStack.b; - } - protected uk getItem(um itemStack) { // Item - return itemStack.b(); - } - - // Item & ItemArmor - - protected boolean isDamageable(uk item) { - return item.n(); - } - protected int getMaxDamage(uk item) { - return item.m(); - } - protected int getArmorLevel(st itemArmor) { // ItemArmor - return itemArmor.b; - } - protected st asItemArmor(uk item) { // ItemArmor - return (st) item; - } - - // PlayerController members - - protected um clickInventory(ayg playerController, - int windowId, int slot, int clickButton, - boolean shiftHold, ayk entityPlayer) { - return playerController.a(windowId, slot, clickButton, - (shiftHold) ? 1 : 0 /* XXX Placeholder */, entityPlayer); - } - - // Container members - - protected int getWindowId(rp container) { - return container.d; - } - protected List getSlots(rp container) { - return container.c; - } - protected sq getSlot(rp container, int i) { // Slot - return (sq) (getSlots(container).get(i)); - } - - protected um getSlotStack(rp container, int i) { - sq slot = getSlot(container, i); - return (slot == null) ? null : getStack(slot); // getStack - } - - protected void setSlotStack(rp container, int i, um stack) { - container.a(i, stack); // putStackInSlot - } - - // Slot members - - protected boolean hasStack(sq slot) { - return slot.d(); - } - protected int getSlotNumber(sq slot) { - try { - // Creative slots don't set the "g" property, serve as a proxy for true slots - if (slot instanceof avn) { - sq underlyingSlot = (sq) getThroughReflection(avn.class, "b", slot); - if (underlyingSlot != null) { - return underlyingSlot.g; - } - } - } catch (Exception e) { - log.warning("Failed to access creative slot number"); - } - return slot.g; - } - protected um getStack(sq slot) { - return slot.c(); - } - protected int getXDisplayPosition(sq slot) { - return slot.h; - } - protected int getYDisplayPosition(sq slot) { - return slot.i; - } - protected boolean areSlotAndStackCompatible(sq slot, um itemStack) { - return slot.a(itemStack); // isItemValid - } - - // GuiContainer members - - protected rp getContainer(auy guiContainer) { - return guiContainer.d; /* inventorySlots */ - } - - // GuiButton - - protected ast asGuiButton(Object o) { - return (ast) o; - } - protected void setEnabled(ast guiButton, boolean enabled) { // GuiButton - guiButton.g = enabled; - } - protected int getId(ast guiButton) { // GuiButton - return guiButton.f; - } - protected void setDisplayString(ast guiButton, String string) { - guiButton.e = string; - } - protected String getDisplayString(ast guiButton) { - return guiButton.e; - } - - // Other - - protected void playSound(String string, float f, float g) { - mc.A.a(string, f, g); - } - protected long getCurrentTime() { - return getTheWorld().E(); - } - protected int getKeyCode(arn b) { // KeyBinding - return b.d; - } - protected int getSpecialChestRowSize(auy guiContainer, int defaultValue) { - return mods.getSpecialChestRowSize(guiContainer, defaultValue); - } - protected boolean hasTexture(String texture) { - bec texturePacksManager = (bec) getThroughReflection(bap.class, "k", mc.o); - return texturePacksManager != null && texturePacksManager.e().a(texture) != null; - } - - // Static access - - public static bn getLocalizationService() { // StringTranslate - return bn.a(); // StringTranslate.getInstance() - } - public static String getCurrentLanguage() { - return getLocalizationService().c(); - } - public static String getLocalizedString(String key) { - return getLocalizationService().b(key); - } - public static um getHoldStackStatic(Minecraft mc) { - return new InvTweaksObfuscation(mc).getHeldStack(); - } - public static aue getCurrentScreenStatic(Minecraft mc) { - return new InvTweaksObfuscation(mc).getCurrentScreen(); - } - - // Classes - - protected boolean isValidChest(aue guiScreen) { - return guiScreen != null && (isGuiChest(guiScreen) - || isGuiDispenser(guiScreen) - || mods.isSpecialChest(guiScreen)); - } - protected boolean isValidInventory(aue guiScreen) { - return isStandardInventory(guiScreen) - || mods.isSpecialInventory(guiScreen); - } - protected boolean isStandardInventory(aue guiScreen) { - return isGuiInventory(guiScreen) - || isGuiWorkbench(guiScreen) - || isGuiFurnace(guiScreen) - || isGuiBrewingStand(guiScreen) - || isGuiEnchantmentTable(guiScreen) - || isGuiTrading(guiScreen) - || isGuiAnvil(guiScreen) - || isGuiBeacon(guiScreen) - || (isGuiInventoryCreative(guiScreen) - && getSlots(getContainer(asGuiContainer(guiScreen))).size() == 46); - } - - protected boolean isGuiContainer(Object o) { // GuiContainer (abstract class) - return o != null && o instanceof auy; - } - - protected boolean isGuiBeacon(Object o) { // GuiBeacon - return o != null && o.getClass().equals(auz.class); - } - protected boolean isGuiBrewingStand(Object o) { // GuiBrewingStand - return o != null && o.getClass().equals(avg.class); - } - protected boolean isGuiChest(Object o) { // GuiChest - return o != null && o.getClass().equals(avi.class); - } - protected boolean isGuiWorkbench(Object o) { // GuiWorkbench - return o != null && o.getClass().equals(avj.class); - } - protected boolean isGuiInventoryCreative(Object o) { // GuiInventoryCreative - return o != null && o.getClass().equals(avl.class); - } - protected boolean isGuiEnchantmentTable(Object o) { // GuiEnchantmentTable - return o != null && o.getClass().equals(avq.class); - } - protected boolean isGuiFurnace(Object o) { // GuiFurnace - return o != null && o.getClass().equals(avr.class); - } - protected boolean isGuiInventory(Object o) { // GuiInventory - return o != null && o.getClass().equals(avs.class); - } - protected boolean isGuiTrading(Object o) { // GuiTrading - return o != null && o.getClass().equals(avt.class); - } - protected boolean isGuiAnvil(Object o) { // GuiAnvil - return o != null && o.getClass().equals(avv.class); - } - protected boolean isGuiDispenser(Object o) { // GuiDispenser - return o != null && o.getClass().equals(avx.class); - } - - protected boolean isGuiButton(Object o) { // GuiButton - return o != null && o instanceof ast; - } - - protected boolean isGuiEditSign(Object o) { // GuiEditSign - return o != null && o.getClass().equals(avw.class); - } - // ================ TODO ================ - - protected boolean isContainerBeacon(Object o) { // ContainerBeacon - return o != null && o.getClass().equals(rq.class); - } - protected boolean isContainerBrewingStand(Object o) { // ContainerBrewingStand - return o != null && o.getClass().equals(rs.class); - } - protected boolean isContainerChest(Object o) { // ContainerChest - return o != null && o.getClass().equals(rw.class); - } - protected boolean isContainerWorkbench(Object o) { // ContainerWorkbench - return o != null && o.getClass().equals(ry.class); - } - protected boolean isContainerEnchantmentTable(Object o) { // ContainerEnchantmentTable - return o != null && o.getClass().equals(rz.class); - } - protected boolean isContainerFurnace(Object o) { // ContainerFurnace - return o != null && o.getClass().equals(sc.class); - } - protected boolean isContainerPlayer(Object o) { // ContainerPlayer - return o != null && o.getClass().equals(se.class); - } - protected boolean isContainerTrading(Object o) { // ContainerTrading - return o != null && o.getClass().equals(si.class); - } - protected boolean isContainerAnvil(Object o) { // ContainerAnvil - return o != null && o.getClass().equals(sl.class); - } - protected boolean isContainerDispenser(Object o) { // ContainerDispenser - return o != null && o.getClass().equals(sr.class); - } - protected boolean isContainerCreative(Object o) { // ContainerCreative - return o != null && o.getClass().equals(avm.class); - } - - protected boolean isItemArmor(Object o) { // ItemArmor - return o != null && o instanceof st; - } - - protected boolean isBasicSlot(Object o) { // Slot - return o != null && o.getClass().equals(sq.class); - } - - // Reflection utils - - protected static void makeFieldPublic(Class c, String field) { - try { - Field f = c.getDeclaredField(field); - f.setAccessible(true); - Field modifiersField = Field.class.getDeclaredField("modifiers"); - modifiersField.setAccessible(true); - modifiersField.setInt(f, Modifier.PUBLIC); - fieldsMap.put(c.getName() + field, f); - } - catch (Exception e) { - log.severe("Failed to make " + c.getName() + "." + field + " accessible: " + e.getMessage()); - } - } - - /** - * Access value from any field, even private. - * Field must be made public through the makeFieldPublic() function first. - * @return - */ - protected static Object getThroughReflection(Class c, String field, Object instance) { - try { - return fieldsMap.get(c.getName() + field).get(instance); - } catch (Exception e) { - return null; - } - } - -} \ No newline at end of file diff --git a/src/InvTweaksObfuscationGuiButton.java b/src/InvTweaksObfuscationGuiButton.java deleted file mode 100755 index 00b0cc4c..00000000 --- a/src/InvTweaksObfuscationGuiButton.java +++ /dev/null @@ -1,55 +0,0 @@ -import net.minecraft.client.Minecraft; - -/** - * Obfuscation layer for gui buttons. - * @author Jimeo Wan - * - */ -public class InvTweaksObfuscationGuiButton extends ast /* GuiButton */ { - - public InvTweaksObfuscationGuiButton(int arg0, int arg1, int arg2, int arg3, int arg4, String arg5) { - super(arg0, arg1, arg2, arg3, arg4, arg5); - } - - protected void drawGradientRect( - int i, int j, int k, int l, int m, int n) { - a(i, j, k, l, m, n); - } - protected void drawTexturedModalRect( - int xPosition, int i, int j, int k, int l, int m) { - b(xPosition, i, j, k, l, m); - } - protected void drawRect(int i, int j, int k, int l, int textColor) { - a(i, j, k, l, textColor); - } - - protected String getDisplayString() { - return e; - } - protected int getTexture(Minecraft mc, String texture) { - return mc.o.b(texture); // renderengine.getTexture - } - protected int getHoverState(boolean mouseOverButton) { - return this.a(mouseOverButton); - } - - protected boolean isEnabled2() { - return this.h; - } - protected boolean isEnabled() { - return this.g; - } - - protected int getXPosition() { - return c; - } - protected int getYPosition() { - return d; - } - protected int getWidth() { - return a; - } - protected int getHeight() { - return b; - } -} \ No newline at end of file diff --git a/src/doc/README.txt b/src/doc/README.txt deleted file mode 100644 index f62a244e..00000000 --- a/src/doc/README.txt +++ /dev/null @@ -1,9 +0,0 @@ -|==============================================================| -| INVENTORY TWEAKS Mod - By Jimeo Wan (jimeo.wan at gmail.com) | -| Readme | -|==============================================================| - -Need help? - -* Official website: http://modding.kalam-alami.net/invtweaks -* Minecraft Forum thread: http://www.minecraftforum.net/topic/323444-inventory-tweaks diff --git a/src/doc/license.txt b/src/doc/license.txt deleted file mode 100644 index a8e93832..00000000 --- a/src/doc/license.txt +++ /dev/null @@ -1,24 +0,0 @@ -|==============================================================| -| INVENTORY TWEAKS Mod - By Jimeo Wan (jimeo.wan at gmail.com) | -| License (MIT) | -|==============================================================| - -Copyright (c) 2011-2012 Marwane Kalam-Alami - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/src/DefaultConfig.dat b/src/minecraft/invtweaks/DefaultConfig.dat similarity index 100% rename from src/DefaultConfig.dat rename to src/minecraft/invtweaks/DefaultConfig.dat diff --git a/src/DefaultTree.dat b/src/minecraft/invtweaks/DefaultTree.dat similarity index 100% rename from src/DefaultTree.dat rename to src/minecraft/invtweaks/DefaultTree.dat diff --git a/src/InvTweaks.java b/src/minecraft/invtweaks/InvTweaks.java similarity index 95% rename from src/InvTweaks.java rename to src/minecraft/invtweaks/InvTweaks.java index e0c5f2d6..81597480 100644 --- a/src/InvTweaks.java +++ b/src/minecraft/invtweaks/InvTweaks.java @@ -1,3 +1,5 @@ +package invtweaks; + import invtweaks.InvTweaksConst; import invtweaks.InvTweaksItemTree; import invtweaks.InvTweaksItemTreeItem; @@ -13,6 +15,12 @@ import java.util.logging.Logger; import net.minecraft.client.Minecraft; +import net.minecraft.src.GuiButton; +import net.minecraft.src.GuiContainer; +import net.minecraft.src.GuiScreen; +import net.minecraft.src.InvTweaksObfuscation; +import net.minecraft.src.ItemStack; +import net.minecraft.src.Slot; import org.lwjgl.LWJGLException; import org.lwjgl.input.Keyboard; @@ -57,7 +65,7 @@ public class InvTweaks extends InvTweaksObfuscation { * sorting on pick up...) */ private int storedStackId = 0, storedStackDamage = -1, storedFocusedSlot = -1; - private um[] hotbarClone = new um[InvTweaksConst.INVENTORY_HOTBAR_SIZE]; + private ItemStack[] hotbarClone = new ItemStack[InvTweaksConst.INVENTORY_HOTBAR_SIZE]; private boolean hadFocus = true, mouseWasDown = false;; /** @@ -114,9 +122,9 @@ public void onTickInGame() { /** * To be called on each tick when a menu is open. * Handles the GUI additions and the middle clicking. - * @param aue + * @param GuiScreen */ - public void onTickInGUI(aue guiScreen) { + public void onTickInGUI(GuiScreen guiScreen) { synchronized (this) { handleMiddleClick(guiScreen); // Called before the rest to be able to trigger config reload if (!onTick()) { @@ -129,7 +137,7 @@ public void onTickInGUI(aue guiScreen) { handleShortcuts(guiScreen); // Copy some info about current selected stack for auto-refill - um currentStack = getFocusedStack(); + ItemStack currentStack = getFocusedStack(); storedStackId = (currentStack == null) ? 0 : getItemID(currentStack); storedStackDamage = (currentStack == null) ? 0 : getItemDamage(currentStack); } @@ -148,7 +156,7 @@ public final void onSortingKeyPressed() { } // Check current GUI - aue guiScreen = getCurrentScreen(); + GuiScreen guiScreen = getCurrentScreen(); if (guiScreen == null || (isValidChest(guiScreen) || isValidInventory(guiScreen))) { // Sorting! handleSorting(guiScreen); @@ -180,7 +188,7 @@ public void onItemPickup() { // (not an existing stack whose amount has been increased) int currentSlot = -1; for (int i = 0; i < InvTweaksConst.INVENTORY_HOTBAR_SIZE; i++) { - um currentHotbarStack = containerMgr.getItemStack(i + 27); + ItemStack currentHotbarStack = containerMgr.getItemStack(i + 27); // Don't move already started stacks if (currentHotbarStack != null && getAnimationsToGo(currentHotbarStack) == 5 && hotbarClone[i] == null) { currentSlot = i + 27; @@ -193,7 +201,7 @@ public void onItemPickup() { // Find preffered slots List prefferedPositions = new LinkedList(); InvTweaksItemTree tree = config.getTree(); - um stack = containerMgr.getItemStack(currentSlot); + ItemStack stack = containerMgr.getItemStack(currentSlot); List items = tree.getItems(getItemID(stack), getItemDamage(stack)); for (InvTweaksConfigSortingRule rule : config.getRules()) { @@ -311,7 +319,7 @@ private boolean onTick() { if (itemPickupPending) { onItemPickup(); } - aue currentScreen = getCurrentScreen(); + GuiScreen currentScreen = getCurrentScreen(); if (currentScreen == null || isGuiInventory(currentScreen)) { cloneHotbar(); } @@ -337,7 +345,7 @@ private boolean onTick() { private void handleConfigSwitch() { InvTweaksConfig config = cfgManager.getConfig(); - aue currentScreen = getCurrentScreen(); + GuiScreen currentScreen = getCurrentScreen(); // Switch between configurations (shortcut) cfgManager.getShortcutsHandler().updatePressedKeys(); @@ -392,11 +400,11 @@ private void handleConfigSwitch() { } - private void handleSorting(aue guiScreen) { + private void handleSorting(GuiScreen guiScreen) { - um selectedItem = null; + ItemStack selectedItem = null; int focusedSlot = getFocusedSlot(); - um[] mainInventory = getMainInventory(); + ItemStack[] mainInventory = getMainInventory(); if (focusedSlot < mainInventory.length && focusedSlot >= 0) { selectedItem = mainInventory[focusedSlot]; } @@ -424,7 +432,7 @@ private void handleSorting(aue guiScreen) { private void handleAutoRefill() { - um currentStack = getFocusedStack(); + ItemStack currentStack = getFocusedStack(); int currentStackId = (currentStack == null) ? 0 : getItemID(currentStack); int currentStackDamage = (currentStack == null) ? 0 : getItemDamage(currentStack); int focusedSlot = getFocusedSlot() + 27; // Convert to container slots index @@ -470,7 +478,7 @@ else if ((currentStack == null || getItemID(currentStack) == 281 && storedStackI } - private void handleMiddleClick(aue guiScreen) { + private void handleMiddleClick(GuiScreen guiScreen) { if (Mouse.isButtonDown(2)) { @@ -488,7 +496,7 @@ private void handleMiddleClick(aue guiScreen) { InvTweaksContainerManager containerMgr = new InvTweaksContainerManager(mc); containerMgr.setClickDelay(config.getClickDelay()); - sq slotAtMousePosition = containerMgr.getSlotAtMousePosition(); + Slot slotAtMousePosition = containerMgr.getSlotAtMousePosition(); InvTweaksContainerSection target = null; if (slotAtMousePosition != null) { target = containerMgr.getSlotSection(getSlotNumber(slotAtMousePosition)); @@ -498,7 +506,7 @@ private void handleMiddleClick(aue guiScreen) { // Check if the middle click target the chest or the inventory // (copied GuiContainer.getSlotAtPosition algorithm) - auy guiContainer = asGuiContainer(guiScreen); + GuiContainer guiContainer = asGuiContainer(guiScreen); if (InvTweaksContainerSection.CHEST.equals(target)) { @@ -553,14 +561,14 @@ private void handleMiddleClick(aue guiScreen) { } } - private void handleGUILayout(aue guiScreen) { + private void handleGUILayout(GuiScreen guiScreen) { InvTweaksConfig config = cfgManager.getConfig(); boolean isValidChest = isValidChest(guiScreen); if (isValidChest || (isStandardInventory(guiScreen) && !isGuiEnchantmentTable(guiScreen))) { - auy guiContainer = asGuiContainer(guiScreen); + GuiContainer guiContainer = asGuiContainer(guiScreen); int w = 10, h = 10; // Look for the mods buttons @@ -568,7 +576,7 @@ private void handleGUILayout(aue guiScreen) { List controlList = getControlList(guiScreen); for (Object o : controlList) { if (isGuiButton(o)) { - ast button = asGuiButton(o); + GuiButton button = asGuiButton(o); if (getId(button) == InvTweaksConst.JIMEOWAN_ID) { customButtonsAdded = true; break; @@ -663,7 +671,7 @@ private void handleGUILayout(aue guiScreen) { // Remove "..." button from non-survival tabs of the creative screen if (isGuiInventoryCreative(guiScreen)) { List controlList = getControlList(guiScreen); - ast buttonToRemove = null; + GuiButton buttonToRemove = null; for (Object o : controlList) { if (isGuiButton(o)) { if (getId(asGuiButton(o)) == InvTweaksConst.JIMEOWAN_ID) { @@ -709,7 +717,7 @@ private boolean isNotEnoughItemsEnabled() { } } - private void handleShortcuts(aue guiScreen) { + private void handleShortcuts(GuiScreen guiScreen) { // Check open GUI if (!(isValidChest(guiScreen) || isStandardInventory(guiScreen))) { @@ -740,7 +748,7 @@ private void handleShortcuts(aue guiScreen) { } - private int getContainerRowSize(auy guiContainer) { + private int getContainerRowSize(GuiContainer guiContainer) { if (isGuiChest(guiContainer)) { return InvTweaksConst.CHEST_ROW_SIZE; } @@ -799,7 +807,7 @@ private void unlockKeysIfNecessary() { * (especially needed by the "on pickup" features). */ private void cloneHotbar() { - um[] mainInventory = getMainInventory(); + ItemStack[] mainInventory = getMainInventory(); for (int i = 0; i < 9; i++) { if (mainInventory[i] != null) { hotbarClone[i] = copy(mainInventory[i]); diff --git a/src/InvTweaksConfig.java b/src/minecraft/invtweaks/InvTweaksConfig.java similarity index 99% rename from src/InvTweaksConfig.java rename to src/minecraft/invtweaks/InvTweaksConfig.java index 2cb9e5f1..ba6a401e 100644 --- a/src/InvTweaksConfig.java +++ b/src/minecraft/invtweaks/InvTweaksConfig.java @@ -1,3 +1,5 @@ +package invtweaks; + import invtweaks.InvTweaksConst; import invtweaks.InvTweaksItemTree; import invtweaks.InvTweaksItemTreeItem; diff --git a/src/InvTweaksConfigInventoryRuleset.java b/src/minecraft/invtweaks/InvTweaksConfigInventoryRuleset.java similarity index 99% rename from src/InvTweaksConfigInventoryRuleset.java rename to src/minecraft/invtweaks/InvTweaksConfigInventoryRuleset.java index ba31f005..83fc069c 100644 --- a/src/InvTweaksConfigInventoryRuleset.java +++ b/src/minecraft/invtweaks/InvTweaksConfigInventoryRuleset.java @@ -1,5 +1,4 @@ - - +package invtweaks; import invtweaks.InvTweaksConst; import invtweaks.InvTweaksItemTree; diff --git a/src/InvTweaksConfigManager.java b/src/minecraft/invtweaks/InvTweaksConfigManager.java similarity index 99% rename from src/InvTweaksConfigManager.java rename to src/minecraft/invtweaks/InvTweaksConfigManager.java index b69718ba..dec48e6d 100644 --- a/src/InvTweaksConfigManager.java +++ b/src/minecraft/invtweaks/InvTweaksConfigManager.java @@ -1,5 +1,4 @@ - - +package invtweaks; import invtweaks.InvTweaksConst; import invtweaks.InvTweaksItemTreeLoader; diff --git a/src/InvTweaksConfigProperties.java b/src/minecraft/invtweaks/InvTweaksConfigProperties.java old mode 100755 new mode 100644 similarity index 97% rename from src/InvTweaksConfigProperties.java rename to src/minecraft/invtweaks/InvTweaksConfigProperties.java index f69fc19f..b446e252 --- a/src/InvTweaksConfigProperties.java +++ b/src/minecraft/invtweaks/InvTweaksConfigProperties.java @@ -1,4 +1,4 @@ - +package invtweaks; import java.util.Collections; import java.util.Enumeration; diff --git a/src/InvTweaksConfigSortingRule.java b/src/minecraft/invtweaks/InvTweaksConfigSortingRule.java similarity index 99% rename from src/InvTweaksConfigSortingRule.java rename to src/minecraft/invtweaks/InvTweaksConfigSortingRule.java index 1b696754..d16368f0 100644 --- a/src/InvTweaksConfigSortingRule.java +++ b/src/minecraft/invtweaks/InvTweaksConfigSortingRule.java @@ -1,7 +1,4 @@ - - - -import invtweaks.InvTweaksItemTree; +package invtweaks; import java.awt.Point; import java.util.logging.Logger; diff --git a/src/InvTweaksConfigSortingRuleType.java b/src/minecraft/invtweaks/InvTweaksConfigSortingRuleType.java old mode 100755 new mode 100644 similarity index 96% rename from src/InvTweaksConfigSortingRuleType.java rename to src/minecraft/invtweaks/InvTweaksConfigSortingRuleType.java index be30a50a..05dd2cee --- a/src/InvTweaksConfigSortingRuleType.java +++ b/src/minecraft/invtweaks/InvTweaksConfigSortingRuleType.java @@ -1,3 +1,5 @@ +package invtweaks; + public enum InvTweaksConfigSortingRuleType { RECTANGLE(1), ROW(2), COLUMN(3), SLOT(4); diff --git a/src/invtweaks/InvTweaksConst.java b/src/minecraft/invtweaks/InvTweaksConst.java similarity index 93% rename from src/invtweaks/InvTweaksConst.java rename to src/minecraft/invtweaks/InvTweaksConst.java index 017b4ae3..351315a1 100644 --- a/src/invtweaks/InvTweaksConst.java +++ b/src/minecraft/invtweaks/InvTweaksConst.java @@ -54,11 +54,12 @@ public class InvTweaksConst { public static final int SLOW_SORTING_DELAY = 30; /** - * Returns the Minecraft folder ensuring: - It is an absolute path - It ends - * with a folder separator + * Returns the Minecraft folder ensuring: + * - It is an absolute path + * - It ends with a folder separator */ public static String getMinecraftDir() { - String absolutePath = Minecraft.b().getAbsolutePath(); + String absolutePath = Minecraft.getMinecraftDir().getAbsolutePath(); if (absolutePath.endsWith(".")) { return absolutePath.substring(0, absolutePath.length() - 1); } diff --git a/src/InvTweaksContainerManager.java b/src/minecraft/invtweaks/InvTweaksContainerManager.java old mode 100755 new mode 100644 similarity index 90% rename from src/InvTweaksContainerManager.java rename to src/minecraft/invtweaks/InvTweaksContainerManager.java index ee0a3477..ae76a7bb --- a/src/InvTweaksContainerManager.java +++ b/src/minecraft/invtweaks/InvTweaksContainerManager.java @@ -1,3 +1,4 @@ +package invtweaks; import java.util.HashMap; import java.util.List; @@ -7,6 +8,12 @@ import org.lwjgl.input.Mouse; import net.minecraft.client.Minecraft; +import net.minecraft.src.Container; +import net.minecraft.src.GuiContainer; +import net.minecraft.src.GuiScreen; +import net.minecraft.src.InvTweaksObfuscation; +import net.minecraft.src.ItemStack; +import net.minecraft.src.Slot; /** * Allows to perform various operations on the inventory @@ -25,10 +32,10 @@ public class InvTweaksContainerManager extends InvTweaksObfuscation { public static final int ACTION_TIMEOUT = 500; public static final int POLLING_DELAY = 3; - private auy guiContainer; - private rp container; - private Map> slotRefs - = new HashMap>(); + private GuiContainer guiContainer; + private Container container; + private Map> slotRefs + = new HashMap>(); private int clickDelay = 0; @@ -42,7 +49,7 @@ public class InvTweaksContainerManager extends InvTweaksObfuscation { public InvTweaksContainerManager(Minecraft mc) { super(mc); - aue currentScreen = getCurrentScreen(); + GuiScreen currentScreen = getCurrentScreen(); if (isGuiContainer(currentScreen)) { this.guiContainer = asGuiContainer(currentScreen); this.container = getContainer(this.guiContainer); @@ -51,7 +58,7 @@ public InvTweaksContainerManager(Minecraft mc) { this.container = getPlayerContainer(); } - List slots = (List) getSlots(container); + List slots = (List) getSlots(container); int size = slots.size(); boolean guiWithInventory = true; @@ -143,8 +150,8 @@ else if (isContainerBrewingStand(container)) { public boolean move(InvTweaksContainerSection srcSection, int srcIndex, InvTweaksContainerSection destSection, int destIndex) { //System.out.println(srcSection + ":" + srcIndex + " to " + destSection + ":" + destIndex); - um srcStack = getItemStack(srcSection, srcIndex); - um destStack = getItemStack(destSection, destIndex); + ItemStack srcStack = getItemStack(srcSection, srcIndex); + ItemStack destStack = getItemStack(destSection, destIndex); if (srcStack == null && destIndex != DROP_SLOT) { return false; @@ -219,12 +226,12 @@ public boolean moveSome(InvTweaksContainerSection srcSection, int srcIndex, InvTweaksContainerSection destSection, int destIndex, int amount) { - um source = getItemStack(srcSection, srcIndex); + ItemStack source = getItemStack(srcSection, srcIndex); if (source == null || srcSection == destSection && srcIndex == destIndex) { return true; } - um destination = getItemStack(srcSection, srcIndex); + ItemStack destination = getItemStack(srcSection, srcIndex); int sourceSize = getStackSize(source); int movedAmount = Math.min(amount, sourceSize); @@ -261,7 +268,7 @@ public boolean dropSome(InvTweaksContainerSection srcSection, int srcIndex, int * @throws Exception */ public boolean putHoldItemDown(InvTweaksContainerSection destSection, int destIndex) { - um heldStack = getHeldStack(); + ItemStack heldStack = getHeldStack(); if (heldStack != null) { if (getItemStack(destSection, destIndex) == null) { click(destSection, destIndex, false); @@ -304,13 +311,13 @@ public void click(InvTweaksContainerSection section, int index, boolean rightCli } } - public sq getSlotAtMousePosition() { + public Slot getSlotAtMousePosition() { // Copied from GuiContainer if (guiContainer != null) { int x = getMouseX(); int y = getMouseY(); for (int k = 0; k < getSlots(getContainer(guiContainer)).size(); k++) { - sq slot = (sq) getSlots(getContainer(guiContainer)).get(k); + Slot slot = (Slot) getSlots(getContainer(guiContainer)).get(k); if (getIsMouseOverSlot(slot, x, y)) { return slot; } @@ -322,15 +329,15 @@ public sq getSlotAtMousePosition() { } } - public boolean getIsMouseOverSlot(sq slot) { + public boolean getIsMouseOverSlot(Slot slot) { return getIsMouseOverSlot(slot, getMouseX(), getMouseY()); } - private boolean getIsMouseOverSlot(sq slot, int x, int y) { + private boolean getIsMouseOverSlot(Slot slot, int x, int y) { // Copied from GuiContainer if (guiContainer != null) { - int i = guiContainer.n; // TODO Deobfuscate - int j = guiContainer.o; + int i = guiContainer.width; + int j = guiContainer.height; x -= i; y -= j; return x >= getXDisplayPosition(slot) - 1 @@ -356,7 +363,7 @@ public boolean hasSection(InvTweaksContainerSection section) { return slotRefs.containsKey(section); } - public List getSlots(InvTweaksContainerSection section) { + public List getSlots(InvTweaksContainerSection section) { return slotRefs.get(section); } @@ -365,7 +372,7 @@ public List getSlots(InvTweaksContainerSection section) { */ public int getSize() { int result = 0; - for (List slots : slotRefs.values()) { + for (List slots : slotRefs.values()) { result += slots.size(); } return result; @@ -392,7 +399,7 @@ public int getSize(InvTweaksContainerSection section) { */ public int getFirstEmptyIndex(InvTweaksContainerSection section) { int i = 0; - for (sq slot : slotRefs.get(section)) { + for (Slot slot : slotRefs.get(section)) { if (!hasStack(slot)) { return i; } @@ -414,8 +421,8 @@ public boolean isSlotEmpty(InvTweaksContainerSection section, int slot) { } } - public sq getSlot(InvTweaksContainerSection section, int index) { - List slots = slotRefs.get(section); + public Slot getSlot(InvTweaksContainerSection section, int index) { + List slots = slotRefs.get(section); if (slots != null) { return slots.get(index); } else { @@ -446,7 +453,7 @@ public int getSlotIndex(int slotNumber, boolean preferInventory) { || (preferInventory && section != InvTweaksContainerSection.INVENTORY_NOT_HOTBAR && section != InvTweaksContainerSection.INVENTORY_HOTBAR)) { int i = 0; - for (sq slot : slotRefs.get(section)) { + for (Slot slot : slotRefs.get(section)) { if (getSlotNumber(slot) == slotNumber) { return i; } @@ -466,7 +473,7 @@ public InvTweaksContainerSection getSlotSection(int slotNumber) { // TODO Caching with getSlotIndex for (InvTweaksContainerSection section : slotRefs.keySet()) { if (section != InvTweaksContainerSection.INVENTORY) { - for (sq slot : slotRefs.get(section)) { + for (Slot slot : slotRefs.get(section)) { if (getSlotNumber(slot) == slotNumber) { return section; } @@ -482,7 +489,7 @@ public InvTweaksContainerSection getSlotSection(int slotNumber) { * @param slot * @return An ItemStack or null. */ - public um getItemStack(InvTweaksContainerSection section, int index) + public ItemStack getItemStack(InvTweaksContainerSection section, int index) throws NullPointerException, IndexOutOfBoundsException { int slot = indexToSlot(section, index); if (slot >= 0 && slot < getSlots(container).size()) { @@ -492,13 +499,13 @@ public um getItemStack(InvTweaksContainerSection section, int index) } } - public rp getContainer() { + public Container getContainer() { return container; } private int getFirstEmptyUsableSlotNumber() { for (InvTweaksContainerSection section : slotRefs.keySet()) { - for (sq slot : slotRefs.get(section)) { + for (Slot slot : slotRefs.get(section)) { // Use only standard slot (to make sure // we can freely put and remove items there) if (isBasicSlot(slot) && !hasStack(slot)) { @@ -520,7 +527,7 @@ private int indexToSlot(InvTweaksContainerSection section, int index) { return DROP_SLOT; } if (hasSection(section)) { - sq slot = slotRefs.get(section).get(index); + Slot slot = slotRefs.get(section).get(index); if (slot != null) { return getSlotNumber(slot); } diff --git a/src/InvTweaksContainerSection.java b/src/minecraft/invtweaks/InvTweaksContainerSection.java old mode 100755 new mode 100644 similarity index 97% rename from src/InvTweaksContainerSection.java rename to src/minecraft/invtweaks/InvTweaksContainerSection.java index ada0ec0b..3a3f37d2 --- a/src/InvTweaksContainerSection.java +++ b/src/minecraft/invtweaks/InvTweaksContainerSection.java @@ -1,3 +1,5 @@ +package invtweaks; + /** * Names for specific parts of containers. * For unknown container types (such as mod containers), diff --git a/src/InvTweaksContainerSectionManager.java b/src/minecraft/invtweaks/InvTweaksContainerSectionManager.java old mode 100755 new mode 100644 similarity index 90% rename from src/InvTweaksContainerSectionManager.java rename to src/minecraft/invtweaks/InvTweaksContainerSectionManager.java index c0bdf19e..331568bc --- a/src/InvTweaksContainerSectionManager.java +++ b/src/minecraft/invtweaks/InvTweaksContainerSectionManager.java @@ -1,7 +1,12 @@ +package invtweaks; + import java.util.List; import java.util.concurrent.TimeoutException; import net.minecraft.client.Minecraft; +import net.minecraft.src.Container; +import net.minecraft.src.ItemStack; +import net.minecraft.src.Slot; /** * Allows to perform various operations on a single section of @@ -63,7 +68,7 @@ public void click(int index, boolean rightClick) throws TimeoutException { containerMgr.click(section, index, rightClick); } - public List getSlots() { + public List getSlots() { return containerMgr.getSlots(section); } @@ -79,7 +84,7 @@ public boolean isSlotEmpty(int slot) { return containerMgr.isSlotEmpty(section, slot); } - public sq getSlot(int index) { + public Slot getSlot(int index) { return containerMgr.getSlot(section, index); } @@ -96,11 +101,11 @@ public boolean isSlotInSection(int slotNumber) { return containerMgr.getSlotSection(slotNumber) == section; } - public um getItemStack(int index) throws NullPointerException, IndexOutOfBoundsException { + public ItemStack getItemStack(int index) throws NullPointerException, IndexOutOfBoundsException { return containerMgr.getItemStack(section, index); } - public rp getContainer() { + public Container getContainer() { return containerMgr.getContainer(); } diff --git a/src/InvTweaksGuiIconButton.java b/src/minecraft/invtweaks/InvTweaksGuiIconButton.java old mode 100755 new mode 100644 similarity index 91% rename from src/InvTweaksGuiIconButton.java rename to src/minecraft/invtweaks/InvTweaksGuiIconButton.java index 40582e52..536e4f53 --- a/src/InvTweaksGuiIconButton.java +++ b/src/minecraft/invtweaks/InvTweaksGuiIconButton.java @@ -1,4 +1,4 @@ - +package invtweaks; import net.minecraft.client.Minecraft; @@ -23,13 +23,9 @@ public InvTweaksGuiIconButton(InvTweaksConfigManager cfgManager, this.useCustomTexture = useCustomTexture; } - public void a(Minecraft minecraft, int i, int j) { /* drawButton */ - super.a(minecraft, i, j); + public void drawButton(Minecraft minecraft, int i, int j) { + super.drawButton(minecraft, i, j); - if (!isEnabled2()) { - return; - } - // Draw background (use the 4 corners of the texture to fit best its small size) int k = getHoverState(isMouseOverButton(i, j)); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); diff --git a/src/InvTweaksGuiSettings.java b/src/minecraft/invtweaks/InvTweaksGuiSettings.java similarity index 87% rename from src/InvTweaksGuiSettings.java rename to src/minecraft/invtweaks/InvTweaksGuiSettings.java index ebbf5ab1..d4876a64 100644 --- a/src/InvTweaksGuiSettings.java +++ b/src/minecraft/invtweaks/InvTweaksGuiSettings.java @@ -1,3 +1,5 @@ +package invtweaks; + import invtweaks.InvTweaksConst; import java.awt.Desktop; @@ -7,6 +9,8 @@ import java.util.logging.Logger; import net.minecraft.client.Minecraft; +import net.minecraft.src.GuiButton; +import net.minecraft.src.GuiScreen; import org.lwjgl.input.Keyboard; import org.lwjgl.util.Point; @@ -43,7 +47,7 @@ public class InvTweaksGuiSettings extends InvTweaksGuiSettingsAbstract { private InvTweaksGuiTooltipButton sortMappingButton; private boolean sortMappingEdition = false; - public InvTweaksGuiSettings(Minecraft mc, aue parentScreen, InvTweaksConfig config) { + public InvTweaksGuiSettings(Minecraft mc, GuiScreen parentScreen, InvTweaksConfig config) { super(mc, parentScreen, config); labelMiddleClick = InvTweaksLocalization.get("invtweaks.settings.middleclick"); @@ -54,8 +58,8 @@ public InvTweaksGuiSettings(Minecraft mc, aue parentScreen, InvTweaksConfig conf } - public void A_() { /* initGui */ - super.A_(); + public void initGui() { + super.initGui(); List controlList = obf.getControlList(this); Point p = new Point(); @@ -64,9 +68,9 @@ public void A_() { /* initGui */ // Create large buttons moveToButtonCoords(1, p); - controlList.add(new ast(ID_EDITRULES, p.getX() + 55, obf.getWindowHeight(this) / 6 + 96, InvTweaksLocalization.get("invtweaks.settings.rulesfile"))); - controlList.add(new ast(ID_EDITTREE, p.getX() + 55, obf.getWindowHeight(this) / 6 + 120, InvTweaksLocalization.get("invtweaks.settings.treefile"))); - controlList.add(new ast(ID_HELP, p.getX() + 55, obf.getWindowHeight(this) / 6 + 144, InvTweaksLocalization.get("invtweaks.settings.onlinehelp"))); + controlList.add(new GuiButton(ID_EDITRULES, p.getX() + 55, obf.getWindowHeight(this) / 6 + 96, InvTweaksLocalization.get("invtweaks.settings.rulesfile"))); + controlList.add(new GuiButton(ID_EDITTREE, p.getX() + 55, obf.getWindowHeight(this) / 6 + 120, InvTweaksLocalization.get("invtweaks.settings.treefile"))); + controlList.add(new GuiButton(ID_HELP, p.getX() + 55, obf.getWindowHeight(this) / 6 + 144, InvTweaksLocalization.get("invtweaks.settings.onlinehelp"))); // Create settings buttons @@ -116,7 +120,7 @@ public void A_() { /* initGui */ if (!Desktop.isDesktopSupported()) { for (Object o : controlList) { if (obf.isGuiButton(o)) { - ast guiButton = obf.asGuiButton(o); + GuiButton guiButton = obf.asGuiButton(o); if (obf.getId(guiButton) >= ID_EDITRULES && obf.getId(guiButton) <= ID_HELP) { obf.setEnabled(guiButton, false); } @@ -129,14 +133,14 @@ public void A_() { /* initGui */ } - protected void a(ast guibutton) { /* actionPerformed */ - super.a(guibutton); + protected void actionPerformed(GuiButton guibutton) { + super.actionPerformed(guibutton); switch (obf.getId(guibutton)) { // Switch sorting key case ID_SORTING_KEY: - sortMappingButton.e = InvTweaksLocalization.get("invtweaks.settings.key") + " > ??? <"; + sortMappingButton.displayString = InvTweaksLocalization.get("invtweaks.settings.key") + " > ??? <"; sortMappingEdition = true; break; @@ -201,11 +205,11 @@ protected void a(ast guibutton) { /* actionPerformed */ } - protected void a(char c, int keyCode) { /* keyPressed */ + protected void keyPressed(char c, int keyCode) { if (sortMappingEdition) { String keyName = Keyboard.getKeyName(keyCode); config.setProperty(InvTweaksConfig.PROP_KEY_SORT_INVENTORY, keyName); - sortMappingButton.e = InvTweaksLocalization.get("invtweaks.settings.key") + " " + keyName; + sortMappingButton.displayString = InvTweaksLocalization.get("invtweaks.settings.key") + " " + keyName; } } diff --git a/src/InvTweaksGuiSettingsAbstract.java b/src/minecraft/invtweaks/InvTweaksGuiSettingsAbstract.java old mode 100755 new mode 100644 similarity index 71% rename from src/InvTweaksGuiSettingsAbstract.java rename to src/minecraft/invtweaks/InvTweaksGuiSettingsAbstract.java index 84de57e9..be562944 --- a/src/InvTweaksGuiSettingsAbstract.java +++ b/src/minecraft/invtweaks/InvTweaksGuiSettingsAbstract.java @@ -1,7 +1,12 @@ +package invtweaks; + import java.util.List; import java.util.logging.Logger; import net.minecraft.client.Minecraft; +import net.minecraft.src.GuiButton; +import net.minecraft.src.GuiScreen; +import net.minecraft.src.InvTweaksObfuscation; import org.lwjgl.util.Point; @@ -12,7 +17,7 @@ * @author Jimeo Wan * */ -public abstract class InvTweaksGuiSettingsAbstract extends aue /* GuiScreen */ { +public abstract class InvTweaksGuiSettingsAbstract extends GuiScreen { protected static final Logger log = Logger.getLogger("InvTweaks"); @@ -23,12 +28,12 @@ public abstract class InvTweaksGuiSettingsAbstract extends aue /* GuiScreen */ { protected Minecraft mc; protected InvTweaksObfuscation obf; protected InvTweaksConfig config; - protected aue parentScreen; + protected GuiScreen parentScreen; protected static String LABEL_DONE; protected final static int ID_DONE = 200; - public InvTweaksGuiSettingsAbstract(Minecraft mc, aue parentScreen, + public InvTweaksGuiSettingsAbstract(Minecraft mc, GuiScreen parentScreen, InvTweaksConfig config) { LABEL_DONE = InvTweaksLocalization.get("invtweaks.settings.exit"); @@ -42,25 +47,25 @@ public InvTweaksGuiSettingsAbstract(Minecraft mc, aue parentScreen, this.config = config; } - public void A_() { /* initGui */ + public void initGui() { List controlList = obf.getControlList(this); Point p = new Point(); moveToButtonCoords(1, p); - controlList.add(new ast(ID_DONE, p.getX() + 55, obf.getWindowHeight(this) / 6 + 168, LABEL_DONE)); // GuiButton + controlList.add(new GuiButton(ID_DONE, p.getX() + 55, obf.getWindowHeight(this) / 6 + 168, LABEL_DONE)); // GuiButton // Save control list obf.setControlList(this, controlList); } - public void a(int i, int j, float f) { /* drawScreen */ - z_(); // Gui.drawDefaultBackground - a(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.settings.title"), obf.getWindowWidth(this) / 2, 20, 0xffffff); // Gui.drawCenteredString - super.a(i, j, f); // drawScreen + public void drawScreen(int i, int j, float f) { + drawDefaultBackground(); + drawCenteredString(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.settings.title"), obf.getWindowWidth(this) / 2, 20, 0xffffff); + super.drawScreen(i, j, f); } - protected void a(ast guibutton) { /* actionPerformed */ + protected void actionPerformed(GuiButton guibutton) { if (obf.getId(guibutton) == ID_DONE) { obf.displayGuiScreen(parentScreen); } @@ -71,7 +76,7 @@ protected void moveToButtonCoords(int buttonOrder, Point p) { p.setY(obf.getWindowHeight(this) / 6 + (buttonOrder / 2) * 24); } - protected void toggleBooleanButton(ast guibutton, String property, String label) { + protected void toggleBooleanButton(GuiButton guibutton, String property, String label) { Boolean enabled = !new Boolean(config.getProperty(property)); config.setProperty(property, enabled.toString()); obf.setDisplayString(guibutton, computeBooleanButtonLabel(property, label)); diff --git a/src/InvTweaksGuiSettingsAdvanced.java b/src/minecraft/invtweaks/InvTweaksGuiSettingsAdvanced.java old mode 100755 new mode 100644 similarity index 81% rename from src/InvTweaksGuiSettingsAdvanced.java rename to src/minecraft/invtweaks/InvTweaksGuiSettingsAdvanced.java index bd16e7c6..306abbfb --- a/src/InvTweaksGuiSettingsAdvanced.java +++ b/src/minecraft/invtweaks/InvTweaksGuiSettingsAdvanced.java @@ -1,4 +1,4 @@ -import invtweaks.InvTweaksConst; +package invtweaks; import java.awt.Desktop; import java.io.File; @@ -6,6 +6,8 @@ import java.util.logging.Logger; import net.minecraft.client.Minecraft; +import net.minecraft.src.GuiButton; +import net.minecraft.src.GuiScreen; import org.lwjgl.util.Point; @@ -34,7 +36,7 @@ public class InvTweaksGuiSettingsAdvanced extends InvTweaksGuiSettingsAbstract { private static String labelEnableSounds; private static String labelSlowSorting; - public InvTweaksGuiSettingsAdvanced(Minecraft mc, aue parentScreen, InvTweaksConfig config) { + public InvTweaksGuiSettingsAdvanced(Minecraft mc, GuiScreen parentScreen, InvTweaksConfig config) { super(mc, parentScreen, config); labelSortOnPickup = InvTweaksLocalization.get("invtweaks.settings.advanced.sortonpickup"); @@ -44,8 +46,8 @@ public InvTweaksGuiSettingsAdvanced(Minecraft mc, aue parentScreen, InvTweaksCon labelSlowSorting = InvTweaksLocalization.get("invtweaks.settings.slowsorting"); } - public void A_() { /* initGui */ - super.A_(); + public void initGui() { + super.initGui(); List controlList = obf.getControlList(this); Point p = new Point(); @@ -54,7 +56,7 @@ public void A_() { /* initGui */ // Create large buttons moveToButtonCoords(1, p); - controlList.add(new ast(ID_EDITSHORTCUTS, p.getX() + 55, obf.getWindowHeight(this) / 6 + 144, InvTweaksLocalization.get("invtweaks.settings.advanced.mappingsfile"))); + controlList.add(new GuiButton(ID_EDITSHORTCUTS, p.getX() + 55, obf.getWindowHeight(this) / 6 + 144, InvTweaksLocalization.get("invtweaks.settings.advanced.mappingsfile"))); // Create settings buttons @@ -89,7 +91,7 @@ public void A_() { /* initGui */ if (!Desktop.isDesktopSupported()) { for (Object o : controlList) { if (obf.isGuiButton(o)) { - ast button = obf.asGuiButton(o); + GuiButton button = obf.asGuiButton(o); if (obf.getId(button) == ID_EDITSHORTCUTS) { obf.setEnabled(button, false); } @@ -102,20 +104,20 @@ public void A_() { /* initGui */ } - public void a(int i, int j, float f) { /* drawScreen */ - super.a(i, j, f); + public void drawScreen(int i, int j, float f) { + super.drawScreen(i, j, f); Point p = new Point(); moveToButtonCoords(1, p); - b(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.settings.pvpwarning.pt1"), p.getX(), 40, 0x999999); // Gui.drawCenteredString - b(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.settings.pvpwarning.pt2"), p.getX(), 50, 0x999999); + drawCenteredString(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.settings.pvpwarning.pt1"), p.getX(), 40, 0x999999); + drawCenteredString(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.settings.pvpwarning.pt2"), p.getX(), 50, 0x999999); - b(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.settings.slowsorting.pt1"), p.getX(), 115, 0x999999); - b(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.settings.slowsorting.pt2"), p.getX(), 125, 0x999999); - b(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.settings.slowsorting.pt3"), p.getX(), 135, 0x999999); + drawCenteredString(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.settings.slowsorting.pt1"), p.getX(), 115, 0x999999); + drawCenteredString(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.settings.slowsorting.pt2"), p.getX(), 125, 0x999999); + drawCenteredString(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.settings.slowsorting.pt3"), p.getX(), 135, 0x999999); } - protected void a(ast guibutton) { /* actionPerformed */ + protected void actionPerformed(GuiButton guibutton) { switch (obf.getId(guibutton)) { diff --git a/src/InvTweaksGuiSettingsButton.java b/src/minecraft/invtweaks/InvTweaksGuiSettingsButton.java old mode 100755 new mode 100644 similarity index 86% rename from src/InvTweaksGuiSettingsButton.java rename to src/minecraft/invtweaks/InvTweaksGuiSettingsButton.java index 49a27bf0..7eeca09c --- a/src/InvTweaksGuiSettingsButton.java +++ b/src/minecraft/invtweaks/InvTweaksGuiSettingsButton.java @@ -1,8 +1,11 @@ +package invtweaks; + import java.util.concurrent.TimeoutException; import java.util.logging.Logger; import net.minecraft.client.Minecraft; +import net.minecraft.src.InvTweaksObfuscation; /** * Button that opens the inventory & chest settings screen. @@ -19,31 +22,27 @@ public InvTweaksGuiSettingsButton(InvTweaksConfigManager cfgManager, super(cfgManager, id, x, y, w, h, displayString, tooltip, useCustomTexture); } - public void a(Minecraft minecraft, int i, int j) { - super.a(minecraft, i, j); - - if (!isEnabled2()) { - return; - } + public void drawButton(Minecraft minecraft, int i, int j) { + super.drawButton(minecraft, i, j); // Display string InvTweaksObfuscation obf = new InvTweaksObfuscation(minecraft); - a(obf.getFontRenderer(), + drawCenteredString(obf.getFontRenderer(), getDisplayString(), getXPosition() + 5, getYPosition() - 1, - getTextColor(i, j)); // Gui.drawCenteredString + getTextColor(i, j)); } /** * Displays inventory settings GUI */ - public boolean c(Minecraft minecraft, int i, int j) { /* mousePressed */ + public boolean mousePressed(Minecraft minecraft, int i, int j) { InvTweaksObfuscation obf = new InvTweaksObfuscation(minecraft); InvTweaksConfig config = cfgManager.getConfig(); - if (super.c(minecraft, i, j)) { // mousePressed + if (super.mousePressed(minecraft, i, j)) { // Put hold item down if necessary InvTweaksContainerSectionManager containerMgr; diff --git a/src/InvTweaksGuiShortcutsHelp.java b/src/minecraft/invtweaks/InvTweaksGuiShortcutsHelp.java old mode 100755 new mode 100644 similarity index 78% rename from src/InvTweaksGuiShortcutsHelp.java rename to src/minecraft/invtweaks/InvTweaksGuiShortcutsHelp.java index b3458360..536b71df --- a/src/InvTweaksGuiShortcutsHelp.java +++ b/src/minecraft/invtweaks/InvTweaksGuiShortcutsHelp.java @@ -1,42 +1,47 @@ +package invtweaks; + import java.util.LinkedList; import java.util.List; import net.minecraft.client.Minecraft; +import net.minecraft.src.GuiButton; +import net.minecraft.src.GuiScreen; +import net.minecraft.src.InvTweaksObfuscation; import org.lwjgl.input.Keyboard; -public class InvTweaksGuiShortcutsHelp extends aue /* GuiScreen */ { +public class InvTweaksGuiShortcutsHelp extends GuiScreen { private final static int ID_DONE = 0; private InvTweaksObfuscation obf; - private aue parentScreen; + private GuiScreen parentScreen; private InvTweaksConfig config; public InvTweaksGuiShortcutsHelp(Minecraft mc, - aue parentScreen, InvTweaksConfig config) { + GuiScreen parentScreen, InvTweaksConfig config) { this.obf = new InvTweaksObfuscation(mc); this.parentScreen = parentScreen; this.config = config; } - public void A_() { /* initGui */ + public void initGui() { // Create Done button - List controlList = new LinkedList(); /* GuiButton */ - controlList.add(new ast(ID_DONE, + List controlList = new LinkedList(); + controlList.add(new GuiButton(ID_DONE, obf.getWindowWidth(this) / 2 - 100, obf.getWindowHeight(this) / 6 + 168, "Done")); obf.setControlList(this, controlList); } - public void a(int i, int j, float f) { /* drawScreen */ + public void drawScreen(int i, int j, float f) { // Note: 0x0000EEFF = blue color (currently unused) - z_(); // Gui.drawDefaultBackground - a(obf.getFontRenderer(), "WARNING: Since 1.3.1, shortcuts won't work as expected. Looking for a workaround...", obf.getWindowWidth(this) / 2, 5, 0xff0000); - a(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.help.shortcuts.title"), obf.getWindowWidth(this) / 2, 20, 0xffffff); // Gui.drawCenteredString + drawDefaultBackground(); + drawCenteredString(obf.getFontRenderer(), "WARNING: Since 1.3.1, shortcuts won't work as expected. Looking for a workaround...", obf.getWindowWidth(this) / 2, 5, 0xff0000); + drawCenteredString(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.help.shortcuts.title"), obf.getWindowWidth(this) / 2, 20, 0xffffff); // Gui.drawCenteredString String clickLabel = InvTweaksLocalization.get("invtweaks.help.shortcuts.click"); int y = obf.getWindowHeight(this) / 6 - 2; @@ -79,10 +84,10 @@ public void a(int i, int j, float f) { /* drawScreen */ String sortKeyName = getKeyName(config.getSortKeyCode(), "(Sort Key)"); drawShortcutLine(InvTweaksLocalization.get("invtweaks.help.shortcuts.selectconfig"), "0-9 + " +sortKeyName, 0x0088FFFF, y); - super.a(i, j, f); // drawScreen + super.drawScreen(i, j, f); } - protected void a(ast guibutton) { /* actionPerformed */ + protected void actionPerformed(GuiButton guibutton) { switch (obf.getId(guibutton)) { @@ -114,9 +119,9 @@ protected String getKeyName(int keyCode, String defaultValue) { } private void drawShortcutLine(String label, String value, int color, int y) { - b(obf.getFontRenderer(), label, 30, y, -1); // drawString + drawString(obf.getFontRenderer(), label, 30, y, -1); // drawString if (value != null) { - b(obf.getFontRenderer(), value.contains("DEFAULT") ? "-" : value.replaceAll(", ", " " + InvTweaksLocalization.get("invtweaks.help.shortcuts.or") + " "), + drawString(obf.getFontRenderer(), value.contains("DEFAULT") ? "-" : value.replaceAll(", ", " " + InvTweaksLocalization.get("invtweaks.help.shortcuts.or") + " "), obf.getWindowWidth(this) / 2 - 30, y, color); // drawString } } diff --git a/src/InvTweaksGuiSortingButton.java b/src/minecraft/invtweaks/InvTweaksGuiSortingButton.java old mode 100755 new mode 100644 similarity index 89% rename from src/InvTweaksGuiSortingButton.java rename to src/minecraft/invtweaks/InvTweaksGuiSortingButton.java index 48dfba8b..a0435ba0 --- a/src/InvTweaksGuiSortingButton.java +++ b/src/minecraft/invtweaks/InvTweaksGuiSortingButton.java @@ -1,3 +1,5 @@ +package invtweaks; + import net.minecraft.client.Minecraft; /** @@ -21,12 +23,8 @@ public InvTweaksGuiSortingButton(InvTweaksConfigManager cfgManager, this.rowSize = rowSize; } - public void a(Minecraft minecraft, int i, int j) { /* drawButton */ - super.a(minecraft, i, j); - - if (!isEnabled2()) { - return; - } + public void drawButton(Minecraft minecraft, int i, int j) { + super.drawButton(minecraft, i, j); // Display symbol int textColor = getTextColor(i, j); @@ -47,8 +45,8 @@ public void a(Minecraft minecraft, int i, int j) { /* drawButton */ /** * Sort container */ - public boolean c(Minecraft minecraft, int i, int j) { - if (super.c(minecraft, i, j)) { // mousePressed + public boolean mousePressed(Minecraft minecraft, int i, int j) { + if (super.mousePressed(minecraft, i, j)) { try { new InvTweaksHandlerSorting( minecraft, cfgManager.getConfig(), diff --git a/src/InvTweaksGuiTooltipButton.java b/src/minecraft/invtweaks/InvTweaksGuiTooltipButton.java old mode 100755 new mode 100644 similarity index 93% rename from src/InvTweaksGuiTooltipButton.java rename to src/minecraft/invtweaks/InvTweaksGuiTooltipButton.java index 02fe76f0..5e259855 --- a/src/InvTweaksGuiTooltipButton.java +++ b/src/minecraft/invtweaks/InvTweaksGuiTooltipButton.java @@ -1,5 +1,9 @@ +package invtweaks; + import invtweaks.InvTweaksConst; import net.minecraft.client.Minecraft; +import net.minecraft.src.FontRenderer; +import net.minecraft.src.InvTweaksObfuscation; /** * Icon-size button, which get drawns in a specific way to fit its small size. @@ -44,15 +48,11 @@ public InvTweaksGuiTooltipButton(int id, int x, int y, int w, int h, } } - public void a(Minecraft minecraft, int i, int j) { /* drawButton */ - super.a(minecraft, i, j); + public void drawButton(Minecraft minecraft, int i, int j) { + super.drawButton(minecraft, i, j); InvTweaksObfuscation obf = new InvTweaksObfuscation(minecraft); - if (!isEnabled2()) { - return; - } - if (tooltipLines != null) { // Compute hover time if (isMouseOverButton(i, j)) { @@ -70,7 +70,7 @@ public void a(Minecraft minecraft, int i, int j) { /* drawButton */ // Draw tooltip if hover time is long enough if (hoverTime > InvTweaksConst.TOOLTIP_DELAY && tooltipLines != null) { - atj fontRenderer = obf.getFontRenderer(); + FontRenderer fontRenderer = obf.getFontRenderer(); // Compute tooltip params int x = i + 12, y = j - LINE_HEIGHT*tooltipLines.length; diff --git a/src/InvTweaksHandlerAutoRefill.java b/src/minecraft/invtweaks/InvTweaksHandlerAutoRefill.java similarity index 97% rename from src/InvTweaksHandlerAutoRefill.java rename to src/minecraft/invtweaks/InvTweaksHandlerAutoRefill.java index 4d671110..0bac8965 100644 --- a/src/InvTweaksHandlerAutoRefill.java +++ b/src/minecraft/invtweaks/InvTweaksHandlerAutoRefill.java @@ -1,3 +1,5 @@ +package invtweaks; + import invtweaks.InvTweaksConst; import invtweaks.InvTweaksItemTree; import invtweaks.InvTweaksItemTreeItem; @@ -9,6 +11,8 @@ import net.minecraft.client.Minecraft; +import net.minecraft.src.InvTweaksObfuscation; +import net.minecraft.src.ItemStack; /** * Handles the auto-refilling of the hotbar. @@ -40,7 +44,7 @@ public void autoRefillSlot(int slot, int wantedId, int wantedDamage) throws Exce InvTweaksContainerSectionManager container = new InvTweaksContainerSectionManager( mc, InvTweaksContainerSection.INVENTORY); container.setClickDelay(config.getClickDelay()); - um candidateStack, replacementStack = null; + ItemStack candidateStack, replacementStack = null; int replacementStackSlot = -1; boolean refillBeforeBreak = config.getProperty(InvTweaksConfig.PROP_AUTO_REFILL_BEFORE_BREAK) .equals(InvTweaksConfig.VALUE_TRUE); @@ -175,7 +179,7 @@ public void run() { // In POLLING_DELAY ms, things might have changed try { - um stack = containerMgr.getItemStack(i); + ItemStack stack = containerMgr.getItemStack(i); if (stack != null && getItemID(stack) == expectedItemId || this.refillBeforeBreak) { if (containerMgr.move(targetedSlot, i) || containerMgr.move(i, targetedSlot)) { if (!config.getProperty(InvTweaksConfig.PROP_ENABLE_SOUNDS).equals(InvTweaksConfig.VALUE_FALSE)) { diff --git a/src/InvTweaksHandlerShortcuts.java b/src/minecraft/invtweaks/InvTweaksHandlerShortcuts.java old mode 100755 new mode 100644 similarity index 96% rename from src/InvTweaksHandlerShortcuts.java rename to src/minecraft/invtweaks/InvTweaksHandlerShortcuts.java index a6feda4a..9569080a --- a/src/InvTweaksHandlerShortcuts.java +++ b/src/minecraft/invtweaks/InvTweaksHandlerShortcuts.java @@ -1,3 +1,5 @@ +package invtweaks; + import java.util.HashMap; import java.util.LinkedList; import java.util.List; @@ -7,6 +9,9 @@ import java.util.logging.Logger; import net.minecraft.client.Minecraft; +import net.minecraft.src.InvTweaksObfuscation; +import net.minecraft.src.ItemStack; +import net.minecraft.src.Slot; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; @@ -28,7 +33,7 @@ private class ShortcutConfig { public InvTweaksShortcutType type = null; public InvTweaksContainerSection fromSection = null; public int fromIndex = -1; - public um fromStack = null; + public ItemStack fromStack = null; public InvTweaksContainerSection toSection = null; public int toIndex = -1; public boolean drop = false; @@ -145,7 +150,7 @@ public ShortcutConfig computeShortcutToTrigger() { // Init container = new InvTweaksContainerManager(mc); container.setClickDelay(config.getClickDelay()); - sq slot = container.getSlotAtMousePosition(); + Slot slot = container.getSlotAtMousePosition(); ShortcutConfig shortcutConfig = new ShortcutConfig(); // If a valid and not empty slot is clicked @@ -206,7 +211,7 @@ else if (container.hasSection(InvTweaksContainerSection.FURNACE_IN)) { orderedSections.add(InvTweaksContainerSection.FURNACE_IN); } else if (container.hasSection(InvTweaksContainerSection.BREWING_INGREDIENT)) { - um stack = container.getStack(slot); + ItemStack stack = container.getStack(slot); if (stack != null) { if (getItemID(stack) == 373 /* Water Bottle/Potions */) { orderedSections.add(InvTweaksContainerSection.BREWING_BOTTLES); @@ -309,7 +314,7 @@ private boolean haveControlsChanged() { private void runShortcut(ShortcutConfig shortcut) throws TimeoutException { // Try to put held item down if (getHeldStack() != null) { - sq slot = container.getSlotAtMousePosition(); + Slot slot = container.getSlotAtMousePosition(); if (slot != null) { int slotNumber = getSlotNumber(slot); container.putHoldItemDown(container.getSlotSection(slotNumber), container.getSlotIndex(slotNumber)); @@ -337,7 +342,7 @@ private void runShortcut(ShortcutConfig shortcut) throws TimeoutException { case MOVE_ONE_STACK: { - sq slot = container.getSlot(shortcut.fromSection, shortcut.fromIndex); + Slot slot = container.getSlot(shortcut.fromSection, shortcut.fromIndex); if (shortcut.fromSection != InvTweaksContainerSection.CRAFTING_OUT && shortcut.toSection != InvTweaksContainerSection.ENCHANTMENT) { while (hasStack(slot) && toIndex != -1) { @@ -392,10 +397,10 @@ private void runShortcut(ShortcutConfig shortcut) throws TimeoutException { } } - private void moveAll(ShortcutConfig shortcut, um stackToMatch) throws TimeoutException { + private void moveAll(ShortcutConfig shortcut, ItemStack stackToMatch) throws TimeoutException { int toIndex = getNextTargetIndex(shortcut), newIndex; boolean success; - for (sq slot : container.getSlots(shortcut.fromSection)) { + for (Slot slot : container.getSlots(shortcut.fromSection)) { if (hasStack(slot) && (stackToMatch == null || areSameItemType(stackToMatch, getStack(slot)))) { int fromIndex = container.getSlotIndex(getSlotNumber(slot)); while (hasStack(slot) && toIndex != -1 && !(shortcut.fromSection == shortcut.toSection && fromIndex == toIndex)) { @@ -420,9 +425,9 @@ private int getNextTargetIndex(ShortcutConfig shortcut) { // Try to merge with existing slot if (!shortcut.forceEmptySlot) { int i = 0; - for (sq slot : container.getSlots(shortcut.toSection)) { + for (Slot slot : container.getSlots(shortcut.toSection)) { if (hasStack(slot)) { - um stack = getStack(slot); + ItemStack stack = getStack(slot); if (!hasDataTags(stack) && areItemsEqual(stack, shortcut.fromStack) && getStackSize(stack) < getMaxStackSize(stack)) { result = i; diff --git a/src/InvTweaksHandlerSorting.java b/src/minecraft/invtweaks/InvTweaksHandlerSorting.java similarity index 95% rename from src/InvTweaksHandlerSorting.java rename to src/minecraft/invtweaks/InvTweaksHandlerSorting.java index bc2d7e59..678d5faa 100644 --- a/src/InvTweaksHandlerSorting.java +++ b/src/minecraft/invtweaks/InvTweaksHandlerSorting.java @@ -1,3 +1,5 @@ +package invtweaks; + import invtweaks.InvTweaksConst; import invtweaks.InvTweaksItemTree; import invtweaks.InvTweaksItemTreeItem; @@ -14,6 +16,11 @@ import net.minecraft.client.Minecraft; +import net.minecraft.src.InvTweaksObfuscation; +import net.minecraft.src.Item; +import net.minecraft.src.ItemArmor; +import net.minecraft.src.ItemStack; +import net.minecraft.src.Slot; /** * Core of the sorting behaviour. Allows to move items in a container @@ -100,7 +107,7 @@ public InvTweaksHandlerSorting(Minecraft mc, InvTweaksConfig config, this.keywordOrder = new int[size]; for (int i = 0; i < size; i++) { this.rulePriority[i] = -1; - um stack = containerMgr.getItemStack(i); + ItemStack stack = containerMgr.getItemStack(i); if (stack != null) { this.keywordOrder[i] = getItemOrder(stack); } else { @@ -137,10 +144,10 @@ public void sort() throws TimeoutException { //// Move items out of the crafting slots log.info("Handling crafting slots."); if (globalContainer.hasSection(InvTweaksContainerSection.CRAFTING_IN)) { - List craftingSlots = globalContainer.getSlots(InvTweaksContainerSection.CRAFTING_IN); + List craftingSlots = globalContainer.getSlots(InvTweaksContainerSection.CRAFTING_IN); int emptyIndex = globalContainer.getFirstEmptyIndex(InvTweaksContainerSection.INVENTORY); if (emptyIndex != -1) { - for (sq craftingSlot : craftingSlots) { + for (Slot craftingSlot : craftingSlots) { if (hasStack(craftingSlot)) { globalContainer.move( InvTweaksContainerSection.CRAFTING_IN, @@ -162,18 +169,18 @@ public void sort() throws TimeoutException { log.info("Merging stacks."); for (int i = size - 1; i >= 0; i--) { - um from = containerMgr.getItemStack(i); + ItemStack from = containerMgr.getItemStack(i); if (from != null) { // Move armor parts - uk fromItem = getItem(from); + Item fromItem = getItem(from); if (isDamageable(fromItem)) { if (sortArmorParts) { if (isItemArmor(fromItem)) { - st fromItemArmor = asItemArmor(fromItem); + ItemArmor fromItemArmor = asItemArmor(fromItem); if (globalContainer.hasSection(InvTweaksContainerSection.ARMOR)) { - List armorSlots = globalContainer.getSlots(InvTweaksContainerSection.ARMOR); - for (sq slot : armorSlots) { + List armorSlots = globalContainer.getSlots(InvTweaksContainerSection.ARMOR); + for (Slot slot : armorSlots) { boolean move = false; if (!hasStack(slot)) { move = true; @@ -201,7 +208,7 @@ && getItemDamage(getStack(slot)) < getItemDamage(from))) { int j = 0; for (Integer lockPriority : lockPriorities) { if (lockPriority > 0) { - um to = containerMgr.getItemStack(j); + ItemStack to = containerMgr.getItemStack(j); if (to != null && areItemsEqual(from, to)) { move(i, j, Integer.MAX_VALUE); markAsNotMoved(j); @@ -233,7 +240,7 @@ && getItemDamage(getStack(slot)) < getItemDamage(from))) { // For every item in the inventory for (int i = 0; i < size; i++) { - um from = containerMgr.getItemStack(i); + ItemStack from = containerMgr.getItemStack(i); // If the rule is strong enough to move the item and it matches the item, move it if (hasToBeMoved(i) && lockPriorities[i] < rulePriority) { @@ -349,7 +356,7 @@ private void defaultSorting() throws TimeoutException { */ private int move(int i, int j, int priority) throws TimeoutException { - um from = containerMgr.getItemStack(i), to = containerMgr.getItemStack(j); + ItemStack from = containerMgr.getItemStack(i), to = containerMgr.getItemStack(j); if (from == null || frozenSlots[j] || frozenSlots[i]) { return -1; @@ -408,7 +415,7 @@ else if (getStackSize(from) > getMaxStackSize(from)) { rulePriority[i] = -1; containerMgr.move(i, j); - um remains = containerMgr.getItemStack(i); + ItemStack remains = containerMgr.getItemStack(i); if (remains != null) { int dropSlot = i; @@ -454,7 +461,7 @@ private boolean hasToBeMoved(int slot) { private boolean isOrderedBefore(int i, int j) { - um iStack = containerMgr.getItemStack(i), jStack = containerMgr.getItemStack(j); + ItemStack iStack = containerMgr.getItemStack(i), jStack = containerMgr.getItemStack(j); if (jStack == null) { return true; @@ -485,7 +492,7 @@ private boolean isOrderedBefore(int i, int j) { } } - private int getItemOrder(um itemStack) { + private int getItemOrder(ItemStack itemStack) { List items = tree.getItems( getItemID(itemStack), getItemDamage(itemStack)); return (items != null && items.size() > 0) @@ -646,7 +653,7 @@ private Map computeContainerStats() { Map itemSearch = new HashMap(); for (int i = 0; i < size; i++) { - um stack = containerMgr.getItemStack(i); + ItemStack stack = containerMgr.getItemStack(i); if (stack != null) { int itemSearchKey = getItemID(stack)*100000 + ((getMaxStackSize(stack) != 1) ? getItemDamage(stack) : 0); diff --git a/src/invtweaks/InvTweaksItemTree.java b/src/minecraft/invtweaks/InvTweaksItemTree.java similarity index 100% rename from src/invtweaks/InvTweaksItemTree.java rename to src/minecraft/invtweaks/InvTweaksItemTree.java diff --git a/src/invtweaks/InvTweaksItemTreeCategory.java b/src/minecraft/invtweaks/InvTweaksItemTreeCategory.java similarity index 100% rename from src/invtweaks/InvTweaksItemTreeCategory.java rename to src/minecraft/invtweaks/InvTweaksItemTreeCategory.java diff --git a/src/invtweaks/InvTweaksItemTreeItem.java b/src/minecraft/invtweaks/InvTweaksItemTreeItem.java similarity index 100% rename from src/invtweaks/InvTweaksItemTreeItem.java rename to src/minecraft/invtweaks/InvTweaksItemTreeItem.java diff --git a/src/invtweaks/InvTweaksItemTreeListener.java b/src/minecraft/invtweaks/InvTweaksItemTreeListener.java old mode 100755 new mode 100644 similarity index 100% rename from src/invtweaks/InvTweaksItemTreeListener.java rename to src/minecraft/invtweaks/InvTweaksItemTreeListener.java diff --git a/src/invtweaks/InvTweaksItemTreeLoader.java b/src/minecraft/invtweaks/InvTweaksItemTreeLoader.java similarity index 100% rename from src/invtweaks/InvTweaksItemTreeLoader.java rename to src/minecraft/invtweaks/InvTweaksItemTreeLoader.java diff --git a/src/InvTweaksLocalization.java b/src/minecraft/invtweaks/InvTweaksLocalization.java similarity index 96% rename from src/InvTweaksLocalization.java rename to src/minecraft/invtweaks/InvTweaksLocalization.java index 20489583..6a621307 100644 --- a/src/InvTweaksLocalization.java +++ b/src/minecraft/invtweaks/InvTweaksLocalization.java @@ -1,7 +1,11 @@ +package invtweaks; + import java.io.InputStream; import java.util.Properties; import java.util.logging.Logger; +import net.minecraft.src.InvTweaksObfuscation; + /** * The global mod's configuration. diff --git a/src/InvTweaksModCompatibility.java b/src/minecraft/invtweaks/InvTweaksModCompatibility.java old mode 100755 new mode 100644 similarity index 82% rename from src/InvTweaksModCompatibility.java rename to src/minecraft/invtweaks/InvTweaksModCompatibility.java index 750782c7..508057ad --- a/src/InvTweaksModCompatibility.java +++ b/src/minecraft/invtweaks/InvTweaksModCompatibility.java @@ -1,15 +1,23 @@ +package invtweaks; + import invtweaks.InvTweaksConst; import java.util.HashMap; import java.util.List; import java.util.Map; +import net.minecraft.src.Container; +import net.minecraft.src.GuiContainer; +import net.minecraft.src.GuiScreen; +import net.minecraft.src.InvTweaksObfuscation; +import net.minecraft.src.Slot; + public class InvTweaksModCompatibility { private InvTweaksObfuscation obf; - InvTweaksModCompatibility(InvTweaksObfuscation obf) { + public InvTweaksModCompatibility(InvTweaksObfuscation obf) { this.obf = obf; } @@ -19,7 +27,7 @@ public class InvTweaksModCompatibility { * @param guiContainer * @return */ - public boolean isSpecialChest(aue guiScreen) { + public boolean isSpecialChest(GuiScreen guiScreen) { return is(guiScreen, "GuiAlchChest") // Equivalent Exchange || is(guiScreen, "GuiCondenser") // Equivalent Exchange || is(guiScreen, "GUIChest") // Iron chests (formerly IC2) @@ -57,7 +65,7 @@ public boolean isSpecialChest(aue guiScreen) { * @param defaultValue * @return */ - public int getSpecialChestRowSize(auy guiContainer, int defaultValue) { + public int getSpecialChestRowSize(GuiContainer guiContainer, int defaultValue) { if (is(guiContainer, "GuiAlchChest") || is(guiContainer, "GuiCondenser")) { // Equivalent Exchange return 13; @@ -90,7 +98,7 @@ public int getSpecialChestRowSize(auy guiContainer, int defaultValue) { return defaultValue; } - public boolean isChestWayTooBig(aue guiScreen) { + public boolean isChestWayTooBig(GuiScreen guiScreen) { return is(guiScreen, "GuiAlchChest") // Equivalent Exchange || is(guiScreen, "GuiMultiPageChest") // MultiPage Chest || is(guiScreen, "GUIChest") // IronChests @@ -103,7 +111,7 @@ public boolean isChestWayTooBig(aue guiScreen) { * @param guiScreen * @return */ - public boolean isSpecialInventory(aue guiScreen) { + public boolean isSpecialInventory(GuiScreen guiScreen) { try { return obf.getSlots(obf.getContainer(obf.asGuiContainer(guiScreen))).size() > InvTweaksConst.INVENTORY_SIZE && !obf.isGuiInventoryCreative(guiScreen); @@ -113,10 +121,10 @@ public boolean isSpecialInventory(aue guiScreen) { } @SuppressWarnings("unchecked") - public Map> getSpecialContainerSlots(aue guiScreen, rp container) { + public Map> getSpecialContainerSlots(GuiScreen guiScreen, Container container) { - Map> result = new HashMap>(); - List slots = (List) obf.getSlots(container); + Map> result = new HashMap>(); + List slots = (List) obf.getSlots(container); if (is(guiScreen, "GuiCondenser")) { // EE result.put(InvTweaksContainerSection.CHEST, slots.subList(1, slots.size() - 36)); @@ -131,7 +139,7 @@ else if (is(guiScreen, "GuiAdvBench")) { // RedPower 2 } - private static final boolean is(aue guiScreen, String className) { + private static final boolean is(GuiScreen guiScreen, String className) { try { return guiScreen.getClass().getSimpleName().contains(className); } diff --git a/src/minecraft/invtweaks/InvTweaksObfuscationGuiButton.java b/src/minecraft/invtweaks/InvTweaksObfuscationGuiButton.java new file mode 100644 index 00000000..8a20a38e --- /dev/null +++ b/src/minecraft/invtweaks/InvTweaksObfuscationGuiButton.java @@ -0,0 +1,44 @@ +package invtweaks; + +import net.minecraft.client.Minecraft; +import net.minecraft.src.GuiButton; + +/** + * Obfuscation layer for gui buttons. + * @author Jimeo Wan + * + */ +public class InvTweaksObfuscationGuiButton extends GuiButton { + + public InvTweaksObfuscationGuiButton(int id, int x, int y, int w, int h, String string) { + super(id, x, y, w, h, string); + } + + protected String getDisplayString() { + return displayString; + } + + protected int getTexture(Minecraft mc, String texture) { + return mc.renderEngine.getTexture(texture); + } + + protected boolean isEnabled() { + return enabled; + } + + protected int getXPosition() { + return xPosition; + } + + protected int getYPosition() { + return yPosition; + } + + protected int getWidth() { + return width; + } + + protected int getHeight() { + return height; + } +} \ No newline at end of file diff --git a/src/InvTweaksShortcutMapping.java b/src/minecraft/invtweaks/InvTweaksShortcutMapping.java old mode 100755 new mode 100644 similarity index 98% rename from src/InvTweaksShortcutMapping.java rename to src/minecraft/invtweaks/InvTweaksShortcutMapping.java index 6fc4896f..865917bd --- a/src/InvTweaksShortcutMapping.java +++ b/src/minecraft/invtweaks/InvTweaksShortcutMapping.java @@ -1,3 +1,5 @@ +package invtweaks; + import java.util.LinkedList; import java.util.List; import java.util.Map; diff --git a/src/InvTweaksShortcutType.java b/src/minecraft/invtweaks/InvTweaksShortcutType.java old mode 100755 new mode 100644 similarity index 94% rename from src/InvTweaksShortcutType.java rename to src/minecraft/invtweaks/InvTweaksShortcutType.java index 75adbe80..e1ec6f07 --- a/src/InvTweaksShortcutType.java +++ b/src/minecraft/invtweaks/InvTweaksShortcutType.java @@ -1,3 +1,5 @@ +package invtweaks; + /** * * @author Jimeo Wan diff --git a/src/invtweaks/lang/_README.txt b/src/minecraft/invtweaks/lang/_README.txt old mode 100755 new mode 100644 similarity index 100% rename from src/invtweaks/lang/_README.txt rename to src/minecraft/invtweaks/lang/_README.txt diff --git a/src/invtweaks/lang/da_DK.properties b/src/minecraft/invtweaks/lang/da_DK.properties old mode 100755 new mode 100644 similarity index 100% rename from src/invtweaks/lang/da_DK.properties rename to src/minecraft/invtweaks/lang/da_DK.properties diff --git a/src/invtweaks/lang/de_DE.properties b/src/minecraft/invtweaks/lang/de_DE.properties old mode 100755 new mode 100644 similarity index 100% rename from src/invtweaks/lang/de_DE.properties rename to src/minecraft/invtweaks/lang/de_DE.properties diff --git a/src/invtweaks/lang/en_US.properties b/src/minecraft/invtweaks/lang/en_US.properties old mode 100755 new mode 100644 similarity index 100% rename from src/invtweaks/lang/en_US.properties rename to src/minecraft/invtweaks/lang/en_US.properties diff --git a/src/invtweaks/lang/es_ES.properties b/src/minecraft/invtweaks/lang/es_ES.properties old mode 100755 new mode 100644 similarity index 100% rename from src/invtweaks/lang/es_ES.properties rename to src/minecraft/invtweaks/lang/es_ES.properties diff --git a/src/invtweaks/lang/fr_FR.properties b/src/minecraft/invtweaks/lang/fr_FR.properties old mode 100755 new mode 100644 similarity index 100% rename from src/invtweaks/lang/fr_FR.properties rename to src/minecraft/invtweaks/lang/fr_FR.properties diff --git a/src/invtweaks/lang/ja_JP.properties b/src/minecraft/invtweaks/lang/ja_JP.properties old mode 100755 new mode 100644 similarity index 100% rename from src/invtweaks/lang/ja_JP.properties rename to src/minecraft/invtweaks/lang/ja_JP.properties diff --git a/src/invtweaks/lang/ko_KR.properties b/src/minecraft/invtweaks/lang/ko_KR.properties old mode 100755 new mode 100644 similarity index 100% rename from src/invtweaks/lang/ko_KR.properties rename to src/minecraft/invtweaks/lang/ko_KR.properties diff --git a/src/invtweaks/lang/nb_NO.properties b/src/minecraft/invtweaks/lang/nb_NO.properties similarity index 100% rename from src/invtweaks/lang/nb_NO.properties rename to src/minecraft/invtweaks/lang/nb_NO.properties diff --git a/src/invtweaks/lang/nl_NL.properties b/src/minecraft/invtweaks/lang/nl_NL.properties old mode 100755 new mode 100644 similarity index 100% rename from src/invtweaks/lang/nl_NL.properties rename to src/minecraft/invtweaks/lang/nl_NL.properties diff --git a/src/invtweaks/lang/pl_PL.properties b/src/minecraft/invtweaks/lang/pl_PL.properties old mode 100755 new mode 100644 similarity index 100% rename from src/invtweaks/lang/pl_PL.properties rename to src/minecraft/invtweaks/lang/pl_PL.properties diff --git a/src/invtweaks/lang/pt_BR.properties b/src/minecraft/invtweaks/lang/pt_BR.properties old mode 100755 new mode 100644 similarity index 100% rename from src/invtweaks/lang/pt_BR.properties rename to src/minecraft/invtweaks/lang/pt_BR.properties diff --git a/src/invtweaks/lang/pt_PT.properties b/src/minecraft/invtweaks/lang/pt_PT.properties old mode 100755 new mode 100644 similarity index 100% rename from src/invtweaks/lang/pt_PT.properties rename to src/minecraft/invtweaks/lang/pt_PT.properties diff --git a/src/invtweaks/lang/ru_RU.properties b/src/minecraft/invtweaks/lang/ru_RU.properties old mode 100755 new mode 100644 similarity index 100% rename from src/invtweaks/lang/ru_RU.properties rename to src/minecraft/invtweaks/lang/ru_RU.properties diff --git a/src/invtweaks/lang/sv_SE.properties b/src/minecraft/invtweaks/lang/sv_SE.properties old mode 100755 new mode 100644 similarity index 100% rename from src/invtweaks/lang/sv_SE.properties rename to src/minecraft/invtweaks/lang/sv_SE.properties diff --git a/src/invtweaks/lang/tr_TR.properties b/src/minecraft/invtweaks/lang/tr_TR.properties old mode 100755 new mode 100644 similarity index 100% rename from src/invtweaks/lang/tr_TR.properties rename to src/minecraft/invtweaks/lang/tr_TR.properties diff --git a/src/invtweaks/lang/uk_UA.properties b/src/minecraft/invtweaks/lang/uk_UA.properties old mode 100755 new mode 100644 similarity index 100% rename from src/invtweaks/lang/uk_UA.properties rename to src/minecraft/invtweaks/lang/uk_UA.properties diff --git a/src/invtweaks/lang/zh_CN.properties b/src/minecraft/invtweaks/lang/zh_CN.properties old mode 100755 new mode 100644 similarity index 100% rename from src/invtweaks/lang/zh_CN.properties rename to src/minecraft/invtweaks/lang/zh_CN.properties diff --git a/src/invtweaks/lang/zh_TW.properties b/src/minecraft/invtweaks/lang/zh_TW.properties old mode 100755 new mode 100644 similarity index 100% rename from src/invtweaks/lang/zh_TW.properties rename to src/minecraft/invtweaks/lang/zh_TW.properties diff --git a/src/minecraft/net/minecraft/src/InvTweaksObfuscation.java b/src/minecraft/net/minecraft/src/InvTweaksObfuscation.java new file mode 100644 index 00000000..fd1628ff --- /dev/null +++ b/src/minecraft/net/minecraft/src/InvTweaksObfuscation.java @@ -0,0 +1,509 @@ +package net.minecraft.src; + +import invtweaks.InvTweaksModCompatibility; + +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.logging.Logger; + +import net.minecraft.client.Minecraft; + +/** + * Minecraft 1.3 Obfuscation layer + * + * @author Jimeo Wan + * + */ +public class InvTweaksObfuscation { + + private static final Logger log = Logger.getLogger("InvTweaks"); + + public Minecraft mc; + + public InvTweaksModCompatibility mods; + + private static Map fieldsMap = new HashMap(); + + static { + // CreativeSlot.underlyingSlot + makeFieldPublic(SlotCreativeInventory.class, "theSlot"); + // RenderEngine.texturePack + makeFieldPublic(RenderEngine.class, "texturePack"); + } + + public InvTweaksObfuscation(Minecraft mc) { + this.mc = mc; + this.mods = new InvTweaksModCompatibility(this); + } + + // Minecraft members + + public void addChatMessage(String message) { + if (mc.ingameGUI != null) { + mc.ingameGUI.getChatGUI().printChatMessage(message); + } + } + public EntityPlayer getThePlayer() { + return mc.thePlayer; + } + public World getTheWorld() { + return mc.theWorld; + } + public PlayerControllerMP getPlayerController() { + return mc.playerController; + } + public GuiScreen getCurrentScreen() { + return mc.currentScreen; + } + public FontRenderer getFontRenderer() { + return mc.fontRenderer; + } + public void displayGuiScreen(GuiScreen parentScreen) { + mc.displayGuiScreen(parentScreen); + } + public int getDisplayWidth() { + return mc.displayWidth; + } + public int getDisplayHeight() { + return mc.displayHeight; + } + public GameSettings getGameSettings() { + return mc.gameSettings; + } + public KeyBinding[] getRegisteredBindings() { + return getGameSettings().keyBindings; + } + public void setRegisteredBindings(KeyBinding[] bindings) { + getGameSettings().keyBindings = bindings; + } + public int getKeyBindingForwardKeyCode() { + return getKeyCode(getGameSettings().keyBindForward); + } + public int getKeyBindingBackKeyCode() { + return getKeyCode(getGameSettings().keyBindBack); + } + + // EntityPlayer members + + public InventoryPlayer getInventoryPlayer() { // InventoryPlayer + return getThePlayer().inventory; + } + public ItemStack getCurrentEquippedItem() { // ItemStack + return getThePlayer().getCurrentEquippedItem(); + } + public Container getCraftingInventory() { // Container + return getThePlayer().craftingInventory; + } + public ContainerPlayer getPlayerContainer() { // ContainerPlayer + return (ContainerPlayer) getThePlayer().inventorySlots; + } + + // InventoryPlayer members + + public ItemStack[] getMainInventory() { + return getInventoryPlayer().mainInventory; + } + public void setMainInventory(ItemStack[] value) { + getInventoryPlayer().mainInventory = value; + } + public void setHasInventoryChanged(boolean value) { + getInventoryPlayer().inventoryChanged = value; + } + public void setHeldStack(ItemStack stack) { + getInventoryPlayer().setItemStack(stack); // setItemStack + } + public boolean hasInventoryChanged() { + return getInventoryPlayer().inventoryChanged; + } + public ItemStack getHeldStack() { + return getInventoryPlayer().getItemStack(); // getItemStack + } + public ItemStack getFocusedStack() { + return getInventoryPlayer().getCurrentItem(); // getCurrentItem + } + public int getFocusedSlot() { + return getInventoryPlayer().currentItem; // currentItem + } + + // GuiScreen members + + public int getWindowWidth(GuiScreen guiScreen) { + return guiScreen.width; + } + public int getWindowHeight(GuiScreen guiScreen) { + return guiScreen.height; + } + public int getGuiX(GuiContainer guiContainer) { + return guiContainer.guiLeft; + } + public int getGuiY(GuiContainer guiContainer) { + return guiContainer.guiTop; + } + public int getGuiWidth(GuiContainer guiContainer) { + return guiContainer.width; + } + public int getGuiHeight(GuiContainer guiContainer) { + return guiContainer.height; + } + @SuppressWarnings("unchecked") + public List getControlList(GuiScreen guiScreen) { + return guiScreen.controlList; + } + public void setControlList(GuiScreen guiScreen, List controlList) { + guiScreen.controlList = controlList; + } + public GuiContainer asGuiContainer(GuiScreen guiScreen) { + return (GuiContainer) guiScreen; + } + + // FontRenderer members + + public int getStringWidth(FontRenderer fontRenderer, String line) { + return fontRenderer.getStringWidth(line); + } + public void drawStringWithShadow(FontRenderer fontRenderer, + String s, int i, int j, int k) { + fontRenderer.drawStringWithShadow(s, i, j, k); + } + + // ItemStack members + + public ItemStack createItemStack(int id, int size, int damage) { + return new ItemStack(id, size, damage); + } + public ItemStack copy(ItemStack itemStack) { + return itemStack.copy(); + } + public int getItemDamage(ItemStack itemStack) { + return itemStack.getItemDamage(); + } + public int getMaxStackSize(ItemStack itemStack) { + return itemStack.getMaxStackSize(); + } + public boolean hasDataTags(ItemStack itemStack) { + return itemStack.hasTagCompound(); + } + public int getStackSize(ItemStack itemStack) { + return itemStack.stackSize; + } + public int getItemID(ItemStack itemStack) { + return itemStack.itemID; + } + public boolean areItemStacksEqual(ItemStack itemStack1, ItemStack itemStack2) { + return itemStack1.isItemEqual(itemStack2) && getStackSize(itemStack1) == getStackSize(itemStack2); + } + public boolean isItemStackDamageable(ItemStack itemStack) { + return itemStack.isItemStackDamageable(); + } + public boolean areSameItemType(ItemStack itemStack1, ItemStack itemStack2) { + return areItemsEqual(itemStack1, itemStack2) || + (isItemStackDamageable(itemStack1) + && getItemID(itemStack1) == getItemID(itemStack2)); + } + public boolean areItemsEqual(ItemStack itemStack1, ItemStack itemStack2) { + return itemStack1.isItemEqual(itemStack2); + } + public int getAnimationsToGo(ItemStack itemStack) { + return itemStack.animationsToGo; + } + public Item getItem(ItemStack itemStack) { // Item + return itemStack.getItem(); + } + + // Item & ItemArmor + + public boolean isDamageable(Item item) { + return item.isDamageable(); + } + public int getMaxDamage(Item item) { + return item.getMaxDamage(); + } + public int getArmorLevel(ItemArmor itemArmor) { // ItemArmor + return itemArmor.damageReduceAmount; + } + public ItemArmor asItemArmor(Item item) { // ItemArmor + return (ItemArmor) item; + } + + // PlayerController members + + public ItemStack clickInventory(PlayerControllerMP playerController, + int windowId, int slot, int clickButton, + boolean shiftHold, EntityPlayer entityPlayer) { + return playerController.windowClick(windowId, slot, clickButton, + (shiftHold) ? 1 : 0 /* XXX Placeholder */, entityPlayer); + } + + // Container members + + public int getWindowId(Container container) { + return container.windowId; + } + public List getSlots(Container container) { + return container.inventorySlots; + } + public Slot getSlot(Container container, int i) { // Slot + return (Slot) (getSlots(container).get(i)); + } + + public ItemStack getSlotStack(Container container, int i) { + Slot slot = getSlot(container, i); + return (slot == null) ? null : getStack(slot); // getStack + } + + public void setSlotStack(Container container, int i, ItemStack stack) { + container.putStackInSlot(i, stack); // putStackInSlot + } + + // Slot members + + public boolean hasStack(Slot slot) { + return slot.getHasStack(); + } + public int getSlotNumber(Slot slot) { + try { + // Creative slots don't set the "slotNumber" property, serve as a proxy for true slots + if (slot instanceof SlotCreativeInventory) { + Slot underlyingSlot = (Slot) getThroughReflection(SlotCreativeInventory.class, "theSlot", slot); + if (underlyingSlot != null) { + return underlyingSlot.slotNumber; + } + } + } catch (Exception e) { + log.warning("Failed to access creative slot nItemStackber"); + } + return slot.slotNumber; + } + public ItemStack getStack(Slot slot) { + return slot.getStack(); + } + public int getXDisplayPosition(Slot slot) { + return slot.xDisplayPosition; + } + public int getYDisplayPosition(Slot slot) { + return slot.yDisplayPosition; + } + public boolean areSlotAndStackCompatible(Slot slot, ItemStack itemStack) { + return slot.isItemValid(itemStack); // isItemValid + } + + // GuiContainer members + + public Container getContainer(GuiContainer guiContainer) { + return guiContainer.inventorySlots; + } + + // GuiButton + + public GuiButton asGuiButton(Object o) { + return (GuiButton) o; + } + public void setEnabled(GuiButton guiButton, boolean enabled) { // GuiButton + guiButton.enabled = enabled; + } + public int getId(GuiButton guiButton) { // GuiButton + return guiButton.id; + } + public void setDisplayString(GuiButton guiButton, String string) { + guiButton.displayString = string; + } + public String getDisplayString(GuiButton guiButton) { + return guiButton.displayString; + } + + // Other + + public void playSound(String string, float f, float g) { + mc.sndManager.playSoundFX(string, f, g); + } + public long getCurrentTime() { + return getTheWorld().getTotalWorldTime(); + } + public int getKeyCode(KeyBinding b) { + return b.keyCode; + } + public int getSpecialChestRowSize(GuiContainer guiContainer, int defaultValue) { + return mods.getSpecialChestRowSize(guiContainer, defaultValue); + } + public boolean hasTexture(String texture) { + TexturePackList texturePacksManager = (TexturePackList) getThroughReflection(RenderEngine.class, "texturePack", mc.renderEngine); + InputStream resourceAsStream = null; + try { + resourceAsStream = texturePacksManager.getSelectedTexturePack().getResourceAsStream(texture); + return texturePacksManager != null && resourceAsStream != null; + } + finally { + if (resourceAsStream != null) { + try { + resourceAsStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + + // Static access + + public static StringTranslate getLocalizationService() { // StringTranslate + return StringTranslate.getInstance(); // StringTranslate.getInstance() + } + public static String getCurrentLanguage() { + return getLocalizationService().getCurrentLanguage(); + } + public static String getLocalizedString(String key) { + return getLocalizationService().translateKey(key); + } + public static ItemStack getHoldStackStatic(Minecraft mc) { + return new InvTweaksObfuscation(mc).getHeldStack(); + } + public static GuiScreen getCurrentScreenStatic(Minecraft mc) { + return new InvTweaksObfuscation(mc).getCurrentScreen(); + } + + // Classes + + public boolean isValidChest(GuiScreen guiScreen) { + return guiScreen != null && (isGuiChest(guiScreen) + || isGuiDispenser(guiScreen) + || mods.isSpecialChest(guiScreen)); + } + public boolean isValidInventory(GuiScreen guiScreen) { + return isStandardInventory(guiScreen) + || mods.isSpecialInventory(guiScreen); + } + public boolean isStandardInventory(GuiScreen guiScreen) { + return isGuiInventory(guiScreen) + || isGuiWorkbench(guiScreen) + || isGuiFurnace(guiScreen) + || isGuiBrewingStand(guiScreen) + || isGuiEnchantmentTable(guiScreen) + || isGuiTrading(guiScreen) + || isGuiAnvil(guiScreen) + || isGuiBeacon(guiScreen) + || (isGuiInventoryCreative(guiScreen) + && getSlots(getContainer(asGuiContainer(guiScreen))).size() == 46); + } + + public boolean isGuiContainer(Object o) { // GuiContainer (abstract class) + return o != null && o instanceof GuiContainer; + } + + public boolean isGuiBeacon(Object o) { // GuiBeacon + return o != null && o.getClass().equals(GuiBeacon.class); + } + public boolean isGuiBrewingStand(Object o) { // GuiBrewingStand + return o != null && o.getClass().equals(GuiBrewingStand.class); + } + public boolean isGuiChest(Object o) { // GuiChest + return o != null && o.getClass().equals(GuiChest.class); + } + public boolean isGuiWorkbench(Object o) { // GuiWorkbench + return o != null && o.getClass().equals(GuiCrafting.class); + } + public boolean isGuiInventoryCreative(Object o) { // GuiInventoryCreative + return o != null && o.getClass().equals(GuiContainerCreative.class); + } + public boolean isGuiEnchantmentTable(Object o) { // GuiEnchantmentTable + return o != null && o.getClass().equals(GuiEnchantment.class); + } + public boolean isGuiFurnace(Object o) { // GuiFurnace + return o != null && o.getClass().equals(GuiFurnace.class); + } + public boolean isGuiInventory(Object o) { // GuiInventory + return o != null && o.getClass().equals(GuiInventory.class); + } + public boolean isGuiTrading(Object o) { // GuiTrading + return o != null && o.getClass().equals(GuiMerchant.class); + } + public boolean isGuiAnvil(Object o) { // GuiAnvil + return o != null && o.getClass().equals(GuiRepair.class); + } + public boolean isGuiDispenser(Object o) { // GuiDispenser + return o != null && o.getClass().equals(GuiDispenser.class); + } + + public boolean isGuiButton(Object o) { // GuiButton + return o != null && o instanceof GuiButton; + } + + public boolean isGuiEditSign(Object o) { + return o != null && o.getClass().equals(GuiEditSign.class); + } + public boolean isContainerBeacon(Object o) { + return o != null && o.getClass().equals(ContainerBeacon.class); + } + public boolean isContainerBrewingStand(Object o) { + return o != null && o.getClass().equals(ContainerBrewingStand.class); + } + public boolean isContainerChest(Object o) { + return o != null && o.getClass().equals(ContainerChest.class); + } + public boolean isContainerWorkbench(Object o) { + return o != null && o.getClass().equals(ContainerWorkbench.class); + } + public boolean isContainerEnchantmentTable(Object o) { + return o != null && o.getClass().equals(ContainerEnchantment.class); + } + public boolean isContainerFurnace(Object o) { + return o != null && o.getClass().equals(ContainerFurnace.class); + } + public boolean isContainerPlayer(Object o) { + return o != null && o.getClass().equals(ContainerPlayer.class); + } + public boolean isContainerTrading(Object o) { + return o != null && o.getClass().equals(ContainerMerchant.class); + } + public boolean isContainerAnvil(Object o) { + return o != null && o.getClass().equals(ContainerRepair.class); + } + public boolean isContainerDispenser(Object o) { + return o != null && o.getClass().equals(ContainerDispenser.class); + } + public boolean isContainerCreative(Object o) { // ContainerCreative + return o != null && o.getClass().equals(ContainerCreative.class); + } + + public boolean isItemArmor(Object o) { // ItemArmor + return o != null && o instanceof ItemArmor; + } + + public boolean isBasicSlot(Object o) { // Slot + return o != null && o.getClass().equals(Slot.class); + } + + // Reflection utils + + public static void makeFieldPublic(Class c, String field) { + try { + Field f = c.getDeclaredField(field); + f.setAccessible(true); + Field modifiersField = Field.class.getDeclaredField("modifiers"); + modifiersField.setAccessible(true); + modifiersField.setInt(f, Modifier.PUBLIC); + fieldsMap.put(c.getName() + field, f); + } + catch (Exception e) { + log.severe("Failed to make " + c.getName() + "." + field + " accessible: " + e.getMessage()); + } + } + + /** + * Access value from any field, even private. + * Field must be made public through the makeFieldPublic() function first. + * @return + */ + public static Object getThroughReflection(Class c, String field, Object instance) { + try { + return fieldsMap.get(c.getName() + field).get(instance); + } catch (Exception e) { + return null; + } + } + +} \ No newline at end of file diff --git a/src/mod_InvTweaks.java b/src/minecraft/net/minecraft/src/mod_InvTweaks.java similarity index 91% rename from src/mod_InvTweaks.java rename to src/minecraft/net/minecraft/src/mod_InvTweaks.java index ae4ad325..c029184d 100644 --- a/src/mod_InvTweaks.java +++ b/src/minecraft/net/minecraft/src/mod_InvTweaks.java @@ -1,3 +1,5 @@ +package net.minecraft.src; +import invtweaks.InvTweaks; import invtweaks.InvTweaksConst; import java.util.logging.Logger; @@ -62,9 +64,10 @@ public boolean onTickInGame(float clock, Minecraft minecraft) { /** * Called by ModLoader when an item has been picked up. */ + @Override - public void onItemPickup(qx entityplayer, um itemstack) { + public void onItemPickup(EntityPlayer entityplayer, ItemStack itemstack) { instance.setItemPickupPending(true); } - + } From 656eac792f68c59879c29f75d0e5aac275ef170c Mon Sep 17 00:00:00 2001 From: Marwane Kalam-Alami Date: Tue, 20 Nov 2012 13:43:24 +0100 Subject: [PATCH 02/30] Update launcher scripts, Localization resources fix when launched through MCP --- launcher/debug.bat | 2 ++ launcher/debug.sh | 3 +++ launcher/debug_suspend.bat | 2 ++ launcher/debug_suspend.sh | 3 +++ src/minecraft/invtweaks/InvTweaksLocalization.java | 7 ++++++- 5 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 launcher/debug.bat create mode 100644 launcher/debug.sh create mode 100644 launcher/debug_suspend.bat create mode 100644 launcher/debug_suspend.sh diff --git a/launcher/debug.bat b/launcher/debug.bat new file mode 100644 index 00000000..3471913c --- /dev/null +++ b/launcher/debug.bat @@ -0,0 +1,2 @@ +cd ../jars +java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 -Xincgc -Xms1024M -Xmx1024M -cp "../bin/minecraft:../lib:../lib/*:../jars/bin/minecraft.jar:../jars/bin/jinput.jar:../jars/bin/lwjgl.jar:../jars/bin/lwjgl_util.jar" -Djava.library.path="../jars/bin/natives" Start diff --git a/launcher/debug.sh b/launcher/debug.sh new file mode 100644 index 00000000..f401a505 --- /dev/null +++ b/launcher/debug.sh @@ -0,0 +1,3 @@ +#!/bin/bash +cd ../jars +java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 -Xincgc -Xms1024M -Xmx1024M -cp "../bin/minecraft:../lib:../lib/*:../jars/bin/minecraft.jar:../jars/bin/jinput.jar:../jars/bin/lwjgl.jar:../jars/bin/lwjgl_util.jar" -Djava.library.path="../jars/bin/natives" Start diff --git a/launcher/debug_suspend.bat b/launcher/debug_suspend.bat new file mode 100644 index 00000000..9ee4e288 --- /dev/null +++ b/launcher/debug_suspend.bat @@ -0,0 +1,2 @@ +cd ../jars +java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -Xincgc -Xms1024M -Xmx1024M -cp "../bin/minecraft:../lib:../lib/*:../jars/bin/minecraft.jar:../jars/bin/jinput.jar:../jars/bin/lwjgl.jar:../jars/bin/lwjgl_util.jar" -Djava.library.path="../jars/bin/natives" Start diff --git a/launcher/debug_suspend.sh b/launcher/debug_suspend.sh new file mode 100644 index 00000000..db76513b --- /dev/null +++ b/launcher/debug_suspend.sh @@ -0,0 +1,3 @@ +#!/bin/bash +cd ../jars +java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -Xincgc -Xms1024M -Xmx1024M -cp "../bin/minecraft:../lib:../lib/*:../jars/bin/minecraft.jar:../jars/bin/jinput.jar:../jars/bin/lwjgl.jar:../jars/bin/lwjgl_util.jar" -Djava.library.path="../jars/bin/natives" Start diff --git a/src/minecraft/invtweaks/InvTweaksLocalization.java b/src/minecraft/invtweaks/InvTweaksLocalization.java index 6a621307..0f325ca6 100644 --- a/src/minecraft/invtweaks/InvTweaksLocalization.java +++ b/src/minecraft/invtweaks/InvTweaksLocalization.java @@ -18,6 +18,7 @@ public class InvTweaksLocalization { @SuppressWarnings("unused") private static final Logger log = Logger.getLogger("InvTweaks"); private static final String LANG_RESOURCES_LOCATION = "invtweaks/lang/"; + private static final String LANG_RESOURCES_LOCATION_MCP = "../invtweaks/lang/"; private static final String DEFAULT_LANGUAGE = "en_US"; private static Properties defaultMappings = new Properties(); private static Properties mappings = new Properties(); @@ -43,7 +44,11 @@ private static String load(String currentLanguage) { try { InputStream langStream = InvTweaksLocalization.class.getResourceAsStream(LANG_RESOURCES_LOCATION + currentLanguage + ".properties"); InputStream defaultLangStream = InvTweaksLocalization.class.getResourceAsStream(LANG_RESOURCES_LOCATION + DEFAULT_LANGUAGE + ".properties"); - + if (langStream == null) { + langStream = InvTweaksLocalization.class.getResourceAsStream(LANG_RESOURCES_LOCATION_MCP + currentLanguage + ".properties"); + defaultLangStream = InvTweaksLocalization.class.getResourceAsStream(LANG_RESOURCES_LOCATION_MCP + DEFAULT_LANGUAGE + ".properties"); + } + mappings.load((langStream == null) ? defaultLangStream : langStream); defaultMappings.load(defaultLangStream); From aa38f5f74c51b730c0d46f6273cc22ee048204dc Mon Sep 17 00:00:00 2001 From: Marwane Kalam-Alami Date: Tue, 20 Nov 2012 13:45:45 +0100 Subject: [PATCH 03/30] Update sources to MCP 7.22 --- src/minecraft/net/minecraft/src/InvTweaksObfuscation.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/minecraft/net/minecraft/src/InvTweaksObfuscation.java b/src/minecraft/net/minecraft/src/InvTweaksObfuscation.java index fd1628ff..3637b9b9 100644 --- a/src/minecraft/net/minecraft/src/InvTweaksObfuscation.java +++ b/src/minecraft/net/minecraft/src/InvTweaksObfuscation.java @@ -96,11 +96,8 @@ public InventoryPlayer getInventoryPlayer() { // InventoryPlayer public ItemStack getCurrentEquippedItem() { // ItemStack return getThePlayer().getCurrentEquippedItem(); } - public Container getCraftingInventory() { // Container - return getThePlayer().craftingInventory; - } - public ContainerPlayer getPlayerContainer() { // ContainerPlayer - return (ContainerPlayer) getThePlayer().inventorySlots; + public ContainerPlayer getPlayerContainer() { + return (ContainerPlayer) getThePlayer().inventoryContainer; } // InventoryPlayer members From 0dce76e4e48f1ca4b108d4760e2d25b8c8a7a1f9 Mon Sep 17 00:00:00 2001 From: Eydamos Date: Fri, 28 Dec 2012 19:53:05 +0100 Subject: [PATCH 04/30] Added compatibility for Backpacks and Red Power 2 Canvas Bags --- src/minecraft/invtweaks/InvTweaksModCompatibility.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/minecraft/invtweaks/InvTweaksModCompatibility.java b/src/minecraft/invtweaks/InvTweaksModCompatibility.java index 508057ad..1b0db21a 100644 --- a/src/minecraft/invtweaks/InvTweaksModCompatibility.java +++ b/src/minecraft/invtweaks/InvTweaksModCompatibility.java @@ -47,6 +47,7 @@ public boolean isSpecialChest(GuiScreen guiScreen) { || is(guiScreen, "GuiFilter") // Red Power 2 || is(guiScreen, "GuiAdvBench") // Red Power 2 || is(guiScreen, "GuiEject") // Red Power 2 + || is(guiScreen, "GuiBag") // Red Power 2 || is(guiScreen, "GuiPersonalChest") || is(guiScreen, "GuiNuclearReactor") // IC2 || is(guiScreen, "GuiEnderChest") // EnderChest @@ -55,6 +56,7 @@ public boolean isSpecialChest(GuiScreen guiScreen) { || is(guiScreen, "FC_GuiChest") // Metallurgy || is(guiScreen, "FM_GuiMintStorage") // Metallurgy || is(guiScreen, "GuiChestTFC") // TerraFirmaCraft + || is(guiScreen, "GuiBackpack") // Backpacks ; } From 1672f21bb7541cab4bf94d03471f88a97327375f Mon Sep 17 00:00:00 2001 From: iluvredwall <> Date: Sun, 23 Dec 2012 02:45:03 -0800 Subject: [PATCH 05/30] Implemented even stacks (distribute items) for crafting tables. Functional, but not amazingly pretty. Probably not the most efficient way either. --- src/minecraft/invtweaks/InvTweaks.java | 162 ++++++------- .../invtweaks/InvTweaksHandlerSorting.java | 229 ++++++++++++------ 2 files changed, 237 insertions(+), 154 deletions(-) diff --git a/src/minecraft/invtweaks/InvTweaks.java b/src/minecraft/invtweaks/InvTweaks.java index 81597480..75a2d134 100644 --- a/src/minecraft/invtweaks/InvTweaks.java +++ b/src/minecraft/invtweaks/InvTweaks.java @@ -31,14 +31,14 @@ /** * Main class for Inventory Tweaks, which maintains various hooks * and dispatches the events to the correct handlers. - * + * * @author Jimeo Wan * * Contact: jimeo.wan (at) gmail (dot) com * Website: {@link http://wan.ka.free.fr/?invtweaks} * Source code: {@link https://github.com/jimeowan/inventory-tweaks} * License: MIT - * + * */ public class InvTweaks extends InvTweaksObfuscation { @@ -50,7 +50,7 @@ public class InvTweaks extends InvTweaksObfuscation { * The configuration loader. */ private InvTweaksConfigManager cfgManager = null; - + /** * Attributes to remember the status of chest sorting * while using middle clicks. @@ -58,7 +58,7 @@ public class InvTweaks extends InvTweaksObfuscation { private int chestAlgorithm = InvTweaksHandlerSorting.ALGORITHM_DEFAULT; private long chestAlgorithmClickTimestamp = 0; private boolean chestAlgorithmButtonDown = false; - + /** * Various information concerning the context, stored on * each tick to allow for certain features (auto-refill, @@ -67,12 +67,12 @@ public class InvTweaks extends InvTweaksObfuscation { private int storedStackId = 0, storedStackDamage = -1, storedFocusedSlot = -1; private ItemStack[] hotbarClone = new ItemStack[InvTweaksConst.INVENTORY_HOTBAR_SIZE]; private boolean hadFocus = true, mouseWasDown = false;; - + /** * Allows to trigger some logic only every Const.POLLING_DELAY. */ private int tickNumber = 0, lastPollingTickNumber = -InvTweaksConst.POLLING_DELAY; - + /** * Stores when the sorting key was last pressed (allows to detect long key holding) */ @@ -81,7 +81,7 @@ public class InvTweaks extends InvTweaksObfuscation { private boolean itemPickupPending = false; - + /** * Creates an instance of the mod, and loads the configuration * from the files, creating them if necessary. @@ -102,7 +102,7 @@ public InvTweaks(Minecraft mc) { } else { log.severe("Mod failed to initialize!"); } - + } @@ -118,7 +118,7 @@ public void onTickInGame() { handleAutoRefill(); } } - + /** * To be called on each tick when a menu is open. * Handles the GUI additions and the middle clicking. @@ -126,7 +126,7 @@ public void onTickInGame() { */ public void onTickInGUI(GuiScreen guiScreen) { synchronized (this) { - handleMiddleClick(guiScreen); // Called before the rest to be able to trigger config reload + handleMiddleClick(guiScreen); // Called before the rest to be able to trigger config reload if (!onTick()) { return; } @@ -135,8 +135,8 @@ public void onTickInGUI(GuiScreen guiScreen) { } handleGUILayout(guiScreen); handleShortcuts(guiScreen); - - // Copy some info about current selected stack for auto-refill + + // Copy some info about current selected stack for auto-refill ItemStack currentStack = getFocusedStack(); storedStackId = (currentStack == null) ? 0 : getItemID(currentStack); storedStackDamage = (currentStack == null) ? 0 : getItemDamage(currentStack); @@ -149,12 +149,12 @@ public void onTickInGUI(GuiScreen guiScreen) { */ public final void onSortingKeyPressed() { synchronized (this) { - + // Check config loading success if (!cfgManager.makeSureConfigurationIsLoaded()) { return; } - + // Check current GUI GuiScreen guiScreen = getCurrentScreen(); if (guiScreen == null || (isValidChest(guiScreen) || isValidInventory(guiScreen))) { @@ -169,7 +169,7 @@ public final void onSortingKeyPressed() { * Moves the picked up item in another slot that matches best the current configuration. */ public void onItemPickup() { - + if (!cfgManager.makeSureConfigurationIsLoaded()) { return; } @@ -178,11 +178,11 @@ public void onItemPickup() { if (cfgManager.getConfig().getProperty(InvTweaksConfig.PROP_ENABLE_SORTING_ON_PICKUP).equals("false")) { return; } - + try { InvTweaksContainerSectionManager containerMgr = new InvTweaksContainerSectionManager(mc, InvTweaksContainerSection.INVENTORY); containerMgr.setClickDelay(config.getClickDelay()); - + // Find stack slot (look in hotbar only). // We're looking for a brand new stack in the hotbar // (not an existing stack whose amount has been increased) @@ -194,10 +194,10 @@ public void onItemPickup() { currentSlot = i + 27; } } - + if (currentSlot != -1) { itemPickupPending = false; - + // Find preffered slots List prefferedPositions = new LinkedList(); InvTweaksItemTree tree = config.getTree(); @@ -211,7 +211,7 @@ public void onItemPickup() { } } } - + // Find best slot for stack boolean hasToBeMoved = true; if (prefferedPositions != null) { @@ -234,7 +234,7 @@ else if (containerMgr.getItemStack(newSlot) == null) { } } } - + // Else, put the slot anywhere if (hasToBeMoved) { for (int i = 0; i < containerMgr.getSize(); i++) { @@ -245,9 +245,9 @@ else if (containerMgr.getItemStack(newSlot) == null) { } } } - + } - + } catch (Exception e) { logInGameError("Failed to move picked up stack", e); } @@ -266,7 +266,7 @@ public void logInGame(String message, boolean alreadyTranslated) { addChatMessage(formattedMsg); log.info(formattedMsg); } - + public void logInGameError(String message, Exception e) { String formattedMsg = buildlogString(Level.SEVERE, InvTweaksLocalization.get(message), e); addChatMessage(formattedMsg); @@ -296,7 +296,7 @@ public static Minecraft getMinecraftInstance() { public static InvTweaksConfigManager getConfigManager() { return instance.cfgManager; } - + public static boolean classExists(String className) { try { return Class.forName(className) != null; @@ -308,13 +308,13 @@ public static boolean classExists(String className) { private boolean onTick() { tickNumber++; - + // Not calling "cfgManager.makeSureConfigurationIsLoaded()" for performance reasons InvTweaksConfig config = cfgManager.getConfig(); - if (config == null) { + if (config == null) { return false; } - + // Clone the hotbar to be able to monitor changes on it if (itemPickupPending) { onItemPickup(); @@ -323,7 +323,7 @@ private boolean onTick() { if (currentScreen == null || isGuiInventory(currentScreen)) { cloneHotbar(); } - + // Handle sort key if (Keyboard.isKeyDown(config.getSortKeyCode())) { if (!sortKeyDown) { @@ -334,16 +334,16 @@ private boolean onTick() { else { sortKeyDown = false; } - + // Handle config switch handleConfigSwitch(); - + return true; - + } - + private void handleConfigSwitch() { - + InvTweaksConfig config = cfgManager.getConfig(); GuiScreen currentScreen = getCurrentScreen(); @@ -370,11 +370,11 @@ private void handleConfigSwitch() { case Keyboard.KEY_NUMPAD9: newRuleset = config.switchConfig(8); break; } } - + if (newRuleset != null) { logInGame(String.format(InvTweaksLocalization.get("invtweaks.loadconfig.enabled"), newRuleset), true); // Hack to prevent 2nd way to switch configs from being enabled - sortingKeyPressedDate = Integer.MAX_VALUE; + sortingKeyPressedDate = Integer.MAX_VALUE; } } @@ -401,7 +401,7 @@ private void handleConfigSwitch() { } private void handleSorting(GuiScreen guiScreen) { - + ItemStack selectedItem = null; int focusedSlot = getFocusedSlot(); ItemStack[] mainInventory = getMainInventory(); @@ -431,22 +431,22 @@ private void handleSorting(GuiScreen guiScreen) { } private void handleAutoRefill() { - + ItemStack currentStack = getFocusedStack(); int currentStackId = (currentStack == null) ? 0 : getItemID(currentStack); int currentStackDamage = (currentStack == null) ? 0 : getItemDamage(currentStack); int focusedSlot = getFocusedSlot() + 27; // Convert to container slots index InvTweaksConfig config = cfgManager.getConfig(); - + if (currentStackId != storedStackId || currentStackDamage != storedStackDamage) { - + if (storedFocusedSlot != focusedSlot) { // Filter selection change storedFocusedSlot = focusedSlot; } else if ((currentStack == null || getItemID(currentStack) == 281 && storedStackId == 282) // Handle eaten mushroom soup && (getCurrentScreen() == null || // Filter open inventory or other window isGuiEditSign(getCurrentScreen()))) { - + if (config.isAutoRefillEnabled(storedStackId, storedStackId)) { try { cfgManager.getAutoRefillHandler().autoRefillSlot(focusedSlot, storedStackId, storedStackDamage); @@ -471,26 +471,26 @@ else if ((currentStack == null || getItemID(currentStack) == 281 && storedStackI } } } - - // Copy some info about current selected stack for auto-refill + + // Copy some info about current selected stack for auto-refill storedStackId = currentStackId; storedStackDamage = currentStackDamage; - + } private void handleMiddleClick(GuiScreen guiScreen) { - + if (Mouse.isButtonDown(2)) { - + if (!cfgManager.makeSureConfigurationIsLoaded()) { return; } InvTweaksConfig config = cfgManager.getConfig(); - + // Check that middle click sorting is allowed if (config.getProperty(InvTweaksConfig.PROP_ENABLE_MIDDLE_CLICK) .equals(InvTweaksConfig.VALUE_TRUE)) { - + if (!chestAlgorithmButtonDown) { chestAlgorithmButtonDown = true; @@ -501,20 +501,20 @@ private void handleMiddleClick(GuiScreen guiScreen) { if (slotAtMousePosition != null) { target = containerMgr.getSlotSection(getSlotNumber(slotAtMousePosition)); } - + if (isValidChest(guiScreen)) { - + // Check if the middle click target the chest or the inventory // (copied GuiContainer.getSlotAtPosition algorithm) GuiContainer guiContainer = asGuiContainer(guiScreen); - + if (InvTweaksContainerSection.CHEST.equals(target)) { - + // Play click playClick(); - + long timestamp = System.currentTimeMillis(); - if (timestamp - chestAlgorithmClickTimestamp > + if (timestamp - chestAlgorithmClickTimestamp > InvTweaksConst.CHEST_ALGORITHM_SWAP_MAX_INTERVAL) { chestAlgorithm = InvTweaksHandlerSorting.ALGORITHM_DEFAULT; } @@ -534,25 +534,21 @@ private void handleMiddleClick(GuiScreen guiScreen) { || (InvTweaksContainerSection.INVENTORY_NOT_HOTBAR.equals(target))) { handleSorting(guiScreen); } - - } else if (isValidInventory(guiScreen)) { - /* + } else if (isValidInventory(guiScreen)) { // Crafting stacks evening (hook ready, TODO implement algorithm) - if (InvTweaksContainerSection.CRAFTING_IN.equals(target)) { + if(InvTweaksContainerSection.CRAFTING_IN.equals(target)) try { - new InvTweaksHandlerSorting(mc, cfgManager.getConfig(), - InvTweaksContainerSection.CRAFTING_IN, - InvTweaksHandlerSorting.ALGORITHM_EVEN_STACKS, - (containerMgr.getSize(target) == 9) ? 3 : 2).sort(); - } catch (Exception e) { + new InvTweaksHandlerSorting(mc, cfgManager.getConfig(), + InvTweaksContainerSection.CRAFTING_IN, + InvTweaksHandlerSorting.ALGORITHM_EVEN_STACKS, + (containerMgr.getSize(target) == 9) ? 3 : 2).sort(); + } + catch(Exception e) { logInGameError("invtweaks.sort.crafting.error", e); e.printStackTrace(); - } - }*/ - - handleSorting(guiScreen); - + } + else handleSorting(guiScreen); } } } @@ -585,10 +581,10 @@ private void handleGUILayout(GuiScreen guiScreen) { } if (!customButtonsAdded) { - + // Check for custom button texture boolean customTextureAvailable = hasTexture("/gui/button10px.png"); - + // Inventory button if (!isValidChest) { controlList.add(new InvTweaksGuiSettingsButton( @@ -617,13 +613,13 @@ private void handleGUILayout(GuiScreen guiScreen) { y += 50; } } - + // Settings button controlList.add(new InvTweaksGuiSettingsButton( - cfgManager, id++, + cfgManager, id++, (isChestWayTooBig) ? x + 22 : x - 1, (isChestWayTooBig) ? y - 3 : y, - w, h, "...", + w, h, "...", InvTweaksLocalization.get("invtweaks.button.settings.tooltip"), customTextureAvailable)); @@ -631,7 +627,7 @@ private void handleGUILayout(GuiScreen guiScreen) { if (!config.getProperty(InvTweaksConfig.PROP_SHOW_CHEST_BUTTONS).equals("false")) { int rowSize = getContainerRowSize(guiContainer); - + InvTweaksObfuscationGuiButton button = new InvTweaksGuiSortingButton( cfgManager, id++, (isChestWayTooBig) ? x + 22 : x - 13, @@ -666,7 +662,7 @@ private void handleGUILayout(GuiScreen guiScreen) { } } } - + else { // Remove "..." button from non-survival tabs of the creative screen if (isGuiInventoryCreative(guiScreen)) { @@ -683,12 +679,12 @@ private void handleGUILayout(GuiScreen guiScreen) { if (buttonToRemove != null) { controlList.remove(buttonToRemove); } - + } } } - + /** * Hacky parsing of the NEI configuration file to see if the mod is enabled or not. */ @@ -718,22 +714,22 @@ private boolean isNotEnoughItemsEnabled() { } private void handleShortcuts(GuiScreen guiScreen) { - + // Check open GUI if (!(isValidChest(guiScreen) || isStandardInventory(guiScreen))) { return; } - + // FIXME Shortcuts are currently buggy within creative inventory if (isGuiInventoryCreative(guiScreen)) { return; } - + // Configurable shortcuts if (Mouse.isButtonDown(0) || Mouse.isButtonDown(1)) { if (!mouseWasDown) { mouseWasDown = true; - + // The mouse has just been clicked, // trigger a shortcut according to the pressed keys. if (cfgManager.getConfig().getProperty( @@ -745,7 +741,7 @@ private void handleShortcuts(GuiScreen guiScreen) { else { mouseWasDown = false; } - + } private int getContainerRowSize(GuiContainer guiContainer) { @@ -835,5 +831,5 @@ private String buildlogString(Level level, String message, Exception e) { private String buildlogString(Level level, String message) { return InvTweaksConst.INGAME_LOG_PREFIX + ((level.equals(Level.SEVERE)) ? "[ERROR] " : "") + message; } - + } diff --git a/src/minecraft/invtweaks/InvTweaksHandlerSorting.java b/src/minecraft/invtweaks/InvTweaksHandlerSorting.java index 678d5faa..880aacc7 100644 --- a/src/minecraft/invtweaks/InvTweaksHandlerSorting.java +++ b/src/minecraft/invtweaks/InvTweaksHandlerSorting.java @@ -4,13 +4,7 @@ import invtweaks.InvTweaksItemTree; import invtweaks.InvTweaksItemTreeItem; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Vector; +import java.util.*; import java.util.concurrent.TimeoutException; import java.util.logging.Logger; @@ -25,7 +19,7 @@ /** * Core of the sorting behaviour. Allows to move items in a container * (inventory or chest) with respect to the mod's configuration. - * + * * @author Jimeo Wan * */ @@ -39,7 +33,7 @@ public class InvTweaksHandlerSorting extends InvTweaksObfuscation { private static int[] DEFAULT_LOCK_PRIORITIES = null; private static boolean[] DEFAULT_FROZEN_SLOTS = null; private static final int MAX_CONTAINER_SIZE = 999; - + public static final int ALGORITHM_DEFAULT = 0; public static final int ALGORITHM_VERTICAL = 1; public static final int ALGORITHM_HORIZONTAL = 2; @@ -51,7 +45,7 @@ public class InvTweaksHandlerSorting extends InvTweaksObfuscation { private int size; private boolean sortArmorParts; private int clickDelay; - + private InvTweaksItemTree tree; private Vector rules; private int[] rulePriority; @@ -62,7 +56,7 @@ public class InvTweaksHandlerSorting extends InvTweaksObfuscation { public InvTweaksHandlerSorting(Minecraft mc, InvTweaksConfig config, InvTweaksContainerSection section, int algorithm, int rowSize) throws Exception { super(mc); - + // Init constants if (DEFAULT_LOCK_PRIORITIES == null) { @@ -86,7 +80,7 @@ public InvTweaksHandlerSorting(Minecraft mc, InvTweaksConfig config, this.size = containerMgr.getSize(); this.sortArmorParts = config.getProperty(InvTweaksConfig.PROP_ENABLE_AUTO_EQUIP_ARMOR).equals(InvTweaksConfig.VALUE_TRUE) && !isGuiInventoryCreative(getCurrentScreen()); // FIXME Armor parts disappear when sorting in creative mode while holding an item - + this.rules = config.getRules(); this.tree = config.getTree(); if (section == InvTweaksContainerSection.INVENTORY) { @@ -115,13 +109,13 @@ public InvTweaksHandlerSorting(Minecraft mc, InvTweaksConfig config, } } } - + public void sort() throws TimeoutException { - + // Do nothing if the inventory is closed // if (!mc.hrrentScreen instanceof GuiContainer) // return; - + long timer = System.nanoTime(); InvTweaksContainerManager globalContainer = new InvTweaksContainerManager(mc); globalContainer.setClickDelay(this.clickDelay); @@ -136,11 +130,15 @@ public void sort() throws TimeoutException { return; // Not enough room to work, abort } } - + if (algorithm != ALGORITHM_DEFAULT) { - - if (algorithm == ALGORITHM_INVENTORY) { - + + if (algorithm == ALGORITHM_EVEN_STACKS) { + distribute(); + for(int i=0;i= 0; i--) { ItemStack from = containerMgr.getItemStack(i); @@ -202,7 +200,7 @@ && getItemDamage(getStack(slot)) < getItemDamage(from))) { } } } - + // Stackable objects are never damageable else { int j = 0; @@ -222,22 +220,22 @@ && getItemDamage(getStack(slot)) < getItemDamage(from))) { } } } - + } - + //// Apply rules log.info("Applying rules."); - + // Sorts rule by rule, themselves being already sorted by decreasing priority Iterator rulesIt = rules.iterator(); while (rulesIt.hasNext()) { - + InvTweaksConfigSortingRule rule = rulesIt.next(); int rulePriority = rule.getPriority(); - + if (log.getLevel() == InvTweaksConst.DEBUG) log.info("Rule : "+rule.getKeyword()+"("+rulePriority+")"); - + // For every item in the inventory for (int i = 0; i < size; i++) { ItemStack from = containerMgr.getItemStack(i); @@ -247,13 +245,13 @@ && getItemDamage(getStack(slot)) < getItemDamage(from))) { List fromItems = tree.getItems( getItemID(from), getItemDamage(from)); if (tree.matches(fromItems, rule.getKeyword())) { - + // Test preffered slots int[] preferredSlots = rule.getPreferredSlots(); int stackToMove = i; for (int j = 0; j < preferredSlots.length; j++) { int k = preferredSlots[j]; - + // Move the stack! int moveResult = move(stackToMove, k, rulePriority); if (moveResult != -1) { @@ -277,10 +275,10 @@ && getItemDamage(getStack(slot)) < getItemDamage(from))) { } } } - + //// Don't move locked stacks log.info("Locking stacks."); - + for (int i = 0; i < size; i++) { if (hasToBeMoved(i) && lockPriorities[i] > 0) { markAsMoved(i, 1); @@ -288,7 +286,7 @@ && getItemDamage(getStack(slot)) < getItemDamage(from))) { } } - + //// Sort remaining defaultSorting(); @@ -307,9 +305,9 @@ && getItemDamage(getStack(slot)) < getItemDamage(from))) { } private void defaultSorting() throws TimeoutException { - + log.info("Default sorting."); - + Vector remaining = new Vector(), nextRemaining = new Vector(); for (int i = 0; i < size; i++) { if (hasToBeMoved(i)) { @@ -317,7 +315,7 @@ private void defaultSorting() throws TimeoutException { nextRemaining.add(i); } } - + int iterations = 0; while (remaining.size() > 0 && iterations++ < 50) { for (int i : remaining) { @@ -339,13 +337,13 @@ private void defaultSorting() throws TimeoutException { if (iterations == 100) { log.warning("Sorting takes too long, aborting."); } - + } /** * Tries to move a stack from i to j, and swaps them if j is already * occupied but i is of greater priority (even if they are of same ID). - * + * * @param i from slot * @param j to slot * @param priority The rule priority. Use 1 if the stack was not moved using a rule. @@ -357,7 +355,7 @@ private void defaultSorting() throws TimeoutException { private int move(int i, int j, int priority) throws TimeoutException { ItemStack from = containerMgr.getItemStack(i), to = containerMgr.getItemStack(j); - + if (from == null || frozenSlots[j] || frozenSlots[i]) { return -1; } @@ -370,20 +368,20 @@ private int move(int i, int j, int priority) throws TimeoutException { markAsMoved(i, priority); return j; } - + // Move to empty slot if (to == null && lockPriorities[j] <= priority && !frozenSlots[j]) { rulePriority[i] = -1; keywordOrder[i] = -1; rulePriority[j] = priority; keywordOrder[j] = getItemOrder(from); - containerMgr.move(i, j); + containerMgr.move(i, j); return j; } // Try to swap/merge else if (to != null) { - + boolean canBeSwappedOrMerged = false; // Can be swapped? @@ -407,9 +405,9 @@ else if (getStackSize(from) > getMaxStackSize(from)) { canBeSwappedOrMerged = false; } } - + if (canBeSwappedOrMerged) { - + keywordOrder[j] = keywordOrder[i]; rulePriority[j] = priority; rulePriority[i] = -1; @@ -462,7 +460,7 @@ private boolean hasToBeMoved(int slot) { private boolean isOrderedBefore(int i, int j) { ItemStack iStack = containerMgr.getItemStack(i), jStack = containerMgr.getItemStack(j); - + if (jStack == null) { return true; } else if (iStack == null || keywordOrder[i] == -1) { @@ -499,12 +497,12 @@ private int getItemOrder(ItemStack itemStack) { ? items.get(0).getOrder() : Integer.MAX_VALUE; } - + private void computeLineSortingRules(int rowSize, boolean horizontal) { - + rules = new Vector(); - - + + Map stats = computeContainerStats(); List itemOrder = new ArrayList(); @@ -515,13 +513,13 @@ private void computeLineSortingRules(int rowSize, boolean horizontal) { int availableSlots = size; int remainingStacks = 0; for (Integer stacks : stats.values()) { - remainingStacks += stacks; + remainingStacks += stacks; } - + // No need to compute rules for an empty chest if (distinctItems == 0) return; - + // (Partially) sort stats by decreasing item stack count List unorderedItems = new ArrayList(stats.keySet()); boolean hasStacksToOrderFirst = true; @@ -540,7 +538,7 @@ private void computeLineSortingRules(int rowSize, boolean horizontal) { } Collections.sort(unorderedItems, Collections.reverseOrder()); itemOrder.addAll(unorderedItems); - + // Define space size used for each item type. if (horizontal) { spaceHeight = 1; @@ -550,16 +548,16 @@ private void computeLineSortingRules(int rowSize, boolean horizontal) { spaceWidth = 1; spaceHeight = columnSize/((distinctItems+rowSize-1)/rowSize); } - + char row = 'a', maxRow = (char) (row - 1 + columnSize); char column = '1', maxColumn = (char) (column - 1 + rowSize); - + // Create rules Iterator it = itemOrder.iterator(); while (it.hasNext()) { - + InvTweaksItemTreeItem item = it.next(); - + // Adapt rule dimensions to fit the amount int thisSpaceWidth = spaceWidth, thisSpaceHeight = spaceHeight; @@ -587,7 +585,7 @@ else if (column + thisSpaceWidth < maxColumn) { } } } - + // Adjust line/column ends to fill empty space if (horizontal && (column + thisSpaceWidth == maxColumn)) { thisSpaceWidth++; @@ -595,7 +593,7 @@ else if (column + thisSpaceWidth < maxColumn) { else if (!horizontal && row + thisSpaceHeight == maxRow) { thisSpaceHeight++; } - + // Create rule String constraint = row + "" + column + "-" + (char)(row - 1 + thisSpaceHeight) @@ -604,7 +602,7 @@ else if (!horizontal && row + thisSpaceHeight == maxRow) { constraint += 'v'; } rules.add(new InvTweaksConfigSortingRule(tree, constraint, item.getName(), size, rowSize)); - + // Check if ther's still room for more rules availableSlots -= thisSpaceHeight*thisSpaceWidth; remainingStacks -= stats.get(item); @@ -635,7 +633,7 @@ else if (!horizontal && row + thisSpaceHeight == maxRow) { break; } } - + String defaultRule; if (horizontal) { defaultRule = maxRow + "1-a" + maxColumn; @@ -643,25 +641,25 @@ else if (!horizontal && row + thisSpaceHeight == maxRow) { else { defaultRule = "a" + maxColumn + "-" + maxRow + "1v"; } - rules.add(new InvTweaksConfigSortingRule(tree, defaultRule, + rules.add(new InvTweaksConfigSortingRule(tree, defaultRule, tree.getRootCategory().getName(), size, rowSize)); - + } - + private Map computeContainerStats() { Map stats = new HashMap(); Map itemSearch = new HashMap(); - + for (int i = 0; i < size; i++) { ItemStack stack = containerMgr.getItemStack(i); if (stack != null) { - int itemSearchKey = getItemID(stack)*100000 + + int itemSearchKey = getItemID(stack)*100000 + ((getMaxStackSize(stack) != 1) ? getItemDamage(stack) : 0); InvTweaksItemTreeItem item = itemSearch.get(itemSearchKey); if (item == null) { item = tree.getItems(getItemID(stack), getItemDamage(stack)).get(0); - itemSearch.put(itemSearchKey, item); + itemSearch.put(itemSearchKey, item); stats.put(item, 1); } else { @@ -669,11 +667,100 @@ private Map computeContainerStats() { } } } - + return stats; } - + private int getContainerColumnSize(int rowSize) { return size / rowSize; } + + private void distribute() { + HashMap itemCounts = getItemCounts(); + for(Object object:itemCounts.entrySet()) { //handle each unique item separately + Map.Entry item = (Map.Entry)object; + int id = (Integer)item.getKey(); + int[] count = (int[])item.getValue(); + int amtPerSlot = count[0]/count[1]; //totalNumber/numberOfSlots + + //linkedlists to store which stacks have too many/few items + LinkedList toFill = new LinkedList(); + LinkedList toPickup = new LinkedList(); + fillTodos(toFill, toPickup, id, amtPerSlot); + + while((!toFill.isEmpty())) { //move items from stacks with too many to those with too little + int pickupIndex = (Integer)toPickup.poll(); + int fillIndex = (Integer)toFill.poll(); + int fillSize = getStackSize(containerMgr.getItemStack(fillIndex)); + try { + containerMgr.moveSome(pickupIndex, fillIndex, amtPerSlot-fillSize); + } catch(Exception e) { + System.out.println("error: " + e); + } + + //update todos + int pickupSize = getStackSize(containerMgr.getItemStack(pickupIndex)); + if(pickupSize > amtPerSlot) + toPickup.offer(pickupIndex); + else if(pickupSize < amtPerSlot) + toFill.offer(pickupIndex); + } + + //put all leftover into one stack for easy removal + while(toPickup.size() > 1) { + int pickupIndex = (Integer)toPickup.poll(); + int pickupSize = getStackSize(containerMgr.getItemStack(pickupIndex)); + try { + containerMgr.moveSome(pickupIndex,(Integer)toPickup.peek(),pickupSize-amtPerSlot); + } catch(Exception e) { + System.out.println("error2: " + e); + } + } + } + } + + /** + * @return a hashmap with entries per item including the number of stacks with the item and + * the total amount of the item across all stacks + */ + protected HashMap getItemCounts() { + HashMap itemCounts = new HashMap(); + for(int i = 0; i < 9; i++) { + um stack = containerMgr.getItemStack(i); + if(stack != null) { + Integer id = getItemID(stack); + int[] count = (int[])itemCounts.get(id); + if(count == null) { + int[] newCount = {getStackSize(stack),1}; + itemCounts.put(id,newCount); + } else { + count[0] += getStackSize(stack); //amount of item + count[1] += 1; //slots with item + } + } + } + return itemCounts; + } + + /** + * fills linked lists with indeces of stacks based on whether the stack has too little + * or too many items + * @param toFill a linkedlist to be filled with indeces of stacks that need more + * @param toPickup a linkedlist to be filled with indeces of stacks that have too much + * @param id item id of relevant items + * @param numPerSlot number of items each slot should have + */ + protected void fillTodos(LinkedList toFill, LinkedList toPickup, int id, int numPerSlot) { + for(int i = 0; i < 9; i++) { + um stack = containerMgr.getItemStack(i); + if(stack != null && getItemID(stack) == id) { + int stackSize = getStackSize(stack); + if(stackSize > numPerSlot) + toPickup.offer(i); + else if(stackSize < numPerSlot) + toFill.offer(i); + } + } + } + } From 3e4f4723a38551817c1a35004265cebbb20aded7 Mon Sep 17 00:00:00 2001 From: iluvredwall <> Date: Mon, 24 Dec 2012 19:07:59 -0800 Subject: [PATCH 06/30] improved even stacks (optimized, removed magic numbers for 2x2 crafting support, account for damage values) --- src/minecraft/invtweaks/InvTweaks.java | 2 +- .../invtweaks/InvTweaksHandlerSorting.java | 155 ++++++++---------- 2 files changed, 67 insertions(+), 90 deletions(-) diff --git a/src/minecraft/invtweaks/InvTweaks.java b/src/minecraft/invtweaks/InvTweaks.java index 75a2d134..81ef82fa 100644 --- a/src/minecraft/invtweaks/InvTweaks.java +++ b/src/minecraft/invtweaks/InvTweaks.java @@ -536,7 +536,7 @@ private void handleMiddleClick(GuiScreen guiScreen) { } } else if (isValidInventory(guiScreen)) { - // Crafting stacks evening (hook ready, TODO implement algorithm) + // Crafting stacks evening if(InvTweaksContainerSection.CRAFTING_IN.equals(target)) try { new InvTweaksHandlerSorting(mc, cfgManager.getConfig(), diff --git a/src/minecraft/invtweaks/InvTweaksHandlerSorting.java b/src/minecraft/invtweaks/InvTweaksHandlerSorting.java index 880aacc7..bcbe57ad 100644 --- a/src/minecraft/invtweaks/InvTweaksHandlerSorting.java +++ b/src/minecraft/invtweaks/InvTweaksHandlerSorting.java @@ -134,9 +134,74 @@ public void sort() throws TimeoutException { if (algorithm != ALGORITHM_DEFAULT) { if (algorithm == ALGORITHM_EVEN_STACKS) { - distribute(); + + //item and slot counts for each unique item + HashMap itemCounts = new HashMap(); + for(int i = 0; i < size; i++) { + um stack = containerMgr.getItemStack(i); + if(stack != null) { + List item = Arrays.asList(getItemID(stack),getItemDamage(stack)); + int[] count = (int[])itemCounts.get(item); + if(count == null) { + int[] newCount = {getStackSize(stack),1}; + itemCounts.put(item,newCount); + } else { + count[0] += getStackSize(stack); //amount of item + count[1]++; //slots with item + } + } + } + + //handle each unique item separately + for(Object object:itemCounts.entrySet()) { + Map.Entry entry = (Map.Entry)object; + List item = (List)entry.getKey(); + int[] count = (int[])entry.getValue(); + int numPerSlot = count[0]/count[1]; //totalNumber/numberOfSlots + + //linkedlists to store which stacks have too many/few items + LinkedList smallStacks = new LinkedList(); + LinkedList largeStacks = new LinkedList(); + for(int i = 0; i < size; i++) { + um stack = containerMgr.getItemStack(i); + if(stack != null && Arrays.asList(getItemID(stack),getItemDamage(stack)).equals(item)) { + int stackSize = getStackSize(stack); + if(stackSize > numPerSlot) + largeStacks.offer(i); + else if(stackSize < numPerSlot) + smallStacks.offer(i); + } + } + + //move items from stacks with too many to those with too little + while((!smallStacks.isEmpty())) { + int largeIndex = (Integer)largeStacks.peek(); + int largeSize = getStackSize(containerMgr.getItemStack(largeIndex)); + int smallIndex = (Integer)smallStacks.peek(); + int smallSize = getStackSize(containerMgr.getItemStack(smallIndex)); + containerMgr.moveSome(largeIndex, smallIndex, Math.min(numPerSlot-smallSize,largeSize-numPerSlot)); + + //update stack lists + largeSize = getStackSize(containerMgr.getItemStack(largeIndex)); + smallSize = getStackSize(containerMgr.getItemStack(smallIndex)); + if(largeSize == numPerSlot) + largeStacks.remove(); + if(smallSize == numPerSlot) + smallStacks.remove(); + } + + //put all leftover into one stack for easy removal + while(largeStacks.size() > 1) { + int pickupIndex = (Integer)largeStacks.poll(); + int pickupSize = getStackSize(containerMgr.getItemStack(pickupIndex)); + containerMgr.moveSome(pickupIndex,(Integer)largeStacks.peek(),pickupSize-numPerSlot); + } + } + + //mark all items as moved. (is there a better way?) for(int i=0;i amtPerSlot) - toPickup.offer(pickupIndex); - else if(pickupSize < amtPerSlot) - toFill.offer(pickupIndex); - } - - //put all leftover into one stack for easy removal - while(toPickup.size() > 1) { - int pickupIndex = (Integer)toPickup.poll(); - int pickupSize = getStackSize(containerMgr.getItemStack(pickupIndex)); - try { - containerMgr.moveSome(pickupIndex,(Integer)toPickup.peek(),pickupSize-amtPerSlot); - } catch(Exception e) { - System.out.println("error2: " + e); - } - } - } - } - - /** - * @return a hashmap with entries per item including the number of stacks with the item and - * the total amount of the item across all stacks - */ - protected HashMap getItemCounts() { - HashMap itemCounts = new HashMap(); - for(int i = 0; i < 9; i++) { - um stack = containerMgr.getItemStack(i); - if(stack != null) { - Integer id = getItemID(stack); - int[] count = (int[])itemCounts.get(id); - if(count == null) { - int[] newCount = {getStackSize(stack),1}; - itemCounts.put(id,newCount); - } else { - count[0] += getStackSize(stack); //amount of item - count[1] += 1; //slots with item - } - } - } - return itemCounts; - } - - /** - * fills linked lists with indeces of stacks based on whether the stack has too little - * or too many items - * @param toFill a linkedlist to be filled with indeces of stacks that need more - * @param toPickup a linkedlist to be filled with indeces of stacks that have too much - * @param id item id of relevant items - * @param numPerSlot number of items each slot should have - */ - protected void fillTodos(LinkedList toFill, LinkedList toPickup, int id, int numPerSlot) { - for(int i = 0; i < 9; i++) { - um stack = containerMgr.getItemStack(i); - if(stack != null && getItemID(stack) == id) { - int stackSize = getStackSize(stack); - if(stackSize > numPerSlot) - toPickup.offer(i); - else if(stackSize < numPerSlot) - toFill.offer(i); - } - } - } - } From 4b191af7ac2b33f94edfe15bb89ccfc4a4a21385 Mon Sep 17 00:00:00 2001 From: iluvredwall <> Date: Mon, 24 Dec 2012 22:48:15 -0800 Subject: [PATCH 07/30] fix even stacks to skip items with more than max number of items (not possible without mods/world editing) --- .../invtweaks/InvTweaksHandlerSorting.java | 82 +++++++++++-------- 1 file changed, 48 insertions(+), 34 deletions(-) diff --git a/src/minecraft/invtweaks/InvTweaksHandlerSorting.java b/src/minecraft/invtweaks/InvTweaksHandlerSorting.java index bcbe57ad..0fa33a5c 100644 --- a/src/minecraft/invtweaks/InvTweaksHandlerSorting.java +++ b/src/minecraft/invtweaks/InvTweaksHandlerSorting.java @@ -4,7 +4,15 @@ import invtweaks.InvTweaksItemTree; import invtweaks.InvTweaksItemTreeItem; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Vector; import java.util.concurrent.TimeoutException; import java.util.logging.Logger; @@ -134,6 +142,7 @@ public void sort() throws TimeoutException { if (algorithm != ALGORITHM_DEFAULT) { if (algorithm == ALGORITHM_EVEN_STACKS) { + log.info("Distributing items."); //item and slot counts for each unique item HashMap itemCounts = new HashMap(); @@ -159,42 +168,47 @@ public void sort() throws TimeoutException { int[] count = (int[])entry.getValue(); int numPerSlot = count[0]/count[1]; //totalNumber/numberOfSlots - //linkedlists to store which stacks have too many/few items - LinkedList smallStacks = new LinkedList(); - LinkedList largeStacks = new LinkedList(); - for(int i = 0; i < size; i++) { - um stack = containerMgr.getItemStack(i); - if(stack != null && Arrays.asList(getItemID(stack),getItemDamage(stack)).equals(item)) { - int stackSize = getStackSize(stack); - if(stackSize > numPerSlot) - largeStacks.offer(i); - else if(stackSize < numPerSlot) - smallStacks.offer(i); + //skip hacked itemstacks that are larger than their max size + //no idea why they would be here, but may as well account for them anyway + if(numPerSlot <= getMaxStackSize(new um(new uk(item.get(0))))) { + + //linkedlists to store which stacks have too many/few items + LinkedList smallStacks = new LinkedList(); + LinkedList largeStacks = new LinkedList(); + for(int i = 0; i < size; i++) { + um stack = containerMgr.getItemStack(i); + if(stack != null && Arrays.asList(getItemID(stack),getItemDamage(stack)).equals(item)) { + int stackSize = getStackSize(stack); + if(stackSize > numPerSlot) + largeStacks.offer(i); + else if(stackSize < numPerSlot) + smallStacks.offer(i); + } } - } - //move items from stacks with too many to those with too little - while((!smallStacks.isEmpty())) { - int largeIndex = (Integer)largeStacks.peek(); - int largeSize = getStackSize(containerMgr.getItemStack(largeIndex)); - int smallIndex = (Integer)smallStacks.peek(); - int smallSize = getStackSize(containerMgr.getItemStack(smallIndex)); - containerMgr.moveSome(largeIndex, smallIndex, Math.min(numPerSlot-smallSize,largeSize-numPerSlot)); - - //update stack lists - largeSize = getStackSize(containerMgr.getItemStack(largeIndex)); - smallSize = getStackSize(containerMgr.getItemStack(smallIndex)); - if(largeSize == numPerSlot) - largeStacks.remove(); - if(smallSize == numPerSlot) - smallStacks.remove(); - } + //move items from stacks with too many to those with too little + while((!smallStacks.isEmpty())) { + int largeIndex = (Integer)largeStacks.peek(); + int largeSize = getStackSize(containerMgr.getItemStack(largeIndex)); + int smallIndex = (Integer)smallStacks.peek(); + int smallSize = getStackSize(containerMgr.getItemStack(smallIndex)); + containerMgr.moveSome(largeIndex, smallIndex, Math.min(numPerSlot-smallSize,largeSize-numPerSlot)); + + //update stack lists + largeSize = getStackSize(containerMgr.getItemStack(largeIndex)); + smallSize = getStackSize(containerMgr.getItemStack(smallIndex)); + if(largeSize == numPerSlot) + largeStacks.remove(); + if(smallSize == numPerSlot) + smallStacks.remove(); + } - //put all leftover into one stack for easy removal - while(largeStacks.size() > 1) { - int pickupIndex = (Integer)largeStacks.poll(); - int pickupSize = getStackSize(containerMgr.getItemStack(pickupIndex)); - containerMgr.moveSome(pickupIndex,(Integer)largeStacks.peek(),pickupSize-numPerSlot); + //put all leftover into one stack for easy removal + while(largeStacks.size() > 1) { + int largeIndex = (Integer)largeStacks.poll(); + int largeSize = getStackSize(containerMgr.getItemStack(largeIndex)); + containerMgr.moveSome(largeIndex,(Integer)largeStacks.peek(),largeSize-numPerSlot); + } } } From 82d1a58479826eaa506553a86fa07a3cd59b0ca5 Mon Sep 17 00:00:00 2001 From: Kobata Date: Tue, 25 Dec 2012 11:35:10 -0500 Subject: [PATCH 08/30] Merge fixes Shouldn't make a new item, just look up the existing one in that index. --- src/minecraft/invtweaks/InvTweaksHandlerSorting.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/minecraft/invtweaks/InvTweaksHandlerSorting.java b/src/minecraft/invtweaks/InvTweaksHandlerSorting.java index 0fa33a5c..e3a996eb 100644 --- a/src/minecraft/invtweaks/InvTweaksHandlerSorting.java +++ b/src/minecraft/invtweaks/InvTweaksHandlerSorting.java @@ -168,9 +168,13 @@ public void sort() throws TimeoutException { int[] count = (int[])entry.getValue(); int numPerSlot = count[0]/count[1]; //totalNumber/numberOfSlots + // Skip potential null items + if(net.minecraft.item.Item.itemsList[item.get(0)] == null) { + continue; + } //skip hacked itemstacks that are larger than their max size //no idea why they would be here, but may as well account for them anyway - if(numPerSlot <= getMaxStackSize(new um(new uk(item.get(0))))) { + if(numPerSlot <= getMaxStackSize(new ItemStack(net.minecraft.item.Item.itemsList[item.get(0)]))) { //linkedlists to store which stacks have too many/few items LinkedList smallStacks = new LinkedList(); From 093fb400ed686617a152a45f0c63fe5998f1b691 Mon Sep 17 00:00:00 2001 From: Kobata Date: Fri, 28 Dec 2012 15:13:49 -0500 Subject: [PATCH 09/30] Ignore first mouse event after opening a GUI. Fixes #2. --- src/minecraft/invtweaks/InvTweaks.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/minecraft/invtweaks/InvTweaks.java b/src/minecraft/invtweaks/InvTweaks.java index 81ef82fa..b122a44c 100644 --- a/src/minecraft/invtweaks/InvTweaks.java +++ b/src/minecraft/invtweaks/InvTweaks.java @@ -68,6 +68,7 @@ public class InvTweaks extends InvTweaksObfuscation { private ItemStack[] hotbarClone = new ItemStack[InvTweaksConst.INVENTORY_HOTBAR_SIZE]; private boolean hadFocus = true, mouseWasDown = false;; + private boolean wasInGUI = false; /** * Allows to trigger some logic only every Const.POLLING_DELAY. */ @@ -116,6 +117,9 @@ public void onTickInGame() { return; } handleAutoRefill(); + if(wasInGUI) { + wasInGUI = false; + } } } @@ -134,12 +138,20 @@ public void onTickInGUI(GuiScreen guiScreen) { unlockKeysIfNecessary(); } handleGUILayout(guiScreen); + if(!wasInGUI) { + // Right-click is always true on initial open of GUI. + // Ignore it to prevent erroneous trigger of shortcuts. + mouseWasDown = true; + } handleShortcuts(guiScreen); // Copy some info about current selected stack for auto-refill ItemStack currentStack = getFocusedStack(); storedStackId = (currentStack == null) ? 0 : getItemID(currentStack); storedStackDamage = (currentStack == null) ? 0 : getItemDamage(currentStack); + if(!wasInGUI) { + wasInGUI = true; + } } } From 5426966c9eb2f8de8bb1182bd17670e842eab347 Mon Sep 17 00:00:00 2001 From: Kobata Date: Mon, 31 Dec 2012 20:08:44 -0500 Subject: [PATCH 10/30] Fix RP2 project table slot numbers. --- src/minecraft/invtweaks/InvTweaksModCompatibility.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/minecraft/invtweaks/InvTweaksModCompatibility.java b/src/minecraft/invtweaks/InvTweaksModCompatibility.java index 1b0db21a..5632aebb 100644 --- a/src/minecraft/invtweaks/InvTweaksModCompatibility.java +++ b/src/minecraft/invtweaks/InvTweaksModCompatibility.java @@ -132,9 +132,9 @@ public Map> getSpecialContainerSlots(GuiSc result.put(InvTweaksContainerSection.CHEST, slots.subList(1, slots.size() - 36)); } else if (is(guiScreen, "GuiAdvBench")) { // RedPower 2 - result.put(InvTweaksContainerSection.CRAFTING_IN, slots.subList(0, 9)); - result.put(InvTweaksContainerSection.CRAFTING_OUT, slots.subList(9, 10)); - result.put(InvTweaksContainerSection.CHEST, slots.subList(10, 28)); + result.put(ContainerSection.CRAFTING_IN, slots.subList(0, 9)); + result.put(ContainerSection.CRAFTING_OUT, slots.subList(10, 11)); + result.put(ContainerSection.CHEST, slots.subList(11, 29)); } return result; From f52f7582d2a35103cf1ebf10b9352a2a6a8b7a00 Mon Sep 17 00:00:00 2001 From: Kobata Date: Tue, 1 Jan 2013 13:18:20 -0500 Subject: [PATCH 11/30] Run crafting even-stacks on chests if they have a CRAFTING_IN section. Should make the evening work on things like RP2's project table, even though it doesn't really have to in that case. --- src/minecraft/invtweaks/InvTweaks.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/minecraft/invtweaks/InvTweaks.java b/src/minecraft/invtweaks/InvTweaks.java index b122a44c..600b923b 100644 --- a/src/minecraft/invtweaks/InvTweaks.java +++ b/src/minecraft/invtweaks/InvTweaks.java @@ -542,6 +542,17 @@ private void handleMiddleClick(GuiScreen guiScreen) { chestAlgorithm = (chestAlgorithm + 1) % 3; chestAlgorithmClickTimestamp = timestamp; + } else if(InvTweaksContainerSection.CRAFTING_IN.equals(target)) { + try { + new InvTweaksHandlerSorting(mc, cfgManager.getConfig(), + InvTweaksContainerSection.CRAFTING_IN, + InvTweaksHandlerSorting.ALGORITHM_EVEN_STACKS, + (containerMgr.getSize(target) == 9) ? 3 : 2).sort(); + } catch(Exception e) { + logInGameError("invtweaks.sort.crafting.error", e); + e.printStackTrace(); + } + } else if (InvTweaksContainerSection.INVENTORY_HOTBAR.equals(target) || (InvTweaksContainerSection.INVENTORY_NOT_HOTBAR.equals(target))) { handleSorting(guiScreen); From 37ab847ff202d64de33c871fa2beb482e6dc5e75 Mon Sep 17 00:00:00 2001 From: Kobata Date: Wed, 2 Jan 2013 00:51:54 -0500 Subject: [PATCH 12/30] Thaumcraft 3: Mark crafting slots on Arcane & Infusion Workbenches as such. --- src/minecraft/invtweaks/InvTweaksModCompatibility.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/minecraft/invtweaks/InvTweaksModCompatibility.java b/src/minecraft/invtweaks/InvTweaksModCompatibility.java index 5632aebb..dfb2589a 100644 --- a/src/minecraft/invtweaks/InvTweaksModCompatibility.java +++ b/src/minecraft/invtweaks/InvTweaksModCompatibility.java @@ -135,6 +135,9 @@ else if (is(guiScreen, "GuiAdvBench")) { // RedPower 2 result.put(ContainerSection.CRAFTING_IN, slots.subList(0, 9)); result.put(ContainerSection.CRAFTING_OUT, slots.subList(10, 11)); result.put(ContainerSection.CHEST, slots.subList(11, 29)); + } else if(is(guiScreen, "GuiArcaneWorkbench") || is(guiScreen, "GuiInfusionWorkbench")) { // Thaumcraft 3 + result.put(ContainerSection.CRAFTING_OUT, slots.subList(0, 1)); + result.put(ContainerSection.CRAFTING_IN, slots.subList(2, 11)); } return result; From ea8d295ce42d7943d3df6e87a7c63417483e7384 Mon Sep 17 00:00:00 2001 From: Kobata Date: Fri, 4 Jan 2013 22:40:34 -0500 Subject: [PATCH 13/30] Insure 'valid chests' are always instances of GuiContainer. The method of checking for mod class names is kind of stupid and breaks with the Backpacks mod because of a non-GuiContainer class name starting with 'GuiBackpack'. --- src/minecraft/net/minecraft/src/InvTweaksObfuscation.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/minecraft/net/minecraft/src/InvTweaksObfuscation.java b/src/minecraft/net/minecraft/src/InvTweaksObfuscation.java index 3637b9b9..d228421f 100644 --- a/src/minecraft/net/minecraft/src/InvTweaksObfuscation.java +++ b/src/minecraft/net/minecraft/src/InvTweaksObfuscation.java @@ -368,7 +368,8 @@ public static GuiScreen getCurrentScreenStatic(Minecraft mc) { public boolean isValidChest(GuiScreen guiScreen) { return guiScreen != null && (isGuiChest(guiScreen) || isGuiDispenser(guiScreen) - || mods.isSpecialChest(guiScreen)); + || mods.isSpecialChest(guiScreen)) + && (guiScreen instanceof GuiContainer); } public boolean isValidInventory(GuiScreen guiScreen) { return isStandardInventory(guiScreen) From 3845c4cadc9c2ee70130c9bad5a88867002a652b Mon Sep 17 00:00:00 2001 From: Kobata Date: Sat, 5 Jan 2013 15:58:50 -0500 Subject: [PATCH 14/30] Add handling for armor replacement when a non-armor item (e.g. skulls) is worn. --- .../invtweaks/InvTweaksHandlerSorting.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/minecraft/invtweaks/InvTweaksHandlerSorting.java b/src/minecraft/invtweaks/InvTweaksHandlerSorting.java index e3a996eb..00ebab1f 100644 --- a/src/minecraft/invtweaks/InvTweaksHandlerSorting.java +++ b/src/minecraft/invtweaks/InvTweaksHandlerSorting.java @@ -267,12 +267,17 @@ else if(stackSize < numPerSlot) move = true; } else { - int armorLevel = getArmorLevel(asItemArmor(getItem(getStack(slot)))); - if (armorLevel < getArmorLevel(fromItemArmor) - || (armorLevel == getArmorLevel(fromItemArmor) - && getItemDamage(getStack(slot)) < getItemDamage(from))) { - move = true; - } + Item currentArmor = getItem(getStack(slot)); + if(isItemArmor(currentArmor)) { + int armorLevel = getArmorLevel(asItemArmor(currentArmor)); + if (armorLevel < getArmorLevel(fromItemArmor) + || (armorLevel == getArmorLevel(fromItemArmor) + && getItemDamage(getStack(slot)) < getItemDamage(from))) { + move = true; + } + } else { + move = true + } } if (areSlotAndStackCompatible(slot, from) && move) { globalContainer.move(InvTweaksContainerSection.INVENTORY, i, InvTweaksContainerSection.ARMOR, From b700a4df956bf91d8035690be79acc7b0f38cc12 Mon Sep 17 00:00:00 2001 From: Marwane Kalam-Alami Date: Sun, 6 Jan 2013 13:38:54 +0100 Subject: [PATCH 15/30] Fix #299: Cherry-pick @iluvredwall implementation of stacks evening --- src/minecraft/invtweaks/InvTweaks.java | 24 +++--- .../invtweaks/InvTweaksHandlerSorting.java | 81 ++++++++++++++++++- 2 files changed, 91 insertions(+), 14 deletions(-) diff --git a/src/minecraft/invtweaks/InvTweaks.java b/src/minecraft/invtweaks/InvTweaks.java index 81597480..422698ee 100644 --- a/src/minecraft/invtweaks/InvTweaks.java +++ b/src/minecraft/invtweaks/InvTweaks.java @@ -537,21 +537,21 @@ private void handleMiddleClick(GuiScreen guiScreen) { } else if (isValidInventory(guiScreen)) { - /* - // Crafting stacks evening (hook ready, TODO implement algorithm) - if (InvTweaksContainerSection.CRAFTING_IN.equals(target)) { + if (InvTweaksContainerSection.CRAFTING_IN.equals(target)) { + // Crafting stacks evening try { - new InvTweaksHandlerSorting(mc, cfgManager.getConfig(), - InvTweaksContainerSection.CRAFTING_IN, - InvTweaksHandlerSorting.ALGORITHM_EVEN_STACKS, - (containerMgr.getSize(target) == 9) ? 3 : 2).sort(); - } catch (Exception e) { + new InvTweaksHandlerSorting(mc, cfgManager.getConfig(), + InvTweaksContainerSection.CRAFTING_IN, + InvTweaksHandlerSorting.ALGORITHM_EVEN_STACKS, + (containerMgr.getSize(target) == 9) ? 3 : 2).sort(); + } catch (Exception e) { logInGameError("invtweaks.sort.crafting.error", e); e.printStackTrace(); - } - }*/ - - handleSorting(guiScreen); + } + } else { + // Sorting + handleSorting(guiScreen); + } } } diff --git a/src/minecraft/invtweaks/InvTweaksHandlerSorting.java b/src/minecraft/invtweaks/InvTweaksHandlerSorting.java index 678d5faa..b007df7b 100644 --- a/src/minecraft/invtweaks/InvTweaksHandlerSorting.java +++ b/src/minecraft/invtweaks/InvTweaksHandlerSorting.java @@ -5,11 +5,14 @@ import invtweaks.InvTweaksItemTreeItem; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; +import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Vector; import java.util.concurrent.TimeoutException; import java.util.logging.Logger; @@ -138,8 +141,82 @@ public void sort() throws TimeoutException { } if (algorithm != ALGORITHM_DEFAULT) { - - if (algorithm == ALGORITHM_INVENTORY) { + + if (algorithm == ALGORITHM_EVEN_STACKS) { + log.info("Distributing items."); + + //item and slot counts for each unique item + HashMap, int[]> itemCounts = new HashMap, int[]>(); + for(int i = 0; i < size; i++) { + ur stack = containerMgr.getItemStack(i); + if(stack != null) { + List item = Arrays.asList(getItemID(stack), getItemDamage(stack)); + int[] count = itemCounts.get(item); + if(count == null) { + int[] newCount = {getStackSize(stack), 1}; + itemCounts.put(item,newCount); + } else { + count[0] += getStackSize(stack); //amount of item + count[1]++; //slots with item + } + } + } + + //handle each unique item separately + for(Entry, int[]> entry : itemCounts.entrySet()) { + List item = entry.getKey(); + int[] count = entry.getValue(); + int numPerSlot = count[0]/count[1]; //totalNumber/numberOfSlots + + //skip hacked itemstacks that are larger than their max size + //no idea why they would be here, but may as well account for them anyway + if(numPerSlot <= getMaxStackSize(new ur(item.get(0),1,0))) { + + //linkedlists to store which stacks have too many/few items + LinkedList smallStacks = new LinkedList(); + LinkedList largeStacks = new LinkedList(); + for(int i = 0; i < size; i++) { + ur stack = containerMgr.getItemStack(i); + if(stack != null && Arrays.asList(getItemID(stack),getItemDamage(stack)).equals(item)) { + int stackSize = getStackSize(stack); + if(stackSize > numPerSlot) + largeStacks.offer(i); + else if(stackSize < numPerSlot) + smallStacks.offer(i); + } + } + + //move items from stacks with too many to those with too little + while((!smallStacks.isEmpty())) { + int largeIndex = (Integer)largeStacks.peek(); + int largeSize = getStackSize(containerMgr.getItemStack(largeIndex)); + int smallIndex = (Integer)smallStacks.peek(); + int smallSize = getStackSize(containerMgr.getItemStack(smallIndex)); + containerMgr.moveSome(largeIndex, smallIndex, Math.min(numPerSlot-smallSize,largeSize-numPerSlot)); + + //update stack lists + largeSize = getStackSize(containerMgr.getItemStack(largeIndex)); + smallSize = getStackSize(containerMgr.getItemStack(smallIndex)); + if(largeSize == numPerSlot) + largeStacks.remove(); + if(smallSize == numPerSlot) + smallStacks.remove(); + } + + //put all leftover into one stack for easy removal + while(largeStacks.size() > 1) { + int largeIndex = (Integer)largeStacks.poll(); + int largeSize = getStackSize(containerMgr.getItemStack(largeIndex)); + containerMgr.moveSome(largeIndex,(Integer)largeStacks.peek(),largeSize-numPerSlot); + } + } + } + + //mark all items as moved. (is there a better way?) + for(int i=0;i Date: Mon, 7 Jan 2013 23:24:44 +0100 Subject: [PATCH 16/30] Transition to MCP build process --- LICENSE.md => INVTWEAKS-LICENSE.md | 0 README.md => INVTWEAKS-README.md | 4 +- conf/mcp.cfg | 155 ++++++++++++++++++ invtweaks_scripts/copy_resources.py | 31 ++++ invtweaks_scripts/deploy_mod.py | 0 invtweaks_scripts/package_mod.py | 0 launcher/debug.bat | 2 - launcher/debug.sh | 3 - launcher/debug_suspend.bat | 2 - launcher/debug_suspend.sh | 3 - mcp/pom.xml | 148 ----------------- pom.xml | 155 ------------------ recompile.bat | 4 + recompile.sh | 3 + src/minecraft/invtweaks/InvTweaksConfig.java | 1 - .../InvTweaksConfigInventoryRuleset.java | 1 - .../invtweaks/InvTweaksConfigSortingRule.java | 1 - src/minecraft/invtweaks/InvTweaksConst.java | 3 +- .../invtweaks/InvTweaksGuiSettings.java | 1 - .../InvTweaksGuiSettingsAdvanced.java | 1 - .../invtweaks/InvTweaksHandlerShortcuts.java | 1 - .../invtweaks/InvTweaksHandlerSorting.java | 9 +- .../invtweaks/InvTweaksItemTree.java | 1 - .../invtweaks/InvTweaksItemTreeCategory.java | 1 - .../invtweaks/InvTweaksLocalization.java | 1 - .../invtweaks/InvTweaksModCompatibility.java | 10 +- .../invtweaks/InvTweaksShortcutMapping.java | 1 - .../net/minecraft/src/mod_InvTweaks.java | 1 - 28 files changed, 203 insertions(+), 340 deletions(-) rename LICENSE.md => INVTWEAKS-LICENSE.md (100%) mode change 100755 => 100644 rename README.md => INVTWEAKS-README.md (79%) create mode 100644 conf/mcp.cfg create mode 100644 invtweaks_scripts/copy_resources.py create mode 100644 invtweaks_scripts/deploy_mod.py create mode 100644 invtweaks_scripts/package_mod.py delete mode 100644 launcher/debug.bat delete mode 100644 launcher/debug.sh delete mode 100644 launcher/debug_suspend.bat delete mode 100644 launcher/debug_suspend.sh delete mode 100644 mcp/pom.xml delete mode 100755 pom.xml create mode 100644 recompile.bat create mode 100644 recompile.sh diff --git a/LICENSE.md b/INVTWEAKS-LICENSE.md old mode 100755 new mode 100644 similarity index 100% rename from LICENSE.md rename to INVTWEAKS-LICENSE.md diff --git a/README.md b/INVTWEAKS-README.md similarity index 79% rename from README.md rename to INVTWEAKS-README.md index 6ed75606..391472a9 100644 --- a/README.md +++ b/INVTWEAKS-README.md @@ -1,4 +1,4 @@ - + * Matching Minecraft version: **1.4.4** @@ -8,5 +8,5 @@ This Open Source project (see [License](https://github.com/mkalam-alami/inventor ## Get started -* For documentation about how to use or install the mod, see the [main page of Inventory Tweaks](http://wan.ka.free.fr/?invtweaks). This place is for developers! +* For documentation about how to use or install the mod, see the [main page of Inventory Tweaks](http://modding.kalam-alami.net). This place is for developers! * To start coding, all is explained on the [project's wiki](https://github.com/mkalam-alami/inventory-tweaks/wiki). diff --git a/conf/mcp.cfg b/conf/mcp.cfg new file mode 100644 index 00000000..b4d6940c --- /dev/null +++ b/conf/mcp.cfg @@ -0,0 +1,155 @@ +[DEFAULT] +DirTemp = temp +DirSrc = src +DirLogs = logs +DirBin = bin +DirJars = jars +DirReobf = reobf +DirConf = conf +DirRuntime = runtime +DirLib = lib +DirTempSrc = temp/src +DirTempCls = temp/cls +DirTempBin = temp/bin +DirModSrc = modsrc +DirEclipse = eclipse + +[CSV] +Classes = %(DirConf)s/classes.csv +Methods = %(DirConf)s/methods.csv +Fields = %(DirConf)s/fields.csv +Params = %(DirConf)s/params.csv +NewIds = %(DirConf)s/newids.csv + +[SRGS] +ConfClient = %(DirConf)s/client.srg +ConfServer = %(DirConf)s/server.srg +Client = %(DirTemp)s/client_rg.srg +Server = %(DirTemp)s/server_rg.srg +DeobfClient = %(DirTemp)s/client_deobf.srg +DeobfServer = %(DirTemp)s/server_deobf.srg +ReobfClient = %(DirTemp)s/client_ro.srg +ReobfServer = %(DirTemp)s/server_ro.srg + +[JAR] +DirNatives = %(DirJars)s/bin/natives +Client = %(DirJars)s/bin/minecraft.jar +Server = %(DirJars)s/minecraft_server.jar +LWJGL = %(DirJars)s/bin/jinput.jar,%(DirJars)s/bin/lwjgl.jar,%(DirJars)s/bin/lwjgl_util.jar +MD5Client = 48677dc4c2b98c29918722b5ab27b4fd +MD5Server = b0700fa969dbf0ff085082cde87384d2 + +[RETROGUARD] +Location = %(DirRuntime)s/bin/retroguard.jar +RetroConf = %(DirTemp)s/retroguard.cfg +RetroReobConf = %(DirTemp)s/retroguard_ro.cfg +ClientConf = %(DirTemp)s/client_rg.cfg +ServerConf = %(DirTemp)s/server_rg.cfg +ClientReobConf = %(DirTemp)s/client_ro.cfg +ServerReobConf = %(DirTemp)s/server_ro.cfg +ClientOut = %(DirTemp)s/minecraft_rg.jar +ServerOut = %(DirTemp)s/minecraft_server_rg.jar +ClientLog = %(DirLogs)s/client_rg.log +ServerLog = %(DirLogs)s/server_rg.log +ClientDeobLog = %(DirLogs)s/client_deob.log +ServerDeobLog = %(DirLogs)s/server_deob.log +NullPkg = net/minecraft/src + +[EXCEPTOR] +XClientCfg = %(DirConf)s/joined.exc +XServerCfg = %(DirConf)s/joined.exc +XClientOut = %(DirTemp)s/minecraft_exc.jar +XServerOut = %(DirTemp)s/minecraft_server_exc.jar +XClientLog = %(DirLogs)s/client_exc.log +XServerLog = %(DirLogs)s/server_exc.log + +[DECOMPILE] +ClsClientTemp = %(DirTempCls)s/minecraft +ClsServerTemp = %(DirTempCls)s/minecraft_server +SrcClientTemp = %(DirTempSrc)s/minecraft +SrcServerTemp = %(DirTempSrc)s/minecraft_server +FFSource = net + +[OUTPUT] +BinClientTemp = %(DirTempBin)s/minecraft +BinServerTemp = %(DirTempBin)s/minecraft_server +SrcClient = %(DirSrc)s/minecraft +SrcServer = %(DirSrc)s/minecraft_server +TestClient = net/minecraft/client/Minecraft +TestServer = net/minecraft/server/MinecraftServer + +[PATCHES] +PatchClient = %(DirConf)s/patches/minecraft.patch +PatchServer = %(DirConf)s/patches/minecraft_server.patch +PatchTemp = %(DirTemp)s/temp.patch +FFPatchClient = %(DirConf)s/patches/minecraft_ff.patch +FFPatchServer = %(DirConf)s/patches/minecraft_server_ff.patch +PatchClient_osx = %(DirConf)s/patches/minecraft_osx.patch +PatchServer_osx = %(DirConf)s/patches/minecraft_server_osx.patch + +[RECOMPILE] +BinClient = %(DirBin)s/minecraft +BinServer = %(DirBin)s/minecraft_server +LogClient = %(DirLogs)s/client_compile.log +LogServer = %(DirLogs)s/server_compile.log +ClassPathClient = %(DirLib)s/,%(DirLib)s/*,%(DirJars)s/bin/minecraft.jar,%(DirJars)s/bin/jinput.jar,%(DirJars)s/bin/lwjgl.jar,%(DirJars)s/bin/lwjgl_util.jar +ClassPathServer = %(DirLib)s/,%(DirLib)s/*,%(DirJars)s/minecraft_server.jar +ClientFixes = %(DirConf)s/patches +FixStart = Start +IgnorePkg = paulscode,com/jcraft,isom,ibxm,de/matthiasmann/twl,org/xmlpull,javax/xml + +[REOBF] +MD5Client = %(DirTemp)s/client.md5 +MD5Server = %(DirTemp)s/server.md5 +MD5PreReobfClient = %(DirTemp)s/client_reobf.md5 +MD5PreReobfServer = %(DirTemp)s/server_reobf.md5 +RecompJarClient = %(DirTemp)s/client_recomp.jar +RecompJarServer = %(DirTemp)s/server_recomp.jar +ObfJarClient = %(DirTemp)s/client_reobf.jar +ObfJarServer = %(DirTemp)s/server_reobf.jar +ReobfDirClient = %(DirReobf)s/minecraft +ReobfDirServer = %(DirReobf)s/minecraft_server +ClientRoLog = %(DirLogs)s/client_ro.log +ServerRoLog = %(DirLogs)s/server_ro.log +ReobfClientLog = %(DirLogs)s/client_reob.log +ReobfServerLog = %(DirLogs)s/server_reob.log + +[GETMODSOURCE] +OutSRCClient = %(DirModSrc)s/minecraft +OutSRCServer = %(DirModSrc)s/minecraft_server + +[MCP] +LogFile = %(DirLogs)s/mcp.log +LogFileErr = %(DirLogs)s/mcperr.log +UpdateUrl = http://mcp.ocean-labs.de/files/mcprolling_{version}/ +IgnoreUpdate = %(DirBin)s,%(DirLib)s,%(DirLogs)s,%(DirModSrc)s,%(DirReobf)s,%(DirSrc)s,%(DirTemp)s,%(DirEclipse)s/Client/bin,%(DirEclipse)s/Server/bin,%(DirJars)s/world,%(DirJars)s/saves,%(DirJars)s/resources +RGIndex = 92000 +ParamIndex = 8000 + +[ASTYLE] +AstyleConfig = %(DirConf)s/astyle.cfg + +[COMMANDS] +Wine = wine +Patcher_win = %(DirRuntime)s/bin/applydiff.exe +Patcher_linux = patch +Patcher_osx = patch +Jad_win = %(DirRuntime)s/bin/jad.exe +Jad_osx = %(DirRuntime)s/bin/jad-osx +AStyle_win = %(DirRuntime)s/bin/astyle.exe +AStyle_linux = astyle +AStyle_osx = %(DirRuntime)s/bin/astyle-osx +JadRetro = %(DirRuntime)s/bin/jadretro.jar +Fernflower = %(DirRuntime)s/bin/fernflower.jar +Exceptor = %(DirRuntime)s/bin/mcinjector.jar +CmdPatch = %s -p1 -u -i {patchfile} -d {srcdir} +CmdJad = %s -b -d {outdir} -dead -o -r -s .java -stat -ff {classes} +CmdAStyle = %s --suffix=none --quiet --options={conffile} {classes} +CmdRG = %s -cp "{classpath}" RetroGuard -searge {conffile} +CmdRGReobf = %s -cp "{classpath}" RetroGuard -notch {conffile} +CmdJadretro = %s -jar %s {targetdir} +CmdFernflower = %s -jar %s -din=0 -rbr=0 -dgs=1 -asc=1 -log=WARN {indir} {outdir} +CmdExceptor = %s -jar %s {input} {output} {conf} {log} +CmdRecomp = %s -Xlint:-options -deprecation -g -source 1.6 -target 1.6 -classpath "{classpath}" -sourcepath {sourcepath} -d {outpath} {pkgs} +CmdStartSrv = %s -Xincgc -Xms1024M -Xmx1024M -cp "{classpath}" net.minecraft.server.MinecraftServer +CmdStartClt = %s -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 -Xincgc -Xms1024M -Xmx1024M -cp "{classpath}" -Djava.library.path={natives} Start diff --git a/invtweaks_scripts/copy_resources.py b/invtweaks_scripts/copy_resources.py new file mode 100644 index 00000000..278673ac --- /dev/null +++ b/invtweaks_scripts/copy_resources.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- + +import shutil +import sys +import os + +# Functions + +INVTWEAKS_SRC = 'src/minecraft/invtweaks/' +INVTWEAKS_BIN = 'bin/minecraft/invtweaks/' + +def copy_resource_tree(resource): + shutil.rmtree(INVTWEAKS_BIN + resource, True) + shutil.copytree(INVTWEAKS_SRC + resource, INVTWEAKS_BIN + resource) + +def copy_resource(resource): + try: + os.remove(INVTWEAKS_BIN + resource) + except OSError: + pass + shutil.copy(INVTWEAKS_SRC + resource, INVTWEAKS_BIN + resource) + +# Resources copy + +sys.stdout.write('Copying InvTweaks resources...\n') + +copy_resource_tree('lang/') +copy_resource('DefaultConfig.dat') +copy_resource('DefaultTree.dat') + +sys.stdout.write('OK!\n') \ No newline at end of file diff --git a/invtweaks_scripts/deploy_mod.py b/invtweaks_scripts/deploy_mod.py new file mode 100644 index 00000000..e69de29b diff --git a/invtweaks_scripts/package_mod.py b/invtweaks_scripts/package_mod.py new file mode 100644 index 00000000..e69de29b diff --git a/launcher/debug.bat b/launcher/debug.bat deleted file mode 100644 index 3471913c..00000000 --- a/launcher/debug.bat +++ /dev/null @@ -1,2 +0,0 @@ -cd ../jars -java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 -Xincgc -Xms1024M -Xmx1024M -cp "../bin/minecraft:../lib:../lib/*:../jars/bin/minecraft.jar:../jars/bin/jinput.jar:../jars/bin/lwjgl.jar:../jars/bin/lwjgl_util.jar" -Djava.library.path="../jars/bin/natives" Start diff --git a/launcher/debug.sh b/launcher/debug.sh deleted file mode 100644 index f401a505..00000000 --- a/launcher/debug.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -cd ../jars -java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000 -Xincgc -Xms1024M -Xmx1024M -cp "../bin/minecraft:../lib:../lib/*:../jars/bin/minecraft.jar:../jars/bin/jinput.jar:../jars/bin/lwjgl.jar:../jars/bin/lwjgl_util.jar" -Djava.library.path="../jars/bin/natives" Start diff --git a/launcher/debug_suspend.bat b/launcher/debug_suspend.bat deleted file mode 100644 index 9ee4e288..00000000 --- a/launcher/debug_suspend.bat +++ /dev/null @@ -1,2 +0,0 @@ -cd ../jars -java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -Xincgc -Xms1024M -Xmx1024M -cp "../bin/minecraft:../lib:../lib/*:../jars/bin/minecraft.jar:../jars/bin/jinput.jar:../jars/bin/lwjgl.jar:../jars/bin/lwjgl_util.jar" -Djava.library.path="../jars/bin/natives" Start diff --git a/launcher/debug_suspend.sh b/launcher/debug_suspend.sh deleted file mode 100644 index db76513b..00000000 --- a/launcher/debug_suspend.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -cd ../jars -java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -Xincgc -Xms1024M -Xmx1024M -cp "../bin/minecraft:../lib:../lib/*:../jars/bin/minecraft.jar:../jars/bin/jinput.jar:../jars/bin/lwjgl.jar:../jars/bin/lwjgl_util.jar" -Djava.library.path="../jars/bin/natives" Start diff --git a/mcp/pom.xml b/mcp/pom.xml deleted file mode 100644 index cbeb664f..00000000 --- a/mcp/pom.xml +++ /dev/null @@ -1,148 +0,0 @@ - - 4.0.0 - - net.jimeowan - inventory-tweaks - 1.45-1.4.4 - jar - Inventory Tweaks - - - UTF-8 - InvTweaks-${project.version} - - - - ${archive.name} - - - src - - - . - false - src - - doc/* - invtweaks/lang/* - *.dat - - - *.java - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - org.apache.maven.plugins - maven-antrun-plugin - 1.6 - - - - move - - run - - package - - - - - - - - - deploy - - run - - install - - - - - - - - - - - - - - - - - - - minecraft-path-windows - - - windows - - - - ${user.home}/AppData/Roaming/.minecraft/ - ${minecraft.path}bin/ - - - - minecraft-path-linux - - - unix - - - - ${user.home}/.minecraft/ - ${minecraft.path}bin/ - - - - minecraft-path-mac - - - unix - mac os x - - - - ${user.home}/Library/Application Support/minecraft/ - ${minecraft.path}bin/ - - - - - - - - net.minecraft - lwjgl - 1.8 - system - ${minecraft.bin.path}lwjgl.jar - - - net.minecraft - lwjgl_util - 1.8 - system - ${minecraft.bin.path}lwjgl_util.jar - - - - diff --git a/pom.xml b/pom.xml deleted file mode 100755 index d8a01134..00000000 --- a/pom.xml +++ /dev/null @@ -1,155 +0,0 @@ - - 4.0.0 - - net.jimeowan - inventory-tweaks - 1.45-1.4.4 - jar - Inventory Tweaks - - - UTF-8 - InvTweaks-${project.version} - - - - ${archive.name} - - - src/minecraft - - - . - false - src - - doc/* - invtweaks/lang/* - *.dat - - - *.java - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - org.apache.maven.plugins - maven-antrun-plugin - 1.6 - - - - move - - run - - package - - - - - - - - - deploy - - run - - install - - - - - - - - - - - - - - - - - - - minecraft-path-windows - - - windows - - - - ${user.home}/AppData/Roaming/.minecraft/ - ${minecraft.path}bin/ - - - - minecraft-path-linux - - - unix - - - - ${user.home}/.minecraft/ - ${minecraft.path}bin/ - - - - minecraft-path-mac - - - unix - mac os x - - - - ${user.home}/Library/Application Support/minecraft/ - ${minecraft.path}bin/ - - - - - - - - net.minecraft - minecraft - any - system - ${basedir}/jars/bin/minecraft.jar - - - net.minecraft - lwjgl - 1.8 - system - ${basedir}/jars/bin/lwjgl.jar - - - net.minecraft - lwjgl_util - 1.8 - system - ${basedir}/jars/bin/lwjgl_util.jar - - - - diff --git a/recompile.bat b/recompile.bat new file mode 100644 index 00000000..c97cdbb5 --- /dev/null +++ b/recompile.bat @@ -0,0 +1,4 @@ +@echo off +runtime\bin\python\python_mcp runtime\recompile.py %* +runtime\bin\python\python_mcp invtweaks_scripts\copy_resources.py +pause diff --git a/recompile.sh b/recompile.sh new file mode 100644 index 00000000..abdb34b3 --- /dev/null +++ b/recompile.sh @@ -0,0 +1,3 @@ +#!/bin/bash +python runtime/recompile.py "$@" +python invtweaks_scripts/copy_resources.py \ No newline at end of file diff --git a/src/minecraft/invtweaks/InvTweaksConfig.java b/src/minecraft/invtweaks/InvTweaksConfig.java index ba6a401e..22d8a2ff 100644 --- a/src/minecraft/invtweaks/InvTweaksConfig.java +++ b/src/minecraft/invtweaks/InvTweaksConfig.java @@ -32,7 +32,6 @@ */ public class InvTweaksConfig { - @SuppressWarnings("unused") private static final Logger log = Logger.getLogger("InvTweaks"); public static final String PROP_VERSION = "version"; diff --git a/src/minecraft/invtweaks/InvTweaksConfigInventoryRuleset.java b/src/minecraft/invtweaks/InvTweaksConfigInventoryRuleset.java index 83fc069c..cba85782 100644 --- a/src/minecraft/invtweaks/InvTweaksConfigInventoryRuleset.java +++ b/src/minecraft/invtweaks/InvTweaksConfigInventoryRuleset.java @@ -20,7 +20,6 @@ */ public class InvTweaksConfigInventoryRuleset { - @SuppressWarnings("unused") private static final Logger log = Logger.getLogger("InvTweaks"); private String name; diff --git a/src/minecraft/invtweaks/InvTweaksConfigSortingRule.java b/src/minecraft/invtweaks/InvTweaksConfigSortingRule.java index d16368f0..d21b6283 100644 --- a/src/minecraft/invtweaks/InvTweaksConfigSortingRule.java +++ b/src/minecraft/invtweaks/InvTweaksConfigSortingRule.java @@ -14,7 +14,6 @@ */ public class InvTweaksConfigSortingRule implements Comparable { - @SuppressWarnings("unused") private static final Logger log = Logger.getLogger("InvTweaks"); private String constraint; diff --git a/src/minecraft/invtweaks/InvTweaksConst.java b/src/minecraft/invtweaks/InvTweaksConst.java index 351315a1..984509c5 100644 --- a/src/minecraft/invtweaks/InvTweaksConst.java +++ b/src/minecraft/invtweaks/InvTweaksConst.java @@ -8,12 +8,11 @@ public class InvTweaksConst { // Mod version - public static final String MOD_VERSION = "1.45 (1.4.4)"; + public static final String MOD_VERSION = "1.50-DEV (1.4.7)"; // Mod tree version // Change only when the tree evolves significantly enough to need to override all configs public static final String TREE_VERSION = "1.4.0"; - // Timing constants public static final int RULESET_SWAP_DELAY = 1000; diff --git a/src/minecraft/invtweaks/InvTweaksGuiSettings.java b/src/minecraft/invtweaks/InvTweaksGuiSettings.java index d4876a64..51470514 100644 --- a/src/minecraft/invtweaks/InvTweaksGuiSettings.java +++ b/src/minecraft/invtweaks/InvTweaksGuiSettings.java @@ -24,7 +24,6 @@ */ public class InvTweaksGuiSettings extends InvTweaksGuiSettingsAbstract { - @SuppressWarnings("unused") private static final Logger log = Logger.getLogger("InvTweaks"); private final static int ID_MIDDLE_CLICK = 1; diff --git a/src/minecraft/invtweaks/InvTweaksGuiSettingsAdvanced.java b/src/minecraft/invtweaks/InvTweaksGuiSettingsAdvanced.java index 306abbfb..6f269bc7 100644 --- a/src/minecraft/invtweaks/InvTweaksGuiSettingsAdvanced.java +++ b/src/minecraft/invtweaks/InvTweaksGuiSettingsAdvanced.java @@ -20,7 +20,6 @@ */ public class InvTweaksGuiSettingsAdvanced extends InvTweaksGuiSettingsAbstract { - @SuppressWarnings("unused") private static final Logger log = Logger.getLogger("InvTweaks"); private final static int ID_SORT_ON_PICKUP = 1; diff --git a/src/minecraft/invtweaks/InvTweaksHandlerShortcuts.java b/src/minecraft/invtweaks/InvTweaksHandlerShortcuts.java index 9569080a..44a5b421 100644 --- a/src/minecraft/invtweaks/InvTweaksHandlerShortcuts.java +++ b/src/minecraft/invtweaks/InvTweaksHandlerShortcuts.java @@ -24,7 +24,6 @@ */ public class InvTweaksHandlerShortcuts extends InvTweaksObfuscation { - @SuppressWarnings("unused") private static final Logger log = Logger.getLogger("InvTweaks"); private static final int DROP_SLOT = -999; diff --git a/src/minecraft/invtweaks/InvTweaksHandlerSorting.java b/src/minecraft/invtweaks/InvTweaksHandlerSorting.java index 5f17d18f..c6dc7547 100644 --- a/src/minecraft/invtweaks/InvTweaksHandlerSorting.java +++ b/src/minecraft/invtweaks/InvTweaksHandlerSorting.java @@ -148,7 +148,7 @@ public void sort() throws TimeoutException { //item and slot counts for each unique item HashMap, int[]> itemCounts = new HashMap, int[]>(); for(int i = 0; i < size; i++) { - ur stack = containerMgr.getItemStack(i); + ItemStack stack = containerMgr.getItemStack(i); if(stack != null) { List item = Arrays.asList(getItemID(stack), getItemDamage(stack)); int[] count = itemCounts.get(item); @@ -217,11 +217,6 @@ else if(stackSize < numPerSlot) markAsMoved(i,1); } else if (algorithm == ALGORITHM_INVENTORY) { -<<<<<<< HEAD - -======= - ->>>>>>> 3845c4cadc9c2ee70130c9bad5a88867002a652b //// Move items out of the crafting slots log.info("Handling crafting slots."); if (globalContainer.hasSection(InvTweaksContainerSection.CRAFTING_IN)) { @@ -276,7 +271,7 @@ && getItemDamage(getStack(slot)) < getItemDamage(from))) { move = true; } } else { - move = true + move = true; } } if (areSlotAndStackCompatible(slot, from) && move) { diff --git a/src/minecraft/invtweaks/InvTweaksItemTree.java b/src/minecraft/invtweaks/InvTweaksItemTree.java index 12b2cd39..e82cf92d 100644 --- a/src/minecraft/invtweaks/InvTweaksItemTree.java +++ b/src/minecraft/invtweaks/InvTweaksItemTree.java @@ -247,7 +247,6 @@ public void addItem(String parentCategory, /** * For debug purposes. Call log(getRootCategory(), 0) to log the whole tree. */ - @SuppressWarnings("unused") private void log(InvTweaksItemTreeCategory category, int indentLevel) { String logIdent = ""; diff --git a/src/minecraft/invtweaks/InvTweaksItemTreeCategory.java b/src/minecraft/invtweaks/InvTweaksItemTreeCategory.java index 7d7e1408..5a691b53 100644 --- a/src/minecraft/invtweaks/InvTweaksItemTreeCategory.java +++ b/src/minecraft/invtweaks/InvTweaksItemTreeCategory.java @@ -18,7 +18,6 @@ */ public class InvTweaksItemTreeCategory { - @SuppressWarnings("unused") private static final Logger log = Logger.getLogger("InvTweaks"); private final Map> items = diff --git a/src/minecraft/invtweaks/InvTweaksLocalization.java b/src/minecraft/invtweaks/InvTweaksLocalization.java index 0f325ca6..c37b334e 100644 --- a/src/minecraft/invtweaks/InvTweaksLocalization.java +++ b/src/minecraft/invtweaks/InvTweaksLocalization.java @@ -15,7 +15,6 @@ */ public class InvTweaksLocalization { - @SuppressWarnings("unused") private static final Logger log = Logger.getLogger("InvTweaks"); private static final String LANG_RESOURCES_LOCATION = "invtweaks/lang/"; private static final String LANG_RESOURCES_LOCATION_MCP = "../invtweaks/lang/"; diff --git a/src/minecraft/invtweaks/InvTweaksModCompatibility.java b/src/minecraft/invtweaks/InvTweaksModCompatibility.java index dfb2589a..ac1ef6fd 100644 --- a/src/minecraft/invtweaks/InvTweaksModCompatibility.java +++ b/src/minecraft/invtweaks/InvTweaksModCompatibility.java @@ -132,12 +132,12 @@ public Map> getSpecialContainerSlots(GuiSc result.put(InvTweaksContainerSection.CHEST, slots.subList(1, slots.size() - 36)); } else if (is(guiScreen, "GuiAdvBench")) { // RedPower 2 - result.put(ContainerSection.CRAFTING_IN, slots.subList(0, 9)); - result.put(ContainerSection.CRAFTING_OUT, slots.subList(10, 11)); - result.put(ContainerSection.CHEST, slots.subList(11, 29)); + result.put(InvTweaksContainerSection.CRAFTING_IN, slots.subList(0, 9)); + result.put(InvTweaksContainerSection.CRAFTING_OUT, slots.subList(10, 11)); + result.put(InvTweaksContainerSection.CHEST, slots.subList(11, 29)); } else if(is(guiScreen, "GuiArcaneWorkbench") || is(guiScreen, "GuiInfusionWorkbench")) { // Thaumcraft 3 - result.put(ContainerSection.CRAFTING_OUT, slots.subList(0, 1)); - result.put(ContainerSection.CRAFTING_IN, slots.subList(2, 11)); + result.put(InvTweaksContainerSection.CRAFTING_OUT, slots.subList(0, 1)); + result.put(InvTweaksContainerSection.CRAFTING_IN, slots.subList(2, 11)); } return result; diff --git a/src/minecraft/invtweaks/InvTweaksShortcutMapping.java b/src/minecraft/invtweaks/InvTweaksShortcutMapping.java index 865917bd..bfafab88 100644 --- a/src/minecraft/invtweaks/InvTweaksShortcutMapping.java +++ b/src/minecraft/invtweaks/InvTweaksShortcutMapping.java @@ -15,7 +15,6 @@ */ public class InvTweaksShortcutMapping { - @SuppressWarnings("unused") private static final Logger log = Logger.getLogger("InvTweaks"); private List keysToHold = new LinkedList(); diff --git a/src/minecraft/net/minecraft/src/mod_InvTweaks.java b/src/minecraft/net/minecraft/src/mod_InvTweaks.java index c029184d..7d8d0c10 100644 --- a/src/minecraft/net/minecraft/src/mod_InvTweaks.java +++ b/src/minecraft/net/minecraft/src/mod_InvTweaks.java @@ -19,7 +19,6 @@ */ public class mod_InvTweaks extends BaseMod { - @SuppressWarnings("unused") private static final Logger log = Logger.getLogger("InvTweaks"); private InvTweaks instance; From 9514c413b097ab9f7122c64a74aef8cbfee16718 Mon Sep 17 00:00:00 2001 From: Marwane Kalam-Alami Date: Wed, 16 Jan 2013 21:45:11 +0100 Subject: [PATCH 17/30] Packaging script --- .gitignore | 1 + invtweaks_scripts/copy_resources.py | 4 +- invtweaks_scripts/deploy_mod.py | 0 invtweaks_scripts/package_mod.py | 59 +++++++++++++++++++++++++++++ 4 files changed, 62 insertions(+), 2 deletions(-) delete mode 100644 invtweaks_scripts/deploy_mod.py diff --git a/.gitignore b/.gitignore index b3f5c26e..8e24443d 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,7 @@ jars/ logs/ runtime/ temp/ +reobf/ CHANGELOG LICENSE.txt *.bat diff --git a/invtweaks_scripts/copy_resources.py b/invtweaks_scripts/copy_resources.py index 278673ac..3c3ca061 100644 --- a/invtweaks_scripts/copy_resources.py +++ b/invtweaks_scripts/copy_resources.py @@ -22,10 +22,10 @@ def copy_resource(resource): # Resources copy -sys.stdout.write('Copying InvTweaks resources...\n') +print 'Copying InvTweaks resources...' copy_resource_tree('lang/') copy_resource('DefaultConfig.dat') copy_resource('DefaultTree.dat') -sys.stdout.write('OK!\n') \ No newline at end of file +print 'OK!' \ No newline at end of file diff --git a/invtweaks_scripts/deploy_mod.py b/invtweaks_scripts/deploy_mod.py deleted file mode 100644 index e69de29b..00000000 diff --git a/invtweaks_scripts/package_mod.py b/invtweaks_scripts/package_mod.py index e69de29b..6accec88 100644 --- a/invtweaks_scripts/package_mod.py +++ b/invtweaks_scripts/package_mod.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- + +import shutil +import sys +import os +import zipfile + +# Constants + +INVTWEAKS_SRC = 'src/minecraft/invtweaks' +INVTWEAKS_CLASS = 'reobf/minecraft' +INVTWEAKS_TMP = 'temp/invtweaks' + +# Remove tmp dir + +shutil.rmtree(INVTWEAKS_TMP, True) + +# Gather files + +print 'Packaging InvTweaks...' + +shutil.copytree(INVTWEAKS_CLASS, INVTWEAKS_TMP) +shutil.copy(INVTWEAKS_SRC + '/DefaultConfig.dat', INVTWEAKS_TMP + '/DefaultConfig.dat') +shutil.copy(INVTWEAKS_SRC + '/DefaultTree.dat', INVTWEAKS_TMP + '/DefaultTree.dat') +shutil.copytree(INVTWEAKS_SRC + '/lang', INVTWEAKS_TMP + '/lang') + +# Zip + +def get_compression_mode(): + try: + import zlib + return zipfile.ZIP_DEFLATED + except: + print '(...but without compressing)' + return zipfile.ZIP_STORED + +def write_to_zip(zip, compression, path): + archive_path = path.replace(INVTWEAKS_TMP, '') + zip.write(path, arcname=archive_path, compress_type=compression) + +def list_files_recursive(folder): + contents = [] + for folder_element in os.listdir(folder): + sys.stdout.write(folder_element + '\n') + if os.path.isfile(folder_element): + contents.append(folder_element) + else: + contents.extend(list_files_recursive(folder_element)) + return contents + +print 'Zipping InvTweaks...' + +compression_mode = get_compression_mode() +invtweaks_zip = zipfile.ZipFile('InvTweaks-DEV.zip', mode='w') +for root, dirs, files in os.walk(INVTWEAKS_TMP): + for file in files: + write_to_zip(invtweaks_zip, compression_mode, root + '/' + file) + +print 'OK!' \ No newline at end of file From 0d47294aee725984e237e81919d85780e37035a7 Mon Sep 17 00:00:00 2001 From: Marwane Kalam-Alami Date: Wed, 16 Jan 2013 22:26:13 +0100 Subject: [PATCH 18/30] Add a screen to help NoCheatPlus victims --- .../invtweaks/InvTweaksGuiModNotWorking.java | 42 +++++++++++++++++++ .../invtweaks/InvTweaksGuiSettings.java | 14 ++++++- .../InvTweaksGuiSettingsAdvanced.java | 13 +++--- .../invtweaks/InvTweaksGuiSettingsButton.java | 5 +-- .../invtweaks/InvTweaksGuiTooltipButton.java | 21 ++++++++-- src/minecraft/invtweaks/lang/en_US.properties | 10 ++--- src/minecraft/invtweaks/lang/fr_FR.properties | 10 ++--- .../minecraft/src/InvTweaksObfuscation.java | 4 +- 8 files changed, 92 insertions(+), 27 deletions(-) create mode 100644 src/minecraft/invtweaks/InvTweaksGuiModNotWorking.java diff --git a/src/minecraft/invtweaks/InvTweaksGuiModNotWorking.java b/src/minecraft/invtweaks/InvTweaksGuiModNotWorking.java new file mode 100644 index 00000000..cdf16719 --- /dev/null +++ b/src/minecraft/invtweaks/InvTweaksGuiModNotWorking.java @@ -0,0 +1,42 @@ +package invtweaks; + +import java.util.logging.Logger; + +import net.minecraft.client.Minecraft; +import net.minecraft.src.GuiButton; +import net.minecraft.src.GuiScreen; + + +/** + * A help menu for the NoCheatPlus conflict. + * + * @author Jimeo Wan + * + */ +public class InvTweaksGuiModNotWorking extends InvTweaksGuiSettingsAbstract { + + private static final Logger log = Logger.getLogger("InvTweaks"); + + public InvTweaksGuiModNotWorking(Minecraft mc, GuiScreen parentScreen, InvTweaksConfig config) { + super(mc, parentScreen, config); + } + + public void drawScreen(int i, int j, float f) { + super.drawScreen(i, j, f); + + int x = obf.getWindowWidth(this) / 2; + drawCenteredString(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.help.bugsorting.pt1"), x, 80, 0xBBBBBB); + drawCenteredString(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.help.bugsorting.pt2"), x, 95, 0xBBBBBB); + drawCenteredString(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.help.bugsorting.pt3"), x, 110, 0xBBBBBB); + drawCenteredString(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.help.bugsorting.pt4"), x, 150, 0xFFFF99); + } + + protected void actionPerformed(GuiButton guibutton) { + switch (obf.getId(guibutton)) { + // Back to main settings screen + case ID_DONE: + obf.displayGuiScreen(new InvTweaksGuiSettings(mc, parentScreen, config)); + } + } + +} diff --git a/src/minecraft/invtweaks/InvTweaksGuiSettings.java b/src/minecraft/invtweaks/InvTweaksGuiSettings.java index 51470514..b47b8d90 100644 --- a/src/minecraft/invtweaks/InvTweaksGuiSettings.java +++ b/src/minecraft/invtweaks/InvTweaksGuiSettings.java @@ -33,6 +33,7 @@ public class InvTweaksGuiSettings extends InvTweaksGuiSettingsAbstract { private final static int ID_AUTO_REFILL = 5; private final static int ID_MORE_OPTIONS = 6; private final static int ID_SORTING_KEY = 7; + private final static int ID_BUG_SORTING = 8; private final static int ID_EDITRULES = 100; private final static int ID_EDITTREE = 101; private final static int ID_HELP = 102; @@ -42,9 +43,11 @@ public class InvTweaksGuiSettings extends InvTweaksGuiSettingsAbstract { private static String labelAutoRefill; private static String labelAutoRefillBeforeBreak; private static String labelMoreOptions; + private static String labelBugSorting; private InvTweaksGuiTooltipButton sortMappingButton; private boolean sortMappingEdition = false; + public InvTweaksGuiSettings(Minecraft mc, GuiScreen parentScreen, InvTweaksConfig config) { super(mc, parentScreen, config); @@ -54,7 +57,7 @@ public InvTweaksGuiSettings(Minecraft mc, GuiScreen parentScreen, InvTweaksConfi labelAutoRefill = InvTweaksLocalization.get("invtweaks.settings.autorefill"); labelAutoRefillBeforeBreak = InvTweaksLocalization.get("invtweaks.settings.beforebreak"); labelMoreOptions = InvTweaksLocalization.get("invtweaks.settings.moreoptions"); - + labelBugSorting = InvTweaksLocalization.get("invtweaks.help.bugsorting"); } public void initGui() { @@ -104,6 +107,8 @@ public void initGui() { moveToButtonCoords(i++, p); controlList.add(new InvTweaksGuiTooltipButton(ID_MORE_OPTIONS, p.getX(), p.getY(), labelMoreOptions, InvTweaksLocalization.get("invtweaks.settings.moreoptions.tooltip"))); + controlList.add(new InvTweaksGuiTooltipButton(ID_BUG_SORTING, 5, this.height - 20, 100, 20, labelBugSorting, null, false)); + String middleClick = config.getProperty(InvTweaksConfig.PROP_ENABLE_MIDDLE_CLICK); moveToButtonCoords(i++, p); InvTweaksGuiTooltipButton middleClickBtn = new InvTweaksGuiTooltipButton(ID_MIDDLE_CLICK, p.getX(), p.getY(), computeBooleanButtonLabel( @@ -114,7 +119,7 @@ public void initGui() { obf.setEnabled(middleClickBtn, false); middleClickBtn.setTooltip(middleClickBtn.getTooltip() + "\n(" + InvTweaksLocalization.get("invtweaks.settings.disableci.tooltip")); } - + // Check if links to files are supported, if not disable the buttons if (!Desktop.isDesktopSupported()) { for (Object o : controlList) { @@ -173,6 +178,11 @@ protected void actionPerformed(GuiButton guibutton) { obf.displayGuiScreen(new InvTweaksGuiSettingsAdvanced(mc, parentScreen, config)); break; + // Sorting bug help screen + case ID_BUG_SORTING: + obf.displayGuiScreen(new InvTweaksGuiModNotWorking(mc, parentScreen, config)); + break; + // Open rules configuration in external editor case ID_EDITRULES: try { diff --git a/src/minecraft/invtweaks/InvTweaksGuiSettingsAdvanced.java b/src/minecraft/invtweaks/InvTweaksGuiSettingsAdvanced.java index 6f269bc7..284f88a0 100644 --- a/src/minecraft/invtweaks/InvTweaksGuiSettingsAdvanced.java +++ b/src/minecraft/invtweaks/InvTweaksGuiSettingsAdvanced.java @@ -106,14 +106,13 @@ public void initGui() { public void drawScreen(int i, int j, float f) { super.drawScreen(i, j, f); - Point p = new Point(); - moveToButtonCoords(1, p); - drawCenteredString(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.settings.pvpwarning.pt1"), p.getX(), 40, 0x999999); - drawCenteredString(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.settings.pvpwarning.pt2"), p.getX(), 50, 0x999999); + int x = obf.getWindowWidth(this) / 2; + drawCenteredString(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.settings.pvpwarning.pt1"), x, 40, 0x999999); + drawCenteredString(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.settings.pvpwarning.pt2"), x, 50, 0x999999); - drawCenteredString(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.settings.slowsorting.pt1"), p.getX(), 115, 0x999999); - drawCenteredString(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.settings.slowsorting.pt2"), p.getX(), 125, 0x999999); - drawCenteredString(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.settings.slowsorting.pt3"), p.getX(), 135, 0x999999); + drawCenteredString(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.settings.slowsorting.pt1"), x, 115, 0x999999); + drawCenteredString(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.settings.slowsorting.pt2"), x, 125, 0x999999); + drawCenteredString(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.settings.slowsorting.pt3"), x, 135, 0x999999); } protected void actionPerformed(GuiButton guibutton) { diff --git a/src/minecraft/invtweaks/InvTweaksGuiSettingsButton.java b/src/minecraft/invtweaks/InvTweaksGuiSettingsButton.java index 7eeca09c..45a297cb 100644 --- a/src/minecraft/invtweaks/InvTweaksGuiSettingsButton.java +++ b/src/minecraft/invtweaks/InvTweaksGuiSettingsButton.java @@ -23,7 +23,7 @@ public InvTweaksGuiSettingsButton(InvTweaksConfigManager cfgManager, } public void drawButton(Minecraft minecraft, int i, int j) { - super.drawButton(minecraft, i, j); + super.drawButton(minecraft, i, j); // Display string InvTweaksObfuscation obf = new InvTweaksObfuscation(minecraft); @@ -71,8 +71,7 @@ public boolean mousePressed(Minecraft minecraft, int i, int j) { cfgManager.makeSureConfigurationIsLoaded(); // Display menu - obf.displayGuiScreen( - new InvTweaksGuiSettings(minecraft, obf.getCurrentScreen(), config)); + obf.displayGuiScreen(new InvTweaksGuiSettings(minecraft, obf.getCurrentScreen(), config)); return true; } else { return false; diff --git a/src/minecraft/invtweaks/InvTweaksGuiTooltipButton.java b/src/minecraft/invtweaks/InvTweaksGuiTooltipButton.java index 5e259855..d58693d8 100644 --- a/src/minecraft/invtweaks/InvTweaksGuiTooltipButton.java +++ b/src/minecraft/invtweaks/InvTweaksGuiTooltipButton.java @@ -21,12 +21,13 @@ public class InvTweaksGuiTooltipButton extends InvTweaksObfuscationGuiButton { private String tooltip = null; private String[] tooltipLines = null; private int tooltipWidth = -1; - + private boolean drawBackground = true; + public InvTweaksGuiTooltipButton(int id, int x, int y, String displayString) { this(id, x, y, 150, 20, displayString, null); } - + /** * Default size is 150, the common "GuiSmallButton" button size. */ @@ -48,8 +49,22 @@ public InvTweaksGuiTooltipButton(int id, int x, int y, int w, int h, } } + public InvTweaksGuiTooltipButton(int id, int x, int y, int w, int h, + String displayString, String tooltip, boolean drawBackground) { + super(id, x, y, w, h, displayString); + if (tooltip != null) { + setTooltip(tooltip); + } + this.drawBackground = drawBackground; + } + public void drawButton(Minecraft minecraft, int i, int j) { - super.drawButton(minecraft, i, j); + if (this.drawBackground) { + super.drawButton(minecraft, i, j); + } + else { + this.drawString(minecraft.fontRenderer, this.displayString, this.xPosition, this.yPosition + (this.height - 8) / 2, 0x999999); + } InvTweaksObfuscation obf = new InvTweaksObfuscation(minecraft); diff --git a/src/minecraft/invtweaks/lang/en_US.properties b/src/minecraft/invtweaks/lang/en_US.properties index fd8a34c0..f68bde2c 100644 --- a/src/minecraft/invtweaks/lang/en_US.properties +++ b/src/minecraft/invtweaks/lang/en_US.properties @@ -41,11 +41,11 @@ invtweaks.settings.treefile=Open the item tree file... invtweaks.settings.treefile.error=[9] Failed to open tree file invtweaks.settings.onlinehelp=Open help in browser... invtweaks.settings.onlinehelp.error=[10] Failed to open help -invtweaks.settings.slowsorting=Server hack mode -invtweaks.settings.slowsorting.pt1=If your server seems to 'cancel' what this mod does, -invtweaks.settings.slowsorting.pt2=ask your admin to disable the "inventory.fastclick" and -invtweaks.settings.slowsorting.pt3="combined.improbable" NoCheatPlus options. Otherwise, try this: -invtweaks.settings.slowsorting.tooltip=Sorts items slowly to cheat the no-cheat plugins +invtweaks.help.bugsorting=Not working? +invtweaks.help.bugsorting.pt1=If your server seems to 'cancel' what this mod does, +invtweaks.help.bugsorting.pt2=it's probably caused by it using the NoCheatPlus plugin. +invtweaks.help.bugsorting.pt3=Ask your admin to disable the following options: +invtweaks.help.bugsorting.pt4="inventory.fastclick" and"combined.improbable" invtweaks.settings.pvpwarning.pt1=Note: On PvP servers, the auto-refill & auto-equip armor invtweaks.settings.pvpwarning.pt2=options are often considered cheating! invtweaks.settings.exit=Done diff --git a/src/minecraft/invtweaks/lang/fr_FR.properties b/src/minecraft/invtweaks/lang/fr_FR.properties index 8657b055..1e9a2a5d 100644 --- a/src/minecraft/invtweaks/lang/fr_FR.properties +++ b/src/minecraft/invtweaks/lang/fr_FR.properties @@ -41,11 +41,11 @@ invtweaks.settings.treefile=Ouvrir le fichier d'arborescence des objets... invtweaks.settings.treefile.error=[9] Impossible d'ouvrir l'arborescence des objets invtweaks.settings.onlinehelp=Ouvrir l'aide en ligne... invtweaks.settings.onlinehelp.error=[10] Impossible d'ouvrir l'aide en ligne -invtweaks.settings.slowsorting=Mode anti-protection serveur -invtweaks.settings.slowsorting.pt1=Si votre serveur semble annuler les actions du mod, -invtweaks.settings.slowsorting.pt2=demandez à votre admin de désactiver "inventory.fastclick" et -invtweaks.settings.slowsorting.pt3="combined.improbable" (des options NoCheatPlus). Sinon, essayez : -invtweaks.settings.slowsorting.tooltip=Trie en cliquant lentement pour contourner l'anti-triche +invtweaks.help.bugsorting=Bugué ? +invtweaks.help.bugsorting.pt1=Si votre serveur semble annuler les actions du mod, +invtweaks.help.bugsorting.pt2=c'est sûrement dû au plugin anti-triche NoCheatPlus. +invtweaks.help.bugsorting.pt3=Demandez à votre admin de désactiver les options : +invtweaks.help.bugsorting.pt4="inventory.fastclick" et "combined.improbable" invtweaks.settings.pvpwarning.pt1=Note\: Sur les serveurs PvP, le remplacement et l'\u00e9quipement invtweaks.settings.pvpwarning.pt2=d'armure automatiques sont souvent vus comme de la triche \! invtweaks.settings.exit=Fermer diff --git a/src/minecraft/net/minecraft/src/InvTweaksObfuscation.java b/src/minecraft/net/minecraft/src/InvTweaksObfuscation.java index d228421f..5ca57db3 100644 --- a/src/minecraft/net/minecraft/src/InvTweaksObfuscation.java +++ b/src/minecraft/net/minecraft/src/InvTweaksObfuscation.java @@ -142,10 +142,10 @@ public int getGuiY(GuiContainer guiContainer) { return guiContainer.guiTop; } public int getGuiWidth(GuiContainer guiContainer) { - return guiContainer.width; + return guiContainer.xSize; } public int getGuiHeight(GuiContainer guiContainer) { - return guiContainer.height; + return guiContainer.ySize; } @SuppressWarnings("unchecked") public List getControlList(GuiScreen guiScreen) { From ecfb004a9fe9bb68547c7bd62f645a9477519252 Mon Sep 17 00:00:00 2001 From: Marwane Kalam-Alami Date: Wed, 16 Jan 2013 22:37:07 +0100 Subject: [PATCH 19/30] Middle-click fix --- src/minecraft/invtweaks/InvTweaks.java | 5 ++++- src/minecraft/invtweaks/InvTweaksContainerManager.java | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/minecraft/invtweaks/InvTweaks.java b/src/minecraft/invtweaks/InvTweaks.java index 11b39ec6..ee7bdb19 100644 --- a/src/minecraft/invtweaks/InvTweaks.java +++ b/src/minecraft/invtweaks/InvTweaks.java @@ -557,7 +557,10 @@ private void handleMiddleClick(GuiScreen guiScreen) { || (InvTweaksContainerSection.INVENTORY_NOT_HOTBAR.equals(target))) { handleSorting(guiScreen); } - + + } + + else if (isValidInventory(guiScreen)) { if (InvTweaksContainerSection.CRAFTING_IN.equals(target)) { // Crafting stacks evening try { diff --git a/src/minecraft/invtweaks/InvTweaksContainerManager.java b/src/minecraft/invtweaks/InvTweaksContainerManager.java index ae76a7bb..60ab2fa1 100644 --- a/src/minecraft/invtweaks/InvTweaksContainerManager.java +++ b/src/minecraft/invtweaks/InvTweaksContainerManager.java @@ -336,8 +336,8 @@ public boolean getIsMouseOverSlot(Slot slot) { private boolean getIsMouseOverSlot(Slot slot, int x, int y) { // Copied from GuiContainer if (guiContainer != null) { - int i = guiContainer.width; - int j = guiContainer.height; + int i = (guiContainer.width - getGuiWidth(guiContainer)) / 2; + int j = (guiContainer.height - getGuiHeight(guiContainer)) / 2; x -= i; y -= j; return x >= getXDisplayPosition(slot) - 1 From 4f6510867bfd906fb0f11d4d1e6908c53a19dc1b Mon Sep 17 00:00:00 2001 From: Marwane Kalam-Alami Date: Wed, 16 Jan 2013 22:53:03 +0100 Subject: [PATCH 20/30] Versioning info update --- INVTWEAKS-LICENSE.md | 2 +- INVTWEAKS-README.md | 2 -- invtweaks_docs/conf.py | 10 ++++++++-- src/minecraft/invtweaks/InvTweaksConst.java | 2 +- src/minecraft/invtweaks/lang/en_US.properties | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/INVTWEAKS-LICENSE.md b/INVTWEAKS-LICENSE.md index 8abeba79..fe92f288 100644 --- a/INVTWEAKS-LICENSE.md +++ b/INVTWEAKS-LICENSE.md @@ -1,6 +1,6 @@ ## Inventory Tweaks Mod license (MIT) -Copyright (c) 2011-2012 Marwane Kalam-Alami +Copyright (c) 2011-2013 Marwane Kalam-Alami Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/INVTWEAKS-README.md b/INVTWEAKS-README.md index 391472a9..c3374621 100644 --- a/INVTWEAKS-README.md +++ b/INVTWEAKS-README.md @@ -1,7 +1,5 @@ -* Matching Minecraft version: **1.4.4** - ## What's this project about This Open Source project (see [License](https://github.com/mkalam-alami/inventory-tweaks/blob/master/src/doc/license.txt)) is a client mod for [Minecraft](http://www.minecraft.net/), a game by [Mojang AB](http://mojang.com/). It implements various features to help players with the management of inventories and chests. A lot of effort has been put to make it as customizable as possible, without being annoying to set up. diff --git a/invtweaks_docs/conf.py b/invtweaks_docs/conf.py index 6da5f333..96d9556e 100644 --- a/invtweaks_docs/conf.py +++ b/invtweaks_docs/conf.py @@ -20,6 +20,12 @@ # -- General configuration ----------------------------------------------------- +# INVENTORY TWEAKS VERSION +invtweaks_version = '1.50' + + + + # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' @@ -48,9 +54,9 @@ # built documents. # # The short X.Y version. -version = '1.45' +version = invtweaks_version # The full version, including alpha/beta/rc tags. -release = '1.45' +release = invtweaks_version # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/src/minecraft/invtweaks/InvTweaksConst.java b/src/minecraft/invtweaks/InvTweaksConst.java index 984509c5..2bec261a 100644 --- a/src/minecraft/invtweaks/InvTweaksConst.java +++ b/src/minecraft/invtweaks/InvTweaksConst.java @@ -8,7 +8,7 @@ public class InvTweaksConst { // Mod version - public static final String MOD_VERSION = "1.50-DEV (1.4.7)"; + public static final String MOD_VERSION = "1.50 (1.4.7)"; // Mod tree version // Change only when the tree evolves significantly enough to need to override all configs diff --git a/src/minecraft/invtweaks/lang/en_US.properties b/src/minecraft/invtweaks/lang/en_US.properties index f68bde2c..b91e2bbe 100644 --- a/src/minecraft/invtweaks/lang/en_US.properties +++ b/src/minecraft/invtweaks/lang/en_US.properties @@ -45,7 +45,7 @@ invtweaks.help.bugsorting=Not working? invtweaks.help.bugsorting.pt1=If your server seems to 'cancel' what this mod does, invtweaks.help.bugsorting.pt2=it's probably caused by it using the NoCheatPlus plugin. invtweaks.help.bugsorting.pt3=Ask your admin to disable the following options: -invtweaks.help.bugsorting.pt4="inventory.fastclick" and"combined.improbable" +invtweaks.help.bugsorting.pt4="inventory.fastclick" and "combined.improbable" invtweaks.settings.pvpwarning.pt1=Note: On PvP servers, the auto-refill & auto-equip armor invtweaks.settings.pvpwarning.pt2=options are often considered cheating! invtweaks.settings.exit=Done From 6a4384ad881209974a4ddad4207de59405d132c9 Mon Sep 17 00:00:00 2001 From: Marwane Kalam-Alami Date: Wed, 16 Jan 2013 22:59:39 +0100 Subject: [PATCH 21/30] Integrate package mod scripts --- reobfuscate.bat | 4 ++++ reobfuscate.sh | 3 +++ 2 files changed, 7 insertions(+) create mode 100755 reobfuscate.bat create mode 100755 reobfuscate.sh diff --git a/reobfuscate.bat b/reobfuscate.bat new file mode 100755 index 00000000..493583f0 --- /dev/null +++ b/reobfuscate.bat @@ -0,0 +1,4 @@ +@echo off +runtime\bin\python\python_mcp runtime\reobfuscate.py %* +runtime\bin\python\python_mcp invtweaks_scripts\package_mod.py +pause diff --git a/reobfuscate.sh b/reobfuscate.sh new file mode 100755 index 00000000..6ee02adb --- /dev/null +++ b/reobfuscate.sh @@ -0,0 +1,3 @@ +#!/bin/bash +python runtime/reobfuscate.py "$@" +python invtweaks_scripts/package_mod.py From e544354a44f95e2d8ed100e63fc9a19b976c67a4 Mon Sep 17 00:00:00 2001 From: Marwane Kalam-Alami Date: Wed, 16 Jan 2013 23:40:43 +0100 Subject: [PATCH 22/30] MCP-transition bugfixes --- build.xml | 2 +- invtweaks_scripts/package_mod.py | 7 ++-- src/minecraft/invtweaks/InvTweaks.java | 4 +- .../invtweaks/InvTweaksGuiSettings.java | 4 +- .../invtweaks/InvTweaksLocalization.java | 9 +--- .../minecraft/src/InvTweaksObfuscation.java | 42 ++----------------- 6 files changed, 15 insertions(+), 53 deletions(-) diff --git a/build.xml b/build.xml index de852232..054c6944 100755 --- a/build.xml +++ b/build.xml @@ -25,7 +25,7 @@ - Copying zip to mods folder - + - Done! diff --git a/invtweaks_scripts/package_mod.py b/invtweaks_scripts/package_mod.py index 6accec88..049d0671 100644 --- a/invtweaks_scripts/package_mod.py +++ b/invtweaks_scripts/package_mod.py @@ -20,9 +20,10 @@ print 'Packaging InvTweaks...' shutil.copytree(INVTWEAKS_CLASS, INVTWEAKS_TMP) -shutil.copy(INVTWEAKS_SRC + '/DefaultConfig.dat', INVTWEAKS_TMP + '/DefaultConfig.dat') -shutil.copy(INVTWEAKS_SRC + '/DefaultTree.dat', INVTWEAKS_TMP + '/DefaultTree.dat') -shutil.copytree(INVTWEAKS_SRC + '/lang', INVTWEAKS_TMP + '/lang') +shutil.copy(INVTWEAKS_SRC + '/DefaultConfig.dat', INVTWEAKS_TMP + '/invtweaks/DefaultConfig.dat') +shutil.copy(INVTWEAKS_SRC + '/DefaultTree.dat', INVTWEAKS_TMP + '/invtweaks/DefaultTree.dat') +shutil.copytree(INVTWEAKS_SRC + '/lang', INVTWEAKS_TMP + '/invtweaks/lang') +shutil.copy('INVTWEAKS-LICENSE.md', INVTWEAKS_TMP + '/INVTWEAKS-LICENSE.txt') # Zip diff --git a/src/minecraft/invtweaks/InvTweaks.java b/src/minecraft/invtweaks/InvTweaks.java index ee7bdb19..be07e0bc 100644 --- a/src/minecraft/invtweaks/InvTweaks.java +++ b/src/minecraft/invtweaks/InvTweaks.java @@ -610,7 +610,9 @@ private void handleGUILayout(GuiScreen guiScreen) { if (!customButtonsAdded) { // Check for custom button texture - boolean customTextureAvailable = hasTexture("/gui/button10px.png"); + // Disabled because the current implementation requires reflection, which is difficult to manage + // in a MCP environment - TODO find a workaround to access the texture packs data + boolean customTextureAvailable = false;//hasTexture("/gui/button10px.png"); // Inventory button if (!isValidChest) { diff --git a/src/minecraft/invtweaks/InvTweaksGuiSettings.java b/src/minecraft/invtweaks/InvTweaksGuiSettings.java index b47b8d90..998da8d1 100644 --- a/src/minecraft/invtweaks/InvTweaksGuiSettings.java +++ b/src/minecraft/invtweaks/InvTweaksGuiSettings.java @@ -213,8 +213,8 @@ protected void actionPerformed(GuiButton guibutton) { } } - - protected void keyPressed(char c, int keyCode) { + + protected void keyTyped(char c, int keyCode) { if (sortMappingEdition) { String keyName = Keyboard.getKeyName(keyCode); config.setProperty(InvTweaksConfig.PROP_KEY_SORT_INVENTORY, keyName); diff --git a/src/minecraft/invtweaks/InvTweaksLocalization.java b/src/minecraft/invtweaks/InvTweaksLocalization.java index c37b334e..16fe0a83 100644 --- a/src/minecraft/invtweaks/InvTweaksLocalization.java +++ b/src/minecraft/invtweaks/InvTweaksLocalization.java @@ -16,8 +16,7 @@ public class InvTweaksLocalization { private static final Logger log = Logger.getLogger("InvTweaks"); - private static final String LANG_RESOURCES_LOCATION = "invtweaks/lang/"; - private static final String LANG_RESOURCES_LOCATION_MCP = "../invtweaks/lang/"; + private static final String LANG_RESOURCES_LOCATION = "/invtweaks/lang/"; private static final String DEFAULT_LANGUAGE = "en_US"; private static Properties defaultMappings = new Properties(); private static Properties mappings = new Properties(); @@ -43,11 +42,7 @@ private static String load(String currentLanguage) { try { InputStream langStream = InvTweaksLocalization.class.getResourceAsStream(LANG_RESOURCES_LOCATION + currentLanguage + ".properties"); InputStream defaultLangStream = InvTweaksLocalization.class.getResourceAsStream(LANG_RESOURCES_LOCATION + DEFAULT_LANGUAGE + ".properties"); - if (langStream == null) { - langStream = InvTweaksLocalization.class.getResourceAsStream(LANG_RESOURCES_LOCATION_MCP + currentLanguage + ".properties"); - defaultLangStream = InvTweaksLocalization.class.getResourceAsStream(LANG_RESOURCES_LOCATION_MCP + DEFAULT_LANGUAGE + ".properties"); - } - + mappings.load((langStream == null) ? defaultLangStream : langStream); defaultMappings.load(defaultLangStream); diff --git a/src/minecraft/net/minecraft/src/InvTweaksObfuscation.java b/src/minecraft/net/minecraft/src/InvTweaksObfuscation.java index 5ca57db3..43c8e827 100644 --- a/src/minecraft/net/minecraft/src/InvTweaksObfuscation.java +++ b/src/minecraft/net/minecraft/src/InvTweaksObfuscation.java @@ -29,13 +29,6 @@ public class InvTweaksObfuscation { private static Map fieldsMap = new HashMap(); - static { - // CreativeSlot.underlyingSlot - makeFieldPublic(SlotCreativeInventory.class, "theSlot"); - // RenderEngine.texturePack - makeFieldPublic(RenderEngine.class, "texturePack"); - } - public InvTweaksObfuscation(Minecraft mc) { this.mc = mc; this.mods = new InvTweaksModCompatibility(this); @@ -266,7 +259,7 @@ public int getSlotNumber(Slot slot) { try { // Creative slots don't set the "slotNumber" property, serve as a proxy for true slots if (slot instanceof SlotCreativeInventory) { - Slot underlyingSlot = (Slot) getThroughReflection(SlotCreativeInventory.class, "theSlot", slot); + Slot underlyingSlot = SlotCreativeInventory.func_75240_a((SlotCreativeInventory) slot); if (underlyingSlot != null) { return underlyingSlot.slotNumber; } @@ -327,7 +320,7 @@ public int getKeyCode(KeyBinding b) { public int getSpecialChestRowSize(GuiContainer guiContainer, int defaultValue) { return mods.getSpecialChestRowSize(guiContainer, defaultValue); } - public boolean hasTexture(String texture) { + /*public boolean hasTexture(String texture) { TexturePackList texturePacksManager = (TexturePackList) getThroughReflection(RenderEngine.class, "texturePack", mc.renderEngine); InputStream resourceAsStream = null; try { @@ -343,7 +336,7 @@ public boolean hasTexture(String texture) { } } } - } + }*/ // Static access @@ -474,34 +467,5 @@ public boolean isItemArmor(Object o) { // ItemArmor public boolean isBasicSlot(Object o) { // Slot return o != null && o.getClass().equals(Slot.class); } - - // Reflection utils - - public static void makeFieldPublic(Class c, String field) { - try { - Field f = c.getDeclaredField(field); - f.setAccessible(true); - Field modifiersField = Field.class.getDeclaredField("modifiers"); - modifiersField.setAccessible(true); - modifiersField.setInt(f, Modifier.PUBLIC); - fieldsMap.put(c.getName() + field, f); - } - catch (Exception e) { - log.severe("Failed to make " + c.getName() + "." + field + " accessible: " + e.getMessage()); - } - } - - /** - * Access value from any field, even private. - * Field must be made public through the makeFieldPublic() function first. - * @return - */ - public static Object getThroughReflection(Class c, String field, Object instance) { - try { - return fieldsMap.get(c.getName() + field).get(instance); - } catch (Exception e) { - return null; - } - } } \ No newline at end of file From e80067913e853fc214ee1cb448a8cd11c65543fb Mon Sep 17 00:00:00 2001 From: Marwane Kalam-Alami Date: Wed, 16 Jan 2013 23:42:33 +0100 Subject: [PATCH 23/30] Readme update --- INVTWEAKS-README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/INVTWEAKS-README.md b/INVTWEAKS-README.md index c3374621..da9dcc99 100644 --- a/INVTWEAKS-README.md +++ b/INVTWEAKS-README.md @@ -1,5 +1,7 @@ +*InvTweaks now runs on MCP! The build process has changed, check [the wiki](https://github.com/mkalam-alami/inventory-tweaks/wiki) :)* + ## What's this project about This Open Source project (see [License](https://github.com/mkalam-alami/inventory-tweaks/blob/master/src/doc/license.txt)) is a client mod for [Minecraft](http://www.minecraft.net/), a game by [Mojang AB](http://mojang.com/). It implements various features to help players with the management of inventories and chests. A lot of effort has been put to make it as customizable as possible, without being annoying to set up. From 4bde99e2a180eb9cd328a1a606a775487ce2734b Mon Sep 17 00:00:00 2001 From: Marwane Kalam-Alami Date: Wed, 16 Jan 2013 23:46:14 +0100 Subject: [PATCH 24/30] Rename doc files --- INVTWEAKS-LICENSE.md => LICENSE.md | 0 INVTWEAKS-README.md => README.md | 0 invtweaks_scripts/package_mod.py | 2 +- 3 files changed, 1 insertion(+), 1 deletion(-) rename INVTWEAKS-LICENSE.md => LICENSE.md (100%) rename INVTWEAKS-README.md => README.md (100%) diff --git a/INVTWEAKS-LICENSE.md b/LICENSE.md similarity index 100% rename from INVTWEAKS-LICENSE.md rename to LICENSE.md diff --git a/INVTWEAKS-README.md b/README.md similarity index 100% rename from INVTWEAKS-README.md rename to README.md diff --git a/invtweaks_scripts/package_mod.py b/invtweaks_scripts/package_mod.py index 049d0671..9d3a9328 100644 --- a/invtweaks_scripts/package_mod.py +++ b/invtweaks_scripts/package_mod.py @@ -23,7 +23,7 @@ shutil.copy(INVTWEAKS_SRC + '/DefaultConfig.dat', INVTWEAKS_TMP + '/invtweaks/DefaultConfig.dat') shutil.copy(INVTWEAKS_SRC + '/DefaultTree.dat', INVTWEAKS_TMP + '/invtweaks/DefaultTree.dat') shutil.copytree(INVTWEAKS_SRC + '/lang', INVTWEAKS_TMP + '/invtweaks/lang') -shutil.copy('INVTWEAKS-LICENSE.md', INVTWEAKS_TMP + '/INVTWEAKS-LICENSE.txt') +shutil.copy('LICENSE.md', INVTWEAKS_TMP + '/LICENSE.txt') # Zip From ab57dcf86e858e7a4df739f72544481d1cbfde3f Mon Sep 17 00:00:00 2001 From: Marwane Kalam-Alami Date: Thu, 17 Jan 2013 00:13:17 +0100 Subject: [PATCH 25/30] Remove click delay option, fix open chests --- README.md | 2 +- src/minecraft/invtweaks/InvTweaks.java | 4 +--- src/minecraft/invtweaks/InvTweaksConfig.java | 12 ------------ .../invtweaks/InvTweaksGuiSettings.java | 2 +- .../InvTweaksGuiSettingsAbstract.java | 7 +++++++ .../InvTweaksGuiSettingsAdvanced.java | 18 ------------------ .../invtweaks/InvTweaksGuiSettingsButton.java | 1 - .../invtweaks/InvTweaksGuiShortcutsHelp.java | 9 ++++++--- .../invtweaks/InvTweaksHandlerAutoRefill.java | 1 - .../invtweaks/InvTweaksHandlerShortcuts.java | 1 - .../invtweaks/InvTweaksHandlerSorting.java | 4 ---- 11 files changed, 16 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index da9dcc99..10610d19 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -*InvTweaks now runs on MCP! The build process has changed, check [the wiki](https://github.com/mkalam-alami/inventory-tweaks/wiki) :)* +*InvTweaks now runs on MCP! The build process has changed, check [the wiki](https://github.com/mkalam-alami/inventory-tweaks/wiki/Getting-started) :)* ## What's this project about diff --git a/src/minecraft/invtweaks/InvTweaks.java b/src/minecraft/invtweaks/InvTweaks.java index be07e0bc..2484dadb 100644 --- a/src/minecraft/invtweaks/InvTweaks.java +++ b/src/minecraft/invtweaks/InvTweaks.java @@ -193,8 +193,7 @@ public void onItemPickup() { try { InvTweaksContainerSectionManager containerMgr = new InvTweaksContainerSectionManager(mc, InvTweaksContainerSection.INVENTORY); - containerMgr.setClickDelay(config.getClickDelay()); - + // Find stack slot (look in hotbar only). // We're looking for a brand new stack in the hotbar // (not an existing stack whose amount has been increased) @@ -507,7 +506,6 @@ private void handleMiddleClick(GuiScreen guiScreen) { chestAlgorithmButtonDown = true; InvTweaksContainerManager containerMgr = new InvTweaksContainerManager(mc); - containerMgr.setClickDelay(config.getClickDelay()); Slot slotAtMousePosition = containerMgr.getSlotAtMousePosition(); InvTweaksContainerSection target = null; if (slotAtMousePosition != null) { diff --git a/src/minecraft/invtweaks/InvTweaksConfig.java b/src/minecraft/invtweaks/InvTweaksConfig.java index 22d8a2ff..117c58c2 100644 --- a/src/minecraft/invtweaks/InvTweaksConfig.java +++ b/src/minecraft/invtweaks/InvTweaksConfig.java @@ -55,7 +55,6 @@ public class InvTweaksConfig { public static final String PROP_SHORTCUT_DROP = "shortcutKeyDrop"; public static final String PROP_SHORTCUT_UP = "shortcutKeyToUpperSection"; public static final String PROP_SHORTCUT_DOWN = "shortcutKeyToLowerSection"; - public static final String PROP_SLOW_SORTING = "slowSorting"; // Other public static final String PROP_ENABLE_SOUNDS = "enableSounds"; @@ -361,16 +360,6 @@ public boolean isAutoRefillEnabled(int itemID, int itemDamage) { } } - public int getClickDelay() { - String slowSortingValue = getProperty(PROP_SLOW_SORTING); - if (VALUE_FALSE.equals(slowSortingValue)) { - return 0; - } - else { - return InvTweaksConst.SLOW_SORTING_DELAY; - } - } - /** * Check potential conflicts with Convenient Inventory (regarding the middle * click shortcut), and solve them according to the CI version. @@ -487,7 +476,6 @@ private void reset() { properties.put(PROP_ENABLE_SHORTCUTS, VALUE_TRUE); properties.put(PROP_ENABLE_AUTO_EQUIP_ARMOR, VALUE_FALSE); properties.put(PROP_KEY_SORT_INVENTORY, "R"); - properties.put(PROP_SLOW_SORTING, VALUE_FALSE); properties.put(PROP_SHORTCUT_ALL_ITEMS, "LCONTROL+LSHIFT, RCONTROL+RSHIFT"); properties.put(PROP_SHORTCUT_EVERYTHING, "SPACE"); diff --git a/src/minecraft/invtweaks/InvTweaksGuiSettings.java b/src/minecraft/invtweaks/InvTweaksGuiSettings.java index 998da8d1..eee4b893 100644 --- a/src/minecraft/invtweaks/InvTweaksGuiSettings.java +++ b/src/minecraft/invtweaks/InvTweaksGuiSettings.java @@ -220,7 +220,7 @@ protected void keyTyped(char c, int keyCode) { config.setProperty(InvTweaksConfig.PROP_KEY_SORT_INVENTORY, keyName); sortMappingButton.displayString = InvTweaksLocalization.get("invtweaks.settings.key") + " " + keyName; } - + super.keyTyped(c, keyCode); } } diff --git a/src/minecraft/invtweaks/InvTweaksGuiSettingsAbstract.java b/src/minecraft/invtweaks/InvTweaksGuiSettingsAbstract.java index be562944..5841757a 100644 --- a/src/minecraft/invtweaks/InvTweaksGuiSettingsAbstract.java +++ b/src/minecraft/invtweaks/InvTweaksGuiSettingsAbstract.java @@ -8,6 +8,7 @@ import net.minecraft.src.GuiScreen; import net.minecraft.src.InvTweaksObfuscation; +import org.lwjgl.input.Keyboard; import org.lwjgl.util.Point; @@ -70,6 +71,12 @@ protected void actionPerformed(GuiButton guibutton) { obf.displayGuiScreen(parentScreen); } } + + protected void keyTyped(char c, int keyCode) { + if (keyCode == Keyboard.KEY_ESCAPE) { + obf.displayGuiScreen(parentScreen); + } + } protected void moveToButtonCoords(int buttonOrder, Point p) { p.setX(obf.getWindowWidth(this) / 2 - 155 + ((buttonOrder+1) % 2) * 160); diff --git a/src/minecraft/invtweaks/InvTweaksGuiSettingsAdvanced.java b/src/minecraft/invtweaks/InvTweaksGuiSettingsAdvanced.java index 284f88a0..453f7c5a 100644 --- a/src/minecraft/invtweaks/InvTweaksGuiSettingsAdvanced.java +++ b/src/minecraft/invtweaks/InvTweaksGuiSettingsAdvanced.java @@ -26,14 +26,12 @@ public class InvTweaksGuiSettingsAdvanced extends InvTweaksGuiSettingsAbstract { private final static int ID_AUTO_EQUIP_ARMOR = 2; private final static int ID_ENABLE_SOUNDS = 3; private final static int ID_CHESTS_BUTTONS = 4; - private final static int ID_SLOW_SORTING = 5; private final static int ID_EDITSHORTCUTS = 100; private static String labelChestButtons; private static String labelSortOnPickup; private static String labelEquipArmor; private static String labelEnableSounds; - private static String labelSlowSorting; public InvTweaksGuiSettingsAdvanced(Minecraft mc, GuiScreen parentScreen, InvTweaksConfig config) { super(mc, parentScreen, config); @@ -42,7 +40,6 @@ public InvTweaksGuiSettingsAdvanced(Minecraft mc, GuiScreen parentScreen, InvTwe labelEquipArmor = InvTweaksLocalization.get("invtweaks.settings.advanced.autoequip"); labelEnableSounds = InvTweaksLocalization.get("invtweaks.settings.advanced.sounds"); labelChestButtons = InvTweaksLocalization.get("invtweaks.settings.chestbuttons"); - labelSlowSorting = InvTweaksLocalization.get("invtweaks.settings.slowsorting"); } public void initGui() { @@ -80,12 +77,6 @@ public void initGui() { InvTweaksConfig.PROP_ENABLE_AUTO_EQUIP_ARMOR, labelEquipArmor), InvTweaksLocalization.get("invtweaks.settings.advanced.autoequip.tooltip")); controlList.add(autoEquipArmorBtn); - i += 3; - moveToButtonCoords(i++, p); - InvTweaksGuiTooltipButton slowSortingBtn = new InvTweaksGuiTooltipButton(ID_SLOW_SORTING, p.getX(), p.getY() + 10, - computeBooleanButtonLabel(InvTweaksConfig.PROP_SLOW_SORTING, labelSlowSorting), null); - controlList.add(slowSortingBtn); - // Check if links to files are supported, if not disable the buttons if (!Desktop.isDesktopSupported()) { for (Object o : controlList) { @@ -109,10 +100,6 @@ public void drawScreen(int i, int j, float f) { int x = obf.getWindowWidth(this) / 2; drawCenteredString(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.settings.pvpwarning.pt1"), x, 40, 0x999999); drawCenteredString(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.settings.pvpwarning.pt2"), x, 50, 0x999999); - - drawCenteredString(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.settings.slowsorting.pt1"), x, 115, 0x999999); - drawCenteredString(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.settings.slowsorting.pt2"), x, 125, 0x999999); - drawCenteredString(obf.getFontRenderer(), InvTweaksLocalization.get("invtweaks.settings.slowsorting.pt3"), x, 135, 0x999999); } protected void actionPerformed(GuiButton guibutton) { @@ -138,11 +125,6 @@ protected void actionPerformed(GuiButton guibutton) { case ID_CHESTS_BUTTONS: toggleBooleanButton(guibutton, InvTweaksConfig.PROP_SHOW_CHEST_BUTTONS, labelChestButtons); break; - - // Toggle sounds - case ID_SLOW_SORTING: - toggleBooleanButton(guibutton, InvTweaksConfig.PROP_SLOW_SORTING, labelSlowSorting); - break; // Open shortcuts mappings in external editor case ID_EDITSHORTCUTS: diff --git a/src/minecraft/invtweaks/InvTweaksGuiSettingsButton.java b/src/minecraft/invtweaks/InvTweaksGuiSettingsButton.java index 45a297cb..310da4a8 100644 --- a/src/minecraft/invtweaks/InvTweaksGuiSettingsButton.java +++ b/src/minecraft/invtweaks/InvTweaksGuiSettingsButton.java @@ -49,7 +49,6 @@ public boolean mousePressed(Minecraft minecraft, int i, int j) { try { containerMgr = new InvTweaksContainerSectionManager( minecraft, InvTweaksContainerSection.INVENTORY); - containerMgr.setClickDelay(config.getClickDelay()); if (obf.getHeldStack() != null) { try { // Put hold item down diff --git a/src/minecraft/invtweaks/InvTweaksGuiShortcutsHelp.java b/src/minecraft/invtweaks/InvTweaksGuiShortcutsHelp.java index 536b71df..ba2cc228 100644 --- a/src/minecraft/invtweaks/InvTweaksGuiShortcutsHelp.java +++ b/src/minecraft/invtweaks/InvTweaksGuiShortcutsHelp.java @@ -88,16 +88,19 @@ public void drawScreen(int i, int j, float f) { } protected void actionPerformed(GuiButton guibutton) { - switch (obf.getId(guibutton)) { - case ID_DONE: obf.displayGuiScreen(parentScreen); break; - } } + protected void keyTyped(char c, int keyCode) { + if (keyCode == Keyboard.KEY_ESCAPE) { + obf.displayGuiScreen(parentScreen); + } + } + private String buildUpOrDownLabel(String shortcutProp, int keyCode, String defaultKeyName) { String shortcutLabel = config.getProperty(shortcutProp); String keyLabel = getKeyName(keyCode, defaultKeyName); diff --git a/src/minecraft/invtweaks/InvTweaksHandlerAutoRefill.java b/src/minecraft/invtweaks/InvTweaksHandlerAutoRefill.java index 0bac8965..478694d9 100644 --- a/src/minecraft/invtweaks/InvTweaksHandlerAutoRefill.java +++ b/src/minecraft/invtweaks/InvTweaksHandlerAutoRefill.java @@ -43,7 +43,6 @@ public void autoRefillSlot(int slot, int wantedId, int wantedDamage) throws Exce InvTweaksContainerSectionManager container = new InvTweaksContainerSectionManager( mc, InvTweaksContainerSection.INVENTORY); - container.setClickDelay(config.getClickDelay()); ItemStack candidateStack, replacementStack = null; int replacementStackSlot = -1; boolean refillBeforeBreak = config.getProperty(InvTweaksConfig.PROP_AUTO_REFILL_BEFORE_BREAK) diff --git a/src/minecraft/invtweaks/InvTweaksHandlerShortcuts.java b/src/minecraft/invtweaks/InvTweaksHandlerShortcuts.java index 44a5b421..5bf9e802 100644 --- a/src/minecraft/invtweaks/InvTweaksHandlerShortcuts.java +++ b/src/minecraft/invtweaks/InvTweaksHandlerShortcuts.java @@ -148,7 +148,6 @@ public ShortcutConfig computeShortcutToTrigger() { // Init container = new InvTweaksContainerManager(mc); - container.setClickDelay(config.getClickDelay()); Slot slot = container.getSlotAtMousePosition(); ShortcutConfig shortcutConfig = new ShortcutConfig(); diff --git a/src/minecraft/invtweaks/InvTweaksHandlerSorting.java b/src/minecraft/invtweaks/InvTweaksHandlerSorting.java index c6dc7547..bcd9e869 100644 --- a/src/minecraft/invtweaks/InvTweaksHandlerSorting.java +++ b/src/minecraft/invtweaks/InvTweaksHandlerSorting.java @@ -53,7 +53,6 @@ public class InvTweaksHandlerSorting extends InvTweaksObfuscation { private int algorithm; private int size; private boolean sortArmorParts; - private int clickDelay; private InvTweaksItemTree tree; private Vector rules; @@ -83,9 +82,7 @@ public InvTweaksHandlerSorting(Minecraft mc, InvTweaksConfig config, // Init attributes - this.clickDelay = config.getClickDelay(); this.containerMgr = new InvTweaksContainerSectionManager(mc, section); - this.containerMgr.setClickDelay(this.clickDelay); this.size = containerMgr.getSize(); this.sortArmorParts = config.getProperty(InvTweaksConfig.PROP_ENABLE_AUTO_EQUIP_ARMOR).equals(InvTweaksConfig.VALUE_TRUE) && !isGuiInventoryCreative(getCurrentScreen()); // FIXME Armor parts disappear when sorting in creative mode while holding an item @@ -127,7 +124,6 @@ public void sort() throws TimeoutException { long timer = System.nanoTime(); InvTweaksContainerManager globalContainer = new InvTweaksContainerManager(mc); - globalContainer.setClickDelay(this.clickDelay); // Put hold item down if (getHeldStack() != null) { From 74670bdb6914657d0f7a10849393a19bd497837c Mon Sep 17 00:00:00 2001 From: Marwane Kalam-Alami Date: Thu, 17 Jan 2013 00:45:46 +0100 Subject: [PATCH 26/30] Update changelog / dl link --- invtweaks_docs/changelog.txt | 8 +++++++- invtweaks_docs/download.txt | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/invtweaks_docs/changelog.txt b/invtweaks_docs/changelog.txt index d346cbcf..42d4ae3b 100644 --- a/invtweaks_docs/changelog.txt +++ b/invtweaks_docs/changelog.txt @@ -3,7 +3,13 @@ Latest changes ============== -`[11.15.2012] 1.45 (1.4.4) `_ +`[01.17.2013] 1.50 (1.4.7) `_ + * Switched sources to MCP (= faster to update, easier to contribute) + * Middle click evens the stacks on crafting tables (thanks to InvTweaks-1.50-1.4.7.zip) + * Removed uneffective NoCheatPlus hack, put a help screen instead + * Fix chests being sometimes left open forever + +`[11.15.2012] 1.45 (1.4.4) `_ * Added Beta option to make the mod work on anti-cheat servers * Fixed the potato IDs in the item tree (delete config/InvTweaksTree.txt to refresh it) * Added Norwegian translation (thanks to mymusicmanager) diff --git a/invtweaks_docs/download.txt b/invtweaks_docs/download.txt index 44b90e24..4ed931c3 100644 --- a/invtweaks_docs/download.txt +++ b/invtweaks_docs/download.txt @@ -1,12 +1,12 @@ .. image:: _static/img/dl.png :align: left -`Inventory Tweaks 1.45 `_ for **Minecraft 1.4.4** (requires `Forge `_ or `ModLoader `_) | `Mirror `_ +`Inventory Tweaks 1.50 `_ for **Minecraft 1.4.6/1.4.7** (requires `Forge `_ or `ModLoader `_) | `Mirror `_ .. image:: _static/img/dl.png :align: left -`Inventory Tweaks 1.44 `_ for **Minecraft 1.4.2** (requires `Forge `_ or `ModLoader `_) | `Mirror `_ +`Inventory Tweaks 1.45 `_ for **Minecraft 1.4.4/1.4.5** (requires `Forge `_ or `ModLoader `_) | `Mirror `_ .. image:: _static/img/dl.png :align: left From d16950eb3e5e87be03f701465b48100f5c4343d2 Mon Sep 17 00:00:00 2001 From: Marwane Kalam-Alami Date: Thu, 17 Jan 2013 00:53:39 +0100 Subject: [PATCH 27/30] Document new shortcut --- invtweaks_docs/index.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/invtweaks_docs/index.txt b/invtweaks_docs/index.txt index 14cb3314..d26920d5 100644 --- a/invtweaks_docs/index.txt +++ b/invtweaks_docs/index.txt @@ -52,7 +52,9 @@ Just start playing Minecraft, you can already use most features of the mod. Noti Inventory sorting ~~~~~~~~~~~~~~~~~ -Trigger the sorting in your inventory by using the **middle click**, or by pressing **R** (by default), at any time. If you want to change the shortcut, you can do that from the "..." menu in your inventory. +Trigger the sorting in your inventory by using the **middle click**, or by pressing **R** (by default), at any time. If you want to change the shortcut, you can do that from the "..." menu in your inventory. + +Tip: The middle click shortcut behaves differently if you target the **crafting input**: in that case, it will adjust the item amounts to balance them, helping optimize your recipe input. For example, if you want to make sticks, it will make sure your wood will be split equally between the top and the bottom stack. Chests sorting ~~~~~~~~~~~~~~ From 043941128d5c871529eb80a10c0aa3e11d5f09f0 Mon Sep 17 00:00:00 2001 From: Joel Green Date: Fri, 8 Mar 2013 18:45:53 -0800 Subject: [PATCH 28/30] Add link to Kobata's fork in README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 10610d19..0b74d507 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ +#Kobata has a well maintained fork with numerous bugfixes and some additions. Please go to https://github.com/Kobata/inventory-tweaks for further updates. Additional links will be updated with time. + *InvTweaks now runs on MCP! The build process has changed, check [the wiki](https://github.com/mkalam-alami/inventory-tweaks/wiki/Getting-started) :)* ## What's this project about From 8733039c1b457da27592e79879a2b2c4dbf5ce47 Mon Sep 17 00:00:00 2001 From: Joel Green Date: Sat, 9 Mar 2013 23:17:43 -0800 Subject: [PATCH 29/30] Fix formatting --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0b74d507..61937ae7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -#Kobata has a well maintained fork with numerous bugfixes and some additions. Please go to https://github.com/Kobata/inventory-tweaks for further updates. Additional links will be updated with time. +_**Kobata has a well maintained fork with numerous bugfixes and some additions. Please go to https://github.com/Kobata/inventory-tweaks for further updates. Additional links will be updated with time.**_ *InvTweaks now runs on MCP! The build process has changed, check [the wiki](https://github.com/mkalam-alami/inventory-tweaks/wiki/Getting-started) :)* From ae4b65bc8658d2081eef2994386f665a48a80cb5 Mon Sep 17 00:00:00 2001 From: Marwane Kalam-Alami Date: Sun, 10 Mar 2013 12:16:01 +0100 Subject: [PATCH 30/30] Complete redirection to Kobata's fork --- README.md | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 61937ae7..f6e969ef 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,12 @@ - +## This repository is not maintained anymore. -_**Kobata has a well maintained fork with numerous bugfixes and some additions. Please go to https://github.com/Kobata/inventory-tweaks for further updates. Additional links will be updated with time.**_ +**Kobata has a well maintained fork with multiple bugfixes and additions. Since March 2013, he is the new official maintainer for InvTweaks.** -*InvTweaks now runs on MCP! The build process has changed, check [the wiki](https://github.com/mkalam-alami/inventory-tweaks/wiki/Getting-started) :)* +* **Please go to [his fork of this repository](https://github.com/Kobata/inventory-tweaks) for further updates** +* **See also the new [InvTweaks thread](http://www.minecraftforum.net/topic/1720872-inventory-tweaks-151-mar-9/) on the Minecraft forums** -## What's this project about +## What is Inventory Tweaks? This Open Source project (see [License](https://github.com/mkalam-alami/inventory-tweaks/blob/master/src/doc/license.txt)) is a client mod for [Minecraft](http://www.minecraft.net/), a game by [Mojang AB](http://mojang.com/). It implements various features to help players with the management of inventories and chests. A lot of effort has been put to make it as customizable as possible, without being annoying to set up. -## Get started - -* For documentation about how to use or install the mod, see the [main page of Inventory Tweaks](http://modding.kalam-alami.net). This place is for developers! -* To start coding, all is explained on the [project's wiki](https://github.com/mkalam-alami/inventory-tweaks/wiki). +