mirror of
https://github.com/GTNewHorizons/waila.git
synced 2026-11-14 17:14:51 +00:00
Compare commits
361
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
76406153ee | ||
|
|
cb1b75a17b | ||
|
|
f172a0dbb0 | ||
|
|
f998f9ebfe | ||
|
|
6d0f162453 | ||
|
|
9e3ef39e30 | ||
|
|
452fbfa47c | ||
|
|
d8477007c9 | ||
|
|
bd5905dfc0 | ||
|
|
80e761d83f | ||
|
|
ef0f8b5329 | ||
|
|
65e4a773d0 | ||
|
|
30717912fb | ||
|
|
1421b83a5b | ||
|
|
2de1ec4235 | ||
|
|
91f8019410 | ||
|
|
59157ec1e3 | ||
|
|
b612897ddb | ||
|
|
a5607eda00 | ||
|
|
f242cf77a9 | ||
|
|
9d1840dabc | ||
|
|
677a74dad7 | ||
|
|
10219fd204 | ||
|
|
d14044c92e | ||
|
|
5c115d9af3 | ||
|
|
c0a119902a | ||
|
|
93485e1525 | ||
|
|
ceb94e3e2c | ||
|
|
8ea26bf073 | ||
|
|
2aabfdb64c | ||
|
|
a34460c159 | ||
|
|
1f3fd64a38 | ||
|
|
191a916896 | ||
|
|
ee1ed27a3a | ||
|
|
07b9d1bf92 | ||
|
|
e82729a113 | ||
|
|
c938ccf542 | ||
|
|
c2e8b44f2b | ||
|
|
c4e3537957 | ||
|
|
9bc1e79f64 | ||
|
|
bdebd737d6 | ||
|
|
9f04d3d029 | ||
|
|
ef3c4a9774 | ||
|
|
3b64d21335 | ||
|
|
72c91a3700 | ||
|
|
bf6d309038 | ||
|
|
5bb7f7221a | ||
|
|
6278e4d575 | ||
|
|
7a46d914db | ||
|
|
d30d8ba100 | ||
|
|
490a176446 | ||
|
|
453a8f50a7 | ||
|
|
d946500c0d | ||
|
|
487829a16e | ||
|
|
f153502858 | ||
|
|
095ea9e3c4 | ||
|
|
c6d48b32f7 | ||
|
|
4fb3d1edaa | ||
|
|
678bb6dd44 | ||
|
|
5333808d65 | ||
|
|
4750486375 | ||
|
|
0f9710a9f9 | ||
|
|
0c0ac4fcfa | ||
|
|
a189446cac | ||
|
|
6279ef2b09 | ||
|
|
6cf6dafb53 | ||
|
|
2f738bc728 | ||
|
|
8329a4f186 | ||
|
|
e5ab6193a5 | ||
|
|
18560992cd | ||
|
|
a767b0f922 | ||
|
|
61f8fbe1ce | ||
|
|
a8a49f2b6e | ||
|
|
bf7cc86247 | ||
|
|
d6650f6cc4 | ||
|
|
bc46b8840d | ||
|
|
7d72e0680e | ||
|
|
ee237c3a44 | ||
|
|
4c4cb95782 | ||
|
|
9698692020 | ||
|
|
e7524e80f1 | ||
|
|
d682f65320 | ||
|
|
3801124648 | ||
|
|
2b73a517e8 | ||
|
|
50221c750b | ||
|
|
752dcd9986 | ||
|
|
2edac37178 | ||
|
|
85f2b035a4 | ||
|
|
4ee7d7396c | ||
|
|
d10840fc54 | ||
|
|
80cfdfd41e | ||
|
|
08a9f33dbb | ||
|
|
8023588d71 | ||
|
|
6ca097d5d0 | ||
|
|
fba608a2d1 | ||
|
|
f04bb197ac | ||
|
|
8b30294ae0 | ||
|
|
d4441c85ce | ||
|
|
c1480d632c | ||
|
|
8268d0a384 | ||
|
|
78eb719f06 | ||
|
|
0c73ed59c3 | ||
|
|
66759201a1 | ||
|
|
aa093a4174 | ||
|
|
2431509d41 | ||
|
|
156c9f3905 | ||
|
|
a1f4378fe7 | ||
|
|
af42a25d2e | ||
|
|
07b0b83f4a | ||
|
|
d932d91a77 | ||
|
|
87261267e1 | ||
|
|
7af9692632 | ||
|
|
1eb78112eb | ||
|
|
4ed103dd25 | ||
|
|
118bab5a2b | ||
|
|
ce6474fc29 | ||
|
|
cbeb3b3628 | ||
|
|
d27d6db57c | ||
|
|
e60974ab20 | ||
|
|
f481e46fb2 | ||
|
|
7638322f7f | ||
|
|
0afbc6efb4 | ||
|
|
6d97a3a595 | ||
|
|
737c4e2cbf | ||
|
|
f4f5920d88 | ||
|
|
ea95fadb78 | ||
|
|
77277c6024 | ||
|
|
0b85d18865 | ||
|
|
9d0b942667 | ||
|
|
caf8cf7e7b | ||
|
|
01546d40e9 | ||
|
|
6d6e7616e4 | ||
|
|
1c2af8da33 | ||
|
|
197305bf78 | ||
|
|
8483573146 | ||
|
|
a05c6aa6d7 | ||
|
|
28196d451e | ||
|
|
e83009414e | ||
|
|
46b0f19572 | ||
|
|
730f57be90 | ||
|
|
6f30e64849 | ||
|
|
156e672dbc | ||
|
|
fdd401469e | ||
|
|
2b5eb13f83 | ||
|
|
0476bca1bf | ||
|
|
f46ac15842 | ||
|
|
616e02e047 | ||
|
|
e74174aff7 | ||
|
|
38fa57823e | ||
|
|
7d1c25872c | ||
|
|
f9f2c4041e | ||
|
|
9050654e42 | ||
|
|
14bee7ab58 | ||
|
|
a63dc221ba | ||
|
|
6bba5f1e7e | ||
|
|
eae1de6698 | ||
|
|
ef7812c64d | ||
|
|
8924997fa0 | ||
|
|
9f6e79c467 | ||
|
|
08db0ed7fd | ||
|
|
adcc7783a8 | ||
|
|
b686bb431c | ||
|
|
7251015c3a | ||
|
|
ff8980089a | ||
|
|
4132d2941b | ||
|
|
8c77c19e94 | ||
|
|
ae10c1cad2 | ||
|
|
2bc138f222 | ||
|
|
3527aa3ddf | ||
|
|
edb0dab397 | ||
|
|
30885054a2 | ||
|
|
96b32ffd50 | ||
|
|
b7dda5d80b | ||
|
|
8d5d86705c | ||
|
|
26dad264d5 | ||
|
|
6489bded40 | ||
|
|
85d8541112 | ||
|
|
c9b750077e | ||
|
|
7c08f87419 | ||
|
|
b8d4783d7e | ||
|
|
146e30cbda | ||
|
|
5978494340 | ||
|
|
c618a10e7c | ||
|
|
634c9a55ce | ||
|
|
a8fb8a03e0 | ||
|
|
13e233d1d2 | ||
|
|
8f87062c1e | ||
|
|
a111fed3d5 | ||
|
|
c887c01e2e | ||
|
|
47cc1af622 | ||
|
|
da60ffef67 | ||
|
|
e69d711124 | ||
|
|
49893aa732 | ||
|
|
e2475c34d5 | ||
|
|
fcc5699046 | ||
|
|
09ab6cb781 | ||
|
|
fd929a4235 | ||
|
|
87986a6cfb | ||
|
|
298eafc0c0 | ||
|
|
5349270996 | ||
|
|
17dce19ba3 | ||
|
|
95ce24b31c | ||
|
|
16b3a46bae | ||
|
|
83339dcbd5 | ||
|
|
d2291a1215 | ||
|
|
3ae11044fd | ||
|
|
aae8449e06 | ||
|
|
206eb75489 | ||
|
|
a633110bb1 | ||
|
|
68fc21b282 | ||
|
|
eb941468f7 | ||
|
|
248c4f844f | ||
|
|
b81f72c0b4 | ||
|
|
441501f49b | ||
|
|
7ac7bff1d3 | ||
|
|
446989c5a9 | ||
|
|
c8b2803aee | ||
|
|
3357e9bb32 | ||
|
|
9ecab4c490 | ||
|
|
d01c5cd452 | ||
|
|
eae6385a45 | ||
|
|
f4ae8de69e | ||
|
|
74865d4b54 | ||
|
|
42bb13818a | ||
|
|
dc0e61b6e9 | ||
|
|
9a74ac8f3b | ||
|
|
37828e18f6 | ||
|
|
40173c3aaa | ||
|
|
72e0f942f2 | ||
|
|
0a3184ba6b | ||
|
|
e322723146 | ||
|
|
5f93e5a027 | ||
|
|
45ec78d68b | ||
|
|
3551c188b7 | ||
|
|
662cb060ff | ||
|
|
23172ad307 | ||
|
|
ea105c698f | ||
|
|
80a17c9af4 | ||
|
|
38f004ba2f | ||
|
|
dfe3050167 | ||
|
|
a5e1a51972 | ||
|
|
aafaeba9fd | ||
|
|
e0805fe0ce | ||
|
|
389f2e7dfc | ||
|
|
7463c054c7 | ||
|
|
80ac857e2c | ||
|
|
ae7132cf8a | ||
|
|
4f947ce409 | ||
|
|
8870cc05ad | ||
|
|
90c3ae6921 | ||
|
|
1b080d1208 | ||
|
|
0a30bb5848 | ||
|
|
8503ed33b7 | ||
|
|
5cb0e10e7a | ||
|
|
b704465eef | ||
|
|
276207d718 | ||
|
|
b5eae48f90 | ||
|
|
9c3358419c | ||
|
|
6e72b0b302 | ||
|
|
08a7be082c | ||
|
|
73ac295ade | ||
|
|
c165526c5b | ||
|
|
a39fb2df02 | ||
|
|
651ae123e6 | ||
|
|
552f1b4127 | ||
|
|
2c2f381b13 | ||
|
|
fad5563eca | ||
|
|
93cd9e1732 | ||
|
|
4c2b473d86 | ||
|
|
4b3d57f075 | ||
|
|
775b088bba | ||
|
|
d18676d144 | ||
|
|
e12a2d8ed7 | ||
|
|
cc88897ca8 | ||
|
|
a2e3aef71e | ||
|
|
2e8bb2760a | ||
|
|
ec37d2fd86 | ||
|
|
0df7285dc2 | ||
|
|
bb00730912 | ||
|
|
166f293142 | ||
|
|
63a46c019c | ||
|
|
0bb6caf334 | ||
|
|
5ac5f7956c | ||
|
|
d00c17b3bb | ||
|
|
52ac40a10e | ||
|
|
40facdda4b | ||
|
|
3505888a82 | ||
|
|
7eb35b7544 | ||
|
|
78039db017 | ||
|
|
17b5cbead9 | ||
|
|
d355ec28bb | ||
|
|
bd675cee28 | ||
|
|
7c74db3640 | ||
|
|
b65dc58fc6 | ||
|
|
1438d6a701 | ||
|
|
223e2c7da6 | ||
|
|
1aed35a2b5 | ||
|
|
96a0d27778 | ||
|
|
aecf8c0330 | ||
|
|
4c1803accf | ||
|
|
3ce45461eb | ||
|
|
90dd086cc3 | ||
|
|
fb9de99f39 | ||
|
|
1580296a2c | ||
|
|
9d272f2e34 | ||
|
|
2259e27f60 | ||
|
|
716498256b | ||
|
|
bcd36dd638 | ||
|
|
f790ac948d | ||
|
|
f282be75f4 | ||
|
|
ec1ab8e548 | ||
|
|
add57cbd6b | ||
|
|
ce249c806e | ||
|
|
3f6da9018c | ||
|
|
2b7f3866a5 | ||
|
|
b83d5bd297 | ||
|
|
4e7e32fba7 | ||
|
|
2346ffd559 | ||
|
|
49a2a32a77 | ||
|
|
47fb4c55a8 | ||
|
|
b6b5404440 | ||
|
|
89fc1c8ce7 | ||
|
|
79107209d9 | ||
|
|
3533ea2d23 | ||
|
|
f1a4056431 | ||
|
|
dcc35737be | ||
|
|
4a3015eb21 | ||
|
|
d3a317e3dd | ||
|
|
9d1045333a | ||
|
|
80e30abec3 | ||
|
|
2dd88b9c13 | ||
|
|
f46d9393b5 | ||
|
|
d2f8911797 | ||
|
|
a1365b2db3 | ||
|
|
0988ee744e | ||
|
|
537c3dc1af | ||
|
|
5f7bf6cc5c | ||
|
|
904fe472b8 | ||
|
|
0ef5f65067 | ||
|
|
b6d529575d | ||
|
|
669435f153 | ||
|
|
f1c484d390 | ||
|
|
ef20dcc4c6 | ||
|
|
1bbf3e8747 | ||
|
|
3bc29dd907 | ||
|
|
23bbd2ceb4 | ||
|
|
d0e2932257 | ||
|
|
cf6ecd55e5 | ||
|
|
bfc2e5dec6 | ||
|
|
d6589ec1c1 | ||
|
|
1cadab1320 | ||
|
|
91aea326c7 | ||
|
|
d2c6d95e75 | ||
|
|
5a8673d322 | ||
|
|
917eaab8be | ||
|
|
198d0c7079 | ||
|
|
03f4bed4fe | ||
|
|
1bfcc07e1f | ||
|
|
ef9a1bedfc | ||
|
|
4121e689fd | ||
|
|
0b1911b711 |
No files matched your search
@@ -0,0 +1,2 @@
|
||||
# Ignore spotlessApply reformat
|
||||
4ee7d7396c8a27b994d49169140edbf9adfdc2dc
|
||||
@@ -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
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
name: Build and test
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master, main ]
|
||||
push:
|
||||
branches: [ master, main ]
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/build-and-test.yml@master
|
||||
secrets: inherit
|
||||
@@ -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
|
||||
@@ -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
@@ -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
|
||||
@@ -0,0 +1,3 @@
|
||||
# Any Github changes require admin approval
|
||||
/.github/** @GTNewHorizons/admin
|
||||
|
||||
@@ -0,0 +1,437 @@
|
||||
Attribution-NonCommercial-ShareAlike 4.0 International
|
||||
|
||||
=======================================================================
|
||||
|
||||
Creative Commons Corporation ("Creative Commons") is not a law firm and
|
||||
does not provide legal services or legal advice. Distribution of
|
||||
Creative Commons public licenses does not create a lawyer-client or
|
||||
other relationship. Creative Commons makes its licenses and related
|
||||
information available on an "as-is" basis. Creative Commons gives no
|
||||
warranties regarding its licenses, any material licensed under their
|
||||
terms and conditions, or any related information. Creative Commons
|
||||
disclaims all liability for damages resulting from their use to the
|
||||
fullest extent possible.
|
||||
|
||||
Using Creative Commons Public Licenses
|
||||
|
||||
Creative Commons public licenses provide a standard set of terms and
|
||||
conditions that creators and other rights holders may use to share
|
||||
original works of authorship and other material subject to copyright
|
||||
and certain other rights specified in the public license below. The
|
||||
following considerations are for informational purposes only, are not
|
||||
exhaustive, and do not form part of our licenses.
|
||||
|
||||
Considerations for licensors: Our public licenses are
|
||||
intended for use by those authorized to give the public
|
||||
permission to use material in ways otherwise restricted by
|
||||
copyright and certain other rights. Our licenses are
|
||||
irrevocable. Licensors should read and understand the terms
|
||||
and conditions of the license they choose before applying it.
|
||||
Licensors should also secure all rights necessary before
|
||||
applying our licenses so that the public can reuse the
|
||||
material as expected. Licensors should clearly mark any
|
||||
material not subject to the license. This includes other CC-
|
||||
licensed material, or material used under an exception or
|
||||
limitation to copyright. More considerations for licensors:
|
||||
wiki.creativecommons.org/Considerations_for_licensors
|
||||
|
||||
Considerations for the public: By using one of our public
|
||||
licenses, a licensor grants the public permission to use the
|
||||
licensed material under specified terms and conditions. If
|
||||
the licensor's permission is not necessary for any reason--for
|
||||
example, because of any applicable exception or limitation to
|
||||
copyright--then that use is not regulated by the license. Our
|
||||
licenses grant only permissions under copyright and certain
|
||||
other rights that a licensor has authority to grant. Use of
|
||||
the licensed material may still be restricted for other
|
||||
reasons, including because others have copyright or other
|
||||
rights in the material. A licensor may make special requests,
|
||||
such as asking that all changes be marked or described.
|
||||
Although not required by our licenses, you are encouraged to
|
||||
respect those requests where reasonable. More considerations
|
||||
for the public:
|
||||
wiki.creativecommons.org/Considerations_for_licensees
|
||||
|
||||
=======================================================================
|
||||
|
||||
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
|
||||
Public License
|
||||
|
||||
By exercising the Licensed Rights (defined below), You accept and agree
|
||||
to be bound by the terms and conditions of this Creative Commons
|
||||
Attribution-NonCommercial-ShareAlike 4.0 International Public License
|
||||
("Public License"). To the extent this Public License may be
|
||||
interpreted as a contract, You are granted the Licensed Rights in
|
||||
consideration of Your acceptance of these terms and conditions, and the
|
||||
Licensor grants You such rights in consideration of benefits the
|
||||
Licensor receives from making the Licensed Material available under
|
||||
these terms and conditions.
|
||||
|
||||
|
||||
Section 1 -- Definitions.
|
||||
|
||||
a. Adapted Material means material subject to Copyright and Similar
|
||||
Rights that is derived from or based upon the Licensed Material
|
||||
and in which the Licensed Material is translated, altered,
|
||||
arranged, transformed, or otherwise modified in a manner requiring
|
||||
permission under the Copyright and Similar Rights held by the
|
||||
Licensor. For purposes of this Public License, where the Licensed
|
||||
Material is a musical work, performance, or sound recording,
|
||||
Adapted Material is always produced where the Licensed Material is
|
||||
synched in timed relation with a moving image.
|
||||
|
||||
b. Adapter's License means the license You apply to Your Copyright
|
||||
and Similar Rights in Your contributions to Adapted Material in
|
||||
accordance with the terms and conditions of this Public License.
|
||||
|
||||
c. BY-NC-SA Compatible License means a license listed at
|
||||
creativecommons.org/compatiblelicenses, approved by Creative
|
||||
Commons as essentially the equivalent of this Public License.
|
||||
|
||||
d. Copyright and Similar Rights means copyright and/or similar rights
|
||||
closely related to copyright including, without limitation,
|
||||
performance, broadcast, sound recording, and Sui Generis Database
|
||||
Rights, without regard to how the rights are labeled or
|
||||
categorized. For purposes of this Public License, the rights
|
||||
specified in Section 2(b)(1)-(2) are not Copyright and Similar
|
||||
Rights.
|
||||
|
||||
e. Effective Technological Measures means those measures that, in the
|
||||
absence of proper authority, may not be circumvented under laws
|
||||
fulfilling obligations under Article 11 of the WIPO Copyright
|
||||
Treaty adopted on December 20, 1996, and/or similar international
|
||||
agreements.
|
||||
|
||||
f. Exceptions and Limitations means fair use, fair dealing, and/or
|
||||
any other exception or limitation to Copyright and Similar Rights
|
||||
that applies to Your use of the Licensed Material.
|
||||
|
||||
g. License Elements means the license attributes listed in the name
|
||||
of a Creative Commons Public License. The License Elements of this
|
||||
Public License are Attribution, NonCommercial, and ShareAlike.
|
||||
|
||||
h. Licensed Material means the artistic or literary work, database,
|
||||
or other material to which the Licensor applied this Public
|
||||
License.
|
||||
|
||||
i. Licensed Rights means the rights granted to You subject to the
|
||||
terms and conditions of this Public License, which are limited to
|
||||
all Copyright and Similar Rights that apply to Your use of the
|
||||
Licensed Material and that the Licensor has authority to license.
|
||||
|
||||
j. Licensor means the individual(s) or entity(ies) granting rights
|
||||
under this Public License.
|
||||
|
||||
k. NonCommercial means not primarily intended for or directed towards
|
||||
commercial advantage or monetary compensation. For purposes of
|
||||
this Public License, the exchange of the Licensed Material for
|
||||
other material subject to Copyright and Similar Rights by digital
|
||||
file-sharing or similar means is NonCommercial provided there is
|
||||
no payment of monetary compensation in connection with the
|
||||
exchange.
|
||||
|
||||
l. Share means to provide material to the public by any means or
|
||||
process that requires permission under the Licensed Rights, such
|
||||
as reproduction, public display, public performance, distribution,
|
||||
dissemination, communication, or importation, and to make material
|
||||
available to the public including in ways that members of the
|
||||
public may access the material from a place and at a time
|
||||
individually chosen by them.
|
||||
|
||||
m. Sui Generis Database Rights means rights other than copyright
|
||||
resulting from Directive 96/9/EC of the European Parliament and of
|
||||
the Council of 11 March 1996 on the legal protection of databases,
|
||||
as amended and/or succeeded, as well as other essentially
|
||||
equivalent rights anywhere in the world.
|
||||
|
||||
n. You means the individual or entity exercising the Licensed Rights
|
||||
under this Public License. Your has a corresponding meaning.
|
||||
|
||||
|
||||
Section 2 -- Scope.
|
||||
|
||||
a. License grant.
|
||||
|
||||
1. Subject to the terms and conditions of this Public License,
|
||||
the Licensor hereby grants You a worldwide, royalty-free,
|
||||
non-sublicensable, non-exclusive, irrevocable license to
|
||||
exercise the Licensed Rights in the Licensed Material to:
|
||||
|
||||
a. reproduce and Share the Licensed Material, in whole or
|
||||
in part, for NonCommercial purposes only; and
|
||||
|
||||
b. produce, reproduce, and Share Adapted Material for
|
||||
NonCommercial purposes only.
|
||||
|
||||
2. Exceptions and Limitations. For the avoidance of doubt, where
|
||||
Exceptions and Limitations apply to Your use, this Public
|
||||
License does not apply, and You do not need to comply with
|
||||
its terms and conditions.
|
||||
|
||||
3. Term. The term of this Public License is specified in Section
|
||||
6(a).
|
||||
|
||||
4. Media and formats; technical modifications allowed. The
|
||||
Licensor authorizes You to exercise the Licensed Rights in
|
||||
all media and formats whether now known or hereafter created,
|
||||
and to make technical modifications necessary to do so. The
|
||||
Licensor waives and/or agrees not to assert any right or
|
||||
authority to forbid You from making technical modifications
|
||||
necessary to exercise the Licensed Rights, including
|
||||
technical modifications necessary to circumvent Effective
|
||||
Technological Measures. For purposes of this Public License,
|
||||
simply making modifications authorized by this Section 2(a)
|
||||
(4) never produces Adapted Material.
|
||||
|
||||
5. Downstream recipients.
|
||||
|
||||
a. Offer from the Licensor -- Licensed Material. Every
|
||||
recipient of the Licensed Material automatically
|
||||
receives an offer from the Licensor to exercise the
|
||||
Licensed Rights under the terms and conditions of this
|
||||
Public License.
|
||||
|
||||
b. Additional offer from the Licensor -- Adapted Material.
|
||||
Every recipient of Adapted Material from You
|
||||
automatically receives an offer from the Licensor to
|
||||
exercise the Licensed Rights in the Adapted Material
|
||||
under the conditions of the Adapter's License You apply.
|
||||
|
||||
c. No downstream restrictions. You may not offer or impose
|
||||
any additional or different terms or conditions on, or
|
||||
apply any Effective Technological Measures to, the
|
||||
Licensed Material if doing so restricts exercise of the
|
||||
Licensed Rights by any recipient of the Licensed
|
||||
Material.
|
||||
|
||||
6. No endorsement. Nothing in this Public License constitutes or
|
||||
may be construed as permission to assert or imply that You
|
||||
are, or that Your use of the Licensed Material is, connected
|
||||
with, or sponsored, endorsed, or granted official status by,
|
||||
the Licensor or others designated to receive attribution as
|
||||
provided in Section 3(a)(1)(A)(i).
|
||||
|
||||
b. Other rights.
|
||||
|
||||
1. Moral rights, such as the right of integrity, are not
|
||||
licensed under this Public License, nor are publicity,
|
||||
privacy, and/or other similar personality rights; however, to
|
||||
the extent possible, the Licensor waives and/or agrees not to
|
||||
assert any such rights held by the Licensor to the limited
|
||||
extent necessary to allow You to exercise the Licensed
|
||||
Rights, but not otherwise.
|
||||
|
||||
2. Patent and trademark rights are not licensed under this
|
||||
Public License.
|
||||
|
||||
3. To the extent possible, the Licensor waives any right to
|
||||
collect royalties from You for the exercise of the Licensed
|
||||
Rights, whether directly or through a collecting society
|
||||
under any voluntary or waivable statutory or compulsory
|
||||
licensing scheme. In all other cases the Licensor expressly
|
||||
reserves any right to collect such royalties, including when
|
||||
the Licensed Material is used other than for NonCommercial
|
||||
purposes.
|
||||
|
||||
|
||||
Section 3 -- License Conditions.
|
||||
|
||||
Your exercise of the Licensed Rights is expressly made subject to the
|
||||
following conditions.
|
||||
|
||||
a. Attribution.
|
||||
|
||||
1. If You Share the Licensed Material (including in modified
|
||||
form), You must:
|
||||
|
||||
a. retain the following if it is supplied by the Licensor
|
||||
with the Licensed Material:
|
||||
|
||||
i. identification of the creator(s) of the Licensed
|
||||
Material and any others designated to receive
|
||||
attribution, in any reasonable manner requested by
|
||||
the Licensor (including by pseudonym if
|
||||
designated);
|
||||
|
||||
ii. a copyright notice;
|
||||
|
||||
iii. a notice that refers to this Public License;
|
||||
|
||||
iv. a notice that refers to the disclaimer of
|
||||
warranties;
|
||||
|
||||
v. a URI or hyperlink to the Licensed Material to the
|
||||
extent reasonably practicable;
|
||||
|
||||
b. indicate if You modified the Licensed Material and
|
||||
retain an indication of any previous modifications; and
|
||||
|
||||
c. indicate the Licensed Material is licensed under this
|
||||
Public License, and include the text of, or the URI or
|
||||
hyperlink to, this Public License.
|
||||
|
||||
2. You may satisfy the conditions in Section 3(a)(1) in any
|
||||
reasonable manner based on the medium, means, and context in
|
||||
which You Share the Licensed Material. For example, it may be
|
||||
reasonable to satisfy the conditions by providing a URI or
|
||||
hyperlink to a resource that includes the required
|
||||
information.
|
||||
3. If requested by the Licensor, You must remove any of the
|
||||
information required by Section 3(a)(1)(A) to the extent
|
||||
reasonably practicable.
|
||||
|
||||
b. ShareAlike.
|
||||
|
||||
In addition to the conditions in Section 3(a), if You Share
|
||||
Adapted Material You produce, the following conditions also apply.
|
||||
|
||||
1. The Adapter's License You apply must be a Creative Commons
|
||||
license with the same License Elements, this version or
|
||||
later, or a BY-NC-SA Compatible License.
|
||||
|
||||
2. You must include the text of, or the URI or hyperlink to, the
|
||||
Adapter's License You apply. You may satisfy this condition
|
||||
in any reasonable manner based on the medium, means, and
|
||||
context in which You Share Adapted Material.
|
||||
|
||||
3. You may not offer or impose any additional or different terms
|
||||
or conditions on, or apply any Effective Technological
|
||||
Measures to, Adapted Material that restrict exercise of the
|
||||
rights granted under the Adapter's License You apply.
|
||||
|
||||
|
||||
Section 4 -- Sui Generis Database Rights.
|
||||
|
||||
Where the Licensed Rights include Sui Generis Database Rights that
|
||||
apply to Your use of the Licensed Material:
|
||||
|
||||
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
|
||||
to extract, reuse, reproduce, and Share all or a substantial
|
||||
portion of the contents of the database for NonCommercial purposes
|
||||
only;
|
||||
|
||||
b. if You include all or a substantial portion of the database
|
||||
contents in a database in which You have Sui Generis Database
|
||||
Rights, then the database in which You have Sui Generis Database
|
||||
Rights (but not its individual contents) is Adapted Material,
|
||||
including for purposes of Section 3(b); and
|
||||
|
||||
c. You must comply with the conditions in Section 3(a) if You Share
|
||||
all or a substantial portion of the contents of the database.
|
||||
|
||||
For the avoidance of doubt, this Section 4 supplements and does not
|
||||
replace Your obligations under this Public License where the Licensed
|
||||
Rights include other Copyright and Similar Rights.
|
||||
|
||||
|
||||
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
|
||||
|
||||
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
|
||||
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
|
||||
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
|
||||
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
|
||||
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
|
||||
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
|
||||
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
|
||||
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
|
||||
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
|
||||
|
||||
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
|
||||
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
|
||||
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
|
||||
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
|
||||
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
|
||||
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
|
||||
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
|
||||
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
|
||||
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
|
||||
|
||||
c. The disclaimer of warranties and limitation of liability provided
|
||||
above shall be interpreted in a manner that, to the extent
|
||||
possible, most closely approximates an absolute disclaimer and
|
||||
waiver of all liability.
|
||||
|
||||
|
||||
Section 6 -- Term and Termination.
|
||||
|
||||
a. This Public License applies for the term of the Copyright and
|
||||
Similar Rights licensed here. However, if You fail to comply with
|
||||
this Public License, then Your rights under this Public License
|
||||
terminate automatically.
|
||||
|
||||
b. Where Your right to use the Licensed Material has terminated under
|
||||
Section 6(a), it reinstates:
|
||||
|
||||
1. automatically as of the date the violation is cured, provided
|
||||
it is cured within 30 days of Your discovery of the
|
||||
violation; or
|
||||
|
||||
2. upon express reinstatement by the Licensor.
|
||||
|
||||
For the avoidance of doubt, this Section 6(b) does not affect any
|
||||
right the Licensor may have to seek remedies for Your violations
|
||||
of this Public License.
|
||||
|
||||
c. For the avoidance of doubt, the Licensor may also offer the
|
||||
Licensed Material under separate terms or conditions or stop
|
||||
distributing the Licensed Material at any time; however, doing so
|
||||
will not terminate this Public License.
|
||||
|
||||
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
|
||||
License.
|
||||
|
||||
|
||||
Section 7 -- Other Terms and Conditions.
|
||||
|
||||
a. The Licensor shall not be bound by any additional or different
|
||||
terms or conditions communicated by You unless expressly agreed.
|
||||
|
||||
b. Any arrangements, understandings, or agreements regarding the
|
||||
Licensed Material not stated herein are separate from and
|
||||
independent of the terms and conditions of this Public License.
|
||||
|
||||
|
||||
Section 8 -- Interpretation.
|
||||
|
||||
a. For the avoidance of doubt, this Public License does not, and
|
||||
shall not be interpreted to, reduce, limit, restrict, or impose
|
||||
conditions on any use of the Licensed Material that could lawfully
|
||||
be made without permission under this Public License.
|
||||
|
||||
b. To the extent possible, if any provision of this Public License is
|
||||
deemed unenforceable, it shall be automatically reformed to the
|
||||
minimum extent necessary to make it enforceable. If the provision
|
||||
cannot be reformed, it shall be severed from this Public License
|
||||
without affecting the enforceability of the remaining terms and
|
||||
conditions.
|
||||
|
||||
c. No term or condition of this Public License will be waived and no
|
||||
failure to comply consented to unless expressly agreed to by the
|
||||
Licensor.
|
||||
|
||||
d. Nothing in this Public License constitutes or may be interpreted
|
||||
as a limitation upon, or waiver of, any privileges and immunities
|
||||
that apply to the Licensor or You, including from the legal
|
||||
processes of any jurisdiction or authority.
|
||||
|
||||
=======================================================================
|
||||
|
||||
Creative Commons is not a party to its public
|
||||
licenses. Notwithstanding, Creative Commons may elect to apply one of
|
||||
its public licenses to material it publishes and in those instances
|
||||
will be considered the “Licensor.” The text of the Creative Commons
|
||||
public licenses is dedicated to the public domain under the CC0 Public
|
||||
Domain Dedication. Except for the limited purpose of indicating that
|
||||
material is shared under a Creative Commons public license or as
|
||||
otherwise permitted by the Creative Commons policies published at
|
||||
creativecommons.org/policies, Creative Commons does not authorize the
|
||||
use of the trademark "Creative Commons" or any other trademark or logo
|
||||
of Creative Commons without its prior written consent including,
|
||||
without limitation, in connection with any unauthorized modifications
|
||||
to any of its public licenses or any other arrangements,
|
||||
understandings, or agreements concerning use of licensed material. For
|
||||
the avoidance of doubt, this paragraph does not form part of the
|
||||
public licenses.
|
||||
|
||||
Creative Commons may be contacted at creativecommons.org.
|
||||
-387
@@ -1,387 +0,0 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
|
||||
APACHE COMMONS MATH DERIVATIVE WORKS:
|
||||
|
||||
The Apache commons-math library includes a number of subcomponents
|
||||
whose implementation is derived from original sources written
|
||||
in C or Fortran. License terms of the original sources
|
||||
are reproduced below.
|
||||
|
||||
===============================================================================
|
||||
For the lmder, lmpar and qrsolv Fortran routine from minpack and translated in
|
||||
the LevenbergMarquardtOptimizer class in package
|
||||
org.apache.commons.math3.optimization.general
|
||||
Original source copyright and license statement:
|
||||
|
||||
Minpack Copyright Notice (1999) University of Chicago. All rights reserved
|
||||
|
||||
Redistribution and use in source and binary forms, with or
|
||||
without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials
|
||||
provided with the distribution.
|
||||
|
||||
3. The end-user documentation included with the
|
||||
redistribution, if any, must include the following
|
||||
acknowledgment:
|
||||
|
||||
"This product includes software developed by the
|
||||
University of Chicago, as Operator of Argonne National
|
||||
Laboratory.
|
||||
|
||||
Alternately, this acknowledgment may appear in the software
|
||||
itself, if and wherever such third-party acknowledgments
|
||||
normally appear.
|
||||
|
||||
4. WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS"
|
||||
WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE
|
||||
UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND
|
||||
THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE
|
||||
OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY
|
||||
OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR
|
||||
USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF
|
||||
THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4)
|
||||
DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION
|
||||
UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL
|
||||
BE CORRECTED.
|
||||
|
||||
5. LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT
|
||||
HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF
|
||||
ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT,
|
||||
INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF
|
||||
ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER
|
||||
SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT
|
||||
(INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE,
|
||||
EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE
|
||||
POSSIBILITY OF SUCH LOSS OR DAMAGES.
|
||||
===============================================================================
|
||||
|
||||
Copyright and license statement for the odex Fortran routine developed by
|
||||
E. Hairer and G. Wanner and translated in GraggBulirschStoerIntegrator class
|
||||
in package org.apache.commons.math3.ode.nonstiff:
|
||||
|
||||
|
||||
Copyright (c) 2004, Ernst Hairer
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
===============================================================================
|
||||
|
||||
Copyright and license statement for the original lapack fortran routines
|
||||
translated in EigenDecompositionImpl class in package
|
||||
org.apache.commons.math3.linear:
|
||||
|
||||
Copyright (c) 1992-2008 The University of Tennessee. All rights reserved.
|
||||
|
||||
$COPYRIGHT$
|
||||
|
||||
Additional copyrights may follow
|
||||
|
||||
$HEADER$
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer listed
|
||||
in this license in the documentation and/or other materials
|
||||
provided with the distribution.
|
||||
|
||||
- Neither the name of the copyright holders nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
===============================================================================
|
||||
|
||||
Copyright and license statement for the original Mersenne twister C
|
||||
routines translated in MersenneTwister class in package
|
||||
org.apache.commons.math3.random:
|
||||
|
||||
Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. The names of its contributors may not be used to endorse or promote
|
||||
products derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
===============================================================================
|
||||
|
||||
The class "org.apache.commons.math3.exception.util.LocalizedFormatsTest" is
|
||||
an adapted version of "OrekitMessagesTest" test class for the Orekit library
|
||||
The "org.apache.commons.math3.analysis.interpolation.HermiteInterpolator"
|
||||
has been imported from the Orekit space flight dynamics library.
|
||||
|
||||
Th Orekit library is described at:
|
||||
https://www.orekit.org/forge/projects/orekit
|
||||
The original files are distributed under the terms of the Apache 2 license
|
||||
which is: Copyright 2010 CS Communication & Systèmes
|
||||
@@ -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
|
||||
```
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.0 KiB |
@@ -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>
|
||||
@@ -0,0 +1,5 @@
|
||||
//version: 1707058017
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhconvention'
|
||||
}
|
||||
@@ -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")
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
#gource --file-idle-time 0 --camera-mode overview --title "Minecraft Coder Pack" -s 2 --hide-filenames --stop-at-end --disable-progress --output-ppm-stream - | ffmpeg -y -r 60 -b 6000K -f image2pipe -vcodec ppm -i - -vcodec libtheora out.ogg
|
||||
gource --file-idle-time 0 --camera-mode overview --title "Waila" -s 2 --hide-filenames --stop-at-end --disable-progress --output-ppm-stream - | ffmpeg -y -f image2pipe -vcodec ppm -i - -vpre libx264-medium -vcodec libx264 out_small.mkv
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
Vendored
BIN
Binary file not shown.
+7
@@ -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
|
||||
@@ -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
@@ -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
|
||||
@@ -0,0 +1,2 @@
|
||||
before_install:
|
||||
- ./gradlew setupCIWorkspace
|
||||
@@ -1,35 +0,0 @@
|
||||
package mcp.mobius.waila;
|
||||
|
||||
public final class Constants {
|
||||
public static String BIND_SCREEN_WIKI = "showwiki";
|
||||
public static String BIND_SCREEN_TECH = "showtechtree";
|
||||
public static String BIND_SCREEN_ENCH = "showenchant";
|
||||
|
||||
public static String BIND_WAILA_CFG = "waila.keybind.wailaconfig";
|
||||
public static String BIND_WAILA_SHOW = "waila.keybind.wailadisplay";
|
||||
public static String BIND_WAILA_LIQUID = "waila.keybind.liquid";
|
||||
public static String BIND_WAILA_RECIPE = "waila.keybind.recipe";
|
||||
public static String BIND_WAILA_USAGE = "waila.keybind.usage";
|
||||
public static String BIND_WAILA_TESTING= "waila.keybind.testing";
|
||||
|
||||
public static String CFG_NEI_SHOW = "world.highlight_tips";
|
||||
public static String BIND_NEI_SHOW = "keys.world.highlight_tips";
|
||||
|
||||
public static String CFG_WAILA_SHOW = "waila.cfg.show";
|
||||
public static String CFG_WAILA_MODE = "waila.cfg.showmode";
|
||||
public static String CFG_WAILA_LIQUID = "waila.cfg.liquid";
|
||||
public static String CFG_WAILA_METADATA = "waila.cfg.metadata";
|
||||
public static String CFG_WAILA_KEYBIND = "waila.cfg.keybind";
|
||||
public static String CFG_WAILA_POSX = "waila.cfg.posx";
|
||||
public static String CFG_WAILA_POSY = "waila.cfg.posy";
|
||||
public static String CFG_WAILA_SCALE = "waila.cfg.scale";
|
||||
|
||||
|
||||
public static String CFG_WAILA_ALPHA = "waila.cfg.alpha";
|
||||
public static String CFG_WAILA_BGCOLOR = "waila.cfg.bgcolor";
|
||||
public static String CFG_WAILA_GRADIENT1 = "waila.cfg.gradient1";
|
||||
public static String CFG_WAILA_GRADIENT2 = "waila.cfg.gradient2";
|
||||
public static String CFG_WAILA_FONTCOLOR = "waila.cfg.fontcolor";
|
||||
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package mcp.mobius.waila;
|
||||
|
||||
public class SpecialChars {
|
||||
|
||||
public static String MCStyle = "\u00A7";
|
||||
|
||||
public static String BLACK = MCStyle + "0";
|
||||
public static String DBLUE = MCStyle + "1";
|
||||
public static String DGREEN = MCStyle + "2";
|
||||
public static String DAQUA = MCStyle + "3";
|
||||
public static String DRED = MCStyle + "4";
|
||||
public static String DPURPLE = MCStyle + "5";
|
||||
public static String GOLD = MCStyle + "6";
|
||||
public static String GRAY = MCStyle + "7";
|
||||
public static String DGRAY = MCStyle + "8";
|
||||
public static String BLUE = MCStyle + "9";
|
||||
public static String GREEN = MCStyle + "a";
|
||||
public static String AQUA = MCStyle + "b";
|
||||
public static String RED = MCStyle + "c";
|
||||
public static String LPURPLE = MCStyle + "d";
|
||||
public static String YELLOW = MCStyle + "e";
|
||||
public static String WHITE = MCStyle + "f";
|
||||
|
||||
public static String OBF = MCStyle + "k";
|
||||
public static String BOLD = MCStyle + "l";
|
||||
public static String STRIKE = MCStyle + "m";
|
||||
public static String UNDER = MCStyle + "n";
|
||||
public static String ITALIC = MCStyle + "o";
|
||||
public static String RESET = MCStyle + "r";
|
||||
|
||||
public static String WailaStyle = "\u00A4";
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package mcp.mobius.waila;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class WailaExceptionHandler {
|
||||
|
||||
public WailaExceptionHandler() {}
|
||||
|
||||
private static ArrayList<String> errs = new ArrayList<String>();
|
||||
|
||||
public static List<String> handleErr(Throwable e, String className, List<String> currenttip){
|
||||
if (!errs.contains(className)){
|
||||
errs.add(className);
|
||||
|
||||
for (StackTraceElement elem : e.getStackTrace()){
|
||||
mod_Waila.log.log(Level.WARNING, String.format("%s.%s:%s",elem.getClassName(), elem.getMethodName(), elem.getLineNumber()));
|
||||
if (elem.getClassName().contains("waila")) break;
|
||||
}
|
||||
|
||||
mod_Waila.log.log(Level.WARNING, String.format("Catched unhandled exception : [%s] %s",className,e));
|
||||
}
|
||||
if (currenttip != null)
|
||||
currenttip.add("<ERROR>");
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package mcp.mobius.waila.addons.appeng;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import codechicken.lib.lang.LangUtil;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
public class AppEngModule {
|
||||
|
||||
public static Class TileStorageMonitor = null;
|
||||
public static Class IAEItemStack = null;
|
||||
public static Method TileStorageMonitor_getItem = null;
|
||||
public static Method IAEItemStack_getItemStack = null;
|
||||
|
||||
public static void register(){
|
||||
try{
|
||||
TileStorageMonitor = Class.forName("appeng.me.tile.TileStorageMonitor");
|
||||
IAEItemStack = Class.forName("appeng.api.IAEItemStack");
|
||||
|
||||
|
||||
TileStorageMonitor_getItem = TileStorageMonitor.getMethod("getItem");
|
||||
IAEItemStack_getItemStack = IAEItemStack.getMethod("getItemStack");
|
||||
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[AppEng] Class not found. " + e);
|
||||
return;
|
||||
} catch (SecurityException e) {
|
||||
mod_Waila.log.log(Level.WARNING, "[AppEng] Security Exception. " + e);
|
||||
return;
|
||||
} catch (NoSuchMethodException e) {
|
||||
mod_Waila.log.log(Level.WARNING, "[AppEng] Method not found. " + e);
|
||||
return;
|
||||
}
|
||||
|
||||
mod_Waila.log.log(Level.INFO, "AppEng mod found.");
|
||||
ModuleRegistrar.instance().addConfig("Applied Energetic", "appeng.monitorcontent");
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDAppEngMonitor(), TileStorageMonitor);
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package mcp.mobius.waila.addons.appeng;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.List;
|
||||
|
||||
import codechicken.lib.lang.LangUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDAppEngMonitor implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
TileEntity entity = accessor.getTileEntity();
|
||||
if (entity != null){
|
||||
if (config.getConfig("appeng.monitorcontent")){
|
||||
try {
|
||||
ItemStack stack = (ItemStack)AppEngModule.IAEItemStack_getItemStack.invoke(AppEngModule.IAEItemStack.cast(AppEngModule.TileStorageMonitor_getItem.invoke(entity)));
|
||||
if (stack != null)
|
||||
currenttip.add(stack.getDisplayName());
|
||||
else
|
||||
currenttip.add(LangUtil.translateG("hud.msg.none"));
|
||||
} catch (Exception e) {
|
||||
System.out.printf("%s\n", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package mcp.mobius.waila.addons.betterbarrels;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
import codechicken.lib.lang.LangUtil;
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.ItemInfo;
|
||||
|
||||
public class BetterBarrelsModule {
|
||||
public static Class TileEntityBarrel = null;
|
||||
public static Class IBarrelStorage = null;
|
||||
public static Field TileEntityBarrel_Storage = null;
|
||||
public static Method IBarrelStorage_getItem = null;
|
||||
|
||||
public static void register(){
|
||||
try{
|
||||
TileEntityBarrel = Class.forName("mcp.mobius.betterbarrels.common.TileEntityBarrel");
|
||||
IBarrelStorage = Class.forName("mcp.mobius.betterbarrels.common.IBarrelStorage");
|
||||
TileEntityBarrel_Storage = TileEntityBarrel.getField("storage");
|
||||
IBarrelStorage_getItem = IBarrelStorage.getMethod("getItem");
|
||||
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[BB] BetterBarrel classes not found.");
|
||||
} catch (NoSuchFieldException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[BB] Storage field not found.");
|
||||
} catch (NoSuchMethodException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[BB] getItem() not found.");
|
||||
}
|
||||
|
||||
if (IBarrelStorage_getItem != null){
|
||||
mod_Waila.log.log(Level.INFO, "Waila module BetterBarrel succefully hooked.");
|
||||
ModuleRegistrar.instance().addConfig("BetterBarrels", "bb.content");
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerBBContent(), TileEntityBarrel);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
package mcp.mobius.waila.addons.betterbarrels;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
//import mcp.mobius.betterbarrels.common.TileEntityBarrel;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import codechicken.lib.lang.LangUtil;
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.ItemInfo;
|
||||
import codechicken.nei.api.ItemInfo.Layout;
|
||||
import codechicken.nei.api.IHighlightHandler;
|
||||
|
||||
public class HUDHandlerBBContent implements IWailaDataProvider {
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
TileEntity entity = accessor.getTileEntity();
|
||||
|
||||
if (!config.getConfig("bb.content")) return currenttip;
|
||||
|
||||
if ((entity != null) && (BetterBarrelsModule.TileEntityBarrel.isInstance(entity))){
|
||||
ItemStack stack = null;
|
||||
try {
|
||||
stack = (ItemStack) BetterBarrelsModule.IBarrelStorage_getItem.invoke(BetterBarrelsModule.TileEntityBarrel_Storage.get(entity));
|
||||
} catch (Exception e){
|
||||
mod_Waila.log.log(Level.SEVERE, "[BB] Unhandled exception trying to access a barrel storage for display !.\n" + String.valueOf(e));
|
||||
currenttip.add("<ERROR!>");
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
if (stack != null){
|
||||
currenttip.add(stack.getDisplayName());
|
||||
} else {
|
||||
currenttip.add(LangUtil.translateG("hud.msg.empty"));
|
||||
}
|
||||
}
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package mcp.mobius.waila.addons.buildcraft;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public class BCModule {
|
||||
|
||||
public static Class TileTank = null;
|
||||
public static Class IPowerReceptor = null;
|
||||
public static Class PipeTransportPower = null;
|
||||
public static Class TileGenericPipe = null;
|
||||
public static Class TileEngine = null;
|
||||
|
||||
public static Method TileTank_getTankInfo = null;
|
||||
|
||||
public static void register(){
|
||||
try {
|
||||
Class ModBuildcraftFactory = Class.forName("buildcraft.BuildCraftFactory");
|
||||
mod_Waila.log.log(Level.INFO, "Buildcraft|Factory mod found.");
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.INFO, "Buildcraft|Factory mod not found. Skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
try{
|
||||
TileTank = Class.forName("buildcraft.factory.TileTank");
|
||||
TileTank_getTankInfo = TileTank.getMethod("getTankInfo", ForgeDirection.class);
|
||||
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[BC] Class not found. " + e);
|
||||
return;
|
||||
} catch (NoSuchMethodException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[BC] Method not found." + e);
|
||||
return;
|
||||
}
|
||||
|
||||
ModuleRegistrar.instance().addConfig("Buildcraft", "bc.tankamount");
|
||||
ModuleRegistrar.instance().addConfig("Buildcraft", "bc.tanktype");
|
||||
ModuleRegistrar.instance().registerHeadProvider(new HUDHandlerBCTanks(), TileTank);
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerBCTanks(), TileTank);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
package mcp.mobius.waila.addons.buildcraft;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
public class BCPowerAPIModule {
|
||||
|
||||
public static Class PowerHandler = null;
|
||||
public static Method PH_getMinEnergyReceived = null;
|
||||
public static Method PH_getMaxEnergyReceived = null;
|
||||
public static Method PH_getMaxEnergyStored = null;
|
||||
public static Method PH_getEnergyStored = null;
|
||||
public static Method PH_getActivationEnergy = null;
|
||||
|
||||
public static Class IPowerReceptor = null;
|
||||
public static Method IPowerReceptor_getPowerReceiver = null;
|
||||
|
||||
public static Class PowerReceiver = null;
|
||||
public static Method PR_getMinEnergyReceived = null;
|
||||
public static Method PR_getMaxEnergyReceived = null;
|
||||
public static Method PR_getMaxEnergyStored = null;
|
||||
public static Method PR_getEnergyStored = null;
|
||||
public static Method PR_getActivationEnergy = null;
|
||||
|
||||
public static void register(){
|
||||
try{
|
||||
Class ModClass = Class.forName("buildcraft.api.power.IPowerReceptor");
|
||||
mod_Waila.log.log(Level.INFO, "Buildcraft Power API found.");
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.INFO, "[Buildcraft Power API] Buildcraft Power API mod not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
try{
|
||||
PowerHandler = Class.forName("buildcraft.api.power.PowerHandler");
|
||||
PH_getMinEnergyReceived = PowerHandler.getMethod("getMinEnergyReceived");
|
||||
PH_getMaxEnergyReceived = PowerHandler.getMethod("getMaxEnergyReceived");
|
||||
PH_getMaxEnergyStored = PowerHandler.getMethod("getMaxEnergyStored");
|
||||
PH_getEnergyStored = PowerHandler.getMethod("getEnergyStored");
|
||||
PH_getActivationEnergy = PowerHandler.getMethod("getActivationEnergy");
|
||||
|
||||
IPowerReceptor = Class.forName("buildcraft.api.power.IPowerReceptor");
|
||||
IPowerReceptor_getPowerReceiver = IPowerReceptor.getMethod("getPowerReceiver", ForgeDirection.class);
|
||||
|
||||
PowerReceiver = Class.forName("buildcraft.api.power.PowerHandler$PowerReceiver");
|
||||
PR_getMinEnergyReceived = PowerReceiver.getMethod("getMinEnergyReceived");
|
||||
PR_getMaxEnergyReceived = PowerReceiver.getMethod("getMaxEnergyReceived");
|
||||
PR_getMaxEnergyStored = PowerReceiver.getMethod("getMaxEnergyStored");
|
||||
PR_getEnergyStored = PowerReceiver.getMethod("getEnergyStored");
|
||||
PR_getActivationEnergy = PowerReceiver.getMethod("getActivationEnergy");
|
||||
|
||||
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Class not found. " + e);
|
||||
return;
|
||||
} catch (NoSuchMethodException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Method not found." + e);
|
||||
return;
|
||||
// } catch (NoSuchFieldException e){
|
||||
// mod_Waila.log.log(Level.WARNING, "[EnderStorage] Field not found." + e);
|
||||
// return;
|
||||
} catch (Exception e){
|
||||
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Unhandled exception." + e);
|
||||
return;
|
||||
}
|
||||
|
||||
ModuleRegistrar.instance().addConfigRemote("BuildcraftAPI", "bcapi.storage");
|
||||
ModuleRegistrar.instance().addConfig("BuildcraftAPI", "bcapi.consump");
|
||||
ModuleRegistrar.instance().addConfig("BuildcraftAPI", "bcapi.trigger");
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerIPowerReceptor(), IPowerReceptor);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
package mcp.mobius.waila.addons.buildcraft;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
//import buildcraft.factory.TileTank;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import codechicken.lib.lang.LangUtil;
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.impl.ConfigHandler;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import net.minecraftforge.liquids.ILiquidTank;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
|
||||
public class HUDHandlerBCTanks implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
FluidTankInfo tank = this.getTank(accessor);
|
||||
FluidStack stack = tank != null ? tank.fluid : null;
|
||||
|
||||
|
||||
String name = currenttip.get(0);
|
||||
if (stack != null && ConfigHandler.instance().getConfig("bc.tanktype"))
|
||||
name = name + " (" + stack.getFluid().getName() + ")";
|
||||
else if (stack == null && ConfigHandler.instance().getConfig("bc.tanktype"))
|
||||
name = name + " " + LangUtil.translateG("hud.msg.empty");
|
||||
currenttip.set(0, name);
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
FluidTankInfo tank = this.getTank(accessor);
|
||||
FluidStack stack = tank != null ? tank.fluid : null;
|
||||
int liquidAmount = stack != null ? stack.amount:0;
|
||||
int capacity = tank != null ? tank.capacity : 0;
|
||||
|
||||
if (ConfigHandler.instance().getConfig("bc.tankamount"))
|
||||
currenttip.add(String.valueOf(liquidAmount) + "/" + String.valueOf(capacity) + " mB");
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
public FluidTankInfo getTank(IWailaDataAccessor accessor){
|
||||
FluidTankInfo tank = null;
|
||||
try{
|
||||
tank = ((FluidTankInfo[])BCModule.TileTank_getTankInfo.invoke(BCModule.TileTank.cast(accessor.getTileEntity()), ForgeDirection.UNKNOWN))[0];
|
||||
} catch (Exception e){
|
||||
mod_Waila.log.log(Level.SEVERE, "[BC] Unhandled exception trying to access a tank for display !.\n" + String.valueOf(e));
|
||||
return null;
|
||||
}
|
||||
return tank;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
package mcp.mobius.waila.addons.buildcraft;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import codechicken.lib.lang.LangUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import mcp.mobius.waila.WailaExceptionHandler;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDHandlerIPowerReceptor implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
|
||||
try{
|
||||
|
||||
String maxPowerStr = LangUtil.translateG("hud.msg.maxpower");
|
||||
String triggerStr = LangUtil.translateG("hud.msg.trigger");
|
||||
|
||||
Object powerReceiver = BCPowerAPIModule.IPowerReceptor_getPowerReceiver.invoke(accessor.getTileEntity(), ForgeDirection.UNKNOWN);
|
||||
if (powerReceiver != null){
|
||||
|
||||
Float minEnergyRecv = (Float)BCPowerAPIModule.PR_getMinEnergyReceived.invoke(powerReceiver);
|
||||
Float maxEnergyRecv = (Float)BCPowerAPIModule.PR_getMaxEnergyReceived.invoke(powerReceiver);
|
||||
Float activation = (Float)BCPowerAPIModule.PR_getActivationEnergy.invoke(powerReceiver);
|
||||
|
||||
|
||||
if(accessor.getNBTData().hasKey("powerProvider") && accessor.getNBTData().getCompoundTag("powerProvider").hasKey("storedEnergy") && config.getConfig("bcapi.storage")){
|
||||
Float energyStored = (Float)accessor.getNBTData().getCompoundTag("powerProvider").getFloat("storedEnergy");
|
||||
Float maxEnergyStor = (Float)BCPowerAPIModule.PR_getMaxEnergyStored.invoke(powerReceiver);
|
||||
if (maxEnergyStor != 0.0f)
|
||||
currenttip.add(String.format("%.1f / %.1f MJ", energyStored, maxEnergyStor));
|
||||
}
|
||||
|
||||
if(accessor.getNBTData().hasKey("storedEnergy") && config.getConfig("bcapi.storage")){
|
||||
Float energyStored = (Float)accessor.getNBTData().getFloat("storedEnergy");
|
||||
Float maxEnergyStor = (Float)BCPowerAPIModule.PR_getMaxEnergyStored.invoke(powerReceiver);
|
||||
if (maxEnergyStor != 0.0f)
|
||||
currenttip.add(String.format("%.1f / %.1f MJ", energyStored, maxEnergyStor));
|
||||
}
|
||||
|
||||
/*
|
||||
if (maxEnergyRecv != 0.0f && config.getConfig("bcapi.consump"))
|
||||
//currenttip.add(String.format("Min/Max Input : %.1f / %.1f MJ/t", minEnergyRecv, maxEnergyRecv));
|
||||
currenttip.add(String.format("%s : %.1f MJ/t", maxPowerStr, maxEnergyRecv));
|
||||
|
||||
if (activation != 0.0f && config.getConfig("bcapi.trigger"))
|
||||
currenttip.add(String.format("%s : %.1f MJ", triggerStr, activation));
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
package mcp.mobius.waila.addons.enderio;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.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");
|
||||
mod_Waila.log.log(Level.INFO, "EnderIO mod found.");
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.INFO, "[EnderIO] EnderIO mod not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
try{
|
||||
|
||||
TileCapacitorBank = Class.forName("crazypants.enderio.machine.power.TileCapacitorBank");
|
||||
TCB_getEnergyStored = TileCapacitorBank.getMethod("getEnergyStored");
|
||||
TCB_getMaxInput = TileCapacitorBank.getMethod("getMaxInput");
|
||||
TCB_getMaxOutput = TileCapacitorBank.getMethod("getMaxOutput");
|
||||
TCB_getMaxEnergyStored = TileCapacitorBank.getMethod("getMaxEnergyStored");
|
||||
TCB_getMaxIO = TileCapacitorBank.getMethod("getMaxIO");
|
||||
|
||||
TileTesseract = Class.forName("crazypants.enderio.machine.hypercube.TileHyperCube");
|
||||
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Class not found. " + e);
|
||||
return;
|
||||
} catch (NoSuchMethodException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Method not found." + e);
|
||||
return;
|
||||
// } catch (NoSuchFieldException e){
|
||||
// mod_Waila.log.log(Level.WARNING, "[EnderStorage] Field not found." + e);
|
||||
// return;
|
||||
} catch (Exception e){
|
||||
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Unhandled exception." + e);
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
package mcp.mobius.waila.addons.enderio;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import codechicken.lib.lang.LangUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import mcp.mobius.waila.WailaExceptionHandler;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDHandlerCapacitor implements IWailaDataProvider{
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
|
||||
try{
|
||||
|
||||
String maxIOStr = LangUtil.translateG("hud.msg.maxio");
|
||||
String inputStr = LangUtil.translateG("hud.msg.input");
|
||||
String outputStr = LangUtil.translateG("hud.msg.output");
|
||||
|
||||
Integer maxEnergyStored = (Integer)EnderIOModule.TCB_getMaxEnergyStored.invoke(accessor.getTileEntity());
|
||||
Float energyStored = (Float)EnderIOModule.TCB_getEnergyStored.invoke(accessor.getTileEntity());
|
||||
Integer maxIO = (Integer)EnderIOModule.TCB_getMaxIO.invoke(accessor.getTileEntity());
|
||||
Integer maxInput = (Integer)EnderIOModule.TCB_getMaxInput.invoke(accessor.getTileEntity());
|
||||
Integer maxOutput = (Integer)EnderIOModule.TCB_getMaxOutput.invoke(accessor.getTileEntity());
|
||||
|
||||
if (config.getConfig("enderio.storage"))
|
||||
currenttip.add(String.format("%.1f / %d MJ", energyStored, maxEnergyStored));
|
||||
|
||||
if (config.getConfig("enderio.inout")){
|
||||
currenttip.add(String.format("%s : %d MJ/t ", maxIOStr, maxIO));
|
||||
currenttip.add(String.format("%s : %d MJ/t ", inputStr, maxInput));
|
||||
currenttip.add(String.format("%s : %d MJ/t ", outputStr, maxOutput));
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
package mcp.mobius.waila.addons.enderio;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import codechicken.lib.lang.LangUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDHandlerTesseract implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
|
||||
String channel = "%s : \u00a7f%s\u00a7r %s";
|
||||
String freq;
|
||||
String frequser;
|
||||
String owner;
|
||||
|
||||
if (config.getConfig("enderio.channel")){
|
||||
|
||||
if (accessor.getNBTData().hasKey("channelName")){
|
||||
freq = accessor.getNBTData().getString("channelName");
|
||||
|
||||
if (accessor.getNBTData().hasKey("channelUser"))
|
||||
frequser = "[ \u00a7f" + accessor.getNBTData().getString("channelUser") + " \u00a7r]";
|
||||
else
|
||||
frequser = "[ \u00a7f" + LangUtil.translateG("hud.msg.public") + " \u00a7r]";
|
||||
|
||||
}
|
||||
else{
|
||||
freq = LangUtil.translateG("hud.msg.none");
|
||||
frequser = "";
|
||||
}
|
||||
|
||||
currenttip.add(String.format(channel, LangUtil.translateG("hud.msg.frequency"), freq, frequser));
|
||||
}
|
||||
|
||||
if (config.getConfig("enderio.owner")){
|
||||
if (accessor.getNBTData().hasKey("owner"))
|
||||
currenttip.add(String.format("%s : \u00a7f%s", LangUtil.translateG("hud.msg.owner"), accessor.getNBTData().getString("owner")));
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
package mcp.mobius.waila.addons.enderstorage;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.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");
|
||||
mod_Waila.log.log(Level.INFO, "EnderStorage mod found.");
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.INFO, "[EnderStorage] EnderStorage mod not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
try{
|
||||
|
||||
TileFrequencyOwner = Class.forName("codechicken.enderstorage.common.TileFrequencyOwner");
|
||||
TileFrequencyOwner_Freq = TileFrequencyOwner.getField("freq");
|
||||
|
||||
EnderStorageManager = Class.forName("codechicken.enderstorage.api.EnderStorageManager");
|
||||
GetColourFromFreq = EnderStorageManager.getDeclaredMethod("getColourFromFreq", Integer.TYPE, Integer.TYPE);
|
||||
|
||||
TileEnderTank = Class.forName("codechicken.enderstorage.storage.liquid.TileEnderTank");
|
||||
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Class not found. " + e);
|
||||
return;
|
||||
} catch (NoSuchMethodException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Method not found." + e);
|
||||
return;
|
||||
} catch (NoSuchFieldException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Field not found." + e);
|
||||
return;
|
||||
} catch (Exception e){
|
||||
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Unhandled exception." + e);
|
||||
return;
|
||||
}
|
||||
|
||||
ModuleRegistrar.instance().addConfig("EnderStorage", "enderstorage.colors");
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerStorage(), TileFrequencyOwner);
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
package mcp.mobius.waila.addons.enderstorage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import codechicken.lib.lang.LangUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import mcp.mobius.waila.WailaExceptionHandler;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDHandlerStorage implements IWailaDataProvider {
|
||||
|
||||
private static String[] colors = {
|
||||
LangUtil.translateG("hud.msg.white"),
|
||||
LangUtil.translateG("hud.msg.orange"),
|
||||
LangUtil.translateG("hud.msg.magenta"),
|
||||
LangUtil.translateG("hud.msg.lblue"),
|
||||
LangUtil.translateG("hud.msg.yellow"),
|
||||
LangUtil.translateG("hud.msg.lime"),
|
||||
LangUtil.translateG("hud.msg.pink"),
|
||||
LangUtil.translateG("hud.msg.gray"),
|
||||
LangUtil.translateG("hud.msg.lgray"),
|
||||
LangUtil.translateG("hud.msg.cyan"),
|
||||
LangUtil.translateG("hud.msg.purple"),
|
||||
LangUtil.translateG("hud.msg.blue"),
|
||||
LangUtil.translateG("hud.msg.brown"),
|
||||
LangUtil.translateG("hud.msg.green"),
|
||||
LangUtil.translateG("hud.msg.red"),
|
||||
LangUtil.translateG("hud.msg.black")
|
||||
};
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
if(config.getConfig("enderstorage.colors")){
|
||||
try{
|
||||
|
||||
int freq = EnderStorageModule.TileFrequencyOwner_Freq.getInt(accessor.getTileEntity());
|
||||
int freqLeft = (Integer)EnderStorageModule.GetColourFromFreq.invoke(null, freq, 0);
|
||||
int freqCenter = (Integer)EnderStorageModule.GetColourFromFreq.invoke(null, freq, 1);
|
||||
int freqRight = (Integer)EnderStorageModule.GetColourFromFreq.invoke(null, freq, 2);
|
||||
|
||||
if (!EnderStorageModule.TileEnderTank.isInstance(accessor.getTileEntity()))
|
||||
currenttip.add(String.format("%s/%s/%s", colors[freqLeft], colors[freqCenter], colors[freqRight]));
|
||||
else
|
||||
currenttip.add(String.format("%s/%s/%s", colors[freqRight], colors[freqCenter], colors[freqLeft]));
|
||||
|
||||
|
||||
} catch (Exception e){
|
||||
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
package mcp.mobius.waila.addons.etb;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.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");
|
||||
mod_Waila.log.log(Level.INFO, "Engineer Toolbox mod found.");
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.INFO, "[Engineer Toolbox] Engineer Toolbox mod not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
try{
|
||||
|
||||
TileSocket = Class.forName("emasher.sockets.TileSocket");
|
||||
Socket_sides = TileSocket.getField("sides");
|
||||
Socket_configs = TileSocket.getField("configs");
|
||||
//Socket_sideID = TileSocket.getField("sideID");
|
||||
//Socket_sideMeta = TileSocket.getField("sideMeta");
|
||||
//Socket_facID = TileSocket.getField("facID");
|
||||
//Socket_facMeta = TileSocket.getField("facMeta");
|
||||
|
||||
SocketsMod = Class.forName("emasher.sockets.SocketsMod");
|
||||
module = SocketsMod.getField("module");
|
||||
//module = (Item)SocketsMod.getField("module").get(null);
|
||||
/*
|
||||
if (module == null){
|
||||
mod_Waila.log.log(Level.WARNING, "[Engineer Toolbox] module field is null !");
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
SideConfig = Class.forName("emasher.api.SideConfig");
|
||||
SC_tank = SideConfig.getField("tank");
|
||||
SC_inventory = SideConfig.getField("inventory");
|
||||
SC_rsControl = SideConfig.getField("rsControl");
|
||||
SC_rsLatch = SideConfig.getField("rsLatch");
|
||||
|
||||
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[Engineer Toolbox] Class not found. " + e);
|
||||
return;
|
||||
// } catch (NoSuchMethodException e){
|
||||
// mod_Waila.log.log(Level.WARNING, "[Engineer Toolbox] Method not found." + e);
|
||||
// return;
|
||||
} catch (NoSuchFieldException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[Engineer Toolbox] Field not found." + e);
|
||||
return;
|
||||
} catch (Exception e){
|
||||
mod_Waila.log.log(Level.WARNING, "[Engineer Toolbox] Unhandled exception." + e);
|
||||
return;
|
||||
}
|
||||
|
||||
ModuleRegistrar.instance().addConfig("Engineer Toolbox", "etb.displaydata");
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerSocket(), TileSocket);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
package mcp.mobius.waila.addons.etb;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import mcp.mobius.waila.WailaExceptionHandler;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDHandlerSocket implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
if (!config.getConfig("etb.displaydata")) return currenttip;
|
||||
|
||||
try {
|
||||
int[] sides = (int[])ETBModule.Socket_sides.get(accessor.getTileEntity());
|
||||
Object[] configs = (Object[])ETBModule.Socket_configs.get(accessor.getTileEntity());
|
||||
Item module = (Item)ETBModule.module.get(null);
|
||||
|
||||
|
||||
for( int s = 0; s < 6; s++){
|
||||
if (sides[s] != 0){
|
||||
|
||||
int tank = (Integer)ETBModule.SC_tank.get(configs[s]);
|
||||
int inventory = (Integer)ETBModule.SC_inventory.get(configs[s]);
|
||||
boolean[] rsControl = (boolean[])ETBModule.SC_rsControl.get(configs[s]);
|
||||
boolean[] rsLatch = (boolean[])ETBModule.SC_rsLatch.get(configs[s]);
|
||||
|
||||
|
||||
ItemStack stack = new ItemStack(module, 1, sides[s]);
|
||||
String tipstr = String.format("%-5s : %s ", ForgeDirection.getOrientation(s), stack.getDisplayName());
|
||||
|
||||
String configstr = "[ ";
|
||||
|
||||
if (tank != -1)
|
||||
configstr += "\u00a79" + String.valueOf(tank) + " ";
|
||||
|
||||
if (inventory != -1)
|
||||
configstr += "\u00a7a" + String.valueOf(inventory) + " ";
|
||||
|
||||
if (rsControl[0] || rsControl[1] || rsControl[2]){
|
||||
configstr += "\u00a7c";
|
||||
configstr += rsControl[0] ? "1" : "0";
|
||||
configstr += rsControl[1] ? "1" : "0";
|
||||
configstr += rsControl[2] ? "1" : "0";
|
||||
configstr += " ";
|
||||
}
|
||||
|
||||
if (rsLatch[0] || rsLatch[1] || rsLatch[2]){
|
||||
configstr += "\u00a75";
|
||||
configstr += rsLatch[0] ? "1" : "0";
|
||||
configstr += rsLatch[1] ? "1" : "0";
|
||||
configstr += rsLatch[2] ? "1" : "0";
|
||||
configstr += " ";
|
||||
}
|
||||
|
||||
configstr += "\u00a7r]";
|
||||
|
||||
if (!configstr.equals("[ \u00a7r]"))
|
||||
tipstr += " " + configstr;
|
||||
|
||||
/*
|
||||
if ((tank != -1) && (inventory != -1))
|
||||
tipstr += String.format("[ \u00a79%d \u00a7a%d \u00a7r]", tank, inventory);
|
||||
else if (tank != -1)
|
||||
tipstr += String.format("[ \u00a79%d \u00a7r]", tank);
|
||||
else if (inventory != -1)
|
||||
tipstr += String.format("[ \u00a7a%d \u00a7r]", inventory);
|
||||
*/
|
||||
|
||||
currenttip.add(tipstr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package mcp.mobius.waila.addons.exu;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
public class ExtraUtilitiesModule {
|
||||
|
||||
public static Class ModExtraUtilities = null;
|
||||
public static Class TileEntityDrum = null;
|
||||
|
||||
public static void register(){
|
||||
|
||||
|
||||
try{
|
||||
Class ModExtraUtilities = Class.forName("extrautils.ExtraUtils");
|
||||
mod_Waila.log.log(Level.INFO, "ExtraUtilities mod found.");
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.INFO, "[ExtraUtilities] ExtraUtilities mod not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
try{
|
||||
TileEntityDrum = Class.forName("extrautils.tileentity.TileEntityDrum");
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[ExtraUtilities] Class not found. " + e);
|
||||
return;
|
||||
}
|
||||
|
||||
ModuleRegistrar.instance().addConfigRemote("ExtraUtilities", "extrautilities.fluidamount");
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerDrum(), TileEntityDrum);
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package mcp.mobius.waila.addons.exu;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDHandlerDrum implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
|
||||
if (!config.getConfig("extrautilities.fluidamount")) return currenttip;
|
||||
|
||||
int amount = 0;
|
||||
|
||||
NBTTagCompound subtag = accessor.getNBTData().getCompoundTag("tank");
|
||||
if (subtag.hasKey("Amount"))
|
||||
amount = accessor.getNBTInteger(subtag, "Amount");
|
||||
|
||||
IFluidHandler handler = (IFluidHandler)accessor.getTileEntity();
|
||||
if (handler == null) return currenttip;
|
||||
|
||||
FluidTankInfo[] tanks = handler.getTankInfo(ForgeDirection.UNKNOWN);
|
||||
if (tanks.length != 1) return currenttip;
|
||||
|
||||
currenttip.add(String.format("%d / %d mB", amount, tanks[0].capacity));
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package mcp.mobius.waila.addons.gravestone;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
public class GravestoneModule {
|
||||
|
||||
public static Class BlockGraveStone = null;
|
||||
|
||||
public static void register(){
|
||||
|
||||
try{
|
||||
Class ModGravestone = Class.forName("GraveStone.ModGraveStone");
|
||||
mod_Waila.log.log(Level.INFO, "GraveStone mod found.");
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.INFO, "[GraveStone] GraveStone mod not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
BlockGraveStone = Class.forName("GraveStone.block.BlockGSGraveStone");
|
||||
} catch (ClassNotFoundException e) {
|
||||
mod_Waila.log.log(Level.WARNING, "[GraveStone] Class not found. " + e);
|
||||
}
|
||||
|
||||
|
||||
ModuleRegistrar.instance().registerStackProvider(new HUDHandlerGravestone(), BlockGraveStone);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package mcp.mobius.waila.addons.gravestone;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDHandlerGravestone implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return new ItemStack(accessor.getBlock(), 0, accessor.getMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
package mcp.mobius.waila.addons.ic2;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import codechicken.lib.lang.LangUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import mcp.mobius.waila.WailaExceptionHandler;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.impl.ConfigHandler;
|
||||
|
||||
public class HUDHandlerTEBaseGenerator implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
|
||||
try{
|
||||
int storage = -1;
|
||||
int production = -1;
|
||||
|
||||
if (IC2Module.TileEntityBaseGenerator.isInstance(accessor.getTileEntity())){
|
||||
storage = IC2Module.TEBG_MaxStorage.getShort(accessor.getTileEntity());
|
||||
production = IC2Module.TEBG_Production.getInt(accessor.getTileEntity());
|
||||
}
|
||||
else if (IC2Module.TileEntityGeoGenerator.isInstance(accessor.getTileEntity())){
|
||||
storage = IC2Module.TEGG_MaxStorage.getShort(accessor.getTileEntity());
|
||||
production = IC2Module.TEGG_Production.getInt(accessor.getTileEntity());
|
||||
}
|
||||
else if (IC2Module.TileEntitySemifluidGenerator.isInstance(accessor.getTileEntity())){
|
||||
storage = IC2Module.TESG_MaxStorage.getShort(accessor.getTileEntity());
|
||||
production = (int)IC2Module.TESG_Production.getDouble(accessor.getTileEntity());
|
||||
}
|
||||
|
||||
String storedStr = LangUtil.translateG("hud.msg.stored");
|
||||
String outputStr = LangUtil.translateG("hud.msg.output");
|
||||
|
||||
/* EU Storage */
|
||||
if (ConfigHandler.instance().getConfig("ic2.storage")){
|
||||
double stored = IC2Module.getStoredEnergy(accessor);
|
||||
|
||||
if ( stored >= 0.0 && storage > 0)
|
||||
currenttip.add(String.format("%s : \u00a7f%d\u00a7r / \u00a7f%d\u00a7r EU", storedStr, Math.round(Math.min(stored,storage)), storage));
|
||||
|
||||
//else if (stored >= 0.0)
|
||||
// currenttip.add(String.format("Stored : %d EU", stored));
|
||||
}
|
||||
|
||||
if (ConfigHandler.instance().getConfig("ic2.outputeu")){
|
||||
if ( production > 0)
|
||||
currenttip.add(String.format("%s : \u00a7f%d\u00a7r EU/t", outputStr, production));
|
||||
}
|
||||
|
||||
} catch (Exception e){
|
||||
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
package mcp.mobius.waila.addons.ic2;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import codechicken.lib.lang.LangUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import mcp.mobius.waila.WailaExceptionHandler;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.impl.ConfigHandler;
|
||||
|
||||
public class HUDHandlerTEElectricBlock implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
|
||||
try{
|
||||
String storedStr = LangUtil.translateG("hud.msg.stored");
|
||||
String outputStr = LangUtil.translateG("hud.msg.output");
|
||||
|
||||
/* EU Storage */
|
||||
if (ConfigHandler.instance().getConfig("ic2.storage")){
|
||||
double stored = IC2Module.getStoredEnergy(accessor);
|
||||
int storage = IC2Module.TEEB_MaxStorage.getInt(accessor.getTileEntity());
|
||||
|
||||
if ( stored >= 0.0 )
|
||||
currenttip.add(String.format("%s : \u00a7f%d\u00a7r / \u00a7f%d\u00a7r EU", storedStr, Math.round(Math.min(stored,storage)), storage));
|
||||
}
|
||||
|
||||
if (ConfigHandler.instance().getConfig("ic2.outputeu")){
|
||||
int production = IC2Module.TEEB_Output.getInt(accessor.getTileEntity());
|
||||
if ( production > 0)
|
||||
currenttip.add(String.format("%s : \u00a7f%d\u00a7r EU/t", outputStr, production));
|
||||
}
|
||||
|
||||
} catch (Exception e){
|
||||
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
package mcp.mobius.waila.addons.ic2;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import codechicken.lib.lang.LangUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import mcp.mobius.waila.WailaExceptionHandler;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.impl.ConfigHandler;
|
||||
|
||||
public class HUDHandlerTEStandardMachine implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor,
|
||||
IWailaConfigHandler config) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
|
||||
try{
|
||||
|
||||
IC2Upgrades upgrades = IC2Module.getUpgrades(accessor);
|
||||
int baseConsumption = IC2Module.TESM_DefaultEnergyConsume.getInt(accessor.getTileEntity());
|
||||
int baseOpTime = IC2Module.TESM_DefaultOperationLength.getInt(accessor.getTileEntity());
|
||||
int baseStorage = IC2Module.TESM_DefaultEnergyStorage.getInt(accessor.getTileEntity());
|
||||
|
||||
long consumption = Math.round(Math.min(baseConsumption * Math.pow(1.6D, upgrades.overclocker), 2147483647));
|
||||
|
||||
double stackOpLen = baseOpTime * 64.0D * Math.pow(0.7D, upgrades.overclocker);
|
||||
int opPerTick = ((int)Math.min(Math.ceil(64.0D / stackOpLen), 2147483647.0D));
|
||||
int opTime = ((int)Math.round(stackOpLen * opPerTick / 64.0D));
|
||||
|
||||
int storage = Math.round(Math.min(baseStorage + 10000 * upgrades.storage + opTime * consumption, 2147483647));;
|
||||
|
||||
|
||||
int maxinput = (Integer)IC2Module.IES_GetMaxSafeInput.invoke(accessor.getTileEntity()) * (int)Math.pow(4.0D, Math.min(4, upgrades.transform));
|
||||
double stored = IC2Module.getStoredEnergy(accessor);
|
||||
|
||||
String storedStr = LangUtil.translateG("hud.msg.stored");
|
||||
String powerStr = LangUtil.translateG("hud.msg.power");
|
||||
String maxPowerStr = LangUtil.translateG("hud.msg.maxpower");
|
||||
|
||||
/* EU Storage */
|
||||
if (ConfigHandler.instance().getConfig("ic2.storage")){
|
||||
if ( stored >= 0.0 )
|
||||
currenttip.add(String.format("%s : \u00a7f%d\u00a7r / \u00a7f%d\u00a7r EU", storedStr, Math.round(Math.min(stored,storage)), storage));
|
||||
}
|
||||
|
||||
if (ConfigHandler.instance().getConfig("ic2.consump")){
|
||||
if ( consumption > 0)
|
||||
currenttip.add(String.format("%s : \u00a7f%d\u00a7r EU/t", powerStr, consumption ));
|
||||
}
|
||||
|
||||
if (ConfigHandler.instance().getConfig("ic2.inputeu")){
|
||||
if ( maxinput > 0)
|
||||
currenttip.add(String.format("%s : \u00a7f%d\u00a7r EU/t", maxPowerStr, maxinput ));
|
||||
}
|
||||
|
||||
} catch (Exception e){
|
||||
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
package mcp.mobius.waila.addons.ic2;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import codechicken.lib.lang.LangUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.impl.ConfigHandler;
|
||||
|
||||
public class HUDHandlerTETradeOMat implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack,List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
|
||||
if (!ConfigHandler.instance().getConfig("ic2.tradeomat")) return currenttip;
|
||||
|
||||
NBTTagCompound slots = accessor.getNBTData().getCompoundTag("InvSlots");
|
||||
NBTTagList offer = slots.getCompoundTag("offer").getTagList("Contents");
|
||||
NBTTagList demand = slots.getCompoundTag("demand").getTagList("Contents");
|
||||
String offersStr = LangUtil.translateG("hud.msg.offers");
|
||||
String demandsStr = LangUtil.translateG("hud.msg.demands");
|
||||
|
||||
|
||||
if (offer.tagCount() == 1){
|
||||
NBTTagCompound subtag = (NBTTagCompound)offer.tagAt(0);
|
||||
ItemStack is = new ItemStack(subtag.getShort("id"), subtag.getByte("Count"), subtag.getShort("Damage"));
|
||||
currenttip.add(String.format("%s : \u00a7f%d\u00a7r x \u00a7f%s\u00a7r", offersStr, is.stackSize, is.getDisplayName()));
|
||||
}
|
||||
|
||||
if (demand.tagCount() == 1){
|
||||
NBTTagCompound subtag = (NBTTagCompound)demand.tagAt(0);
|
||||
ItemStack is = new ItemStack(subtag.getShort("id"), subtag.getByte("Count"), subtag.getShort("Damage"));
|
||||
currenttip.add(String.format("%s : \u00a7f%d\u00a7r x \u00a7f%s\u00a7r", demandsStr, is.stackSize, is.getDisplayName()));
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,173 +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 net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import mcp.mobius.waila.mod_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.tools.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();
|
||||
mod_Waila.log.log(Level.WARNING, "[IC2] Class not found. " + e);
|
||||
return;
|
||||
} catch (NoSuchMethodException e){
|
||||
//e.printStackTrace();
|
||||
mod_Waila.log.log(Level.WARNING, "[IC2] Method not found." + e);
|
||||
return;
|
||||
} catch (NoSuchFieldException e){
|
||||
//e.printStackTrace();
|
||||
mod_Waila.log.log(Level.WARNING, "[IC2] Field not found." + e);
|
||||
return;
|
||||
} catch (Exception e){
|
||||
//e.printStackTrace();
|
||||
mod_Waila.log.log(Level.WARNING, "[IC2] Unhandled exception." + e);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/* 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);
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
package mcp.mobius.waila.addons.openblocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import codechicken.lib.lang.LangUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDHandlerTank implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
if (!config.getConfig("openblocks.fluidamount")) return currenttip;
|
||||
|
||||
IFluidHandler handler = (IFluidHandler)accessor.getTileEntity();
|
||||
if (handler == null) return currenttip;
|
||||
|
||||
FluidTankInfo[] tanks = handler.getTankInfo(ForgeDirection.UNKNOWN);
|
||||
if (tanks.length != 1) return currenttip;
|
||||
|
||||
FluidStack fluid = tanks[0].fluid;
|
||||
String name = currenttip.get(0);
|
||||
|
||||
try{
|
||||
name += String.format(" < %s >", fluid.getFluid().getLocalizedName());
|
||||
} catch (NullPointerException f){
|
||||
name += " " + LangUtil.translateG("hud.msg.empty");
|
||||
}
|
||||
|
||||
currenttip.set(0, name);
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
if (!config.getConfig("openblocks.fluidamount")) return currenttip;
|
||||
|
||||
IFluidHandler handler = (IFluidHandler)accessor.getTileEntity();
|
||||
if (handler == null) return currenttip;
|
||||
|
||||
FluidTankInfo[] tanks = handler.getTankInfo(ForgeDirection.UNKNOWN);
|
||||
if (tanks.length != 1) return currenttip;
|
||||
|
||||
if(tanks[0].fluid != null)
|
||||
currenttip.add(String.format("%d / %d mB", tanks[0].fluid.amount, tanks[0].capacity));
|
||||
else
|
||||
currenttip.add(String.format("0 / %d mB", tanks[0].capacity));
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package mcp.mobius.waila.addons.openblocks;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
public class OpenBlocksModule {
|
||||
|
||||
public static Class ModOpenBlocks = null;
|
||||
public static Class TileEntityTank = null;
|
||||
|
||||
public static void register(){
|
||||
try{
|
||||
Class ModOpenBlocks = Class.forName("openblocks.OpenBlocks");
|
||||
mod_Waila.log.log(Level.INFO, "OpenBlocks mod found.");
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.INFO, "[OpenBlocks] OpenBlocks mod not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
try{
|
||||
TileEntityTank = Class.forName("openblocks.common.tileentity.TileEntityTank");
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[OpenBlocks] Class not found. " + e);
|
||||
return;
|
||||
}
|
||||
|
||||
ModuleRegistrar.instance().addConfigRemote("OpenBlocks", "openblocks.fluidamount");
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTank(), TileEntityTank);
|
||||
ModuleRegistrar.instance().registerHeadProvider(new HUDHandlerTank(), TileEntityTank);
|
||||
}
|
||||
}
|
||||
@@ -1,202 +0,0 @@
|
||||
package mcp.mobius.waila.addons.projectred;
|
||||
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import mcp.mobius.waila.api.IWailaBlockDecorator;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.gui.helpers.UIHelper;
|
||||
|
||||
public class HUDDecoratorRsGateLogic implements IWailaBlockDecorator {
|
||||
|
||||
static byte[][] IOARRAY={
|
||||
{1,1,2,1} /* OR */, {1,1,2,1} /* NOR */, {1,2,2,2} /* NOT */, {1,1,2,1} /* AND */,
|
||||
{1,1,2,1} /* NAND */, {0,1,2,1} /* XOR */, {0,1,2,1} /* XNOR */, {1,2,2,2} /* Buf */,
|
||||
{3,4,2,5} /* Multi */, {1,0,2,0} /* Pulse */, {1,0,2,0} /* Repeat */, {1,2,2,2} /* Rand */,
|
||||
{2,1,2,1} /* Latch */, {2,1,2,1} /* Toggle*/, {6,1,2,2} /* Transp */, {2,0,0,0} /* Light */,
|
||||
{2,0,0,0} /* Rain */, {1,7,2,7} /* Timer */, {2,2,2,2} /* Sequen */, {2,9,2,8} /* Count */,
|
||||
{1,2,2,6} /* State */, {6,1,2,1} /* Sync */, {10,1,10,1} /* Bus */, {11,12,11,12} /* Null */,
|
||||
{11,12,11,12} /* Inver */, {11,12,11,12} /* Buff */, {1,9,2,8} /* Cmp */, {1,12,2,12} /* And */,
|
||||
};
|
||||
|
||||
static String[] IONAMES={ "", "IN", "OUT", "SWAP", "IN_A", "IN_B", "LOCK", "IO", "POS", "NEG", "BUS", "A", "B"};
|
||||
|
||||
@Override
|
||||
public void decorateBlock(ItemStack itemStack, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
if (!config.getConfig("pr.showio")) return;
|
||||
|
||||
|
||||
int orient = 0;
|
||||
int subID = 0;
|
||||
int shape = 0;
|
||||
boolean found = false;
|
||||
|
||||
if (!accessor.getNBTData().hasKey("parts")) return;
|
||||
NBTTagList parts = accessor.getNBTData().getTagList("parts");
|
||||
for (int i = 0; i < parts.tagCount(); i++){
|
||||
NBTTagCompound subtag = (NBTTagCompound)parts.tagAt(i);
|
||||
String id = subtag.getString("id");
|
||||
|
||||
if (id.equals("pr_sgate") || id.equals("pr_igate") ||
|
||||
id.equals("pr_tgate") || id.equals("pr_bgate") ||
|
||||
id.equals("pr_agate") || id.equals("pr_rgate")){
|
||||
orient = accessor.getNBTInteger(subtag, "orient");
|
||||
subID = accessor.getNBTInteger(subtag, "subID");
|
||||
shape = accessor.getNBTInteger(subtag, "shape");
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) return;
|
||||
|
||||
//orient = orient - ((orient & 0x10) + (orient & 0x8) + (orient & 0x4));
|
||||
int hOrient = orient & 0x3;
|
||||
ForgeDirection vOrient = ForgeDirection.getOrientation((orient - (orient & 0x3)) >> 2);
|
||||
|
||||
//System.out.printf("%s\n", ForgeDirection.getOrientation(vOrient));
|
||||
|
||||
if (vOrient == ForgeDirection.EAST)
|
||||
hOrient -= 1;
|
||||
|
||||
if (vOrient == ForgeDirection.WEST)
|
||||
hOrient += 1;
|
||||
|
||||
if (hOrient == -1)
|
||||
hOrient = 3;
|
||||
|
||||
String[] IOStr = new String[4];
|
||||
for (int i = 0; i < 4; i++)
|
||||
IOStr[i] = IONAMES[IOARRAY[subID][i]];
|
||||
|
||||
String[] IOStrRot = new String[4];
|
||||
|
||||
for (int i = 0; i < 4 ; i++){
|
||||
int j = i + hOrient;
|
||||
if (j >= 4) j -= 4;
|
||||
IOStrRot[j] = IOStr[i];
|
||||
}
|
||||
|
||||
switch(vOrient){
|
||||
case DOWN:
|
||||
UIHelper.drawFloatingText(IOStrRot[0], accessor.getRenderingPosition(), 0.5F, 0.2F, 1.4F, 90F, 0F, 0F); // Orient 0
|
||||
UIHelper.drawFloatingText(IOStrRot[1], accessor.getRenderingPosition(), -0.4F, 0.2F, 0.5F, 90F, 270F, 0F); // Orient 1
|
||||
UIHelper.drawFloatingText(IOStrRot[2], accessor.getRenderingPosition(), 0.5F, 0.2F, -0.4F, 90F, 180F, 0F); // Orient 2
|
||||
UIHelper.drawFloatingText(IOStrRot[3], accessor.getRenderingPosition(), 1.4F, 0.2F, 0.5F, 90F, 90F, 0F); // Orient 3
|
||||
break;
|
||||
case EAST:
|
||||
UIHelper.drawFloatingText(IOStrRot[0], accessor.getRenderingPosition(), 0.8F, 0.5F, 1.4F, 0F, 90F, 90F);
|
||||
UIHelper.drawFloatingText(IOStrRot[1], accessor.getRenderingPosition(), 0.8F, -0.4F, 0.5F, 0F, 90F, 180F);
|
||||
UIHelper.drawFloatingText(IOStrRot[2], accessor.getRenderingPosition(), 0.8F, 0.5F, -0.4F, 0F, 90F, 270F);
|
||||
UIHelper.drawFloatingText(IOStrRot[3], accessor.getRenderingPosition(), 0.8F, 1.4F, 0.5F, 0F, 90F, 0F);
|
||||
break;
|
||||
case NORTH:
|
||||
UIHelper.drawFloatingText(IOStrRot[0], accessor.getRenderingPosition(), 0.5F, 1.4F, 0.2F, 0F, 180F, 0F);
|
||||
UIHelper.drawFloatingText(IOStrRot[1], accessor.getRenderingPosition(), 1.4F, 0.5F, 0.2F, 0F, 180F, 90F);
|
||||
UIHelper.drawFloatingText(IOStrRot[2], accessor.getRenderingPosition(), 0.5F, -0.4F, 0.2F, 0F, 180F, 180F);
|
||||
UIHelper.drawFloatingText(IOStrRot[3], accessor.getRenderingPosition(), -0.4F, 0.5F, 0.2F, 0F, 180F, 270F);
|
||||
break;
|
||||
case SOUTH:
|
||||
UIHelper.drawFloatingText(IOStrRot[0], accessor.getRenderingPosition(), 0.5F, 1.4F, 0.8F, 0F, 0F, 0F);
|
||||
UIHelper.drawFloatingText(IOStrRot[1], accessor.getRenderingPosition(), -0.4F, 0.5F, 0.8F, 0F, 0F, 90F);
|
||||
UIHelper.drawFloatingText(IOStrRot[2], accessor.getRenderingPosition(), 0.5F, -0.4F, 0.8F, 0F, 0F, 180F);
|
||||
UIHelper.drawFloatingText(IOStrRot[3], accessor.getRenderingPosition(), 1.4F, 0.5F, 0.8F, 0F, 0F, 270F);
|
||||
break;
|
||||
case UP:
|
||||
UIHelper.drawFloatingText(IOStrRot[0], accessor.getRenderingPosition(), 0.5F, 0.8F, 1.4F, 270F, 180F, 0F);
|
||||
UIHelper.drawFloatingText(IOStrRot[1], accessor.getRenderingPosition(), 1.4F, 0.8F, 0.5F, 270F, 270F, 0F);
|
||||
UIHelper.drawFloatingText(IOStrRot[2], accessor.getRenderingPosition(), 0.5F, 0.8F, -0.4F, 270F, 0F, 0F);
|
||||
UIHelper.drawFloatingText(IOStrRot[3], accessor.getRenderingPosition(), -0.4F, 0.8F, 0.5F, 270F, 90F, 0F);
|
||||
break;
|
||||
case WEST:
|
||||
UIHelper.drawFloatingText(IOStrRot[0], accessor.getRenderingPosition(), 0.2F, 0.5F, 1.4F, 180F, 90F, 90F);
|
||||
UIHelper.drawFloatingText(IOStrRot[1], accessor.getRenderingPosition(), 0.2F, 1.4F, 0.5F, 180F, 90F, 180F);
|
||||
UIHelper.drawFloatingText(IOStrRot[2], accessor.getRenderingPosition(), 0.2F, 0.5F, -0.4F, 180F, 90F, 270F);
|
||||
UIHelper.drawFloatingText(IOStrRot[3], accessor.getRenderingPosition(), 0.2F, -0.4F, 0.5F, 180F, 90F, 0F);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
double x = accessor.getRenderingPosition().xCoord;
|
||||
double y = accessor.getRenderingPosition().yCoord;
|
||||
double z = accessor.getRenderingPosition().zCoord;
|
||||
|
||||
switch(vOrient){
|
||||
case DOWN:
|
||||
UIHelper.drawRectangle(x - 0.1, y + 0.1, z, x, y + 0.1, z + 0.35, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangle(x - 0.1, y + 0.1, z + 0.65, x, y + 0.1, z + 1.0, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangle(x + 1.0, y + 0.1, z, x + 1.1, y + 0.1, z + 0.35, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangle(x + 1.0, y + 0.1, z + 0.65, x + 1.1, y + 0.1, z + 1.0, 255, 255, 255, 150 );
|
||||
|
||||
UIHelper.drawRectangle(x - 0.1, y + 0.1, z - 0.1, x + 0.35, y + 0.1, z + 0.1, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangle(x + 0.65, y + 0.1, z - 0.1, x + 1.1, y + 0.1, z + 0.1, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangle(x - 0.1, y + 0.1, z + 1.0, x + 0.35, y + 0.1, z + 1.1, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangle(x + 0.65, y + 0.1, z + 1.0, x + 1.1, y + 0.1, z + 1.1, 255, 255, 255, 150 );
|
||||
break;
|
||||
case EAST:
|
||||
UIHelper.drawRectangleEW(x + 0.9, y, z - 0.1, x + 0.9, y + 0.35, z, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangleEW(x + 0.9, y + 0.65, z - 0.1, x + 0.9, y + 1.0, z, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangleEW(x + 0.9, y, z + 1.0, x + 0.9, y + 0.35, z + 1.1, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangleEW(x + 0.9, y + 0.65, z + 1.0, x + 0.9, y + 1.0, z + 1.1, 255, 255, 255, 150 );
|
||||
|
||||
UIHelper.drawRectangleEW(x + 0.9, y - 0.1, z - 0.1, x + 0.9, y, z + 0.35, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangleEW(x + 0.9, y - 0.1, z + 0.65, x + 0.9, y, z + 1.1, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangleEW(x + 0.9, y + 1.0, z - 0.1, x + 0.9, y + 1.1, z + 0.35, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangleEW(x + 0.9, y + 1.0, z + 0.65, x + 0.9, y + 1.1, z + 1.1, 255, 255, 255, 150 );
|
||||
break;
|
||||
case NORTH:
|
||||
UIHelper.drawRectangle(x - 0.1, y, z + 0.1, x, y + 0.35, z + 0.1, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangle(x - 0.1, y + 0.65, z + 0.1, x, y + 1.0, z + 0.1, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangle(x + 1.0, y, z + 0.1, x + 1.1, y + 0.35, z + 0.1, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangle(x + 1.0, y + 0.65, z + 0.1, x + 1.1, y + 1.0, z + 0.1, 255, 255, 255, 150 );
|
||||
|
||||
UIHelper.drawRectangle(x - 0.1, y - 0.1, z + 0.1, x + 0.35, y, z + 0.1, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangle(x + 0.65, y - 0.1, z + 0.1, x + 1.1, y, z + 0.1, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangle(x - 0.1, y + 1.0, z + 0.1, x + 0.35, y + 1.1, z + 0.1, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangle(x + 0.65, y + 1.0, z + 0.1, x + 1.1, y + 1.1, z + 0.1, 255, 255, 255, 150 );
|
||||
break;
|
||||
case SOUTH:
|
||||
UIHelper.drawRectangle(x, y, z + 0.9, x - 0.1, y + 0.35, z + 0.9, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangle(x, y + 0.65, z + 0.9, x - 0.1, y + 1.0, z + 0.9, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangle(x + 1.1, y, z + 0.9, x + 1.0, y + 0.35, z + 0.9, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangle(x + 1.1, y + 0.65, z + 0.9, x + 1.0, y + 1.0, z + 0.9, 255, 255, 255, 150 );
|
||||
|
||||
UIHelper.drawRectangle(x + 0.35, y - 0.1, z + 0.9, x - 0.1, y, z + 0.9, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangle(x + 1.10, y - 0.1, z + 0.9, x + 0.65, y, z + 0.9, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangle(x + 0.35, y + 1.0, z + 0.9, x - 0.1, y + 1.1, z + 0.9, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangle(x + 1.1, y + 1.0, z + 0.9, x + 0.65, y + 1.1, z + 0.9, 255, 255, 255, 150 );
|
||||
break;
|
||||
case UP:
|
||||
UIHelper.drawRectangle(x, y + 0.9, z, x - 0.1, y + 0.9, z + 0.35, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangle(x, y + 0.9, z + 0.65, x - 0.1, y + 0.9, z + 1.0, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangle(x + 1.1, y + 0.9, z, x + 1.0, y + 0.9, z + 0.35, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangle(x + 1.1, y + 0.9, z + 0.65, x + 1.0, y + 0.9, z + 1.0, 255, 255, 255, 150 );
|
||||
|
||||
UIHelper.drawRectangle(x + 0.35, y + 0.9, z - 0.1, x - 0.1, y + 0.9, z + 0.1, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangle(x + 1.1, y + 0.9, z - 0.1, x + 0.65, y + 0.9, z + 0.1, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangle(x +0.35, y + 0.9, z + 1.0, x - 0.1, y + 0.9, z + 1.1, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangle(x + 1.1, y + 0.9, z + 1.0, x + 0.65, y + 0.9, z + 1.1, 255, 255, 255, 150 );
|
||||
|
||||
break;
|
||||
case WEST:
|
||||
UIHelper.drawRectangleEW(x + 0.1, y+ 0.35, z - 0.1, x + 0.1, y , z, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangleEW(x + 0.1, y + 1.0, z - 0.1, x + 0.1, y + 0.65, z, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangleEW(x + 0.1, y + 0.35, z + 1.0, x + 0.1, y, z + 1.1, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangleEW(x + 0.1, y + 1.0, z + 1.0, x + 0.1, y + 0.65, z + 1.1, 255, 255, 255, 150 );
|
||||
|
||||
UIHelper.drawRectangleEW(x + 0.1, y, z - 0.1, x + 0.1, y - 0.1, z + 0.35, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangleEW(x + 0.1, y, z + 0.65, x + 0.1, y - 0.1, z + 1.1, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangleEW(x + 0.1, y + 1.1, z - 0.1, x + 0.1, y + 1.0, z + 0.35, 255, 255, 255, 150 );
|
||||
UIHelper.drawRectangleEW(x + 0.1, y + 1.1, z + 0.65, x + 0.1, y + 1.0, z + 1.1, 255, 255, 255, 150 );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
package mcp.mobius.waila.addons.projectred;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDHandlerRsGateLogic implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
if (!config.getConfig("pr.showdata")) return currenttip;
|
||||
|
||||
int orient = 0;
|
||||
int subID = 0;
|
||||
int shape = 0;
|
||||
int pmax = 0;
|
||||
int val = 0;
|
||||
int max = 0;
|
||||
int dec = 0;
|
||||
int inc = 0;
|
||||
|
||||
boolean found = false;
|
||||
|
||||
if (!accessor.getNBTData().hasKey("parts")) return currenttip;
|
||||
NBTTagList parts = accessor.getNBTData().getTagList("parts");
|
||||
for (int i = 0; i < parts.tagCount(); i++){
|
||||
NBTTagCompound subtag = (NBTTagCompound)parts.tagAt(i);
|
||||
String id = subtag.getString("id");
|
||||
|
||||
if (id.equals("pr_sgate") || id.equals("pr_igate") ||
|
||||
id.equals("pr_tgate") || id.equals("pr_bgate") ||
|
||||
id.equals("pr_agate") || id.equals("pr_rgate")){
|
||||
orient = accessor.getNBTInteger(subtag, "orient");
|
||||
subID = accessor.getNBTInteger(subtag, "subID");
|
||||
shape = accessor.getNBTInteger(subtag, "shape");
|
||||
|
||||
if (subID == 17)
|
||||
pmax = accessor.getNBTInteger(subtag, "pmax");
|
||||
|
||||
if (subID == 19){
|
||||
val = accessor.getNBTInteger(subtag, "val");
|
||||
max = accessor.getNBTInteger(subtag, "max");
|
||||
dec = accessor.getNBTInteger(subtag, "dec");
|
||||
inc = accessor.getNBTInteger(subtag, "inc");
|
||||
}
|
||||
|
||||
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) return currenttip;
|
||||
|
||||
switch(subID){
|
||||
case 10:
|
||||
currenttip.add(String.format("Delay : \u00a7f%d ticks", (int)Math.pow(2, shape)));
|
||||
break;
|
||||
|
||||
case 15:
|
||||
if (shape == 0)
|
||||
currenttip.add("Shape : \u00a7fOpen");
|
||||
if (shape == 1)
|
||||
currenttip.add("Shape : \u00a7fHalf closed");
|
||||
if (shape == 2)
|
||||
currenttip.add("Shape : \u00a7fclosed");
|
||||
break;
|
||||
|
||||
case 17:
|
||||
currenttip.add(String.format("Timer : \u00a7f%d \u00a7rms", (pmax + 2) * 50));
|
||||
break;
|
||||
|
||||
case 19:
|
||||
|
||||
|
||||
currenttip.add(String.format("Value : \u00a7f%d \u00a7r/ \u00a7f%d", val, max));
|
||||
currenttip.add(String.format("Step : \u00a7f-%d \u00a7r/ \u00a7f+%d", dec, inc));
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package mcp.mobius.waila.addons.projectred;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
public class ProjectRedModule {
|
||||
|
||||
|
||||
public static Class BlockMultipart = null;
|
||||
|
||||
public static void register(){
|
||||
try{
|
||||
Class ModClass = Class.forName("mrtjp.projectred.ProjectRedIntegration");
|
||||
mod_Waila.log.log(Level.INFO, "ProjectRed|Integration mod found.");
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.INFO, "[ProjectRed] ProjectRed|Integration mod not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
try{
|
||||
|
||||
//InstancedRsGateLogic = Class.forName("mrtjp.projectred.integration.InstancedRsGateLogic");
|
||||
BlockMultipart = Class.forName("codechicken.multipart.BlockMultipart");
|
||||
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Class not found. " + e);
|
||||
return;
|
||||
// } catch (NoSuchMethodException e){
|
||||
// mod_Waila.log.log(Level.WARNING, "[EnderStorage] Method not found." + e);
|
||||
// return;
|
||||
// } catch (NoSuchFieldException e){
|
||||
// mod_Waila.log.log(Level.WARNING, "[EnderStorage] Field not found." + e);
|
||||
// return;
|
||||
} catch (Exception e){
|
||||
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Unhandled exception." + e);
|
||||
return;
|
||||
}
|
||||
|
||||
ModuleRegistrar.instance().addConfigRemote("Project:Red", "pr.showio");
|
||||
ModuleRegistrar.instance().addConfigRemote("Project:Red", "pr.showdata");
|
||||
|
||||
ModuleRegistrar.instance().registerBlockDecorator(new HUDDecoratorRsGateLogic(), BlockMultipart);
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerRsGateLogic(), BlockMultipart);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
package mcp.mobius.waila.addons.railcraft;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.List;
|
||||
|
||||
import codechicken.lib.lang.LangUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidTank;
|
||||
import mcp.mobius.waila.WailaExceptionHandler;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDHandlerTank implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
if (!config.getConfig("railcraft.fluidamount")) return currenttip;
|
||||
try {
|
||||
IFluidTank tank = (IFluidTank)RailcraftModule.ITankTile_getTank.invoke(RailcraftModule.ITankTile.cast(accessor.getTileEntity()));
|
||||
if (tank == null) return currenttip;
|
||||
|
||||
FluidStack fluid = tank.getFluid();
|
||||
|
||||
String name = currenttip.get(0);
|
||||
|
||||
try{
|
||||
name += String.format(" < %s >", fluid.getFluid().getLocalizedName());
|
||||
} catch (NullPointerException f){
|
||||
name += " " + LangUtil.translateG("hud.msg.empty");
|
||||
}
|
||||
|
||||
currenttip.set(0, name);
|
||||
|
||||
} catch (Exception e){
|
||||
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
if (!config.getConfig("railcraft.fluidamount")) return currenttip;
|
||||
|
||||
try {
|
||||
IFluidTank tank = (IFluidTank)RailcraftModule.ITankTile_getTank.invoke(RailcraftModule.ITankTile.cast(accessor.getTileEntity()));
|
||||
if (tank == null) return currenttip;
|
||||
|
||||
FluidStack fluid = tank.getFluid();
|
||||
if (fluid != null)
|
||||
currenttip.add(String.format("%d / %d mB", fluid.amount, tank.getInfo().capacity));
|
||||
else
|
||||
currenttip.add(String.format("0 / %d mB", tank.getInfo().capacity));
|
||||
|
||||
} catch (Exception e){
|
||||
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
package mcp.mobius.waila.addons.railcraft;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
public class RailcraftModule {
|
||||
public static Class TileTankBase = null;
|
||||
public static Class ITankTile = null;
|
||||
public static Method ITankTile_getTank = null;
|
||||
//public static Class StandardTank = null;
|
||||
|
||||
public static void register(){
|
||||
try{
|
||||
Class ModRailcraft = Class.forName("mods.railcraft.common.core.Railcraft");
|
||||
mod_Waila.log.log(Level.INFO, "Railcraft mod found.");
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.INFO, "[Railcraft] Railcraft mod not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
try{
|
||||
TileTankBase = Class.forName("mods.railcraft.common.blocks.machine.beta.TileTankBase");
|
||||
ITankTile = Class.forName("mods.railcraft.common.blocks.machine.ITankTile");
|
||||
ITankTile_getTank = ITankTile.getMethod("getTank");
|
||||
//StandardTank = Class.forName("mods.railcraft.common.fluids.tanks.StandardTank");
|
||||
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[Railcraft] Class not found. " + e);
|
||||
return;
|
||||
} catch (NoSuchMethodException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[Railcraft] Method not found." + e);
|
||||
return;
|
||||
}
|
||||
|
||||
ModuleRegistrar.instance().addConfigRemote("Railcraft", "railcraft.fluidamount");
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTank(), TileTankBase);
|
||||
ModuleRegistrar.instance().registerHeadProvider(new HUDHandlerTank(), TileTankBase);
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package mcp.mobius.waila.addons.thaumcraft;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.WailaExceptionHandler;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class HUDHandlerCapacitor implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
if (config.getConfig("thaumcraft.storedvis")){
|
||||
try{
|
||||
short storedVis = ThaumcraftModule.TileCrystalCapacitor_StoredVis.getShort(accessor.getTileEntity());
|
||||
short maxVis = ThaumcraftModule.TileCrystalCapacitor_MaxVis.getShort(accessor.getTileEntity());
|
||||
|
||||
currenttip.add(String.format("%s/%s vis", storedVis, maxVis));
|
||||
}catch (Exception e){
|
||||
currenttip = WailaExceptionHandler.handleErr(e, accessor.getClass().getName(), currenttip);
|
||||
}
|
||||
}
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package mcp.mobius.waila.addons.thaumcraft;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDHandlerLeaves implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return new ItemStack(accessor.getBlock(), 0, accessor.getMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package mcp.mobius.waila.addons.thaumcraft;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDHandlerPlants implements IWailaDataProvider {
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return new ItemStack(accessor.getBlock(), 0, accessor.getMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package mcp.mobius.waila.addons.thaumcraft;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
public class ThaumcraftModule {
|
||||
|
||||
public static Class BlockMagicalLeaves = null;
|
||||
public static Class BlockCustomPlant = null;
|
||||
|
||||
public static Class TileCrystalCapacitor = null;
|
||||
public static Field TileCrystalCapacitor_StoredVis = null;
|
||||
public static Field TileCrystalCapacitor_MaxVis = null;
|
||||
|
||||
public static void register(){
|
||||
|
||||
try{
|
||||
Class ModThaumcraft = Class.forName("thaumcraft.common.Thaumcraft");
|
||||
mod_Waila.log.log(Level.INFO, "Thaumcraft mod found.");
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.INFO, "[Thaumcraft] Thaumcraft mod not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
try{
|
||||
BlockMagicalLeaves = Class.forName("thaumcraft.common.world.BlockMagicalLeaves");
|
||||
BlockCustomPlant = Class.forName("thaumcraft.common.world.BlockCustomPlant");
|
||||
|
||||
TileCrystalCapacitor = Class.forName("thaumcraft.common.tiles.TileCrystalCapacitor");
|
||||
TileCrystalCapacitor_StoredVis = TileCrystalCapacitor.getField("storedVis");
|
||||
TileCrystalCapacitor_MaxVis = TileCrystalCapacitor.getField("maxVis");
|
||||
|
||||
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[Thaumcraft] Class not found. " + e);
|
||||
return;
|
||||
// } catch (NoSuchMethodException e){
|
||||
// mod_Waila.log.log(Level.WARNING, "[Thaumcraft] Method not found." + e);
|
||||
// return;
|
||||
} catch (NoSuchFieldException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[Thaumcraft] Field not found." + e);
|
||||
return;
|
||||
// } catch (Exception e){
|
||||
// mod_Waila.log.log(Level.WARNING, "[Thaumcraft] Unhandled exception." + e);
|
||||
// return;
|
||||
}
|
||||
ModuleRegistrar.instance().addConfig("Thaumcraft", "thaumcraft.storedvis");
|
||||
ModuleRegistrar.instance().registerStackProvider(new HUDHandlerLeaves(), BlockMagicalLeaves);
|
||||
ModuleRegistrar.instance().registerStackProvider(new HUDHandlerPlants(), BlockCustomPlant);
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerCapacitor(), TileCrystalCapacitor);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
package mcp.mobius.waila.addons.thermalexpansion;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import codechicken.lib.lang.LangUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import mcp.mobius.waila.WailaExceptionHandler;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDHandlerConduitFluid implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
|
||||
if (!config.getConfig("thermalexpansion.fluidtype")) return currenttip;
|
||||
|
||||
boolean found = false;
|
||||
FluidStack fluid = null;
|
||||
|
||||
if (!accessor.getNBTData().hasKey("parts")) return currenttip;
|
||||
NBTTagList parts = accessor.getNBTData().getTagList("parts");
|
||||
for (int i = 0; i < parts.tagCount(); i++){
|
||||
NBTTagCompound subtag = (NBTTagCompound)parts.tagAt(i);
|
||||
String id = subtag.getString("id");
|
||||
|
||||
if (id.contains("ConduitFluid")){
|
||||
found = true;
|
||||
NBTTagCompound fluidTag = subtag.getCompoundTag("ConnFluid");
|
||||
fluid = FluidStack.loadFluidStackFromNBT(fluidTag);
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) return currenttip;
|
||||
|
||||
if (fluid != null)
|
||||
currenttip.add(fluid.getFluid().getLocalizedName());
|
||||
else
|
||||
currenttip.add(LangUtil.translateG("hud.msg.empty"));
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
package mcp.mobius.waila.addons.thermalexpansion;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDHandlerConduitItem implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
|
||||
if (!config.getConfig("thermalexpansion.conditemmode")) return currenttip;
|
||||
|
||||
boolean found = false;
|
||||
int mode = -1;
|
||||
|
||||
if (!accessor.getNBTData().hasKey("parts")) return currenttip;
|
||||
NBTTagList parts = accessor.getNBTData().getTagList("parts");
|
||||
for (int i = 0; i < parts.tagCount(); i++){
|
||||
NBTTagCompound subtag = (NBTTagCompound)parts.tagAt(i);
|
||||
String id = subtag.getString("id");
|
||||
|
||||
if (id.contains("ConduitItem")){
|
||||
mode = accessor.getNBTInteger(subtag, "Mode");
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) return currenttip;
|
||||
|
||||
if (mode == 0){}
|
||||
else if (mode == 1)
|
||||
currenttip.add("Mode : \u00a7fDense");
|
||||
else if (mode == 2)
|
||||
currenttip.add("Mode : \u00a7fVacuum");
|
||||
else if (mode == 3)
|
||||
currenttip.add("Mode : \u00a7fRound-Robin");
|
||||
else
|
||||
currenttip.add("Mode : <UNKNOWN>");
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package mcp.mobius.waila.addons.thermalexpansion;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import codechicken.lib.lang.LangUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import mcp.mobius.waila.WailaExceptionHandler;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDHandlerEnergyCell implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
if (!config.getConfig("thermalexpansion.energycell")) return currenttip;
|
||||
|
||||
int energyReceive = accessor.getNBTInteger(accessor.getNBTData(), "Recv");
|
||||
int energySend = accessor.getNBTInteger(accessor.getNBTData(), "Send");
|
||||
|
||||
currenttip.add(String.format("%s/%s : %d / %d RF/t", LangUtil.translateG("hud.msg.in"), LangUtil.translateG("hud.msg.out"), energyReceive, energySend));
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
package mcp.mobius.waila.addons.thermalexpansion;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import mcp.mobius.waila.WailaExceptionHandler;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDHandlerIEnergyHandler implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
|
||||
if (!config.getConfig("thermalexpansion.energyhandler")) return currenttip;
|
||||
if (!accessor.getNBTData().hasKey("Energy")) return currenttip;
|
||||
|
||||
int energy = accessor.getNBTInteger(accessor.getNBTData(), "Energy");
|
||||
try {
|
||||
Integer maxEnergy = (Integer)ThermalExpansionModule.IEnergyHandler_getMaxStorage.invoke(accessor.getTileEntity(), ForgeDirection.UNKNOWN);
|
||||
if (maxEnergy != 0)
|
||||
currenttip.add(String.format("%d / %d RF", energy, maxEnergy));
|
||||
} catch (Exception e){
|
||||
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
package mcp.mobius.waila.addons.thermalexpansion;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import codechicken.lib.lang.LangUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
|
||||
public class HUDHandlerISecureTile implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
|
||||
if (config.getConfig("thermalexpansion.owner")){
|
||||
|
||||
String owner = accessor.getNBTData().getString("Owner");
|
||||
int iaccess = accessor.getNBTInteger(accessor.getNBTData(), "Access");
|
||||
|
||||
String access = "INVALID";
|
||||
switch(iaccess){
|
||||
case 0:
|
||||
access = LangUtil.translateG("hud.msg.public");
|
||||
break;
|
||||
case 1:
|
||||
access = LangUtil.translateG("hud.msg.restricted");
|
||||
break;
|
||||
case 2:
|
||||
access = LangUtil.translateG("hud.msg.private");
|
||||
break;
|
||||
}
|
||||
|
||||
currenttip.add(String.format("%s : \u00a7f%s\u00a7r [ %s ]", LangUtil.translateG("hud.msg.owner"), owner, access));
|
||||
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
package mcp.mobius.waila.addons.thermalexpansion;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.List;
|
||||
|
||||
import codechicken.lib.lang.LangUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import mcp.mobius.waila.WailaExceptionHandler;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDHandlerTank implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
if (!config.getConfig("thermalexpansion.fluidtype")) return currenttip;
|
||||
|
||||
try {
|
||||
FluidStack fluid = (FluidStack)ThermalExpansionModule.TileTank_getTankFluid.invoke(accessor.getTileEntity());
|
||||
String name = currenttip.get(0);
|
||||
|
||||
try{
|
||||
name += String.format(" < %s >", fluid.getFluid().getLocalizedName());
|
||||
} catch (NullPointerException f){
|
||||
name += " " + LangUtil.translateG("hud.msg.empty");
|
||||
}
|
||||
|
||||
currenttip.set(0, name);
|
||||
|
||||
} catch (Exception e){
|
||||
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
|
||||
}
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
try {
|
||||
if (config.getConfig("thermalexpansion.fluidamount")){
|
||||
int amount = 0;
|
||||
if (accessor.getNBTData().hasKey("Amount"))
|
||||
amount = accessor.getNBTInteger(accessor.getNBTData(), "Amount");
|
||||
|
||||
Integer capacity = (Integer)ThermalExpansionModule.TileTank_getTankCapacity.invoke(accessor.getTileEntity());
|
||||
|
||||
currenttip.add(String.format("%d / %d mB", amount, capacity));
|
||||
}
|
||||
|
||||
if (config.getConfig("thermalexpansion.tankmode")){
|
||||
Byte mode = (Byte)ThermalExpansionModule.TileTank_mode.get(accessor.getTileEntity());
|
||||
if (mode == 0)
|
||||
currenttip.add(String.format("%s : \u00a7a%s", LangUtil.translateG("hud.msg.mode"), LangUtil.translateG("hud.msg.input")));
|
||||
else if (mode == 1)
|
||||
currenttip.add(String.format("%s : \u00a7c%s", LangUtil.translateG("hud.msg.mode"), LangUtil.translateG("hud.msg.output")));
|
||||
else
|
||||
currenttip.add(String.format("Mode : Unknown (%d)", mode));
|
||||
}
|
||||
|
||||
|
||||
|
||||
} catch (Exception e){
|
||||
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
package mcp.mobius.waila.addons.thermalexpansion;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import codechicken.lib.lang.LangUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDHandlerTesseract implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
|
||||
if (config.getConfig("thermalexpansion.tesssendrecv")){
|
||||
String send = String.format("%s : ", LangUtil.translateG("hud.msg.send"));
|
||||
String recv = String.format("%s : ", LangUtil.translateG("hud.msg.recv"));
|
||||
String item = String.format("\u00a7a%s ", LangUtil.translateG("hud.msg.item"));
|
||||
String fluid= String.format("\u00a79%s ", LangUtil.translateG("hud.msg.fluid"));
|
||||
String energ= String.format("\u00a7c%s ", LangUtil.translateG("hud.msg.energ"));
|
||||
|
||||
|
||||
switch (accessor.getNBTInteger(accessor.getNBTData(), "Item.Mode")){
|
||||
case 0:
|
||||
send += item;
|
||||
break;
|
||||
case 1:
|
||||
recv += item;
|
||||
break;
|
||||
case 2:
|
||||
send += item;
|
||||
recv += item;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (accessor.getNBTInteger(accessor.getNBTData(), "Fluid.Mode")){
|
||||
case 0:
|
||||
send += fluid;
|
||||
break;
|
||||
case 1:
|
||||
recv += fluid;
|
||||
break;
|
||||
case 2:
|
||||
send += fluid;
|
||||
recv += fluid;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (accessor.getNBTInteger(accessor.getNBTData(), "Energy.Mode")){
|
||||
case 0:
|
||||
send += energ;
|
||||
break;
|
||||
case 1:
|
||||
recv += energ;
|
||||
break;
|
||||
case 2:
|
||||
send += energ;
|
||||
recv += energ;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!send.equals(String.format("%s : ", LangUtil.translateG("hud.msg.send"))))
|
||||
currenttip.add(send);
|
||||
|
||||
if (!send.equals(String.format("%s : ", LangUtil.translateG("hud.msg.recv"))))
|
||||
currenttip.add(recv);
|
||||
}
|
||||
|
||||
if (config.getConfig("thermalexpansion.tessfreq"))
|
||||
currenttip.add(String.format("%s : %d",LangUtil.translateG("hud.msg.frequency"), accessor.getNBTInteger(accessor.getNBTData(), "Frequency")));
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
package mcp.mobius.waila.addons.thermalexpansion;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
public class ThermalExpansionModule {
|
||||
|
||||
public static Class IEnergyHandler = null;
|
||||
public static Method IEnergyHandler_getMaxStorage = null;
|
||||
|
||||
public static Class TileEnergyCell = null;
|
||||
|
||||
public static Class TileTank = null;
|
||||
public static Method TileTank_getTankFluid = null;
|
||||
public static Method TileTank_getTankCapacity = null;
|
||||
public static Field TileTank_mode = null;
|
||||
|
||||
//public static Class TileConduitFluid = null;
|
||||
//public static Method TileConduitFluid_getRenderFluid = null;
|
||||
//public static Method TileConduitFluid_getRenderFluidLevel = null;
|
||||
|
||||
//public static Class TileConduitItems = null;
|
||||
|
||||
public static Class TileTesseract = null;
|
||||
|
||||
public static Class ISecureTile = null;
|
||||
|
||||
public static Class BlockMultipart = null;
|
||||
|
||||
//public static Field TileTesseract_modItem = null;
|
||||
//public static Field TileTesseract_modFluid = null;
|
||||
//public static Field TileTesseract_modEnergy = null;
|
||||
|
||||
|
||||
//public static Class TileConduitBase = null;
|
||||
//public static Field TileConduitBase_isInput = null;
|
||||
//public static Field TileConduitBase_isOutput = null;
|
||||
|
||||
public static void register(){
|
||||
|
||||
try{
|
||||
Class ModThermalExpansion = Class.forName("thermalexpansion.ThermalExpansion");
|
||||
mod_Waila.log.log(Level.INFO, "Thermal Expansion mod found.");
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.INFO, "[Thermal Expansion] ThermalExpansion mod not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
try{
|
||||
IEnergyHandler = Class.forName("cofh.api.energy.IEnergyHandler");
|
||||
IEnergyHandler_getMaxStorage = IEnergyHandler.getMethod("getMaxEnergyStored", ForgeDirection.class);
|
||||
TileEnergyCell = Class.forName("thermalexpansion.block.energycell.TileEnergyCell");
|
||||
|
||||
TileTank = Class.forName("thermalexpansion.block.tank.TileTank");
|
||||
TileTank_getTankFluid = TileTank.getMethod("getTankFluid");
|
||||
TileTank_getTankCapacity = TileTank.getMethod("getTankCapacity");
|
||||
TileTank_mode = TileTank.getField("mode");
|
||||
|
||||
//TileConduitFluid = Class.forName("thermalexpansion.block.conduit.fluid.TileConduitFluid");
|
||||
//TileConduitFluid_getRenderFluid = TileConduitFluid.getMethod("getRenderFluid");
|
||||
//TileConduitFluid_getRenderFluidLevel = TileConduitFluid.getMethod("getRenderFluidLevel");
|
||||
//TileConduitItems = Class.forName("thermalexpansion.block.conduit.item.TileConduitItem");
|
||||
|
||||
TileTesseract = Class.forName("thermalexpansion.block.tesseract.TileTesseract");
|
||||
|
||||
ISecureTile = Class.forName("cofh.api.tileentity.ISecureTile");
|
||||
|
||||
BlockMultipart = Class.forName("codechicken.multipart.BlockMultipart");
|
||||
|
||||
//TileTesseract_modItem = TileTesseract.getField("modItem");
|
||||
//TileTesseract_modFluid = TileTesseract.getField("modFluid");
|
||||
//TileTesseract_modEnergy = TileTesseract.getField("modEnergy");
|
||||
|
||||
//TileConduitBase = Class.forName("thermalexpansion.block.conduit.TileConduitBase");
|
||||
//TileConduitBase_isInput = TileConduitBase.getField("isInput");
|
||||
//TileConduitBase_isOutput = TileConduitBase.getField("isOutput");
|
||||
|
||||
//TileEnergyCell_energyReceive = TileEnergyCell.getField("energyReceive");
|
||||
//TileEnergyCell_energySend = TileEnergyCell.getField("energySend");
|
||||
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[Thermal Expansion] Class not found. " + e);
|
||||
return;
|
||||
} catch (NoSuchMethodException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[Thermal Expansion] Method not found." + e);
|
||||
return;
|
||||
} catch (NoSuchFieldException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[Thermal Expansion] Field not found." + e);
|
||||
return;
|
||||
// } catch (Exception e){
|
||||
// mod_Waila.log.log(Level.WARNING, "[Thermal Expansion] Unhandled exception." + e);
|
||||
// return;
|
||||
}
|
||||
|
||||
ModuleRegistrar.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.energyhandler");
|
||||
ModuleRegistrar.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.energycell");
|
||||
ModuleRegistrar.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.fluidtype");
|
||||
ModuleRegistrar.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.fluidamount");
|
||||
ModuleRegistrar.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.conditemmode");
|
||||
ModuleRegistrar.instance().addConfig("Thermal Expansion", "thermalexpansion.tankmode");
|
||||
ModuleRegistrar.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.tesssendrecv");
|
||||
ModuleRegistrar.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.tessfreq");
|
||||
ModuleRegistrar.instance().addConfigRemote("Thermal Expansion", "thermalexpansion.owner");
|
||||
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerIEnergyHandler(), IEnergyHandler);
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerEnergyCell(), TileEnergyCell);
|
||||
ModuleRegistrar.instance().registerHeadProvider(new HUDHandlerTank(), TileTank);
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTank(), TileTank);
|
||||
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerTesseract(), TileTesseract);
|
||||
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerISecureTile(), ISecureTile);
|
||||
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerConduitFluid(), BlockMultipart);
|
||||
ModuleRegistrar.instance().registerBodyProvider(new HUDHandlerConduitItem(), BlockMultipart);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package mcp.mobius.waila.addons.twilightforest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class TwilightForestGenericOverride implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return new ItemStack(accessor.getBlock(), 0, accessor.getMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package mcp.mobius.waila.addons.twilightforest;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
public class TwilightForestModule {
|
||||
|
||||
public static Class BlockTFRoots = null;
|
||||
public static Class BlockTFPlant = null;
|
||||
public static Class BlockTFSapling = null;
|
||||
|
||||
public static void register(){
|
||||
|
||||
try{
|
||||
Class TwilightForestMod = Class.forName("twilightforest.TwilightForestMod");
|
||||
mod_Waila.log.log(Level.INFO, "TwilightForestMod mod found.");
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.INFO, "[TwilightForestMod] TwilightForestMod mod not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
BlockTFRoots = Class.forName("twilightforest.block.BlockTFRoots");
|
||||
BlockTFPlant = Class.forName("twilightforest.block.BlockTFPlant");
|
||||
BlockTFSapling = Class.forName("twilightforest.block.BlockTFSapling");
|
||||
} catch (ClassNotFoundException e) {
|
||||
mod_Waila.log.log(Level.WARNING, "[TwilightForestMod] Class not found. " + e);
|
||||
}
|
||||
|
||||
|
||||
ModuleRegistrar.instance().registerStackProvider(new TwilightForestGenericOverride(), BlockTFRoots);
|
||||
ModuleRegistrar.instance().registerStackProvider(new TwilightForestGenericOverride(), BlockTFPlant);
|
||||
//ExternalModulesHandler.instance().registerStackProvider(new TwilightForestGenericOverride(), BlockTFSapling);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
package mcp.mobius.waila.addons.vanillamc;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import mcp.mobius.waila.api.IWailaBlockDecorator;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.gui.helpers.UIHelper;
|
||||
|
||||
public class HUDDecoratorVanilla implements IWailaBlockDecorator {
|
||||
|
||||
@Override
|
||||
public void decorateBlock(ItemStack itemStack, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
//UIHelper.drawBillboardText(itemStack.getDisplayName(), accessor.getRenderingPosition(), 0.5F, 1.5F, 0.5F, accessor.getPartialFrame());
|
||||
UIHelper.drawFloatingText("IN", accessor.getRenderingPosition(), 0.5F, 0.2F, -0.2F, 90F, 0F, 0F);
|
||||
UIHelper.drawFloatingText("OUT", accessor.getRenderingPosition(), -0.2F, 0.2F, 0.5F, 90F, 90F, 0F);
|
||||
UIHelper.drawFloatingText("OUT", accessor.getRenderingPosition(), 1.2F, 0.2F, 0.5F, 90F, -90F, 0F);
|
||||
UIHelper.drawFloatingText("OUT", accessor.getRenderingPosition(), 0.5F, 0.2F, 1.2F, 90F, -180F, 0F);
|
||||
|
||||
double offset = 0.1;
|
||||
double delta = 1 + 2 * offset;
|
||||
|
||||
double x = accessor.getRenderingPosition().xCoord - offset;
|
||||
double y = accessor.getRenderingPosition().yCoord - offset;
|
||||
double z = accessor.getRenderingPosition().zCoord - offset;
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
|
||||
tessellator.setColorRGBA(255, 255, 255, 150);
|
||||
|
||||
tessellator.addVertex(x, y + 0.2 , z);
|
||||
tessellator.addVertex(x, y + 0.2 , z + delta/2 - 0.1);
|
||||
tessellator.addVertex(x + offset, y + 0.2, z + delta/2 - 0.1);
|
||||
tessellator.addVertex(x + offset, y + 0.2, z);
|
||||
|
||||
tessellator.addVertex(x, y + 0.2 , z + delta/2 + 0.1);
|
||||
tessellator.addVertex(x, y + 0.2 , z + delta);
|
||||
tessellator.addVertex(x + offset, y + 0.2, z + delta);
|
||||
tessellator.addVertex(x + offset, y + 0.2, z + delta/2 + 0.1);
|
||||
|
||||
tessellator.addVertex(x + delta - 0.1, y + 0.2 , z + 0.1);
|
||||
tessellator.addVertex(x + delta - 0.1, y + 0.2 , z + delta/2 - 0.1);
|
||||
tessellator.addVertex(x + delta + offset - 0.1, y + 0.2, z + delta/2 - 0.1);
|
||||
tessellator.addVertex(x + delta + offset - 0.1, y + 0.2, z + 0.1);
|
||||
|
||||
tessellator.addVertex(x + delta - 0.1, y + 0.2 , z + delta/2 + 0.1);
|
||||
tessellator.addVertex(x + delta - 0.1, y + 0.2 , z + delta);
|
||||
tessellator.addVertex(x + delta + offset - 0.1, y + 0.2, z + delta);
|
||||
tessellator.addVertex(x + delta + offset - 0.1, y + 0.2, z + delta/2 + 0.1);
|
||||
|
||||
|
||||
tessellator.addVertex(x+ 0.1, y + 0.2, z);
|
||||
tessellator.addVertex(x+ 0.1, y + 0.2, z+ offset);
|
||||
tessellator.addVertex(x+ delta/2 - 0.1, y + 0.2, z+ offset);
|
||||
tessellator.addVertex(x+ delta/2 - 0.1, y + 0.2, z);
|
||||
|
||||
tessellator.addVertex(x+ delta/2 + 0.1, y + 0.2, z);
|
||||
tessellator.addVertex(x+ delta/2 + 0.1, y + 0.2, z+ offset);
|
||||
tessellator.addVertex(x+ delta, y + 0.2, z+ offset);
|
||||
tessellator.addVertex(x+ delta, y + 0.2, z);
|
||||
|
||||
tessellator.addVertex(x + 0.1, y + 0.2, z+ delta - 0.1);
|
||||
tessellator.addVertex(x + 0.1, y + 0.2, z+ offset+ delta - 0.1);
|
||||
tessellator.addVertex(x+ delta/2 - 0.1, y + 0.2, z+ offset+ delta - 0.1);
|
||||
tessellator.addVertex(x+ delta/2 - 0.1, y + 0.2, z+ delta - 0.1);
|
||||
|
||||
tessellator.addVertex(x+ delta/2 + 0.1, y + 0.2, z+ delta - 0.1);
|
||||
tessellator.addVertex(x+ delta/2 + 0.1, y + 0.2, z+ offset+ delta - 0.1);
|
||||
tessellator.addVertex(x+ delta - 0.1, y + 0.2, z+ offset+ delta - 0.1);
|
||||
tessellator.addVertex(x+ delta - 0.1, y + 0.2, z+ delta - 0.1);
|
||||
|
||||
tessellator.draw();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,204 +0,0 @@
|
||||
package mcp.mobius.waila.addons.vanillamc;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import codechicken.lib.lang.LangUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockSilverfish;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemRecord;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntityMobSpawner;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
|
||||
public class HUDHandlerVanilla implements IWailaDataProvider {
|
||||
|
||||
static int mobSpawnerID = Block.mobSpawner.blockID;
|
||||
static int cropsID = Block.crops.blockID;
|
||||
static int melonStemID = Block.melonStem.blockID;
|
||||
static int pumpkinStemID = Block.pumpkinStem.blockID;
|
||||
static int carrotID = Block.carrot.blockID;
|
||||
static int potatoID = Block.potato.blockID;
|
||||
static int leverID = Block.lever.blockID;
|
||||
static int repeaterIdle = Block.redstoneRepeaterIdle.blockID;
|
||||
static int repeaterActv = Block.redstoneRepeaterActive.blockID;
|
||||
static int comparatorIdl = Block.redstoneComparatorIdle.blockID;
|
||||
static int comparatorAct = Block.redstoneComparatorActive.blockID;
|
||||
static int redstone = Block.redstoneWire.blockID;
|
||||
static int jukebox = Block.jukebox.blockID;
|
||||
static int cocoa = Block.cocoaPlant.blockID;
|
||||
static int netherwart = Block.netherStalk.blockID;
|
||||
static int silverfish = Block.silverfish.blockID;
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
int blockID = accessor.getBlockID();
|
||||
|
||||
if (blockID == silverfish){
|
||||
int metadata = accessor.getMetadata();
|
||||
switch(metadata){
|
||||
case 0:
|
||||
return new ItemStack(Block.stone);
|
||||
case 1:
|
||||
return new ItemStack(Block.cobblestone);
|
||||
case 2:
|
||||
return new ItemStack(Block.stoneBrick);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (blockID == redstone){
|
||||
return new ItemStack(Item.redstone);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
int blockID = accessor.getBlockID();
|
||||
|
||||
/* Mob spawner handler */
|
||||
if (blockID == mobSpawnerID && accessor.getTileEntity() instanceof TileEntityMobSpawner && config.getConfig("vanilla.spawntype")){
|
||||
String name = currenttip.get(0);
|
||||
String mobname = ((TileEntityMobSpawner)accessor.getTileEntity()).getSpawnerLogic().getEntityNameToSpawn();
|
||||
currenttip.set(0, String.format("%s (%s)", name, mobname));
|
||||
}
|
||||
|
||||
if (blockID == redstone){
|
||||
String name = currenttip.get(0).replaceFirst(String.format(" %s", accessor.getMetadata()), "");
|
||||
currenttip.set(0, name);
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
int blockID = accessor.getBlockID();
|
||||
/* Crops */
|
||||
if (config.getConfig("vanilla.growthvalue"))
|
||||
if (blockID == cropsID || blockID == melonStemID || blockID == pumpkinStemID || blockID == carrotID || blockID == potatoID){
|
||||
float growthValue = (accessor.getMetadata() / 7.0F) * 100.0F;
|
||||
if (growthValue < 100.0)
|
||||
currenttip.add(String.format("%s : %.0f %%", LangUtil.translateG("hud.msg.growth"), growthValue));
|
||||
else
|
||||
currenttip.add(String.format("%s : %s", LangUtil.translateG("hud.msg.growth"), LangUtil.translateG("hud.msg.mature")));
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
if (blockID == cocoa){
|
||||
|
||||
float growthValue = ((accessor.getMetadata() >> 2) / 2.0F) * 100.0F;
|
||||
if (growthValue < 100.0)
|
||||
currenttip.add(String.format("%s : %.0f %%", LangUtil.translateG("hud.msg.growth"), growthValue));
|
||||
else
|
||||
currenttip.add(String.format("%s : %s", LangUtil.translateG("hud.msg.growth"), LangUtil.translateG("hud.msg.mature")));
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
if (blockID == netherwart){
|
||||
float growthValue = (accessor.getMetadata() / 3.0F) * 100.0F;
|
||||
if (growthValue < 100.0)
|
||||
currenttip.add(String.format("%s : %.0f %%", LangUtil.translateG("hud.msg.growth"), growthValue));
|
||||
else
|
||||
currenttip.add(String.format("%s : %s", LangUtil.translateG("hud.msg.growth"), LangUtil.translateG("hud.msg.mature")));
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
if (config.getConfig("vanilla.leverstate"))
|
||||
if (blockID == leverID){
|
||||
String redstoneOn = (accessor.getMetadata() & 8) == 0 ? LangUtil.translateG("hud.msg.off") : LangUtil.translateG("hud.msg.on");
|
||||
currenttip.add(String.format("%s : %s", LangUtil.translateG("hud.msg.state"), redstoneOn));
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
if (config.getConfig("vanilla.repeater"))
|
||||
if ((blockID == repeaterIdle) ||(blockID == repeaterActv)){
|
||||
int tick = (accessor.getMetadata() >> 2) + 1 ;
|
||||
if (tick == 1)
|
||||
currenttip.add(String.format("%s : %s tick", LangUtil.translateG("hud.msg.delay"), tick));
|
||||
else
|
||||
currenttip.add(String.format("%s : %s ticks", LangUtil.translateG("hud.msg.delay"), tick));
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
if (config.getConfig("vanilla.comparator"))
|
||||
if ((blockID == comparatorIdl) ||(blockID == comparatorAct)){
|
||||
String mode = ((accessor.getMetadata() >> 2) & 1) == 0 ? LangUtil.translateG("hud.msg.comparator") : LangUtil.translateG("hud.msg.substractor");
|
||||
//int outputSignal = ((TileEntityComparator)entity).func_96100_a();
|
||||
currenttip.add("Mode : " + mode);
|
||||
//currenttip.add(String.format("Out : %s", outputSignal));
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
if (config.getConfig("vanilla.redstone"))
|
||||
if (blockID == redstone){
|
||||
currenttip.add(String.format("%s : %s" , LangUtil.translateG("hud.msg.power"), accessor.getMetadata()));
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
if (config.getConfig("vanilla.jukebox"))
|
||||
if (blockID == jukebox){
|
||||
NBTTagCompound tag = accessor.getNBTData();
|
||||
Item record = null;
|
||||
if (tag.hasKey("Record")){
|
||||
record = Item.itemsList[accessor.getNBTInteger(tag, "Record")];
|
||||
currenttip.add(((ItemRecord)record).getRecordTitle());
|
||||
} else {
|
||||
currenttip.add(LangUtil.translateG("hud.msg.empty"));
|
||||
}
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
public static void register(){
|
||||
ModuleRegistrar.instance().addConfig("VanillaMC", "vanilla.spawntype");
|
||||
ModuleRegistrar.instance().addConfig("VanillaMC", "vanilla.growthvalue");
|
||||
ModuleRegistrar.instance().addConfig("VanillaMC", "vanilla.leverstate");
|
||||
ModuleRegistrar.instance().addConfig("VanillaMC", "vanilla.repeater");
|
||||
ModuleRegistrar.instance().addConfig("VanillaMC", "vanilla.comparator");
|
||||
ModuleRegistrar.instance().addConfig("VanillaMC", "vanilla.redstone");
|
||||
ModuleRegistrar.instance().addConfigRemote("VanillaMC", "vanilla.jukebox");
|
||||
|
||||
IWailaDataProvider provider = new HUDHandlerVanilla();
|
||||
|
||||
ModuleRegistrar.instance().registerStackProvider(provider, silverfish);
|
||||
ModuleRegistrar.instance().registerStackProvider(provider, redstone);
|
||||
ModuleRegistrar.instance().registerHeadProvider(provider, mobSpawnerID);
|
||||
ModuleRegistrar.instance().registerBodyProvider(provider, cropsID);
|
||||
ModuleRegistrar.instance().registerBodyProvider(provider, melonStemID);
|
||||
ModuleRegistrar.instance().registerBodyProvider(provider, pumpkinStemID);
|
||||
ModuleRegistrar.instance().registerBodyProvider(provider, carrotID);
|
||||
ModuleRegistrar.instance().registerBodyProvider(provider, potatoID);
|
||||
ModuleRegistrar.instance().registerBodyProvider(provider, leverID);
|
||||
ModuleRegistrar.instance().registerBodyProvider(provider, repeaterIdle);
|
||||
ModuleRegistrar.instance().registerBodyProvider(provider, repeaterActv);
|
||||
ModuleRegistrar.instance().registerBodyProvider(provider, comparatorIdl);
|
||||
ModuleRegistrar.instance().registerBodyProvider(provider, comparatorAct);
|
||||
ModuleRegistrar.instance().registerHeadProvider(provider, redstone);
|
||||
ModuleRegistrar.instance().registerBodyProvider(provider, redstone);
|
||||
ModuleRegistrar.instance().registerBodyProvider(provider, jukebox);
|
||||
ModuleRegistrar.instance().registerBodyProvider(provider, cocoa);
|
||||
ModuleRegistrar.instance().registerBodyProvider(provider, netherwart);
|
||||
|
||||
ModuleRegistrar.instance().registerDocTextFile("/mcp/mobius/waila/addons/vanillamc/WikiData.csv");
|
||||
|
||||
//ExternalModulesHandler.instance().registerBlockDecorator(new HUDDecoratorVanilla(), repeaterIdle);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package mcp.mobius.waila.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IWailaBlock {
|
||||
/*
|
||||
* Use this method to return an item stack in case the default lookup system fails.
|
||||
* Return null if you want to use the default lookup system.
|
||||
* You get the world, the player and the location of the block. With that, it is easy to gather information & tile entities
|
||||
*/
|
||||
ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config);
|
||||
|
||||
/* Waila HUD is divided into 3 zones. The head corresponds to the item name,
|
||||
* body to where you mostly want to put informations, and I reserve the tail for modname display
|
||||
*/
|
||||
|
||||
/* Those 2 methods works exactly the same way, except they are related to a different zone in Waila HUD.
|
||||
* You get in input world, player and the block location. You also get the itemstack as returned by the default lookup system or getWailaStack().
|
||||
* ConfigHandler provides the current Waila config state so you can show/hide elements depending on the configuration. Refer the ConfigHandler class for more info.
|
||||
* currenttip represents the current list of text lines in the tooltip zone.
|
||||
* For example, getWailaHead() will have the current item name as currenttip.
|
||||
* You can modify the tips, add more, remove some, etc.
|
||||
* When you are done, just returns the currenttip and it will display in Waila.
|
||||
*
|
||||
* Always return the currenttip is you don't want to modify the current zone.
|
||||
*/
|
||||
|
||||
List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config);
|
||||
List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config);
|
||||
List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package mcp.mobius.waila.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IWailaBlockDecorator {
|
||||
|
||||
void decorateBlock(ItemStack itemStack, IWailaDataAccessor accessor, IWailaConfigHandler config);
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package mcp.mobius.waila.api;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
|
||||
public interface IWailaConfigHandler {
|
||||
/* Returns a set of all the currently loaded modules in the config handler */
|
||||
public Set<String> getModuleNames();
|
||||
|
||||
/* Returns all the currently available options for a given module */
|
||||
public HashMap<String, String> getConfigKeys(String modName);
|
||||
|
||||
/* Add a new option to a given module
|
||||
*
|
||||
* modName is the name of the module to add the option to (ie : Buildcraft, IndustrialCraft2, etc)
|
||||
* key is the config key (ie : bc.tankcontent, ic2.inputvalue)
|
||||
* name is the human readable name of the option (ie : "Tank content", "Max EU Input")
|
||||
* */
|
||||
//public void addConfig(String modName, String key, String name);
|
||||
|
||||
/* Returns the current value of an option (true/false) with a default value defvalue if not set*/
|
||||
public boolean getConfig(String key, boolean defvalue);
|
||||
|
||||
/* Returns the current value of an option (true/false) with a default value true if not set*/
|
||||
public boolean getConfig(String key);
|
||||
|
||||
public void setConfig(String key, boolean value);
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package mcp.mobius.waila.api;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public interface IWailaDataAccessor {
|
||||
World getWorld();
|
||||
EntityPlayer getPlayer();
|
||||
Block getBlock();
|
||||
int getBlockID();
|
||||
int getMetadata();
|
||||
TileEntity getTileEntity();
|
||||
MovingObjectPosition getPosition();
|
||||
Vec3 getRenderingPosition();
|
||||
NBTTagCompound getNBTData();
|
||||
int getNBTInteger(NBTTagCompound tag, String keyname);
|
||||
double getPartialFrame();
|
||||
ForgeDirection getSide();
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package mcp.mobius.waila.api;
|
||||
|
||||
public interface IWailaDataProvider extends IWailaBlock{
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package mcp.mobius.waila.api;
|
||||
|
||||
public interface IWailaRegistrar {
|
||||
/* Add a config option in the section modname with displayed text configtext and access key keyname */
|
||||
public void addConfig(String modname, String keyname, String configtext);
|
||||
public void addConfigRemote(String modname, String keyname, String configtext);
|
||||
public void addConfig(String modname, String keyname);
|
||||
public void addConfigRemote(String modname, String keyname);
|
||||
|
||||
/* Register a IWailaDataProvider for the given blockID, either for the Head section or the Body section */
|
||||
public void registerHeadProvider (IWailaDataProvider dataProvider, int blockID);
|
||||
public void registerBodyProvider (IWailaDataProvider dataProvider, int blockID);
|
||||
public void registerTailProvider (IWailaDataProvider dataProvider, int blockID);
|
||||
|
||||
/* Register a stack overrider for the given blockID */
|
||||
public void registerStackProvider(IWailaDataProvider dataProvider, int blockID);
|
||||
public void registerStackProvider(IWailaDataProvider dataProvider, Class block);
|
||||
|
||||
/* Same thing, but works on a class hierarchy instead */
|
||||
public void registerHeadProvider (IWailaDataProvider dataProvider, Class block);
|
||||
public void registerBodyProvider (IWailaDataProvider dataProvider, Class block);
|
||||
public void registerTailProvider (IWailaDataProvider dataProvider, Class block);
|
||||
|
||||
/* The block decorators */
|
||||
public void registerBlockDecorator (IWailaBlockDecorator decorator, int blockID);
|
||||
public void registerBlockDecorator (IWailaBlockDecorator decorator, Class block);
|
||||
|
||||
public void registerDocTextFile (String filename);
|
||||
|
||||
public void registerShortDataProvider (IWailaSummaryProvider dataProvider, Class item);
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package mcp.mobius.waila.api;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IWailaSummaryProvider {
|
||||
/* This interface is used to control the display data in the description screen */
|
||||
|
||||
/* BASIC TOOLS & ITEMS DATA */
|
||||
//EnumToolMaterial getMaterial(ItemStack stack);
|
||||
//String getMaterialName(ItemStack stack);
|
||||
//String getEffectiveBlock(ItemStack stack);
|
||||
//int getHarvestLevel(ItemStack stack);
|
||||
//float getEfficiencyOnProperMaterial(ItemStack stack);
|
||||
//int getEnchantability(ItemStack stack);
|
||||
//int getDamageVsEntity(ItemStack stack);
|
||||
//int getDurability(ItemStack stack);
|
||||
|
||||
LinkedHashMap<String, String> getSummary(ItemStack stack, LinkedHashMap<String, String> currentSummary, IWailaConfigHandler config);
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
package mcp.mobius.waila.api.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Set;
|
||||
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import net.minecraftforge.common.Property;
|
||||
|
||||
public class ConfigHandler implements IWailaConfigHandler {
|
||||
|
||||
private static ConfigHandler instance = null;
|
||||
private LinkedHashMap<String, ConfigModule> modules = new LinkedHashMap<String, ConfigModule>();
|
||||
private ArrayList<String> serverconfigs = new ArrayList<String>();
|
||||
|
||||
private ConfigHandler() {
|
||||
instance = this;
|
||||
}
|
||||
|
||||
public static ConfigHandler instance(){
|
||||
if (ConfigHandler.instance == null)
|
||||
ConfigHandler.instance = new ConfigHandler();
|
||||
return ConfigHandler.instance;
|
||||
}
|
||||
|
||||
public void addModule(String modName, HashMap<String, String> options){
|
||||
this.addModule(modName, new ConfigModule(modName, options));
|
||||
}
|
||||
|
||||
public void addModule(String modName, ConfigModule options){
|
||||
this.modules.put(modName, options);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getModuleNames(){
|
||||
return this.modules.keySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<String, String> getConfigKeys(String modName){
|
||||
if (this.modules.containsKey(modName))
|
||||
return this.modules.get(modName).options;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addConfig(String modName, String key, String name){
|
||||
if (!this.modules.containsKey(modName))
|
||||
this.modules.put(modName, new ConfigModule(modName));
|
||||
|
||||
this.modules.get(modName).addOption(key, name);
|
||||
}
|
||||
|
||||
public void addConfigServer(String modName, String key, String name){
|
||||
if (!this.modules.containsKey(modName))
|
||||
this.modules.put(modName, new ConfigModule(modName));
|
||||
|
||||
this.modules.get(modName).addOption(key, name);
|
||||
this.serverconfigs.add(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getConfig(String key, boolean defvalue){
|
||||
mod_Waila.instance.config.load();
|
||||
|
||||
if (this.serverconfigs.contains(key) && !mod_Waila.instance.serverPresent)
|
||||
return false;
|
||||
|
||||
Property prop = mod_Waila.instance.config.get(Configuration.CATEGORY_GENERAL, key, defvalue);
|
||||
return prop.getBoolean(defvalue);
|
||||
}
|
||||
|
||||
public boolean isServerRequired(String key){
|
||||
return this.serverconfigs.contains(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getConfig(String key){
|
||||
return this.getConfig(key, true);
|
||||
}
|
||||
|
||||
public int getConfigInt(String key){
|
||||
mod_Waila.instance.config.load();
|
||||
Property prop = mod_Waila.instance.config.get(Configuration.CATEGORY_GENERAL, key, 0);
|
||||
return prop.getInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConfig(String key, boolean value){
|
||||
mod_Waila.instance.config.load();
|
||||
mod_Waila.instance.config.get(Configuration.CATEGORY_GENERAL, key, true).set(value);;
|
||||
mod_Waila.instance.config.save();
|
||||
}
|
||||
|
||||
public void setConfigInt(String key, int value){
|
||||
mod_Waila.instance.config.load();
|
||||
mod_Waila.instance.config.get(Configuration.CATEGORY_GENERAL, key, 0).set(value);;
|
||||
mod_Waila.instance.config.save();
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package mcp.mobius.waila.api.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class ConfigModule {
|
||||
|
||||
String modName;
|
||||
HashMap<String, String> options;
|
||||
|
||||
public ConfigModule(String _modName){
|
||||
this.modName = _modName;
|
||||
this.options = new HashMap<String, String>();
|
||||
}
|
||||
|
||||
public ConfigModule(String _modName, HashMap<String, String> _options) {
|
||||
this.modName = _modName;
|
||||
this.options = _options;
|
||||
}
|
||||
|
||||
public void addOption(String key, String name){
|
||||
this.options.put(key,name);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,176 +0,0 @@
|
||||
package mcp.mobius.waila.api.impl;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagByte;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagInt;
|
||||
import net.minecraft.nbt.NBTTagShort;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
|
||||
public class DataAccessor implements IWailaDataAccessor {
|
||||
|
||||
public World world;
|
||||
public EntityPlayer player;
|
||||
public MovingObjectPosition mop;
|
||||
public Vec3 renderingvec = null;
|
||||
public Block block;
|
||||
public int blockID;
|
||||
public int metadata;
|
||||
public TileEntity entity;
|
||||
public NBTTagCompound remoteNbt = null;
|
||||
public long timeLastUpdate = System.currentTimeMillis();
|
||||
public double partialFrame;
|
||||
|
||||
public static DataAccessor instance = new DataAccessor();
|
||||
|
||||
public void set(World _world, EntityPlayer _player, MovingObjectPosition _mop) {
|
||||
this.set(_world, _player, _mop, null, 0.0);
|
||||
}
|
||||
|
||||
public void set(World _world, EntityPlayer _player, MovingObjectPosition _mop, EntityLivingBase viewEntity, double partialTicks) {
|
||||
this.world = _world;
|
||||
this.player = _player;
|
||||
this.mop = _mop;
|
||||
this.blockID = world.getBlockId(_mop.blockX, _mop.blockY, _mop.blockZ);
|
||||
this.block = Block.blocksList[this.blockID];
|
||||
this.metadata = world.getBlockMetadata(_mop.blockX, _mop.blockY, _mop.blockZ);
|
||||
this.entity = world.getBlockTileEntity(_mop.blockX, _mop.blockY, _mop.blockZ);
|
||||
|
||||
if (viewEntity != null){
|
||||
double px = viewEntity.lastTickPosX + (viewEntity.posX - viewEntity.lastTickPosX) * partialTicks;
|
||||
double py = viewEntity.lastTickPosY + (viewEntity.posY - viewEntity.lastTickPosY) * partialTicks;
|
||||
double pz = viewEntity.lastTickPosZ + (viewEntity.posZ - viewEntity.lastTickPosZ) * partialTicks;
|
||||
this.renderingvec = Vec3.createVectorHelper(_mop.blockX - px, _mop.blockY - py, _mop.blockZ - pz);
|
||||
this.partialFrame = partialTicks;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld() {
|
||||
return this.world;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityPlayer getPlayer() {
|
||||
return this.player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getBlock() {
|
||||
return this.block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockID() {
|
||||
return this.blockID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata() {
|
||||
return this.metadata;
|
||||
}
|
||||
|
||||
public void setBlock(Block block) {
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
public void setBlockID(int val) {
|
||||
this.blockID = val;
|
||||
}
|
||||
|
||||
public void setMetadata(int val) {
|
||||
this.metadata = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getTileEntity() {
|
||||
return this.entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MovingObjectPosition getPosition() {
|
||||
return this.mop;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData() {
|
||||
if (this.entity == null) return null;
|
||||
|
||||
if (this.isTagCorrect(this.remoteNbt))
|
||||
return this.remoteNbt;
|
||||
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
this.entity.writeToNBT(tag);
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNBTInteger(NBTTagCompound tag, String keyname){
|
||||
NBTBase subtag = tag.getTag(keyname);
|
||||
if (subtag instanceof NBTTagInt)
|
||||
return tag.getInteger(keyname);
|
||||
if (subtag instanceof NBTTagShort)
|
||||
return tag.getShort(keyname);
|
||||
if (subtag instanceof NBTTagByte)
|
||||
return tag.getByte(keyname);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private boolean isTagCorrect(NBTTagCompound tag){
|
||||
if (tag == null){
|
||||
this.timeLastUpdate = System.currentTimeMillis() - 250;
|
||||
return false;
|
||||
}
|
||||
|
||||
int x = tag.getInteger("x");
|
||||
int y = tag.getInteger("y");
|
||||
int z = tag.getInteger("z");
|
||||
|
||||
if (x == this.mop.blockX && y == this.mop.blockY && z == this.mop.blockZ)
|
||||
return true;
|
||||
else {
|
||||
this.timeLastUpdate = System.currentTimeMillis() - 250;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3 getRenderingPosition() {
|
||||
return this.renderingvec;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getPartialFrame() {
|
||||
return this.partialFrame;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForgeDirection getSide(){
|
||||
int side = this.getPosition().sideHit;
|
||||
switch (side){
|
||||
case 0:
|
||||
return ForgeDirection.DOWN;
|
||||
case 1:
|
||||
return ForgeDirection.UP;
|
||||
case 2:
|
||||
return ForgeDirection.EAST;
|
||||
case 3:
|
||||
return ForgeDirection.WEST;
|
||||
case 4:
|
||||
return ForgeDirection.NORTH;
|
||||
case 5:
|
||||
return ForgeDirection.SOUTH;
|
||||
}
|
||||
return ForgeDirection.UNKNOWN;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,139 +0,0 @@
|
||||
package mcp.mobius.waila.api.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.WailaExceptionHandler;
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.api.IWailaBlock;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.network.Packet0x01TERequest;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import codechicken.nei.api.ItemInfo.Layout;
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
|
||||
public class MetaDataProvider{
|
||||
|
||||
private ArrayList<IWailaDataProvider> headProviders = new ArrayList<IWailaDataProvider>();
|
||||
private ArrayList<IWailaDataProvider> bodyProviders = new ArrayList<IWailaDataProvider>();
|
||||
private ArrayList<IWailaDataProvider> tailProviders = new ArrayList<IWailaDataProvider>();
|
||||
private Class prevBlock = null;
|
||||
private Class prevTile = null;
|
||||
|
||||
public ItemStack identifyHighlight(World world, EntityPlayer player, MovingObjectPosition mop, DataAccessor accessor) {
|
||||
Block block = accessor.getBlock();
|
||||
int blockID = accessor.getBlockID();
|
||||
|
||||
if (IWailaBlock.class.isInstance(block)){
|
||||
try{
|
||||
return ((IWailaBlock)block).getWailaStack(accessor, ConfigHandler.instance());
|
||||
}catch (Throwable e){
|
||||
WailaExceptionHandler.handleErr(e, block.getClass().toString(), null);
|
||||
}
|
||||
}
|
||||
|
||||
if(ModuleRegistrar.instance().hasStackProviders(blockID)){
|
||||
for (IWailaDataProvider dataProvider : ModuleRegistrar.instance().getStackProviders(blockID)){
|
||||
try{
|
||||
ItemStack retval = dataProvider.getWailaStack(accessor, ConfigHandler.instance());
|
||||
if (retval != null)
|
||||
return retval;
|
||||
}catch (Throwable e){
|
||||
WailaExceptionHandler.handleErr(e, dataProvider.getClass().toString(), null);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<String> handleTextData(ItemStack itemStack, World world, EntityPlayer player, MovingObjectPosition mop, DataAccessor accessor, List<String> currenttip, Layout layout) {
|
||||
Block block = accessor.getBlock();
|
||||
int blockID = accessor.getBlockID();
|
||||
|
||||
if (accessor.getTileEntity() != null && mod_Waila.instance.serverPresent &&
|
||||
((System.currentTimeMillis() - accessor.timeLastUpdate >= 250))){
|
||||
accessor.timeLastUpdate = System.currentTimeMillis();
|
||||
PacketDispatcher.sendPacketToServer(Packet0x01TERequest.create(world, mop));
|
||||
}
|
||||
|
||||
/* Interface IWailaBlock */
|
||||
if (IWailaBlock.class.isInstance(block)){
|
||||
TileEntity entity = world.getBlockTileEntity(mop.blockX, mop.blockY, mop.blockZ);
|
||||
if (layout == Layout.HEADER)
|
||||
try{
|
||||
return ((IWailaBlock)block).getWailaHead(itemStack, currenttip, accessor, ConfigHandler.instance());
|
||||
} catch (Throwable e){
|
||||
return WailaExceptionHandler.handleErr(e, block.getClass().toString(), currenttip);
|
||||
}
|
||||
else if (layout == Layout.BODY)
|
||||
try{
|
||||
return ((IWailaBlock)block).getWailaBody(itemStack, currenttip, accessor, ConfigHandler.instance());
|
||||
} catch (Throwable e){
|
||||
return WailaExceptionHandler.handleErr(e, block.getClass().toString(), currenttip);
|
||||
}
|
||||
else if (layout == Layout.FOOTER)
|
||||
try{
|
||||
return ((IWailaBlock)block).getWailaTail(itemStack, currenttip, accessor, ConfigHandler.instance());
|
||||
} catch (Throwable e){
|
||||
return WailaExceptionHandler.handleErr(e, block.getClass().toString(), currenttip);
|
||||
}
|
||||
}
|
||||
|
||||
headProviders.clear();
|
||||
bodyProviders.clear();
|
||||
tailProviders.clear();
|
||||
|
||||
/* Lookup by class (for blocks)*/
|
||||
if (layout == Layout.HEADER && ModuleRegistrar.instance().hasHeadProviders(block))
|
||||
headProviders.addAll(ModuleRegistrar.instance().getHeadProviders(block));
|
||||
|
||||
else if (layout == Layout.BODY && ModuleRegistrar.instance().hasBodyProviders(block))
|
||||
bodyProviders.addAll(ModuleRegistrar.instance().getBodyProviders(block));
|
||||
|
||||
else if (layout == Layout.FOOTER && ModuleRegistrar.instance().hasTailProviders(block))
|
||||
tailProviders.addAll(ModuleRegistrar.instance().getTailProviders(block));
|
||||
|
||||
|
||||
/* Lookup by class (for tileentities)*/
|
||||
if (layout == Layout.HEADER && ModuleRegistrar.instance().hasHeadProviders(accessor.getTileEntity()))
|
||||
headProviders.addAll(ModuleRegistrar.instance().getHeadProviders(accessor.getTileEntity()));
|
||||
|
||||
else if (layout == Layout.BODY && ModuleRegistrar.instance().hasBodyProviders(accessor.getTileEntity()))
|
||||
bodyProviders.addAll(ModuleRegistrar.instance().getBodyProviders(accessor.getTileEntity()));
|
||||
|
||||
else if (layout == Layout.FOOTER && ModuleRegistrar.instance().hasTailProviders(accessor.getTileEntity()))
|
||||
tailProviders.addAll(ModuleRegistrar.instance().getTailProviders(accessor.getTileEntity()));
|
||||
|
||||
/* Apply all collected providers */
|
||||
if (layout == Layout.HEADER)
|
||||
for (IWailaDataProvider dataProvider : headProviders)
|
||||
try{
|
||||
currenttip = dataProvider.getWailaHead(itemStack, currenttip, accessor, ConfigHandler.instance());
|
||||
} catch (Throwable e){
|
||||
currenttip = WailaExceptionHandler.handleErr(e, dataProvider.getClass().toString(), currenttip);
|
||||
}
|
||||
|
||||
if (layout == Layout.BODY)
|
||||
for (IWailaDataProvider dataProvider : bodyProviders)
|
||||
try{
|
||||
currenttip = dataProvider.getWailaBody(itemStack, currenttip, accessor, ConfigHandler.instance());
|
||||
} catch (Throwable e){
|
||||
currenttip = WailaExceptionHandler.handleErr(e, dataProvider.getClass().toString(), currenttip);
|
||||
}
|
||||
|
||||
if (layout == Layout.FOOTER)
|
||||
for (IWailaDataProvider dataProvider : tailProviders)
|
||||
try{
|
||||
currenttip = dataProvider.getWailaTail(itemStack, currenttip, accessor, ConfigHandler.instance());
|
||||
} catch (Throwable e){
|
||||
currenttip = WailaExceptionHandler.handleErr(e, dataProvider.getClass().toString(), currenttip);
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
}
|
||||
@@ -1,372 +0,0 @@
|
||||
package mcp.mobius.waila.api.impl;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import au.com.bytecode.opencsv.CSVReader;
|
||||
import net.minecraft.block.Block;
|
||||
import codechicken.lib.lang.LangUtil;
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.api.IWailaBlockDecorator;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.IWailaRegistrar;
|
||||
import mcp.mobius.waila.api.IWailaSummaryProvider;
|
||||
|
||||
public class ModuleRegistrar implements IWailaRegistrar {
|
||||
|
||||
private static ModuleRegistrar instance = null;
|
||||
//public LinkedHashMap<Integer, ArrayList<IWailaDataProvider>> headProviders = new LinkedHashMap<Integer, ArrayList<IWailaDataProvider>>();
|
||||
//public LinkedHashMap<Integer, ArrayList<IWailaDataProvider>> bodyProviders = new LinkedHashMap<Integer, ArrayList<IWailaDataProvider>>();
|
||||
//public LinkedHashMap<Integer, ArrayList<IWailaDataProvider>> tailProviders = new LinkedHashMap<Integer, ArrayList<IWailaDataProvider>>();
|
||||
public LinkedHashMap<Integer, ArrayList<IWailaDataProvider>> stackProviders = new LinkedHashMap<Integer, ArrayList<IWailaDataProvider>>();
|
||||
|
||||
public LinkedHashMap<Class, ArrayList<IWailaDataProvider>> headBlockProviders = new LinkedHashMap<Class, ArrayList<IWailaDataProvider>>();
|
||||
public LinkedHashMap<Class, ArrayList<IWailaDataProvider>> bodyBlockProviders = new LinkedHashMap<Class, ArrayList<IWailaDataProvider>>();
|
||||
public LinkedHashMap<Class, ArrayList<IWailaDataProvider>> tailBlockProviders = new LinkedHashMap<Class, ArrayList<IWailaDataProvider>>();
|
||||
//public LinkedHashMap<Class, ArrayList<IWailaDataProvider>> stackBlockProviders = new LinkedHashMap<Class, ArrayList<IWailaDataProvider>>();
|
||||
|
||||
public LinkedHashMap<Integer, ArrayList<IWailaBlockDecorator>> blockIdDecorators = new LinkedHashMap<Integer, ArrayList<IWailaBlockDecorator>>();
|
||||
public LinkedHashMap<Class, ArrayList<IWailaBlockDecorator>> blockClassDecorators = new LinkedHashMap<Class, ArrayList<IWailaBlockDecorator>>();
|
||||
|
||||
public LinkedHashMap<String, LinkedHashMap <String, LinkedHashMap <String, String>>> wikiDescriptions = new LinkedHashMap<String, LinkedHashMap <String, LinkedHashMap <String, String>>>();
|
||||
|
||||
public LinkedHashMap<Class, ArrayList<IWailaSummaryProvider>> summaryProviders = new LinkedHashMap<Class, ArrayList<IWailaSummaryProvider>>();
|
||||
|
||||
private ModuleRegistrar() {
|
||||
instance = this;
|
||||
}
|
||||
|
||||
public static ModuleRegistrar instance(){
|
||||
if (ModuleRegistrar.instance == null)
|
||||
ModuleRegistrar.instance = new ModuleRegistrar();
|
||||
return ModuleRegistrar.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addConfig(String modname, String key, String configname) {
|
||||
ConfigHandler.instance().addConfig(modname, key, LangUtil.translateG(configname));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addConfigRemote(String modname, String key, String configname) {
|
||||
ConfigHandler.instance().addConfigServer(modname, key, LangUtil.translateG(configname));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addConfig(String modname, String key) {
|
||||
ConfigHandler.instance().addConfig(modname, key, LangUtil.translateG("option." + key));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addConfigRemote(String modname, String key) {
|
||||
ConfigHandler.instance().addConfigServer(modname, key, LangUtil.translateG("option." + key));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerHeadProvider(IWailaDataProvider dataProvider, int blockID) {
|
||||
this.registerHeadProvider(dataProvider, Block.blocksList[blockID].getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerHeadProvider(IWailaDataProvider dataProvider, Class block) {
|
||||
if (!this.headBlockProviders.containsKey(block))
|
||||
this.headBlockProviders.put(block, new ArrayList<IWailaDataProvider>());
|
||||
|
||||
ArrayList<IWailaDataProvider> providers = this.headBlockProviders.get(block);
|
||||
if (providers.contains(dataProvider)) return;
|
||||
|
||||
this.headBlockProviders.get(block).add(dataProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBodyProvider(IWailaDataProvider dataProvider, int blockID) {
|
||||
this.registerBodyProvider(dataProvider, Block.blocksList[blockID].getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBodyProvider(IWailaDataProvider dataProvider, Class block) {
|
||||
if (!this.bodyBlockProviders.containsKey(block))
|
||||
this.bodyBlockProviders.put(block, new ArrayList<IWailaDataProvider>());
|
||||
|
||||
ArrayList<IWailaDataProvider> providers = this.bodyBlockProviders.get(block);
|
||||
if (providers.contains(dataProvider)) return;
|
||||
|
||||
this.bodyBlockProviders.get(block).add(dataProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerTailProvider(IWailaDataProvider dataProvider, int blockID) {
|
||||
this.registerTailProvider(dataProvider, Block.blocksList[blockID].getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerTailProvider(IWailaDataProvider dataProvider, Class block) {
|
||||
if (!this.tailBlockProviders.containsKey(block))
|
||||
this.tailBlockProviders.put(block, new ArrayList<IWailaDataProvider>());
|
||||
|
||||
ArrayList<IWailaDataProvider> providers = this.tailBlockProviders.get(block);
|
||||
if (providers.contains(dataProvider)) return;
|
||||
|
||||
this.tailBlockProviders.get(block).add(dataProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerStackProvider(IWailaDataProvider dataProvider, int blockID) {
|
||||
if (!this.stackProviders.containsKey(blockID))
|
||||
this.stackProviders.put(blockID, new ArrayList<IWailaDataProvider>());
|
||||
this.stackProviders.get(blockID).add(dataProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerStackProvider(IWailaDataProvider dataProvider, Class block) {
|
||||
for (int i = 0; i < Block.blocksList.length; i++)
|
||||
if (block.isInstance(Block.blocksList[i])){
|
||||
this.registerStackProvider(dataProvider, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerShortDataProvider(IWailaSummaryProvider dataProvider, Class item) {
|
||||
if (!this.summaryProviders.containsKey(item))
|
||||
this.summaryProviders.put(item, new ArrayList<IWailaSummaryProvider>());
|
||||
this.summaryProviders.get(item).add(dataProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockDecorator(IWailaBlockDecorator decorator, int blockID) {
|
||||
if (!this.blockIdDecorators.containsKey(blockID))
|
||||
this.blockIdDecorators.put(blockID, new ArrayList<IWailaBlockDecorator>());
|
||||
this.blockIdDecorators.get(blockID).add(decorator);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockDecorator(IWailaBlockDecorator decorator, Class block) {
|
||||
if (!this.blockClassDecorators.containsKey(block))
|
||||
this.blockClassDecorators.put(block, new ArrayList<IWailaBlockDecorator>());
|
||||
this.blockClassDecorators.get(block).add(decorator);
|
||||
}
|
||||
|
||||
public ArrayList<IWailaDataProvider> getHeadProviders(Object block) {
|
||||
ArrayList<IWailaDataProvider> returnList = new ArrayList<IWailaDataProvider>();
|
||||
for (Class clazz : this.headBlockProviders.keySet())
|
||||
if (clazz.isInstance(block))
|
||||
returnList.addAll(this.headBlockProviders.get(clazz));
|
||||
|
||||
return returnList;
|
||||
}
|
||||
|
||||
public ArrayList<IWailaDataProvider> getBodyProviders(Object block) {
|
||||
ArrayList<IWailaDataProvider> returnList = new ArrayList<IWailaDataProvider>();
|
||||
for (Class clazz : this.bodyBlockProviders.keySet())
|
||||
if (clazz.isInstance(block))
|
||||
returnList.addAll(this.bodyBlockProviders.get(clazz));
|
||||
|
||||
return returnList;
|
||||
}
|
||||
|
||||
public ArrayList<IWailaDataProvider> getTailProviders(Object block) {
|
||||
ArrayList<IWailaDataProvider> returnList = new ArrayList<IWailaDataProvider>();
|
||||
for (Class clazz : this.tailBlockProviders.keySet())
|
||||
if (clazz.isInstance(block))
|
||||
returnList.addAll(this.tailBlockProviders.get(clazz));
|
||||
|
||||
return returnList;
|
||||
}
|
||||
|
||||
public ArrayList<IWailaDataProvider> getStackProviders(int blockID) {
|
||||
return this.stackProviders.get(blockID);
|
||||
}
|
||||
|
||||
public ArrayList<IWailaSummaryProvider> getSummaryProvider(Object item){
|
||||
ArrayList<IWailaSummaryProvider> returnList = new ArrayList<IWailaSummaryProvider>();
|
||||
for (Class clazz : this.summaryProviders.keySet())
|
||||
if (clazz.isInstance(item))
|
||||
returnList.addAll(this.summaryProviders.get(clazz));
|
||||
|
||||
return returnList;
|
||||
}
|
||||
|
||||
public ArrayList<IWailaBlockDecorator> getBlockDecorators(int blockID){
|
||||
return this.blockIdDecorators.get(blockID);
|
||||
}
|
||||
|
||||
public ArrayList<IWailaBlockDecorator> getBlockDecorators(Object block){
|
||||
ArrayList<IWailaBlockDecorator> returnList = new ArrayList<IWailaBlockDecorator>();
|
||||
for (Class clazz : this.blockClassDecorators.keySet())
|
||||
if (clazz.isInstance(block))
|
||||
returnList.addAll(this.blockClassDecorators.get(clazz));
|
||||
|
||||
return returnList;
|
||||
}
|
||||
|
||||
public boolean hasStackProviders(int blockID){
|
||||
return this.stackProviders.containsKey(blockID);
|
||||
}
|
||||
|
||||
public boolean hasHeadProviders(Object block){
|
||||
for (Class clazz : this.headBlockProviders.keySet())
|
||||
if (clazz.isInstance(block))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasBodyProviders(Object block){
|
||||
for (Class clazz : this.bodyBlockProviders.keySet())
|
||||
if (clazz.isInstance(block))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasTailProviders(Object block){
|
||||
for (Class clazz : this.tailBlockProviders.keySet())
|
||||
if (clazz.isInstance(block))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasSummaryProvider(Class item){
|
||||
return this.summaryProviders.containsKey(item);
|
||||
}
|
||||
|
||||
public boolean hasBlockDecorator(int blockID){
|
||||
return this.blockIdDecorators.containsKey(blockID);
|
||||
}
|
||||
|
||||
public boolean hasBlockDecorator(Object block){
|
||||
for (Class clazz : this.blockClassDecorators.keySet())
|
||||
if (clazz.isInstance(block))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* ----------------- */
|
||||
@Override
|
||||
public void registerDocTextFile(String filename) {
|
||||
List<String[]> docData = null;
|
||||
int nentries = 0;
|
||||
|
||||
|
||||
try{
|
||||
docData = this.readFileAsString(filename);
|
||||
} catch (IOException e){
|
||||
mod_Waila.log.log(Level.WARNING, String.format("Error while accessing file %s : %s", filename, e));
|
||||
return;
|
||||
}
|
||||
|
||||
for (String[] ss : docData){
|
||||
String modid = ss[0];
|
||||
String name = ss[1];
|
||||
String meta = ss[2];
|
||||
String desc = ss[5].replace('$', '\n');
|
||||
if (!(desc.trim().equals(""))){
|
||||
if (!this.wikiDescriptions.containsKey(modid))
|
||||
this.wikiDescriptions.put(modid, new LinkedHashMap <String, LinkedHashMap <String, String>>());
|
||||
if (!this.wikiDescriptions.get(modid).containsKey(name))
|
||||
this.wikiDescriptions.get(modid).put(name, new LinkedHashMap<String, String>());
|
||||
|
||||
this.wikiDescriptions.get(modid).get(name).put(meta, desc);
|
||||
System.out.printf("Registered %s %s %s\n", modid, name, meta);
|
||||
nentries += 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
String[] sections = docData.split(">>>>");
|
||||
for (String s : sections){
|
||||
s.trim();
|
||||
if (!s.equals("")){
|
||||
try{
|
||||
String name = s.split("\r?\n",2)[0].trim();
|
||||
String desc = s.split("\r?\n",2)[1].trim();
|
||||
if (!this.wikiDescriptions.containsKey(modid))
|
||||
this.wikiDescriptions.put(modid, new LinkedHashMap <String, String>());
|
||||
this.wikiDescriptions.get(modid).put(name, desc);
|
||||
nentries += 1;
|
||||
}catch (Exception e){
|
||||
System.out.printf("%s\n", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
mod_Waila.log.log(Level.INFO, String.format("Registered %s entries from %s", nentries, filename));
|
||||
}
|
||||
|
||||
public boolean hasDocTextModID(String modid){
|
||||
return this.wikiDescriptions.containsKey(modid);
|
||||
}
|
||||
|
||||
public boolean hasDocTextItem(String modid, String item){
|
||||
if (this.hasDocTextModID(modid))
|
||||
return this.wikiDescriptions.get(modid).containsKey(item);
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasDocTextMeta(String modid, String item, String meta){
|
||||
if (this.hasDocTextItem(modid, item))
|
||||
return this.wikiDescriptions.get(modid).get(item).containsKey(meta);
|
||||
return false;
|
||||
}
|
||||
|
||||
public LinkedHashMap<String, String> getDocText(String modid, String name){
|
||||
return this.wikiDescriptions.get(modid).get(name);
|
||||
}
|
||||
|
||||
public String getDocText(String modid, String name, String meta){
|
||||
return this.wikiDescriptions.get(modid).get(name).get(meta);
|
||||
}
|
||||
|
||||
public boolean hasDocTextSpecificMeta(String modid, String name, String meta){
|
||||
for (String s : this.getDocText(modid, name).keySet())
|
||||
if (s.equals(meta))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getDoxTextWildcardMatch(String modid, String name){
|
||||
Set<String> keys = this.wikiDescriptions.get(modid).keySet();
|
||||
for (String s : keys){
|
||||
String regexed = s;
|
||||
regexed = regexed.replace(".", "\\.");
|
||||
regexed = regexed.replace("*", ".*");
|
||||
|
||||
if (name.matches(s))
|
||||
return s;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<String[]> readFileAsString(String filePath) throws IOException {
|
||||
// URL fileURL = this.getClass().getResource(filePath);
|
||||
// File filedata = new File(fileURL);
|
||||
// Reader paramReader = new InputStreamReader(this.getClass().getResourceAsStream(filePath));
|
||||
|
||||
InputStream in = getClass().getResourceAsStream(filePath);
|
||||
BufferedReader input = new BufferedReader(new InputStreamReader(in));
|
||||
CSVReader reader = new CSVReader(input);
|
||||
|
||||
List<String[]> myEntries = reader.readAll();
|
||||
reader.close();
|
||||
|
||||
return myEntries;
|
||||
/*
|
||||
StringBuffer fileData = new StringBuffer();
|
||||
//BufferedReader reader = new BufferedReader(paramReader);
|
||||
|
||||
char[] buf = new char[1024];
|
||||
int numRead=0;
|
||||
while((numRead=input.read(buf)) != -1){
|
||||
String readData = String.valueOf(buf, 0, numRead);
|
||||
fileData.append(readData);
|
||||
}
|
||||
input.close();
|
||||
return fileData.toString();
|
||||
*/
|
||||
}
|
||||
}
|
||||
@@ -1,166 +0,0 @@
|
||||
package mcp.mobius.waila.client;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.Constants;
|
||||
import mcp.mobius.waila.api.impl.ConfigHandler;
|
||||
import mcp.mobius.waila.gui.screens.config.ScreenConfig;
|
||||
import mcp.mobius.waila.gui.screens.info.ScreenEnchants;
|
||||
import mcp.mobius.waila.handlers.nei.HandlerEnchants;
|
||||
import mcp.mobius.waila.overlay.RayTracing;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.inventory.GuiInventory;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumMovingObjectType;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import codechicken.lib.lang.LangUtil;
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.forge.GuiContainerManager;
|
||||
import codechicken.nei.recipe.GuiCraftingRecipe;
|
||||
import codechicken.nei.recipe.GuiUsageRecipe;
|
||||
import cpw.mods.fml.client.registry.KeyBindingRegistry.KeyHandler;
|
||||
import cpw.mods.fml.common.TickType;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
public class ConfigKeyHandler extends KeyHandler {
|
||||
|
||||
static boolean firstInventory = true;
|
||||
|
||||
public ConfigKeyHandler()
|
||||
{
|
||||
super(new KeyBinding[]{
|
||||
new KeyBinding(Constants.BIND_WAILA_CFG, Keyboard.KEY_NUMPAD0),
|
||||
new KeyBinding(Constants.BIND_WAILA_SHOW, Keyboard.KEY_NUMPAD1),
|
||||
new KeyBinding(Constants.BIND_WAILA_LIQUID, Keyboard.KEY_NUMPAD2),
|
||||
new KeyBinding(Constants.BIND_WAILA_RECIPE, Keyboard.KEY_NUMPAD3),
|
||||
new KeyBinding(Constants.BIND_WAILA_USAGE, Keyboard.KEY_NUMPAD4),
|
||||
//new KeyBinding(Constants.BIND_WAILA_TESTING, Keyboard.KEY_NUMPAD9),
|
||||
}, new boolean[]{
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
//false
|
||||
});
|
||||
|
||||
/*
|
||||
LanguageRegistry.instance().addStringLocalization(Constants.BIND_WAILA_CFG, LangUtil.translateG("keybind.configscreen"));
|
||||
LanguageRegistry.instance().addStringLocalization(Constants.BIND_WAILA_SHOW, LangUtil.translateG("keybind.showhide"));
|
||||
LanguageRegistry.instance().addStringLocalization(Constants.BIND_WAILA_LIQUID, LangUtil.translateG("keybind.showliquid"));
|
||||
LanguageRegistry.instance().addStringLocalization(Constants.BIND_WAILA_RECIPE, LangUtil.translateG("keybind.showrecipe"));
|
||||
LanguageRegistry.instance().addStringLocalization(Constants.BIND_WAILA_USAGE, LangUtil.translateG("keybind.showusage"));
|
||||
LanguageRegistry.instance().addStringLocalization(Constants.BIND_WAILA_TESTING, LangUtil.translateG("keybind.testing"));
|
||||
*/
|
||||
//LanguageRegistry.instance().addStringLocalization(Constants.BIND_SCREEN_ENCH, "[Waila] Show enchant screen");
|
||||
//LanguageRegistry.instance().addStringLocalization("key.wailatedump", "[Waila] Dump server TE");
|
||||
|
||||
GuiContainerManager.addInputHandler(new HandlerEnchants());
|
||||
API.addKeyBind(Constants.BIND_SCREEN_ENCH, Keyboard.KEY_I);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyDown(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd, boolean isRepeat) {
|
||||
if (!tickEnd) return;
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if (kb.keyDescription == Constants.BIND_WAILA_CFG){
|
||||
if(mc.currentScreen == null)
|
||||
mc.displayGuiScreen(new ScreenConfig(mc.currentScreen));
|
||||
}
|
||||
|
||||
if (kb.keyDescription == Constants.BIND_WAILA_TESTING){
|
||||
if(mc.currentScreen == null)
|
||||
mc.displayGuiScreen(new ScreenEnchants(mc.currentScreen));
|
||||
}
|
||||
|
||||
if (mc.currentScreen != null)
|
||||
return;
|
||||
|
||||
if (kb.keyDescription == Constants.BIND_WAILA_SHOW && ConfigHandler.instance().getConfig(Constants.CFG_WAILA_MODE)){
|
||||
boolean status = ConfigHandler.instance().getConfig(Constants.CFG_WAILA_SHOW);
|
||||
ConfigHandler.instance().setConfig(Constants.CFG_WAILA_SHOW, !status);
|
||||
}
|
||||
|
||||
else if (kb.keyDescription == Constants.BIND_WAILA_SHOW && !ConfigHandler.instance().getConfig(Constants.CFG_WAILA_MODE)){
|
||||
ConfigHandler.instance().setConfig(Constants.CFG_WAILA_SHOW, true);
|
||||
}
|
||||
|
||||
else if (kb.keyDescription == Constants.BIND_WAILA_LIQUID){
|
||||
boolean status = ConfigHandler.instance().getConfig(Constants.CFG_WAILA_LIQUID);
|
||||
ConfigHandler.instance().setConfig(Constants.CFG_WAILA_LIQUID, !status);
|
||||
}
|
||||
|
||||
else if (kb.keyDescription == Constants.BIND_WAILA_RECIPE){
|
||||
this.openRecipeGUI(true);
|
||||
}
|
||||
|
||||
else if (kb.keyDescription == Constants.BIND_WAILA_USAGE){
|
||||
this.openRecipeGUI(false);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void openRecipeGUI(boolean recipe){
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
boolean uiResult;
|
||||
String msg;
|
||||
|
||||
if ((RayTracing.instance().getTarget() != null) && (RayTracing.instance().getTarget().typeOfHit == EnumMovingObjectType.TILE)){
|
||||
List<ItemStack> stacks = RayTracing.instance().getIdentifierItems();
|
||||
if (stacks.size() > 0){
|
||||
mc.displayGuiScreen(new GuiInventory(mc.thePlayer));
|
||||
if (firstInventory){
|
||||
try {Thread.sleep(1000);} catch (Exception e){};
|
||||
firstInventory = false;
|
||||
}
|
||||
|
||||
if(recipe)
|
||||
if(!GuiCraftingRecipe.openRecipeGui("item", stacks.get(0).copy())){
|
||||
ItemStack target = stacks.get(0).copy();
|
||||
target.setItemDamage(0);
|
||||
if(!GuiCraftingRecipe.openRecipeGui("item", target)){
|
||||
mc.thePlayer.addChatMessage("\u00a7f\u00a7o" + LangUtil.translateG("client.msg.norecipe"));
|
||||
mc.displayGuiScreen((GuiScreen)null);
|
||||
mc.setIngameFocus();
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipe)
|
||||
if(!GuiUsageRecipe.openRecipeGui("item", stacks.get(0).copy())){
|
||||
ItemStack target = stacks.get(0).copy();
|
||||
target.setItemDamage(0);
|
||||
if(!GuiUsageRecipe.openRecipeGui("item", target)){
|
||||
mc.thePlayer.addChatMessage("\u00a7f\u00a7o" + LangUtil.translateG("client.msg.nousage"));
|
||||
mc.displayGuiScreen((GuiScreen)null);
|
||||
mc.setIngameFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyUp(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd) {
|
||||
if (!tickEnd) return;
|
||||
if (kb.keyDescription == Constants.BIND_WAILA_SHOW && !ConfigHandler.instance().getConfig(Constants.CFG_WAILA_MODE)){
|
||||
ConfigHandler.instance().setConfig(Constants.CFG_WAILA_SHOW, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<TickType> ticks() {
|
||||
return EnumSet.of(TickType.CLIENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLabel() {
|
||||
return "Waila Config Screen Keybind";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,141 +0,0 @@
|
||||
package mcp.mobius.waila.client;
|
||||
|
||||
import mcp.mobius.waila.Constants;
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.addons.appeng.AppEngModule;
|
||||
import mcp.mobius.waila.addons.buildcraft.BCModule;
|
||||
import mcp.mobius.waila.addons.buildcraft.BCPowerAPIModule;
|
||||
import mcp.mobius.waila.addons.enderio.EnderIOModule;
|
||||
import mcp.mobius.waila.addons.enderstorage.EnderStorageModule;
|
||||
import mcp.mobius.waila.addons.etb.ETBModule;
|
||||
import mcp.mobius.waila.addons.exu.ExtraUtilitiesModule;
|
||||
import mcp.mobius.waila.addons.gravestone.GravestoneModule;
|
||||
import mcp.mobius.waila.addons.ic2.IC2Module;
|
||||
import mcp.mobius.waila.addons.openblocks.OpenBlocksModule;
|
||||
import mcp.mobius.waila.addons.projectred.ProjectRedModule;
|
||||
import mcp.mobius.waila.addons.railcraft.RailcraftModule;
|
||||
import mcp.mobius.waila.addons.thaumcraft.ThaumcraftModule;
|
||||
import mcp.mobius.waila.addons.thermalexpansion.ThermalExpansionModule;
|
||||
import mcp.mobius.waila.addons.twilightforest.TwilightForestModule;
|
||||
import mcp.mobius.waila.addons.vanillamc.HUDHandlerVanilla;
|
||||
import mcp.mobius.waila.api.impl.MetaDataProvider;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
import mcp.mobius.waila.gui.truetyper.FontLoader;
|
||||
import mcp.mobius.waila.gui.truetyper.TrueTypeFont;
|
||||
import mcp.mobius.waila.handlers.HUDHandlerWaila;
|
||||
import mcp.mobius.waila.handlers.SummaryProviderDefault;
|
||||
import mcp.mobius.waila.handlers.nei.TooltipHandlerWaila;
|
||||
import mcp.mobius.waila.overlay.WailaTickHandler;
|
||||
import mcp.mobius.waila.server.ProxyServer;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import codechicken.lib.lang.LangUtil;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.ItemInfo;
|
||||
import codechicken.nei.forge.GuiContainerManager;
|
||||
import cpw.mods.fml.client.registry.KeyBindingRegistry;
|
||||
import cpw.mods.fml.common.registry.TickRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public class ProxyClient extends ProxyServer {
|
||||
|
||||
TrueTypeFont minecraftiaFont;
|
||||
|
||||
//public static LangUtil lang = LangUtil.loadLangDir("waila");
|
||||
|
||||
public ProxyClient() {}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerHandlers(){
|
||||
|
||||
LangUtil.instance.loadLangDir("waila");
|
||||
|
||||
minecraftiaFont = FontLoader.createFont(new ResourceLocation("waila", "fonts/Minecraftia.ttf"), 14, true);
|
||||
|
||||
TickRegistry.registerTickHandler(WailaTickHandler.instance(), Side.CLIENT);
|
||||
|
||||
GuiContainerManager.addTooltipHandler(new TooltipHandlerWaila());
|
||||
|
||||
//API.registerHighlightHandler(new HUDHandlerExternal(), ItemInfo.Layout.HEADER);
|
||||
//API.registerHighlightHandler(new HUDHandlerExternal(), ItemInfo.Layout.BODY);
|
||||
//API.registerHighlightHandler(new HUDHandlerExternal(), ItemInfo.Layout.FOOTER);
|
||||
//API.registerHighlightHandler(new HUDHandlerWaila(), ItemInfo.Layout.FOOTER);
|
||||
//API.registerHighlightHandler(new HUDHandlerWaila(), ItemInfo.Layout.HEADER);
|
||||
|
||||
KeyBindingRegistry.registerKeyBinding(new ConfigKeyHandler());
|
||||
|
||||
// We mute the default keybind for displaying the tooltip
|
||||
NEIClientConfig.getSetting(Constants.BIND_NEI_SHOW).setIntValue(Keyboard.KEY_NONE);
|
||||
NEIClientConfig.getSetting(Constants.CFG_NEI_SHOW).setBooleanValue(false);
|
||||
|
||||
//API.addKeyBind(Constants.BIND_WIKI, "Display wiki", Keyboard.KEY_RSHIFT);
|
||||
//API.addKeyBind(Constants.BIND_TECH, "Display techtree", Keyboard.KEY_RSHIFT);
|
||||
|
||||
ModuleRegistrar.instance().registerHeadProvider(new HUDHandlerWaila(), Block.class);
|
||||
ModuleRegistrar.instance().registerTailProvider(new HUDHandlerWaila(), Block.class);
|
||||
ModuleRegistrar.instance().registerShortDataProvider(new SummaryProviderDefault(), Item.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMods(){
|
||||
|
||||
HUDHandlerVanilla.register();
|
||||
|
||||
/*BETTER BARRELS*/
|
||||
//BetterBarrelsModule.register();
|
||||
|
||||
/* BUILDCRAFT */
|
||||
BCModule.register();
|
||||
|
||||
/* INDUSTRIALCRAFT2 */
|
||||
IC2Module.register();
|
||||
|
||||
/*Thaumcraft*/
|
||||
ThaumcraftModule.register();
|
||||
|
||||
/*EnderStorage*/
|
||||
EnderStorageModule.register();
|
||||
|
||||
/*Gravestone*/
|
||||
GravestoneModule.register();
|
||||
|
||||
/*Twilight forest*/
|
||||
TwilightForestModule.register();
|
||||
|
||||
/* Applied Energetics */
|
||||
AppEngModule.register();
|
||||
|
||||
/* Thermal Expansion */
|
||||
ThermalExpansionModule.register();
|
||||
|
||||
/* ETB */
|
||||
ETBModule.register();
|
||||
|
||||
/* EnderIO */
|
||||
EnderIOModule.register();
|
||||
|
||||
/* Buildcraft Power API */
|
||||
BCPowerAPIModule.register();
|
||||
|
||||
/* ProjectRed API */
|
||||
ProjectRedModule.register();
|
||||
|
||||
/* ExtraUtilities */
|
||||
ExtraUtilitiesModule.register();
|
||||
|
||||
/* OpenBlocks */
|
||||
OpenBlocksModule.register();
|
||||
|
||||
/* Railcraft */
|
||||
RailcraftModule.register();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getFont(){return this.minecraftiaFont;}
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
package mcp.mobius.waila.client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import mcp.mobius.waila.WailaExceptionHandler;
|
||||
import mcp.mobius.waila.api.IWailaBlockDecorator;
|
||||
import mcp.mobius.waila.api.impl.ConfigHandler;
|
||||
import mcp.mobius.waila.api.impl.DataAccessor;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
import mcp.mobius.waila.overlay.RayTracing;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.event.ForgeSubscribe;
|
||||
|
||||
public class WailaClientEventHandler {
|
||||
|
||||
@ForgeSubscribe
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onRenderWorldLast(RenderWorldLastEvent event) {
|
||||
if (RayTracing.instance().getTarget() == null || RayTracing.instance().getTargetStack() == null) return;
|
||||
|
||||
double partialTicks = event.partialTicks;
|
||||
|
||||
DataAccessor accessor = DataAccessor.instance;
|
||||
World world = Minecraft.getMinecraft().theWorld;
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
EntityLivingBase viewEntity = Minecraft.getMinecraft().renderViewEntity;
|
||||
|
||||
if (world == null || player == null || viewEntity == null) return;
|
||||
|
||||
accessor.set(world, player, RayTracing.instance().getTarget(), viewEntity, partialTicks);
|
||||
|
||||
Block block = accessor.getBlock();
|
||||
int blockID = accessor.getBlockID();
|
||||
|
||||
if (!ModuleRegistrar.instance().hasBlockDecorator(blockID) && !ModuleRegistrar.instance().hasBlockDecorator(block)) return;
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glDepthMask(false);
|
||||
|
||||
if (ModuleRegistrar.instance().hasBlockDecorator(blockID)){
|
||||
for (IWailaBlockDecorator decorator : ModuleRegistrar.instance().getBlockDecorators(blockID))
|
||||
try{
|
||||
GL11.glPushMatrix();
|
||||
decorator.decorateBlock(RayTracing.instance().getTargetStack(), accessor, ConfigHandler.instance());
|
||||
GL11.glPopMatrix();
|
||||
} catch (Throwable e){
|
||||
GL11.glPopMatrix();
|
||||
WailaExceptionHandler.handleErr(e, decorator.getClass().toString(), null);
|
||||
}
|
||||
}
|
||||
|
||||
if (ModuleRegistrar.instance().hasBlockDecorator(block)){
|
||||
for (IWailaBlockDecorator decorator : ModuleRegistrar.instance().getBlockDecorators(block))
|
||||
try{
|
||||
GL11.glPushMatrix();
|
||||
decorator.decorateBlock(RayTracing.instance().getTargetStack(), accessor, ConfigHandler.instance());
|
||||
GL11.glPopMatrix();
|
||||
} catch (Throwable e){
|
||||
GL11.glPopMatrix();
|
||||
WailaExceptionHandler.handleErr(e, decorator.getClass().toString(), null);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glPopAttrib();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
package mcp.mobius.waila.gui.events;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import mcp.mobius.waila.gui.interfaces.IWidget;
|
||||
|
||||
public class MouseEvent {
|
||||
|
||||
public enum EventType {NONE, MOVE, CLICK, RELEASED, DRAG, WHEEL, ENTER, LEAVE};
|
||||
|
||||
public long timestamp;
|
||||
public Minecraft mc;
|
||||
public IWidget srcwidget;
|
||||
public IWidget trgwidget;
|
||||
public double x,y;
|
||||
public int z;
|
||||
public static int buttonCount = Mouse.getButtonCount();
|
||||
public boolean[] buttonState = new boolean[buttonCount];
|
||||
public EventType type;
|
||||
public int button = -1;
|
||||
|
||||
|
||||
public MouseEvent(IWidget widget){
|
||||
this.srcwidget = widget;
|
||||
this.timestamp = System.nanoTime();
|
||||
|
||||
this.mc = Minecraft.getMinecraft();
|
||||
|
||||
this.x = (double)Mouse.getEventX() * (double)this.srcwidget.getSize().getX() / (double)this.mc.displayWidth;
|
||||
this.y = (double)this.srcwidget.getSize().getY() - (double)Mouse.getEventY() * (double)this.srcwidget.getSize().getY() / (double)this.mc.displayHeight - 1.0;
|
||||
|
||||
//this.x = Mouse.getEventX();
|
||||
//this.y = Mouse.getEventY();
|
||||
|
||||
//System.out.printf("%s %s\n", this.x, this.y);
|
||||
|
||||
//this.z = Mouse.getEventDWheel();
|
||||
this.z = Mouse.getDWheel();
|
||||
|
||||
for (int i = 0; i < buttonCount; i++)
|
||||
buttonState[i] = Mouse.isButtonDown(i);
|
||||
|
||||
this.trgwidget = this.srcwidget.getWidgetAtCoordinates(this.x, this.y);
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
String retstring = String.format("MOUSE %s : [%s] [ %.2f %.2f %d ] [", this.type, this.timestamp, this.x, this.y, this.z);
|
||||
if (this.buttonCount < 5)
|
||||
for (int i = 0; i < this.buttonCount; i++)
|
||||
retstring += String.format(" %s ", this.buttonState[i]);
|
||||
else
|
||||
for (int i = 0; i < 5; i++)
|
||||
retstring += String.format(" %s ", this.buttonState[i]);
|
||||
retstring += "]";
|
||||
|
||||
if (this.button != -1)
|
||||
retstring += String.format(" Button %s", this.button);
|
||||
|
||||
return retstring;
|
||||
}
|
||||
|
||||
// Returns the event type based on the previous mouse event.
|
||||
public EventType getEventType(MouseEvent me){
|
||||
|
||||
this.type = EventType.NONE;
|
||||
|
||||
if (this.trgwidget != me.trgwidget){
|
||||
this.type = EventType.ENTER;
|
||||
return this.type;
|
||||
}
|
||||
|
||||
if (this.z != 0){
|
||||
this.type = EventType.WHEEL;
|
||||
return this.type;
|
||||
}
|
||||
|
||||
for (int i = 0; i < this.buttonCount; i++){
|
||||
if (this.buttonState[i] != me.buttonState[i]){
|
||||
if (this.buttonState[i] == true)
|
||||
this.type = EventType.CLICK;
|
||||
else
|
||||
this.type = EventType.RELEASED;
|
||||
this.button = i;
|
||||
return this.type;
|
||||
}
|
||||
}
|
||||
|
||||
//MOVE & DRAG EVENTS (we moved the mouse and button 0 was clicked or not)
|
||||
if ((this.x != me.x) || (this.y != me.y)){
|
||||
if (this.buttonState[0] == true)
|
||||
this.type = EventType.DRAG;
|
||||
else
|
||||
this.type = EventType.MOVE;
|
||||
return this.type;
|
||||
}
|
||||
|
||||
return this.type;
|
||||
}
|
||||
}
|
||||
Loaded 100 of 436 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user