Compare commits

..
Author SHA1 Message Date
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
Thomas Guimbretiere f28ed4c274 Added coloring for enchanted items. 2013-10-24 18:38:57 +02:00
Thomas Guimbretiere fc3606b71c When adding a widget, it is now possible to specify a render priority (LOW, MEDIUM, HIGH).
Widgets will be rendered in the order of insert in each category (allows to have forground widgets which are not mouse stealing).
Fixed again the Config HUD screen using that.
2013-10-24 17:38:35 +02:00
Thomas Guimbretiere aeff9c1039 Might have fixed IAmOmicron bug.
Fixed HUD config screen.
2013-10-24 17:22:17 +02:00
Thomas Guimbretiere 9fd13c9ca1 Fixed enchant mod detection.
Changed default key from RSHIFT to I
2013-10-24 17:12:42 +02:00
Thomas Guimbretiere ac1cc77258 Item enchantments done. 2013-10-24 16:31:39 +02:00
Thomas Guimbretiere e6005e55af First shot at partial enchant screen. 2013-10-24 15:48:44 +02:00
Thomas Guimbretiere 62ec48ba21 Added a ViewTable widget to display data in a table shape 2013-10-24 15:25:23 +02:00
Thomas Guimbretiere 7ab8981dde All layouts depend on LayoutBase.
LayoutBase now allows for a background gradient. (setBackgroundColors)
To handle multilayers, widget rendering is done from the start of the list to
the end (in the order of insert), but widget lookup is done in revert order (
last inserted widget will be returned first).
Added utility class for reverse lookup (ReverseIterator).
2013-10-24 11:39:35 +02:00
Thomas Guimbretiere f8202e8fa8 Fixed cropping layout. 2013-10-24 03:22:41 +02:00
Thomas Guimbretiere b18fb9df61 Fixed dragging on the HUD. 2013-10-24 02:20:29 +02:00
Thomas Guimbretiere b4ca299115 Better handling of dragging when leaving the widget (moved some dragging identification to canvas). 2013-10-24 02:08:56 +02:00
Thomas Guimbretiere b0104482bb More adjustement on dragging. 2013-10-24 01:58:37 +02:00
Thomas Guimbretiere ef9ee6441d Fixed some mouse handling (keeping the drag going when on the main widget, stopping the drag on leaving, etc). 2013-10-24 01:52:02 +02:00
Thomas Guimbretiere 4ad3e92fae Mouse handling of the escalator. 2013-10-24 01:42:54 +02:00
Thomas Guimbretiere 098c88676e Corrected order of msg sending for GEOM_CHANGED (post change)
Cursor is now working properly.
2013-10-24 01:12:10 +02:00
Thomas Guimbretiere 4b05b017f7 Moved setPos / setSize to IWidget.
Modifying the geometry now triggers a GEOM_CHANGED event.
2013-10-23 22:19:19 +02:00
Thomas Guimbretiere a92a5dde3c ViewportScrollable is now its own class. 2013-10-23 21:21:34 +02:00
Thomas Guimbretiere a6890c5824 Test widget is bounded on mousewheel.
Added a possibility of setting up the steping (in px).
2013-10-23 20:51:26 +02:00
Thomas Guimbretiere e87d08a789 Reverse lookup for mouse move & drag. 2013-10-23 20:39:31 +02:00
Thomas Guimbretiere 65d8ef8c63 Fixed a couple of button bugs. 2013-10-23 20:33:56 +02:00
Thomas Guimbretiere 878a00b16b Reverse lookup on click/release. 2013-10-23 20:28:37 +02:00
Thomas Guimbretiere 984b26c7fd Reverse lookup for MouseEnter/MouseLeave 2013-10-23 20:16:42 +02:00
Thomas Guimbretiere b2cc1e02d7 Added inverted lookup for MouseWheel.
getWidgetAtPosition does return the deepest widget, so mouse events should check the parent for implementation, not the childrens !
2013-10-23 20:09:27 +02:00
Thomas Guimbretiere 83c7ef6aa9 Corrected a position bug in ItemStackDisplay
Added LayoutCropping (cropping layout using scissors).
2013-10-22 12:05:49 +02:00
Thomas Guimbretiere 6fca3468e2 Cleanup 2013-10-22 11:25:51 +02:00
Thomas Guimbretiere d134aba573 Added scalable ItemStack display. 2013-10-22 11:02:41 +02:00
Thomas Guimbretiere 8f32c0c770 Cleanup 2013-10-22 00:32:56 +02:00
Thomas Guimbretiere e0a5da865f Linked the HUD config screen to the Waila config screen. 2013-10-21 22:56:55 +02:00
Thomas Guimbretiere 69a62e6edf And finally, the scale. Can be adjusted between 0.1 and 2.0. 2013-10-21 22:42:26 +02:00
Thomas Guimbretiere a6da4adc08 Alpha is now configurable too.
Colors can be changed from the config file.
2013-10-21 22:09:43 +02:00
Thomas Guimbretiere 2d3768423f Widgets are now stored in a LinkedHashMap (for proper sorting).
Better Save/Load of GL State (includes colors).
Restored all the buttons on the config screen.
Config is now saved properly and used.
Possibility to reset to defaults.
2013-10-21 20:03:24 +02:00
Thomas Guimbretiere cb2491f3f3 Fixed dragging when other widgets are present. 2013-10-21 18:31:45 +02:00
Thomas Guimbretiere 9248b75a0c Draggable picture in the position config screen is now using relative positions.
Should be behaving like you would expect.
2013-10-21 18:08:16 +02:00
Thomas Guimbretiere fc46634fcc Shorter enum names
Mouse pos is now a double for finer control (?)
2013-10-21 02:54:59 +02:00
Thomas Guimbretiere 9df8f252c0 Changed the position/size type to an enum to make it clearer 2013-10-21 02:28:34 +02:00
Thomas Guimbretiere a844fb4815 Added default configs.
Killed the config screen (again)
2013-10-21 01:49:45 +02:00
Thomas Guimbretiere 58266d3cd1 More advance in the hud config screen. 2013-10-20 17:35:48 +02:00
Thomas Guimbretiere 94a22bf6ca Reworked the event system. Now events are pushed upward to the first widget which can treat them.
No more slots. Best practice is to create a LayoutBase derived class, and handle the events in there.
2013-10-20 17:08:08 +02:00
Thomas Guimbretiere 32a50e112b Singals and slots are now enums.
Added a few widgets to the config screen.
2013-10-20 16:34:32 +02:00
Thomas Guimbretiere 6dbcf366bd Added basic inter-widget signal passing.
LabelFixedFont now has a setText slot (to change text to first signal argument).
PictureMovable will emit onDragX/onDragY events when dragged.
WidgetBase now has slots to move the widget around (setPosX, setPosY).
WidgetGeometry allows to change the position of the widget without having to recreate the geom
Added a CounterInteger widget to store integer data. Slots to change the value and signals to advertise the change.
2013-10-20 12:14:48 +02:00
Thomas Guimbretiere 24efba751d Added a PictureMovable widget, that you can drag and drop around. Area of action is constrainted by the parent.
Added getTop() getBottom() to IWidget interface (shortcuts for getPos().getY() and getPos().getY() + getSize().getY() )
2013-10-19 15:38:51 +02:00
Thomas Guimbretiere e681b98231 Fix alignment for Module choice 2013-10-18 20:20:46 +02:00
Thomas Guimbretiere 30d88b4c45 Readded support for remote config keys.
Moved keyboard handling out of the old UI package.
2013-10-18 12:18:51 +02:00
Thomas Guimbretiere 9a13ff7898 Fixed derp in calling wrong recipe method. 2013-10-18 11:59:11 +02:00
Thomas Guimbretiere 91ac3a9e32 Fixed recipe lookup for blocks with metadata. If not recipe is found with meta, we lookup recipes without meta. 2013-10-18 11:56:32 +02:00
Thomas Guimbretiere 1036c7c0c0 Added the final missing config screens. Config keybind now popups up the new screens.
Still need to remake the server bound config buttons.
2013-10-18 11:51:16 +02:00
Thomas Guimbretiere c03d9183a8 Added main config screen.
Added clicky sound on buttons.
2013-10-18 02:25:47 +02:00
Thomas Guimbretiere 5da91bea2d Fixed MouseEnter/MouseLeave and getWidgetAtPosition logic.
Buttons labels now have the proper color.
Fixed ID:Metadata HEADER bug.
2013-10-18 02:05:19 +02:00
Thomas Guimbretiere c2ceb365d9 Derp 2013-10-18 00:58:23 +02:00
Thomas Guimbretiere 4488c37149 Added a ButtonContainer with label handling.
Created the basic Waila config screen.
2013-10-18 00:58:03 +02:00
Thomas Guimbretiere 3c3fcad888 Screen change button
More test classes in gui.testing
2013-10-17 22:17:13 +02:00
Thomas Guimbretiere 391cfe8290 Added buttons linked to config options (specific to Waila). 2013-10-17 21:47:56 +02:00
Thomas Guimbretiere 8c2ff2b56f Vertical spacing of buttons is now absolute 2013-10-17 21:21:38 +02:00
Thomas Guimbretiere d9a16ba7fa Added per-coordinate abs/frac capabilities for pos & size in WidgetGeometry 2013-10-17 21:16:50 +02:00
Thomas Guimbretiere 3b906f4de8 Moved buttons to their own package. 2013-10-17 21:03:49 +02:00
Thomas Guimbretiere 0496543d70 Added a button container for easy grid-layout buttons 2013-10-17 21:01:12 +02:00
Thomas Guimbretiere e9cc68d2b1 Added 2 types of buttons (boolean & integer) to the widgets. 2013-10-17 20:10:16 +02:00
Thomas Guimbretiere 8a5dc45240 Added a PictureSwitch widget, switching between 2 pictures on mouse over. 2013-10-11 22:03:36 +02:00
Thomas Guimbretiere d23855b263 Added show,hide to widgets.
Renamed Label to LabelFixedFont
2013-10-11 21:54:44 +02:00
Thomas Guimbretiere 5601fcdf7b Added Label widget.
Reworked WidgetGeometry to allow for separate pos/size computation method.
2013-10-11 21:43:58 +02:00
Thomas Guimbretiere a87d3b9de7 Nothing is absolute anymore. Everything is relative to the parent, in full or fractional value 2013-10-11 15:24:01 +02:00
Thomas Guimbretiere 67775bad84 Added ENTER and LEAVE events. 2013-10-11 15:19:24 +02:00
Thomas Guimbretiere 3d004700fb Mouse event handling. 2013-10-11 14:50:07 +02:00
Thomas Guimbretiere b3b2024ce7 Generic structure of new widgets is up.
Test screen with a test texture is done.
2013-10-09 22:58:39 +02:00
Thomas Guimbretiere c1cfb94a0d Setup basic testing framework for the new UI system. 2013-10-09 15:52:26 +02:00
Thomas Guimbretiere 029d141872 Bumped version
May have fixed a light prb when looking at ents.
2013-10-04 20:33:58 +02:00
Thomas Guimbretiere ed93c68fb9 Added registration methods for tail changes along with proper calls to the registrated classes. 2013-10-04 20:02:27 +02:00
Thomas Guimbretiere 4b8acb517e Added "getWailaTail" to the API 2013-10-04 19:55:26 +02:00
Thomas Guimbretiere 419308e2ac Rearranged inworld recipe check to prevent crash on NEI cache loading. 2013-10-04 19:48:55 +02:00
Thomas Guimbretiere 8dc890421d More adjusting and desactivation of NEI overlay. 2013-10-04 18:55:19 +02:00
Thomas Guimbretiere fe90900b55 Adjusted the block discovery system a bit. 2013-10-04 16:30:55 +02:00
Thomas Guimbretiere 1d9807e6d6 Added in-world recipe/usage lookup. 2013-10-04 16:02:21 +02:00
Thomas Guimbretiere 58931febc4 Fixed the proxy raytracing. 2013-10-04 15:04:59 +02:00
Thomas Guimbretiere d72dfa5775 Added support for entities.
Added missing files.
2013-10-04 14:55:01 +02:00
Thomas Guimbretiere dbf49534da Added liquid raytracing 2013-10-04 13:33:59 +02:00
Thomas Guimbretiere aad38c1eac Added a new block recovery test by using a fresh block if the block do not have a TE. 2013-10-04 13:07:08 +02:00
Thomas Guimbretiere c0727b2157 Moved overlay renderer from NEI to Waila for easier handling. 2013-10-02 18:00:53 +02:00
Thomas Guimbretiere 3085f7442a Added tag 1.3.9_1.6.2 for changeset 1e7cde94ccce 2013-09-04 00:12:37 +02:00
115 changed files with 5038 additions and 513 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.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 KiB

+162
View File
@@ -0,0 +1,162 @@
package mcp.mobius.waila;
import java.util.EnumSet;
import java.util.List;
import mcp.mobius.waila.addons.ConfigHandler;
import mcp.mobius.waila.gui.screens.config.ScreenConfig;
import mcp.mobius.waila.gui.screens.info.ScreenEnchants;
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.GuiInventory;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumMovingObjectType;
import org.lwjgl.input.Keyboard;
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;
public class ConfigKeyHandler extends KeyHandler {
static boolean firstInventory = true;
public ConfigKeyHandler()
{
super(new KeyBinding[]{
new KeyBinding(Constants.BIND_WAILA_CFG, Keyboard.KEY_NUMPAD0),
new KeyBinding(Constants.BIND_WAILA_SHOW, Keyboard.KEY_NUMPAD1),
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 boolean[]{
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_SCREEN_ENCH, "[Waila] Show enchant screen");
//LanguageRegistry.instance().addStringLocalization("key.wailatedump", "[Waila] Dump server TE");
GuiContainerManager.addInputHandler(new HandlerEnchants());
API.addKeyBind(Constants.BIND_SCREEN_ENCH, Keyboard.KEY_I);
}
@Override
public void keyDown(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd, boolean isRepeat) {
if (!tickEnd) return;
Minecraft mc = Minecraft.getMinecraft();
if (kb.keyDescription == Constants.BIND_WAILA_CFG){
if(mc.currentScreen == null)
mc.displayGuiScreen(new ScreenConfig(mc.currentScreen));
}
if (kb.keyDescription == Constants.BIND_WAILA_TESTING){
if(mc.currentScreen == null)
mc.displayGuiScreen(new ScreenEnchants(mc.currentScreen));
}
if (mc.currentScreen != null)
return;
if (kb.keyDescription == Constants.BIND_WAILA_SHOW && ConfigHandler.instance().getConfig(Constants.CFG_WAILA_MODE)){
boolean status = ConfigHandler.instance().getConfig(Constants.CFG_WAILA_SHOW);
ConfigHandler.instance().setConfig(Constants.CFG_WAILA_SHOW, !status);
}
else if (kb.keyDescription == Constants.BIND_WAILA_SHOW && !ConfigHandler.instance().getConfig(Constants.CFG_WAILA_MODE)){
ConfigHandler.instance().setConfig(Constants.CFG_WAILA_SHOW, true);
}
else if (kb.keyDescription == Constants.BIND_WAILA_LIQUID){
boolean status = ConfigHandler.instance().getConfig(Constants.CFG_WAILA_LIQUID);
ConfigHandler.instance().setConfig(Constants.CFG_WAILA_LIQUID, !status);
}
else if (kb.keyDescription == Constants.BIND_WAILA_RECIPE){
this.openRecipeGUI(true);
}
else if (kb.keyDescription == Constants.BIND_WAILA_USAGE){
this.openRecipeGUI(false);
}
}
public void openRecipeGUI(boolean recipe){
Minecraft mc = Minecraft.getMinecraft();
boolean uiResult;
String msg;
if ((RayTracing.raytracedTarget != null) && (RayTracing.raytracedTarget.typeOfHit == EnumMovingObjectType.TILE)){
List<ItemStack> stacks = RayTracing.getIdentifierItems();
if (stacks.size() > 0){
mc.displayGuiScreen(new GuiInventory(mc.thePlayer));
if (firstInventory){
try {Thread.sleep(1000);} catch (Exception e){};
firstInventory = false;
}
if(recipe)
if(!GuiCraftingRecipe.openRecipeGui("item", stacks.get(0).copy())){
ItemStack target = stacks.get(0).copy();
target.setItemDamage(0);
if(!GuiCraftingRecipe.openRecipeGui("item", target)){
mc.thePlayer.addChatMessage("\u00a7f\u00a7oNo recipe found.");
mc.displayGuiScreen((GuiScreen)null);
mc.setIngameFocus();
}
}
if(!recipe)
if(!GuiUsageRecipe.openRecipeGui("item", stacks.get(0).copy())){
ItemStack target = stacks.get(0).copy();
target.setItemDamage(0);
if(!GuiUsageRecipe.openRecipeGui("item", target)){
mc.thePlayer.addChatMessage("\u00a7f\u00a7oNo usage found.");
mc.displayGuiScreen((GuiScreen)null);
mc.setIngameFocus();
}
}
}
}
}
@Override
public void keyUp(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd) {
if (!tickEnd) return;
if (kb.keyDescription == Constants.BIND_WAILA_SHOW && !ConfigHandler.instance().getConfig(Constants.CFG_WAILA_MODE)){
ConfigHandler.instance().setConfig(Constants.CFG_WAILA_SHOW, false);
}
}
@Override
public EnumSet<TickType> ticks() {
return EnumSet.of(TickType.CLIENT);
}
@Override
public String getLabel() {
return "Waila Config Screen Keybind";
}
}
+24 -4
View File
@@ -5,11 +5,31 @@ 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_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 CFG_NEI_SHOW = "world.highlight_tips";
public static String CFG_NEI_SHOW = "world.highlight_tips";
public static String BIND_NEI_SHOW = "keys.world.highlight_tips";
public static String CFG_WAILA_SHOW = "waila.cfg.show";
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";
public static String CFG_WAILA_ALPHA = "waila.cfg.alpha";
public static String CFG_WAILA_BGCOLOR = "waila.cfg.bgcolor";
public static String CFG_WAILA_GRADIENT1 = "waila.cfg.gradient1";
public static String CFG_WAILA_GRADIENT2 = "waila.cfg.gradient2";
public static String CFG_WAILA_FONTCOLOR = "waila.cfg.fontcolor";
}
+24 -20
View File
@@ -1,5 +1,21 @@
package mcp.mobius.waila;
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.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.thermalexpansion.ThermalExpansionModule;
import mcp.mobius.waila.addons.twilightforest.TwilightForestModule;
import mcp.mobius.waila.addons.vanillamc.HUDHandlerVanilla;
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 org.lwjgl.input.Keyboard;
@@ -9,24 +25,8 @@ import codechicken.nei.api.API;
import codechicken.nei.api.ItemInfo;
import codechicken.nei.forge.GuiContainerManager;
import cpw.mods.fml.client.registry.KeyBindingRegistry;
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.ConfigKeyHandler;
import mcp.mobius.waila.handlers.HUDHandlerExternal;
import mcp.mobius.waila.handlers.HUDHandlerWaila;
import mcp.mobius.waila.handlers.SummaryProviderDefault;
import mcp.mobius.waila.handlers.HandlerTechTree;
import mcp.mobius.waila.handlers.TooltipHandlerWaila;
import mcp.mobius.waila.handlers.HandlerWiki;
import mcp.mobius.waila.server.ProxyServer;
import cpw.mods.fml.common.registry.TickRegistry;
import cpw.mods.fml.relauncher.Side;
public class ProxyClient extends ProxyServer {
@@ -35,6 +35,8 @@ public class ProxyClient extends ProxyServer {
@Override
public void registerHandlers(){
TickRegistry.registerTickHandler(new WailaTickHandler(), Side.CLIENT);
GuiContainerManager.addTooltipHandler(new TooltipHandlerWaila());
API.registerHighlightHandler(new HUDHandlerExternal(), ItemInfo.Layout.HEADER);
API.registerHighlightHandler(new HUDHandlerExternal(), ItemInfo.Layout.BODY);
@@ -45,9 +47,8 @@ public class ProxyClient extends ProxyServer {
// We mute the default keybind for displaying the tooltip
NEIClientConfig.getSetting(Constants.BIND_NEI_SHOW).setIntValue(Keyboard.KEY_NONE);
NEIClientConfig.getSetting(Constants.CFG_NEI_SHOW).setBooleanValue(false);
//GuiContainerManager.addInputHandler(new TechTreeHandler());
//API.addKeyBind(Constants.BIND_ENCH, "Display enchantements", Keyboard.KEY_RSHIFT);
//API.addKeyBind(Constants.BIND_WIKI, "Display wiki", Keyboard.KEY_RSHIFT);
//API.addKeyBind(Constants.BIND_TECH, "Display techtree", Keyboard.KEY_RSHIFT);
@@ -83,6 +84,9 @@ public class ProxyClient extends ProxyServer {
/* Applied Energetics */
AppEngModule.register();
/* Thermal Expansion */
ThermalExpansionModule.register();
}
}
+20 -1
View File
@@ -80,5 +80,24 @@ public class ConfigHandler implements IWailaConfigHandler {
@Override
public boolean getConfig(String key){
return this.getConfig(key, true);
}
}
public int getConfigInt(String key){
mod_Waila.instance.config.load();
Property prop = mod_Waila.instance.config.get(Configuration.CATEGORY_GENERAL, key, 0);
return prop.getInt();
}
@Override
public void setConfig(String key, boolean value){
mod_Waila.instance.config.load();
mod_Waila.instance.config.get(Configuration.CATEGORY_GENERAL, key, true).set(value);;
mod_Waila.instance.config.save();
}
public void setConfigInt(String key, int value){
mod_Waila.instance.config.load();
mod_Waila.instance.config.get(Configuration.CATEGORY_GENERAL, key, 0).set(value);;
mod_Waila.instance.config.save();
}
}
@@ -11,16 +11,13 @@ import java.util.Set;
import java.util.logging.Level;
import au.com.bytecode.opencsv.CSVReader;
import net.minecraft.block.Block;
import codechicken.nei.api.API;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.IWailaRegistrar;
import mcp.mobius.waila.api.IWailaSummaryProvider;
import mcp.mobius.waila.handlers.HUDHandlerExternal;
import mcp.mobius.waila.handlers.hud.HUDHandlerExternal;
public class ExternalModulesHandler implements IWailaRegistrar {
@@ -87,12 +84,14 @@ public class ExternalModulesHandler implements IWailaRegistrar {
this.bodyBlockProviders.get(block).add(dataProvider);
}
@Override
public void registerTailProvider(IWailaDataProvider dataProvider, int blockID) {
if (!this.tailProviders.containsKey(blockID))
this.tailProviders.put(blockID, new ArrayList<IWailaDataProvider>());
this.tailProviders.get(blockID).add(dataProvider);
}
@Override
public void registerTailProvider(IWailaDataProvider dataProvider, Class block) {
if (!this.tailBlockProviders.containsKey(block))
this.tailBlockProviders.put(block, new ArrayList<IWailaDataProvider>());
@@ -41,4 +41,9 @@ public class HUDAppEngMonitor implements IWailaDataProvider {
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -15,7 +15,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import codechicken.nei.api.API;
import codechicken.nei.api.ItemInfo;
import codechicken.nei.api.ItemInfo.Layout;
@@ -56,4 +55,9 @@ public class HUDHandlerBBContent implements IWailaDataProvider {
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -35,4 +35,9 @@ public class HUDHandlerBCEngine implements IWailaDataProvider {
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -1,6 +1,7 @@
package mcp.mobius.waila.addons.buildcraft;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import mcp.mobius.waila.api.IWailaConfigHandler;
@@ -40,4 +41,9 @@ public class HUDHandlerBCIPowerReceptor implements IWailaDataProvider {
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -31,6 +31,11 @@ public class HUDHandlerBCPipes implements IWailaDataProvider {
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())
@@ -8,6 +8,7 @@ import java.util.logging.Level;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ConfigHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
@@ -55,6 +56,11 @@ public class HUDHandlerBCTanks implements IWailaDataProvider {
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
public FluidTankInfo getTank(IWailaDataAccessor accessor){
FluidTankInfo tank = null;
@@ -41,4 +41,9 @@ public class HUDHandlerStorage implements IWailaDataProvider {
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -24,4 +24,9 @@ public class HUDHandlerGravestone implements IWailaDataProvider {
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -24,6 +24,9 @@ public class HUDHandlerDoor implements IWailaDataProvider {
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -57,6 +57,11 @@ public class HUDHandlerIC2IEnergySink implements IWailaDataProvider {
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"))
@@ -42,6 +42,11 @@ public class HUDHandlerIC2IEnergySource implements IWailaDataProvider {
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;
}
}
@@ -42,6 +42,11 @@ public class HUDHandlerIC2IEnergyStorage implements IWailaDataProvider {
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;
}
}
@@ -35,4 +35,9 @@ public class HUDHandlerCapacitor implements IWailaDataProvider {
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -24,4 +24,8 @@ public class HUDHandlerLeaves implements IWailaDataProvider {
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -23,4 +23,8 @@ public class HUDHandlerPlants implements IWailaDataProvider {
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.thermalexpansion;
import java.util.List;
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 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")){
try {
FluidStack fluid = (FluidStack)ThermalExpansionModule.TileConduitFluid_getRenderFluid.invoke(accessor.getTileEntity());
try{
currenttip.add(fluid.getFluid().getLocalizedName());
} catch (NullPointerException f){
currenttip.add("Empty");
}
} 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,40 @@
package mcp.mobius.waila.addons.thermalexpansion;
import java.util.List;
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 HUDHandlerEnergyCell 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.energycell")) return currenttip;
int energyReceive = accessor.getNBTInteger(accessor.getNBTData(), "Recv");
int energySend = accessor.getNBTInteger(accessor.getNBTData(), "Send");
currenttip.add(String.format("In/Out : %d / %d RF/t", energyReceive, energySend));
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -0,0 +1,49 @@
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;
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;
}
}
@@ -0,0 +1,58 @@
package mcp.mobius.waila.addons.thermalexpansion;
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 HUDHandlerISecureTile 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.owner")){
String owner = accessor.getNBTData().getString("Owner");
int iaccess = accessor.getNBTInteger(accessor.getNBTData(), "Access");
String access = "INVALID";
switch(iaccess){
case 0:
access = "Public";
break;
case 1:
access = "Restricted";
break;
case 2:
access = "Private";
break;
}
currenttip.add(String.format("Owner : \u00a7f%s\u00a7r [ %s ]", owner, access));
}
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.thermalexpansion;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
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 += " < 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("Mode : \u00a7aInput");
else if (mode == 1)
currenttip.add("Mode : \u00a7cOutput");
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,86 @@
package mcp.mobius.waila.addons.thermalexpansion;
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 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 = "Send : ";
String recv = "Recv : ";
switch (accessor.getNBTInteger(accessor.getNBTData(), "Item.Mode")){
case 0:
send += "\u00a7aItem ";
break;
case 1:
recv += "\u00a7aItem ";
break;
case 2:
send += "\u00a7aItem ";
recv += "\u00a7aItem ";
break;
}
switch (accessor.getNBTInteger(accessor.getNBTData(), "Fluid.Mode")){
case 0:
send += "\u00a79Fluid ";
break;
case 1:
recv += "\u00a79Fluid ";
break;
case 2:
send += "\u00a79Fluid ";
recv += "\u00a79Fluid ";
break;
}
switch (accessor.getNBTInteger(accessor.getNBTData(), "Energy.Mode")){
case 0:
send += "\u00a7cEnergy";
break;
case 1:
recv += "\u00a7cEnergy";
break;
case 2:
send += "\u00a7cEnergy";
recv += "\u00a7cEnergy";
break;
}
if (!send.equals("Send : "))
currenttip.add(send);
if (!send.equals("Recv : "))
currenttip.add(recv);
}
if (config.getConfig("thermalexpansion.tessfreq"))
currenttip.add(String.format("Frequency : %d",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,120 @@
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 TileTesseract = null;
public static Class ISecureTile = 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.TileConduitFluidTrans");
TileConduitFluid_getRenderFluid = TileConduitFluid.getMethod("getRenderFluid");
TileConduitFluid_getRenderFluidLevel = TileConduitFluid.getMethod("getRenderFluidLevel");
TileTesseract = Class.forName("thermalexpansion.block.tesseract.TileTesseract");
ISecureTile = Class.forName("cofh.api.tileentity.ISecureTile");
//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", "Show RF storage");
ExternalModulesHandler.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.energycell", "Show ECell IN/OUT");
ExternalModulesHandler.instance().addConfig("Thermal Expansion", "thermalexpansion.fluidtype", "Show fluid type");
ExternalModulesHandler.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.fluidamount", "Show fluid amount");
ExternalModulesHandler.instance().addConfig("Thermal Expansion", "thermalexpansion.tankmode", "Show tank mode");
ExternalModulesHandler.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.tesssendrecv", "Tesseract mode");
ExternalModulesHandler.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.tessfreq", "Tesseract frequency");
ExternalModulesHandler.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.owner", "Show 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 HUDHandlerConduitFluid(), TileConduitFluid);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerTesseract(), TileTesseract);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerISecureTile(), ISecureTile);
//ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerConduitBase(), TileConduitBase);
}
}
@@ -23,5 +23,9 @@ public class TwilightForestGenericOverride implements IWailaDataProvider {
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;
}
}
@@ -114,6 +114,11 @@ public class HUDHandlerVanilla implements IWailaDataProvider {
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
public static void register(){
ExternalModulesHandler.instance().addConfig("VanillaMC", "vanilla.spawntype", "Spawner type");
+1
View File
@@ -29,4 +29,5 @@ public interface IWailaBlock {
List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config);
List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config);
List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config);
}
@@ -23,4 +23,6 @@ public interface IWailaConfigHandler {
/* Returns the current value of an option (true/false) with a default value true if not set*/
public boolean getConfig(String key);
public void setConfig(String key, boolean value);
}
@@ -8,6 +8,7 @@ public interface IWailaRegistrar {
/* Register a IWailaDataProvider for the given blockID, either for the Head section or the Body section */
public void registerHeadProvider (IWailaDataProvider dataProvider, int blockID);
public void registerBodyProvider (IWailaDataProvider dataProvider, int blockID);
public void registerTailProvider (IWailaDataProvider dataProvider, int blockID);
/* Register a stack overrider for the given blockID */
public void registerStackProvider(IWailaDataProvider dataProvider, int blockID);
@@ -17,6 +18,7 @@ public interface IWailaRegistrar {
/* 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);
public void registerDocTextFile (String filename);
@@ -1,72 +0,0 @@
package mcp.mobius.waila.gui;
import java.util.EnumSet;
import org.lwjgl.input.Keyboard;
import codechicken.nei.NEIClientConfig;
import mcp.mobius.waila.Constants;
import mcp.mobius.waila.addons.ConfigHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.KeyBinding;
import cpw.mods.fml.client.registry.KeyBindingRegistry.KeyHandler;
import cpw.mods.fml.common.TickType;
import cpw.mods.fml.common.registry.LanguageRegistry;
public class ConfigKeyHandler extends KeyHandler {
public ConfigKeyHandler()
{
super(new KeyBinding[]{
new KeyBinding(Constants.BIND_WAILA_CFG, Keyboard.KEY_NUMPAD0),
new KeyBinding(Constants.BIND_WAILA_SHOW, Keyboard.KEY_NUMPAD1),
//new KeyBinding("key.wailatedump", Keyboard.KEY_NUMPAD1),
}, new boolean[]{
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("key.wailatedump", "[Waila] Dump server TE");
}
@Override
public void keyDown(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd, boolean isRepeat) {
if (!tickEnd) return;
Minecraft mc = Minecraft.getMinecraft();
if (kb.keyDescription == Constants.BIND_WAILA_CFG){
if(mc.currentScreen == null)
mc.displayGuiScreen(new GuiConfigScreen(mc.currentScreen));
}
else if (kb.keyDescription == Constants.BIND_WAILA_SHOW && ConfigHandler.instance().getConfig("waila.showmode")){
boolean status = NEIClientConfig.getSetting(Constants.CFG_NEI_SHOW).getBooleanValue();
NEIClientConfig.getSetting(Constants.CFG_NEI_SHOW).setBooleanValue(!status);
}
else if (kb.keyDescription == Constants.BIND_WAILA_SHOW && !ConfigHandler.instance().getConfig("waila.showmode")){
NEIClientConfig.getSetting(Constants.CFG_NEI_SHOW).setBooleanValue(true);
}
}
@Override
public void keyUp(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd) {
if (!tickEnd) return;
if (kb.keyDescription == Constants.BIND_WAILA_SHOW && !ConfigHandler.instance().getConfig("waila.showmode")){
NEIClientConfig.getSetting(Constants.CFG_NEI_SHOW).setBooleanValue(false);
}
}
@Override
public EnumSet<TickType> ticks() {
return EnumSet.of(TickType.CLIENT);
}
@Override
public String getLabel() {
return "Waila Config Screen Keybind";
}
}
-23
View File
@@ -1,23 +0,0 @@
package mcp.mobius.waila.gui;
import mcp.mobius.waila.gui.widget_old.ButtonChangeScreen;
import mcp.mobius.waila.gui.widget_old.ContainerButtons;
import net.minecraft.client.gui.GuiScreen;
public class GuiConfigScreen extends BaseWailaScreen {
public GuiConfigScreen(GuiScreen _parentGui) {
super(_parentGui);
}
@Override
/* We init the GUI data here (buttons, etc) */
public void initGui()
{
buttonList.add(new ButtonChangeScreen(200, width / 2 - 100, height / 6 + 168, "Done", null));
ContainerButtons container = new ContainerButtons(this, 5, height/2-10, width - 10, height);
container.addButton(new ButtonChangeScreen(201, "Waila", new GuiWailaConfig(this) ));
container.addButton(new ButtonChangeScreen(202, "Modules", new GuiModules(this)));
}
}
@@ -1,57 +0,0 @@
package mcp.mobius.waila.gui;
import mcp.mobius.waila.gui.widget.ContainerTable;
import mcp.mobius.waila.gui.widget.Label;
import mcp.mobius.waila.gui.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);
}
}
@@ -1,33 +0,0 @@
package mcp.mobius.waila.gui;
import mcp.mobius.waila.addons.ConfigHandler;
import mcp.mobius.waila.gui.widget_old.ButtonChangeScreen;
import mcp.mobius.waila.gui.widget_old.ButtonConfigOption;
import mcp.mobius.waila.gui.widget_old.ButtonConfigRemote;
import mcp.mobius.waila.gui.widget_old.ContainerButtons;
import net.minecraft.client.gui.GuiScreen;
public class GuiModuleOptions extends BaseWailaScreen {
private String modName;
public GuiModuleOptions(GuiScreen _parentGui, String _modName) {
super(_parentGui);
this.modName = _modName;
}
@Override
public void initGui()
{
buttonList.add(new ButtonChangeScreen(200, width / 2 - 100, height / 6 + 168, "Back", this.parentGui));
ContainerButtons container = new ContainerButtons(this, 5, 0, width - 10, height);
for (String key:ConfigHandler.instance().getConfigKeys(this.modName).keySet()){
if (ConfigHandler.instance().isServerRequired(key))
container.addButton(new ButtonConfigRemote(-1, "No", "Yes", ConfigHandler.instance().getConfigKeys(this.modName).get(key), key ));
else
container.addButton(new ButtonConfigOption(-1, "No", "Yes", ConfigHandler.instance().getConfigKeys(this.modName).get(key), key ));
}
}
}
-31
View File
@@ -1,31 +0,0 @@
package mcp.mobius.waila.gui;
import java.util.HashMap;
import mcp.mobius.waila.addons.ConfigHandler;
import mcp.mobius.waila.gui.widget_old.ButtonChangeScreen;
import mcp.mobius.waila.gui.widget_old.ContainerButtons;
import net.minecraft.client.gui.GuiScreen;
public class GuiModules extends BaseWailaScreen {
private HashMap<String, GuiScreen> screens = new HashMap<String, GuiScreen>();
public GuiModules(GuiScreen _parentGui) {
super(_parentGui);
for (String key : ConfigHandler.instance().getModuleNames())
screens.put(key, new GuiModuleOptions(this, key));
}
@Override
public void initGui()
{
buttonList.add(new ButtonChangeScreen(200, width / 2 - 100, height / 6 + 168, "Back", this.parentGui));
ContainerButtons container = new ContainerButtons(this, 5, 0, width - 10, height);
for (String key : ConfigHandler.instance().getModuleNames())
container.addButton(new ButtonChangeScreen(-1, key, screens.get(key)));
}
}
-29
View File
@@ -1,29 +0,0 @@
package mcp.mobius.waila.gui;
import mcp.mobius.waila.Constants;
import mcp.mobius.waila.gui.widget_old.ButtonChangeScreen;
import mcp.mobius.waila.gui.widget_old.ButtonConfigNEI;
import mcp.mobius.waila.gui.widget_old.ButtonConfigOption;
import mcp.mobius.waila.gui.widget_old.ContainerButtons;
import net.minecraft.client.gui.GuiScreen;
public class GuiWailaConfig extends BaseWailaScreen {
public GuiWailaConfig(GuiScreen _parentGui) {
super(_parentGui);
// TODO Auto-generated constructor stub
}
@Override
public void initGui()
{
buttonList.add(new ButtonChangeScreen(200, width / 2 - 100, height / 6 + 168, "Back", this.parentGui));
ContainerButtons container = new ContainerButtons(this, 5, 0, width - 10, height);
container.addButton(new ButtonConfigNEI(-1, "Hidden", "Shown", "Show/Hide Waila", Constants.CFG_NEI_SHOW ));
container.addButton(new ButtonConfigOption(-1, "Maintained", "Toggled", "Toggle/Maintained", "waila.showmode" ));
container.addButton(new ButtonConfigOption(-1, "Hidden", "Visible", "Show ID:Metadata", "waila.showmetadata", false ));
}
}
+101
View File
@@ -0,0 +1,101 @@
package mcp.mobius.waila.gui.events;
import net.minecraft.client.Minecraft;
import org.lwjgl.input.Mouse;
import mcp.mobius.waila.gui.interfaces.IWidget;
public class MouseEvent {
public enum EventType {NONE, MOVE, CLICK, RELEASED, DRAG, WHEEL, ENTER, LEAVE};
public long timestamp;
public Minecraft mc;
public IWidget srcwidget;
public IWidget trgwidget;
public double x,y;
public int z;
public static int buttonCount = Mouse.getButtonCount();
public boolean[] buttonState = new boolean[buttonCount];
public EventType type;
public int button = -1;
public MouseEvent(IWidget widget){
this.srcwidget = widget;
this.timestamp = System.nanoTime();
this.mc = Minecraft.getMinecraft();
this.x = (double)Mouse.getEventX() * (double)this.srcwidget.getSize().getX() / (double)this.mc.displayWidth;
this.y = (double)this.srcwidget.getSize().getY() - (double)Mouse.getEventY() * (double)this.srcwidget.getSize().getY() / (double)this.mc.displayHeight - 1.0;
//this.x = Mouse.getEventX();
//this.y = Mouse.getEventY();
//System.out.printf("%s %s\n", this.x, this.y);
//this.z = Mouse.getEventDWheel();
this.z = Mouse.getDWheel();
for (int i = 0; i < buttonCount; i++)
buttonState[i] = Mouse.isButtonDown(i);
this.trgwidget = this.srcwidget.getWidgetAtCoordinates(this.x, this.y);
}
public String toString(){
String retstring = String.format("MOUSE %s : [%s] [ %.2f %.2f %d ] [", this.type, this.timestamp, this.x, this.y, this.z);
if (this.buttonCount < 5)
for (int i = 0; i < this.buttonCount; i++)
retstring += String.format(" %s ", this.buttonState[i]);
else
for (int i = 0; i < 5; i++)
retstring += String.format(" %s ", this.buttonState[i]);
retstring += "]";
if (this.button != -1)
retstring += String.format(" Button %s", this.button);
return retstring;
}
// Returns the event type based on the previous mouse event.
public EventType getEventType(MouseEvent me){
this.type = EventType.NONE;
if (this.trgwidget != me.trgwidget){
this.type = EventType.ENTER;
return this.type;
}
if (this.z != 0){
this.type = EventType.WHEEL;
return this.type;
}
for (int i = 0; i < this.buttonCount; i++){
if (this.buttonState[i] != me.buttonState[i]){
if (this.buttonState[i] == true)
this.type = EventType.CLICK;
else
this.type = EventType.RELEASED;
this.button = i;
return this.type;
}
}
//MOVE & DRAG EVENTS (we moved the mouse and button 0 was clicked or not)
if ((this.x != me.x) || (this.y != me.y)){
if (this.buttonState[0] == true)
this.type = EventType.DRAG;
else
this.type = EventType.MOVE;
return this.type;
}
return this.type;
}
}
@@ -0,0 +1,37 @@
package mcp.mobius.waila.gui.helpers;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import com.google.common.collect.Lists;
public class ReverseIterator<T> implements Iterable<T> {
private ListIterator<T> listIterator;
public ReverseIterator(Collection<T> wrappedList) {
List list = Lists.newArrayList(wrappedList);
this.listIterator = list.listIterator(wrappedList.size());
}
public Iterator<T> iterator() {
return new Iterator<T>() {
public boolean hasNext() {
return listIterator.hasPrevious();
}
public T next() {
return listIterator.previous();
}
public void remove() {
listIterator.remove();
}
};
}
}
@@ -0,0 +1,7 @@
package mcp.mobius.waila.gui.helpers;
public class UIException extends RuntimeException {
public UIException(String message) {
super(message);
}
}
@@ -0,0 +1,58 @@
package mcp.mobius.waila.gui.helpers;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.renderer.Tessellator;
public class UIHelper {
public static void drawTexture(int posX, int posY, int sizeX, int sizeY)
{
UIHelper.drawTexture(posX, posY, sizeX, sizeY, 0, 0, 256, 256);
}
public static void drawTexture(int posX, int posY, int sizeX, int sizeY, int texU, int texV, int texSizeU, int texSizeV)
{
float zLevel = 0.0F;
float f = 0.00390625F;
Tessellator tess = Tessellator.instance;
tess.startDrawingQuads();
tess.addVertexWithUV((double)(posX + 0), (double)(posY + sizeY), (double)zLevel, texU*f, (texV + texSizeV)*f);
tess.addVertexWithUV((double)(posX + sizeX), (double)(posY + sizeY), (double)zLevel, (texU + texSizeU)*f, (texV + texSizeV)*f);
tess.addVertexWithUV((double)(posX + sizeX), (double)(posY + 0), (double)zLevel, (texU + texSizeU)*f, texV*f);
tess.addVertexWithUV((double)(posX + 0), (double)(posY + 0), (double)zLevel, texU*f, texV*f);
tess.draw();
}
public static void drawGradientRect(int minx, int miny, int maxx, int maxy, int zlevel, int color1, int color2)
{
float alpha1 = (float)(color1 >> 24 & 255) / 255.0F;
float red1 = (float)(color1 >> 16 & 255) / 255.0F;
float green1 = (float)(color1 >> 8 & 255) / 255.0F;
float blue1 = (float)(color1 & 255) / 255.0F;
float alpha2 = (float)(color2 >> 24 & 255) / 255.0F;
float red2 = (float)(color2 >> 16 & 255) / 255.0F;
float green2 = (float)(color2 >> 8 & 255) / 255.0F;
float blue2 = (float)(color2 & 255) / 255.0F;
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glShadeModel(GL11.GL_SMOOTH);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.setColorRGBA_F(red1, green1, blue1, alpha1);
tessellator.addVertex((double)maxx, (double)miny, (double)zlevel);
tessellator.addVertex((double)minx, (double)miny, (double)zlevel);
tessellator.setColorRGBA_F(red2, green2, blue2, alpha2);
tessellator.addVertex((double)minx, (double)maxy, (double)zlevel);
tessellator.addVertex((double)maxx, (double)maxy, (double)zlevel);
tessellator.draw();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
}
@@ -0,0 +1,8 @@
package mcp.mobius.waila.gui.interfaces;
public enum CType {
REL_X,
REL_Y,
RELXY,
ABSXY;
}
@@ -0,0 +1,64 @@
package mcp.mobius.waila.gui.interfaces;
import mcp.mobius.waila.gui.events.MouseEvent;
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
import org.lwjgl.util.Point;
public interface IWidget {
// Should all the coordinates, sizes, etc be % or absolute values ?
// Should we allow 2 methods for an absolute referencing (screen pos) and relative one (parent pos) ?
IWidget getParent();
void setParent(IWidget parent);
IWidget setGeometry(WidgetGeometry geom);
WidgetGeometry getGeometry();
IWidget setPos(double x, double y);
IWidget setPos(double x, double y, boolean fracX, boolean fracY);
IWidget setSize(double sx, double sy);
IWidget setSize(double sx, double sy, boolean fracX, boolean fracY);
IWidget adjustSize();
Point getPos();
Point getSize();
int getRight();
int getLeft();
int getTop();
int getBottom();
void draw();
void draw(Point pos);
void show();
void hide();
void setAlpha(float alpha);
float getAlpha();
boolean shouldRender();
IWidget addWidget(String name, IWidget widget);
IWidget addWidget(String name, IWidget widget, RenderPriority priority);
IWidget getWidget(String name);
IWidget delWidget(String name);
IWidget getWidgetAtCoordinates(double posX, double posY);
boolean isWidgetAtCoordinates(double posx, double posy);
void handleMouseInput();
void onMouseClick(MouseEvent event);
void onMouseDrag(MouseEvent event);
void onMouseMove(MouseEvent event);
void onMouseRelease(MouseEvent event);
void onMouseWheel(MouseEvent event);
void onMouseEnter(MouseEvent event);
void onMouseLeave(MouseEvent event);
void emit(Signal signal, Object... params);
void onWidgetEvent(IWidget srcwidget, Signal signal, Object... params);
//boolean onMouseEnter();
//boolean onMouseMoved();
//boolean onMouseLeave();
}
@@ -0,0 +1,7 @@
package mcp.mobius.waila.gui.interfaces;
public enum RenderPriority {
LOW,
MEDIUM,
HIGH;
}
@@ -0,0 +1,8 @@
package mcp.mobius.waila.gui.interfaces;
public enum Signal {
DRAGGED,
CLICKED,
VALUE_CHANGED,
GEOM_CHANGED;
}
@@ -0,0 +1,5 @@
package mcp.mobius.waila.gui.interfaces;
public enum WAlign {
LEFT,CENTER,RIGHT,TOP,BOTTOM;
}
@@ -0,0 +1,90 @@
package mcp.mobius.waila.gui.screens;
import java.util.HashMap;
import org.lwjgl.input.Mouse;
import mcp.mobius.waila.gui.interfaces.IWidget;
import mcp.mobius.waila.gui.widgets.LayoutCanvas;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
public abstract class ScreenBase extends GuiScreen{
protected GuiScreen parent; // Return screen if available.
protected Minecraft mc; // Minecraft instance
protected HashMap<String, IWidget> widgets; // List of widgets on this ui
public ScreenBase(GuiScreen parent) {
this.parent = parent;
this.mc = Minecraft.getMinecraft();
this.widgets = new HashMap<String, IWidget>();
this.addWidget("canvas", new LayoutCanvas());
Mouse.getDWheel(); // We init the DWheel method (getDWheel returns the value since the last call, so we have to call it once on ui creation)
}
/////////////////////
// WIDGET HANDLING //
/////////////////////
public IWidget addWidget(String name, IWidget widget){
this.widgets.put(name, widget);
return this.getWidget(name);
}
public IWidget getWidget(String name){
return this.widgets.get(name);
}
public IWidget delWidget(String name){
IWidget widget = this.getWidget(name);
this.widgets.remove(widget);
return widget;
}
public IWidget getRoot(){
return this.getWidget("canvas");
}
/////////////////////
// DRAWING METHODS //
/////////////////////
@Override
public void drawScreen(int i, int j, float f) {
this.drawDefaultBackground(); //The dark background common to most of the UIs
super.drawScreen(i, j, f);
for (IWidget widget: this.widgets.values())
widget.draw();
}
// Used to easily display a UI without having to mess with mc handle.
public void display(){
this.mc.displayGuiScreen(this);
}
/////////////////////
// INPUT METHODS //
/////////////////////
//Keyboard handling. Basic one is just returning to the previous UI when Esc is pressed
@Override
public void keyTyped(char keyChar, int keyID)
{
if (keyID == 1)
if (this.parent == null){
this.mc.displayGuiScreen((GuiScreen)null);
this.mc.setIngameFocus();
} else
this.mc.displayGuiScreen(this.parent);
}
@Override
public void handleMouseInput()
{
this.getRoot().handleMouseInput();
}
}
@@ -0,0 +1,32 @@
package mcp.mobius.waila.gui.screens.config;
import mcp.mobius.waila.Constants;
import mcp.mobius.waila.gui.interfaces.CType;
import mcp.mobius.waila.gui.interfaces.WAlign;
import mcp.mobius.waila.gui.screens.ScreenBase;
import mcp.mobius.waila.gui.widgets.LayoutBase;
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
import mcp.mobius.waila.gui.widgets.buttons.ButtonBooleanConfig;
import mcp.mobius.waila.gui.widgets.buttons.ButtonContainer;
import mcp.mobius.waila.gui.widgets.buttons.ButtonContainerLabel;
import mcp.mobius.waila.gui.widgets.buttons.ButtonScreenChange;
import net.minecraft.client.gui.GuiScreen;
public class ScreenConfig extends ScreenBase {
public ScreenConfig(GuiScreen parent){
super(parent);
this.getRoot().addWidget("ButtonContainer", new ButtonContainer(this.getRoot(), 2, 100, 25.0));
this.getRoot().getWidget("ButtonContainer").setGeometry(new WidgetGeometry(50.0, 50.0, 50.0, 30.0, CType.RELXY, CType.REL_X, WAlign.CENTER, WAlign.CENTER));
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)));
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").getWidget("ButtonBack").setGeometry(new WidgetGeometry(50.0, 50.0, 100.0, 20.0, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
}
}
@@ -0,0 +1,254 @@
package mcp.mobius.waila.gui.screens.config;
import org.lwjgl.util.Point;
import mcp.mobius.waila.Constants;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ConfigHandler;
import mcp.mobius.waila.gui.events.MouseEvent;
import mcp.mobius.waila.gui.interfaces.CType;
import mcp.mobius.waila.gui.interfaces.IWidget;
import mcp.mobius.waila.gui.interfaces.RenderPriority;
import mcp.mobius.waila.gui.interfaces.Signal;
import mcp.mobius.waila.gui.interfaces.WAlign;
import mcp.mobius.waila.gui.screens.ScreenBase;
import mcp.mobius.waila.gui.widgets.LabelFixedFont;
import mcp.mobius.waila.gui.widgets.LayoutBase;
import mcp.mobius.waila.gui.widgets.LayoutMargin;
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
import mcp.mobius.waila.gui.widgets.buttons.ButtonLabel;
import mcp.mobius.waila.gui.widgets.buttons.ButtonScreenChange;
import mcp.mobius.waila.gui.widgets.movable.PictureMovableRC;
import net.minecraft.client.gui.GuiScreen;
public class ScreenHUDConfig extends ScreenBase {
private class EventCanvas extends LayoutBase{
IWidget draggedWidget = null;
float scale;
public EventCanvas(IWidget parent, GuiScreen prevScreen){
super(parent);
this.setGeometry(new WidgetGeometry(0.0,0.0,100.0,100.0,CType.RELXY, CType.RELXY));
/*
IWidget layoutX = this.addWidget("LayoutX", new LayoutBase(this));
layoutX.setGeometry(new WidgetGeometry(40.0,50.0,20,60, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
layoutX.addWidget("ButtonXAdd", new ButtonLabel(null, "+")).setGeometry(new WidgetGeometry(0.0, 0.0,20,20, CType.RELXY, CType.ABSXY, WAlign.LEFT, WAlign.TOP));
layoutX.addWidget("ButtonXSub", new ButtonLabel(null, "-")).setGeometry(new WidgetGeometry(0.0,100.0,20,20, CType.RELXY, CType.ABSXY, WAlign.LEFT, WAlign.BOTTOM));
layoutX.addWidget("ValueDisplayX", new LabelFixedFont(null, "0")).setGeometry(new WidgetGeometry(50.0,50.0,20,20, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
*/
/*
IWidget layoutY = this.addWidget("LayoutY", new LayoutBase(this));
layoutY.setGeometry(new WidgetGeometry(50.0,50.0,20,60,CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
layoutY.addWidget("ButtonYAdd", new ButtonLabel(null, "+")).setGeometry(new WidgetGeometry(0.0, 0.0,20,20, CType.RELXY, CType.ABSXY, WAlign.LEFT, WAlign.TOP));
layoutY.addWidget("ButtonYSub", new ButtonLabel(null, "-")).setGeometry(new WidgetGeometry(0.0,100.0,20,20, CType.RELXY, CType.ABSXY, WAlign.LEFT, WAlign.BOTTOM));
layoutY.addWidget("ValueDisplayY", new LabelFixedFont(null, "0")).setGeometry(new WidgetGeometry(50.0,50.0,20,20, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
*/
double picX = ConfigHandler.instance().getConfigInt(Constants.CFG_WAILA_POSX) / 100.0;
double picY = ConfigHandler.instance().getConfigInt(Constants.CFG_WAILA_POSY) / 100.0;
float picAlpha = ConfigHandler.instance().getConfigInt(Constants.CFG_WAILA_ALPHA) / 100.0f;
scale = ConfigHandler.instance().getConfigInt(Constants.CFG_WAILA_SCALE) / 100.0f;
int picSX = (int)(180 / this.rez.getScaleFactor() * scale), picSY = (int)(62 / this.rez.getScaleFactor() * scale);
this.addWidget("Layout", new LayoutMargin(null), RenderPriority.HIGH);
((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));;
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));
layoutX.addWidget("LabelX", new LabelFixedFont(null, "X")) .setGeometry(new WidgetGeometry(50.0, 0.0,20,20, CType.REL_X, CType.ABSXY, WAlign.CENTER, WAlign.TOP));
layoutX.addWidget("ButtonXAdd", new ButtonLabel(null, "+")) .setGeometry(new WidgetGeometry(0.0, 10.0,20,20, CType.REL_X, CType.ABSXY, WAlign.LEFT, WAlign.TOP));
layoutX.addWidget("ValueDisplayX", new LabelFixedFont(null, "0")) .setGeometry(new WidgetGeometry(50.0, 40.0,20,20, CType.REL_X, CType.ABSXY, WAlign.CENTER, WAlign.TOP));
layoutX.addWidget("ButtonXSub", new ButtonLabel(null, "-")) .setGeometry(new WidgetGeometry(0.0, 60.0,20,20, CType.REL_X, CType.ABSXY, WAlign.LEFT, WAlign.TOP));
IWidget layoutY = this.addWidget("LayoutY", new LayoutBase(this));
layoutY.setGeometry(new WidgetGeometry(45.0,50.0,20,80,CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
layoutY.addWidget("LabelY", new LabelFixedFont(null, "Y")) .setGeometry(new WidgetGeometry(50.0, 0.0,20,20, CType.REL_X, CType.ABSXY, WAlign.CENTER, WAlign.TOP));
layoutY.addWidget("ButtonYAdd", new ButtonLabel(null, "+")) .setGeometry(new WidgetGeometry(0.0, 10.0,20,20, CType.REL_X, CType.ABSXY, WAlign.LEFT, WAlign.TOP));
layoutY.addWidget("ValueDisplayY", new LabelFixedFont(null, "0")) .setGeometry(new WidgetGeometry(50.0, 40.0,20,20, CType.REL_X, CType.ABSXY, WAlign.CENTER, WAlign.TOP));
layoutY.addWidget("ButtonYSub", new ButtonLabel(null, "-")) .setGeometry(new WidgetGeometry(0.0, 60.0,20,20, CType.REL_X, CType.ABSXY, WAlign.LEFT, WAlign.TOP));
IWidget layoutAlpha = this.addWidget("LayoutAlpha", new LayoutBase(this));
layoutAlpha.setGeometry(new WidgetGeometry(55.0,50.0,20,80,CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
layoutAlpha.addWidget("LabelAlpha", new LabelFixedFont(null, "Alpha")).setGeometry(new WidgetGeometry(50.0, 0.0,20,20, CType.REL_X, CType.ABSXY, WAlign.CENTER, WAlign.TOP));
layoutAlpha.addWidget("ButtonAlphaAdd", new ButtonLabel(null, "+")) .setGeometry(new WidgetGeometry(0.0, 10.0,20,20, CType.REL_X, CType.ABSXY, WAlign.LEFT, WAlign.TOP));
layoutAlpha.addWidget("ValueDisplayAlpha", new LabelFixedFont(null, "0")) .setGeometry(new WidgetGeometry(50.0, 40.0,20,20, CType.REL_X, CType.ABSXY, WAlign.CENTER, WAlign.TOP));
layoutAlpha.addWidget("ButtonAlphaSub", new ButtonLabel(null, "-")) .setGeometry(new WidgetGeometry(0.0, 60.0,20,20, CType.REL_X, CType.ABSXY, WAlign.LEFT, WAlign.TOP));
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("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));
((LabelFixedFont)this.getWidget("LayoutX").getWidget("ValueDisplayX")).setText(String.format("%.2f", picX));
((LabelFixedFont)this.getWidget("LayoutY").getWidget("ValueDisplayY")).setText(String.format("%.2f", picY));
((LabelFixedFont)this.getWidget("LayoutAlpha").getWidget("ValueDisplayAlpha")).setText(String.format("%.2f", picAlpha));
((LabelFixedFont)this.getWidget("LayoutScale").getWidget("ValueDisplayScale")).setText(String.format("%.2f", scale));
this.getWidget("Layout").getWidget("Picture").setAlpha(picAlpha);
}
@Override
public IWidget getWidgetAtCoordinates(double posX, double posY){
if (this.getWidget("Layout").getWidget("Picture").isWidgetAtCoordinates(posX, posY))
return this.getWidget("Layout").getWidget("Picture");
else
return super.getWidgetAtCoordinates(posX, posY);
}
@Override
public void onMouseClick(MouseEvent event){
//System.out.println(this.getWidgetAtCoordinates(event.x, event.y));
if ((event.button == 0) && (this.getWidget("Layout").getWidget("Picture").isWidgetAtCoordinates(event.x, event.y))){
this.getWidget("Layout").getWidget("Picture").onMouseClick(event);
this.draggedWidget = this.getWidget("Layout").getWidget("Picture");
}
else
super.onMouseClick(event);
}
@Override
public void onMouseDrag(MouseEvent event){
//if ((this.getWidgetAtCoordinates(event.x, event.y) == this) && (this.draggedWidget != null)){
if (this.draggedWidget != null){
this.draggedWidget.onMouseDrag(event);
} else {
super.onMouseDrag(event);
}
}
@Override
public void onMouseRelease(MouseEvent event){
if (event.button == 0)
this.draggedWidget = null;
super.onMouseRelease(event);
}
private void updateData(){
((LabelFixedFont)this.getWidget("LayoutX").getWidget("ValueDisplayX")).setText(String.format("%.2f", this.getWidget("Layout").getWidget("Picture").getGeometry().getRawPos().getX()));
((LabelFixedFont)this.getWidget("LayoutY").getWidget("ValueDisplayY")).setText(String.format("%.2f", this.getWidget("Layout").getWidget("Picture").getGeometry().getRawPos().getY()));
((LabelFixedFont)this.getWidget("LayoutAlpha").getWidget("ValueDisplayAlpha")).setText(String.format("%.2f", this.getWidget("Layout").getWidget("Picture").getAlpha()));
((LabelFixedFont)this.getWidget("LayoutScale").getWidget("ValueDisplayScale")).setText(String.format("%.2f", scale));
}
@Override
public void onWidgetEvent(IWidget srcwidget, Signal signal, Object... params){
if (this.getWidget("Layout") == null) return;
if (srcwidget.equals(this.getWidget("Layout").getWidget("Picture")) && signal == Signal.DRAGGED){
this.draggedWidget = this.getWidget("Layout").getWidget("Picture");
this.updateData();
}
if (signal == Signal.CLICKED){
IWidget picture = this.getWidget("Layout").getWidget("Picture");
double pictureX = picture.getGeometry().getRawPos().getX();
double pictureY = picture.getGeometry().getRawPos().getY();
double pixelToPercentX = 100.0D / picture.getParent().getSize().getX();
double pixelToPercentY = 100.0D / picture.getParent().getSize().getY();
if (srcwidget.equals(this.getWidget("LayoutX").getWidget("ButtonXAdd"))){
double newPos = Math.min(pictureX + pixelToPercentX, 100.0);
picture.setPos(newPos, pictureY);
}
if (srcwidget.equals(this.getWidget("LayoutX").getWidget("ButtonXSub"))){
double newPos = Math.max(pictureX - pixelToPercentX, 0.0);
picture.setPos(newPos, pictureY);
}
if (srcwidget.equals(this.getWidget("LayoutY").getWidget("ButtonYAdd"))){
double newPos = Math.min(pictureY + pixelToPercentY, 100.0);
picture.setPos(pictureX, newPos);
}
if (srcwidget.equals(this.getWidget("LayoutY").getWidget("ButtonYSub"))){
double newPos = Math.max(pictureY - pixelToPercentY, 0.0);
picture.setPos(pictureX, newPos);
}
if (srcwidget.equals(this.getWidget("LayoutAlpha").getWidget("ButtonAlphaAdd")))
picture.setAlpha(Math.min(picture.getAlpha() + 0.05f, 1.0f));
if (srcwidget.equals(this.getWidget("LayoutAlpha").getWidget("ButtonAlphaSub")))
picture.setAlpha(Math.max(picture.getAlpha() - 0.05f, 0.0f));
if (srcwidget.equals(this.getWidget("LayoutScale").getWidget("ButtonScaleAdd"))){
scale += 0.05f;
scale = Math.max(0.10f, scale);
scale = Math.min(2.00f, scale);
int picSX = (int)(180 / this.rez.getScaleFactor() * scale), picSY = (int)(62 / this.rez.getScaleFactor() * scale);
picture.setSize(picSX, picSY);
((LayoutMargin)this.getWidget("Layout")).setMargins(picSX/2, picSX/2, picSY/2, picSY/2);
}
if (srcwidget.equals(this.getWidget("LayoutScale").getWidget("ButtonScaleSub"))){
scale -= 0.05f;
scale = Math.max(0.10f, scale);
scale = Math.min(2.00f, scale);
int picSX = (int)(180 / this.rez.getScaleFactor() * scale), picSY = (int)(62 / this.rez.getScaleFactor() * scale);
picture.setSize(picSX, picSY);
((LayoutMargin)this.getWidget("Layout")).setMargins(picSX/2, picSX/2, picSY/2, picSY/2);
}
//picture.emit(Signal.DRAGGED, picture.getPos());
this.updateData();
}
if (srcwidget.equals(this.getWidget("ButtonOk")) && signal == Signal.CLICKED){
ConfigHandler.instance().setConfigInt(Constants.CFG_WAILA_POSX, (int)(this.getWidget("Layout").getWidget("Picture").getGeometry().getRawPos().getX() * 100.0));
ConfigHandler.instance().setConfigInt(Constants.CFG_WAILA_POSY, (int)(this.getWidget("Layout").getWidget("Picture").getGeometry().getRawPos().getY() * 100.0));
ConfigHandler.instance().setConfigInt(Constants.CFG_WAILA_ALPHA, (int)(this.getWidget("Layout").getWidget("Picture").getAlpha() * 100.0));
ConfigHandler.instance().setConfigInt(Constants.CFG_WAILA_SCALE, (int)(scale * 100.0));
mod_Waila.alpha = ConfigHandler.instance().getConfigInt(Constants.CFG_WAILA_ALPHA);
mod_Waila.posX = ConfigHandler.instance().getConfigInt(Constants.CFG_WAILA_POSX);
mod_Waila.posY = ConfigHandler.instance().getConfigInt(Constants.CFG_WAILA_POSY);
mod_Waila.scale = ConfigHandler.instance().getConfigInt(Constants.CFG_WAILA_SCALE) / 100.0f;
mod_Waila.updateColors();
}
if (srcwidget.equals(this.getWidget("ButtonDefault")) && signal == Signal.CLICKED){
this.getWidget("Layout").getWidget("Picture").setPos(50.0, 1.0);
this.getWidget("Layout").getWidget("Picture").setAlpha(0.8f);
this.scale = 1.0f;
int picSX = (int)(180 / this.rez.getScaleFactor() * scale), picSY = (int)(62 / this.rez.getScaleFactor() * scale);
this.getWidget("Layout").getWidget("Picture").setSize(picSX, picSY);
((LayoutMargin)this.getWidget("Layout")).setMargins(picSX/2, picSX/2, picSY/2, picSY/2);
this.updateData();
}
}
}
public ScreenHUDConfig(GuiScreen parent){
super(parent);
this.getRoot().addWidget("EventCanvas", new EventCanvas(this.getRoot(), parent));
}
}
@@ -0,0 +1,32 @@
package mcp.mobius.waila.gui.screens.config;
import mcp.mobius.waila.addons.ConfigHandler;
import mcp.mobius.waila.gui.interfaces.CType;
import mcp.mobius.waila.gui.interfaces.WAlign;
import mcp.mobius.waila.gui.screens.ScreenBase;
import mcp.mobius.waila.gui.widgets.LayoutBase;
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
import mcp.mobius.waila.gui.widgets.buttons.ButtonContainer;
import mcp.mobius.waila.gui.widgets.buttons.ButtonScreenChange;
import mcp.mobius.waila.gui_old.widget_old.ButtonChangeScreen;
import net.minecraft.client.gui.GuiScreen;
public class ScreenModuleChoice extends ScreenBase {
public ScreenModuleChoice(GuiScreen parent){
super(parent);
this.getRoot().addWidget("ButtonContainer", new ButtonContainer(this.getRoot(), 3, 100, 25.0));
this.getRoot().getWidget("ButtonContainer").setGeometry(new WidgetGeometry(50.0, 20.0, 400.0, 60.0, CType.RELXY, CType.REL_Y, WAlign.CENTER, WAlign.TOP));
ButtonContainer buttonContainer = ((ButtonContainer)this.getRoot().getWidget("ButtonContainer"));
for (String key : ConfigHandler.instance().getModuleNames())
buttonContainer.addButton( new ButtonScreenChange(this.getRoot(), key, new ScreenModuleConfig(this, key)));
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").getWidget("ButtonBack").setGeometry(new WidgetGeometry(50.0, 50.0, 100.0, 20.0, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
}
}
@@ -0,0 +1,49 @@
package mcp.mobius.waila.gui.screens.config;
import mcp.mobius.waila.addons.ConfigHandler;
import mcp.mobius.waila.gui.interfaces.CType;
import mcp.mobius.waila.gui.interfaces.WAlign;
import mcp.mobius.waila.gui.screens.ScreenBase;
import mcp.mobius.waila.gui.widgets.LayoutBase;
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
import mcp.mobius.waila.gui.widgets.buttons.ButtonBooleanConfig;
import mcp.mobius.waila.gui.widgets.buttons.ButtonBooleanConfigRemote;
import mcp.mobius.waila.gui.widgets.buttons.ButtonContainer;
import mcp.mobius.waila.gui.widgets.buttons.ButtonContainerLabel;
import mcp.mobius.waila.gui.widgets.buttons.ButtonScreenChange;
import mcp.mobius.waila.gui_old.widget_old.ButtonConfigOption;
import mcp.mobius.waila.gui_old.widget_old.ButtonConfigRemote;
import net.minecraft.client.gui.GuiScreen;
public class ScreenModuleConfig extends ScreenBase {
private String modName;
public ScreenModuleConfig(GuiScreen parent, String modname){
super(parent);
this.modName = modname;
this.getRoot().addWidget("ButtonContainer", new ButtonContainerLabel(this.getRoot(), 2, 100, 25.0));
this.getRoot().getWidget("ButtonContainer").setGeometry(new WidgetGeometry(0.0, 20.0, 100.0, 60.0, CType.RELXY, CType.RELXY, WAlign.LEFT, WAlign.TOP));
ButtonContainerLabel buttonContainer = ((ButtonContainerLabel)this.getRoot().getWidget("ButtonContainer"));
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));
else
buttonContainer.addButton(new ButtonBooleanConfig(this.getRoot(), key, "No", "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 ));
}
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").getWidget("ButtonBack").setGeometry(new WidgetGeometry(50.0, 50.0, 100.0, 20.0, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
}
}
@@ -0,0 +1,40 @@
package mcp.mobius.waila.gui.screens.config;
import net.minecraft.client.gui.GuiScreen;
import mcp.mobius.waila.Constants;
import mcp.mobius.waila.gui.interfaces.CType;
import mcp.mobius.waila.gui.interfaces.WAlign;
import mcp.mobius.waila.gui.screens.ScreenBase;
import mcp.mobius.waila.gui.widgets.LayoutBase;
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
import mcp.mobius.waila.gui.widgets.buttons.ButtonBooleanConfig;
import mcp.mobius.waila.gui.widgets.buttons.ButtonContainerLabel;
import mcp.mobius.waila.gui.widgets.buttons.ButtonIntegerConfig;
import mcp.mobius.waila.gui.widgets.buttons.ButtonScreenChange;
public class ScreenWailaConfig extends ScreenBase {
public ScreenWailaConfig(GuiScreen parent){
super(parent);
this.getRoot().addWidget("ButtonContainer", new ButtonContainerLabel(this.getRoot(), 2, 100, 25.0));
this.getRoot().getWidget("ButtonContainer").setGeometry(new WidgetGeometry(0.0, 10.0, 100.0, 50.0, CType.RELXY, CType.RELXY));
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");
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").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").getWidget("ButtonBack").setGeometry(new WidgetGeometry(50.0, 50.0, 100.0, 20.0, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
}
}
@@ -0,0 +1,73 @@
package mcp.mobius.waila.gui.screens.info;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.gui.interfaces.CType;
import mcp.mobius.waila.gui.interfaces.WAlign;
import mcp.mobius.waila.gui.screens.ScreenBase;
import mcp.mobius.waila.gui.widgets.ItemStackDisplay;
import mcp.mobius.waila.gui.widgets.LabelFixedFont;
import mcp.mobius.waila.gui.widgets.LayoutBase;
import mcp.mobius.waila.gui.widgets.ViewTable;
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
public class ScreenEnchants extends ScreenBase {
public ScreenEnchants(GuiScreen parent) {
super(parent);
this.getRoot().addWidget("Layout_Title", new LayoutBase(null))
.setGeometry(new WidgetGeometry(50.0, 10.0, 50.0, 32.0, CType.REL_X, CType.REL_X, WAlign.CENTER, WAlign.TOP));
this.getRoot().getWidget("Layout_Title").addWidget("ItemStack", new ItemStackDisplay(null))
.setGeometry(new WidgetGeometry(0.0, 0.0, 32.0, 32.0, CType.ABSXY, CType.ABSXY, WAlign.LEFT, WAlign.TOP));
this.getRoot().getWidget("Layout_Title").addWidget("LabelName", new LabelFixedFont(null, "None"))
.setGeometry(new WidgetGeometry(40.0, 4.0, 16.0, 16.0, CType.ABSXY, CType.ABSXY, WAlign.LEFT, WAlign.TOP));
this.getRoot().getWidget("Layout_Title").addWidget("LabelEnchantability", new LabelFixedFont(null, "None"))
.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, 80.0, CType.REL_X, CType.RELXY, WAlign.CENTER, WAlign.TOP));
((ViewTable)this.getRoot().getWidget("Table"))
.setColumnsTitle("\u00a7a\u00a7oName","\u00a7a\u00a7oMin lvl","\u00a7a\u00a7oMax lvl","\u00a7a\u00a7oWeight", "\u00a7a\u00a7oMod")
.setColumnsWidth(35.0, 10.0, 10.0, 10.0, 35.0)
.setColumnsAlign(WAlign.LEFT, WAlign.CENTER, WAlign.CENTER, WAlign.CENTER, WAlign.LEFT);
}
public ViewTable getTable(){
return (ViewTable)this.getRoot().getWidget("Table");
}
public ScreenEnchants addRow(String...strings ){
this.getTable().addRow(strings);
return this;
}
public ScreenEnchants setStack(ItemStack stack){
((ItemStackDisplay)this.getRoot().getWidget("Layout_Title").getWidget("ItemStack")).setStack(stack);
this.getRoot().getWidget("Layout_Title").adjustSize();
return this;
}
public ScreenEnchants setName(String name){
((LabelFixedFont)this.getRoot().getWidget("Layout_Title").getWidget("LabelName")).setText(name);
this.getRoot().getWidget("Layout_Title").adjustSize();
return this;
}
public ScreenEnchants setEnchantability(String value){
((LabelFixedFont)this.getRoot().getWidget("Layout_Title").getWidget("LabelEnchantability")).setText(String.format("Enchantability : %s", value));
this.getRoot().getWidget("Layout_Title").adjustSize();
return this;
}
/*
public ScreenEnchants setStack(ItemStack stack){
((ItemStackDisplay)this.getRoot().getWidget("ItemStack")).setStack(stack);
return this;
}
*/
}
@@ -0,0 +1,70 @@
package mcp.mobius.waila.gui.testing;
import org.lwjgl.util.Point;
import mcp.mobius.waila.gui.events.MouseEvent;
import mcp.mobius.waila.gui.helpers.UIException;
import mcp.mobius.waila.gui.interfaces.CType;
import mcp.mobius.waila.gui.interfaces.IWidget;
import mcp.mobius.waila.gui.interfaces.WAlign;
import mcp.mobius.waila.gui.screens.ScreenBase;
import mcp.mobius.waila.gui.widgets.ItemStackDisplay;
import mcp.mobius.waila.gui.widgets.LabelFixedFont;
import mcp.mobius.waila.gui.widgets.LayoutBase;
import mcp.mobius.waila.gui.widgets.LayoutCropping;
import mcp.mobius.waila.gui.widgets.PictureDisplay;
import mcp.mobius.waila.gui.widgets.PictureSwitch;
import mcp.mobius.waila.gui.widgets.ViewTable;
import mcp.mobius.waila.gui.widgets.ViewportScrollable;
import mcp.mobius.waila.gui.widgets.WidgetBase;
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
import mcp.mobius.waila.gui.widgets.buttons.ButtonBoolean;
import mcp.mobius.waila.gui.widgets.buttons.ButtonContainerLabel;
import mcp.mobius.waila.gui.widgets.buttons.ButtonInteger;
import mcp.mobius.waila.gui.widgets.buttons.ButtonIntegerConfig;
import mcp.mobius.waila.gui.widgets.buttons.ButtonScreenChange;
import mcp.mobius.waila.gui.widgets.movable.PictureMovableRC;
import net.minecraft.block.Block;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.item.ItemStack;
public class ScreenTest extends ScreenBase {
public ScreenTest(GuiScreen parent) {
super(parent);
this.getRoot().addWidget("Test", new ViewTable(null))
.setGeometry(new WidgetGeometry(50.0, 50.0, 90.0, 90.0, CType.RELXY, CType.RELXY, WAlign.CENTER, WAlign.CENTER));
((ViewTable)this.getRoot().getWidget("Test"))
.setColumnsTitle("Column1","Column2","Column3")
.setColumnsWidth(30.0,30.0,30.0)
.setColumnsAlign(WAlign.CENTER, WAlign.CENTER, WAlign.CENTER)
.addRow("test1", "test2", "test3")
.addRow("test1", "test2", "test3")
.addRow("test1", "test2", "test3")
.addRow("test1", "test2", "test3")
.addRow("test1", "test2", "test3")
.addRow("test1", "test2", "test3")
.addRow("test1", "test2", "test3")
.addRow("test1", "test2", "test3")
.addRow("test1", "test2", "test3")
.addRow("test1", "test2", "test3");
/*
this.getRoot().addWidget("Test", new Row(null)).setGeometry(new WidgetGeometry(50.0, 50.0, 90.0, 20.0, CType.RELXY, CType.REL_X, WAlign.CENTER, WAlign.CENTER));
((Row)this.getRoot().getWidget("Test")).setColumnsText("aabbbbbbbbbbbbbbbbbbbbbbbbb","bb","cc");
((Row)this.getRoot().getWidget("Test")).setColumnsWidth(30.0,30.0,30.0);
((Row)this.getRoot().getWidget("Test")).setColumnsAlign(WAlign.LEFT, WAlign.CENTER, WAlign.CENTER);
*/
//this.getRoot().addWidget("TestLayout", new LayoutBase(null)).setGeometry(new WidgetGeometry(50.0, 50.0, 90.0, 90.0, CType.RELXY, CType.RELXY, WAlign.CENTER, WAlign.CENTER));
//((LayoutBase)this.getRoot().getWidget("TestLayout")).setBackgroundColors(0xff505050, 0xff505050);
//this.getRoot().addWidget("Layout", new ViewportScrollable(null)).setGeometry(new WidgetGeometry(50.0,50.0,75.0,75.0,CType.RELXY, CType.RELXY, WAlign.CENTER, WAlign.CENTER));
//((ViewportScrollable)this.getRoot().getWidget("Layout")).attachWidget(new PictureSwitch(this.getRoot(), "waila:textures/test.png", "waila:textures/test_solar.png")).setSize(900, 900);
}
}
@@ -0,0 +1,29 @@
package mcp.mobius.waila.gui.testing;
import net.minecraft.client.gui.GuiScreen;
import mcp.mobius.waila.gui.interfaces.CType;
import mcp.mobius.waila.gui.interfaces.WAlign;
import mcp.mobius.waila.gui.screens.ScreenBase;
import mcp.mobius.waila.gui.widgets.LabelFixedFont;
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
import mcp.mobius.waila.gui.widgets.buttons.ButtonContainerLabel;
import mcp.mobius.waila.gui.widgets.buttons.ButtonIntegerConfig;
public class ScreenTest2 extends ScreenBase {
public ScreenTest2(GuiScreen parent) {
super(parent);
//this.getRoot().addWidget("Picture", new PictureSwitch(this.getRoot(), "waila:textures/test.png", "waila:textures/test_solar.png"));
//this.getRoot().addWidget("Button", new ButtonInteger(this.getRoot(), "Val0", "Val1", "Val2"));
//this.getRoot().getWidget("Button").setGeometry(new WidgetGeometry(50.0D, 50.0D, 100.0D, 20.0D, true, false, WidgetAlign.CENTER, WidgetAlign.CENTER));
this.getRoot().addWidget("Buttons", new ButtonContainerLabel(this.getRoot(), 2, 100, 30.0));
this.getRoot().getWidget("Buttons").setGeometry(new WidgetGeometry(0.0, 0.0, 100.0, 50.0, CType.RELXY, CType.RELXY));
//((ButtonContainer)this.getRoot().getWidget("Buttons")).addButton(new ButtonIntegerConfig(this.getRoot(), "testconfig", true, 0, "Val0", "Val1", "Val2"));
this.getRoot().addWidget("Text", new LabelFixedFont(this.getRoot(), "waila:textures/test.png"));
this.getRoot().getWidget("Text").setGeometry(new WidgetGeometry(50.0D, 10.0D, 50.0D, 50.0D, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.TOP));
}
}
@@ -0,0 +1,49 @@
package mcp.mobius.waila.gui.widgets;
import mcp.mobius.waila.gui.interfaces.IWidget;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
import org.lwjgl.util.Point;
import codechicken.nei.forge.GuiContainerManager;
public class ItemStackDisplay extends WidgetBase {
ItemStack stack = null;
public ItemStackDisplay(IWidget parent){
this(parent, null);
}
public ItemStackDisplay(IWidget parent, ItemStack stack){
super(parent);
this.stack = stack;
this.setSize(16, 16);
}
public void setStack(ItemStack stack){
this.stack = stack;
}
public ItemStack getStack(){
return this.stack;
}
@Override
public void draw(Point pos) {
if (this.stack == null) return;
float scaleX = this.getSize().getX()/16.0f;
float scaleY = this.getSize().getY()/16.0f;
GL11.glPushMatrix();
GL11.glScalef(scaleX, scaleY, 1.0f);
RenderHelper.enableGUIStandardItemLighting();
GuiContainerManager.drawItem((int)(pos.getX()/scaleX), (int)(pos.getY()/scaleX), this.stack);
GL11.glPopMatrix();
}
}
@@ -0,0 +1,57 @@
package mcp.mobius.waila.gui.widgets;
import mcp.mobius.waila.gui.interfaces.CType;
import mcp.mobius.waila.gui.interfaces.IWidget;
import mcp.mobius.waila.gui.interfaces.Signal;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.util.Point;
public class LabelFixedFont extends WidgetBase {
protected String text = "";
protected int color;
public LabelFixedFont(IWidget parent, String text){
super(parent);
this.setText(text);
this.color = 0xFFFFFF;
}
public LabelFixedFont(IWidget parent, String text, int color){
super(parent);
this.setText(text);
this.color = color;
}
@Override
public IWidget setGeometry(WidgetGeometry geom){
this.geom = geom;
this.updateGeometry();
return this;
}
public void setText(String text){
this.text = text;
this.updateGeometry();
}
public void setColor(int color){
this.color = color;
}
private void updateGeometry(){
if (this.geom == null)
this.geom = new WidgetGeometry(0,0,50,50, CType.ABSXY, CType.ABSXY);
this.geom = new WidgetGeometry(this.geom.x, this.geom.y, this.mc.fontRenderer.getStringWidth(this.text), 8, this.geom.posType, CType.ABSXY, this.geom.alignX, this.geom.alignY);
}
@Override
public void draw(Point pos) {
this.saveGLState();
this.mc.fontRenderer.drawString(this.text, pos.getX(), pos.getY(), this.color);
this.loadGLState();
}
}
@@ -0,0 +1,47 @@
package mcp.mobius.waila.gui.widgets;
import mcp.mobius.waila.gui.events.MouseEvent;
import mcp.mobius.waila.gui.helpers.UIHelper;
import mcp.mobius.waila.gui.interfaces.IWidget;
import org.lwjgl.util.Point;
public class LayoutBase extends WidgetBase {
protected int bgcolor1 = 0x00000000;
protected int bgcolor2 = 0x00000000;
protected boolean renderBG;
public LayoutBase(IWidget parent){
super(parent);
}
@Override
public void draw(Point pos) {
if (this.renderBG)
UIHelper.drawGradientRect(this.getLeft(), this.getTop(), this.getRight(), this.getBottom(), 0, this.bgcolor1, this.bgcolor2);
}
public void setBackgroundColors(int bg1, int bg2){
this.bgcolor1 = bg1;
this.bgcolor2 = bg2;
this.renderBG = true;
}
/*
@Override
public void onMouseEnter(MouseEvent event) {
IWidget widget = this.getWidgetAtCoordinates(event.x, event.y);
if (widget != null && widget != this)
widget.onMouseEnter(event);
}
@Override
public void onMouseLeave(MouseEvent event) {
IWidget widget = this.getWidgetAtCoordinates(event.x, event.y);
if (widget != null && widget != this)
widget.onMouseLeave(event);
}
*/
}
@@ -0,0 +1,122 @@
package mcp.mobius.waila.gui.widgets;
import net.minecraft.client.gui.ScaledResolution;
import org.lwjgl.input.Mouse;
import org.lwjgl.util.Point;
import mcp.mobius.waila.gui.events.MouseEvent;
import mcp.mobius.waila.gui.events.MouseEvent.EventType;
import mcp.mobius.waila.gui.interfaces.CType;
import mcp.mobius.waila.gui.interfaces.IWidget;
import mcp.mobius.waila.gui.interfaces.Signal;
public class LayoutCanvas extends LayoutBase{
private MouseEvent lastMouseEvent;
private IWidget draggedWidget = null;
public LayoutCanvas(){
super(null);
this.setGeometry(0, 0, this.rez.getScaledWidth(), this.rez.getScaledHeight(), CType.ABSXY, CType.ABSXY);
Mouse.getDWheel(); // This is to "calibrate" the DWheel
this.lastMouseEvent = new MouseEvent(this);
}
@Override
public void draw(){
this.rez = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
this.setGeometry(0, 0, this.rez.getScaledWidth(), this.rez.getScaledHeight(), CType.ABSXY, CType.ABSXY);
/*
this.draw(this.getPos());
for (IWidget widget: this.widgets.values())
if (widget.shouldRender())
widget.draw();
*/
super.draw();
this.handleMouseInput();
}
@Override
public void draw(Point pos) { super.draw(pos); }
@Override
public void handleMouseInput(){
// Here we are going to generate the require mouse events we will pass down to all the other widgets
// This is more or less where the magic happens. If you want mouse support for a widget, it should be
// attached to a canvas like this one, or any inheriting one.
MouseEvent event = new MouseEvent(this);
EventType type = event.getEventType(this.lastMouseEvent);
IWidget targetWidget = this.getWidgetAtCoordinates(event.x, event.y);
switch (type){
case CLICK:
if (targetWidget != null)
targetWidget.onMouseClick(event);
//this.onMouseClick(event);
break;
case DRAG:
if (targetWidget != null)
targetWidget.onMouseDrag(event);
//this.onMouseDrag(event);
break;
case MOVE:
if (targetWidget != null)
targetWidget.onMouseMove(event);
//this.onMouseMove(event);
break;
case RELEASED:
if (targetWidget != null)
targetWidget.onMouseRelease(event);
//this.onMouseRelease(event);
break;
case WHEEL:
if (targetWidget != null)
targetWidget.onMouseWheel(event);
//this.onMouseWheel(event);
break;
case ENTER:
if (event.trgwidget != null)
event.trgwidget.onMouseEnter(event);
if (this.lastMouseEvent.trgwidget != null){
event.type = EventType.LEAVE;
this.lastMouseEvent.trgwidget.onMouseLeave(event);
}
break;
case NONE:
break;
default:
break;
}
this.lastMouseEvent = event;
}
@Override
public void onWidgetEvent(IWidget srcwidget, Signal signal, Object... params){
if (signal == Signal.DRAGGED)
this.draggedWidget = srcwidget;
else
super.onWidgetEvent(srcwidget, signal, params);
}
@Override
public void onMouseRelease(MouseEvent event){
if(event.button == 0)
this.draggedWidget = null;
super.onMouseRelease(event);
}
@Override
public void onMouseDrag(MouseEvent event){
if (this.draggedWidget != null)
this.draggedWidget.onMouseDrag(event);
else
super.onMouseDrag(event);
}
}
@@ -0,0 +1,68 @@
package mcp.mobius.waila.gui.widgets;
import mcp.mobius.waila.gui.interfaces.IWidget;
import net.minecraft.client.gui.ScaledResolution;
import org.lwjgl.opengl.GL11;
import org.lwjgl.util.Point;
public class LayoutCropping extends LayoutBase {
int xOffset = 0;
int yOffset = 0;
public LayoutCropping(IWidget parent){
super(parent);
}
public void setOffsets(int xoffset, int yoffset){
this.xOffset = xoffset;
this.yOffset = yoffset;
}
@Override
public void draw(){
this.rez = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
this.saveGLState();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA,GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f(1.0f, 1.0f, 1.0f, this.alpha);
this.draw(this.getPos());
GL11.glEnable(GL11.GL_SCISSOR_TEST);
GL11.glScissor(this.getPos().getX()*this.rez.getScaleFactor(), (this.rez.getScaledHeight() - (this.getPos().getY() + this.getSize().getY())) * this.rez.getScaleFactor(), this.getSize().getX()*this.rez.getScaleFactor(), this.getSize().getY()*this.rez.getScaleFactor());
//GL11.glScissor(this.getPos().getX()*this.rez.getScaleFactor(), this.getPos().getY()*this.rez.getScaleFactor(), this.getSize().getX()*this.rez.getScaleFactor(), this.getSize().getY()*this.rez.getScaleFactor());
GL11.glTranslatef(xOffset, yOffset, 0.0f);
/*
for (IWidget widget: this.widgets.values())
if (widget.shouldRender())
widget.draw();
*/
for (IWidget widget: this.renderQueue_LOW.values())
if (widget.shouldRender())
widget.draw();
for (IWidget widget: this.renderQueue_MEDIUM.values())
if (widget.shouldRender())
widget.draw();
for (IWidget widget: this.renderQueue_HIGH.values())
if (widget.shouldRender())
widget.draw();
GL11.glDisable(GL11.GL_SCISSOR_TEST);
this.loadGLState();
}
@Override
public void draw(Point pos) { super.draw(pos); }
}
@@ -0,0 +1,43 @@
package mcp.mobius.waila.gui.widgets;
import mcp.mobius.waila.gui.interfaces.CType;
import mcp.mobius.waila.gui.interfaces.IWidget;
import mcp.mobius.waila.gui.interfaces.WAlign;
import org.lwjgl.util.Point;
public class LayoutMargin extends LayoutBase {
int left = 0;
int right = 0;
int top = 0;
int bottom = 0;
public LayoutMargin(IWidget parent){
super (parent);
this.setGeometry(new WidgetGeometry(0,0,0,0,CType.ABSXY,CType.ABSXY,WAlign.CENTER,WAlign.CENTER));
}
public void setMargins(int left, int right, int top, int bottom){
this.left = left;
this.right = right;
this.top = top;
this.bottom = bottom;
}
@Override
public Point getSize(){
Point parentSize = this.parent.getSize();
return new Point(parentSize.getX() - left - right, parentSize.getY() - top - bottom);
}
@Override
public Point getPos(){
Point parentPos = this.parent.getPos();
return new Point(parentPos.getX() + left, parentPos.getY() + top);
}
@Override
public void draw(Point pos) { super.draw(pos); }
}
@@ -0,0 +1,31 @@
package mcp.mobius.waila.gui.widgets;
import mcp.mobius.waila.gui.helpers.UIHelper;
import mcp.mobius.waila.gui.interfaces.IWidget;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.lwjgl.util.Point;
public class PictureDisplay extends WidgetBase {
protected ResourceLocation texture;
public PictureDisplay(IWidget parent, String uri){
super(parent);
this.texture = new ResourceLocation(uri);
}
@Override
public void draw(Point pos) {
this.saveGLState();
GL11.glPushMatrix();
this.texManager.func_110577_a(texture);
UIHelper.drawTexture(pos.getX(), pos.getY(), this.getSize().getX(), this.getSize().getY());
GL11.glPopMatrix();
this.loadGLState();
}
}
@@ -0,0 +1,49 @@
package mcp.mobius.waila.gui.widgets;
import mcp.mobius.waila.gui.events.MouseEvent;
import mcp.mobius.waila.gui.helpers.UIHelper;
import mcp.mobius.waila.gui.interfaces.IWidget;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.lwjgl.util.Point;
public class PictureSwitch extends WidgetBase {
private ResourceLocation texture1;
private ResourceLocation texture2;
private boolean mouseOver = false;
public PictureSwitch(IWidget parent, String uri1, String uri2){
super(parent);
this.texture1 = new ResourceLocation(uri1);
this.texture2 = new ResourceLocation(uri2);
}
@Override
public void draw(Point pos) {
this.saveGLState();
ResourceLocation texture = mouseOver ? this.texture2 : this.texture1;
GL11.glPushMatrix();
this.texManager.func_110577_a(texture);
UIHelper.drawTexture(pos.getX(), pos.getY(), this.getSize().getX(), this.getSize().getY());
GL11.glPopMatrix();
this.loadGLState();
}
@Override
public void onMouseEnter(MouseEvent event){
//System.out.printf("%s %s\n", this, event);
mouseOver = true;
}
@Override
public void onMouseLeave(MouseEvent event){
//System.out.printf("%s %s\n", this, event);
mouseOver = false;
}
}
+201
View File
@@ -0,0 +1,201 @@
package mcp.mobius.waila.gui.widgets;
import mcp.mobius.waila.gui.helpers.UIException;
import mcp.mobius.waila.gui.interfaces.CType;
import mcp.mobius.waila.gui.interfaces.IWidget;
import mcp.mobius.waila.gui.interfaces.WAlign;
import org.lwjgl.util.Point;
public class ViewTable extends WidgetBase{
public class Cell extends WidgetBase{
public Cell(IWidget parent, String text, WAlign align){
super(parent);
//this.addWidget("Crop", new LayoutCropping(null)).setGeometry(new WidgetGeometry(50.0, 50.0, 90.0, 100.0, CType.RELXY, CType.RELXY, WAlign.CENTER, WAlign.CENTER));
switch(align){
case CENTER:
//this.getWidget("Crop").addWidget("Text", new LabelFixedFont(null, text))
this.addWidget("Text", new LabelFixedFont(null, text))
.setGeometry(new WidgetGeometry(50.0, 50.0, 100.0, 100.0, CType.RELXY, CType.RELXY, WAlign.CENTER, WAlign.CENTER));
break;
case LEFT:
//this.getWidget("Crop").addWidget("Text", new LabelFixedFont(null, text))
this.addWidget("Text", new LabelFixedFont(null, text))
.setGeometry(new WidgetGeometry(5.0, 50.0, 95.0, 100.0, CType.RELXY, CType.RELXY, WAlign.LEFT, WAlign.CENTER));
break;
case RIGHT:
//this.getWidget("Crop").addWidget("Text", new LabelFixedFont(null, text))
this.addWidget("Text", new LabelFixedFont(null, text))
.setGeometry(new WidgetGeometry(5.0, 50.0, 95.0, 100.0, CType.RELXY, CType.RELXY, WAlign.RIGHT, WAlign.CENTER));
break;
default:
throw new UIException(String.format("Unexpected align value : %s", align));
}
}
@Override
public void draw(Point pos){}
}
public class Row extends WidgetBase{
int ncolumns = -1;
double[] widths;
String[] texts;
WAlign[] aligns;
boolean init = false;
int bgcolor1 = 0x50505050;
int bgcolor2 = 0x50505050;
public Row(IWidget parent){
super(parent);
this.addWidget("Background", new LayoutBase(null)).setGeometry(new WidgetGeometry(50.0, 50.0, 100.0, 100.0, CType.RELXY, CType.RELXY, WAlign.CENTER, WAlign.CENTER));
((LayoutBase)this.getWidget("Background")).setBackgroundColors(this.bgcolor1, this.bgcolor2);
}
public Row setColumnsWidth(double... widths){
if (this.ncolumns == -1)
this.ncolumns = widths.length;
else if(this.ncolumns != widths.length){
throw new UIException(String.format("Number of columns mismatch. Expecting %d, got %d", this.ncolumns, widths.length));
}
this.widths = widths;
return this;
}
public Row setColumnsText(String...strings ){
if (this.ncolumns == -1)
this.ncolumns = strings.length;
else if(this.ncolumns != strings.length){
throw new UIException(String.format("Number of columns mismatch. Expecting %d, got %d", this.ncolumns, strings.length));
}
this.texts = strings;
return this;
}
public Row setColumnsAlign(WAlign... aligns ){
if (this.ncolumns == -1)
this.ncolumns = aligns.length;
else if(this.ncolumns != aligns.length){
throw new UIException(String.format("Number of columns mismatch. Expecting %d, got %d", this.ncolumns, aligns.length));
}
this.aligns = aligns;
return this;
}
public Row setColors(int bg1, int bg2){
this.bgcolor1 = bg1;
this.bgcolor2 = bg2;
((LayoutBase)this.getWidget("Background")).setBackgroundColors(this.bgcolor1, this.bgcolor2);
return this;
}
@Override
public void draw(){
if (!init)
{
double currentOffset = 0.0;
for (int i = 0; i < this.ncolumns; i++){
if (!this.widgets.containsKey(String.format("Cell_%02d", i))){
Cell cell = (Cell)(this.addWidget(String.format("Cell_%02d", i), new Cell(null, this.texts[i], this.aligns[i])));
cell.setGeometry(new WidgetGeometry(currentOffset, 50.0, this.widths[i], 100.0, CType.RELXY, CType.RELXY, WAlign.LEFT, WAlign.CENTER));
currentOffset += this.widths[i];
}
}
init = true;
}
super.draw();
}
@Override
public void draw(Point pos){}
}
int ncolumns = -1;
int nrows = 0;
double[] widths;
String[] texts;
WAlign[] aligns;
boolean init = false;
public ViewTable(IWidget parent){
super(parent);
this.addWidget("Titles", new Row(null)).setGeometry(new WidgetGeometry(0.0, 0.0, 100.0, 16.0, CType.REL_X, CType.REL_X, WAlign.LEFT, WAlign.TOP));
((Row)this.getWidget("Titles")).setColors(0x00000000, 0x00000000);
this.addWidget("Viewport", new ViewportScrollable(null)).setGeometry(new WidgetGeometry(0.0, 16.0, 100.0, 90.0, CType.REL_X, CType.RELXY, WAlign.LEFT, WAlign.TOP));
((ViewportScrollable)(this.getWidget("Viewport"))).attachWidget(new LayoutBase(null)).setGeometry(new WidgetGeometry(0.0, 0.0, 100.0, 0.0, CType.RELXY, CType.REL_X, WAlign.LEFT, WAlign.TOP));
}
@Override
public void draw(Point pos){}
public ViewTable setColumnsWidth(double... widths){
if (this.ncolumns == -1)
this.ncolumns = widths.length;
else if(this.ncolumns != widths.length){
throw new UIException(String.format("Number of columns mismatch. Expecting %d, got %d", this.ncolumns, widths.length));
}
this.widths = widths;
((Row)this.getWidget("Titles")).setColumnsWidth(widths);
return this;
}
public ViewTable setColumnsTitle(String...strings ){
if (this.ncolumns == -1)
this.ncolumns = strings.length;
else if(this.ncolumns != strings.length){
throw new UIException(String.format("Number of columns mismatch. Expecting %d, got %d", this.ncolumns, strings.length));
}
this.texts = strings;
((Row)this.getWidget("Titles")).setColumnsText(strings);
return this;
}
public ViewTable setColumnsAlign(WAlign... aligns ){
if (this.ncolumns == -1)
this.ncolumns = aligns.length;
else if(this.ncolumns != aligns.length){
throw new UIException(String.format("Number of columns mismatch. Expecting %d, got %d", this.ncolumns, aligns.length));
}
this.aligns = aligns;
((Row)this.getWidget("Titles")).setColumnsAlign(aligns);
return this;
}
public ViewTable addRow(String...strings ){
IWidget tableLayout = ((ViewportScrollable)(this.getWidget("Viewport"))).getAttachedWidget();
tableLayout.setSize(100.0, (this.nrows + 1) * 16);
Row newRow = (Row)new Row(null);
newRow.setColumnsWidth(this.widths);
newRow.setColumnsText(strings);
newRow.setColumnsAlign(this.aligns);
if(this.nrows % 2 == 1)
newRow.setColors(0x50808080, 0x50808080);
newRow.setGeometry(new WidgetGeometry(0.0, 16*this.nrows, 100.0, 16, CType.REL_X, CType.REL_X, WAlign.LEFT, WAlign.TOP));
tableLayout.addWidget(String.format("Row_%03d", this.nrows), newRow);
this.nrows += 1;
return this;
}
}
@@ -0,0 +1,179 @@
package mcp.mobius.waila.gui.widgets;
import mcp.mobius.waila.gui.events.MouseEvent;
import mcp.mobius.waila.gui.helpers.UIHelper;
import mcp.mobius.waila.gui.interfaces.CType;
import mcp.mobius.waila.gui.interfaces.IWidget;
import mcp.mobius.waila.gui.interfaces.Signal;
import mcp.mobius.waila.gui.interfaces.WAlign;
import org.lwjgl.opengl.Display;
import org.lwjgl.util.Point;
public class ViewportScrollable extends WidgetBase {
public class Escalator extends WidgetBase{
int yOffset = 0;
int sizeCursor = 8;
int maxValue = 0;
int step = 0;
boolean drag = false;
public Escalator(IWidget parent, int step){
this.parent = parent;
this.step = step;
}
public void setOffset(int yoffset){
this.yOffset = yoffset;
}
public void setMaxValue(int value){
this.maxValue = value;
}
public void setStep(int step){
this.step = step;
}
@Override
public void draw(Point pos) {
UIHelper.drawGradientRect(this.getLeft(), this.getTop(), this.getRight(), this.getBottom(), 1, 0xff999999, 0xff999999);
int offsetScaled = (int)(((double)this.getSize().getY() - (double)sizeCursor + 1) / (double)this.maxValue * (yOffset));
UIHelper.drawGradientRect(this.getLeft(), this.getTop() + offsetScaled, this.getRight(), this.getTop() + offsetScaled + sizeCursor, 1, 0xffffffff, 0xffffffff);
}
@Override
public void onMouseClick(MouseEvent event){
if (event.button == 0){
int offsetScaled = this.getTop() + (int)(((double)this.getSize().getY() - (double)sizeCursor + 1) / (double)this.maxValue * (yOffset));
this.drag = false;
if (event.y < offsetScaled)
this.yOffset += this.step;
else if (event.y > offsetScaled + sizeCursor)
this.yOffset -= this.step;
else
this.drag = true;
this.emit(Signal.VALUE_CHANGED, this.yOffset);
} else {
super.onMouseClick(event);
}
}
@Override
public void onMouseRelease(MouseEvent event){
if (event.button == 0)
this.drag = false;
super.onMouseRelease(event);
}
@Override
public void onMouseDrag(MouseEvent event){
if (this.drag){
int relativeY = (int)event.y - this.getTop();
double factor = ((double)this.getSize().getY() - (double)sizeCursor + 1) / (double)this.maxValue;
this.yOffset = (int)(relativeY / factor);
this.yOffset = Math.max(this.yOffset, this.maxValue);
this.yOffset = Math.min(this.yOffset, 0);
this.emit(Signal.VALUE_CHANGED, this.yOffset);
this.emit(Signal.DRAGGED, this);
}
else
super.onMouseDrag(event);
}
}
IWidget attachedWidget = null;
int yOffset = 0;
int step = 5;
public ViewportScrollable( IWidget parent){
super(parent);
this.addWidget("Cropping", new LayoutCropping(null)).setGeometry(new WidgetGeometry(0.0, 0.0, 100.0, 100.0, CType.RELXY, CType.RELXY, WAlign.LEFT, WAlign.TOP));
this.addWidget("Escalator", new Escalator(null, this.step * 5)).setGeometry(new WidgetGeometry(100.0, 0, 8, 100.0, CType.RELXY, CType.REL_Y, WAlign.RIGHT, WAlign.TOP)).hide();
}
public IWidget attachWidget(IWidget widget){
this.attachedWidget = this.getWidget("Cropping").addWidget("Cropped", widget);
return this.attachedWidget;
}
public IWidget getAttachedWidget(){
return this.attachedWidget;
}
public IWidget setStep(int step){
this.step = step;
((Escalator)this.getWidget("Escalator")).setStep(this.step * 5);
return this;
}
@Override
public void draw(Point pos) {}
@Override
public void draw(){
//if (Display.wasResized())
if ((this.attachedWidget != null) && (this.attachedWidget.getSize().getY() > this.getSize().getY()))
this.getWidget("Escalator").show();
else
this.getWidget("Escalator").hide();
super.draw();
}
@Override
public void onMouseWheel(MouseEvent event){
this.yOffset += event.z / 120.0 * this.step;
this.yOffset = Math.max(this.yOffset, this.getSize().getY() - this.attachedWidget.getSize().getY());
this.yOffset = Math.min(this.yOffset, 0);
((LayoutCropping)this.getWidget("Cropping")).setOffsets(0, this.yOffset);
((Escalator)this.getWidget("Escalator")).setOffset(this.yOffset);
}
@Override
public void onWidgetEvent(IWidget srcwidget, Signal signal, Object... params){
if (srcwidget.equals(this.attachedWidget) && signal == Signal.GEOM_CHANGED){
((Escalator)this.getWidget("Escalator")).setMaxValue(this.getSize().getY() - srcwidget.getSize().getY());
}
else if (srcwidget.equals(this.getWidget("Escalator")) && signal == Signal.VALUE_CHANGED){
this.yOffset = (Integer)params[0];
((LayoutCropping)this.getWidget("Cropping")).setOffsets(0, this.yOffset);
}
else
super.onWidgetEvent(srcwidget, signal, params);
}
@Override
public void onMouseDrag(MouseEvent event){
if (this.getWidget("Escalator").shouldRender() && ((Escalator)this.getWidget("Escalator")).drag)
this.getWidget("Escalator").onMouseDrag(event);
else
super.onMouseDrag(event);
}
@Override
public void onMouseClick(MouseEvent event){
if (event.button == 0){
if (!this.getWidget("Escalator").isWidgetAtCoordinates(event.x, event.y)){
((Escalator)this.getWidget("Escalator")).drag = false;
super.onMouseClick(event);
}
else
this.getWidget("Escalator").onMouseClick(event);
}
else
super.onMouseClick(event);
}
}
@@ -0,0 +1,362 @@
package mcp.mobius.waila.gui.widgets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import org.lwjgl.opengl.GL11;
import org.lwjgl.util.Point;
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.texture.TextureManager;
import mcp.mobius.waila.gui.events.MouseEvent;
import mcp.mobius.waila.gui.helpers.ReverseIterator;
import mcp.mobius.waila.gui.interfaces.CType;
import mcp.mobius.waila.gui.interfaces.IWidget;
import mcp.mobius.waila.gui.interfaces.RenderPriority;
import mcp.mobius.waila.gui.interfaces.Signal;
public abstract class WidgetBase implements IWidget {
protected IWidget parent;
protected WidgetGeometry geom;
protected LinkedHashMap<String, IWidget> widgets = new LinkedHashMap<String, IWidget>();
protected LinkedHashMap<String, IWidget> renderQueue_HIGH = new LinkedHashMap<String, IWidget>();
protected LinkedHashMap<String, IWidget> renderQueue_MEDIUM = new LinkedHashMap<String, IWidget>();
protected LinkedHashMap<String, IWidget> renderQueue_LOW = new LinkedHashMap<String, IWidget>();
protected Minecraft mc;
protected TextureManager texManager;
protected ScaledResolution rez;
protected boolean hasBlending;
protected boolean hasLight;
protected int boundTexIndex;
protected boolean isRendering = true;
protected float alpha = 1.0f;
public WidgetBase(){
this.setParent(null);
this.mc = Minecraft.getMinecraft();
this.rez = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
this.texManager = this.mc.renderEngine;
this.setGeometry(new WidgetGeometry(0, 0, 50, 50, CType.ABSXY, CType.ABSXY));
}
public WidgetBase(IWidget parent){
this.setParent(parent);
this.mc = Minecraft.getMinecraft();
this.rez = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
this.texManager = this.mc.renderEngine;
this.setGeometry(new WidgetGeometry(0, 0, 50, 50, CType.ABSXY, CType.ABSXY));
}
/////////////////////
// WIDGET HANDLING //
/////////////////////
@Override
public IWidget addWidget(String name, IWidget widget){
return this.addWidget(name, widget, RenderPriority.MEDIUM);
}
@Override
public IWidget addWidget(String name, IWidget widget, RenderPriority priority){
widget.setParent(this);
this.widgets.put(name, widget);
switch(priority){
case LOW:
this.renderQueue_LOW.put(name, widget);
break;
case HIGH:
this.renderQueue_HIGH.put(name, widget);
break;
case MEDIUM:
this.renderQueue_MEDIUM.put(name, widget);
break;
}
return this.getWidget(name);
}
@Override
public IWidget getWidget(String name){
return this.widgets.get(name);
}
@Override
public IWidget delWidget(String name){
IWidget widget = this.getWidget(name);
this.widgets.remove(widget);
return widget;
}
@Override
public IWidget getWidgetAtCoordinates(double posX, double posY){
for (IWidget widget : new ReverseIterator<IWidget>(this.widgets.values()))
if ((posX >= widget.getPos().getX()) &&
(posX <= widget.getPos().getX() + widget.getSize().getX()) &&
(posY >= widget.getPos().getY()) &&
(posY <= widget.getPos().getY() + widget.getSize().getY()))
return widget.getWidgetAtCoordinates(posX, posY);
if ((posX >= this.getPos().getX()) &&
(posX <= this.getPos().getX() + this.getSize().getX()) &&
(posY >= this.getPos().getY()) &&
(posY <= this.getPos().getY() + this.getSize().getY()))
return this;
return null;
}
@Override
public boolean isWidgetAtCoordinates(double posx, double posy){
if (this.getLeft() > posx) return false;
if (this.getRight() < posx) return false;
if (this.getTop() > posy) return false;
if (this.getBottom() < posy) return false;
return true;
}
///////////////////////
// IWIDGET INTERFACE //
///////////////////////
@Override
public IWidget getParent() { return this.parent; }
@Override
public void setParent(IWidget parent) { this.parent = parent; }
@Override
public void draw(){
this.saveGLState();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA,GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4f(1.0f, 1.0f, 1.0f, this.alpha);
this.draw(this.getPos());
/*
for (IWidget widget: this.widgets.values())
if (widget.shouldRender())
widget.draw();
*/
for (IWidget widget: this.renderQueue_LOW.values())
if (widget.shouldRender())
widget.draw();
for (IWidget widget: this.renderQueue_MEDIUM.values())
if (widget.shouldRender())
widget.draw();
for (IWidget widget: this.renderQueue_HIGH.values())
if (widget.shouldRender())
widget.draw();
this.loadGLState();
}
@Override
public abstract void draw(Point pos);
@Override
public IWidget setGeometry(WidgetGeometry geom) {
this.geom = geom;
this.emit(Signal.GEOM_CHANGED, this.geom);
return this;
}
public IWidget setGeometry(double x, double y, double sx, double sy, CType fp, CType fs){
this.setGeometry(new WidgetGeometry (x, y, sx, sy, fp, fs));
this.emit(Signal.GEOM_CHANGED, this.geom);
return this;
}
@Override
public WidgetGeometry getGeometry() { return this.geom; }
@Override
public Point getPos() { return this.geom.getPos(this.parent); }
@Override
public Point getSize() { return this.geom.getSize(this.parent); }
@Override
public int getLeft() { return this.getPos().getX(); }
@Override
public int getRight() { return this.getPos().getX() + this.getSize().getX(); }
@Override
public int getTop() { return this.getPos().getY(); }
@Override
public int getBottom() { return this.getPos().getY() + this.getSize().getY(); }
@Override
public IWidget setPos(double x, double y){
return this.setPos(x, y, this.geom.fracPosX, this.geom.fracPosY);
}
@Override
public IWidget setPos(double x, double y, boolean fracX, boolean fracY){
this.geom.setPos(x, y, fracX, fracY);
this.emit(Signal.GEOM_CHANGED, this.geom);
return this;
};
@Override
public IWidget setSize(double sx, double sy){
return this.setSize(sx, sy, this.geom.fracSizeX, this.geom.fracSizeY);
}
@Override
public IWidget setSize(double sx, double sy, boolean fracX, boolean fracY){
this.geom.setSize(sx, sy, fracX, fracY);
this.emit(Signal.GEOM_CHANGED, this.geom);
return this;
};
@Override
public IWidget adjustSize(){
int minleft = 9999;
int maxright = 0;
int mintop = 9999;
int maxbottom = 0;
for (IWidget widget : this.widgets.values()){
minleft = Math.min(minleft, widget.getLeft());
maxright = Math.max(maxright, widget.getRight());
mintop = Math.min(mintop, widget.getTop());
maxbottom = Math.max(maxbottom, widget.getBottom());
}
this.setSize(maxright - minleft, maxbottom - mintop, false, false);
this.emit(Signal.GEOM_CHANGED, this.geom);
return this;
}
////////////////////////////
// SOME RENDERING HELPERS //
////////////////////////////
protected void saveGLState(){
hasBlending = GL11.glGetBoolean(GL11.GL_BLEND);
hasLight = GL11.glGetBoolean(GL11.GL_LIGHTING);
boundTexIndex = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);
GL11.glPushAttrib(GL11.GL_CURRENT_BIT);
GL11.glPushMatrix();
}
protected void loadGLState(){
if (hasBlending) GL11.glEnable(GL11.GL_BLEND); else GL11.glDisable(GL11.GL_BLEND);
if (hasLight) GL11.glEnable(GL11.GL_LIGHTING); else GL11.glDisable(GL11.GL_LIGHTING);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, boundTexIndex);
GL11.glPopMatrix();
GL11.glPopAttrib();
//GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
}
@Override
public void setAlpha(float alpha){this.alpha = alpha;};
@Override
public float getAlpha(){return this.alpha;};
@Override
public void show(){this.isRendering = true;};
@Override
public void hide(){this.isRendering = false;};
@Override
public boolean shouldRender(){return this.isRendering;};
////////////////////
// INPUT HANDLING //
////////////////////
@Override
public void handleMouseInput(){}
@Override
public void onMouseClick(MouseEvent event) {
//System.out.printf("%s %s\n", this, event);
if (this.parent != null)
this.parent.onMouseClick(event);
//IWidget widget = this.getWidgetAtCoordinates(event.x, event.y);
//if (widget != null && widget != this)
// widget.onMouseClick(event);
}
@Override
public void onMouseDrag(MouseEvent event) {
//System.out.printf("%s %s\n", this, event);
if (this.parent != null)
this.parent.onMouseDrag(event);
//IWidget widget = this.getWidgetAtCoordinates(event.x, event.y);
//if (widget != null && widget != this)
// widget.onMouseDrag(event);
}
@Override
public void onMouseMove(MouseEvent event) {
//System.out.printf("%s %s\n", this, event);
if (this.parent != null)
this.parent.onMouseMove(event);
//IWidget widget = this.getWidgetAtCoordinates(event.x, event.y);
//if (widget != null && widget != this)
// widget.onMouseMove(event);
}
@Override
public void onMouseRelease(MouseEvent event) {
//System.out.printf("%s %s\n", this, event);
if (this.parent != null)
this.parent.onMouseRelease(event);
//IWidget widget = this.getWidgetAtCoordinates(event.x, event.y);
//if (widget != null && widget != this)
// widget.onMouseRelease(event);
}
@Override
public void onMouseWheel(MouseEvent event) {
//System.out.printf("%s %s\n", this, event);
if (this.parent != null)
this.parent.onMouseWheel(event);
}
@Override
public void onMouseEnter(MouseEvent event) {
//System.out.printf("%s %s\n", this, event);
if (this.parent != null)
this.parent.onMouseEnter(event);
}
@Override
public void onMouseLeave(MouseEvent event) {
//System.out.printf("%s %s\n", this, event);
if (this.parent != null)
this.parent.onMouseLeave(event);
}
@Override
public void emit(Signal signal, Object... params) {
if(this.parent != null)
this.parent.onWidgetEvent(this, signal, params);
}
@Override
public void onWidgetEvent(IWidget srcwidget, Signal signal, Object... params) {
if (this.parent != null)
this.parent.onWidgetEvent(srcwidget, signal, params);
}
}
@@ -0,0 +1,186 @@
package mcp.mobius.waila.gui.widgets;
import mcp.mobius.waila.gui.interfaces.CType;
import mcp.mobius.waila.gui.interfaces.IWidget;
import mcp.mobius.waila.gui.interfaces.WAlign;
import net.minecraft.util.MathHelper;
import org.lwjgl.util.Point;
//public class WidgetGeometry implements Cloneable{
public class WidgetGeometry{
//public enum Align {LEFT, CENTER, RIGHT, TOP, BOTTOM};
double x = -1;
double y = -1;
double sx = -1;
double sy = -1;
CType posType;
CType sizeType;
boolean fracPosX = false;
boolean fracPosY = false;
boolean fracSizeX = false;
boolean fracSizeY = false;
WAlign alignX;
WAlign alignY;
public class PointDouble{
double x; double y;
public PointDouble(double x, double y){ this.x = x; this.y = y;};
public double getX(){return this.x;}
public double getY(){return this.y;}
public String toString(){return String.format("PointDouble : %.5f %.5f", this.x, this.y);}
}
public WidgetGeometry(double x, double y, double sx, double sy, CType fracPos, CType fracSize){
this(x, y, sx, sy, fracPos, fracSize, WAlign.LEFT, WAlign.TOP);
}
public WidgetGeometry(double x, double y, double sx, double sy, CType fracPos, CType fracSize, WAlign alignX, WAlign alignY){
this.x = x;
this.y = y;
this.sx = sx;
this.sy = sy;
this.posType = fracPos;
this.sizeType = fracSize;
switch(fracPos){
case REL_X:
this.fracPosX = true;
break;
case RELXY:
this.fracPosX = true;
this.fracPosY = true;
break;
case REL_Y:
this.fracPosY = true;
break;
default:
break;
}
switch(fracSize){
case REL_X:
this.fracSizeX = true;
break;
case RELXY:
this.fracSizeX = true;
this.fracSizeY = true;
break;
case REL_Y:
this.fracSizeY = true;
break;
default:
break;
}
this.alignX = alignX;
this.alignY = alignY;
}
public void setPos(double x, double y, boolean fracX, boolean fracY){
this.x = x;
this.y = y;
this.fracPosX = fracX;
this.fracPosY = fracY;
}
public void setSize(double sx, double sy, boolean fracSizeX, boolean fracSizeY){
this.sx = sx;
this.sy = sy;
this.fracSizeX = fracSizeX;
this.fracSizeY = fracSizeY;
}
public PointDouble getRawPos(){
return new PointDouble(this.x, this.y);
}
public Point getUnalignedPos(IWidget parent){
int x = -1;
if (this.fracPosX)
x = MathHelper.ceiling_double_int(parent.getPos().getX() + parent.getSize().getX() * this.x / 100D);
if (!this.fracPosX && parent != null)
x = parent.getPos().getX() + (int)this.x;
if (!this.fracPosX && parent == null)
x = (int)this.x;
int y = -1;
if (this.fracPosY)
y = MathHelper.ceiling_double_int(parent.getPos().getY() + parent.getSize().getY() * this.y / 100D);
if (!this.fracPosY && parent != null)
y = parent.getPos().getY() + (int)this.y;
if (!this.fracPosY && parent == null)
y = (int)this.y;
return new Point(x,y);
}
public Point getPos(IWidget parent){
int x = -1;
if (this.fracPosX)
x = MathHelper.ceiling_double_int(parent.getPos().getX() + parent.getSize().getX() * this.x / 100D);
if (!this.fracPosX && parent != null)
x = parent.getPos().getX() + (int)this.x;
if (!this.fracPosX && parent == null)
x = (int)this.x;
int y = -1;
if (this.fracPosY)
y = MathHelper.ceiling_double_int(parent.getPos().getY() + parent.getSize().getY() * this.y / 100D);
if (!this.fracPosY && parent != null)
y = parent.getPos().getY() + (int)this.y;
if (!this.fracPosY && parent == null)
y = (int)this.y;
if (this.alignX == WAlign.CENTER)
x -= this.getSize(parent).getX() / 2;
if (this.alignY == WAlign.CENTER)
y -= this.getSize(parent).getY() / 2;
if (this.alignX == WAlign.RIGHT)
x -= this.getSize(parent).getX() - 1;
if (this.alignY == WAlign.BOTTOM)
y -= this.getSize(parent).getY() - 1;
return new Point(x,y);
}
public Point getSize(IWidget parent){
int sx = -1;
if (this.fracSizeX)
sx = MathHelper.ceiling_double_int(parent.getSize().getX() * this.sx / 100D);
if (!this.fracSizeX)
sx = (int)this.sx;
int sy = -1;
if (this.fracSizeY)
sy = MathHelper.ceiling_double_int(parent.getSize().getY() * this.sy / 100D);
if (!this.fracSizeY)
sy = (int)this.sy;
return new Point(sx,sy);
}
public String toString(){
return String.format("Geometry : [%s %s] [%s %s] [%s %s] [%s %s]", this.x, this.y, this.sx, this.sy, this.posType, this.sizeType, this.alignX, this.alignY);
}
//@Override
//public WidgetGeometry clone() throws CloneNotSupportedException{
// return (WidgetGeometry)super.clone();
//}
}
@@ -0,0 +1,73 @@
package mcp.mobius.waila.gui.widgets.buttons;
import mcp.mobius.waila.gui.events.MouseEvent;
import mcp.mobius.waila.gui.helpers.UIHelper;
import mcp.mobius.waila.gui.interfaces.IWidget;
import mcp.mobius.waila.gui.interfaces.Signal;
import mcp.mobius.waila.gui.widgets.LabelFixedFont;
import mcp.mobius.waila.gui.widgets.WidgetBase;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.lwjgl.util.Point;
public abstract class ButtonBase extends WidgetBase {
protected boolean mouseOver = false;
protected static ResourceLocation widgetsTexture = new ResourceLocation("textures/gui/widgets.png");
public ButtonBase(IWidget parent){
super(parent);
}
@Override
public void draw() {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
for (IWidget widget : this.widgets.values())
if (widget instanceof LabelFixedFont)
if (this.mouseOver)
((LabelFixedFont)widget).setColor(0xffffa0);
else
((LabelFixedFont)widget).setColor(0xffffff);
super.draw();
}
@Override
public void draw(Point pos) {
this.saveGLState();
int texOffset = 0;
if (this.mouseOver)
texOffset = 1;
this.mc.func_110434_K().func_110577_a(widgetsTexture);
UIHelper.drawTexture(this.getPos().getX(), this.getPos().getY(), this.getSize().getX(), this.getSize().getY(), 0, 66 + texOffset*20, 200, 20);
this.loadGLState();
}
@Override
public void onMouseEnter(MouseEvent event){
mouseOver = true;
}
@Override
public void onMouseLeave(MouseEvent event){
mouseOver = false;
}
@Override
public IWidget getWidgetAtCoordinates(double posX, double posY){
return this;
}
@Override
public void onMouseClick(MouseEvent event){
if (event.button == 0)
this.mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
this.emit(Signal.CLICKED, event.button);
}
}
@@ -0,0 +1,43 @@
package mcp.mobius.waila.gui.widgets.buttons;
import mcp.mobius.waila.gui.events.MouseEvent;
import mcp.mobius.waila.gui.helpers.UIHelper;
import mcp.mobius.waila.gui.interfaces.CType;
import mcp.mobius.waila.gui.interfaces.IWidget;
import mcp.mobius.waila.gui.interfaces.WAlign;
import mcp.mobius.waila.gui.widgets.LabelFixedFont;
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.util.Point;
public class ButtonBoolean extends ButtonBase {
protected boolean state = false;
public ButtonBoolean(IWidget parent, String textFalse, String textTrue){
super(parent);
this.addWidget("LabelFalse", new LabelFixedFont(this, textFalse));
this.getWidget("LabelFalse").setGeometry(new WidgetGeometry(50.0D, 50.0D, 100.0D, 20.0D, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
this.addWidget("LabelTrue", new LabelFixedFont(this, textTrue));
this.getWidget("LabelTrue").hide();
this.getWidget("LabelTrue").setGeometry(new WidgetGeometry(50.0D, 50.0D, 100.0D, 20.0D, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
}
@Override
public void onMouseClick(MouseEvent event){
super.onMouseClick(event);
if (event.button == 0)
this.state = !this.state;
if (this.state){
this.getWidget("LabelTrue").show();
this.getWidget("LabelFalse").hide();
} else {
this.getWidget("LabelTrue").hide();
this.getWidget("LabelFalse").show();
}
}
}
@@ -0,0 +1,46 @@
package mcp.mobius.waila.gui.widgets.buttons;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.Property;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.gui.events.MouseEvent;
import mcp.mobius.waila.gui.interfaces.IWidget;
public class ButtonBooleanConfig extends ButtonBoolean {
private String configKey;
private boolean instant;
public ButtonBooleanConfig(IWidget parent, String configKey, String textFalse, String textTrue){
this(parent, configKey, true, true, textFalse, textTrue);
}
public ButtonBooleanConfig(IWidget parent, String configKey, boolean instant, boolean state_, String textFalse, String textTrue){
super(parent, textFalse, textTrue);
this.configKey = configKey;
this.instant = instant;
mod_Waila.instance.config.load();
Property prop = mod_Waila.instance.config.get(Configuration.CATEGORY_GENERAL, this.configKey, state_);
this.state = prop.getBoolean(state_);
if (this.state){
this.getWidget("LabelTrue").show();
this.getWidget("LabelFalse").hide();
} else {
this.getWidget("LabelTrue").hide();
this.getWidget("LabelFalse").show();
}
}
@Override
public void onMouseClick(MouseEvent event){
super.onMouseClick(event);
if (this.instant){
mod_Waila.instance.config.getCategory(Configuration.CATEGORY_GENERAL).put(this.configKey, new Property(this.configKey,String.valueOf(this.state),Property.Type.BOOLEAN));
mod_Waila.instance.config.save();
}
}
}
@@ -0,0 +1,52 @@
package mcp.mobius.waila.gui.widgets.buttons;
import org.lwjgl.opengl.GL11;
import org.lwjgl.util.Point;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.Property;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.gui.events.MouseEvent;
import mcp.mobius.waila.gui.helpers.UIHelper;
import mcp.mobius.waila.gui.interfaces.IWidget;
import mcp.mobius.waila.gui.widgets.LabelFixedFont;
public class ButtonBooleanConfigRemote extends ButtonBooleanConfig {
public ButtonBooleanConfigRemote(IWidget parent, String configKey, String textFalse, String textTrue){
this(parent, configKey, true, true, textFalse, textTrue);
}
public ButtonBooleanConfigRemote(IWidget parent, String configKey, boolean instant, boolean state_, String textFalse, String textTrue){
super(parent, configKey, instant, state_, textFalse, textTrue);
if (!mod_Waila.instance.serverPresent)
this.state = false;
if (this.state){
this.getWidget("LabelTrue").show();
this.getWidget("LabelFalse").hide();
} else {
this.getWidget("LabelTrue").hide();
this.getWidget("LabelFalse").show();
}
}
@Override
public void onMouseClick(MouseEvent event){
if (mod_Waila.instance.serverPresent)
super.onMouseClick(event);
}
@Override
public void draw(Point pos) {
if (mod_Waila.instance.serverPresent)
super.draw(pos);
else{
this.saveGLState();
int texOffset = -1;
this.mc.func_110434_K().func_110577_a(widgetsTexture);
UIHelper.drawTexture(this.getPos().getX(), this.getPos().getY(), this.getSize().getX(), this.getSize().getY(), 0, 66 + texOffset*20, 200, 20);
this.loadGLState();
}
}
}
@@ -0,0 +1,50 @@
package mcp.mobius.waila.gui.widgets.buttons;
import org.lwjgl.util.Point;
import mcp.mobius.waila.gui.interfaces.CType;
import mcp.mobius.waila.gui.interfaces.IWidget;
import mcp.mobius.waila.gui.interfaces.WAlign;
import mcp.mobius.waila.gui.widgets.LabelFixedFont;
import mcp.mobius.waila.gui.widgets.LayoutBase;
import mcp.mobius.waila.gui.widgets.WidgetBase;
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
public class ButtonContainer extends WidgetBase {
private int nButtons = 0;
private int columns;
private int buttonSize;
private double spacing;
public ButtonContainer(IWidget parent, int columns, int buttonSize, double spacing){
super (parent);
this.columns = columns;
this.spacing = spacing;
this.buttonSize = buttonSize;
}
public void addButton(ButtonBase button){
String buttonName = String.format("Button_%d", nButtons);
String layoutName = String.format("Layout_%d", nButtons);
String layoutLabelName = String.format("LayoutLabel_%d", nButtons);
String labelName = String.format("Label_%d", nButtons);
this.addWidget(layoutName, new LayoutBase(this));
this.addWidget(layoutLabelName, new LayoutBase(this));
int column = this.nButtons % this.columns;
int row = this.nButtons / this.columns;
double sizeColumn = 100.0 / this.columns;
this.getWidget(layoutName).setGeometry(new WidgetGeometry(sizeColumn * column, spacing * row, sizeColumn, spacing, CType.REL_X, CType.REL_X, WAlign.LEFT, WAlign.TOP));
this.getWidget(layoutName).addWidget(buttonName, button);
this.getWidget(layoutName).getWidget(buttonName).setGeometry(new WidgetGeometry(50.0, 50.0, buttonSize, 20.0, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
this.nButtons += 1;
}
@Override
public void draw(Point pos) {}
}
@@ -0,0 +1,55 @@
package mcp.mobius.waila.gui.widgets.buttons;
import mcp.mobius.waila.gui.interfaces.CType;
import mcp.mobius.waila.gui.interfaces.IWidget;
import mcp.mobius.waila.gui.interfaces.WAlign;
import mcp.mobius.waila.gui.widgets.LabelFixedFont;
import mcp.mobius.waila.gui.widgets.LayoutBase;
import mcp.mobius.waila.gui.widgets.WidgetBase;
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
import org.lwjgl.util.Point;
//TODO : THIS CLASS IS WIP AND CAN'T WORK RIGHT NOW
public class ButtonContainerLabel extends WidgetBase {
private int nButtons = 0;
private int columns;
private int buttonSize;
private double spacing;
public ButtonContainerLabel(IWidget parent, int columns, int buttonSize, double spacing){
super (parent);
this.columns = columns;
this.spacing = spacing;
this.buttonSize = buttonSize;
}
public void addButton(ButtonBase button, String label){
String buttonName = String.format("Button_%d", nButtons);
String layoutName = String.format("Layout_%d", nButtons);
String layoutLabelName = String.format("LayoutLabel_%d", nButtons);
String labelName = String.format("Label_%d", nButtons);
this.addWidget(layoutName, new LayoutBase(this));
this.addWidget(layoutLabelName, new LayoutBase(this));
int column = (this.nButtons % this.columns) * 2;
int row = this.nButtons / this.columns;
double sizeColumn = 100.0 / (this.columns * 2);
this.getWidget(layoutName).setGeometry(new WidgetGeometry(sizeColumn * (column + 1), spacing * row, sizeColumn, spacing, CType.REL_X, CType.REL_X, WAlign.LEFT, WAlign.TOP));
this.getWidget(layoutName).addWidget(buttonName, button);
this.getWidget(layoutName).getWidget(buttonName).setGeometry(new WidgetGeometry(50.0, 50.0, buttonSize, 20.0, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
this.getWidget(layoutLabelName).setGeometry(new WidgetGeometry(sizeColumn * column, spacing * row, sizeColumn, spacing, CType.REL_X, CType.REL_X, WAlign.LEFT, WAlign.TOP));
this.getWidget(layoutLabelName).addWidget(labelName, new LabelFixedFont(this, label));
this.getWidget(layoutLabelName).getWidget(labelName).setGeometry(new WidgetGeometry(50.0, 50.0, buttonSize, 20.0, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
this.nButtons += 1;
}
@Override
public void draw(Point pos) {}
}
@@ -0,0 +1,49 @@
package mcp.mobius.waila.gui.widgets.buttons;
import mcp.mobius.waila.gui.events.MouseEvent;
import mcp.mobius.waila.gui.helpers.UIHelper;
import mcp.mobius.waila.gui.interfaces.CType;
import mcp.mobius.waila.gui.interfaces.IWidget;
import mcp.mobius.waila.gui.interfaces.WAlign;
import mcp.mobius.waila.gui.widgets.LabelFixedFont;
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.util.Point;
public class ButtonInteger extends ButtonBase {
protected int state = 0;
protected int nStates;
public ButtonInteger(IWidget parent, String... texts){
super(parent);
this.nStates = texts.length;
for (int i = 0; i < texts.length; i++){
String labelName = String.format("Label_%d", i);
this.addWidget(labelName, new LabelFixedFont(this, texts[i]));
this.getWidget(labelName).hide();
this.getWidget(labelName).setGeometry(new WidgetGeometry(50.0D, 50.0D, 100.0D, 20.0D, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
}
this.getWidget("Label_0").show();
}
@Override
public void onMouseClick(MouseEvent event){
super.onMouseClick(event);
if (event.button == 0)
this.state += 1;
if (this.state >= this.nStates)
this.state = 0;
for (int i = 0; i < this.nStates; i++)
this.getWidget(String.format("Label_%d", i)).hide();
this.getWidget(String.format("Label_%d", state)).show();
}
}
@@ -0,0 +1,47 @@
package mcp.mobius.waila.gui.widgets.buttons;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.Property;
import org.lwjgl.util.Point;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.gui.events.MouseEvent;
import mcp.mobius.waila.gui.interfaces.IWidget;
import mcp.mobius.waila.gui.widgets.WidgetBase;
public class ButtonIntegerConfig extends ButtonInteger {
private String configKey;
private boolean instant;
public ButtonIntegerConfig(IWidget parent, String configKey, String... texts){
this(parent, configKey, true, 0, texts);
}
public ButtonIntegerConfig(IWidget parent, String configKey, boolean instant, int state_, String... texts){
super(parent, texts);
this.configKey = configKey;
this.instant = instant;
mod_Waila.instance.config.load();
Property prop = mod_Waila.instance.config.get(Configuration.CATEGORY_GENERAL, this.configKey, state_);
this.state = prop.getInt();
for (int i = 0; i < this.nStates; i++)
this.getWidget(String.format("Label_%d", i)).hide();
this.getWidget(String.format("Label_%d", state)).show();
}
@Override
public void onMouseClick(MouseEvent event){
super.onMouseClick(event);
if (this.instant){
mod_Waila.instance.config.getCategory(Configuration.CATEGORY_GENERAL).put(this.configKey, new Property(this.configKey,String.valueOf(this.state),Property.Type.INTEGER));
mod_Waila.instance.config.save();
}
}
}
@@ -0,0 +1,24 @@
package mcp.mobius.waila.gui.widgets.buttons;
import mcp.mobius.waila.gui.events.MouseEvent;
import mcp.mobius.waila.gui.interfaces.CType;
import mcp.mobius.waila.gui.interfaces.IWidget;
import mcp.mobius.waila.gui.interfaces.WAlign;
import mcp.mobius.waila.gui.widgets.LabelFixedFont;
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
import net.minecraft.client.gui.GuiScreen;
public class ButtonLabel extends ButtonBase {
public ButtonLabel(IWidget parent, String text){
super(parent);
this.addWidget("Label", new LabelFixedFont(this, text));
this.getWidget("Label").setGeometry(new WidgetGeometry(50.0D, 50.0D, 100.0D, 20.0D, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
}
@Override
public void onMouseClick(MouseEvent event){
super.onMouseClick(event);
}
}
@@ -0,0 +1,31 @@
package mcp.mobius.waila.gui.widgets.buttons;
import net.minecraft.client.gui.GuiScreen;
import mcp.mobius.waila.gui.events.MouseEvent;
import mcp.mobius.waila.gui.interfaces.CType;
import mcp.mobius.waila.gui.interfaces.IWidget;
import mcp.mobius.waila.gui.interfaces.WAlign;
import mcp.mobius.waila.gui.screens.ScreenBase;
import mcp.mobius.waila.gui.widgets.LabelFixedFont;
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
public class ButtonScreenChange extends ButtonBase {
GuiScreen linkedScreen;
public ButtonScreenChange(IWidget parent, String text, GuiScreen linkedscreen){
super(parent);
this.linkedScreen = linkedscreen;
this.addWidget("Label", new LabelFixedFont(this, text));
this.getWidget("Label").setGeometry(new WidgetGeometry(50.0D, 50.0D, 100.0D, 20.0D, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
}
@Override
public void onMouseClick(MouseEvent event){
super.onMouseClick(event);
if (event.button == 0)
this.mc.displayGuiScreen(this.linkedScreen);
}
}
@@ -0,0 +1,68 @@
package mcp.mobius.waila.gui.widgets.movable;
import mcp.mobius.waila.gui.events.MouseEvent;
import mcp.mobius.waila.gui.helpers.UIHelper;
import mcp.mobius.waila.gui.interfaces.CType;
import mcp.mobius.waila.gui.interfaces.IWidget;
import mcp.mobius.waila.gui.interfaces.Signal;
import mcp.mobius.waila.gui.interfaces.WAlign;
import mcp.mobius.waila.gui.widgets.WidgetBase;
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
import mcp.mobius.waila.gui.widgets.WidgetGeometry.PointDouble;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import org.lwjgl.util.Point;
// A movable picture setup especially for centered relative positions.
public class PictureMovableRC extends WidgetBase {
private double offsetX, offsetY;
protected ResourceLocation texture;
public PictureMovableRC(IWidget parent, String uri) {
super(parent);
this.texture = new ResourceLocation(uri);
}
@Override
public void onMouseClick(MouseEvent event){
this.offsetX = event.x - this.geom.getUnalignedPos(this.parent).getX();
this.offsetY = event.y - this.geom.getUnalignedPos(this.parent).getY();
//System.out.printf("%s %s\n", this.offsetX, this.offsetY);
}
@Override
public void onMouseDrag(MouseEvent event){
double newX = event.x - this.offsetX ;
double newY = event.y - this.offsetY ;
newX = Math.max(newX, this.parent.getLeft());
newY = Math.max(newY, this.parent.getTop());
newX = Math.min(newX, this.parent.getRight());
newY = Math.min(newY, this.parent.getBottom());
this.setPos(((newX - this.parent.getLeft()) / this.parent.getSize().getX()) * 100.0, ((newY - this.parent.getTop())/ this.parent.getSize().getY()) * 100.0);
//System.out.printf("%s\n", this.parent.getGeometry());
//System.out.printf("%s %s\n", this.parent.getPos(), this.parent.getSize());
this.emit(Signal.DRAGGED, this.getPos());
}
@Override
public void draw(Point pos) {
this.saveGLState();
GL11.glPushMatrix();
this.texManager.func_110577_a(texture);
UIHelper.drawTexture(pos.getX(), pos.getY(), this.getSize().getX(), this.getSize().getY());
GL11.glPopMatrix();
this.loadGLState();
}
}
@@ -1,13 +1,13 @@
package mcp.mobius.waila.gui;
package mcp.mobius.waila.gui_old;
import java.util.Collection;
import java.util.HashMap;
import org.lwjgl.input.Mouse;
import mcp.mobius.waila.gui.widget.IWidget;
import mcp.mobius.waila.gui.widget_old.Button2States;
import mcp.mobius.waila.gui.widget_old.ButtonChangeScreen;
import mcp.mobius.waila.gui_old.widget.IWidget;
import mcp.mobius.waila.gui_old.widget_old.Button2States;
import mcp.mobius.waila.gui_old.widget_old.ButtonChangeScreen;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
@@ -26,8 +26,8 @@ public class BaseWailaScreen extends GuiScreen{
private int lastMousePosY = -1;
private static int buttonCount = Mouse.getButtonCount();
private boolean[] lastButtonStates = new boolean[buttonCount];
private IWidget[] focusWidget = new IWidget[buttonCount];
private IWidget mainFocusWidget = null;
private IWidget[] focusWidget = new IWidget[buttonCount];
private IWidget mainFocusWidget = null;
@@ -1,17 +1,17 @@
package mcp.mobius.waila.gui;
package mcp.mobius.waila.gui_old;
import mcp.mobius.waila.gui.widget.ContainerTable;
import mcp.mobius.waila.gui.widget.Label;
import mcp.mobius.waila.gui.widget.StackDisplay;
import mcp.mobius.waila.gui.widget.WikiReader;
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 mcp.mobius.waila.gui_old.widget.WikiReader;
import net.minecraft.client.gui.GuiScreen;
public class GuiIngameWiki extends BaseWailaScreen {
public WikiReader widReader = null;
public StackDisplay widStack = null;
public WikiReader widReader = null;
public StackDisplay widStack = null;
public ContainerTable widTable = null;
public Label widItemName = null;
public Label widItemName = null;
public GuiIngameWiki(GuiScreen _parentGui) {
super(_parentGui);
@@ -1,7 +1,6 @@
package mcp.mobius.waila.gui;
package mcp.mobius.waila.gui_old;
import mcp.mobius.waila.gui.widget.DraggableViewport;
import mcp.mobius.waila.gui.widget.StackDisplay;
import mcp.mobius.waila.gui_old.widget.DraggableViewport;
import net.minecraft.client.gui.GuiScreen;
public class GuiTechTree extends BaseWailaScreen {
@@ -1,10 +1,8 @@
package mcp.mobius.waila.handlers;
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,24 +1,13 @@
package mcp.mobius.waila.handlers;
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.GuiIngameWiki;
import mcp.mobius.waila.gui.GuiTechTree;
import mcp.mobius.waila.gui.widget.ComponentDisplay;
import mcp.mobius.waila.gui.widget.StackDisplay;
import mcp.mobius.waila.gui_old.GuiTechTree;
import mcp.mobius.waila.gui_old.widget.ComponentDisplay;
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;
@@ -1,4 +1,4 @@
package mcp.mobius.waila.handlers;
package mcp.mobius.waila.gui_old.NEI;
import java.util.LinkedHashMap;
@@ -6,9 +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.GuiIngameWiki;
import mcp.mobius.waila.gui.widget.Label;
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;
@@ -57,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());
@@ -1,4 +1,4 @@
package mcp.mobius.waila.gui.widget;
package mcp.mobius.waila.gui_old.widget;
import java.util.Collection;
import java.util.HashMap;
@@ -1,8 +1,8 @@
package mcp.mobius.waila.gui.widget;
package mcp.mobius.waila.gui_old.widget;
import java.util.ArrayList;
import mcp.mobius.waila.handlers.CraftingTreeNode;
import mcp.mobius.waila.gui_old.NEI.CraftingTreeNode;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.item.ItemStack;
@@ -1,4 +1,4 @@
package mcp.mobius.waila.gui.widget;
package mcp.mobius.waila.gui_old.widget;
import java.util.ArrayList;
@@ -1,10 +1,8 @@
package mcp.mobius.waila.gui.widget;
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 {
@@ -1,13 +1,13 @@
package mcp.mobius.waila.gui.widget;
package mcp.mobius.waila.gui_old.widget;
import java.util.Collection;
public interface IWidget {
int getWidth();
int getHeight();
int getWidth();
int getHeight();
String getLabel();
int getPosX();
int getPosY();
int getPosX();
int getPosY();
void setWidth(int width);
void setHeight(int height);
@@ -1,4 +1,4 @@
package mcp.mobius.waila.gui.widget;
package mcp.mobius.waila.gui_old.widget;
import net.minecraft.client.gui.GuiScreen;
@@ -1,11 +1,9 @@
package mcp.mobius.waila.gui.widget;
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,4 +1,4 @@
package mcp.mobius.waila.gui.widget;
package mcp.mobius.waila.gui_old.widget;
import net.minecraft.client.gui.GuiScreen;
@@ -1,4 +1,4 @@
package mcp.mobius.waila.gui.widget;
package mcp.mobius.waila.gui_old.widget;
import java.util.ArrayList;
@@ -1,4 +1,4 @@
package mcp.mobius.waila.gui.widget_old;
package mcp.mobius.waila.gui_old.widget_old;
import org.lwjgl.opengl.GL11;
@@ -1,4 +1,4 @@
package mcp.mobius.waila.gui.widget_old;
package mcp.mobius.waila.gui_old.widget_old;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
Loaded 100 of 115 files, more files were not shown because too many files have changed in this diff. Show more