Compare commits

..
74 Commits
Author SHA1 Message Date
Thomas Guimbretiere 42170ca050 Fixed wrong msgs on empty and microblocks. 2013-12-23 13:40:21 +01:00
Thomas Guimbretiere f9868afde1 Added support for Railcraft tanks. 2013-12-21 00:09:53 +01:00
Thomas Guimbretiere 4e79797cd1 Added support for OpenBlocks tanks. 2013-12-20 23:16:11 +01:00
Thomas Guimbretiere 921b245273 Added support for ExtraUtilities drums 2013-12-20 22:31:09 +01:00
Thomas Guimbretiere 2cbaeca169 Fixed Thermal Expansion conduits. 2013-12-20 21:52:53 +01:00
Thomas Guimbretiere bc344cab41 Added tag 1.4.3 for changeset 1c391d52f3d9 2013-12-17 18:59:24 +01:00
Thomas Guimbretiere 7a2fd4363c Mute the discovery errors from IC2.
Moved the module registration to very late events.
2013-12-17 18:40:55 +01:00
Thomas Guimbretiere 11d0f86320 Updated RU translation
Removed fluked file.
2013-12-12 16:26:28 +01:00
Thomas Guimbretiere d83fb8fe76 Added side getter to the accessor.
Version bump.
2013-12-09 14:08:18 +01:00
Thomas Guimbretiere a36013c28c Fixed a derp with air blocks... 2013-12-09 14:01:52 +01:00
Thomas Guimbretiere 1934171e5a Merge 2013-12-07 01:34:18 +01:00
Thomas Guimbretiere 4b2e873261 Merged in Vexatos/waila-1/Vexatos/de_delang-edited-online-with-bitbucket-1386187266977 (pull request #5)
de_DE.lang edited online with Bitbucket
2013-12-07 01:38:27 +01:00
Thomas Guimbretiere 6319cbd425 Localization 2013-12-07 01:33:57 +01:00
Vexatos 72ae5eccb3 de_DE.lang edited online with Bitbucket 2013-12-04 20:01:17 +00:00
Thomas Guimbretiere 5d1c7d532f Added tag 1.4.1 for changeset f9daea609042 2013-11-26 16:29:14 +01:00
Thomas Guimbretiere afb9549da9 Done with options & localization. 2013-11-26 16:28:54 +01:00
Thomas Guimbretiere 0d749d80ae [IC2] Added trade-o-mat display. 2013-11-26 01:57:29 +01:00
Thomas Guimbretiere 050fd992c6 [IC2] Fixed display for geothermal & semifluid generators. 2013-11-26 01:35:12 +01:00
Thomas Guimbretiere 3694992eb5 Working revisited IC2 module. 2013-11-26 00:37:40 +01:00
Thomas Guimbretiere 6f0301667d Check for MOP diff in the NBT sync packet sending block. 2013-11-23 19:45:28 +01:00
Thomas Guimbretiere d2606bfc25 Fixed ETB module (early lookup).
Removed IC2 module for now (pending rewrite).
Caching providers lookup data for optimization.
2013-11-23 19:38:54 +01:00
Thomas Guimbretiere 299ef5307e Added tag v1.4.0 for changeset e8b1906c3f51 2013-11-23 15:40:38 +01:00
Thomas Guimbretiere a750f76a5d Merge 2013-11-22 18:42:00 +01:00
Thomas Guimbretiere cd587ee8ca Fixed orientation prbs & IC2 2013-11-22 18:41:00 +01:00
Thomas Guimbretiere 987254caca Readded Repeater
Fixed mod identification by jar for Forge.
2013-11-22 16:43:42 +01:00
Thomas Guimbretiere ef5ff0c6ed Small orientation bugfix 2013-11-22 16:30:55 +01:00
Thomas Guimbretiere e9947e3960 Merged in Vexatos/waila-2/Vexatos/updated-de_delang-1385130888171 (pull request #4)
Fixed Itemduct typo
2013-11-22 15:41:37 +01:00
Vexatos 95bf99a24a fr_FR.lang edited online with Bitbucket 2013-11-22 14:38:28 +00:00
Vexatos be530da970 en_US.lang edited online with Bitbucket 2013-11-22 14:37:08 +00:00
Vexatos 5d82ebf0d5 Updated de_DE.lang 2013-11-22 14:34:53 +00:00
Thomas Guimbretiere 165cb1003c Merged in Vexatos/waila-1/Vexatos/updated-de_delang-with-project-red-stuff-1385130448150 (pull request #3)
Updated de_DE.lang with Project: Red stuff
2013-11-22 15:28:50 +01:00
Vexatos 5388d1bea0 Updated de_DE.lang with Project: Red stuff 2013-11-22 14:27:33 +00:00
Thomas Guimbretiere c40c032531 Added tag Nightly_131121a for changeset c7e3d16cb236 2013-11-21 01:50:26 +01:00
Thomas Guimbretiere bf0bb6e0c7 Added config options. 2013-11-21 01:50:05 +01:00
Thomas Guimbretiere 42c35d2b69 Added full support for P:R
Updated a few lang files
Added conduits to TE3
2013-11-21 00:40:46 +01:00
Thomas Guimbretiere e9b440616e FR_fr localization 2013-11-20 19:01:16 +01:00
Thomas Guimbretiere d1b354f05e Class name fix for TE3
Exception now shows the first line containing a Waila reference.
2013-11-20 18:50:44 +01:00
Thomas Guimbretiere 0742ef2422 Working proto of P:R module.
Added stacktrace to ExceptionHandler
2013-11-20 18:24:57 +01:00
Thomas Guimbretiere 8e45cb8064 Added billboard helper, floating text help
Accessor contains a bit more information (like the partial frame)
Added a project red module with basic block highlight.
2013-11-19 14:13:09 +01:00
Thomas Guimbretiere 6896998934 Added test decorator on Vanilla crop (desactivated) 2013-11-19 02:13:31 +01:00
Thomas Guimbretiere 74a2805844 IWailaBlockDecorators are now called in the event, with proper safeguards. 2013-11-19 01:37:57 +01:00
Thomas Guimbretiere c95daee0e2 Moved client side stuff to client package.
Added a client event handler for renderLast events.
Basic coordinate gathering in the renderLast event.
Added API to register block decorators.
2013-11-19 00:54:20 +01:00
Thomas Guimbretiere bb5cd6cbfa Added tag Nightly_131118 for changeset d2ec5e84d19f 2013-11-19 00:53:06 +01:00
Thomas Guimbretiere 3dde25b1a4 Added tag Nightly_13111 for changeset 9280666656c7 2013-11-19 00:52:32 +01:00
Thomas Guimbretiere 66649fa9dd Small fixes in the localization engine. 2013-11-18 17:56:01 +01:00
Vexatos a87c29bb2f Created de_DE.lang 2013-11-18 17:26:49 +01:00
Thomas Guimbretiere 3a057e4aba Moved IPowerReceptor to BCAPI module (new module)
Cleaned up all the broken BC parts.
Smaller textures for the test pics.
EnderIO tesseracts are now showing chans/owner
Localization all over the place & a couple new strings.
2013-11-18 14:57:12 +01:00
Thomas Guimbretiere b50df6af26 Added BC power receptor API hooks. 2013-11-18 03:57:21 +01:00
Thomas Guimbretiere 8e8fd7f2bd Basic support for EnderIO capacitors
Added options to ETB
2013-11-18 02:50:33 +01:00
Thomas Guimbretiere d9f209a1d4 Added support for Engineer Toolbox. 2013-11-18 01:11:51 +01:00
Thomas Guimbretiere 5e6ccc5ff8 Done implementing the localization 2013-11-17 20:44:45 +01:00
Thomas Guimbretiere bbfcc3b3ad My bad 2013-11-17 20:33:47 +01:00
Thomas Guimbretiere d4a7b62644 Partial localization 2013-11-17 20:31:39 +01:00
Thomas Guimbretiere 417a75a896 Localized everything up to ConfigKeys. 2013-11-17 19:03:55 +01:00
Thomas Guimbretiere b551d54e5c Attempt at getting TTF font support (failed). 2013-11-17 17:47:15 +01:00
Thomas Guimbretiere 16ca8f2917 Added Minecraftia as default font & loaded it. 2013-11-17 17:26:20 +01:00
Thomas Guimbretiere e7f2cab192 Added TrueTyper 2013-11-17 17:14:55 +01:00
Thomas Guimbretiere 40063f3799 Vanilla Cocoa & Netherwarts are now handled properly (growth) 2013-11-17 17:05:30 +01:00
Thomas Guimbretiere 326d2b519b Removed RF energy display for IEnergyHandler if the NBT data is not there.
Fixed EnderStorage tanks color display.
2013-11-17 15:03:28 +01:00
Thomas Guimbretiere a7668e321c Fixed tooltip size error.
Added a exception throwing getField (so you can test multiple combinaisons => obf vs srg)
2013-11-17 14:33:44 +01:00
Thomas Guimbretiere 79af54e8cf Added tag Nightly_131116 for changeset 246642120b36 2013-11-17 14:09:09 +01:00
Thomas Guimbretiere 09f8bbe33e Full TE3 support 2013-11-17 14:08:54 +01:00
Thomas Guimbretiere 1908f39995 Added support for TE
Added some stuff to the reflection helper.
2013-11-16 15:14:30 +01:00
Thomas Guimbretiere 748fc3fffa Added License 2013-11-12 23:53:20 +01:00
Thomas Guimbretiere 250dc6ac2a Added try/catch around getPickBlock in the raytracing. Was crashing on some circunstances. 2013-10-26 13:53:39 +02:00
Thomas Guimbretiere b81d2d3709 Added tag Nightly_131025 for changeset bc4937f3a7d4 2013-10-26 13:53:05 +02:00
Thomas Guimbretiere a873131d2f Removed some wrong imports. 2013-10-26 12:54:37 +02:00
Thomas Guimbretiere b5689428e8 Added assets folder 2013-10-26 12:48:13 +02:00
Thomas Guimbretiere d6285e2932 Fixed enchant table rendering out of screen. 2013-10-25 14:57:41 +02:00
Thomas Guimbretiere eb348d10fc Fixed string discovery for keybind config screen.
Adding tag is controlled by a config option.
2013-10-25 14:22:29 +02:00
Thomas Guimbretiere 7eb3ddb50c Added an helper for reflection.
Moved all mod identification to a static class.
Dump of KeyHandler string + mod on startup.
2013-10-25 13:35:01 +02:00
Thomas Guimbretiere fde934363c Cleanup 2013-10-24 21:54:33 +02:00
Thomas Guimbretiere dce9809205 Cleanup 2013-10-24 21:51:32 +02:00
Thomas Guimbretiere 15bee287f3 Added tag Nightly_131024 for changeset 02ebbb4aeebe 2013-10-24 18:39:41 +02:00
96 changed files with 5162 additions and 927 deletions

No files matched your search

+387
View File
@@ -0,0 +1,387 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
APACHE COMMONS MATH DERIVATIVE WORKS:
The Apache commons-math library includes a number of subcomponents
whose implementation is derived from original sources written
in C or Fortran. License terms of the original sources
are reproduced below.
===============================================================================
For the lmder, lmpar and qrsolv Fortran routine from minpack and translated in
the LevenbergMarquardtOptimizer class in package
org.apache.commons.math3.optimization.general
Original source copyright and license statement:
Minpack Copyright Notice (1999) University of Chicago. All rights reserved
Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the
following conditions are met:
1. Redistributions of source code must retain the above
copyright notice, this list of conditions and the following
disclaimer.
2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials
provided with the distribution.
3. The end-user documentation included with the
redistribution, if any, must include the following
acknowledgment:
"This product includes software developed by the
University of Chicago, as Operator of Argonne National
Laboratory.
Alternately, this acknowledgment may appear in the software
itself, if and wherever such third-party acknowledgments
normally appear.
4. WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS"
WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE
UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND
THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE
OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY
OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR
USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF
THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4)
DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION
UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL
BE CORRECTED.
5. LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT
HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF
ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT,
INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF
ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF
PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER
SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT
(INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE,
EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE
POSSIBILITY OF SUCH LOSS OR DAMAGES.
===============================================================================
Copyright and license statement for the odex Fortran routine developed by
E. Hairer and G. Wanner and translated in GraggBulirschStoerIntegrator class
in package org.apache.commons.math3.ode.nonstiff:
Copyright (c) 2004, Ernst Hairer
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
===============================================================================
Copyright and license statement for the original lapack fortran routines
translated in EigenDecompositionImpl class in package
org.apache.commons.math3.linear:
Copyright (c) 1992-2008 The University of Tennessee. All rights reserved.
$COPYRIGHT$
Additional copyrights may follow
$HEADER$
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer listed
in this license in the documentation and/or other materials
provided with the distribution.
- Neither the name of the copyright holders nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
===============================================================================
Copyright and license statement for the original Mersenne twister C
routines translated in MersenneTwister class in package
org.apache.commons.math3.random:
Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The names of its contributors may not be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
===============================================================================
The class "org.apache.commons.math3.exception.util.LocalizedFormatsTest" is
an adapted version of "OrekitMessagesTest" test class for the Orekit library
The "org.apache.commons.math3.analysis.interpolation.HermiteInterpolator"
has been imported from the Orekit space flight dynamics library.
Th Orekit library is described at:
https://www.orekit.org/forge/projects/orekit
The original files are distributed under the terms of the Apache 2 license
which is: Copyright 2010 CS Communication & Systèmes
Binary file not shown.
+137
View File
@@ -0,0 +1,137 @@
screen.button.waila=Waila
screen.button.modules=Module
screen.label.scale=Maße
screen.label.dragtuto=Verschiebe das HUD, um seine Position zu ändern.
screen.button.default=Standard
screen.button.cancel=Abbrechen
screen.button.ok=Ok
screen.button.yes=Ja
screen.button.no=Nein
screen.button.back=Zurück
screen.button.hidden=Versteckt
screen.button.visible=Sichtbar
screen.button.maintained=Gewartet
screen.button.toggled=Geschaltet
choice.showhidewaila=Zeige/Verstecke Waila
choice.showhideidmeta=Zeige ID:Metadata
choice.toggledmaintained=Geschaltet/Gewartet
choice.showliquids=Flüssigkeiten
screen.button.configureaspect=Konfiguriere Aspekt...
enchant.title.name=Name
enchant.title.minlvl=Min lvl
enchant.title.maxlvl=Max lvl
enchant.title.weight=Gewicht
enchant.label.enchantability=Verzauberbarkeit
waila.keybind.wailaconfig=[Waila] Config-Bildschirm
waila.keybind.wailadisplay=[Waila] Zeigen/Verstecken
waila.keybind.liquid=[Waila] Zeige Flüssigkeiten
waila.keybind.recipe=[Waila] Zeige Rezept
waila.keybind.usage=[Waila] Zeige Nutzung
waila.keybind.testing=[Waila] Testen
client.msg.norecipe=Kein Rezept gefunden.
client.msg.nousage=Keine Nutzung gefunden.
hud.msg.none=<Nichts>
hud.msg.empty=<Leer>
hud.msg.output=Output
hud.msg.input=Input
hud.msg.out=Out
hud.msg.in=In
hud.msg.power=Energie
hud.msg.storage=Speicher
hud.msg.stored=Gespeichert
hud.msg.any=Jegliches
hud.msg.mode=Modus
hud.msg.maxpower=Max Energie
hud.msg.trigger=Trigger
hud.msg.maxio=Max IO
hud.msg.send=Senden
hud.msg.recv=Empfangen
hud.msg.item=Item
hud.msg.fluid=Flüssigk.
hud.msg.energ=Energie
hud.msg.frequency=Frequenz
hud.msg.owner=Besitzer
hud.msg.public=Öffentlich
hud.msg.restricted=Eingeschränkt
hud.msg.private=Privat
hud.msg.white=Weiß
hud.msg.orange=Orange
hud.msg.magenta=Magenta
hud.msg.lblue=HBlau
hud.msg.yellow=Gelb
hud.msg.lime=HGrün
hud.msg.pink=Pink
hud.msg.gray=Grau
hud.msg.lgray=HGrau
hud.msg.cyan=Türkis
hud.msg.purple=Violett
hud.msg.blue=Blau
hud.msg.brown=Braun
hud.msg.green=Grün
hud.msg.red=Rot
hud.msg.black=Schwarz
hud.msg.growth=Wachstum
hud.msg.mature=Erwachsen
hud.msg.off=Aus
hud.msg.on=An
hud.msg.state=Status
hud.msg.delay=Verzögerung
hud.msg.comparator=Komparator
hud.msg.substractor=Substraktor
hud.msg.record=Platte
hud.msg.offers=Angebote
hud.msg.demands=Bedarf
option.appeng.monitorcontent=Monitorinhalt
option.bb.content=Fassinhalt
option.bc.tankamount=Flüssigk.-Menge
option.bc.tanktype=Flüssigk.-Typ
option.enderstorage.colors=Farben
option.ic2.inputeumach=Max EU-Input [Maschinen]
option.ic2.inputeuother=Max EU-Input [Anderes]
option.ic2.inputeu=Max EU-Input
option.ic2.outputeu=Max EU-Output
option.ic2.storage=Energie gespeichert
option.ic2.consump=Zeige Verbrauch
option.ic2.tradeomat=Zeige Tauschautomaten-Forderung
option.thaumcraft.storedvis=Kondensatorspeicher
option.thermalexpansion.energyhandler=Zeige RO-Speicher
option.thermalexpansion.energycell=Zeige EZellen IN/OUT
option.thermalexpansion.fluidtype=Zeige Flüssigk.-Typ
option.thermalexpansion.fluidamount=Zeige Flüssigk.-Menge
option.thermalexpansion.tankmode=Zeige Tankmodus
option.thermalexpansion.tesssendrecv=Tesseraktmodus
option.thermalexpansion.tessfreq=Tesseraktfrequenz
option.thermalexpansion.owner=Zeige Besitzer
option.thermalexpansion.conditemmode=Zeige Itemduktmodus
option.vanilla.spawntype=Spawner-Typ
option.vanilla.growthvalue=Wachstumswert
option.vanilla.leverstate=Hebelstatus
option.vanilla.repeater=Repeater-Verzögerung
option.vanilla.comparator=Komparatormodus
option.vanilla.redstone=Redstone-Stärke
option.vanilla.jukebox=Musikbox-Platte
option.etb.displaydata=Zeige Sockeldaten
option.enderio.inout=Zeige Input/Output
option.enderio.storage=Zeige gespeicherte MJ
option.enderio.owner=Zeige Block-Besitzer
option.enderio.channel=Zeige Hypercube-Kanal
option.bcapi.storage=Zeige gespeicherte MJ
option.bcapi.consump=Zeige maximale Energie
option.bcapi.trigger=Zeige Startenergie
option.pr.showio=Zeige Gatter IO
option.pr.showdata=Zeige Gatterdaten
option.extrautilities.fluidamount=Zeige Flüssigk.-Menge
option.openblocks.fluidamount=Zeige Flüssigk.-Menge
option.railcraft.fluidamount=Zeige Flüssigk.-Menge
+137
View File
@@ -0,0 +1,137 @@
screen.button.waila=Waila
screen.button.modules=Modules
screen.label.scale=Scale
screen.label.dragtuto=Drag the HUD to setup its position.
screen.button.default=Default
screen.button.cancel=Cancel
screen.button.ok=Ok
screen.button.yes=Yes
screen.button.no=No
screen.button.back=Back
screen.button.hidden=Hidden
screen.button.visible=Visible
screen.button.maintained=Maintained
screen.button.toggled=Toggled
choice.showhidewaila=Show/Hide Waila
choice.showhideidmeta=Show ID:Metadata
choice.toggledmaintained=Toggled/Maintained
choice.showliquids=Liquids
screen.button.configureaspect=Configure aspect...
enchant.title.name=Name
enchant.title.minlvl=Min lvl
enchant.title.maxlvl=Max lvl
enchant.title.weight=Weight
enchant.label.enchantability=Enchantability
waila.keybind.wailaconfig=[Waila] Config screen
waila.keybind.wailadisplay=[Waila] Show/Hide
waila.keybind.liquid=[Waila] Show liquids
waila.keybind.recipe=[Waila] Show recipe
waila.keybind.usage=[Waila] Show usage
waila.keybind.testing=[Waila] Testing
client.msg.norecipe=No recipe found.
client.msg.nousage=No usage found.
hud.msg.none=<None>
hud.msg.empty=<Empty>
hud.msg.output=Output
hud.msg.input=Input
hud.msg.out=Out
hud.msg.in=In
hud.msg.power=Power
hud.msg.storage=Storage
hud.msg.stored=Stored
hud.msg.any=Any
hud.msg.mode=Mode
hud.msg.maxpower=Max Power
hud.msg.trigger=Trigger
hud.msg.maxio=Max IO
hud.msg.send=Send
hud.msg.recv=Recv
hud.msg.item=Item
hud.msg.fluid=Fluid
hud.msg.energ=Energy
hud.msg.frequency=Frequency
hud.msg.owner=Owner
hud.msg.public=Public
hud.msg.restricted=Restricted
hud.msg.private=Private
hud.msg.white=White
hud.msg.orange=Orange
hud.msg.magenta=Magenta
hud.msg.lblue=LBlue
hud.msg.yellow=Yellow
hud.msg.lime=Lime
hud.msg.pink=Pink
hud.msg.gray=Gray
hud.msg.lgray=LGray
hud.msg.cyan=Cyan
hud.msg.purple=Purple
hud.msg.blue=Blue
hud.msg.brown=Brown
hud.msg.green=Green
hud.msg.red=Red
hud.msg.black=Black
hud.msg.growth=Growth
hud.msg.mature=Mature
hud.msg.off=Off
hud.msg.on=On
hud.msg.state=State
hud.msg.delay=Delay
hud.msg.comparator=Comparator
hud.msg.substractor=Substractor
hud.msg.record=Record
hud.msg.offers=Offers
hud.msg.demands=Demands
option.appeng.monitorcontent=Monitor's content
option.bb.content=Barrel's content
option.bc.tankamount=Liquid amount
option.bc.tanktype=Liquid type
option.enderstorage.colors=Colors
option.ic2.inputeumach=Max EU input [Machines]
option.ic2.inputeuother=Max EU input [Other]
option.ic2.inputeu=Max EU input
option.ic2.outputeu=Max EU output
option.ic2.storage=Energy stored
option.ic2.consump=Show consumption
option.ic2.tradeomat=Show Trade-O-Mat request
option.thaumcraft.storedvis=Capacitor storage
option.thermalexpansion.energyhandler=Show RF storage
option.thermalexpansion.energycell=Show ECell IN/OUT
option.thermalexpansion.fluidtype=Show fluid type
option.thermalexpansion.fluidamount=Show fluid amount
option.thermalexpansion.tankmode=Show tank mode
option.thermalexpansion.tesssendrecv=Tesseract mode
option.thermalexpansion.tessfreq=Tesseract frequency
option.thermalexpansion.owner=Show owner
option.thermalexpansion.conditemmode=Show Itemduct mode
option.vanilla.spawntype=Spawner type
option.vanilla.growthvalue=Growth value
option.vanilla.leverstate=Lever state
option.vanilla.repeater=Repeater delay
option.vanilla.comparator=Comparator mode
option.vanilla.redstone=Redstone power
option.vanilla.jukebox=Jukebox disk
option.etb.displaydata=Show socket data
option.enderio.inout=Show input/output
option.enderio.storage=Show stored MJ
option.enderio.owner=Show block owner
option.enderio.channel=Show hypercube channel
option.bcapi.storage=Show stored MJ
option.bcapi.consump=Show maximum power
option.bcapi.trigger=Show triggering energy
option.pr.showio=Show gates IO
option.pr.showdata=Show gates data
option.extrautilities.fluidamount=Show fluid amount
option.openblocks.fluidamount=Show fluid amount
option.railcraft.fluidamount=Show fluid amount
+136
View File
@@ -0,0 +1,136 @@
screen.button.waila=Waila
screen.button.modules=Modules
screen.label.scale=Echelle
screen.label.dragtuto=Faites glisser le HUD pour paramétrer la position.
screen.button.default=Défaut
screen.button.cancel=Annuler
screen.button.ok=Ok
screen.button.yes=Oui
screen.button.no=Non
screen.button.back=Retour
screen.button.hidden=Masquer
screen.button.visible=Afficher
screen.button.maintained=Maintenu
screen.button.toggled=Switché
choice.showhidewaila=Afficher/Masquer Waila
choice.showhideidmeta=Afficher ID:Metadata
choice.toggledmaintained= Switché/Maintenu
choice.showliquids=Liquides
screen.button.configureaspect=Configurer l'aspect…
enchant.title.name=Nom
enchant.title.minlvl=Min lvl
enchant.title.maxlvl=Max lvl
enchant.title.weight=Poids
enchant.label.enchantability=Enchantabilitée
waila.keybind.wailaconfig=[Waila] Ecran de config
waila.keybind.wailadisplay=[Waila] Afficher/Masquer
waila.keybind.liquid=[Waila] Afficher les liquides
waila.keybind.recipe=[Waila] Afficher les recettes
waila.keybind.usage=[Waila] Afficher l'utilisation
waila.keybind.testing=[Waila] Test
client.msg.norecipe=Pas de recette trouvée.
client.msg.nousage=Pas d'utilisation trouvée.
hud.msg.none=<Aucun>
hud.msg.empty=<Vide>
hud.msg.output=Sortie
hud.msg.input=Entrée
hud.msg.out=Sortie
hud.msg.in=Entrée
hud.msg.power=Energie
hud.msg.storage=Stockage
hud.msg.stored=Stocké
hud.msg.any=Tout
hud.msg.mode=Mode
hud.msg.maxpower=Max Puissance
hud.msg.trigger=Déclencheur
hud.msg.maxio=Max Entrée/Sortie
hud.msg.send=Envoyer
hud.msg.recv=Recevoir
hud.msg.item=Objet
hud.msg.fluid=Fluide
hud.msg.energ=Energie
hud.msg.frequency=Fréquence
hud.msg.owner=Propriétaire
hud.msg.public=Publique
hud.msg.restricted=Limité
hud.msg.private=Privée
hud.msg.white=Blanc
hud.msg.orange=Orange
hud.msg.magenta=Magenta
hud.msg.lblue=Bleu clair
hud.msg.yellow=Jaune
hud.msg.lime=Vert clair
hud.msg.pink=Rose
hud.msg.gray=Gris
hud.msg.lgray=Gris clair
hud.msg.cyan=Cyan
hud.msg.purple=Violet
hud.msg.blue=Bleu
hud.msg.brown=Marron
hud.msg.green=Vert
hud.msg.red=Rouge
hud.msg.black=Noir
hud.msg.growth=Croissance
hud.msg.mature=Mature
hud.msg.off=Off
hud.msg.on=On
hud.msg.state=Etat
hud.msg.delay=Retard
hud.msg.comparator=Comparateur
hud.msg.substractor=Soustracteur
hud.msg.record=Disque
hud.msg.offers=Offre
hud.msg.demands=Demande
option.appeng.monitorcontent=Contenu des écrans
option.bb.content=Contenu des barils
option.bc.tankamount=Niveau de liquide
option.bc.tanktype=Sorte de liquide
option.enderstorage.colors=Couleurs
option.ic2.inputeumach=Max EU en entrée [Machines]
option.ic2.inputeuother=Max EU en entrée [Autres]
option.ic2.inputeu=Max EU en entrée
option.ic2.outputeu=Max EU en sortie
option.ic2.storage=Energie stockée
option.ic2.consump=Afficher consommation
option.thaumcraft.storedvis=Condensateur de stockage
option.thermalexpansion.energyhandler=Afficher stockage RF
option.thermalexpansion.energycell=Afficher ECell Entrée/Sortie
option.thermalexpansion.fluidtype=Afficher sorte fluides
option.thermalexpansion.fluidamount=Afficher niveau fluides
option.thermalexpansion.tankmode=Afficher mode Réservoir
option.thermalexpansion.tesssendrecv=Tesseract mode
option.thermalexpansion.tessfreq=Tesseract fréquence
option.thermalexpansion.owner=Afficher propriétaire
option.thermalexpansion.conditemmode=Afficher Itemduct mode
option.vanilla.spawntype=Spawner type
option.vanilla.growthvalue=Niveau de croissance
option.vanilla.leverstate=Etat Levier
option.vanilla.repeater=Répeteur retard
option.vanilla.comparator=Comparateur mode
option.vanilla.redstone=Redstone puissance
option.vanilla.jukebox=Jukebox disque
option.etb.displaydata=Afficher données socket
option.enderio.inout=Afficher Entrée/Sortie
option.enderio.storage=Afficher MJ stocké
option.enderio.owner=Afficher propriétaire du bloc
option.enderio.channel=Afficher hypercube canal
option.bcapi.storage=Afficher MJ stocké
option.bcapi.consump=Afficher puissance maximale
option.bcapi.trigger=Energie déclanchement
option.pr.showio=Afficher plaques IO
option.pr.showdata=Afficher plaques data
option.extrautilities.fluidamount=Afficher niveau fluides
option.openblocks.fluidamount=Afficher niveau fluides
option.railcraft.fluidamount=Afficher niveau fluides
+117
View File
@@ -0,0 +1,117 @@
screen.button.waila=Waila
screen.button.modules=Modules
screen.label.scale=Schaal
screen.label.dragtuto=Sleep de HUD om zijn positie in te stellen.
screen.button.default=Standaard
screen.button.cancel=Annuleren
screen.button.ok=Ok
screen.button.yes=Ja
screen.button.no=Nee
screen.button.back=Terug
screen.button.hidden=Verborgen
screen.button.visible=Zichtbaar
screen.button.maintained=Gehandhaafd
screen.button.toggled=Omgeschakeld
choice.showhidewaila=Toon/Verberg Waila
choice.showhideidmeta=Toon ID:Metadata
choice.toggledmaintained=Omgeschakeld/Gehandhaafd
choice.showliquids=Vloeistoffen
screen.button.configureaspect=Configureer aspect...
enchant.title.name=Naam
enchant.title.minlvl=Min lvl
enchant.title.maxlvl=Max lvl
enchant.title.weight=Gewicht
enchant.label.enchantability=Enchantbaarheid
keybind.configscreen=[Waila] Configuratiescherm
keybind.showhide=[Waila] Toon/Verberg
keybind.showliquid=[Waila] Toon vloeistoffen
keybind.showrecipe=[Waila] Toon recepten
keybind.showusage=[Waila] Toon gebruik
keybind.testing=[Waila] Testen
client.msg.norecipe=Geen recept gevonden.
client.msg.nousage=Geen gebruik gevonden.
hud.msg.none=<Geen>
hud.msg.empty=<Leeg>
hud.msg.output=Uitvoer
hud.msg.input=Invoer
hud.msg.out=Uit
hud.msg.in=In
hud.msg.power=Vermogen
hud.msg.storage=Opslag
hud.msg.any=Om het even welke
hud.msg.mode=Modus
hud.msg.send=Zend
hud.msg.recv=Ontv
hud.msg.item=Item
hud.msg.fluid=Vloeistof
hud.msg.energ=Energie
hud.msg.frequency=Frequentie
hud.msg.owner=Eigenaar
hud.msg.public=Publiek
hud.msg.restricted=Begrensd
hud.msg.private=Privé
hud.msg.white=Wit
hud.msg.orange=Oranje
hud.msg.magenta=Magenta
hud.msg.lblue=LBlauw
hud.msg.yellow=Geel
hud.msg.lime=Limoen
hud.msg.pink=Roze
hud.msg.gray=Grijs
hud.msg.lgray=LGrijs
hud.msg.cyan=Cyaan
hud.msg.purple=Paars
hud.msg.blue=Blauw
hud.msg.brown=Bruin
hud.msg.green=Groen
hud.msg.red=Rood
hud.msg.black=Zwart
hud.msg.growth=Groei
hud.msg.mature=Volwassen
hud.msg.off=Af
hud.msg.on=Aan
hud.msg.state=Status
hud.msg.delay=Vertraging
hud.msg.comparator=Vergelijker
hud.msg.substractor=Aftrekker
hud.msg.record=Neem op
option.appeng.monitorcontent=Scherm inhoud
option.bb.content=Ton inhoud
option.bc.tankamount=Vloeistofhoeveelheid
option.bc.tanktype=Vloeistoftype
option.enderstorage.colors=Kleuren
option.ic2.inputeumach=Max EU invoer [Machines]
option.ic2.inputeuother=Max EU invoer [Andere]
option.ic2.inputeu=Max EU invoer
option.ic2.outputeu=Max EU uitvoer
option.ic2.storage=Opgeslagen energie
option.thaumcraft.storedvis=Condensator opslag
option.thermalexpansion.energyhandler=Toon RF opslag
option.thermalexpansion.energycell=Toon ECell IN/UIT
option.thermalexpansion.fluidtype=Toon vloeistoftype
option.thermalexpansion.fluidamount=Toon vloeistofhoeveelheid
option.thermalexpansion.tankmode=Toon tank modus
option.thermalexpansion.tesssendrecv=Tesseract modus
option.thermalexpansion.tessfreq=Tesseract frequentie
option.thermalexpansion.owner=Toon eigenaar
option.vanilla.spawntype=Spawner type
option.vanilla.growthvalue=Groei hoeveelheid
option.vanilla.leverstate=Hendel status
option.vanilla.repeater=Herhaler vertraging
option.vanilla.comparator=Vergelijker modus
option.vanilla.redstone=Redstone vermogen
option.vanilla.jukebox=Jukebox schijf
option.extrautilities.fluidamount=Toon vloeistofhoeveelheid
option.openblocks.fluidamount=Toon vloeistofhoeveelheid
option.railcraft.fluidamount=Toon vloeistofhoeveelheid
+131
View File
@@ -0,0 +1,131 @@
screen.button.waila=Waila
screen.button.modules=Модули
screen.label.scale=Размер
screen.label.dragtuto=Перетащите интерфейс, чтобы изменить позицию.
screen.button.default=По умолчанию
screen.button.cancel=Отмена
screen.button.ok=Ок
screen.button.yes=Да
screen.button.no=Нет
screen.button.back=Назад
screen.button.hidden=Скрывать
screen.button.visible=Показывать
screen.button.maintained=При нажатой клавише
screen.button.toggled=Вкл./Выкл. гор. клавишей
choice.showhidewaila=Показать/Скрыть Waila
choice.showhideidmeta=Показать ID:Метаданные
choice.toggledmaintained=Переключ./Нажатая клав.
choice.showliquids=Жидкости
screen.button.configureaspect=Настроить индикатор...
enchant.title.name=Название
enchant.title.minlvl=Мин. уровень
enchant.title.maxlvl=Макс. уровень
enchant.title.weight=Вес
enchant.label.enchantability=Зачарование
waila.keybind.wailaconfig=[Waila] Меню настроек
waila.keybind.wailadisplay=[Waila] Показать/Скрыть
waila.keybind.liquid=[Waila] Показать жидкости
waila.keybind.recipe=[Waila] Показать рецепт
waila.keybind.usage=[Waila] Показать применение
waila.keybind.testing=[Waila] Тестировать
client.msg.norecipe=Рецептов не найдено.
client.msg.nousage=Применений не найдено.
hud.msg.none=<Ничего>
hud.msg.empty=<Пусто>
hud.msg.output=Вывод
hud.msg.input=Ввод
hud.msg.out=Из
hud.msg.in=В
hud.msg.power=Энергия
hud.msg.storage=Хранилище
hud.msg.any=Всё
hud.msg.mode=Режим
hud.msg.maxpower=Макс. энергия
hud.msg.trigger=Триггер
hud.msg.maxio=Макс. ввод/вывод
hud.msg.send=Передача
hud.msg.recv=Приём
hud.msg.item=Предмет
hud.msg.fluid=Жидкость
hud.msg.energ=Энергия
hud.msg.frequency=Частота
hud.msg.owner=Владелец
hud.msg.public=Публичный
hud.msg.restricted=Ограниченный
hud.msg.private=Приватный
hud.msg.white=Белый
hud.msg.orange=Оранжевый
hud.msg.magenta=Сиреневый
hud.msg.lblue=Светло-синий
hud.msg.yellow=Жёлтый
hud.msg.lime=Светло-зелёный
hud.msg.pink=Розовый
hud.msg.gray=Серый
hud.msg.lgray=Светло-серый
hud.msg.cyan=Бирюзовый
hud.msg.purple=Фиолетовый
hud.msg.blue=Синий
hud.msg.brown=Коричневый
hud.msg.green=Зелёный
hud.msg.red=Красный
hud.msg.black=Чёрный
hud.msg.growth=Рост
hud.msg.mature=Вырос
hud.msg.off=Выкл.
hud.msg.on=Вкл.
hud.msg.state=Статус
hud.msg.delay=Задержка
hud.msg.comparator=Компаратор
hud.msg.substractor=Вычитатель
hud.msg.record=Пластинка
option.appeng.monitorcontent=Содержимое монитора
option.bb.content=Содержимое бочки
option.bc.tankamount=Кол-во жидкости
option.bc.tanktype=Тип жидкости
option.enderstorage.colors=Цвета
option.ic2.inputeumach=Макс. ввод еЭ [Машины]
option.ic2.inputeuother=Макс. ввод еЭ [Другое]
option.ic2.inputeu=Макс. ввод еЭ
option.ic2.outputeu=Макс. вывод еЭ
option.ic2.storage=Заряд энергии
option.thaumcraft.storedvis=Заряд конденсатора
option.thermalexpansion.energyhandler=Показывать заряд заряжателя
option.thermalexpansion.energycell=Показывать Ввод/Вывод Р.батареи
option.thermalexpansion.fluidtype=Показывать тип жидкости
option.thermalexpansion.fluidamount=Показывать кол-во жидкости
option.thermalexpansion.tankmode=Режим цистерны
option.thermalexpansion.tesssendrecv=Режим тессеракта
option.thermalexpansion.tessfreq=Частота тессеракта
option.thermalexpansion.owner=Показывать владельца
option.thermalexpansion.conditemmode=Показывать режим труб
option.vanilla.spawntype=Тип спаунера
option.vanilla.growthvalue=Стадия роста
option.vanilla.leverstate=Положение рычага
option.vanilla.repeater=Задержка повторителя
option.vanilla.comparator=Режим компаратора
option.vanilla.redstone=Сила красного камня
option.vanilla.jukebox=Пластинка в проигрывателе
option.etb.displaydata=Показывать инф. о сокетах
option.enderio.inout=Показывать ввод/вывод
option.enderio.storage=Показывать заряд MJ
option.enderio.owner=Показывать владельца блока
option.enderio.channel=Показывать канал гиперкуба
option.bcapi.storage=Показывать заряд MJ
option.bcapi.consump=Показывать макс. энергию
option.bcapi.trigger=Показывать энергию активации
option.pr.showio=Показывать ввод/вывод схем
option.pr.showdata=Показывать инф. о схемах
option.extrautilities.fluidamount=Показывать кол-во жидкости
option.openblocks.fluidamount=Показывать кол-во жидкости
option.railcraft.fluidamount=Показывать кол-во жидкости
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

+7 -6
View File
@@ -5,12 +5,12 @@ public final class Constants {
public static String BIND_SCREEN_TECH = "showtechtree";
public static String BIND_SCREEN_ENCH = "showenchant";
public static String BIND_WAILA_CFG = "key.wailaconfig";
public static String BIND_WAILA_SHOW = "key.wailadisplay";
public static String BIND_WAILA_LIQUID = "waila.key.liquid";
public static String BIND_WAILA_RECIPE = "waila.key.recipe";
public static String BIND_WAILA_USAGE = "waila.key.usage";
public static String BIND_WAILA_TESTING= "waila.key.testing";
public static String BIND_WAILA_CFG = "waila.keybind.wailaconfig";
public static String BIND_WAILA_SHOW = "waila.keybind.wailadisplay";
public static String BIND_WAILA_LIQUID = "waila.keybind.liquid";
public static String BIND_WAILA_RECIPE = "waila.keybind.recipe";
public static String BIND_WAILA_USAGE = "waila.keybind.usage";
public static String BIND_WAILA_TESTING= "waila.keybind.testing";
public static String CFG_NEI_SHOW = "world.highlight_tips";
public static String BIND_NEI_SHOW = "keys.world.highlight_tips";
@@ -19,6 +19,7 @@ public final class Constants {
public static String CFG_WAILA_MODE = "waila.cfg.showmode";
public static String CFG_WAILA_LIQUID = "waila.cfg.liquid";
public static String CFG_WAILA_METADATA = "waila.cfg.metadata";
public static String CFG_WAILA_KEYBIND = "waila.cfg.keybind";
public static String CFG_WAILA_POSX = "waila.cfg.posx";
public static String CFG_WAILA_POSY = "waila.cfg.posy";
public static String CFG_WAILA_SCALE = "waila.cfg.scale";
@@ -13,6 +13,12 @@ public class WailaExceptionHandler {
public static List<String> handleErr(Throwable e, String className, List<String> currenttip){
if (!errs.contains(className)){
errs.add(className);
for (StackTraceElement elem : e.getStackTrace()){
mod_Waila.log.log(Level.WARNING, String.format("%s.%s:%s",elem.getClassName(), elem.getMethodName(), elem.getLineNumber()));
if (elem.getClassName().contains("waila")) break;
}
mod_Waila.log.log(Level.WARNING, String.format("Catched unhandled exception : [%s] %s",className,e));
}
if (currenttip != null)
@@ -12,8 +12,10 @@ import java.util.logging.Level;
import au.com.bytecode.opencsv.CSVReader;
import net.minecraft.block.Block;
import codechicken.lib.lang.LangUtil;
import codechicken.nei.api.API;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.api.IWailaBlockDecorator;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.IWailaRegistrar;
import mcp.mobius.waila.api.IWailaSummaryProvider;
@@ -32,6 +34,9 @@ public class ExternalModulesHandler implements IWailaRegistrar {
public LinkedHashMap<Class, ArrayList<IWailaDataProvider>> tailBlockProviders = new LinkedHashMap<Class, ArrayList<IWailaDataProvider>>();
public LinkedHashMap<Class, ArrayList<IWailaDataProvider>> stackBlockProviders = new LinkedHashMap<Class, ArrayList<IWailaDataProvider>>();
public LinkedHashMap<Integer, ArrayList<IWailaBlockDecorator>> blockIdDecorators = new LinkedHashMap<Integer, ArrayList<IWailaBlockDecorator>>();
public LinkedHashMap<Class, ArrayList<IWailaBlockDecorator>> blockClassDecorators = new LinkedHashMap<Class, ArrayList<IWailaBlockDecorator>>();
public LinkedHashMap<String, LinkedHashMap <String, LinkedHashMap <String, String>>> wikiDescriptions = new LinkedHashMap<String, LinkedHashMap <String, LinkedHashMap <String, String>>>();
public LinkedHashMap<Class, ArrayList<IWailaSummaryProvider>> summaryProviders = new LinkedHashMap<Class, ArrayList<IWailaSummaryProvider>>();
@@ -48,12 +53,22 @@ public class ExternalModulesHandler implements IWailaRegistrar {
@Override
public void addConfig(String modname, String key, String configname) {
ConfigHandler.instance().addConfig(modname, key, configname);
ConfigHandler.instance().addConfig(modname, key, LangUtil.translateG(configname));
}
@Override
public void addConfigRemote(String modname, String key, String configname) {
ConfigHandler.instance().addConfigServer(modname, key, configname);
ConfigHandler.instance().addConfigServer(modname, key, LangUtil.translateG(configname));
}
@Override
public void addConfig(String modname, String key) {
ConfigHandler.instance().addConfig(modname, key, LangUtil.translateG("option." + key));
}
@Override
public void addConfigRemote(String modname, String key) {
ConfigHandler.instance().addConfigServer(modname, key, LangUtil.translateG("option." + key));
}
@Override
@@ -121,6 +136,20 @@ public class ExternalModulesHandler implements IWailaRegistrar {
this.summaryProviders.get(item).add(dataProvider);
}
@Override
public void registerBlockDecorator(IWailaBlockDecorator decorator, int blockID) {
if (!this.blockIdDecorators.containsKey(blockID))
this.blockIdDecorators.put(blockID, new ArrayList<IWailaBlockDecorator>());
this.blockIdDecorators.get(blockID).add(decorator);
}
@Override
public void registerBlockDecorator(IWailaBlockDecorator decorator, Class block) {
if (!this.blockClassDecorators.containsKey(block))
this.blockClassDecorators.put(block, new ArrayList<IWailaBlockDecorator>());
this.blockClassDecorators.get(block).add(decorator);
}
/* Arrays getters */
public ArrayList<IWailaDataProvider> getHeadProviders(int blockID) {
@@ -175,6 +204,19 @@ public class ExternalModulesHandler implements IWailaRegistrar {
return returnList;
}
public ArrayList<IWailaBlockDecorator> getBlockDecorators(int blockID){
return this.blockIdDecorators.get(blockID);
}
public ArrayList<IWailaBlockDecorator> getBlockDecorators(Object block){
ArrayList<IWailaBlockDecorator> returnList = new ArrayList<IWailaBlockDecorator>();
for (Class clazz : this.blockClassDecorators.keySet())
if (clazz.isInstance(block))
returnList.addAll(this.blockClassDecorators.get(clazz));
return returnList;
}
/* Providers querry methods */
public boolean hasHeadProviders(int blockID){
@@ -218,6 +260,18 @@ public class ExternalModulesHandler implements IWailaRegistrar {
return this.summaryProviders.containsKey(item);
}
public boolean hasBlockDecorator(int blockID){
return this.blockIdDecorators.containsKey(blockID);
}
public boolean hasBlockDecorator(Object block){
for (Class clazz : this.blockClassDecorators.keySet())
if (clazz.isInstance(block))
return true;
return false;
}
/* ----------------- */
@Override
public void registerDocTextFile(String filename) {
List<String[]> docData = null;
@@ -4,6 +4,7 @@ import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.logging.Level;
import codechicken.lib.lang.LangUtil;
import net.minecraftforge.common.ForgeDirection;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ExternalModulesHandler;
@@ -36,7 +37,7 @@ public class AppEngModule {
}
mod_Waila.log.log(Level.INFO, "AppEng mod found.");
ExternalModulesHandler.instance().addConfig("Applied Energetic", "appeng.monitorcontent", "Monitor's content");
ExternalModulesHandler.instance().addConfig("Applied Energetic", "appeng.monitorcontent");
ExternalModulesHandler.instance().registerBodyProvider(new HUDAppEngMonitor(), TileStorageMonitor);
}
}
@@ -3,6 +3,7 @@ package mcp.mobius.waila.addons.appeng;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import codechicken.lib.lang.LangUtil;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import mcp.mobius.waila.api.IWailaConfigHandler;
@@ -31,7 +32,7 @@ public class HUDAppEngMonitor implements IWailaDataProvider {
if (stack != null)
currenttip.add(stack.getDisplayName());
else
currenttip.add("<None>");
currenttip.add(LangUtil.translateG("hud.msg.none"));
} catch (Exception e) {
System.out.printf("%s\n", e);
}
@@ -6,7 +6,7 @@ import java.util.logging.Level;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ExternalModulesHandler;
import mcp.mobius.waila.addons.buildcraft.HUDHandlerBCPipes;
import codechicken.lib.lang.LangUtil;
import codechicken.nei.api.API;
import codechicken.nei.api.ItemInfo;
@@ -33,7 +33,7 @@ public class BetterBarrelsModule {
if (IBarrelStorage_getItem != null){
mod_Waila.log.log(Level.INFO, "Waila module BetterBarrel succefully hooked.");
ExternalModulesHandler.instance().addConfig("BetterBarrels", "bb.content", "Barrel's content");
ExternalModulesHandler.instance().addConfig("BetterBarrels", "bb.content");
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerBBContent(), TileEntityBarrel);
}
}
@@ -15,6 +15,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import codechicken.lib.lang.LangUtil;
import codechicken.nei.api.API;
import codechicken.nei.api.ItemInfo;
import codechicken.nei.api.ItemInfo.Layout;
@@ -50,7 +51,7 @@ public class HUDHandlerBBContent implements IWailaDataProvider {
if (stack != null){
currenttip.add(stack.getDisplayName());
} else {
currenttip.add("<Empty>");
currenttip.add(LangUtil.translateG("hud.msg.empty"));
}
}
return currenttip;
@@ -16,7 +16,6 @@ public class BCModule {
public static Class TileEngine = null;
public static Method TileTank_getTankInfo = null;
//public static Method IPowerReceptor_PowerRequest = null;
public static void register(){
try {
@@ -29,13 +28,7 @@ public class BCModule {
try{
TileTank = Class.forName("buildcraft.factory.TileTank");
IPowerReceptor = Class.forName("buildcraft.api.power.IPowerReceptor");
PipeTransportPower = Class.forName("buildcraft.transport.PipeTransportPower");
TileGenericPipe = Class.forName("buildcraft.transport.TileGenericPipe");
TileEngine = Class.forName("buildcraft.energy.TileEngine");
TileTank_getTankInfo = TileTank.getMethod("getTankInfo", ForgeDirection.class);
//IPowerReceptor_PowerRequest = IPowerReceptor.getMethod("powerRequest", ForgeDirection.class);
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.WARNING, "[BC] Class not found. " + e);
@@ -45,14 +38,10 @@ public class BCModule {
return;
}
ExternalModulesHandler.instance().addConfig("Buildcraft", "bc.tankamount", "Liquid amount");
ExternalModulesHandler.instance().addConfig("Buildcraft", "bc.tanktype", "Liquid type");
//ExternalModulesHandler.instance().addConfigRemote("Buildcraft", "bc.powerpipe", "Power pipes");
ExternalModulesHandler.instance().addConfig("Buildcraft", "bc.tankamount");
ExternalModulesHandler.instance().addConfig("Buildcraft", "bc.tanktype");
ExternalModulesHandler.instance().registerHeadProvider(new HUDHandlerBCTanks(), TileTank);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerBCTanks(), TileTank);
//ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerBCPipes(), TileGenericPipe);
//ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerBCEngine(), TileEngine);
//ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerBCIPowerReceptor(), PipeTransportPower);
}
}
@@ -0,0 +1,79 @@
package mcp.mobius.waila.addons.buildcraft;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.logging.Level;
import net.minecraftforge.common.ForgeDirection;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ExternalModulesHandler;
public class BCPowerAPIModule {
public static Class PowerHandler = null;
public static Method PH_getMinEnergyReceived = null;
public static Method PH_getMaxEnergyReceived = null;
public static Method PH_getMaxEnergyStored = null;
public static Method PH_getEnergyStored = null;
public static Method PH_getActivationEnergy = null;
public static Class IPowerReceptor = null;
public static Method IPowerReceptor_getPowerReceiver = null;
public static Class PowerReceiver = null;
public static Method PR_getMinEnergyReceived = null;
public static Method PR_getMaxEnergyReceived = null;
public static Method PR_getMaxEnergyStored = null;
public static Method PR_getEnergyStored = null;
public static Method PR_getActivationEnergy = null;
public static void register(){
try{
Class ModClass = Class.forName("buildcraft.api.power.IPowerReceptor");
mod_Waila.log.log(Level.INFO, "Buildcraft Power API found.");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.INFO, "[Buildcraft Power API] Buildcraft Power API mod not found.");
return;
}
try{
PowerHandler = Class.forName("buildcraft.api.power.PowerHandler");
PH_getMinEnergyReceived = PowerHandler.getMethod("getMinEnergyReceived");
PH_getMaxEnergyReceived = PowerHandler.getMethod("getMaxEnergyReceived");
PH_getMaxEnergyStored = PowerHandler.getMethod("getMaxEnergyStored");
PH_getEnergyStored = PowerHandler.getMethod("getEnergyStored");
PH_getActivationEnergy = PowerHandler.getMethod("getActivationEnergy");
IPowerReceptor = Class.forName("buildcraft.api.power.IPowerReceptor");
IPowerReceptor_getPowerReceiver = IPowerReceptor.getMethod("getPowerReceiver", ForgeDirection.class);
PowerReceiver = Class.forName("buildcraft.api.power.PowerHandler$PowerReceiver");
PR_getMinEnergyReceived = PowerReceiver.getMethod("getMinEnergyReceived");
PR_getMaxEnergyReceived = PowerReceiver.getMethod("getMaxEnergyReceived");
PR_getMaxEnergyStored = PowerReceiver.getMethod("getMaxEnergyStored");
PR_getEnergyStored = PowerReceiver.getMethod("getEnergyStored");
PR_getActivationEnergy = PowerReceiver.getMethod("getActivationEnergy");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Class not found. " + e);
return;
} catch (NoSuchMethodException e){
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Method not found." + e);
return;
// } catch (NoSuchFieldException e){
// mod_Waila.log.log(Level.WARNING, "[EnderStorage] Field not found." + e);
// return;
} catch (Exception e){
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Unhandled exception." + e);
return;
}
ExternalModulesHandler.instance().addConfigRemote("BuildcraftAPI", "bcapi.storage");
ExternalModulesHandler.instance().addConfig("BuildcraftAPI", "bcapi.consump");
ExternalModulesHandler.instance().addConfig("BuildcraftAPI", "bcapi.trigger");
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerIPowerReceptor(), IPowerReceptor);
}
}
@@ -1,56 +0,0 @@
package mcp.mobius.waila.addons.buildcraft;
import java.util.List;
import java.util.Map;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.tools.Reflect;
public class HUDHandlerBCPipes implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
NBTTagCompound tag = accessor.getNBTData();
if (this.hasPartialKey(tag, "internalNextPower") && config.getConfig("bc.powerpipe")){
double power = Math.max(0, this.getPartialKeySum(tag, "internalNextPower"));
currenttip.add(String.format("Power : %.1f MJ", power));
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
public boolean hasPartialKey(NBTTagCompound tag, String key){
Map tagMap = (Map)Reflect.getFieldValue("net.minecraft.nbt.NBTTagCompound", "tagMap", tag);
for (Object k : tagMap.keySet())
if (((String)k).contains(key))
return true;
return false;
}
public double getPartialKeySum(NBTTagCompound tag, String key){
double retVal = 0;
Map tagMap = (Map)Reflect.getFieldValue("net.minecraft.nbt.NBTTagCompound", "tagMap", tag);
for (Object k : tagMap.keySet())
if (((String)k).contains(key))
retVal += tag.getDouble((String)k);
return retVal;
}
}
@@ -9,6 +9,8 @@ import java.util.logging.Level;
import codechicken.lib.lang.LangUtil;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ConfigHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
@@ -39,7 +41,7 @@ public class HUDHandlerBCTanks implements IWailaDataProvider {
if (stack != null && ConfigHandler.instance().getConfig("bc.tanktype"))
name = name + " (" + stack.getFluid().getName() + ")";
else if (stack == null && ConfigHandler.instance().getConfig("bc.tanktype"))
name = name + " <Empty>";
name = name + " " + LangUtil.translateG("hud.msg.empty");
currenttip.set(0, name);
return currenttip;
}
@@ -0,0 +1,76 @@
package mcp.mobius.waila.addons.buildcraft;
import java.util.List;
import codechicken.lib.lang.LangUtil;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ForgeDirection;
import mcp.mobius.waila.WailaExceptionHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerIPowerReceptor implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
try{
String maxPowerStr = LangUtil.translateG("hud.msg.maxpower");
String triggerStr = LangUtil.translateG("hud.msg.trigger");
Object powerReceiver = BCPowerAPIModule.IPowerReceptor_getPowerReceiver.invoke(accessor.getTileEntity(), ForgeDirection.UNKNOWN);
if (powerReceiver != null){
Float minEnergyRecv = (Float)BCPowerAPIModule.PR_getMinEnergyReceived.invoke(powerReceiver);
Float maxEnergyRecv = (Float)BCPowerAPIModule.PR_getMaxEnergyReceived.invoke(powerReceiver);
Float activation = (Float)BCPowerAPIModule.PR_getActivationEnergy.invoke(powerReceiver);
if(accessor.getNBTData().hasKey("powerProvider") && accessor.getNBTData().getCompoundTag("powerProvider").hasKey("storedEnergy") && config.getConfig("bcapi.storage")){
Float energyStored = (Float)accessor.getNBTData().getCompoundTag("powerProvider").getFloat("storedEnergy");
Float maxEnergyStor = (Float)BCPowerAPIModule.PR_getMaxEnergyStored.invoke(powerReceiver);
if (maxEnergyStor != 0.0f)
currenttip.add(String.format("%.1f / %.1f MJ", energyStored, maxEnergyStor));
}
if(accessor.getNBTData().hasKey("storedEnergy") && config.getConfig("bcapi.storage")){
Float energyStored = (Float)accessor.getNBTData().getFloat("storedEnergy");
Float maxEnergyStor = (Float)BCPowerAPIModule.PR_getMaxEnergyStored.invoke(powerReceiver);
if (maxEnergyStor != 0.0f)
currenttip.add(String.format("%.1f / %.1f MJ", energyStored, maxEnergyStor));
}
if (maxEnergyRecv != 0.0f && config.getConfig("bcapi.consump"))
//currenttip.add(String.format("Min/Max Input : %.1f / %.1f MJ/t", minEnergyRecv, maxEnergyRecv));
currenttip.add(String.format("%s : %.1f MJ/t", maxPowerStr, maxEnergyRecv));
if (activation != 0.0f && config.getConfig("bcapi.trigger"))
currenttip.add(String.format("%s : %.1f MJ", triggerStr, activation));
}
} catch (Exception e) {
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -0,0 +1,64 @@
package mcp.mobius.waila.addons.enderio;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.logging.Level;
import net.minecraftforge.common.ForgeDirection;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ExternalModulesHandler;
public class EnderIOModule {
public static Class TileCapacitorBank = null;
public static Method TCB_getMaxInput = null;
public static Method TCB_getMaxOutput = null;
public static Method TCB_getEnergyStored = null;
public static Method TCB_getMaxEnergyStored = null;
public static Method TCB_getMaxIO = null;
public static Class TileTesseract = null;
public static void register(){
try{
Class ModClass = Class.forName("crazypants.enderio.EnderIO");
mod_Waila.log.log(Level.INFO, "EnderIO mod found.");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.INFO, "[EnderIO] EnderIO mod not found.");
return;
}
try{
TileCapacitorBank = Class.forName("crazypants.enderio.machine.power.TileCapacitorBank");
TCB_getEnergyStored = TileCapacitorBank.getMethod("getEnergyStored");
TCB_getMaxInput = TileCapacitorBank.getMethod("getMaxInput");
TCB_getMaxOutput = TileCapacitorBank.getMethod("getMaxOutput");
TCB_getMaxEnergyStored = TileCapacitorBank.getMethod("getMaxEnergyStored");
TCB_getMaxIO = TileCapacitorBank.getMethod("getMaxIO");
TileTesseract = Class.forName("crazypants.enderio.machine.hypercube.TileHyperCube");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Class not found. " + e);
return;
} catch (NoSuchMethodException e){
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Method not found." + e);
return;
// } catch (NoSuchFieldException e){
// mod_Waila.log.log(Level.WARNING, "[EnderStorage] Field not found." + e);
// return;
} catch (Exception e){
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Unhandled exception." + e);
return;
}
ExternalModulesHandler.instance().addConfig("EnderIO", "enderio.inout");
ExternalModulesHandler.instance().addConfig("EnderIO", "enderio.storage");
ExternalModulesHandler.instance().addConfig("EnderIO", "enderio.owner");
ExternalModulesHandler.instance().addConfig("EnderIO", "enderio.channel");
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerCapacitor(), TileCapacitorBank);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerTesseract(), TileTesseract);
}
}
@@ -0,0 +1,61 @@
package mcp.mobius.waila.addons.enderio;
import java.util.List;
import codechicken.lib.lang.LangUtil;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.WailaExceptionHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerCapacitor implements IWailaDataProvider{
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
try{
String maxIOStr = LangUtil.translateG("hud.msg.maxio");
String inputStr = LangUtil.translateG("hud.msg.input");
String outputStr = LangUtil.translateG("hud.msg.output");
Integer maxEnergyStored = (Integer)EnderIOModule.TCB_getMaxEnergyStored.invoke(accessor.getTileEntity());
Float energyStored = (Float)EnderIOModule.TCB_getEnergyStored.invoke(accessor.getTileEntity());
Integer maxIO = (Integer)EnderIOModule.TCB_getMaxIO.invoke(accessor.getTileEntity());
Integer maxInput = (Integer)EnderIOModule.TCB_getMaxInput.invoke(accessor.getTileEntity());
Integer maxOutput = (Integer)EnderIOModule.TCB_getMaxOutput.invoke(accessor.getTileEntity());
if (config.getConfig("enderio.storage"))
currenttip.add(String.format("%.1f / %d MJ", energyStored, maxEnergyStored));
if (config.getConfig("enderio.inout")){
currenttip.add(String.format("%s : %d MJ/t ", maxIOStr, maxIO));
currenttip.add(String.format("%s : %d MJ/t ", inputStr, maxInput));
currenttip.add(String.format("%s : %d MJ/t ", outputStr, maxOutput));
}
} catch (Exception e) {
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -0,0 +1,63 @@
package mcp.mobius.waila.addons.enderio;
import java.util.List;
import codechicken.lib.lang.LangUtil;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerTesseract implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
String channel = "%s : \u00a7f%s\u00a7r %s";
String freq;
String frequser;
String owner;
if (config.getConfig("enderio.channel")){
if (accessor.getNBTData().hasKey("channelName")){
freq = accessor.getNBTData().getString("channelName");
if (accessor.getNBTData().hasKey("channelUser"))
frequser = "[ \u00a7f" + accessor.getNBTData().getString("channelUser") + " \u00a7r]";
else
frequser = "[ \u00a7f" + LangUtil.translateG("hud.msg.public") + " \u00a7r]";
}
else{
freq = LangUtil.translateG("hud.msg.none");
frequser = "";
}
currenttip.add(String.format(channel, LangUtil.translateG("hud.msg.frequency"), freq, frequser));
}
if (config.getConfig("enderio.owner")){
if (accessor.getNBTData().hasKey("owner"))
currenttip.add(String.format("%s : \u00a7f%s", LangUtil.translateG("hud.msg.owner"), accessor.getNBTData().getString("owner")));
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -15,6 +15,8 @@ public class EnderStorageModule {
public static Class EnderStorageManager = null;
public static Method GetColourFromFreq = null;
public static Class TileEnderTank = null;
public static void register(){
try{
Class EnderStorage = Class.forName("codechicken.enderstorage.EnderStorage");
@@ -32,6 +34,8 @@ public class EnderStorageModule {
EnderStorageManager = Class.forName("codechicken.enderstorage.api.EnderStorageManager");
GetColourFromFreq = EnderStorageManager.getDeclaredMethod("getColourFromFreq", Integer.TYPE, Integer.TYPE);
TileEnderTank = Class.forName("codechicken.enderstorage.storage.liquid.TileEnderTank");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Class not found. " + e);
return;
@@ -46,7 +50,7 @@ public class EnderStorageModule {
return;
}
ExternalModulesHandler.instance().addConfig("EnderStorage", "enderstorage.colors", "Colors");
ExternalModulesHandler.instance().addConfig("EnderStorage", "enderstorage.colors");
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerStorage(), TileFrequencyOwner);
}
}
@@ -2,6 +2,7 @@ package mcp.mobius.waila.addons.enderstorage;
import java.util.List;
import codechicken.lib.lang.LangUtil;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.WailaExceptionHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
@@ -10,7 +11,24 @@ import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerStorage implements IWailaDataProvider {
private static String[] colors = {"White", "Orange", "Magenta", "LBlue", "Yellow", "Lime", "Pink", "Gray", "LGray", "Cyan", "Purple", "Blue", "Brown", "Green", "Red", "Black"};
private static String[] colors = {
LangUtil.translateG("hud.msg.white"),
LangUtil.translateG("hud.msg.orange"),
LangUtil.translateG("hud.msg.magenta"),
LangUtil.translateG("hud.msg.lblue"),
LangUtil.translateG("hud.msg.yellow"),
LangUtil.translateG("hud.msg.lime"),
LangUtil.translateG("hud.msg.pink"),
LangUtil.translateG("hud.msg.gray"),
LangUtil.translateG("hud.msg.lgray"),
LangUtil.translateG("hud.msg.cyan"),
LangUtil.translateG("hud.msg.purple"),
LangUtil.translateG("hud.msg.blue"),
LangUtil.translateG("hud.msg.brown"),
LangUtil.translateG("hud.msg.green"),
LangUtil.translateG("hud.msg.red"),
LangUtil.translateG("hud.msg.black")
};
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
@@ -26,12 +44,18 @@ public class HUDHandlerStorage implements IWailaDataProvider {
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if(config.getConfig("enderstorage.colors")){
try{
int freq = EnderStorageModule.TileFrequencyOwner_Freq.getInt(accessor.getTileEntity());
int freqLeft = (Integer)EnderStorageModule.GetColourFromFreq.invoke(null, freq, 0);
int freqCenter = (Integer)EnderStorageModule.GetColourFromFreq.invoke(null, freq, 1);
int freqRight = (Integer)EnderStorageModule.GetColourFromFreq.invoke(null, freq, 2);
currenttip.add(String.format("%s/%s/%s", colors[freqLeft], colors[freqCenter], colors[freqRight]));
if (!EnderStorageModule.TileEnderTank.isInstance(accessor.getTileEntity()))
currenttip.add(String.format("%s/%s/%s", colors[freqLeft], colors[freqCenter], colors[freqRight]));
else
currenttip.add(String.format("%s/%s/%s", colors[freqRight], colors[freqCenter], colors[freqLeft]));
} catch (Exception e){
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
@@ -0,0 +1,83 @@
package mcp.mobius.waila.addons.etb;
import java.lang.reflect.Field;
import java.util.logging.Level;
import net.minecraft.item.Item;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ExternalModulesHandler;
public class ETBModule {
public static Class TileSocket = null;
public static Field Socket_sides = null;
public static Field Socket_configs = null;
//public static Field Socket_sideID = null;
//public static Field Socket_sideMeta = null;
//public static Field Socket_facID = null;
//public static Field Socket_facMeta = null;
public static Class SocketsMod = null;
public static Field module = null;
public static Class SideConfig = null;
public static Field SC_tank = null;
public static Field SC_inventory = null;
public static Field SC_rsControl = null;
public static Field SC_rsLatch = null;
public static void register(){
try{
Class ModClass = Class.forName("emasher.sockets.TileSocket");
mod_Waila.log.log(Level.INFO, "Engineer Toolbox mod found.");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.INFO, "[Engineer Toolbox] Engineer Toolbox mod not found.");
return;
}
try{
TileSocket = Class.forName("emasher.sockets.TileSocket");
Socket_sides = TileSocket.getField("sides");
Socket_configs = TileSocket.getField("configs");
//Socket_sideID = TileSocket.getField("sideID");
//Socket_sideMeta = TileSocket.getField("sideMeta");
//Socket_facID = TileSocket.getField("facID");
//Socket_facMeta = TileSocket.getField("facMeta");
SocketsMod = Class.forName("emasher.sockets.SocketsMod");
module = SocketsMod.getField("module");
//module = (Item)SocketsMod.getField("module").get(null);
/*
if (module == null){
mod_Waila.log.log(Level.WARNING, "[Engineer Toolbox] module field is null !");
return;
}
*/
SideConfig = Class.forName("emasher.api.SideConfig");
SC_tank = SideConfig.getField("tank");
SC_inventory = SideConfig.getField("inventory");
SC_rsControl = SideConfig.getField("rsControl");
SC_rsLatch = SideConfig.getField("rsLatch");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.WARNING, "[Engineer Toolbox] Class not found. " + e);
return;
// } catch (NoSuchMethodException e){
// mod_Waila.log.log(Level.WARNING, "[Engineer Toolbox] Method not found." + e);
// return;
} catch (NoSuchFieldException e){
mod_Waila.log.log(Level.WARNING, "[Engineer Toolbox] Field not found." + e);
return;
} catch (Exception e){
mod_Waila.log.log(Level.WARNING, "[Engineer Toolbox] Unhandled exception." + e);
return;
}
ExternalModulesHandler.instance().addConfig("Engineer Toolbox", "etb.displaydata");
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerSocket(), TileSocket);
}
}
@@ -0,0 +1,104 @@
package mcp.mobius.waila.addons.etb;
import java.util.Arrays;
import java.util.List;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ForgeDirection;
import mcp.mobius.waila.WailaExceptionHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerSocket implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("etb.displaydata")) return currenttip;
try {
int[] sides = (int[])ETBModule.Socket_sides.get(accessor.getTileEntity());
Object[] configs = (Object[])ETBModule.Socket_configs.get(accessor.getTileEntity());
Item module = (Item)ETBModule.module.get(null);
for( int s = 0; s < 6; s++){
if (sides[s] != 0){
int tank = (Integer)ETBModule.SC_tank.get(configs[s]);
int inventory = (Integer)ETBModule.SC_inventory.get(configs[s]);
boolean[] rsControl = (boolean[])ETBModule.SC_rsControl.get(configs[s]);
boolean[] rsLatch = (boolean[])ETBModule.SC_rsLatch.get(configs[s]);
ItemStack stack = new ItemStack(module, 1, sides[s]);
String tipstr = String.format("%-5s : %s ", ForgeDirection.getOrientation(s), stack.getDisplayName());
String configstr = "[ ";
if (tank != -1)
configstr += "\u00a79" + String.valueOf(tank) + " ";
if (inventory != -1)
configstr += "\u00a7a" + String.valueOf(inventory) + " ";
if (rsControl[0] || rsControl[1] || rsControl[2]){
configstr += "\u00a7c";
configstr += rsControl[0] ? "1" : "0";
configstr += rsControl[1] ? "1" : "0";
configstr += rsControl[2] ? "1" : "0";
configstr += " ";
}
if (rsLatch[0] || rsLatch[1] || rsLatch[2]){
configstr += "\u00a75";
configstr += rsLatch[0] ? "1" : "0";
configstr += rsLatch[1] ? "1" : "0";
configstr += rsLatch[2] ? "1" : "0";
configstr += " ";
}
configstr += "\u00a7r]";
if (!configstr.equals("[ \u00a7r]"))
tipstr += " " + configstr;
/*
if ((tank != -1) && (inventory != -1))
tipstr += String.format("[ \u00a79%d \u00a7a%d \u00a7r]", tank, inventory);
else if (tank != -1)
tipstr += String.format("[ \u00a79%d \u00a7r]", tank);
else if (inventory != -1)
tipstr += String.format("[ \u00a7a%d \u00a7r]", inventory);
*/
currenttip.add(tipstr);
}
}
} catch (Exception e) {
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -0,0 +1,34 @@
package mcp.mobius.waila.addons.exu;
import java.util.logging.Level;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ExternalModulesHandler;
public class ExtraUtilitiesModule {
public static Class ModExtraUtilities = null;
public static Class TileEntityDrum = null;
public static void register(){
try{
Class ModExtraUtilities = Class.forName("extrautils.ExtraUtils");
mod_Waila.log.log(Level.INFO, "ExtraUtilities mod found.");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.INFO, "[ExtraUtilities] ExtraUtilities mod not found.");
return;
}
try{
TileEntityDrum = Class.forName("extrautils.tileentity.TileEntityDrum");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.WARNING, "[ExtraUtilities] Class not found. " + e);
return;
}
ExternalModulesHandler.instance().addConfigRemote("ExtraUtilities", "extrautilities.fluidamount");
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerDrum(), TileEntityDrum);
}
}
@@ -0,0 +1,53 @@
package mcp.mobius.waila.addons.exu;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerDrum implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("extrautilities.fluidamount")) return currenttip;
int amount = 0;
NBTTagCompound subtag = accessor.getNBTData().getCompoundTag("tank");
if (subtag.hasKey("Amount"))
amount = accessor.getNBTInteger(subtag, "Amount");
IFluidHandler handler = (IFluidHandler)accessor.getTileEntity();
if (handler == null) return currenttip;
FluidTankInfo[] tanks = handler.getTankInfo(ForgeDirection.UNKNOWN);
if (tanks.length != 1) return currenttip;
currenttip.add(String.format("%d / %d mB", amount, tanks[0].capacity));
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -1,32 +0,0 @@
package mcp.mobius.waila.addons.ic2;
import java.util.List;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerDoor implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return IC2Module.ReinforcedDoorStack;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -1,88 +0,0 @@
package mcp.mobius.waila.addons.ic2;
import java.util.List;
import java.util.logging.Level;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ConfigHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
public class HUDHandlerIC2IEnergySink implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
//if (accessor.getTileEntity() != null && TEElectricBlock.isInstance(accessor.getTileEntity())){
int maxinput = -1;
try{
if (IC2Module.IEnergySink.isInstance(accessor.getTileEntity()))
maxinput = (Integer)(IC2Module.IEnergySink_GetInput.invoke(IC2Module.IEnergySink.cast(accessor.getTileEntity())));
} catch (Exception e){
mod_Waila.log.log(Level.SEVERE, "[IC2] Unhandled exception trying to access an IEnergySink for display !.\n" + String.valueOf(e));
return currenttip;
}
int ntransformers = this.getTransformerUpgrades(accessor);
if (ntransformers > 0){
maxinput = maxinput * (int)Math.pow(4.0D, Math.min(3, ntransformers));
}
if (ConfigHandler.instance().getConfig("ic2.inputeuother") && (maxinput > 4096))
currenttip.add("IN : ANY");
else if (ConfigHandler.instance().getConfig("ic2.inputeuother") && (maxinput != -1) && !this.canUpgrade(accessor.getNBTData()))
currenttip.add(String.format("IN : %s EU/t", maxinput));
else if (ConfigHandler.instance().getConfig("ic2.inputeumach") && (maxinput != -1) && this.canUpgrade(accessor.getNBTData()))
currenttip.add(String.format("IN : %s EU/t", maxinput));
if (config.getConfig("ic2.storage"))
if (accessor.getNBTData().hasKey("energy") && !IC2Module.IEnergyStorage.isInstance(accessor.getTileEntity()))
currenttip.add(String.format("Storage : %s EU", accessor.getNBTInteger(accessor.getNBTData(), "energy")));
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
public boolean canUpgrade(NBTTagCompound tag){
if (tag.hasKey("InvSlots"))
if (tag.getCompoundTag("InvSlots").hasKey("upgrade"))
return true;
return false;
}
public int getTransformerUpgrades(IWailaDataAccessor accessor){
NBTTagCompound tag = accessor.getNBTData();
if (!canUpgrade(tag)) return -1;
int ntransformers = 0;
NBTTagList contents = tag.getCompoundTag("InvSlots").getCompoundTag("upgrade").getTagList("Contents");
for (NBTTagCompound subtag : (List<NBTTagCompound>)contents.tagList){
ItemStack currentSlot = new ItemStack(accessor.getNBTInteger(subtag, "id"),accessor.getNBTInteger(subtag, "Count"),accessor.getNBTInteger(subtag, "Damage"));
if (IC2Module.TransformerUpgradeStack.isItemEqual(currentSlot)){
ntransformers += currentSlot.stackSize;
}
}
return ntransformers;
}
}
@@ -1,52 +0,0 @@
package mcp.mobius.waila.addons.ic2;
import java.util.List;
import java.util.logging.Level;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ConfigHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import net.minecraft.item.ItemStack;
public class HUDHandlerIC2IEnergySource implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
//if (accessor.getTileEntity() != null && TEElectricBlock.isInstance(accessor.getTileEntity())){
int output = -1;
try{
if (IC2Module.IEnergySource.isInstance(accessor.getTileEntity()))
output = (Integer)(IC2Module.IEnergySource_GetOutput.invoke(IC2Module.IEnergySource.cast(accessor.getTileEntity())));
} catch (Exception e){
mod_Waila.log.log(Level.SEVERE, "[IC2] Unhandled exception trying to access an IEnergySource for display !.\n" + String.valueOf(e));
return currenttip;
}
if (ConfigHandler.instance().getConfig("ic2.outputeu") && (output != -1))
currenttip.add(String.format("OUT : %s EU/t", output));
if (config.getConfig("ic2.storage"))
if (accessor.getNBTData().hasKey("storage") && !IC2Module.IEnergyStorage.isInstance(accessor.getTileEntity()))
currenttip.add(String.format("Storage : %s EU", accessor.getNBTInteger(accessor.getNBTData(), "storage")));
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -1,52 +0,0 @@
package mcp.mobius.waila.addons.ic2;
import java.util.List;
import java.util.logging.Level;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import net.minecraft.item.ItemStack;
public class HUDHandlerIC2IEnergyStorage implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("ic2.storage"))
return currenttip;
int stored = -1;
int capacity = -1;
try{
if (IC2Module.IEnergyStorage.isInstance(accessor.getTileEntity()))
capacity = (Integer)(IC2Module.IEnergyStorage_GetCapacity.invoke(IC2Module.IEnergyStorage.cast(accessor.getTileEntity())));
} catch (Exception e){
mod_Waila.log.log(Level.SEVERE, "[IC2] Unhandled exception trying to access an IEnergyStorage for display !.\n" + String.valueOf(e));
return currenttip;
}
if (accessor.getNBTData().hasKey("energy"))
stored = accessor.getNBTInteger(accessor.getNBTData(), "energy");
if ((capacity != -1) && (stored != -1))
currenttip.add(String.format("%s/%s EU", stored, capacity));
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -0,0 +1,76 @@
package mcp.mobius.waila.addons.ic2;
import java.util.List;
import codechicken.lib.lang.LangUtil;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.WailaExceptionHandler;
import mcp.mobius.waila.addons.ConfigHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerTEBaseGenerator implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
try{
int storage = -1;
int production = -1;
if (IC2Module.TileEntityBaseGenerator.isInstance(accessor.getTileEntity())){
storage = IC2Module.TEBG_MaxStorage.getShort(accessor.getTileEntity());
production = IC2Module.TEBG_Production.getInt(accessor.getTileEntity());
}
else if (IC2Module.TileEntityGeoGenerator.isInstance(accessor.getTileEntity())){
storage = IC2Module.TEGG_MaxStorage.getShort(accessor.getTileEntity());
production = IC2Module.TEGG_Production.getInt(accessor.getTileEntity());
}
else if (IC2Module.TileEntitySemifluidGenerator.isInstance(accessor.getTileEntity())){
storage = IC2Module.TESG_MaxStorage.getShort(accessor.getTileEntity());
production = (int)IC2Module.TESG_Production.getDouble(accessor.getTileEntity());
}
String storedStr = LangUtil.translateG("hud.msg.stored");
String outputStr = LangUtil.translateG("hud.msg.output");
/* EU Storage */
if (ConfigHandler.instance().getConfig("ic2.storage")){
double stored = IC2Module.getStoredEnergy(accessor);
if ( stored >= 0.0 && storage > 0)
currenttip.add(String.format("%s : \u00a7f%d\u00a7r / \u00a7f%d\u00a7r EU", storedStr, Math.round(Math.min(stored,storage)), storage));
//else if (stored >= 0.0)
// currenttip.add(String.format("Stored : %d EU", stored));
}
if (ConfigHandler.instance().getConfig("ic2.outputeu")){
if ( production > 0)
currenttip.add(String.format("%s : \u00a7f%d\u00a7r EU/t", outputStr, production));
}
} catch (Exception e){
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -0,0 +1,61 @@
package mcp.mobius.waila.addons.ic2;
import java.util.List;
import codechicken.lib.lang.LangUtil;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.WailaExceptionHandler;
import mcp.mobius.waila.addons.ConfigHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerTEElectricBlock implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor,
IWailaConfigHandler config) {
// TODO Auto-generated method stub
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
try{
String storedStr = LangUtil.translateG("hud.msg.stored");
String outputStr = LangUtil.translateG("hud.msg.output");
/* EU Storage */
if (ConfigHandler.instance().getConfig("ic2.storage")){
double stored = IC2Module.getStoredEnergy(accessor);
int storage = IC2Module.TEEB_MaxStorage.getInt(accessor.getTileEntity());
if ( stored >= 0.0 )
currenttip.add(String.format("%s : \u00a7f%d\u00a7r / \u00a7f%d\u00a7r EU", storedStr, Math.round(Math.min(stored,storage)), storage));
}
if (ConfigHandler.instance().getConfig("ic2.outputeu")){
int production = IC2Module.TEEB_Output.getInt(accessor.getTileEntity());
if ( production > 0)
currenttip.add(String.format("%s : \u00a7f%d\u00a7r EU/t", outputStr, production));
}
} catch (Exception e){
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -0,0 +1,81 @@
package mcp.mobius.waila.addons.ic2;
import java.util.List;
import codechicken.lib.lang.LangUtil;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.WailaExceptionHandler;
import mcp.mobius.waila.addons.ConfigHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerTEStandardMachine implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor,
IWailaConfigHandler config) {
// TODO Auto-generated method stub
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
try{
IC2Upgrades upgrades = IC2Module.getUpgrades(accessor);
int baseConsumption = IC2Module.TESM_DefaultEnergyConsume.getInt(accessor.getTileEntity());
int baseOpTime = IC2Module.TESM_DefaultOperationLength.getInt(accessor.getTileEntity());
int baseStorage = IC2Module.TESM_DefaultEnergyStorage.getInt(accessor.getTileEntity());
long consumption = Math.round(Math.min(baseConsumption * Math.pow(1.6D, upgrades.overclocker), 2147483647));
double stackOpLen = baseOpTime * 64.0D * Math.pow(0.7D, upgrades.overclocker);
int opPerTick = ((int)Math.min(Math.ceil(64.0D / stackOpLen), 2147483647.0D));
int opTime = ((int)Math.round(stackOpLen * opPerTick / 64.0D));
int storage = Math.round(Math.min(baseStorage + 10000 * upgrades.storage + opTime * consumption, 2147483647));;
int maxinput = (Integer)IC2Module.IES_GetMaxSafeInput.invoke(accessor.getTileEntity()) * (int)Math.pow(4.0D, Math.min(4, upgrades.transform));
double stored = IC2Module.getStoredEnergy(accessor);
String storedStr = LangUtil.translateG("hud.msg.stored");
String powerStr = LangUtil.translateG("hud.msg.power");
String maxPowerStr = LangUtil.translateG("hud.msg.maxpower");
/* EU Storage */
if (ConfigHandler.instance().getConfig("ic2.storage")){
if ( stored >= 0.0 )
currenttip.add(String.format("%s : \u00a7f%d\u00a7r / \u00a7f%d\u00a7r EU", storedStr, Math.round(Math.min(stored,storage)), storage));
}
if (ConfigHandler.instance().getConfig("ic2.consump")){
if ( consumption > 0)
currenttip.add(String.format("%s : \u00a7f%d\u00a7r EU/t", powerStr, consumption ));
}
if (ConfigHandler.instance().getConfig("ic2.inputeu")){
if ( maxinput > 0)
currenttip.add(String.format("%s : \u00a7f%d\u00a7r EU/t", maxPowerStr, maxinput ));
}
} catch (Exception e){
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -0,0 +1,58 @@
package mcp.mobius.waila.addons.ic2;
import java.util.List;
import codechicken.lib.lang.LangUtil;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import mcp.mobius.waila.addons.ConfigHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerTETradeOMat implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack,List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!ConfigHandler.instance().getConfig("ic2.tradeomat")) return currenttip;
NBTTagCompound slots = accessor.getNBTData().getCompoundTag("InvSlots");
NBTTagList offer = slots.getCompoundTag("offer").getTagList("Contents");
NBTTagList demand = slots.getCompoundTag("demand").getTagList("Contents");
String offersStr = LangUtil.translateG("hud.msg.offers");
String demandsStr = LangUtil.translateG("hud.msg.demands");
if (offer.tagCount() == 1){
NBTTagCompound subtag = (NBTTagCompound)offer.tagAt(0);
ItemStack is = new ItemStack(subtag.getShort("id"), subtag.getByte("Count"), subtag.getShort("Damage"));
currenttip.add(String.format("%s : \u00a7f%d\u00a7r x \u00a7f%s\u00a7r", offersStr, is.stackSize, is.getDisplayName()));
}
if (demand.tagCount() == 1){
NBTTagCompound subtag = (NBTTagCompound)demand.tagAt(0);
ItemStack is = new ItemStack(subtag.getShort("id"), subtag.getByte("Count"), subtag.getShort("Damage"));
currenttip.add(String.format("%s : \u00a7f%d\u00a7r x \u00a7f%s\u00a7r", demandsStr, is.stackSize, is.getDisplayName()));
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
+126 -49
View File
@@ -4,88 +4,165 @@ import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.logging.Level;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ExternalModulesHandler;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ConfigHandler;
import mcp.mobius.waila.addons.ExternalModulesHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
public class IC2Module {
/* Our interfaces */
public static Class IEnergyStorage = null;
public static Class IEnergySink = null;
public static Class IEnergySource = null;
public static Class TileEntityStandardMachine = null;
public static Field TESM_DefaultEnergyStorage = null;
public static Field TESM_DefaultEnergyConsume = null;
public static Field TESM_DefaultOperationLength = null;
public static Field TESM_MaxEnergy = null;
/* Methods interfaces */
public static Method IEnergyStorage_GetCapacity = null;
public static Method IEnergySink_GetInput = null;
public static Method IEnergySource_GetOutput = null;
public static Class TileEntityBaseGenerator = null;
public static Field TEBG_MaxStorage = null;
public static Field TEBG_Production = null;
public static Class TileEntitySemifluidGenerator = null;
public static Field TESG_MaxStorage = null;
public static Field TESG_Production = null;
public static Class TileEntityGeoGenerator = null;
public static Field TEGG_MaxStorage = null;
public static Field TEGG_Production = null;
public static Class TileEntityElectricBlock = null;
public static Field TEEB_MaxStorage = null;
public static Field TEEB_Output = null;
public static Class IEnergySink = null;
public static Method IES_GetMaxSafeInput = null;
public static Class TileEntityTradeOMat = null;
/* Some required items */
public static Class IC2Items = null;
public static Field TransformerUpgrade = null;
public static ItemStack TransformerUpgradeStack = null;
public static Field EnergyStorageUpgrade = null;
public static ItemStack EnergyStorageUpgradeStack = null;
/* Fix for doors */
public static Class BlockIC2Door = null;
public static Field ReinforcedDoor = null;
public static ItemStack ReinforcedDoorStack = null;
public static ItemStack TransformerUpgradeStack = null;
public static Field EnergyStorageUpgrade = null;
public static ItemStack EnergyStorageUpgradeStack = null;
public static Field OverclockerUpgrade = null;
public static ItemStack OverclockerUpgradeStack = null;
public static void register(){
try{
Class ModIndustrialCraft = Class.forName("ic2.core.IC2");
mod_Waila.log.log(Level.INFO, "Industrialcraft2 mod found.");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.INFO, "[IC2] Industrialcraft2 mod not found.");
return;
}
try{
TileEntityStandardMachine = Class.forName("ic2.core.block.machine.tileentity.TileEntityStandardMachine");
TESM_DefaultEnergyStorage = TileEntityStandardMachine.getField("defaultEnergyStorage");
TESM_DefaultEnergyConsume = TileEntityStandardMachine.getField("defaultEnergyConsume");
TESM_DefaultOperationLength = TileEntityStandardMachine.getField("defaultOperationLength");
TESM_MaxEnergy = TileEntityStandardMachine.getField("maxEnergy");
IEnergyStorage = Class.forName("ic2.api.tile.IEnergyStorage");
IEnergySink = Class.forName("ic2.api.energy.tile.IEnergySink");
IEnergySource = Class.forName("ic2.api.energy.tile.IEnergySource");
IEnergySink_GetInput = IEnergySink.getMethod("getMaxSafeInput");
IEnergySource_GetOutput = IEnergySource.getMethod("getMaxEnergyOutput");
IEnergyStorage_GetCapacity = IEnergyStorage.getMethod("getCapacity");
TileEntityBaseGenerator = Class.forName("ic2.core.block.generator.tileentity.TileEntityBaseGenerator");
TEBG_MaxStorage = TileEntityBaseGenerator.getField("maxStorage");
TEBG_Production = TileEntityBaseGenerator.getField("production");
TileEntitySemifluidGenerator = Class.forName("ic2.core.block.generator.tileentity.TileEntitySemifluidGenerator");
TESG_MaxStorage = TileEntitySemifluidGenerator.getDeclaredField("maxStorage");
TESG_Production = TileEntitySemifluidGenerator.getDeclaredField("production");
TESG_MaxStorage.setAccessible(true);
TESG_Production.setAccessible(true);
IC2Items = Class.forName("ic2.core.Ic2Items");
TransformerUpgrade = IC2Items.getDeclaredField("transformerUpgrade");
EnergyStorageUpgrade = IC2Items.getDeclaredField("energyStorageUpgrade");
TileEntityGeoGenerator = Class.forName("ic2.core.block.generator.tileentity.TileEntityGeoGenerator");
TEGG_MaxStorage = TileEntityGeoGenerator.getField("maxStorage");
TEGG_Production = TileEntityGeoGenerator.getField("production");
TileEntityElectricBlock = Class.forName("ic2.core.block.wiring.TileEntityElectricBlock");
TEEB_MaxStorage = TileEntityElectricBlock.getField("maxStorage");
TEEB_Output = TileEntityElectricBlock.getField("output");
IEnergySink = Class.forName("ic2.api.energy.tile.IEnergySink");
IES_GetMaxSafeInput = IEnergySink.getMethod("getMaxSafeInput");
IC2Items = Class.forName("ic2.core.Ic2Items");
TransformerUpgrade = IC2Items.getField("transformerUpgrade");
EnergyStorageUpgrade = IC2Items.getField("energyStorageUpgrade");
OverclockerUpgrade = IC2Items.getField("overclockerUpgrade");
TransformerUpgradeStack = (ItemStack)TransformerUpgrade.get(null);
EnergyStorageUpgradeStack = (ItemStack)EnergyStorageUpgrade.get(null);
EnergyStorageUpgradeStack = (ItemStack)EnergyStorageUpgrade.get(null);
OverclockerUpgradeStack = (ItemStack)OverclockerUpgrade.get(null);
BlockIC2Door = Class.forName("ic2.core.block.BlockIC2Door");
ReinforcedDoor = IC2Items.getDeclaredField("reinforcedDoor");
ReinforcedDoorStack = (ItemStack)ReinforcedDoor.get(null);
TileEntityTradeOMat = Class.forName("ic2.core.block.personal.TileEntityTradeOMat");
} catch (ClassNotFoundException e){
//e.printStackTrace();
mod_Waila.log.log(Level.WARNING, "[IC2] Class not found. " + e);
return;
} catch (NoSuchMethodException e){
//e.printStackTrace();
mod_Waila.log.log(Level.WARNING, "[IC2] Method not found." + e);
return;
} catch (NoSuchFieldException e){
//e.printStackTrace();
mod_Waila.log.log(Level.WARNING, "[IC2] Field not found." + e);
return;
} catch (Exception e){
//e.printStackTrace();
mod_Waila.log.log(Level.WARNING, "[IC2] Unhandled exception." + e);
return;
}
}
ExternalModulesHandler.instance().addConfigRemote("IndustrialCraft2", "ic2.inputeumach", "Max EU input [Machines]");
ExternalModulesHandler.instance().addConfig("IndustrialCraft2", "ic2.inputeuother", "Max EU input [Other]");
ExternalModulesHandler.instance().addConfig("IndustrialCraft2", "ic2.outputeu", "Max EU output");
ExternalModulesHandler.instance().addConfigRemote("IndustrialCraft2", "ic2.storage", "Energy stored");
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerIC2IEnergySink(), IEnergySink);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerIC2IEnergySource(), IEnergySource);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerIC2IEnergyStorage(), IEnergyStorage);
ExternalModulesHandler.instance().registerStackProvider(new HUDHandlerDoor(), BlockIC2Door);
ExternalModulesHandler.instance().addConfigRemote("IndustrialCraft2", "ic2.storage");
ExternalModulesHandler.instance().addConfig("IndustrialCraft2", "ic2.outputeu");
ExternalModulesHandler.instance().addConfigRemote("IndustrialCraft2", "ic2.inputeu");
ExternalModulesHandler.instance().addConfigRemote("IndustrialCraft2", "ic2.consump");
ExternalModulesHandler.instance().addConfigRemote("IndustrialCraft2", "ic2.tradeomat");
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerTEStandardMachine(), TileEntityStandardMachine);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerTEBaseGenerator(), TileEntityBaseGenerator);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerTEBaseGenerator(), TileEntitySemifluidGenerator);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerTEBaseGenerator(), TileEntityGeoGenerator);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerTEElectricBlock(), TileEntityElectricBlock);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerTETradeOMat(), TileEntityTradeOMat);
}
/* Retuns the current stored energy if available in the nbt and config is true */
public static double getStoredEnergy(IWailaDataAccessor accessor){
if (ConfigHandler.instance().getConfig("ic2.storage")){
if (accessor.getNBTData().hasKey("energy"))
return accessor.getNBTData().getDouble("energy");
else if (accessor.getNBTData().hasKey("storage"))
return accessor.getNBTData().getDouble("storage");
}
return -1.0;
}
public static IC2Upgrades getUpgrades(IWailaDataAccessor accessor){
NBTTagCompound nbt = accessor.getNBTData();
IC2Upgrades upgrades = new IC2Upgrades();
if (!nbt.hasKey("InvSlots")) return null;
NBTTagCompound inventory = nbt.getCompoundTag("InvSlots");
if (!inventory.hasKey("upgrade")) return null;
NBTTagList nbtupgrades = inventory.getCompoundTag("upgrade").getTagList("Contents");
for (Object subobj : nbtupgrades.tagList){
NBTTagCompound subtag = (NBTTagCompound)subobj;
int id = subtag.getShort("id");
int meta = subtag.getShort("Damage");
int count = subtag.getByte("Count");
//ItemStack is = new ItemStack(id, 1, count);
if (TransformerUpgradeStack.getItemDamage() == meta && TransformerUpgradeStack.itemID == id)
upgrades.transform += count;
if (EnergyStorageUpgradeStack.getItemDamage() == meta && EnergyStorageUpgradeStack.itemID == id)
upgrades.storage += count;
if (OverclockerUpgradeStack.getItemDamage() == meta && OverclockerUpgradeStack.itemID == id)
upgrades.overclocker += count;
}
return upgrades;
}
}
@@ -0,0 +1,7 @@
package mcp.mobius.waila.addons.ic2;
public class IC2Upgrades {
public int transform = 0;
public int storage = 0;
public int overclocker = 0;
}
@@ -0,0 +1,69 @@
package mcp.mobius.waila.addons.openblocks;
import java.util.List;
import codechicken.lib.lang.LangUtil;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerTank implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("openblocks.fluidamount")) return currenttip;
IFluidHandler handler = (IFluidHandler)accessor.getTileEntity();
if (handler == null) return currenttip;
FluidTankInfo[] tanks = handler.getTankInfo(ForgeDirection.UNKNOWN);
if (tanks.length != 1) return currenttip;
FluidStack fluid = tanks[0].fluid;
String name = currenttip.get(0);
try{
name += String.format(" < %s >", fluid.getFluid().getLocalizedName());
} catch (NullPointerException f){
name += " " + LangUtil.translateG("hud.msg.empty");
}
currenttip.set(0, name);
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("openblocks.fluidamount")) return currenttip;
IFluidHandler handler = (IFluidHandler)accessor.getTileEntity();
if (handler == null) return currenttip;
FluidTankInfo[] tanks = handler.getTankInfo(ForgeDirection.UNKNOWN);
if (tanks.length != 1) return currenttip;
if(tanks[0].fluid != null)
currenttip.add(String.format("%d / %d mB", tanks[0].fluid.amount, tanks[0].capacity));
else
currenttip.add(String.format("0 / %d mB", tanks[0].capacity));
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -0,0 +1,33 @@
package mcp.mobius.waila.addons.openblocks;
import java.util.logging.Level;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ExternalModulesHandler;
public class OpenBlocksModule {
public static Class ModOpenBlocks = null;
public static Class TileEntityTank = null;
public static void register(){
try{
Class ModOpenBlocks = Class.forName("openblocks.OpenBlocks");
mod_Waila.log.log(Level.INFO, "OpenBlocks mod found.");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.INFO, "[OpenBlocks] OpenBlocks mod not found.");
return;
}
try{
TileEntityTank = Class.forName("openblocks.common.tileentity.TileEntityTank");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.WARNING, "[OpenBlocks] Class not found. " + e);
return;
}
ExternalModulesHandler.instance().addConfigRemote("OpenBlocks", "openblocks.fluidamount");
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerTank(), TileEntityTank);
ExternalModulesHandler.instance().registerHeadProvider(new HUDHandlerTank(), TileEntityTank);
}
}
@@ -0,0 +1,202 @@
package mcp.mobius.waila.addons.projectred;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.common.ForgeDirection;
import mcp.mobius.waila.api.IWailaBlockDecorator;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.gui.helpers.UIHelper;
public class HUDDecoratorRsGateLogic implements IWailaBlockDecorator {
static byte[][] IOARRAY={
{1,1,2,1} /* OR */, {1,1,2,1} /* NOR */, {1,2,2,2} /* NOT */, {1,1,2,1} /* AND */,
{1,1,2,1} /* NAND */, {0,1,2,1} /* XOR */, {0,1,2,1} /* XNOR */, {1,2,2,2} /* Buf */,
{3,4,2,5} /* Multi */, {1,0,2,0} /* Pulse */, {1,0,2,0} /* Repeat */, {1,2,2,2} /* Rand */,
{2,1,2,1} /* Latch */, {2,1,2,1} /* Toggle*/, {6,1,2,2} /* Transp */, {2,0,0,0} /* Light */,
{2,0,0,0} /* Rain */, {1,7,2,7} /* Timer */, {2,2,2,2} /* Sequen */, {2,9,2,8} /* Count */,
{1,2,2,6} /* State */, {6,1,2,1} /* Sync */, {10,1,10,1} /* Bus */, {11,12,11,12} /* Null */,
{11,12,11,12} /* Inver */, {11,12,11,12} /* Buff */, {1,9,2,8} /* Cmp */, {1,12,2,12} /* And */,
};
static String[] IONAMES={ "", "IN", "OUT", "SWAP", "IN_A", "IN_B", "LOCK", "IO", "POS", "NEG", "BUS", "A", "B"};
@Override
public void decorateBlock(ItemStack itemStack, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("pr.showio")) return;
int orient = 0;
int subID = 0;
int shape = 0;
boolean found = false;
if (!accessor.getNBTData().hasKey("parts")) return;
NBTTagList parts = accessor.getNBTData().getTagList("parts");
for (int i = 0; i < parts.tagCount(); i++){
NBTTagCompound subtag = (NBTTagCompound)parts.tagAt(i);
String id = subtag.getString("id");
if (id.equals("pr_sgate") || id.equals("pr_igate") ||
id.equals("pr_tgate") || id.equals("pr_bgate") ||
id.equals("pr_agate") || id.equals("pr_rgate")){
orient = accessor.getNBTInteger(subtag, "orient");
subID = accessor.getNBTInteger(subtag, "subID");
shape = accessor.getNBTInteger(subtag, "shape");
found = true;
}
}
if (!found) return;
//orient = orient - ((orient & 0x10) + (orient & 0x8) + (orient & 0x4));
int hOrient = orient & 0x3;
ForgeDirection vOrient = ForgeDirection.getOrientation((orient - (orient & 0x3)) >> 2);
//System.out.printf("%s\n", ForgeDirection.getOrientation(vOrient));
if (vOrient == ForgeDirection.EAST)
hOrient -= 1;
if (vOrient == ForgeDirection.WEST)
hOrient += 1;
if (hOrient == -1)
hOrient = 3;
String[] IOStr = new String[4];
for (int i = 0; i < 4; i++)
IOStr[i] = IONAMES[IOARRAY[subID][i]];
String[] IOStrRot = new String[4];
for (int i = 0; i < 4 ; i++){
int j = i + hOrient;
if (j >= 4) j -= 4;
IOStrRot[j] = IOStr[i];
}
switch(vOrient){
case DOWN:
UIHelper.drawFloatingText(IOStrRot[0], accessor.getRenderingPosition(), 0.5F, 0.2F, 1.4F, 90F, 0F, 0F); // Orient 0
UIHelper.drawFloatingText(IOStrRot[1], accessor.getRenderingPosition(), -0.4F, 0.2F, 0.5F, 90F, 270F, 0F); // Orient 1
UIHelper.drawFloatingText(IOStrRot[2], accessor.getRenderingPosition(), 0.5F, 0.2F, -0.4F, 90F, 180F, 0F); // Orient 2
UIHelper.drawFloatingText(IOStrRot[3], accessor.getRenderingPosition(), 1.4F, 0.2F, 0.5F, 90F, 90F, 0F); // Orient 3
break;
case EAST:
UIHelper.drawFloatingText(IOStrRot[0], accessor.getRenderingPosition(), 0.8F, 0.5F, 1.4F, 0F, 90F, 90F);
UIHelper.drawFloatingText(IOStrRot[1], accessor.getRenderingPosition(), 0.8F, -0.4F, 0.5F, 0F, 90F, 180F);
UIHelper.drawFloatingText(IOStrRot[2], accessor.getRenderingPosition(), 0.8F, 0.5F, -0.4F, 0F, 90F, 270F);
UIHelper.drawFloatingText(IOStrRot[3], accessor.getRenderingPosition(), 0.8F, 1.4F, 0.5F, 0F, 90F, 0F);
break;
case NORTH:
UIHelper.drawFloatingText(IOStrRot[0], accessor.getRenderingPosition(), 0.5F, 1.4F, 0.2F, 0F, 180F, 0F);
UIHelper.drawFloatingText(IOStrRot[1], accessor.getRenderingPosition(), 1.4F, 0.5F, 0.2F, 0F, 180F, 90F);
UIHelper.drawFloatingText(IOStrRot[2], accessor.getRenderingPosition(), 0.5F, -0.4F, 0.2F, 0F, 180F, 180F);
UIHelper.drawFloatingText(IOStrRot[3], accessor.getRenderingPosition(), -0.4F, 0.5F, 0.2F, 0F, 180F, 270F);
break;
case SOUTH:
UIHelper.drawFloatingText(IOStrRot[0], accessor.getRenderingPosition(), 0.5F, 1.4F, 0.8F, 0F, 0F, 0F);
UIHelper.drawFloatingText(IOStrRot[1], accessor.getRenderingPosition(), -0.4F, 0.5F, 0.8F, 0F, 0F, 90F);
UIHelper.drawFloatingText(IOStrRot[2], accessor.getRenderingPosition(), 0.5F, -0.4F, 0.8F, 0F, 0F, 180F);
UIHelper.drawFloatingText(IOStrRot[3], accessor.getRenderingPosition(), 1.4F, 0.5F, 0.8F, 0F, 0F, 270F);
break;
case UP:
UIHelper.drawFloatingText(IOStrRot[0], accessor.getRenderingPosition(), 0.5F, 0.8F, 1.4F, 270F, 180F, 0F);
UIHelper.drawFloatingText(IOStrRot[1], accessor.getRenderingPosition(), 1.4F, 0.8F, 0.5F, 270F, 270F, 0F);
UIHelper.drawFloatingText(IOStrRot[2], accessor.getRenderingPosition(), 0.5F, 0.8F, -0.4F, 270F, 0F, 0F);
UIHelper.drawFloatingText(IOStrRot[3], accessor.getRenderingPosition(), -0.4F, 0.8F, 0.5F, 270F, 90F, 0F);
break;
case WEST:
UIHelper.drawFloatingText(IOStrRot[0], accessor.getRenderingPosition(), 0.2F, 0.5F, 1.4F, 180F, 90F, 90F);
UIHelper.drawFloatingText(IOStrRot[1], accessor.getRenderingPosition(), 0.2F, 1.4F, 0.5F, 180F, 90F, 180F);
UIHelper.drawFloatingText(IOStrRot[2], accessor.getRenderingPosition(), 0.2F, 0.5F, -0.4F, 180F, 90F, 270F);
UIHelper.drawFloatingText(IOStrRot[3], accessor.getRenderingPosition(), 0.2F, -0.4F, 0.5F, 180F, 90F, 0F);
break;
default:
break;
}
double x = accessor.getRenderingPosition().xCoord;
double y = accessor.getRenderingPosition().yCoord;
double z = accessor.getRenderingPosition().zCoord;
switch(vOrient){
case DOWN:
UIHelper.drawRectangle(x - 0.1, y + 0.1, z, x, y + 0.1, z + 0.35, 255, 255, 255, 150 );
UIHelper.drawRectangle(x - 0.1, y + 0.1, z + 0.65, x, y + 0.1, z + 1.0, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 1.0, y + 0.1, z, x + 1.1, y + 0.1, z + 0.35, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 1.0, y + 0.1, z + 0.65, x + 1.1, y + 0.1, z + 1.0, 255, 255, 255, 150 );
UIHelper.drawRectangle(x - 0.1, y + 0.1, z - 0.1, x + 0.35, y + 0.1, z + 0.1, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 0.65, y + 0.1, z - 0.1, x + 1.1, y + 0.1, z + 0.1, 255, 255, 255, 150 );
UIHelper.drawRectangle(x - 0.1, y + 0.1, z + 1.0, x + 0.35, y + 0.1, z + 1.1, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 0.65, y + 0.1, z + 1.0, x + 1.1, y + 0.1, z + 1.1, 255, 255, 255, 150 );
break;
case EAST:
UIHelper.drawRectangleEW(x + 0.9, y, z - 0.1, x + 0.9, y + 0.35, z, 255, 255, 255, 150 );
UIHelper.drawRectangleEW(x + 0.9, y + 0.65, z - 0.1, x + 0.9, y + 1.0, z, 255, 255, 255, 150 );
UIHelper.drawRectangleEW(x + 0.9, y, z + 1.0, x + 0.9, y + 0.35, z + 1.1, 255, 255, 255, 150 );
UIHelper.drawRectangleEW(x + 0.9, y + 0.65, z + 1.0, x + 0.9, y + 1.0, z + 1.1, 255, 255, 255, 150 );
UIHelper.drawRectangleEW(x + 0.9, y - 0.1, z - 0.1, x + 0.9, y, z + 0.35, 255, 255, 255, 150 );
UIHelper.drawRectangleEW(x + 0.9, y - 0.1, z + 0.65, x + 0.9, y, z + 1.1, 255, 255, 255, 150 );
UIHelper.drawRectangleEW(x + 0.9, y + 1.0, z - 0.1, x + 0.9, y + 1.1, z + 0.35, 255, 255, 255, 150 );
UIHelper.drawRectangleEW(x + 0.9, y + 1.0, z + 0.65, x + 0.9, y + 1.1, z + 1.1, 255, 255, 255, 150 );
break;
case NORTH:
UIHelper.drawRectangle(x - 0.1, y, z + 0.1, x, y + 0.35, z + 0.1, 255, 255, 255, 150 );
UIHelper.drawRectangle(x - 0.1, y + 0.65, z + 0.1, x, y + 1.0, z + 0.1, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 1.0, y, z + 0.1, x + 1.1, y + 0.35, z + 0.1, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 1.0, y + 0.65, z + 0.1, x + 1.1, y + 1.0, z + 0.1, 255, 255, 255, 150 );
UIHelper.drawRectangle(x - 0.1, y - 0.1, z + 0.1, x + 0.35, y, z + 0.1, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 0.65, y - 0.1, z + 0.1, x + 1.1, y, z + 0.1, 255, 255, 255, 150 );
UIHelper.drawRectangle(x - 0.1, y + 1.0, z + 0.1, x + 0.35, y + 1.1, z + 0.1, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 0.65, y + 1.0, z + 0.1, x + 1.1, y + 1.1, z + 0.1, 255, 255, 255, 150 );
break;
case SOUTH:
UIHelper.drawRectangle(x, y, z + 0.9, x - 0.1, y + 0.35, z + 0.9, 255, 255, 255, 150 );
UIHelper.drawRectangle(x, y + 0.65, z + 0.9, x - 0.1, y + 1.0, z + 0.9, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 1.1, y, z + 0.9, x + 1.0, y + 0.35, z + 0.9, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 1.1, y + 0.65, z + 0.9, x + 1.0, y + 1.0, z + 0.9, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 0.35, y - 0.1, z + 0.9, x - 0.1, y, z + 0.9, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 1.10, y - 0.1, z + 0.9, x + 0.65, y, z + 0.9, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 0.35, y + 1.0, z + 0.9, x - 0.1, y + 1.1, z + 0.9, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 1.1, y + 1.0, z + 0.9, x + 0.65, y + 1.1, z + 0.9, 255, 255, 255, 150 );
break;
case UP:
UIHelper.drawRectangle(x, y + 0.9, z, x - 0.1, y + 0.9, z + 0.35, 255, 255, 255, 150 );
UIHelper.drawRectangle(x, y + 0.9, z + 0.65, x - 0.1, y + 0.9, z + 1.0, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 1.1, y + 0.9, z, x + 1.0, y + 0.9, z + 0.35, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 1.1, y + 0.9, z + 0.65, x + 1.0, y + 0.9, z + 1.0, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 0.35, y + 0.9, z - 0.1, x - 0.1, y + 0.9, z + 0.1, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 1.1, y + 0.9, z - 0.1, x + 0.65, y + 0.9, z + 0.1, 255, 255, 255, 150 );
UIHelper.drawRectangle(x +0.35, y + 0.9, z + 1.0, x - 0.1, y + 0.9, z + 1.1, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 1.1, y + 0.9, z + 1.0, x + 0.65, y + 0.9, z + 1.1, 255, 255, 255, 150 );
break;
case WEST:
UIHelper.drawRectangleEW(x + 0.1, y+ 0.35, z - 0.1, x + 0.1, y , z, 255, 255, 255, 150 );
UIHelper.drawRectangleEW(x + 0.1, y + 1.0, z - 0.1, x + 0.1, y + 0.65, z, 255, 255, 255, 150 );
UIHelper.drawRectangleEW(x + 0.1, y + 0.35, z + 1.0, x + 0.1, y, z + 1.1, 255, 255, 255, 150 );
UIHelper.drawRectangleEW(x + 0.1, y + 1.0, z + 1.0, x + 0.1, y + 0.65, z + 1.1, 255, 255, 255, 150 );
UIHelper.drawRectangleEW(x + 0.1, y, z - 0.1, x + 0.1, y - 0.1, z + 0.35, 255, 255, 255, 150 );
UIHelper.drawRectangleEW(x + 0.1, y, z + 0.65, x + 0.1, y - 0.1, z + 1.1, 255, 255, 255, 150 );
UIHelper.drawRectangleEW(x + 0.1, y + 1.1, z - 0.1, x + 0.1, y + 1.0, z + 0.35, 255, 255, 255, 150 );
UIHelper.drawRectangleEW(x + 0.1, y + 1.1, z + 0.65, x + 0.1, y + 1.0, z + 1.1, 255, 255, 255, 150 );
break;
default:
break;
}
}
}
@@ -0,0 +1,105 @@
package mcp.mobius.waila.addons.projectred;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerRsGateLogic implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("pr.showdata")) return currenttip;
int orient = 0;
int subID = 0;
int shape = 0;
int pmax = 0;
int val = 0;
int max = 0;
int dec = 0;
int inc = 0;
boolean found = false;
if (!accessor.getNBTData().hasKey("parts")) return currenttip;
NBTTagList parts = accessor.getNBTData().getTagList("parts");
for (int i = 0; i < parts.tagCount(); i++){
NBTTagCompound subtag = (NBTTagCompound)parts.tagAt(i);
String id = subtag.getString("id");
if (id.equals("pr_sgate") || id.equals("pr_igate") ||
id.equals("pr_tgate") || id.equals("pr_bgate") ||
id.equals("pr_agate") || id.equals("pr_rgate")){
orient = accessor.getNBTInteger(subtag, "orient");
subID = accessor.getNBTInteger(subtag, "subID");
shape = accessor.getNBTInteger(subtag, "shape");
if (subID == 17)
pmax = accessor.getNBTInteger(subtag, "pmax");
if (subID == 19){
val = accessor.getNBTInteger(subtag, "val");
max = accessor.getNBTInteger(subtag, "max");
dec = accessor.getNBTInteger(subtag, "dec");
inc = accessor.getNBTInteger(subtag, "inc");
}
found = true;
}
}
if (!found) return currenttip;
switch(subID){
case 10:
currenttip.add(String.format("Delay : \u00a7f%d ticks", (int)Math.pow(2, shape)));
break;
case 15:
if (shape == 0)
currenttip.add("Shape : \u00a7fOpen");
if (shape == 1)
currenttip.add("Shape : \u00a7fHalf closed");
if (shape == 2)
currenttip.add("Shape : \u00a7fclosed");
break;
case 17:
currenttip.add(String.format("Timer : \u00a7f%d \u00a7rms", (pmax + 2) * 50));
break;
case 19:
currenttip.add(String.format("Value : \u00a7f%d \u00a7r/ \u00a7f%d", val, max));
currenttip.add(String.format("Step : \u00a7f-%d \u00a7r/ \u00a7f+%d", dec, inc));
default:
break;
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -0,0 +1,51 @@
package mcp.mobius.waila.addons.projectred;
import java.io.File;
import java.util.logging.Level;
import net.minecraft.block.Block;
import net.minecraftforge.common.Configuration;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ExternalModulesHandler;
public class ProjectRedModule {
public static Class BlockMultipart = null;
public static void register(){
try{
Class ModClass = Class.forName("mrtjp.projectred.ProjectRedIntegration");
mod_Waila.log.log(Level.INFO, "ProjectRed|Integration mod found.");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.INFO, "[ProjectRed] ProjectRed|Integration mod not found.");
return;
}
try{
//InstancedRsGateLogic = Class.forName("mrtjp.projectred.integration.InstancedRsGateLogic");
BlockMultipart = Class.forName("codechicken.multipart.BlockMultipart");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Class not found. " + e);
return;
// } catch (NoSuchMethodException e){
// mod_Waila.log.log(Level.WARNING, "[EnderStorage] Method not found." + e);
// return;
// } catch (NoSuchFieldException e){
// mod_Waila.log.log(Level.WARNING, "[EnderStorage] Field not found." + e);
// return;
} catch (Exception e){
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Unhandled exception." + e);
return;
}
ExternalModulesHandler.instance().addConfigRemote("Project:Red", "pr.showio");
ExternalModulesHandler.instance().addConfigRemote("Project:Red", "pr.showdata");
ExternalModulesHandler.instance().registerBlockDecorator(new HUDDecoratorRsGateLogic(), BlockMultipart);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerRsGateLogic(), BlockMultipart);
}
}
@@ -0,0 +1,74 @@
package mcp.mobius.waila.addons.railcraft;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import codechicken.lib.lang.LangUtil;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidTank;
import mcp.mobius.waila.WailaExceptionHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerTank implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("railcraft.fluidamount")) return currenttip;
try {
IFluidTank tank = (IFluidTank)RailcraftModule.ITankTile_getTank.invoke(RailcraftModule.ITankTile.cast(accessor.getTileEntity()));
if (tank == null) return currenttip;
FluidStack fluid = tank.getFluid();
String name = currenttip.get(0);
try{
name += String.format(" < %s >", fluid.getFluid().getLocalizedName());
} catch (NullPointerException f){
name += " " + LangUtil.translateG("hud.msg.empty");
}
currenttip.set(0, name);
} catch (Exception e){
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("railcraft.fluidamount")) return currenttip;
try {
IFluidTank tank = (IFluidTank)RailcraftModule.ITankTile_getTank.invoke(RailcraftModule.ITankTile.cast(accessor.getTileEntity()));
if (tank == null) return currenttip;
FluidStack fluid = tank.getFluid();
if (fluid != null)
currenttip.add(String.format("%d / %d mB", fluid.amount, tank.getInfo().capacity));
else
currenttip.add(String.format("0 / %d mB", tank.getInfo().capacity));
} catch (Exception e){
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -0,0 +1,42 @@
package mcp.mobius.waila.addons.railcraft;
import java.lang.reflect.Method;
import java.util.logging.Level;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ExternalModulesHandler;
public class RailcraftModule {
public static Class TileTankBase = null;
public static Class ITankTile = null;
public static Method ITankTile_getTank = null;
//public static Class StandardTank = null;
public static void register(){
try{
Class ModRailcraft = Class.forName("mods.railcraft.common.core.Railcraft");
mod_Waila.log.log(Level.INFO, "Railcraft mod found.");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.INFO, "[Railcraft] Railcraft mod not found.");
return;
}
try{
TileTankBase = Class.forName("mods.railcraft.common.blocks.machine.beta.TileTankBase");
ITankTile = Class.forName("mods.railcraft.common.blocks.machine.ITankTile");
ITankTile_getTank = ITankTile.getMethod("getTank");
//StandardTank = Class.forName("mods.railcraft.common.fluids.tanks.StandardTank");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.WARNING, "[Railcraft] Class not found. " + e);
return;
} catch (NoSuchMethodException e){
mod_Waila.log.log(Level.WARNING, "[Railcraft] Method not found." + e);
return;
}
ExternalModulesHandler.instance().addConfigRemote("Railcraft", "railcraft.fluidamount");
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerTank(), TileTankBase);
ExternalModulesHandler.instance().registerHeadProvider(new HUDHandlerTank(), TileTankBase);
}
}
@@ -47,7 +47,7 @@ public class ThaumcraftModule {
// mod_Waila.log.log(Level.WARNING, "[Thaumcraft] Unhandled exception." + e);
// return;
}
ExternalModulesHandler.instance().addConfig("Thaumcraft", "thaumcraft.storedvis", "Capacitor storage");
ExternalModulesHandler.instance().addConfig("Thaumcraft", "thaumcraft.storedvis");
ExternalModulesHandler.instance().registerStackProvider(new HUDHandlerLeaves(), BlockMagicalLeaves);
ExternalModulesHandler.instance().registerStackProvider(new HUDHandlerPlants(), BlockCustomPlant);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerCapacitor(), TileCrystalCapacitor);
@@ -0,0 +1,63 @@
package mcp.mobius.waila.addons.thermalexpansion;
import java.util.List;
import codechicken.lib.lang.LangUtil;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.fluids.FluidStack;
import mcp.mobius.waila.WailaExceptionHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerConduitFluid implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("thermalexpansion.fluidtype")) return currenttip;
boolean found = false;
FluidStack fluid = null;
if (!accessor.getNBTData().hasKey("parts")) return currenttip;
NBTTagList parts = accessor.getNBTData().getTagList("parts");
for (int i = 0; i < parts.tagCount(); i++){
NBTTagCompound subtag = (NBTTagCompound)parts.tagAt(i);
String id = subtag.getString("id");
if (id.contains("ConduitFluid")){
found = true;
NBTTagCompound fluidTag = subtag.getCompoundTag("ConnFluid");
fluid = FluidStack.loadFluidStackFromNBT(fluidTag);
}
}
if (!found) return currenttip;
if (fluid != null)
currenttip.add(fluid.getFluid().getLocalizedName());
else
currenttip.add(LangUtil.translateG("hud.msg.empty"));
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -0,0 +1,64 @@
package mcp.mobius.waila.addons.thermalexpansion;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerConduitItem implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("thermalexpansion.conditemmode")) return currenttip;
boolean found = false;
int mode = -1;
if (!accessor.getNBTData().hasKey("parts")) return currenttip;
NBTTagList parts = accessor.getNBTData().getTagList("parts");
for (int i = 0; i < parts.tagCount(); i++){
NBTTagCompound subtag = (NBTTagCompound)parts.tagAt(i);
String id = subtag.getString("id");
if (id.contains("ConduitItem")){
mode = accessor.getNBTInteger(subtag, "Mode");
found = true;
}
}
if (!found) return currenttip;
if (mode == 0){}
else if (mode == 1)
currenttip.add("Mode : \u00a7fDense");
else if (mode == 2)
currenttip.add("Mode : \u00a7fVacuum");
else if (mode == 3)
currenttip.add("Mode : \u00a7fRound-Robin");
else
currenttip.add("Mode : <UNKNOWN>");
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -1,14 +1,15 @@
package mcp.mobius.waila.addons.buildcraft;
package mcp.mobius.waila.addons.thermalexpansion;
import java.util.List;
import codechicken.lib.lang.LangUtil;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import mcp.mobius.waila.WailaExceptionHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerBCEngine implements IWailaDataProvider {
public class HUDHandlerEnergyCell implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
@@ -22,22 +23,19 @@ public class HUDHandlerBCEngine implements IWailaDataProvider {
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("thermalexpansion.energycell")) return currenttip;
int energyReceive = accessor.getNBTInteger(accessor.getNBTData(), "Recv");
int energySend = accessor.getNBTInteger(accessor.getNBTData(), "Send");
currenttip.add(String.format("%s/%s : %d / %d RF/t", LangUtil.translateG("hud.msg.in"), LangUtil.translateG("hud.msg.out"), energyReceive, energySend));
NBTTagCompound tag = accessor.getNBTData();
if (tag.hasKey("energyF")){
//float output = tag.getFloat("energyF")*tag.getFloat("progress");
float output = tag.getFloat("energyF");
if (output > 1.0F)
currenttip.add(String.format("Output : %.1f MJ",output));
else
currenttip.add(String.format("Output : %.2f MJ",output));
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
}
@@ -0,0 +1,48 @@
package mcp.mobius.waila.addons.thermalexpansion;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ForgeDirection;
import mcp.mobius.waila.WailaExceptionHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerIEnergyHandler implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("thermalexpansion.energyhandler")) return currenttip;
if (!accessor.getNBTData().hasKey("Energy")) return currenttip;
int energy = accessor.getNBTInteger(accessor.getNBTData(), "Energy");
try {
Integer maxEnergy = (Integer)ThermalExpansionModule.IEnergyHandler_getMaxStorage.invoke(accessor.getTileEntity(), ForgeDirection.UNKNOWN);
if (maxEnergy != 0)
currenttip.add(String.format("%d / %d RF", energy, maxEnergy));
} catch (Exception e){
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -1,18 +1,15 @@
package mcp.mobius.waila.addons.buildcraft;
package mcp.mobius.waila.addons.thermalexpansion;
import java.util.List;
import codechicken.lib.lang.LangUtil;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerBCIPowerReceptor implements IWailaDataProvider {
public HUDHandlerBCIPowerReceptor() {
// TODO Auto-generated constructor stub
}
public class HUDHandlerISecureTile implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
@@ -26,17 +23,28 @@ public class HUDHandlerBCIPowerReceptor implements IWailaDataProvider {
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
// int powerRequest = 0;
// try{
// powerRequest = (Integer)BCModule.IPowerReceptor_PowerRequest.invoke(BCModule.IPowerReceptor.cast(accessor.getTileEntity()), ForgeDirection.UNKNOWN);
// }
// catch (Exception e){
// mod_Waila.log.log(Level.SEVERE, "[BC] Unhandled exception trying to access a tank for display !.\n" + String.valueOf(e));
// return currenttip;
// }
// currenttip.add(String.valueOf(powerRequest));
// NBTTagCompound tag = accessor.getNBTData();
if (config.getConfig("thermalexpansion.owner")){
String owner = accessor.getNBTData().getString("Owner");
int iaccess = accessor.getNBTInteger(accessor.getNBTData(), "Access");
String access = "INVALID";
switch(iaccess){
case 0:
access = LangUtil.translateG("hud.msg.public");
break;
case 1:
access = LangUtil.translateG("hud.msg.restricted");
break;
case 2:
access = LangUtil.translateG("hud.msg.private");
break;
}
currenttip.add(String.format("%s : \u00a7f%s\u00a7r [ %s ]", LangUtil.translateG("hud.msg.owner"), owner, access));
}
return currenttip;
}
@@ -44,6 +52,8 @@ public class HUDHandlerBCIPowerReceptor implements IWailaDataProvider {
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
}
@@ -0,0 +1,82 @@
package mcp.mobius.waila.addons.thermalexpansion;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import codechicken.lib.lang.LangUtil;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import mcp.mobius.waila.WailaExceptionHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerTank implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("thermalexpansion.fluidtype")) return currenttip;
try {
FluidStack fluid = (FluidStack)ThermalExpansionModule.TileTank_getTankFluid.invoke(accessor.getTileEntity());
String name = currenttip.get(0);
try{
name += String.format(" < %s >", fluid.getFluid().getLocalizedName());
} catch (NullPointerException f){
name += " " + LangUtil.translateG("hud.msg.empty");
}
currenttip.set(0, name);
} catch (Exception e){
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
try {
if (config.getConfig("thermalexpansion.fluidamount")){
int amount = 0;
if (accessor.getNBTData().hasKey("Amount"))
amount = accessor.getNBTInteger(accessor.getNBTData(), "Amount");
Integer capacity = (Integer)ThermalExpansionModule.TileTank_getTankCapacity.invoke(accessor.getTileEntity());
currenttip.add(String.format("%d / %d mB", amount, capacity));
}
if (config.getConfig("thermalexpansion.tankmode")){
Byte mode = (Byte)ThermalExpansionModule.TileTank_mode.get(accessor.getTileEntity());
if (mode == 0)
currenttip.add(String.format("%s : \u00a7a%s", LangUtil.translateG("hud.msg.mode"), LangUtil.translateG("hud.msg.input")));
else if (mode == 1)
currenttip.add(String.format("%s : \u00a7c%s", LangUtil.translateG("hud.msg.mode"), LangUtil.translateG("hud.msg.output")));
else
currenttip.add(String.format("Mode : Unknown (%d)", mode));
}
} catch (Exception e){
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -0,0 +1,91 @@
package mcp.mobius.waila.addons.thermalexpansion;
import java.util.List;
import codechicken.lib.lang.LangUtil;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerTesseract implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (config.getConfig("thermalexpansion.tesssendrecv")){
String send = String.format("%s : ", LangUtil.translateG("hud.msg.send"));
String recv = String.format("%s : ", LangUtil.translateG("hud.msg.recv"));
String item = String.format("\u00a7a%s ", LangUtil.translateG("hud.msg.item"));
String fluid= String.format("\u00a79%s ", LangUtil.translateG("hud.msg.fluid"));
String energ= String.format("\u00a7c%s ", LangUtil.translateG("hud.msg.energ"));
switch (accessor.getNBTInteger(accessor.getNBTData(), "Item.Mode")){
case 0:
send += item;
break;
case 1:
recv += item;
break;
case 2:
send += item;
recv += item;
break;
}
switch (accessor.getNBTInteger(accessor.getNBTData(), "Fluid.Mode")){
case 0:
send += fluid;
break;
case 1:
recv += fluid;
break;
case 2:
send += fluid;
recv += fluid;
break;
}
switch (accessor.getNBTInteger(accessor.getNBTData(), "Energy.Mode")){
case 0:
send += energ;
break;
case 1:
recv += energ;
break;
case 2:
send += energ;
recv += energ;
break;
}
if (!send.equals(String.format("%s : ", LangUtil.translateG("hud.msg.send"))))
currenttip.add(send);
if (!send.equals(String.format("%s : ", LangUtil.translateG("hud.msg.recv"))))
currenttip.add(recv);
}
if (config.getConfig("thermalexpansion.tessfreq"))
currenttip.add(String.format("%s : %d",LangUtil.translateG("hud.msg.frequency"), accessor.getNBTInteger(accessor.getNBTData(), "Frequency")));
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -0,0 +1,126 @@
package mcp.mobius.waila.addons.thermalexpansion;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.logging.Level;
import net.minecraftforge.common.ForgeDirection;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ExternalModulesHandler;
public class ThermalExpansionModule {
public static Class IEnergyHandler = null;
public static Method IEnergyHandler_getMaxStorage = null;
public static Class TileEnergyCell = null;
public static Class TileTank = null;
public static Method TileTank_getTankFluid = null;
public static Method TileTank_getTankCapacity = null;
public static Field TileTank_mode = null;
//public static Class TileConduitFluid = null;
//public static Method TileConduitFluid_getRenderFluid = null;
//public static Method TileConduitFluid_getRenderFluidLevel = null;
//public static Class TileConduitItems = null;
public static Class TileTesseract = null;
public static Class ISecureTile = null;
public static Class BlockMultipart = null;
//public static Field TileTesseract_modItem = null;
//public static Field TileTesseract_modFluid = null;
//public static Field TileTesseract_modEnergy = null;
//public static Class TileConduitBase = null;
//public static Field TileConduitBase_isInput = null;
//public static Field TileConduitBase_isOutput = null;
public static void register(){
try{
Class ModThermalExpansion = Class.forName("thermalexpansion.ThermalExpansion");
mod_Waila.log.log(Level.INFO, "Thermal Expansion mod found.");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.INFO, "[Thermal Expansion] ThermalExpansion mod not found.");
return;
}
try{
IEnergyHandler = Class.forName("cofh.api.energy.IEnergyHandler");
IEnergyHandler_getMaxStorage = IEnergyHandler.getMethod("getMaxEnergyStored", ForgeDirection.class);
TileEnergyCell = Class.forName("thermalexpansion.block.energycell.TileEnergyCell");
TileTank = Class.forName("thermalexpansion.block.tank.TileTank");
TileTank_getTankFluid = TileTank.getMethod("getTankFluid");
TileTank_getTankCapacity = TileTank.getMethod("getTankCapacity");
TileTank_mode = TileTank.getField("mode");
//TileConduitFluid = Class.forName("thermalexpansion.block.conduit.fluid.TileConduitFluid");
//TileConduitFluid_getRenderFluid = TileConduitFluid.getMethod("getRenderFluid");
//TileConduitFluid_getRenderFluidLevel = TileConduitFluid.getMethod("getRenderFluidLevel");
//TileConduitItems = Class.forName("thermalexpansion.block.conduit.item.TileConduitItem");
TileTesseract = Class.forName("thermalexpansion.block.tesseract.TileTesseract");
ISecureTile = Class.forName("cofh.api.tileentity.ISecureTile");
BlockMultipart = Class.forName("codechicken.multipart.BlockMultipart");
//TileTesseract_modItem = TileTesseract.getField("modItem");
//TileTesseract_modFluid = TileTesseract.getField("modFluid");
//TileTesseract_modEnergy = TileTesseract.getField("modEnergy");
//TileConduitBase = Class.forName("thermalexpansion.block.conduit.TileConduitBase");
//TileConduitBase_isInput = TileConduitBase.getField("isInput");
//TileConduitBase_isOutput = TileConduitBase.getField("isOutput");
//TileEnergyCell_energyReceive = TileEnergyCell.getField("energyReceive");
//TileEnergyCell_energySend = TileEnergyCell.getField("energySend");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.WARNING, "[Thermal Expansion] Class not found. " + e);
return;
} catch (NoSuchMethodException e){
mod_Waila.log.log(Level.WARNING, "[Thermal Expansion] Method not found." + e);
return;
} catch (NoSuchFieldException e){
mod_Waila.log.log(Level.WARNING, "[Thermal Expansion] Field not found." + e);
return;
// } catch (Exception e){
// mod_Waila.log.log(Level.WARNING, "[Thermal Expansion] Unhandled exception." + e);
// return;
}
ExternalModulesHandler.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.energyhandler");
ExternalModulesHandler.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.energycell");
ExternalModulesHandler.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.fluidtype");
ExternalModulesHandler.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.fluidamount");
ExternalModulesHandler.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.conditemmode");
ExternalModulesHandler.instance().addConfig("Thermal Expansion", "thermalexpansion.tankmode");
ExternalModulesHandler.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.tesssendrecv");
ExternalModulesHandler.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.tessfreq");
ExternalModulesHandler.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.owner");
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerIEnergyHandler(), IEnergyHandler);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerEnergyCell(), TileEnergyCell);
ExternalModulesHandler.instance().registerHeadProvider(new HUDHandlerTank(), TileTank);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerTank(), TileTank);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerTesseract(), TileTesseract);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerISecureTile(), ISecureTile);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerConduitFluid(), BlockMultipart);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerConduitItem(), BlockMultipart);
}
}
@@ -0,0 +1,85 @@
package mcp.mobius.waila.addons.vanillamc;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.api.IWailaBlockDecorator;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.gui.helpers.UIHelper;
public class HUDDecoratorVanilla implements IWailaBlockDecorator {
@Override
public void decorateBlock(ItemStack itemStack, IWailaDataAccessor accessor, IWailaConfigHandler config) {
Tessellator tessellator = Tessellator.instance;
//UIHelper.drawBillboardText(itemStack.getDisplayName(), accessor.getRenderingPosition(), 0.5F, 1.5F, 0.5F, accessor.getPartialFrame());
UIHelper.drawFloatingText("IN", accessor.getRenderingPosition(), 0.5F, 0.2F, -0.2F, 90F, 0F, 0F);
UIHelper.drawFloatingText("OUT", accessor.getRenderingPosition(), -0.2F, 0.2F, 0.5F, 90F, 90F, 0F);
UIHelper.drawFloatingText("OUT", accessor.getRenderingPosition(), 1.2F, 0.2F, 0.5F, 90F, -90F, 0F);
UIHelper.drawFloatingText("OUT", accessor.getRenderingPosition(), 0.5F, 0.2F, 1.2F, 90F, -180F, 0F);
double offset = 0.1;
double delta = 1 + 2 * offset;
double x = accessor.getRenderingPosition().xCoord - offset;
double y = accessor.getRenderingPosition().yCoord - offset;
double z = accessor.getRenderingPosition().zCoord - offset;
tessellator.startDrawingQuads();
tessellator.setColorRGBA(255, 255, 255, 150);
tessellator.addVertex(x, y + 0.2 , z);
tessellator.addVertex(x, y + 0.2 , z + delta/2 - 0.1);
tessellator.addVertex(x + offset, y + 0.2, z + delta/2 - 0.1);
tessellator.addVertex(x + offset, y + 0.2, z);
tessellator.addVertex(x, y + 0.2 , z + delta/2 + 0.1);
tessellator.addVertex(x, y + 0.2 , z + delta);
tessellator.addVertex(x + offset, y + 0.2, z + delta);
tessellator.addVertex(x + offset, y + 0.2, z + delta/2 + 0.1);
tessellator.addVertex(x + delta - 0.1, y + 0.2 , z + 0.1);
tessellator.addVertex(x + delta - 0.1, y + 0.2 , z + delta/2 - 0.1);
tessellator.addVertex(x + delta + offset - 0.1, y + 0.2, z + delta/2 - 0.1);
tessellator.addVertex(x + delta + offset - 0.1, y + 0.2, z + 0.1);
tessellator.addVertex(x + delta - 0.1, y + 0.2 , z + delta/2 + 0.1);
tessellator.addVertex(x + delta - 0.1, y + 0.2 , z + delta);
tessellator.addVertex(x + delta + offset - 0.1, y + 0.2, z + delta);
tessellator.addVertex(x + delta + offset - 0.1, y + 0.2, z + delta/2 + 0.1);
tessellator.addVertex(x+ 0.1, y + 0.2, z);
tessellator.addVertex(x+ 0.1, y + 0.2, z+ offset);
tessellator.addVertex(x+ delta/2 - 0.1, y + 0.2, z+ offset);
tessellator.addVertex(x+ delta/2 - 0.1, y + 0.2, z);
tessellator.addVertex(x+ delta/2 + 0.1, y + 0.2, z);
tessellator.addVertex(x+ delta/2 + 0.1, y + 0.2, z+ offset);
tessellator.addVertex(x+ delta, y + 0.2, z+ offset);
tessellator.addVertex(x+ delta, y + 0.2, z);
tessellator.addVertex(x + 0.1, y + 0.2, z+ delta - 0.1);
tessellator.addVertex(x + 0.1, y + 0.2, z+ offset+ delta - 0.1);
tessellator.addVertex(x+ delta/2 - 0.1, y + 0.2, z+ offset+ delta - 0.1);
tessellator.addVertex(x+ delta/2 - 0.1, y + 0.2, z+ delta - 0.1);
tessellator.addVertex(x+ delta/2 + 0.1, y + 0.2, z+ delta - 0.1);
tessellator.addVertex(x+ delta/2 + 0.1, y + 0.2, z+ offset+ delta - 0.1);
tessellator.addVertex(x+ delta - 0.1, y + 0.2, z+ offset+ delta - 0.1);
tessellator.addVertex(x+ delta - 0.1, y + 0.2, z+ delta - 0.1);
tessellator.draw();
}
}
@@ -2,7 +2,9 @@ package mcp.mobius.waila.addons.vanillamc;
import java.util.List;
import codechicken.lib.lang.LangUtil;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSilverfish;
import net.minecraft.item.Item;
import net.minecraft.item.ItemRecord;
import net.minecraft.item.ItemStack;
@@ -28,11 +30,31 @@ public class HUDHandlerVanilla implements IWailaDataProvider {
static int comparatorAct = Block.redstoneComparatorActive.blockID;
static int redstone = Block.redstoneWire.blockID;
static int jukebox = Block.jukebox.blockID;
static int cocoa = Block.cocoaPlant.blockID;
static int netherwart = Block.netherStalk.blockID;
static int silverfish = Block.silverfish.blockID;
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
int blockID = accessor.getBlockID();
if (blockID == silverfish){
int metadata = accessor.getMetadata();
switch(metadata){
case 0:
return new ItemStack(Block.stone);
case 1:
return new ItemStack(Block.cobblestone);
case 2:
return new ItemStack(Block.stoneBrick);
default:
return null;
}
}
return null;
}
@Override
@@ -61,17 +83,36 @@ public class HUDHandlerVanilla implements IWailaDataProvider {
if (config.getConfig("vanilla.growthvalue"))
if (blockID == cropsID || blockID == melonStemID || blockID == pumpkinStemID || blockID == carrotID || blockID == potatoID){
float growthValue = (accessor.getMetadata() / 7.0F) * 100.0F;
if (growthValue != 100.0)
currenttip.add(String.format("Growth : %.0f %%", growthValue));
if (growthValue < 100.0)
currenttip.add(String.format("%s : %.0f %%", LangUtil.translateG("hud.msg.growth"), growthValue));
else
currenttip.add("Growth : Mature");
currenttip.add(String.format("%s : %s", LangUtil.translateG("hud.msg.growth"), LangUtil.translateG("hud.msg.mature")));
return currenttip;
}
if (blockID == cocoa){
float growthValue = ((accessor.getMetadata() >> 2) / 2.0F) * 100.0F;
if (growthValue < 100.0)
currenttip.add(String.format("%s : %.0f %%", LangUtil.translateG("hud.msg.growth"), growthValue));
else
currenttip.add(String.format("%s : %s", LangUtil.translateG("hud.msg.growth"), LangUtil.translateG("hud.msg.mature")));
return currenttip;
}
if (blockID == netherwart){
float growthValue = (accessor.getMetadata() / 3.0F) * 100.0F;
if (growthValue < 100.0)
currenttip.add(String.format("%s : %.0f %%", LangUtil.translateG("hud.msg.growth"), growthValue));
else
currenttip.add(String.format("%s : %s", LangUtil.translateG("hud.msg.growth"), LangUtil.translateG("hud.msg.mature")));
return currenttip;
}
if (config.getConfig("vanilla.leverstate"))
if (blockID == leverID){
String redstoneOn = (accessor.getMetadata() & 8) == 0 ? "Off" : "On";
currenttip.add("State : " + redstoneOn);
String redstoneOn = (accessor.getMetadata() & 8) == 0 ? LangUtil.translateG("hud.msg.off") : LangUtil.translateG("hud.msg.on");
currenttip.add(String.format("%s : %s", LangUtil.translateG("hud.msg.state"), redstoneOn));
return currenttip;
}
@@ -79,15 +120,15 @@ public class HUDHandlerVanilla implements IWailaDataProvider {
if ((blockID == repeaterIdle) ||(blockID == repeaterActv)){
int tick = (accessor.getMetadata() >> 2) + 1 ;
if (tick == 1)
currenttip.add(String.format("Delay : %s tick", tick));
currenttip.add(String.format("%s : %s tick", LangUtil.translateG("hud.msg.delay"), tick));
else
currenttip.add(String.format("Delay : %s ticks", tick));
currenttip.add(String.format("%s : %s ticks", LangUtil.translateG("hud.msg.delay"), tick));
return currenttip;
}
if (config.getConfig("vanilla.comparator"))
if ((blockID == comparatorIdl) ||(blockID == comparatorAct)){
String mode = ((accessor.getMetadata() >> 2) & 1) == 0 ? "Comparator" : "Subtractor";
String mode = ((accessor.getMetadata() >> 2) & 1) == 0 ? LangUtil.translateG("hud.msg.comparator") : LangUtil.translateG("hud.msg.substractor");
//int outputSignal = ((TileEntityComparator)entity).func_96100_a();
currenttip.add("Mode : " + mode);
//currenttip.add(String.format("Out : %s", outputSignal));
@@ -96,7 +137,7 @@ public class HUDHandlerVanilla implements IWailaDataProvider {
if (config.getConfig("vanilla.redstone"))
if (blockID == redstone){
currenttip.add(String.format("Power : %s" , accessor.getMetadata()));
currenttip.add(String.format("%s : %s" , LangUtil.translateG("hud.msg.power"), accessor.getMetadata()));
return currenttip;
}
@@ -108,7 +149,7 @@ public class HUDHandlerVanilla implements IWailaDataProvider {
record = Item.itemsList[accessor.getNBTInteger(tag, "Record")];
currenttip.add(((ItemRecord)record).getRecordTitle());
} else {
currenttip.add("<Empty>");
currenttip.add(LangUtil.translateG("hud.msg.empty"));
}
}
@@ -121,29 +162,37 @@ public class HUDHandlerVanilla implements IWailaDataProvider {
}
public static void register(){
ExternalModulesHandler.instance().addConfig("VanillaMC", "vanilla.spawntype", "Spawner type");
ExternalModulesHandler.instance().addConfig("VanillaMC", "vanilla.growthvalue", "Growth value");
ExternalModulesHandler.instance().addConfig("VanillaMC", "vanilla.leverstate", "Lever state");
ExternalModulesHandler.instance().addConfig("VanillaMC", "vanilla.repeater", "Repeater delay");
ExternalModulesHandler.instance().addConfig("VanillaMC", "vanilla.comparator", "Comparator mode");
ExternalModulesHandler.instance().addConfig("VanillaMC", "vanilla.redstone", "Redstone power");
ExternalModulesHandler.instance().addConfigRemote("VanillaMC", "vanilla.jukebox", "Jukebox disk");
ExternalModulesHandler.instance().registerHeadProvider(new HUDHandlerVanilla(), mobSpawnerID);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), cropsID);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), melonStemID);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), pumpkinStemID);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), carrotID);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), potatoID);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), leverID);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), repeaterIdle);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), repeaterActv);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), comparatorIdl);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), comparatorAct);
ExternalModulesHandler.instance().registerHeadProvider(new HUDHandlerVanilla(), redstone);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), redstone);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), jukebox);
ExternalModulesHandler.instance().addConfig("VanillaMC", "vanilla.spawntype");
ExternalModulesHandler.instance().addConfig("VanillaMC", "vanilla.growthvalue");
ExternalModulesHandler.instance().addConfig("VanillaMC", "vanilla.leverstate");
ExternalModulesHandler.instance().addConfig("VanillaMC", "vanilla.repeater");
ExternalModulesHandler.instance().addConfig("VanillaMC", "vanilla.comparator");
ExternalModulesHandler.instance().addConfig("VanillaMC", "vanilla.redstone");
ExternalModulesHandler.instance().addConfigRemote("VanillaMC", "vanilla.jukebox");
ExternalModulesHandler.instance().registerDocTextFile("/mcp/mobius/waila/addons/vanillamc/WikiData.csv");
IWailaDataProvider provider = new HUDHandlerVanilla();
ExternalModulesHandler.instance().registerStackProvider(provider, silverfish);
ExternalModulesHandler.instance().registerHeadProvider(provider, mobSpawnerID);
ExternalModulesHandler.instance().registerBodyProvider(provider, cropsID);
ExternalModulesHandler.instance().registerBodyProvider(provider, melonStemID);
ExternalModulesHandler.instance().registerBodyProvider(provider, pumpkinStemID);
ExternalModulesHandler.instance().registerBodyProvider(provider, carrotID);
ExternalModulesHandler.instance().registerBodyProvider(provider, potatoID);
ExternalModulesHandler.instance().registerBodyProvider(provider, leverID);
ExternalModulesHandler.instance().registerBodyProvider(provider, repeaterIdle);
ExternalModulesHandler.instance().registerBodyProvider(provider, repeaterActv);
ExternalModulesHandler.instance().registerBodyProvider(provider, comparatorIdl);
ExternalModulesHandler.instance().registerBodyProvider(provider, comparatorAct);
ExternalModulesHandler.instance().registerHeadProvider(provider, redstone);
ExternalModulesHandler.instance().registerBodyProvider(provider, redstone);
ExternalModulesHandler.instance().registerBodyProvider(provider, jukebox);
ExternalModulesHandler.instance().registerBodyProvider(provider, cocoa);
ExternalModulesHandler.instance().registerBodyProvider(provider, netherwart);
ExternalModulesHandler.instance().registerDocTextFile("/mcp/mobius/waila/addons/vanillamc/WikiData.csv");
//ExternalModulesHandler.instance().registerBlockDecorator(new HUDDecoratorVanilla(), repeaterIdle);
}
@@ -0,0 +1,11 @@
package mcp.mobius.waila.api;
import java.util.List;
import net.minecraft.item.ItemStack;
public interface IWailaBlockDecorator {
void decorateBlock(ItemStack itemStack, IWailaDataAccessor accessor, IWailaConfigHandler config);
}
+10 -5
View File
@@ -5,16 +5,21 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
public interface IWailaDataAccessor {
World getWorld();
EntityPlayer getPlayer();
Block getBlock();
int getBlockID();
int getMetadata();
World getWorld();
EntityPlayer getPlayer();
Block getBlock();
int getBlockID();
int getMetadata();
TileEntity getTileEntity();
MovingObjectPosition getPosition();
Vec3 getRenderingPosition();
NBTTagCompound getNBTData();
int getNBTInteger(NBTTagCompound tag, String keyname);
double getPartialFrame();
ForgeDirection getSide();
}
+6 -1
View File
@@ -4,6 +4,8 @@ public interface IWailaRegistrar {
/* Add a config option in the section modname with displayed text configtext and access key keyname */
public void addConfig(String modname, String keyname, String configtext);
public void addConfigRemote(String modname, String keyname, String configtext);
public void addConfig(String modname, String keyname);
public void addConfigRemote(String modname, String keyname);
/* Register a IWailaDataProvider for the given blockID, either for the Head section or the Body section */
public void registerHeadProvider (IWailaDataProvider dataProvider, int blockID);
@@ -14,12 +16,15 @@ public interface IWailaRegistrar {
public void registerStackProvider(IWailaDataProvider dataProvider, int blockID);
public void registerStackProvider(IWailaDataProvider dataProvider, Class block);
/* Same thing, but works on a class hierarchy instead */
public void registerHeadProvider (IWailaDataProvider dataProvider, Class block);
public void registerBodyProvider (IWailaDataProvider dataProvider, Class block);
public void registerTailProvider (IWailaDataProvider dataProvider, Class block);
/* The block decorators */
public void registerBlockDecorator (IWailaBlockDecorator decorator, int blockID);
public void registerBlockDecorator (IWailaBlockDecorator decorator, Class block);
public void registerDocTextFile (String filename);
public void registerShortDataProvider (IWailaSummaryProvider dataProvider, Class item);
@@ -1,35 +1,28 @@
package mcp.mobius.waila;
package mcp.mobius.waila.client;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import org.lwjgl.input.Keyboard;
import codechicken.core.Profiler;
import codechicken.nei.NEIClientUtils;
import codechicken.nei.api.API;
import codechicken.nei.forge.GuiContainerManager;
import codechicken.nei.recipe.GuiCraftingRecipe;
import codechicken.nei.recipe.GuiUsageRecipe;
import codechicken.nei.recipe.ICraftingHandler;
import codechicken.nei.recipe.ProfilerRecipeHandler;
import mcp.mobius.waila.Constants;
import mcp.mobius.waila.addons.ConfigHandler;
import mcp.mobius.waila.gui.screens.ScreenBase;
import mcp.mobius.waila.gui.screens.config.ScreenConfig;
import mcp.mobius.waila.gui.screens.config.ScreenHUDConfig;
import mcp.mobius.waila.gui.screens.config.ScreenWailaConfig;
import mcp.mobius.waila.gui.screens.info.ScreenEnchants;
import mcp.mobius.waila.gui.testing.ScreenTest;
import mcp.mobius.waila.handlers.nei.HandlerEnchants;
import mcp.mobius.waila.overlay.RayTracing;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumMovingObjectType;
import org.lwjgl.input.Keyboard;
import codechicken.lib.lang.LangUtil;
import codechicken.nei.api.API;
import codechicken.nei.forge.GuiContainerManager;
import codechicken.nei.recipe.GuiCraftingRecipe;
import codechicken.nei.recipe.GuiUsageRecipe;
import cpw.mods.fml.client.registry.KeyBindingRegistry.KeyHandler;
import cpw.mods.fml.common.TickType;
import cpw.mods.fml.common.registry.LanguageRegistry;
@@ -46,22 +39,24 @@ public class ConfigKeyHandler extends KeyHandler {
new KeyBinding(Constants.BIND_WAILA_LIQUID, Keyboard.KEY_NUMPAD2),
new KeyBinding(Constants.BIND_WAILA_RECIPE, Keyboard.KEY_NUMPAD3),
new KeyBinding(Constants.BIND_WAILA_USAGE, Keyboard.KEY_NUMPAD4),
new KeyBinding(Constants.BIND_WAILA_TESTING, Keyboard.KEY_NUMPAD9),
//new KeyBinding(Constants.BIND_WAILA_TESTING, Keyboard.KEY_NUMPAD9),
}, new boolean[]{
false,
false,
false,
false,
false,
false
//false
});
LanguageRegistry.instance().addStringLocalization(Constants.BIND_WAILA_CFG, "[Waila] Config screen");
LanguageRegistry.instance().addStringLocalization(Constants.BIND_WAILA_SHOW, "[Waila] Show/Hide");
LanguageRegistry.instance().addStringLocalization(Constants.BIND_WAILA_LIQUID, "[Waila] Show liquids");
LanguageRegistry.instance().addStringLocalization(Constants.BIND_WAILA_RECIPE, "[Waila] Show recipe");
LanguageRegistry.instance().addStringLocalization(Constants.BIND_WAILA_USAGE, "[Waila] Show usage");
LanguageRegistry.instance().addStringLocalization(Constants.BIND_WAILA_TESTING, "[Waila] Testing");
/*
LanguageRegistry.instance().addStringLocalization(Constants.BIND_WAILA_CFG, LangUtil.translateG("keybind.configscreen"));
LanguageRegistry.instance().addStringLocalization(Constants.BIND_WAILA_SHOW, LangUtil.translateG("keybind.showhide"));
LanguageRegistry.instance().addStringLocalization(Constants.BIND_WAILA_LIQUID, LangUtil.translateG("keybind.showliquid"));
LanguageRegistry.instance().addStringLocalization(Constants.BIND_WAILA_RECIPE, LangUtil.translateG("keybind.showrecipe"));
LanguageRegistry.instance().addStringLocalization(Constants.BIND_WAILA_USAGE, LangUtil.translateG("keybind.showusage"));
LanguageRegistry.instance().addStringLocalization(Constants.BIND_WAILA_TESTING, LangUtil.translateG("keybind.testing"));
*/
//LanguageRegistry.instance().addStringLocalization(Constants.BIND_SCREEN_ENCH, "[Waila] Show enchant screen");
//LanguageRegistry.instance().addStringLocalization("key.wailatedump", "[Waila] Dump server TE");
@@ -130,7 +125,7 @@ public class ConfigKeyHandler extends KeyHandler {
ItemStack target = stacks.get(0).copy();
target.setItemDamage(0);
if(!GuiCraftingRecipe.openRecipeGui("item", target)){
mc.thePlayer.addChatMessage("\u00a7f\u00a7oNo recipe found.");
mc.thePlayer.addChatMessage("\u00a7f\u00a7o" + LangUtil.translateG("client.msg.norecipe"));
mc.displayGuiScreen((GuiScreen)null);
mc.setIngameFocus();
}
@@ -141,7 +136,7 @@ public class ConfigKeyHandler extends KeyHandler {
ItemStack target = stacks.get(0).copy();
target.setItemDamage(0);
if(!GuiUsageRecipe.openRecipeGui("item", target)){
mc.thePlayer.addChatMessage("\u00a7f\u00a7oNo usage found.");
mc.thePlayer.addChatMessage("\u00a7f\u00a7o" + LangUtil.translateG("client.msg.nousage"));
mc.displayGuiScreen((GuiScreen)null);
mc.setIngameFocus();
}
@@ -1,9 +1,37 @@
package mcp.mobius.waila;
package mcp.mobius.waila.client;
import mcp.mobius.waila.Constants;
import mcp.mobius.waila.addons.ExternalModulesHandler;
import mcp.mobius.waila.addons.appeng.AppEngModule;
import mcp.mobius.waila.addons.buildcraft.BCModule;
import mcp.mobius.waila.addons.buildcraft.BCPowerAPIModule;
import mcp.mobius.waila.addons.enderio.EnderIOModule;
import mcp.mobius.waila.addons.enderstorage.EnderStorageModule;
import mcp.mobius.waila.addons.etb.ETBModule;
import mcp.mobius.waila.addons.exu.ExtraUtilitiesModule;
import mcp.mobius.waila.addons.gravestone.GravestoneModule;
import mcp.mobius.waila.addons.ic2.IC2Module;
import mcp.mobius.waila.addons.openblocks.OpenBlocksModule;
import mcp.mobius.waila.addons.projectred.ProjectRedModule;
import mcp.mobius.waila.addons.railcraft.RailcraftModule;
import mcp.mobius.waila.addons.thaumcraft.ThaumcraftModule;
import mcp.mobius.waila.addons.thermalexpansion.ThermalExpansionModule;
import mcp.mobius.waila.addons.twilightforest.TwilightForestModule;
import mcp.mobius.waila.addons.vanillamc.HUDHandlerVanilla;
import mcp.mobius.waila.gui.truetyper.FontLoader;
import mcp.mobius.waila.gui.truetyper.TrueTypeFont;
import mcp.mobius.waila.handlers.SummaryProviderDefault;
import mcp.mobius.waila.handlers.hud.HUDHandlerExternal;
import mcp.mobius.waila.handlers.hud.HUDHandlerWaila;
import mcp.mobius.waila.handlers.tooltip.TooltipHandlerWaila;
import mcp.mobius.waila.overlay.WailaTickHandler;
import mcp.mobius.waila.server.ProxyServer;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.input.Keyboard;
import codechicken.lib.lang.LangUtil;
import codechicken.nei.NEIClientConfig;
import codechicken.nei.api.API;
import codechicken.nei.api.ItemInfo;
@@ -11,33 +39,23 @@ import codechicken.nei.forge.GuiContainerManager;
import cpw.mods.fml.client.registry.KeyBindingRegistry;
import cpw.mods.fml.common.registry.TickRegistry;
import cpw.mods.fml.relauncher.Side;
import mcp.mobius.waila.addons.ExternalModulesHandler;
import mcp.mobius.waila.addons.appeng.AppEngModule;
import mcp.mobius.waila.addons.betterbarrels.BetterBarrelsModule;
import mcp.mobius.waila.addons.buildcraft.BCModule;
import mcp.mobius.waila.addons.enderstorage.EnderStorageModule;
import mcp.mobius.waila.addons.gravestone.GravestoneModule;
import mcp.mobius.waila.addons.ic2.IC2Module;
import mcp.mobius.waila.addons.thaumcraft.ThaumcraftModule;
import mcp.mobius.waila.addons.twilightforest.TwilightForestModule;
import mcp.mobius.waila.addons.vanillamc.HUDHandlerVanilla;
import mcp.mobius.waila.gui_old.NEI.HandlerTechTree;
import mcp.mobius.waila.gui_old.NEI.HandlerWiki;
import mcp.mobius.waila.handlers.SummaryProviderDefault;
import mcp.mobius.waila.handlers.hud.HUDHandlerExternal;
import mcp.mobius.waila.handlers.hud.HUDHandlerWaila;
import mcp.mobius.waila.handlers.nei.HandlerEnchants;
import mcp.mobius.waila.handlers.tooltip.TooltipHandlerWaila;
import mcp.mobius.waila.overlay.WailaTickHandler;
import mcp.mobius.waila.server.ProxyServer;
public class ProxyClient extends ProxyServer {
TrueTypeFont minecraftiaFont;
//public static LangUtil lang = LangUtil.loadLangDir("waila");
public ProxyClient() {}
@Override
public void registerHandlers(){
LangUtil.instance.loadLangDir("waila");
minecraftiaFont = FontLoader.createFont(new ResourceLocation("waila", "fonts/Minecraftia.ttf"), 14, true);
TickRegistry.registerTickHandler(new WailaTickHandler(), Side.CLIENT);
GuiContainerManager.addTooltipHandler(new TooltipHandlerWaila());
@@ -56,10 +74,9 @@ public class ProxyClient extends ProxyServer {
//API.addKeyBind(Constants.BIND_TECH, "Display techtree", Keyboard.KEY_RSHIFT);
ExternalModulesHandler.instance().registerShortDataProvider(new SummaryProviderDefault(), Item.class);
this.registerMods();
}
@Override
public void registerMods(){
HUDHandlerVanilla.register();
@@ -87,6 +104,32 @@ public class ProxyClient extends ProxyServer {
/* Applied Energetics */
AppEngModule.register();
/* Thermal Expansion */
ThermalExpansionModule.register();
/* ETB */
ETBModule.register();
/* EnderIO */
EnderIOModule.register();
/* Buildcraft Power API */
BCPowerAPIModule.register();
/* ProjectRed API */
ProjectRedModule.register();
/* ExtraUtilities */
ExtraUtilitiesModule.register();
/* OpenBlocks */
OpenBlocksModule.register();
/* Railcraft */
RailcraftModule.register();
}
@Override
public Object getFont(){return this.minecraftiaFont;}
}
@@ -0,0 +1,81 @@
package mcp.mobius.waila.client;
import java.util.ArrayList;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import mcp.mobius.waila.WailaExceptionHandler;
import mcp.mobius.waila.addons.ConfigHandler;
import mcp.mobius.waila.addons.ExternalModulesHandler;
import mcp.mobius.waila.api.IWailaBlockDecorator;
import mcp.mobius.waila.handlers.DataAccessor;
import mcp.mobius.waila.overlay.RayTracing;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.event.ForgeSubscribe;
public class WailaClientEventHandler {
@ForgeSubscribe
@SideOnly(Side.CLIENT)
public void onRenderWorldLast(RenderWorldLastEvent event) {
if (RayTracing.raytracedTarget == null || RayTracing.raytracedStack == null) return;
double partialTicks = event.partialTicks;
DataAccessor accessor = DataAccessor.instance;
World world = Minecraft.getMinecraft().theWorld;
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
EntityLivingBase viewEntity = Minecraft.getMinecraft().renderViewEntity;
if (world == null || player == null || viewEntity == null) return;
accessor.set(world, player, RayTracing.raytracedTarget, viewEntity, partialTicks);
Block block = accessor.getBlock();
int blockID = accessor.getBlockID();
if (!ExternalModulesHandler.instance().hasBlockDecorator(blockID) && !ExternalModulesHandler.instance().hasBlockDecorator(block)) return;
GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glDepthMask(false);
if (ExternalModulesHandler.instance().hasBlockDecorator(blockID)){
for (IWailaBlockDecorator decorator : ExternalModulesHandler.instance().getBlockDecorators(blockID))
try{
GL11.glPushMatrix();
decorator.decorateBlock(RayTracing.raytracedStack, accessor, ConfigHandler.instance());
GL11.glPopMatrix();
} catch (Throwable e){
GL11.glPopMatrix();
WailaExceptionHandler.handleErr(e, decorator.getClass().toString(), null);
}
}
if (ExternalModulesHandler.instance().hasBlockDecorator(block)){
for (IWailaBlockDecorator decorator : ExternalModulesHandler.instance().getBlockDecorators(block))
try{
GL11.glPushMatrix();
decorator.decorateBlock(RayTracing.raytracedStack, accessor, ConfigHandler.instance());
GL11.glPopMatrix();
} catch (Throwable e){
GL11.glPopMatrix();
WailaExceptionHandler.handleErr(e, decorator.getClass().toString(), null);
}
}
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glPopAttrib();
}
}
+103
View File
@@ -2,7 +2,11 @@ package mcp.mobius.waila.gui.helpers;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.Vec3;
public class UIHelper {
@@ -55,4 +59,103 @@ public class UIHelper {
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
public static void drawBillboardText(String text, Vec3 pos, float offX, float offY, float offZ, double partialFrame){
UIHelper.drawBillboardText(text, (float)pos.xCoord, (float)pos.yCoord, (float)pos.zCoord, offX, offY, offZ, partialFrame);
}
public static void drawBillboardText(String text, float posX, float posY, float posZ, float offX, float offY, float offZ, double partialFrame){
EntityLivingBase player = Minecraft.getMinecraft().renderViewEntity;
float playerViewY = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * (float)partialFrame;
float playerViewX = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * (float)partialFrame;
UIHelper.drawFloatingText(text, posX, posY, posZ, offX, offY, offZ, playerViewX, playerViewY * -1.0F, 0.0F);
}
public static void drawFloatingText(String text, Vec3 pos, float offX, float offY, float offZ, float rotX, float rotY, float rotZ){
UIHelper.drawFloatingText(text, (float)pos.xCoord, (float)pos.yCoord, (float)pos.zCoord, offX, offY, offZ, rotX, rotY, rotZ);
}
public static void drawFloatingText(String text, float posX, float posY, float posZ, float offX, float offY, float offZ, float rotX, float rotY, float rotZ){
if (text.isEmpty()) return;
FontRenderer fontrenderer = Minecraft.getMinecraft().fontRenderer;
float f = 1.6F;
float f1 = 0.016666668F * f;
GL11.glPushMatrix();
//GL11.glTranslatef((float)accessor.getPosition().blockX + 0.0F, (float)accessor.getPosition().blockY + 0.5F, (float)accessor.getPosition().blockZ);
GL11.glTranslatef(posX + offX, posY + offY, posZ + offZ);
//GL11.glTranslatef(posX, posY, posZ);
GL11.glNormal3f(0.0F, 1.0F, 0.0F);
GL11.glRotatef(rotY, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(rotX, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(rotZ, 0.0F, 0.0F, 1.0F);
//GL11.glTranslatef(offX, offY, offZ);
GL11.glScalef(-f1, -f1, f1);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDepthMask(false);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
byte b0 = 0;
Tessellator tessellator = Tessellator.instance;
GL11.glDisable(GL11.GL_TEXTURE_2D);
tessellator.startDrawingQuads();
int j = fontrenderer.getStringWidth(text) / 2;
tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
tessellator.addVertex((double)(-j - 1), (double)(-1 + b0), 0.0D);
tessellator.addVertex((double)(-j - 1), (double)(8 + b0), 0.0D);
tessellator.addVertex((double)(j + 1), (double)(8 + b0), 0.0D);
tessellator.addVertex((double)(j + 1), (double)(-1 + b0), 0.0D);
tessellator.draw();
GL11.glEnable(GL11.GL_TEXTURE_2D);
fontrenderer.drawString(text, -fontrenderer.getStringWidth(text) / 2, b0, 553648127);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDepthMask(true);
fontrenderer.drawString(text, -fontrenderer.getStringWidth(text) / 2, b0, -1);
//GL11.glEnable(GL11.GL_LIGHTING);
//GL11.glDisable(GL11.GL_BLEND);
//GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glPopMatrix();
}
public static void drawRectangle(double x1, double y1, double z1, double x2, double y2, double z2, int r, int g, int b, int a){
Tessellator tessellator = Tessellator.instance;
tessellator.setColorRGBA(r, g, b, a);
tessellator.startDrawingQuads();
tessellator.addVertex(x1, y2, z1);
tessellator.addVertex(x1, y1, z2);
tessellator.addVertex(x2, y1, z2);
tessellator.addVertex(x2, y2, z1);
tessellator.draw();
}
public static void drawRectangleEW(double x1, double y1, double z1, double x2, double y2, double z2, int r, int g, int b, int a){
Tessellator tessellator = Tessellator.instance;
tessellator.setColorRGBA(r, g, b, a);
tessellator.startDrawingQuads();
tessellator.addVertex(x1, y1, z1);
tessellator.addVertex(x1, y1, z2);
tessellator.addVertex(x2, y2, z2);
tessellator.addVertex(x2, y2, z1);
tessellator.draw();
}
}
@@ -21,12 +21,12 @@ public class ScreenConfig extends ScreenBase {
ButtonContainer buttonContainer = ((ButtonContainer)this.getRoot().getWidget("ButtonContainer"));
buttonContainer.addButton( new ButtonScreenChange(this.getRoot(), "Waila", new ScreenWailaConfig(this)));
buttonContainer.addButton( new ButtonScreenChange(this.getRoot(), "Modules", new ScreenModuleChoice(this)));
buttonContainer.addButton( new ButtonScreenChange(this.getRoot(), "screen.button.waila", new ScreenWailaConfig(this)));
buttonContainer.addButton( new ButtonScreenChange(this.getRoot(), "screen.button.modules", new ScreenModuleChoice(this)));
this.getRoot().addWidget("LayoutBack", new LayoutBase(this.getRoot()));
this.getRoot().getWidget("LayoutBack").setGeometry(new WidgetGeometry(0.0, 80.0, 100.0, 20.0, CType.RELXY, CType.RELXY));
this.getRoot().getWidget("LayoutBack").addWidget("ButtonBack", new ButtonScreenChange(this.getRoot().getWidget("LayoutBack"), "Back", this.parent));
this.getRoot().getWidget("LayoutBack").addWidget("ButtonBack", new ButtonScreenChange(this.getRoot().getWidget("LayoutBack"), "screen.button.back", this.parent));
this.getRoot().getWidget("LayoutBack").getWidget("ButtonBack").setGeometry(new WidgetGeometry(50.0, 50.0, 100.0, 20.0, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
}
}
@@ -58,7 +58,7 @@ public class ScreenHUDConfig extends ScreenBase {
((LayoutMargin)this.getWidget("Layout")).setMargins(picSX/2, picSX/2, picSY/2, picSY/2);
this.getWidget("Layout").addWidget("Picture", new PictureMovableRC(null, "waila:textures/config_template.png")).setGeometry(new WidgetGeometry(picX, picY, picSX, picSY,CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
this.addWidget("TextTuto1", new LabelFixedFont(null, "Drag the HUD to setup its position.")).setGeometry(new WidgetGeometry(50.0, 30.0,20,20, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));;
this.addWidget("TextTuto1", new LabelFixedFont(null, "screen.label.dragtuto")).setGeometry(new WidgetGeometry(50.0, 30.0,20,20, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));;
IWidget layoutX = this.addWidget("LayoutX", new LayoutBase(this));
layoutX.setGeometry(new WidgetGeometry(35.0,50.0,20,80,CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
@@ -83,15 +83,15 @@ public class ScreenHUDConfig extends ScreenBase {
IWidget layoutScale = this.addWidget("LayoutScale", new LayoutBase(this));
layoutScale.setGeometry(new WidgetGeometry(65.0,50.0,20,80,CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
layoutScale.addWidget("LabelScale", new LabelFixedFont(null, "Scale")).setGeometry(new WidgetGeometry(50.0, 0.0,20,20, CType.REL_X, CType.ABSXY, WAlign.CENTER, WAlign.TOP));
layoutScale.addWidget("LabelScale", new LabelFixedFont(null, "screen.label.scale")).setGeometry(new WidgetGeometry(50.0, 0.0,20,20, CType.REL_X, CType.ABSXY, WAlign.CENTER, WAlign.TOP));
layoutScale.addWidget("ButtonScaleAdd", new ButtonLabel(null, "+")) .setGeometry(new WidgetGeometry(0.0, 10.0,20,20, CType.REL_X, CType.ABSXY, WAlign.LEFT, WAlign.TOP));
layoutScale.addWidget("ValueDisplayScale", new LabelFixedFont(null, "0")) .setGeometry(new WidgetGeometry(50.0, 40.0,20,20, CType.REL_X, CType.ABSXY, WAlign.CENTER, WAlign.TOP));
layoutScale.addWidget("ButtonScaleSub", new ButtonLabel(null, "-")) .setGeometry(new WidgetGeometry(0.0, 60.0,20,20, CType.REL_X, CType.ABSXY, WAlign.LEFT, WAlign.TOP));
this.addWidget("ButtonCancel", new ButtonScreenChange(null, "Cancel", prevScreen)).setGeometry(new WidgetGeometry(70.0,97.0,75,20, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.BOTTOM));
this.addWidget("ButtonOk", new ButtonScreenChange(null, "Ok", prevScreen)).setGeometry(new WidgetGeometry(30.0,97.0,75,20, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.BOTTOM));
this.addWidget("ButtonDefault",new ButtonLabel(null, "Default")).setGeometry(new WidgetGeometry(50.0,97.0,75,20, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.BOTTOM));
this.addWidget("ButtonCancel", new ButtonScreenChange(null, "screen.button.cancel", prevScreen)).setGeometry(new WidgetGeometry(70.0,97.0,75,20, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.BOTTOM));
this.addWidget("ButtonOk", new ButtonScreenChange(null, "screen.button.ok", prevScreen)).setGeometry(new WidgetGeometry(30.0,97.0,75,20, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.BOTTOM));
this.addWidget("ButtonDefault",new ButtonLabel(null, "screen.button.default")).setGeometry(new WidgetGeometry(50.0,97.0,75,20, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.BOTTOM));
@@ -31,9 +31,9 @@ public class ScreenModuleConfig extends ScreenBase {
for (String key:ConfigHandler.instance().getConfigKeys(this.modName).keySet()){
if (ConfigHandler.instance().isServerRequired(key))
buttonContainer.addButton(new ButtonBooleanConfigRemote(this.getRoot(), key, "No", "Yes"), ConfigHandler.instance().getConfigKeys(this.modName).get(key));
buttonContainer.addButton(new ButtonBooleanConfigRemote(this.getRoot(), key, "screen.button.no", "screen.button.yes"), ConfigHandler.instance().getConfigKeys(this.modName).get(key));
else
buttonContainer.addButton(new ButtonBooleanConfig(this.getRoot(), key, "No", "Yes"), ConfigHandler.instance().getConfigKeys(this.modName).get(key));
buttonContainer.addButton(new ButtonBooleanConfig(this.getRoot(), key, "screen.button.no", "screen.button.yes"), ConfigHandler.instance().getConfigKeys(this.modName).get(key));
//buttonContainer.addButton(new ButtonConfigRemote(-1, "No", "Yes", ConfigHandler.instance().getConfigKeys(this.modName).get(key), key ));
//else
//buttonContainer.addButton(new ButtonConfigOption(-1, "No", "Yes", ConfigHandler.instance().getConfigKeys(this.modName).get(key), key ));
@@ -41,7 +41,7 @@ public class ScreenModuleConfig extends ScreenBase {
this.getRoot().addWidget("LayoutBack", new LayoutBase(this.getRoot()));
this.getRoot().getWidget("LayoutBack").setGeometry(new WidgetGeometry(0.0, 80.0, 100.0, 20.0, CType.RELXY, CType.RELXY));
this.getRoot().getWidget("LayoutBack").addWidget("ButtonBack", new ButtonScreenChange(this.getRoot().getWidget("LayoutBack"), "Back", this.parent));
this.getRoot().getWidget("LayoutBack").addWidget("ButtonBack", new ButtonScreenChange(this.getRoot().getWidget("LayoutBack"), "screen.button.back", this.parent));
this.getRoot().getWidget("LayoutBack").getWidget("ButtonBack").setGeometry(new WidgetGeometry(50.0, 50.0, 100.0, 20.0, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
}
@@ -21,20 +21,20 @@ public class ScreenWailaConfig extends ScreenBase {
ButtonContainerLabel buttonContainer = ((ButtonContainerLabel)this.getRoot().getWidget("ButtonContainer"));
buttonContainer.addButton( new ButtonBooleanConfig(this.getRoot(), Constants.CFG_WAILA_SHOW, true, true, "Hidden", "Visible"), "Show/Hide Waila");
buttonContainer.addButton( new ButtonBooleanConfig(this.getRoot(), Constants.CFG_WAILA_MODE, true, true, "Maintained", "Toggled"), "Toggled/Maintained");
buttonContainer.addButton( new ButtonBooleanConfig(this.getRoot(), Constants.CFG_WAILA_METADATA, true, false,"Hidden", "Visible"), "Show ID:Metadata");
buttonContainer.addButton( new ButtonBooleanConfig(this.getRoot(), Constants.CFG_WAILA_LIQUID, true, false,"Hidden", "Visible"), "Liquids");
buttonContainer.addButton( new ButtonBooleanConfig(this.getRoot(), Constants.CFG_WAILA_SHOW, true, true, "screen.button.hidden", "screen.button.visible"), "choice.showhidewaila");
buttonContainer.addButton( new ButtonBooleanConfig(this.getRoot(), Constants.CFG_WAILA_MODE, true, true, "screen.button.maintained", "screen.button.toggled"), "choice.toggledmaintained");
buttonContainer.addButton( new ButtonBooleanConfig(this.getRoot(), Constants.CFG_WAILA_METADATA, true, false,"screen.button.hidden", "screen.button.visible"), "choice.showhideidmeta");
buttonContainer.addButton( new ButtonBooleanConfig(this.getRoot(), Constants.CFG_WAILA_LIQUID, true, false,"screen.button.hidden", "screen.button.visible"), "choice.showliquids");
this.getRoot().addWidget("LayoutConfigPos", new LayoutBase(this.getRoot()));
this.getRoot().getWidget("LayoutConfigPos").setGeometry(new WidgetGeometry(0.0, 50.0, 100.0, 20.0, CType.RELXY, CType.RELXY));
this.getRoot().getWidget("LayoutConfigPos").addWidget("ButtonConfigPos", new ButtonScreenChange(null, "Configure aspect ...", new ScreenHUDConfig(this)));
this.getRoot().getWidget("LayoutConfigPos").addWidget("ButtonConfigPos", new ButtonScreenChange(null, "screen.button.configureaspect", new ScreenHUDConfig(this)));
this.getRoot().getWidget("LayoutConfigPos").getWidget("ButtonConfigPos").setGeometry(new WidgetGeometry(50.0, 50.0, 150.0, 20.0, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
this.getRoot().addWidget("LayoutBack", new LayoutBase(this.getRoot()));
this.getRoot().getWidget("LayoutBack").setGeometry(new WidgetGeometry(0.0, 80.0, 100.0, 20.0, CType.RELXY, CType.RELXY));
this.getRoot().getWidget("LayoutBack").addWidget("ButtonBack", new ButtonScreenChange(null, "Back", this.parent));
this.getRoot().getWidget("LayoutBack").addWidget("ButtonBack", new ButtonScreenChange(null, "screen.button.back", this.parent));
this.getRoot().getWidget("LayoutBack").getWidget("ButtonBack").setGeometry(new WidgetGeometry(50.0, 50.0, 100.0, 20.0, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
}
}
@@ -1,5 +1,6 @@
package mcp.mobius.waila.gui.screens.info;
import codechicken.lib.lang.LangUtil;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.gui.interfaces.CType;
@@ -29,10 +30,15 @@ public class ScreenEnchants extends ScreenBase {
.setGeometry(new WidgetGeometry(40.0, 22.0, 16.0, 16.0, CType.ABSXY, CType.REL_X, WAlign.LEFT, WAlign.BOTTOM));
this.getRoot().addWidget("Table", new ViewTable(null))
.setGeometry(new WidgetGeometry(50.0, 50.0, 90.0, 90.0, CType.REL_X, CType.RELXY, WAlign.CENTER, WAlign.TOP));
.setGeometry(new WidgetGeometry(50.0, 50.0, 90.0, 80.0, CType.REL_X, CType.RELXY, WAlign.CENTER, WAlign.TOP));
String columnName = "\u00a7a\u00a7o" + LangUtil.translateG("enchant.title.name");
String columnMinLvl= "\u00a7a\u00a7o" + LangUtil.translateG("enchant.title.minlvl");;
String columnMaxLvl= "\u00a7a\u00a7o" + LangUtil.translateG("enchant.title.maxlvl");;
String columnWeight= "\u00a7a\u00a7o" + LangUtil.translateG("enchant.title.weight");;
((ViewTable)this.getRoot().getWidget("Table"))
.setColumnsTitle("\u00a7a\u00a7oName","\u00a7a\u00a7oMin lvl","\u00a7a\u00a7oMax lvl","\u00a7a\u00a7oWeight", "\u00a7a\u00a7oMod")
.setColumnsTitle(columnName, columnMinLvl, columnMaxLvl, columnWeight, "\u00a7a\u00a7oMod")
.setColumnsWidth(35.0, 10.0, 10.0, 10.0, 35.0)
.setColumnsAlign(WAlign.LEFT, WAlign.CENTER, WAlign.CENTER, WAlign.CENTER, WAlign.LEFT);
}
@@ -59,7 +65,7 @@ public class ScreenEnchants extends ScreenBase {
}
public ScreenEnchants setEnchantability(String value){
((LabelFixedFont)this.getRoot().getWidget("Layout_Title").getWidget("LabelEnchantability")).setText(String.format("Enchantability : %s", value));
((LabelFixedFont)this.getRoot().getWidget("Layout_Title").getWidget("LabelEnchantability")).setText(String.format("%s : %s", LangUtil.translateG("enchant.label.enchantability"), value));
this.getRoot().getWidget("Layout_Title").adjustSize();
return this;
}
@@ -0,0 +1,118 @@
package mcp.mobius.waila.gui.truetyper;
/**
* TrueTyper: Open Source TTF implementation for Minecraft.
* Copyright (C) 2013 - Mr_okushama
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import java.nio.FloatBuffer;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
import org.lwjgl.util.vector.Matrix4f;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraftforge.client.GuiIngameForge;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.common.MinecraftForge;
public class FontHelper {
private static String formatEscape = "\u00A7";
public static void drawString(String s, float x, float y, TrueTypeFont font, float scaleX, float scaleY, float... rgba){
drawString(s,x,y,font,scaleX,scaleY,0,rgba);
}
public static void drawString(String s, float x, float y, TrueTypeFont font, float scaleX, float scaleY, float rotationZ, float... rgba){
Minecraft mc = Minecraft.getMinecraft();
ScaledResolution sr = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
if(mc.gameSettings.hideGUI){
return;
}
int amt = 1;
if(sr.getScaleFactor() == 1){
amt = 2;
}
FloatBuffer matrixData = BufferUtils.createFloatBuffer(16);
GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, matrixData);
FontHelper.set2DMode(matrixData);
GL11.glPushMatrix();
y = mc.displayHeight-(y*sr.getScaleFactor())-(((font.getLineHeight()/amt)));
float tx = (x*sr.getScaleFactor())+(font.getWidth(s)/2);
float tranx = tx+2;
float trany = y+(font.getLineHeight()/2);
GL11.glTranslatef(tranx,trany,0);
GL11.glRotatef(rotationZ, 0f, 0f, 1f);
GL11.glTranslatef(-tranx,-trany,0);
GL11.glEnable(GL11.GL_BLEND);
if(s.contains(formatEscape)){
String[] pars = s.split(formatEscape);
float totalOffset = 0;
for(int i = 0; i < pars.length; i++){
String par = pars[i];
float[] c = rgba;
if(i > 0){
c = Formatter.getFormatted(par.charAt(0));
par = par.substring(1, par.length());
}
font.drawString((x*sr.getScaleFactor()+totalOffset), y, par, scaleX/amt, scaleY/amt, c);
totalOffset += font.getWidth(par);
}
}else{
font.drawString((x*sr.getScaleFactor()), y, s, scaleX/amt, scaleY/amt, rgba);
}
GL11.glPopMatrix();
GL11.glDisable(GL11.GL_BLEND);
FontHelper.set3DMode();
}
private static void set2DMode(FloatBuffer matrixData) {
Minecraft mc = Minecraft.getMinecraft();
ScaledResolution sr = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
mc.entityRenderer.setupOverlayRendering();
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glPushMatrix();
//GL11.glLoadMatrix(matrixData);
GL11.glLoadIdentity();
GL11.glOrtho(0, mc.displayWidth, 0, mc.displayHeight, -1, 1);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glPushMatrix();
GL11.glLoadIdentity();
Matrix4f matrix = new Matrix4f();
matrix.load(matrixData);
GL11.glTranslatef(matrix.m30*sr.getScaleFactor(),-matrix.m31*sr.getScaleFactor(), 0f);
}
private static void set3DMode() {
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glPopMatrix();
Minecraft mc = Minecraft.getMinecraft();
mc.entityRenderer.setupOverlayRendering();
}
}
@@ -0,0 +1,69 @@
package mcp.mobius.waila.gui.truetyper;
/**
* TrueTyper: Open Source TTF implementation for Minecraft.
* Copyright (C) 2013 - Mr_okushama
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import java.awt.Font;
import java.awt.FontFormatException;
import java.awt.geom.AffineTransform;
import java.io.IOException;
import java.util.ArrayList;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
public class FontLoader{
public static TrueTypeFont loadSystemFont(String name, float defSize, boolean antialias){
return loadSystemFont(name, defSize, antialias, Font.TRUETYPE_FONT);
}
public static TrueTypeFont loadSystemFont(String name, float defSize, boolean antialias, int type){
Font font;
TrueTypeFont out = null;
try {
font = new Font(name, type, (int)defSize);
font = font.deriveFont(defSize);
out = new TrueTypeFont(font, antialias);
} catch (Exception e) {
e.printStackTrace();
}
return out;
}
public static TrueTypeFont createFont(ResourceLocation res, float defSize, boolean antialias){
return createFont(res, defSize, antialias, Font.TRUETYPE_FONT);
}
public static TrueTypeFont createFont(ResourceLocation res, float defSize, boolean antialias, int type){
Font font;
TrueTypeFont out = null;
try {
font = Font.createFont(type, Minecraft.getMinecraft().func_110442_L().func_110536_a(res).func_110527_b());
font = font.deriveFont(defSize);
out = new TrueTypeFont(font, antialias);
} catch (Exception e) {
e.printStackTrace();
}
return out;
}
}
@@ -0,0 +1,86 @@
package mcp.mobius.waila.gui.truetyper;
/**
* TrueTyper: Open Source TTF implementation for Minecraft.
* Copyright (C) 2013 - Mr_okushama
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
public class Formatter {
public static float[] getFormatted(char c){
int[] outrgba = null;
float[] outfloat;
switch(c){
case '0':
outrgba = new int[]{0,0,0,0,255};
break;
case '1':
outrgba = new int[]{0,0,170,255};
break;
case '2':
outrgba = new int[]{0,170,0,255};
break;
case '3':
outrgba = new int[]{0,170,170,255};
break;
case '4':
outrgba = new int[]{170,0,0,255};
break;
case '5':
outrgba = new int[]{170,0,170,255};
break;
case '6':
outrgba = new int[]{255,170,0,255};
break;
case '7':
outrgba = new int[]{170,170,170,255};
break;
case '8':
outrgba = new int[]{85,85,85,255};
break;
case '9':
outrgba = new int[]{85,85,255,255};
break;
case 'a':
outrgba = new int[]{85,255,85,255};
break;
case 'b':
outrgba = new int[]{85,255,255,255};
break;
case 'c':
outrgba = new int[]{255,85,85,255};
break;
case 'd':
outrgba = new int[]{85,255,255,255};
break;
case 'e':
outrgba = new int[]{255,255,85,255};
break;
case 'f':
outrgba = new int[]{255,255,255,255};
break;
default:
outrgba = new int[]{255,255,255,255};
break;
}
outfloat = new float[outrgba.length];
for(int i = 0; i < outrgba.length ; i++){
outfloat[i] = outrgba[i] > 0 ? outrgba[i]/255 : 0;
}
return outfloat;
}
}
+71
View File
@@ -0,0 +1,71 @@
package mcp.mobius.waila.gui.truetyper;
/**
* TrueTyper: Open Source TTF implementation for Minecraft.
* Copyright (C) 2013 - Mr_okushama
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import java.awt.Font;
import java.awt.GraphicsEnvironment;
import java.util.ArrayList;
import net.minecraft.util.EnumChatFormatting;
public class Test {
public static ArrayList<TrueTypeFont> testFonts = new ArrayList<TrueTypeFont>();
public static float[] white = {1f,1f,1f,1f};
public static boolean init = false;
public static void initTest(){
return;
/*
GraphicsEnvironment e = GraphicsEnvironment.getLocalGraphicsEnvironment();
Font[] fonts = e.getAllFonts();
{
int max = 9;
for(Font f : fonts){
boolean pass = true;
for(TrueTypeFont ttf : testFonts){
if(ttf.font.getFontName().startsWith(f.getFontName().substring(0, 1))){
pass = false;
continue;
}
}
if(pass){
max--;
if(max == 0){
break;
}
testFonts.add(FontLoader.loadSystemFont(f.getFontName(), 24f, false));
testFonts.add(FontLoader.loadSystemFont(f.getFontName(), 24f, true));
}
}
}
init = true;
}
public static void doTest(){
if(!init){
initTest();
}
for(int i =0; i < testFonts.size(); i++){
int y = 10+i*12;
int x = 10;
FontHelper.drawString("He"+EnumChatFormatting.GOLD+"llo "+EnumChatFormatting.GREEN+"wor"+EnumChatFormatting.YELLOW+"ld", x, y, testFonts.get(i), 1f, 1f);
}*/
}
}
@@ -0,0 +1,507 @@
package mcp.mobius.waila.gui.truetyper;
import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer;
import java.awt.image.DataBufferByte;
import java.awt.image.DataBufferInt;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.IntBuffer;
import java.util.HashMap;
import java.util.Map;
import java.awt.GraphicsEnvironment;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.settings.GameSettings;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import org.lwjgl.opengl.GL30;
import org.lwjgl.util.glu.GLU;
/**
* TrueTyper: Open Source TTF implementation for Minecraft.
* Modified from Slick2D - under BSD Licensing - http://slick.ninjacave.com/license/
*
* Copyright (c) 2013 - Slick2D
*
* All rights reserved.
*/
public class TrueTypeFont {
public final static int
ALIGN_LEFT = 0,
ALIGN_RIGHT = 1,
ALIGN_CENTER = 2;
/** Array that holds necessary information about the font characters */
private FloatObject[] charArray = new FloatObject[256];
/** Map of user defined font characters (Character <-> IntObject) */
private Map customChars = new HashMap();
/** Boolean flag on whether AntiAliasing is enabled or not */
protected boolean antiAlias;
/** Font's size */
private float fontSize = 0;
/** Font's height */
private float fontHeight = 0;
/** Texture used to cache the font 0-255 characters */
private int fontTextureID;
/** Default font texture width */
private int textureWidth = 1024;
/** Default font texture height */
private int textureHeight = 1024;
/** A reference to Java's AWT Font that we create our font texture from */
protected Font font;
/** The font metrics for our Java AWT font */
private FontMetrics fontMetrics;
private int correctL = 9, correctR = 8;
private class FloatObject {
/** Character's width */
public float width;
/** Character's height */
public float height;
/** Character's stored x position */
public float storedX;
/** Character's stored y position */
public float storedY;
}
public TrueTypeFont(Font font, boolean antiAlias, char[] additionalChars) {
this.font = font;
this.fontSize = font.getSize()+3;
this.antiAlias = antiAlias;
createSet( additionalChars );
System.out.println("TrueTypeFont loaded: "+font+" - AntiAlias = "+antiAlias);
fontHeight -= 1;
if (fontHeight <= 0) fontHeight = 1;
}
public TrueTypeFont(Font font, boolean antiAlias) {
this( font, antiAlias, null );
}
public void setCorrection(boolean on) {
if (on) {
correctL = 2;
correctR = 1;
} else {
correctL = 0;
correctR = 0;
}
}
private BufferedImage getFontImage(char ch) {
// Create a temporary image to extract the character's size
BufferedImage tempfontImage = new BufferedImage(1, 1,
BufferedImage.TYPE_INT_ARGB);
Graphics2D g = (Graphics2D) tempfontImage.getGraphics();
if (antiAlias == true) {
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
}
g.setFont(font);
fontMetrics = g.getFontMetrics();
float charwidth = fontMetrics.charWidth(ch)+8;
if (charwidth <= 0) {
charwidth = 7;
}
float charheight = fontMetrics.getHeight()+3;
if (charheight <= 0) {
charheight = fontSize;
}
// Create another image holding the character we are creating
BufferedImage fontImage;
fontImage = new BufferedImage((int)charwidth,(int)charheight,
BufferedImage.TYPE_INT_ARGB);
Graphics2D gt = (Graphics2D) fontImage.getGraphics();
if (antiAlias == true) {
gt.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
}
gt.setFont(font);
gt.setColor(Color.WHITE);
int charx = 3;
int chary = 1;
gt.drawString(String.valueOf(ch), (charx), (chary)
+ fontMetrics.getAscent());
return fontImage;
}
private void createSet( char[] customCharsArray ) {
// If there are custom chars then I expand the font texture twice
if (customCharsArray != null && customCharsArray.length > 0) {
textureWidth *= 2;
}
// In any case this should be done in other way. Texture with size 512x512
// can maintain only 256 characters with resolution of 32x32. The texture
// size should be calculated dynamicaly by looking at character sizes.
try {
BufferedImage imgTemp = new BufferedImage(textureWidth, textureHeight, BufferedImage.TYPE_INT_ARGB);
Graphics2D g = (Graphics2D) imgTemp.getGraphics();
g.setColor(new Color(0,0,0,1));
g.fillRect(0,0,textureWidth,textureHeight);
float rowHeight = 0;
float positionX = 0;
float positionY = 0;
int customCharsLength = ( customCharsArray != null ) ? customCharsArray.length : 0;
for (int i = 0; i < 256 + customCharsLength; i++) {
// get 0-255 characters and then custom characters
char ch = ( i < 256 ) ? (char) i : customCharsArray[i-256];
BufferedImage fontImage = getFontImage(ch);
FloatObject newIntObject = new FloatObject();
newIntObject.width = fontImage.getWidth();
newIntObject.height = fontImage.getHeight();
if (positionX + newIntObject.width >= textureWidth) {
positionX = 0;
positionY += rowHeight;
rowHeight = 0;
}
newIntObject.storedX = positionX;
newIntObject.storedY = positionY;
if (newIntObject.height > fontHeight) {
fontHeight = newIntObject.height;
}
if (newIntObject.height > rowHeight) {
rowHeight = newIntObject.height;
}
// Draw it here
g.drawImage(fontImage, (int)positionX, (int)positionY, null);
positionX += newIntObject.width;
if( i < 256 ) { // standard characters
charArray[i] = newIntObject;
} else { // custom characters
customChars.put( new Character( ch ), newIntObject );
}
fontImage = null;
}
fontTextureID = loadImage(imgTemp);
//.getTexture(font.toString(), imgTemp);
} catch (Exception e) {
System.err.println("Failed to create font.");
e.printStackTrace();
}
}
private void drawQuad(float drawX, float drawY, float drawX2, float drawY2,
float srcX, float srcY, float srcX2, float srcY2) {
float DrawWidth = drawX2 - drawX;
float DrawHeight = drawY2 - drawY;
float TextureSrcX= srcX / textureWidth;
float TextureSrcY = srcY / textureHeight;
float SrcWidth = srcX2 - srcX;
float SrcHeight = srcY2 - srcY;
float RenderWidth = (SrcWidth / textureWidth);
float RenderHeight = (SrcHeight / textureHeight);
Tessellator t = Tessellator.instance;
//t.setColorRGBA_F(0f, 0f, 0f, 1f);
t.addVertexWithUV(drawX, drawY, 0, TextureSrcX, TextureSrcY);
//GL11.glTexCoord2f(TextureSrcX, TextureSrcY);
//GL11.glVertex2f(drawX, drawY);
t.addVertexWithUV(drawX, drawY + DrawHeight, 0, TextureSrcX, TextureSrcY + RenderHeight);
//GL11.glTexCoord2f(TextureSrcX, TextureSrcY + RenderHeight);
//GL11.glVertex2f(drawX, drawY + DrawHeight);
t.addVertexWithUV(drawX + DrawWidth, drawY + DrawHeight, 0, TextureSrcX + RenderWidth, TextureSrcY + RenderHeight);
//GL11.glTexCoord2f(TextureSrcX + RenderWidth, TextureSrcY + RenderHeight);
//GL11.glVertex2f(drawX + DrawWidth, drawY + DrawHeight);
t.addVertexWithUV(drawX + DrawWidth, drawY, 0, TextureSrcX + RenderWidth, TextureSrcY);
//GL11.glTexCoord2f(TextureSrcX + RenderWidth, TextureSrcY);
//GL11.glVertex2f(drawX + DrawWidth, drawY);
}
public float getWidth(String whatchars) {
float totalwidth = 0;
FloatObject floatObject = null;
int currentChar = 0;
float lastWidth = -10f;
for (int i = 0; i < whatchars.length(); i++) {
currentChar = whatchars.charAt(i);
if (currentChar < 256) {
floatObject = charArray[currentChar];
} else {
floatObject = (FloatObject)customChars.get( new Character( (char) currentChar ) );
}
if( floatObject != null ){
totalwidth += floatObject.width/2;
lastWidth = floatObject.width;
}
}
//System.out.println("Size: "+totalwidth);
return this.fontMetrics.stringWidth(whatchars);
//return (totalwidth);
}
public float getHeight() {
return fontHeight;
}
public float getHeight(String HeightString) {
return fontHeight;
}
public float getLineHeight() {
return fontHeight;
}
public void drawString(float x, float y, String whatchars, float scaleX, float scaleY, float... rgba) {
if(rgba.length == 0) rgba = new float[]{1f,1f,1f,1f};
drawString(x,y,whatchars, 0, whatchars.length()-1, scaleX, scaleY, ALIGN_LEFT, rgba);
}
public void drawString(float x, float y, String whatchars, float scaleX, float scaleY, int format, float... rgba) {
if(rgba.length == 0) rgba = new float[]{1f,1f,1f,1f};
drawString(x,y,whatchars, 0, whatchars.length()-1, scaleX, scaleY, format, rgba);
}
public void drawString(float x, float y, String whatchars, int startIndex, int endIndex, float scaleX, float scaleY, int format, float... rgba) {
if(rgba.length == 0) rgba = new float[]{1f,1f,1f,1f};
GL11.glPushMatrix();
GL11.glScalef (scaleX, scaleY, 1.0f);
FloatObject floatObject = null;
int charCurrent;
float totalwidth = 0;
int i = startIndex, d, c;
float startY = 0;
switch (format) {
case ALIGN_RIGHT: {
d = -1;
c = correctR;
while (i < endIndex) {
if (whatchars.charAt(i) == '\n') startY -= fontHeight;
i++;
}
break;
}
case ALIGN_CENTER: {
for (int l = startIndex; l <= endIndex; l++) {
charCurrent = whatchars.charAt(l);
if (charCurrent == '\n') break;
if (charCurrent < 256) {
floatObject = charArray[charCurrent];
} else {
floatObject = (FloatObject)customChars.get( new Character( (char) charCurrent ) );
}
totalwidth += floatObject.width-correctL;
}
totalwidth /= -2;
}
case ALIGN_LEFT:
default: {
d = 1;
c = correctL;
break;
}
}
GL11.glBindTexture(GL11.GL_TEXTURE_2D, fontTextureID);
Tessellator t = Tessellator.instance;
t.startDrawingQuads();
// GL11.glBegin(GL11.GL_QUADS);
if(rgba.length == 4)
t.setColorRGBA_F(rgba[0], rgba[1], rgba[2], rgba[3]);
while (i >= startIndex && i <= endIndex) {
charCurrent = whatchars.charAt(i);
if (charCurrent < 256) {
floatObject = charArray[charCurrent];
} else {
floatObject = (FloatObject)customChars.get( new Character( (char) charCurrent ) );
}
if( floatObject != null ) {
if (d < 0) totalwidth += (floatObject.width-c) * d;
if (charCurrent == '\n') {
startY -= fontHeight * d;
totalwidth = 0;
if (format == ALIGN_CENTER) {
for (int l = i+1; l <= endIndex; l++) {
charCurrent = whatchars.charAt(l);
if (charCurrent == '\n') break;
if (charCurrent < 256) {
floatObject = charArray[charCurrent];
} else {
floatObject = (FloatObject)customChars.get( new Character( (char) charCurrent ) );
}
totalwidth += floatObject.width-correctL;
}
totalwidth /= -2;
}
//if center get next lines total width/2;
}
else {
drawQuad((totalwidth + floatObject.width) + x/scaleX,
startY + y/scaleY,
totalwidth + x/scaleX,
(startY + floatObject.height) + y/scaleY,
floatObject.storedX + floatObject.width,
floatObject.storedY + floatObject.height,
floatObject.storedX,
floatObject.storedY);
if (d > 0) totalwidth += (floatObject.width-c) * d ;
}
i += d;
}
}
t.draw();
// GL11.glEnd();
GL11.glPopMatrix();
}
public static int loadImage(BufferedImage bufferedImage) {
try {
short width = (short)bufferedImage.getWidth();
short height = (short)bufferedImage.getHeight();
//textureLoader.bpp = bufferedImage.getColorModel().hasAlpha() ? (byte)32 : (byte)24;
int bpp = (byte)bufferedImage.getColorModel().getPixelSize();
ByteBuffer byteBuffer;
DataBuffer db = bufferedImage.getData().getDataBuffer();
if (db instanceof DataBufferInt) {
int intI[] = ((DataBufferInt)(bufferedImage.getData().getDataBuffer())).getData();
byte newI[] = new byte[intI.length * 4];
for (int i = 0; i < intI.length; i++) {
byte b[] = intToByteArray(intI[i]);
int newIndex = i*4;
newI[newIndex] = b[1];
newI[newIndex+1] = b[2];
newI[newIndex+2] = b[3];
newI[newIndex+3] = b[0];
}
byteBuffer = ByteBuffer.allocateDirect(
width*height*(bpp/8))
.order(ByteOrder.nativeOrder())
.put(newI);
} else {
byteBuffer = ByteBuffer.allocateDirect(
width*height*(bpp/8))
.order(ByteOrder.nativeOrder())
.put(((DataBufferByte)(bufferedImage.getData().getDataBuffer())).getData());
}
byteBuffer.flip();
int internalFormat = GL11.GL_RGBA8,
format = GL11.GL_RGBA;
IntBuffer textureId = BufferUtils.createIntBuffer(1);;
GL11.glGenTextures(textureId);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureId.get(0));
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
//GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
//GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_NEAREST);
//GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR);
//GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST_MIPMAP_LINEAR);
//GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST_MIPMAP_NEAREST);
GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE);
GLU.gluBuild2DMipmaps(GL11.GL_TEXTURE_2D, internalFormat, width, height, format, GL11.GL_UNSIGNED_BYTE, byteBuffer);
return textureId.get(0);
} catch (Exception e) {
e.printStackTrace();
System.exit(-1);
}
return -1;
}
public static boolean isSupported(String fontname) {
Font font[] = getFonts();
for (int i = font.length-1; i >= 0; i--) {
if (font[i].getName().equalsIgnoreCase(fontname))
return true;
}
return false;
}
public static Font[] getFonts() {
return GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
}
public static byte[] intToByteArray(int value) {
return new byte[] {
(byte)(value >>> 24),
(byte)(value >>> 16),
(byte)(value >>> 8),
(byte)value};
}
public void destroy() {
IntBuffer scratch = BufferUtils.createIntBuffer(1);
scratch.put(0, fontTextureID);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
GL11.glDeleteTextures(scratch);
}
}
@@ -8,6 +8,8 @@ import net.minecraft.util.ResourceLocation;
import org.lwjgl.util.Point;
import codechicken.lib.lang.LangUtil;
public class LabelFixedFont extends WidgetBase {
protected String text = "";
@@ -33,7 +35,7 @@ public class LabelFixedFont extends WidgetBase {
}
public void setText(String text){
this.text = text;
this.text = LangUtil.translateG(text);
this.updateGeometry();
}
@@ -52,6 +54,7 @@ public class LabelFixedFont extends WidgetBase {
public void draw(Point pos) {
this.saveGLState();
this.mc.fontRenderer.drawString(this.text, pos.getX(), pos.getY(), this.color);
//this.mc.fontRenderer.drawString(this.text, pos.getX(), pos.getY(), this.color);
this.loadGLState();
}
}
@@ -1,57 +0,0 @@
package mcp.mobius.waila.gui_old;
import mcp.mobius.waila.gui_old.widget.ContainerTable;
import mcp.mobius.waila.gui_old.widget.Label;
import mcp.mobius.waila.gui_old.widget.StackDisplay;
import net.minecraft.client.gui.GuiScreen;
public class GuiEnchantScreen extends BaseWailaScreen {
public ContainerTable widTable;
public StackDisplay widStackDisplay;
public Label widStackName;
public Label widStackEnchantability;
public GuiEnchantScreen(GuiScreen _parentGui) {
super(_parentGui);
this.zLevel = -1.0F;
this.widTable = new ContainerTable(this);
this.widStackDisplay = new StackDisplay(this);
this.widStackName = new Label(this);
this.widStackEnchantability = new Label(this);
this.widTable.setColumns(8, "\u00a7a\u00a7oName", "\u00a7a\u00a7oMin lvl", "\u00a7a\u00a7oMax lvl", "\u00a7a\u00a7oMod");
this.widTable.setHeight(this.res.getScaledHeight() - 16 - 32);
this.addWidget("datatable", this.widTable);
this.addWidget("stackdisplay", this.widStackDisplay);
this.addWidget("stackname", this.widStackName);
this.addWidget("stackenchant", this.widStackEnchantability);
}
@Override
/* Here we draw anything special, and super takes care of the buttons for us */
public void drawScreen(int i, int j, float f)
{
//this.parentGui.drawScreen(i, j, f);
//this.parentGui.allowUserInput = false;
super.drawScreen(i, j, f);
widTable.draw(this.getXCentered(widTable.getWidth()), 32, 0);
widStackDisplay.draw(this.getXCentered(widTable.getWidth()), 0, 0);
widStackName.draw(this.getXCentered(widTable.getWidth())+32, 0, 0);
widStackEnchantability.draw(this.getXCentered(widTable.getWidth())+32, 8, 0);
}
@Override
public void initGui()
{
}
@Override
public void drawDefaultBackground()
{
this.drawGradientRect(0, 0, this.width, this.height, 0xdd000000, 0xdd000000);
}
}
@@ -3,8 +3,6 @@ package mcp.mobius.waila.gui_old.NEI;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import codechicken.core.ReflectionManager;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.FuelRecipeHandler;
@@ -14,13 +12,7 @@ import codechicken.nei.recipe.TemplateRecipeHandler;
import codechicken.nei.recipe.TemplateRecipeHandler.CachedRecipe;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
public class CraftingTreeNode {
@@ -169,6 +161,7 @@ public class CraftingTreeNode {
return curratedStacks;
}
@Override
public String toString(){
return this.elements.toString();
}
@@ -1,171 +0,0 @@
package mcp.mobius.waila.gui_old.NEI;
import java.lang.reflect.Method;
import mcp.mobius.waila.Constants;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.gui_old.GuiEnchantScreen;
import mcp.mobius.waila.gui_old.widget.Label;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import codechicken.nei.NEIClientConfig;
import codechicken.nei.forge.IContainerInputHandler;
public class HandlerEnchantment implements IContainerInputHandler {
static Class EplusApi;
static Method Tooltip;
@Override
public boolean keyTyped(GuiContainer gui, char keyChar, int keyCode) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onKeyTyped(GuiContainer gui, char keyChar, int keyID) {
// TODO Auto-generated method stub
}
@Override
public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyID) {
ItemStack stackover = gui.manager.getStackMouseOver();
if(stackover == null)
return false;
if(keyID == NEIClientConfig.getKeyBinding(Constants.BIND_SCREEN_ENCH)){
//try{
int itemEnchantability = stackover.getItem().getItemEnchantability();
if (itemEnchantability == 0){return false;}
Minecraft mc = Minecraft.getMinecraft();
GuiEnchantScreen enchantScreen = new GuiEnchantScreen(mc.currentScreen);
enchantScreen.widStackDisplay.setStack(stackover);
enchantScreen.widStackName.setLabel("\u00a7f" + stackover.getDisplayName());
enchantScreen.widStackEnchantability.setLabel(String.format("\u00a7fEnchantability : %s", itemEnchantability));
Enchantment[] enchants = null;
if (stackover.getItem() == Item.book)
enchants = Enchantment.enchantmentsBookList;
else
enchants = Enchantment.enchantmentsList;
for(Enchantment enchant : enchants){
if (enchant == null){continue;}
if (enchant.canApplyAtEnchantingTable(stackover) || stackover.getItem() == Item.book){
for (int lvl = enchant.getMinLevel(); lvl <= enchant.getMaxLevel(); lvl++){
int minEnchantEnchantability = enchant.getMinEnchantability(lvl);
int maxEnchantEnchantability = enchant.getMaxEnchantability(lvl);
int minItemEnchantability = 1;
int meanItemEnchantability = 1 + itemEnchantability/4;
int maxItemEnchantability = 1 + itemEnchantability/2;
int minModifiedEnchantability = (int)(0.85*minItemEnchantability + 0.5);
int meanModifiedEnchantability = (int)(1.00*meanItemEnchantability + 0.5);
int maxModifiedEnchantability = (int)(1.15*maxItemEnchantability + 0.5);
int minLevel = (int) ((minEnchantEnchantability - minModifiedEnchantability)/1.15);
int maxLevel = (int) ((maxEnchantEnchantability - maxModifiedEnchantability)/0.85);
int meanMinLevel = (int) ((minEnchantEnchantability - meanModifiedEnchantability)/1.0);
int meanMaxLevel = (int) ((maxEnchantEnchantability - meanModifiedEnchantability)/1.0);
enchantScreen.widTable.addRow(new Label(enchant.getTranslatedName(lvl)),
new Label(String.valueOf(minLevel)),
new Label(String.valueOf(maxLevel)),
//new Label(String.valueOf(meanMinLevel)),
//new Label(String.valueOf(meanMaxLevel)),
new Label("\u00a79\u00a7o"+ this.getEnchantModName(enchant))
);
//String description = this.getEnchantmentToolTip(enchant);
}
}
}
mc.displayGuiScreen(enchantScreen);
//}
//catch (NullPointerException e){
// System.out.printf("%s\n", e);
//}
}
return false;
}
public String getEnchantModName(Enchantment enchant){
String enchantPath = enchant.getClass().getProtectionDomain().getCodeSource().getLocation().toString();
String enchantModName = "<Unknown>";
for (String s: mod_Waila.instance.modSourceList.keySet())
if (enchantPath.contains(s))
enchantModName = mod_Waila.instance.modSourceList.get(s);
if (enchantModName.equals("Minecraft Coder Pack"))
enchantModName = "Minecraft";
return enchantModName;
}
@Override
public boolean mouseClicked(GuiContainer gui, int mousex, int mousey,
int button) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onMouseClicked(GuiContainer gui, int mousex, int mousey,
int button) {
// TODO Auto-generated method stub
}
@Override
public void onMouseUp(GuiContainer gui, int mousex, int mousey, int button) {
// TODO Auto-generated method stub
}
@Override
public boolean mouseScrolled(GuiContainer gui, int mousex, int mousey,
int scrolled) {
// TODO Auto-generated method stub
return false;
}
@Override
public void onMouseScrolled(GuiContainer gui, int mousex, int mousey,
int scrolled) {
// TODO Auto-generated method stub
}
@Override
public void onMouseDragged(GuiContainer gui, int mousex, int mousey,
int button, long heldTime) {
// TODO Auto-generated method stub
}
private String getEnchantmentToolTip(Enchantment enchantment) {
try {
if (EplusApi == null) {
EplusApi = Class.forName("eplus.api.EplusApi");
}
if (Tooltip == null) {
Tooltip = EplusApi.getMethod("getEnchantmentToolTip", Enchantment.class);
}
return String.valueOf(Tooltip.invoke(null, enchantment));
} catch (Exception e) {
return "";
}
}
}
@@ -2,23 +2,12 @@ package mcp.mobius.waila.gui_old.NEI;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import mcp.mobius.waila.Constants;
import mcp.mobius.waila.gui_old.GuiIngameWiki;
import mcp.mobius.waila.gui_old.GuiTechTree;
import mcp.mobius.waila.gui_old.widget.ComponentDisplay;
import mcp.mobius.waila.gui_old.widget.StackDisplay;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import codechicken.nei.NEIClientConfig;
import codechicken.nei.forge.IContainerInputHandler;
@@ -6,10 +6,10 @@ import mcp.mobius.waila.Constants;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ConfigHandler;
import mcp.mobius.waila.addons.ExternalModulesHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.gui_old.GuiIngameWiki;
import mcp.mobius.waila.gui_old.widget.Label;
import mcp.mobius.waila.handlers.SummaryProvider;
import mcp.mobius.waila.tools.ModIdentification;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.ItemStack;
@@ -58,7 +58,7 @@ public class HandlerWiki implements IContainerInputHandler {
Minecraft mc = Minecraft.getMinecraft();
GuiIngameWiki wikiScreen = new GuiIngameWiki(mc.currentScreen);
wikiScreen.widReader.setText(this.getDescriptionString(mod_Waila.instance.getModID(stackover), stackover.getItemName(), String.valueOf(stackover.getItemDamage())));
wikiScreen.widReader.setText(this.getDescriptionString(ModIdentification.idFromStack(stackover), stackover.getItemName(), String.valueOf(stackover.getItemDamage())));
wikiScreen.widStack.setStack(stackover);
wikiScreen.widItemName.setLabel(stackover.getDisplayName());
@@ -3,8 +3,6 @@ package mcp.mobius.waila.gui_old.widget;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class DraggableViewport extends BaseWidget {
@@ -2,10 +2,8 @@ package mcp.mobius.waila.gui_old.widget;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
@@ -20,7 +18,7 @@ public class StackDisplay extends BaseWidget {
public StackDisplay(GuiScreen parent){
this.parent = parent;
this.drawItems.zLevel = 500.0f;
StackDisplay.drawItems.zLevel = 500.0f;
};
public StackDisplay(GuiScreen parent, ItemStack stack){
@@ -1,6 +1,8 @@
package mcp.mobius.waila.handlers;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagByte;
@@ -9,7 +11,9 @@ import net.minecraft.nbt.NBTTagInt;
import net.minecraft.nbt.NBTTagShort;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import mcp.mobius.waila.api.IWailaDataAccessor;
public class DataAccessor implements IWailaDataAccessor {
@@ -17,16 +21,22 @@ public class DataAccessor implements IWailaDataAccessor {
public World world;
public EntityPlayer player;
public MovingObjectPosition mop;
public Vec3 renderingvec = null;
public Block block;
public int blockID;
public int metadata;
public TileEntity entity;
public NBTTagCompound remoteNbt = null;
public long timeLastUpdate = System.currentTimeMillis();
public double partialFrame;
public static DataAccessor instance = new DataAccessor();
public void set(World _world, EntityPlayer _player, MovingObjectPosition _mop) {
this.set(_world, _player, _mop, null, 0.0);
}
public void set(World _world, EntityPlayer _player, MovingObjectPosition _mop, EntityLivingBase viewEntity, double partialTicks) {
this.world = _world;
this.player = _player;
this.mop = _mop;
@@ -34,6 +44,14 @@ public class DataAccessor implements IWailaDataAccessor {
this.block = Block.blocksList[this.blockID];
this.metadata = world.getBlockMetadata(_mop.blockX, _mop.blockY, _mop.blockZ);
this.entity = world.getBlockTileEntity(_mop.blockX, _mop.blockY, _mop.blockZ);
if (viewEntity != null){
double px = viewEntity.lastTickPosX + (viewEntity.posX - viewEntity.lastTickPosX) * partialTicks;
double py = viewEntity.lastTickPosY + (viewEntity.posY - viewEntity.lastTickPosY) * partialTicks;
double pz = viewEntity.lastTickPosZ + (viewEntity.posZ - viewEntity.lastTickPosZ) * partialTicks;
this.renderingvec = Vec3.createVectorHelper(_mop.blockX - px, _mop.blockY - py, _mop.blockZ - pz);
this.partialFrame = partialTicks;
}
}
@Override
@@ -113,5 +131,35 @@ public class DataAccessor implements IWailaDataAccessor {
return false;
}
}
@Override
public Vec3 getRenderingPosition() {
return this.renderingvec;
}
@Override
public double getPartialFrame() {
return this.partialFrame;
}
@Override
public ForgeDirection getSide(){
int side = this.getPosition().sideHit;
switch (side){
case 0:
return ForgeDirection.DOWN;
case 1:
return ForgeDirection.UP;
case 2:
return ForgeDirection.EAST;
case 3:
return ForgeDirection.WEST;
case 4:
return ForgeDirection.NORTH;
case 5:
return ForgeDirection.SOUTH;
}
return ForgeDirection.UNKNOWN;
}
}
@@ -1,5 +1,6 @@
package mcp.mobius.waila.handlers.hud;
import java.util.ArrayList;
import java.util.List;
import mcp.mobius.waila.WailaExceptionHandler;
@@ -7,6 +8,7 @@ import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ConfigHandler;
import mcp.mobius.waila.addons.ExternalModulesHandler;
import mcp.mobius.waila.api.IWailaBlock;
import mcp.mobius.waila.api.IWailaBlockDecorator;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.handlers.DataAccessor;
import mcp.mobius.waila.network.Packet0x01TERequest;
@@ -22,6 +24,12 @@ import cpw.mods.fml.common.network.PacketDispatcher;
public class HUDHandlerExternal implements IHighlightHandler {
private ArrayList<IWailaDataProvider> headProviders = new ArrayList<IWailaDataProvider>();
private ArrayList<IWailaDataProvider> bodyProviders = new ArrayList<IWailaDataProvider>();
private ArrayList<IWailaDataProvider> tailProviders = new ArrayList<IWailaDataProvider>();
private MovingObjectPosition prevMOP = null;
private int prevWorldID = -999;
@Override
public ItemStack identifyHighlight(World world, EntityPlayer player, MovingObjectPosition mop) {
DataAccessor accessor = DataAccessor.instance;
@@ -53,16 +61,21 @@ public class HUDHandlerExternal implements IHighlightHandler {
@Override
public List<String> handleTextData(ItemStack itemStack, World world, EntityPlayer player, MovingObjectPosition mop, List<String> currenttip, Layout layout) {
if (this.prevMOP == null)
this.prevMOP = mop;
DataAccessor accessor = DataAccessor.instance;
accessor.set(world, player, mop);
Block block = accessor.getBlock();
int blockID = accessor.getBlockID();
if (accessor.getTileEntity() != null && mod_Waila.instance.serverPresent && (System.currentTimeMillis() - accessor.timeLastUpdate >= 250) ){
if (accessor.getTileEntity() != null && mod_Waila.instance.serverPresent &&
((System.currentTimeMillis() - accessor.timeLastUpdate >= 250) || this.areMopDifferent(player, mop))){
accessor.timeLastUpdate = System.currentTimeMillis();
PacketDispatcher.sendPacketToServer(Packet0x01TERequest.create(world, mop));
}
/* Interface IWailaBlock */
if (IWailaBlock.class.isInstance(block)){
TileEntity entity = world.getBlockTileEntity(mop.blockX, mop.blockY, mop.blockZ);
if (layout == Layout.HEADER)
@@ -83,97 +96,77 @@ public class HUDHandlerExternal implements IHighlightHandler {
} catch (Throwable e){
return WailaExceptionHandler.handleErr(e, block.getClass().toString(), currenttip);
}
}
if (layout == Layout.HEADER && ExternalModulesHandler.instance().hasHeadProviders(blockID)){
for (IWailaDataProvider dataProvider : ExternalModulesHandler.instance().getHeadProviders(blockID))
try{
currenttip = dataProvider.getWailaHead(itemStack, currenttip, accessor, ConfigHandler.instance());
} catch (Throwable e){
currenttip = WailaExceptionHandler.handleErr(e, dataProvider.getClass().toString(), currenttip);
}
}
if (layout == Layout.BODY && ExternalModulesHandler.instance().hasBodyProviders(blockID)){
for (IWailaDataProvider dataProvider : ExternalModulesHandler.instance().getBodyProviders(blockID))
try{
currenttip = dataProvider.getWailaBody(itemStack, currenttip, accessor, ConfigHandler.instance());
} catch (Throwable e){
currenttip = WailaExceptionHandler.handleErr(e, dataProvider.getClass().toString(), currenttip);
}
}
if (layout == Layout.FOOTER && ExternalModulesHandler.instance().hasTailProviders(blockID)){
for (IWailaDataProvider dataProvider : ExternalModulesHandler.instance().getTailProviders(blockID))
try{
currenttip = dataProvider.getWailaTail(itemStack, currenttip, accessor, ConfigHandler.instance());
} catch (Throwable e){
currenttip = WailaExceptionHandler.handleErr(e, dataProvider.getClass().toString(), currenttip);
}
}
if (layout == Layout.HEADER && ExternalModulesHandler.instance().hasHeadProviders(block)){
for (IWailaDataProvider dataProvider : ExternalModulesHandler.instance().getHeadProviders(block))
try{
currenttip = dataProvider.getWailaHead(itemStack, currenttip, accessor, ConfigHandler.instance());
} catch (Throwable e){
currenttip = WailaExceptionHandler.handleErr(e, dataProvider.getClass().toString(), currenttip);
}
}
if (this.areMopDifferent(player, mop)){
if (layout == Layout.BODY && ExternalModulesHandler.instance().hasBodyProviders(block)){
for (IWailaDataProvider dataProvider : ExternalModulesHandler.instance().getBodyProviders(block))
try{
currenttip = dataProvider.getWailaBody(itemStack, currenttip, accessor, ConfigHandler.instance());
} catch (Throwable e){
currenttip = WailaExceptionHandler.handleErr(e, dataProvider.getClass().toString(), currenttip);
}
}
if (layout == Layout.FOOTER && ExternalModulesHandler.instance().hasTailProviders(block)){
for (IWailaDataProvider dataProvider : ExternalModulesHandler.instance().getTailProviders(block))
try{
currenttip = dataProvider.getWailaTail(itemStack, currenttip, accessor, ConfigHandler.instance());
} catch (Throwable e){
currenttip = WailaExceptionHandler.handleErr(e, dataProvider.getClass().toString(), currenttip);
}
}
if (layout == Layout.HEADER && ExternalModulesHandler.instance().hasHeadProviders(accessor.getTileEntity())){
for (IWailaDataProvider dataProvider : ExternalModulesHandler.instance().getHeadProviders(accessor.getTileEntity()))
try{
currenttip = dataProvider.getWailaHead(itemStack, currenttip, accessor, ConfigHandler.instance());
} catch (Throwable e){
currenttip = WailaExceptionHandler.handleErr(e, dataProvider.getClass().toString(), currenttip);
}
}
if (layout == Layout.BODY && ExternalModulesHandler.instance().hasBodyProviders(accessor.getTileEntity())){
for (IWailaDataProvider dataProvider : ExternalModulesHandler.instance().getBodyProviders(accessor.getTileEntity()))
try{
currenttip = dataProvider.getWailaBody(itemStack, currenttip, accessor, ConfigHandler.instance());
} catch (Throwable e){
currenttip = WailaExceptionHandler.handleErr(e, dataProvider.getClass().toString(), currenttip);
}
}
headProviders.clear();
bodyProviders.clear();
tailProviders.clear();
this.prevMOP = mop;
this.prevWorldID = player.dimension;
/* Lookup by block ID */
if (layout == Layout.HEADER && ExternalModulesHandler.instance().hasHeadProviders(blockID))
headProviders.addAll(ExternalModulesHandler.instance().getHeadProviders(blockID));
if (layout == Layout.FOOTER && ExternalModulesHandler.instance().hasTailProviders(accessor.getTileEntity())){
for (IWailaDataProvider dataProvider : ExternalModulesHandler.instance().getTailProviders(accessor.getTileEntity()))
try{
currenttip = dataProvider.getWailaTail(itemStack, currenttip, accessor, ConfigHandler.instance());
} catch (Throwable e){
currenttip = WailaExceptionHandler.handleErr(e, dataProvider.getClass().toString(), currenttip);
}
}
if (layout == Layout.BODY && ExternalModulesHandler.instance().hasBodyProviders(blockID))
bodyProviders.addAll(ExternalModulesHandler.instance().getBodyProviders(blockID));
if (layout == Layout.FOOTER && ExternalModulesHandler.instance().hasTailProviders(blockID))
tailProviders.addAll(ExternalModulesHandler.instance().getTailProviders(blockID));
/* Lookup by class (for blocks)*/
if (layout == Layout.HEADER && ExternalModulesHandler.instance().hasHeadProviders(block))
headProviders.addAll(ExternalModulesHandler.instance().getHeadProviders(block));
if (layout == Layout.BODY && ExternalModulesHandler.instance().hasBodyProviders(block))
bodyProviders.addAll(ExternalModulesHandler.instance().getBodyProviders(block));
if (layout == Layout.FOOTER && ExternalModulesHandler.instance().hasTailProviders(block))
tailProviders.addAll(ExternalModulesHandler.instance().getTailProviders(block));
/* Lookup by class (for tileentities)*/
if (layout == Layout.HEADER && ExternalModulesHandler.instance().hasHeadProviders(accessor.getTileEntity()))
headProviders.addAll(ExternalModulesHandler.instance().getHeadProviders(accessor.getTileEntity()));
if (layout == Layout.BODY && ExternalModulesHandler.instance().hasBodyProviders(accessor.getTileEntity()))
bodyProviders.addAll(ExternalModulesHandler.instance().getBodyProviders(accessor.getTileEntity()));
if (layout == Layout.FOOTER && ExternalModulesHandler.instance().hasTailProviders(accessor.getTileEntity()))
tailProviders.addAll(ExternalModulesHandler.instance().getTailProviders(accessor.getTileEntity()));
}
/* Apply all collected providers */
for (IWailaDataProvider dataProvider : headProviders)
try{
currenttip = dataProvider.getWailaHead(itemStack, currenttip, accessor, ConfigHandler.instance());
} catch (Throwable e){
currenttip = WailaExceptionHandler.handleErr(e, dataProvider.getClass().toString(), currenttip);
}
for (IWailaDataProvider dataProvider : bodyProviders)
try{
currenttip = dataProvider.getWailaBody(itemStack, currenttip, accessor, ConfigHandler.instance());
} catch (Throwable e){
currenttip = WailaExceptionHandler.handleErr(e, dataProvider.getClass().toString(), currenttip);
}
for (IWailaDataProvider dataProvider : tailProviders)
try{
currenttip = dataProvider.getWailaTail(itemStack, currenttip, accessor, ConfigHandler.instance());
} catch (Throwable e){
currenttip = WailaExceptionHandler.handleErr(e, dataProvider.getClass().toString(), currenttip);
}
return currenttip;
}
public boolean areMopDifferent(EntityPlayer player, MovingObjectPosition mop){
return this.prevMOP.blockX != mop.blockX || this.prevMOP.blockY != mop.blockY || this.prevMOP.blockZ != mop.blockZ || prevWorldID != player.dimension;
}
}
@@ -5,6 +5,7 @@ import java.util.List;
import mcp.mobius.waila.Constants;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ConfigHandler;
import mcp.mobius.waila.tools.ModIdentification;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
@@ -23,9 +24,9 @@ public class HUDHandlerWaila implements IHighlightHandler {
public List<String> handleTextData(ItemStack itemStack, World world, EntityPlayer player, MovingObjectPosition mop, List<String> currenttip, Layout layout) {
if (layout == Layout.FOOTER){
String modName = mod_Waila.instance.getModName(itemStack);
String modName = ModIdentification.nameFromStack(itemStack);
if (modName != null && !modName.equals(""))
currenttip.add("\u00a79\u00a7o" + modName);
currenttip.add("\u00A79\u00A7o" + modName);
} else if (layout == Layout.HEADER && ConfigHandler.instance().getConfig(Constants.CFG_WAILA_METADATA, false)){
if (currenttip.size() == 0)
currenttip.add("< Unnamed >");
@@ -6,6 +6,7 @@ import java.util.logging.Level;
import mcp.mobius.waila.Constants;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.gui.screens.info.ScreenEnchants;
import mcp.mobius.waila.tools.ModIdentification;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.enchantment.Enchantment;
@@ -93,7 +94,7 @@ public class HandlerEnchants implements IContainerInputHandler {
colorcode + String.valueOf(minLevel),
colorcode + String.valueOf(maxLevel),
colorcode + String.valueOf(enchant.getWeight()),
"\u00a79\u00a7o"+ this.getEnchantModName(enchant));
"\u00a79\u00a7o"+ ModIdentification.nameFromObject(enchant));
}
}
}
@@ -103,6 +104,7 @@ public class HandlerEnchants implements IContainerInputHandler {
return false;
}
/*
public String getEnchantModName(Enchantment enchant){
String enchantPath = enchant.getClass().getProtectionDomain().getCodeSource().getLocation().toString();
@@ -116,7 +118,8 @@ public class HandlerEnchants implements IContainerInputHandler {
if (enchantModName.equals("Minecraft Coder Pack"))
enchantModName = "Minecraft";
return enchantModName;
}
}
*/
@Override
public boolean mouseClicked(GuiContainer gui, int mousex, int mousey, int button) { return false; }
@@ -1,15 +1,15 @@
package mcp.mobius.waila.handlers.tooltip;
import java.util.List;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.tools.ModIdentification;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.ItemStack;
import codechicken.nei.forge.IContainerTooltipHandler;
public class TooltipHandlerWaila implements IContainerTooltipHandler {
private mod_Waila waila = mod_Waila.instance;
@Override
public List<String> handleTooltipFirst(GuiContainer gui, int mousex, int mousey, List<String> currenttip) {
return currenttip;
@@ -17,7 +17,7 @@ public class TooltipHandlerWaila implements IContainerTooltipHandler {
@Override
public List<String> handleItemTooltip(GuiContainer gui, ItemStack itemstack, List<String> currenttip) {
String canonicalName = waila.getModName(itemstack);
String canonicalName = ModIdentification.nameFromStack(itemstack);
if (canonicalName != null && !canonicalName.equals(""))
currenttip.add("\u00a79\u00a7o" + canonicalName);
return currenttip;
+81 -59
View File
@@ -1,41 +1,59 @@
package mcp.mobius.waila;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe;
import mcp.mobius.waila.addons.ConfigHandler;
import mcp.mobius.waila.addons.ExternalModulesHandler;
import mcp.mobius.waila.api.IWailaRegistrar;
import mcp.mobius.waila.client.WailaClientEventHandler;
import mcp.mobius.waila.network.WailaConnectionHandler;
import mcp.mobius.waila.network.WailaPacketHandler;
import mcp.mobius.waila.server.ProxyServer;
import mcp.mobius.waila.tools.ModIdentification;
import mcp.mobius.waila.tools.Reflect;
import net.minecraft.client.resources.I18n;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.Property;
import net.minecraftforge.common.MinecraftForge;
import codechicken.core.CommonUtils;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.IMCCallback;
import codechicken.lib.lang.LangUtil;
import cpw.mods.fml.client.registry.KeyBindingRegistry;
import cpw.mods.fml.client.registry.KeyBindingRegistry.KeyHandler;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.FMLModContainer;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.IMCCallback;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.common.registry.ItemData;
import cpw.mods.fml.common.registry.LanguageRegistry;
@Mod(modid="Waila", name="Waila", version="1.4.0_dev")
@Mod(modid="Waila", name="Waila", version="1.4.4", dependencies="required-after:NotEnoughItems")
@NetworkMod(channels = {"Waila"},clientSideRequired=false, serverSideRequired=false, connectionHandler = WailaConnectionHandler.class,
packetHandler = WailaPacketHandler.class, versionBounds="[1.3.0,)")
@@ -44,14 +62,12 @@ public class mod_Waila {
@Instance("Waila")
public static mod_Waila instance;
@SidedProxy(clientSide="mcp.mobius.waila.ProxyClient", serverSide="mcp.mobius.waila.server.ProxyServer")
@SidedProxy(clientSide="mcp.mobius.waila.client.ProxyClient", serverSide="mcp.mobius.waila.server.ProxyServer")
public static ProxyServer proxy;
public static Logger log = Logger.getLogger("Waila");
private HashMap<Integer, String> itemMap = new HashMap<Integer, String>();
public Configuration config = null;
public boolean serverPresent = false;
public HashMap<String, String> modSourceList = new HashMap<String, String>();
public static int posX;
public static int posY;
@@ -62,14 +78,18 @@ public class mod_Waila {
public static int fontcolor;
public static float scale;
@PreInit
public void preInit(FMLPreInitializationEvent event) {
/* INIT SEQUENCE */
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
config = new Configuration(event.getSuggestedConfigurationFile());
config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_SHOW, true);
config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_MODE, true);
config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_LIQUID, false);
config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_METADATA, false);
config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_KEYBIND, true);
posX = config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_POSX, 5000).getInt();
posY = config.get(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_POSY, 100).getInt();
@@ -84,41 +104,65 @@ public class mod_Waila {
config.save();
updateColors();
MinecraftForge.EVENT_BUS.register(new WailaClientEventHandler());
}
@Init
public void load(FMLInitializationEvent event) {
@EventHandler
public void initialize(FMLInitializationEvent event) {
try {
Field eBus = FMLModContainer.class.getDeclaredField("eventBus");
eBus.setAccessible(true);
EventBus FMLbus = (EventBus) eBus.get(FMLCommonHandler.instance().findContainerFor(this));
FMLbus.register(this);
} catch (Throwable t) {}
}
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
proxy.registerHandlers();
}
@PostInit
public void postInit(FMLPostInitializationEvent event) {
/* This section is about preloading the name/modid of the items in a table, so we don't look it up at every cycle */
NBTTagList itemDataList = new NBTTagList();
GameData.writeItemData(itemDataList);
ModIdentification.init();
for(int i = 0; i < itemDataList.tagCount(); i++)
{
ItemData itemData = new ItemData((NBTTagCompound) itemDataList.tagAt(i));
this.itemMap.put(itemData.getItemId(), itemData.getModId());
}
if (ConfigHandler.instance().getConfig(Constants.CFG_WAILA_KEYBIND)){
for (ModContainer mod : Loader.instance().getModList()) {
this.modSourceList.put(mod.getSource().getName(), mod.getName());
//log.log(Level.INFO, String.format("%s %s", mod.getSource().getName(), mod.getName()));
for (String key: ModIdentification.keyhandlerStrings.keySet()){
String orig = I18n.func_135053_a(key);
if (orig.equals(key))
orig = LanguageRegistry.instance().getStringLocalization(key);
if (orig.equals(key))
orig = LangUtil.translateG(key);
if (orig.isEmpty())
orig = key;
String modif;
if (orig.startsWith("[") || orig.contains(":"))
modif = orig;
else{
String id = ModIdentification.keyhandlerStrings.get(key);
if (id.contains("."))
id = id.split("\\.")[0];
if (id.length() > 10)
id = id.substring(0, 11);
if (id.isEmpty())
id = "????";
modif = String.format("[%s] %s", id, orig);
}
LanguageRegistry.instance().addStringLocalization(key, modif);
}
}
this.modSourceList.put("1.6.2.jar", "Minecraft");
this.modSourceList.put("1.6.3.jar", "Minecraft");
this.modSourceList.put("1.6.4.jar", "Minecraft");
// for (String s : this.modSourceList.keySet())
// if (this.modSourceList.get(s) == "Minecraft Coder Pack")
// this.modSourceList.put(s, "Minecraft");
}
@Subscribe
public void loadComplete(FMLLoadCompleteEvent event) {
proxy.registerMods();
}
@IMCCallback
public void processIMC(FMLInterModComms.IMCEvent event)
{
@@ -166,28 +210,6 @@ public class mod_Waila {
}
public String getModName(ItemStack itemstack){
try{
String modID = this.itemMap.get(itemstack.itemID);
ModContainer mod = CommonUtils.findModContainer(modID);
String modname = mod == null ? modID : mod.getName();
return modname;
} catch (NullPointerException e){
//System.out.printf("NPE : %s\n",itemstack.toString());
return "";
}
}
public String getModID(ItemStack itemstack){
try{
String modID = this.itemMap.get(itemstack.itemID);
return modID;
} catch (NullPointerException e){
//System.out.printf("NPE : %s\n",itemstack.toString());
return "";
}
}
public static void updateColors(){
alpha = (int)(ConfigHandler.instance().getConfigInt(Constants.CFG_WAILA_ALPHA) / 100.0f * 256) << 24;
bgcolor = alpha + ConfigHandler.instance().getConfigInt(Constants.CFG_WAILA_BGCOLOR);
+8 -14
View File
@@ -3,13 +3,11 @@ package mcp.mobius.waila.overlay;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import codechicken.nei.api.IHighlightHandler;
import codechicken.nei.api.ItemInfo;
import codechicken.nei.forge.GuiContainerManager;
import cpw.mods.fml.common.ModContainer;
@@ -22,21 +20,14 @@ import java.awt.Point;
import mcp.mobius.waila.Constants;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ConfigHandler;
import net.minecraft.block.Block;
import mcp.mobius.waila.gui.truetyper.TrueTypeFont;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import net.minecraftforge.common.IShearable;
import static codechicken.core.gui.GuiDraw.*;
import static mcp.mobius.waila.gui.helpers.UIHelper.*;
public class OverlayRenderer {
@@ -71,8 +62,8 @@ public class OverlayRenderer {
}
});
ItemStack stack = items.get(0);
renderOverlay(stack, ItemInfo.getText(stack, world, mc.thePlayer, RayTracing.raytracedTarget), getPositioning());
RayTracing.raytracedStack = items.get(0);
renderOverlay(RayTracing.raytracedStack, ItemInfo.getText(RayTracing.raytracedStack, world, mc.thePlayer, RayTracing.raytracedTarget), getPositioning());
}
if (RayTracing.raytracedTarget.typeOfHit == EnumMovingObjectType.ENTITY)
@@ -118,6 +109,8 @@ public class OverlayRenderer {
public static void renderOverlay(ItemStack stack, List<String> textData, Point pos)
{
TrueTypeFont font = (TrueTypeFont)mod_Waila.proxy.getFont();
GL11.glPushMatrix();
GL11.glScalef(mod_Waila.scale, mod_Waila.scale, 1.0f);
@@ -138,11 +131,12 @@ public class OverlayRenderer {
drawTooltipBox(x, y, w, h, mod_Waila.bgcolor, mod_Waila.gradient1, mod_Waila.gradient2);
int ty = (h-8*textData.size())/2;
int ty = (h-10*textData.size())/2;
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA,GL11.GL_ONE_MINUS_SRC_ALPHA);
for (int i = 0; i < textData.size(); i++)
//FontHelper.drawString(textData.get(i), x + 24, y + ty + 10*i, font, 1.0f, 1.0f, new float[] {1.0f, 1.0f, 1.0f});
drawString(textData.get(i), x + 24, y + ty + 10*i, mod_Waila.fontcolor, true);
GL11.glDisable(GL11.GL_BLEND);
@@ -178,7 +172,7 @@ public class OverlayRenderer {
drawTooltipBox(x, y, w, h, mod_Waila.bgcolor, mod_Waila.gradient1, mod_Waila.gradient2);
int ty = (h-8*textData.size())/2;
int ty = (h-10*textData.size())/2;
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA,GL11.GL_ONE_MINUS_SRC_ALPHA);
+12 -6
View File
@@ -21,6 +21,7 @@ import net.minecraftforge.common.IShearable;
public class RayTracing {
public static MovingObjectPosition raytracedTarget = null;
public static ItemStack raytracedStack = null;
public static void raytrace(){
if (Minecraft.getMinecraft().objectMouseOver == null){
@@ -48,9 +49,9 @@ public class RayTracing {
float f = 1.0F;
float f1 = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * f;
float f2 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * f;
double d0 = player.prevPosX + (player.posX - player.prevPosX) * (double)f;
double d1 = player.prevPosY + (player.posY - player.prevPosY) * (double)f + 1.62D - (double)player.yOffset;
double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double)f;
double d0 = player.prevPosX + (player.posX - player.prevPosX) * f;
double d1 = player.prevPosY + (player.posY - player.prevPosY) * f + 1.62D - player.yOffset;
double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * f;
Vec3 vec3 = world.getWorldVec3Pool().getVecFromPool(d0, d1, d2);
float f3 = MathHelper.cos(-f2 * 0.017453292F - (float)Math.PI);
float f4 = MathHelper.sin(-f2 * 0.017453292F - (float)Math.PI);
@@ -59,7 +60,7 @@ public class RayTracing {
float f7 = f4 * f5;
float f8 = f3 * f5;
double d3 = 5.0D;
Vec3 vec31 = vec3.addVector((double)f7 * d3, (double)f6 * d3, (double)f8 * d3);
Vec3 vec31 = vec3.addVector(f7 * d3, f6 * d3, f8 * d3);
return world.clip(vec3, vec31, true);
}
@@ -78,7 +79,7 @@ public class RayTracing {
int y = raytracedTarget.blockY;
int z = raytracedTarget.blockZ;
Block mouseoverBlock = Block.blocksList[world.getBlockId(x, y, z)];
if (mouseoverBlock == null) return items;
ArrayList<IHighlightHandler> handlers = new ArrayList<IHighlightHandler>();
if(ItemInfo.highlightIdentifiers.get(0) != null)
@@ -107,10 +108,12 @@ public class RayTracing {
if(items.size() > 0)
return items;
try{
ItemStack pick = mouseoverBlock.getPickBlock(raytracedTarget, world, x, y, z);
if(pick != null)
items.add(pick);
}catch(Exception e){}
if(items.size() > 0)
return items;
@@ -120,6 +123,9 @@ public class RayTracing {
}
catch(Exception e){}
if(items.size() > 0)
return items;
if(mouseoverBlock instanceof IShearable)
{
IShearable shearable = (IShearable)mouseoverBlock;
@@ -2,12 +2,14 @@ package mcp.mobius.waila.overlay;
import java.util.EnumSet;
import mcp.mobius.waila.mod_Waila;
import codechicken.lib.lang.LangUtil;
import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;
public class WailaTickHandler implements ITickHandler {
//public static LangUtil lang = LangUtil.loadLangDir("waila");
private int ticks = 0;
@Override
+2
View File
@@ -5,5 +5,7 @@ public class ProxyServer {
public ProxyServer() {}
public void registerHandlers(){}
public void registerMods(){}
public Object getFont(){return null;}
}
+153
View File
@@ -0,0 +1,153 @@
package mcp.mobius.waila.tools;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import mcp.mobius.waila.mod_Waila;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.item.crafting.IRecipe;
public class AccessHelper {
public static Field getDeclaredField(String classname, String fieldname){
try {
Class class_ = Class.forName(classname);
Field field_ = class_.getDeclaredField(fieldname);
field_.setAccessible(true);
mod_Waila.log.fine(String.format("++ Found field %s %s\n", classname, fieldname));
return field_;
}
catch (NoSuchFieldException e) {
mod_Waila.log.warning(String.format("== Field %s %s not found !\n", classname, fieldname));
return null;
}
catch (SecurityException e) {
mod_Waila.log.warning(String.format("== Field %s %s security exception !\n", classname, fieldname));
return null;
}
catch (ClassNotFoundException e) {
mod_Waila.log.warning(String.format("== Class %s not found !\n", classname));
return null;
}
}
public static Object getField(String classname, String fieldname, Object instance){
try {
Class class_ = Class.forName(classname);
Field field_ = class_.getDeclaredField(fieldname);
field_.setAccessible(true);
mod_Waila.log.fine(String.format("++ Found field %s %s\n", classname, fieldname));
return field_.get(instance);
}
catch (NoSuchFieldException e) {
mod_Waila.log.warning(String.format("== Field %s %s not found !\n", classname, fieldname));
return null;
}
catch (SecurityException e) {
mod_Waila.log.warning(String.format("== Field %s %s security exception !\n", classname, fieldname));
return null;
}
catch (ClassNotFoundException e) {
mod_Waila.log.warning(String.format("== Class %s not found !\n", classname));
return null;
} catch (IllegalArgumentException e) {
mod_Waila.log.warning(String.format("== %s\n", e));
return null;
} catch (IllegalAccessException e) {
mod_Waila.log.warning(String.format("== %s\n", e));
return null;
}
}
public static Object getFieldExcept(String classname, String fieldname, Object instance) throws Exception{
Class class_ = Class.forName(classname);
Field field_ = class_.getDeclaredField(fieldname);
field_.setAccessible(true);
mod_Waila.log.fine(String.format("++ Found field %s %s\n", classname, fieldname));
return field_.get(instance);
}
public static Block getBlock(String classname, String fieldname){
Field field_ = getDeclaredField(classname, fieldname);
try{
return (Block)field_.get(Block.class);
} catch (Exception e) {
System.out.printf("%s\n", e);
mod_Waila.log.warning(String.format("== ERROR GETTING BLOCK %s %s\n", classname, fieldname));
return null;
}
}
public static Item getItem(String classname, String fieldname){
Field field_ = getDeclaredField(classname, fieldname);
try{
return (Item)field_.get(Item.class);
} catch (Exception e) {
System.out.printf("%s\n", e);
mod_Waila.log.warning(String.format("== ERROR GETTING ITEM %s %s\n", classname, fieldname));
return null;
}
}
public static ArrayList<IRecipe> getCraftingRecipes(ItemStack stack){
ArrayList<IRecipe> recipes = new ArrayList<IRecipe>();
for (IRecipe recipe : (ArrayList<IRecipe>)CraftingManager.getInstance().getRecipeList()){
if (recipe != null && recipe.getRecipeOutput() != null){
if (recipe.getRecipeOutput().isItemEqual(stack))
recipes.add(recipe);
}
}
return recipes;
}
public static void cleanCraftingRecipes(ItemStack stack){
for (IRecipe recipe: getCraftingRecipes(stack)){
CraftingManager.getInstance().getRecipeList().remove(recipe);
}
}
public static void cleanSmeltingRecipes(ItemStack stack){
Map smeltingList = FurnaceRecipes.smelting().getSmeltingList();
Map<List<Integer>, ItemStack> smeltingListMeta = FurnaceRecipes.smelting().getMetaSmeltingList();
HashMap<Integer, ItemStack> matchingRecipes = new HashMap<Integer, ItemStack>();
HashMap<List<Integer>, ItemStack> matchingRecipesMeta = new HashMap<List<Integer>, ItemStack>();
// We walk the none meta list to find all the recipes
for (Object id_ : smeltingList.keySet()){
Integer id = (Integer)id_;
ItemStack result = (ItemStack)smeltingList.get(id_);
if (stack.isItemEqual(result))
matchingRecipes.put(id, result);
}
for (List<Integer> key : smeltingListMeta.keySet()){
ItemStack result = smeltingListMeta.get(key);
if (stack.isItemEqual(result))
matchingRecipesMeta.put(key, result);
}
for (Integer key : matchingRecipes.keySet())
FurnaceRecipes.smelting().getSmeltingList().remove(key);
for (List<Integer> key : matchingRecipesMeta.keySet())
FurnaceRecipes.smelting().getMetaSmeltingList().remove(key);
}
}
@@ -0,0 +1,141 @@
package mcp.mobius.waila.tools;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.net.URLDecoder;
import java.util.HashMap;
import java.util.Set;
import java.util.logging.Level;
import codechicken.core.CommonUtils;
import cpw.mods.fml.client.registry.KeyBindingRegistry;
import cpw.mods.fml.client.registry.KeyBindingRegistry.KeyHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.common.registry.ItemData;
import mcp.mobius.waila.mod_Waila;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
public class ModIdentification {
public static HashMap<String, String> modSource_Name = new HashMap<String, String>();
public static HashMap<String, String> modSource_ID = new HashMap<String, String>();
public static HashMap<Integer, String> itemMap = new HashMap<Integer, String>();
public static HashMap<String, String> keyhandlerStrings = new HashMap<String, String>();
public static void init(){
NBTTagList itemDataList = new NBTTagList();
GameData.writeItemData(itemDataList);
for(int i = 0; i < itemDataList.tagCount(); i++)
{
ItemData itemData = new ItemData((NBTTagCompound) itemDataList.tagAt(i));
itemMap.put(itemData.getItemId(), itemData.getModId());
}
for (ModContainer mod : Loader.instance().getModList()){
modSource_Name.put(mod.getSource().getName(), mod.getName());
modSource_ID.put(mod.getSource().getName(), mod.getModId());
}
modSource_Name.put("1.6.2.jar", "Minecraft");
modSource_Name.put("1.6.3.jar", "Minecraft");
modSource_Name.put("1.6.4.jar", "Minecraft");
modSource_Name.put("Forge", "Minecraft");
modSource_ID.put("1.6.2.jar", "Minecraft");
modSource_ID.put("1.6.3.jar", "Minecraft");
modSource_ID.put("1.6.4.jar", "Minecraft");
modSource_ID.put("Forge", "Minecraft");
// for (String s : this.modSourceList.keySet())
// if (this.modSourceList.get(s) == "Minecraft Coder Pack")
// this.modSourceList.put(s, "Minecraft");
// Code to retrieve all the registered keybindings along with the mod adding them.
Field keyHandlers_Field = AccessHelper.getDeclaredField("cpw.mods.fml.client.registry.KeyBindingRegistry", "keyHandlers");
try {
Set<KeyHandler> keyHandlers = (Set<KeyHandler>)keyHandlers_Field.get(KeyBindingRegistry.instance());
for (KeyHandler keyhandler : keyHandlers)
for (int i = 0; i < keyhandler.getKeyBindings().length; i++)
keyhandlerStrings.put(keyhandler.getKeyBindings()[i].keyDescription, idFromObject(keyhandler));
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
public static String nameFromObject(Object obj){
String objPath = obj.getClass().getProtectionDomain().getCodeSource().getLocation().toString();
try {
objPath = URLDecoder.decode(objPath, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
String modName = "<Unknown>";
for (String s: modSource_Name.keySet())
if (objPath.contains(s)){
modName = modSource_Name.get(s);
break;
}
if (modName.equals("Minecraft Coder Pack"))
modName = "Minecraft";
return modName;
}
public static String idFromObject(Object obj){
String objPath = obj.getClass().getProtectionDomain().getCodeSource().getLocation().toString();
try {
objPath = URLDecoder.decode(objPath, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
String modName = "<Unknown>";
for (String s: modSource_ID.keySet())
if (objPath.contains(s)){
modName = modSource_ID.get(s);
break;
}
if (modName.equals("Minecraft Coder Pack"))
modName = "Minecraft";
return modName;
}
public static String nameFromStack(ItemStack itemstack){
try{
String modID = itemMap.get(itemstack.itemID);
ModContainer mod = CommonUtils.findModContainer(modID);
String modname = mod == null ? modID : mod.getName();
return modname;
} catch (NullPointerException e){
//System.out.printf("NPE : %s\n",itemstack.toString());
return "";
}
}
public static String idFromStack(ItemStack itemstack){
try{
String modID = itemMap.get(itemstack.itemID);
return modID;
} catch (NullPointerException e){
//System.out.printf("NPE : %s\n",itemstack.toString());
return "";
}
}
}