Compare commits

...
106 Commits
Author SHA1 Message Date
UltraProdigy d5669e3000 ci: run build and test on release branches 2026-11-09 01:43:44 -05:00
evgengoldwarandMartin Robertz f998f9ebfe Fix TTRenderStack (#75)
Co-authored-by: Martin Robertz <[email protected]>
2026-08-24 00:08:51 +07:00
evgengoldwar 6d0f162453 Add ColorUtils (#74) 2026-08-23 13:27:35 +02:00
evgengoldwar 9e3ef39e30 Improve progress bar (#73) 2026-08-22 23:16:21 -04:00
SuperSoupr 452fbfa47c Change progress bars lengths (#71) 2026-07-19 13:47:43 +03:00
Guillaume MercierandGuillaume Mercier d8477007c9 Add compat for fluid colors for non GT5u fluids (#69)
Co-authored-by: Guillaume Mercier <[email protected]>
2026-06-05 16:01:44 -04:00
flamingowrangler2869 bd5905dfc0 fix comparator "substractor" mode spelling (#70) 2026-05-24 00:26:01 +00:00
Algent 80e761d83f Allow Waila to handle bigger NBT packet (#68) 2026-05-12 14:12:37 +02:00
MalTeeezandgithub-actions[bot] ef0f8b5329 Prevent overflowing of bars in tooltip renderers (#66)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-05-11 18:50:24 +02:00
Alexdoru 65e4a773d0 [Memory-opti:fix leak] fix client leak from DataAccessorFMP (#65) 2026-05-10 20:19:36 +02:00
jackandMartin Robertz 30717912fb Added GUI config factory (#63)
Co-authored-by: Martin Robertz <[email protected]>
2026-05-03 10:05:56 +02:00
Ranzu 1421b83a5b Styling of text and buttons (#64) 2026-04-29 18:24:21 +02:00
UltraProdigy 2de1ec4235 Fix Deps (#62) 2026-04-27 23:35:30 +02:00
Martin Robertz 91f8019410 update+gradle+deps+bs 2026-04-27 12:25:53 +02:00
UltraProdigy 59157ec1e3 Optimize Images & Workflow (#61) 2026-04-26 18:20:36 +00:00
slprime b612897ddb Skip WAILA tooltip updates when GUI is open (#60) 2026-02-07 14:37:38 +01:00
Martin Robertz a5607eda00 update 2026-01-24 20:40:06 +01:00
Connor-ColensoandConnor Colenso f242cf77a9 Format numbers follow up (#59)
Co-authored-by: Connor Colenso <colen@CONNORSPC>
2026-01-24 20:37:57 +01:00
9d1840dabc Format numbers migration (#57)
Co-authored-by: Connor Colenso <[email protected]>
Co-authored-by: Connor Colenso <colen@CONNORSPC>
2026-01-23 18:55:28 +00:00
evgengoldwar 677a74dad7 Add small icon variant for TTRenderStack (#58) 2026-01-19 22:25:21 +01:00
MalTeeezandMartin Robertz 10219fd204 Allow showing empty tanks via Fluid Bars (#51)
Co-authored-by: Martin Robertz <[email protected]>
2025-11-17 00:50:29 +01:00
MalTeeezandMartin Robertz d14044c92e Use progress bars to render IEnergyInfo RF content (#55)
Co-authored-by: Martin Robertz <[email protected]>
2025-11-17 00:50:04 +01:00
danyadev 5c115d9af3 WailaPlugins compat (#54) 2025-11-15 18:17:38 +01:00
danyadev c0a119902a add a note about forking the repo in README.md (#52) 2025-11-15 09:50:17 +00:00
SuperSoupr 93485e1525 Clarify IWailaVariableWidthTooltipRenderer.getSize's documentation (#53) 2025-11-14 06:29:41 +01:00
ceb94e3e2c fix loader check (#45)
Co-authored-by: Martin Robertz <[email protected]>
Co-authored-by: SuperSoupr <[email protected]>
2025-11-11 18:29:45 +00:00
SuperSouprandsisyphussy 8ea26bf073 Add gradient to fluid bar to improve visibility (#49)
Co-authored-by: sisyphussy <[email protected]>
2025-11-11 18:50:58 +01:00
Worive 2aabfdb64c Rename hasAdvancedBody to hasWailaAdvancedBody (#48) 2025-10-25 14:04:28 +02:00
Martin Robertz a34460c159 update 2025-10-24 22:59:20 +02:00
SuperSouprandSuper 1f3fd64a38 Use special comma for renderer formatting (#47)
Co-authored-by: Super <[email protected]>
2025-10-24 13:29:56 +02:00
Martin Robertz 191a916896 update 2025-10-22 21:39:31 +02:00
SuperSouprandSuper ee1ed27a3a Add fancy fluid tooltip renderer (#43)
Co-authored-by: Super <[email protected]>
2025-10-22 21:33:06 +02:00
SuperSoupr 07b9d1bf92 Add documentation for IWailaVariableWidthTooltipRenderer (#44) 2025-10-20 21:47:51 +00:00
SuperSouprandSuper e82729a113 Add variable width tooltip renderer support (#42)
Co-authored-by: Super <[email protected]>
2025-10-20 21:55:03 +02:00
Dream Master c938ccf542 update 2025-10-13 14:42:49 +02:00
c2e8b44f2b Draw thaumcraft aspect icons in tooltip (#41)
Co-authored-by: Super <[email protected]>
Co-authored-by: Martin Robertz <[email protected]>
2025-10-13 14:22:46 +02:00
Martin Robertz c4e3537957 update 2025-10-01 17:23:42 +02:00
EmperorSuper 9bc1e79f64 Add Gadomancy support (Thaumic Sight enchant) (#40) 2025-10-01 08:12:13 +02:00
Martin Robertz bdebd737d6 update 2025-09-21 17:20:45 +02:00
WoriveandMartin Robertz 9f04d3d029 feat(api): Add support for advanced tooltip body (#38)
Co-authored-by: Martin Robertz <[email protected]>
2025-09-21 17:19:57 +02:00
Martin Robertz ef3c4a9774 update 2025-09-17 13:52:33 +02:00
Alexdoru 3b64d21335 change log level of callbackRegistration (#39) 2025-09-16 11:26:17 +02:00
Alexdoru 72c91a3700 Fix FMLLoadCompleteEvent using wrong annotation (#37) 2025-07-14 00:22:10 +00:00
Alexdoru bf6d309038 Delete redundant registration via reflection (#36) 2025-07-13 21:58:24 +02:00
Maya 5bb7f7221a update 2025-06-28 09:59:03 -06:00
AlexdoruandMartin Robertz 6278e4d575 [Memory-opti:fix leak] Fix WorldClient leak in WailaTickHandler and RayTracing (#31)
Co-authored-by: Martin Robertz <[email protected]>
2025-06-28 09:58:51 -06:00
Martin Robertz 7a46d914db update 2025-06-14 00:28:26 +02:00
Alexdoru d30d8ba100 Add config to show icon on HUD or not (#35) 2025-06-13 12:06:54 +02:00
Alexdoru 490a176446 Make strings rendering ignore transparency (#33) 2025-06-11 04:19:57 +02:00
Nikolay S. 453a8f50a7 Re-encode cs_CZ.lang into UTF-8 (#32) 2025-06-10 20:48:42 -05:00
Dream Master d946500c0d update 2025-05-28 12:25:03 +02:00
Alexdoru 487829a16e Stop running tick events twice per tick (#30) 2025-05-28 06:28:45 +02:00
Martin Robertz f153502858 update
(cherry picked from commit 093cf20b71)
2025-05-24 22:31:15 +02:00
dibbydoda 095ea9e3c4 Remove unused EnderIO module (#29) 2025-05-24 20:08:33 +02:00
Maya c6d48b32f7 update 2025-03-20 09:41:10 -05:00
4fb3d1edaa Fix thaumcraft node aspects overflowing out of the tooltip bounding box (#28)
Co-authored-by: Martin Robertz <[email protected]>
Co-authored-by: Maya <[email protected]>
2025-03-20 09:40:58 -05:00
EmperorSuperandMaya 678bb6dd44 Add a total size counter to thaumcraft nodes (#27)
Co-authored-by: Maya <[email protected]>
2025-03-20 09:35:25 -05:00
Glease 5333808d65 add more information to help debug weird NPE (#26) 2025-03-20 09:30:06 -05:00
Martin Robertz 4750486375 update 2024-11-16 15:38:59 +01:00
Alexdoru 0f9710a9f9 Remove unnecessary reflection (#24) 2024-11-16 02:48:17 +01:00
Martin Robertz 0c0ac4fcfa update 2024-07-02 23:48:19 +02:00
AnrDaemonandQuarri6343 a189446cac fixed broken Maintained mod (#23)
Co-authored-by: Quarri6343 <[email protected]>
2024-07-01 06:43:57 +02:00
Martin Robertz 6279ef2b09 update 2024-05-20 12:35:52 +02:00
Lyfts 6cf6dafb53 Add signal strength indicator for projectred wires (#22) 2024-05-20 12:34:29 +02:00
mist475 2f738bc728 Add option to hide invisible players (#20)
* add option to hide invisible players

* fix some warnings
2024-04-17 08:25:25 +02:00
Mist475 8329a4f186 improve mod detection logging 2024-04-17 08:25:00 +02:00
Mist475 e5ab6193a5 update buildscript 2024-04-17 08:25:00 +02:00
mist475 18560992cd Cleanup codebase (#19)
* update buildscript + deps

* applyDecompilerCleanupToMain

* remove commented out code

* move to tags based injected version

* cleanup code

* remove .bak files
2024-04-01 20:42:52 +02:00
Martin Robertz a767b0f922 update 2024-02-22 13:21:43 +01:00
connor135246 61f8fbe1ce Fix vanilla Anvils, Saplings, and Slabs (#18)
* Fix Anvil display

* Fix growth stage 1 Saplings

* Fix top slabs and "smooth" double slabs

* comment on modded anvils

* spotless apply

* Only fix vanilla anvil

modded anvils can do it themselves

* Simplify

Thinking about this, I don't think there's a need to worry about the smooth double slabs.
There's a few reasons:
These blocks can only be obtained with commands. The only one this actually matters for is the sandstone one (43:9), since that's the only one that is visually different as well as has the wrong name. Holding 43:9 in your inventory will still have the wrong name anyway. Mods that add the modern minecraft ways of accessing these blocks create their own versions instead of using the old ones.
2024-02-22 11:33:30 +01:00
Raven Szewczyk a8a49f2b6e [ci skip] upgraded build system 2024-02-04 20:02:54 +00:00
Martin Robertz bf7cc86247 update bs+deps 2024-01-12 21:23:08 +01:00
Raven Szewczyk d6650f6cc4 [ci skip] upgraded build system 2024-01-08 21:30:25 +00: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
278 changed files with 13921 additions and 17073 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, release/** ]
push:
branches: [ master, main, release/** ]
jobs:
build-and-test:
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/build-and-test.yml@master
secrets: inherit
+17
View File
@@ -0,0 +1,17 @@
name: Optimize images
on:
pull_request:
branches: [ master, main, release/** ]
paths:
- "**/*.png"
push:
branches: [ master, main, release/** ]
paths:
- "**/*.png"
jobs:
optimize-images:
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/optimize-images.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
+31
View File
@@ -0,0 +1,31 @@
.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
layout.json
.DS_Store
-10
View File
@@ -1,10 +0,0 @@
syntax: glob
*.orig
.gradle
build
eclipse
out
*.iml
*.ipr
*.iws
src/main/java/net/*
-25
View File
@@ -1,25 +0,0 @@
28ccc9a07b5421f7e529c417b9baf0cf0a384d9f v1.2.0
38f148ebeb8f6cfbdbaff0afc93612eb297188cd v1.3.1
4a92f4e3296c1b64557ecf30023c61badf598a3e 1.3.2
8ee781ebab6c82631601fee3dc1fb4d3a03f9351 1.3.3
2f6144f8e55ca2f0fa6ccbbee707ca58f5e75c80 1.3.4
45e01e7ee1a8e1587832e388584fd102672066ae 1.3.8_1.6.2
1e7cde94ccceb8c1425a03c90fe2523afbe20d53 1.3.9_1.6.2
02ebbb4aeebe23b3eaaded32bda20dad2fe14381 Nightly_131024
bc4937f3a7d4c8eef31b8273cab6e043a8b354ef Nightly_131025
246642120b36fb05ed2682ef79e7b48020edf21d Nightly_131116
9280666656c77770a35c2797129f9fb806ed6367 Nightly_13111
d2ec5e84d19f679d5b482112ed1fab4cb4d0b427 Nightly_131118
c7e3d16cb236195aaa6d978fe15706d63831a4e2 Nightly_131121a
e8b1906c3f51a14a12539850404b4622311b936b v1.4.0
f9daea609042db35e35989da99a1c4c8696eb8ab 1.4.1
1c391d52f3d955eebe3437d81dd8eca8ca142a8c 1.4.3
7ff010d0fad85eb59eca7f1bc6583a6dada6ef8d 1.4.5
5dd753fa7c80d22c3526714d48cf9c3a01918dec 1.4.5a
1066f782daede2a968ec282d4e3eba5a6ec74a53 Waila_1.5.0_dev2
ad46f8b41bbe08c95a6ae4a6c609be96196148ca Waila_1.5.0
<<<<<<< local
be89d97648acdc95afe1f7fea6a190641ae629d5 v1.5.2
=======
bb4fc720238a6545946c35de78e417141625a69c v1.4.5_1.7.2
>>>>>>> other
+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.
+13
View File
@@ -0,0 +1,13 @@
# Waila
## Contribution
When forking this repository, make sure to uncheck the `Copy the master branch only` option.
This will copy all tags to your fork, so the build system can detect the latest mod version.
If you leave it checked, you won't be able to enter the world in a local client run because Waila [will think the mod is outdated](https://github.com/GTNewHorizons/waila/blob/master/src/main/java/mcp/mobius/waila/Waila.java#L133).
If you already forked the repository without tags, you can fetch them manually:
```
git remote add upstream https://github.com/GTNewHorizons/waila
git fetch upstream --tags
```
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

+4 -152
View File
@@ -1,153 +1,5 @@
buildscript {
repositories {
mavenCentral()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
}
}
configurations {
deployerJars
//packed
//compile.extendsFrom packed
}
//add dependency repositories
repositories {
mavenLocal()
mavenCentral()
maven {
name = "chickenbones"
url = "http://chickenbones.net/maven/"
}
}
apply plugin: 'java'
apply plugin: 'forge'
apply plugin: 'maven'
version = "1.5.11-RC3_1.7.10"
group= "mcp.mobius.waila" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "Waila"
// Define properties file
ext.configFile = file "build.properties"
configFile.withReader {
// Load config. It shall from now be referenced as simply config or project.config
def prop = new Properties()
prop.load(it)
project.ext.config = new ConfigSlurper().parse prop
}
dependencies {
compile "codechicken:CodeChickenLib:${config.mc_version}-${config.ccl_version}:dev"
compile "codechicken:CodeChickenCore:${config.mc_version}-${config.ccc_version}:dev"
compile "codechicken:NotEnoughItems:${config.mc_version}-${config.nei_version}:dev"
deployerJars "org.apache.maven.wagon:wagon-ssh:2.2"
}
minecraft {
version = "1.7.10-${config.forge_version}-1.7.10"
runDir = "eclipse"
}
def root = project.projectDir.parentFile
sourceSets {
main {
java {
srcDir new File(root, "src")
}
resources {
srcDir new File(root, "resources")
}
}
}
processResources
{
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
//def commonManifest = {
// attributes 'FMLCorePlugin': 'mcp.mobius.wailacore.asm.CoreDescription'
// attributes 'FMLCorePluginContainsFMLMod': 'mcp.mobius.waila.Waila'
//}
jar {
exclude "**/client/gui/inventory/GuiContainer.class"
exclude "**/client/gui/inventory/GuiContainer.java"
// manifest commonManifest
// from {
// configurations.packed.collect {
// it.isDirectory() ? it : zipTree(it).matching {
// exclude "META-INF", "META-INF/**", "*META-INF*", "meta-inf"
// exclude "**.jar", "**/*.jar", "*.jar"
// }
// }
// }
}
task sourceJar(type: Jar) {
from sourceSets.main.java
from new File(root, "dev")
classifier = 'sources'
}
task devJar(type: Jar) {
from sourceSets.main.output
classifier = 'dev'
}
artifacts {
archives sourceJar, devJar
}
uploadArchives {
dependsOn 'reobf'
repositories.mavenDeployer {
configuration = configurations.deployerJars
repository(url: "scp://mobiusstrip.eu/home/mobius/web/maven"){
authentication(userName: "mobius")
}
pom {
groupId = project.group
version = project.version
artifactId = project.archivesBaseName
project {
name project.archivesBaseName
packaging 'jar'
description 'Waila '
url 'http://mobiusstrip.eu'
}
}
}
//version: 1707058017
plugins {
id 'com.gtnewhorizons.gtnhconvention'
}
-7
View File
@@ -1,7 +0,0 @@
mc_version=1.7.10
forge_version=10.13.4.1448
ccl_version=1.1.3.138
ccc_version=1.0.7.+
nei_version=1.0.5.+
mod_version=1.0
waila_version=1.5.2a
+24
View File
@@ -0,0 +1,24 @@
// Add your dependencies here
dependencies {
implementation('com.github.GTNewHorizons:NotEnoughItems:2.8.93-GTNH:dev')
shadowImplementation('au.com.bytecode:opencsv:2.4')
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.52.463:dev") { transitive = false }
runtimeOnlyNonPublishable("com.github.GTNewHorizons:WAILAPlugins:0.7.2:dev") {
exclude group: 'com.github.GTNewHorizons', module: 'waila'
}
runtimeOnlyNonPublishable("com.github.GTNewHorizons:EnderCore:0.5.12:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:BuildCraft:7.1.57:dev")
runtimeOnlyNonPublishable(deobfCurse("cofh-lib-220333:2388748"))
runtimeOnlyNonPublishable(deobfCurse("extrautils-225561:2264383"))
runtimeOnlyNonPublishable("com.github.GTNewHorizons:OpenBlocks:1.12.12-GTNH:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:Railcraft:9.17.26:dev")
runtimeOnlyNonPublishable(deobfCurse('thermal-foundation-222880:2388753'))
runtimeOnlyNonPublishable(deobfCurse('thermal-expansion-69163:2388759'))
runtimeOnlyNonPublishable(deobfCurse('thermal-dynamics-227443:2388756'))
implementation(deobfCurse('cofh-core-69162:2388751'))
api("com.github.GTNewHorizons:GTNHLib:0.11.37:dev")
}
+238
View File
@@ -0,0 +1,238 @@
# ExampleMod tag to use as Blowdryer (Spotless, etc.) settings version, leave empty to disable.
# LOCAL to test local config updates.
gtnh.settings.blowdryerTag = 0.2.0
# Human-readable mod name, available for mcmod.info population.
modName = Waila
# Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation.
# Conventionally lowercase.
modId = Waila
# Root package of the mod, used to find various classes in other properties,
# mcmod.info substitution, enabling assertions in run tasks, etc.
modGroup = mcp.mobius.waila
# Whether to use modGroup as the maven publishing group.
# When false, com.github.GTNewHorizons is used.
useModGroupForPublishing = false
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
autoUpdateBuildScript = false
# Version of Minecraft to target
minecraftVersion = 1.7.10
# Version of Minecraft Forge to target
forgeVersion = 10.13.4.1614
# Specify an MCP channel for dependency deobfuscation and the deobfParams task.
channel = stable
# Specify an MCP mappings version for dependency deobfuscation and the deobfParams task.
mappingsVersion = 12
# Defines other MCP mappings for dependency deobfuscation.
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
# Select a default username for testing your mod. You can always override this per-run by running
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
developmentEnvironmentUserName = Developer
# Enables modern Java syntax support. Valid values:
# - false: No modern syntax, Java 8 only
# - jabel: Jabel syntax-only support, compiles to J8 bytecode
# - jvmDowngrader: Full modern Java via JVM Downgrader (syntax + stdlib APIs)
# - modern: Native modern Java bytecode, no downgrading
enableModernJavaSyntax = jabel
# If set, ignores the above setting and compiles with the given toolchain. This may cause unexpected issues,
# and should *not* be used in most situations. -1 disables this.
# forceToolchainVersion = -1
# Target JVM version for JVM Downgrader bytecode downgrading.
# Only used when enableModernJavaSyntax = jvmDowngrader
# downgradeTargetVersion = 8
# Comma-separated list of Java versions for multi-release jar support (JVM Downgrader only).
# Classes will be available in META-INF/versions/N/ for each version N in this list.
# Default: "21,25" (J25+ gets native classes, J21-24 gets partial downgrade, J8-20 gets full downgrade).
# jvmDowngraderMultiReleaseVersions = 21,25
# Specifies how JVM Downgrader API stubs are provided. Options:
# - shade: Shade minimized stubs into the jar
# - gtnhlib: GTNHLib provides stubs at runtime (adds version constraint)
# - external: Another dependency provides stubs (no constraint, no warning)
# - (empty): Warning reminding you to configure stubs
# Note: 'shade' option requires you to verify license compliance, see: https://github.com/unimined/JvmDowngrader/blob/main/LICENSE.md
# jvmDowngraderStubsProvider =
# Enables injecting missing generics into the decompiled source code for a better coding experience.
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
enableGenericInjection = true
# Generate a class with a String field for the mod version named as defined below.
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
generateGradleTokenClass = mcp.mobius.waila.Tags
# Name of the token containing the project's current version to generate/replace.
gradleTokenVersion = GRADLETOKEN_VERSION
# [DEPRECATED] Mod ID replacement token.
gradleTokenModId =
# [DEPRECATED] Mod name replacement token.
gradleTokenModName =
# [DEPRECATED] Mod Group replacement token.
gradleTokenGroupName =
# [DEPRECATED]
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
# 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 =
# 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/
# There can be multiple files in a space-separated list.
# Example value: mymodid_at.cfg nei_at.cfg
accessTransformersFile =
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false
# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
# Mixin classes will have access to "main" classes, but not the other way around.
separateMixinSourceSet =
# Adds some debug arguments like verbose output and class export.
usesMixinDebug = false
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
mixinPlugin =
# Specify the package that contains all of your Mixins. The package must exist or
# the build will fail. If you have a package property defined in your mixins.<modid>.json,
# it must match with this 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
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
forceEnableMixins = false
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated into your jar. It is your
# responsibility to check the license and request permission for distribution if required.
usesShadowedDependencies = true
# If disabled, won't remove unused classes from shadowed dependencies. Some libraries use reflection to access
# their own classes, making the minimization unreliable.
minimizeShadowedDependencies = true
# If disabled, won't rename the shadowed classes.
relocateShadowedDependencies = true
# Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
includeWellKnownRepositories = true
# A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated
# list of strings, with the acceptable keys being(case does not matter):
# cursemaven
# modrinth
excludeWellKnownRepositories =
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
usesMavenPublishing = true
# Maven repository to publish the mod to.
# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/
# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
#
# The project's ID on Modrinth. Can be either the slug or the ID.
# Leave this empty if you don't want to publish to Modrinth.
modrinthProjectId =
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
# Syntax: scope1-type1:name1;scope2-type2:name2;...
# Where scope can be one of [required, optional, incompatible, embedded],
# type can be one of [project, version],
# and the name is the Modrinth project or version slug/id of the other mod.
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
modrinthRelations =
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
#
# The project's numeric ID on CurseForge. You can find this in the About Project box.
# Leave this empty if you don't want to publish on CurseForge.
curseForgeProjectId =
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
# Syntax: type1:name1;type2:name2;...
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
# and the name is the CurseForge project slug of the other mod.
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
curseForgeRelations =
# Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older
# projects. New projects should not use this parameter.
# customArchiveBaseName =
# Optional parameter to customize the default working directory used by the runClient* tasks. Relative to the project directory.
# runClientWorkingDirectory = run/client
# Optional parameter to customize the default working directory used by the runServer* tasks. Relative to the project directory.
# runServerWorkingDirectory = run/server
# Optional parameter to have the build automatically fail if an illegal version is used.
# This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'.
# The check is ONLY performed if the version is a git tag.
# Note: the specified string must be escaped, so e.g. 1\\.1\\.\\d+ instead of 1\.1\.\d+
# versionPattern =
# Uncomment to prevent the source code from being published.
# noPublishedSources = true
# Uncomment this to disable Spotless checks.
# This should only be uncommented to keep it easier to sync with upstream/other forks.
# That is, if there is no other active fork/upstream, NEVER change this.
# disableSpotless = true
# Uncomment this to disable Checkstyle checks (currently wildcard import check).
# disableCheckstyle = true
# Override the IDEA build type. Valid values are: "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle"
# (force use delegated build).
# This is meant to be set in $HOME/.gradle/gradle.properties.
# e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be native build.
# WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want!
# Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you.
# ideaOverrideBuildType = idea
# Whether IDEA should run spotless checks when pressing the Build button.
# This is meant to be set in $HOME/.gradle/gradle.properties.
# ideaCheckSpotlessOnBuild = true
# Non-GTNH properties
org.gradle.configuration-cache = true
org.gradle.parallel = true
+12
View File
@@ -0,0 +1,12 @@
#This file is generated by updateDaemonJvm
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c2dd35c9d0aaf0ba6ad0791320f99dfc/redirect
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/e5810bd7fd1f8a586644409d395a7e55/redirect
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/7b3c4877c0749019e6805bb61e421497/redirect
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/8e1d9ee5d0f13e442218f6884a306da1/redirect
toolchainVersion=25
Binary file not shown.
+7
View File
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored Executable
+248
View File
@@ -0,0 +1,248 @@
#!/bin/sh
#
# Copyright © 2015 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.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
# 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/b631911858264c0b6e4d6603d677ff5218766cee/platforms/jvm/plugins-application/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##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# 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
# 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
if ! command -v java >/dev/null 2>&1
then
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
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=SC2039,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=SC2039,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" )
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
# 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"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# 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
+93
View File
@@ -0,0 +1,93 @@
@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
@rem SPDX-License-Identifier: Apache-2.0
@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. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
: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
+4
View File
@@ -0,0 +1,4 @@
// Add any additional repositiroes for your dependencies here
repositories {
}
+23
View File
@@ -0,0 +1,23 @@
pluginManagement {
repositories {
maven {
// RetroFuturaGradle
name "GTNH Maven"
url "https://nexus.gtnewhorizons.com/repository/public/"
mavenContent {
includeGroup("com.gtnewhorizons")
includeGroupByRegex("com\\.gtnewhorizons\\..+")
}
}
gradlePluginPortal()
mavenCentral()
mavenLocal()
}
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.24'
}
@@ -1,323 +0,0 @@
package au.com.bytecode.opencsv;
/**
Copyright 2005 Bytecode Pty Ltd.
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.
*/
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* A very simple CSV parser released under a commercial-friendly license.
* This just implements splitting a single line into fields.
*
* @author Glen Smith
* @author Rainer Pruy
*/
public class CSVParser {
private final char separator;
private final char quotechar;
private final char escape;
private final boolean strictQuotes;
private String pending;
private boolean inField = false;
private final boolean ignoreLeadingWhiteSpace;
/**
* The default separator to use if none is supplied to the constructor.
*/
public static final char DEFAULT_SEPARATOR = ',';
public static final int INITIAL_READ_SIZE = 128;
/**
* The default quote character to use if none is supplied to the
* constructor.
*/
public static final char DEFAULT_QUOTE_CHARACTER = '"';
/**
* The default escape character to use if none is supplied to the
* constructor.
*/
public static final char DEFAULT_ESCAPE_CHARACTER = '\\';
/**
* The default strict quote behavior to use if none is supplied to the
* constructor
*/
public static final boolean DEFAULT_STRICT_QUOTES = false;
/**
* The default leading whitespace behavior to use if none is supplied to the
* constructor
*/
public static final boolean DEFAULT_IGNORE_LEADING_WHITESPACE = true;
/**
* This is the "null" character - if a value is set to this then it is ignored.
* I.E. if the quote character is set to null then there is no quote character.
*/
public static final char NULL_CHARACTER = '\0';
/**
* Constructs CSVParser using a comma for the separator.
*/
public CSVParser() {
this(DEFAULT_SEPARATOR, DEFAULT_QUOTE_CHARACTER, DEFAULT_ESCAPE_CHARACTER);
}
/**
* Constructs CSVParser with supplied separator.
*
* @param separator the delimiter to use for separating entries.
*/
public CSVParser(char separator) {
this(separator, DEFAULT_QUOTE_CHARACTER, DEFAULT_ESCAPE_CHARACTER);
}
/**
* Constructs CSVParser with supplied separator and quote char.
*
* @param separator the delimiter to use for separating entries
* @param quotechar the character to use for quoted elements
*/
public CSVParser(char separator, char quotechar) {
this(separator, quotechar, DEFAULT_ESCAPE_CHARACTER);
}
/**
* Constructs CSVReader with supplied separator and quote char.
*
* @param separator the delimiter to use for separating entries
* @param quotechar the character to use for quoted elements
* @param escape the character to use for escaping a separator or quote
*/
public CSVParser(char separator, char quotechar, char escape) {
this(separator, quotechar, escape, DEFAULT_STRICT_QUOTES);
}
/**
* Constructs CSVReader with supplied separator and quote char.
* Allows setting the "strict quotes" flag
*
* @param separator the delimiter to use for separating entries
* @param quotechar the character to use for quoted elements
* @param escape the character to use for escaping a separator or quote
* @param strictQuotes if true, characters outside the quotes are ignored
*/
public CSVParser(char separator, char quotechar, char escape, boolean strictQuotes) {
this(separator, quotechar, escape, strictQuotes, DEFAULT_IGNORE_LEADING_WHITESPACE);
}
/**
* Constructs CSVReader with supplied separator and quote char.
* Allows setting the "strict quotes" and "ignore leading whitespace" flags
*
* @param separator the delimiter to use for separating entries
* @param quotechar the character to use for quoted elements
* @param escape the character to use for escaping a separator or quote
* @param strictQuotes if true, characters outside the quotes are ignored
* @param ignoreLeadingWhiteSpace if true, white space in front of a quote in a field is ignored
*/
public CSVParser(char separator, char quotechar, char escape, boolean strictQuotes, boolean ignoreLeadingWhiteSpace) {
if (anyCharactersAreTheSame(separator, quotechar, escape)) {
throw new UnsupportedOperationException("The separator, quote, and escape characters must be different!");
}
if (separator == NULL_CHARACTER) {
throw new UnsupportedOperationException("The separator character must be defined!");
}
this.separator = separator;
this.quotechar = quotechar;
this.escape = escape;
this.strictQuotes = strictQuotes;
this.ignoreLeadingWhiteSpace = ignoreLeadingWhiteSpace;
}
private boolean anyCharactersAreTheSame(char separator, char quotechar, char escape) {
return isSameCharacter(separator, quotechar) || isSameCharacter(separator, escape) || isSameCharacter(quotechar, escape);
}
private boolean isSameCharacter(char c1, char c2) {
return c1 != NULL_CHARACTER && c1 == c2;
}
/**
* @return true if something was left over from last call(s)
*/
public boolean isPending() {
return pending != null;
}
public String[] parseLineMulti(String nextLine) throws IOException {
return parseLine(nextLine, true);
}
public String[] parseLine(String nextLine) throws IOException {
return parseLine(nextLine, false);
}
/**
* Parses an incoming String and returns an array of elements.
*
* @param nextLine the string to parse
* @param multi
* @return the comma-tokenized list of elements, or null if nextLine is null
* @throws IOException if bad things happen during the read
*/
private String[] parseLine(String nextLine, boolean multi) throws IOException {
if (!multi && pending != null) {
pending = null;
}
if (nextLine == null) {
if (pending != null) {
String s = pending;
pending = null;
return new String[]{s};
} else {
return null;
}
}
List<String> tokensOnThisLine = new ArrayList<String>();
StringBuilder sb = new StringBuilder(INITIAL_READ_SIZE);
boolean inQuotes = false;
if (pending != null) {
sb.append(pending);
pending = null;
inQuotes = true;
}
for (int i = 0; i < nextLine.length(); i++) {
char c = nextLine.charAt(i);
if (c == this.escape) {
if (isNextCharacterEscapable(nextLine, inQuotes || inField, i)) {
sb.append(nextLine.charAt(i + 1));
i++;
}
} else if (c == quotechar) {
if (isNextCharacterEscapedQuote(nextLine, inQuotes || inField, i)) {
sb.append(nextLine.charAt(i + 1));
i++;
} else {
//inQuotes = !inQuotes;
// the tricky case of an embedded quote in the middle: a,bc"d"ef,g
if (!strictQuotes) {
if (i > 2 //not on the beginning of the line
&& nextLine.charAt(i - 1) != this.separator //not at the beginning of an escape sequence
&& nextLine.length() > (i + 1) &&
nextLine.charAt(i + 1) != this.separator //not at the end of an escape sequence
) {
if (ignoreLeadingWhiteSpace && sb.length() > 0 && isAllWhiteSpace(sb)) {
sb.setLength(0); //discard white space leading up to quote
} else {
sb.append(c);
//continue;
}
}
}
inQuotes = !inQuotes;
}
inField = !inField;
} else if (c == separator && !inQuotes) {
tokensOnThisLine.add(sb.toString());
sb.setLength(0); // start work on next token
inField = false;
} else {
if (!strictQuotes || inQuotes) {
sb.append(c);
inField = true;
}
}
}
// line is done - check status
if (inQuotes) {
if (multi) {
// continuing a quoted section, re-append newline
sb.append("\n");
pending = sb.toString();
sb = null; // this partial content is not to be added to field list yet
} else {
throw new IOException("Un-terminated quoted field at end of CSV line");
}
}
if (sb != null) {
tokensOnThisLine.add(sb.toString());
}
return tokensOnThisLine.toArray(new String[tokensOnThisLine.size()]);
}
/**
* precondition: the current character is a quote or an escape
*
* @param nextLine the current line
* @param inQuotes true if the current context is quoted
* @param i current index in line
* @return true if the following character is a quote
*/
private boolean isNextCharacterEscapedQuote(String nextLine, boolean inQuotes, int i) {
return inQuotes // we are in quotes, therefore there can be escaped quotes in here.
&& nextLine.length() > (i + 1) // there is indeed another character to check.
&& nextLine.charAt(i + 1) == quotechar;
}
/**
* precondition: the current character is an escape
*
* @param nextLine the current line
* @param inQuotes true if the current context is quoted
* @param i current index in line
* @return true if the following character is a quote
*/
protected boolean isNextCharacterEscapable(String nextLine, boolean inQuotes, int i) {
return inQuotes // we are in quotes, therefore there can be escaped quotes in here.
&& nextLine.length() > (i + 1) // there is indeed another character to check.
&& (nextLine.charAt(i + 1) == quotechar || nextLine.charAt(i + 1) == this.escape);
}
/**
* precondition: sb.length() > 0
*
* @param sb A sequence of characters to examine
* @return true if every character in the sequence is whitespace
*/
protected boolean isAllWhiteSpace(CharSequence sb) {
boolean result = true;
for (int i = 0; i < sb.length(); i++) {
char c = sb.charAt(i);
if (!Character.isWhitespace(c)) {
return false;
}
}
return result;
}
}
@@ -1,282 +0,0 @@
package au.com.bytecode.opencsv;
/**
Copyright 2005 Bytecode Pty Ltd.
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.
*/
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.Reader;
import java.util.ArrayList;
import java.util.List;
/**
* A very simple CSV reader released under a commercial-friendly license.
*
* @author Glen Smith
*
*/
public class CSVReader implements Closeable {
private BufferedReader br;
private boolean hasNext = true;
private CSVParser parser;
private int skipLines;
private boolean linesSkiped;
/**
* The default line to start reading.
*/
public static final int DEFAULT_SKIP_LINES = 0;
/**
* Constructs CSVReader using a comma for the separator.
*
* @param reader
* the reader to an underlying CSV source.
*/
public CSVReader(Reader reader) {
this(reader, CSVParser.DEFAULT_SEPARATOR, CSVParser.DEFAULT_QUOTE_CHARACTER, CSVParser.DEFAULT_ESCAPE_CHARACTER);
}
/**
* Constructs CSVReader with supplied separator.
*
* @param reader
* the reader to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries.
*/
public CSVReader(Reader reader, char separator) {
this(reader, separator, CSVParser.DEFAULT_QUOTE_CHARACTER, CSVParser.DEFAULT_ESCAPE_CHARACTER);
}
/**
* Constructs CSVReader with supplied separator and quote char.
*
* @param reader
* the reader to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
*/
public CSVReader(Reader reader, char separator, char quotechar) {
this(reader, separator, quotechar, CSVParser.DEFAULT_ESCAPE_CHARACTER, DEFAULT_SKIP_LINES, CSVParser.DEFAULT_STRICT_QUOTES);
}
/**
* Constructs CSVReader with supplied separator, quote char and quote handling
* behavior.
*
* @param reader
* the reader to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
* @param strictQuotes
* sets if characters outside the quotes are ignored
*/
public CSVReader(Reader reader, char separator, char quotechar, boolean strictQuotes) {
this(reader, separator, quotechar, CSVParser.DEFAULT_ESCAPE_CHARACTER, DEFAULT_SKIP_LINES, strictQuotes);
}
/**
* Constructs CSVReader with supplied separator and quote char.
*
* @param reader
* the reader to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
* @param escape
* the character to use for escaping a separator or quote
*/
public CSVReader(Reader reader, char separator,
char quotechar, char escape) {
this(reader, separator, quotechar, escape, DEFAULT_SKIP_LINES, CSVParser.DEFAULT_STRICT_QUOTES);
}
/**
* Constructs CSVReader with supplied separator and quote char.
*
* @param reader
* the reader to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
* @param line
* the line number to skip for start reading
*/
public CSVReader(Reader reader, char separator, char quotechar, int line) {
this(reader, separator, quotechar, CSVParser.DEFAULT_ESCAPE_CHARACTER, line, CSVParser.DEFAULT_STRICT_QUOTES);
}
/**
* Constructs CSVReader with supplied separator and quote char.
*
* @param reader
* the reader to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
* @param escape
* the character to use for escaping a separator or quote
* @param line
* the line number to skip for start reading
*/
public CSVReader(Reader reader, char separator, char quotechar, char escape, int line) {
this(reader, separator, quotechar, escape, line, CSVParser.DEFAULT_STRICT_QUOTES);
}
/**
* Constructs CSVReader with supplied separator and quote char.
*
* @param reader
* the reader to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
* @param escape
* the character to use for escaping a separator or quote
* @param line
* the line number to skip for start reading
* @param strictQuotes
* sets if characters outside the quotes are ignored
*/
public CSVReader(Reader reader, char separator, char quotechar, char escape, int line, boolean strictQuotes) {
this(reader, separator, quotechar, escape, line, strictQuotes, CSVParser.DEFAULT_IGNORE_LEADING_WHITESPACE);
}
/**
* Constructs CSVReader with supplied separator and quote char.
*
* @param reader
* the reader to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
* @param escape
* the character to use for escaping a separator or quote
* @param line
* the line number to skip for start reading
* @param strictQuotes
* sets if characters outside the quotes are ignored
* @param ignoreLeadingWhiteSpace
* it true, parser should ignore white space before a quote in a field
*/
public CSVReader(Reader reader, char separator, char quotechar, char escape, int line, boolean strictQuotes, boolean ignoreLeadingWhiteSpace) {
this.br = new BufferedReader(reader);
this.parser = new CSVParser(separator, quotechar, escape, strictQuotes, ignoreLeadingWhiteSpace);
this.skipLines = line;
}
/**
* Reads the entire file into a List with each element being a String[] of
* tokens.
*
* @return a List of String[], with each String[] representing a line of the
* file.
*
* @throws IOException
* if bad things happen during the read
*/
public List<String[]> readAll() throws IOException {
List<String[]> allElements = new ArrayList<String[]>();
while (hasNext) {
String[] nextLineAsTokens = readNext();
if (nextLineAsTokens != null)
allElements.add(nextLineAsTokens);
}
return allElements;
}
/**
* Reads the next line from the buffer and converts to a string array.
*
* @return a string array with each comma-separated element as a separate
* entry.
*
* @throws IOException
* if bad things happen during the read
*/
public String[] readNext() throws IOException {
String[] result = null;
do {
String nextLine = getNextLine();
if (!hasNext) {
return result; // should throw if still pending?
}
String[] r = parser.parseLineMulti(nextLine);
if (r.length > 0) {
if (result == null) {
result = r;
} else {
String[] t = new String[result.length+r.length];
System.arraycopy(result, 0, t, 0, result.length);
System.arraycopy(r, 0, t, result.length, r.length);
result = t;
}
}
} while (parser.isPending());
return result;
}
/**
* Reads the next line from the file.
*
* @return the next line from the file without trailing newline
* @throws IOException
* if bad things happen during the read
*/
private String getNextLine() throws IOException {
if (!this.linesSkiped) {
for (int i = 0; i < skipLines; i++) {
br.readLine();
}
this.linesSkiped = true;
}
String nextLine = br.readLine();
if (nextLine == null) {
hasNext = false;
}
return hasNext ? nextLine : null;
}
/**
* Closes the underlying reader.
*
* @throws IOException if the close fails
*/
public void close() throws IOException{
br.close();
}
}
@@ -1,302 +0,0 @@
package au.com.bytecode.opencsv;
/**
Copyright 2005 Bytecode Pty Ltd.
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.
*/
import java.io.Closeable;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.Writer;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
/**
* A very simple CSV writer released under a commercial-friendly license.
*
* @author Glen Smith
*
*/
public class CSVWriter implements Closeable {
public static final int INITIAL_STRING_SIZE = 128;
private Writer rawWriter;
private PrintWriter pw;
private char separator;
private char quotechar;
private char escapechar;
private String lineEnd;
/** The character used for escaping quotes. */
public static final char DEFAULT_ESCAPE_CHARACTER = '"';
/** The default separator to use if none is supplied to the constructor. */
public static final char DEFAULT_SEPARATOR = ',';
/**
* The default quote character to use if none is supplied to the
* constructor.
*/
public static final char DEFAULT_QUOTE_CHARACTER = '"';
/** The quote constant to use when you wish to suppress all quoting. */
public static final char NO_QUOTE_CHARACTER = '\u0000';
/** The escape constant to use when you wish to suppress all escaping. */
public static final char NO_ESCAPE_CHARACTER = '\u0000';
/** Default line terminator uses platform encoding. */
public static final String DEFAULT_LINE_END = "\n";
private ResultSetHelper resultService = new ResultSetHelperService();
/**
* Constructs CSVWriter using a comma for the separator.
*
* @param writer
* the writer to an underlying CSV source.
*/
public CSVWriter(Writer writer) {
this(writer, DEFAULT_SEPARATOR);
}
/**
* Constructs CSVWriter with supplied separator.
*
* @param writer
* the writer to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries.
*/
public CSVWriter(Writer writer, char separator) {
this(writer, separator, DEFAULT_QUOTE_CHARACTER);
}
/**
* Constructs CSVWriter with supplied separator and quote char.
*
* @param writer
* the writer to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
*/
public CSVWriter(Writer writer, char separator, char quotechar) {
this(writer, separator, quotechar, DEFAULT_ESCAPE_CHARACTER);
}
/**
* Constructs CSVWriter with supplied separator and quote char.
*
* @param writer
* the writer to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
* @param escapechar
* the character to use for escaping quotechars or escapechars
*/
public CSVWriter(Writer writer, char separator, char quotechar, char escapechar) {
this(writer, separator, quotechar, escapechar, DEFAULT_LINE_END);
}
/**
* Constructs CSVWriter with supplied separator and quote char.
*
* @param writer
* the writer to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
* @param lineEnd
* the line feed terminator to use
*/
public CSVWriter(Writer writer, char separator, char quotechar, String lineEnd) {
this(writer, separator, quotechar, DEFAULT_ESCAPE_CHARACTER, lineEnd);
}
/**
* Constructs CSVWriter with supplied separator, quote char, escape char and line ending.
*
* @param writer
* the writer to an underlying CSV source.
* @param separator
* the delimiter to use for separating entries
* @param quotechar
* the character to use for quoted elements
* @param escapechar
* the character to use for escaping quotechars or escapechars
* @param lineEnd
* the line feed terminator to use
*/
public CSVWriter(Writer writer, char separator, char quotechar, char escapechar, String lineEnd) {
this.rawWriter = writer;
this.pw = new PrintWriter(writer);
this.separator = separator;
this.quotechar = quotechar;
this.escapechar = escapechar;
this.lineEnd = lineEnd;
}
/**
* Writes the entire list to a CSV file. The list is assumed to be a
* String[]
*
* @param allLines
* a List of String[], with each String[] representing a line of
* the file.
*/
public void writeAll(List<String[]> allLines) {
for (String[] line : allLines) {
writeNext(line);
}
}
protected void writeColumnNames(ResultSet rs)
throws SQLException {
writeNext(resultService.getColumnNames(rs));
}
/**
* Writes the entire ResultSet to a CSV file.
*
* The caller is responsible for closing the ResultSet.
*
* @param rs the recordset to write
* @param includeColumnNames true if you want column names in the output, false otherwise
*
* @throws java.io.IOException thrown by getColumnValue
* @throws java.sql.SQLException thrown by getColumnValue
*/
public void writeAll(java.sql.ResultSet rs, boolean includeColumnNames) throws SQLException, IOException {
if (includeColumnNames) {
writeColumnNames(rs);
}
while (rs.next())
{
writeNext(resultService.getColumnValues(rs));
}
}
/**
* Writes the next line to the file.
*
* @param nextLine
* a string array with each comma-separated element as a separate
* entry.
*/
public void writeNext(String[] nextLine) {
if (nextLine == null)
return;
StringBuilder sb = new StringBuilder(INITIAL_STRING_SIZE);
for (int i = 0; i < nextLine.length; i++) {
if (i != 0) {
sb.append(separator);
}
String nextElement = nextLine[i];
if (nextElement == null)
continue;
if (quotechar != NO_QUOTE_CHARACTER)
sb.append(quotechar);
sb.append(stringContainsSpecialCharacters(nextElement) ? processLine(nextElement) : nextElement);
if (quotechar != NO_QUOTE_CHARACTER)
sb.append(quotechar);
}
sb.append(lineEnd);
pw.write(sb.toString());
}
private boolean stringContainsSpecialCharacters(String line) {
return line.indexOf(quotechar) != -1 || line.indexOf(escapechar) != -1;
}
protected StringBuilder processLine(String nextElement)
{
StringBuilder sb = new StringBuilder(INITIAL_STRING_SIZE);
for (int j = 0; j < nextElement.length(); j++) {
char nextChar = nextElement.charAt(j);
if (escapechar != NO_ESCAPE_CHARACTER && nextChar == quotechar) {
sb.append(escapechar).append(nextChar);
} else if (escapechar != NO_ESCAPE_CHARACTER && nextChar == escapechar) {
sb.append(escapechar).append(nextChar);
} else {
sb.append(nextChar);
}
}
return sb;
}
/**
* Flush underlying stream to writer.
*
* @throws IOException if bad things happen
*/
public void flush() throws IOException {
pw.flush();
}
/**
* Close the underlying stream writer flushing any buffered content.
*
* @throws IOException if bad things happen
*
*/
public void close() throws IOException {
flush();
pw.close();
rawWriter.close();
}
/**
* Checks to see if the there has been an error in the printstream.
*/
public boolean checkError() {
return pw.checkError();
}
public void setResultService(ResultSetHelper resultService) {
this.resultService = resultService;
}
}
@@ -1,33 +0,0 @@
package au.com.bytecode.opencsv;
/**
Copyright 2005 Bytecode Pty Ltd.
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.
*/
import java.io.IOException;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
*
*
*
*
*
*/
public interface ResultSetHelper {
public String[] getColumnNames(ResultSet rs) throws SQLException;
public String[] getColumnValues(ResultSet rs) throws SQLException, IOException;
}
@@ -1,183 +0,0 @@
package au.com.bytecode.opencsv;
/**
Copyright 2005 Bytecode Pty Ltd.
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.
*/
import java.io.IOException;
import java.io.Reader;
import java.math.BigDecimal;
import java.sql.*;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
/**
*
*
* helper class for processing JDBC ResultSet objects
*
*
*/
public class ResultSetHelperService implements ResultSetHelper {
public static final int CLOBBUFFERSIZE = 2048;
// note: we want to maintain compatibility with Java 5 VM's
// These types don't exist in Java 5
private static final int NVARCHAR = -9;
private static final int NCHAR = -15;
private static final int LONGNVARCHAR = -16;
private static final int NCLOB = 2011;
public String[] getColumnNames(ResultSet rs) throws SQLException {
List<String> names = new ArrayList<String>();
ResultSetMetaData metadata = rs.getMetaData();
for (int i = 0; i < metadata.getColumnCount(); i++) {
names.add(metadata.getColumnName(i+1));
}
String[] nameArray = new String[names.size()];
return names.toArray(nameArray);
}
public String[] getColumnValues(ResultSet rs) throws SQLException, IOException {
List<String> values = new ArrayList<String>();
ResultSetMetaData metadata = rs.getMetaData();
for (int i = 0; i < metadata.getColumnCount(); i++) {
values.add(getColumnValue(rs, metadata.getColumnType(i + 1), i + 1));
}
String[] valueArray = new String[values.size()];
return values.toArray(valueArray);
}
private String handleObject(Object obj){
return obj == null ? "" : String.valueOf(obj);
}
private String handleBigDecimal(BigDecimal decimal) {
return decimal == null ? "" : decimal.toString();
}
private String handleLong(ResultSet rs, int columnIndex) throws SQLException {
long lv = rs.getLong(columnIndex);
return rs.wasNull() ? "" : Long.toString(lv);
}
private String handleInteger(ResultSet rs, int columnIndex) throws SQLException {
int i = rs.getInt(columnIndex);
return rs.wasNull() ? "" : Integer.toString(i);
}
private String handleDate(ResultSet rs, int columnIndex) throws SQLException {
java.sql.Date date = rs.getDate(columnIndex);
String value = null;
if (date != null) {
SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
value = dateFormat.format(date);
}
return value;
}
private String handleTime(Time time) {
return time == null ? null : time.toString();
}
private String handleTimestamp(Timestamp timestamp) {
SimpleDateFormat timeFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss");
return timestamp == null ? null : timeFormat.format(timestamp);
}
private String getColumnValue(ResultSet rs, int colType, int colIndex)
throws SQLException, IOException {
String value = "";
switch (colType)
{
case Types.BIT:
case Types.JAVA_OBJECT:
value = handleObject(rs.getObject(colIndex));
break;
case Types.BOOLEAN:
boolean b = rs.getBoolean(colIndex);
value = Boolean.valueOf(b).toString();
break;
case NCLOB: // todo : use rs.getNClob
case Types.CLOB:
Clob c = rs.getClob(colIndex);
if (c != null) {
value = read(c);
}
break;
case Types.BIGINT:
value = handleLong(rs, colIndex);
break;
case Types.DECIMAL:
case Types.DOUBLE:
case Types.FLOAT:
case Types.REAL:
case Types.NUMERIC:
value = handleBigDecimal(rs.getBigDecimal(colIndex));
break;
case Types.INTEGER:
case Types.TINYINT:
case Types.SMALLINT:
value = handleInteger(rs, colIndex);
break;
case Types.DATE:
value = handleDate(rs, colIndex);
break;
case Types.TIME:
value = handleTime(rs.getTime(colIndex));
break;
case Types.TIMESTAMP:
value = handleTimestamp(rs.getTimestamp(colIndex));
break;
case NVARCHAR: // todo : use rs.getNString
case NCHAR: // todo : use rs.getNString
case LONGNVARCHAR: // todo : use rs.getNString
case Types.LONGVARCHAR:
case Types.VARCHAR:
case Types.CHAR:
value = rs.getString(colIndex);
break;
default:
value = "";
}
if (value == null)
{
value = "";
}
return value;
}
private static String read(Clob c) throws SQLException, IOException
{
StringBuilder sb = new StringBuilder( (int) c.length());
Reader r = c.getCharacterStream();
char[] cbuf = new char[CLOBBUFFERSIZE];
int n;
while ((n = r.read(cbuf, 0, cbuf.length)) != -1) {
sb.append(cbuf, 0, n);
}
return sb.toString();
}
}
@@ -1,37 +0,0 @@
package au.com.bytecode.opencsv.bean;
import au.com.bytecode.opencsv.CSVReader;
import java.io.IOException;
/**
Copyright 2007 Kyle Miller.
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.
*/
public class ColumnPositionMappingStrategy<T> extends HeaderColumnNameMappingStrategy<T> {
private String[] columnMapping = new String[] {};
public void captureHeader(CSVReader reader) throws IOException {
//do nothing, first line is not header
}
protected String getColumnName(int col) {
return (null != columnMapping && col < columnMapping.length) ? columnMapping[col] : null ;
}
public String[] getColumnMapping() {
return columnMapping != null ? columnMapping.clone() : null;
}
public void setColumnMapping(String[] columnMapping) {
this.columnMapping = columnMapping != null ? columnMapping.clone() : null;
}
}
@@ -1,119 +0,0 @@
package au.com.bytecode.opencsv.bean;
/**
Copyright 2007 Kyle Miller.
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.
*/
import au.com.bytecode.opencsv.CSVReader;
import java.beans.IntrospectionException;
import java.beans.PropertyDescriptor;
import java.beans.PropertyEditor;
import java.beans.PropertyEditorManager;
import java.io.Reader;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CsvToBean<T> {
private Map<Class<?>, PropertyEditor> editorMap = null;
public CsvToBean() {
}
public List<T> parse(MappingStrategy<T> mapper, Reader reader) {
return parse(mapper, new CSVReader(reader));
}
public List<T> parse(MappingStrategy<T> mapper, CSVReader csv) {
try {
mapper.captureHeader(csv);
String[] line;
List<T> list = new ArrayList<T>();
while (null != (line = csv.readNext())) {
T obj = processLine(mapper, line);
list.add(obj); // TODO: (Kyle) null check object
}
return list;
} catch (Exception e) {
throw new RuntimeException("Error parsing CSV!", e);
}
}
protected T processLine(MappingStrategy<T> mapper, String[] line) throws IllegalAccessException, InvocationTargetException, InstantiationException, IntrospectionException {
T bean = mapper.createBean();
for (int col = 0; col < line.length; col++) {
PropertyDescriptor prop = mapper.findDescriptor(col);
if (null != prop) {
String value = checkForTrim(line[col], prop);
Object obj = convertValue(value, prop);
prop.getWriteMethod().invoke(bean, obj);
}
}
return bean;
}
private String checkForTrim(String s, PropertyDescriptor prop) {
return trimmableProperty(prop) ? s.trim() : s;
}
private boolean trimmableProperty(PropertyDescriptor prop) {
return !prop.getPropertyType().getName().contains("String");
}
protected Object convertValue(String value, PropertyDescriptor prop) throws InstantiationException, IllegalAccessException {
PropertyEditor editor = getPropertyEditor(prop);
Object obj = value;
if (null != editor) {
editor.setAsText(value);
obj = editor.getValue();
}
return obj;
}
private PropertyEditor getPropertyEditorValue(Class<?> cls) {
if (editorMap == null) {
editorMap = new HashMap<Class<?>, PropertyEditor>();
}
PropertyEditor editor = editorMap.get(cls);
if (editor == null) {
editor = PropertyEditorManager.findEditor(cls);
addEditorToMap(cls, editor);
}
return editor;
}
private void addEditorToMap(Class<?> cls, PropertyEditor editor) {
if (editor != null) {
editorMap.put(cls, editor);
}
}
/*
* Attempt to find custom property editor on descriptor first, else try the propery editor manager.
*/
protected PropertyEditor getPropertyEditor(PropertyDescriptor desc) throws InstantiationException, IllegalAccessException {
Class<?> cls = desc.getPropertyEditorClass();
if (null != cls) return (PropertyEditor) cls.newInstance();
return getPropertyEditorValue(desc.getPropertyType());
}
}
@@ -1,84 +0,0 @@
package au.com.bytecode.opencsv.bean;
import au.com.bytecode.opencsv.CSVReader;
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/**
* Copyright 2007 Kyle Miller.
* <p/>
* 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
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* 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.
*/
public class HeaderColumnNameMappingStrategy<T> implements MappingStrategy<T> {
protected String[] header;
protected Map<String, PropertyDescriptor> descriptorMap = null;
protected Class<T> type;
public void captureHeader(CSVReader reader) throws IOException {
header = reader.readNext();
}
public PropertyDescriptor findDescriptor(int col) throws IntrospectionException {
String columnName = getColumnName(col);
return (null != columnName && columnName.trim().length() > 0) ? findDescriptor(columnName) : null;
}
protected String getColumnName(int col) {
return (null != header && col < header.length) ? header[col] : null;
}
protected PropertyDescriptor findDescriptor(String name) throws IntrospectionException {
if (null == descriptorMap) descriptorMap = loadDescriptorMap(getType()); //lazy load descriptors
return descriptorMap.get(name.toUpperCase().trim());
}
protected boolean matches(String name, PropertyDescriptor desc) {
return desc.getName().equals(name.trim());
}
protected Map<String, PropertyDescriptor> loadDescriptorMap(Class<T> cls) throws IntrospectionException {
Map<String, PropertyDescriptor> map = new HashMap<String, PropertyDescriptor>();
PropertyDescriptor[] descriptors;
descriptors = loadDescriptors(getType());
for (PropertyDescriptor descriptor : descriptors) {
map.put(descriptor.getName().toUpperCase().trim(), descriptor);
}
return map;
}
private PropertyDescriptor[] loadDescriptors(Class<T> cls) throws IntrospectionException {
BeanInfo beanInfo = Introspector.getBeanInfo(cls);
return beanInfo.getPropertyDescriptors();
}
public T createBean() throws InstantiationException, IllegalAccessException {
return type.newInstance();
}
public Class<T> getType() {
return type;
}
public void setType(Class<T> type) {
this.type = type;
}
}
@@ -1,34 +0,0 @@
package au.com.bytecode.opencsv.bean;
import java.util.HashMap;
import java.util.Map;
/**
Copyright 2007,2010 Kyle Miller.
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.
*/
public class HeaderColumnNameTranslateMappingStrategy<T> extends HeaderColumnNameMappingStrategy<T> {
private Map<String, String> columnMapping = new HashMap<String, String>();
protected String getColumnName(int col) {
return col < header.length ? columnMapping.get(header[col].toUpperCase()) : null;
}
public Map<String, String> getColumnMapping() {
return columnMapping;
}
public void setColumnMapping(Map<String, String> columnMapping) {
for (String key : columnMapping.keySet()) {
this.columnMapping.put(key.toUpperCase(), columnMapping.get(key));
}
}
}
@@ -1,46 +0,0 @@
package au.com.bytecode.opencsv.bean;
/**
Copyright 2007 Kyle Miller.
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.
*/
import au.com.bytecode.opencsv.CSVReader;
import java.beans.IntrospectionException;
import java.beans.PropertyDescriptor;
import java.io.IOException;
public interface MappingStrategy<T> {
/**
* Implementation will have to return a property descriptor from a bean based on the current column.
* @param col the column to find the description for
* @throws java.beans.IntrospectionException
* @return the related PropertyDescriptor
*/
public abstract PropertyDescriptor findDescriptor(int col) throws IntrospectionException;
public abstract T createBean() throws InstantiationException, IllegalAccessException;
/**
* Implementation of this method can grab the header line before parsing begins to use to map columns
* to bean properties.
* @param reader the CSVReader to use for header parsing
* @throws java.io.IOException if parsing fails
*/
public void captureHeader(CSVReader reader) throws IOException;
}
@@ -1,12 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
</head>
<body bgcolor="white">
<p>
A simple bean binding interface for use with opencsv.
</p>
<br>
<a href="http://opencsv.sourceforge.net/">opencsv.sourceforge.net</a>
</body>
</html>
@@ -1,12 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
</head>
<body bgcolor="white">
<p>
A very simple CSV parser for Java released under a commercial-friendly license.
</p>
<br>
<a href="http://opencsv.sourceforge.net/">opencsv.sourceforge.net</a>
</body>
</html>
+102 -139
View File
@@ -1,32 +1,13 @@
package mcp.mobius.waila;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Map;
import net.minecraftforge.common.MinecraftForge;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe;
import mcp.mobius.waila.api.IWailaRegistrar;
import mcp.mobius.waila.api.impl.ConfigHandler;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
import mcp.mobius.waila.network.NetworkHandler;
import mcp.mobius.waila.network.WailaPacketHandler;
import mcp.mobius.waila.overlay.OverlayConfig;
import mcp.mobius.waila.overlay.DecoratorRenderer;
import mcp.mobius.waila.overlay.WailaTickHandler;
import mcp.mobius.waila.server.ProxyServer;
import mcp.mobius.waila.utils.Constants;
import mcp.mobius.waila.utils.ModIdentification;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.oredict.OreDictionary;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.FMLModContainer;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
@@ -38,138 +19,120 @@ import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.common.network.NetworkCheckHandler;
import cpw.mods.fml.common.versioning.ArtifactVersion;
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
import cpw.mods.fml.relauncher.Side;
import mcp.mobius.waila.cbcore.LangUtil;
import mcp.mobius.waila.api.impl.ConfigHandler;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
import mcp.mobius.waila.client.KeyEvent;
import mcp.mobius.waila.commands.CommandDumpHandlers;
import mcp.mobius.waila.network.NetworkHandler;
import mcp.mobius.waila.network.WailaPacketHandler;
import mcp.mobius.waila.overlay.DecoratorRenderer;
import mcp.mobius.waila.overlay.OverlayConfig;
import mcp.mobius.waila.overlay.WailaTickHandler;
import mcp.mobius.waila.server.ProxyServer;
import mcp.mobius.waila.utils.ModIdentification;
@Mod(modid="Waila", name="Waila", version="1.5.11", dependencies="after:NotEnoughItems@[1.0.4.0,)", acceptableRemoteVersions="*")
/*
@NetworkMod(channels = {"Waila"},clientSideRequired=false, serverSideRequired=false, connectionHandler = WailaConnectionHandler.class,
packetHandler = WailaPacketHandler.class, versionBounds="[1.5.0,)")
//packetHandler = WailaPacketHandler.class)
*/
@Mod(
modid = "Waila",
name = "Waila",
version = Tags.GRADLETOKEN_VERSION,
dependencies = "after:NotEnoughItems@[1.0.4.0,)",
acceptableRemoteVersions = "*",
guiFactory = "mcp.mobius.waila.client.WailaGuiFactory")
public class Waila {
// The instance of your mod that Forge uses.
@Instance("Waila")
public static Waila instance;
@SidedProxy(clientSide="mcp.mobius.waila.client.ProxyClient", serverSide="mcp.mobius.waila.server.ProxyServer")
public static ProxyServer proxy;
public static Logger log = LogManager.getLogger("Waila");
public boolean serverPresent = false;
// The instance of your mod that Forge uses.
@Instance("Waila")
public static Waila instance;
@SidedProxy(clientSide = "mcp.mobius.waila.client.ProxyClient", serverSide = "mcp.mobius.waila.server.ProxyServer")
public static ProxyServer proxy;
public static Logger log = LogManager.getLogger("Waila");
public boolean serverPresent = false;
private final ArtifactVersion minimumClientJoinVersion = new DefaultArtifactVersion("1.7.3");
/* INIT SEQUENCE */
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
ConfigHandler.instance().loadDefaultConfig(event);
OverlayConfig.updateColors();
MinecraftForge.EVENT_BUS.register(new DecoratorRenderer());
WailaPacketHandler.INSTANCE.ordinal();
}
ConfigHandler.instance().loadDefaultConfig(event);
OverlayConfig.updateColors();
MinecraftForge.EVENT_BUS.register(new DecoratorRenderer());
WailaPacketHandler.INSTANCE.ordinal();
}
@EventHandler
public void initialize(FMLInitializationEvent event) {
try {
Field eBus = FMLModContainer.class.getDeclaredField("eventBus");
eBus.setAccessible(true);
EventBus FMLbus = (EventBus) eBus.get(FMLCommonHandler.instance().findContainerFor(this));
FMLbus.register(this);
} catch (Throwable t) {}
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT){
MinecraftForge.EVENT_BUS.register(new DecoratorRenderer());
FMLCommonHandler.instance().bus().register(new KeyEvent());
FMLCommonHandler.instance().bus().register(WailaTickHandler.instance());
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
MinecraftForge.EVENT_BUS.register(new DecoratorRenderer());
FMLCommonHandler.instance().bus().register(new KeyEvent());
FMLCommonHandler.instance().bus().register(new WailaTickHandler());
}
FMLCommonHandler.instance().bus().register(new NetworkHandler());
}
FMLCommonHandler.instance().bus().register(new NetworkHandler());
}
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
proxy.registerHandlers();
ModIdentification.init();
/*
if (ConfigHandler.instance().getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_KEYBIND, true)){
for (String key: ModIdentification.keyhandlerStrings.keySet()){
String orig = I18n.getString(key);
if (orig.equals(key))
orig = LanguageRegistry.instance().getStringLocalization(key);
if (orig.equals(key))
orig = LangUtil.translateG(key);
if (orig.isEmpty())
orig = key;
String modif;
if (orig.startsWith("[") || orig.contains(":"))
modif = orig;
else{
String id = ModIdentification.keyhandlerStrings.get(key);
if (id.contains("."))
id = id.split("\\.")[0];
if (id.length() > 10)
id = id.substring(0, 11);
if (id.isEmpty())
id = "????";
modif = String.format("[%s] %s", id, orig);
}
LanguageRegistry.instance().addStringLocalization(key, modif);
}
}
*/
}
proxy.registerHandlers();
ModIdentification.init();
}
@Subscribe
public void loadComplete(FMLLoadCompleteEvent event) {
proxy.registerMods();
proxy.registerIMCs();
/*
String[] ores = OreDictionary.getOreNames();
for (String s : ores)
for (ItemStack stack : OreDictionary.getOres(s))
System.out.printf("%s : %s\n", s, stack);
*/
}
@EventHandler
public void processIMC(FMLInterModComms.IMCEvent event)
{
for (IMCMessage imcMessage : event.getMessages()){
if (!imcMessage.isStringMessage()) continue;
if (imcMessage.key.equalsIgnoreCase("addconfig")){
String[] params = imcMessage.getStringValue().split("\\$\\$");
if (params.length != 3){
Waila.log.warn(String.format("Error while parsing config option from [ %s ] for %s", imcMessage.getSender(), imcMessage.getStringValue()));
continue;
}
Waila.log.info(String.format("Receiving config request from [ %s ] for %s", imcMessage.getSender(), imcMessage.getStringValue()));
ConfigHandler.instance().addConfig(params[0], params[1], params[2]);
}
if (imcMessage.key.equalsIgnoreCase("register")){
Waila.log.info(String.format("Receiving registration request from [ %s ] for method %s", imcMessage.getSender(), imcMessage.getStringValue()));
ModuleRegistrar.instance().addIMCRequest(imcMessage.getStringValue(), imcMessage.getSender());
}
}
}
public void loadComplete(FMLLoadCompleteEvent event) {
proxy.registerMods();
proxy.registerIMCs();
}
@EventHandler
public void serverStarting(FMLServerStartingEvent event){
event.registerServerCommand(new CommandDumpHandlers());
}
}
@EventHandler
public void processIMC(FMLInterModComms.IMCEvent event) {
for (IMCMessage imcMessage : event.getMessages()) {
if (!imcMessage.isStringMessage()) continue;
if (imcMessage.key.equalsIgnoreCase("addconfig")) {
String[] params = imcMessage.getStringValue().split("\\$\\$");
if (params.length != 3) {
Waila.log.warn(
String.format(
"Error while parsing config option from [ %s ] for %s",
imcMessage.getSender(),
imcMessage.getStringValue()));
continue;
}
Waila.log.info(
String.format(
"Receiving config request from [ %s ] for %s",
imcMessage.getSender(),
imcMessage.getStringValue()));
ConfigHandler.instance().addConfig(params[0], params[1], params[2]);
}
if (imcMessage.key.equalsIgnoreCase("register")) {
Waila.log.info(
String.format(
"Receiving registration request from [ %s ] for method %s",
imcMessage.getSender(),
imcMessage.getStringValue()));
ModuleRegistrar.instance().addIMCRequest(imcMessage.getStringValue(), imcMessage.getSender());
}
}
}
@EventHandler
public void serverStarting(FMLServerStartingEvent event) {
event.registerServerCommand(new CommandDumpHandlers());
}
/**
* Block any clients older than 1.7.3 to ensure the vanilla.show_invisible_players property is respected
*/
@SuppressWarnings("unused")
@NetworkCheckHandler
public boolean checkModList(Map<String, String> versions, Side side) {
if (side == Side.CLIENT && versions.containsKey("Waila")) {
return minimumClientJoinVersion.compareTo(new DefaultArtifactVersion(versions.get("Waila"))) <= 0;
}
return true;
}
}
@@ -6,25 +6,25 @@ import mcp.mobius.waila.Waila;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
public class AgricultureModule {
public static Class BlockCrop = null;
public static void register(){
try{
Class Agriculture = Class.forName("com.teammetallurgy.agriculture.Agriculture");
Waila.log.log(Level.INFO, "Agriculture mod found.");
} catch (ClassNotFoundException e){
Waila.log.log(Level.INFO, "[Agriculture] Agriculture mod not found.");
return;
}
try{
BlockCrop = Class.forName("com.teammetallurgy.agriculture.crops.BlockCrop");
} catch (ClassNotFoundException e){
Waila.log.log(Level.WARN, "[Agriculture] Class not found. " + e);
return;
}
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerCrop(), BlockCrop);
}
public static Class<?> BlockCrop = null;
public static void register() {
try {
Class.forName("com.teammetallurgy.agriculture.Agriculture");
Waila.log.log(Level.INFO, "Agriculture mod found.");
} catch (ClassNotFoundException e) {
Waila.log.log(Level.INFO, "[Agriculture] Agriculture mod not found.");
return;
}
try {
BlockCrop = Class.forName("com.teammetallurgy.agriculture.crops.BlockCrop");
} catch (ClassNotFoundException e) {
Waila.log.log(Level.WARN, "[Agriculture] Class not found. " + e);
return;
}
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerCrop(), BlockCrop);
}
}
@@ -2,50 +2,55 @@ package mcp.mobius.waila.addons.agriculture;
import java.util.List;
import mcp.mobius.waila.cbcore.LangUtil;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.cbcore.LangUtil;
public class HUDHandlerCrop implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@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> 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("general.showcrop")) return currenttip;
int growthStage = accessor.getMetadata();
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
if (!config.getConfig("general.showcrop")) return currenttip;
float growthValue = (growthStage / 6.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;
}
int growthStage = accessor.getMetadata();
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
float growthValue = (growthStage / 6.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;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
return currenttip;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
int y, int z) {
return tag;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
return tag;
}
}
@@ -2,43 +2,40 @@ package mcp.mobius.waila.addons.buildcraft;
import java.lang.reflect.Method;
import net.minecraftforge.common.util.ForgeDirection;
import org.apache.logging.log4j.Level;
import net.minecraftforge.common.util.ForgeDirection;
import mcp.mobius.waila.Waila;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
import mcp.mobius.waila.utils.LoadedMods;
public class BCModule {
public static Class TileTank = null;
public static Method TileTank_getTankInfo = null;
//public static Class IPowerReceptor = null;
//public static Class PipeTransportPower = null;
//public static Class TileGenericPipe = null;
//public static Class TileEngine = null;
public static Class<?> TileTank = null;
public static Method TileTank_getTankInfo = null;
public static void register() {
if (LoadedMods.WAILA_PLUGINS) {
return;
}
public static void register(){
try{
TileTank = Class.forName("buildcraft.factory.TileTank");
TileTank_getTankInfo = TileTank.getMethod("getTankInfo", ForgeDirection.class);
try {
TileTank = Class.forName("buildcraft.factory.TileTank");
TileTank_getTankInfo = TileTank.getMethod("getTankInfo", ForgeDirection.class);
ModuleRegistrar.instance().addConfig("Buildcraft", "bc.tankamount");
ModuleRegistrar.instance().addConfig("Buildcraft", "bc.tanktype");
ModuleRegistrar.instance().registerHeadProvider(new HUDHandlerBCTanks(), TileTank);
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerBCTanks(), TileTank);
} catch (ClassNotFoundException e){
Waila.log.log(Level.WARN, "[BC] Class not found. " + e);
return;
} catch (NoSuchMethodException e){
Waila.log.log(Level.WARN, "[BC] Method not found." + e);
return;
}
Waila.log.log(Level.INFO, "Buildcraft mod found.");
} catch (ClassNotFoundException | NoSuchMethodException e) {
Waila.log.log(Level.INFO, "[BC] Buildcraft mod not found.");
return;
}
ModuleRegistrar.instance().addConfig("Buildcraft", "bc.tanktype");
ModuleRegistrar.instance().addConfig("Buildcraft", "bc.tankamount");
TankFluidHandler tankFluidHandler = new TankFluidHandler();
ModuleRegistrar.instance().registerHeadProvider(tankFluidHandler, TileTank);
ModuleRegistrar.instance().registerBodyProvider(tankFluidHandler, TileTank);
}
}
}
@@ -1,83 +0,0 @@
package mcp.mobius.waila.addons.buildcraft;
import java.util.List;
//import buildcraft.factory.TileTank;
import org.apache.logging.log4j.Level;
import mcp.mobius.waila.Waila;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.impl.ConfigHandler;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import mcp.mobius.waila.cbcore.LangUtil;
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){
Waila.log.log(Level.ERROR, "[BC] Unhandled exception trying to access a tank for display !.\n" + String.valueOf(e));
return null;
}
return tank;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
return tag;
}
}
@@ -0,0 +1,94 @@
package mcp.mobius.waila.addons.buildcraft;
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatFluid;
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
import java.util.List;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import org.apache.logging.log4j.Level;
import mcp.mobius.waila.Waila;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.impl.ConfigHandler;
import mcp.mobius.waila.cbcore.LangUtil;
public class TankFluidHandler 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 (!ConfigHandler.instance().getConfig("bc.tanktype")) {
return currenttip;
}
FluidTankInfo tank = this.getTank(accessor);
FluidStack stack = tank != null ? tank.fluid : null;
String name = currenttip.get(0);
String fluidName = stack == null ? LangUtil.translateG("hud.msg.empty")
: stack.getFluid().getLocalizedName(stack);
currenttip.set(0, name + " < " + fluidName + " >");
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
if (!ConfigHandler.instance().getConfig("bc.tankamount")) {
return currenttip;
}
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;
currenttip.add(String.format("%s / %s", formatNumber(liquidAmount), formatFluid(capacity)));
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;
try {
tank = ((FluidTankInfo[]) BCModule.TileTank_getTankInfo
.invoke(BCModule.TileTank.cast(accessor.getTileEntity()), ForgeDirection.UNKNOWN))[0];
} catch (Exception e) {
Waila.log.log(Level.ERROR, "[BC] Unhandled exception trying to access a tank for display !.\n" + e);
return null;
}
return tank;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
int y, int z) {
return tag;
}
}
@@ -2,39 +2,6 @@ package mcp.mobius.waila.addons.carpenters;
public class CarpentersModule {
public static Class TEBase = null;
public static Class BlockCarpentersDoor = null;
public static Class BlockCarpentersHatch = null;
public static void register(){
/*
try{
Class CarpentersBlocks = Class.forName("carpentersblocks.CarpentersBlocks");
Waila.log.log(Level.INFO, "CarpentersBlocks mod found.");
} catch (ClassNotFoundException e){
Waila.log.log(Level.INFO, "[CarpentersBlocks] CarpentersBlocks mod not found.");
return;
}
try{
TEBase = Class.forName("carpentersblocks.tileentity.TEBase");
BlockCarpentersDoor = Class.forName("carpentersblocks.block.BlockCarpentersDoor");
BlockCarpentersHatch = Class.forName("carpentersblocks.block.BlockCarpentersHatch");
} catch (ClassNotFoundException e){
Waila.log.log(Level.WARNING, "[CarpentersBlocks] Class not found. " + e);
return;
} catch (Exception e) {
Waila.log.log(Level.WARNING, "[CarpentersBlocks] Error while loading module. " + e);
return;
}
public static void register() {}
ModuleRegistrar.instance().addConfig("Carpenter's Blocks", "carpenters.hide");
ModuleRegistrar.instance().registerStackProvider(new HUDCarpentersBlocksTE(), BlockCarpentersDoor);
ModuleRegistrar.instance().registerStackProvider(new HUDCarpentersBlocksTE(), BlockCarpentersHatch);
ModuleRegistrar.instance().registerSyncedNBTKey("data", TEBase);
ModuleRegistrar.instance().registerSyncedNBTKey("cover_6", TEBase);
*/
}
}
@@ -7,60 +7,41 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDCarpentersBlocksTE implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
/*
if (!config.getConfig("carpenters.hide")) return null;
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
NBTTagCompound tag = accessor.getNBTData();
short data = tag.getShort("data");
short cover = tag.getShort("cover_6");
if(CarpentersModule.BlockCarpentersDoor.isInstance(accessor.getBlock())){
int type = data & 0x7;
if (type != 5) return null;
if (cover == 0) return null;
return new ItemStack(cover & 0xfff, 0, (cover & 0xf000) >>> 12);
}
else if (CarpentersModule.BlockCarpentersHatch.isInstance(accessor.getBlock())){
int type = data & 0x7;
if (type != 0) return null;
if (cover == 0) return null;
return new ItemStack(cover & 0xfff, 0, (cover & 0xf000) >>> 12);
}
*/
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
return currenttip;
}
@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> 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;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
int y, int z) {
if (te != null) te.writeToNBT(tag);
return tag;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
if (te != null)
te.writeToNBT(tag);
return tag;
}
}
@@ -1,65 +0,0 @@
package mcp.mobius.waila.addons.enderio;
import java.lang.reflect.Method;
import org.apache.logging.log4j.Level;
import mcp.mobius.waila.Waila;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
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");
Waila.log.log(Level.INFO, "EnderIO mod found.");
} catch (ClassNotFoundException e){
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){
Waila.log.log(Level.WARN, "[EnderStorage] Class not found. " + e);
return;
} catch (NoSuchMethodException e){
Waila.log.log(Level.WARN, "[EnderStorage] Method not found." + e);
return;
// } catch (NoSuchFieldException e){
// mod_Waila.log.log(Level.WARNING, "[EnderStorage] Field not found." + e);
// return;
} catch (Exception e){
Waila.log.log(Level.WARN, "[EnderStorage] Unhandled exception." + e);
return;
}
ModuleRegistrar.instance().addConfig("EnderIO", "enderio.inout");
ModuleRegistrar.instance().addConfig("EnderIO", "enderio.storage");
ModuleRegistrar.instance().addConfig("EnderIO", "enderio.owner");
ModuleRegistrar.instance().addConfig("EnderIO", "enderio.channel");
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerCapacitor(), TileCapacitorBank);
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTesseract(), TileTesseract);
ModuleRegistrar.instance().registerNBTProvider (new HUDHandlerCapacitor(), TileCapacitorBank);
ModuleRegistrar.instance().registerNBTProvider (new HUDHandlerTesseract(), TileTesseract);
}
}
@@ -1,75 +0,0 @@
package mcp.mobius.waila.addons.enderio;
import java.util.List;
import mcp.mobius.waila.cbcore.LangUtil;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.utils.WailaExceptionHandler;
import static mcp.mobius.waila.api.SpecialChars.*;
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 (accessor.getPlayer().isSneaking()){
try{
String maxIOStr = LangUtil.translateG("hud.msg.maxio");
String inputStr = LangUtil.translateG("hud.msg.input");
String outputStr = LangUtil.translateG("hud.msg.output");
if (config.getConfig("enderio.storage")){
Integer maxEnergyStored = (Integer)EnderIOModule.TCB_getMaxEnergyStored.invoke(accessor.getTileEntity());
Double energyStored = (Double)EnderIOModule.TCB_getEnergyStored.invoke(accessor.getTileEntity());
currenttip.add(String.format("%s%.1f%s / %s%d%s RF", WHITE, energyStored * 10, RESET, WHITE, maxEnergyStored * 10, RESET));
}
if (config.getConfig("enderio.inout")){
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());
currenttip.add(String.format("%s : %s%d%sRF/t ", maxIOStr, TAB + ALIGNRIGHT + WHITE, maxIO * 10, TAB + ALIGNRIGHT));
currenttip.add(String.format("%s : %s%d%sRF/t ", inputStr, TAB + ALIGNRIGHT + WHITE, maxInput * 10, TAB + ALIGNRIGHT));
currenttip.add(String.format("%s : %s%d%sRF/t ", outputStr,TAB + ALIGNRIGHT + WHITE, maxOutput * 10, TAB + ALIGNRIGHT));
}
} 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;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
if (te != null)
te.writeToNBT(tag);
return tag;
}
}
@@ -1,79 +0,0 @@
package mcp.mobius.waila.addons.enderio;
import java.util.List;
import mcp.mobius.waila.cbcore.LangUtil;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import static mcp.mobius.waila.api.SpecialChars.*;
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 (accessor.getPlayer().isSneaking()){
String channel = "%s : %s%s%s %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 = "[ " + WHITE + accessor.getNBTData().getString("channelUser") + RESET + " ]";
else
frequser = "[ " + WHITE + LangUtil.translateG("hud.msg.public") + RESET +" ]";
}
else{
freq = LangUtil.translateG("hud.msg.none");
frequser = "";
}
currenttip.add(String.format(channel, LangUtil.translateG("hud.msg.frequency"), TAB + WHITE, freq, RESET, frequser));
}
if (config.getConfig("enderio.owner")){
if (accessor.getNBTData().hasKey("owner"))
currenttip.add(String.format("%s : %s%s", LangUtil.translateG("hud.msg.owner"), TAB + WHITE, accessor.getNBTData().getString("owner")));
}
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
if (te != null)
te.writeToNBT(tag);
return tag;
}
}
@@ -10,49 +10,49 @@ import mcp.mobius.waila.api.impl.ModuleRegistrar;
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");
Waila.log.log(Level.INFO, "EnderStorage mod found.");
} catch (ClassNotFoundException e){
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){
Waila.log.log(Level.WARN, "[EnderStorage] Class not found. " + e);
return;
} catch (NoSuchMethodException e){
Waila.log.log(Level.WARN, "[EnderStorage] Method not found." + e);
return;
} catch (NoSuchFieldException e){
Waila.log.log(Level.WARN, "[EnderStorage] Field not found." + e);
return;
} catch (Exception e){
Waila.log.log(Level.WARN, "[EnderStorage] Unhandled exception." + e);
return;
}
ModuleRegistrar.instance().addConfig("EnderStorage", "enderstorage.colors");
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerStorage(), TileFrequencyOwner);
ModuleRegistrar.instance().registerNBTProvider (new HUDHandlerStorage(), TileFrequencyOwner);
}
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.forName("codechicken.enderstorage.EnderStorage");
Waila.log.log(Level.INFO, "EnderStorage mod found.");
} catch (ClassNotFoundException e) {
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) {
Waila.log.log(Level.WARN, "[EnderStorage] Class not found. " + e);
return;
} catch (NoSuchMethodException e) {
Waila.log.log(Level.WARN, "[EnderStorage] Method not found." + e);
return;
} catch (NoSuchFieldException e) {
Waila.log.log(Level.WARN, "[EnderStorage] Field not found." + e);
return;
} catch (Exception e) {
Waila.log.log(Level.WARN, "[EnderStorage] Unhandled exception." + e);
return;
}
ModuleRegistrar.instance().addConfig("EnderStorage", "enderstorage.colors");
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerStorage(), TileFrequencyOwner);
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerStorage(), TileFrequencyOwner);
}
}
@@ -2,83 +2,75 @@ package mcp.mobius.waila.addons.enderstorage;
import java.util.List;
import mcp.mobius.waila.cbcore.LangUtil;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.cbcore.LangUtil;
import mcp.mobius.waila.utils.WailaExceptionHandler;
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;
}
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 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);
}
}
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
return currenttip;
}
@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;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
int y, int z) {
if (te != null) te.writeToNBT(tag);
return tag;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
if (te != null)
te.writeToNBT(tag);
return tag;
}
}
@@ -9,75 +9,56 @@ import mcp.mobius.waila.api.impl.ModuleRegistrar;
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");
Waila.log.log(Level.INFO, "Engineer Toolbox mod found.");
} catch (ClassNotFoundException e){
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){
Waila.log.log(Level.WARN, "[Engineer Toolbox] Class not found. " + e);
return;
// } catch (NoSuchMethodException e){
// Waila.log.log(Level.WARN, "[Engineer Toolbox] Method not found." + e);
// return;
} catch (NoSuchFieldException e){
Waila.log.log(Level.WARN, "[Engineer Toolbox] Field not found." + e);
return;
} catch (Exception e){
Waila.log.log(Level.WARN, "[Engineer Toolbox] Unhandled exception." + e);
return;
}
ModuleRegistrar.instance().addConfig("Engineer Toolbox", "etb.displaydata");
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerSocket(), TileSocket);
ModuleRegistrar.instance().registerNBTProvider (new HUDHandlerSocket(), TileSocket);
}
public static Class<?> TileSocket = null;
public static Field Socket_sides = null;
public static Field Socket_configs = 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.forName("emasher.sockets.TileSocket");
Waila.log.log(Level.INFO, "Engineer Toolbox mod found.");
} catch (ClassNotFoundException e) {
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");
SocketsMod = Class.forName("emasher.sockets.SocketsMod");
module = SocketsMod.getField("module");
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) {
Waila.log.log(Level.WARN, "[Engineer Toolbox] Class not found. " + e);
return;
} catch (NoSuchFieldException e) {
Waila.log.log(Level.WARN, "[Engineer Toolbox] Field not found." + e);
return;
} catch (Exception e) {
Waila.log.log(Level.WARN, "[Engineer Toolbox] Unhandled exception." + e);
return;
}
ModuleRegistrar.instance().addConfig("Engineer Toolbox", "etb.displaydata");
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerSocket(), TileSocket);
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerSocket(), TileSocket);
}
}
@@ -9,6 +9,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
@@ -16,99 +17,87 @@ import mcp.mobius.waila.utils.WailaExceptionHandler;
public class HUDHandlerSocket implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@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> 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) + " ";
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
if (!config.getConfig("etb.displaydata")) return currenttip;
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 += " ";
}
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);
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;
}
for (int s = 0; s < 6; s++) {
if (sides[s] != 0) {
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
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" + tank + " ";
if (inventory != -1) configstr += "\u00a7a" + 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;
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;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
int y, int z) {
if (te != null) te.writeToNBT(tag);
return tag;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
if (te != null)
te.writeToNBT(tag);
return tag;
}
}
@@ -0,0 +1,64 @@
package mcp.mobius.waila.addons.exu;
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatFluid;
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
import java.util.List;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class DrumFluidHandler implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
if (!config.getConfig("extrautilities.fluidamount")) return currenttip;
IFluidHandler handler = (IFluidHandler) accessor.getTileEntity();
if (handler == null) return currenttip;
FluidTankInfo[] tanks = handler.getTankInfo(ForgeDirection.UNKNOWN);
if (tanks.length != 1) return currenttip;
int amount = tanks[0].fluid == null ? 0 : tanks[0].fluid.amount;
currenttip.add(String.format("%s / %s", formatNumber(amount), formatFluid(tanks[0].capacity)));
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
return currenttip;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
int y, int z) {
return tag;
}
}
@@ -4,32 +4,26 @@ import org.apache.logging.log4j.Level;
import mcp.mobius.waila.Waila;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
import mcp.mobius.waila.utils.LoadedMods;
public class ExtraUtilitiesModule {
public static Class ModExtraUtilities = null;
public static Class TileEntityDrum = null;
public static void register(){
public static Class<?> TileEntityDrum = null;
try{
Class ModExtraUtilities = Class.forName("com.rwtema.extrautils.ExtraUtils");
Waila.log.log(Level.INFO, "ExtraUtilities mod found.");
} catch (ClassNotFoundException e){
Waila.log.log(Level.INFO, "[ExtraUtilities] ExtraUtilities mod not found.");
return;
}
try{
TileEntityDrum = Class.forName("com.rwtema.extrautils.tileentity.TileEntityDrum");
} catch (ClassNotFoundException e){
Waila.log.log(Level.WARN, "[ExtraUtilities] Class not found. " + e);
return;
}
ModuleRegistrar.instance().addConfigRemote("ExtraUtilities", "extrautilities.fluidamount");
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerDrum(), TileEntityDrum);
ModuleRegistrar.instance().registerNBTProvider (new HUDHandlerDrum(), TileEntityDrum);
}
public static void register() {
if (LoadedMods.WAILA_PLUGINS) {
return;
}
try {
TileEntityDrum = Class.forName("com.rwtema.extrautils.tileentity.TileEntityDrum");
Waila.log.log(Level.INFO, "ExtraUtilities mod found.");
} catch (ClassNotFoundException e) {
Waila.log.log(Level.INFO, "[ExtraUtilities] ExtraUtilities mod not found.");
return;
}
ModuleRegistrar.instance().addConfigRemote("ExtraUtilities", "extrautilities.fluidamount");
ModuleRegistrar.instance().registerBodyProvider(new DrumFluidHandler(), TileEntityDrum);
}
}
@@ -1,63 +0,0 @@
package mcp.mobius.waila.addons.exu;
import java.util.List;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerDrum implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("extrautilities.fluidamount")) return currenttip;
int amount = 0;
NBTTagCompound subtag = accessor.getNBTData().getCompoundTag("tank");
if (subtag.hasKey("Amount"))
amount = accessor.getNBTInteger(subtag, "Amount");
IFluidHandler handler = (IFluidHandler)accessor.getTileEntity();
if (handler == null) return currenttip;
FluidTankInfo[] tanks = handler.getTankInfo(ForgeDirection.UNKNOWN);
if (tanks.length != 1) return currenttip;
currenttip.add(String.format("%d / %d mB", amount, tanks[0].capacity));
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
if (te != null)
te.writeToNBT(tag);
return tag;
}
}
@@ -7,27 +7,26 @@ import mcp.mobius.waila.api.impl.ModuleRegistrar;
public class GravestoneModule {
public static Class BlockGraveStone = null;
public static void register(){
public static Class<?> BlockGraveStone = null;
try{
Class ModGravestone = Class.forName("GraveStone.ModGraveStone");
Waila.log.log(Level.INFO, "GraveStone mod found.");
} catch (ClassNotFoundException e){
Waila.log.log(Level.INFO, "[GraveStone] GraveStone mod not found.");
return;
}
public static void register() {
try {
BlockGraveStone = Class.forName("GraveStone.block.BlockGSGraveStone");
} catch (ClassNotFoundException e) {
Waila.log.log(Level.WARN, "[GraveStone] Class not found. " + e);
}
try {
Class.forName("GraveStone.ModGraveStone");
Waila.log.log(Level.INFO, "GraveStone mod found.");
} catch (ClassNotFoundException e) {
Waila.log.log(Level.INFO, "[GraveStone] GraveStone mod not found.");
return;
}
ModuleRegistrar.instance().registerStackProvider(new HUDHandlerGravestone(), BlockGraveStone);
ModuleRegistrar.instance().registerNBTProvider (new HUDHandlerGravestone(), BlockGraveStone);
}
try {
BlockGraveStone = Class.forName("GraveStone.block.BlockGSGraveStone");
} catch (ClassNotFoundException e) {
Waila.log.log(Level.WARN, "[GraveStone] Class not found. " + e);
}
ModuleRegistrar.instance().registerStackProvider(new HUDHandlerGravestone(), BlockGraveStone);
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerGravestone(), BlockGraveStone);
}
}
@@ -7,37 +7,41 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
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 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> 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> 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;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
int y, int z) {
if (te != null) te.writeToNBT(tag);
return tag;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
if (te != null)
te.writeToNBT(tag);
return tag;
}
}
@@ -2,54 +2,58 @@ package mcp.mobius.waila.addons.harvestcraft;
import java.util.List;
import mcp.mobius.waila.cbcore.LangUtil;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.cbcore.LangUtil;
import mcp.mobius.waila.utils.NBTUtil;
public class HUDHandlerPamCrop implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@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> 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("general.showcrop")) return currenttip;
int growthStage = NBTUtil.getNBTInteger(accessor.getNBTData(), "growthStage");
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
if (!config.getConfig("general.showcrop")) return currenttip;
float growthValue = (growthStage / 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;
int growthStage = NBTUtil.getNBTInteger(accessor.getNBTData(), "growthStage");
}
float growthValue = (growthStage / 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;
@Override
public List<String> getWailaTail(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;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
int y, int z) {
if (te != null) te.writeToNBT(tag);
return tag;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
if (te != null)
te.writeToNBT(tag);
return tag;
}
}
@@ -6,25 +6,25 @@ import mcp.mobius.waila.Waila;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
public class HarvestcraftModule {
public static Class TileEntityPamCrop = null;
public static void register(){
try{
Class PamHarvestCraft = Class.forName("assets.pamharvestcraft.PamHarvestCraft");
Waila.log.log(Level.INFO, "PamHarvestCraft mod found.");
} catch (ClassNotFoundException e){
Waila.log.log(Level.INFO, "[PamHarvestCraft] PamHarvestCraft mod not found.");
return;
}
try{
TileEntityPamCrop = Class.forName("assets.pamharvestcraft.TileEntityPamCrop");
} catch (ClassNotFoundException e){
Waila.log.log(Level.WARN, "[PamHarvestCraft] Class not found. " + e);
return;
}
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerPamCrop(), TileEntityPamCrop);
}
public static Class<?> TileEntityPamCrop = null;
public static void register() {
try {
Class.forName("assets.pamharvestcraft.PamHarvestCraft");
Waila.log.log(Level.INFO, "PamHarvestCraft mod found.");
} catch (ClassNotFoundException e) {
Waila.log.log(Level.INFO, "[PamHarvestCraft] PamHarvestCraft mod not found.");
return;
}
try {
TileEntityPamCrop = Class.forName("assets.pamharvestcraft.TileEntityPamCrop");
} catch (ClassNotFoundException e) {
Waila.log.log(Level.WARN, "[PamHarvestCraft] Class not found. " + e);
return;
}
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerPamCrop(), TileEntityPamCrop);
}
}
@@ -1,87 +0,0 @@
package mcp.mobius.waila.addons.ic2;
import java.util.List;
import mcp.mobius.waila.cbcore.LangUtil;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.impl.ConfigHandler;
import mcp.mobius.waila.utils.WailaExceptionHandler;
import static mcp.mobius.waila.api.SpecialChars.*;
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%s\u00a7f%d\u00a7r / \u00a7f%d\u00a7r EU", storedStr, TAB + ALIGNRIGHT, 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%s\u00a7f%d\u00a7r EU/t", outputStr, TAB + ALIGNRIGHT, 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;
}
@Override
public NBTTagCompound getNBTData(TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
if (te != null)
te.writeToNBT(tag);
return tag;
}
}
@@ -1,72 +0,0 @@
package mcp.mobius.waila.addons.ic2;
import java.util.List;
import mcp.mobius.waila.cbcore.LangUtil;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.impl.ConfigHandler;
import mcp.mobius.waila.utils.WailaExceptionHandler;
import static mcp.mobius.waila.api.SpecialChars.*;
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%s\u00a7f%d\u00a7r / \u00a7f%d\u00a7r EU", storedStr, TAB + ALIGNRIGHT, 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%s\u00a7f%d\u00a7r EU/t", outputStr, TAB + ALIGNRIGHT, 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;
}
@Override
public NBTTagCompound getNBTData(TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
if (te != null)
te.writeToNBT(tag);
return tag;
}
}
@@ -1,5 +1,8 @@
package mcp.mobius.waila.addons.ic2;
import static mcp.mobius.waila.api.SpecialChars.ALIGNRIGHT;
import static mcp.mobius.waila.api.SpecialChars.TAB;
import java.util.List;
import net.minecraft.entity.player.EntityPlayerMP;
@@ -8,104 +11,113 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.impl.ConfigHandler;
import mcp.mobius.waila.cbcore.LangUtil;
import mcp.mobius.waila.utils.WailaExceptionHandler;
import static mcp.mobius.waila.api.SpecialChars.*;
public class HUDHandlerTEGenerator implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@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> 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{
double storage = accessor.getNBTData().getDouble("storage");
int production = accessor.getNBTData().getInteger("production");
long maxStorage = accessor.getNBTData().getLong("maxStorage");
String storedStr = LangUtil.translateG("hud.msg.stored");
String outputStr = LangUtil.translateG("hud.msg.output");
/* EU Storage */
if (ConfigHandler.instance().getConfig("ic2.storage")){
if (maxStorage > 0)
currenttip.add(String.format("%s%s\u00a7f%d\u00a7r / \u00a7f%d\u00a7r EU", storedStr, TAB + ALIGNRIGHT, Math.round(Math.min(storage,maxStorage)), maxStorage));
}
if (ConfigHandler.instance().getConfig("ic2.outputeu")){
currenttip.add(String.format("%s%s\u00a7f%d\u00a7r EU/t", outputStr, TAB + ALIGNRIGHT, production));
}
} 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 {
double storage = accessor.getNBTData().getDouble("storage");
int production = accessor.getNBTData().getInteger("production");
long maxStorage = accessor.getNBTData().getLong("maxStorage");
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
String storedStr = LangUtil.translateG("hud.msg.stored");
String outputStr = LangUtil.translateG("hud.msg.output");
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
try{
double storage = -1;
long production = -1;
long maxStorage = -1;
if (IC2Module.TileBaseGenerator.isInstance(te)){
storage = IC2Module.TileBaseGenerator_storage.getDouble(te);
production = (long)IC2Module.TileBaseGenerator_production.getInt(te);
maxStorage = (long)IC2Module.TileBaseGenerator_maxStorage.getShort(te);
}
/* EU Storage */
if (ConfigHandler.instance().getConfig("ic2.storage")) {
if (maxStorage > 0) currenttip.add(
String.format(
"%s%s\u00a7f%d\u00a7r / \u00a7f%d\u00a7r EU",
storedStr,
TAB + ALIGNRIGHT,
Math.round(Math.min(storage, maxStorage)),
maxStorage));
}
else if (IC2Module.TileGeoGenerator.isInstance(te)){
storage = IC2Module.TileGeoGenerator_storage.getDouble(te);
production = (long)IC2Module.TileGeoGenerator_production.getInt(te);
maxStorage = (long)IC2Module.TileGeoGenerator_maxStorage.getShort(te);
}
else if (IC2Module.TileKineticGenerator.isInstance(te)){
storage = IC2Module.TileKineticGenerator_storage.getDouble(te);
production = MathHelper.floor_double_long(IC2Module.TileKineticGenerator_production.getDouble(te));
maxStorage = (long)IC2Module.TileKineticGenerator_maxStorage.getInt(te);
}
else if (IC2Module.TileSemifluidGenerator.isInstance(te)){
storage = IC2Module.TileSemifluidGenerator_storage.getDouble(te);
production = MathHelper.floor_double_long(IC2Module.TileSemifluidGenerator_production.getDouble(te));
maxStorage = (long)IC2Module.TileSemifluidGenerator_maxStorage.getShort(te);
}
else if (IC2Module.TileStirlingGenerator.isInstance(te)){
storage = IC2Module.TileStirlingGenerator_storage.getDouble(te);
production = MathHelper.floor_double_long(IC2Module.TileStirlingGenerator_production.getDouble(te));
maxStorage = (long)IC2Module.TileStirlingGenerator_maxStorage.getShort(te);
}
tag.setDouble ("storage", storage);
tag.setLong ("production", production);
tag.setLong ("maxStorage", maxStorage);
} catch (Exception e){
throw new RuntimeException(e);
}
return tag;
}
if (ConfigHandler.instance().getConfig("ic2.outputeu")) {
currenttip.add(String.format("%s%s\u00a7f%d\u00a7r EU/t", outputStr, TAB + ALIGNRIGHT, 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;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
int y, int z) {
try {
double storage = -1;
long production = -1;
long maxStorage = -1;
if (IC2Module.TileBaseGenerator.isInstance(te)) {
storage = IC2Module.TileBaseGenerator_storage.getDouble(te);
production = IC2Module.TileBaseGenerator_production.getInt(te);
maxStorage = IC2Module.TileBaseGenerator_maxStorage.getShort(te);
}
else if (IC2Module.TileGeoGenerator.isInstance(te)) {
storage = IC2Module.TileGeoGenerator_storage.getDouble(te);
production = IC2Module.TileGeoGenerator_production.getInt(te);
maxStorage = IC2Module.TileGeoGenerator_maxStorage.getShort(te);
}
else if (IC2Module.TileKineticGenerator.isInstance(te)) {
storage = IC2Module.TileKineticGenerator_storage.getDouble(te);
production = MathHelper.floor_double_long(IC2Module.TileKineticGenerator_production.getDouble(te));
maxStorage = IC2Module.TileKineticGenerator_maxStorage.getInt(te);
}
else if (IC2Module.TileSemifluidGenerator.isInstance(te)) {
storage = IC2Module.TileSemifluidGenerator_storage.getDouble(te);
production = MathHelper.floor_double_long(IC2Module.TileSemifluidGenerator_production.getDouble(te));
maxStorage = IC2Module.TileSemifluidGenerator_maxStorage.getShort(te);
}
else if (IC2Module.TileStirlingGenerator.isInstance(te)) {
storage = IC2Module.TileStirlingGenerator_storage.getDouble(te);
production = MathHelper.floor_double_long(IC2Module.TileStirlingGenerator_production.getDouble(te));
maxStorage = IC2Module.TileStirlingGenerator_maxStorage.getShort(te);
}
tag.setDouble("storage", storage);
tag.setLong("production", production);
tag.setLong("maxStorage", maxStorage);
} catch (Exception e) {
throw new RuntimeException(e);
}
return tag;
}
}
@@ -1,92 +0,0 @@
package mcp.mobius.waila.addons.ic2;
import java.util.List;
import mcp.mobius.waila.cbcore.LangUtil;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.impl.ConfigHandler;
import mcp.mobius.waila.utils.WailaExceptionHandler;
import static mcp.mobius.waila.api.SpecialChars.*;
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%s\u00a7f%d\u00a7r / \u00a7f%d\u00a7r EU", storedStr, TAB + ALIGNRIGHT, Math.round(Math.min(stored,storage)), storage));
}
if (ConfigHandler.instance().getConfig("ic2.consump")){
if ( consumption > 0)
currenttip.add(String.format("%s%s\u00a7f%d\u00a7r EU/t", powerStr, TAB + ALIGNRIGHT, consumption ));
}
if (ConfigHandler.instance().getConfig("ic2.inputeu")){
if ( maxinput > 0)
currenttip.add(String.format("%s%s\u00a7f%d\u00a7r EU/t", maxPowerStr, TAB + ALIGNRIGHT, 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;
}
@Override
public NBTTagCompound getNBTData(TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
if (te != null)
te.writeToNBT(tag);
return tag;
}
}
@@ -1,68 +0,0 @@
package mcp.mobius.waila.addons.ic2;
import java.util.List;
import mcp.mobius.waila.cbcore.LangUtil;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.impl.ConfigHandler;
import static mcp.mobius.waila.api.SpecialChars.*;
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%s\u00a7f%d\u00a7r x \u00a7f%s\u00a7r", offersStr, TAB + ALIGNRIGHT, 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%s\u00a7f%d\u00a7r x \u00a7f%s\u00a7r", demandsStr, TAB + ALIGNRIGHT, is.stackSize, is.getDisplayName()));
}
*/
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public NBTTagCompound getNBTData(TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
if (te != null)
te.writeToNBT(tag);
return tag;
}
}
@@ -1,6 +1,7 @@
package mcp.mobius.waila.addons.ic2;
import java.lang.reflect.Field;
import org.apache.logging.log4j.Level;
import mcp.mobius.waila.Waila;
@@ -8,84 +9,89 @@ import mcp.mobius.waila.api.impl.ModuleRegistrar;
public class IC2Module {
public static Class TileBaseGenerator = null;
public static Field TileBaseGenerator_storage = null;
public static Field TileBaseGenerator_maxStorage = null;
public static Field TileBaseGenerator_production = null;
public static Class TileGeoGenerator = null;
public static Field TileGeoGenerator_storage = null;
public static Field TileGeoGenerator_maxStorage = null;
public static Field TileGeoGenerator_production = null;
public static Class<?> TileBaseGenerator = null;
public static Field TileBaseGenerator_storage = null;
public static Field TileBaseGenerator_maxStorage = null;
public static Field TileBaseGenerator_production = null;
public static Class TileKineticGenerator = null;
public static Field TileKineticGenerator_storage = null;
public static Field TileKineticGenerator_maxStorage = null;
public static Field TileKineticGenerator_production = null;
public static Class TileSemifluidGenerator = null;
public static Field TileSemifluidGenerator_storage = null;
public static Field TileSemifluidGenerator_maxStorage = null;
public static Field TileSemifluidGenerator_production = null;
public static Class TileStirlingGenerator = null;
public static Field TileStirlingGenerator_storage = null;
public static Field TileStirlingGenerator_maxStorage = null;
public static Field TileStirlingGenerator_production = null;
public static void register(){
// XXX : We register the Energy interface first
try{
TileBaseGenerator = Class.forName("ic2.core.block.generator.tileentity.TileEntityBaseGenerator");
TileBaseGenerator_storage = TileBaseGenerator.getDeclaredField("storage");
TileBaseGenerator_maxStorage = TileBaseGenerator.getDeclaredField("maxStorage");
TileBaseGenerator_production = TileBaseGenerator.getDeclaredField("production");
public static Class<?> TileGeoGenerator = null;
public static Field TileGeoGenerator_storage = null;
public static Field TileGeoGenerator_maxStorage = null;
public static Field TileGeoGenerator_production = null;
public static Class<?> TileKineticGenerator = null;
public static Field TileKineticGenerator_storage = null;
public static Field TileKineticGenerator_maxStorage = null;
public static Field TileKineticGenerator_production = null;
public static Class<?> TileSemifluidGenerator = null;
public static Field TileSemifluidGenerator_storage = null;
public static Field TileSemifluidGenerator_maxStorage = null;
public static Field TileSemifluidGenerator_production = null;
public static Class<?> TileStirlingGenerator = null;
public static Field TileStirlingGenerator_storage = null;
public static Field TileStirlingGenerator_maxStorage = null;
public static Field TileStirlingGenerator_production = null;
public static void register() {
// XXX : We register the Energy interface first
try {
TileBaseGenerator = Class.forName("ic2.core.block.generator.tileentity.TileEntityBaseGenerator");
TileBaseGenerator_storage = TileBaseGenerator.getDeclaredField("storage");
TileBaseGenerator_maxStorage = TileBaseGenerator.getDeclaredField("maxStorage");
TileBaseGenerator_production = TileBaseGenerator.getDeclaredField("production");
TileGeoGenerator = Class.forName("ic2.core.block.generator.tileentity.TileEntityGeoGenerator");
TileGeoGenerator_storage = TileGeoGenerator.getDeclaredField("storage");
TileGeoGenerator_maxStorage = TileGeoGenerator.getDeclaredField("maxStorage");
TileGeoGenerator_production = TileGeoGenerator.getDeclaredField("production");
TileKineticGenerator = Class.forName("ic2.core.block.generator.tileentity.TileEntityKineticGenerator");
TileKineticGenerator_storage = TileKineticGenerator.getDeclaredField("EUstorage");
TileKineticGenerator_maxStorage = TileKineticGenerator.getDeclaredField("maxEUStorage");
TileKineticGenerator_production = TileKineticGenerator.getDeclaredField("production");
TileKineticGenerator_storage.setAccessible(true);
TileKineticGenerator_maxStorage.setAccessible(true);
TileKineticGenerator_production.setAccessible(true);
TileSemifluidGenerator = Class.forName("ic2.core.block.generator.tileentity.TileEntitySemifluidGenerator");
TileSemifluidGenerator_storage = TileSemifluidGenerator.getDeclaredField("storage");
TileSemifluidGenerator_maxStorage = TileSemifluidGenerator.getDeclaredField("maxStorage");
TileSemifluidGenerator_production = TileSemifluidGenerator.getDeclaredField("production");
TileSemifluidGenerator_storage.setAccessible(true);
TileSemifluidGenerator_maxStorage.setAccessible(true);
TileSemifluidGenerator_production.setAccessible(true);
TileStirlingGenerator = Class.forName("ic2.core.block.generator.tileentity.TileEntityStirlingGenerator");
TileStirlingGenerator_storage = TileStirlingGenerator.getDeclaredField("EUstorage");
TileStirlingGenerator_maxStorage = TileStirlingGenerator.getDeclaredField("maxEUStorage");
TileStirlingGenerator_production = TileStirlingGenerator.getDeclaredField("production");
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTEGenerator(), TileBaseGenerator);
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTEGenerator(), TileGeoGenerator);
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTEGenerator(), TileKineticGenerator);
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTEGenerator(), TileSemifluidGenerator);
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTEGenerator(), TileStirlingGenerator);
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerTEGenerator(), TileBaseGenerator);
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerTEGenerator(), TileGeoGenerator);
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerTEGenerator(), TileKineticGenerator);
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerTEGenerator(), TileSemifluidGenerator);
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerTEGenerator(), TileStirlingGenerator);
ModuleRegistrar.instance().addConfigRemote("IndustrialCraft2", "ic2.storage");
ModuleRegistrar.instance().addConfigRemote("IndustrialCraft2", "ic2.outputeu");
} catch (Exception e) {
if (e instanceof ClassNotFoundException || e instanceof NoSuchFieldException) {
Waila.log.log(Level.INFO, "[IndustrialCraft 2] IndustrialCraft 2 mod not found.");
} else {
Waila.log.log(Level.WARN, "[IndustrialCraft 2] Error while loading generator hooks." + e);
}
return;
}
Waila.log.log(Level.INFO, "IndustrialCraft 2 mod found.");
}
TileGeoGenerator = Class.forName("ic2.core.block.generator.tileentity.TileEntityGeoGenerator");
TileGeoGenerator_storage = TileGeoGenerator.getDeclaredField("storage");
TileGeoGenerator_maxStorage = TileGeoGenerator.getDeclaredField("maxStorage");
TileGeoGenerator_production = TileGeoGenerator.getDeclaredField("production");
TileKineticGenerator = Class.forName("ic2.core.block.generator.tileentity.TileEntityKineticGenerator");
TileKineticGenerator_storage = TileKineticGenerator.getDeclaredField("EUstorage");
TileKineticGenerator_maxStorage = TileKineticGenerator.getDeclaredField("maxEUStorage");
TileKineticGenerator_production = TileKineticGenerator.getDeclaredField("production");
TileKineticGenerator_storage.setAccessible(true);
TileKineticGenerator_maxStorage.setAccessible(true);
TileKineticGenerator_production.setAccessible(true);
TileSemifluidGenerator = Class.forName("ic2.core.block.generator.tileentity.TileEntitySemifluidGenerator");
TileSemifluidGenerator_storage = TileSemifluidGenerator.getDeclaredField("storage");
TileSemifluidGenerator_maxStorage = TileSemifluidGenerator.getDeclaredField("maxStorage");
TileSemifluidGenerator_production = TileSemifluidGenerator.getDeclaredField("production");
TileSemifluidGenerator_storage.setAccessible(true);
TileSemifluidGenerator_maxStorage.setAccessible(true);
TileSemifluidGenerator_production.setAccessible(true);
TileStirlingGenerator = Class.forName("ic2.core.block.generator.tileentity.TileEntityStirlingGenerator");
TileStirlingGenerator_storage = TileStirlingGenerator.getDeclaredField("EUstorage");
TileStirlingGenerator_maxStorage = TileStirlingGenerator.getDeclaredField("maxEUStorage");
TileStirlingGenerator_production = TileStirlingGenerator.getDeclaredField("production");
//ModuleRegistrar.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.energyhandler");
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTEGenerator(), TileBaseGenerator);
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTEGenerator(), TileGeoGenerator);
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTEGenerator(), TileKineticGenerator);
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTEGenerator(), TileSemifluidGenerator);
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTEGenerator(), TileStirlingGenerator);
ModuleRegistrar.instance().registerNBTProvider (new HUDHandlerTEGenerator(), TileBaseGenerator);
ModuleRegistrar.instance().registerNBTProvider (new HUDHandlerTEGenerator(), TileGeoGenerator);
ModuleRegistrar.instance().registerNBTProvider (new HUDHandlerTEGenerator(), TileKineticGenerator);
ModuleRegistrar.instance().registerNBTProvider (new HUDHandlerTEGenerator(), TileSemifluidGenerator);
ModuleRegistrar.instance().registerNBTProvider (new HUDHandlerTEGenerator(), TileStirlingGenerator);
ModuleRegistrar.instance().addConfigRemote("IndustrialCraft2", "ic2.storage");
ModuleRegistrar.instance().addConfigRemote("IndustrialCraft2", "ic2.outputeu");
} catch (Exception e){
Waila.log.log(Level.WARN, "[IndustrialCraft 2] Error while loading generator hooks." + e);
}
}
}
@@ -1,186 +0,0 @@
package mcp.mobius.waila.addons.ic2;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.List;
import java.util.logging.Level;
import cpw.mods.fml.common.ObfuscationReflectionHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import mcp.mobius.waila.Waila;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.impl.ConfigHandler;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
import mcp.mobius.waila.utils.AccessHelper;
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();
Waila.log.log(Level.WARNING, "[IC2] Class not found. " + e);
return;
} catch (NoSuchMethodException e){
//e.printStackTrace();
Waila.log.log(Level.WARNING, "[IC2] Method not found." + e);
return;
} catch (NoSuchFieldException e){
//e.printStackTrace();
Waila.log.log(Level.WARNING, "[IC2] Field not found." + e);
return;
} catch (Exception e){
//e.printStackTrace();
Waila.log.log(Level.WARNING, "[IC2] Unhandled exception." + e);
return;
}
ModuleRegistrar.instance().addConfigRemote("IndustrialCraft2", "ic2.storage");
ModuleRegistrar.instance().addConfig("IndustrialCraft2", "ic2.outputeu");
ModuleRegistrar.instance().addConfigRemote("IndustrialCraft2", "ic2.inputeu");
ModuleRegistrar.instance().addConfigRemote("IndustrialCraft2", "ic2.consump");
ModuleRegistrar.instance().addConfigRemote("IndustrialCraft2", "ic2.tradeomat");
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTEStandardMachine(), TileEntityStandardMachine);
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTEBaseGenerator(), TileEntityBaseGenerator);
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTEBaseGenerator(), TileEntitySemifluidGenerator);
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTEBaseGenerator(), TileEntityGeoGenerator);
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTEElectricBlock(), TileEntityElectricBlock);
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTETradeOMat(), TileEntityTradeOMat);
ModuleRegistrar.instance().registerSyncedNBTKey("*", TileEntityStandardMachine);
ModuleRegistrar.instance().registerSyncedNBTKey("*", TileEntityBaseGenerator);
ModuleRegistrar.instance().registerSyncedNBTKey("*", TileEntitySemifluidGenerator);
ModuleRegistrar.instance().registerSyncedNBTKey("*", TileEntityGeoGenerator);
ModuleRegistrar.instance().registerSyncedNBTKey("*", TileEntityElectricBlock);
ModuleRegistrar.instance().registerSyncedNBTKey("*", 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");
//List tagList = (List)AccessHelper.getField("net.minecraft.nbt.NBTTagList", "tagList", nbtupgrades);
List tagList = ObfuscationReflectionHelper.getPrivateValue(NBTTagList.class, nbtupgrades, "field_74747_a");
for (Object subobj : 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;
}
@@ -2,52 +2,56 @@ package mcp.mobius.waila.addons.magicalcrops;
import java.util.List;
import mcp.mobius.waila.cbcore.LangUtil;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.cbcore.LangUtil;
public class HUDHandlerMagicalCrops implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@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> 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("general.showcrop")) return currenttip;
int growthStage = accessor.getMetadata();
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
if (!config.getConfig("general.showcrop")) return currenttip;
float growthValue = (growthStage / 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;
}
int growthStage = accessor.getMetadata();
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
float growthValue = (growthStage / 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;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
return currenttip;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
int y, int z) {
if (te != null) te.writeToNBT(tag);
return tag;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
if (te != null)
te.writeToNBT(tag);
return tag;
}
}
@@ -6,25 +6,25 @@ import mcp.mobius.waila.Waila;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
public class MagicalCropsModule {
public static Class BlockMagicalCrops = null;
public static void register(){
try{
Class MagicalCrops = Class.forName("magicalcrops.mod_sCrops");
Waila.log.log(Level.INFO, "MagicalCrops mod found.");
} catch (ClassNotFoundException e){
Waila.log.log(Level.INFO, "[MagicalCrops] MagicalCrops mod not found.");
return;
}
try{
BlockMagicalCrops = Class.forName("magicalcrops.BlockMagicalCrops");
} catch (ClassNotFoundException e){
Waila.log.log(Level.WARN, "[MagicalCrops] Class not found. " + e);
return;
}
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerMagicalCrops(), BlockMagicalCrops);
}
public static Class<?> BlockMagicalCrops = null;
public static void register() {
try {
Class.forName("magicalcrops.mod_sCrops");
Waila.log.log(Level.INFO, "MagicalCrops mod found.");
} catch (ClassNotFoundException e) {
Waila.log.log(Level.INFO, "[MagicalCrops] MagicalCrops mod not found.");
return;
}
try {
BlockMagicalCrops = Class.forName("magicalcrops.BlockMagicalCrops");
} catch (ClassNotFoundException e) {
Waila.log.log(Level.WARN, "[MagicalCrops] Class not found. " + e);
return;
}
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerMagicalCrops(), BlockMagicalCrops);
}
}
@@ -1,80 +0,0 @@
package mcp.mobius.waila.addons.openblocks;
import java.util.List;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.cbcore.LangUtil;
public class HUDHandlerTank implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("openblocks.fluidamount")) return currenttip;
IFluidHandler handler = (IFluidHandler)accessor.getTileEntity();
if (handler == null) return currenttip;
FluidTankInfo[] tanks = handler.getTankInfo(ForgeDirection.UNKNOWN);
if (tanks.length != 1) return currenttip;
FluidStack fluid = tanks[0].fluid;
String name = currenttip.get(0);
try{
name += String.format(" < %s >", fluid.getFluid().getLocalizedName(fluid));
} catch (NullPointerException f){
name += " " + LangUtil.translateG("hud.msg.empty");
}
currenttip.set(0, name);
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("openblocks.fluidamount")) return currenttip;
IFluidHandler handler = (IFluidHandler)accessor.getTileEntity();
if (handler == null) return currenttip;
FluidTankInfo[] tanks = handler.getTankInfo(ForgeDirection.UNKNOWN);
if (tanks.length != 1) return currenttip;
if(tanks[0].fluid != null)
currenttip.add(String.format("%d / %d mB", tanks[0].fluid.amount, tanks[0].capacity));
else
currenttip.add(String.format("0 / %d mB", tanks[0].capacity));
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
if (te != null)
te.writeToNBT(tag);
return tag;
}
}
@@ -4,31 +4,29 @@ import org.apache.logging.log4j.Level;
import mcp.mobius.waila.Waila;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
import mcp.mobius.waila.utils.LoadedMods;
public class OpenBlocksModule {
public static Class ModOpenBlocks = null;
public static Class TileEntityTank = null;
public static void register(){
try{
Class ModOpenBlocks = Class.forName("openblocks.OpenBlocks");
Waila.log.log(Level.INFO, "OpenBlocks mod found.");
} catch (ClassNotFoundException e){
Waila.log.log(Level.INFO, "[OpenBlocks] OpenBlocks mod not found.");
return;
}
try{
TileEntityTank = Class.forName("openblocks.common.tileentity.TileEntityTank");
} catch (ClassNotFoundException e){
Waila.log.log(Level.WARN, "[OpenBlocks] Class not found. " + e);
return;
}
ModuleRegistrar.instance().addConfigRemote("OpenBlocks", "openblocks.fluidamount");
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTank(), TileEntityTank);
ModuleRegistrar.instance().registerHeadProvider(new HUDHandlerTank(), TileEntityTank);
ModuleRegistrar.instance().registerNBTProvider (new HUDHandlerTank(), TileEntityTank);
}
public static Class<?> TileEntityTank = null;
public static void register() {
if (LoadedMods.WAILA_PLUGINS) {
return;
}
try {
TileEntityTank = Class.forName("openblocks.common.tileentity.TileEntityTank");
Waila.log.log(Level.INFO, "OpenBlocks mod found.");
} catch (ClassNotFoundException e) {
Waila.log.log(Level.INFO, "[OpenBlocks] OpenBlocks mod not found.");
return;
}
ModuleRegistrar.instance().addConfigRemote("OpenBlocks", "openblocks.fluidamount");
TankFluidHandler tankFluidHandler = new TankFluidHandler();
ModuleRegistrar.instance().registerBodyProvider(tankFluidHandler, TileEntityTank);
ModuleRegistrar.instance().registerHeadProvider(tankFluidHandler, TileEntityTank);
}
}
@@ -0,0 +1,80 @@
package mcp.mobius.waila.addons.openblocks;
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatFluid;
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
import java.util.List;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.cbcore.LangUtil;
public class TankFluidHandler implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
if (!config.getConfig("openblocks.fluidamount")) return currenttip;
IFluidHandler handler = (IFluidHandler) accessor.getTileEntity();
if (handler == null) return currenttip;
FluidTankInfo[] tanks = handler.getTankInfo(ForgeDirection.UNKNOWN);
if (tanks.length != 1) return currenttip;
FluidStack fluid = tanks[0].fluid;
String name = currenttip.get(0);
String fluidName = fluid == null ? LangUtil.translateG("hud.msg.empty")
: fluid.getFluid().getLocalizedName(fluid);
currenttip.set(0, name + " < " + fluidName + " >");
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
if (!config.getConfig("openblocks.fluidamount")) return currenttip;
IFluidHandler handler = (IFluidHandler) accessor.getTileEntity();
if (handler == null) return currenttip;
FluidTankInfo[] tanks = handler.getTankInfo(ForgeDirection.UNKNOWN);
if (tanks.length != 1) return currenttip;
int amount = tanks[0].fluid == null ? 0 : tanks[0].fluid.amount;
currenttip.add(String.format("%s / %s", formatNumber(amount), formatFluid(tanks[0].capacity)));
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
return currenttip;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
int y, int z) {
return tag;
}
}
@@ -2,6 +2,7 @@ package mcp.mobius.waila.addons.projectred;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaFMPAccessor;
import mcp.mobius.waila.api.IWailaFMPDecorator;
@@ -10,201 +11,318 @@ import mcp.mobius.waila.utils.NBTUtil;
public class HUDDecoratorRsGateLogic implements IWailaFMPDecorator {
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 byte[][] IOARRAYALTER={
{1,8,2,9} /* Cmp 1*/, {1,6,2,2} /* State 1*/, {2,8,2,9} /* Count 1*/, {6,2,2,1} /* Transp 1*/,
{2,1,2,1} /* Latch 1*/, {2,1,2,1} /* Latch 2*/, {2,1,2,1} /* Latch 3*/
};
static String[] IONAMES={ "", "IN", "OUT", "SWAP", "IN_A", "IN_B", "LOCK", "IO", "POS", "NEG", "BUS", "A", "B"};
@Override
public void decorateBlock(ItemStack itemStack, IWailaFMPAccessor accessor, IWailaConfigHandler config) {
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 */, };
if (!config.getConfig("pr.showio")) return;
int orient = 0;
int subID = 0;
int shape = 0;
orient = NBTUtil.getNBTInteger(accessor.getNBTData(), "orient");
subID = NBTUtil.getNBTInteger(accessor.getNBTData(), "subID");
shape = NBTUtil.getNBTInteger(accessor.getNBTData(), "shape");
//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;
static byte[][] IOARRAYALTER = { { 1, 8, 2, 9 } /* Cmp 1 */, { 1, 6, 2, 2 } /* State 1 */,
{ 2, 8, 2, 9 } /* Count 1 */, { 6, 2, 2, 1 } /* Transp 1 */, { 2, 1, 2, 1 } /* Latch 1 */,
{ 2, 1, 2, 1 } /* Latch 2 */, { 2, 1, 2, 1 } /* Latch 3 */
};
static String[] IONAMES = { "", "IN", "OUT", "SWAP", "IN_A", "IN_B", "LOCK", "IO", "POS", "NEG", "BUS", "A", "B" };
@Override
public void decorateBlock(ItemStack itemStack, IWailaFMPAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("pr.showio")) return;
int orient = 0;
int subID = 0;
int shape = 0;
orient = NBTUtil.getNBTInteger(accessor.getNBTData(), "orient");
subID = NBTUtil.getNBTInteger(accessor.getNBTData(), "subID");
shape = NBTUtil.getNBTInteger(accessor.getNBTData(), "shape");
int hOrient = orient & 0x3;
ForgeDirection vOrient = ForgeDirection.getOrientation((orient - (orient & 0x3)) >> 2);
if (vOrient == ForgeDirection.EAST) hOrient -= 1;
if (vOrient == ForgeDirection.WEST) hOrient += 1;
if (hOrient == -1) hOrient = 3;
String[] IOStr = new String[4];
if (shape != 0) {
int altIndex = -1;
if (subID == 26 && shape == 1) altIndex = 0;
if (subID == 20 && shape == 1) altIndex = 1;
if (subID == 19 && shape == 1) altIndex = 2;
if (subID == 14 && shape == 1) altIndex = 3;
if (subID == 12 && shape == 1) altIndex = 4;
if (subID == 12 && shape == 2) altIndex = 5;
if (subID == 12 && shape == 3) altIndex = 6;
if (altIndex == -1) for (int i = 0; i < 4; i++) IOStr[i] = IONAMES[IOARRAY[subID][i]];
else for (int i = 0; i < 4; i++) IOStr[i] = IONAMES[IOARRAYALTER[altIndex][i]];
} else {
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;
}
if (vOrient == ForgeDirection.WEST)
hOrient += 1;
if (hOrient == -1)
hOrient = 3;
String[] IOStr = new String[4];
if (shape != 0){
int altIndex = -1;
if (subID == 26 && shape == 1) altIndex = 0;
if (subID == 20 && shape == 1) altIndex = 1;
if (subID == 19 && shape == 1) altIndex = 2;
if (subID == 14 && shape == 1) altIndex = 3;
if (subID == 12 && shape == 1) altIndex = 4;
if (subID == 12 && shape == 2) altIndex = 5;
if (subID == 12 && shape == 3) altIndex = 6;
if (altIndex == -1)
for (int i = 0; i < 4; i++)
IOStr[i] = IONAMES[IOARRAY[subID][i]];
else
for (int i = 0; i < 4; i++)
IOStr[i] = IONAMES[IOARRAYALTER[altIndex][i]];
} else {
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 );
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.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 + 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.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.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.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.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.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.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.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;
}
}
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,82 +1,99 @@
package mcp.mobius.waila.addons.projectred;
import static mcp.mobius.waila.api.SpecialChars.ALIGNRIGHT;
import static mcp.mobius.waila.api.SpecialChars.GRAY;
import static mcp.mobius.waila.api.SpecialChars.TAB;
import static mcp.mobius.waila.api.SpecialChars.WHITE;
import java.util.List;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaFMPAccessor;
import mcp.mobius.waila.api.IWailaFMPProvider;
import mcp.mobius.waila.utils.NBTUtil;
import static mcp.mobius.waila.api.SpecialChars.*;
public class HUDFMPGateLogic implements IWailaFMPProvider {
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaFMPAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaFMPAccessor accessor,
IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaFMPAccessor 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;
orient = NBTUtil.getNBTInteger(accessor.getNBTData(), "orient");
subID = NBTUtil.getNBTInteger(accessor.getNBTData(), "subID");
shape = NBTUtil.getNBTInteger(accessor.getNBTData(), "shape");
if (subID == 17)
pmax = NBTUtil.getNBTInteger(accessor.getNBTData(), "pmax");
if (subID == 19){
val = NBTUtil.getNBTInteger(accessor.getNBTData(), "val");
max = NBTUtil.getNBTInteger(accessor.getNBTData(), "max");
dec = NBTUtil.getNBTInteger(accessor.getNBTData(), "dec");
inc = NBTUtil.getNBTInteger(accessor.getNBTData(), "inc");
}
switch(subID){
case 10:
currenttip.add(String.format("[Repeater]" + TAB + ALIGNRIGHT + WHITE + "%d" + GRAY + " ticks", (int)Math.pow(2, shape)));
break;
case 15:
if (shape == 0)
currenttip.add("[Sensor]" + TAB + ALIGNRIGHT + WHITE + "Open");
if (shape == 1)
currenttip.add("[Sensor]" + TAB + ALIGNRIGHT + WHITE + "Half closed");
if (shape == 2)
currenttip.add("[Sensor]" + TAB + ALIGNRIGHT + WHITE + "Closed");
break;
case 17:
currenttip.add(String.format("[Timer delay]" + TAB + ALIGNRIGHT + WHITE + "%d " + GRAY + "ms", (pmax + 2) * 50));
break;
case 19:
currenttip.add(String.format("[Counter value]"+ TAB + ALIGNRIGHT + WHITE + "%d " + GRAY + "/ " + WHITE + "%d", val, max));
currenttip.add(String.format("[Counter step]" + TAB + ALIGNRIGHT + WHITE + "-%d " + GRAY + "/ " + WHITE + "+%d", dec, inc));
default:
break;
}
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaFMPAccessor accessor,
IWailaConfigHandler config) {
if (!config.getConfig("pr.showdata")) return currenttip;
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaFMPAccessor accessor, IWailaConfigHandler config) {
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;
orient = NBTUtil.getNBTInteger(accessor.getNBTData(), "orient");
subID = NBTUtil.getNBTInteger(accessor.getNBTData(), "subID");
shape = NBTUtil.getNBTInteger(accessor.getNBTData(), "shape");
if (subID == 17) pmax = NBTUtil.getNBTInteger(accessor.getNBTData(), "pmax");
if (subID == 19) {
val = NBTUtil.getNBTInteger(accessor.getNBTData(), "val");
max = NBTUtil.getNBTInteger(accessor.getNBTData(), "max");
dec = NBTUtil.getNBTInteger(accessor.getNBTData(), "dec");
inc = NBTUtil.getNBTInteger(accessor.getNBTData(), "inc");
}
switch (subID) {
case 10:
currenttip.add(
String.format(
"[Repeater]" + TAB + ALIGNRIGHT + WHITE + "%d" + GRAY + " ticks",
(int) Math.pow(2, shape)));
break;
case 15:
if (shape == 0) currenttip.add("[Sensor]" + TAB + ALIGNRIGHT + WHITE + "Open");
if (shape == 1) currenttip.add("[Sensor]" + TAB + ALIGNRIGHT + WHITE + "Half closed");
if (shape == 2) currenttip.add("[Sensor]" + TAB + ALIGNRIGHT + WHITE + "Closed");
break;
case 17:
currenttip.add(
String.format(
"[Timer delay]" + TAB + ALIGNRIGHT + WHITE + "%d " + GRAY + "ms",
(pmax + 2) * 50));
break;
case 19:
currenttip.add(
String.format(
"[Counter value]" + TAB + ALIGNRIGHT + WHITE + "%d " + GRAY + "/ " + WHITE + "%d",
val,
max));
currenttip.add(
String.format(
"[Counter step]" + TAB + ALIGNRIGHT + WHITE + "-%d " + GRAY + "/ " + WHITE + "+%d",
dec,
inc));
default:
break;
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaFMPAccessor accessor,
IWailaConfigHandler config) {
return currenttip;
}
}
@@ -0,0 +1,41 @@
package mcp.mobius.waila.addons.projectred;
import java.util.List;
import net.minecraft.item.ItemStack;
import mcp.mobius.waila.api.ITaggedList;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaFMPAccessor;
import mcp.mobius.waila.api.IWailaFMPProvider;
import mcp.mobius.waila.cbcore.LangUtil;
import mcp.mobius.waila.utils.NBTUtil;
public class HUDFMPWires implements IWailaFMPProvider {
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaFMPAccessor accessor,
IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaFMPAccessor accessor,
IWailaConfigHandler config) {
if (!config.getConfig("pr.showsignal")) return currenttip;
ITaggedList<String, String> tagList = (ITaggedList<String, String>) currenttip;
int signal = ((NBTUtil.getNBTInteger(accessor.getNBTData(), "signal") & 0xff) + 16) / 17;
if (tagList.getEntries("signal").isEmpty()) {
tagList.add(String.format("%s : %s", LangUtil.translateG("hud.msg.power"), signal), "signal");
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaFMPAccessor accessor,
IWailaConfigHandler config) {
return currenttip;
}
}
@@ -7,35 +7,36 @@ import mcp.mobius.waila.api.impl.ModuleRegistrar;
public class ProjectRedModule {
public static void register(){
try{
Class ModClass = Class.forName("mrtjp.projectred.ProjectRedIntegration");
Waila.log.log(Level.INFO, "ProjectRed|Integration mod found.");
} catch (ClassNotFoundException e){
Waila.log.log(Level.INFO, "[ProjectRed] ProjectRed|Integration mod not found.");
return;
}
ModuleRegistrar.instance().addConfigRemote("Project:Red", "pr.showio");
ModuleRegistrar.instance().addConfigRemote("Project:Red", "pr.showdata");
ModuleRegistrar.instance().registerBodyProvider(new HUDFMPGateLogic(), "pr_sgate");
ModuleRegistrar.instance().registerBodyProvider(new HUDFMPGateLogic(), "pr_igate");
ModuleRegistrar.instance().registerBodyProvider(new HUDFMPGateLogic(), "pr_tgate");
ModuleRegistrar.instance().registerBodyProvider(new HUDFMPGateLogic(), "pr_bgate");
ModuleRegistrar.instance().registerBodyProvider(new HUDFMPGateLogic(), "pr_agate");
ModuleRegistrar.instance().registerBodyProvider(new HUDFMPGateLogic(), "pr_rgate");
ModuleRegistrar.instance().registerDecorator(new HUDDecoratorRsGateLogic(), "pr_sgate");
ModuleRegistrar.instance().registerDecorator(new HUDDecoratorRsGateLogic(), "pr_igate");
ModuleRegistrar.instance().registerDecorator(new HUDDecoratorRsGateLogic(), "pr_tgate");
ModuleRegistrar.instance().registerDecorator(new HUDDecoratorRsGateLogic(), "pr_bgate");
ModuleRegistrar.instance().registerDecorator(new HUDDecoratorRsGateLogic(), "pr_agate");
ModuleRegistrar.instance().registerDecorator(new HUDDecoratorRsGateLogic(), "pr_rgate");
//ModuleRegistrar.instance().registerBlockDecorator(new HUDDecoratorRsGateLogic(), BlockMultipart);
//ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerRsGateLogic(), BlockMultipart);
//ModuleRegistrar.instance().registerSyncedNBTKey("*", BlockMultipart);
}
public static void register() {
try {
Class.forName("mrtjp.projectred.ProjectRedIntegration");
Waila.log.log(Level.INFO, "ProjectRed|Integration mod found.");
} catch (ClassNotFoundException e) {
Waila.log.log(Level.INFO, "[ProjectRed] ProjectRed|Integration mod not found.");
return;
}
ModuleRegistrar.instance().addConfigRemote("Project:Red", "pr.showio");
ModuleRegistrar.instance().addConfigRemote("Project:Red", "pr.showdata");
ModuleRegistrar.instance().addConfigRemote("Project:Red", "pr.showsignal");
ModuleRegistrar.instance().registerBodyProvider(new HUDFMPGateLogic(), "pr_sgate");
ModuleRegistrar.instance().registerBodyProvider(new HUDFMPGateLogic(), "pr_igate");
ModuleRegistrar.instance().registerBodyProvider(new HUDFMPGateLogic(), "pr_tgate");
ModuleRegistrar.instance().registerBodyProvider(new HUDFMPGateLogic(), "pr_bgate");
ModuleRegistrar.instance().registerBodyProvider(new HUDFMPGateLogic(), "pr_agate");
ModuleRegistrar.instance().registerBodyProvider(new HUDFMPGateLogic(), "pr_rgate");
ModuleRegistrar.instance().registerBodyProvider(new HUDFMPWires(), "pr_redwire");
ModuleRegistrar.instance().registerBodyProvider(new HUDFMPWires(), "pr_insulated");
ModuleRegistrar.instance().registerBodyProvider(new HUDFMPWires(), "pr_fredwire");
ModuleRegistrar.instance().registerBodyProvider(new HUDFMPWires(), "pr_finsulated");
ModuleRegistrar.instance().registerDecorator(new HUDDecoratorRsGateLogic(), "pr_sgate");
ModuleRegistrar.instance().registerDecorator(new HUDDecoratorRsGateLogic(), "pr_igate");
ModuleRegistrar.instance().registerDecorator(new HUDDecoratorRsGateLogic(), "pr_tgate");
ModuleRegistrar.instance().registerDecorator(new HUDDecoratorRsGateLogic(), "pr_bgate");
ModuleRegistrar.instance().registerDecorator(new HUDDecoratorRsGateLogic(), "pr_agate");
ModuleRegistrar.instance().registerDecorator(new HUDDecoratorRsGateLogic(), "pr_rgate");
}
}
@@ -1,84 +0,0 @@
package mcp.mobius.waila.addons.railcraft;
import java.util.List;
import mcp.mobius.waila.cbcore.LangUtil;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidTank;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.utils.WailaExceptionHandler;
public class HUDHandlerTank implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("railcraft.fluidamount")) return currenttip;
try {
IFluidTank tank = (IFluidTank)RailcraftModule.ITankTile_getTank.invoke(RailcraftModule.ITankTile.cast(accessor.getTileEntity()));
if (tank == null) return currenttip;
FluidStack fluid = tank.getFluid();
String name = currenttip.get(0);
try{
name += String.format(" < %s >", fluid.getFluid().getLocalizedName(fluid));
} catch (NullPointerException f){
name += " " + LangUtil.translateG("hud.msg.empty");
}
currenttip.set(0, name);
} catch (Exception e){
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("railcraft.fluidamount")) return currenttip;
try {
IFluidTank tank = (IFluidTank)RailcraftModule.ITankTile_getTank.invoke(RailcraftModule.ITankTile.cast(accessor.getTileEntity()));
if (tank == null) return currenttip;
FluidStack fluid = tank.getFluid();
if (fluid != null)
currenttip.add(String.format("%d / %d mB", fluid.amount, tank.getInfo().capacity));
else
currenttip.add(String.format("0 / %d mB", tank.getInfo().capacity));
} catch (Exception e){
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
if (te != null)
te.writeToNBT(tag);
return tag;
}
}
@@ -1,44 +1,59 @@
package mcp.mobius.waila.addons.railcraft;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import org.apache.logging.log4j.Level;
import mcp.mobius.waila.Waila;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
import mcp.mobius.waila.utils.LoadedMods;
public class RailcraftModule {
public static Class TileTankBase = null;
public static Class ITankTile = null;
public static Method ITankTile_getTank = null;
//public static Class StandardTank = null;
public static void register(){
try{
Class ModRailcraft = Class.forName("mods.railcraft.common.core.Railcraft");
Waila.log.log(Level.INFO, "Railcraft mod found.");
} catch (ClassNotFoundException e){
Waila.log.log(Level.INFO, "[Railcraft] Railcraft mod not found.");
return;
}
try{
TileTankBase = Class.forName("mods.railcraft.common.blocks.machine.beta.TileTankBase");
ITankTile = Class.forName("mods.railcraft.common.blocks.machine.ITankTile");
ITankTile_getTank = ITankTile.getMethod("getTank");
//StandardTank = Class.forName("mods.railcraft.common.fluids.tanks.StandardTank");
} catch (ClassNotFoundException e){
Waila.log.log(Level.WARN, "[Railcraft] Class not found. " + e);
return;
} catch (NoSuchMethodException e){
Waila.log.log(Level.WARN, "[Railcraft] Method not found." + e);
return;
}
ModuleRegistrar.instance().addConfigRemote("Railcraft", "railcraft.fluidamount");
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTank(), TileTankBase);
ModuleRegistrar.instance().registerHeadProvider(new HUDHandlerTank(), TileTankBase);
ModuleRegistrar.instance().registerNBTProvider (new HUDHandlerTank(), TileTankBase);
}
public static Class<?> TileTankBase = null;
public static Method TileTankBase_getTank = null;
public static Class<?> StandardTank = null;
public static Field StandardTank_capacity = null;
public static Field StandardTank_renderData = null;
public static Field StandardTank_renderDataFluid = null;
public static Field StandardTank_renderDataAmount = null;
public static void register() {
if (LoadedMods.WAILA_PLUGINS) {
return;
}
try {
TileTankBase = Class.forName("mods.railcraft.common.blocks.machine.beta.TileTankBase");
TileTankBase_getTank = TileTankBase.getMethod("getTank");
StandardTank = Class.forName("mods.railcraft.common.fluids.tanks.StandardTank");
StandardTank_capacity = StandardTank.getSuperclass().getDeclaredField("capacity");
StandardTank_capacity.setAccessible(true);
StandardTank_renderData = StandardTank.getField("renderData");
StandardTank_renderDataFluid = StandardTank_renderData.getType().getField("fluid");
StandardTank_renderDataAmount = StandardTank_renderData.getType().getField("amount");
Waila.log.log(Level.INFO, "Railcraft mod found.");
} catch (ClassNotFoundException e) {
Waila.log.log(Level.WARN, "[Railcraft] Class not found. " + e);
return;
} catch (NoSuchMethodException e) {
Waila.log.log(Level.WARN, "[Railcraft] Method not found." + e);
return;
} catch (NoSuchFieldException e) {
Waila.log.log(Level.WARN, "[Railcraft] Field not found." + e);
return;
}
ModuleRegistrar.instance().addConfigRemote("Railcraft", "railcraft.fluidamount");
TankFluidHandler tankFluidHandler = new TankFluidHandler();
ModuleRegistrar.instance().registerHeadProvider(tankFluidHandler, TileTankBase);
ModuleRegistrar.instance().registerBodyProvider(tankFluidHandler, TileTankBase);
}
}
@@ -0,0 +1,98 @@
package mcp.mobius.waila.addons.railcraft;
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatFluid;
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
import java.util.List;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
import net.minecraftforge.fluids.IFluidTank;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.cbcore.LangUtil;
import mcp.mobius.waila.utils.WailaExceptionHandler;
public class TankFluidHandler implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
if (!config.getConfig("railcraft.fluidamount")) return currenttip;
IFluidTank tank = this.getTank(accessor.getTileEntity());
if (tank == null) return currenttip;
FluidStack fluid = tank.getFluid();
String name = currenttip.get(0);
String fluidName = fluid == null ? LangUtil.translateG("hud.msg.empty")
: fluid.getFluid().getLocalizedName(fluid);
currenttip.set(0, name + " < " + fluidName + " >");
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
if (!config.getConfig("railcraft.fluidamount")) return currenttip;
IFluidTank tank = this.getTank(accessor.getTileEntity());
if (tank == null) return currenttip;
FluidStack fluid = tank.getFluid();
int amount = fluid == null ? 0 : fluid.amount;
currenttip.add(String.format("%s / %s", formatNumber(amount), formatFluid(tank.getCapacity())));
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
return currenttip;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
int y, int z) {
return tag;
}
private FluidTank getTank(TileEntity tileEntity) {
if (tileEntity == null) {
return null;
}
try {
Object tank = RailcraftModule.TileTankBase_getTank.invoke(tileEntity);
int capacity = RailcraftModule.StandardTank_capacity.getInt(tank);
Object renderData = RailcraftModule.StandardTank_renderData.get(tank);
Fluid fluid = (Fluid) RailcraftModule.StandardTank_renderDataFluid.get(renderData);
int amount = RailcraftModule.StandardTank_renderDataAmount.getInt(renderData);
return new FluidTank(fluid, amount, capacity);
} catch (Exception e) {
WailaExceptionHandler.handleErr(e, tileEntity.getClass().getName(), null);
return null;
}
}
}
@@ -7,94 +7,45 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDTileEntityCamo implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
/*
if (!config.getConfig("secretrooms.hide")) return null;
if ( SecretRoomsModule.BlockCamoTrapDoor.isInstance(accessor.getBlock()) ){
return this.getTrapDoorBlock(accessor);
@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;
}
else if ( SecretRoomsModule.BlockTorchLever.isInstance(accessor.getBlock()) ){
return new ItemStack(Blocks.torch);
}
else if (accessor.getNBTData() != null){
NBTTagCompound tag = accessor.getNBTData();
if (tag.hasKey("copyID") && tag.hasKey("copyMeta")){
int copyID = accessor.getNBTInteger(tag, "copyID");
int copyMeta = accessor.getNBTInteger(tag, "copyMeta");
return new ItemStack(copyID, 1, copyMeta);
}
}
*/
return null;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaHead(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;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
private ItemStack getTrapDoorBlock(IWailaDataAccessor accessor) {
return null;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
int y, int z) {
if (te != null) te.writeToNBT(tag);
return tag;
}
private ItemStack getTrapDoorBlock(IWailaDataAccessor accessor){
// modify coordinates to get hinge Block.
/*
int i = accessor.getMetadata();
int j = accessor.getPosition().blockX;
int k = accessor.getPosition().blockZ;
if ((i & 3) == 0)
{
k++;
}
if ((i & 3) == 1)
{
k--;
}
if ((i & 3) == 2)
{
j++;
}
if ((i & 3) == 3)
{
j--;
}
int blockID = accessor.getWorld().getBlockId(j, accessor.getPosition().blockY, k);
int blockMeta = accessor.getWorld().getBlockMetadata(j, accessor.getPosition().blockY, k);
return new ItemStack(blockID, 1, blockMeta);
*/
return null;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
if (te != null)
te.writeToNBT(tag);
return tag;
}
}
@@ -2,40 +2,6 @@ package mcp.mobius.waila.addons.secretrooms;
public class SecretRoomsModule {
public static Class TileEntityCamo = null;
public static Class BlockTorchLever = null;
public static Class BlockCamoTrapDoor = null;
public static void register(){
/*
try{
Class SecretRooms = Class.forName("com.github.AbrarSyed.secretroomsmod.common.SecretRooms");
Waila.log.log(Level.INFO, "SecretRooms mod found.");
} catch (ClassNotFoundException e){
Waila.log.log(Level.INFO, "[SecretRooms] SecretRooms mod not found.");
return;
}
try{
TileEntityCamo = Class.forName("com.github.AbrarSyed.secretroomsmod.blocks.TileEntityCamo");
BlockTorchLever = Class.forName("com.github.AbrarSyed.secretroomsmod.blocks.BlockTorchLever");
BlockCamoTrapDoor = Class.forName("com.github.AbrarSyed.secretroomsmod.blocks.BlockCamoTrapDoor");
} catch (ClassNotFoundException e){
Waila.log.log(Level.WARNING, "[SecretRooms] Class not found. " + e);
return;
} catch (Exception e) {
Waila.log.log(Level.WARNING, "[SecretRooms] Error while loading module. " + e);
return;
}
public static void register() {}
ModuleRegistrar.instance().addConfig("SecretRooms", "secretrooms.hide");
ModuleRegistrar.instance().registerStackProvider(new HUDTileEntityCamo(), TileEntityCamo);
ModuleRegistrar.instance().registerStackProvider(new HUDTileEntityCamo(), BlockTorchLever);
ModuleRegistrar.instance().registerStackProvider(new HUDTileEntityCamo(), BlockCamoTrapDoor);
ModuleRegistrar.instance().registerSyncedNBTKey("copyID", TileEntityCamo);
ModuleRegistrar.instance().registerSyncedNBTKey("copyMeta", TileEntityCamo);
*/
}
}
@@ -1,5 +1,9 @@
package mcp.mobius.waila.addons.statues;
import static mcp.mobius.waila.api.SpecialChars.BLUE;
import static mcp.mobius.waila.api.SpecialChars.ITALIC;
import static mcp.mobius.waila.api.SpecialChars.WHITE;
import java.util.List;
import net.minecraft.entity.player.EntityPlayerMP;
@@ -7,72 +11,66 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.utils.WailaExceptionHandler;
import static mcp.mobius.waila.api.SpecialChars.*;
public class HUDHandlerStatues implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
try {
String skinName = (String)StatuesModule.skinName.get(accessor.getTileEntity());
if (skinName.equals("")){
TileEntity belowEnt = accessor.getWorld().getTileEntity(accessor.getPosition().blockX, accessor.getPosition().blockY - 1, accessor.getPosition().blockZ);
if (StatuesModule.TileEntityStatue.isInstance(belowEnt))
skinName = (String)StatuesModule.skinName.get(belowEnt);
}
if (skinName.equals("")){
currenttip.clear();
currenttip.add(WHITE + "Statue : Unknown");
} else {
currenttip.clear();
currenttip.add(WHITE + "Statue : " + skinName);
}
} catch (Exception e) {
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
/*
String skinName = accessor.getNBTData().getString("skin");
if (skinName.equals("")){
if (accessor.getWorld().getBlockTileEntity(accessor.getPosition().blockX, accessor.getPosition().blockY - 1, accessor.getPosition().blockZ) != null){
}
}
*/
return currenttip;
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
try {
String skinName = (String) StatuesModule.skinName.get(accessor.getTileEntity());
if (skinName.isEmpty()) {
TileEntity belowEnt = accessor.getWorld().getTileEntity(
accessor.getPosition().blockX,
accessor.getPosition().blockY - 1,
accessor.getPosition().blockZ);
if (StatuesModule.TileEntityStatue.isInstance(belowEnt))
skinName = (String) StatuesModule.skinName.get(belowEnt);
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
if (skinName.isEmpty()) {
currenttip.clear();
currenttip.add(WHITE + "Statue : Unknown");
} else {
currenttip.clear();
currenttip.add(WHITE + "Statue : " + skinName);
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
currenttip.add(BLUE + ITALIC + "Statues" );
return currenttip;
}
} 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) {
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
currenttip.add(BLUE + ITALIC + "Statues");
return currenttip;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
int y, int z) {
if (te != null) te.writeToNBT(tag);
return tag;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
if (te != null)
te.writeToNBT(tag);
return tag;
}
}
@@ -9,32 +9,29 @@ import mcp.mobius.waila.api.impl.ModuleRegistrar;
public class StatuesModule {
public static Class TileEntityStatue = null;
public static Field skinName = null;
public static void register(){
try{
Class Statues = Class.forName("info.jbcs.minecraft.statues.Statues");
Waila.log.log(Level.INFO, "Statues mod found.");
} catch (ClassNotFoundException e){
Waila.log.log(Level.INFO, "[Statues] Statues mod not found.");
return;
}
try{
TileEntityStatue = Class.forName("info.jbcs.minecraft.statues.TileEntityStatue");
skinName = TileEntityStatue.getDeclaredField("skinName");
} catch (ClassNotFoundException e){
Waila.log.log(Level.WARN, "[Statues] Class not found. " + e);
return;
} catch (NoSuchFieldException e){
Waila.log.log(Level.WARN, "[Statues] Class not found. " + e);
return;
}
ModuleRegistrar.instance().registerHeadProvider(new HUDHandlerStatues(), TileEntityStatue);
ModuleRegistrar.instance().registerTailProvider(new HUDHandlerStatues(), TileEntityStatue);
ModuleRegistrar.instance().registerNBTProvider (new HUDHandlerStatues(), TileEntityStatue);
}
public static Class<?> TileEntityStatue = null;
public static Field skinName = null;
public static void register() {
try {
Class.forName("info.jbcs.minecraft.statues.Statues");
Waila.log.log(Level.INFO, "Statues mod found.");
} catch (ClassNotFoundException e) {
Waila.log.log(Level.INFO, "[Statues] Statues mod not found.");
return;
}
try {
TileEntityStatue = Class.forName("info.jbcs.minecraft.statues.TileEntityStatue");
skinName = TileEntityStatue.getDeclaredField("skinName");
} catch (ClassNotFoundException | NoSuchFieldException e) {
Waila.log.log(Level.WARN, "[Statues] Class not found. " + e);
return;
}
ModuleRegistrar.instance().registerHeadProvider(new HUDHandlerStatues(), TileEntityStatue);
ModuleRegistrar.instance().registerTailProvider(new HUDHandlerStatues(), TileEntityStatue);
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerStatues(), TileEntityStatue);
}
}
@@ -1,5 +1,12 @@
package mcp.mobius.waila.addons.stevescarts;
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
import static mcp.mobius.waila.api.SpecialChars.ALIGNRIGHT;
import static mcp.mobius.waila.api.SpecialChars.GRAY;
import static mcp.mobius.waila.api.SpecialChars.ITALIC;
import static mcp.mobius.waila.api.SpecialChars.TAB;
import static mcp.mobius.waila.api.SpecialChars.WHITE;
import java.util.ArrayList;
import java.util.List;
@@ -8,152 +15,133 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.utils.WailaExceptionHandler;
import static mcp.mobius.waila.api.SpecialChars.*;
public class HUDCargoManager implements IWailaDataProvider {
private static String colors[] = {"NA", "Red", "Blue", "Yellow", "Green", "Dis."};
private static String sides[] = {"Yellow", "Blue", "Green", "Red"};
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
private static String[] colors = { "NA", "Red", "Blue", "Yellow", "Green", "Dis." };
private static String[] sides = { "Yellow", "Blue", "Green", "Red" };
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("stevescarts.showall")) return currenttip;
if (config.getConfig("stevescarts.shifttoggle") && !accessor.getPlayer().isSneaking()){
currenttip.add(ITALIC + "Press shift for more data");
return currenttip;
}
NBTTagCompound tag = accessor.getNBTData();
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
return currenttip;
}
if (config.getConfig("stevescarts.colorblind")){
int side = accessor.getSide().ordinal() - 2;
if (side >= 0)
currenttip.add("Looking at side " + WHITE + sides[side]);
}
int layout = accessor.getNBTInteger(tag, "layout");
switch(layout){
case 0:
currenttip.add("Slots : "+ WHITE + "Shared");
break;
case 1:
currenttip.add("Slots : "+ WHITE + "By side");
break;
case 2:
currenttip.add("Slots : "+ WHITE + "By color");
break;
}
try{
ArrayList<Object> itemSelection = (ArrayList<Object>) StevesCartsModule.ItemSelections.get(accessor.getTileEntity());
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
if (!config.getConfig("stevescarts.showall")) return currenttip;
if (config.getConfig("stevescarts.shifttoggle") && !accessor.getPlayer().isSneaking()) {
currenttip.add(ITALIC + "Press shift for more data");
return currenttip;
}
int toCart = accessor.getNBTInteger(tag, "tocart");
int doReturn = accessor.getNBTInteger(tag, "doReturn");
for (int i = 0; i < 4; i++){
int target = accessor.getNBTInteger(tag, "target" + String.valueOf(i));
int color = accessor.getNBTInteger(tag, "color" + String.valueOf(i));
int amount = accessor.getNBTInteger(tag, "amount" + String.valueOf(i));
if (color == 5) continue;
String direction = (toCart & (1 << i)) != 0 ? "Load" : "Unload";
String shouldReturn = (doReturn & (1 << i)) != 0 ? "Ret." : "Cont.";
String sAmount = amount == 0 ? "All" : String.valueOf(this.getAmount(amount) + " " + this.getAmountType(amount));
String selection = (String) StevesCartsModule.GetSelectionName.invoke(StevesCartsModule.CargoItemSelection.cast(itemSelection.get(target)));
currenttip.add(String.format("Side %s %s[ %s ]%s[ %s , %s]%s[ %s ]", WHITE + colors[color] + GRAY,
TAB + ALIGNRIGHT, WHITE + selection + GRAY,
TAB + ALIGNRIGHT, WHITE + direction + GRAY,
TAB + ALIGNRIGHT + WHITE + shouldReturn + GRAY,
TAB + ALIGNRIGHT, WHITE + sAmount + GRAY));
}
} catch (Exception e) {
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
return currenttip;
}
NBTTagCompound tag = accessor.getNBTData();
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
if (config.getConfig("stevescarts.colorblind")) {
int side = accessor.getSide().ordinal() - 2;
if (side >= 0) currenttip.add("Looking at side " + WHITE + sides[side]);
}
public int getAmount(int id)
{
switch (id)
{
int layout = accessor.getNBTInteger(tag, "layout");
switch (layout) {
case 0:
currenttip.add("Slots : " + WHITE + "Shared");
break;
case 1:
return 1;
currenttip.add("Slots : " + WHITE + "By side");
break;
case 2:
return 3;
currenttip.add("Slots : " + WHITE + "By color");
break;
}
case 3:
return 8;
try {
ArrayList<Object> itemSelection = (ArrayList<Object>) StevesCartsModule.ItemSelections
.get(accessor.getTileEntity());
case 4:
return 16;
int toCart = accessor.getNBTInteger(tag, "tocart");
int doReturn = accessor.getNBTInteger(tag, "doReturn");
case 5:
return 32;
for (int i = 0; i < 4; i++) {
int target = accessor.getNBTInteger(tag, "target" + i);
int color = accessor.getNBTInteger(tag, "color" + i);
int amount = accessor.getNBTInteger(tag, "amount" + i);
if (color == 5) continue;
case 6:
return 64;
String direction = (toCart & (1 << i)) != 0 ? "Load" : "Unload";
String shouldReturn = (doReturn & (1 << i)) != 0 ? "Ret." : "Cont.";
String sAmount = amount == 0 ? "All"
: formatNumber(this.getAmount(amount)) + " " + this.getAmountType(amount);
case 7:
return 1;
String selection = (String) StevesCartsModule.GetSelectionName
.invoke(StevesCartsModule.CargoItemSelection.cast(itemSelection.get(target)));
currenttip.add(
String.format(
"Side %s %s[ %s ]%s[ %s , %s]%s[ %s ]",
WHITE + colors[color] + GRAY,
TAB + ALIGNRIGHT,
WHITE + selection + GRAY,
TAB + ALIGNRIGHT,
WHITE + direction + GRAY,
TAB + ALIGNRIGHT + WHITE + shouldReturn + GRAY,
TAB + ALIGNRIGHT,
WHITE + sAmount + GRAY));
}
case 8:
return 2;
} catch (Exception e) {
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
}
case 9:
return 3;
return currenttip;
}
case 10:
return 5;
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
return currenttip;
}
default:
return 0;
public int getAmount(int id) {
return switch (id) {
case 1, 7 -> 1;
case 2, 9 -> 3;
case 3 -> 8;
case 4 -> 16;
case 5 -> 32;
case 6 -> 64;
case 8 -> 2;
case 10 -> 5;
default -> 0;
};
}
// 0 - MAX
// 1 - Items
// 2 - Stacks
public String getAmountType(int id) {
if (id <= 6) {
return "I";
} else {
return "S";
}
}
//0 - MAX
//1 - Items
//2 - Stacks
public String getAmountType(int id)
{
if (id <= 6)
{
return "I";
}
else
{
return "S";
}
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
if (te != null)
te.writeToNBT(tag);
return tag;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
int y, int z) {
if (te != null) te.writeToNBT(tag);
return tag;
}
}
@@ -7,80 +7,40 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDCartAssembler implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@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> 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("stevescarts.showall")) return currenttip;
if (config.getConfig("stevescarts.shifttoggle") && !accessor.getPlayer().isSneaking()){
currenttip.add(ITALIC + "Press shift for more data");
return currenttip;
}
int currTime = accessor.getNBTInteger(accessor.getNBTData(), "currentTime");
int maxTime = accessor.getNBTInteger(accessor.getNBTData(), "maxTime");
int isAssembling = accessor.getNBTInteger(accessor.getNBTData(), "isAssembling");
NBTTagList slots = accessor.getNBTData().getTagList("Items");
boolean hasOutput = false;
Item ItemCartModule = null;
try {
ItemCartModule = (Item)StevesCartsModule.ItemCartModule.get(null);
} catch (Exception e) {
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
return currenttip;
}
for (int i = 0; i < slots.tagCount(); i++){
NBTTagCompound subtag = (NBTTagCompound)(slots.tagAt(i));
byte slot = subtag.getByte("Slot");
if (slot == 30)
hasOutput = true;
}
if (isAssembling == 1){
currenttip.add(String.format("Time remaining : %.1f sec", (maxTime - currTime) / 20.0f));
NBTTagCompound output = accessor.getNBTData().getCompoundTag("Output");
short outID = output.getShort("id");
byte[] metas = output.getCompoundTag("tag").getByteArray("Modules");
for (byte b : metas){
currenttip.add(new ItemStack(ItemCartModule, 1, b).getDisplayName());
}
}
else
if (hasOutput)
currenttip.add(String.format("Time remaining : <Done>"));
else
currenttip.add(String.format("Time remaining : <Idle>"));
*/
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;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
return currenttip;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
if (te != null)
te.writeToNBT(tag);
return tag;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
int y, int z) {
if (te != null) te.writeToNBT(tag);
return tag;
}
}
@@ -1,5 +1,12 @@
package mcp.mobius.waila.addons.stevescarts;
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatFluid;
import static mcp.mobius.waila.api.SpecialChars.ALIGNRIGHT;
import static mcp.mobius.waila.api.SpecialChars.GRAY;
import static mcp.mobius.waila.api.SpecialChars.ITALIC;
import static mcp.mobius.waila.api.SpecialChars.TAB;
import static mcp.mobius.waila.api.SpecialChars.WHITE;
import java.util.List;
import net.minecraft.entity.player.EntityPlayerMP;
@@ -7,129 +14,122 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import static mcp.mobius.waila.api.SpecialChars.*;
public class HUDLiquidManager implements IWailaDataProvider {
private static String colors[] = {"NA", "Red", "Blue", "Yellow", "Green", "Dis."};
private static String sides[] = {"Yellow", "Blue", "Green", "Red"};
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
private static String[] colors = { "NA", "Red", "Blue", "Yellow", "Green", "Dis." };
private static String[] sides = { "Yellow", "Blue", "Green", "Red" };
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("stevescarts.showall")) return currenttip;
if (config.getConfig("stevescarts.shifttoggle") && !accessor.getPlayer().isSneaking()){
currenttip.add(ITALIC + "Press shift for more data");
return currenttip;
}
NBTTagCompound tag = accessor.getNBTData();
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
return currenttip;
}
if (config.getConfig("stevescarts.colorblind")){
int side = accessor.getSide().ordinal() - 2;
if (side >= 0)
currenttip.add("Looking at side " + WHITE + sides[side]);
}
int layout = accessor.getNBTInteger(tag, "layout");
switch(layout){
case 0:
currenttip.add("Tanks : "+ WHITE + "Shared");
break;
case 1:
currenttip.add("Tanks : "+ WHITE + "By side");
break;
case 2:
currenttip.add("Tanks : "+ WHITE + "By color");
break;
}
int toCart = accessor.getNBTInteger(tag, "tocart");
int doReturn = accessor.getNBTInteger(tag, "doReturn");
for (int i = 0; i < 4; i++){
int target = accessor.getNBTInteger(tag, "target" + String.valueOf(i));
int color = accessor.getNBTInteger(tag, "color" + String.valueOf(i));
int amount = accessor.getNBTInteger(tag, "amount" + String.valueOf(i));
String fluidName = "<Empty>";
int fluidAmount = 0;
if (tag.hasKey("Fluid" + i)){
fluidName = tag.getCompoundTag("Fluid" + i).getString("FluidName");
fluidAmount = tag.getCompoundTag("Fluid" + i).getInteger("Amount");
}
String fluidString = fluidAmount == 0 ? "<Empty>" : String.format("%s mB of %s", fluidAmount, fluidName);
if (color == 5) continue;
String direction = (toCart & (1 << i)) != 0 ? "Load" : "Unload";
String shouldReturn = (doReturn & (1 << i)) != 0 ? "Ret." : "Cont.";
String sAmount = amount == 0 ? "All" : String.valueOf(this.getMaxAmountBuckets(amount)) + " mB";
//String selection = (String) StevesCartsModule.GetSelectionName.invoke(StevesCartsModule.CargoItemSelection.cast(itemSelection.get(target)));
currenttip.add(String.format("Side %s %s[ %s ]%s[ %s , %s]%s[ %s ]", WHITE + colors[color] + GRAY,
TAB + ALIGNRIGHT, WHITE + fluidString + GRAY,
TAB + ALIGNRIGHT, WHITE + direction + GRAY,
TAB + ALIGNRIGHT + WHITE + shouldReturn + GRAY,
TAB + ALIGNRIGHT, WHITE + sAmount + GRAY));
}
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
if (!config.getConfig("stevescarts.showall")) return currenttip;
if (config.getConfig("stevescarts.shifttoggle") && !accessor.getPlayer().isSneaking()) {
currenttip.add(ITALIC + "Press shift for more data");
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
NBTTagCompound tag = accessor.getNBTData();
public int getMaxAmountBuckets(int id) {
switch(id) {
case 1:
return 250;
case 2:
return 500;
case 3:
return 750;
case 4:
return 1000;
case 5:
return 2000;
case 6:
return 3000;
case 7:
return 5000;
case 8:
return 7500;
case 9:
return 10000;
case 10:
return 15000;
default:
return 0;
}
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
if (te != null)
te.writeToNBT(tag);
return tag;
}
if (config.getConfig("stevescarts.colorblind")) {
int side = accessor.getSide().ordinal() - 2;
if (side >= 0) currenttip.add("Looking at side " + WHITE + sides[side]);
}
int layout = accessor.getNBTInteger(tag, "layout");
switch (layout) {
case 0:
currenttip.add("Tanks : " + WHITE + "Shared");
break;
case 1:
currenttip.add("Tanks : " + WHITE + "By side");
break;
case 2:
currenttip.add("Tanks : " + WHITE + "By color");
break;
}
int toCart = accessor.getNBTInteger(tag, "tocart");
int doReturn = accessor.getNBTInteger(tag, "doReturn");
for (int i = 0; i < 4; i++) {
int color = accessor.getNBTInteger(tag, "color" + i);
int amount = accessor.getNBTInteger(tag, "amount" + i);
String fluidName = "<Empty>";
int fluidAmount = 0;
if (tag.hasKey("Fluid" + i)) {
fluidName = tag.getCompoundTag("Fluid" + i).getString("FluidName");
fluidAmount = tag.getCompoundTag("Fluid" + i).getInteger("Amount");
}
String fluidString = fluidAmount == 0 ? "<Empty>"
: String.format("%s of %s", formatFluid(fluidAmount), fluidName);
if (color == 5) continue;
String direction = (toCart & (1 << i)) != 0 ? "Load" : "Unload";
String shouldReturn = (doReturn & (1 << i)) != 0 ? "Ret." : "Cont.";
String sAmount = amount == 0 ? "All" : formatFluid(this.getMaxAmountBuckets(amount));
currenttip.add(
String.format(
"Side %s %s[ %s ]%s[ %s , %s]%s[ %s ]",
WHITE + colors[color] + GRAY,
TAB + ALIGNRIGHT,
WHITE + fluidString + GRAY,
TAB + ALIGNRIGHT,
WHITE + direction + GRAY,
TAB + ALIGNRIGHT + WHITE + shouldReturn + GRAY,
TAB + ALIGNRIGHT,
WHITE + sAmount + GRAY));
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
return currenttip;
}
public int getMaxAmountBuckets(int id) {
return switch (id) {
case 1 -> 250;
case 2 -> 500;
case 3 -> 750;
case 4 -> 1000;
case 5 -> 2000;
case 6 -> 3000;
case 7 -> 5000;
case 8 -> 7500;
case 9 -> 10000;
case 10 -> 15000;
default -> 0;
};
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
int y, int z) {
if (te != null) te.writeToNBT(tag);
return tag;
}
}
@@ -1,5 +1,12 @@
package mcp.mobius.waila.addons.stevescarts;
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
import static mcp.mobius.waila.api.SpecialChars.ALIGNRIGHT;
import static mcp.mobius.waila.api.SpecialChars.GRAY;
import static mcp.mobius.waila.api.SpecialChars.ITALIC;
import static mcp.mobius.waila.api.SpecialChars.TAB;
import static mcp.mobius.waila.api.SpecialChars.WHITE;
import java.util.List;
import net.minecraft.entity.Entity;
@@ -8,86 +15,102 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaEntityAccessor;
import mcp.mobius.waila.api.IWailaEntityProvider;
import mcp.mobius.waila.utils.WailaExceptionHandler;
import static mcp.mobius.waila.api.SpecialChars.*;
public class HUDMinecartModular implements IWailaEntityProvider {
@Override
public Entity getWailaOverride(IWailaEntityAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public Entity getWailaOverride(IWailaEntityAccessor accessor, IWailaConfigHandler config) {
return null;
}
@Override
public List<String> getWailaHead(Entity entity, List<String> currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config) {
if (currenttip.get(0).contains("entity.StevesCarts.Minecart")){
currenttip.remove(0);
currenttip.add(WHITE + "Modular Minecart");
}
return currenttip;
}
@Override
public List<String> getWailaHead(Entity entity, List<String> currenttip, IWailaEntityAccessor accessor,
IWailaConfigHandler config) {
if (currenttip.get(0).contains("entity.StevesCarts.Minecart")) {
currenttip.remove(0);
currenttip.add(WHITE + "Modular Minecart");
}
@Override
public List<String> getWailaBody(Entity entity, List<String> currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("stevescarts.showall")) return currenttip;
if (config.getConfig("stevescarts.shifttoggle") && !accessor.getPlayer().isSneaking()){
currenttip.add(ITALIC + "Press shift for more data");
return currenttip;
}
Item ItemCartModule = null;
try {
ItemCartModule = (Item)StevesCartsModule.ItemCartModule.get(null);
} catch (Exception e) {
currenttip = WailaExceptionHandler.handleErr(e, accessor.getEntity().getClass().getName(), currenttip);
return currenttip;
}
NBTTagCompound tag = accessor.getNBTData();
if (tag.hasKey("Modules")){
byte[] metas = tag.getByteArray("Modules");
for (int i = 0; i < metas.length; i++){
if (tag.hasKey("module" + String.valueOf(i) + "Fuel")){
int fuel = accessor.getNBTInteger(tag, "module" + String.valueOf(i) + "Fuel");
currenttip.add(new ItemStack(ItemCartModule, 1, metas[i]).getDisplayName() + TAB + ALIGNRIGHT + " [ " + WHITE + fuel + GRAY + " POW ]");
} else if (tag.hasKey("module" + String.valueOf(i) + "Fluid")){
NBTTagCompound subtag = tag.getCompoundTag("module" + String.valueOf(i) + "Fluid");
if (subtag.hasKey("Amount")){
int amount = accessor.getNBTInteger(subtag, "Amount");
String fluid = subtag.getString("FluidName");
currenttip.add(new ItemStack(ItemCartModule, 1, metas[i]).getDisplayName() + TAB + ALIGNRIGHT + " [ " + WHITE + String.valueOf(amount) + GRAY + " mB of " + WHITE + fluid + GRAY + " ]");
} else {
currenttip.add(new ItemStack(ItemCartModule, 1, metas[i]).getDisplayName() + TAB + ALIGNRIGHT + " < " + WHITE + "Empty" + GRAY + " > ");
}
}else{
currenttip.add(new ItemStack(ItemCartModule, 1, metas[i]).getDisplayName());
}
}
}
return currenttip;
}
return currenttip;
}
@Override
public List<String> getWailaTail(Entity entity, List<String> currenttip, IWailaEntityAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public List<String> getWailaBody(Entity entity, List<String> currenttip, IWailaEntityAccessor accessor,
IWailaConfigHandler config) {
if (!config.getConfig("stevescarts.showall")) return currenttip;
if (config.getConfig("stevescarts.shifttoggle") && !accessor.getPlayer().isSneaking()) {
currenttip.add(ITALIC + "Press shift for more data");
return currenttip;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, Entity te, NBTTagCompound tag, World world) {
if (te != null)
te.writeToNBT(tag);
return tag;
}
Item ItemCartModule;
try {
ItemCartModule = (Item) StevesCartsModule.ItemCartModule.get(null);
} catch (Exception e) {
currenttip = WailaExceptionHandler.handleErr(e, accessor.getEntity().getClass().getName(), currenttip);
return currenttip;
}
NBTTagCompound tag = accessor.getNBTData();
if (tag.hasKey("Modules")) {
byte[] metas = tag.getByteArray("Modules");
for (int i = 0; i < metas.length; i++) {
if (tag.hasKey("module" + i + "Fuel")) {
int fuel = accessor.getNBTInteger(tag, "module" + i + "Fuel");
currenttip.add(
new ItemStack(ItemCartModule, 1, metas[i])
.getDisplayName() + TAB + ALIGNRIGHT + " [ " + WHITE + fuel + GRAY + " POW ]");
} else if (tag.hasKey("module" + i + "Fluid")) {
NBTTagCompound subtag = tag.getCompoundTag("module" + i + "Fluid");
if (subtag.hasKey("Amount")) {
int amount = accessor.getNBTInteger(subtag, "Amount");
String fluid = subtag.getString("FluidName");
currenttip.add(
new ItemStack(ItemCartModule, 1, metas[i]).getDisplayName() + TAB
+ ALIGNRIGHT
+ GRAY
+ " [ "
+ WHITE
+ formatNumber(amount)
+ " of "
+ fluid
+ GRAY
+ " ]");
} else {
currenttip.add(
new ItemStack(ItemCartModule, 1, metas[i])
.getDisplayName() + TAB + ALIGNRIGHT + " < " + WHITE + "Empty" + GRAY + " > ");
}
} else {
currenttip.add(new ItemStack(ItemCartModule, 1, metas[i]).getDisplayName());
}
}
}
return currenttip;
}
@Override
public List<String> getWailaTail(Entity entity, List<String> currenttip, IWailaEntityAccessor accessor,
IWailaConfigHandler config) {
return currenttip;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, Entity te, NBTTagCompound tag, World world) {
if (te != null) te.writeToNBT(tag);
return tag;
}
}
@@ -5,72 +5,13 @@ import java.lang.reflect.Method;
public class StevesCartsModule {
public static Class TileEntityCartAssembler = null;
public static Class TileEntityCargo = null;
public static Class TileEntityLiquid = null;
public static Class MinecartModular = null;
public static Class StevesItems = null;
public static Class CargoItemSelection = null;
public static Class<?> CargoItemSelection = null;
public static Field ItemCartModule = null; // Items.modules
public static Field ItemSelections = null; // TileEntityCargo.itemSelections
public static Method GetSelectionName = null; // CargoItemSelection.getName
public static void register() {}
public static Field ItemCartComponent = null; //Items.component
public static Field ItemCartModule = null; //Items.modules
public static Field ItemSelections = null; //TileEntityCargo.itemSelections
public static Method GetSelectionName = null; // CargoItemSelection.getName
public static void register(){
/*
try{
Class ModStevesCarts = Class.forName("vswe.stevescarts.StevesCarts");
Waila.log.log(Level.INFO, "StevesCarts mod found.");
} catch (ClassNotFoundException e){
Waila.log.log(Level.INFO, "[StevesCarts] StevesCarts mod not found.");
return;
}
try{
TileEntityCartAssembler = Class.forName("vswe.stevescarts.TileEntities.TileEntityCartAssembler");
TileEntityCargo = Class.forName("vswe.stevescarts.TileEntities.TileEntityCargo");
TileEntityLiquid = Class.forName("vswe.stevescarts.TileEntities.TileEntityLiquid");
MinecartModular = Class.forName("vswe.stevescarts.Carts.MinecartModular");
StevesItems = Class.forName("vswe.stevescarts.Items.Items");
CargoItemSelection = Class.forName("vswe.stevescarts.Helpers.CargoItemSelection");
ItemCartComponent = StevesItems.getDeclaredField("component");
ItemCartModule = StevesItems.getDeclaredField("modules");
ItemSelections = TileEntityCargo.getDeclaredField("itemSelections");
GetSelectionName = CargoItemSelection.getDeclaredMethod("getName");
} catch (ClassNotFoundException e){
Waila.log.log(Level.WARNING, "[StevesCarts] Class not found. " + e);
return;
} catch (NoSuchFieldException e) {
Waila.log.log(Level.WARNING, "[StevesCarts] Field not found. " + e);
return;
} catch (NoSuchMethodException e) {
Waila.log.log(Level.WARNING, "[StevesCarts] Method not found. " + e);
return;
} catch (Exception e) {
Waila.log.log(Level.WARNING, "[StevesCarts] Error while loading module. " + e);
return;
}
ModuleRegistrar.instance().addConfigRemote("Steve's carts", "stevescarts.showall");
ModuleRegistrar.instance().addConfigRemote("Steve's carts", "stevescarts.colorblind");
ModuleRegistrar.instance().addConfigRemote("Steve's carts", "stevescarts.shifttoggle");
ModuleRegistrar.instance().registerBodyProvider(new HUDCartAssembler(), TileEntityCartAssembler);
ModuleRegistrar.instance().registerBodyProvider(new HUDCargoManager(), TileEntityCargo);
ModuleRegistrar.instance().registerBodyProvider(new HUDLiquidManager(), TileEntityLiquid);
ModuleRegistrar.instance().registerHeadProvider(new HUDMinecartModular(), MinecartModular);
ModuleRegistrar.instance().registerBodyProvider(new HUDMinecartModular(), MinecartModular);
ModuleRegistrar.instance().registerSyncedNBTKey("*", TileEntityCartAssembler);
ModuleRegistrar.instance().registerSyncedNBTKey("*", MinecartModular);
ModuleRegistrar.instance().registerSyncedNBTKey("*", TileEntityCargo);
ModuleRegistrar.instance().registerSyncedNBTKey("*", TileEntityLiquid);
*/
}
}
@@ -1,9 +1,14 @@
package mcp.mobius.waila.addons.thaumcraft;
import static mcp.mobius.waila.api.SpecialChars.ALIGNRIGHT;
import static mcp.mobius.waila.api.SpecialChars.AQUA;
import static mcp.mobius.waila.api.SpecialChars.TAB;
import static mcp.mobius.waila.api.SpecialChars.WHITE;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
@@ -11,106 +16,127 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import static mcp.mobius.waila.api.SpecialChars.*;
import mcp.mobius.waila.api.SpecialChars;
import mcp.mobius.waila.cbcore.LangUtil;
public class HUDHandlerIAspectContainer implements IWailaDataProvider{
public class HUDHandlerIAspectContainer implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@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> 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.aspects")) return currenttip;
NBTTagCompound tag = accessor.getNBTData();
if (tag.hasKey("Aspects")){
NBTTagList taglist = tag.getTagList("Aspects", 10);
List<String> unknownAspects = new ArrayList<String>();
for (int i = 0; i < taglist.tagCount(); i++){
NBTTagCompound subtag = taglist.getCompoundTagAt(i);
String aspect = Character.toUpperCase(subtag.getString("key").charAt(0)) + subtag.getString("key").substring(1);
String amount = String.valueOf(subtag.getInteger("value"));
if (!aspect.equals("???"))
currenttip.add(String.format("%s" + TAB + ALIGNRIGHT + WHITE + "%s", aspect, amount));
else
unknownAspects.add(String.format("%s" + TAB + ALIGNRIGHT + WHITE + "%s", aspect, amount));
}
currenttip.addAll(unknownAspects);
}
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
if (!config.getConfig("thaumcraft.aspects")) return currenttip;
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
try{
tag.setTag("Aspects", new NBTTagList());
NBTTagList aspects = tag.getTagList("Aspects", 10);
ItemStack headSlot = player.inventory.armorInventory[3];
if (headSlot == null) return tag;
boolean hasReveal = ThaumcraftModule.IGoggles.isInstance(headSlot.getItem());
if (!hasReveal) return tag;
HashMap knownAspects = (HashMap) ThaumcraftModule.CommonProxy_getKnownAspects.invoke(ThaumcraftModule.Thaumcraft_proxy.get(null));
LinkedHashMap playerAspects = (LinkedHashMap) ThaumcraftModule.AspectList_aspects.get(knownAspects.get(player.getCommandSenderName()));
LinkedHashMap tileAspects = new LinkedHashMap();
if (ThaumcraftModule.IAspectContainer.isInstance(te)){
tileAspects = (LinkedHashMap) ThaumcraftModule.AspectList_aspects.get(ThaumcraftModule.IAspectContainer_getAspects.invoke(te));
} else if (ThaumcraftModule.TileAlchemyFurnace.isInstance(te)){
tileAspects = (LinkedHashMap) ThaumcraftModule.AspectList_aspects.get(ThaumcraftModule.TileAlchemyFurnace_aspects.get(te));
}
for (Object o : tileAspects.keySet()){
if ((Integer) tileAspects.get(o) > 0){
if (playerAspects.containsKey(o)){
NBTTagCompound cmptag = new NBTTagCompound();
cmptag.setString ("key", (String)ThaumcraftModule.Aspect_tag.get(o));
cmptag.setInteger("value", (Integer) tileAspects.get(o));
aspects.appendTag(cmptag);
} else {
NBTTagCompound cmptag = new NBTTagCompound();
cmptag.setString ("key", "???");
cmptag.setInteger("value", (Integer) tileAspects.get(o));
aspects.appendTag(cmptag);
}
}
}
//for (int i = 0; i < aspects.tagCount(); i++){
// System.out.printf("%s : %s\n", aspects.getCompoundTagAt(i).getString("key"), aspects.getCompoundTagAt(i).getString("value"));
//}
} catch (Exception e) {
throw new RuntimeException(e);
}
return tag;
}
NBTTagCompound tag = accessor.getNBTData();
if (tag.hasKey("Aspects")) {
NBTTagList taglist = tag.getTagList("Aspects", 10);
List<String> unknownAspects = new ArrayList<>();
int total = 0;
for (int i = 0; i < taglist.tagCount(); i++) {
NBTTagCompound subtag = taglist.getCompoundTagAt(i);
String aspect = subtag.getString("key");
int value = subtag.getInteger("value");
total += value;
String amount = String.valueOf(value);
if (!aspect.equals("???")) currenttip.add(
SpecialChars.getRenderString("waila.tcaspect", aspect) + TAB + ALIGNRIGHT + WHITE + amount);
else unknownAspects.add(
SpecialChars.getRenderString("waila.tcaspect", aspect) + TAB + ALIGNRIGHT + WHITE + amount);
}
String id = tag.getString("WailaID");
if ((id.equals("TileNode") || id.equals("TileExtendedNode") || id.equals("TileJarNode"))
&& (taglist.tagCount() > 10 || total > 300)) {
currenttip.add(
0,
String.format(
AQUA + "%s" + TAB + ALIGNRIGHT + WHITE + "%s",
LangUtil.translateG("hud.msg.tcnodetotalsize"),
total));
}
currenttip.addAll(unknownAspects);
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
return currenttip;
}
@SuppressWarnings("unchecked")
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
int y, int z) {
try {
tag.setTag("Aspects", new NBTTagList());
NBTTagList aspects = tag.getTagList("Aspects", 10);
ItemStack headSlot = player.inventory.armorInventory[3];
if (headSlot == null) return tag;
boolean hasReveal = ThaumcraftModule.isGoggles.apply(headSlot);
if (!hasReveal) return tag;
Map<String, ?> knownAspects = (Map<String, ?>) ThaumcraftModule.CommonProxy_getKnownAspects
.invoke(ThaumcraftModule.Thaumcraft_proxy.get(null));
Map<?, Integer> playerAspects = (Map<?, Integer>) ThaumcraftModule.AspectList_aspects
.get(knownAspects.get(player.getCommandSenderName()));
Map<?, Integer> tileAspects = new LinkedHashMap<>();
if (ThaumcraftModule.IAspectContainer.isInstance(te)) {
tileAspects = (Map<?, Integer>) ThaumcraftModule.AspectList_aspects
.get(ThaumcraftModule.IAspectContainer_getAspects.invoke(te));
} else if (ThaumcraftModule.TileAlchemyFurnace.isInstance(te)) {
tileAspects = (Map<?, Integer>) ThaumcraftModule.AspectList_aspects
.get(ThaumcraftModule.TileAlchemyFurnace_aspects.get(te));
}
for (Object o : tileAspects.keySet()) {
if (tileAspects.get(o) > 0) {
if (playerAspects.containsKey(o)) {
NBTTagCompound cmptag = new NBTTagCompound();
cmptag.setString("key", (String) ThaumcraftModule.Aspect_tag.get(o));
cmptag.setInteger("value", tileAspects.get(o));
aspects.appendTag(cmptag);
} else {
NBTTagCompound cmptag = new NBTTagCompound();
cmptag.setString("key", "???");
cmptag.setInteger("value", tileAspects.get(o));
aspects.appendTag(cmptag);
}
}
}
} catch (ReflectiveOperationException e) {
throw new RuntimeException(e);
}
return tag;
}
}
@@ -1,9 +1,13 @@
package mcp.mobius.waila.addons.thaumcraft;
import java.awt.Color;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.function.Function;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import org.apache.logging.log4j.Level;
@@ -11,71 +15,82 @@ import mcp.mobius.waila.Waila;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
public class ThaumcraftModule {
public static Class Thaumcraft = null;
public static Field Thaumcraft_proxy = null;
public static Class IAspectContainer = null;
public static Method IAspectContainer_getAspects = null;
public static Class AspectList = null;
public static Method AspectList_writeToNBT = null;
public static Field AspectList_aspects = null;
public static Class TileAlchemyFurnace = null;
public static Field TileAlchemyFurnace_aspects = null;
public static Class Aspect = null;
public static Field Aspect_tag = null;
public static Class CommonProxy = null;
public static Method CommonProxy_getKnownAspects = null;
public static Class<?> Thaumcraft = null;
public static Field Thaumcraft_proxy = null;
public static Class IGoggles = null;
public static Class<?> IAspectContainer = null;
public static Method IAspectContainer_getAspects = null;
//public static Class TileAlchemyFurnace = null;
public static void register(){
try{
Thaumcraft = Class.forName("thaumcraft.common.Thaumcraft");
Thaumcraft_proxy = Thaumcraft.getDeclaredField("proxy");
IAspectContainer = Class.forName("thaumcraft.api.aspects.IAspectContainer");
IAspectContainer_getAspects = IAspectContainer.getDeclaredMethod("getAspects");
AspectList = Class.forName("thaumcraft.api.aspects.AspectList");
AspectList_writeToNBT = AspectList.getDeclaredMethod("writeToNBT", NBTTagCompound.class);
AspectList_aspects = AspectList.getDeclaredField("aspects");
public static Class<?> AspectList = null;
public static Method AspectList_writeToNBT = null;
public static Field AspectList_aspects = null;
TileAlchemyFurnace = Class.forName("thaumcraft.common.tiles.TileAlchemyFurnace");
TileAlchemyFurnace_aspects = TileAlchemyFurnace.getDeclaredField("aspects");
Aspect = Class.forName("thaumcraft.api.aspects.Aspect");
Aspect_tag = Aspect.getDeclaredField("tag");
Aspect_tag.setAccessible(true);
CommonProxy = Class.forName("thaumcraft.common.CommonProxy");
CommonProxy_getKnownAspects = CommonProxy.getDeclaredMethod("getKnownAspects");
public static Class<?> TileAlchemyFurnace = null;
public static Field TileAlchemyFurnace_aspects = null;
IGoggles = Class.forName("thaumcraft.api.IGoggles");
public static Class<?> Aspect = null;
public static Field Aspect_tag = null;
public static Method Aspect_getName = null;
public static Method Aspect_getAspect = null;
public static Method Aspect_getImage = null;
public static Method Aspect_getColor = null;
ModuleRegistrar.instance().addConfigRemote("Thaumcraft", "thaumcraft.aspects");
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerIAspectContainer(), IAspectContainer);
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerIAspectContainer(), TileAlchemyFurnace);
ModuleRegistrar.instance().registerNBTProvider (new HUDHandlerIAspectContainer(), IAspectContainer);
ModuleRegistrar.instance().registerNBTProvider (new HUDHandlerIAspectContainer(), TileAlchemyFurnace);
} catch (ClassNotFoundException e){
Waila.log.log(Level.WARN, "[Thaumcraft] Class not found. " + e);
return;
} catch (Exception e){
Waila.log.log(Level.WARN, "[Thaumcraft] Unhandled exception." + e);
return;
}
}
public static Class<?> CommonProxy = null;
public static Method CommonProxy_getKnownAspects = null;
public static Class<?> IGoggles = null;
public static ResourceLocation unknownAspectTexture = null;
public static Color unknownAspectColor = null;
public static Function<ItemStack, Boolean> isGoggles = stack -> IGoggles.isInstance(stack.getItem());
public static void register() {
try {
Thaumcraft = Class.forName("thaumcraft.common.Thaumcraft");
Thaumcraft_proxy = Thaumcraft.getDeclaredField("proxy");
IAspectContainer = Class.forName("thaumcraft.api.aspects.IAspectContainer");
IAspectContainer_getAspects = IAspectContainer.getDeclaredMethod("getAspects");
AspectList = Class.forName("thaumcraft.api.aspects.AspectList");
AspectList_writeToNBT = AspectList.getDeclaredMethod("writeToNBT", NBTTagCompound.class);
AspectList_aspects = AspectList.getDeclaredField("aspects");
TileAlchemyFurnace = Class.forName("thaumcraft.common.tiles.TileAlchemyFurnace");
TileAlchemyFurnace_aspects = TileAlchemyFurnace.getDeclaredField("aspects");
Aspect = Class.forName("thaumcraft.api.aspects.Aspect");
Aspect_tag = Aspect.getDeclaredField("tag");
Aspect_tag.setAccessible(true);
Aspect_getName = Aspect.getDeclaredMethod("getName");
Aspect_getAspect = Aspect.getMethod("getAspect", java.lang.String.class);
Aspect_getImage = Aspect.getDeclaredMethod("getImage");
Aspect_getColor = Aspect.getDeclaredMethod("getColor");
CommonProxy = Class.forName("thaumcraft.common.CommonProxy");
CommonProxy_getKnownAspects = CommonProxy.getDeclaredMethod("getKnownAspects");
IGoggles = Class.forName("thaumcraft.api.IGoggles");
unknownAspectTexture = new ResourceLocation("thaumcraft", "textures/aspects/_unknown.png");
unknownAspectColor = new Color(0x654242);
ModuleRegistrar.instance().addConfigRemote("Thaumcraft", "thaumcraft.aspects");
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerIAspectContainer(), IAspectContainer);
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerIAspectContainer(), TileAlchemyFurnace);
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerIAspectContainer(), IAspectContainer);
ModuleRegistrar.instance().registerNBTProvider(new HUDHandlerIAspectContainer(), TileAlchemyFurnace);
} catch (ClassNotFoundException e) {
Waila.log.log(Level.INFO, "[Thaumcraft] Thaumcraft mod not found.");
return;
} catch (Exception e) {
Waila.log.log(Level.WARN, "[Thaumcraft] Unhandled exception. {}", e);
return;
}
Waila.log.log(Level.INFO, "Thaumcraft mod found.");
}
}
@@ -0,0 +1,41 @@
package mcp.mobius.waila.addons.thaumcraftGadomancy;
import java.lang.reflect.Field;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import org.apache.logging.log4j.Level;
import mcp.mobius.waila.Waila;
import mcp.mobius.waila.addons.thaumcraft.ThaumcraftModule;
public class GadomancyModule {
public static Class<?> RegisteredEnchantments = null;
public static Field RegisteredEnchantments_revealer = null;
public static int revealerEffectId;
public static void register() {
try {
RegisteredEnchantments = Class.forName("makeo.gadomancy.common.registration.RegisteredEnchantments");
RegisteredEnchantments_revealer = RegisteredEnchantments.getDeclaredField("revealer");
Object revealer = RegisteredEnchantments_revealer.get(null);
revealerEffectId = ((Enchantment) revealer).effectId;
ThaumcraftModule.isGoggles = stack -> ThaumcraftModule.IGoggles.isInstance(stack.getItem())
|| EnchantmentHelper.getEnchantmentLevel(revealerEffectId, stack) > 0;
} catch (ClassNotFoundException e) {
Waila.log.log(Level.INFO, "[Thaumcraft Gadomancy] Gadomancy mod not found.");
return;
} catch (Exception e) {
Waila.log.log(Level.WARN, "[Thaumcraft Gadomancy] Unhandled exception. {}", e);
return;
}
Waila.log.log(Level.INFO, "Gadomancy mod found.");
}
}
@@ -0,0 +1,108 @@
package mcp.mobius.waila.addons.thermaldynamics;
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatFluid;
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
import java.util.List;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.cbcore.LangUtil;
/**
* Created by Lordmau5 on 28.02.2015.
*/
public class FluiductFluidHandler 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("thermaldynamics.fluiductsFluid")) {
return currenttip;
}
NBTTagCompound tag = accessor.getNBTData();
FluidStack fluid = FluidStack.loadFluidStackFromNBT(tag.getCompoundTag("fluid"));
int capacity = tag.getInteger("capacity");
if (capacity == 0) {
return currenttip;
}
String name = currenttip.get(0);
String fluidName = fluid == null ? LangUtil.translateG("hud.msg.empty")
: fluid.getFluid().getLocalizedName(fluid);
currenttip.set(0, name + " < " + fluidName + " >");
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
if (!config.getConfig("thermaldynamics.fluiductsAmount")) {
return currenttip;
}
NBTTagCompound tag = accessor.getNBTData();
FluidStack fluid = FluidStack.loadFluidStackFromNBT(tag.getCompoundTag("fluid"));
int amount = fluid == null ? 0 : fluid.amount;
int capacity = tag.getInteger("capacity");
if (capacity == 0) {
return currenttip;
}
currenttip.add(String.format("%s / %s", formatNumber(amount), formatFluid(capacity)));
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
return currenttip;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
int y, int z) {
if (te instanceof IFluidHandler fluidHandler) {
FluidTankInfo[] infos = fluidHandler.getTankInfo(ForgeDirection.UNKNOWN);
if (infos.length != 1) {
return tag;
}
FluidTankInfo info = infos[0];
if (info.fluid != null) {
NBTTagCompound fluidNBT = info.fluid.writeToNBT(new NBTTagCompound());
tag.setTag("fluid", fluidNBT);
}
tag.setInteger("capacity", info.capacity);
}
return tag;
}
}
@@ -1,71 +0,0 @@
package mcp.mobius.waila.addons.thermaldynamics;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.cbcore.LangUtil;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
import java.util.List;
/**
* Created by Lordmau5 on 28.02.2015.
*/
public class HUDHandlerDuct 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("thermaldynamics.fluiductsFluid")) return currenttip;
FluidStack fluid = FluidStack.loadFluidStackFromNBT(accessor.getNBTData());
String name = "";
try{
name += String.format(" < %s >", fluid.getFluid().getLocalizedName(fluid));
} catch (NullPointerException f){
name += " " + LangUtil.translateG("hud.msg.empty");
}
currenttip.add(name);
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("thermaldynamics.fluiductsAmount")) return currenttip;
int amount = 0;
NBTTagCompound tag = accessor.getNBTData();
if (tag.hasKey("Amount"))
amount = accessor.getNBTInteger(tag, "Amount");
currenttip.add(String.format(" %d / 1000 mB", amount));
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
if (te != null)
te.writeToNBT(tag);
return tag;
}
}
@@ -1,44 +1,38 @@
package mcp.mobius.waila.addons.thermaldynamics;
import mcp.mobius.waila.Waila;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
import org.apache.logging.log4j.Level;
public class ThermalDynamicsModule {
public static Class TileFluidDuct = null;
public static void register(){
// XXX : We register the Fluiduct
try{
TileFluidDuct = Class.forName("cofh.thermaldynamics.ducts.fluid.TileFluidDuct");
ModuleRegistrar.instance().addConfigRemote("Thermal Dynamics", "thermaldynamics.fluidDuctsFluid");
ModuleRegistrar.instance().addConfigRemote("Thermal Dynamics", "thermaldynamics.fluidDuctsAmount");
ModuleRegistrar.instance().registerHeadProvider(new HUDHandlerDuct(), TileFluidDuct);
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerDuct(), TileFluidDuct);
ModuleRegistrar.instance().registerNBTProvider (new HUDHandlerDuct(), TileFluidDuct);
} catch (Exception e){
Waila.log.log(Level.WARN, "[Thermal Dynamics] Error while loading FluidDuct hooks." + e);
}
// XXX : We register the IBlockInfo interface
/*
try{
IBlockInfo = Class.forName("cofh.api.block.IBlockInfo");
IBlockInfo_getBlockInfo = IBlockInfo.getMethod("getBlockInfo", IBlockAccess.class, int.class, int.class, int.class, ForgeDirection.class, EntityPlayer.class, List.class, boolean.class);
//ModuleRegistrar.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.energyhandler");
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerIBlockInfo(), IBlockInfo);
ModuleRegistrar.instance().registerNBTProvider (new HUDHandlerIBlockInfo(), IBlockInfo);
} catch (Exception e){
Waila.log.log(Level.WARN, "[Thermal Expansion] Error while loading IBlockInfo hooks." + e);
}
*/
}
}
package mcp.mobius.waila.addons.thermaldynamics;
import org.apache.logging.log4j.Level;
import mcp.mobius.waila.Waila;
import mcp.mobius.waila.api.impl.ModuleRegistrar;
import mcp.mobius.waila.utils.LoadedMods;
public class ThermalDynamicsModule {
public static Class<?> TileFluidDuct = null;
public static void register() {
if (LoadedMods.WAILA_PLUGINS) {
return;
}
try {
TileFluidDuct = Class.forName("cofh.thermaldynamics.duct.fluid.TileFluidDuct");
Waila.log.log(Level.INFO, "Thermal Dynamics mod found.");
} catch (ClassNotFoundException e) {
Waila.log.log(Level.INFO, "[Thermal Dynamics] Thermal Dynamics mod not found.");
return;
} catch (Exception e) {
Waila.log.log(Level.WARN, "[Thermal Dynamics] Error while loading FluidDuct hooks. {}", e);
return;
}
ModuleRegistrar.instance().addConfigRemote("Thermal Dynamics", "thermaldynamics.fluidDuctsFluid");
ModuleRegistrar.instance().addConfigRemote("Thermal Dynamics", "thermaldynamics.fluidDuctsAmount");
FluiductFluidHandler fluiductFluidHandler = new FluiductFluidHandler();
ModuleRegistrar.instance().registerHeadProvider(fluiductFluidHandler, TileFluidDuct);
ModuleRegistrar.instance().registerBodyProvider(fluiductFluidHandler, TileFluidDuct);
ModuleRegistrar.instance().registerNBTProvider(fluiductFluidHandler, TileFluidDuct);
}
}
@@ -1,11 +1,8 @@
package mcp.mobius.waila.addons.thermalexpansion;
import cpw.mods.fml.common.registry.GameData;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.SpecialChars;
import mcp.mobius.waila.cbcore.LangUtil;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -13,34 +10,47 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import cpw.mods.fml.common.registry.GameData;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.SpecialChars;
import mcp.mobius.waila.cbcore.LangUtil;
public class HUDHandlerCache implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) { return null; }
@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.cache"))
return currenttip;
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
if (!config.getConfig("thermalexpansion.cache")) return currenttip;
try {
ItemStack storedItem = null;
if(accessor.getNBTData().hasKey("Item"))
if (accessor.getNBTData().hasKey("Item"))
storedItem = readItemStack(accessor.getNBTData().getCompoundTag("Item"));
String name = currenttip.get(0);
String color = "";
if(name.startsWith("\u00a7"))
color = name.substring(0, 2);
if (name.startsWith("\u00a7")) color = name.substring(0, 2);
if(storedItem != null) {
if (storedItem != null) {
String namex = GameData.getItemRegistry().getNameForObject(storedItem.getItem());
name += String.format(" < " + SpecialChars.getRenderString("waila.stack", "1", namex, "0", String.valueOf(storedItem.getItemDamage())) + color + " %s >", storedItem.getDisplayName());
name += String.format(
" < %s %s >",
SpecialChars.getRenderString(
"waila.stack",
"1",
namex,
"0",
String.valueOf(storedItem.getItemDamage())) + color,
storedItem.getDisplayName());
} else {
name += " < " + LangUtil.translateG("hud.msg.empty") + " >";
}
else
name += " " + LangUtil.translateG("hud.msg.empty");
currenttip.set(0, name);
} catch (Exception e) {
@@ -48,54 +58,47 @@ public class HUDHandlerCache implements IWailaDataProvider {
}
return currenttip;
}
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
if (!config.getConfig("thermalexpansion.cache"))
return currenttip;
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
if (!config.getConfig("thermalexpansion.cache")) return currenttip;
NBTTagCompound tag = accessor.getNBTData();
ItemStack storedItem = null;
if(tag.hasKey("Item"))
storedItem = readItemStack(tag.getCompoundTag("Item"));
if (tag.hasKey("Item")) storedItem = readItemStack(tag.getCompoundTag("Item"));
int stored = 0;
int maxStored = 0;
if(tag.hasKey("Stored"))
stored = tag.getInteger("Stored");
if(tag.hasKey("MaxStored"))
maxStored = tag.getInteger("MaxStored");
if (tag.hasKey("Stored")) stored = tag.getInteger("Stored");
if (tag.hasKey("MaxStored")) maxStored = tag.getInteger("MaxStored");
if(storedItem != null) {
if (storedItem != null) {
currenttip.add("Stored: " + stored + "/" + maxStored);
}
else
currenttip.add("Capacity: " + maxStored);
} else currenttip.add("Capacity: " + maxStored);
return currenttip;
}
return currenttip;
}
@Override
public List<String> getWailaTail(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;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
if(te != null)
te.writeToNBT(tag);
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
int y, int z) {
if (te != null) te.writeToNBT(tag);
try {
tag.setInteger("MaxStored", (Integer) ThermalExpansionModule.TileCache_getMaxStored.invoke(te));
tag.setInteger("Stored", (Integer) ThermalExpansionModule.TileCache_getStored.invoke(te));
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
} catch (InvocationTargetException | IllegalAccessException e) {
e.printStackTrace();
}
return tag;
}
}
public ItemStack readItemStack(NBTTagCompound tag) {
ItemStack is = new ItemStack(Item.getItemById(tag.getShort("id")));
@@ -107,5 +110,5 @@ public class HUDHandlerCache implements IWailaDataProvider {
return is;
}
}
@@ -1,57 +1,70 @@
package mcp.mobius.waila.addons.thermalexpansion;
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
import java.util.List;
import mcp.mobius.waila.cbcore.LangUtil;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.cbcore.LangUtil;
public class HUDHandlerEnergyCell implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@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> 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> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
if (!config.getConfig("thermalexpansion.energycell")) return currenttip;
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
int energyReceive = accessor.getNBTInteger(accessor.getNBTData(), "Recv");
int energySend = accessor.getNBTInteger(accessor.getNBTData(), "Send");
currenttip.add(
String.format(
"%s/%s : %s / %s RF/t",
LangUtil.translateG("hud.msg.in"),
LangUtil.translateG("hud.msg.out"),
formatNumber(energyReceive),
formatNumber(energySend)));
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
return currenttip;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
int y, int z) {
try {
int recv = ThermalExpansionModule.TileEnergyCell_Recv.getInt(te);
int send = ThermalExpansionModule.TileEnergyCell_Send.getInt(te);
tag.setInteger("Recv", recv);
tag.setInteger("Send", send);
} catch (Exception e) {
throw new RuntimeException(e);
}
return tag;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
try {
int recv = ThermalExpansionModule.TileEnergyCell_Recv.getInt(te);
int send = ThermalExpansionModule.TileEnergyCell_Send.getInt(te);
tag.setInteger("Recv", recv);
tag.setInteger("Send", send);
} catch (Exception e) {
throw new RuntimeException(e);
}
return tag;
}
}
@@ -8,51 +8,56 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IChatComponent;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
public class HUDHandlerIBlockInfo implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@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> 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> 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;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
return currenttip;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
try{
List info = new ArrayList();
Block block = world.getBlock(x, y, z);
ThermalExpansionModule.IBlockInfo_getBlockInfo.invoke(block, world, x, y, z, ForgeDirection.UNKNOWN, player, info, false);
for (Object i : info){
System.out.printf("%s\n", i);
}
} catch (Exception e){
throw new RuntimeException(e);
}
return tag;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
int y, int z) {
try {
List<Object> info = new ArrayList<>();
Block block = world.getBlock(x, y, z);
ThermalExpansionModule.IBlockInfo_getBlockInfo
.invoke(block, world, x, y, z, ForgeDirection.UNKNOWN, player, info, false);
for (Object i : info) {
System.out.printf("%s\n", i);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
return tag;
}
}
@@ -1,5 +1,7 @@
package mcp.mobius.waila.addons.thermalexpansion;
import static com.gtnewhorizon.gtnhlib.util.numberformatting.NumberFormatUtil.formatNumber;
import java.util.List;
import net.minecraft.entity.player.EntityPlayerMP;
@@ -8,72 +10,89 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import mcp.mobius.waila.api.ITaggedList;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.utils.WailaExceptionHandler;
import mcp.mobius.waila.api.ITaggedList;
import mcp.mobius.waila.api.SpecialChars;
public class HUDHandlerIEnergyHandler implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@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> 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");
int maxEnergy = accessor.getNBTInteger(accessor.getNBTData(), "MaxStorage");
try {
if ((maxEnergy != 0) && (((ITaggedList)currenttip).getEntries("RFEnergyStorage").size() == 0)){
((ITaggedList)currenttip).add(String.format("%d / %d RF", energy, maxEnergy), "RFEnergyStorage");
}
} 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) {
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
if (!config.getConfig("thermalexpansion.energyhandler")) return currenttip;
if (!accessor.getNBTData().hasKey("Energy")) return currenttip;
if (!accessor.getNBTData().hasKey("MaxStorage")) return currenttip;
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
try{
Integer energy = -1;
Integer maxsto = -1;
if (ThermalExpansionModule.IEnergyInfo.isInstance(te)){
energy = (Integer) ThermalExpansionModule.IEnergyInfo_getCurStorage.invoke(te);
maxsto = (Integer) ThermalExpansionModule.IEnergyInfo_getMaxStorage.invoke(te);
} else if (ThermalExpansionModule.IEnergyProvider.isInstance(te)){
energy = (Integer) ThermalExpansionModule.IEnergyProvider_getCurStorage.invoke(te, ForgeDirection.UNKNOWN);
maxsto = (Integer) ThermalExpansionModule.IEnergyProvider_getMaxStorage.invoke(te, ForgeDirection.UNKNOWN);
} else if (ThermalExpansionModule.IEnergyReceiver.isInstance(te)){
energy = (Integer) ThermalExpansionModule.IEnergyReceiver_getCurStorage.invoke(te, ForgeDirection.UNKNOWN);
maxsto = (Integer) ThermalExpansionModule.IEnergyReceiver_getMaxStorage.invoke(te, ForgeDirection.UNKNOWN);
}
if (currenttip instanceof ITaggedList taggedTips) {
int energy = accessor.getNBTInteger(accessor.getNBTData(), "Energy");
int maxEnergy = accessor.getNBTInteger(accessor.getNBTData(), "MaxStorage");
if (maxEnergy > 0 && taggedTips.getEntries("RFEnergyStorage").isEmpty()) {
if (config.getConfig("thermalexpansion.rfenergybar")) {
taggedTips.add(
SpecialChars.getRenderString("waila.rfenergy", energy + "", maxEnergy + ""),
"RFEnergyStorage");
} else {
taggedTips.add(
String.format("%s / %s RF", formatNumber(energy), formatNumber(maxEnergy)),
"RFEnergyStorage");
}
}
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
return currenttip;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
int y, int z) {
try {
Integer energy = -1;
Integer maxsto = -1;
if (ThermalExpansionModule.IEnergyInfo.isInstance(te)) {
energy = (Integer) ThermalExpansionModule.IEnergyInfo_getCurStorage.invoke(te);
maxsto = (Integer) ThermalExpansionModule.IEnergyInfo_getMaxStorage.invoke(te);
} else if (ThermalExpansionModule.IEnergyProvider.isInstance(te)) {
energy = (Integer) ThermalExpansionModule.IEnergyProvider_getCurStorage
.invoke(te, ForgeDirection.UNKNOWN);
maxsto = (Integer) ThermalExpansionModule.IEnergyProvider_getMaxStorage
.invoke(te, ForgeDirection.UNKNOWN);
} else if (ThermalExpansionModule.IEnergyReceiver.isInstance(te)) {
energy = (Integer) ThermalExpansionModule.IEnergyReceiver_getCurStorage
.invoke(te, ForgeDirection.UNKNOWN);
maxsto = (Integer) ThermalExpansionModule.IEnergyReceiver_getMaxStorage
.invoke(te, ForgeDirection.UNKNOWN);
}
tag.setInteger("Energy", energy);
tag.setInteger("MaxStorage", maxsto);
} catch (Exception e) {
throw new RuntimeException(e);
}
return tag;
}
tag.setInteger("Energy", energy);
tag.setInteger("MaxStorage", maxsto);
} catch (Exception e){
throw new RuntimeException(e);
}
return tag;
}
}
@@ -2,78 +2,76 @@ package mcp.mobius.waila.addons.thermalexpansion;
import java.util.List;
import mcp.mobius.waila.cbcore.LangUtil;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.cbcore.LangUtil;
public class HUDHandlerISecureTile implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@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> 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");
if (owner.equals("[None]"))
return currenttip;
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> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
if (config.getConfig("thermalexpansion.owner")) {
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
try {
String owner = (String) ThermalExpansionModule.ISecureTile_getOwnerName.invoke(te);
int access = ((Enum) ThermalExpansionModule.ISecureTile_getAccess.invoke(te)).ordinal();
tag.setString("Owner", owner);
tag.setInteger("Access", access);
} catch (Exception e) {
throw new RuntimeException(e);
}
return tag;
}
String owner = accessor.getNBTData().getString("Owner");
int iaccess = accessor.getNBTInteger(accessor.getNBTData(), "Access");
if (owner.equals("[None]")) return currenttip;
String access = switch (iaccess) {
case 0 -> LangUtil.translateG("hud.msg.public");
case 1 -> LangUtil.translateG("hud.msg.restricted");
case 2 -> LangUtil.translateG("hud.msg.private");
default -> "INVALID";
};
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;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
int y, int z) {
try {
String owner = (String) ThermalExpansionModule.ISecureTile_getOwnerName.invoke(te);
int access = ((Enum<?>) ThermalExpansionModule.ISecureTile_getAccess.invoke(te)).ordinal();
tag.setString("Owner", owner);
tag.setInteger("Access", access);
} catch (Exception e) {
throw new RuntimeException(e);
}
return tag;
}
}
@@ -1,96 +0,0 @@
package mcp.mobius.waila.addons.thermalexpansion;
import java.util.List;
import mcp.mobius.waila.cbcore.LangUtil;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.utils.WailaExceptionHandler;
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(fluid));
} 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;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
try {
int amount = (Integer) ThermalExpansionModule.TileTank_getTankAmount.invoke(te);
tag.setInteger("Amount", amount);
} catch (Exception e) {
throw new RuntimeException(e);
}
return tag;
}
}
@@ -2,109 +2,115 @@ package mcp.mobius.waila.addons.thermalexpansion;
import java.util.List;
import mcp.mobius.waila.cbcore.LangUtil;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.SpecialChars;
import mcp.mobius.waila.cbcore.LangUtil;
public class HUDHandlerTesseract implements IWailaDataProvider {
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
return null;
}
@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> 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> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
return currenttip;
}
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("%s ", SpecialChars.GREEN + LangUtil.translateG("hud.msg.item"));
String fluid = String.format("%s ", SpecialChars.BLUE + LangUtil.translateG("hud.msg.fluid"));
String energ = String.format("%s ", SpecialChars.RED + 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;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x,
int y, int z) {
try {
byte modeItem = ThermalExpansionModule.TileTesseract_Item.getByte(te);
byte modeFluid = ThermalExpansionModule.TileTesseract_Fluid.getByte(te);
byte modeEnergy = ThermalExpansionModule.TileTesseract_Energy.getByte(te);
tag.setByte("Item.Mode", modeItem);
tag.setByte("Fluid.Mode", modeFluid);
tag.setByte("Energy.Mode", modeEnergy);
} catch (Exception e) {
throw new RuntimeException(e);
}
return tag;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) {
try {
byte modeItem = ThermalExpansionModule.TileTesseract_Item.getByte(te);
byte modeFluid = ThermalExpansionModule.TileTesseract_Fluid.getByte(te);
byte modeEnergy = ThermalExpansionModule.TileTesseract_Energy.getByte(te);
tag.setByte("Item.Mode", modeItem);
tag.setByte("Fluid.Mode", modeFluid);
tag.setByte("Energy.Mode", modeEnergy);
} catch (Exception e) {
throw new RuntimeException(e);
}
return tag;
}
}
Loaded 100 of 278 files, more files were not shown because too many files have changed in this diff. Show more