Compare commits

...
Author SHA1 Message Date
Caedis 5bcb9174fa Add initial break progress bar 2024-01-01 16:34:18 -06:00
Caedis fae07b5ca2 update bs and deps 2024-01-01 12:03:39 -06:00
tth05 bc46b8840d Convert world unload event handler to public inner class (#17) 2023-11-17 20:39:34 +01:00
tth05 7d72e0680e Clear DataAccessorCommon instance when leaving world (#16) 2023-11-17 15:43:10 +01:00
Martin Robertz ee237c3a44 update deps+bs 2023-11-16 11:03:17 +01:00
tth05 4c4cb95782 Remove unnecessary targetStack and targetEntity fields in RayTracing class 2023-11-16 10:01:36 +01:00
Martin Robertz 9698692020 Cleanup (#14)
* update gradle+deps

* remove bak file
clean wci

* add back

* sa
2023-10-18 18:34:53 +02:00
ghostflyby e7524e80f1 Move font init to getter with guard if (#13)
* Move font init to getter with guard if

* update bs
2023-10-18 13:50:55 +02:00
Martin Robertz d682f65320 update bs+sa+dep file+gradle 2023-05-06 17:21:16 +02:00
Ryan Nasers 3801124648 Fixing dependencies.gradle (#12) 2023-05-06 17:17:04 +02:00
glowredman 2b73a517e8 Use aspect's name instead of tag (#11) 2023-03-04 19:37:08 +01:00
Raven Szewczyk 50221c750b Update buildscript, dependencies and repositories. (#10) 2023-02-09 14:19:19 +01:00
Raven Szewczyk 752dcd9986 updateBuildscript 2023-02-09 13:12:58 +00:00
Raven Szewczyk 2edac37178 [ci skip] upgraded build system 2023-01-31 09:57:01 +00:00
Jason Mitchell 85f2b035a4 [ci skip] Add git-blame-ignore-revs for spotlessApply 2023-01-29 12:42:42 -08:00
Jason Mitchell 4ee7d7396c [ci skip] spotlessApply with the new settings 2023-01-29 12:42:42 -08:00
Jason Mitchell d10840fc54 [ci skip] Update buildscript to RetroFuturaGradle 2023-01-29 12:42:07 -08:00
Alexdoru 80cfdfd41e fixed the keybinds triggering when they are un binded (#9)
* fix keybind triggering when un binded

* translation had wrong key

* it's in the same class
2022-09-14 07:32:45 +02:00
Jason Mitchell 08a9f33dbb [ci skip] Migrate github actions to GTNH-Actions-Workflows 2022-07-16 10:52:02 -07:00
glowredman 8023588d71 Moar Null Safety (#8)
* Update build.gradle

* Check for world == null
2022-06-05 23:19:30 +02:00
bombcar 6ca097d5d0 BY-NC-SA 4.0 (#7) 2022-02-14 22:11:52 +01:00
bombcar fba608a2d1 CC-BY-SA-4.0 (#6)
* update build

* CC-BY-SA-4.0
2022-02-10 08:29:27 -08:00
Kiwiand[Kiwi233] f04bb197ac Update zh_CN.lang (#5)
* Update zh_CN.lang

* Update zh_CN.lang

Co-authored-by: [Kiwi233] <[[email protected]]>
2022-02-06 19:14:19 +01:00
Jason Mitchell 8b30294ae0 update to explicit dependencies 2022-01-17 22:18:55 -08:00
Jason Mitchell d4441c85ce maven publish buildscript update 2022-01-17 22:18:46 -08:00
Kiwiand[Kiwi233] c1480d632c Update zh_CN.lang (#4)
Co-authored-by: [Kiwi233] <[[email protected]]>
2021-12-30 14:45:32 +01:00
Jason Mitchell 8268d0a384 Add License (#3) 2021-12-05 21:22:45 +01:00
boubou19 78eb719f06 Merge pull request #2 from GTNewHorizons/update-build-script
Update build script and CI
2021-11-30 15:40:51 +01:00
Johann Bernhardt 0c73ed59c3 Update build script and CI 2021-11-30 10:09:50 +01:00
Johann Bernhardt 66759201a1 Add missing api jar 2021-11-23 21:43:49 +01:00
Johann Bernhardt aa093a4174 Merge pull request #1 from GTNewHorizons/unified-build-script
Unified build script
2021-11-23 14:33:02 +01:00
Johann Bernhardt 2431509d41 Switch to NEI master 2021-11-22 18:51:24 +01:00
Johann Bernhardt 156c9f3905 Shade dependency to openCSV 2021-11-22 13:36:51 +01:00
Johann Bernhardt a1f4378fe7 Migrated to unified build script 2021-11-22 13:24:52 +01:00
Johann Bernhardt af42a25d2e Strip unused core plugin 2021-11-22 13:22:32 +01:00
Thomas Guimbretiere 07b0b83f4a Added localization for NEI keybind.
Fixes issue #185
2015-07-12 19:24:21 +02:00
Thomas Guimbretiere d932d91a77 Potential fix for issue #200
Stupid java 1.6 on macs...
2015-07-12 18:55:01 +02:00
Thomas Guimbretiere 87261267e1 Added tag v1.5.10_1.7.10 for changeset 02ba9c022a25 2015-07-12 18:42:20 +02:00
Thomas Guimbretiere 7af9692632 Added czech translation. Many thx to nalimleinad.
Closes issue #204
2015-07-12 18:33:03 +02:00
Thomas Guimbretiere 1eb78112eb Added a config option (in Modules/General) to turn on/off the display of entity tooltips.
It is located there so it can be enforced server side if required (for pvp, etc).

Fixes issue #196
2015-07-12 18:29:28 +02:00
Thomas Guimbretiere 4ed103dd25 NBT is synced only when the tooltip is visible to reduce ressource usage.
Fixes issue #179
2015-07-12 17:56:04 +02:00
Thomas Guimbretiere 118bab5a2b Updated to latest NEIs and forge 2015-07-12 16:43:29 +02:00
Thomas Guimbretiere ce6474fc29 Fixed case where config is written too many times in "press to show" mode. 2015-05-21 19:13:38 +02:00
Thomas Guimbretiere cbeb3b3628 Fixed derp with logs.
Still have a huge derp with CCC that need to be resolved...
2015-05-16 22:03:25 +02:00
Thomas Guimbretiere d27d6db57c Updated to latest CCC & Forge 2015-05-16 20:38:30 +02:00
Thomas Guimbretiere e60974ab20 Version bump 2015-03-18 16:09:14 +01:00
Thomas Guimbretiere f481e46fb2 Tabbing correction 2015-03-09 18:31:56 +01:00
Thomas Guimbretiere 7638322f7f Merge 2015-03-09 18:29:22 +01:00
Thomas Guimbretiere 0afbc6efb4 Added tag v1.5.9_1.7.10 for changeset 32b8eca2f373 2015-03-09 18:29:13 +01:00
Thomas Guimbretiere 6d97a3a595 Version bump 2015-03-09 18:28:43 +01:00
Lordmau5 737c4e2cbf Added support for Thermal Dynamics (Fluiducts showing content, so far) 2015-03-09 15:46:18 +01:00
Lordmau5 f4f5920d88 Fix for Thermal Expansion stuff - Also added HUD for Caches :) 2015-03-09 15:46:00 +01:00
Lordmau5 ea95fadb78 Fix for Extra Utilities Drums 2015-03-09 15:45:26 +01:00
Lordmau5 77277c6024 Fix for networking code (Fixes issues with data on dedicated servers) 2015-03-09 15:23:18 +01:00
Thomas Guimbretiere 0b85d18865 Reinstanciate the lists in TickHandler to make sure they are not of the wrong type.
All handler getters now return a TreeMap with an index integer to make sure handlers are used in the right order everywhere.
2015-02-10 22:23:22 +01:00
Thomas Guimbretiere 9d0b942667 Returning a stack with a null item from getWailaStack with desactivate the tooltip all together.
A good one to use if new ItemStack(Blocks.air)
2015-02-10 18:08:21 +01:00
Thomas Guimbretiere caf8cf7e7b Desactivated furnace progress display. 2015-02-10 17:34:41 +01:00
Thomas Guimbretiere 01546d40e9 Protected rendering from crashes.
Tried to use TrueTyper without success
Update to latest Gradle
2015-02-10 17:32:43 +01:00
Thomas Guimbretiere 6d6e7616e4 Stack & Progress bar for furnaces, just because I can. 2015-01-05 20:22:56 +01:00
Thomas Guimbretiere 1c2af8da33 Moved renderIcon() from OverlayRenderer to DisplayUtil 2015-01-05 15:52:00 +01:00
Thomas Guimbretiere 197305bf78 Display of text vs hearts is based on max health now, not current health. 2015-01-05 15:38:15 +01:00
Thomas Guimbretiere 8483573146 Added a custom renderer for health bars 2015-01-05 15:27:55 +01:00
Thomas Guimbretiere a05c6aa6d7 Added size hint for icon special char 2015-01-05 14:38:32 +01:00
Thomas Guimbretiere 28196d451e Added tag v1.5.8a_1.7.10 for changeset ef5c83a57257 2015-01-04 16:26:13 +01:00
Thomas Guimbretiere e83009414e Version bump 2015-01-04 16:19:56 +01:00
Thomas Guimbretiere 46b0f19572 Fix for issue #137 2015-01-04 15:48:14 +01:00
Thomas Guimbretiere 730f57be90 Added tag v1.5.8_1.7.10 for changeset dd4695b8b6e8 2015-01-04 15:48:02 +01:00
Thomas Guimbretiere 6f30e64849 Version bump 2015-01-04 00:51:18 +01:00
Thomas Guimbretiere 156e672dbc Restored getBlockID to the accessors
Added getBlockQualifiedName to return a block domain:name str
Restored the id display (along with the new qualified name)
2015-01-04 00:46:14 +01:00
Thomas Guimbretiere fdd401469e Added tooltip event registered only if NEI is not present to show the originating mod. 2015-01-03 18:59:44 +01:00
Thomas Guimbretiere 2b5eb13f83 Updated API version 2015-01-03 18:42:37 +01:00
Thomas Guimbretiere 0476bca1bf NEI is now a weak dependency. 2015-01-03 18:38:40 +01:00
Thomas Guimbretiere f46ac15842 Ported to NEI 1.0.4.+ 2015-01-03 17:11:54 +01:00
Thomas Guimbretiere 616e02e047 Removed System.exit(-1);
Fixed issue #119
2015-01-03 16:06:28 +01:00
Thomas Guimbretiere e74174aff7 Cleanup 2015-01-03 16:04:01 +01:00
Thomas Guimbretiere 38fa57823e Added try/catch around the calls to external renderer methods 2015-01-03 16:01:35 +01:00
Thomas Guimbretiere 7d1c25872c Line spacing is added to the reserved size.
glPush/Pop & glTranslate around the calls to draw
Moved all the special renderers to a 2nd pass, post text.
Removed x,y from the draw signature.
Added an helper method to get the proper RenderString
2015-01-03 15:52:32 +01:00
Thomas Guimbretiere f9f2c4041e Removed Block & Entity accessor and replaced it with the Common accessor.
Added a split in the line regexp for the icon.
Created a icon renderer.
Old waila Icon nomenclature is now turned into the proper renderer.
Removed some empty methods in Tooltip.
2014-12-29 17:52:53 +01:00
Thomas Guimbretiere 9050654e42 Added skeleton DataAccessorCommon that will be used instead of individual Accessors (via param interface cast)
IWailaTooltipRenderer uses this new more generic accessor.
All internals of the accessors are now private.
2014-12-29 16:49:37 +01:00
Thomas Guimbretiere 14bee7ab58 Moved the renderers to their own sub package in overlay 2014-12-29 16:21:48 +01:00
Thomas Guimbretiere a63dc221ba Added argument to pass along the param array 2014-12-29 16:17:41 +01:00
Thomas Guimbretiere 6bba5f1e7e Fixed regexp to include comma separated String arguments to the renderer call 2014-12-29 16:01:46 +01:00
Thomas Guimbretiere eae1de6698 Added handling for the RENDER tag 2014-12-29 03:07:19 +01:00
Thomas Guimbretiere ef7812c64d Added some debug code when registering null block/handler 2014-12-29 02:28:44 +01:00
Thomas Guimbretiere 8924997fa0 Reinstored proper align, fixed the broken ALIGNCENTER, added kickass regexp 2014-12-29 02:03:56 +01:00
Thomas Guimbretiere 9f6e79c467 Enormous simplification of the tooltip handling code.
Away with the Lines and overly complicated code, I welcome our new regexped Renderable overlord !
2014-12-29 01:00:06 +01:00
Thomas Guimbretiere 08db0ed7fd First working version of Tooltip rendering using custom renderers (for strings)
Moved some CBCore methods to DisplayUtil
2014-12-28 01:59:15 +01:00
Thomas Guimbretiere adcc7783a8 Added skeleton support for custom renderers in the tooltip.
Still need to fix the offset and check all the signatures.
2014-12-26 03:08:01 +01:00
Thomas Guimbretiere b686bb431c Added tag v1.5.7a_1.7.10 for changeset 56138035307d 2014-12-25 19:41:12 +01:00
Thomas Guimbretiere 7251015c3a Removed some debug stack printing in IEnergyHandler.
Added a test IBlockInfo handler.
Version bump
Added enforcing dep on NEI
2014-12-25 19:40:33 +01:00
Thomas Guimbretiere ff8980089a Filter out aspects with a value of 0
Put back the missing config test
2014-12-23 16:05:06 +01:00
Thomas Guimbretiere 4132d2941b Removed debug code 2014-12-23 02:25:16 +01:00
Thomas Guimbretiere 8c77c19e94 Added a more generic Interface for the TipList so I can modify what is going on later on if needed. 2014-12-22 15:29:18 +01:00
Thomas Guimbretiere ae10c1cad2 Fixed getBlockReadDistance() derp (no need for 0.5F correction anymore) 2014-12-22 15:06:10 +01:00
Thomas Guimbretiere 2bc138f222 Fixed raytracing bug when using different model then player. 2014-12-22 15:03:26 +01:00
Thomas Guimbretiere 3527aa3ddf Sorted the list of aspects by known/unknown to prevent alphabetical guessing 2014-12-20 18:58:59 +01:00
Thomas Guimbretiere edb0dab397 Finished adding Javadoc to most classes. 2014-12-18 00:37:51 +01:00
Thomas Guimbretiere 30885054a2 Added shorthand add(E e, String tag) and add(E e, List<String> taglst) to make it easier to add tags.
Added removeEntries(String tag) to remove all the entries with a given tag.
2014-12-18 00:12:31 +01:00
Thomas Guimbretiere 96b32ffd50 Partial javadoc 2014-12-18 00:02:42 +01:00
Thomas Guimbretiere b7dda5d80b Updated TE module to handle new interfaces.
Readded the clear/remove part of TipList to make sure there is no lingering tags.
2014-12-17 20:29:18 +01:00
Thomas Guimbretiere 8d5d86705c Import cleanup 2014-12-17 18:59:33 +01:00
Thomas Guimbretiere 26dad264d5 Implemented tag handling in TipList
Import cleanup in the API
2014-12-17 18:56:19 +01:00
Thomas Guimbretiere 6489bded40 Moved reflected API calls to AccessHelper
Added a dummy custom ArrayList implementation to support tags
2014-12-17 17:06:41 +01:00
Thomas Guimbretiere 85d8541112 Merged in TheVikingWarrior/waila (pull request #29)
Italian localization
2014-12-17 03:15:40 +01:00
Thomas Guimbretiere c9b750077e Merged in Adapta/waila-1/Adapta/ru_rulang-edited-1411545918603 (pull request #27)
ru_RU.lang edited
2014-12-17 03:15:11 +01:00
Thomas Guimbretiere 7c08f87419 Deleted old files.
Version bumped to 1.5.7 dev
2014-12-17 02:41:30 +01:00
Thomas Guimbretiere b8d4783d7e Finished remaking TC module. 2014-12-17 02:29:43 +01:00
Thomas Guimbretiere 146e30cbda Added player and world to getNBTData for entities. 2014-12-17 01:20:37 +01:00
Thomas Guimbretiere 5978494340 Added skeleton for a coremod (inactivated for now), just in case.
Added one param to getNBTData (the player). This would invalidate the previous mods, but tricked Waila into using reflection when that happens.
Skeleton Thaumcraft module.
2014-12-17 01:15:29 +01:00
Thomas Guimbretiere c618a10e7c Updated package-info to superseed all those nasty mods including the API (bouh !) 2014-12-16 17:52:08 +01:00
Thomas Guimbretiere 634c9a55ce Fixed corner case when writeToNBT is called in getNBTData for a TE which is not the targeted one. 2014-12-15 04:44:58 +01:00
Thomas Guimbretiere a8fb8a03e0 Added tag v1.5.6a_1.7.10 for changeset fccf438ffd64 2014-12-15 01:36:23 +01:00
Thomas Guimbretiere 13e233d1d2 Desactivated Thaumcraft module until I can fix it. 2014-12-15 01:36:00 +01:00
Thomas Guimbretiere 8f87062c1e Added tag v1.5.5_1.7.10 for changeset 24cd83db1c1c 2014-12-14 20:09:30 +01:00
Thomas Guimbretiere a111fed3d5 Added tag v1.5.6_1.7.10 for changeset 25d552df32d1 2014-12-14 20:08:17 +01:00
Thomas Guimbretiere c887c01e2e Cleanup in TE
getNBTData rethrowing the exceptions to be caught by the Waila Exception handler (IC2, TE).
Version bump
2014-12-14 20:08:07 +01:00
Thomas Guimbretiere 47cc1af622 plop 2014-12-14 04:10:05 +01:00
Thomas Guimbretiere da60ffef67 Readded IC2 generators 2014-12-14 03:31:40 +01:00
Thomas Guimbretiere e69d711124 Bad import 2014-12-14 01:32:42 +01:00
Thomas Guimbretiere 49893aa732 Cleaned up BC and TF modules. 2014-12-14 01:21:39 +01:00
Thomas Guimbretiere e2475c34d5 Removed all usage of the old sync registration method.
Replace all of them by a call to the new registration method (which is just using writeToNBT for now).
2014-12-14 01:06:47 +01:00
Thomas Guimbretiere fcc5699046 Added handling for server side NBT override for Entities. 2014-12-14 00:44:28 +01:00
Thomas Guimbretiere 09ab6cb781 Fixed reflection derp on obf MC.
Added registration for NBT override for Ents
2014-12-13 23:23:33 +01:00
Thomas Guimbretiere fd929a4235 Modules are now registered both clien and server side (let's pray for the best on this one...) 2014-12-13 22:42:59 +01:00
Thomas Guimbretiere 87986a6cfb Added default NBT values server side (position/type)
Ported all ThermalExpansion to the new system.
2014-12-13 22:18:35 +01:00
Thomas Guimbretiere 298eafc0c0 NBT Data provider is now taking precedence on writeToNBT to handle NBT sync. 2014-12-13 20:35:14 +01:00
Thomas Guimbretiere 5349270996 Updated to latest forge (1264) 2014-12-13 20:07:13 +01:00
Thomas Guimbretiere 17dce19ba3 Update to forge1258 (to support ThermalExpension in dev env) 2014-12-13 19:11:29 +01:00
Thomas Guimbretiere 95ce24b31c Added registration and methods for a custom NBT tag getter. 2014-12-13 18:35:26 +01:00
Thomas Guimbretiere 16b3a46bae Completly desactivated BC module. 2014-12-13 17:39:54 +01:00
Thomas Guimbretiere 83339dcbd5 Merge 2014-12-13 17:38:51 +01:00
Thomas Guimbretiere d2291a1215 Merged in EpixZhang/waila/EpixZhang/getcommandusage-return-a-string-rather-t-1415728834683 (pull request #31)
getCommandUsage return a string rather than null. should fix "/help" crash
2014-12-13 17:41:20 +01:00
Thomas Guimbretiere 3ae11044fd Removed debug msg for nbt sync. 2014-12-13 17:38:41 +01:00
Epix Zhang aae8449e06 getCommandUsage return a string rather than null. should fix "/help" crash 2014-11-11 18:00:40 +00:00
Lukasz M 206eb75489 Fixed epic derpy leak in ModNameFilter 2014-10-30 22:25:47 +01:00
Lukasz M a633110bb1 Fixed filtering CME, possibly fixing few other issues 2014-10-29 21:06:52 +01:00
Thomas Guimbretiere 68fc21b282 Updated build.gradle to use latest NEI
Reduced the used tags in TE
2014-10-16 19:48:18 +02:00
Thomas Guimbretiere eb941468f7 Fixed early cast in EnderIO 2014-10-11 18:12:46 +02:00
Thomas Guimbretiere 248c4f844f Delayed IMC requests to the end of the pipeline to provide proper lookup order. 2014-10-02 20:20:43 +02:00
TheVikingWarrior b81f72c0b4 Merged in TheVikingWarrior/created-italian-localization-1412019536812 (pull request #1)
Italian localization
2014-09-29 21:39:51 +02:00
TheVikingWarrior 441501f49b Close branch TheVikingWarrior/created-italian-localization-1412019536812 2014-09-29 21:39:51 +02:00
TheVikingWarrior 7ac7bff1d3 Italian localization 2014-09-29 19:39:05 +00:00
Thomas Guimbretiere 446989c5a9 Version bump 2014-09-29 15:06:00 +02:00
Thomas Guimbretiere c8b2803aee Corrected small duplicated method body 2014-09-29 14:46:11 +02:00
Thomas Guimbretiere 3357e9bb32 Added default config value support. 2014-09-29 14:42:46 +02:00
Thomas Guimbretiere 9ecab4c490 Added new config option to turn off the new filters.
Workaround for people having the @mod slowdown.
2014-09-29 14:28:20 +02:00
Thomas Guimbretiere d01c5cd452 Merged in Parker8283/waila/logging (pull request #28)
Updated to log4j2
2014-09-28 23:00:19 +02:00
Parker Young eae6385a45 Updated to log4j2
Also did some unused import cleanup and deprecation cleanup.
2014-09-28 16:53:28 -04:00
Parker Young f4ae8de69e Created new branch logging 2014-09-28 20:15:08 +00:00
Adapta 74865d4b54 ru_RU.lang edited 2014-09-24 08:06:39 +00:00
Thomas Guimbretiere 42bb13818a Merged in vlendvaj/waila-1/vlendvaj/fix-for-botanias-ring-of-far-reach-1406664387560 (pull request #22)
Fix for botania's ring of far reach
2014-09-23 22:34:24 +02:00
Thomas Guimbretiere dc0e61b6e9 Merged in crafteverywhere/waila (pull request #26)
Redo the language file for Chinese.
2014-09-23 22:31:39 +02:00
Thomas Guimbretiere 9a74ac8f3b Some cleanup 2014-09-23 22:23:51 +02:00
Thomas Guimbretiere 37828e18f6 Reactivated Thaumcraft module + fix to handle IGoggles better. 2014-09-23 22:22:13 +02:00
Thomas Guimbretiere 40173c3aaa Partial fix for #82
Added override for vanilla leaves to fix placed leaves metadata swift.
2014-09-23 21:29:40 +02:00
Thomas Guimbretiere 72e0f942f2 Fix for #97
Restored BC tank module.
2014-09-23 21:08:41 +02:00
Thomas Guimbretiere 0a3184ba6b Fix for #92
Added a try/catch around the filter to prevent concurrent modifications errors.
2014-09-23 20:10:44 +02:00
Thomas Guimbretiere e322723146 Fix for #101
Added try/catch clause around NBT lookup.
2014-09-23 19:13:35 +02:00
Thomas Guimbretiere 5f93e5a027 Added CC-BY-NC-SA license 2014-09-22 17:53:50 +02:00
craft 45ec78d68b Merged in crafteverywhere/zh_cnlang-edited-online-with-bitbucket-1411334152054 (pull request #1)
Redo the language file for Chinese.
2014-09-22 05:18:09 +08:00
craft 3551c188b7 Close branch crafteverywhere/zh_cnlang-edited-online-with-bitbucket-1411334152054 2014-09-22 05:18:09 +08:00
craft 662cb060ff Redo the language file for Chinese. 2014-09-21 21:16:22 +00:00
Thomas Guimbretiere 23172ad307 Added command to dump all currently registered handlers. 2014-09-15 23:33:56 +02:00
Thomas Guimbretiere ea105c698f Added some protection if icons are invalid (which should never happen...) 2014-09-14 18:20:45 +02:00
Thomas Guimbretiere 80a17c9af4 Added tag v1.5.4a_1.7.10 for changeset ab090f34afed 2014-09-13 10:53:55 +02:00
Thomas Guimbretiere 38f004ba2f Restored default NEI filtering by using a nasty workaround. 2014-09-13 10:53:24 +02:00
Thomas Guimbretiere dfe3050167 Forgot to register the network handler... 2014-09-12 01:39:53 +02:00
Thomas Guimbretiere a5e1a51972 Uncommented some stuff 2014-09-12 00:41:34 +02:00
Thomas Guimbretiere aafaeba9fd Removed obsolete stuff
Readded EnderIO with nicer tabbed output.
2014-09-12 00:36:36 +02:00
Thomas Guimbretiere e0805fe0ce Same fix on OreDict filter.
ThermalExpansion is back in.
2014-09-12 00:16:45 +02:00
Thomas Guimbretiere 389f2e7dfc Added a new filter. #<oredict> will return all the items under this specific oredict entry. 2014-09-05 15:33:31 +02:00
Thomas Guimbretiere 7463c054c7 Updated to last version of NEI/CCC
Added a custom item filter to handle Waila modname filtering.
2014-09-01 01:14:05 +02:00
Thomas Guimbretiere 80ac857e2c version bump x2 2014-08-25 18:51:16 +02:00
Thomas Guimbretiere ae7132cf8a Version bump 2014-08-25 18:50:36 +02:00
Thomas Guimbretiere 4f947ce409 Fixes issue #44 2014-08-25 18:46:33 +02:00
Thomas Guimbretiere 8870cc05ad Fixes issue #61
Wheat is now overriden to display a proper stack.
2014-08-25 18:14:22 +02:00
Thomas Guimbretiere 90c3ae6921 Fixed issue #79
Redstone Ore is now returned properly using a stack override.
2014-08-25 16:57:23 +02:00
Thomas Guimbretiere 1b080d1208 Fix for double plants.
Moved to forge 1208
2014-08-25 16:36:41 +02:00
Thomas Guimbretiere 0a30bb5848 Updated version in Gradle 2014-08-25 00:35:19 +02:00
Thomas Guimbretiere 8503ed33b7 Merge with default 2014-08-25 00:33:26 +02:00
Thomas Guimbretiere 5cb0e10e7a Merged in Adapta/waila/Adapta/ru_rulang-edited-online-with-bitbucket-1403029325882 (pull request #15)
ru_RU.lang edited
2014-08-25 00:35:08 +02:00
Thomas Guimbretiere b704465eef Merge with default 2014-08-25 00:32:22 +02:00
Simon Cavindish 276207d718 zh_CN.lang created online with Bitbucket 2014-08-16 04:36:56 +00:00
vlendvaj b5eae48f90 Fix for botania's ring of far reach 2014-07-29 20:06:36 +00:00
eracer 9c3358419c Renamed misspelled resources directory 2014-07-23 09:54:42 -06:00
Thomas Guimbretiere 6e72b0b302 Version bump.
Removed the client/server dep
2014-07-21 02:30:10 +02:00
Thomas Guimbretiere 08a7be082c Ported to 1.7.10
Fixed BC
Thanks for the PRs from Shane Sova, Crazy Pants & MrSourceCoded
2014-07-21 02:20:40 +02:00
Thomas Guimbretiere 73ac295ade Fixed build.gradle for 1.7.10 2014-07-21 01:46:42 +02:00
Thomas Guimbretiere c165526c5b Proper gradle file structure. 2014-06-24 17:36:14 +02:00
Adapta a39fb2df02 ru_RU.lang edited online with Bitbucket 2014-06-17 18:22:18 +00:00
Thomas Guimbretiere 651ae123e6 fixed a small circular prb with Gradle, NEI and ASM 2014-05-05 00:41:27 +02:00
Thomas Guimbretiere 552f1b4127 Added lang files 2014-05-01 15:31:12 +02:00
Thomas Guimbretiere 2c2f381b13 Fix API to work with official NEI release. 2014-05-01 15:26:46 +02:00
Thomas Guimbretiere fad5563eca Removed the CSV reading. 2014-04-24 00:50:12 +02:00
Thomas Guimbretiere 93cd9e1732 Backported changes to match NEI RC2 instead of NEI RC3_dev 2014-04-08 14:46:05 +02:00
Raul Tambre 4c2b473d86 Remove previous one, what had no .lang extension 2014-04-05 06:33:27 +00:00
Raul Tambre 4b3d57f075 Fix couple typos and add .lang in the end 2014-04-05 06:31:47 +00:00
Raul Tambre 775b088bba Added Estonian translation 2014-03-30 22:18:25 +03:00
Raul Tambre d18676d144 Added Estonian translation 2014-03-30 19:15:44 +00:00
Thomas Guimbretiere e12a2d8ed7 Added tag v1.5.2_1.7.2 for changeset 8da12a38d3b9 2014-03-30 19:50:16 +02:00
Thomas Guimbretiere cc88897ca8 And one last version bump. 2014-03-30 19:49:59 +02:00
Thomas Guimbretiere a2e3aef71e All done ! (?) 2014-03-30 19:21:26 +02:00
Thomas Guimbretiere 2e8bb2760a More fixed stuff and more desactivated modules 2014-03-30 17:30:01 +02:00
Thomas Guimbretiere ec37d2fd86 More fixing. Basic packets fixed. 2014-03-30 16:10:00 +02:00
Thomas Guimbretiere 0df7285dc2 Missing files 2014-03-30 15:25:00 +02:00
Thomas Guimbretiere bb00730912 First commit for 1.7.2 2014-03-30 15:24:44 +02:00
Thomas Guimbretiere 166f293142 Added tag v1.4.5_1.7.2 for changeset bb4fc720238a 2014-03-30 14:34:58 +02:00
Thomas Guimbretiere 63a46c019c Merge with forge_965 2014-03-26 22:39:03 +01:00
Thomas Guimbretiere 0bb6caf334 Cleanup of TC module and addition of TT helmets handling. 2014-02-23 18:56:46 +01:00
Thomas Guimbretiere 5ac5f7956c Fixed Thaumcraft module. 2014-02-23 18:29:19 +01:00
Thomas Guimbretiere d00c17b3bb Fixed double registration of crops. 2014-02-23 17:34:36 +01:00
Thomas Guimbretiere 52ac40a10e Workaround for Morph eye height. 2014-02-23 17:29:09 +01:00
Thomas Guimbretiere 40facdda4b Added config option for Thaumcraft 2014-02-20 01:22:52 +01:00
Thomas Guimbretiere 3505888a82 Added new module section called "General".
Growth value and entity health are now config options there.
2014-02-20 00:34:09 +01:00
Thomas Guimbretiere 7eb35b7544 Max hp before text is now a config option 2014-02-20 00:24:22 +01:00
Thomas Guimbretiere 78039db017 Added support for Agriculture crop 2014-02-20 00:02:27 +01:00
Thomas Guimbretiere 17b5cbead9 Added tag Waila_1.5.0 for changeset ad46f8b41bbe 2014-02-19 23:44:28 +01:00
Thomas Guimbretiere d355ec28bb Added try/catch around NBT dumping client side. 2014-02-19 23:44:13 +01:00
Thomas Guimbretiere bd675cee28 Max hearts per line can be changed.
HP turns to text when max > 40
2014-02-19 23:21:42 +01:00
Thomas Guimbretiere 7c74db3640 Added lookup for known aspects. 2014-02-19 22:42:55 +01:00
Thomas Guimbretiere b65dc58fc6 Fixed tooltip size when name is bigger than tabbed display data. 2014-02-19 21:54:42 +01:00
Thomas Guimbretiere 1438d6a701 First fix for Entity hp display
Thaumcraft module will show aspects if the player is wearing googles of revealing.
2014-02-19 21:36:42 +01:00
Thomas Guimbretiere 223e2c7da6 Stopped bleeding gl constants at the end of rendering. 2014-02-19 18:52:27 +01:00
Thomas Guimbretiere 1aed35a2b5 Version bump
Local NBT is used if server sync is not available
Moved the "shift to see" handling to the tick handler directly
Fixed Steve's cart tank display
Both hide options for carpenter & secret rooms are not remote anymore.
2014-02-19 01:23:28 +01:00
Thomas Guimbretiere 96a0d27778 Added support for Statues. 2014-02-18 22:22:07 +01:00
Thomas Guimbretiere aecf8c0330 Moved the SpecialChars to the API
Deprecated the old IWailaBlock
2014-02-18 11:18:01 +01:00
Thomas Guimbretiere 4c1803accf Try at making a somewhat broken billboard code. 2014-02-18 10:46:59 +01:00
Thomas Guimbretiere 3ce45461eb Version bump 2014-02-18 02:43:42 +01:00
Thomas Guimbretiere 90dd086cc3 Added tag Waila_1.5.0_dev2 for changeset 1066f782daed 2014-02-18 02:43:32 +01:00
Thomas Guimbretiere fb9de99f39 Moved all the Vanilla module from ID to Block identification.
Fixed inheriting crop discovery
Added magical crops module.
2014-02-18 01:37:37 +01:00
Thomas Guimbretiere 1580296a2c Added Harvestcraft growth display 2014-02-18 01:04:20 +01:00
Thomas Guimbretiere 9d272f2e34 Fixed orientation of plates with alternate shapes. 2014-02-18 00:47:21 +01:00
Thomas Guimbretiere 2259e27f60 Ignore update 2014-02-17 22:44:13 +01:00
Thomas Guimbretiere 716498256b Added full FMP decorator support.
P:R decorator ported.
2014-02-17 22:41:00 +01:00
Thomas Guimbretiere bcd36dd638 Cleanup 2014-02-17 22:16:57 +01:00
Thomas Guimbretiere f790ac948d Replaced Project:Red old block registration with shiny new FMP registration.
Added DataAccessorFMP
2014-02-17 22:14:12 +01:00
Thomas Guimbretiere f282be75f4 FMPHandler registers itself properly when FMP is found. 2014-02-17 21:10:45 +01:00
Thomas Guimbretiere ec1ab8e548 Added registration for FMP data providers.
Moved getNBTInt to NBTUtil.
2014-02-17 20:36:02 +01:00
Thomas Guimbretiere add57cbd6b Spring cleaning on the registrar by abusing generics. 2014-02-17 20:09:28 +01:00
Thomas Guimbretiere ce249c806e Switched to generics for the registration. 2014-02-17 19:08:32 +01:00
Thomas Guimbretiere 3f6da9018c Tooltip cleanup works for entities too now. 2014-02-17 18:36:47 +01:00
Thomas Guimbretiere 2b7f3866a5 Separate config for blocks & entities 2014-02-17 18:32:50 +01:00
Thomas Guimbretiere b83d5bd297 Added shift toggled data display.
Will default to false, can be turned on in the config.
2014-02-17 18:02:45 +01:00
Thomas Guimbretiere 4e7e32fba7 Added config options for Steve's carts module.
Added toggle shift view.
2014-02-17 17:13:53 +01:00
Thomas Guimbretiere 2346ffd559 Steve's carts cargo and liquid managers done.
TODO : Add config options for EVERYTHING
2014-02-17 04:54:16 +01:00
Thomas Guimbretiere 49a2a32a77 Restricted synced keys for Carpenter's and SecretDoors. 2014-02-17 02:07:44 +01:00
Thomas Guimbretiere 47fb4c55a8 Carpenter's block module added 2014-02-17 02:05:08 +01:00
Thomas Guimbretiere b6b5404440 Added torches and trapdoors to the override. 2014-02-17 01:29:37 +01:00
Thomas Guimbretiere 89fc1c8ce7 Added secret room module.
Added lookup by TileEntity for override stack to the Raytracing routine.
2014-02-17 00:40:46 +01:00
Thomas Guimbretiere 79107209d9 Added option in the VanillaMC module to hide/show silverfishes.
It will default to true (Hide silverfishes).
2014-02-17 00:10:01 +01:00
Thomas Guimbretiere 3533ea2d23 Added comments to the accessors. 2014-02-16 23:45:24 +01:00
Thomas Guimbretiere f1a4056431 Try/Catch the creation of the stack in the Accessor (it does fail sometimes with some mods.) 2014-02-16 23:35:32 +01:00
Thomas Guimbretiere dcc35737be Added liquid display to Steve's carts.
Added getStack to the accessor to get the none overriden stack.
ID:Meta is now based on the override stack instead of the accessor.
Fixed a NPE when a stack provider returns a null stack.
Version bump.
2014-02-16 23:33:53 +01:00
Thomas Guimbretiere 4a3015eb21 Steve's carts first module test. 2014-02-15 21:13:27 +01:00
Thomas Guimbretiere d3a317e3dd All modules are now registering a full NBT sync request (just because it would be a pita to track down the keys). 2014-02-15 17:16:19 +01:00
Thomas Guimbretiere 9d1045333a Entity data is now synced too. 2014-02-15 17:01:14 +01:00
Thomas Guimbretiere 80e30abec3 Added partial NBT syncing to the protocol.
TEs will NOT be synced by default anymore. You actually have to either request "*" to get the whole NBT,
or request specific keys using "aaa.bbb", etc.
2014-02-15 16:41:38 +01:00
Thomas Guimbretiere 2dd88b9c13 Added synced NBT Key registration and retrieval. 2014-02-15 12:24:04 +01:00
Thomas Guimbretiere f46d9393b5 Refactoring & Cleanup 2014-02-15 11:43:12 +01:00
Thomas Guimbretiere d2f8911797 Right justification.
Fixed tooltip size prb.
2014-02-15 03:13:21 +01:00
Thomas Guimbretiere a1365b2db3 Tabulated display of IC2 tooltips. 2014-02-15 02:24:34 +01:00
Thomas Guimbretiere 0988ee744e Added Empty Heart to the icon list.
Fixed light prb (tesselator color reset)
Added life display to EntityLivingBase
2014-02-15 02:07:01 +01:00
Thomas Guimbretiere 537c3dc1af Icon rendering and handling is almost done. 2014-02-15 01:35:49 +01:00
Thomas Guimbretiere 5f7bf6cc5c Generic icon rendering method based on an enum with u,v,su,sv
Also handles adding a backgroup icon (for hearts for example).
2014-02-15 00:18:59 +01:00
Thomas Guimbretiere 904fe472b8 Code cleanup, basic icon rendering support. 2014-02-15 00:07:14 +01:00
Thomas Guimbretiere 0ef5f65067 Support for columns is now added. Inserting SpecialChars.TAB in a tooltip will create a new column.
Text in the columns is aligned properly when rendering.
2014-02-14 22:36:11 +01:00
Thomas Guimbretiere b6d529575d Basic line splitting
This will be redone and put here as reference.
2014-02-14 22:04:12 +01:00
Thomas Guimbretiere 669435f153 Moved string rendering to the Tooltip itself to allow for more complex stuff. 2014-02-14 18:42:54 +01:00
Thomas Guimbretiere f1c484d390 Moved more data to the Tooltip class for precomputation.
Only one overlay renderer now with offsets and data precomputed in the ClientTick (not more Entity vs Stack).
2014-02-14 18:32:32 +01:00
Thomas Guimbretiere ef20dcc4c6 Tooltip position & size computation moved out of the RenderTick into the ClientTick.
Will allow for more flexibility on how to render it too since more can be computed there.
2014-02-14 17:55:48 +01:00
Thomas Guimbretiere 1bbf3e8747 Server => Client config key syncing is operational. 2014-02-13 19:50:11 +01:00
Thomas Guimbretiere 3bc29dd907 Key forcing is now send over the network upon login. 2014-02-13 19:29:22 +01:00
Thomas Guimbretiere 23bbd2ceb4 Moved Overlay data to a separate class (OverlayConfig)
Moved default config file to ConfigHandler.
2014-02-13 19:00:37 +01:00
Thomas Guimbretiere d0e2932257 Server forcing config keys are generated.
The whole file is now loaded only once on startup.
2014-02-13 18:51:40 +01:00
Thomas Guimbretiere cf6ecd55e5 First pass at reworking the config system to handle multiple categories (General and modules for now) 2014-02-13 18:34:53 +01:00
Thomas Guimbretiere bfc2e5dec6 Declared Waila API as an API so it doesn't get messed up by other mods.
Fixes issue #22
2014-02-13 00:10:51 +01:00
Thomas Guimbretiere d6589ec1c1 Config options are added to the config file when the option is registered. 2014-02-12 23:51:01 +01:00
Thomas Guimbretiere 1cadab1320 Clean up
Added commented HP display for demonstration.
2014-02-12 22:57:21 +01:00
Thomas Guimbretiere 91aea326c7 Override for entities is in. 2014-02-12 22:27:10 +01:00
Thomas Guimbretiere d2c6d95e75 Entity tooltip is now handled by the API (registration, lookup, etc).
TODO : Add icon handling and overriding.
2014-02-12 22:12:32 +01:00
Thomas Guimbretiere 5a8673d322 Added & registered default empty module for Entities. 2014-02-12 18:57:59 +01:00
Thomas Guimbretiere 917eaab8be Added tag 1.4.5a for changeset 5dd753fa7c80 2014-02-12 18:20:19 +01:00
Thomas Guimbretiere 198d0c7079 Removed some logging
Reflection is now done with FML utilities
Fixes issue #17
Version bump
2014-02-12 18:20:11 +01:00
Thomas Guimbretiere 03f4bed4fe Added missing registrar methods for entities. 2014-02-11 21:10:46 +01:00
Thomas Guimbretiere 1bfcc07e1f Fixed getSide()
Fix for issue #21
2014-02-11 20:38:33 +01:00
Thomas Guimbretiere ef9a1bedfc Basic IWailaEntityProvider registration process implemented.
Removed duplicated stackProviders & decoratorProviders methods based on IDs
Deprecated ID based registration (in plan for 1.7)
2014-02-11 20:09:12 +01:00
Thomas Guimbretiere 4121e689fd Readded missing config call for ID:Meta display 2014-02-04 13:59:42 +01:00
Thomas Guimbretiere 0b1911b711 Added tag 1.4.5 for changeset 7ff010d0fad8 2014-02-04 13:59:22 +01:00
Thomas Guimbretiere ac73b6b537 Enable the rendering of the UI only is the UI is visible.
Might fix issue #11
2014-02-03 22:31:34 +01:00
Thomas Guimbretiere 4188ec37b2 Added override for redstone wires.
Fixes Issue #12
2014-02-03 22:24:54 +01:00
Thomas Guimbretiere 6cefb32520 Added safeguard if the NBT len > 32k to prevent client side crash.
Fixes Issue #9
2014-02-03 21:59:59 +01:00
Thomas Guimbretiere 7ba3a2b7e8 Removed depricated annotation. 2014-01-25 04:57:30 +01:00
Thomas Guimbretiere 3d7c3f0726 Update for 965 2014-01-25 04:45:56 +01:00
Thomas Guimbretiere 74cdb0fa1e New branch for forge_965 2014-01-12 14:56:22 +01:00
Thomas Guimbretiere dc07947ccf Merge with current 2014-01-12 14:53:07 +01:00
Thomas Guimbretiere 3b1f35e7a8 Updated default to 1.4.4b 2014-01-12 14:52:40 +01:00
Thomas Guimbretiere dbd06b2552 Removed MJ wrong handling of some internals. 2014-01-12 14:49:28 +01:00
Thomas Guimbretiere 9c121fb5c8 Added color constants. 2013-12-24 19:33:56 +01:00
Thomas Guimbretiere 28d19ef015 Clean up
Added setters for the IAccessor.
2013-12-24 18:28:01 +01:00
Thomas Guimbretiere 3843fd9815 Refactoring 2013-12-24 18:17:00 +01:00
Thomas Guimbretiere 2777e0ea80 Custom identifiers are now considered properly in the Tick handler 2013-12-24 15:45:25 +01:00
Thomas Guimbretiere e62f26a0ee The whole tooltip is now produced completly in Waila.
No more dependencies on NEI API for that.
2013-12-24 08:03:08 +01:00
Thomas Guimbretiere 403e2aad57 Tooltip rendering is not dependent on NEI API no more. 2013-12-24 07:48:36 +01:00
Thomas Guimbretiere c171d33e8c Some cleanup & added support for Footer. 2013-12-24 00:20:52 +01:00
Thomas Guimbretiere b1f7f2f2df Moved string gather to CLIENT tick for caching. 2013-12-24 00:01:18 +01:00
Thomas Guimbretiere a49d359656 Reworked the raytracing to make it cleaner and leaner. 2013-12-23 22:42:09 +01:00
Thomas Guimbretiere 03ec8ac17b Added code to call upon HUDHandlerExternal in the tick handler (commented)
TickHandler is now a singleton
2013-12-23 21:23:15 +01:00
Thomas Guimbretiere 75f3618424 Raytracing is now done in the CLIENT tick 2013-12-23 21:02:15 +01:00
Thomas Guimbretiere e400edb92f New Branch 2013-12-23 20:53:28 +01:00
Thomas Guimbretiere 42170ca050 Fixed wrong msgs on empty and microblocks. 2013-12-23 13:40:21 +01:00
Thomas Guimbretiere f9868afde1 Added support for Railcraft tanks. 2013-12-21 00:09:53 +01:00
Thomas Guimbretiere 4e79797cd1 Added support for OpenBlocks tanks. 2013-12-20 23:16:11 +01:00
Thomas Guimbretiere 921b245273 Added support for ExtraUtilities drums 2013-12-20 22:31:09 +01:00
Thomas Guimbretiere 2cbaeca169 Fixed Thermal Expansion conduits. 2013-12-20 21:52:53 +01:00
Thomas Guimbretiere bc344cab41 Added tag 1.4.3 for changeset 1c391d52f3d9 2013-12-17 18:59:24 +01:00
Thomas Guimbretiere 7a2fd4363c Mute the discovery errors from IC2.
Moved the module registration to very late events.
2013-12-17 18:40:55 +01:00
Thomas Guimbretiere 11d0f86320 Updated RU translation
Removed fluked file.
2013-12-12 16:26:28 +01:00
Thomas Guimbretiere d83fb8fe76 Added side getter to the accessor.
Version bump.
2013-12-09 14:08:18 +01:00
Thomas Guimbretiere a36013c28c Fixed a derp with air blocks... 2013-12-09 14:01:52 +01:00
Thomas Guimbretiere 1934171e5a Merge 2013-12-07 01:34:18 +01:00
Thomas Guimbretiere 4b2e873261 Merged in Vexatos/waila-1/Vexatos/de_delang-edited-online-with-bitbucket-1386187266977 (pull request #5)
de_DE.lang edited online with Bitbucket
2013-12-07 01:38:27 +01:00
Thomas Guimbretiere 6319cbd425 Localization 2013-12-07 01:33:57 +01:00
Vexatos 72ae5eccb3 de_DE.lang edited online with Bitbucket 2013-12-04 20:01:17 +00:00
Thomas Guimbretiere 5d1c7d532f Added tag 1.4.1 for changeset f9daea609042 2013-11-26 16:29:14 +01:00
Thomas Guimbretiere 005cc66115 Merge with dev 2013-06-29 15:22:48 +02:00
405 changed files with 29745 additions and 11777 deletions

No files matched your search

+2
View File
@@ -0,0 +1,2 @@
# Ignore spotlessApply reformat
4ee7d7396c8a27b994d49169140edbf9adfdc2dc
+44
View File
@@ -0,0 +1,44 @@
* text eol=lf
*.[jJ][aA][rR] binary
*.[pP][nN][gG] binary
*.[jJ][pP][gG] binary
*.[jJ][pP][eE][gG] binary
*.[gG][iI][fF] binary
*.[tT][iI][fF] binary
*.[tT][iI][fF][fF] binary
*.[iI][cC][oO] binary
*.[sS][vV][gG] text
*.[eE][pP][sS] binary
*.[xX][cC][fF] binary
*.[kK][aA][rR] binary
*.[mM]4[aA] binary
*.[mM][iI][dD] binary
*.[mM][iI][dD][iI] binary
*.[mM][pP]3 binary
*.[oO][gG][gG] binary
*.[rR][aA] binary
*.7[zZ] binary
*.[gG][zZ] binary
*.[tT][aA][rR] binary
*.[tT][gG][zZ] binary
*.[zZ][iI][pP] binary
*.[tT][cC][nN] binary
*.[sS][oO] binary
*.[dD][lL][lL] binary
*.[dD][yY][lL][iI][bB] binary
*.[pP][sS][dD] binary
*.[tT][tT][fF] binary
*.[oO][tT][fF] binary
*.[pP][aA][tT][cC][hH] -text
*.[bB][aA][tT] text eol=crlf
*.[cC][mM][dD] text eol=crlf
*.[pP][sS]1 text eol=crlf
*[aA][uU][tT][oO][gG][eE][nN][eE][rR][aA][tT][eE][dD]* binary
+13
View File
@@ -0,0 +1,13 @@
name: Build and test
on:
pull_request:
branches: [ master, main ]
push:
branches: [ master, main ]
jobs:
build-and-test:
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/build-and-test.yml@master
secrets: inherit
+14
View File
@@ -0,0 +1,14 @@
name: Release tagged build
on:
push:
tags: [ '*' ]
permissions:
contents: write
jobs:
release-tags:
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/release-tags.yml@master
secrets: inherit
+29
View File
@@ -0,0 +1,29 @@
.gradle
.settings
/.idea/
/run/
/build/
/eclipse/
.classpath
.project
/bin/
/config/
/crash-reports/
/logs/
options.txt
/saves/
usernamecache.json
banned-ips.json
banned-players.json
eula.txt
ops.json
server.properties
servers.dat
usercache.json
whitelist.json
/out/
*.iml
*.ipr
*.iws
src/main/resources/mixins.*.json
*.bat
+3
View File
@@ -0,0 +1,3 @@
# Any Github changes require admin approval
/.github/** @GTNewHorizons/admin
+437
View File
@@ -0,0 +1,437 @@
Attribution-NonCommercial-ShareAlike 4.0 International
=======================================================================
Creative Commons Corporation ("Creative Commons") is not a law firm and
does not provide legal services or legal advice. Distribution of
Creative Commons public licenses does not create a lawyer-client or
other relationship. Creative Commons makes its licenses and related
information available on an "as-is" basis. Creative Commons gives no
warranties regarding its licenses, any material licensed under their
terms and conditions, or any related information. Creative Commons
disclaims all liability for damages resulting from their use to the
fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and
conditions that creators and other rights holders may use to share
original works of authorship and other material subject to copyright
and certain other rights specified in the public license below. The
following considerations are for informational purposes only, are not
exhaustive, and do not form part of our licenses.
Considerations for licensors: Our public licenses are
intended for use by those authorized to give the public
permission to use material in ways otherwise restricted by
copyright and certain other rights. Our licenses are
irrevocable. Licensors should read and understand the terms
and conditions of the license they choose before applying it.
Licensors should also secure all rights necessary before
applying our licenses so that the public can reuse the
material as expected. Licensors should clearly mark any
material not subject to the license. This includes other CC-
licensed material, or material used under an exception or
limitation to copyright. More considerations for licensors:
wiki.creativecommons.org/Considerations_for_licensors
Considerations for the public: By using one of our public
licenses, a licensor grants the public permission to use the
licensed material under specified terms and conditions. If
the licensor's permission is not necessary for any reason--for
example, because of any applicable exception or limitation to
copyright--then that use is not regulated by the license. Our
licenses grant only permissions under copyright and certain
other rights that a licensor has authority to grant. Use of
the licensed material may still be restricted for other
reasons, including because others have copyright or other
rights in the material. A licensor may make special requests,
such as asking that all changes be marked or described.
Although not required by our licenses, you are encouraged to
respect those requests where reasonable. More considerations
for the public:
wiki.creativecommons.org/Considerations_for_licensees
=======================================================================
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
Public License
By exercising the Licensed Rights (defined below), You accept and agree
to be bound by the terms and conditions of this Creative Commons
Attribution-NonCommercial-ShareAlike 4.0 International Public License
("Public License"). To the extent this Public License may be
interpreted as a contract, You are granted the Licensed Rights in
consideration of Your acceptance of these terms and conditions, and the
Licensor grants You such rights in consideration of benefits the
Licensor receives from making the Licensed Material available under
these terms and conditions.
Section 1 -- Definitions.
a. Adapted Material means material subject to Copyright and Similar
Rights that is derived from or based upon the Licensed Material
and in which the Licensed Material is translated, altered,
arranged, transformed, or otherwise modified in a manner requiring
permission under the Copyright and Similar Rights held by the
Licensor. For purposes of this Public License, where the Licensed
Material is a musical work, performance, or sound recording,
Adapted Material is always produced where the Licensed Material is
synched in timed relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright
and Similar Rights in Your contributions to Adapted Material in
accordance with the terms and conditions of this Public License.
c. BY-NC-SA Compatible License means a license listed at
creativecommons.org/compatiblelicenses, approved by Creative
Commons as essentially the equivalent of this Public License.
d. Copyright and Similar Rights means copyright and/or similar rights
closely related to copyright including, without limitation,
performance, broadcast, sound recording, and Sui Generis Database
Rights, without regard to how the rights are labeled or
categorized. For purposes of this Public License, the rights
specified in Section 2(b)(1)-(2) are not Copyright and Similar
Rights.
e. Effective Technological Measures means those measures that, in the
absence of proper authority, may not be circumvented under laws
fulfilling obligations under Article 11 of the WIPO Copyright
Treaty adopted on December 20, 1996, and/or similar international
agreements.
f. Exceptions and Limitations means fair use, fair dealing, and/or
any other exception or limitation to Copyright and Similar Rights
that applies to Your use of the Licensed Material.
g. License Elements means the license attributes listed in the name
of a Creative Commons Public License. The License Elements of this
Public License are Attribution, NonCommercial, and ShareAlike.
h. Licensed Material means the artistic or literary work, database,
or other material to which the Licensor applied this Public
License.
i. Licensed Rights means the rights granted to You subject to the
terms and conditions of this Public License, which are limited to
all Copyright and Similar Rights that apply to Your use of the
Licensed Material and that the Licensor has authority to license.
j. Licensor means the individual(s) or entity(ies) granting rights
under this Public License.
k. NonCommercial means not primarily intended for or directed towards
commercial advantage or monetary compensation. For purposes of
this Public License, the exchange of the Licensed Material for
other material subject to Copyright and Similar Rights by digital
file-sharing or similar means is NonCommercial provided there is
no payment of monetary compensation in connection with the
exchange.
l. Share means to provide material to the public by any means or
process that requires permission under the Licensed Rights, such
as reproduction, public display, public performance, distribution,
dissemination, communication, or importation, and to make material
available to the public including in ways that members of the
public may access the material from a place and at a time
individually chosen by them.
m. Sui Generis Database Rights means rights other than copyright
resulting from Directive 96/9/EC of the European Parliament and of
the Council of 11 March 1996 on the legal protection of databases,
as amended and/or succeeded, as well as other essentially
equivalent rights anywhere in the world.
n. You means the individual or entity exercising the Licensed Rights
under this Public License. Your has a corresponding meaning.
Section 2 -- Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License,
the Licensor hereby grants You a worldwide, royalty-free,
non-sublicensable, non-exclusive, irrevocable license to
exercise the Licensed Rights in the Licensed Material to:
a. reproduce and Share the Licensed Material, in whole or
in part, for NonCommercial purposes only; and
b. produce, reproduce, and Share Adapted Material for
NonCommercial purposes only.
2. Exceptions and Limitations. For the avoidance of doubt, where
Exceptions and Limitations apply to Your use, this Public
License does not apply, and You do not need to comply with
its terms and conditions.
3. Term. The term of this Public License is specified in Section
6(a).
4. Media and formats; technical modifications allowed. The
Licensor authorizes You to exercise the Licensed Rights in
all media and formats whether now known or hereafter created,
and to make technical modifications necessary to do so. The
Licensor waives and/or agrees not to assert any right or
authority to forbid You from making technical modifications
necessary to exercise the Licensed Rights, including
technical modifications necessary to circumvent Effective
Technological Measures. For purposes of this Public License,
simply making modifications authorized by this Section 2(a)
(4) never produces Adapted Material.
5. Downstream recipients.
a. Offer from the Licensor -- Licensed Material. Every
recipient of the Licensed Material automatically
receives an offer from the Licensor to exercise the
Licensed Rights under the terms and conditions of this
Public License.
b. Additional offer from the Licensor -- Adapted Material.
Every recipient of Adapted Material from You
automatically receives an offer from the Licensor to
exercise the Licensed Rights in the Adapted Material
under the conditions of the Adapter's License You apply.
c. No downstream restrictions. You may not offer or impose
any additional or different terms or conditions on, or
apply any Effective Technological Measures to, the
Licensed Material if doing so restricts exercise of the
Licensed Rights by any recipient of the Licensed
Material.
6. No endorsement. Nothing in this Public License constitutes or
may be construed as permission to assert or imply that You
are, or that Your use of the Licensed Material is, connected
with, or sponsored, endorsed, or granted official status by,
the Licensor or others designated to receive attribution as
provided in Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not
licensed under this Public License, nor are publicity,
privacy, and/or other similar personality rights; however, to
the extent possible, the Licensor waives and/or agrees not to
assert any such rights held by the Licensor to the limited
extent necessary to allow You to exercise the Licensed
Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this
Public License.
3. To the extent possible, the Licensor waives any right to
collect royalties from You for the exercise of the Licensed
Rights, whether directly or through a collecting society
under any voluntary or waivable statutory or compulsory
licensing scheme. In all other cases the Licensor expressly
reserves any right to collect such royalties, including when
the Licensed Material is used other than for NonCommercial
purposes.
Section 3 -- License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the
following conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified
form), You must:
a. retain the following if it is supplied by the Licensor
with the Licensed Material:
i. identification of the creator(s) of the Licensed
Material and any others designated to receive
attribution, in any reasonable manner requested by
the Licensor (including by pseudonym if
designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of
warranties;
v. a URI or hyperlink to the Licensed Material to the
extent reasonably practicable;
b. indicate if You modified the Licensed Material and
retain an indication of any previous modifications; and
c. indicate the Licensed Material is licensed under this
Public License, and include the text of, or the URI or
hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any
reasonable manner based on the medium, means, and context in
which You Share the Licensed Material. For example, it may be
reasonable to satisfy the conditions by providing a URI or
hyperlink to a resource that includes the required
information.
3. If requested by the Licensor, You must remove any of the
information required by Section 3(a)(1)(A) to the extent
reasonably practicable.
b. ShareAlike.
In addition to the conditions in Section 3(a), if You Share
Adapted Material You produce, the following conditions also apply.
1. The Adapter's License You apply must be a Creative Commons
license with the same License Elements, this version or
later, or a BY-NC-SA Compatible License.
2. You must include the text of, or the URI or hyperlink to, the
Adapter's License You apply. You may satisfy this condition
in any reasonable manner based on the medium, means, and
context in which You Share Adapted Material.
3. You may not offer or impose any additional or different terms
or conditions on, or apply any Effective Technological
Measures to, Adapted Material that restrict exercise of the
rights granted under the Adapter's License You apply.
Section 4 -- Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that
apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
to extract, reuse, reproduce, and Share all or a substantial
portion of the contents of the database for NonCommercial purposes
only;
b. if You include all or a substantial portion of the database
contents in a database in which You have Sui Generis Database
Rights, then the database in which You have Sui Generis Database
Rights (but not its individual contents) is Adapted Material,
including for purposes of Section 3(b); and
c. You must comply with the conditions in Section 3(a) if You Share
all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not
replace Your obligations under this Public License where the Licensed
Rights include other Copyright and Similar Rights.
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
c. The disclaimer of warranties and limitation of liability provided
above shall be interpreted in a manner that, to the extent
possible, most closely approximates an absolute disclaimer and
waiver of all liability.
Section 6 -- Term and Termination.
a. This Public License applies for the term of the Copyright and
Similar Rights licensed here. However, if You fail to comply with
this Public License, then Your rights under this Public License
terminate automatically.
b. Where Your right to use the Licensed Material has terminated under
Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided
it is cured within 30 days of Your discovery of the
violation; or
2. upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any
right the Licensor may have to seek remedies for Your violations
of this Public License.
c. For the avoidance of doubt, the Licensor may also offer the
Licensed Material under separate terms or conditions or stop
distributing the Licensed Material at any time; however, doing so
will not terminate this Public License.
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
License.
Section 7 -- Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different
terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the
Licensed Material not stated herein are separate from and
independent of the terms and conditions of this Public License.
Section 8 -- Interpretation.
a. For the avoidance of doubt, this Public License does not, and
shall not be interpreted to, reduce, limit, restrict, or impose
conditions on any use of the Licensed Material that could lawfully
be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is
deemed unenforceable, it shall be automatically reformed to the
minimum extent necessary to make it enforceable. If the provision
cannot be reformed, it shall be severed from this Public License
without affecting the enforceability of the remaining terms and
conditions.
c. No term or condition of this Public License will be waived and no
failure to comply consented to unless expressly agreed to by the
Licensor.
d. Nothing in this Public License constitutes or may be interpreted
as a limitation upon, or waiver of, any privileges and immunities
that apply to the Licensor or You, including from the legal
processes of any jurisdiction or authority.
=======================================================================
Creative Commons is not a party to its public
licenses. Notwithstanding, Creative Commons may elect to apply one of
its public licenses to material it publishes and in those instances
will be considered the “Licensor.” The text of the Creative Commons
public licenses is dedicated to the public domain under the CC0 Public
Domain Dedication. Except for the limited purpose of indicating that
material is shared under a Creative Commons public license or as
otherwise permitted by the Creative Commons policies published at
creativecommons.org/policies, Creative Commons does not authorize the
use of the trademark "Creative Commons" or any other trademark or logo
of Creative Commons without its prior written consent including,
without limitation, in connection with any unauthorized modifications
to any of its public licenses or any other arrangements,
understandings, or agreements concerning use of licensed material. For
the avoidance of doubt, this paragraph does not form part of the
public licenses.
Creative Commons may be contacted at creativecommons.org.
-387
View File
@@ -1,387 +0,0 @@
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
+1610
View File
File diff suppressed because it is too large. Load diff
+7
View File
@@ -0,0 +1,7 @@
// Add your dependencies here
dependencies {
implementation('com.github.GTNewHorizons:NotEnoughItems:2.4.13-GTNH:dev')
shadowImplementation('au.com.bytecode:opencsv:2.4')
}
+63
View File
@@ -0,0 +1,63 @@
modName = Waila
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
modId = Waila
modGroup = mcp.mobius.waila
# WHY is there no version field?
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
# Will update your build.gradle automatically whenever an update is available
autoUpdateBuildScript = false
minecraftVersion = 1.7.10
forgeVersion = 10.13.4.1614
# Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you
# restart Minecraft in development. Choose this dependent on your mod:
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
developmentEnvironmentUserName = Developer
# Define a source file of your project with:
# public static final String VERSION = "GRADLETOKEN_VERSION";
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
# version in @Mod([...], version = VERSION, [...])
# Leave these properties empty to skip individual token replacements
replaceGradleTokenInFile = Waila.java
gradleTokenModId =
gradleTokenModName =
gradleTokenVersion = GRADLETOKEN_VERSION
gradleTokenGroupName =
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise you can
# leave this property empty.
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
apiPackage = api
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
# Example value: mymodid_at.cfg
accessTransformersFile = Waila_at.cfg
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
mixinPlugin =
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
mixinsPackage =
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
# This parameter is for legacy compatibility only
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
coreModClass =
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
containsMixinsAndOrCoreModOnly = false
# If enabled, you may use 'shadowImplementation' for dependencies. They will be integrated in your jar. It is your
# responsibility check the licence and request permission for distribution, if required.
usesShadowedDependencies = true
# Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories
includeWellKnownRepositories = true
Binary file not shown.
+6
View File
@@ -0,0 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored Executable
+244
View File
@@ -0,0 +1,244 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# 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
#
# https://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.
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"
Vendored
+92
View File
@@ -0,0 +1,92 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
+2
View File
@@ -0,0 +1,2 @@
before_install:
- ./gradlew setupCIWorkspace
-35
View File
@@ -1,35 +0,0 @@
package mcp.mobius.waila;
public final class Constants {
public static String BIND_SCREEN_WIKI = "showwiki";
public static String BIND_SCREEN_TECH = "showtechtree";
public static String BIND_SCREEN_ENCH = "showenchant";
public static String BIND_WAILA_CFG = "waila.keybind.wailaconfig";
public static String BIND_WAILA_SHOW = "waila.keybind.wailadisplay";
public static String BIND_WAILA_LIQUID = "waila.keybind.liquid";
public static String BIND_WAILA_RECIPE = "waila.keybind.recipe";
public static String BIND_WAILA_USAGE = "waila.keybind.usage";
public static String BIND_WAILA_TESTING= "waila.keybind.testing";
public static String CFG_NEI_SHOW = "world.highlight_tips";
public static String BIND_NEI_SHOW = "keys.world.highlight_tips";
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";
}
@@ -1,30 +0,0 @@
package mcp.mobius.waila;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
public class WailaExceptionHandler {
public WailaExceptionHandler() {}
private static ArrayList<String> errs = new ArrayList<String>();
public static List<String> handleErr(Throwable e, String className, List<String> currenttip){
if (!errs.contains(className)){
errs.add(className);
for (StackTraceElement elem : e.getStackTrace()){
mod_Waila.log.log(Level.WARNING, String.format("%s.%s:%s",elem.getClassName(), elem.getMethodName(), elem.getLineNumber()));
if (elem.getClassName().contains("waila")) break;
}
mod_Waila.log.log(Level.WARNING, String.format("Catched unhandled exception : [%s] %s",className,e));
}
if (currenttip != null)
currenttip.add("<ERROR>");
return currenttip;
}
}
-103
View File
@@ -1,103 +0,0 @@
package mcp.mobius.waila.addons;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Set;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.api.IWailaConfigHandler;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.Property;
public class ConfigHandler implements IWailaConfigHandler {
private static ConfigHandler instance = null;
private LinkedHashMap<String, ConfigModule> modules = new LinkedHashMap<String, ConfigModule>();
private ArrayList<String> serverconfigs = new ArrayList<String>();
private ConfigHandler() {
instance = this;
}
public static ConfigHandler instance(){
if (ConfigHandler.instance == null)
ConfigHandler.instance = new ConfigHandler();
return ConfigHandler.instance;
}
public void addModule(String modName, HashMap<String, String> options){
this.addModule(modName, new ConfigModule(modName, options));
}
public void addModule(String modName, ConfigModule options){
this.modules.put(modName, options);
}
@Override
public Set<String> getModuleNames(){
return this.modules.keySet();
}
@Override
public HashMap<String, String> getConfigKeys(String modName){
if (this.modules.containsKey(modName))
return this.modules.get(modName).options;
else
return null;
}
public void addConfig(String modName, String key, String name){
if (!this.modules.containsKey(modName))
this.modules.put(modName, new ConfigModule(modName));
this.modules.get(modName).addOption(key, name);
}
public void addConfigServer(String modName, String key, String name){
if (!this.modules.containsKey(modName))
this.modules.put(modName, new ConfigModule(modName));
this.modules.get(modName).addOption(key, name);
this.serverconfigs.add(key);
}
@Override
public boolean getConfig(String key, boolean defvalue){
mod_Waila.instance.config.load();
if (this.serverconfigs.contains(key) && !mod_Waila.instance.serverPresent)
return false;
Property prop = mod_Waila.instance.config.get(Configuration.CATEGORY_GENERAL, key, defvalue);
return prop.getBoolean(defvalue);
}
public boolean isServerRequired(String key){
return this.serverconfigs.contains(key);
}
@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();
}
}
-24
View File
@@ -1,24 +0,0 @@
package mcp.mobius.waila.addons;
import java.util.HashMap;
public class ConfigModule {
String modName;
HashMap<String, String> options;
public ConfigModule(String _modName){
this.modName = _modName;
this.options = new HashMap<String, String>();
}
public ConfigModule(String _modName, HashMap<String, String> _options) {
this.modName = _modName;
this.options = _options;
}
public void addOption(String key, String name){
this.options.put(key,name);
}
}
@@ -1,397 +0,0 @@
package mcp.mobius.waila.addons;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import au.com.bytecode.opencsv.CSVReader;
import net.minecraft.block.Block;
import codechicken.lib.lang.LangUtil;
import codechicken.nei.api.API;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.api.IWailaBlockDecorator;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.IWailaRegistrar;
import mcp.mobius.waila.api.IWailaSummaryProvider;
import mcp.mobius.waila.handlers.hud.HUDHandlerExternal;
public class ExternalModulesHandler implements IWailaRegistrar {
private static ExternalModulesHandler instance = null;
public LinkedHashMap<Integer, ArrayList<IWailaDataProvider>> headProviders = new LinkedHashMap<Integer, ArrayList<IWailaDataProvider>>();
public LinkedHashMap<Integer, ArrayList<IWailaDataProvider>> bodyProviders = new LinkedHashMap<Integer, ArrayList<IWailaDataProvider>>();
public LinkedHashMap<Integer, ArrayList<IWailaDataProvider>> tailProviders = new LinkedHashMap<Integer, ArrayList<IWailaDataProvider>>();
public LinkedHashMap<Integer, ArrayList<IWailaDataProvider>> stackProviders = new LinkedHashMap<Integer, ArrayList<IWailaDataProvider>>();
public LinkedHashMap<Class, ArrayList<IWailaDataProvider>> headBlockProviders = new LinkedHashMap<Class, ArrayList<IWailaDataProvider>>();
public LinkedHashMap<Class, ArrayList<IWailaDataProvider>> bodyBlockProviders = new LinkedHashMap<Class, ArrayList<IWailaDataProvider>>();
public LinkedHashMap<Class, ArrayList<IWailaDataProvider>> tailBlockProviders = new LinkedHashMap<Class, ArrayList<IWailaDataProvider>>();
public LinkedHashMap<Class, ArrayList<IWailaDataProvider>> stackBlockProviders = new LinkedHashMap<Class, ArrayList<IWailaDataProvider>>();
public LinkedHashMap<Integer, ArrayList<IWailaBlockDecorator>> blockIdDecorators = new LinkedHashMap<Integer, ArrayList<IWailaBlockDecorator>>();
public LinkedHashMap<Class, ArrayList<IWailaBlockDecorator>> blockClassDecorators = new LinkedHashMap<Class, ArrayList<IWailaBlockDecorator>>();
public LinkedHashMap<String, LinkedHashMap <String, LinkedHashMap <String, String>>> wikiDescriptions = new LinkedHashMap<String, LinkedHashMap <String, LinkedHashMap <String, String>>>();
public LinkedHashMap<Class, ArrayList<IWailaSummaryProvider>> summaryProviders = new LinkedHashMap<Class, ArrayList<IWailaSummaryProvider>>();
private ExternalModulesHandler() {
instance = this;
}
public static ExternalModulesHandler instance(){
if (ExternalModulesHandler.instance == null)
ExternalModulesHandler.instance = new ExternalModulesHandler();
return ExternalModulesHandler.instance;
}
@Override
public void addConfig(String modname, String key, String configname) {
ConfigHandler.instance().addConfig(modname, key, LangUtil.translateG(configname));
}
@Override
public void addConfigRemote(String modname, String key, String configname) {
ConfigHandler.instance().addConfigServer(modname, key, LangUtil.translateG(configname));
}
@Override
public void addConfig(String modname, String key) {
ConfigHandler.instance().addConfig(modname, key, LangUtil.translateG("option." + key));
}
@Override
public void addConfigRemote(String modname, String key) {
ConfigHandler.instance().addConfigServer(modname, key, LangUtil.translateG("option." + key));
}
@Override
public void registerHeadProvider(IWailaDataProvider dataProvider, int blockID) {
if (!this.headProviders.containsKey(blockID))
this.headProviders.put(blockID, new ArrayList<IWailaDataProvider>());
this.headProviders.get(blockID).add(dataProvider);
}
@Override
public void registerHeadProvider(IWailaDataProvider dataProvider, Class block) {
if (!this.headBlockProviders.containsKey(block))
this.headBlockProviders.put(block, new ArrayList<IWailaDataProvider>());
this.headBlockProviders.get(block).add(dataProvider);
}
@Override
public void registerBodyProvider(IWailaDataProvider dataProvider, int blockID) {
if (!this.bodyProviders.containsKey(blockID))
this.bodyProviders.put(blockID, new ArrayList<IWailaDataProvider>());
this.bodyProviders.get(blockID).add(dataProvider);
}
@Override
public void registerBodyProvider(IWailaDataProvider dataProvider, Class block) {
if (!this.bodyBlockProviders.containsKey(block))
this.bodyBlockProviders.put(block, new ArrayList<IWailaDataProvider>());
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>());
this.tailBlockProviders.get(block).add(dataProvider);
}
@Override
public void registerStackProvider(IWailaDataProvider dataProvider, int blockID) {
if (!this.stackProviders.containsKey(blockID))
this.stackProviders.put(blockID, new ArrayList<IWailaDataProvider>());
this.stackProviders.get(blockID).add(dataProvider);
API.registerHighlightIdentifier(blockID, new HUDHandlerExternal());
}
@Override
public void registerStackProvider(IWailaDataProvider dataProvider, Class block) {
for (int i = 0; i < Block.blocksList.length; i++)
if (block.isInstance(Block.blocksList[i])){
this.registerStackProvider(dataProvider, i);
}
}
@Override
public void registerShortDataProvider(IWailaSummaryProvider dataProvider, Class item) {
if (!this.summaryProviders.containsKey(item))
this.summaryProviders.put(item, new ArrayList<IWailaSummaryProvider>());
this.summaryProviders.get(item).add(dataProvider);
}
@Override
public void registerBlockDecorator(IWailaBlockDecorator decorator, int blockID) {
if (!this.blockIdDecorators.containsKey(blockID))
this.blockIdDecorators.put(blockID, new ArrayList<IWailaBlockDecorator>());
this.blockIdDecorators.get(blockID).add(decorator);
}
@Override
public void registerBlockDecorator(IWailaBlockDecorator decorator, Class block) {
if (!this.blockClassDecorators.containsKey(block))
this.blockClassDecorators.put(block, new ArrayList<IWailaBlockDecorator>());
this.blockClassDecorators.get(block).add(decorator);
}
/* Arrays getters */
public ArrayList<IWailaDataProvider> getHeadProviders(int blockID) {
return this.headProviders.get(blockID);
}
public ArrayList<IWailaDataProvider> getBodyProviders(int blockID) {
return this.bodyProviders.get(blockID);
}
public ArrayList<IWailaDataProvider> getTailProviders(int blockID) {
return this.tailProviders.get(blockID);
}
public ArrayList<IWailaDataProvider> getHeadProviders(Object block) {
ArrayList<IWailaDataProvider> returnList = new ArrayList<IWailaDataProvider>();
for (Class clazz : this.headBlockProviders.keySet())
if (clazz.isInstance(block))
returnList.addAll(this.headBlockProviders.get(clazz));
return returnList;
}
public ArrayList<IWailaDataProvider> getBodyProviders(Object block) {
ArrayList<IWailaDataProvider> returnList = new ArrayList<IWailaDataProvider>();
for (Class clazz : this.bodyBlockProviders.keySet())
if (clazz.isInstance(block))
returnList.addAll(this.bodyBlockProviders.get(clazz));
return returnList;
}
public ArrayList<IWailaDataProvider> getTailProviders(Object block) {
ArrayList<IWailaDataProvider> returnList = new ArrayList<IWailaDataProvider>();
for (Class clazz : this.bodyBlockProviders.keySet())
if (clazz.isInstance(block))
returnList.addAll(this.bodyBlockProviders.get(clazz));
return returnList;
}
public ArrayList<IWailaDataProvider> getStackProviders(int blockID) {
return this.stackProviders.get(blockID);
}
public ArrayList<IWailaSummaryProvider> getSummaryProvider(Object item){
ArrayList<IWailaSummaryProvider> returnList = new ArrayList<IWailaSummaryProvider>();
for (Class clazz : this.summaryProviders.keySet())
if (clazz.isInstance(item))
returnList.addAll(this.summaryProviders.get(clazz));
return returnList;
}
public ArrayList<IWailaBlockDecorator> getBlockDecorators(int blockID){
return this.blockIdDecorators.get(blockID);
}
public ArrayList<IWailaBlockDecorator> getBlockDecorators(Object block){
ArrayList<IWailaBlockDecorator> returnList = new ArrayList<IWailaBlockDecorator>();
for (Class clazz : this.blockClassDecorators.keySet())
if (clazz.isInstance(block))
returnList.addAll(this.blockClassDecorators.get(clazz));
return returnList;
}
/* Providers querry methods */
public boolean hasHeadProviders(int blockID){
return this.headProviders.containsKey(blockID);
}
public boolean hasBodyProviders(int blockID){
return this.bodyProviders.containsKey(blockID);
}
public boolean hasTailProviders(int blockID){
return this.tailProviders.containsKey(blockID);
}
public boolean hasStackProviders(int blockID){
return this.stackProviders.containsKey(blockID);
}
public boolean hasHeadProviders(Object block){
for (Class clazz : this.headBlockProviders.keySet())
if (clazz.isInstance(block))
return true;
return false;
}
public boolean hasBodyProviders(Object block){
for (Class clazz : this.bodyBlockProviders.keySet())
if (clazz.isInstance(block))
return true;
return false;
}
public boolean hasTailProviders(Object block){
for (Class clazz : this.tailBlockProviders.keySet())
if (clazz.isInstance(block))
return true;
return false;
}
public boolean hasSummaryProvider(Class item){
return this.summaryProviders.containsKey(item);
}
public boolean hasBlockDecorator(int blockID){
return this.blockIdDecorators.containsKey(blockID);
}
public boolean hasBlockDecorator(Object block){
for (Class clazz : this.blockClassDecorators.keySet())
if (clazz.isInstance(block))
return true;
return false;
}
/* ----------------- */
@Override
public void registerDocTextFile(String filename) {
List<String[]> docData = null;
int nentries = 0;
try{
docData = this.readFileAsString(filename);
} catch (IOException e){
mod_Waila.log.log(Level.WARNING, String.format("Error while accessing file %s : %s", filename, e));
return;
}
for (String[] ss : docData){
String modid = ss[0];
String name = ss[1];
String meta = ss[2];
String desc = ss[5].replace('$', '\n');
if (!(desc.trim().equals(""))){
if (!this.wikiDescriptions.containsKey(modid))
this.wikiDescriptions.put(modid, new LinkedHashMap <String, LinkedHashMap <String, String>>());
if (!this.wikiDescriptions.get(modid).containsKey(name))
this.wikiDescriptions.get(modid).put(name, new LinkedHashMap<String, String>());
this.wikiDescriptions.get(modid).get(name).put(meta, desc);
System.out.printf("Registered %s %s %s\n", modid, name, meta);
nentries += 1;
}
}
/*
String[] sections = docData.split(">>>>");
for (String s : sections){
s.trim();
if (!s.equals("")){
try{
String name = s.split("\r?\n",2)[0].trim();
String desc = s.split("\r?\n",2)[1].trim();
if (!this.wikiDescriptions.containsKey(modid))
this.wikiDescriptions.put(modid, new LinkedHashMap <String, String>());
this.wikiDescriptions.get(modid).put(name, desc);
nentries += 1;
}catch (Exception e){
System.out.printf("%s\n", e);
}
}
}
*/
mod_Waila.log.log(Level.INFO, String.format("Registered %s entries from %s", nentries, filename));
}
public boolean hasDocTextModID(String modid){
return this.wikiDescriptions.containsKey(modid);
}
public boolean hasDocTextItem(String modid, String item){
if (this.hasDocTextModID(modid))
return this.wikiDescriptions.get(modid).containsKey(item);
return false;
}
public boolean hasDocTextMeta(String modid, String item, String meta){
if (this.hasDocTextItem(modid, item))
return this.wikiDescriptions.get(modid).get(item).containsKey(meta);
return false;
}
public LinkedHashMap<String, String> getDocText(String modid, String name){
return this.wikiDescriptions.get(modid).get(name);
}
public String getDocText(String modid, String name, String meta){
return this.wikiDescriptions.get(modid).get(name).get(meta);
}
public boolean hasDocTextSpecificMeta(String modid, String name, String meta){
for (String s : this.getDocText(modid, name).keySet())
if (s.equals(meta))
return true;
return false;
}
public String getDoxTextWildcardMatch(String modid, String name){
Set<String> keys = this.wikiDescriptions.get(modid).keySet();
for (String s : keys){
String regexed = s;
regexed = regexed.replace(".", "\\.");
regexed = regexed.replace("*", ".*");
if (name.matches(s))
return s;
}
return null;
}
private List<String[]> readFileAsString(String filePath) throws IOException {
// URL fileURL = this.getClass().getResource(filePath);
// File filedata = new File(fileURL);
// Reader paramReader = new InputStreamReader(this.getClass().getResourceAsStream(filePath));
InputStream in = getClass().getResourceAsStream(filePath);
BufferedReader input = new BufferedReader(new InputStreamReader(in));
CSVReader reader = new CSVReader(input);
List<String[]> myEntries = reader.readAll();
reader.close();
return myEntries;
/*
StringBuffer fileData = new StringBuffer();
//BufferedReader reader = new BufferedReader(paramReader);
char[] buf = new char[1024];
int numRead=0;
while((numRead=input.read(buf)) != -1){
String readData = String.valueOf(buf, 0, numRead);
fileData.append(readData);
}
input.close();
return fileData.toString();
*/
}
}
@@ -1,43 +0,0 @@
package mcp.mobius.waila.addons.appeng;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.logging.Level;
import codechicken.lib.lang.LangUtil;
import net.minecraftforge.common.ForgeDirection;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ExternalModulesHandler;
public class AppEngModule {
public static Class TileStorageMonitor = null;
public static Class IAEItemStack = null;
public static Method TileStorageMonitor_getItem = null;
public static Method IAEItemStack_getItemStack = null;
public static void register(){
try{
TileStorageMonitor = Class.forName("appeng.me.tile.TileStorageMonitor");
IAEItemStack = Class.forName("appeng.api.IAEItemStack");
TileStorageMonitor_getItem = TileStorageMonitor.getMethod("getItem");
IAEItemStack_getItemStack = IAEItemStack.getMethod("getItemStack");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.WARNING, "[AppEng] Class not found. " + e);
return;
} catch (SecurityException e) {
mod_Waila.log.log(Level.WARNING, "[AppEng] Security Exception. " + e);
return;
} catch (NoSuchMethodException e) {
mod_Waila.log.log(Level.WARNING, "[AppEng] Method not found. " + e);
return;
}
mod_Waila.log.log(Level.INFO, "AppEng mod found.");
ExternalModulesHandler.instance().addConfig("Applied Energetic", "appeng.monitorcontent");
ExternalModulesHandler.instance().registerBodyProvider(new HUDAppEngMonitor(), TileStorageMonitor);
}
}
@@ -1,50 +0,0 @@
package mcp.mobius.waila.addons.appeng;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import codechicken.lib.lang.LangUtil;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDAppEngMonitor 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) {
TileEntity entity = accessor.getTileEntity();
if (entity != null){
if (config.getConfig("appeng.monitorcontent")){
try {
ItemStack stack = (ItemStack)AppEngModule.IAEItemStack_getItemStack.invoke(AppEngModule.IAEItemStack.cast(AppEngModule.TileStorageMonitor_getItem.invoke(entity)));
if (stack != null)
currenttip.add(stack.getDisplayName());
else
currenttip.add(LangUtil.translateG("hud.msg.none"));
} catch (Exception e) {
System.out.printf("%s\n", e);
}
}
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -1,41 +0,0 @@
package mcp.mobius.waila.addons.betterbarrels;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.logging.Level;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ExternalModulesHandler;
import codechicken.lib.lang.LangUtil;
import codechicken.nei.api.API;
import codechicken.nei.api.ItemInfo;
public class BetterBarrelsModule {
public static Class TileEntityBarrel = null;
public static Class IBarrelStorage = null;
public static Field TileEntityBarrel_Storage = null;
public static Method IBarrelStorage_getItem = null;
public static void register(){
try{
TileEntityBarrel = Class.forName("mcp.mobius.betterbarrels.common.TileEntityBarrel");
IBarrelStorage = Class.forName("mcp.mobius.betterbarrels.common.IBarrelStorage");
TileEntityBarrel_Storage = TileEntityBarrel.getField("storage");
IBarrelStorage_getItem = IBarrelStorage.getMethod("getItem");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.WARNING, "[BB] BetterBarrel classes not found.");
} catch (NoSuchFieldException e){
mod_Waila.log.log(Level.WARNING, "[BB] Storage field not found.");
} catch (NoSuchMethodException e){
mod_Waila.log.log(Level.WARNING, "[BB] getItem() not found.");
}
if (IBarrelStorage_getItem != null){
mod_Waila.log.log(Level.INFO, "Waila module BetterBarrel succefully hooked.");
ExternalModulesHandler.instance().addConfig("BetterBarrels", "bb.content");
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerBBContent(), TileEntityBarrel);
}
}
}
@@ -1,64 +0,0 @@
package mcp.mobius.waila.addons.betterbarrels;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.List;
import java.util.logging.Level;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
//import mcp.mobius.betterbarrels.common.TileEntityBarrel;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import codechicken.lib.lang.LangUtil;
import codechicken.nei.api.API;
import codechicken.nei.api.ItemInfo;
import codechicken.nei.api.ItemInfo.Layout;
import codechicken.nei.api.IHighlightHandler;
public class HUDHandlerBBContent 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) {
TileEntity entity = accessor.getTileEntity();
if (!config.getConfig("bb.content")) return currenttip;
if ((entity != null) && (BetterBarrelsModule.TileEntityBarrel.isInstance(entity))){
ItemStack stack = null;
try {
stack = (ItemStack) BetterBarrelsModule.IBarrelStorage_getItem.invoke(BetterBarrelsModule.TileEntityBarrel_Storage.get(entity));
} catch (Exception e){
mod_Waila.log.log(Level.SEVERE, "[BB] Unhandled exception trying to access a barrel storage for display !.\n" + String.valueOf(e));
currenttip.add("<ERROR!>");
return currenttip;
}
if (stack != null){
currenttip.add(stack.getDisplayName());
} else {
currenttip.add(LangUtil.translateG("hud.msg.empty"));
}
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -1,47 +0,0 @@
package mcp.mobius.waila.addons.buildcraft;
import java.lang.reflect.Method;
import java.util.logging.Level;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ExternalModulesHandler;
import net.minecraftforge.common.ForgeDirection;
public class BCModule {
public static Class TileTank = null;
public static Class IPowerReceptor = null;
public static Class PipeTransportPower = null;
public static Class TileGenericPipe = null;
public static Class TileEngine = null;
public static Method TileTank_getTankInfo = null;
public static void register(){
try {
Class ModBuildcraftFactory = Class.forName("buildcraft.BuildCraftFactory");
mod_Waila.log.log(Level.INFO, "Buildcraft|Factory mod found.");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.INFO, "Buildcraft|Factory mod not found. Skipping.");
return;
}
try{
TileTank = Class.forName("buildcraft.factory.TileTank");
TileTank_getTankInfo = TileTank.getMethod("getTankInfo", ForgeDirection.class);
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.WARNING, "[BC] Class not found. " + e);
return;
} catch (NoSuchMethodException e){
mod_Waila.log.log(Level.WARNING, "[BC] Method not found." + e);
return;
}
ExternalModulesHandler.instance().addConfig("Buildcraft", "bc.tankamount");
ExternalModulesHandler.instance().addConfig("Buildcraft", "bc.tanktype");
ExternalModulesHandler.instance().registerHeadProvider(new HUDHandlerBCTanks(), TileTank);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerBCTanks(), TileTank);
}
}
@@ -1,79 +0,0 @@
package mcp.mobius.waila.addons.buildcraft;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.logging.Level;
import net.minecraftforge.common.ForgeDirection;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ExternalModulesHandler;
public class BCPowerAPIModule {
public static Class PowerHandler = null;
public static Method PH_getMinEnergyReceived = null;
public static Method PH_getMaxEnergyReceived = null;
public static Method PH_getMaxEnergyStored = null;
public static Method PH_getEnergyStored = null;
public static Method PH_getActivationEnergy = null;
public static Class IPowerReceptor = null;
public static Method IPowerReceptor_getPowerReceiver = null;
public static Class PowerReceiver = null;
public static Method PR_getMinEnergyReceived = null;
public static Method PR_getMaxEnergyReceived = null;
public static Method PR_getMaxEnergyStored = null;
public static Method PR_getEnergyStored = null;
public static Method PR_getActivationEnergy = null;
public static void register(){
try{
Class ModClass = Class.forName("buildcraft.api.power.IPowerReceptor");
mod_Waila.log.log(Level.INFO, "Buildcraft Power API found.");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.INFO, "[Buildcraft Power API] Buildcraft Power API mod not found.");
return;
}
try{
PowerHandler = Class.forName("buildcraft.api.power.PowerHandler");
PH_getMinEnergyReceived = PowerHandler.getMethod("getMinEnergyReceived");
PH_getMaxEnergyReceived = PowerHandler.getMethod("getMaxEnergyReceived");
PH_getMaxEnergyStored = PowerHandler.getMethod("getMaxEnergyStored");
PH_getEnergyStored = PowerHandler.getMethod("getEnergyStored");
PH_getActivationEnergy = PowerHandler.getMethod("getActivationEnergy");
IPowerReceptor = Class.forName("buildcraft.api.power.IPowerReceptor");
IPowerReceptor_getPowerReceiver = IPowerReceptor.getMethod("getPowerReceiver", ForgeDirection.class);
PowerReceiver = Class.forName("buildcraft.api.power.PowerHandler$PowerReceiver");
PR_getMinEnergyReceived = PowerReceiver.getMethod("getMinEnergyReceived");
PR_getMaxEnergyReceived = PowerReceiver.getMethod("getMaxEnergyReceived");
PR_getMaxEnergyStored = PowerReceiver.getMethod("getMaxEnergyStored");
PR_getEnergyStored = PowerReceiver.getMethod("getEnergyStored");
PR_getActivationEnergy = PowerReceiver.getMethod("getActivationEnergy");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Class not found. " + e);
return;
} catch (NoSuchMethodException e){
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Method not found." + e);
return;
// } catch (NoSuchFieldException e){
// mod_Waila.log.log(Level.WARNING, "[EnderStorage] Field not found." + e);
// return;
} catch (Exception e){
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Unhandled exception." + e);
return;
}
ExternalModulesHandler.instance().addConfigRemote("BuildcraftAPI", "bcapi.storage");
ExternalModulesHandler.instance().addConfig("BuildcraftAPI", "bcapi.consump");
ExternalModulesHandler.instance().addConfig("BuildcraftAPI", "bcapi.trigger");
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerIPowerReceptor(), IPowerReceptor);
}
}
@@ -1,78 +0,0 @@
package mcp.mobius.waila.addons.buildcraft;
import java.util.List;
import java.util.logging.Level;
//import buildcraft.factory.TileTank;
import codechicken.lib.lang.LangUtil;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ConfigHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import net.minecraftforge.liquids.ILiquidTank;
import net.minecraftforge.liquids.LiquidStack;
public class HUDHandlerBCTanks 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) {
FluidTankInfo tank = this.getTank(accessor);
FluidStack stack = tank != null ? tank.fluid : null;
String name = currenttip.get(0);
if (stack != null && ConfigHandler.instance().getConfig("bc.tanktype"))
name = name + " (" + stack.getFluid().getName() + ")";
else if (stack == null && ConfigHandler.instance().getConfig("bc.tanktype"))
name = name + " " + LangUtil.translateG("hud.msg.empty");
currenttip.set(0, name);
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
FluidTankInfo tank = this.getTank(accessor);
FluidStack stack = tank != null ? tank.fluid : null;
int liquidAmount = stack != null ? stack.amount:0;
int capacity = tank != null ? tank.capacity : 0;
if (ConfigHandler.instance().getConfig("bc.tankamount"))
currenttip.add(String.valueOf(liquidAmount) + "/" + String.valueOf(capacity) + " mB");
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;
try{
tank = ((FluidTankInfo[])BCModule.TileTank_getTankInfo.invoke(BCModule.TileTank.cast(accessor.getTileEntity()), ForgeDirection.UNKNOWN))[0];
} catch (Exception e){
mod_Waila.log.log(Level.SEVERE, "[BC] Unhandled exception trying to access a tank for display !.\n" + String.valueOf(e));
return null;
}
return tank;
}
}
@@ -1,76 +0,0 @@
package mcp.mobius.waila.addons.buildcraft;
import java.util.List;
import codechicken.lib.lang.LangUtil;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ForgeDirection;
import mcp.mobius.waila.WailaExceptionHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerIPowerReceptor implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
try{
String maxPowerStr = LangUtil.translateG("hud.msg.maxpower");
String triggerStr = LangUtil.translateG("hud.msg.trigger");
Object powerReceiver = BCPowerAPIModule.IPowerReceptor_getPowerReceiver.invoke(accessor.getTileEntity(), ForgeDirection.UNKNOWN);
if (powerReceiver != null){
Float minEnergyRecv = (Float)BCPowerAPIModule.PR_getMinEnergyReceived.invoke(powerReceiver);
Float maxEnergyRecv = (Float)BCPowerAPIModule.PR_getMaxEnergyReceived.invoke(powerReceiver);
Float activation = (Float)BCPowerAPIModule.PR_getActivationEnergy.invoke(powerReceiver);
if(accessor.getNBTData().hasKey("powerProvider") && accessor.getNBTData().getCompoundTag("powerProvider").hasKey("storedEnergy") && config.getConfig("bcapi.storage")){
Float energyStored = (Float)accessor.getNBTData().getCompoundTag("powerProvider").getFloat("storedEnergy");
Float maxEnergyStor = (Float)BCPowerAPIModule.PR_getMaxEnergyStored.invoke(powerReceiver);
if (maxEnergyStor != 0.0f)
currenttip.add(String.format("%.1f / %.1f MJ", energyStored, maxEnergyStor));
}
if(accessor.getNBTData().hasKey("storedEnergy") && config.getConfig("bcapi.storage")){
Float energyStored = (Float)accessor.getNBTData().getFloat("storedEnergy");
Float maxEnergyStor = (Float)BCPowerAPIModule.PR_getMaxEnergyStored.invoke(powerReceiver);
if (maxEnergyStor != 0.0f)
currenttip.add(String.format("%.1f / %.1f MJ", energyStored, maxEnergyStor));
}
if (maxEnergyRecv != 0.0f && config.getConfig("bcapi.consump"))
//currenttip.add(String.format("Min/Max Input : %.1f / %.1f MJ/t", minEnergyRecv, maxEnergyRecv));
currenttip.add(String.format("%s : %.1f MJ/t", maxPowerStr, maxEnergyRecv));
if (activation != 0.0f && config.getConfig("bcapi.trigger"))
currenttip.add(String.format("%s : %.1f MJ", triggerStr, activation));
}
} catch (Exception e) {
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -1,64 +0,0 @@
package mcp.mobius.waila.addons.enderio;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.logging.Level;
import net.minecraftforge.common.ForgeDirection;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ExternalModulesHandler;
public class EnderIOModule {
public static Class TileCapacitorBank = null;
public static Method TCB_getMaxInput = null;
public static Method TCB_getMaxOutput = null;
public static Method TCB_getEnergyStored = null;
public static Method TCB_getMaxEnergyStored = null;
public static Method TCB_getMaxIO = null;
public static Class TileTesseract = null;
public static void register(){
try{
Class ModClass = Class.forName("crazypants.enderio.EnderIO");
mod_Waila.log.log(Level.INFO, "EnderIO mod found.");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.INFO, "[EnderIO] EnderIO mod not found.");
return;
}
try{
TileCapacitorBank = Class.forName("crazypants.enderio.machine.power.TileCapacitorBank");
TCB_getEnergyStored = TileCapacitorBank.getMethod("getEnergyStored");
TCB_getMaxInput = TileCapacitorBank.getMethod("getMaxInput");
TCB_getMaxOutput = TileCapacitorBank.getMethod("getMaxOutput");
TCB_getMaxEnergyStored = TileCapacitorBank.getMethod("getMaxEnergyStored");
TCB_getMaxIO = TileCapacitorBank.getMethod("getMaxIO");
TileTesseract = Class.forName("crazypants.enderio.machine.hypercube.TileHyperCube");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Class not found. " + e);
return;
} catch (NoSuchMethodException e){
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Method not found." + e);
return;
// } catch (NoSuchFieldException e){
// mod_Waila.log.log(Level.WARNING, "[EnderStorage] Field not found." + e);
// return;
} catch (Exception e){
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Unhandled exception." + e);
return;
}
ExternalModulesHandler.instance().addConfig("EnderIO", "enderio.inout");
ExternalModulesHandler.instance().addConfig("EnderIO", "enderio.storage");
ExternalModulesHandler.instance().addConfig("EnderIO", "enderio.owner");
ExternalModulesHandler.instance().addConfig("EnderIO", "enderio.channel");
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerCapacitor(), TileCapacitorBank);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerTesseract(), TileTesseract);
}
}
@@ -1,61 +0,0 @@
package mcp.mobius.waila.addons.enderio;
import java.util.List;
import codechicken.lib.lang.LangUtil;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.WailaExceptionHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerCapacitor implements IWailaDataProvider{
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
try{
String maxIOStr = LangUtil.translateG("hud.msg.maxio");
String inputStr = LangUtil.translateG("hud.msg.input");
String outputStr = LangUtil.translateG("hud.msg.output");
Integer maxEnergyStored = (Integer)EnderIOModule.TCB_getMaxEnergyStored.invoke(accessor.getTileEntity());
Float energyStored = (Float)EnderIOModule.TCB_getEnergyStored.invoke(accessor.getTileEntity());
Integer maxIO = (Integer)EnderIOModule.TCB_getMaxIO.invoke(accessor.getTileEntity());
Integer maxInput = (Integer)EnderIOModule.TCB_getMaxInput.invoke(accessor.getTileEntity());
Integer maxOutput = (Integer)EnderIOModule.TCB_getMaxOutput.invoke(accessor.getTileEntity());
if (config.getConfig("enderio.storage"))
currenttip.add(String.format("%.1f / %d MJ", energyStored, maxEnergyStored));
if (config.getConfig("enderio.inout")){
currenttip.add(String.format("%s : %d MJ/t ", maxIOStr, maxIO));
currenttip.add(String.format("%s : %d MJ/t ", inputStr, maxInput));
currenttip.add(String.format("%s : %d MJ/t ", outputStr, maxOutput));
}
} catch (Exception e) {
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -1,63 +0,0 @@
package mcp.mobius.waila.addons.enderio;
import java.util.List;
import codechicken.lib.lang.LangUtil;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerTesseract implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
String channel = "%s : \u00a7f%s\u00a7r %s";
String freq;
String frequser;
String owner;
if (config.getConfig("enderio.channel")){
if (accessor.getNBTData().hasKey("channelName")){
freq = accessor.getNBTData().getString("channelName");
if (accessor.getNBTData().hasKey("channelUser"))
frequser = "[ \u00a7f" + accessor.getNBTData().getString("channelUser") + " \u00a7r]";
else
frequser = "[ \u00a7f" + LangUtil.translateG("hud.msg.public") + " \u00a7r]";
}
else{
freq = LangUtil.translateG("hud.msg.none");
frequser = "";
}
currenttip.add(String.format(channel, LangUtil.translateG("hud.msg.frequency"), freq, frequser));
}
if (config.getConfig("enderio.owner")){
if (accessor.getNBTData().hasKey("owner"))
currenttip.add(String.format("%s : \u00a7f%s", LangUtil.translateG("hud.msg.owner"), accessor.getNBTData().getString("owner")));
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -1,56 +0,0 @@
package mcp.mobius.waila.addons.enderstorage;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.logging.Level;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ExternalModulesHandler;
public class EnderStorageModule {
public static Class TileFrequencyOwner = null;
public static Field TileFrequencyOwner_Freq = null;
public static Class EnderStorageManager = null;
public static Method GetColourFromFreq = null;
public static Class TileEnderTank = null;
public static void register(){
try{
Class EnderStorage = Class.forName("codechicken.enderstorage.EnderStorage");
mod_Waila.log.log(Level.INFO, "EnderStorage mod found.");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.INFO, "[EnderStorage] EnderStorage mod not found.");
return;
}
try{
TileFrequencyOwner = Class.forName("codechicken.enderstorage.common.TileFrequencyOwner");
TileFrequencyOwner_Freq = TileFrequencyOwner.getField("freq");
EnderStorageManager = Class.forName("codechicken.enderstorage.api.EnderStorageManager");
GetColourFromFreq = EnderStorageManager.getDeclaredMethod("getColourFromFreq", Integer.TYPE, Integer.TYPE);
TileEnderTank = Class.forName("codechicken.enderstorage.storage.liquid.TileEnderTank");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Class not found. " + e);
return;
} catch (NoSuchMethodException e){
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Method not found." + e);
return;
} catch (NoSuchFieldException e){
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Field not found." + e);
return;
} catch (Exception e){
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Unhandled exception." + e);
return;
}
ExternalModulesHandler.instance().addConfig("EnderStorage", "enderstorage.colors");
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerStorage(), TileFrequencyOwner);
}
}
@@ -1,73 +0,0 @@
package mcp.mobius.waila.addons.enderstorage;
import java.util.List;
import codechicken.lib.lang.LangUtil;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.WailaExceptionHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerStorage implements IWailaDataProvider {
private static String[] colors = {
LangUtil.translateG("hud.msg.white"),
LangUtil.translateG("hud.msg.orange"),
LangUtil.translateG("hud.msg.magenta"),
LangUtil.translateG("hud.msg.lblue"),
LangUtil.translateG("hud.msg.yellow"),
LangUtil.translateG("hud.msg.lime"),
LangUtil.translateG("hud.msg.pink"),
LangUtil.translateG("hud.msg.gray"),
LangUtil.translateG("hud.msg.lgray"),
LangUtil.translateG("hud.msg.cyan"),
LangUtil.translateG("hud.msg.purple"),
LangUtil.translateG("hud.msg.blue"),
LangUtil.translateG("hud.msg.brown"),
LangUtil.translateG("hud.msg.green"),
LangUtil.translateG("hud.msg.red"),
LangUtil.translateG("hud.msg.black")
};
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
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("enderstorage.colors")){
try{
int freq = EnderStorageModule.TileFrequencyOwner_Freq.getInt(accessor.getTileEntity());
int freqLeft = (Integer)EnderStorageModule.GetColourFromFreq.invoke(null, freq, 0);
int freqCenter = (Integer)EnderStorageModule.GetColourFromFreq.invoke(null, freq, 1);
int freqRight = (Integer)EnderStorageModule.GetColourFromFreq.invoke(null, freq, 2);
if (!EnderStorageModule.TileEnderTank.isInstance(accessor.getTileEntity()))
currenttip.add(String.format("%s/%s/%s", colors[freqLeft], colors[freqCenter], colors[freqRight]));
else
currenttip.add(String.format("%s/%s/%s", colors[freqRight], colors[freqCenter], colors[freqLeft]));
} catch (Exception e){
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -1,83 +0,0 @@
package mcp.mobius.waila.addons.etb;
import java.lang.reflect.Field;
import java.util.logging.Level;
import net.minecraft.item.Item;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ExternalModulesHandler;
public class ETBModule {
public static Class TileSocket = null;
public static Field Socket_sides = null;
public static Field Socket_configs = null;
//public static Field Socket_sideID = null;
//public static Field Socket_sideMeta = null;
//public static Field Socket_facID = null;
//public static Field Socket_facMeta = null;
public static Class SocketsMod = null;
public static Field module = null;
public static Class SideConfig = null;
public static Field SC_tank = null;
public static Field SC_inventory = null;
public static Field SC_rsControl = null;
public static Field SC_rsLatch = null;
public static void register(){
try{
Class ModClass = Class.forName("emasher.sockets.TileSocket");
mod_Waila.log.log(Level.INFO, "Engineer Toolbox mod found.");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.INFO, "[Engineer Toolbox] Engineer Toolbox mod not found.");
return;
}
try{
TileSocket = Class.forName("emasher.sockets.TileSocket");
Socket_sides = TileSocket.getField("sides");
Socket_configs = TileSocket.getField("configs");
//Socket_sideID = TileSocket.getField("sideID");
//Socket_sideMeta = TileSocket.getField("sideMeta");
//Socket_facID = TileSocket.getField("facID");
//Socket_facMeta = TileSocket.getField("facMeta");
SocketsMod = Class.forName("emasher.sockets.SocketsMod");
module = SocketsMod.getField("module");
//module = (Item)SocketsMod.getField("module").get(null);
/*
if (module == null){
mod_Waila.log.log(Level.WARNING, "[Engineer Toolbox] module field is null !");
return;
}
*/
SideConfig = Class.forName("emasher.api.SideConfig");
SC_tank = SideConfig.getField("tank");
SC_inventory = SideConfig.getField("inventory");
SC_rsControl = SideConfig.getField("rsControl");
SC_rsLatch = SideConfig.getField("rsLatch");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.WARNING, "[Engineer Toolbox] Class not found. " + e);
return;
// } catch (NoSuchMethodException e){
// mod_Waila.log.log(Level.WARNING, "[Engineer Toolbox] Method not found." + e);
// return;
} catch (NoSuchFieldException e){
mod_Waila.log.log(Level.WARNING, "[Engineer Toolbox] Field not found." + e);
return;
} catch (Exception e){
mod_Waila.log.log(Level.WARNING, "[Engineer Toolbox] Unhandled exception." + e);
return;
}
ExternalModulesHandler.instance().addConfig("Engineer Toolbox", "etb.displaydata");
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerSocket(), TileSocket);
}
}
@@ -1,104 +0,0 @@
package mcp.mobius.waila.addons.etb;
import java.util.Arrays;
import java.util.List;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ForgeDirection;
import mcp.mobius.waila.WailaExceptionHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerSocket implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("etb.displaydata")) return currenttip;
try {
int[] sides = (int[])ETBModule.Socket_sides.get(accessor.getTileEntity());
Object[] configs = (Object[])ETBModule.Socket_configs.get(accessor.getTileEntity());
Item module = (Item)ETBModule.module.get(null);
for( int s = 0; s < 6; s++){
if (sides[s] != 0){
int tank = (Integer)ETBModule.SC_tank.get(configs[s]);
int inventory = (Integer)ETBModule.SC_inventory.get(configs[s]);
boolean[] rsControl = (boolean[])ETBModule.SC_rsControl.get(configs[s]);
boolean[] rsLatch = (boolean[])ETBModule.SC_rsLatch.get(configs[s]);
ItemStack stack = new ItemStack(module, 1, sides[s]);
String tipstr = String.format("%-5s : %s ", ForgeDirection.getOrientation(s), stack.getDisplayName());
String configstr = "[ ";
if (tank != -1)
configstr += "\u00a79" + String.valueOf(tank) + " ";
if (inventory != -1)
configstr += "\u00a7a" + String.valueOf(inventory) + " ";
if (rsControl[0] || rsControl[1] || rsControl[2]){
configstr += "\u00a7c";
configstr += rsControl[0] ? "1" : "0";
configstr += rsControl[1] ? "1" : "0";
configstr += rsControl[2] ? "1" : "0";
configstr += " ";
}
if (rsLatch[0] || rsLatch[1] || rsLatch[2]){
configstr += "\u00a75";
configstr += rsLatch[0] ? "1" : "0";
configstr += rsLatch[1] ? "1" : "0";
configstr += rsLatch[2] ? "1" : "0";
configstr += " ";
}
configstr += "\u00a7r]";
if (!configstr.equals("[ \u00a7r]"))
tipstr += " " + configstr;
/*
if ((tank != -1) && (inventory != -1))
tipstr += String.format("[ \u00a79%d \u00a7a%d \u00a7r]", tank, inventory);
else if (tank != -1)
tipstr += String.format("[ \u00a79%d \u00a7r]", tank);
else if (inventory != -1)
tipstr += String.format("[ \u00a7a%d \u00a7r]", inventory);
*/
currenttip.add(tipstr);
}
}
} catch (Exception e) {
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -1,32 +0,0 @@
package mcp.mobius.waila.addons.gravestone;
import java.util.logging.Level;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ExternalModulesHandler;
public class GravestoneModule {
public static Class BlockGraveStone = null;
public static void register(){
try{
Class ModGravestone = Class.forName("GraveStone.ModGraveStone");
mod_Waila.log.log(Level.INFO, "GraveStone mod found.");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.INFO, "[GraveStone] GraveStone mod not found.");
return;
}
try {
BlockGraveStone = Class.forName("GraveStone.block.BlockGSGraveStone");
} catch (ClassNotFoundException e) {
mod_Waila.log.log(Level.WARNING, "[GraveStone] Class not found. " + e);
}
ExternalModulesHandler.instance().registerStackProvider(new HUDHandlerGravestone(), BlockGraveStone);
}
}
@@ -1,32 +0,0 @@
package mcp.mobius.waila.addons.gravestone;
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 HUDHandlerGravestone implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return new ItemStack(accessor.getBlock(), 0, accessor.getMetadata());
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -1,76 +0,0 @@
package mcp.mobius.waila.addons.ic2;
import java.util.List;
import codechicken.lib.lang.LangUtil;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.WailaExceptionHandler;
import mcp.mobius.waila.addons.ConfigHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerTEBaseGenerator implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
try{
int storage = -1;
int production = -1;
if (IC2Module.TileEntityBaseGenerator.isInstance(accessor.getTileEntity())){
storage = IC2Module.TEBG_MaxStorage.getShort(accessor.getTileEntity());
production = IC2Module.TEBG_Production.getInt(accessor.getTileEntity());
}
else if (IC2Module.TileEntityGeoGenerator.isInstance(accessor.getTileEntity())){
storage = IC2Module.TEGG_MaxStorage.getShort(accessor.getTileEntity());
production = IC2Module.TEGG_Production.getInt(accessor.getTileEntity());
}
else if (IC2Module.TileEntitySemifluidGenerator.isInstance(accessor.getTileEntity())){
storage = IC2Module.TESG_MaxStorage.getShort(accessor.getTileEntity());
production = (int)IC2Module.TESG_Production.getDouble(accessor.getTileEntity());
}
String storedStr = LangUtil.translateG("hud.msg.stored");
String outputStr = LangUtil.translateG("hud.msg.output");
/* EU Storage */
if (ConfigHandler.instance().getConfig("ic2.storage")){
double stored = IC2Module.getStoredEnergy(accessor);
if ( stored >= 0.0 && storage > 0)
currenttip.add(String.format("%s : \u00a7f%d\u00a7r / \u00a7f%d\u00a7r EU", storedStr, Math.round(Math.min(stored,storage)), storage));
//else if (stored >= 0.0)
// currenttip.add(String.format("Stored : %d EU", stored));
}
if (ConfigHandler.instance().getConfig("ic2.outputeu")){
if ( production > 0)
currenttip.add(String.format("%s : \u00a7f%d\u00a7r EU/t", outputStr, production));
}
} catch (Exception e){
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -1,61 +0,0 @@
package mcp.mobius.waila.addons.ic2;
import java.util.List;
import codechicken.lib.lang.LangUtil;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.WailaExceptionHandler;
import mcp.mobius.waila.addons.ConfigHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerTEElectricBlock implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor,
IWailaConfigHandler config) {
// TODO Auto-generated method stub
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
try{
String storedStr = LangUtil.translateG("hud.msg.stored");
String outputStr = LangUtil.translateG("hud.msg.output");
/* EU Storage */
if (ConfigHandler.instance().getConfig("ic2.storage")){
double stored = IC2Module.getStoredEnergy(accessor);
int storage = IC2Module.TEEB_MaxStorage.getInt(accessor.getTileEntity());
if ( stored >= 0.0 )
currenttip.add(String.format("%s : \u00a7f%d\u00a7r / \u00a7f%d\u00a7r EU", storedStr, Math.round(Math.min(stored,storage)), storage));
}
if (ConfigHandler.instance().getConfig("ic2.outputeu")){
int production = IC2Module.TEEB_Output.getInt(accessor.getTileEntity());
if ( production > 0)
currenttip.add(String.format("%s : \u00a7f%d\u00a7r EU/t", outputStr, production));
}
} catch (Exception e){
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -1,81 +0,0 @@
package mcp.mobius.waila.addons.ic2;
import java.util.List;
import codechicken.lib.lang.LangUtil;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.WailaExceptionHandler;
import mcp.mobius.waila.addons.ConfigHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerTEStandardMachine implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor,
IWailaConfigHandler config) {
// TODO Auto-generated method stub
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
try{
IC2Upgrades upgrades = IC2Module.getUpgrades(accessor);
int baseConsumption = IC2Module.TESM_DefaultEnergyConsume.getInt(accessor.getTileEntity());
int baseOpTime = IC2Module.TESM_DefaultOperationLength.getInt(accessor.getTileEntity());
int baseStorage = IC2Module.TESM_DefaultEnergyStorage.getInt(accessor.getTileEntity());
long consumption = Math.round(Math.min(baseConsumption * Math.pow(1.6D, upgrades.overclocker), 2147483647));
double stackOpLen = baseOpTime * 64.0D * Math.pow(0.7D, upgrades.overclocker);
int opPerTick = ((int)Math.min(Math.ceil(64.0D / stackOpLen), 2147483647.0D));
int opTime = ((int)Math.round(stackOpLen * opPerTick / 64.0D));
int storage = Math.round(Math.min(baseStorage + 10000 * upgrades.storage + opTime * consumption, 2147483647));;
int maxinput = (Integer)IC2Module.IES_GetMaxSafeInput.invoke(accessor.getTileEntity()) * (int)Math.pow(4.0D, Math.min(4, upgrades.transform));
double stored = IC2Module.getStoredEnergy(accessor);
String storedStr = LangUtil.translateG("hud.msg.stored");
String powerStr = LangUtil.translateG("hud.msg.power");
String maxPowerStr = LangUtil.translateG("hud.msg.maxpower");
/* EU Storage */
if (ConfigHandler.instance().getConfig("ic2.storage")){
if ( stored >= 0.0 )
currenttip.add(String.format("%s : \u00a7f%d\u00a7r / \u00a7f%d\u00a7r EU", storedStr, Math.round(Math.min(stored,storage)), storage));
}
if (ConfigHandler.instance().getConfig("ic2.consump")){
if ( consumption > 0)
currenttip.add(String.format("%s : \u00a7f%d\u00a7r EU/t", powerStr, consumption ));
}
if (ConfigHandler.instance().getConfig("ic2.inputeu")){
if ( maxinput > 0)
currenttip.add(String.format("%s : \u00a7f%d\u00a7r EU/t", maxPowerStr, maxinput ));
}
} catch (Exception e){
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -1,58 +0,0 @@
package mcp.mobius.waila.addons.ic2;
import java.util.List;
import codechicken.lib.lang.LangUtil;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import mcp.mobius.waila.addons.ConfigHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerTETradeOMat implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack,List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!ConfigHandler.instance().getConfig("ic2.tradeomat")) return currenttip;
NBTTagCompound slots = accessor.getNBTData().getCompoundTag("InvSlots");
NBTTagList offer = slots.getCompoundTag("offer").getTagList("Contents");
NBTTagList demand = slots.getCompoundTag("demand").getTagList("Contents");
String offersStr = LangUtil.translateG("hud.msg.offers");
String demandsStr = LangUtil.translateG("hud.msg.demands");
if (offer.tagCount() == 1){
NBTTagCompound subtag = (NBTTagCompound)offer.tagAt(0);
ItemStack is = new ItemStack(subtag.getShort("id"), subtag.getByte("Count"), subtag.getShort("Damage"));
currenttip.add(String.format("%s : \u00a7f%d\u00a7r x \u00a7f%s\u00a7r", offersStr, is.stackSize, is.getDisplayName()));
}
if (demand.tagCount() == 1){
NBTTagCompound subtag = (NBTTagCompound)demand.tagAt(0);
ItemStack is = new ItemStack(subtag.getShort("id"), subtag.getByte("Count"), subtag.getShort("Damage"));
currenttip.add(String.format("%s : \u00a7f%d\u00a7r x \u00a7f%s\u00a7r", demandsStr, is.stackSize, is.getDisplayName()));
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
-168
View File
@@ -1,168 +0,0 @@
package mcp.mobius.waila.addons.ic2;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.logging.Level;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ConfigHandler;
import mcp.mobius.waila.addons.ExternalModulesHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
public class IC2Module {
public static Class TileEntityStandardMachine = null;
public static Field TESM_DefaultEnergyStorage = null;
public static Field TESM_DefaultEnergyConsume = null;
public static Field TESM_DefaultOperationLength = null;
public static Field TESM_MaxEnergy = null;
public static Class TileEntityBaseGenerator = null;
public static Field TEBG_MaxStorage = null;
public static Field TEBG_Production = null;
public static Class TileEntitySemifluidGenerator = null;
public static Field TESG_MaxStorage = null;
public static Field TESG_Production = null;
public static Class TileEntityGeoGenerator = null;
public static Field TEGG_MaxStorage = null;
public static Field TEGG_Production = null;
public static Class TileEntityElectricBlock = null;
public static Field TEEB_MaxStorage = null;
public static Field TEEB_Output = null;
public static Class IEnergySink = null;
public static Method IES_GetMaxSafeInput = null;
public static Class TileEntityTradeOMat = null;
/* Some required items */
public static Class IC2Items = null;
public static Field TransformerUpgrade = null;
public static ItemStack TransformerUpgradeStack = null;
public static Field EnergyStorageUpgrade = null;
public static ItemStack EnergyStorageUpgradeStack = null;
public static Field OverclockerUpgrade = null;
public static ItemStack OverclockerUpgradeStack = null;
public static void register(){
try{
TileEntityStandardMachine = Class.forName("ic2.core.block.machine.tileentity.TileEntityStandardMachine");
TESM_DefaultEnergyStorage = TileEntityStandardMachine.getField("defaultEnergyStorage");
TESM_DefaultEnergyConsume = TileEntityStandardMachine.getField("defaultEnergyConsume");
TESM_DefaultOperationLength = TileEntityStandardMachine.getField("defaultOperationLength");
TESM_MaxEnergy = TileEntityStandardMachine.getField("maxEnergy");
TileEntityBaseGenerator = Class.forName("ic2.core.block.generator.tileentity.TileEntityBaseGenerator");
TEBG_MaxStorage = TileEntityBaseGenerator.getField("maxStorage");
TEBG_Production = TileEntityBaseGenerator.getField("production");
TileEntitySemifluidGenerator = Class.forName("ic2.core.block.generator.tileentity.TileEntitySemifluidGenerator");
TESG_MaxStorage = TileEntitySemifluidGenerator.getDeclaredField("maxStorage");
TESG_Production = TileEntitySemifluidGenerator.getDeclaredField("production");
TESG_MaxStorage.setAccessible(true);
TESG_Production.setAccessible(true);
TileEntityGeoGenerator = Class.forName("ic2.core.block.generator.tileentity.TileEntityGeoGenerator");
TEGG_MaxStorage = TileEntityGeoGenerator.getField("maxStorage");
TEGG_Production = TileEntityGeoGenerator.getField("production");
TileEntityElectricBlock = Class.forName("ic2.core.block.wiring.TileEntityElectricBlock");
TEEB_MaxStorage = TileEntityElectricBlock.getField("maxStorage");
TEEB_Output = TileEntityElectricBlock.getField("output");
IEnergySink = Class.forName("ic2.api.energy.tile.IEnergySink");
IES_GetMaxSafeInput = IEnergySink.getMethod("getMaxSafeInput");
IC2Items = Class.forName("ic2.core.Ic2Items");
TransformerUpgrade = IC2Items.getField("transformerUpgrade");
EnergyStorageUpgrade = IC2Items.getField("energyStorageUpgrade");
OverclockerUpgrade = IC2Items.getField("overclockerUpgrade");
TransformerUpgradeStack = (ItemStack)TransformerUpgrade.get(null);
EnergyStorageUpgradeStack = (ItemStack)EnergyStorageUpgrade.get(null);
OverclockerUpgradeStack = (ItemStack)OverclockerUpgrade.get(null);
TileEntityTradeOMat = Class.forName("ic2.core.block.personal.TileEntityTradeOMat");
} catch (ClassNotFoundException e){
e.printStackTrace();
mod_Waila.log.log(Level.WARNING, "[IC2] Class not found. " + e);
return;
} catch (NoSuchMethodException e){
e.printStackTrace();
mod_Waila.log.log(Level.WARNING, "[IC2] Method not found." + e);
return;
} catch (NoSuchFieldException e){
e.printStackTrace();
mod_Waila.log.log(Level.WARNING, "[IC2] Field not found." + e);
return;
} catch (Exception e){
e.printStackTrace();
mod_Waila.log.log(Level.WARNING, "[IC2] Unhandled exception." + e);
return;
}
ExternalModulesHandler.instance().addConfigRemote("IndustrialCraft2", "ic2.storage");
ExternalModulesHandler.instance().addConfig("IndustrialCraft2", "ic2.outputeu");
ExternalModulesHandler.instance().addConfigRemote("IndustrialCraft2", "ic2.inputeu");
ExternalModulesHandler.instance().addConfigRemote("IndustrialCraft2", "ic2.consump");
ExternalModulesHandler.instance().addConfigRemote("IndustrialCraft2", "ic2.tradeomat");
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerTEStandardMachine(), TileEntityStandardMachine);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerTEBaseGenerator(), TileEntityBaseGenerator);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerTEBaseGenerator(), TileEntitySemifluidGenerator);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerTEBaseGenerator(), TileEntityGeoGenerator);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerTEElectricBlock(), TileEntityElectricBlock);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerTETradeOMat(), TileEntityTradeOMat);
}
/* Retuns the current stored energy if available in the nbt and config is true */
public static double getStoredEnergy(IWailaDataAccessor accessor){
if (ConfigHandler.instance().getConfig("ic2.storage")){
if (accessor.getNBTData().hasKey("energy"))
return accessor.getNBTData().getDouble("energy");
else if (accessor.getNBTData().hasKey("storage"))
return accessor.getNBTData().getDouble("storage");
}
return -1.0;
}
public static IC2Upgrades getUpgrades(IWailaDataAccessor accessor){
NBTTagCompound nbt = accessor.getNBTData();
IC2Upgrades upgrades = new IC2Upgrades();
if (!nbt.hasKey("InvSlots")) return null;
NBTTagCompound inventory = nbt.getCompoundTag("InvSlots");
if (!inventory.hasKey("upgrade")) return null;
NBTTagList nbtupgrades = inventory.getCompoundTag("upgrade").getTagList("Contents");
for (Object subobj : nbtupgrades.tagList){
NBTTagCompound subtag = (NBTTagCompound)subobj;
int id = subtag.getShort("id");
int meta = subtag.getShort("Damage");
int count = subtag.getByte("Count");
//ItemStack is = new ItemStack(id, 1, count);
if (TransformerUpgradeStack.getItemDamage() == meta && TransformerUpgradeStack.itemID == id)
upgrades.transform += count;
if (EnergyStorageUpgradeStack.getItemDamage() == meta && EnergyStorageUpgradeStack.itemID == id)
upgrades.storage += count;
if (OverclockerUpgradeStack.getItemDamage() == meta && OverclockerUpgradeStack.itemID == id)
upgrades.overclocker += count;
}
return upgrades;
}
}
@@ -1,7 +0,0 @@
package mcp.mobius.waila.addons.ic2;
public class IC2Upgrades {
public int transform = 0;
public int storage = 0;
public int overclocker = 0;
}
@@ -1,202 +0,0 @@
package mcp.mobius.waila.addons.projectred;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.common.ForgeDirection;
import mcp.mobius.waila.api.IWailaBlockDecorator;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.gui.helpers.UIHelper;
public class HUDDecoratorRsGateLogic implements IWailaBlockDecorator {
static byte[][] IOARRAY={
{1,1,2,1} /* OR */, {1,1,2,1} /* NOR */, {1,2,2,2} /* NOT */, {1,1,2,1} /* AND */,
{1,1,2,1} /* NAND */, {0,1,2,1} /* XOR */, {0,1,2,1} /* XNOR */, {1,2,2,2} /* Buf */,
{3,4,2,5} /* Multi */, {1,0,2,0} /* Pulse */, {1,0,2,0} /* Repeat */, {1,2,2,2} /* Rand */,
{2,1,2,1} /* Latch */, {2,1,2,1} /* Toggle*/, {6,1,2,2} /* Transp */, {2,0,0,0} /* Light */,
{2,0,0,0} /* Rain */, {1,7,2,7} /* Timer */, {2,2,2,2} /* Sequen */, {2,9,2,8} /* Count */,
{1,2,2,6} /* State */, {6,1,2,1} /* Sync */, {10,1,10,1} /* Bus */, {11,12,11,12} /* Null */,
{11,12,11,12} /* Inver */, {11,12,11,12} /* Buff */, {1,9,2,8} /* Cmp */, {1,12,2,12} /* And */,
};
static String[] IONAMES={ "", "IN", "OUT", "SWAP", "IN_A", "IN_B", "LOCK", "IO", "POS", "NEG", "BUS", "A", "B"};
@Override
public void decorateBlock(ItemStack itemStack, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("pr.showio")) return;
int orient = 0;
int subID = 0;
int shape = 0;
boolean found = false;
if (!accessor.getNBTData().hasKey("parts")) return;
NBTTagList parts = accessor.getNBTData().getTagList("parts");
for (int i = 0; i < parts.tagCount(); i++){
NBTTagCompound subtag = (NBTTagCompound)parts.tagAt(i);
String id = subtag.getString("id");
if (id.equals("pr_sgate") || id.equals("pr_igate") ||
id.equals("pr_tgate") || id.equals("pr_bgate") ||
id.equals("pr_agate") || id.equals("pr_rgate")){
orient = accessor.getNBTInteger(subtag, "orient");
subID = accessor.getNBTInteger(subtag, "subID");
shape = accessor.getNBTInteger(subtag, "shape");
found = true;
}
}
if (!found) return;
//orient = orient - ((orient & 0x10) + (orient & 0x8) + (orient & 0x4));
int hOrient = orient & 0x3;
ForgeDirection vOrient = ForgeDirection.getOrientation((orient - (orient & 0x3)) >> 2);
//System.out.printf("%s\n", ForgeDirection.getOrientation(vOrient));
if (vOrient == ForgeDirection.EAST)
hOrient -= 1;
if (vOrient == ForgeDirection.WEST)
hOrient += 1;
if (hOrient == -1)
hOrient = 3;
String[] IOStr = new String[4];
for (int i = 0; i < 4; i++)
IOStr[i] = IONAMES[IOARRAY[subID][i]];
String[] IOStrRot = new String[4];
for (int i = 0; i < 4 ; i++){
int j = i + hOrient;
if (j >= 4) j -= 4;
IOStrRot[j] = IOStr[i];
}
switch(vOrient){
case DOWN:
UIHelper.drawFloatingText(IOStrRot[0], accessor.getRenderingPosition(), 0.5F, 0.2F, 1.4F, 90F, 0F, 0F); // Orient 0
UIHelper.drawFloatingText(IOStrRot[1], accessor.getRenderingPosition(), -0.4F, 0.2F, 0.5F, 90F, 270F, 0F); // Orient 1
UIHelper.drawFloatingText(IOStrRot[2], accessor.getRenderingPosition(), 0.5F, 0.2F, -0.4F, 90F, 180F, 0F); // Orient 2
UIHelper.drawFloatingText(IOStrRot[3], accessor.getRenderingPosition(), 1.4F, 0.2F, 0.5F, 90F, 90F, 0F); // Orient 3
break;
case EAST:
UIHelper.drawFloatingText(IOStrRot[0], accessor.getRenderingPosition(), 0.8F, 0.5F, 1.4F, 0F, 90F, 90F);
UIHelper.drawFloatingText(IOStrRot[1], accessor.getRenderingPosition(), 0.8F, -0.4F, 0.5F, 0F, 90F, 180F);
UIHelper.drawFloatingText(IOStrRot[2], accessor.getRenderingPosition(), 0.8F, 0.5F, -0.4F, 0F, 90F, 270F);
UIHelper.drawFloatingText(IOStrRot[3], accessor.getRenderingPosition(), 0.8F, 1.4F, 0.5F, 0F, 90F, 0F);
break;
case NORTH:
UIHelper.drawFloatingText(IOStrRot[0], accessor.getRenderingPosition(), 0.5F, 1.4F, 0.2F, 0F, 180F, 0F);
UIHelper.drawFloatingText(IOStrRot[1], accessor.getRenderingPosition(), 1.4F, 0.5F, 0.2F, 0F, 180F, 90F);
UIHelper.drawFloatingText(IOStrRot[2], accessor.getRenderingPosition(), 0.5F, -0.4F, 0.2F, 0F, 180F, 180F);
UIHelper.drawFloatingText(IOStrRot[3], accessor.getRenderingPosition(), -0.4F, 0.5F, 0.2F, 0F, 180F, 270F);
break;
case SOUTH:
UIHelper.drawFloatingText(IOStrRot[0], accessor.getRenderingPosition(), 0.5F, 1.4F, 0.8F, 0F, 0F, 0F);
UIHelper.drawFloatingText(IOStrRot[1], accessor.getRenderingPosition(), -0.4F, 0.5F, 0.8F, 0F, 0F, 90F);
UIHelper.drawFloatingText(IOStrRot[2], accessor.getRenderingPosition(), 0.5F, -0.4F, 0.8F, 0F, 0F, 180F);
UIHelper.drawFloatingText(IOStrRot[3], accessor.getRenderingPosition(), 1.4F, 0.5F, 0.8F, 0F, 0F, 270F);
break;
case UP:
UIHelper.drawFloatingText(IOStrRot[0], accessor.getRenderingPosition(), 0.5F, 0.8F, 1.4F, 270F, 180F, 0F);
UIHelper.drawFloatingText(IOStrRot[1], accessor.getRenderingPosition(), 1.4F, 0.8F, 0.5F, 270F, 270F, 0F);
UIHelper.drawFloatingText(IOStrRot[2], accessor.getRenderingPosition(), 0.5F, 0.8F, -0.4F, 270F, 0F, 0F);
UIHelper.drawFloatingText(IOStrRot[3], accessor.getRenderingPosition(), -0.4F, 0.8F, 0.5F, 270F, 90F, 0F);
break;
case WEST:
UIHelper.drawFloatingText(IOStrRot[0], accessor.getRenderingPosition(), 0.2F, 0.5F, 1.4F, 180F, 90F, 90F);
UIHelper.drawFloatingText(IOStrRot[1], accessor.getRenderingPosition(), 0.2F, 1.4F, 0.5F, 180F, 90F, 180F);
UIHelper.drawFloatingText(IOStrRot[2], accessor.getRenderingPosition(), 0.2F, 0.5F, -0.4F, 180F, 90F, 270F);
UIHelper.drawFloatingText(IOStrRot[3], accessor.getRenderingPosition(), 0.2F, -0.4F, 0.5F, 180F, 90F, 0F);
break;
default:
break;
}
double x = accessor.getRenderingPosition().xCoord;
double y = accessor.getRenderingPosition().yCoord;
double z = accessor.getRenderingPosition().zCoord;
switch(vOrient){
case DOWN:
UIHelper.drawRectangle(x - 0.1, y + 0.1, z, x, y + 0.1, z + 0.35, 255, 255, 255, 150 );
UIHelper.drawRectangle(x - 0.1, y + 0.1, z + 0.65, x, y + 0.1, z + 1.0, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 1.0, y + 0.1, z, x + 1.1, y + 0.1, z + 0.35, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 1.0, y + 0.1, z + 0.65, x + 1.1, y + 0.1, z + 1.0, 255, 255, 255, 150 );
UIHelper.drawRectangle(x - 0.1, y + 0.1, z - 0.1, x + 0.35, y + 0.1, z + 0.1, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 0.65, y + 0.1, z - 0.1, x + 1.1, y + 0.1, z + 0.1, 255, 255, 255, 150 );
UIHelper.drawRectangle(x - 0.1, y + 0.1, z + 1.0, x + 0.35, y + 0.1, z + 1.1, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 0.65, y + 0.1, z + 1.0, x + 1.1, y + 0.1, z + 1.1, 255, 255, 255, 150 );
break;
case EAST:
UIHelper.drawRectangleEW(x + 0.9, y, z - 0.1, x + 0.9, y + 0.35, z, 255, 255, 255, 150 );
UIHelper.drawRectangleEW(x + 0.9, y + 0.65, z - 0.1, x + 0.9, y + 1.0, z, 255, 255, 255, 150 );
UIHelper.drawRectangleEW(x + 0.9, y, z + 1.0, x + 0.9, y + 0.35, z + 1.1, 255, 255, 255, 150 );
UIHelper.drawRectangleEW(x + 0.9, y + 0.65, z + 1.0, x + 0.9, y + 1.0, z + 1.1, 255, 255, 255, 150 );
UIHelper.drawRectangleEW(x + 0.9, y - 0.1, z - 0.1, x + 0.9, y, z + 0.35, 255, 255, 255, 150 );
UIHelper.drawRectangleEW(x + 0.9, y - 0.1, z + 0.65, x + 0.9, y, z + 1.1, 255, 255, 255, 150 );
UIHelper.drawRectangleEW(x + 0.9, y + 1.0, z - 0.1, x + 0.9, y + 1.1, z + 0.35, 255, 255, 255, 150 );
UIHelper.drawRectangleEW(x + 0.9, y + 1.0, z + 0.65, x + 0.9, y + 1.1, z + 1.1, 255, 255, 255, 150 );
break;
case NORTH:
UIHelper.drawRectangle(x - 0.1, y, z + 0.1, x, y + 0.35, z + 0.1, 255, 255, 255, 150 );
UIHelper.drawRectangle(x - 0.1, y + 0.65, z + 0.1, x, y + 1.0, z + 0.1, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 1.0, y, z + 0.1, x + 1.1, y + 0.35, z + 0.1, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 1.0, y + 0.65, z + 0.1, x + 1.1, y + 1.0, z + 0.1, 255, 255, 255, 150 );
UIHelper.drawRectangle(x - 0.1, y - 0.1, z + 0.1, x + 0.35, y, z + 0.1, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 0.65, y - 0.1, z + 0.1, x + 1.1, y, z + 0.1, 255, 255, 255, 150 );
UIHelper.drawRectangle(x - 0.1, y + 1.0, z + 0.1, x + 0.35, y + 1.1, z + 0.1, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 0.65, y + 1.0, z + 0.1, x + 1.1, y + 1.1, z + 0.1, 255, 255, 255, 150 );
break;
case SOUTH:
UIHelper.drawRectangle(x, y, z + 0.9, x - 0.1, y + 0.35, z + 0.9, 255, 255, 255, 150 );
UIHelper.drawRectangle(x, y + 0.65, z + 0.9, x - 0.1, y + 1.0, z + 0.9, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 1.1, y, z + 0.9, x + 1.0, y + 0.35, z + 0.9, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 1.1, y + 0.65, z + 0.9, x + 1.0, y + 1.0, z + 0.9, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 0.35, y - 0.1, z + 0.9, x - 0.1, y, z + 0.9, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 1.10, y - 0.1, z + 0.9, x + 0.65, y, z + 0.9, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 0.35, y + 1.0, z + 0.9, x - 0.1, y + 1.1, z + 0.9, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 1.1, y + 1.0, z + 0.9, x + 0.65, y + 1.1, z + 0.9, 255, 255, 255, 150 );
break;
case UP:
UIHelper.drawRectangle(x, y + 0.9, z, x - 0.1, y + 0.9, z + 0.35, 255, 255, 255, 150 );
UIHelper.drawRectangle(x, y + 0.9, z + 0.65, x - 0.1, y + 0.9, z + 1.0, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 1.1, y + 0.9, z, x + 1.0, y + 0.9, z + 0.35, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 1.1, y + 0.9, z + 0.65, x + 1.0, y + 0.9, z + 1.0, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 0.35, y + 0.9, z - 0.1, x - 0.1, y + 0.9, z + 0.1, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 1.1, y + 0.9, z - 0.1, x + 0.65, y + 0.9, z + 0.1, 255, 255, 255, 150 );
UIHelper.drawRectangle(x +0.35, y + 0.9, z + 1.0, x - 0.1, y + 0.9, z + 1.1, 255, 255, 255, 150 );
UIHelper.drawRectangle(x + 1.1, y + 0.9, z + 1.0, x + 0.65, y + 0.9, z + 1.1, 255, 255, 255, 150 );
break;
case WEST:
UIHelper.drawRectangleEW(x + 0.1, y+ 0.35, z - 0.1, x + 0.1, y , z, 255, 255, 255, 150 );
UIHelper.drawRectangleEW(x + 0.1, y + 1.0, z - 0.1, x + 0.1, y + 0.65, z, 255, 255, 255, 150 );
UIHelper.drawRectangleEW(x + 0.1, y + 0.35, z + 1.0, x + 0.1, y, z + 1.1, 255, 255, 255, 150 );
UIHelper.drawRectangleEW(x + 0.1, y + 1.0, z + 1.0, x + 0.1, y + 0.65, z + 1.1, 255, 255, 255, 150 );
UIHelper.drawRectangleEW(x + 0.1, y, z - 0.1, x + 0.1, y - 0.1, z + 0.35, 255, 255, 255, 150 );
UIHelper.drawRectangleEW(x + 0.1, y, z + 0.65, x + 0.1, y - 0.1, z + 1.1, 255, 255, 255, 150 );
UIHelper.drawRectangleEW(x + 0.1, y + 1.1, z - 0.1, x + 0.1, y + 1.0, z + 0.35, 255, 255, 255, 150 );
UIHelper.drawRectangleEW(x + 0.1, y + 1.1, z + 0.65, x + 0.1, y + 1.0, z + 1.1, 255, 255, 255, 150 );
break;
default:
break;
}
}
}
@@ -1,105 +0,0 @@
package mcp.mobius.waila.addons.projectred;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerRsGateLogic implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("pr.showdata")) return currenttip;
int orient = 0;
int subID = 0;
int shape = 0;
int pmax = 0;
int val = 0;
int max = 0;
int dec = 0;
int inc = 0;
boolean found = false;
if (!accessor.getNBTData().hasKey("parts")) return currenttip;
NBTTagList parts = accessor.getNBTData().getTagList("parts");
for (int i = 0; i < parts.tagCount(); i++){
NBTTagCompound subtag = (NBTTagCompound)parts.tagAt(i);
String id = subtag.getString("id");
if (id.equals("pr_sgate") || id.equals("pr_igate") ||
id.equals("pr_tgate") || id.equals("pr_bgate") ||
id.equals("pr_agate") || id.equals("pr_rgate")){
orient = accessor.getNBTInteger(subtag, "orient");
subID = accessor.getNBTInteger(subtag, "subID");
shape = accessor.getNBTInteger(subtag, "shape");
if (subID == 17)
pmax = accessor.getNBTInteger(subtag, "pmax");
if (subID == 19){
val = accessor.getNBTInteger(subtag, "val");
max = accessor.getNBTInteger(subtag, "max");
dec = accessor.getNBTInteger(subtag, "dec");
inc = accessor.getNBTInteger(subtag, "inc");
}
found = true;
}
}
if (!found) return currenttip;
switch(subID){
case 10:
currenttip.add(String.format("Delay : \u00a7f%d ticks", (int)Math.pow(2, shape)));
break;
case 15:
if (shape == 0)
currenttip.add("Shape : \u00a7fOpen");
if (shape == 1)
currenttip.add("Shape : \u00a7fHalf closed");
if (shape == 2)
currenttip.add("Shape : \u00a7fclosed");
break;
case 17:
currenttip.add(String.format("Timer : \u00a7f%d \u00a7rms", (pmax + 2) * 50));
break;
case 19:
currenttip.add(String.format("Value : \u00a7f%d \u00a7r/ \u00a7f%d", val, max));
currenttip.add(String.format("Step : \u00a7f-%d \u00a7r/ \u00a7f+%d", dec, inc));
default:
break;
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -1,51 +0,0 @@
package mcp.mobius.waila.addons.projectred;
import java.io.File;
import java.util.logging.Level;
import net.minecraft.block.Block;
import net.minecraftforge.common.Configuration;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ExternalModulesHandler;
public class ProjectRedModule {
public static Class BlockMultipart = null;
public static void register(){
try{
Class ModClass = Class.forName("mrtjp.projectred.ProjectRedIntegration");
mod_Waila.log.log(Level.INFO, "ProjectRed|Integration mod found.");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.INFO, "[ProjectRed] ProjectRed|Integration mod not found.");
return;
}
try{
//InstancedRsGateLogic = Class.forName("mrtjp.projectred.integration.InstancedRsGateLogic");
BlockMultipart = Class.forName("codechicken.multipart.BlockMultipart");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Class not found. " + e);
return;
// } catch (NoSuchMethodException e){
// mod_Waila.log.log(Level.WARNING, "[EnderStorage] Method not found." + e);
// return;
// } catch (NoSuchFieldException e){
// mod_Waila.log.log(Level.WARNING, "[EnderStorage] Field not found." + e);
// return;
} catch (Exception e){
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Unhandled exception." + e);
return;
}
ExternalModulesHandler.instance().addConfigRemote("Project:Red", "pr.showio");
ExternalModulesHandler.instance().addConfigRemote("Project:Red", "pr.showdata");
ExternalModulesHandler.instance().registerBlockDecorator(new HUDDecoratorRsGateLogic(), BlockMultipart);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerRsGateLogic(), BlockMultipart);
}
}
@@ -1,43 +0,0 @@
package mcp.mobius.waila.addons.thaumcraft;
import java.util.List;
import mcp.mobius.waila.WailaExceptionHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import net.minecraft.item.ItemStack;
public class HUDHandlerCapacitor implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (config.getConfig("thaumcraft.storedvis")){
try{
short storedVis = ThaumcraftModule.TileCrystalCapacitor_StoredVis.getShort(accessor.getTileEntity());
short maxVis = ThaumcraftModule.TileCrystalCapacitor_MaxVis.getShort(accessor.getTileEntity());
currenttip.add(String.format("%s/%s vis", storedVis, maxVis));
}catch (Exception e){
currenttip = WailaExceptionHandler.handleErr(e, accessor.getClass().getName(), currenttip);
}
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -1,31 +0,0 @@
package mcp.mobius.waila.addons.thaumcraft;
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 HUDHandlerLeaves implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return new ItemStack(accessor.getBlock(), 0, accessor.getMetadata());
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -1,30 +0,0 @@
package mcp.mobius.waila.addons.thaumcraft;
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 HUDHandlerPlants implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return new ItemStack(accessor.getBlock(), 0, accessor.getMetadata());
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -1,57 +0,0 @@
package mcp.mobius.waila.addons.thaumcraft;
import java.lang.reflect.Field;
import java.util.logging.Level;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ExternalModulesHandler;
public class ThaumcraftModule {
public static Class BlockMagicalLeaves = null;
public static Class BlockCustomPlant = null;
public static Class TileCrystalCapacitor = null;
public static Field TileCrystalCapacitor_StoredVis = null;
public static Field TileCrystalCapacitor_MaxVis = null;
public static void register(){
try{
Class ModThaumcraft = Class.forName("thaumcraft.common.Thaumcraft");
mod_Waila.log.log(Level.INFO, "Thaumcraft mod found.");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.INFO, "[Thaumcraft] Thaumcraft mod not found.");
return;
}
try{
BlockMagicalLeaves = Class.forName("thaumcraft.common.world.BlockMagicalLeaves");
BlockCustomPlant = Class.forName("thaumcraft.common.world.BlockCustomPlant");
TileCrystalCapacitor = Class.forName("thaumcraft.common.tiles.TileCrystalCapacitor");
TileCrystalCapacitor_StoredVis = TileCrystalCapacitor.getField("storedVis");
TileCrystalCapacitor_MaxVis = TileCrystalCapacitor.getField("maxVis");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.WARNING, "[Thaumcraft] Class not found. " + e);
return;
// } catch (NoSuchMethodException e){
// mod_Waila.log.log(Level.WARNING, "[Thaumcraft] Method not found." + e);
// return;
} catch (NoSuchFieldException e){
mod_Waila.log.log(Level.WARNING, "[Thaumcraft] Field not found." + e);
return;
// } catch (Exception e){
// mod_Waila.log.log(Level.WARNING, "[Thaumcraft] Unhandled exception." + e);
// return;
}
ExternalModulesHandler.instance().addConfig("Thaumcraft", "thaumcraft.storedvis");
ExternalModulesHandler.instance().registerStackProvider(new HUDHandlerLeaves(), BlockMagicalLeaves);
ExternalModulesHandler.instance().registerStackProvider(new HUDHandlerPlants(), BlockCustomPlant);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerCapacitor(), TileCrystalCapacitor);
}
}
@@ -1,52 +0,0 @@
package mcp.mobius.waila.addons.thermalexpansion;
import java.util.List;
import codechicken.lib.lang.LangUtil;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import mcp.mobius.waila.WailaExceptionHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class 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(LangUtil.translateG("hud.msg.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;
}
}
@@ -1,45 +0,0 @@
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 HUDHandlerConduitItem implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (accessor.getNBTData().hasKey("Mode") && accessor.getNBTInteger(accessor.getNBTData(), "Mode") != 0){
int mode = accessor.getNBTInteger(accessor.getNBTData(), "Mode");
if (mode == 1)
currenttip.add("Mode : \u00a7fDense");
else if (mode == 2)
currenttip.add("Mode : \u00a7fVacuum");
else if (mode == 3)
currenttip.add("Mode : \u00a7fRound-Robin");
else
currenttip.add("Mode : <UNKNOWN>");
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -1,41 +0,0 @@
package mcp.mobius.waila.addons.thermalexpansion;
import java.util.List;
import codechicken.lib.lang.LangUtil;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.WailaExceptionHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class 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("%s/%s : %d / %d RF/t", LangUtil.translateG("hud.msg.in"), LangUtil.translateG("hud.msg.out"), energyReceive, energySend));
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -1,48 +0,0 @@
package mcp.mobius.waila.addons.thermalexpansion;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.ForgeDirection;
import mcp.mobius.waila.WailaExceptionHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerIEnergyHandler implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("thermalexpansion.energyhandler")) return currenttip;
if (!accessor.getNBTData().hasKey("Energy")) return currenttip;
int energy = accessor.getNBTInteger(accessor.getNBTData(), "Energy");
try {
Integer maxEnergy = (Integer)ThermalExpansionModule.IEnergyHandler_getMaxStorage.invoke(accessor.getTileEntity(), ForgeDirection.UNKNOWN);
if (maxEnergy != 0)
currenttip.add(String.format("%d / %d RF", energy, maxEnergy));
} catch (Exception e){
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -1,59 +0,0 @@
package mcp.mobius.waila.addons.thermalexpansion;
import java.util.List;
import codechicken.lib.lang.LangUtil;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class 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 = LangUtil.translateG("hud.msg.public");
break;
case 1:
access = LangUtil.translateG("hud.msg.restricted");
break;
case 2:
access = LangUtil.translateG("hud.msg.private");
break;
}
currenttip.add(String.format("%s : \u00a7f%s\u00a7r [ %s ]", LangUtil.translateG("hud.msg.owner"), owner, access));
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -1,82 +0,0 @@
package mcp.mobius.waila.addons.thermalexpansion;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import codechicken.lib.lang.LangUtil;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import mcp.mobius.waila.WailaExceptionHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerTank implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("thermalexpansion.fluidtype")) return currenttip;
try {
FluidStack fluid = (FluidStack)ThermalExpansionModule.TileTank_getTankFluid.invoke(accessor.getTileEntity());
String name = currenttip.get(0);
try{
name += String.format(" < %s >", fluid.getFluid().getLocalizedName());
} catch (NullPointerException f){
name += " " + LangUtil.translateG("hud.msg.empty");
}
currenttip.set(0, name);
} catch (Exception e){
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
try {
if (config.getConfig("thermalexpansion.fluidamount")){
int amount = 0;
if (accessor.getNBTData().hasKey("Amount"))
amount = accessor.getNBTInteger(accessor.getNBTData(), "Amount");
Integer capacity = (Integer)ThermalExpansionModule.TileTank_getTankCapacity.invoke(accessor.getTileEntity());
currenttip.add(String.format("%d / %d mB", amount, capacity));
}
if (config.getConfig("thermalexpansion.tankmode")){
Byte mode = (Byte)ThermalExpansionModule.TileTank_mode.get(accessor.getTileEntity());
if (mode == 0)
currenttip.add(String.format("%s : \u00a7a%s", LangUtil.translateG("hud.msg.mode"), LangUtil.translateG("hud.msg.input")));
else if (mode == 1)
currenttip.add(String.format("%s : \u00a7c%s", LangUtil.translateG("hud.msg.mode"), LangUtil.translateG("hud.msg.output")));
else
currenttip.add(String.format("Mode : Unknown (%d)", mode));
}
} catch (Exception e){
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -1,91 +0,0 @@
package mcp.mobius.waila.addons.thermalexpansion;
import java.util.List;
import codechicken.lib.lang.LangUtil;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerTesseract implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (config.getConfig("thermalexpansion.tesssendrecv")){
String send = String.format("%s : ", LangUtil.translateG("hud.msg.send"));
String recv = String.format("%s : ", LangUtil.translateG("hud.msg.recv"));
String item = String.format("\u00a7a%s ", LangUtil.translateG("hud.msg.item"));
String fluid= String.format("\u00a79%s ", LangUtil.translateG("hud.msg.fluid"));
String energ= String.format("\u00a7c%s ", LangUtil.translateG("hud.msg.energ"));
switch (accessor.getNBTInteger(accessor.getNBTData(), "Item.Mode")){
case 0:
send += item;
break;
case 1:
recv += item;
break;
case 2:
send += item;
recv += item;
break;
}
switch (accessor.getNBTInteger(accessor.getNBTData(), "Fluid.Mode")){
case 0:
send += fluid;
break;
case 1:
recv += fluid;
break;
case 2:
send += fluid;
recv += fluid;
break;
}
switch (accessor.getNBTInteger(accessor.getNBTData(), "Energy.Mode")){
case 0:
send += energ;
break;
case 1:
recv += energ;
break;
case 2:
send += energ;
recv += energ;
break;
}
if (!send.equals(String.format("%s : ", LangUtil.translateG("hud.msg.send"))))
currenttip.add(send);
if (!send.equals(String.format("%s : ", LangUtil.translateG("hud.msg.recv"))))
currenttip.add(recv);
}
if (config.getConfig("thermalexpansion.tessfreq"))
currenttip.add(String.format("%s : %d",LangUtil.translateG("hud.msg.frequency"), accessor.getNBTInteger(accessor.getNBTData(), "Frequency")));
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -1,125 +0,0 @@
package mcp.mobius.waila.addons.thermalexpansion;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.logging.Level;
import net.minecraftforge.common.ForgeDirection;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ExternalModulesHandler;
public class ThermalExpansionModule {
public static Class IEnergyHandler = null;
public static Method IEnergyHandler_getMaxStorage = null;
public static Class TileEnergyCell = null;
public static Class TileTank = null;
public static Method TileTank_getTankFluid = null;
public static Method TileTank_getTankCapacity = null;
public static Field TileTank_mode = null;
public static Class TileConduitFluid = null;
public static Method TileConduitFluid_getRenderFluid = null;
public static Method TileConduitFluid_getRenderFluidLevel = null;
public static Class TileConduitItems = null;
public static Class TileTesseract = null;
public static Class ISecureTile = null;
//public static Field TileTesseract_modItem = null;
//public static Field TileTesseract_modFluid = null;
//public static Field TileTesseract_modEnergy = null;
//public static Class TileConduitBase = null;
//public static Field TileConduitBase_isInput = null;
//public static Field TileConduitBase_isOutput = null;
public static void register(){
try{
Class ModThermalExpansion = Class.forName("thermalexpansion.ThermalExpansion");
mod_Waila.log.log(Level.INFO, "Thermal Expansion mod found.");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.INFO, "[Thermal Expansion] ThermalExpansion mod not found.");
return;
}
try{
IEnergyHandler = Class.forName("cofh.api.energy.IEnergyHandler");
IEnergyHandler_getMaxStorage = IEnergyHandler.getMethod("getMaxEnergyStored", ForgeDirection.class);
TileEnergyCell = Class.forName("thermalexpansion.block.energycell.TileEnergyCell");
TileTank = Class.forName("thermalexpansion.block.tank.TileTank");
TileTank_getTankFluid = TileTank.getMethod("getTankFluid");
TileTank_getTankCapacity = TileTank.getMethod("getTankCapacity");
TileTank_mode = TileTank.getField("mode");
TileConduitFluid = Class.forName("thermalexpansion.block.conduit.fluid.TileConduitFluid");
TileConduitFluid_getRenderFluid = TileConduitFluid.getMethod("getRenderFluid");
TileConduitFluid_getRenderFluidLevel = TileConduitFluid.getMethod("getRenderFluidLevel");
TileConduitItems = Class.forName("thermalexpansion.block.conduit.item.TileConduitItem");
TileTesseract = Class.forName("thermalexpansion.block.tesseract.TileTesseract");
ISecureTile = Class.forName("cofh.api.tileentity.ISecureTile");
//TileTesseract_modItem = TileTesseract.getField("modItem");
//TileTesseract_modFluid = TileTesseract.getField("modFluid");
//TileTesseract_modEnergy = TileTesseract.getField("modEnergy");
//TileConduitBase = Class.forName("thermalexpansion.block.conduit.TileConduitBase");
//TileConduitBase_isInput = TileConduitBase.getField("isInput");
//TileConduitBase_isOutput = TileConduitBase.getField("isOutput");
//TileEnergyCell_energyReceive = TileEnergyCell.getField("energyReceive");
//TileEnergyCell_energySend = TileEnergyCell.getField("energySend");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.WARNING, "[Thermal Expansion] Class not found. " + e);
return;
} catch (NoSuchMethodException e){
mod_Waila.log.log(Level.WARNING, "[Thermal Expansion] Method not found." + e);
return;
} catch (NoSuchFieldException e){
mod_Waila.log.log(Level.WARNING, "[Thermal Expansion] Field not found." + e);
return;
// } catch (Exception e){
// mod_Waila.log.log(Level.WARNING, "[Thermal Expansion] Unhandled exception." + e);
// return;
}
ExternalModulesHandler.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.energyhandler");
ExternalModulesHandler.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.energycell");
ExternalModulesHandler.instance().addConfig("Thermal Expansion", "thermalexpansion.fluidtype");
ExternalModulesHandler.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.fluidamount");
ExternalModulesHandler.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.conditemmode");
ExternalModulesHandler.instance().addConfig("Thermal Expansion", "thermalexpansion.tankmode");
ExternalModulesHandler.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.tesssendrecv");
ExternalModulesHandler.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.tessfreq");
ExternalModulesHandler.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.owner");
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerIEnergyHandler(), IEnergyHandler);
//ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerIEnergyHandler(), TileEnergyCell);
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 HUDHandlerConduitItem(), TileConduitItems);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerISecureTile(), ISecureTile);
//ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerConduitBase(), TileConduitBase);
}
}
@@ -1,31 +0,0 @@
package mcp.mobius.waila.addons.twilightforest;
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 TwilightForestGenericOverride implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return new ItemStack(accessor.getBlock(), 0, accessor.getMetadata());
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
}
@@ -1,38 +0,0 @@
package mcp.mobius.waila.addons.twilightforest;
import java.util.logging.Level;
import mcp.mobius.waila.mod_Waila;
import mcp.mobius.waila.addons.ExternalModulesHandler;
public class TwilightForestModule {
public static Class BlockTFRoots = null;
public static Class BlockTFPlant = null;
public static Class BlockTFSapling = null;
public static void register(){
try{
Class TwilightForestMod = Class.forName("twilightforest.TwilightForestMod");
mod_Waila.log.log(Level.INFO, "TwilightForestMod mod found.");
} catch (ClassNotFoundException e){
mod_Waila.log.log(Level.INFO, "[TwilightForestMod] TwilightForestMod mod not found.");
return;
}
try {
BlockTFRoots = Class.forName("twilightforest.block.BlockTFRoots");
BlockTFPlant = Class.forName("twilightforest.block.BlockTFPlant");
BlockTFSapling = Class.forName("twilightforest.block.BlockTFSapling");
} catch (ClassNotFoundException e) {
mod_Waila.log.log(Level.WARNING, "[TwilightForestMod] Class not found. " + e);
}
ExternalModulesHandler.instance().registerStackProvider(new TwilightForestGenericOverride(), BlockTFRoots);
ExternalModulesHandler.instance().registerStackProvider(new TwilightForestGenericOverride(), BlockTFPlant);
//ExternalModulesHandler.instance().registerStackProvider(new TwilightForestGenericOverride(), BlockTFSapling);
}
}
@@ -1,85 +0,0 @@
package mcp.mobius.waila.addons.vanillamc;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.api.IWailaBlockDecorator;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.gui.helpers.UIHelper;
public class HUDDecoratorVanilla implements IWailaBlockDecorator {
@Override
public void decorateBlock(ItemStack itemStack, IWailaDataAccessor accessor, IWailaConfigHandler config) {
Tessellator tessellator = Tessellator.instance;
//UIHelper.drawBillboardText(itemStack.getDisplayName(), accessor.getRenderingPosition(), 0.5F, 1.5F, 0.5F, accessor.getPartialFrame());
UIHelper.drawFloatingText("IN", accessor.getRenderingPosition(), 0.5F, 0.2F, -0.2F, 90F, 0F, 0F);
UIHelper.drawFloatingText("OUT", accessor.getRenderingPosition(), -0.2F, 0.2F, 0.5F, 90F, 90F, 0F);
UIHelper.drawFloatingText("OUT", accessor.getRenderingPosition(), 1.2F, 0.2F, 0.5F, 90F, -90F, 0F);
UIHelper.drawFloatingText("OUT", accessor.getRenderingPosition(), 0.5F, 0.2F, 1.2F, 90F, -180F, 0F);
double offset = 0.1;
double delta = 1 + 2 * offset;
double x = accessor.getRenderingPosition().xCoord - offset;
double y = accessor.getRenderingPosition().yCoord - offset;
double z = accessor.getRenderingPosition().zCoord - offset;
tessellator.startDrawingQuads();
tessellator.setColorRGBA(255, 255, 255, 150);
tessellator.addVertex(x, y + 0.2 , z);
tessellator.addVertex(x, y + 0.2 , z + delta/2 - 0.1);
tessellator.addVertex(x + offset, y + 0.2, z + delta/2 - 0.1);
tessellator.addVertex(x + offset, y + 0.2, z);
tessellator.addVertex(x, y + 0.2 , z + delta/2 + 0.1);
tessellator.addVertex(x, y + 0.2 , z + delta);
tessellator.addVertex(x + offset, y + 0.2, z + delta);
tessellator.addVertex(x + offset, y + 0.2, z + delta/2 + 0.1);
tessellator.addVertex(x + delta - 0.1, y + 0.2 , z + 0.1);
tessellator.addVertex(x + delta - 0.1, y + 0.2 , z + delta/2 - 0.1);
tessellator.addVertex(x + delta + offset - 0.1, y + 0.2, z + delta/2 - 0.1);
tessellator.addVertex(x + delta + offset - 0.1, y + 0.2, z + 0.1);
tessellator.addVertex(x + delta - 0.1, y + 0.2 , z + delta/2 + 0.1);
tessellator.addVertex(x + delta - 0.1, y + 0.2 , z + delta);
tessellator.addVertex(x + delta + offset - 0.1, y + 0.2, z + delta);
tessellator.addVertex(x + delta + offset - 0.1, y + 0.2, z + delta/2 + 0.1);
tessellator.addVertex(x+ 0.1, y + 0.2, z);
tessellator.addVertex(x+ 0.1, y + 0.2, z+ offset);
tessellator.addVertex(x+ delta/2 - 0.1, y + 0.2, z+ offset);
tessellator.addVertex(x+ delta/2 - 0.1, y + 0.2, z);
tessellator.addVertex(x+ delta/2 + 0.1, y + 0.2, z);
tessellator.addVertex(x+ delta/2 + 0.1, y + 0.2, z+ offset);
tessellator.addVertex(x+ delta, y + 0.2, z+ offset);
tessellator.addVertex(x+ delta, y + 0.2, z);
tessellator.addVertex(x + 0.1, y + 0.2, z+ delta - 0.1);
tessellator.addVertex(x + 0.1, y + 0.2, z+ offset+ delta - 0.1);
tessellator.addVertex(x+ delta/2 - 0.1, y + 0.2, z+ offset+ delta - 0.1);
tessellator.addVertex(x+ delta/2 - 0.1, y + 0.2, z+ delta - 0.1);
tessellator.addVertex(x+ delta/2 + 0.1, y + 0.2, z+ delta - 0.1);
tessellator.addVertex(x+ delta/2 + 0.1, y + 0.2, z+ offset+ delta - 0.1);
tessellator.addVertex(x+ delta - 0.1, y + 0.2, z+ offset+ delta - 0.1);
tessellator.addVertex(x+ delta - 0.1, y + 0.2, z+ delta - 0.1);
tessellator.draw();
}
}
@@ -1,177 +0,0 @@
package mcp.mobius.waila.addons.vanillamc;
import java.util.List;
import codechicken.lib.lang.LangUtil;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemRecord;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntityMobSpawner;
import mcp.mobius.waila.addons.ExternalModulesHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerVanilla implements IWailaDataProvider {
static int mobSpawnerID = Block.mobSpawner.blockID;
static int cropsID = Block.crops.blockID;
static int melonStemID = Block.melonStem.blockID;
static int pumpkinStemID = Block.pumpkinStem.blockID;
static int carrotID = Block.carrot.blockID;
static int potatoID = Block.potato.blockID;
static int leverID = Block.lever.blockID;
static int repeaterIdle = Block.redstoneRepeaterIdle.blockID;
static int repeaterActv = Block.redstoneRepeaterActive.blockID;
static int comparatorIdl = Block.redstoneComparatorIdle.blockID;
static int comparatorAct = Block.redstoneComparatorActive.blockID;
static int redstone = Block.redstoneWire.blockID;
static int jukebox = Block.jukebox.blockID;
static int cocoa = Block.cocoaPlant.blockID;
static int netherwart = Block.netherStalk.blockID;
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
int blockID = accessor.getBlockID();
/* Mob spawner handler */
if (blockID == mobSpawnerID && accessor.getTileEntity() instanceof TileEntityMobSpawner && config.getConfig("vanilla.spawntype")){
String name = currenttip.get(0);
String mobname = ((TileEntityMobSpawner)accessor.getTileEntity()).getSpawnerLogic().getEntityNameToSpawn();
currenttip.set(0, String.format("%s (%s)", name, mobname));
}
if (blockID == redstone){
String name = currenttip.get(0).replaceFirst(String.format(" %s", accessor.getMetadata()), "");
currenttip.set(0, name);
}
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
int blockID = accessor.getBlockID();
/* Crops */
if (config.getConfig("vanilla.growthvalue"))
if (blockID == cropsID || blockID == melonStemID || blockID == pumpkinStemID || blockID == carrotID || blockID == potatoID){
float growthValue = (accessor.getMetadata() / 7.0F) * 100.0F;
if (growthValue < 100.0)
currenttip.add(String.format("%s : %.0f %%", LangUtil.translateG("hud.msg.growth"), growthValue));
else
currenttip.add(String.format("%s : %s", LangUtil.translateG("hud.msg.growth"), LangUtil.translateG("hud.msg.mature")));
return currenttip;
}
if (blockID == cocoa){
float growthValue = ((accessor.getMetadata() >> 2) / 2.0F) * 100.0F;
if (growthValue < 100.0)
currenttip.add(String.format("%s : %.0f %%", LangUtil.translateG("hud.msg.growth"), growthValue));
else
currenttip.add(String.format("%s : %s", LangUtil.translateG("hud.msg.growth"), LangUtil.translateG("hud.msg.mature")));
return currenttip;
}
if (blockID == netherwart){
float growthValue = (accessor.getMetadata() / 3.0F) * 100.0F;
if (growthValue < 100.0)
currenttip.add(String.format("%s : %.0f %%", LangUtil.translateG("hud.msg.growth"), growthValue));
else
currenttip.add(String.format("%s : %s", LangUtil.translateG("hud.msg.growth"), LangUtil.translateG("hud.msg.mature")));
return currenttip;
}
if (config.getConfig("vanilla.leverstate"))
if (blockID == leverID){
String redstoneOn = (accessor.getMetadata() & 8) == 0 ? LangUtil.translateG("hud.msg.off") : LangUtil.translateG("hud.msg.on");
currenttip.add(String.format("%s : %s", LangUtil.translateG("hud.msg.state"), redstoneOn));
return currenttip;
}
if (config.getConfig("vanilla.repeater"))
if ((blockID == repeaterIdle) ||(blockID == repeaterActv)){
int tick = (accessor.getMetadata() >> 2) + 1 ;
if (tick == 1)
currenttip.add(String.format("%s : %s tick", LangUtil.translateG("hud.msg.delay"), tick));
else
currenttip.add(String.format("%s : %s ticks", LangUtil.translateG("hud.msg.delay"), tick));
return currenttip;
}
if (config.getConfig("vanilla.comparator"))
if ((blockID == comparatorIdl) ||(blockID == comparatorAct)){
String mode = ((accessor.getMetadata() >> 2) & 1) == 0 ? LangUtil.translateG("hud.msg.comparator") : LangUtil.translateG("hud.msg.substractor");
//int outputSignal = ((TileEntityComparator)entity).func_96100_a();
currenttip.add("Mode : " + mode);
//currenttip.add(String.format("Out : %s", outputSignal));
return currenttip;
}
if (config.getConfig("vanilla.redstone"))
if (blockID == redstone){
currenttip.add(String.format("%s : %s" , LangUtil.translateG("hud.msg.power"), accessor.getMetadata()));
return currenttip;
}
if (config.getConfig("vanilla.jukebox"))
if (blockID == jukebox){
NBTTagCompound tag = accessor.getNBTData();
Item record = null;
if (tag.hasKey("Record")){
record = Item.itemsList[accessor.getNBTInteger(tag, "Record")];
currenttip.add(((ItemRecord)record).getRecordTitle());
} else {
currenttip.add(LangUtil.translateG("hud.msg.empty"));
}
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
public static void register(){
ExternalModulesHandler.instance().addConfig("VanillaMC", "vanilla.spawntype");
ExternalModulesHandler.instance().addConfig("VanillaMC", "vanilla.growthvalue");
ExternalModulesHandler.instance().addConfig("VanillaMC", "vanilla.leverstate");
ExternalModulesHandler.instance().addConfig("VanillaMC", "vanilla.repeater");
ExternalModulesHandler.instance().addConfig("VanillaMC", "vanilla.comparator");
ExternalModulesHandler.instance().addConfig("VanillaMC", "vanilla.redstone");
ExternalModulesHandler.instance().addConfigRemote("VanillaMC", "vanilla.jukebox");
ExternalModulesHandler.instance().registerHeadProvider(new HUDHandlerVanilla(), mobSpawnerID);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), cropsID);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), melonStemID);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), pumpkinStemID);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), carrotID);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), potatoID);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), leverID);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), repeaterIdle);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), repeaterActv);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), comparatorIdl);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), comparatorAct);
ExternalModulesHandler.instance().registerHeadProvider(new HUDHandlerVanilla(), redstone);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), redstone);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), jukebox);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), cocoa);
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), netherwart);
ExternalModulesHandler.instance().registerDocTextFile("/mcp/mobius/waila/addons/vanillamc/WikiData.csv");
//ExternalModulesHandler.instance().registerBlockDecorator(new HUDDecoratorVanilla(), repeaterIdle);
}
}
-33
View File
@@ -1,33 +0,0 @@
package mcp.mobius.waila.api;
import java.util.List;
import net.minecraft.item.ItemStack;
public interface IWailaBlock {
/*
* Use this method to return an item stack in case the default lookup system fails.
* Return null if you want to use the default lookup system.
* You get the world, the player and the location of the block. With that, it is easy to gather information & tile entities
*/
ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config);
/* Waila HUD is divided into 3 zones. The head corresponds to the item name,
* body to where you mostly want to put informations, and I reserve the tail for modname display
*/
/* Those 2 methods works exactly the same way, except they are related to a different zone in Waila HUD.
* You get in input world, player and the block location. You also get the itemstack as returned by the default lookup system or getWailaStack().
* ConfigHandler provides the current Waila config state so you can show/hide elements depending on the configuration. Refer the ConfigHandler class for more info.
* currenttip represents the current list of text lines in the tooltip zone.
* For example, getWailaHead() will have the current item name as currenttip.
* You can modify the tips, add more, remove some, etc.
* When you are done, just returns the currenttip and it will display in Waila.
*
* Always return the currenttip is you don't want to modify the current zone.
*/
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);
}
@@ -1,11 +0,0 @@
package mcp.mobius.waila.api;
import java.util.List;
import net.minecraft.item.ItemStack;
public interface IWailaBlockDecorator {
void decorateBlock(ItemStack itemStack, IWailaDataAccessor accessor, IWailaConfigHandler config);
}
@@ -1,28 +0,0 @@
package mcp.mobius.waila.api;
import java.util.HashMap;
import java.util.Set;
public interface IWailaConfigHandler {
/* Returns a set of all the currently loaded modules in the config handler */
public Set<String> getModuleNames();
/* Returns all the currently available options for a given module */
public HashMap<String, String> getConfigKeys(String modName);
/* Add a new option to a given module
*
* modName is the name of the module to add the option to (ie : Buildcraft, IndustrialCraft2, etc)
* key is the config key (ie : bc.tankcontent, ic2.inputvalue)
* name is the human readable name of the option (ie : "Tank content", "Max EU Input")
* */
//public void addConfig(String modName, String key, String name);
/* Returns the current value of an option (true/false) with a default value defvalue if not set*/
public boolean getConfig(String key, boolean defvalue);
/* 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);
}
@@ -1,23 +0,0 @@
package mcp.mobius.waila.api;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
public interface IWailaDataAccessor {
World getWorld();
EntityPlayer getPlayer();
Block getBlock();
int getBlockID();
int getMetadata();
TileEntity getTileEntity();
MovingObjectPosition getPosition();
Vec3 getRenderingPosition();
NBTTagCompound getNBTData();
int getNBTInteger(NBTTagCompound tag, String keyname);
double getPartialFrame();
}
@@ -1,4 +0,0 @@
package mcp.mobius.waila.api;
public interface IWailaDataProvider extends IWailaBlock{
}
-31
View File
@@ -1,31 +0,0 @@
package mcp.mobius.waila.api;
public interface IWailaRegistrar {
/* Add a config option in the section modname with displayed text configtext and access key keyname */
public void addConfig(String modname, String keyname, String configtext);
public void addConfigRemote(String modname, String keyname, String configtext);
public void addConfig(String modname, String keyname);
public void addConfigRemote(String modname, String keyname);
/* Register a IWailaDataProvider for the given blockID, either for the Head section or the Body section */
public void registerHeadProvider (IWailaDataProvider dataProvider, int blockID);
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);
public void registerStackProvider(IWailaDataProvider dataProvider, Class block);
/* Same thing, but works on a class hierarchy instead */
public void registerHeadProvider (IWailaDataProvider dataProvider, Class block);
public void registerBodyProvider (IWailaDataProvider dataProvider, Class block);
public void registerTailProvider (IWailaDataProvider dataProvider, Class block);
/* The block decorators */
public void registerBlockDecorator (IWailaBlockDecorator decorator, int blockID);
public void registerBlockDecorator (IWailaBlockDecorator decorator, Class block);
public void registerDocTextFile (String filename);
public void registerShortDataProvider (IWailaSummaryProvider dataProvider, Class item);
}
@@ -1,21 +0,0 @@
package mcp.mobius.waila.api;
import java.util.LinkedHashMap;
import net.minecraft.item.ItemStack;
public interface IWailaSummaryProvider {
/* This interface is used to control the display data in the description screen */
/* BASIC TOOLS & ITEMS DATA */
//EnumToolMaterial getMaterial(ItemStack stack);
//String getMaterialName(ItemStack stack);
//String getEffectiveBlock(ItemStack stack);
//int getHarvestLevel(ItemStack stack);
//float getEfficiencyOnProperMaterial(ItemStack stack);
//int getEnchantability(ItemStack stack);
//int getDamageVsEntity(ItemStack stack);
//int getDurability(ItemStack stack);
LinkedHashMap<String, String> getSummary(ItemStack stack, LinkedHashMap<String, String> currentSummary, IWailaConfigHandler config);
}
@@ -1,166 +0,0 @@
package mcp.mobius.waila.client;
import java.util.EnumSet;
import java.util.List;
import mcp.mobius.waila.Constants;
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.lib.lang.LangUtil;
import codechicken.nei.api.API;
import codechicken.nei.forge.GuiContainerManager;
import codechicken.nei.recipe.GuiCraftingRecipe;
import codechicken.nei.recipe.GuiUsageRecipe;
import cpw.mods.fml.client.registry.KeyBindingRegistry.KeyHandler;
import cpw.mods.fml.common.TickType;
import cpw.mods.fml.common.registry.LanguageRegistry;
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, LangUtil.translateG("keybind.configscreen"));
LanguageRegistry.instance().addStringLocalization(Constants.BIND_WAILA_SHOW, LangUtil.translateG("keybind.showhide"));
LanguageRegistry.instance().addStringLocalization(Constants.BIND_WAILA_LIQUID, LangUtil.translateG("keybind.showliquid"));
LanguageRegistry.instance().addStringLocalization(Constants.BIND_WAILA_RECIPE, LangUtil.translateG("keybind.showrecipe"));
LanguageRegistry.instance().addStringLocalization(Constants.BIND_WAILA_USAGE, LangUtil.translateG("keybind.showusage"));
LanguageRegistry.instance().addStringLocalization(Constants.BIND_WAILA_TESTING, LangUtil.translateG("keybind.testing"));
*/
//LanguageRegistry.instance().addStringLocalization(Constants.BIND_SCREEN_ENCH, "[Waila] Show enchant screen");
//LanguageRegistry.instance().addStringLocalization("key.wailatedump", "[Waila] Dump server TE");
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\u00a7o" + LangUtil.translateG("client.msg.norecipe"));
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\u00a7o" + LangUtil.translateG("client.msg.nousage"));
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";
}
}
-124
View File
@@ -1,124 +0,0 @@
package mcp.mobius.waila.client;
import mcp.mobius.waila.Constants;
import mcp.mobius.waila.addons.ExternalModulesHandler;
import mcp.mobius.waila.addons.appeng.AppEngModule;
import mcp.mobius.waila.addons.buildcraft.BCModule;
import mcp.mobius.waila.addons.buildcraft.BCPowerAPIModule;
import mcp.mobius.waila.addons.enderio.EnderIOModule;
import mcp.mobius.waila.addons.enderstorage.EnderStorageModule;
import mcp.mobius.waila.addons.etb.ETBModule;
import mcp.mobius.waila.addons.gravestone.GravestoneModule;
import mcp.mobius.waila.addons.ic2.IC2Module;
import mcp.mobius.waila.addons.projectred.ProjectRedModule;
import mcp.mobius.waila.addons.thaumcraft.ThaumcraftModule;
import mcp.mobius.waila.addons.thermalexpansion.ThermalExpansionModule;
import mcp.mobius.waila.addons.twilightforest.TwilightForestModule;
import mcp.mobius.waila.addons.vanillamc.HUDHandlerVanilla;
import mcp.mobius.waila.gui.truetyper.FontLoader;
import mcp.mobius.waila.gui.truetyper.TrueTypeFont;
import mcp.mobius.waila.handlers.SummaryProviderDefault;
import mcp.mobius.waila.handlers.hud.HUDHandlerExternal;
import mcp.mobius.waila.handlers.hud.HUDHandlerWaila;
import mcp.mobius.waila.handlers.tooltip.TooltipHandlerWaila;
import mcp.mobius.waila.overlay.WailaTickHandler;
import mcp.mobius.waila.server.ProxyServer;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.input.Keyboard;
import codechicken.lib.lang.LangUtil;
import codechicken.nei.NEIClientConfig;
import codechicken.nei.api.API;
import codechicken.nei.api.ItemInfo;
import codechicken.nei.forge.GuiContainerManager;
import cpw.mods.fml.client.registry.KeyBindingRegistry;
import cpw.mods.fml.common.registry.TickRegistry;
import cpw.mods.fml.relauncher.Side;
public class ProxyClient extends ProxyServer {
TrueTypeFont minecraftiaFont;
//public static LangUtil lang = LangUtil.loadLangDir("waila");
public ProxyClient() {}
@Override
public void registerHandlers(){
LangUtil.instance.loadLangDir("waila");
minecraftiaFont = FontLoader.createFont(new ResourceLocation("waila", "fonts/Minecraftia.ttf"), 14, true);
TickRegistry.registerTickHandler(new WailaTickHandler(), Side.CLIENT);
GuiContainerManager.addTooltipHandler(new TooltipHandlerWaila());
API.registerHighlightHandler(new HUDHandlerExternal(), ItemInfo.Layout.HEADER);
API.registerHighlightHandler(new HUDHandlerExternal(), ItemInfo.Layout.BODY);
API.registerHighlightHandler(new HUDHandlerWaila(), ItemInfo.Layout.FOOTER);
API.registerHighlightHandler(new HUDHandlerWaila(), ItemInfo.Layout.HEADER);
KeyBindingRegistry.registerKeyBinding(new ConfigKeyHandler());
// 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);
//API.addKeyBind(Constants.BIND_WIKI, "Display wiki", Keyboard.KEY_RSHIFT);
//API.addKeyBind(Constants.BIND_TECH, "Display techtree", Keyboard.KEY_RSHIFT);
ExternalModulesHandler.instance().registerShortDataProvider(new SummaryProviderDefault(), Item.class);
this.registerMods();
}
public void registerMods(){
HUDHandlerVanilla.register();
/*BETTER BARRELS*/
//BetterBarrelsModule.register();
/* BUILDCRAFT */
BCModule.register();
/* INDUSTRIALCRAFT2 */
IC2Module.register();
/*Thaumcraft*/
ThaumcraftModule.register();
/*EnderStorage*/
EnderStorageModule.register();
/*Gravestone*/
GravestoneModule.register();
/*Twilight forest*/
TwilightForestModule.register();
/* Applied Energetics */
AppEngModule.register();
/* Thermal Expansion */
ThermalExpansionModule.register();
/* ETB */
ETBModule.register();
/* EnderIO */
EnderIOModule.register();
/* Buildcraft Power API */
BCPowerAPIModule.register();
/* ProjectRed API */
ProjectRedModule.register();
}
@Override
public Object getFont(){return this.minecraftiaFont;}
}
@@ -1,81 +0,0 @@
package mcp.mobius.waila.client;
import java.util.ArrayList;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import mcp.mobius.waila.WailaExceptionHandler;
import mcp.mobius.waila.addons.ConfigHandler;
import mcp.mobius.waila.addons.ExternalModulesHandler;
import mcp.mobius.waila.api.IWailaBlockDecorator;
import mcp.mobius.waila.handlers.DataAccessor;
import mcp.mobius.waila.overlay.RayTracing;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.event.ForgeSubscribe;
public class WailaClientEventHandler {
@ForgeSubscribe
@SideOnly(Side.CLIENT)
public void onRenderWorldLast(RenderWorldLastEvent event) {
if (RayTracing.raytracedTarget == null || RayTracing.raytracedStack == null) return;
double partialTicks = event.partialTicks;
DataAccessor accessor = DataAccessor.instance;
World world = Minecraft.getMinecraft().theWorld;
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
EntityLivingBase viewEntity = Minecraft.getMinecraft().renderViewEntity;
if (world == null || player == null || viewEntity == null) return;
accessor.set(world, player, RayTracing.raytracedTarget, viewEntity, partialTicks);
Block block = accessor.getBlock();
int blockID = accessor.getBlockID();
if (!ExternalModulesHandler.instance().hasBlockDecorator(blockID) && !ExternalModulesHandler.instance().hasBlockDecorator(block)) return;
GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glDepthMask(false);
if (ExternalModulesHandler.instance().hasBlockDecorator(blockID)){
for (IWailaBlockDecorator decorator : ExternalModulesHandler.instance().getBlockDecorators(blockID))
try{
GL11.glPushMatrix();
decorator.decorateBlock(RayTracing.raytracedStack, accessor, ConfigHandler.instance());
GL11.glPopMatrix();
} catch (Throwable e){
GL11.glPopMatrix();
WailaExceptionHandler.handleErr(e, decorator.getClass().toString(), null);
}
}
if (ExternalModulesHandler.instance().hasBlockDecorator(block)){
for (IWailaBlockDecorator decorator : ExternalModulesHandler.instance().getBlockDecorators(block))
try{
GL11.glPushMatrix();
decorator.decorateBlock(RayTracing.raytracedStack, accessor, ConfigHandler.instance());
GL11.glPopMatrix();
} catch (Throwable e){
GL11.glPopMatrix();
WailaExceptionHandler.handleErr(e, decorator.getClass().toString(), null);
}
}
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glPopAttrib();
}
}
-101
View File
@@ -1,101 +0,0 @@
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;
}
}
-161
View File
@@ -1,161 +0,0 @@
package mcp.mobius.waila.gui.helpers;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.Vec3;
public class UIHelper {
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);
}
public static void drawBillboardText(String text, Vec3 pos, float offX, float offY, float offZ, double partialFrame){
UIHelper.drawBillboardText(text, (float)pos.xCoord, (float)pos.yCoord, (float)pos.zCoord, offX, offY, offZ, partialFrame);
}
public static void drawBillboardText(String text, float posX, float posY, float posZ, float offX, float offY, float offZ, double partialFrame){
EntityLivingBase player = Minecraft.getMinecraft().renderViewEntity;
float playerViewY = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * (float)partialFrame;
float playerViewX = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * (float)partialFrame;
UIHelper.drawFloatingText(text, posX, posY, posZ, offX, offY, offZ, playerViewX, playerViewY * -1.0F, 0.0F);
}
public static void drawFloatingText(String text, Vec3 pos, float offX, float offY, float offZ, float rotX, float rotY, float rotZ){
UIHelper.drawFloatingText(text, (float)pos.xCoord, (float)pos.yCoord, (float)pos.zCoord, offX, offY, offZ, rotX, rotY, rotZ);
}
public static void drawFloatingText(String text, float posX, float posY, float posZ, float offX, float offY, float offZ, float rotX, float rotY, float rotZ){
if (text.isEmpty()) return;
FontRenderer fontrenderer = Minecraft.getMinecraft().fontRenderer;
float f = 1.6F;
float f1 = 0.016666668F * f;
GL11.glPushMatrix();
//GL11.glTranslatef((float)accessor.getPosition().blockX + 0.0F, (float)accessor.getPosition().blockY + 0.5F, (float)accessor.getPosition().blockZ);
GL11.glTranslatef(posX + offX, posY + offY, posZ + offZ);
//GL11.glTranslatef(posX, posY, posZ);
GL11.glNormal3f(0.0F, 1.0F, 0.0F);
GL11.glRotatef(rotY, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(rotX, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(rotZ, 0.0F, 0.0F, 1.0F);
//GL11.glTranslatef(offX, offY, offZ);
GL11.glScalef(-f1, -f1, f1);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDepthMask(false);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
byte b0 = 0;
Tessellator tessellator = Tessellator.instance;
GL11.glDisable(GL11.GL_TEXTURE_2D);
tessellator.startDrawingQuads();
int j = fontrenderer.getStringWidth(text) / 2;
tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
tessellator.addVertex((double)(-j - 1), (double)(-1 + b0), 0.0D);
tessellator.addVertex((double)(-j - 1), (double)(8 + b0), 0.0D);
tessellator.addVertex((double)(j + 1), (double)(8 + b0), 0.0D);
tessellator.addVertex((double)(j + 1), (double)(-1 + b0), 0.0D);
tessellator.draw();
GL11.glEnable(GL11.GL_TEXTURE_2D);
fontrenderer.drawString(text, -fontrenderer.getStringWidth(text) / 2, b0, 553648127);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDepthMask(true);
fontrenderer.drawString(text, -fontrenderer.getStringWidth(text) / 2, b0, -1);
//GL11.glEnable(GL11.GL_LIGHTING);
//GL11.glDisable(GL11.GL_BLEND);
//GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glPopMatrix();
}
public static void drawRectangle(double x1, double y1, double z1, double x2, double y2, double z2, int r, int g, int b, int a){
Tessellator tessellator = Tessellator.instance;
tessellator.setColorRGBA(r, g, b, a);
tessellator.startDrawingQuads();
tessellator.addVertex(x1, y2, z1);
tessellator.addVertex(x1, y1, z2);
tessellator.addVertex(x2, y1, z2);
tessellator.addVertex(x2, y2, z1);
tessellator.draw();
}
public static void drawRectangleEW(double x1, double y1, double z1, double x2, double y2, double z2, int r, int g, int b, int a){
Tessellator tessellator = Tessellator.instance;
tessellator.setColorRGBA(r, g, b, a);
tessellator.startDrawingQuads();
tessellator.addVertex(x1, y1, z1);
tessellator.addVertex(x1, y1, z2);
tessellator.addVertex(x2, y2, z2);
tessellator.addVertex(x2, y2, z1);
tessellator.draw();
}
}
@@ -1,64 +0,0 @@
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();
}
@@ -1,90 +0,0 @@
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();
}
}
@@ -1,32 +0,0 @@
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(), "screen.button.waila", new ScreenWailaConfig(this)));
buttonContainer.addButton( new ButtonScreenChange(this.getRoot(), "screen.button.modules", new ScreenModuleChoice(this)));
this.getRoot().addWidget("LayoutBack", new LayoutBase(this.getRoot()));
this.getRoot().getWidget("LayoutBack").setGeometry(new WidgetGeometry(0.0, 80.0, 100.0, 20.0, CType.RELXY, CType.RELXY));
this.getRoot().getWidget("LayoutBack").addWidget("ButtonBack", new ButtonScreenChange(this.getRoot().getWidget("LayoutBack"), "screen.button.back", this.parent));
this.getRoot().getWidget("LayoutBack").getWidget("ButtonBack").setGeometry(new WidgetGeometry(50.0, 50.0, 100.0, 20.0, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
}
}
@@ -1,254 +0,0 @@
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, "screen.label.dragtuto")).setGeometry(new WidgetGeometry(50.0, 30.0,20,20, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));;
IWidget layoutX = this.addWidget("LayoutX", new LayoutBase(this));
layoutX.setGeometry(new WidgetGeometry(35.0,50.0,20,80,CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
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, "screen.label.scale")).setGeometry(new WidgetGeometry(50.0, 0.0,20,20, CType.REL_X, CType.ABSXY, WAlign.CENTER, WAlign.TOP));
layoutScale.addWidget("ButtonScaleAdd", new ButtonLabel(null, "+")) .setGeometry(new WidgetGeometry(0.0, 10.0,20,20, CType.REL_X, CType.ABSXY, WAlign.LEFT, WAlign.TOP));
layoutScale.addWidget("ValueDisplayScale", new LabelFixedFont(null, "0")) .setGeometry(new WidgetGeometry(50.0, 40.0,20,20, CType.REL_X, CType.ABSXY, WAlign.CENTER, WAlign.TOP));
layoutScale.addWidget("ButtonScaleSub", new ButtonLabel(null, "-")) .setGeometry(new WidgetGeometry(0.0, 60.0,20,20, CType.REL_X, CType.ABSXY, WAlign.LEFT, WAlign.TOP));
this.addWidget("ButtonCancel", new ButtonScreenChange(null, "screen.button.cancel", prevScreen)).setGeometry(new WidgetGeometry(70.0,97.0,75,20, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.BOTTOM));
this.addWidget("ButtonOk", new ButtonScreenChange(null, "screen.button.ok", prevScreen)).setGeometry(new WidgetGeometry(30.0,97.0,75,20, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.BOTTOM));
this.addWidget("ButtonDefault",new ButtonLabel(null, "screen.button.default")).setGeometry(new WidgetGeometry(50.0,97.0,75,20, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.BOTTOM));
((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));
}
}
@@ -1,32 +0,0 @@
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));
}
}
@@ -1,49 +0,0 @@
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, "screen.button.no", "screen.button.yes"), ConfigHandler.instance().getConfigKeys(this.modName).get(key));
else
buttonContainer.addButton(new ButtonBooleanConfig(this.getRoot(), key, "screen.button.no", "screen.button.yes"), ConfigHandler.instance().getConfigKeys(this.modName).get(key));
//buttonContainer.addButton(new ButtonConfigRemote(-1, "No", "Yes", ConfigHandler.instance().getConfigKeys(this.modName).get(key), key ));
//else
//buttonContainer.addButton(new ButtonConfigOption(-1, "No", "Yes", ConfigHandler.instance().getConfigKeys(this.modName).get(key), key ));
}
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"), "screen.button.back", this.parent));
this.getRoot().getWidget("LayoutBack").getWidget("ButtonBack").setGeometry(new WidgetGeometry(50.0, 50.0, 100.0, 20.0, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
}
}
@@ -1,40 +0,0 @@
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, "screen.button.hidden", "screen.button.visible"), "choice.showhidewaila");
buttonContainer.addButton( new ButtonBooleanConfig(this.getRoot(), Constants.CFG_WAILA_MODE, true, true, "screen.button.maintained", "screen.button.toggled"), "choice.toggledmaintained");
buttonContainer.addButton( new ButtonBooleanConfig(this.getRoot(), Constants.CFG_WAILA_METADATA, true, false,"screen.button.hidden", "screen.button.visible"), "choice.showhideidmeta");
buttonContainer.addButton( new ButtonBooleanConfig(this.getRoot(), Constants.CFG_WAILA_LIQUID, true, false,"screen.button.hidden", "screen.button.visible"), "choice.showliquids");
this.getRoot().addWidget("LayoutConfigPos", new LayoutBase(this.getRoot()));
this.getRoot().getWidget("LayoutConfigPos").setGeometry(new WidgetGeometry(0.0, 50.0, 100.0, 20.0, CType.RELXY, CType.RELXY));
this.getRoot().getWidget("LayoutConfigPos").addWidget("ButtonConfigPos", new ButtonScreenChange(null, "screen.button.configureaspect", new ScreenHUDConfig(this)));
this.getRoot().getWidget("LayoutConfigPos").getWidget("ButtonConfigPos").setGeometry(new WidgetGeometry(50.0, 50.0, 150.0, 20.0, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
this.getRoot().addWidget("LayoutBack", new LayoutBase(this.getRoot()));
this.getRoot().getWidget("LayoutBack").setGeometry(new WidgetGeometry(0.0, 80.0, 100.0, 20.0, CType.RELXY, CType.RELXY));
this.getRoot().getWidget("LayoutBack").addWidget("ButtonBack", new ButtonScreenChange(null, "screen.button.back", this.parent));
this.getRoot().getWidget("LayoutBack").getWidget("ButtonBack").setGeometry(new WidgetGeometry(50.0, 50.0, 100.0, 20.0, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
}
}
@@ -1,79 +0,0 @@
package mcp.mobius.waila.gui.screens.info;
import codechicken.lib.lang.LangUtil;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.gui.interfaces.CType;
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));
String columnName = "\u00a7a\u00a7o" + LangUtil.translateG("enchant.title.name");
String columnMinLvl= "\u00a7a\u00a7o" + LangUtil.translateG("enchant.title.minlvl");;
String columnMaxLvl= "\u00a7a\u00a7o" + LangUtil.translateG("enchant.title.maxlvl");;
String columnWeight= "\u00a7a\u00a7o" + LangUtil.translateG("enchant.title.weight");;
((ViewTable)this.getRoot().getWidget("Table"))
.setColumnsTitle(columnName, columnMinLvl, columnMaxLvl, columnWeight, "\u00a7a\u00a7oMod")
.setColumnsWidth(35.0, 10.0, 10.0, 10.0, 35.0)
.setColumnsAlign(WAlign.LEFT, WAlign.CENTER, WAlign.CENTER, WAlign.CENTER, WAlign.LEFT);
}
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("%s : %s", LangUtil.translateG("enchant.label.enchantability"), value));
this.getRoot().getWidget("Layout_Title").adjustSize();
return this;
}
/*
public ScreenEnchants setStack(ItemStack stack){
((ItemStackDisplay)this.getRoot().getWidget("ItemStack")).setStack(stack);
return this;
}
*/
}
@@ -1,70 +0,0 @@
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);
}
}
@@ -1,29 +0,0 @@
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));
}
}
@@ -1,118 +0,0 @@
package mcp.mobius.waila.gui.truetyper;
/**
* TrueTyper: Open Source TTF implementation for Minecraft.
* Copyright (C) 2013 - Mr_okushama
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import java.nio.FloatBuffer;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
import org.lwjgl.util.vector.Matrix4f;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraftforge.client.GuiIngameForge;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.common.MinecraftForge;
public class FontHelper {
private static String formatEscape = "\u00A7";
public static void drawString(String s, float x, float y, TrueTypeFont font, float scaleX, float scaleY, float... rgba){
drawString(s,x,y,font,scaleX,scaleY,0,rgba);
}
public static void drawString(String s, float x, float y, TrueTypeFont font, float scaleX, float scaleY, float rotationZ, float... rgba){
Minecraft mc = Minecraft.getMinecraft();
ScaledResolution sr = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
if(mc.gameSettings.hideGUI){
return;
}
int amt = 1;
if(sr.getScaleFactor() == 1){
amt = 2;
}
FloatBuffer matrixData = BufferUtils.createFloatBuffer(16);
GL11.glGetFloat(GL11.GL_MODELVIEW_MATRIX, matrixData);
FontHelper.set2DMode(matrixData);
GL11.glPushMatrix();
y = mc.displayHeight-(y*sr.getScaleFactor())-(((font.getLineHeight()/amt)));
float tx = (x*sr.getScaleFactor())+(font.getWidth(s)/2);
float tranx = tx+2;
float trany = y+(font.getLineHeight()/2);
GL11.glTranslatef(tranx,trany,0);
GL11.glRotatef(rotationZ, 0f, 0f, 1f);
GL11.glTranslatef(-tranx,-trany,0);
GL11.glEnable(GL11.GL_BLEND);
if(s.contains(formatEscape)){
String[] pars = s.split(formatEscape);
float totalOffset = 0;
for(int i = 0; i < pars.length; i++){
String par = pars[i];
float[] c = rgba;
if(i > 0){
c = Formatter.getFormatted(par.charAt(0));
par = par.substring(1, par.length());
}
font.drawString((x*sr.getScaleFactor()+totalOffset), y, par, scaleX/amt, scaleY/amt, c);
totalOffset += font.getWidth(par);
}
}else{
font.drawString((x*sr.getScaleFactor()), y, s, scaleX/amt, scaleY/amt, rgba);
}
GL11.glPopMatrix();
GL11.glDisable(GL11.GL_BLEND);
FontHelper.set3DMode();
}
private static void set2DMode(FloatBuffer matrixData) {
Minecraft mc = Minecraft.getMinecraft();
ScaledResolution sr = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
mc.entityRenderer.setupOverlayRendering();
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glPushMatrix();
//GL11.glLoadMatrix(matrixData);
GL11.glLoadIdentity();
GL11.glOrtho(0, mc.displayWidth, 0, mc.displayHeight, -1, 1);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glPushMatrix();
GL11.glLoadIdentity();
Matrix4f matrix = new Matrix4f();
matrix.load(matrixData);
GL11.glTranslatef(matrix.m30*sr.getScaleFactor(),-matrix.m31*sr.getScaleFactor(), 0f);
}
private static void set3DMode() {
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glPopMatrix();
Minecraft mc = Minecraft.getMinecraft();
mc.entityRenderer.setupOverlayRendering();
}
}
@@ -1,69 +0,0 @@
package mcp.mobius.waila.gui.truetyper;
/**
* TrueTyper: Open Source TTF implementation for Minecraft.
* Copyright (C) 2013 - Mr_okushama
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import java.awt.Font;
import java.awt.FontFormatException;
import java.awt.geom.AffineTransform;
import java.io.IOException;
import java.util.ArrayList;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
public class FontLoader{
public static TrueTypeFont loadSystemFont(String name, float defSize, boolean antialias){
return loadSystemFont(name, defSize, antialias, Font.TRUETYPE_FONT);
}
public static TrueTypeFont loadSystemFont(String name, float defSize, boolean antialias, int type){
Font font;
TrueTypeFont out = null;
try {
font = new Font(name, type, (int)defSize);
font = font.deriveFont(defSize);
out = new TrueTypeFont(font, antialias);
} catch (Exception e) {
e.printStackTrace();
}
return out;
}
public static TrueTypeFont createFont(ResourceLocation res, float defSize, boolean antialias){
return createFont(res, defSize, antialias, Font.TRUETYPE_FONT);
}
public static TrueTypeFont createFont(ResourceLocation res, float defSize, boolean antialias, int type){
Font font;
TrueTypeFont out = null;
try {
font = Font.createFont(type, Minecraft.getMinecraft().func_110442_L().func_110536_a(res).func_110527_b());
font = font.deriveFont(defSize);
out = new TrueTypeFont(font, antialias);
} catch (Exception e) {
e.printStackTrace();
}
return out;
}
}
@@ -1,86 +0,0 @@
package mcp.mobius.waila.gui.truetyper;
/**
* TrueTyper: Open Source TTF implementation for Minecraft.
* Copyright (C) 2013 - Mr_okushama
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
public class Formatter {
public static float[] getFormatted(char c){
int[] outrgba = null;
float[] outfloat;
switch(c){
case '0':
outrgba = new int[]{0,0,0,0,255};
break;
case '1':
outrgba = new int[]{0,0,170,255};
break;
case '2':
outrgba = new int[]{0,170,0,255};
break;
case '3':
outrgba = new int[]{0,170,170,255};
break;
case '4':
outrgba = new int[]{170,0,0,255};
break;
case '5':
outrgba = new int[]{170,0,170,255};
break;
case '6':
outrgba = new int[]{255,170,0,255};
break;
case '7':
outrgba = new int[]{170,170,170,255};
break;
case '8':
outrgba = new int[]{85,85,85,255};
break;
case '9':
outrgba = new int[]{85,85,255,255};
break;
case 'a':
outrgba = new int[]{85,255,85,255};
break;
case 'b':
outrgba = new int[]{85,255,255,255};
break;
case 'c':
outrgba = new int[]{255,85,85,255};
break;
case 'd':
outrgba = new int[]{85,255,255,255};
break;
case 'e':
outrgba = new int[]{255,255,85,255};
break;
case 'f':
outrgba = new int[]{255,255,255,255};
break;
default:
outrgba = new int[]{255,255,255,255};
break;
}
outfloat = new float[outrgba.length];
for(int i = 0; i < outrgba.length ; i++){
outfloat[i] = outrgba[i] > 0 ? outrgba[i]/255 : 0;
}
return outfloat;
}
}
-71
View File
@@ -1,71 +0,0 @@
package mcp.mobius.waila.gui.truetyper;
/**
* TrueTyper: Open Source TTF implementation for Minecraft.
* Copyright (C) 2013 - Mr_okushama
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import java.awt.Font;
import java.awt.GraphicsEnvironment;
import java.util.ArrayList;
import net.minecraft.util.EnumChatFormatting;
public class Test {
public static ArrayList<TrueTypeFont> testFonts = new ArrayList<TrueTypeFont>();
public static float[] white = {1f,1f,1f,1f};
public static boolean init = false;
public static void initTest(){
return;
/*
GraphicsEnvironment e = GraphicsEnvironment.getLocalGraphicsEnvironment();
Font[] fonts = e.getAllFonts();
{
int max = 9;
for(Font f : fonts){
boolean pass = true;
for(TrueTypeFont ttf : testFonts){
if(ttf.font.getFontName().startsWith(f.getFontName().substring(0, 1))){
pass = false;
continue;
}
}
if(pass){
max--;
if(max == 0){
break;
}
testFonts.add(FontLoader.loadSystemFont(f.getFontName(), 24f, false));
testFonts.add(FontLoader.loadSystemFont(f.getFontName(), 24f, true));
}
}
}
init = true;
}
public static void doTest(){
if(!init){
initTest();
}
for(int i =0; i < testFonts.size(); i++){
int y = 10+i*12;
int x = 10;
FontHelper.drawString("He"+EnumChatFormatting.GOLD+"llo "+EnumChatFormatting.GREEN+"wor"+EnumChatFormatting.YELLOW+"ld", x, y, testFonts.get(i), 1f, 1f);
}*/
}
}
@@ -1,507 +0,0 @@
package mcp.mobius.waila.gui.truetyper;
import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer;
import java.awt.image.DataBufferByte;
import java.awt.image.DataBufferInt;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.IntBuffer;
import java.util.HashMap;
import java.util.Map;
import java.awt.GraphicsEnvironment;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.settings.GameSettings;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import org.lwjgl.opengl.GL30;
import org.lwjgl.util.glu.GLU;
/**
* TrueTyper: Open Source TTF implementation for Minecraft.
* Modified from Slick2D - under BSD Licensing - http://slick.ninjacave.com/license/
*
* Copyright (c) 2013 - Slick2D
*
* All rights reserved.
*/
public class TrueTypeFont {
public final static int
ALIGN_LEFT = 0,
ALIGN_RIGHT = 1,
ALIGN_CENTER = 2;
/** Array that holds necessary information about the font characters */
private FloatObject[] charArray = new FloatObject[256];
/** Map of user defined font characters (Character <-> IntObject) */
private Map customChars = new HashMap();
/** Boolean flag on whether AntiAliasing is enabled or not */
protected boolean antiAlias;
/** Font's size */
private float fontSize = 0;
/** Font's height */
private float fontHeight = 0;
/** Texture used to cache the font 0-255 characters */
private int fontTextureID;
/** Default font texture width */
private int textureWidth = 1024;
/** Default font texture height */
private int textureHeight = 1024;
/** A reference to Java's AWT Font that we create our font texture from */
protected Font font;
/** The font metrics for our Java AWT font */
private FontMetrics fontMetrics;
private int correctL = 9, correctR = 8;
private class FloatObject {
/** Character's width */
public float width;
/** Character's height */
public float height;
/** Character's stored x position */
public float storedX;
/** Character's stored y position */
public float storedY;
}
public TrueTypeFont(Font font, boolean antiAlias, char[] additionalChars) {
this.font = font;
this.fontSize = font.getSize()+3;
this.antiAlias = antiAlias;
createSet( additionalChars );
System.out.println("TrueTypeFont loaded: "+font+" - AntiAlias = "+antiAlias);
fontHeight -= 1;
if (fontHeight <= 0) fontHeight = 1;
}
public TrueTypeFont(Font font, boolean antiAlias) {
this( font, antiAlias, null );
}
public void setCorrection(boolean on) {
if (on) {
correctL = 2;
correctR = 1;
} else {
correctL = 0;
correctR = 0;
}
}
private BufferedImage getFontImage(char ch) {
// Create a temporary image to extract the character's size
BufferedImage tempfontImage = new BufferedImage(1, 1,
BufferedImage.TYPE_INT_ARGB);
Graphics2D g = (Graphics2D) tempfontImage.getGraphics();
if (antiAlias == true) {
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
}
g.setFont(font);
fontMetrics = g.getFontMetrics();
float charwidth = fontMetrics.charWidth(ch)+8;
if (charwidth <= 0) {
charwidth = 7;
}
float charheight = fontMetrics.getHeight()+3;
if (charheight <= 0) {
charheight = fontSize;
}
// Create another image holding the character we are creating
BufferedImage fontImage;
fontImage = new BufferedImage((int)charwidth,(int)charheight,
BufferedImage.TYPE_INT_ARGB);
Graphics2D gt = (Graphics2D) fontImage.getGraphics();
if (antiAlias == true) {
gt.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
}
gt.setFont(font);
gt.setColor(Color.WHITE);
int charx = 3;
int chary = 1;
gt.drawString(String.valueOf(ch), (charx), (chary)
+ fontMetrics.getAscent());
return fontImage;
}
private void createSet( char[] customCharsArray ) {
// If there are custom chars then I expand the font texture twice
if (customCharsArray != null && customCharsArray.length > 0) {
textureWidth *= 2;
}
// In any case this should be done in other way. Texture with size 512x512
// can maintain only 256 characters with resolution of 32x32. The texture
// size should be calculated dynamicaly by looking at character sizes.
try {
BufferedImage imgTemp = new BufferedImage(textureWidth, textureHeight, BufferedImage.TYPE_INT_ARGB);
Graphics2D g = (Graphics2D) imgTemp.getGraphics();
g.setColor(new Color(0,0,0,1));
g.fillRect(0,0,textureWidth,textureHeight);
float rowHeight = 0;
float positionX = 0;
float positionY = 0;
int customCharsLength = ( customCharsArray != null ) ? customCharsArray.length : 0;
for (int i = 0; i < 256 + customCharsLength; i++) {
// get 0-255 characters and then custom characters
char ch = ( i < 256 ) ? (char) i : customCharsArray[i-256];
BufferedImage fontImage = getFontImage(ch);
FloatObject newIntObject = new FloatObject();
newIntObject.width = fontImage.getWidth();
newIntObject.height = fontImage.getHeight();
if (positionX + newIntObject.width >= textureWidth) {
positionX = 0;
positionY += rowHeight;
rowHeight = 0;
}
newIntObject.storedX = positionX;
newIntObject.storedY = positionY;
if (newIntObject.height > fontHeight) {
fontHeight = newIntObject.height;
}
if (newIntObject.height > rowHeight) {
rowHeight = newIntObject.height;
}
// Draw it here
g.drawImage(fontImage, (int)positionX, (int)positionY, null);
positionX += newIntObject.width;
if( i < 256 ) { // standard characters
charArray[i] = newIntObject;
} else { // custom characters
customChars.put( new Character( ch ), newIntObject );
}
fontImage = null;
}
fontTextureID = loadImage(imgTemp);
//.getTexture(font.toString(), imgTemp);
} catch (Exception e) {
System.err.println("Failed to create font.");
e.printStackTrace();
}
}
private void drawQuad(float drawX, float drawY, float drawX2, float drawY2,
float srcX, float srcY, float srcX2, float srcY2) {
float DrawWidth = drawX2 - drawX;
float DrawHeight = drawY2 - drawY;
float TextureSrcX= srcX / textureWidth;
float TextureSrcY = srcY / textureHeight;
float SrcWidth = srcX2 - srcX;
float SrcHeight = srcY2 - srcY;
float RenderWidth = (SrcWidth / textureWidth);
float RenderHeight = (SrcHeight / textureHeight);
Tessellator t = Tessellator.instance;
//t.setColorRGBA_F(0f, 0f, 0f, 1f);
t.addVertexWithUV(drawX, drawY, 0, TextureSrcX, TextureSrcY);
//GL11.glTexCoord2f(TextureSrcX, TextureSrcY);
//GL11.glVertex2f(drawX, drawY);
t.addVertexWithUV(drawX, drawY + DrawHeight, 0, TextureSrcX, TextureSrcY + RenderHeight);
//GL11.glTexCoord2f(TextureSrcX, TextureSrcY + RenderHeight);
//GL11.glVertex2f(drawX, drawY + DrawHeight);
t.addVertexWithUV(drawX + DrawWidth, drawY + DrawHeight, 0, TextureSrcX + RenderWidth, TextureSrcY + RenderHeight);
//GL11.glTexCoord2f(TextureSrcX + RenderWidth, TextureSrcY + RenderHeight);
//GL11.glVertex2f(drawX + DrawWidth, drawY + DrawHeight);
t.addVertexWithUV(drawX + DrawWidth, drawY, 0, TextureSrcX + RenderWidth, TextureSrcY);
//GL11.glTexCoord2f(TextureSrcX + RenderWidth, TextureSrcY);
//GL11.glVertex2f(drawX + DrawWidth, drawY);
}
public float getWidth(String whatchars) {
float totalwidth = 0;
FloatObject floatObject = null;
int currentChar = 0;
float lastWidth = -10f;
for (int i = 0; i < whatchars.length(); i++) {
currentChar = whatchars.charAt(i);
if (currentChar < 256) {
floatObject = charArray[currentChar];
} else {
floatObject = (FloatObject)customChars.get( new Character( (char) currentChar ) );
}
if( floatObject != null ){
totalwidth += floatObject.width/2;
lastWidth = floatObject.width;
}
}
//System.out.println("Size: "+totalwidth);
return this.fontMetrics.stringWidth(whatchars);
//return (totalwidth);
}
public float getHeight() {
return fontHeight;
}
public float getHeight(String HeightString) {
return fontHeight;
}
public float getLineHeight() {
return fontHeight;
}
public void drawString(float x, float y, String whatchars, float scaleX, float scaleY, float... rgba) {
if(rgba.length == 0) rgba = new float[]{1f,1f,1f,1f};
drawString(x,y,whatchars, 0, whatchars.length()-1, scaleX, scaleY, ALIGN_LEFT, rgba);
}
public void drawString(float x, float y, String whatchars, float scaleX, float scaleY, int format, float... rgba) {
if(rgba.length == 0) rgba = new float[]{1f,1f,1f,1f};
drawString(x,y,whatchars, 0, whatchars.length()-1, scaleX, scaleY, format, rgba);
}
public void drawString(float x, float y, String whatchars, int startIndex, int endIndex, float scaleX, float scaleY, int format, float... rgba) {
if(rgba.length == 0) rgba = new float[]{1f,1f,1f,1f};
GL11.glPushMatrix();
GL11.glScalef (scaleX, scaleY, 1.0f);
FloatObject floatObject = null;
int charCurrent;
float totalwidth = 0;
int i = startIndex, d, c;
float startY = 0;
switch (format) {
case ALIGN_RIGHT: {
d = -1;
c = correctR;
while (i < endIndex) {
if (whatchars.charAt(i) == '\n') startY -= fontHeight;
i++;
}
break;
}
case ALIGN_CENTER: {
for (int l = startIndex; l <= endIndex; l++) {
charCurrent = whatchars.charAt(l);
if (charCurrent == '\n') break;
if (charCurrent < 256) {
floatObject = charArray[charCurrent];
} else {
floatObject = (FloatObject)customChars.get( new Character( (char) charCurrent ) );
}
totalwidth += floatObject.width-correctL;
}
totalwidth /= -2;
}
case ALIGN_LEFT:
default: {
d = 1;
c = correctL;
break;
}
}
GL11.glBindTexture(GL11.GL_TEXTURE_2D, fontTextureID);
Tessellator t = Tessellator.instance;
t.startDrawingQuads();
// GL11.glBegin(GL11.GL_QUADS);
if(rgba.length == 4)
t.setColorRGBA_F(rgba[0], rgba[1], rgba[2], rgba[3]);
while (i >= startIndex && i <= endIndex) {
charCurrent = whatchars.charAt(i);
if (charCurrent < 256) {
floatObject = charArray[charCurrent];
} else {
floatObject = (FloatObject)customChars.get( new Character( (char) charCurrent ) );
}
if( floatObject != null ) {
if (d < 0) totalwidth += (floatObject.width-c) * d;
if (charCurrent == '\n') {
startY -= fontHeight * d;
totalwidth = 0;
if (format == ALIGN_CENTER) {
for (int l = i+1; l <= endIndex; l++) {
charCurrent = whatchars.charAt(l);
if (charCurrent == '\n') break;
if (charCurrent < 256) {
floatObject = charArray[charCurrent];
} else {
floatObject = (FloatObject)customChars.get( new Character( (char) charCurrent ) );
}
totalwidth += floatObject.width-correctL;
}
totalwidth /= -2;
}
//if center get next lines total width/2;
}
else {
drawQuad((totalwidth + floatObject.width) + x/scaleX,
startY + y/scaleY,
totalwidth + x/scaleX,
(startY + floatObject.height) + y/scaleY,
floatObject.storedX + floatObject.width,
floatObject.storedY + floatObject.height,
floatObject.storedX,
floatObject.storedY);
if (d > 0) totalwidth += (floatObject.width-c) * d ;
}
i += d;
}
}
t.draw();
// GL11.glEnd();
GL11.glPopMatrix();
}
public static int loadImage(BufferedImage bufferedImage) {
try {
short width = (short)bufferedImage.getWidth();
short height = (short)bufferedImage.getHeight();
//textureLoader.bpp = bufferedImage.getColorModel().hasAlpha() ? (byte)32 : (byte)24;
int bpp = (byte)bufferedImage.getColorModel().getPixelSize();
ByteBuffer byteBuffer;
DataBuffer db = bufferedImage.getData().getDataBuffer();
if (db instanceof DataBufferInt) {
int intI[] = ((DataBufferInt)(bufferedImage.getData().getDataBuffer())).getData();
byte newI[] = new byte[intI.length * 4];
for (int i = 0; i < intI.length; i++) {
byte b[] = intToByteArray(intI[i]);
int newIndex = i*4;
newI[newIndex] = b[1];
newI[newIndex+1] = b[2];
newI[newIndex+2] = b[3];
newI[newIndex+3] = b[0];
}
byteBuffer = ByteBuffer.allocateDirect(
width*height*(bpp/8))
.order(ByteOrder.nativeOrder())
.put(newI);
} else {
byteBuffer = ByteBuffer.allocateDirect(
width*height*(bpp/8))
.order(ByteOrder.nativeOrder())
.put(((DataBufferByte)(bufferedImage.getData().getDataBuffer())).getData());
}
byteBuffer.flip();
int internalFormat = GL11.GL_RGBA8,
format = GL11.GL_RGBA;
IntBuffer textureId = BufferUtils.createIntBuffer(1);;
GL11.glGenTextures(textureId);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureId.get(0));
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
//GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
//GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_NEAREST);
//GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR);
//GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST_MIPMAP_LINEAR);
//GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST_MIPMAP_NEAREST);
GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE);
GLU.gluBuild2DMipmaps(GL11.GL_TEXTURE_2D, internalFormat, width, height, format, GL11.GL_UNSIGNED_BYTE, byteBuffer);
return textureId.get(0);
} catch (Exception e) {
e.printStackTrace();
System.exit(-1);
}
return -1;
}
public static boolean isSupported(String fontname) {
Font font[] = getFonts();
for (int i = font.length-1; i >= 0; i--) {
if (font[i].getName().equalsIgnoreCase(fontname))
return true;
}
return false;
}
public static Font[] getFonts() {
return GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
}
public static byte[] intToByteArray(int value) {
return new byte[] {
(byte)(value >>> 24),
(byte)(value >>> 16),
(byte)(value >>> 8),
(byte)value};
}
public void destroy() {
IntBuffer scratch = BufferUtils.createIntBuffer(1);
scratch.put(0, fontTextureID);
GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
GL11.glDeleteTextures(scratch);
}
}
@@ -1,49 +0,0 @@
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();
}
}
@@ -1,60 +0,0 @@
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;
import codechicken.lib.lang.LangUtil;
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 = LangUtil.translateG(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.mc.fontRenderer.drawString(this.text, pos.getX(), pos.getY(), this.color);
this.loadGLState();
}
}
@@ -1,47 +0,0 @@
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);
}
*/
}
@@ -1,122 +0,0 @@
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);
}
}
@@ -1,68 +0,0 @@
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); }
}
@@ -1,43 +0,0 @@
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); }
}
@@ -1,31 +0,0 @@
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();
}
}
@@ -1,49 +0,0 @@
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
@@ -1,201 +0,0 @@
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;
}
}
@@ -1,179 +0,0 @@
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);
}
}
Loaded 100 of 405 files, more files were not shown because too many files have changed in this diff. Show more