mirror of
https://github.com/GTNewHorizons/waila.git
synced 2026-11-15 01:25:16 +00:00
Compare commits
455
Commits
Nightly_131024
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d5669e3000 | ||
|
|
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 | ||
|
|
ac73b6b537 | ||
|
|
4188ec37b2 | ||
|
|
6cefb32520 | ||
|
|
7ba3a2b7e8 | ||
|
|
3d7c3f0726 | ||
|
|
74cdb0fa1e | ||
|
|
dc07947ccf | ||
|
|
3b1f35e7a8 | ||
|
|
dbd06b2552 | ||
|
|
9c121fb5c8 | ||
|
|
28d19ef015 | ||
|
|
3843fd9815 | ||
|
|
2777e0ea80 | ||
|
|
e62f26a0ee | ||
|
|
403e2aad57 | ||
|
|
c171d33e8c | ||
|
|
b1f7f2f2df | ||
|
|
a49d359656 | ||
|
|
03ec8ac17b | ||
|
|
75f3618424 | ||
|
|
e400edb92f | ||
|
|
42170ca050 | ||
|
|
f9868afde1 | ||
|
|
4e79797cd1 | ||
|
|
921b245273 | ||
|
|
2cbaeca169 | ||
|
|
bc344cab41 | ||
|
|
7a2fd4363c | ||
|
|
11d0f86320 | ||
|
|
d83fb8fe76 | ||
|
|
a36013c28c | ||
|
|
1934171e5a | ||
|
|
4b2e873261 | ||
|
|
6319cbd425 | ||
|
|
72ae5eccb3 | ||
|
|
5d1c7d532f | ||
|
|
afb9549da9 | ||
|
|
0d749d80ae | ||
|
|
050fd992c6 | ||
|
|
3694992eb5 | ||
|
|
6f0301667d | ||
|
|
d2606bfc25 | ||
|
|
299ef5307e | ||
|
|
a750f76a5d | ||
|
|
cd587ee8ca | ||
|
|
987254caca | ||
|
|
ef5ff0c6ed | ||
|
|
e9947e3960 | ||
|
|
95bf99a24a | ||
|
|
be530da970 | ||
|
|
5d82ebf0d5 | ||
|
|
165cb1003c | ||
|
|
5388d1bea0 | ||
|
|
c40c032531 | ||
|
|
bf0bb6e0c7 | ||
|
|
42c35d2b69 | ||
|
|
e9b440616e | ||
|
|
d1b354f05e | ||
|
|
0742ef2422 | ||
|
|
8e45cb8064 | ||
|
|
6896998934 | ||
|
|
74a2805844 | ||
|
|
c95daee0e2 | ||
|
|
bb5cd6cbfa | ||
|
|
3dde25b1a4 | ||
|
|
66649fa9dd | ||
|
|
a87c29bb2f | ||
|
|
3a057e4aba | ||
|
|
b50df6af26 | ||
|
|
8e8fd7f2bd | ||
|
|
d9f209a1d4 | ||
|
|
5e6ccc5ff8 | ||
|
|
bbfcc3b3ad | ||
|
|
d4a7b62644 | ||
|
|
417a75a896 | ||
|
|
b551d54e5c | ||
|
|
16ca8f2917 | ||
|
|
e7f2cab192 | ||
|
|
40063f3799 | ||
|
|
326d2b519b | ||
|
|
a7668e321c | ||
|
|
79af54e8cf | ||
|
|
09f8bbe33e | ||
|
|
1908f39995 | ||
|
|
748fc3fffa | ||
|
|
250dc6ac2a | ||
|
|
b81d2d3709 | ||
|
|
a873131d2f | ||
|
|
b5689428e8 | ||
|
|
d6285e2932 | ||
|
|
eb348d10fc | ||
|
|
7eb3ddb50c | ||
|
|
fde934363c | ||
|
|
dce9809205 | ||
|
|
15bee287f3 | ||
|
|
005cc66115 |
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, release/** ]
|
||||
push:
|
||||
branches: [ master, main, release/** ]
|
||||
|
||||
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.
|
||||
@@ -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
|
||||
```
|
||||
@@ -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")
|
||||
}
|
||||
@@ -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,171 +0,0 @@
|
||||
package mcp.mobius.waila;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import codechicken.core.Profiler;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.forge.GuiContainerManager;
|
||||
import codechicken.nei.recipe.GuiCraftingRecipe;
|
||||
import codechicken.nei.recipe.GuiUsageRecipe;
|
||||
import codechicken.nei.recipe.ICraftingHandler;
|
||||
import codechicken.nei.recipe.ProfilerRecipeHandler;
|
||||
import mcp.mobius.waila.addons.ConfigHandler;
|
||||
import mcp.mobius.waila.gui.screens.ScreenBase;
|
||||
import mcp.mobius.waila.gui.screens.config.ScreenConfig;
|
||||
import mcp.mobius.waila.gui.screens.config.ScreenHUDConfig;
|
||||
import mcp.mobius.waila.gui.screens.config.ScreenWailaConfig;
|
||||
import mcp.mobius.waila.gui.screens.info.ScreenEnchants;
|
||||
import mcp.mobius.waila.gui.testing.ScreenTest;
|
||||
import mcp.mobius.waila.handlers.nei.HandlerEnchants;
|
||||
import mcp.mobius.waila.overlay.RayTracing;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.gui.inventory.GuiInventory;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumMovingObjectType;
|
||||
import cpw.mods.fml.client.registry.KeyBindingRegistry.KeyHandler;
|
||||
import cpw.mods.fml.common.TickType;
|
||||
import cpw.mods.fml.common.registry.LanguageRegistry;
|
||||
|
||||
public class ConfigKeyHandler extends KeyHandler {
|
||||
|
||||
static boolean firstInventory = true;
|
||||
|
||||
public ConfigKeyHandler()
|
||||
{
|
||||
super(new KeyBinding[]{
|
||||
new KeyBinding(Constants.BIND_WAILA_CFG, Keyboard.KEY_NUMPAD0),
|
||||
new KeyBinding(Constants.BIND_WAILA_SHOW, Keyboard.KEY_NUMPAD1),
|
||||
new KeyBinding(Constants.BIND_WAILA_LIQUID, Keyboard.KEY_NUMPAD2),
|
||||
new KeyBinding(Constants.BIND_WAILA_RECIPE, Keyboard.KEY_NUMPAD3),
|
||||
new KeyBinding(Constants.BIND_WAILA_USAGE, Keyboard.KEY_NUMPAD4),
|
||||
new KeyBinding(Constants.BIND_WAILA_TESTING, Keyboard.KEY_NUMPAD9),
|
||||
}, new boolean[]{
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
});
|
||||
|
||||
LanguageRegistry.instance().addStringLocalization(Constants.BIND_WAILA_CFG, "[Waila] Config screen");
|
||||
LanguageRegistry.instance().addStringLocalization(Constants.BIND_WAILA_SHOW, "[Waila] Show/Hide");
|
||||
LanguageRegistry.instance().addStringLocalization(Constants.BIND_WAILA_LIQUID, "[Waila] Show liquids");
|
||||
LanguageRegistry.instance().addStringLocalization(Constants.BIND_WAILA_RECIPE, "[Waila] Show recipe");
|
||||
LanguageRegistry.instance().addStringLocalization(Constants.BIND_WAILA_USAGE, "[Waila] Show usage");
|
||||
LanguageRegistry.instance().addStringLocalization(Constants.BIND_WAILA_TESTING, "[Waila] Testing");
|
||||
//LanguageRegistry.instance().addStringLocalization(Constants.BIND_SCREEN_ENCH, "[Waila] Show enchant screen");
|
||||
//LanguageRegistry.instance().addStringLocalization("key.wailatedump", "[Waila] Dump server TE");
|
||||
|
||||
GuiContainerManager.addInputHandler(new HandlerEnchants());
|
||||
API.addKeyBind(Constants.BIND_SCREEN_ENCH, Keyboard.KEY_I);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyDown(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd, boolean isRepeat) {
|
||||
if (!tickEnd) return;
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if (kb.keyDescription == Constants.BIND_WAILA_CFG){
|
||||
if(mc.currentScreen == null)
|
||||
mc.displayGuiScreen(new ScreenConfig(mc.currentScreen));
|
||||
}
|
||||
|
||||
if (kb.keyDescription == Constants.BIND_WAILA_TESTING){
|
||||
if(mc.currentScreen == null)
|
||||
mc.displayGuiScreen(new ScreenEnchants(mc.currentScreen));
|
||||
}
|
||||
|
||||
if (mc.currentScreen != null)
|
||||
return;
|
||||
|
||||
if (kb.keyDescription == Constants.BIND_WAILA_SHOW && ConfigHandler.instance().getConfig(Constants.CFG_WAILA_MODE)){
|
||||
boolean status = ConfigHandler.instance().getConfig(Constants.CFG_WAILA_SHOW);
|
||||
ConfigHandler.instance().setConfig(Constants.CFG_WAILA_SHOW, !status);
|
||||
}
|
||||
|
||||
else if (kb.keyDescription == Constants.BIND_WAILA_SHOW && !ConfigHandler.instance().getConfig(Constants.CFG_WAILA_MODE)){
|
||||
ConfigHandler.instance().setConfig(Constants.CFG_WAILA_SHOW, true);
|
||||
}
|
||||
|
||||
else if (kb.keyDescription == Constants.BIND_WAILA_LIQUID){
|
||||
boolean status = ConfigHandler.instance().getConfig(Constants.CFG_WAILA_LIQUID);
|
||||
ConfigHandler.instance().setConfig(Constants.CFG_WAILA_LIQUID, !status);
|
||||
}
|
||||
|
||||
else if (kb.keyDescription == Constants.BIND_WAILA_RECIPE){
|
||||
this.openRecipeGUI(true);
|
||||
}
|
||||
|
||||
else if (kb.keyDescription == Constants.BIND_WAILA_USAGE){
|
||||
this.openRecipeGUI(false);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void openRecipeGUI(boolean recipe){
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
boolean uiResult;
|
||||
String msg;
|
||||
|
||||
if ((RayTracing.raytracedTarget != null) && (RayTracing.raytracedTarget.typeOfHit == EnumMovingObjectType.TILE)){
|
||||
List<ItemStack> stacks = RayTracing.getIdentifierItems();
|
||||
if (stacks.size() > 0){
|
||||
mc.displayGuiScreen(new GuiInventory(mc.thePlayer));
|
||||
if (firstInventory){
|
||||
try {Thread.sleep(1000);} catch (Exception e){};
|
||||
firstInventory = false;
|
||||
}
|
||||
|
||||
if(recipe)
|
||||
if(!GuiCraftingRecipe.openRecipeGui("item", stacks.get(0).copy())){
|
||||
ItemStack target = stacks.get(0).copy();
|
||||
target.setItemDamage(0);
|
||||
if(!GuiCraftingRecipe.openRecipeGui("item", target)){
|
||||
mc.thePlayer.addChatMessage("\u00a7f\u00a7oNo recipe found.");
|
||||
mc.displayGuiScreen((GuiScreen)null);
|
||||
mc.setIngameFocus();
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipe)
|
||||
if(!GuiUsageRecipe.openRecipeGui("item", stacks.get(0).copy())){
|
||||
ItemStack target = stacks.get(0).copy();
|
||||
target.setItemDamage(0);
|
||||
if(!GuiUsageRecipe.openRecipeGui("item", target)){
|
||||
mc.thePlayer.addChatMessage("\u00a7f\u00a7oNo usage found.");
|
||||
mc.displayGuiScreen((GuiScreen)null);
|
||||
mc.setIngameFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyUp(EnumSet<TickType> types, KeyBinding kb, boolean tickEnd) {
|
||||
if (!tickEnd) return;
|
||||
if (kb.keyDescription == Constants.BIND_WAILA_SHOW && !ConfigHandler.instance().getConfig(Constants.CFG_WAILA_MODE)){
|
||||
ConfigHandler.instance().setConfig(Constants.CFG_WAILA_SHOW, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSet<TickType> ticks() {
|
||||
return EnumSet.of(TickType.CLIENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLabel() {
|
||||
return "Waila Config Screen Keybind";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,34 +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 = "key.wailaconfig";
|
||||
public static String BIND_WAILA_SHOW = "key.wailadisplay";
|
||||
public static String BIND_WAILA_LIQUID = "waila.key.liquid";
|
||||
public static String BIND_WAILA_RECIPE = "waila.key.recipe";
|
||||
public static String BIND_WAILA_USAGE = "waila.key.usage";
|
||||
public static String BIND_WAILA_TESTING= "waila.key.testing";
|
||||
|
||||
public static String CFG_NEI_SHOW = "world.highlight_tips";
|
||||
public static String 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_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,92 +0,0 @@
|
||||
package mcp.mobius.waila;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
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;
|
||||
import mcp.mobius.waila.addons.ExternalModulesHandler;
|
||||
import mcp.mobius.waila.addons.appeng.AppEngModule;
|
||||
import mcp.mobius.waila.addons.betterbarrels.BetterBarrelsModule;
|
||||
import mcp.mobius.waila.addons.buildcraft.BCModule;
|
||||
import mcp.mobius.waila.addons.enderstorage.EnderStorageModule;
|
||||
import mcp.mobius.waila.addons.gravestone.GravestoneModule;
|
||||
import mcp.mobius.waila.addons.ic2.IC2Module;
|
||||
import mcp.mobius.waila.addons.thaumcraft.ThaumcraftModule;
|
||||
import mcp.mobius.waila.addons.twilightforest.TwilightForestModule;
|
||||
import mcp.mobius.waila.addons.vanillamc.HUDHandlerVanilla;
|
||||
import mcp.mobius.waila.gui_old.NEI.HandlerTechTree;
|
||||
import mcp.mobius.waila.gui_old.NEI.HandlerWiki;
|
||||
import mcp.mobius.waila.handlers.SummaryProviderDefault;
|
||||
import mcp.mobius.waila.handlers.hud.HUDHandlerExternal;
|
||||
import mcp.mobius.waila.handlers.hud.HUDHandlerWaila;
|
||||
import mcp.mobius.waila.handlers.nei.HandlerEnchants;
|
||||
import mcp.mobius.waila.handlers.tooltip.TooltipHandlerWaila;
|
||||
import mcp.mobius.waila.overlay.WailaTickHandler;
|
||||
import mcp.mobius.waila.server.ProxyServer;
|
||||
|
||||
public class ProxyClient extends ProxyServer {
|
||||
|
||||
public ProxyClient() {}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerHandlers(){
|
||||
TickRegistry.registerTickHandler(new WailaTickHandler(), Side.CLIENT);
|
||||
|
||||
GuiContainerManager.addTooltipHandler(new TooltipHandlerWaila());
|
||||
API.registerHighlightHandler(new HUDHandlerExternal(), ItemInfo.Layout.HEADER);
|
||||
API.registerHighlightHandler(new HUDHandlerExternal(), ItemInfo.Layout.BODY);
|
||||
API.registerHighlightHandler(new HUDHandlerWaila(), ItemInfo.Layout.FOOTER);
|
||||
API.registerHighlightHandler(new HUDHandlerWaila(), ItemInfo.Layout.HEADER);
|
||||
|
||||
KeyBindingRegistry.registerKeyBinding(new ConfigKeyHandler());
|
||||
|
||||
// We mute the default keybind for displaying the tooltip
|
||||
NEIClientConfig.getSetting(Constants.BIND_NEI_SHOW).setIntValue(Keyboard.KEY_NONE);
|
||||
NEIClientConfig.getSetting(Constants.CFG_NEI_SHOW).setBooleanValue(false);
|
||||
|
||||
//API.addKeyBind(Constants.BIND_WIKI, "Display wiki", Keyboard.KEY_RSHIFT);
|
||||
//API.addKeyBind(Constants.BIND_TECH, "Display techtree", Keyboard.KEY_RSHIFT);
|
||||
|
||||
ExternalModulesHandler.instance().registerShortDataProvider(new SummaryProviderDefault(), Item.class);
|
||||
|
||||
this.registerMods();
|
||||
}
|
||||
|
||||
public void registerMods(){
|
||||
|
||||
HUDHandlerVanilla.register();
|
||||
|
||||
/*BETTER BARRELS*/
|
||||
//BetterBarrelsModule.register();
|
||||
|
||||
/* BUILDCRAFT */
|
||||
BCModule.register();
|
||||
|
||||
/* INDUSTRIALCRAFT2 */
|
||||
IC2Module.register();
|
||||
|
||||
/*Thaumcraft*/
|
||||
ThaumcraftModule.register();
|
||||
|
||||
/*EnderStorage*/
|
||||
EnderStorageModule.register();
|
||||
|
||||
/*Gravestone*/
|
||||
GravestoneModule.register();
|
||||
|
||||
/*Twilight forest*/
|
||||
TwilightForestModule.register();
|
||||
|
||||
/* Applied Energetics */
|
||||
AppEngModule.register();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,24 +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);
|
||||
mod_Waila.log.log(Level.WARNING, String.format("Catched unhandled exception : [%s] %s",className,e));
|
||||
}
|
||||
if (currenttip != null)
|
||||
currenttip.add("<ERROR>");
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
package mcp.mobius.waila.addons;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Set;
|
||||
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import net.minecraftforge.common.Property;
|
||||
|
||||
public class ConfigHandler implements IWailaConfigHandler {
|
||||
|
||||
private static ConfigHandler instance = null;
|
||||
private LinkedHashMap<String, ConfigModule> modules = new LinkedHashMap<String, ConfigModule>();
|
||||
private ArrayList<String> serverconfigs = new ArrayList<String>();
|
||||
|
||||
private ConfigHandler() {
|
||||
instance = this;
|
||||
}
|
||||
|
||||
public static ConfigHandler instance(){
|
||||
if (ConfigHandler.instance == null)
|
||||
ConfigHandler.instance = new ConfigHandler();
|
||||
return ConfigHandler.instance;
|
||||
}
|
||||
|
||||
public void addModule(String modName, HashMap<String, String> options){
|
||||
this.addModule(modName, new ConfigModule(modName, options));
|
||||
}
|
||||
|
||||
public void addModule(String modName, ConfigModule options){
|
||||
this.modules.put(modName, options);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getModuleNames(){
|
||||
return this.modules.keySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<String, String> getConfigKeys(String modName){
|
||||
if (this.modules.containsKey(modName))
|
||||
return this.modules.get(modName).options;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addConfig(String modName, String key, String name){
|
||||
if (!this.modules.containsKey(modName))
|
||||
this.modules.put(modName, new ConfigModule(modName));
|
||||
|
||||
this.modules.get(modName).addOption(key, name);
|
||||
}
|
||||
|
||||
public void addConfigServer(String modName, String key, String name){
|
||||
if (!this.modules.containsKey(modName))
|
||||
this.modules.put(modName, new ConfigModule(modName));
|
||||
|
||||
this.modules.get(modName).addOption(key, name);
|
||||
this.serverconfigs.add(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getConfig(String key, boolean defvalue){
|
||||
mod_Waila.instance.config.load();
|
||||
|
||||
if (this.serverconfigs.contains(key) && !mod_Waila.instance.serverPresent)
|
||||
return false;
|
||||
|
||||
Property prop = mod_Waila.instance.config.get(Configuration.CATEGORY_GENERAL, key, defvalue);
|
||||
return prop.getBoolean(defvalue);
|
||||
}
|
||||
|
||||
public boolean isServerRequired(String key){
|
||||
return this.serverconfigs.contains(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getConfig(String key){
|
||||
return this.getConfig(key, true);
|
||||
}
|
||||
|
||||
public int getConfigInt(String key){
|
||||
mod_Waila.instance.config.load();
|
||||
Property prop = mod_Waila.instance.config.get(Configuration.CATEGORY_GENERAL, key, 0);
|
||||
return prop.getInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConfig(String key, boolean value){
|
||||
mod_Waila.instance.config.load();
|
||||
mod_Waila.instance.config.get(Configuration.CATEGORY_GENERAL, key, true).set(value);;
|
||||
mod_Waila.instance.config.save();
|
||||
}
|
||||
|
||||
public void setConfigInt(String key, int value){
|
||||
mod_Waila.instance.config.load();
|
||||
mod_Waila.instance.config.get(Configuration.CATEGORY_GENERAL, key, 0).set(value);;
|
||||
mod_Waila.instance.config.save();
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package mcp.mobius.waila.addons;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class ConfigModule {
|
||||
|
||||
String modName;
|
||||
HashMap<String, String> options;
|
||||
|
||||
public ConfigModule(String _modName){
|
||||
this.modName = _modName;
|
||||
this.options = new HashMap<String, String>();
|
||||
}
|
||||
|
||||
public ConfigModule(String _modName, HashMap<String, String> _options) {
|
||||
this.modName = _modName;
|
||||
this.options = _options;
|
||||
}
|
||||
|
||||
public void addOption(String key, String name){
|
||||
this.options.put(key,name);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,343 +0,0 @@
|
||||
package mcp.mobius.waila.addons;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import au.com.bytecode.opencsv.CSVReader;
|
||||
import net.minecraft.block.Block;
|
||||
import codechicken.nei.api.API;
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.IWailaRegistrar;
|
||||
import mcp.mobius.waila.api.IWailaSummaryProvider;
|
||||
import mcp.mobius.waila.handlers.hud.HUDHandlerExternal;
|
||||
|
||||
public class ExternalModulesHandler implements IWailaRegistrar {
|
||||
|
||||
private static ExternalModulesHandler instance = null;
|
||||
public LinkedHashMap<Integer, ArrayList<IWailaDataProvider>> headProviders = new LinkedHashMap<Integer, ArrayList<IWailaDataProvider>>();
|
||||
public LinkedHashMap<Integer, ArrayList<IWailaDataProvider>> bodyProviders = new LinkedHashMap<Integer, ArrayList<IWailaDataProvider>>();
|
||||
public LinkedHashMap<Integer, ArrayList<IWailaDataProvider>> tailProviders = new LinkedHashMap<Integer, ArrayList<IWailaDataProvider>>();
|
||||
public LinkedHashMap<Integer, ArrayList<IWailaDataProvider>> stackProviders = new LinkedHashMap<Integer, ArrayList<IWailaDataProvider>>();
|
||||
|
||||
public LinkedHashMap<Class, ArrayList<IWailaDataProvider>> headBlockProviders = new LinkedHashMap<Class, ArrayList<IWailaDataProvider>>();
|
||||
public LinkedHashMap<Class, ArrayList<IWailaDataProvider>> bodyBlockProviders = new LinkedHashMap<Class, ArrayList<IWailaDataProvider>>();
|
||||
public LinkedHashMap<Class, ArrayList<IWailaDataProvider>> tailBlockProviders = new LinkedHashMap<Class, ArrayList<IWailaDataProvider>>();
|
||||
public LinkedHashMap<Class, ArrayList<IWailaDataProvider>> stackBlockProviders = new LinkedHashMap<Class, ArrayList<IWailaDataProvider>>();
|
||||
|
||||
public LinkedHashMap<String, LinkedHashMap <String, LinkedHashMap <String, String>>> wikiDescriptions = new LinkedHashMap<String, LinkedHashMap <String, LinkedHashMap <String, String>>>();
|
||||
|
||||
public LinkedHashMap<Class, ArrayList<IWailaSummaryProvider>> summaryProviders = new LinkedHashMap<Class, ArrayList<IWailaSummaryProvider>>();
|
||||
|
||||
private ExternalModulesHandler() {
|
||||
instance = this;
|
||||
}
|
||||
|
||||
public static ExternalModulesHandler instance(){
|
||||
if (ExternalModulesHandler.instance == null)
|
||||
ExternalModulesHandler.instance = new ExternalModulesHandler();
|
||||
return ExternalModulesHandler.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addConfig(String modname, String key, String configname) {
|
||||
ConfigHandler.instance().addConfig(modname, key, configname);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addConfigRemote(String modname, String key, String configname) {
|
||||
ConfigHandler.instance().addConfigServer(modname, key, configname);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerHeadProvider(IWailaDataProvider dataProvider, int blockID) {
|
||||
if (!this.headProviders.containsKey(blockID))
|
||||
this.headProviders.put(blockID, new ArrayList<IWailaDataProvider>());
|
||||
this.headProviders.get(blockID).add(dataProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerHeadProvider(IWailaDataProvider dataProvider, Class block) {
|
||||
if (!this.headBlockProviders.containsKey(block))
|
||||
this.headBlockProviders.put(block, new ArrayList<IWailaDataProvider>());
|
||||
this.headBlockProviders.get(block).add(dataProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBodyProvider(IWailaDataProvider dataProvider, int blockID) {
|
||||
if (!this.bodyProviders.containsKey(blockID))
|
||||
this.bodyProviders.put(blockID, new ArrayList<IWailaDataProvider>());
|
||||
this.bodyProviders.get(blockID).add(dataProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBodyProvider(IWailaDataProvider dataProvider, Class block) {
|
||||
if (!this.bodyBlockProviders.containsKey(block))
|
||||
this.bodyBlockProviders.put(block, new ArrayList<IWailaDataProvider>());
|
||||
this.bodyBlockProviders.get(block).add(dataProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerTailProvider(IWailaDataProvider dataProvider, int blockID) {
|
||||
if (!this.tailProviders.containsKey(blockID))
|
||||
this.tailProviders.put(blockID, new ArrayList<IWailaDataProvider>());
|
||||
this.tailProviders.get(blockID).add(dataProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerTailProvider(IWailaDataProvider dataProvider, Class block) {
|
||||
if (!this.tailBlockProviders.containsKey(block))
|
||||
this.tailBlockProviders.put(block, new ArrayList<IWailaDataProvider>());
|
||||
this.tailBlockProviders.get(block).add(dataProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerStackProvider(IWailaDataProvider dataProvider, int blockID) {
|
||||
if (!this.stackProviders.containsKey(blockID))
|
||||
this.stackProviders.put(blockID, new ArrayList<IWailaDataProvider>());
|
||||
this.stackProviders.get(blockID).add(dataProvider);
|
||||
API.registerHighlightIdentifier(blockID, new HUDHandlerExternal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerStackProvider(IWailaDataProvider dataProvider, Class block) {
|
||||
for (int i = 0; i < Block.blocksList.length; i++)
|
||||
if (block.isInstance(Block.blocksList[i])){
|
||||
this.registerStackProvider(dataProvider, i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerShortDataProvider(IWailaSummaryProvider dataProvider, Class item) {
|
||||
if (!this.summaryProviders.containsKey(item))
|
||||
this.summaryProviders.put(item, new ArrayList<IWailaSummaryProvider>());
|
||||
this.summaryProviders.get(item).add(dataProvider);
|
||||
}
|
||||
|
||||
/* Arrays getters */
|
||||
|
||||
public ArrayList<IWailaDataProvider> getHeadProviders(int blockID) {
|
||||
return this.headProviders.get(blockID);
|
||||
}
|
||||
|
||||
public ArrayList<IWailaDataProvider> getBodyProviders(int blockID) {
|
||||
return this.bodyProviders.get(blockID);
|
||||
}
|
||||
|
||||
public ArrayList<IWailaDataProvider> getTailProviders(int blockID) {
|
||||
return this.tailProviders.get(blockID);
|
||||
}
|
||||
|
||||
public ArrayList<IWailaDataProvider> getHeadProviders(Object block) {
|
||||
ArrayList<IWailaDataProvider> returnList = new ArrayList<IWailaDataProvider>();
|
||||
for (Class clazz : this.headBlockProviders.keySet())
|
||||
if (clazz.isInstance(block))
|
||||
returnList.addAll(this.headBlockProviders.get(clazz));
|
||||
|
||||
return returnList;
|
||||
}
|
||||
|
||||
public ArrayList<IWailaDataProvider> getBodyProviders(Object block) {
|
||||
ArrayList<IWailaDataProvider> returnList = new ArrayList<IWailaDataProvider>();
|
||||
for (Class clazz : this.bodyBlockProviders.keySet())
|
||||
if (clazz.isInstance(block))
|
||||
returnList.addAll(this.bodyBlockProviders.get(clazz));
|
||||
|
||||
return returnList;
|
||||
}
|
||||
|
||||
public ArrayList<IWailaDataProvider> getTailProviders(Object block) {
|
||||
ArrayList<IWailaDataProvider> returnList = new ArrayList<IWailaDataProvider>();
|
||||
for (Class clazz : this.bodyBlockProviders.keySet())
|
||||
if (clazz.isInstance(block))
|
||||
returnList.addAll(this.bodyBlockProviders.get(clazz));
|
||||
|
||||
return returnList;
|
||||
}
|
||||
|
||||
public ArrayList<IWailaDataProvider> getStackProviders(int blockID) {
|
||||
return this.stackProviders.get(blockID);
|
||||
}
|
||||
|
||||
public ArrayList<IWailaSummaryProvider> getSummaryProvider(Object item){
|
||||
ArrayList<IWailaSummaryProvider> returnList = new ArrayList<IWailaSummaryProvider>();
|
||||
for (Class clazz : this.summaryProviders.keySet())
|
||||
if (clazz.isInstance(item))
|
||||
returnList.addAll(this.summaryProviders.get(clazz));
|
||||
|
||||
return returnList;
|
||||
}
|
||||
|
||||
/* Providers querry methods */
|
||||
|
||||
public boolean hasHeadProviders(int blockID){
|
||||
return this.headProviders.containsKey(blockID);
|
||||
}
|
||||
|
||||
public boolean hasBodyProviders(int blockID){
|
||||
return this.bodyProviders.containsKey(blockID);
|
||||
}
|
||||
|
||||
public boolean hasTailProviders(int blockID){
|
||||
return this.tailProviders.containsKey(blockID);
|
||||
}
|
||||
|
||||
public boolean hasStackProviders(int blockID){
|
||||
return this.stackProviders.containsKey(blockID);
|
||||
}
|
||||
|
||||
public boolean hasHeadProviders(Object block){
|
||||
for (Class clazz : this.headBlockProviders.keySet())
|
||||
if (clazz.isInstance(block))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasBodyProviders(Object block){
|
||||
for (Class clazz : this.bodyBlockProviders.keySet())
|
||||
if (clazz.isInstance(block))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasTailProviders(Object block){
|
||||
for (Class clazz : this.tailBlockProviders.keySet())
|
||||
if (clazz.isInstance(block))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasSummaryProvider(Class item){
|
||||
return this.summaryProviders.containsKey(item);
|
||||
}
|
||||
|
||||
@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,42 +0,0 @@
|
||||
package mcp.mobius.waila.addons.appeng;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.addons.ExternalModulesHandler;
|
||||
|
||||
public class AppEngModule {
|
||||
|
||||
public static Class TileStorageMonitor = null;
|
||||
public static Class IAEItemStack = null;
|
||||
public static Method TileStorageMonitor_getItem = null;
|
||||
public static Method IAEItemStack_getItemStack = null;
|
||||
|
||||
public static void register(){
|
||||
try{
|
||||
TileStorageMonitor = Class.forName("appeng.me.tile.TileStorageMonitor");
|
||||
IAEItemStack = Class.forName("appeng.api.IAEItemStack");
|
||||
|
||||
|
||||
TileStorageMonitor_getItem = TileStorageMonitor.getMethod("getItem");
|
||||
IAEItemStack_getItemStack = IAEItemStack.getMethod("getItemStack");
|
||||
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[AppEng] Class not found. " + e);
|
||||
return;
|
||||
} catch (SecurityException e) {
|
||||
mod_Waila.log.log(Level.WARNING, "[AppEng] Security Exception. " + e);
|
||||
return;
|
||||
} catch (NoSuchMethodException e) {
|
||||
mod_Waila.log.log(Level.WARNING, "[AppEng] Method not found. " + e);
|
||||
return;
|
||||
}
|
||||
|
||||
mod_Waila.log.log(Level.INFO, "AppEng mod found.");
|
||||
ExternalModulesHandler.instance().addConfig("Applied Energetic", "appeng.monitorcontent", "Monitor's content");
|
||||
ExternalModulesHandler.instance().registerBodyProvider(new HUDAppEngMonitor(), TileStorageMonitor);
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
package mcp.mobius.waila.addons.appeng;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.List;
|
||||
|
||||
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("<None>");
|
||||
} catch (Exception e) {
|
||||
System.out.printf("%s\n", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package mcp.mobius.waila.addons.betterbarrels;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.addons.ExternalModulesHandler;
|
||||
import mcp.mobius.waila.addons.buildcraft.HUDHandlerBCPipes;
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.api.ItemInfo;
|
||||
|
||||
public class BetterBarrelsModule {
|
||||
public static Class TileEntityBarrel = null;
|
||||
public static Class IBarrelStorage = null;
|
||||
public static Field TileEntityBarrel_Storage = null;
|
||||
public static Method IBarrelStorage_getItem = null;
|
||||
|
||||
public static void register(){
|
||||
try{
|
||||
TileEntityBarrel = Class.forName("mcp.mobius.betterbarrels.common.TileEntityBarrel");
|
||||
IBarrelStorage = Class.forName("mcp.mobius.betterbarrels.common.IBarrelStorage");
|
||||
TileEntityBarrel_Storage = TileEntityBarrel.getField("storage");
|
||||
IBarrelStorage_getItem = IBarrelStorage.getMethod("getItem");
|
||||
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[BB] BetterBarrel classes not found.");
|
||||
} catch (NoSuchFieldException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[BB] Storage field not found.");
|
||||
} catch (NoSuchMethodException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[BB] getItem() not found.");
|
||||
}
|
||||
|
||||
if (IBarrelStorage_getItem != null){
|
||||
mod_Waila.log.log(Level.INFO, "Waila module BetterBarrel succefully hooked.");
|
||||
ExternalModulesHandler.instance().addConfig("BetterBarrels", "bb.content", "Barrel's content");
|
||||
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerBBContent(), TileEntityBarrel);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,63 +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.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("<Empty>");
|
||||
}
|
||||
}
|
||||
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.buildcraft;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.addons.ExternalModulesHandler;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
|
||||
public class BCModule {
|
||||
|
||||
public static Class TileTank = null;
|
||||
public static Class IPowerReceptor = null;
|
||||
public static Class PipeTransportPower = null;
|
||||
public static Class TileGenericPipe = null;
|
||||
public static Class TileEngine = null;
|
||||
|
||||
public static Method TileTank_getTankInfo = null;
|
||||
//public static Method IPowerReceptor_PowerRequest = 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");
|
||||
IPowerReceptor = Class.forName("buildcraft.api.power.IPowerReceptor");
|
||||
PipeTransportPower = Class.forName("buildcraft.transport.PipeTransportPower");
|
||||
TileGenericPipe = Class.forName("buildcraft.transport.TileGenericPipe");
|
||||
TileEngine = Class.forName("buildcraft.energy.TileEngine");
|
||||
|
||||
TileTank_getTankInfo = TileTank.getMethod("getTankInfo", ForgeDirection.class);
|
||||
//IPowerReceptor_PowerRequest = IPowerReceptor.getMethod("powerRequest", ForgeDirection.class);
|
||||
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[BC] Class not found. " + e);
|
||||
return;
|
||||
} catch (NoSuchMethodException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[BC] Method not found." + e);
|
||||
return;
|
||||
}
|
||||
|
||||
ExternalModulesHandler.instance().addConfig("Buildcraft", "bc.tankamount", "Liquid amount");
|
||||
ExternalModulesHandler.instance().addConfig("Buildcraft", "bc.tanktype", "Liquid type");
|
||||
//ExternalModulesHandler.instance().addConfigRemote("Buildcraft", "bc.powerpipe", "Power pipes");
|
||||
ExternalModulesHandler.instance().registerHeadProvider(new HUDHandlerBCTanks(), TileTank);
|
||||
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerBCTanks(), TileTank);
|
||||
//ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerBCPipes(), TileGenericPipe);
|
||||
//ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerBCEngine(), TileEngine);
|
||||
//ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerBCIPowerReceptor(), PipeTransportPower);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package mcp.mobius.waila.addons.buildcraft;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDHandlerBCEngine implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
|
||||
NBTTagCompound tag = accessor.getNBTData();
|
||||
if (tag.hasKey("energyF")){
|
||||
//float output = tag.getFloat("energyF")*tag.getFloat("progress");
|
||||
float output = tag.getFloat("energyF");
|
||||
if (output > 1.0F)
|
||||
currenttip.add(String.format("Output : %.1f MJ",output));
|
||||
else
|
||||
currenttip.add(String.format("Output : %.2f MJ",output));
|
||||
}
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
package mcp.mobius.waila.addons.buildcraft;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDHandlerBCIPowerReceptor implements IWailaDataProvider {
|
||||
|
||||
public HUDHandlerBCIPowerReceptor() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@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) {
|
||||
// int powerRequest = 0;
|
||||
// try{
|
||||
// powerRequest = (Integer)BCModule.IPowerReceptor_PowerRequest.invoke(BCModule.IPowerReceptor.cast(accessor.getTileEntity()), ForgeDirection.UNKNOWN);
|
||||
// }
|
||||
// catch (Exception e){
|
||||
// mod_Waila.log.log(Level.SEVERE, "[BC] Unhandled exception trying to access a tank for display !.\n" + String.valueOf(e));
|
||||
// return currenttip;
|
||||
// }
|
||||
// currenttip.add(String.valueOf(powerRequest));
|
||||
|
||||
// NBTTagCompound tag = accessor.getNBTData();
|
||||
|
||||
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.buildcraft;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.tools.Reflect;
|
||||
|
||||
public class HUDHandlerBCPipes implements IWailaDataProvider {
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
NBTTagCompound tag = accessor.getNBTData();
|
||||
if (this.hasPartialKey(tag, "internalNextPower") && config.getConfig("bc.powerpipe")){
|
||||
double power = Math.max(0, this.getPartialKeySum(tag, "internalNextPower"));
|
||||
currenttip.add(String.format("Power : %.1f MJ", power));
|
||||
}
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
public boolean hasPartialKey(NBTTagCompound tag, String key){
|
||||
Map tagMap = (Map)Reflect.getFieldValue("net.minecraft.nbt.NBTTagCompound", "tagMap", tag);
|
||||
for (Object k : tagMap.keySet())
|
||||
if (((String)k).contains(key))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public double getPartialKeySum(NBTTagCompound tag, String key){
|
||||
double retVal = 0;
|
||||
Map tagMap = (Map)Reflect.getFieldValue("net.minecraft.nbt.NBTTagCompound", "tagMap", tag);
|
||||
for (Object k : tagMap.keySet())
|
||||
if (((String)k).contains(key))
|
||||
retVal += tag.getDouble((String)k);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
package mcp.mobius.waila.addons.buildcraft;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
//import buildcraft.factory.TileTank;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.addons.ConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import net.minecraftforge.liquids.ILiquidTank;
|
||||
import net.minecraftforge.liquids.LiquidStack;
|
||||
|
||||
public class HUDHandlerBCTanks implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
FluidTankInfo tank = this.getTank(accessor);
|
||||
FluidStack stack = tank != null ? tank.fluid : null;
|
||||
|
||||
|
||||
String name = currenttip.get(0);
|
||||
if (stack != null && ConfigHandler.instance().getConfig("bc.tanktype"))
|
||||
name = name + " (" + stack.getFluid().getName() + ")";
|
||||
else if (stack == null && ConfigHandler.instance().getConfig("bc.tanktype"))
|
||||
name = name + " <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,52 +0,0 @@
|
||||
package mcp.mobius.waila.addons.enderstorage;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.addons.ExternalModulesHandler;
|
||||
|
||||
public class EnderStorageModule {
|
||||
|
||||
public static Class TileFrequencyOwner = null;
|
||||
public static Field TileFrequencyOwner_Freq = null;
|
||||
|
||||
public static Class EnderStorageManager = null;
|
||||
public static Method GetColourFromFreq = null;
|
||||
|
||||
public static 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);
|
||||
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Class not found. " + e);
|
||||
return;
|
||||
} catch (NoSuchMethodException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Method not found." + e);
|
||||
return;
|
||||
} catch (NoSuchFieldException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Field not found." + e);
|
||||
return;
|
||||
} catch (Exception e){
|
||||
mod_Waila.log.log(Level.WARNING, "[EnderStorage] Unhandled exception." + e);
|
||||
return;
|
||||
}
|
||||
|
||||
ExternalModulesHandler.instance().addConfig("EnderStorage", "enderstorage.colors", "Colors");
|
||||
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerStorage(), TileFrequencyOwner);
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
package mcp.mobius.waila.addons.enderstorage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import mcp.mobius.waila.WailaExceptionHandler;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDHandlerStorage implements IWailaDataProvider {
|
||||
|
||||
private static String[] colors = {"White", "Orange", "Magenta", "LBlue", "Yellow", "Lime", "Pink", "Gray", "LGray", "Cyan", "Purple", "Blue", "Brown", "Green", "Red", "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);
|
||||
|
||||
currenttip.add(String.format("%s/%s/%s", colors[freqLeft], colors[freqCenter], colors[freqRight]));
|
||||
} catch (Exception e){
|
||||
currenttip = WailaExceptionHandler.handleErr(e, accessor.getTileEntity().getClass().getName(), currenttip);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package mcp.mobius.waila.addons.gravestone;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.addons.ExternalModulesHandler;
|
||||
|
||||
public class GravestoneModule {
|
||||
|
||||
public static Class BlockGraveStone = null;
|
||||
|
||||
public static void register(){
|
||||
|
||||
try{
|
||||
Class ModGravestone = Class.forName("GraveStone.ModGraveStone");
|
||||
mod_Waila.log.log(Level.INFO, "GraveStone mod found.");
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.INFO, "[GraveStone] GraveStone mod not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
BlockGraveStone = Class.forName("GraveStone.block.BlockGSGraveStone");
|
||||
} catch (ClassNotFoundException e) {
|
||||
mod_Waila.log.log(Level.WARNING, "[GraveStone] Class not found. " + e);
|
||||
}
|
||||
|
||||
|
||||
ExternalModulesHandler.instance().registerStackProvider(new HUDHandlerGravestone(), BlockGraveStone);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package mcp.mobius.waila.addons.gravestone;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDHandlerGravestone implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return new ItemStack(accessor.getBlock(), 0, accessor.getMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package mcp.mobius.waila.addons.ic2;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDHandlerDoor implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return IC2Module.ReinforcedDoorStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
package mcp.mobius.waila.addons.ic2;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.addons.ConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
public class HUDHandlerIC2IEnergySink implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
//if (accessor.getTileEntity() != null && TEElectricBlock.isInstance(accessor.getTileEntity())){
|
||||
int maxinput = -1;
|
||||
try{
|
||||
if (IC2Module.IEnergySink.isInstance(accessor.getTileEntity()))
|
||||
maxinput = (Integer)(IC2Module.IEnergySink_GetInput.invoke(IC2Module.IEnergySink.cast(accessor.getTileEntity())));
|
||||
} catch (Exception e){
|
||||
mod_Waila.log.log(Level.SEVERE, "[IC2] Unhandled exception trying to access an IEnergySink for display !.\n" + String.valueOf(e));
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
int ntransformers = this.getTransformerUpgrades(accessor);
|
||||
if (ntransformers > 0){
|
||||
maxinput = maxinput * (int)Math.pow(4.0D, Math.min(3, ntransformers));
|
||||
}
|
||||
|
||||
|
||||
if (ConfigHandler.instance().getConfig("ic2.inputeuother") && (maxinput > 4096))
|
||||
currenttip.add("IN : ANY");
|
||||
|
||||
else if (ConfigHandler.instance().getConfig("ic2.inputeuother") && (maxinput != -1) && !this.canUpgrade(accessor.getNBTData()))
|
||||
currenttip.add(String.format("IN : %s EU/t", maxinput));
|
||||
|
||||
else if (ConfigHandler.instance().getConfig("ic2.inputeumach") && (maxinput != -1) && this.canUpgrade(accessor.getNBTData()))
|
||||
currenttip.add(String.format("IN : %s EU/t", maxinput));
|
||||
|
||||
if (config.getConfig("ic2.storage"))
|
||||
if (accessor.getNBTData().hasKey("energy") && !IC2Module.IEnergyStorage.isInstance(accessor.getTileEntity()))
|
||||
currenttip.add(String.format("Storage : %s EU", accessor.getNBTInteger(accessor.getNBTData(), "energy")));
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
public boolean canUpgrade(NBTTagCompound tag){
|
||||
if (tag.hasKey("InvSlots"))
|
||||
if (tag.getCompoundTag("InvSlots").hasKey("upgrade"))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getTransformerUpgrades(IWailaDataAccessor accessor){
|
||||
NBTTagCompound tag = accessor.getNBTData();
|
||||
if (!canUpgrade(tag)) return -1;
|
||||
|
||||
int ntransformers = 0;
|
||||
NBTTagList contents = tag.getCompoundTag("InvSlots").getCompoundTag("upgrade").getTagList("Contents");
|
||||
for (NBTTagCompound subtag : (List<NBTTagCompound>)contents.tagList){
|
||||
ItemStack currentSlot = new ItemStack(accessor.getNBTInteger(subtag, "id"),accessor.getNBTInteger(subtag, "Count"),accessor.getNBTInteger(subtag, "Damage"));
|
||||
if (IC2Module.TransformerUpgradeStack.isItemEqual(currentSlot)){
|
||||
ntransformers += currentSlot.stackSize;
|
||||
}
|
||||
}
|
||||
|
||||
return ntransformers;
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
package mcp.mobius.waila.addons.ic2;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.addons.ConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class HUDHandlerIC2IEnergySource implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
//if (accessor.getTileEntity() != null && TEElectricBlock.isInstance(accessor.getTileEntity())){
|
||||
int output = -1;
|
||||
|
||||
try{
|
||||
if (IC2Module.IEnergySource.isInstance(accessor.getTileEntity()))
|
||||
output = (Integer)(IC2Module.IEnergySource_GetOutput.invoke(IC2Module.IEnergySource.cast(accessor.getTileEntity())));
|
||||
} catch (Exception e){
|
||||
mod_Waila.log.log(Level.SEVERE, "[IC2] Unhandled exception trying to access an IEnergySource for display !.\n" + String.valueOf(e));
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
if (ConfigHandler.instance().getConfig("ic2.outputeu") && (output != -1))
|
||||
currenttip.add(String.format("OUT : %s EU/t", output));
|
||||
|
||||
if (config.getConfig("ic2.storage"))
|
||||
if (accessor.getNBTData().hasKey("storage") && !IC2Module.IEnergyStorage.isInstance(accessor.getTileEntity()))
|
||||
currenttip.add(String.format("Storage : %s EU", accessor.getNBTInteger(accessor.getNBTData(), "storage")));
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
package mcp.mobius.waila.addons.ic2;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class HUDHandlerIC2IEnergyStorage implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
if (!config.getConfig("ic2.storage"))
|
||||
return currenttip;
|
||||
|
||||
int stored = -1;
|
||||
int capacity = -1;
|
||||
try{
|
||||
if (IC2Module.IEnergyStorage.isInstance(accessor.getTileEntity()))
|
||||
capacity = (Integer)(IC2Module.IEnergyStorage_GetCapacity.invoke(IC2Module.IEnergyStorage.cast(accessor.getTileEntity())));
|
||||
} catch (Exception e){
|
||||
mod_Waila.log.log(Level.SEVERE, "[IC2] Unhandled exception trying to access an IEnergyStorage for display !.\n" + String.valueOf(e));
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
if (accessor.getNBTData().hasKey("energy"))
|
||||
stored = accessor.getNBTInteger(accessor.getNBTData(), "energy");
|
||||
|
||||
if ((capacity != -1) && (stored != -1))
|
||||
currenttip.add(String.format("%s/%s EU", stored, capacity));
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
package mcp.mobius.waila.addons.ic2;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.addons.ExternalModulesHandler;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class IC2Module {
|
||||
|
||||
/* Our interfaces */
|
||||
public static Class IEnergyStorage = null;
|
||||
public static Class IEnergySink = null;
|
||||
public static Class IEnergySource = null;
|
||||
|
||||
/* Methods interfaces */
|
||||
public static Method IEnergyStorage_GetCapacity = null;
|
||||
public static Method IEnergySink_GetInput = null;
|
||||
public static Method IEnergySource_GetOutput = null;
|
||||
|
||||
/* Some required items */
|
||||
public static Class IC2Items = null;
|
||||
public static Field TransformerUpgrade = null;
|
||||
public static ItemStack TransformerUpgradeStack = null;
|
||||
public static Field EnergyStorageUpgrade = null;
|
||||
public static ItemStack EnergyStorageUpgradeStack = null;
|
||||
|
||||
/* Fix for doors */
|
||||
public static Class BlockIC2Door = null;
|
||||
public static Field ReinforcedDoor = null;
|
||||
public static ItemStack ReinforcedDoorStack = null;
|
||||
|
||||
|
||||
public static void register(){
|
||||
|
||||
try{
|
||||
Class ModIndustrialCraft = Class.forName("ic2.core.IC2");
|
||||
mod_Waila.log.log(Level.INFO, "Industrialcraft2 mod found.");
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.INFO, "[IC2] Industrialcraft2 mod not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
try{
|
||||
|
||||
IEnergyStorage = Class.forName("ic2.api.tile.IEnergyStorage");
|
||||
IEnergySink = Class.forName("ic2.api.energy.tile.IEnergySink");
|
||||
IEnergySource = Class.forName("ic2.api.energy.tile.IEnergySource");
|
||||
|
||||
IEnergySink_GetInput = IEnergySink.getMethod("getMaxSafeInput");
|
||||
IEnergySource_GetOutput = IEnergySource.getMethod("getMaxEnergyOutput");
|
||||
IEnergyStorage_GetCapacity = IEnergyStorage.getMethod("getCapacity");
|
||||
|
||||
IC2Items = Class.forName("ic2.core.Ic2Items");
|
||||
TransformerUpgrade = IC2Items.getDeclaredField("transformerUpgrade");
|
||||
EnergyStorageUpgrade = IC2Items.getDeclaredField("energyStorageUpgrade");
|
||||
|
||||
TransformerUpgradeStack = (ItemStack)TransformerUpgrade.get(null);
|
||||
EnergyStorageUpgradeStack = (ItemStack)EnergyStorageUpgrade.get(null);
|
||||
|
||||
BlockIC2Door = Class.forName("ic2.core.block.BlockIC2Door");
|
||||
ReinforcedDoor = IC2Items.getDeclaredField("reinforcedDoor");
|
||||
ReinforcedDoorStack = (ItemStack)ReinforcedDoor.get(null);
|
||||
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[IC2] Class not found. " + e);
|
||||
return;
|
||||
} catch (NoSuchMethodException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[IC2] Method not found." + e);
|
||||
return;
|
||||
} catch (NoSuchFieldException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[IC2] Field not found." + e);
|
||||
return;
|
||||
} catch (Exception e){
|
||||
mod_Waila.log.log(Level.WARNING, "[IC2] Unhandled exception." + e);
|
||||
return;
|
||||
}
|
||||
|
||||
ExternalModulesHandler.instance().addConfigRemote("IndustrialCraft2", "ic2.inputeumach", "Max EU input [Machines]");
|
||||
ExternalModulesHandler.instance().addConfig("IndustrialCraft2", "ic2.inputeuother", "Max EU input [Other]");
|
||||
ExternalModulesHandler.instance().addConfig("IndustrialCraft2", "ic2.outputeu", "Max EU output");
|
||||
ExternalModulesHandler.instance().addConfigRemote("IndustrialCraft2", "ic2.storage", "Energy stored");
|
||||
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerIC2IEnergySink(), IEnergySink);
|
||||
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerIC2IEnergySource(), IEnergySource);
|
||||
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerIC2IEnergyStorage(), IEnergyStorage);
|
||||
ExternalModulesHandler.instance().registerStackProvider(new HUDHandlerDoor(), BlockIC2Door);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package mcp.mobius.waila.addons.thaumcraft;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.WailaExceptionHandler;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class HUDHandlerCapacitor implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
if (config.getConfig("thaumcraft.storedvis")){
|
||||
try{
|
||||
short storedVis = ThaumcraftModule.TileCrystalCapacitor_StoredVis.getShort(accessor.getTileEntity());
|
||||
short maxVis = ThaumcraftModule.TileCrystalCapacitor_MaxVis.getShort(accessor.getTileEntity());
|
||||
|
||||
currenttip.add(String.format("%s/%s vis", storedVis, maxVis));
|
||||
}catch (Exception e){
|
||||
currenttip = WailaExceptionHandler.handleErr(e, accessor.getClass().getName(), currenttip);
|
||||
}
|
||||
}
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package mcp.mobius.waila.addons.thaumcraft;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDHandlerLeaves implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return new ItemStack(accessor.getBlock(), 0, accessor.getMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package mcp.mobius.waila.addons.thaumcraft;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDHandlerPlants implements IWailaDataProvider {
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return new ItemStack(accessor.getBlock(), 0, accessor.getMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package mcp.mobius.waila.addons.thaumcraft;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.addons.ExternalModulesHandler;
|
||||
|
||||
public class ThaumcraftModule {
|
||||
|
||||
public static Class BlockMagicalLeaves = null;
|
||||
public static Class BlockCustomPlant = null;
|
||||
|
||||
public static Class TileCrystalCapacitor = null;
|
||||
public static Field TileCrystalCapacitor_StoredVis = null;
|
||||
public static Field TileCrystalCapacitor_MaxVis = null;
|
||||
|
||||
public static void register(){
|
||||
|
||||
try{
|
||||
Class ModThaumcraft = Class.forName("thaumcraft.common.Thaumcraft");
|
||||
mod_Waila.log.log(Level.INFO, "Thaumcraft mod found.");
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.INFO, "[Thaumcraft] Thaumcraft mod not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
try{
|
||||
BlockMagicalLeaves = Class.forName("thaumcraft.common.world.BlockMagicalLeaves");
|
||||
BlockCustomPlant = Class.forName("thaumcraft.common.world.BlockCustomPlant");
|
||||
|
||||
TileCrystalCapacitor = Class.forName("thaumcraft.common.tiles.TileCrystalCapacitor");
|
||||
TileCrystalCapacitor_StoredVis = TileCrystalCapacitor.getField("storedVis");
|
||||
TileCrystalCapacitor_MaxVis = TileCrystalCapacitor.getField("maxVis");
|
||||
|
||||
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[Thaumcraft] Class not found. " + e);
|
||||
return;
|
||||
// } catch (NoSuchMethodException e){
|
||||
// mod_Waila.log.log(Level.WARNING, "[Thaumcraft] Method not found." + e);
|
||||
// return;
|
||||
} catch (NoSuchFieldException e){
|
||||
mod_Waila.log.log(Level.WARNING, "[Thaumcraft] Field not found." + e);
|
||||
return;
|
||||
// } catch (Exception e){
|
||||
// mod_Waila.log.log(Level.WARNING, "[Thaumcraft] Unhandled exception." + e);
|
||||
// return;
|
||||
}
|
||||
ExternalModulesHandler.instance().addConfig("Thaumcraft", "thaumcraft.storedvis", "Capacitor storage");
|
||||
ExternalModulesHandler.instance().registerStackProvider(new HUDHandlerLeaves(), BlockMagicalLeaves);
|
||||
ExternalModulesHandler.instance().registerStackProvider(new HUDHandlerPlants(), BlockCustomPlant);
|
||||
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerCapacitor(), TileCrystalCapacitor);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package mcp.mobius.waila.addons.twilightforest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class TwilightForestGenericOverride implements IWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return new ItemStack(accessor.getBlock(), 0, accessor.getMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package mcp.mobius.waila.addons.twilightforest;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.addons.ExternalModulesHandler;
|
||||
|
||||
public class TwilightForestModule {
|
||||
|
||||
public static Class BlockTFRoots = null;
|
||||
public static Class BlockTFPlant = null;
|
||||
public static Class BlockTFSapling = null;
|
||||
|
||||
public static void register(){
|
||||
|
||||
try{
|
||||
Class TwilightForestMod = Class.forName("twilightforest.TwilightForestMod");
|
||||
mod_Waila.log.log(Level.INFO, "TwilightForestMod mod found.");
|
||||
} catch (ClassNotFoundException e){
|
||||
mod_Waila.log.log(Level.INFO, "[TwilightForestMod] TwilightForestMod mod not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
BlockTFRoots = Class.forName("twilightforest.block.BlockTFRoots");
|
||||
BlockTFPlant = Class.forName("twilightforest.block.BlockTFPlant");
|
||||
BlockTFSapling = Class.forName("twilightforest.block.BlockTFSapling");
|
||||
} catch (ClassNotFoundException e) {
|
||||
mod_Waila.log.log(Level.WARNING, "[TwilightForestMod] Class not found. " + e);
|
||||
}
|
||||
|
||||
|
||||
ExternalModulesHandler.instance().registerStackProvider(new TwilightForestGenericOverride(), BlockTFRoots);
|
||||
ExternalModulesHandler.instance().registerStackProvider(new TwilightForestGenericOverride(), BlockTFPlant);
|
||||
//ExternalModulesHandler.instance().registerStackProvider(new TwilightForestGenericOverride(), BlockTFSapling);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,151 +0,0 @@
|
||||
package mcp.mobius.waila.addons.vanillamc;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemRecord;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntityMobSpawner;
|
||||
import mcp.mobius.waila.addons.ExternalModulesHandler;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
public class HUDHandlerVanilla implements IWailaDataProvider {
|
||||
|
||||
static int mobSpawnerID = Block.mobSpawner.blockID;
|
||||
static int cropsID = Block.crops.blockID;
|
||||
static int melonStemID = Block.melonStem.blockID;
|
||||
static int pumpkinStemID = Block.pumpkinStem.blockID;
|
||||
static int carrotID = Block.carrot.blockID;
|
||||
static int potatoID = Block.potato.blockID;
|
||||
static int leverID = Block.lever.blockID;
|
||||
static int repeaterIdle = Block.redstoneRepeaterIdle.blockID;
|
||||
static int repeaterActv = Block.redstoneRepeaterActive.blockID;
|
||||
static int comparatorIdl = Block.redstoneComparatorIdle.blockID;
|
||||
static int comparatorAct = Block.redstoneComparatorActive.blockID;
|
||||
static int redstone = Block.redstoneWire.blockID;
|
||||
static int jukebox = Block.jukebox.blockID;
|
||||
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
int blockID = accessor.getBlockID();
|
||||
|
||||
/* Mob spawner handler */
|
||||
if (blockID == mobSpawnerID && accessor.getTileEntity() instanceof TileEntityMobSpawner && config.getConfig("vanilla.spawntype")){
|
||||
String name = currenttip.get(0);
|
||||
String mobname = ((TileEntityMobSpawner)accessor.getTileEntity()).getSpawnerLogic().getEntityNameToSpawn();
|
||||
currenttip.set(0, String.format("%s (%s)", name, mobname));
|
||||
}
|
||||
|
||||
if (blockID == redstone){
|
||||
String name = currenttip.get(0).replaceFirst(String.format(" %s", accessor.getMetadata()), "");
|
||||
currenttip.set(0, name);
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
int blockID = accessor.getBlockID();
|
||||
/* Crops */
|
||||
if (config.getConfig("vanilla.growthvalue"))
|
||||
if (blockID == cropsID || blockID == melonStemID || blockID == pumpkinStemID || blockID == carrotID || blockID == potatoID){
|
||||
float growthValue = (accessor.getMetadata() / 7.0F) * 100.0F;
|
||||
if (growthValue != 100.0)
|
||||
currenttip.add(String.format("Growth : %.0f %%", growthValue));
|
||||
else
|
||||
currenttip.add("Growth : Mature");
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
if (config.getConfig("vanilla.leverstate"))
|
||||
if (blockID == leverID){
|
||||
String redstoneOn = (accessor.getMetadata() & 8) == 0 ? "Off" : "On";
|
||||
currenttip.add("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("Delay : %s tick", tick));
|
||||
else
|
||||
currenttip.add(String.format("Delay : %s ticks", tick));
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
if (config.getConfig("vanilla.comparator"))
|
||||
if ((blockID == comparatorIdl) ||(blockID == comparatorAct)){
|
||||
String mode = ((accessor.getMetadata() >> 2) & 1) == 0 ? "Comparator" : "Subtractor";
|
||||
//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("Power : %s" , 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("<Empty>");
|
||||
}
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
public static void register(){
|
||||
ExternalModulesHandler.instance().addConfig("VanillaMC", "vanilla.spawntype", "Spawner type");
|
||||
ExternalModulesHandler.instance().addConfig("VanillaMC", "vanilla.growthvalue", "Growth value");
|
||||
ExternalModulesHandler.instance().addConfig("VanillaMC", "vanilla.leverstate", "Lever state");
|
||||
ExternalModulesHandler.instance().addConfig("VanillaMC", "vanilla.repeater", "Repeater delay");
|
||||
ExternalModulesHandler.instance().addConfig("VanillaMC", "vanilla.comparator", "Comparator mode");
|
||||
ExternalModulesHandler.instance().addConfig("VanillaMC", "vanilla.redstone", "Redstone power");
|
||||
ExternalModulesHandler.instance().addConfigRemote("VanillaMC", "vanilla.jukebox", "Jukebox disk");
|
||||
ExternalModulesHandler.instance().registerHeadProvider(new HUDHandlerVanilla(), mobSpawnerID);
|
||||
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), cropsID);
|
||||
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), melonStemID);
|
||||
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), pumpkinStemID);
|
||||
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), carrotID);
|
||||
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), potatoID);
|
||||
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), leverID);
|
||||
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), repeaterIdle);
|
||||
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), repeaterActv);
|
||||
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), comparatorIdl);
|
||||
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), comparatorAct);
|
||||
ExternalModulesHandler.instance().registerHeadProvider(new HUDHandlerVanilla(), redstone);
|
||||
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), redstone);
|
||||
ExternalModulesHandler.instance().registerBodyProvider(new HUDHandlerVanilla(), jukebox);
|
||||
|
||||
ExternalModulesHandler.instance().registerDocTextFile("/mcp/mobius/waila/addons/vanillamc/WikiData.csv");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -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,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,20 +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.world.World;
|
||||
|
||||
public interface IWailaDataAccessor {
|
||||
World getWorld();
|
||||
EntityPlayer getPlayer();
|
||||
Block getBlock();
|
||||
int getBlockID();
|
||||
int getMetadata();
|
||||
TileEntity getTileEntity();
|
||||
MovingObjectPosition getPosition();
|
||||
NBTTagCompound getNBTData();
|
||||
int getNBTInteger(NBTTagCompound tag, String keyname);
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package mcp.mobius.waila.api;
|
||||
|
||||
public interface IWailaDataProvider extends IWailaBlock{
|
||||
}
|
||||
@@ -1,26 +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);
|
||||
|
||||
/* 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);
|
||||
|
||||
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,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;
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
package mcp.mobius.waila.gui.helpers;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
|
||||
public class UIHelper {
|
||||
|
||||
public static void drawTexture(int posX, int posY, int sizeX, int sizeY)
|
||||
{
|
||||
UIHelper.drawTexture(posX, posY, sizeX, sizeY, 0, 0, 256, 256);
|
||||
}
|
||||
|
||||
public static void drawTexture(int posX, int posY, int sizeX, int sizeY, int texU, int texV, int texSizeU, int texSizeV)
|
||||
{
|
||||
float zLevel = 0.0F;
|
||||
float f = 0.00390625F;
|
||||
|
||||
Tessellator tess = Tessellator.instance;
|
||||
tess.startDrawingQuads();
|
||||
tess.addVertexWithUV((double)(posX + 0), (double)(posY + sizeY), (double)zLevel, texU*f, (texV + texSizeV)*f);
|
||||
tess.addVertexWithUV((double)(posX + sizeX), (double)(posY + sizeY), (double)zLevel, (texU + texSizeU)*f, (texV + texSizeV)*f);
|
||||
tess.addVertexWithUV((double)(posX + sizeX), (double)(posY + 0), (double)zLevel, (texU + texSizeU)*f, texV*f);
|
||||
tess.addVertexWithUV((double)(posX + 0), (double)(posY + 0), (double)zLevel, texU*f, texV*f);
|
||||
tess.draw();
|
||||
}
|
||||
|
||||
public static void drawGradientRect(int minx, int miny, int maxx, int maxy, int zlevel, int color1, int color2)
|
||||
{
|
||||
float alpha1 = (float)(color1 >> 24 & 255) / 255.0F;
|
||||
float red1 = (float)(color1 >> 16 & 255) / 255.0F;
|
||||
float green1 = (float)(color1 >> 8 & 255) / 255.0F;
|
||||
float blue1 = (float)(color1 & 255) / 255.0F;
|
||||
float alpha2 = (float)(color2 >> 24 & 255) / 255.0F;
|
||||
float red2 = (float)(color2 >> 16 & 255) / 255.0F;
|
||||
float green2 = (float)(color2 >> 8 & 255) / 255.0F;
|
||||
float blue2 = (float)(color2 & 255) / 255.0F;
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorRGBA_F(red1, green1, blue1, alpha1);
|
||||
tessellator.addVertex((double)maxx, (double)miny, (double)zlevel);
|
||||
tessellator.addVertex((double)minx, (double)miny, (double)zlevel);
|
||||
tessellator.setColorRGBA_F(red2, green2, blue2, alpha2);
|
||||
tessellator.addVertex((double)minx, (double)maxy, (double)zlevel);
|
||||
tessellator.addVertex((double)maxx, (double)maxy, (double)zlevel);
|
||||
tessellator.draw();
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
package mcp.mobius.waila.gui.interfaces;
|
||||
|
||||
import mcp.mobius.waila.gui.events.MouseEvent;
|
||||
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
|
||||
|
||||
import org.lwjgl.util.Point;
|
||||
|
||||
public interface IWidget {
|
||||
// Should all the coordinates, sizes, etc be % or absolute values ?
|
||||
// Should we allow 2 methods for an absolute referencing (screen pos) and relative one (parent pos) ?
|
||||
|
||||
IWidget getParent();
|
||||
void setParent(IWidget parent);
|
||||
|
||||
IWidget setGeometry(WidgetGeometry geom);
|
||||
WidgetGeometry getGeometry();
|
||||
|
||||
IWidget setPos(double x, double y);
|
||||
IWidget setPos(double x, double y, boolean fracX, boolean fracY);
|
||||
IWidget setSize(double sx, double sy);
|
||||
IWidget setSize(double sx, double sy, boolean fracX, boolean fracY);
|
||||
IWidget adjustSize();
|
||||
|
||||
Point getPos();
|
||||
Point getSize();
|
||||
int getRight();
|
||||
int getLeft();
|
||||
int getTop();
|
||||
int getBottom();
|
||||
|
||||
void draw();
|
||||
void draw(Point pos);
|
||||
void show();
|
||||
void hide();
|
||||
void setAlpha(float alpha);
|
||||
float getAlpha();
|
||||
boolean shouldRender();
|
||||
|
||||
IWidget addWidget(String name, IWidget widget);
|
||||
IWidget addWidget(String name, IWidget widget, RenderPriority priority);
|
||||
IWidget getWidget(String name);
|
||||
IWidget delWidget(String name);
|
||||
IWidget getWidgetAtCoordinates(double posX, double posY);
|
||||
|
||||
boolean isWidgetAtCoordinates(double posx, double posy);
|
||||
|
||||
void handleMouseInput();
|
||||
|
||||
void onMouseClick(MouseEvent event);
|
||||
void onMouseDrag(MouseEvent event);
|
||||
void onMouseMove(MouseEvent event);
|
||||
void onMouseRelease(MouseEvent event);
|
||||
void onMouseWheel(MouseEvent event);
|
||||
void onMouseEnter(MouseEvent event);
|
||||
void onMouseLeave(MouseEvent event);
|
||||
|
||||
void emit(Signal signal, Object... params);
|
||||
void onWidgetEvent(IWidget srcwidget, Signal signal, Object... params);
|
||||
|
||||
//boolean onMouseEnter();
|
||||
//boolean onMouseMoved();
|
||||
//boolean onMouseLeave();
|
||||
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
package mcp.mobius.waila.gui.screens;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import mcp.mobius.waila.gui.interfaces.IWidget;
|
||||
import mcp.mobius.waila.gui.widgets.LayoutCanvas;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
public abstract class ScreenBase extends GuiScreen{
|
||||
protected GuiScreen parent; // Return screen if available.
|
||||
protected Minecraft mc; // Minecraft instance
|
||||
protected HashMap<String, IWidget> widgets; // List of widgets on this ui
|
||||
|
||||
public ScreenBase(GuiScreen parent) {
|
||||
this.parent = parent;
|
||||
this.mc = Minecraft.getMinecraft();
|
||||
this.widgets = new HashMap<String, IWidget>();
|
||||
|
||||
this.addWidget("canvas", new LayoutCanvas());
|
||||
|
||||
Mouse.getDWheel(); // We init the DWheel method (getDWheel returns the value since the last call, so we have to call it once on ui creation)
|
||||
}
|
||||
|
||||
/////////////////////
|
||||
// WIDGET HANDLING //
|
||||
/////////////////////
|
||||
|
||||
public IWidget addWidget(String name, IWidget widget){
|
||||
this.widgets.put(name, widget);
|
||||
return this.getWidget(name);
|
||||
}
|
||||
|
||||
public IWidget getWidget(String name){
|
||||
return this.widgets.get(name);
|
||||
}
|
||||
|
||||
public IWidget delWidget(String name){
|
||||
IWidget widget = this.getWidget(name);
|
||||
this.widgets.remove(widget);
|
||||
return widget;
|
||||
}
|
||||
|
||||
public IWidget getRoot(){
|
||||
return this.getWidget("canvas");
|
||||
}
|
||||
|
||||
/////////////////////
|
||||
// DRAWING METHODS //
|
||||
/////////////////////
|
||||
|
||||
@Override
|
||||
public void drawScreen(int i, int j, float f) {
|
||||
this.drawDefaultBackground(); //The dark background common to most of the UIs
|
||||
super.drawScreen(i, j, f);
|
||||
|
||||
for (IWidget widget: this.widgets.values())
|
||||
widget.draw();
|
||||
}
|
||||
|
||||
// Used to easily display a UI without having to mess with mc handle.
|
||||
public void display(){
|
||||
this.mc.displayGuiScreen(this);
|
||||
}
|
||||
|
||||
/////////////////////
|
||||
// INPUT METHODS //
|
||||
/////////////////////
|
||||
|
||||
//Keyboard handling. Basic one is just returning to the previous UI when Esc is pressed
|
||||
@Override
|
||||
public void keyTyped(char keyChar, int keyID)
|
||||
{
|
||||
if (keyID == 1)
|
||||
if (this.parent == null){
|
||||
this.mc.displayGuiScreen((GuiScreen)null);
|
||||
this.mc.setIngameFocus();
|
||||
} else
|
||||
this.mc.displayGuiScreen(this.parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMouseInput()
|
||||
{
|
||||
this.getRoot().handleMouseInput();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package mcp.mobius.waila.gui.screens.config;
|
||||
|
||||
import mcp.mobius.waila.Constants;
|
||||
import mcp.mobius.waila.gui.interfaces.CType;
|
||||
import mcp.mobius.waila.gui.interfaces.WAlign;
|
||||
import mcp.mobius.waila.gui.screens.ScreenBase;
|
||||
import mcp.mobius.waila.gui.widgets.LayoutBase;
|
||||
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
|
||||
import mcp.mobius.waila.gui.widgets.buttons.ButtonBooleanConfig;
|
||||
import mcp.mobius.waila.gui.widgets.buttons.ButtonContainer;
|
||||
import mcp.mobius.waila.gui.widgets.buttons.ButtonContainerLabel;
|
||||
import mcp.mobius.waila.gui.widgets.buttons.ButtonScreenChange;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
public class ScreenConfig extends ScreenBase {
|
||||
public ScreenConfig(GuiScreen parent){
|
||||
super(parent);
|
||||
|
||||
this.getRoot().addWidget("ButtonContainer", new ButtonContainer(this.getRoot(), 2, 100, 25.0));
|
||||
this.getRoot().getWidget("ButtonContainer").setGeometry(new WidgetGeometry(50.0, 50.0, 50.0, 30.0, CType.RELXY, CType.REL_X, WAlign.CENTER, WAlign.CENTER));
|
||||
|
||||
ButtonContainer buttonContainer = ((ButtonContainer)this.getRoot().getWidget("ButtonContainer"));
|
||||
|
||||
buttonContainer.addButton( new ButtonScreenChange(this.getRoot(), "Waila", new ScreenWailaConfig(this)));
|
||||
buttonContainer.addButton( new ButtonScreenChange(this.getRoot(), "Modules", new ScreenModuleChoice(this)));
|
||||
|
||||
this.getRoot().addWidget("LayoutBack", new LayoutBase(this.getRoot()));
|
||||
this.getRoot().getWidget("LayoutBack").setGeometry(new WidgetGeometry(0.0, 80.0, 100.0, 20.0, CType.RELXY, CType.RELXY));
|
||||
this.getRoot().getWidget("LayoutBack").addWidget("ButtonBack", new ButtonScreenChange(this.getRoot().getWidget("LayoutBack"), "Back", this.parent));
|
||||
this.getRoot().getWidget("LayoutBack").getWidget("ButtonBack").setGeometry(new WidgetGeometry(50.0, 50.0, 100.0, 20.0, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
|
||||
}
|
||||
}
|
||||
@@ -1,254 +0,0 @@
|
||||
package mcp.mobius.waila.gui.screens.config;
|
||||
|
||||
import org.lwjgl.util.Point;
|
||||
|
||||
import mcp.mobius.waila.Constants;
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.addons.ConfigHandler;
|
||||
import mcp.mobius.waila.gui.events.MouseEvent;
|
||||
import mcp.mobius.waila.gui.interfaces.CType;
|
||||
import mcp.mobius.waila.gui.interfaces.IWidget;
|
||||
import mcp.mobius.waila.gui.interfaces.RenderPriority;
|
||||
import mcp.mobius.waila.gui.interfaces.Signal;
|
||||
import mcp.mobius.waila.gui.interfaces.WAlign;
|
||||
import mcp.mobius.waila.gui.screens.ScreenBase;
|
||||
import mcp.mobius.waila.gui.widgets.LabelFixedFont;
|
||||
import mcp.mobius.waila.gui.widgets.LayoutBase;
|
||||
import mcp.mobius.waila.gui.widgets.LayoutMargin;
|
||||
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
|
||||
import mcp.mobius.waila.gui.widgets.buttons.ButtonLabel;
|
||||
import mcp.mobius.waila.gui.widgets.buttons.ButtonScreenChange;
|
||||
import mcp.mobius.waila.gui.widgets.movable.PictureMovableRC;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
public class ScreenHUDConfig extends ScreenBase {
|
||||
|
||||
private class EventCanvas extends LayoutBase{
|
||||
IWidget draggedWidget = null;
|
||||
|
||||
float scale;
|
||||
|
||||
public EventCanvas(IWidget parent, GuiScreen prevScreen){
|
||||
super(parent);
|
||||
this.setGeometry(new WidgetGeometry(0.0,0.0,100.0,100.0,CType.RELXY, CType.RELXY));
|
||||
|
||||
/*
|
||||
IWidget layoutX = this.addWidget("LayoutX", new LayoutBase(this));
|
||||
layoutX.setGeometry(new WidgetGeometry(40.0,50.0,20,60, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
|
||||
layoutX.addWidget("ButtonXAdd", new ButtonLabel(null, "+")).setGeometry(new WidgetGeometry(0.0, 0.0,20,20, CType.RELXY, CType.ABSXY, WAlign.LEFT, WAlign.TOP));
|
||||
layoutX.addWidget("ButtonXSub", new ButtonLabel(null, "-")).setGeometry(new WidgetGeometry(0.0,100.0,20,20, CType.RELXY, CType.ABSXY, WAlign.LEFT, WAlign.BOTTOM));
|
||||
layoutX.addWidget("ValueDisplayX", new LabelFixedFont(null, "0")).setGeometry(new WidgetGeometry(50.0,50.0,20,20, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
|
||||
*/
|
||||
|
||||
/*
|
||||
IWidget layoutY = this.addWidget("LayoutY", new LayoutBase(this));
|
||||
layoutY.setGeometry(new WidgetGeometry(50.0,50.0,20,60,CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
|
||||
layoutY.addWidget("ButtonYAdd", new ButtonLabel(null, "+")).setGeometry(new WidgetGeometry(0.0, 0.0,20,20, CType.RELXY, CType.ABSXY, WAlign.LEFT, WAlign.TOP));
|
||||
layoutY.addWidget("ButtonYSub", new ButtonLabel(null, "-")).setGeometry(new WidgetGeometry(0.0,100.0,20,20, CType.RELXY, CType.ABSXY, WAlign.LEFT, WAlign.BOTTOM));
|
||||
layoutY.addWidget("ValueDisplayY", new LabelFixedFont(null, "0")).setGeometry(new WidgetGeometry(50.0,50.0,20,20, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
|
||||
*/
|
||||
|
||||
double picX = ConfigHandler.instance().getConfigInt(Constants.CFG_WAILA_POSX) / 100.0;
|
||||
double picY = ConfigHandler.instance().getConfigInt(Constants.CFG_WAILA_POSY) / 100.0;
|
||||
float picAlpha = ConfigHandler.instance().getConfigInt(Constants.CFG_WAILA_ALPHA) / 100.0f;
|
||||
scale = ConfigHandler.instance().getConfigInt(Constants.CFG_WAILA_SCALE) / 100.0f;
|
||||
|
||||
int picSX = (int)(180 / this.rez.getScaleFactor() * scale), picSY = (int)(62 / this.rez.getScaleFactor() * scale);
|
||||
this.addWidget("Layout", new LayoutMargin(null), RenderPriority.HIGH);
|
||||
((LayoutMargin)this.getWidget("Layout")).setMargins(picSX/2, picSX/2, picSY/2, picSY/2);
|
||||
this.getWidget("Layout").addWidget("Picture", new PictureMovableRC(null, "waila:textures/config_template.png")).setGeometry(new WidgetGeometry(picX, picY, picSX, picSY,CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
|
||||
|
||||
this.addWidget("TextTuto1", new LabelFixedFont(null, "Drag the HUD to setup its position.")).setGeometry(new WidgetGeometry(50.0, 30.0,20,20, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));;
|
||||
|
||||
IWidget layoutX = this.addWidget("LayoutX", new LayoutBase(this));
|
||||
layoutX.setGeometry(new WidgetGeometry(35.0,50.0,20,80,CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
|
||||
layoutX.addWidget("LabelX", new LabelFixedFont(null, "X")) .setGeometry(new WidgetGeometry(50.0, 0.0,20,20, CType.REL_X, CType.ABSXY, WAlign.CENTER, WAlign.TOP));
|
||||
layoutX.addWidget("ButtonXAdd", new ButtonLabel(null, "+")) .setGeometry(new WidgetGeometry(0.0, 10.0,20,20, CType.REL_X, CType.ABSXY, WAlign.LEFT, WAlign.TOP));
|
||||
layoutX.addWidget("ValueDisplayX", new LabelFixedFont(null, "0")) .setGeometry(new WidgetGeometry(50.0, 40.0,20,20, CType.REL_X, CType.ABSXY, WAlign.CENTER, WAlign.TOP));
|
||||
layoutX.addWidget("ButtonXSub", new ButtonLabel(null, "-")) .setGeometry(new WidgetGeometry(0.0, 60.0,20,20, CType.REL_X, CType.ABSXY, WAlign.LEFT, WAlign.TOP));
|
||||
|
||||
IWidget layoutY = this.addWidget("LayoutY", new LayoutBase(this));
|
||||
layoutY.setGeometry(new WidgetGeometry(45.0,50.0,20,80,CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
|
||||
layoutY.addWidget("LabelY", new LabelFixedFont(null, "Y")) .setGeometry(new WidgetGeometry(50.0, 0.0,20,20, CType.REL_X, CType.ABSXY, WAlign.CENTER, WAlign.TOP));
|
||||
layoutY.addWidget("ButtonYAdd", new ButtonLabel(null, "+")) .setGeometry(new WidgetGeometry(0.0, 10.0,20,20, CType.REL_X, CType.ABSXY, WAlign.LEFT, WAlign.TOP));
|
||||
layoutY.addWidget("ValueDisplayY", new LabelFixedFont(null, "0")) .setGeometry(new WidgetGeometry(50.0, 40.0,20,20, CType.REL_X, CType.ABSXY, WAlign.CENTER, WAlign.TOP));
|
||||
layoutY.addWidget("ButtonYSub", new ButtonLabel(null, "-")) .setGeometry(new WidgetGeometry(0.0, 60.0,20,20, CType.REL_X, CType.ABSXY, WAlign.LEFT, WAlign.TOP));
|
||||
|
||||
IWidget layoutAlpha = this.addWidget("LayoutAlpha", new LayoutBase(this));
|
||||
layoutAlpha.setGeometry(new WidgetGeometry(55.0,50.0,20,80,CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
|
||||
layoutAlpha.addWidget("LabelAlpha", new LabelFixedFont(null, "Alpha")).setGeometry(new WidgetGeometry(50.0, 0.0,20,20, CType.REL_X, CType.ABSXY, WAlign.CENTER, WAlign.TOP));
|
||||
layoutAlpha.addWidget("ButtonAlphaAdd", new ButtonLabel(null, "+")) .setGeometry(new WidgetGeometry(0.0, 10.0,20,20, CType.REL_X, CType.ABSXY, WAlign.LEFT, WAlign.TOP));
|
||||
layoutAlpha.addWidget("ValueDisplayAlpha", new LabelFixedFont(null, "0")) .setGeometry(new WidgetGeometry(50.0, 40.0,20,20, CType.REL_X, CType.ABSXY, WAlign.CENTER, WAlign.TOP));
|
||||
layoutAlpha.addWidget("ButtonAlphaSub", new ButtonLabel(null, "-")) .setGeometry(new WidgetGeometry(0.0, 60.0,20,20, CType.REL_X, CType.ABSXY, WAlign.LEFT, WAlign.TOP));
|
||||
|
||||
IWidget layoutScale = this.addWidget("LayoutScale", new LayoutBase(this));
|
||||
layoutScale.setGeometry(new WidgetGeometry(65.0,50.0,20,80,CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
|
||||
layoutScale.addWidget("LabelScale", new LabelFixedFont(null, "Scale")).setGeometry(new WidgetGeometry(50.0, 0.0,20,20, CType.REL_X, CType.ABSXY, WAlign.CENTER, WAlign.TOP));
|
||||
layoutScale.addWidget("ButtonScaleAdd", new ButtonLabel(null, "+")) .setGeometry(new WidgetGeometry(0.0, 10.0,20,20, CType.REL_X, CType.ABSXY, WAlign.LEFT, WAlign.TOP));
|
||||
layoutScale.addWidget("ValueDisplayScale", new LabelFixedFont(null, "0")) .setGeometry(new WidgetGeometry(50.0, 40.0,20,20, CType.REL_X, CType.ABSXY, WAlign.CENTER, WAlign.TOP));
|
||||
layoutScale.addWidget("ButtonScaleSub", new ButtonLabel(null, "-")) .setGeometry(new WidgetGeometry(0.0, 60.0,20,20, CType.REL_X, CType.ABSXY, WAlign.LEFT, WAlign.TOP));
|
||||
|
||||
|
||||
this.addWidget("ButtonCancel", new ButtonScreenChange(null, "Cancel", prevScreen)).setGeometry(new WidgetGeometry(70.0,97.0,75,20, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.BOTTOM));
|
||||
this.addWidget("ButtonOk", new ButtonScreenChange(null, "Ok", prevScreen)).setGeometry(new WidgetGeometry(30.0,97.0,75,20, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.BOTTOM));
|
||||
this.addWidget("ButtonDefault",new ButtonLabel(null, "Default")).setGeometry(new WidgetGeometry(50.0,97.0,75,20, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.BOTTOM));
|
||||
|
||||
|
||||
|
||||
((LabelFixedFont)this.getWidget("LayoutX").getWidget("ValueDisplayX")).setText(String.format("%.2f", picX));
|
||||
((LabelFixedFont)this.getWidget("LayoutY").getWidget("ValueDisplayY")).setText(String.format("%.2f", picY));
|
||||
((LabelFixedFont)this.getWidget("LayoutAlpha").getWidget("ValueDisplayAlpha")).setText(String.format("%.2f", picAlpha));
|
||||
((LabelFixedFont)this.getWidget("LayoutScale").getWidget("ValueDisplayScale")).setText(String.format("%.2f", scale));
|
||||
|
||||
this.getWidget("Layout").getWidget("Picture").setAlpha(picAlpha);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWidget getWidgetAtCoordinates(double posX, double posY){
|
||||
if (this.getWidget("Layout").getWidget("Picture").isWidgetAtCoordinates(posX, posY))
|
||||
return this.getWidget("Layout").getWidget("Picture");
|
||||
else
|
||||
return super.getWidgetAtCoordinates(posX, posY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseClick(MouseEvent event){
|
||||
//System.out.println(this.getWidgetAtCoordinates(event.x, event.y));
|
||||
|
||||
if ((event.button == 0) && (this.getWidget("Layout").getWidget("Picture").isWidgetAtCoordinates(event.x, event.y))){
|
||||
this.getWidget("Layout").getWidget("Picture").onMouseClick(event);
|
||||
this.draggedWidget = this.getWidget("Layout").getWidget("Picture");
|
||||
}
|
||||
else
|
||||
super.onMouseClick(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseDrag(MouseEvent event){
|
||||
|
||||
//if ((this.getWidgetAtCoordinates(event.x, event.y) == this) && (this.draggedWidget != null)){
|
||||
if (this.draggedWidget != null){
|
||||
this.draggedWidget.onMouseDrag(event);
|
||||
} else {
|
||||
super.onMouseDrag(event);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseRelease(MouseEvent event){
|
||||
if (event.button == 0)
|
||||
this.draggedWidget = null;
|
||||
super.onMouseRelease(event);
|
||||
}
|
||||
|
||||
|
||||
private void updateData(){
|
||||
((LabelFixedFont)this.getWidget("LayoutX").getWidget("ValueDisplayX")).setText(String.format("%.2f", this.getWidget("Layout").getWidget("Picture").getGeometry().getRawPos().getX()));
|
||||
((LabelFixedFont)this.getWidget("LayoutY").getWidget("ValueDisplayY")).setText(String.format("%.2f", this.getWidget("Layout").getWidget("Picture").getGeometry().getRawPos().getY()));
|
||||
((LabelFixedFont)this.getWidget("LayoutAlpha").getWidget("ValueDisplayAlpha")).setText(String.format("%.2f", this.getWidget("Layout").getWidget("Picture").getAlpha()));
|
||||
((LabelFixedFont)this.getWidget("LayoutScale").getWidget("ValueDisplayScale")).setText(String.format("%.2f", scale));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWidgetEvent(IWidget srcwidget, Signal signal, Object... params){
|
||||
|
||||
if (this.getWidget("Layout") == null) return;
|
||||
|
||||
if (srcwidget.equals(this.getWidget("Layout").getWidget("Picture")) && signal == Signal.DRAGGED){
|
||||
this.draggedWidget = this.getWidget("Layout").getWidget("Picture");
|
||||
this.updateData();
|
||||
}
|
||||
|
||||
if (signal == Signal.CLICKED){
|
||||
|
||||
IWidget picture = this.getWidget("Layout").getWidget("Picture");
|
||||
double pictureX = picture.getGeometry().getRawPos().getX();
|
||||
double pictureY = picture.getGeometry().getRawPos().getY();
|
||||
double pixelToPercentX = 100.0D / picture.getParent().getSize().getX();
|
||||
double pixelToPercentY = 100.0D / picture.getParent().getSize().getY();
|
||||
|
||||
if (srcwidget.equals(this.getWidget("LayoutX").getWidget("ButtonXAdd"))){
|
||||
double newPos = Math.min(pictureX + pixelToPercentX, 100.0);
|
||||
picture.setPos(newPos, pictureY);
|
||||
}
|
||||
|
||||
if (srcwidget.equals(this.getWidget("LayoutX").getWidget("ButtonXSub"))){
|
||||
double newPos = Math.max(pictureX - pixelToPercentX, 0.0);
|
||||
picture.setPos(newPos, pictureY);
|
||||
}
|
||||
|
||||
if (srcwidget.equals(this.getWidget("LayoutY").getWidget("ButtonYAdd"))){
|
||||
double newPos = Math.min(pictureY + pixelToPercentY, 100.0);
|
||||
picture.setPos(pictureX, newPos);
|
||||
}
|
||||
|
||||
if (srcwidget.equals(this.getWidget("LayoutY").getWidget("ButtonYSub"))){
|
||||
double newPos = Math.max(pictureY - pixelToPercentY, 0.0);
|
||||
picture.setPos(pictureX, newPos);
|
||||
}
|
||||
|
||||
if (srcwidget.equals(this.getWidget("LayoutAlpha").getWidget("ButtonAlphaAdd")))
|
||||
picture.setAlpha(Math.min(picture.getAlpha() + 0.05f, 1.0f));
|
||||
|
||||
if (srcwidget.equals(this.getWidget("LayoutAlpha").getWidget("ButtonAlphaSub")))
|
||||
picture.setAlpha(Math.max(picture.getAlpha() - 0.05f, 0.0f));
|
||||
|
||||
if (srcwidget.equals(this.getWidget("LayoutScale").getWidget("ButtonScaleAdd"))){
|
||||
scale += 0.05f;
|
||||
scale = Math.max(0.10f, scale);
|
||||
scale = Math.min(2.00f, scale);
|
||||
|
||||
int picSX = (int)(180 / this.rez.getScaleFactor() * scale), picSY = (int)(62 / this.rez.getScaleFactor() * scale);
|
||||
picture.setSize(picSX, picSY);
|
||||
((LayoutMargin)this.getWidget("Layout")).setMargins(picSX/2, picSX/2, picSY/2, picSY/2);
|
||||
}
|
||||
|
||||
if (srcwidget.equals(this.getWidget("LayoutScale").getWidget("ButtonScaleSub"))){
|
||||
scale -= 0.05f;
|
||||
scale = Math.max(0.10f, scale);
|
||||
scale = Math.min(2.00f, scale);
|
||||
|
||||
int picSX = (int)(180 / this.rez.getScaleFactor() * scale), picSY = (int)(62 / this.rez.getScaleFactor() * scale);
|
||||
picture.setSize(picSX, picSY);
|
||||
((LayoutMargin)this.getWidget("Layout")).setMargins(picSX/2, picSX/2, picSY/2, picSY/2);
|
||||
}
|
||||
|
||||
//picture.emit(Signal.DRAGGED, picture.getPos());
|
||||
this.updateData();
|
||||
|
||||
}
|
||||
if (srcwidget.equals(this.getWidget("ButtonOk")) && signal == Signal.CLICKED){
|
||||
ConfigHandler.instance().setConfigInt(Constants.CFG_WAILA_POSX, (int)(this.getWidget("Layout").getWidget("Picture").getGeometry().getRawPos().getX() * 100.0));
|
||||
ConfigHandler.instance().setConfigInt(Constants.CFG_WAILA_POSY, (int)(this.getWidget("Layout").getWidget("Picture").getGeometry().getRawPos().getY() * 100.0));
|
||||
ConfigHandler.instance().setConfigInt(Constants.CFG_WAILA_ALPHA, (int)(this.getWidget("Layout").getWidget("Picture").getAlpha() * 100.0));
|
||||
ConfigHandler.instance().setConfigInt(Constants.CFG_WAILA_SCALE, (int)(scale * 100.0));
|
||||
|
||||
mod_Waila.alpha = ConfigHandler.instance().getConfigInt(Constants.CFG_WAILA_ALPHA);
|
||||
mod_Waila.posX = ConfigHandler.instance().getConfigInt(Constants.CFG_WAILA_POSX);
|
||||
mod_Waila.posY = ConfigHandler.instance().getConfigInt(Constants.CFG_WAILA_POSY);
|
||||
mod_Waila.scale = ConfigHandler.instance().getConfigInt(Constants.CFG_WAILA_SCALE) / 100.0f;
|
||||
|
||||
mod_Waila.updateColors();
|
||||
}
|
||||
|
||||
if (srcwidget.equals(this.getWidget("ButtonDefault")) && signal == Signal.CLICKED){
|
||||
this.getWidget("Layout").getWidget("Picture").setPos(50.0, 1.0);
|
||||
this.getWidget("Layout").getWidget("Picture").setAlpha(0.8f);
|
||||
this.scale = 1.0f;
|
||||
int picSX = (int)(180 / this.rez.getScaleFactor() * scale), picSY = (int)(62 / this.rez.getScaleFactor() * scale);
|
||||
this.getWidget("Layout").getWidget("Picture").setSize(picSX, picSY);
|
||||
((LayoutMargin)this.getWidget("Layout")).setMargins(picSX/2, picSX/2, picSY/2, picSY/2);
|
||||
|
||||
this.updateData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ScreenHUDConfig(GuiScreen parent){
|
||||
super(parent);
|
||||
|
||||
this.getRoot().addWidget("EventCanvas", new EventCanvas(this.getRoot(), parent));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package mcp.mobius.waila.gui.screens.config;
|
||||
|
||||
import mcp.mobius.waila.addons.ConfigHandler;
|
||||
import mcp.mobius.waila.gui.interfaces.CType;
|
||||
import mcp.mobius.waila.gui.interfaces.WAlign;
|
||||
import mcp.mobius.waila.gui.screens.ScreenBase;
|
||||
import mcp.mobius.waila.gui.widgets.LayoutBase;
|
||||
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
|
||||
import mcp.mobius.waila.gui.widgets.buttons.ButtonContainer;
|
||||
import mcp.mobius.waila.gui.widgets.buttons.ButtonScreenChange;
|
||||
import mcp.mobius.waila.gui_old.widget_old.ButtonChangeScreen;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
public class ScreenModuleChoice extends ScreenBase {
|
||||
|
||||
public ScreenModuleChoice(GuiScreen parent){
|
||||
super(parent);
|
||||
|
||||
this.getRoot().addWidget("ButtonContainer", new ButtonContainer(this.getRoot(), 3, 100, 25.0));
|
||||
this.getRoot().getWidget("ButtonContainer").setGeometry(new WidgetGeometry(50.0, 20.0, 400.0, 60.0, CType.RELXY, CType.REL_Y, WAlign.CENTER, WAlign.TOP));
|
||||
|
||||
ButtonContainer buttonContainer = ((ButtonContainer)this.getRoot().getWidget("ButtonContainer"));
|
||||
|
||||
for (String key : ConfigHandler.instance().getModuleNames())
|
||||
buttonContainer.addButton( new ButtonScreenChange(this.getRoot(), key, new ScreenModuleConfig(this, key)));
|
||||
|
||||
this.getRoot().addWidget("LayoutBack", new LayoutBase(this.getRoot()));
|
||||
this.getRoot().getWidget("LayoutBack").setGeometry(new WidgetGeometry(0.0, 80.0, 100.0, 20.0, CType.RELXY, CType.RELXY));
|
||||
this.getRoot().getWidget("LayoutBack").addWidget("ButtonBack", new ButtonScreenChange(this.getRoot().getWidget("LayoutBack"), "Back", this.parent));
|
||||
this.getRoot().getWidget("LayoutBack").getWidget("ButtonBack").setGeometry(new WidgetGeometry(50.0, 50.0, 100.0, 20.0, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
package mcp.mobius.waila.gui.screens.config;
|
||||
|
||||
import mcp.mobius.waila.addons.ConfigHandler;
|
||||
import mcp.mobius.waila.gui.interfaces.CType;
|
||||
import mcp.mobius.waila.gui.interfaces.WAlign;
|
||||
import mcp.mobius.waila.gui.screens.ScreenBase;
|
||||
import mcp.mobius.waila.gui.widgets.LayoutBase;
|
||||
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
|
||||
import mcp.mobius.waila.gui.widgets.buttons.ButtonBooleanConfig;
|
||||
import mcp.mobius.waila.gui.widgets.buttons.ButtonBooleanConfigRemote;
|
||||
import mcp.mobius.waila.gui.widgets.buttons.ButtonContainer;
|
||||
import mcp.mobius.waila.gui.widgets.buttons.ButtonContainerLabel;
|
||||
import mcp.mobius.waila.gui.widgets.buttons.ButtonScreenChange;
|
||||
import mcp.mobius.waila.gui_old.widget_old.ButtonConfigOption;
|
||||
import mcp.mobius.waila.gui_old.widget_old.ButtonConfigRemote;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
public class ScreenModuleConfig extends ScreenBase {
|
||||
|
||||
private String modName;
|
||||
|
||||
public ScreenModuleConfig(GuiScreen parent, String modname){
|
||||
super(parent);
|
||||
|
||||
this.modName = modname;
|
||||
|
||||
this.getRoot().addWidget("ButtonContainer", new ButtonContainerLabel(this.getRoot(), 2, 100, 25.0));
|
||||
this.getRoot().getWidget("ButtonContainer").setGeometry(new WidgetGeometry(0.0, 20.0, 100.0, 60.0, CType.RELXY, CType.RELXY, WAlign.LEFT, WAlign.TOP));
|
||||
|
||||
ButtonContainerLabel buttonContainer = ((ButtonContainerLabel)this.getRoot().getWidget("ButtonContainer"));
|
||||
|
||||
for (String key:ConfigHandler.instance().getConfigKeys(this.modName).keySet()){
|
||||
if (ConfigHandler.instance().isServerRequired(key))
|
||||
buttonContainer.addButton(new ButtonBooleanConfigRemote(this.getRoot(), key, "No", "Yes"), ConfigHandler.instance().getConfigKeys(this.modName).get(key));
|
||||
else
|
||||
buttonContainer.addButton(new ButtonBooleanConfig(this.getRoot(), key, "No", "Yes"), ConfigHandler.instance().getConfigKeys(this.modName).get(key));
|
||||
//buttonContainer.addButton(new ButtonConfigRemote(-1, "No", "Yes", ConfigHandler.instance().getConfigKeys(this.modName).get(key), key ));
|
||||
//else
|
||||
//buttonContainer.addButton(new ButtonConfigOption(-1, "No", "Yes", ConfigHandler.instance().getConfigKeys(this.modName).get(key), key ));
|
||||
}
|
||||
|
||||
this.getRoot().addWidget("LayoutBack", new LayoutBase(this.getRoot()));
|
||||
this.getRoot().getWidget("LayoutBack").setGeometry(new WidgetGeometry(0.0, 80.0, 100.0, 20.0, CType.RELXY, CType.RELXY));
|
||||
this.getRoot().getWidget("LayoutBack").addWidget("ButtonBack", new ButtonScreenChange(this.getRoot().getWidget("LayoutBack"), "Back", this.parent));
|
||||
this.getRoot().getWidget("LayoutBack").getWidget("ButtonBack").setGeometry(new WidgetGeometry(50.0, 50.0, 100.0, 20.0, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package mcp.mobius.waila.gui.screens.config;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import mcp.mobius.waila.Constants;
|
||||
import mcp.mobius.waila.gui.interfaces.CType;
|
||||
import mcp.mobius.waila.gui.interfaces.WAlign;
|
||||
import mcp.mobius.waila.gui.screens.ScreenBase;
|
||||
import mcp.mobius.waila.gui.widgets.LayoutBase;
|
||||
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
|
||||
import mcp.mobius.waila.gui.widgets.buttons.ButtonBooleanConfig;
|
||||
import mcp.mobius.waila.gui.widgets.buttons.ButtonContainerLabel;
|
||||
import mcp.mobius.waila.gui.widgets.buttons.ButtonIntegerConfig;
|
||||
import mcp.mobius.waila.gui.widgets.buttons.ButtonScreenChange;
|
||||
|
||||
public class ScreenWailaConfig extends ScreenBase {
|
||||
public ScreenWailaConfig(GuiScreen parent){
|
||||
super(parent);
|
||||
|
||||
this.getRoot().addWidget("ButtonContainer", new ButtonContainerLabel(this.getRoot(), 2, 100, 25.0));
|
||||
this.getRoot().getWidget("ButtonContainer").setGeometry(new WidgetGeometry(0.0, 10.0, 100.0, 50.0, CType.RELXY, CType.RELXY));
|
||||
|
||||
ButtonContainerLabel buttonContainer = ((ButtonContainerLabel)this.getRoot().getWidget("ButtonContainer"));
|
||||
|
||||
buttonContainer.addButton( new ButtonBooleanConfig(this.getRoot(), Constants.CFG_WAILA_SHOW, true, true, "Hidden", "Visible"), "Show/Hide Waila");
|
||||
buttonContainer.addButton( new ButtonBooleanConfig(this.getRoot(), Constants.CFG_WAILA_MODE, true, true, "Maintained", "Toggled"), "Toggled/Maintained");
|
||||
buttonContainer.addButton( new ButtonBooleanConfig(this.getRoot(), Constants.CFG_WAILA_METADATA, true, false,"Hidden", "Visible"), "Show ID:Metadata");
|
||||
buttonContainer.addButton( new ButtonBooleanConfig(this.getRoot(), Constants.CFG_WAILA_LIQUID, true, false,"Hidden", "Visible"), "Liquids");
|
||||
|
||||
|
||||
this.getRoot().addWidget("LayoutConfigPos", new LayoutBase(this.getRoot()));
|
||||
this.getRoot().getWidget("LayoutConfigPos").setGeometry(new WidgetGeometry(0.0, 50.0, 100.0, 20.0, CType.RELXY, CType.RELXY));
|
||||
this.getRoot().getWidget("LayoutConfigPos").addWidget("ButtonConfigPos", new ButtonScreenChange(null, "Configure aspect ...", new ScreenHUDConfig(this)));
|
||||
this.getRoot().getWidget("LayoutConfigPos").getWidget("ButtonConfigPos").setGeometry(new WidgetGeometry(50.0, 50.0, 150.0, 20.0, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
|
||||
|
||||
this.getRoot().addWidget("LayoutBack", new LayoutBase(this.getRoot()));
|
||||
this.getRoot().getWidget("LayoutBack").setGeometry(new WidgetGeometry(0.0, 80.0, 100.0, 20.0, CType.RELXY, CType.RELXY));
|
||||
this.getRoot().getWidget("LayoutBack").addWidget("ButtonBack", new ButtonScreenChange(null, "Back", this.parent));
|
||||
this.getRoot().getWidget("LayoutBack").getWidget("ButtonBack").setGeometry(new WidgetGeometry(50.0, 50.0, 100.0, 20.0, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
package mcp.mobius.waila.gui.screens.info;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import mcp.mobius.waila.gui.interfaces.CType;
|
||||
import mcp.mobius.waila.gui.interfaces.WAlign;
|
||||
import mcp.mobius.waila.gui.screens.ScreenBase;
|
||||
import mcp.mobius.waila.gui.widgets.ItemStackDisplay;
|
||||
import mcp.mobius.waila.gui.widgets.LabelFixedFont;
|
||||
import mcp.mobius.waila.gui.widgets.LayoutBase;
|
||||
import mcp.mobius.waila.gui.widgets.ViewTable;
|
||||
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
|
||||
|
||||
public class ScreenEnchants extends ScreenBase {
|
||||
|
||||
public ScreenEnchants(GuiScreen parent) {
|
||||
super(parent);
|
||||
|
||||
this.getRoot().addWidget("Layout_Title", new LayoutBase(null))
|
||||
.setGeometry(new WidgetGeometry(50.0, 10.0, 50.0, 32.0, CType.REL_X, CType.REL_X, WAlign.CENTER, WAlign.TOP));
|
||||
|
||||
this.getRoot().getWidget("Layout_Title").addWidget("ItemStack", new ItemStackDisplay(null))
|
||||
.setGeometry(new WidgetGeometry(0.0, 0.0, 32.0, 32.0, CType.ABSXY, CType.ABSXY, WAlign.LEFT, WAlign.TOP));
|
||||
|
||||
this.getRoot().getWidget("Layout_Title").addWidget("LabelName", new LabelFixedFont(null, "None"))
|
||||
.setGeometry(new WidgetGeometry(40.0, 4.0, 16.0, 16.0, CType.ABSXY, CType.ABSXY, WAlign.LEFT, WAlign.TOP));
|
||||
|
||||
this.getRoot().getWidget("Layout_Title").addWidget("LabelEnchantability", new LabelFixedFont(null, "None"))
|
||||
.setGeometry(new WidgetGeometry(40.0, 22.0, 16.0, 16.0, CType.ABSXY, CType.REL_X, WAlign.LEFT, WAlign.BOTTOM));
|
||||
|
||||
this.getRoot().addWidget("Table", new ViewTable(null))
|
||||
.setGeometry(new WidgetGeometry(50.0, 50.0, 90.0, 90.0, CType.REL_X, CType.RELXY, WAlign.CENTER, WAlign.TOP));
|
||||
|
||||
((ViewTable)this.getRoot().getWidget("Table"))
|
||||
.setColumnsTitle("\u00a7a\u00a7oName","\u00a7a\u00a7oMin lvl","\u00a7a\u00a7oMax lvl","\u00a7a\u00a7oWeight", "\u00a7a\u00a7oMod")
|
||||
.setColumnsWidth(35.0, 10.0, 10.0, 10.0, 35.0)
|
||||
.setColumnsAlign(WAlign.LEFT, WAlign.CENTER, WAlign.CENTER, WAlign.CENTER, WAlign.LEFT);
|
||||
}
|
||||
|
||||
public ViewTable getTable(){
|
||||
return (ViewTable)this.getRoot().getWidget("Table");
|
||||
}
|
||||
|
||||
public ScreenEnchants addRow(String...strings ){
|
||||
this.getTable().addRow(strings);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ScreenEnchants setStack(ItemStack stack){
|
||||
((ItemStackDisplay)this.getRoot().getWidget("Layout_Title").getWidget("ItemStack")).setStack(stack);
|
||||
this.getRoot().getWidget("Layout_Title").adjustSize();
|
||||
return this;
|
||||
}
|
||||
|
||||
public ScreenEnchants setName(String name){
|
||||
((LabelFixedFont)this.getRoot().getWidget("Layout_Title").getWidget("LabelName")).setText(name);
|
||||
this.getRoot().getWidget("Layout_Title").adjustSize();
|
||||
return this;
|
||||
}
|
||||
|
||||
public ScreenEnchants setEnchantability(String value){
|
||||
((LabelFixedFont)this.getRoot().getWidget("Layout_Title").getWidget("LabelEnchantability")).setText(String.format("Enchantability : %s", value));
|
||||
this.getRoot().getWidget("Layout_Title").adjustSize();
|
||||
return this;
|
||||
}
|
||||
|
||||
/*
|
||||
public ScreenEnchants setStack(ItemStack stack){
|
||||
((ItemStackDisplay)this.getRoot().getWidget("ItemStack")).setStack(stack);
|
||||
return this;
|
||||
}
|
||||
*/
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
package mcp.mobius.waila.gui.testing;
|
||||
|
||||
import org.lwjgl.util.Point;
|
||||
|
||||
import mcp.mobius.waila.gui.events.MouseEvent;
|
||||
import mcp.mobius.waila.gui.helpers.UIException;
|
||||
import mcp.mobius.waila.gui.interfaces.CType;
|
||||
import mcp.mobius.waila.gui.interfaces.IWidget;
|
||||
import mcp.mobius.waila.gui.interfaces.WAlign;
|
||||
import mcp.mobius.waila.gui.screens.ScreenBase;
|
||||
import mcp.mobius.waila.gui.widgets.ItemStackDisplay;
|
||||
import mcp.mobius.waila.gui.widgets.LabelFixedFont;
|
||||
import mcp.mobius.waila.gui.widgets.LayoutBase;
|
||||
import mcp.mobius.waila.gui.widgets.LayoutCropping;
|
||||
import mcp.mobius.waila.gui.widgets.PictureDisplay;
|
||||
import mcp.mobius.waila.gui.widgets.PictureSwitch;
|
||||
import mcp.mobius.waila.gui.widgets.ViewTable;
|
||||
import mcp.mobius.waila.gui.widgets.ViewportScrollable;
|
||||
import mcp.mobius.waila.gui.widgets.WidgetBase;
|
||||
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
|
||||
import mcp.mobius.waila.gui.widgets.buttons.ButtonBoolean;
|
||||
import mcp.mobius.waila.gui.widgets.buttons.ButtonContainerLabel;
|
||||
import mcp.mobius.waila.gui.widgets.buttons.ButtonInteger;
|
||||
import mcp.mobius.waila.gui.widgets.buttons.ButtonIntegerConfig;
|
||||
import mcp.mobius.waila.gui.widgets.buttons.ButtonScreenChange;
|
||||
import mcp.mobius.waila.gui.widgets.movable.PictureMovableRC;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ScreenTest extends ScreenBase {
|
||||
|
||||
public ScreenTest(GuiScreen parent) {
|
||||
super(parent);
|
||||
|
||||
this.getRoot().addWidget("Test", new ViewTable(null))
|
||||
.setGeometry(new WidgetGeometry(50.0, 50.0, 90.0, 90.0, CType.RELXY, CType.RELXY, WAlign.CENTER, WAlign.CENTER));
|
||||
((ViewTable)this.getRoot().getWidget("Test"))
|
||||
.setColumnsTitle("Column1","Column2","Column3")
|
||||
.setColumnsWidth(30.0,30.0,30.0)
|
||||
.setColumnsAlign(WAlign.CENTER, WAlign.CENTER, WAlign.CENTER)
|
||||
.addRow("test1", "test2", "test3")
|
||||
.addRow("test1", "test2", "test3")
|
||||
.addRow("test1", "test2", "test3")
|
||||
.addRow("test1", "test2", "test3")
|
||||
.addRow("test1", "test2", "test3")
|
||||
.addRow("test1", "test2", "test3")
|
||||
.addRow("test1", "test2", "test3")
|
||||
.addRow("test1", "test2", "test3")
|
||||
.addRow("test1", "test2", "test3")
|
||||
.addRow("test1", "test2", "test3");
|
||||
|
||||
|
||||
/*
|
||||
this.getRoot().addWidget("Test", new Row(null)).setGeometry(new WidgetGeometry(50.0, 50.0, 90.0, 20.0, CType.RELXY, CType.REL_X, WAlign.CENTER, WAlign.CENTER));
|
||||
((Row)this.getRoot().getWidget("Test")).setColumnsText("aabbbbbbbbbbbbbbbbbbbbbbbbb","bb","cc");
|
||||
((Row)this.getRoot().getWidget("Test")).setColumnsWidth(30.0,30.0,30.0);
|
||||
((Row)this.getRoot().getWidget("Test")).setColumnsAlign(WAlign.LEFT, WAlign.CENTER, WAlign.CENTER);
|
||||
*/
|
||||
|
||||
|
||||
//this.getRoot().addWidget("TestLayout", new LayoutBase(null)).setGeometry(new WidgetGeometry(50.0, 50.0, 90.0, 90.0, CType.RELXY, CType.RELXY, WAlign.CENTER, WAlign.CENTER));
|
||||
//((LayoutBase)this.getRoot().getWidget("TestLayout")).setBackgroundColors(0xff505050, 0xff505050);
|
||||
|
||||
//this.getRoot().addWidget("Layout", new ViewportScrollable(null)).setGeometry(new WidgetGeometry(50.0,50.0,75.0,75.0,CType.RELXY, CType.RELXY, WAlign.CENTER, WAlign.CENTER));
|
||||
//((ViewportScrollable)this.getRoot().getWidget("Layout")).attachWidget(new PictureSwitch(this.getRoot(), "waila:textures/test.png", "waila:textures/test_solar.png")).setSize(900, 900);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package mcp.mobius.waila.gui.testing;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import mcp.mobius.waila.gui.interfaces.CType;
|
||||
import mcp.mobius.waila.gui.interfaces.WAlign;
|
||||
import mcp.mobius.waila.gui.screens.ScreenBase;
|
||||
import mcp.mobius.waila.gui.widgets.LabelFixedFont;
|
||||
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
|
||||
import mcp.mobius.waila.gui.widgets.buttons.ButtonContainerLabel;
|
||||
import mcp.mobius.waila.gui.widgets.buttons.ButtonIntegerConfig;
|
||||
|
||||
public class ScreenTest2 extends ScreenBase {
|
||||
|
||||
public ScreenTest2(GuiScreen parent) {
|
||||
super(parent);
|
||||
//this.getRoot().addWidget("Picture", new PictureSwitch(this.getRoot(), "waila:textures/test.png", "waila:textures/test_solar.png"));
|
||||
//this.getRoot().addWidget("Button", new ButtonInteger(this.getRoot(), "Val0", "Val1", "Val2"));
|
||||
//this.getRoot().getWidget("Button").setGeometry(new WidgetGeometry(50.0D, 50.0D, 100.0D, 20.0D, true, false, WidgetAlign.CENTER, WidgetAlign.CENTER));
|
||||
|
||||
this.getRoot().addWidget("Buttons", new ButtonContainerLabel(this.getRoot(), 2, 100, 30.0));
|
||||
this.getRoot().getWidget("Buttons").setGeometry(new WidgetGeometry(0.0, 0.0, 100.0, 50.0, CType.RELXY, CType.RELXY));
|
||||
|
||||
//((ButtonContainer)this.getRoot().getWidget("Buttons")).addButton(new ButtonIntegerConfig(this.getRoot(), "testconfig", true, 0, "Val0", "Val1", "Val2"));
|
||||
|
||||
this.getRoot().addWidget("Text", new LabelFixedFont(this.getRoot(), "waila:textures/test.png"));
|
||||
this.getRoot().getWidget("Text").setGeometry(new WidgetGeometry(50.0D, 10.0D, 50.0D, 50.0D, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.TOP));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
package mcp.mobius.waila.gui.widgets;
|
||||
|
||||
import mcp.mobius.waila.gui.interfaces.IWidget;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.util.Point;
|
||||
|
||||
import codechicken.nei.forge.GuiContainerManager;
|
||||
|
||||
public class ItemStackDisplay extends WidgetBase {
|
||||
|
||||
ItemStack stack = null;
|
||||
|
||||
public ItemStackDisplay(IWidget parent){
|
||||
this(parent, null);
|
||||
}
|
||||
|
||||
public ItemStackDisplay(IWidget parent, ItemStack stack){
|
||||
super(parent);
|
||||
this.stack = stack;
|
||||
this.setSize(16, 16);
|
||||
}
|
||||
|
||||
public void setStack(ItemStack stack){
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
public ItemStack getStack(){
|
||||
return this.stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Point pos) {
|
||||
if (this.stack == null) return;
|
||||
|
||||
float scaleX = this.getSize().getX()/16.0f;
|
||||
float scaleY = this.getSize().getY()/16.0f;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScalef(scaleX, scaleY, 1.0f);
|
||||
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GuiContainerManager.drawItem((int)(pos.getX()/scaleX), (int)(pos.getY()/scaleX), this.stack);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package mcp.mobius.waila.gui.widgets;
|
||||
|
||||
import mcp.mobius.waila.gui.interfaces.CType;
|
||||
import mcp.mobius.waila.gui.interfaces.IWidget;
|
||||
import mcp.mobius.waila.gui.interfaces.Signal;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.util.Point;
|
||||
|
||||
public class LabelFixedFont extends WidgetBase {
|
||||
|
||||
protected String text = "";
|
||||
protected int color;
|
||||
|
||||
public LabelFixedFont(IWidget parent, String text){
|
||||
super(parent);
|
||||
this.setText(text);
|
||||
this.color = 0xFFFFFF;
|
||||
}
|
||||
|
||||
public LabelFixedFont(IWidget parent, String text, int color){
|
||||
super(parent);
|
||||
this.setText(text);
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWidget setGeometry(WidgetGeometry geom){
|
||||
this.geom = geom;
|
||||
this.updateGeometry();
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setText(String text){
|
||||
this.text = text;
|
||||
this.updateGeometry();
|
||||
}
|
||||
|
||||
public void setColor(int color){
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
private void updateGeometry(){
|
||||
if (this.geom == null)
|
||||
this.geom = new WidgetGeometry(0,0,50,50, CType.ABSXY, CType.ABSXY);
|
||||
|
||||
this.geom = new WidgetGeometry(this.geom.x, this.geom.y, this.mc.fontRenderer.getStringWidth(this.text), 8, this.geom.posType, CType.ABSXY, this.geom.alignX, this.geom.alignY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Point pos) {
|
||||
this.saveGLState();
|
||||
this.mc.fontRenderer.drawString(this.text, pos.getX(), pos.getY(), this.color);
|
||||
this.loadGLState();
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package mcp.mobius.waila.gui.widgets;
|
||||
|
||||
import mcp.mobius.waila.gui.events.MouseEvent;
|
||||
import mcp.mobius.waila.gui.helpers.UIHelper;
|
||||
import mcp.mobius.waila.gui.interfaces.IWidget;
|
||||
|
||||
import org.lwjgl.util.Point;
|
||||
|
||||
public class LayoutBase extends WidgetBase {
|
||||
|
||||
protected int bgcolor1 = 0x00000000;
|
||||
protected int bgcolor2 = 0x00000000;
|
||||
protected boolean renderBG;
|
||||
|
||||
public LayoutBase(IWidget parent){
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Point pos) {
|
||||
if (this.renderBG)
|
||||
UIHelper.drawGradientRect(this.getLeft(), this.getTop(), this.getRight(), this.getBottom(), 0, this.bgcolor1, this.bgcolor2);
|
||||
}
|
||||
|
||||
public void setBackgroundColors(int bg1, int bg2){
|
||||
this.bgcolor1 = bg1;
|
||||
this.bgcolor2 = bg2;
|
||||
this.renderBG = true;
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public void onMouseEnter(MouseEvent event) {
|
||||
IWidget widget = this.getWidgetAtCoordinates(event.x, event.y);
|
||||
if (widget != null && widget != this)
|
||||
widget.onMouseEnter(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseLeave(MouseEvent event) {
|
||||
IWidget widget = this.getWidgetAtCoordinates(event.x, event.y);
|
||||
if (widget != null && widget != this)
|
||||
widget.onMouseLeave(event);
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
@@ -1,122 +0,0 @@
|
||||
package mcp.mobius.waila.gui.widgets;
|
||||
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.util.Point;
|
||||
|
||||
import mcp.mobius.waila.gui.events.MouseEvent;
|
||||
import mcp.mobius.waila.gui.events.MouseEvent.EventType;
|
||||
import mcp.mobius.waila.gui.interfaces.CType;
|
||||
import mcp.mobius.waila.gui.interfaces.IWidget;
|
||||
import mcp.mobius.waila.gui.interfaces.Signal;
|
||||
|
||||
public class LayoutCanvas extends LayoutBase{
|
||||
|
||||
private MouseEvent lastMouseEvent;
|
||||
private IWidget draggedWidget = null;
|
||||
|
||||
public LayoutCanvas(){
|
||||
super(null);
|
||||
this.setGeometry(0, 0, this.rez.getScaledWidth(), this.rez.getScaledHeight(), CType.ABSXY, CType.ABSXY);
|
||||
Mouse.getDWheel(); // This is to "calibrate" the DWheel
|
||||
this.lastMouseEvent = new MouseEvent(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
this.rez = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
|
||||
this.setGeometry(0, 0, this.rez.getScaledWidth(), this.rez.getScaledHeight(), CType.ABSXY, CType.ABSXY);
|
||||
|
||||
/*
|
||||
this.draw(this.getPos());
|
||||
|
||||
for (IWidget widget: this.widgets.values())
|
||||
if (widget.shouldRender())
|
||||
widget.draw();
|
||||
*/
|
||||
|
||||
super.draw();
|
||||
|
||||
this.handleMouseInput();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Point pos) { super.draw(pos); }
|
||||
|
||||
@Override
|
||||
public void handleMouseInput(){
|
||||
// Here we are going to generate the require mouse events we will pass down to all the other widgets
|
||||
// This is more or less where the magic happens. If you want mouse support for a widget, it should be
|
||||
// attached to a canvas like this one, or any inheriting one.
|
||||
|
||||
MouseEvent event = new MouseEvent(this);
|
||||
EventType type = event.getEventType(this.lastMouseEvent);
|
||||
IWidget targetWidget = this.getWidgetAtCoordinates(event.x, event.y);
|
||||
|
||||
switch (type){
|
||||
case CLICK:
|
||||
if (targetWidget != null)
|
||||
targetWidget.onMouseClick(event);
|
||||
//this.onMouseClick(event);
|
||||
break;
|
||||
case DRAG:
|
||||
if (targetWidget != null)
|
||||
targetWidget.onMouseDrag(event);
|
||||
//this.onMouseDrag(event);
|
||||
break;
|
||||
case MOVE:
|
||||
if (targetWidget != null)
|
||||
targetWidget.onMouseMove(event);
|
||||
//this.onMouseMove(event);
|
||||
break;
|
||||
case RELEASED:
|
||||
if (targetWidget != null)
|
||||
targetWidget.onMouseRelease(event);
|
||||
//this.onMouseRelease(event);
|
||||
break;
|
||||
case WHEEL:
|
||||
if (targetWidget != null)
|
||||
targetWidget.onMouseWheel(event);
|
||||
//this.onMouseWheel(event);
|
||||
break;
|
||||
case ENTER:
|
||||
if (event.trgwidget != null)
|
||||
event.trgwidget.onMouseEnter(event);
|
||||
if (this.lastMouseEvent.trgwidget != null){
|
||||
event.type = EventType.LEAVE;
|
||||
this.lastMouseEvent.trgwidget.onMouseLeave(event);
|
||||
}
|
||||
break;
|
||||
case NONE:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
this.lastMouseEvent = event;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWidgetEvent(IWidget srcwidget, Signal signal, Object... params){
|
||||
if (signal == Signal.DRAGGED)
|
||||
this.draggedWidget = srcwidget;
|
||||
else
|
||||
super.onWidgetEvent(srcwidget, signal, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseRelease(MouseEvent event){
|
||||
if(event.button == 0)
|
||||
this.draggedWidget = null;
|
||||
super.onMouseRelease(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseDrag(MouseEvent event){
|
||||
if (this.draggedWidget != null)
|
||||
this.draggedWidget.onMouseDrag(event);
|
||||
else
|
||||
super.onMouseDrag(event);
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
package mcp.mobius.waila.gui.widgets;
|
||||
|
||||
import mcp.mobius.waila.gui.interfaces.IWidget;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.util.Point;
|
||||
|
||||
public class LayoutCropping extends LayoutBase {
|
||||
|
||||
int xOffset = 0;
|
||||
int yOffset = 0;
|
||||
|
||||
public LayoutCropping(IWidget parent){
|
||||
super(parent);
|
||||
}
|
||||
|
||||
public void setOffsets(int xoffset, int yoffset){
|
||||
this.xOffset = xoffset;
|
||||
this.yOffset = yoffset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
this.rez = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
|
||||
this.saveGLState();
|
||||
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA,GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, this.alpha);
|
||||
|
||||
this.draw(this.getPos());
|
||||
|
||||
GL11.glEnable(GL11.GL_SCISSOR_TEST);
|
||||
GL11.glScissor(this.getPos().getX()*this.rez.getScaleFactor(), (this.rez.getScaledHeight() - (this.getPos().getY() + this.getSize().getY())) * this.rez.getScaleFactor(), this.getSize().getX()*this.rez.getScaleFactor(), this.getSize().getY()*this.rez.getScaleFactor());
|
||||
//GL11.glScissor(this.getPos().getX()*this.rez.getScaleFactor(), this.getPos().getY()*this.rez.getScaleFactor(), this.getSize().getX()*this.rez.getScaleFactor(), this.getSize().getY()*this.rez.getScaleFactor());
|
||||
|
||||
GL11.glTranslatef(xOffset, yOffset, 0.0f);
|
||||
|
||||
/*
|
||||
for (IWidget widget: this.widgets.values())
|
||||
if (widget.shouldRender())
|
||||
widget.draw();
|
||||
*/
|
||||
|
||||
|
||||
for (IWidget widget: this.renderQueue_LOW.values())
|
||||
if (widget.shouldRender())
|
||||
widget.draw();
|
||||
|
||||
for (IWidget widget: this.renderQueue_MEDIUM.values())
|
||||
if (widget.shouldRender())
|
||||
widget.draw();
|
||||
|
||||
for (IWidget widget: this.renderQueue_HIGH.values())
|
||||
if (widget.shouldRender())
|
||||
widget.draw();
|
||||
|
||||
|
||||
GL11.glDisable(GL11.GL_SCISSOR_TEST);
|
||||
|
||||
this.loadGLState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Point pos) { super.draw(pos); }
|
||||
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package mcp.mobius.waila.gui.widgets;
|
||||
|
||||
import mcp.mobius.waila.gui.interfaces.CType;
|
||||
import mcp.mobius.waila.gui.interfaces.IWidget;
|
||||
import mcp.mobius.waila.gui.interfaces.WAlign;
|
||||
|
||||
import org.lwjgl.util.Point;
|
||||
|
||||
public class LayoutMargin extends LayoutBase {
|
||||
|
||||
int left = 0;
|
||||
int right = 0;
|
||||
int top = 0;
|
||||
int bottom = 0;
|
||||
|
||||
public LayoutMargin(IWidget parent){
|
||||
super (parent);
|
||||
this.setGeometry(new WidgetGeometry(0,0,0,0,CType.ABSXY,CType.ABSXY,WAlign.CENTER,WAlign.CENTER));
|
||||
}
|
||||
|
||||
public void setMargins(int left, int right, int top, int bottom){
|
||||
this.left = left;
|
||||
this.right = right;
|
||||
this.top = top;
|
||||
this.bottom = bottom;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getSize(){
|
||||
Point parentSize = this.parent.getSize();
|
||||
return new Point(parentSize.getX() - left - right, parentSize.getY() - top - bottom);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getPos(){
|
||||
Point parentPos = this.parent.getPos();
|
||||
return new Point(parentPos.getX() + left, parentPos.getY() + top);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Point pos) { super.draw(pos); }
|
||||
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package mcp.mobius.waila.gui.widgets;
|
||||
|
||||
import mcp.mobius.waila.gui.helpers.UIHelper;
|
||||
import mcp.mobius.waila.gui.interfaces.IWidget;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.util.Point;
|
||||
|
||||
public class PictureDisplay extends WidgetBase {
|
||||
|
||||
protected ResourceLocation texture;
|
||||
|
||||
public PictureDisplay(IWidget parent, String uri){
|
||||
super(parent);
|
||||
this.texture = new ResourceLocation(uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Point pos) {
|
||||
this.saveGLState();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
this.texManager.func_110577_a(texture);
|
||||
UIHelper.drawTexture(pos.getX(), pos.getY(), this.getSize().getX(), this.getSize().getY());
|
||||
GL11.glPopMatrix();
|
||||
|
||||
this.loadGLState();
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
package mcp.mobius.waila.gui.widgets;
|
||||
|
||||
import mcp.mobius.waila.gui.events.MouseEvent;
|
||||
import mcp.mobius.waila.gui.helpers.UIHelper;
|
||||
import mcp.mobius.waila.gui.interfaces.IWidget;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.util.Point;
|
||||
|
||||
public class PictureSwitch extends WidgetBase {
|
||||
|
||||
private ResourceLocation texture1;
|
||||
private ResourceLocation texture2;
|
||||
private boolean mouseOver = false;
|
||||
|
||||
public PictureSwitch(IWidget parent, String uri1, String uri2){
|
||||
super(parent);
|
||||
this.texture1 = new ResourceLocation(uri1);
|
||||
this.texture2 = new ResourceLocation(uri2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Point pos) {
|
||||
this.saveGLState();
|
||||
|
||||
ResourceLocation texture = mouseOver ? this.texture2 : this.texture1;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
this.texManager.func_110577_a(texture);
|
||||
UIHelper.drawTexture(pos.getX(), pos.getY(), this.getSize().getX(), this.getSize().getY());
|
||||
GL11.glPopMatrix();
|
||||
|
||||
this.loadGLState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseEnter(MouseEvent event){
|
||||
//System.out.printf("%s %s\n", this, event);
|
||||
mouseOver = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseLeave(MouseEvent event){
|
||||
//System.out.printf("%s %s\n", this, event);
|
||||
mouseOver = false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,201 +0,0 @@
|
||||
package mcp.mobius.waila.gui.widgets;
|
||||
|
||||
import mcp.mobius.waila.gui.helpers.UIException;
|
||||
import mcp.mobius.waila.gui.interfaces.CType;
|
||||
import mcp.mobius.waila.gui.interfaces.IWidget;
|
||||
import mcp.mobius.waila.gui.interfaces.WAlign;
|
||||
|
||||
import org.lwjgl.util.Point;
|
||||
|
||||
public class ViewTable extends WidgetBase{
|
||||
|
||||
public class Cell extends WidgetBase{
|
||||
public Cell(IWidget parent, String text, WAlign align){
|
||||
super(parent);
|
||||
|
||||
//this.addWidget("Crop", new LayoutCropping(null)).setGeometry(new WidgetGeometry(50.0, 50.0, 90.0, 100.0, CType.RELXY, CType.RELXY, WAlign.CENTER, WAlign.CENTER));
|
||||
|
||||
switch(align){
|
||||
case CENTER:
|
||||
//this.getWidget("Crop").addWidget("Text", new LabelFixedFont(null, text))
|
||||
this.addWidget("Text", new LabelFixedFont(null, text))
|
||||
.setGeometry(new WidgetGeometry(50.0, 50.0, 100.0, 100.0, CType.RELXY, CType.RELXY, WAlign.CENTER, WAlign.CENTER));
|
||||
break;
|
||||
case LEFT:
|
||||
//this.getWidget("Crop").addWidget("Text", new LabelFixedFont(null, text))
|
||||
this.addWidget("Text", new LabelFixedFont(null, text))
|
||||
.setGeometry(new WidgetGeometry(5.0, 50.0, 95.0, 100.0, CType.RELXY, CType.RELXY, WAlign.LEFT, WAlign.CENTER));
|
||||
break;
|
||||
case RIGHT:
|
||||
//this.getWidget("Crop").addWidget("Text", new LabelFixedFont(null, text))
|
||||
this.addWidget("Text", new LabelFixedFont(null, text))
|
||||
.setGeometry(new WidgetGeometry(5.0, 50.0, 95.0, 100.0, CType.RELXY, CType.RELXY, WAlign.RIGHT, WAlign.CENTER));
|
||||
break;
|
||||
default:
|
||||
throw new UIException(String.format("Unexpected align value : %s", align));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Point pos){}
|
||||
}
|
||||
|
||||
public class Row extends WidgetBase{
|
||||
int ncolumns = -1;
|
||||
double[] widths;
|
||||
String[] texts;
|
||||
WAlign[] aligns;
|
||||
boolean init = false;
|
||||
int bgcolor1 = 0x50505050;
|
||||
int bgcolor2 = 0x50505050;
|
||||
|
||||
|
||||
public Row(IWidget parent){
|
||||
super(parent);
|
||||
|
||||
this.addWidget("Background", new LayoutBase(null)).setGeometry(new WidgetGeometry(50.0, 50.0, 100.0, 100.0, CType.RELXY, CType.RELXY, WAlign.CENTER, WAlign.CENTER));
|
||||
((LayoutBase)this.getWidget("Background")).setBackgroundColors(this.bgcolor1, this.bgcolor2);
|
||||
|
||||
}
|
||||
|
||||
public Row setColumnsWidth(double... widths){
|
||||
if (this.ncolumns == -1)
|
||||
this.ncolumns = widths.length;
|
||||
else if(this.ncolumns != widths.length){
|
||||
throw new UIException(String.format("Number of columns mismatch. Expecting %d, got %d", this.ncolumns, widths.length));
|
||||
}
|
||||
|
||||
this.widths = widths;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public Row setColumnsText(String...strings ){
|
||||
if (this.ncolumns == -1)
|
||||
this.ncolumns = strings.length;
|
||||
else if(this.ncolumns != strings.length){
|
||||
throw new UIException(String.format("Number of columns mismatch. Expecting %d, got %d", this.ncolumns, strings.length));
|
||||
}
|
||||
|
||||
this.texts = strings;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public Row setColumnsAlign(WAlign... aligns ){
|
||||
if (this.ncolumns == -1)
|
||||
this.ncolumns = aligns.length;
|
||||
else if(this.ncolumns != aligns.length){
|
||||
throw new UIException(String.format("Number of columns mismatch. Expecting %d, got %d", this.ncolumns, aligns.length));
|
||||
}
|
||||
|
||||
this.aligns = aligns;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public Row setColors(int bg1, int bg2){
|
||||
this.bgcolor1 = bg1;
|
||||
this.bgcolor2 = bg2;
|
||||
((LayoutBase)this.getWidget("Background")).setBackgroundColors(this.bgcolor1, this.bgcolor2);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
if (!init)
|
||||
{
|
||||
double currentOffset = 0.0;
|
||||
for (int i = 0; i < this.ncolumns; i++){
|
||||
if (!this.widgets.containsKey(String.format("Cell_%02d", i))){
|
||||
Cell cell = (Cell)(this.addWidget(String.format("Cell_%02d", i), new Cell(null, this.texts[i], this.aligns[i])));
|
||||
cell.setGeometry(new WidgetGeometry(currentOffset, 50.0, this.widths[i], 100.0, CType.RELXY, CType.RELXY, WAlign.LEFT, WAlign.CENTER));
|
||||
currentOffset += this.widths[i];
|
||||
}
|
||||
}
|
||||
init = true;
|
||||
}
|
||||
|
||||
super.draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Point pos){}
|
||||
}
|
||||
|
||||
int ncolumns = -1;
|
||||
int nrows = 0;
|
||||
double[] widths;
|
||||
String[] texts;
|
||||
WAlign[] aligns;
|
||||
boolean init = false;
|
||||
|
||||
public ViewTable(IWidget parent){
|
||||
super(parent);
|
||||
this.addWidget("Titles", new Row(null)).setGeometry(new WidgetGeometry(0.0, 0.0, 100.0, 16.0, CType.REL_X, CType.REL_X, WAlign.LEFT, WAlign.TOP));
|
||||
((Row)this.getWidget("Titles")).setColors(0x00000000, 0x00000000);
|
||||
this.addWidget("Viewport", new ViewportScrollable(null)).setGeometry(new WidgetGeometry(0.0, 16.0, 100.0, 90.0, CType.REL_X, CType.RELXY, WAlign.LEFT, WAlign.TOP));
|
||||
((ViewportScrollable)(this.getWidget("Viewport"))).attachWidget(new LayoutBase(null)).setGeometry(new WidgetGeometry(0.0, 0.0, 100.0, 0.0, CType.RELXY, CType.REL_X, WAlign.LEFT, WAlign.TOP));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Point pos){}
|
||||
|
||||
public ViewTable setColumnsWidth(double... widths){
|
||||
if (this.ncolumns == -1)
|
||||
this.ncolumns = widths.length;
|
||||
else if(this.ncolumns != widths.length){
|
||||
throw new UIException(String.format("Number of columns mismatch. Expecting %d, got %d", this.ncolumns, widths.length));
|
||||
}
|
||||
|
||||
this.widths = widths;
|
||||
((Row)this.getWidget("Titles")).setColumnsWidth(widths);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ViewTable setColumnsTitle(String...strings ){
|
||||
if (this.ncolumns == -1)
|
||||
this.ncolumns = strings.length;
|
||||
else if(this.ncolumns != strings.length){
|
||||
throw new UIException(String.format("Number of columns mismatch. Expecting %d, got %d", this.ncolumns, strings.length));
|
||||
}
|
||||
|
||||
this.texts = strings;
|
||||
((Row)this.getWidget("Titles")).setColumnsText(strings);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public ViewTable setColumnsAlign(WAlign... aligns ){
|
||||
if (this.ncolumns == -1)
|
||||
this.ncolumns = aligns.length;
|
||||
else if(this.ncolumns != aligns.length){
|
||||
throw new UIException(String.format("Number of columns mismatch. Expecting %d, got %d", this.ncolumns, aligns.length));
|
||||
}
|
||||
|
||||
this.aligns = aligns;
|
||||
((Row)this.getWidget("Titles")).setColumnsAlign(aligns);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public ViewTable addRow(String...strings ){
|
||||
IWidget tableLayout = ((ViewportScrollable)(this.getWidget("Viewport"))).getAttachedWidget();
|
||||
tableLayout.setSize(100.0, (this.nrows + 1) * 16);
|
||||
|
||||
Row newRow = (Row)new Row(null);
|
||||
newRow.setColumnsWidth(this.widths);
|
||||
newRow.setColumnsText(strings);
|
||||
newRow.setColumnsAlign(this.aligns);
|
||||
if(this.nrows % 2 == 1)
|
||||
newRow.setColors(0x50808080, 0x50808080);
|
||||
newRow.setGeometry(new WidgetGeometry(0.0, 16*this.nrows, 100.0, 16, CType.REL_X, CType.REL_X, WAlign.LEFT, WAlign.TOP));
|
||||
|
||||
tableLayout.addWidget(String.format("Row_%03d", this.nrows), newRow);
|
||||
|
||||
this.nrows += 1;
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,179 +0,0 @@
|
||||
package mcp.mobius.waila.gui.widgets;
|
||||
|
||||
import mcp.mobius.waila.gui.events.MouseEvent;
|
||||
import mcp.mobius.waila.gui.helpers.UIHelper;
|
||||
import mcp.mobius.waila.gui.interfaces.CType;
|
||||
import mcp.mobius.waila.gui.interfaces.IWidget;
|
||||
import mcp.mobius.waila.gui.interfaces.Signal;
|
||||
import mcp.mobius.waila.gui.interfaces.WAlign;
|
||||
|
||||
import org.lwjgl.opengl.Display;
|
||||
import org.lwjgl.util.Point;
|
||||
|
||||
public class ViewportScrollable extends WidgetBase {
|
||||
|
||||
public class Escalator extends WidgetBase{
|
||||
int yOffset = 0;
|
||||
int sizeCursor = 8;
|
||||
int maxValue = 0;
|
||||
int step = 0;
|
||||
boolean drag = false;
|
||||
|
||||
public Escalator(IWidget parent, int step){
|
||||
this.parent = parent;
|
||||
this.step = step;
|
||||
}
|
||||
|
||||
public void setOffset(int yoffset){
|
||||
this.yOffset = yoffset;
|
||||
}
|
||||
|
||||
public void setMaxValue(int value){
|
||||
this.maxValue = value;
|
||||
}
|
||||
|
||||
public void setStep(int step){
|
||||
this.step = step;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Point pos) {
|
||||
UIHelper.drawGradientRect(this.getLeft(), this.getTop(), this.getRight(), this.getBottom(), 1, 0xff999999, 0xff999999);
|
||||
int offsetScaled = (int)(((double)this.getSize().getY() - (double)sizeCursor + 1) / (double)this.maxValue * (yOffset));
|
||||
UIHelper.drawGradientRect(this.getLeft(), this.getTop() + offsetScaled, this.getRight(), this.getTop() + offsetScaled + sizeCursor, 1, 0xffffffff, 0xffffffff);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseClick(MouseEvent event){
|
||||
if (event.button == 0){
|
||||
int offsetScaled = this.getTop() + (int)(((double)this.getSize().getY() - (double)sizeCursor + 1) / (double)this.maxValue * (yOffset));
|
||||
|
||||
this.drag = false;
|
||||
|
||||
if (event.y < offsetScaled)
|
||||
this.yOffset += this.step;
|
||||
else if (event.y > offsetScaled + sizeCursor)
|
||||
this.yOffset -= this.step;
|
||||
else
|
||||
this.drag = true;
|
||||
|
||||
this.emit(Signal.VALUE_CHANGED, this.yOffset);
|
||||
|
||||
} else {
|
||||
super.onMouseClick(event);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseRelease(MouseEvent event){
|
||||
if (event.button == 0)
|
||||
this.drag = false;
|
||||
super.onMouseRelease(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseDrag(MouseEvent event){
|
||||
if (this.drag){
|
||||
int relativeY = (int)event.y - this.getTop();
|
||||
double factor = ((double)this.getSize().getY() - (double)sizeCursor + 1) / (double)this.maxValue;
|
||||
this.yOffset = (int)(relativeY / factor);
|
||||
this.yOffset = Math.max(this.yOffset, this.maxValue);
|
||||
this.yOffset = Math.min(this.yOffset, 0);
|
||||
this.emit(Signal.VALUE_CHANGED, this.yOffset);
|
||||
this.emit(Signal.DRAGGED, this);
|
||||
}
|
||||
else
|
||||
super.onMouseDrag(event);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
IWidget attachedWidget = null;
|
||||
int yOffset = 0;
|
||||
int step = 5;
|
||||
|
||||
public ViewportScrollable( IWidget parent){
|
||||
super(parent);
|
||||
this.addWidget("Cropping", new LayoutCropping(null)).setGeometry(new WidgetGeometry(0.0, 0.0, 100.0, 100.0, CType.RELXY, CType.RELXY, WAlign.LEFT, WAlign.TOP));
|
||||
this.addWidget("Escalator", new Escalator(null, this.step * 5)).setGeometry(new WidgetGeometry(100.0, 0, 8, 100.0, CType.RELXY, CType.REL_Y, WAlign.RIGHT, WAlign.TOP)).hide();
|
||||
}
|
||||
|
||||
public IWidget attachWidget(IWidget widget){
|
||||
this.attachedWidget = this.getWidget("Cropping").addWidget("Cropped", widget);
|
||||
return this.attachedWidget;
|
||||
}
|
||||
|
||||
public IWidget getAttachedWidget(){
|
||||
return this.attachedWidget;
|
||||
}
|
||||
|
||||
public IWidget setStep(int step){
|
||||
this.step = step;
|
||||
((Escalator)this.getWidget("Escalator")).setStep(this.step * 5);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Point pos) {}
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
//if (Display.wasResized())
|
||||
|
||||
if ((this.attachedWidget != null) && (this.attachedWidget.getSize().getY() > this.getSize().getY()))
|
||||
this.getWidget("Escalator").show();
|
||||
else
|
||||
this.getWidget("Escalator").hide();
|
||||
|
||||
super.draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseWheel(MouseEvent event){
|
||||
this.yOffset += event.z / 120.0 * this.step;
|
||||
|
||||
this.yOffset = Math.max(this.yOffset, this.getSize().getY() - this.attachedWidget.getSize().getY());
|
||||
this.yOffset = Math.min(this.yOffset, 0);
|
||||
|
||||
((LayoutCropping)this.getWidget("Cropping")).setOffsets(0, this.yOffset);
|
||||
((Escalator)this.getWidget("Escalator")).setOffset(this.yOffset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWidgetEvent(IWidget srcwidget, Signal signal, Object... params){
|
||||
if (srcwidget.equals(this.attachedWidget) && signal == Signal.GEOM_CHANGED){
|
||||
((Escalator)this.getWidget("Escalator")).setMaxValue(this.getSize().getY() - srcwidget.getSize().getY());
|
||||
}
|
||||
|
||||
else if (srcwidget.equals(this.getWidget("Escalator")) && signal == Signal.VALUE_CHANGED){
|
||||
this.yOffset = (Integer)params[0];
|
||||
((LayoutCropping)this.getWidget("Cropping")).setOffsets(0, this.yOffset);
|
||||
}
|
||||
else
|
||||
super.onWidgetEvent(srcwidget, signal, params);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseDrag(MouseEvent event){
|
||||
if (this.getWidget("Escalator").shouldRender() && ((Escalator)this.getWidget("Escalator")).drag)
|
||||
this.getWidget("Escalator").onMouseDrag(event);
|
||||
else
|
||||
super.onMouseDrag(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseClick(MouseEvent event){
|
||||
if (event.button == 0){
|
||||
if (!this.getWidget("Escalator").isWidgetAtCoordinates(event.x, event.y)){
|
||||
((Escalator)this.getWidget("Escalator")).drag = false;
|
||||
super.onMouseClick(event);
|
||||
}
|
||||
else
|
||||
this.getWidget("Escalator").onMouseClick(event);
|
||||
}
|
||||
else
|
||||
super.onMouseClick(event);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,362 +0,0 @@
|
||||
package mcp.mobius.waila.gui.widgets;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.util.Point;
|
||||
|
||||
import com.google.common.collect.HashBasedTable;
|
||||
import com.google.common.collect.Table;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import mcp.mobius.waila.gui.events.MouseEvent;
|
||||
import mcp.mobius.waila.gui.helpers.ReverseIterator;
|
||||
import mcp.mobius.waila.gui.interfaces.CType;
|
||||
import mcp.mobius.waila.gui.interfaces.IWidget;
|
||||
import mcp.mobius.waila.gui.interfaces.RenderPriority;
|
||||
import mcp.mobius.waila.gui.interfaces.Signal;
|
||||
|
||||
public abstract class WidgetBase implements IWidget {
|
||||
|
||||
protected IWidget parent;
|
||||
protected WidgetGeometry geom;
|
||||
protected LinkedHashMap<String, IWidget> widgets = new LinkedHashMap<String, IWidget>();
|
||||
protected LinkedHashMap<String, IWidget> renderQueue_HIGH = new LinkedHashMap<String, IWidget>();
|
||||
protected LinkedHashMap<String, IWidget> renderQueue_MEDIUM = new LinkedHashMap<String, IWidget>();
|
||||
protected LinkedHashMap<String, IWidget> renderQueue_LOW = new LinkedHashMap<String, IWidget>();
|
||||
protected Minecraft mc;
|
||||
protected TextureManager texManager;
|
||||
protected ScaledResolution rez;
|
||||
|
||||
protected boolean hasBlending;
|
||||
protected boolean hasLight;
|
||||
protected int boundTexIndex;
|
||||
|
||||
protected boolean isRendering = true;
|
||||
|
||||
protected float alpha = 1.0f;
|
||||
|
||||
public WidgetBase(){
|
||||
this.setParent(null);
|
||||
this.mc = Minecraft.getMinecraft();
|
||||
this.rez = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
|
||||
this.texManager = this.mc.renderEngine;
|
||||
this.setGeometry(new WidgetGeometry(0, 0, 50, 50, CType.ABSXY, CType.ABSXY));
|
||||
}
|
||||
|
||||
public WidgetBase(IWidget parent){
|
||||
this.setParent(parent);
|
||||
this.mc = Minecraft.getMinecraft();
|
||||
this.rez = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
|
||||
this.texManager = this.mc.renderEngine;
|
||||
this.setGeometry(new WidgetGeometry(0, 0, 50, 50, CType.ABSXY, CType.ABSXY));
|
||||
}
|
||||
|
||||
/////////////////////
|
||||
// WIDGET HANDLING //
|
||||
/////////////////////
|
||||
|
||||
@Override
|
||||
public IWidget addWidget(String name, IWidget widget){
|
||||
return this.addWidget(name, widget, RenderPriority.MEDIUM);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWidget addWidget(String name, IWidget widget, RenderPriority priority){
|
||||
widget.setParent(this);
|
||||
this.widgets.put(name, widget);
|
||||
|
||||
switch(priority){
|
||||
case LOW:
|
||||
this.renderQueue_LOW.put(name, widget);
|
||||
break;
|
||||
case HIGH:
|
||||
this.renderQueue_HIGH.put(name, widget);
|
||||
break;
|
||||
case MEDIUM:
|
||||
this.renderQueue_MEDIUM.put(name, widget);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return this.getWidget(name);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IWidget getWidget(String name){
|
||||
return this.widgets.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWidget delWidget(String name){
|
||||
IWidget widget = this.getWidget(name);
|
||||
this.widgets.remove(widget);
|
||||
return widget;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWidget getWidgetAtCoordinates(double posX, double posY){
|
||||
for (IWidget widget : new ReverseIterator<IWidget>(this.widgets.values()))
|
||||
if ((posX >= widget.getPos().getX()) &&
|
||||
(posX <= widget.getPos().getX() + widget.getSize().getX()) &&
|
||||
(posY >= widget.getPos().getY()) &&
|
||||
(posY <= widget.getPos().getY() + widget.getSize().getY()))
|
||||
return widget.getWidgetAtCoordinates(posX, posY);
|
||||
|
||||
if ((posX >= this.getPos().getX()) &&
|
||||
(posX <= this.getPos().getX() + this.getSize().getX()) &&
|
||||
(posY >= this.getPos().getY()) &&
|
||||
(posY <= this.getPos().getY() + this.getSize().getY()))
|
||||
return this;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWidgetAtCoordinates(double posx, double posy){
|
||||
if (this.getLeft() > posx) return false;
|
||||
if (this.getRight() < posx) return false;
|
||||
if (this.getTop() > posy) return false;
|
||||
if (this.getBottom() < posy) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
///////////////////////
|
||||
// IWIDGET INTERFACE //
|
||||
///////////////////////
|
||||
|
||||
@Override
|
||||
public IWidget getParent() { return this.parent; }
|
||||
@Override
|
||||
public void setParent(IWidget parent) { this.parent = parent; }
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
this.saveGLState();
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA,GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, this.alpha);
|
||||
|
||||
this.draw(this.getPos());
|
||||
|
||||
/*
|
||||
for (IWidget widget: this.widgets.values())
|
||||
if (widget.shouldRender())
|
||||
widget.draw();
|
||||
*/
|
||||
|
||||
for (IWidget widget: this.renderQueue_LOW.values())
|
||||
if (widget.shouldRender())
|
||||
widget.draw();
|
||||
|
||||
for (IWidget widget: this.renderQueue_MEDIUM.values())
|
||||
if (widget.shouldRender())
|
||||
widget.draw();
|
||||
|
||||
for (IWidget widget: this.renderQueue_HIGH.values())
|
||||
if (widget.shouldRender())
|
||||
widget.draw();
|
||||
|
||||
this.loadGLState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract void draw(Point pos);
|
||||
|
||||
@Override
|
||||
public IWidget setGeometry(WidgetGeometry geom) {
|
||||
this.geom = geom;
|
||||
this.emit(Signal.GEOM_CHANGED, this.geom);
|
||||
return this;
|
||||
}
|
||||
|
||||
public IWidget setGeometry(double x, double y, double sx, double sy, CType fp, CType fs){
|
||||
this.setGeometry(new WidgetGeometry (x, y, sx, sy, fp, fs));
|
||||
this.emit(Signal.GEOM_CHANGED, this.geom);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WidgetGeometry getGeometry() { return this.geom; }
|
||||
@Override
|
||||
public Point getPos() { return this.geom.getPos(this.parent); }
|
||||
@Override
|
||||
public Point getSize() { return this.geom.getSize(this.parent); }
|
||||
@Override
|
||||
public int getLeft() { return this.getPos().getX(); }
|
||||
@Override
|
||||
public int getRight() { return this.getPos().getX() + this.getSize().getX(); }
|
||||
@Override
|
||||
public int getTop() { return this.getPos().getY(); }
|
||||
@Override
|
||||
public int getBottom() { return this.getPos().getY() + this.getSize().getY(); }
|
||||
|
||||
@Override
|
||||
public IWidget setPos(double x, double y){
|
||||
return this.setPos(x, y, this.geom.fracPosX, this.geom.fracPosY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWidget setPos(double x, double y, boolean fracX, boolean fracY){
|
||||
this.geom.setPos(x, y, fracX, fracY);
|
||||
this.emit(Signal.GEOM_CHANGED, this.geom);
|
||||
return this;
|
||||
};
|
||||
|
||||
@Override
|
||||
public IWidget setSize(double sx, double sy){
|
||||
return this.setSize(sx, sy, this.geom.fracSizeX, this.geom.fracSizeY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWidget setSize(double sx, double sy, boolean fracX, boolean fracY){
|
||||
this.geom.setSize(sx, sy, fracX, fracY);
|
||||
this.emit(Signal.GEOM_CHANGED, this.geom);
|
||||
return this;
|
||||
};
|
||||
|
||||
@Override
|
||||
public IWidget adjustSize(){
|
||||
int minleft = 9999;
|
||||
int maxright = 0;
|
||||
int mintop = 9999;
|
||||
int maxbottom = 0;
|
||||
|
||||
for (IWidget widget : this.widgets.values()){
|
||||
minleft = Math.min(minleft, widget.getLeft());
|
||||
maxright = Math.max(maxright, widget.getRight());
|
||||
|
||||
mintop = Math.min(mintop, widget.getTop());
|
||||
maxbottom = Math.max(maxbottom, widget.getBottom());
|
||||
}
|
||||
|
||||
this.setSize(maxright - minleft, maxbottom - mintop, false, false);
|
||||
|
||||
this.emit(Signal.GEOM_CHANGED, this.geom);
|
||||
return this;
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
// SOME RENDERING HELPERS //
|
||||
////////////////////////////
|
||||
|
||||
protected void saveGLState(){
|
||||
hasBlending = GL11.glGetBoolean(GL11.GL_BLEND);
|
||||
hasLight = GL11.glGetBoolean(GL11.GL_LIGHTING);
|
||||
boundTexIndex = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);
|
||||
GL11.glPushAttrib(GL11.GL_CURRENT_BIT);
|
||||
GL11.glPushMatrix();
|
||||
}
|
||||
|
||||
protected void loadGLState(){
|
||||
if (hasBlending) GL11.glEnable(GL11.GL_BLEND); else GL11.glDisable(GL11.GL_BLEND);
|
||||
if (hasLight) GL11.glEnable(GL11.GL_LIGHTING); else GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glBindTexture(GL11.GL_TEXTURE_2D, boundTexIndex);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopAttrib();
|
||||
//GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAlpha(float alpha){this.alpha = alpha;};
|
||||
|
||||
@Override
|
||||
public float getAlpha(){return this.alpha;};
|
||||
|
||||
@Override
|
||||
public void show(){this.isRendering = true;};
|
||||
@Override
|
||||
public void hide(){this.isRendering = false;};
|
||||
@Override
|
||||
public boolean shouldRender(){return this.isRendering;};
|
||||
|
||||
////////////////////
|
||||
// INPUT HANDLING //
|
||||
////////////////////
|
||||
|
||||
@Override
|
||||
public void handleMouseInput(){}
|
||||
|
||||
@Override
|
||||
public void onMouseClick(MouseEvent event) {
|
||||
//System.out.printf("%s %s\n", this, event);
|
||||
if (this.parent != null)
|
||||
this.parent.onMouseClick(event);
|
||||
|
||||
//IWidget widget = this.getWidgetAtCoordinates(event.x, event.y);
|
||||
//if (widget != null && widget != this)
|
||||
// widget.onMouseClick(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseDrag(MouseEvent event) {
|
||||
//System.out.printf("%s %s\n", this, event);
|
||||
if (this.parent != null)
|
||||
this.parent.onMouseDrag(event);
|
||||
|
||||
//IWidget widget = this.getWidgetAtCoordinates(event.x, event.y);
|
||||
//if (widget != null && widget != this)
|
||||
// widget.onMouseDrag(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseMove(MouseEvent event) {
|
||||
//System.out.printf("%s %s\n", this, event);
|
||||
if (this.parent != null)
|
||||
this.parent.onMouseMove(event);
|
||||
|
||||
|
||||
//IWidget widget = this.getWidgetAtCoordinates(event.x, event.y);
|
||||
//if (widget != null && widget != this)
|
||||
// widget.onMouseMove(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseRelease(MouseEvent event) {
|
||||
//System.out.printf("%s %s\n", this, event);
|
||||
if (this.parent != null)
|
||||
this.parent.onMouseRelease(event);
|
||||
|
||||
//IWidget widget = this.getWidgetAtCoordinates(event.x, event.y);
|
||||
//if (widget != null && widget != this)
|
||||
// widget.onMouseRelease(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseWheel(MouseEvent event) {
|
||||
//System.out.printf("%s %s\n", this, event);
|
||||
if (this.parent != null)
|
||||
this.parent.onMouseWheel(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseEnter(MouseEvent event) {
|
||||
//System.out.printf("%s %s\n", this, event);
|
||||
if (this.parent != null)
|
||||
this.parent.onMouseEnter(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseLeave(MouseEvent event) {
|
||||
//System.out.printf("%s %s\n", this, event);
|
||||
if (this.parent != null)
|
||||
this.parent.onMouseLeave(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void emit(Signal signal, Object... params) {
|
||||
if(this.parent != null)
|
||||
this.parent.onWidgetEvent(this, signal, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWidgetEvent(IWidget srcwidget, Signal signal, Object... params) {
|
||||
if (this.parent != null)
|
||||
this.parent.onWidgetEvent(srcwidget, signal, params);
|
||||
}
|
||||
}
|
||||
@@ -1,186 +0,0 @@
|
||||
package mcp.mobius.waila.gui.widgets;
|
||||
|
||||
import mcp.mobius.waila.gui.interfaces.CType;
|
||||
import mcp.mobius.waila.gui.interfaces.IWidget;
|
||||
import mcp.mobius.waila.gui.interfaces.WAlign;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
import org.lwjgl.util.Point;
|
||||
|
||||
|
||||
|
||||
//public class WidgetGeometry implements Cloneable{
|
||||
public class WidgetGeometry{
|
||||
|
||||
//public enum Align {LEFT, CENTER, RIGHT, TOP, BOTTOM};
|
||||
|
||||
|
||||
double x = -1;
|
||||
double y = -1;
|
||||
double sx = -1;
|
||||
double sy = -1;
|
||||
|
||||
CType posType;
|
||||
CType sizeType;
|
||||
|
||||
boolean fracPosX = false;
|
||||
boolean fracPosY = false;
|
||||
boolean fracSizeX = false;
|
||||
boolean fracSizeY = false;
|
||||
|
||||
WAlign alignX;
|
||||
WAlign alignY;
|
||||
|
||||
public class PointDouble{
|
||||
double x; double y;
|
||||
public PointDouble(double x, double y){ this.x = x; this.y = y;};
|
||||
public double getX(){return this.x;}
|
||||
public double getY(){return this.y;}
|
||||
public String toString(){return String.format("PointDouble : %.5f %.5f", this.x, this.y);}
|
||||
}
|
||||
|
||||
public WidgetGeometry(double x, double y, double sx, double sy, CType fracPos, CType fracSize){
|
||||
this(x, y, sx, sy, fracPos, fracSize, WAlign.LEFT, WAlign.TOP);
|
||||
}
|
||||
|
||||
public WidgetGeometry(double x, double y, double sx, double sy, CType fracPos, CType fracSize, WAlign alignX, WAlign alignY){
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.sx = sx;
|
||||
this.sy = sy;
|
||||
this.posType = fracPos;
|
||||
this.sizeType = fracSize;
|
||||
|
||||
switch(fracPos){
|
||||
case REL_X:
|
||||
this.fracPosX = true;
|
||||
break;
|
||||
case RELXY:
|
||||
this.fracPosX = true;
|
||||
this.fracPosY = true;
|
||||
break;
|
||||
case REL_Y:
|
||||
this.fracPosY = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
switch(fracSize){
|
||||
case REL_X:
|
||||
this.fracSizeX = true;
|
||||
break;
|
||||
case RELXY:
|
||||
this.fracSizeX = true;
|
||||
this.fracSizeY = true;
|
||||
break;
|
||||
case REL_Y:
|
||||
this.fracSizeY = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
this.alignX = alignX;
|
||||
this.alignY = alignY;
|
||||
}
|
||||
|
||||
public void setPos(double x, double y, boolean fracX, boolean fracY){
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.fracPosX = fracX;
|
||||
this.fracPosY = fracY;
|
||||
}
|
||||
|
||||
public void setSize(double sx, double sy, boolean fracSizeX, boolean fracSizeY){
|
||||
this.sx = sx;
|
||||
this.sy = sy;
|
||||
this.fracSizeX = fracSizeX;
|
||||
this.fracSizeY = fracSizeY;
|
||||
}
|
||||
|
||||
public PointDouble getRawPos(){
|
||||
return new PointDouble(this.x, this.y);
|
||||
}
|
||||
|
||||
public Point getUnalignedPos(IWidget parent){
|
||||
int x = -1;
|
||||
if (this.fracPosX)
|
||||
x = MathHelper.ceiling_double_int(parent.getPos().getX() + parent.getSize().getX() * this.x / 100D);
|
||||
if (!this.fracPosX && parent != null)
|
||||
x = parent.getPos().getX() + (int)this.x;
|
||||
if (!this.fracPosX && parent == null)
|
||||
x = (int)this.x;
|
||||
|
||||
int y = -1;
|
||||
if (this.fracPosY)
|
||||
y = MathHelper.ceiling_double_int(parent.getPos().getY() + parent.getSize().getY() * this.y / 100D);
|
||||
if (!this.fracPosY && parent != null)
|
||||
y = parent.getPos().getY() + (int)this.y;
|
||||
if (!this.fracPosY && parent == null)
|
||||
y = (int)this.y;
|
||||
|
||||
return new Point(x,y);
|
||||
}
|
||||
|
||||
public Point getPos(IWidget parent){
|
||||
|
||||
int x = -1;
|
||||
if (this.fracPosX)
|
||||
x = MathHelper.ceiling_double_int(parent.getPos().getX() + parent.getSize().getX() * this.x / 100D);
|
||||
if (!this.fracPosX && parent != null)
|
||||
x = parent.getPos().getX() + (int)this.x;
|
||||
if (!this.fracPosX && parent == null)
|
||||
x = (int)this.x;
|
||||
|
||||
int y = -1;
|
||||
if (this.fracPosY)
|
||||
y = MathHelper.ceiling_double_int(parent.getPos().getY() + parent.getSize().getY() * this.y / 100D);
|
||||
if (!this.fracPosY && parent != null)
|
||||
y = parent.getPos().getY() + (int)this.y;
|
||||
if (!this.fracPosY && parent == null)
|
||||
y = (int)this.y;
|
||||
|
||||
|
||||
if (this.alignX == WAlign.CENTER)
|
||||
x -= this.getSize(parent).getX() / 2;
|
||||
|
||||
if (this.alignY == WAlign.CENTER)
|
||||
y -= this.getSize(parent).getY() / 2;
|
||||
|
||||
if (this.alignX == WAlign.RIGHT)
|
||||
x -= this.getSize(parent).getX() - 1;
|
||||
|
||||
if (this.alignY == WAlign.BOTTOM)
|
||||
y -= this.getSize(parent).getY() - 1;
|
||||
|
||||
return new Point(x,y);
|
||||
}
|
||||
|
||||
public Point getSize(IWidget parent){
|
||||
int sx = -1;
|
||||
if (this.fracSizeX)
|
||||
sx = MathHelper.ceiling_double_int(parent.getSize().getX() * this.sx / 100D);
|
||||
if (!this.fracSizeX)
|
||||
sx = (int)this.sx;
|
||||
|
||||
int sy = -1;
|
||||
if (this.fracSizeY)
|
||||
sy = MathHelper.ceiling_double_int(parent.getSize().getY() * this.sy / 100D);
|
||||
if (!this.fracSizeY)
|
||||
sy = (int)this.sy;
|
||||
|
||||
return new Point(sx,sy);
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
return String.format("Geometry : [%s %s] [%s %s] [%s %s] [%s %s]", this.x, this.y, this.sx, this.sy, this.posType, this.sizeType, this.alignX, this.alignY);
|
||||
}
|
||||
|
||||
//@Override
|
||||
//public WidgetGeometry clone() throws CloneNotSupportedException{
|
||||
// return (WidgetGeometry)super.clone();
|
||||
//}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
package mcp.mobius.waila.gui.widgets.buttons;
|
||||
|
||||
import mcp.mobius.waila.gui.events.MouseEvent;
|
||||
import mcp.mobius.waila.gui.helpers.UIHelper;
|
||||
import mcp.mobius.waila.gui.interfaces.IWidget;
|
||||
import mcp.mobius.waila.gui.interfaces.Signal;
|
||||
import mcp.mobius.waila.gui.widgets.LabelFixedFont;
|
||||
import mcp.mobius.waila.gui.widgets.WidgetBase;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.util.Point;
|
||||
|
||||
public abstract class ButtonBase extends WidgetBase {
|
||||
|
||||
protected boolean mouseOver = false;
|
||||
protected static ResourceLocation widgetsTexture = new ResourceLocation("textures/gui/widgets.png");
|
||||
|
||||
public ButtonBase(IWidget parent){
|
||||
super(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw() {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
for (IWidget widget : this.widgets.values())
|
||||
if (widget instanceof LabelFixedFont)
|
||||
if (this.mouseOver)
|
||||
((LabelFixedFont)widget).setColor(0xffffa0);
|
||||
else
|
||||
((LabelFixedFont)widget).setColor(0xffffff);
|
||||
|
||||
super.draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Point pos) {
|
||||
this.saveGLState();
|
||||
int texOffset = 0;
|
||||
|
||||
if (this.mouseOver)
|
||||
texOffset = 1;
|
||||
|
||||
this.mc.func_110434_K().func_110577_a(widgetsTexture);
|
||||
UIHelper.drawTexture(this.getPos().getX(), this.getPos().getY(), this.getSize().getX(), this.getSize().getY(), 0, 66 + texOffset*20, 200, 20);
|
||||
|
||||
this.loadGLState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseEnter(MouseEvent event){
|
||||
mouseOver = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseLeave(MouseEvent event){
|
||||
mouseOver = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWidget getWidgetAtCoordinates(double posX, double posY){
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseClick(MouseEvent event){
|
||||
if (event.button == 0)
|
||||
this.mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||
|
||||
this.emit(Signal.CLICKED, event.button);
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package mcp.mobius.waila.gui.widgets.buttons;
|
||||
|
||||
import mcp.mobius.waila.gui.events.MouseEvent;
|
||||
import mcp.mobius.waila.gui.helpers.UIHelper;
|
||||
import mcp.mobius.waila.gui.interfaces.CType;
|
||||
import mcp.mobius.waila.gui.interfaces.IWidget;
|
||||
import mcp.mobius.waila.gui.interfaces.WAlign;
|
||||
import mcp.mobius.waila.gui.widgets.LabelFixedFont;
|
||||
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.util.Point;
|
||||
|
||||
public class ButtonBoolean extends ButtonBase {
|
||||
|
||||
protected boolean state = false;
|
||||
|
||||
public ButtonBoolean(IWidget parent, String textFalse, String textTrue){
|
||||
super(parent);
|
||||
|
||||
this.addWidget("LabelFalse", new LabelFixedFont(this, textFalse));
|
||||
this.getWidget("LabelFalse").setGeometry(new WidgetGeometry(50.0D, 50.0D, 100.0D, 20.0D, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
|
||||
this.addWidget("LabelTrue", new LabelFixedFont(this, textTrue));
|
||||
this.getWidget("LabelTrue").hide();
|
||||
this.getWidget("LabelTrue").setGeometry(new WidgetGeometry(50.0D, 50.0D, 100.0D, 20.0D, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseClick(MouseEvent event){
|
||||
super.onMouseClick(event);
|
||||
|
||||
if (event.button == 0)
|
||||
this.state = !this.state;
|
||||
|
||||
if (this.state){
|
||||
this.getWidget("LabelTrue").show();
|
||||
this.getWidget("LabelFalse").hide();
|
||||
} else {
|
||||
this.getWidget("LabelTrue").hide();
|
||||
this.getWidget("LabelFalse").show();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package mcp.mobius.waila.gui.widgets.buttons;
|
||||
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import net.minecraftforge.common.Property;
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.gui.events.MouseEvent;
|
||||
import mcp.mobius.waila.gui.interfaces.IWidget;
|
||||
|
||||
public class ButtonBooleanConfig extends ButtonBoolean {
|
||||
|
||||
private String configKey;
|
||||
private boolean instant;
|
||||
|
||||
public ButtonBooleanConfig(IWidget parent, String configKey, String textFalse, String textTrue){
|
||||
this(parent, configKey, true, true, textFalse, textTrue);
|
||||
}
|
||||
|
||||
public ButtonBooleanConfig(IWidget parent, String configKey, boolean instant, boolean state_, String textFalse, String textTrue){
|
||||
super(parent, textFalse, textTrue);
|
||||
this.configKey = configKey;
|
||||
this.instant = instant;
|
||||
|
||||
mod_Waila.instance.config.load();
|
||||
Property prop = mod_Waila.instance.config.get(Configuration.CATEGORY_GENERAL, this.configKey, state_);
|
||||
this.state = prop.getBoolean(state_);
|
||||
|
||||
if (this.state){
|
||||
this.getWidget("LabelTrue").show();
|
||||
this.getWidget("LabelFalse").hide();
|
||||
} else {
|
||||
this.getWidget("LabelTrue").hide();
|
||||
this.getWidget("LabelFalse").show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseClick(MouseEvent event){
|
||||
super.onMouseClick(event);
|
||||
|
||||
if (this.instant){
|
||||
mod_Waila.instance.config.getCategory(Configuration.CATEGORY_GENERAL).put(this.configKey, new Property(this.configKey,String.valueOf(this.state),Property.Type.BOOLEAN));
|
||||
mod_Waila.instance.config.save();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
package mcp.mobius.waila.gui.widgets.buttons;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.util.Point;
|
||||
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import net.minecraftforge.common.Property;
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.gui.events.MouseEvent;
|
||||
import mcp.mobius.waila.gui.helpers.UIHelper;
|
||||
import mcp.mobius.waila.gui.interfaces.IWidget;
|
||||
import mcp.mobius.waila.gui.widgets.LabelFixedFont;
|
||||
|
||||
public class ButtonBooleanConfigRemote extends ButtonBooleanConfig {
|
||||
|
||||
public ButtonBooleanConfigRemote(IWidget parent, String configKey, String textFalse, String textTrue){
|
||||
this(parent, configKey, true, true, textFalse, textTrue);
|
||||
}
|
||||
|
||||
public ButtonBooleanConfigRemote(IWidget parent, String configKey, boolean instant, boolean state_, String textFalse, String textTrue){
|
||||
super(parent, configKey, instant, state_, textFalse, textTrue);
|
||||
if (!mod_Waila.instance.serverPresent)
|
||||
this.state = false;
|
||||
|
||||
if (this.state){
|
||||
this.getWidget("LabelTrue").show();
|
||||
this.getWidget("LabelFalse").hide();
|
||||
} else {
|
||||
this.getWidget("LabelTrue").hide();
|
||||
this.getWidget("LabelFalse").show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseClick(MouseEvent event){
|
||||
if (mod_Waila.instance.serverPresent)
|
||||
super.onMouseClick(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Point pos) {
|
||||
if (mod_Waila.instance.serverPresent)
|
||||
super.draw(pos);
|
||||
else{
|
||||
this.saveGLState();
|
||||
int texOffset = -1;
|
||||
this.mc.func_110434_K().func_110577_a(widgetsTexture);
|
||||
UIHelper.drawTexture(this.getPos().getX(), this.getPos().getY(), this.getSize().getX(), this.getSize().getY(), 0, 66 + texOffset*20, 200, 20);
|
||||
this.loadGLState();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package mcp.mobius.waila.gui.widgets.buttons;
|
||||
|
||||
import org.lwjgl.util.Point;
|
||||
|
||||
import mcp.mobius.waila.gui.interfaces.CType;
|
||||
import mcp.mobius.waila.gui.interfaces.IWidget;
|
||||
import mcp.mobius.waila.gui.interfaces.WAlign;
|
||||
import mcp.mobius.waila.gui.widgets.LabelFixedFont;
|
||||
import mcp.mobius.waila.gui.widgets.LayoutBase;
|
||||
import mcp.mobius.waila.gui.widgets.WidgetBase;
|
||||
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
|
||||
|
||||
public class ButtonContainer extends WidgetBase {
|
||||
|
||||
private int nButtons = 0;
|
||||
private int columns;
|
||||
private int buttonSize;
|
||||
private double spacing;
|
||||
|
||||
public ButtonContainer(IWidget parent, int columns, int buttonSize, double spacing){
|
||||
super (parent);
|
||||
this.columns = columns;
|
||||
this.spacing = spacing;
|
||||
this.buttonSize = buttonSize;
|
||||
}
|
||||
|
||||
public void addButton(ButtonBase button){
|
||||
String buttonName = String.format("Button_%d", nButtons);
|
||||
String layoutName = String.format("Layout_%d", nButtons);
|
||||
String layoutLabelName = String.format("LayoutLabel_%d", nButtons);
|
||||
String labelName = String.format("Label_%d", nButtons);
|
||||
|
||||
this.addWidget(layoutName, new LayoutBase(this));
|
||||
this.addWidget(layoutLabelName, new LayoutBase(this));
|
||||
|
||||
int column = this.nButtons % this.columns;
|
||||
int row = this.nButtons / this.columns;
|
||||
double sizeColumn = 100.0 / this.columns;
|
||||
|
||||
this.getWidget(layoutName).setGeometry(new WidgetGeometry(sizeColumn * column, spacing * row, sizeColumn, spacing, CType.REL_X, CType.REL_X, WAlign.LEFT, WAlign.TOP));
|
||||
this.getWidget(layoutName).addWidget(buttonName, button);
|
||||
this.getWidget(layoutName).getWidget(buttonName).setGeometry(new WidgetGeometry(50.0, 50.0, buttonSize, 20.0, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
|
||||
|
||||
this.nButtons += 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Point pos) {}
|
||||
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package mcp.mobius.waila.gui.widgets.buttons;
|
||||
|
||||
import mcp.mobius.waila.gui.interfaces.CType;
|
||||
import mcp.mobius.waila.gui.interfaces.IWidget;
|
||||
import mcp.mobius.waila.gui.interfaces.WAlign;
|
||||
import mcp.mobius.waila.gui.widgets.LabelFixedFont;
|
||||
import mcp.mobius.waila.gui.widgets.LayoutBase;
|
||||
import mcp.mobius.waila.gui.widgets.WidgetBase;
|
||||
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
|
||||
|
||||
import org.lwjgl.util.Point;
|
||||
|
||||
//TODO : THIS CLASS IS WIP AND CAN'T WORK RIGHT NOW
|
||||
|
||||
public class ButtonContainerLabel extends WidgetBase {
|
||||
|
||||
private int nButtons = 0;
|
||||
private int columns;
|
||||
private int buttonSize;
|
||||
private double spacing;
|
||||
|
||||
public ButtonContainerLabel(IWidget parent, int columns, int buttonSize, double spacing){
|
||||
super (parent);
|
||||
this.columns = columns;
|
||||
this.spacing = spacing;
|
||||
this.buttonSize = buttonSize;
|
||||
}
|
||||
|
||||
public void addButton(ButtonBase button, String label){
|
||||
String buttonName = String.format("Button_%d", nButtons);
|
||||
String layoutName = String.format("Layout_%d", nButtons);
|
||||
String layoutLabelName = String.format("LayoutLabel_%d", nButtons);
|
||||
String labelName = String.format("Label_%d", nButtons);
|
||||
|
||||
this.addWidget(layoutName, new LayoutBase(this));
|
||||
this.addWidget(layoutLabelName, new LayoutBase(this));
|
||||
|
||||
int column = (this.nButtons % this.columns) * 2;
|
||||
int row = this.nButtons / this.columns;
|
||||
double sizeColumn = 100.0 / (this.columns * 2);
|
||||
|
||||
this.getWidget(layoutName).setGeometry(new WidgetGeometry(sizeColumn * (column + 1), spacing * row, sizeColumn, spacing, CType.REL_X, CType.REL_X, WAlign.LEFT, WAlign.TOP));
|
||||
this.getWidget(layoutName).addWidget(buttonName, button);
|
||||
this.getWidget(layoutName).getWidget(buttonName).setGeometry(new WidgetGeometry(50.0, 50.0, buttonSize, 20.0, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
|
||||
|
||||
this.getWidget(layoutLabelName).setGeometry(new WidgetGeometry(sizeColumn * column, spacing * row, sizeColumn, spacing, CType.REL_X, CType.REL_X, WAlign.LEFT, WAlign.TOP));
|
||||
this.getWidget(layoutLabelName).addWidget(labelName, new LabelFixedFont(this, label));
|
||||
this.getWidget(layoutLabelName).getWidget(labelName).setGeometry(new WidgetGeometry(50.0, 50.0, buttonSize, 20.0, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
|
||||
|
||||
this.nButtons += 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Point pos) {}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
package mcp.mobius.waila.gui.widgets.buttons;
|
||||
|
||||
import mcp.mobius.waila.gui.events.MouseEvent;
|
||||
import mcp.mobius.waila.gui.helpers.UIHelper;
|
||||
import mcp.mobius.waila.gui.interfaces.CType;
|
||||
import mcp.mobius.waila.gui.interfaces.IWidget;
|
||||
import mcp.mobius.waila.gui.interfaces.WAlign;
|
||||
import mcp.mobius.waila.gui.widgets.LabelFixedFont;
|
||||
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.util.Point;
|
||||
|
||||
public class ButtonInteger extends ButtonBase {
|
||||
|
||||
protected int state = 0;
|
||||
protected int nStates;
|
||||
|
||||
public ButtonInteger(IWidget parent, String... texts){
|
||||
super(parent);
|
||||
|
||||
this.nStates = texts.length;
|
||||
|
||||
for (int i = 0; i < texts.length; i++){
|
||||
String labelName = String.format("Label_%d", i);
|
||||
this.addWidget(labelName, new LabelFixedFont(this, texts[i]));
|
||||
this.getWidget(labelName).hide();
|
||||
this.getWidget(labelName).setGeometry(new WidgetGeometry(50.0D, 50.0D, 100.0D, 20.0D, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
|
||||
}
|
||||
this.getWidget("Label_0").show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseClick(MouseEvent event){
|
||||
super.onMouseClick(event);
|
||||
|
||||
if (event.button == 0)
|
||||
this.state += 1;
|
||||
|
||||
if (this.state >= this.nStates)
|
||||
this.state = 0;
|
||||
|
||||
for (int i = 0; i < this.nStates; i++)
|
||||
this.getWidget(String.format("Label_%d", i)).hide();
|
||||
|
||||
this.getWidget(String.format("Label_%d", state)).show();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package mcp.mobius.waila.gui.widgets.buttons;
|
||||
|
||||
import net.minecraftforge.common.Configuration;
|
||||
import net.minecraftforge.common.Property;
|
||||
|
||||
import org.lwjgl.util.Point;
|
||||
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.gui.events.MouseEvent;
|
||||
import mcp.mobius.waila.gui.interfaces.IWidget;
|
||||
import mcp.mobius.waila.gui.widgets.WidgetBase;
|
||||
|
||||
public class ButtonIntegerConfig extends ButtonInteger {
|
||||
|
||||
private String configKey;
|
||||
private boolean instant;
|
||||
|
||||
public ButtonIntegerConfig(IWidget parent, String configKey, String... texts){
|
||||
this(parent, configKey, true, 0, texts);
|
||||
}
|
||||
|
||||
public ButtonIntegerConfig(IWidget parent, String configKey, boolean instant, int state_, String... texts){
|
||||
super(parent, texts);
|
||||
this.configKey = configKey;
|
||||
this.instant = instant;
|
||||
|
||||
mod_Waila.instance.config.load();
|
||||
Property prop = mod_Waila.instance.config.get(Configuration.CATEGORY_GENERAL, this.configKey, state_);
|
||||
this.state = prop.getInt();
|
||||
|
||||
for (int i = 0; i < this.nStates; i++)
|
||||
this.getWidget(String.format("Label_%d", i)).hide();
|
||||
|
||||
this.getWidget(String.format("Label_%d", state)).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseClick(MouseEvent event){
|
||||
super.onMouseClick(event);
|
||||
|
||||
if (this.instant){
|
||||
mod_Waila.instance.config.getCategory(Configuration.CATEGORY_GENERAL).put(this.configKey, new Property(this.configKey,String.valueOf(this.state),Property.Type.INTEGER));
|
||||
mod_Waila.instance.config.save();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package mcp.mobius.waila.gui.widgets.buttons;
|
||||
|
||||
import mcp.mobius.waila.gui.events.MouseEvent;
|
||||
import mcp.mobius.waila.gui.interfaces.CType;
|
||||
import mcp.mobius.waila.gui.interfaces.IWidget;
|
||||
import mcp.mobius.waila.gui.interfaces.WAlign;
|
||||
import mcp.mobius.waila.gui.widgets.LabelFixedFont;
|
||||
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
public class ButtonLabel extends ButtonBase {
|
||||
|
||||
public ButtonLabel(IWidget parent, String text){
|
||||
super(parent);
|
||||
|
||||
this.addWidget("Label", new LabelFixedFont(this, text));
|
||||
this.getWidget("Label").setGeometry(new WidgetGeometry(50.0D, 50.0D, 100.0D, 20.0D, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseClick(MouseEvent event){
|
||||
super.onMouseClick(event);
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package mcp.mobius.waila.gui.widgets.buttons;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import mcp.mobius.waila.gui.events.MouseEvent;
|
||||
import mcp.mobius.waila.gui.interfaces.CType;
|
||||
import mcp.mobius.waila.gui.interfaces.IWidget;
|
||||
import mcp.mobius.waila.gui.interfaces.WAlign;
|
||||
import mcp.mobius.waila.gui.screens.ScreenBase;
|
||||
import mcp.mobius.waila.gui.widgets.LabelFixedFont;
|
||||
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
|
||||
|
||||
public class ButtonScreenChange extends ButtonBase {
|
||||
|
||||
GuiScreen linkedScreen;
|
||||
|
||||
public ButtonScreenChange(IWidget parent, String text, GuiScreen linkedscreen){
|
||||
super(parent);
|
||||
this.linkedScreen = linkedscreen;
|
||||
|
||||
this.addWidget("Label", new LabelFixedFont(this, text));
|
||||
this.getWidget("Label").setGeometry(new WidgetGeometry(50.0D, 50.0D, 100.0D, 20.0D, CType.RELXY, CType.ABSXY, WAlign.CENTER, WAlign.CENTER));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseClick(MouseEvent event){
|
||||
super.onMouseClick(event);
|
||||
|
||||
if (event.button == 0)
|
||||
this.mc.displayGuiScreen(this.linkedScreen);
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
package mcp.mobius.waila.gui.widgets.movable;
|
||||
|
||||
import mcp.mobius.waila.gui.events.MouseEvent;
|
||||
import mcp.mobius.waila.gui.helpers.UIHelper;
|
||||
import mcp.mobius.waila.gui.interfaces.CType;
|
||||
import mcp.mobius.waila.gui.interfaces.IWidget;
|
||||
import mcp.mobius.waila.gui.interfaces.Signal;
|
||||
import mcp.mobius.waila.gui.interfaces.WAlign;
|
||||
import mcp.mobius.waila.gui.widgets.WidgetBase;
|
||||
import mcp.mobius.waila.gui.widgets.WidgetGeometry;
|
||||
import mcp.mobius.waila.gui.widgets.WidgetGeometry.PointDouble;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.util.Point;
|
||||
|
||||
|
||||
// A movable picture setup especially for centered relative positions.
|
||||
|
||||
public class PictureMovableRC extends WidgetBase {
|
||||
|
||||
private double offsetX, offsetY;
|
||||
protected ResourceLocation texture;
|
||||
|
||||
public PictureMovableRC(IWidget parent, String uri) {
|
||||
super(parent);
|
||||
this.texture = new ResourceLocation(uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseClick(MouseEvent event){
|
||||
this.offsetX = event.x - this.geom.getUnalignedPos(this.parent).getX();
|
||||
this.offsetY = event.y - this.geom.getUnalignedPos(this.parent).getY();
|
||||
//System.out.printf("%s %s\n", this.offsetX, this.offsetY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseDrag(MouseEvent event){
|
||||
double newX = event.x - this.offsetX ;
|
||||
double newY = event.y - this.offsetY ;
|
||||
|
||||
newX = Math.max(newX, this.parent.getLeft());
|
||||
newY = Math.max(newY, this.parent.getTop());
|
||||
|
||||
newX = Math.min(newX, this.parent.getRight());
|
||||
newY = Math.min(newY, this.parent.getBottom());
|
||||
|
||||
this.setPos(((newX - this.parent.getLeft()) / this.parent.getSize().getX()) * 100.0, ((newY - this.parent.getTop())/ this.parent.getSize().getY()) * 100.0);
|
||||
|
||||
//System.out.printf("%s\n", this.parent.getGeometry());
|
||||
//System.out.printf("%s %s\n", this.parent.getPos(), this.parent.getSize());
|
||||
|
||||
this.emit(Signal.DRAGGED, this.getPos());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Point pos) {
|
||||
this.saveGLState();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
this.texManager.func_110577_a(texture);
|
||||
UIHelper.drawTexture(pos.getX(), pos.getY(), this.getSize().getX(), this.getSize().getY());
|
||||
GL11.glPopMatrix();
|
||||
|
||||
this.loadGLState();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,235 +0,0 @@
|
||||
package mcp.mobius.waila.gui_old;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import mcp.mobius.waila.gui_old.widget.IWidget;
|
||||
import mcp.mobius.waila.gui_old.widget_old.Button2States;
|
||||
import mcp.mobius.waila.gui_old.widget_old.ButtonChangeScreen;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
|
||||
public class BaseWailaScreen extends GuiScreen{
|
||||
|
||||
protected GuiScreen parentGui; // GUI we will return to in the case we are call from a GUI
|
||||
public ScaledResolution res;
|
||||
protected HashMap<String, IWidget> widgets = new HashMap<String, IWidget>();
|
||||
|
||||
/* Custom mouse handling */
|
||||
private int lastMouseButton = -1;
|
||||
private long lastMouseEvent = -1;
|
||||
private int lastMousePosX = -1;
|
||||
private int lastMousePosY = -1;
|
||||
private static int buttonCount = Mouse.getButtonCount();
|
||||
private boolean[] lastButtonStates = new boolean[buttonCount];
|
||||
private IWidget[] focusWidget = new IWidget[buttonCount];
|
||||
private IWidget mainFocusWidget = null;
|
||||
|
||||
|
||||
|
||||
public BaseWailaScreen(GuiScreen _parentGui) {
|
||||
this.parentGui = _parentGui;
|
||||
res = new ScaledResolution(Minecraft.getMinecraft().gameSettings,
|
||||
Minecraft.getMinecraft().displayWidth,
|
||||
Minecraft.getMinecraft().displayHeight);
|
||||
Mouse.getDWheel();
|
||||
}
|
||||
|
||||
@Override
|
||||
/* Here we draw anything special, and super takes care of the buttons for us */
|
||||
public void drawScreen(int i, int j, float f)
|
||||
{
|
||||
drawDefaultBackground();
|
||||
super.drawScreen(i, j, f);
|
||||
}
|
||||
|
||||
@Override
|
||||
/* Here we handle key presses. Super will just close the gui on ESC, and we like it like that */
|
||||
public void keyTyped(char keyChar, int keyID)
|
||||
{
|
||||
if (keyID == 1)
|
||||
{
|
||||
if (this.parentGui == null){
|
||||
this.mc.displayGuiScreen((GuiScreen)null);
|
||||
this.mc.setIngameFocus();
|
||||
} else {
|
||||
this.mc.displayGuiScreen(this.parentGui);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
if (guibutton instanceof ButtonChangeScreen)
|
||||
((ButtonChangeScreen)guibutton).pressButton();
|
||||
|
||||
else if (guibutton instanceof Button2States)
|
||||
((Button2States)guibutton).pressButton();
|
||||
}
|
||||
|
||||
protected int getXCentered(int width){
|
||||
return (this.res.getScaledWidth() - width)/ 2;
|
||||
}
|
||||
|
||||
public void addWidget(String name, IWidget widget){
|
||||
this.widgets.put(name, widget);
|
||||
}
|
||||
|
||||
public Collection<IWidget> getWidgets(){
|
||||
return this.widgets.values();
|
||||
}
|
||||
|
||||
public IWidget getWidget(String name){
|
||||
return this.widgets.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int mouseX, int mouseY, int buttonID)
|
||||
{
|
||||
IWidget widget = this.getWidgetAtCoordinates(mouseX, mouseY);
|
||||
if (widget != null && widget.mouseClicked(mouseX, mouseY, buttonID)){
|
||||
if (buttonID == 0)
|
||||
this.mainFocusWidget = widget;
|
||||
this.focusWidget[buttonID] = widget;
|
||||
}
|
||||
else
|
||||
super.mouseClicked(mouseX, mouseY, buttonID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseMovedOrUp(int mouseX, int mouseY, int buttonID)
|
||||
{
|
||||
if (buttonID == 0)
|
||||
this.mainFocusWidget = null;
|
||||
|
||||
if (this.focusWidget[buttonID] != null){
|
||||
this.focusWidget[buttonID].mouseReleased(mouseX, mouseY, buttonID);
|
||||
this.focusWidget[buttonID] = null;
|
||||
} else {
|
||||
IWidget widget = this.getWidgetAtCoordinates(mouseX, mouseY);
|
||||
if (widget == null || !widget.mouseReleased(mouseX, mouseY, buttonID))
|
||||
super.mouseMovedOrUp(mouseX, mouseY, buttonID);
|
||||
}
|
||||
}
|
||||
|
||||
public void mouseWheel(int mouseX, int mouseY, int mouseZ){
|
||||
IWidget widget = this.getWidgetAtCoordinates(mouseX, mouseY);
|
||||
if (widget != null)
|
||||
widget.mouseWheel(mouseX, mouseY, mouseZ);
|
||||
|
||||
}
|
||||
|
||||
public void mouseMoved(int mouseX, int mouseY){
|
||||
if (this.mainFocusWidget != null)
|
||||
this.mainFocusWidget.mouseMoved(mouseX, mouseY);
|
||||
else{
|
||||
IWidget widget = this.getWidgetAtCoordinates(mouseX, mouseY);
|
||||
if (widget != null)
|
||||
widget.mouseMoved(mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
public void mouseDragged(int mouseX, int mouseY, int buttonID, long deltaTime){
|
||||
IWidget widget = this.getWidgetAtCoordinates(mouseX, mouseY);
|
||||
if (widget != null)
|
||||
widget.mouseDragged(mouseX, mouseY, buttonID, deltaTime);
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void handleMouseInput()
|
||||
{
|
||||
int mouseX = Mouse.getEventX() * this.width / this.mc.displayWidth;
|
||||
int mouseY = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
|
||||
int mouseZ = Mouse.getEventDWheel();
|
||||
boolean[] buttonChanged = new boolean[buttonCount];
|
||||
|
||||
if (mouseZ != 0)
|
||||
this.mouseWheel(mouseX, mouseY, mouseZ);
|
||||
|
||||
int changedButton = -1;
|
||||
boolean hasStateChanged = false;
|
||||
if (Mouse.getEventButtonState()){
|
||||
hasStateChanged = true;
|
||||
changedButton = Mouse.getEventButton();
|
||||
}
|
||||
for (int i = 0; i < buttonCount; i++){
|
||||
buttonChanged[i] = Mouse.isButtonDown(i) != this.lastButtonStates[i];
|
||||
this.lastButtonStates[i] = Mouse.isButtonDown(i);
|
||||
|
||||
if (buttonChanged[i] && Mouse.isButtonDown(i))
|
||||
this.mouseClicked(mouseX, mouseY, i);
|
||||
else if (buttonChanged[i] && !Mouse.isButtonDown(i))
|
||||
this.mouseMovedOrUp(mouseX, mouseY, i);
|
||||
}
|
||||
|
||||
if ((mouseX != this.lastMousePosX) || (mouseY != this.lastMousePosY)){
|
||||
this.mouseMoved(mouseX, mouseY);
|
||||
this.lastMousePosX = mouseX;
|
||||
this.lastMousePosY = mouseY;
|
||||
}
|
||||
|
||||
/*
|
||||
if (changedButton != -1){
|
||||
if (Mouse.isButtonDown(changedButton)){
|
||||
this.mouseClicked(mouseX, mouseY, changedButton);
|
||||
this.lastMouseButton = changedButton;
|
||||
}
|
||||
else if (!Mouse.isButtonDown(changedButton)){
|
||||
this.mouseMovedOrUp(mouseX, mouseY, changedButton);
|
||||
this.lastMouseButton = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if ((mouseX != this.lastMousePosX) || (mouseY != this.lastMousePosY)){
|
||||
this.mouseMoved(mouseX, mouseY);
|
||||
this.lastMousePosX = mouseX;
|
||||
this.lastMousePosY = mouseY;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
if (hasStateChanged)
|
||||
{
|
||||
this.lastMouseButton = changedButton;
|
||||
this.lastMouseEvent = Minecraft.getSystemTime();
|
||||
this.mouseClicked(mouseX, mouseY, this.lastMouseButton);
|
||||
}
|
||||
else if (changedButton != -1)
|
||||
{
|
||||
this.lastMouseButton = -1;
|
||||
this.mouseMovedOrUp(mouseX, mouseY, changedButton);
|
||||
}
|
||||
*/
|
||||
/*
|
||||
else if (this.lastMouseButton != -1 && this.lastMouseEvent > 0L)
|
||||
{
|
||||
long deltaTime = Minecraft.getSystemTime() - this.lastMouseEvent;
|
||||
this.mouseDragged(mouseX, mouseY, this.lastMouseButton, deltaTime);
|
||||
}
|
||||
*/
|
||||
/*
|
||||
else if ((mouseX != this.lastMousePosX) || (mouseY != this.lastMousePosY)){
|
||||
this.mouseMoved(mouseX, mouseY);
|
||||
this.lastMousePosX = mouseX;
|
||||
this.lastMousePosY = mouseY;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
private IWidget getWidgetAtCoordinates(int posX, int posY){
|
||||
for (IWidget widget : this.getWidgets())
|
||||
if ((posX >= widget.getPosX()) &&
|
||||
(posX <= widget.getPosX() + widget.getWidth()) &&
|
||||
(posY >= widget.getPosY()) &&
|
||||
(posY <= widget.getPosY() + widget.getHeight()))
|
||||
return widget;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package mcp.mobius.waila.gui_old;
|
||||
|
||||
import mcp.mobius.waila.gui_old.widget.ContainerTable;
|
||||
import mcp.mobius.waila.gui_old.widget.Label;
|
||||
import mcp.mobius.waila.gui_old.widget.StackDisplay;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
public class GuiEnchantScreen extends BaseWailaScreen {
|
||||
|
||||
public ContainerTable widTable;
|
||||
public StackDisplay widStackDisplay;
|
||||
public Label widStackName;
|
||||
public Label widStackEnchantability;
|
||||
|
||||
public GuiEnchantScreen(GuiScreen _parentGui) {
|
||||
super(_parentGui);
|
||||
this.zLevel = -1.0F;
|
||||
|
||||
this.widTable = new ContainerTable(this);
|
||||
this.widStackDisplay = new StackDisplay(this);
|
||||
this.widStackName = new Label(this);
|
||||
this.widStackEnchantability = new Label(this);
|
||||
|
||||
this.widTable.setColumns(8, "\u00a7a\u00a7oName", "\u00a7a\u00a7oMin lvl", "\u00a7a\u00a7oMax lvl", "\u00a7a\u00a7oMod");
|
||||
this.widTable.setHeight(this.res.getScaledHeight() - 16 - 32);
|
||||
|
||||
this.addWidget("datatable", this.widTable);
|
||||
this.addWidget("stackdisplay", this.widStackDisplay);
|
||||
this.addWidget("stackname", this.widStackName);
|
||||
this.addWidget("stackenchant", this.widStackEnchantability);
|
||||
}
|
||||
|
||||
@Override
|
||||
/* Here we draw anything special, and super takes care of the buttons for us */
|
||||
public void drawScreen(int i, int j, float f)
|
||||
{
|
||||
//this.parentGui.drawScreen(i, j, f);
|
||||
//this.parentGui.allowUserInput = false;
|
||||
|
||||
super.drawScreen(i, j, f);
|
||||
widTable.draw(this.getXCentered(widTable.getWidth()), 32, 0);
|
||||
widStackDisplay.draw(this.getXCentered(widTable.getWidth()), 0, 0);
|
||||
widStackName.draw(this.getXCentered(widTable.getWidth())+32, 0, 0);
|
||||
widStackEnchantability.draw(this.getXCentered(widTable.getWidth())+32, 8, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawDefaultBackground()
|
||||
{
|
||||
this.drawGradientRect(0, 0, this.width, this.height, 0xdd000000, 0xdd000000);
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
package mcp.mobius.waila.gui_old;
|
||||
|
||||
import mcp.mobius.waila.gui_old.widget.ContainerTable;
|
||||
import mcp.mobius.waila.gui_old.widget.Label;
|
||||
import mcp.mobius.waila.gui_old.widget.StackDisplay;
|
||||
import mcp.mobius.waila.gui_old.widget.WikiReader;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
public class GuiIngameWiki extends BaseWailaScreen {
|
||||
|
||||
public WikiReader widReader = null;
|
||||
public StackDisplay widStack = null;
|
||||
public ContainerTable widTable = null;
|
||||
public Label widItemName = null;
|
||||
|
||||
public GuiIngameWiki(GuiScreen _parentGui) {
|
||||
super(_parentGui);
|
||||
|
||||
this.widReader = new WikiReader(this);
|
||||
this.widStack = new StackDisplay(this);
|
||||
this.widTable = new ContainerTable(this);
|
||||
this.widItemName = new Label("");
|
||||
|
||||
this.widReader.setWidth(this.res.getScaledWidth()-this.res.getScaledWidth()/3 - 16);
|
||||
this.widReader.setHeight(this.res.getScaledHeight() - 24);
|
||||
this.widReader.setBackgroundColor(0x66888888);
|
||||
|
||||
this.widStack.setScale(4.0f);
|
||||
|
||||
this.widTable.setAutosize(false);
|
||||
this.widTable.setWidth(this.res.getScaledWidth()/3 - 8);
|
||||
this.widTable.setHeight(this.res.getScaledHeight() - 16 - this.widStack.getHeight());
|
||||
this.widTable.setColumns(8, "\u00a7a\u00a7oEntry", "\u00a7a\u00a7oValue");
|
||||
|
||||
this.addWidget("wikireader", this.widReader);
|
||||
this.addWidget("stackdisplay", this.widStack);
|
||||
this.addWidget("datatable", this.widTable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int i, int j, float f)
|
||||
{
|
||||
super.drawScreen(i, j, f);
|
||||
widTable.draw(4, this.widStack.getHeight() + 16, 1000);
|
||||
widItemName.draw(this.res.getScaledWidth()/6-widItemName.getWidth()/2, this.widStack.getHeight(), 0);
|
||||
widReader.draw(this.res.getScaledWidth()/3 + 8, 8, 0);
|
||||
widStack.draw(this.res.getScaledWidth()/6-widStack.getWidth()/2, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawDefaultBackground()
|
||||
{
|
||||
this.drawGradientRect(0, 0, this.width, this.height, 0xdd000000, 0xdd000000);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
package mcp.mobius.waila.gui_old;
|
||||
|
||||
import mcp.mobius.waila.gui_old.widget.DraggableViewport;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
public class GuiTechTree extends BaseWailaScreen {
|
||||
|
||||
public DraggableViewport widViewport = null;
|
||||
public int topOffset = 16;
|
||||
|
||||
public GuiTechTree(GuiScreen _parentGui) {
|
||||
super(_parentGui);
|
||||
|
||||
this.widViewport = new DraggableViewport(this);
|
||||
this.widViewport.setWidth(this.res.getScaledWidth() - 32);
|
||||
this.widViewport.setHeight(this.res.getScaledHeight() - 32);
|
||||
this.widViewport.setBackgroundColor(0x66888888);
|
||||
|
||||
this.addWidget("viewport", this.widViewport);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int i, int j, float f)
|
||||
{
|
||||
super.drawScreen(i, j, f);
|
||||
this.widViewport.draw(16,topOffset,0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawDefaultBackground()
|
||||
{
|
||||
this.drawGradientRect(0, 0, this.width, this.height, 0xdd000000, 0xdd000000);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,175 +0,0 @@
|
||||
package mcp.mobius.waila.gui_old.NEI;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
import codechicken.core.ReflectionManager;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.FuelRecipeHandler;
|
||||
import codechicken.nei.recipe.GuiCraftingRecipe;
|
||||
import codechicken.nei.recipe.ICraftingHandler;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler.CachedRecipe;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.ShapedRecipes;
|
||||
import net.minecraft.item.crafting.ShapelessRecipes;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
|
||||
public class CraftingTreeNode {
|
||||
|
||||
CraftingTreeNode topNode = null;
|
||||
LinkedHashMap<ItemStack, ArrayList<CraftingTreeNode>> bottomNodes = new LinkedHashMap<ItemStack, ArrayList<CraftingTreeNode>>();
|
||||
|
||||
//Item stacks we have in the node.
|
||||
public ArrayList<ItemStack> elements = new ArrayList<ItemStack>();
|
||||
//Item stacks we are filtering the recipes with. (Previous stacks in the tree)
|
||||
ArrayList<CachedRecipe> excRecipes = new ArrayList<CachedRecipe>();
|
||||
//List of recipes available for a given stack
|
||||
HashMap<ItemStack, ArrayList<CachedRecipe>> recipesMap = new HashMap<ItemStack, ArrayList<CachedRecipe>>();
|
||||
//Components sorted by recipes for a given item stack
|
||||
HashMap<ItemStack, ArrayList<ArrayList<ItemStack>>> componentsMap = new HashMap<ItemStack, ArrayList<ArrayList<ItemStack>>>();
|
||||
|
||||
int layer;
|
||||
LinkedHashMap<Integer, ArrayList<CraftingTreeNode>> layers;
|
||||
|
||||
public CraftingTreeNode(CraftingTreeNode topNode, ArrayList<ItemStack> elements, int layer, LinkedHashMap<Integer, ArrayList<CraftingTreeNode>> layers) {
|
||||
this.topNode = topNode;
|
||||
this.layer = layer;
|
||||
this.layers = layers;
|
||||
this.addSelfToLayers();
|
||||
this.setElements(elements);
|
||||
System.out.printf("%s\n", this.toString());
|
||||
}
|
||||
|
||||
public CraftingTreeNode(CraftingTreeNode topNode, ArrayList<ItemStack> elements, ArrayList<CachedRecipe> excluded, int layer, LinkedHashMap<Integer, ArrayList<CraftingTreeNode>> layers) {
|
||||
this.topNode = topNode;
|
||||
this.layer = layer;
|
||||
this.layers = layers;
|
||||
this.addSelfToLayers();
|
||||
this.excRecipes = excluded;
|
||||
this.setElements(elements);
|
||||
System.out.printf("%s\n", this.toString());
|
||||
}
|
||||
|
||||
public CraftingTreeNode(CraftingTreeNode topNode, ItemStack stack, int layer, LinkedHashMap<Integer, ArrayList<CraftingTreeNode>> layers) {
|
||||
this.topNode = topNode;
|
||||
this.layer = layer;
|
||||
this.layers = layers;
|
||||
this.addSelfToLayers();
|
||||
this.addElement(stack);
|
||||
System.out.printf("%s\n", this.toString());
|
||||
}
|
||||
|
||||
public void addSelfToLayers(){
|
||||
if (!(this.layers.containsKey(layer)))
|
||||
this.layers.put(this.layer, new ArrayList<CraftingTreeNode>());
|
||||
this.layers.get(this.layer).add(this);
|
||||
}
|
||||
|
||||
public void addElement(ItemStack stack){
|
||||
this.elements.add(stack);
|
||||
this.recipesMap.put(stack, this.getRecipes(stack, this.excRecipes));
|
||||
this.componentsMap.put(stack, new ArrayList<ArrayList<ItemStack>>());
|
||||
for (CachedRecipe recipe: this.recipesMap.get(stack)){
|
||||
this.excRecipes.add(recipe);
|
||||
ArrayList<ItemStack> subComposants = new ArrayList<ItemStack>();
|
||||
for (PositionedStack substack : recipe.getIngredients())
|
||||
subComposants.add(substack.item);
|
||||
|
||||
if (subComposants.size() > 0){
|
||||
if (!this.bottomNodes.containsKey(stack))
|
||||
this.bottomNodes.put(stack, new ArrayList<CraftingTreeNode>());
|
||||
this.bottomNodes.get(stack).add(new CraftingTreeNode(this, this.cleanupRecipe(subComposants), this.excRecipes, this.layer+1, this.layers));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setElements(ArrayList<ItemStack> elements){
|
||||
for (ItemStack is : elements)
|
||||
this.addElement(is);
|
||||
}
|
||||
|
||||
public ArrayList<CachedRecipe> getRecipes(ItemStack stack, ArrayList<CachedRecipe> excluded){
|
||||
ArrayList<ICraftingHandler> craftinghandlers = ReflectionManager.getField(GuiCraftingRecipe.class, ArrayList.class, null, "craftinghandlers");
|
||||
ArrayList<CachedRecipe> cachedRecipes = new ArrayList<CachedRecipe>();
|
||||
|
||||
for (ICraftingHandler handler : craftinghandlers)
|
||||
if (handler instanceof TemplateRecipeHandler && !(handler instanceof FuelRecipeHandler)){
|
||||
((TemplateRecipeHandler) handler).arecipes = new ArrayList<CachedRecipe>();
|
||||
((TemplateRecipeHandler) handler).loadCraftingRecipes(stack);
|
||||
for (CachedRecipe recipe : ((TemplateRecipeHandler)handler).arecipes){
|
||||
boolean found = false;
|
||||
for (CachedRecipe exc : excluded)
|
||||
if (this.areRecipesIdentical(recipe, exc))
|
||||
found = true;
|
||||
if (found)
|
||||
continue;
|
||||
|
||||
cachedRecipes.add(recipe);
|
||||
}
|
||||
}
|
||||
return cachedRecipes;
|
||||
}
|
||||
|
||||
public boolean areRecipesIdentical(CachedRecipe recipe1, CachedRecipe recipe2){
|
||||
if (recipe1.getResult().items.length != recipe2.getResult().items.length)
|
||||
return false;
|
||||
if (recipe1.getIngredients().size() != recipe1.getIngredients().size())
|
||||
return false;
|
||||
for (int i = 0; i < recipe1.getResult().items.length; i++)
|
||||
if (!recipe1.getResult().items[i].isItemEqual(recipe2.getResult().items[i]))
|
||||
return false;
|
||||
for (int i = 0; i < recipe1.getIngredients().size(); i++)
|
||||
for (int j = 0; j < recipe1.getIngredients().get(i).items.length; j++)
|
||||
if (!recipe1.getIngredients().get(i).items[j].isItemEqual(recipe2.getIngredients().get(i).items[j]))
|
||||
return false;
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public ArrayList<ItemStack> cleanupRecipe(ArrayList<ItemStack> stacks){
|
||||
ArrayList<ItemStack> curratedStacks = new ArrayList<ItemStack>();
|
||||
for (ItemStack is : stacks){
|
||||
boolean found = false;
|
||||
for (ItemStack isc : curratedStacks){
|
||||
//if (OreDictionary.itemMatches(is, isc, false)){
|
||||
if ((isc.isItemEqual(is)) ||
|
||||
((OreDictionary.getOreID(isc) != -1) &&
|
||||
(OreDictionary.getOreID(is) != -1) &&
|
||||
(OreDictionary.getOreID(isc) == OreDictionary.getOreID(is))
|
||||
)){
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found){
|
||||
ItemStack isc = is.copy();
|
||||
isc.stackSize = 0;
|
||||
curratedStacks.add(isc);
|
||||
}
|
||||
}
|
||||
|
||||
for (ItemStack is : stacks)
|
||||
for (ItemStack isc : curratedStacks)
|
||||
if ((isc.isItemEqual(is)) ||
|
||||
((OreDictionary.getOreID(isc) != -1) &&
|
||||
(OreDictionary.getOreID(is) != -1) &&
|
||||
(OreDictionary.getOreID(isc) == OreDictionary.getOreID(is))
|
||||
))
|
||||
//if (isc.isItemEqual(is) || OreDictionary.getOreID(isc) == OreDictionary.getOreID(is))
|
||||
isc.stackSize += is.stackSize;
|
||||
|
||||
return curratedStacks;
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
return this.elements.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,171 +0,0 @@
|
||||
package mcp.mobius.waila.gui_old.NEI;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import mcp.mobius.waila.Constants;
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.gui_old.GuiEnchantScreen;
|
||||
import mcp.mobius.waila.gui_old.widget.Label;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.forge.IContainerInputHandler;
|
||||
|
||||
public class HandlerEnchantment implements IContainerInputHandler {
|
||||
|
||||
static Class EplusApi;
|
||||
static Method Tooltip;
|
||||
|
||||
@Override
|
||||
public boolean keyTyped(GuiContainer gui, char keyChar, int keyCode) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeyTyped(GuiContainer gui, char keyChar, int keyID) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyID) {
|
||||
ItemStack stackover = gui.manager.getStackMouseOver();
|
||||
if(stackover == null)
|
||||
return false;
|
||||
|
||||
if(keyID == NEIClientConfig.getKeyBinding(Constants.BIND_SCREEN_ENCH)){
|
||||
//try{
|
||||
int itemEnchantability = stackover.getItem().getItemEnchantability();
|
||||
if (itemEnchantability == 0){return false;}
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
GuiEnchantScreen enchantScreen = new GuiEnchantScreen(mc.currentScreen);
|
||||
enchantScreen.widStackDisplay.setStack(stackover);
|
||||
enchantScreen.widStackName.setLabel("\u00a7f" + stackover.getDisplayName());
|
||||
enchantScreen.widStackEnchantability.setLabel(String.format("\u00a7fEnchantability : %s", itemEnchantability));
|
||||
|
||||
Enchantment[] enchants = null;
|
||||
if (stackover.getItem() == Item.book)
|
||||
enchants = Enchantment.enchantmentsBookList;
|
||||
else
|
||||
enchants = Enchantment.enchantmentsList;
|
||||
|
||||
for(Enchantment enchant : enchants){
|
||||
if (enchant == null){continue;}
|
||||
if (enchant.canApplyAtEnchantingTable(stackover) || stackover.getItem() == Item.book){
|
||||
for (int lvl = enchant.getMinLevel(); lvl <= enchant.getMaxLevel(); lvl++){
|
||||
int minEnchantEnchantability = enchant.getMinEnchantability(lvl);
|
||||
int maxEnchantEnchantability = enchant.getMaxEnchantability(lvl);
|
||||
|
||||
int minItemEnchantability = 1;
|
||||
int meanItemEnchantability = 1 + itemEnchantability/4;
|
||||
int maxItemEnchantability = 1 + itemEnchantability/2;
|
||||
|
||||
int minModifiedEnchantability = (int)(0.85*minItemEnchantability + 0.5);
|
||||
int meanModifiedEnchantability = (int)(1.00*meanItemEnchantability + 0.5);
|
||||
int maxModifiedEnchantability = (int)(1.15*maxItemEnchantability + 0.5);
|
||||
|
||||
int minLevel = (int) ((minEnchantEnchantability - minModifiedEnchantability)/1.15);
|
||||
int maxLevel = (int) ((maxEnchantEnchantability - maxModifiedEnchantability)/0.85);
|
||||
|
||||
int meanMinLevel = (int) ((minEnchantEnchantability - meanModifiedEnchantability)/1.0);
|
||||
int meanMaxLevel = (int) ((maxEnchantEnchantability - meanModifiedEnchantability)/1.0);
|
||||
|
||||
enchantScreen.widTable.addRow(new Label(enchant.getTranslatedName(lvl)),
|
||||
new Label(String.valueOf(minLevel)),
|
||||
new Label(String.valueOf(maxLevel)),
|
||||
//new Label(String.valueOf(meanMinLevel)),
|
||||
//new Label(String.valueOf(meanMaxLevel)),
|
||||
new Label("\u00a79\u00a7o"+ this.getEnchantModName(enchant))
|
||||
);
|
||||
|
||||
//String description = this.getEnchantmentToolTip(enchant);
|
||||
}
|
||||
}
|
||||
}
|
||||
mc.displayGuiScreen(enchantScreen);
|
||||
//}
|
||||
//catch (NullPointerException e){
|
||||
// System.out.printf("%s\n", e);
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getEnchantModName(Enchantment enchant){
|
||||
String enchantPath = enchant.getClass().getProtectionDomain().getCodeSource().getLocation().toString();
|
||||
String enchantModName = "<Unknown>";
|
||||
for (String s: mod_Waila.instance.modSourceList.keySet())
|
||||
if (enchantPath.contains(s))
|
||||
enchantModName = mod_Waila.instance.modSourceList.get(s);
|
||||
|
||||
if (enchantModName.equals("Minecraft Coder Pack"))
|
||||
enchantModName = "Minecraft";
|
||||
return enchantModName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(GuiContainer gui, int mousex, int mousey,
|
||||
int button) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseClicked(GuiContainer gui, int mousex, int mousey,
|
||||
int button) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseUp(GuiContainer gui, int mousex, int mousey, int button) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseScrolled(GuiContainer gui, int mousex, int mousey,
|
||||
int scrolled) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseScrolled(GuiContainer gui, int mousex, int mousey,
|
||||
int scrolled) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseDragged(GuiContainer gui, int mousex, int mousey,
|
||||
int button, long heldTime) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
private String getEnchantmentToolTip(Enchantment enchantment) {
|
||||
try {
|
||||
|
||||
if (EplusApi == null) {
|
||||
EplusApi = Class.forName("eplus.api.EplusApi");
|
||||
}
|
||||
|
||||
if (Tooltip == null) {
|
||||
Tooltip = EplusApi.getMethod("getEnchantmentToolTip", Enchantment.class);
|
||||
}
|
||||
|
||||
return String.valueOf(Tooltip.invoke(null, enchantment));
|
||||
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,152 +0,0 @@
|
||||
package mcp.mobius.waila.gui_old.NEI;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.Constants;
|
||||
import mcp.mobius.waila.gui_old.GuiIngameWiki;
|
||||
import mcp.mobius.waila.gui_old.GuiTechTree;
|
||||
import mcp.mobius.waila.gui_old.widget.ComponentDisplay;
|
||||
import mcp.mobius.waila.gui_old.widget.StackDisplay;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.ShapedRecipes;
|
||||
import net.minecraft.item.crafting.ShapelessRecipes;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.forge.IContainerInputHandler;
|
||||
|
||||
public class HandlerTechTree implements IContainerInputHandler {
|
||||
|
||||
public HandlerTechTree() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyTyped(GuiContainer gui, char keyChar, int keyCode) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeyTyped(GuiContainer gui, char keyChar, int keyID) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyID) {
|
||||
ItemStack stackover = gui.manager.getStackMouseOver();
|
||||
if(stackover == null)
|
||||
return false;
|
||||
|
||||
if(keyID == NEIClientConfig.getKeyBinding(Constants.BIND_SCREEN_TECH)){
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
GuiTechTree techScreen = new GuiTechTree(mc.currentScreen);
|
||||
|
||||
LinkedHashMap<Integer, ArrayList<CraftingTreeNode>> layers = new LinkedHashMap<Integer, ArrayList<CraftingTreeNode>> ();
|
||||
CraftingTreeNode tree = new CraftingTreeNode(null, stackover, 0, layers);
|
||||
|
||||
/*
|
||||
LinkedHashMap<Integer, ArrayList<CraftingTreeNode>> curratedLayers = new LinkedHashMap<Integer, ArrayList<CraftingTreeNode>> ();
|
||||
|
||||
for (int layer : layers.keySet())
|
||||
curratedLayers.put(layer, new ArrayList<CraftingTreeNode>());
|
||||
|
||||
for (int i = 0; i < (layers.size() - 1) ; i++)
|
||||
for (CraftingTreeNode node : layers.get(i)){
|
||||
if (node.bottomNodes.size() != 0){
|
||||
curratedLayers.get(i).add(node);
|
||||
|
||||
}
|
||||
else{
|
||||
node.layer += 1;
|
||||
layers.get(i+1).add(node);
|
||||
}
|
||||
}
|
||||
|
||||
for (CraftingTreeNode node : layers.get(layers.keySet().size()-1))
|
||||
curratedLayers.get(layers.keySet().size()-1).add(node);
|
||||
|
||||
System.out.printf("%s\n", curratedLayers);
|
||||
*/
|
||||
|
||||
/*
|
||||
for (int layer = curratedLayers.keySet().size() - 1; layer >= 0; layer--){
|
||||
int offsetX = 0;
|
||||
for (int icompo = 0; icompo < curratedLayers.get(layer).size(); icompo++){
|
||||
ComponentDisplay componentDisplay = new ComponentDisplay(techScreen, curratedLayers.get(layer).get(icompo));
|
||||
componentDisplay.setBackgroundColor(0xddeeeed1);
|
||||
techScreen.widViewport.addWidget(componentDisplay, offsetX, layer*32, 0);
|
||||
offsetX += componentDisplay.getWidth() + 8;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
for (int layer = layers.keySet().size() - 1; layer >= 0; layer--){
|
||||
int offsetX = 0;
|
||||
for (int icompo = 0; icompo < layers.get(layer).size(); icompo++){
|
||||
ComponentDisplay componentDisplay = new ComponentDisplay(techScreen, layers.get(layer).get(icompo));
|
||||
componentDisplay.setBackgroundColor(0xddeeeed1);
|
||||
if (layer != 0)
|
||||
componentDisplay.setDrawOverlay(true);
|
||||
|
||||
techScreen.widViewport.addWidget(componentDisplay, offsetX, layer*32, 0);
|
||||
offsetX += componentDisplay.getWidth() + 8;
|
||||
}
|
||||
}
|
||||
|
||||
mc.displayGuiScreen(techScreen);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(GuiContainer gui, int mousex, int mousey,
|
||||
int button) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseClicked(GuiContainer gui, int mousex, int mousey,
|
||||
int button) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseUp(GuiContainer gui, int mousex, int mousey, int button) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseScrolled(GuiContainer gui, int mousex, int mousey,
|
||||
int scrolled) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseScrolled(GuiContainer gui, int mousex, int mousey,
|
||||
int scrolled) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseDragged(GuiContainer gui, int mousex, int mousey,
|
||||
int button, long heldTime) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,138 +0,0 @@
|
||||
package mcp.mobius.waila.gui_old.NEI;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
import mcp.mobius.waila.Constants;
|
||||
import mcp.mobius.waila.mod_Waila;
|
||||
import mcp.mobius.waila.addons.ConfigHandler;
|
||||
import mcp.mobius.waila.addons.ExternalModulesHandler;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.gui_old.GuiIngameWiki;
|
||||
import mcp.mobius.waila.gui_old.widget.Label;
|
||||
import mcp.mobius.waila.handlers.SummaryProvider;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.forge.IContainerInputHandler;
|
||||
|
||||
public class HandlerWiki implements IContainerInputHandler {
|
||||
|
||||
public String getDescriptionString(String modid, String name, String meta){
|
||||
if (ExternalModulesHandler.instance().hasDocTextModID(modid)){
|
||||
//Do we have an direct entry for this item ?
|
||||
if (ExternalModulesHandler.instance().hasDocTextItem(modid, name)){
|
||||
//We check if we have an exact match, a wildcard match and finally, an meta 0 match
|
||||
if (ExternalModulesHandler.instance().hasDocTextMeta(modid, name, meta)){
|
||||
return ExternalModulesHandler.instance().getDocText(modid, name, meta);
|
||||
} else if (ExternalModulesHandler.instance().hasDocTextSpecificMeta(modid, name, "*")){
|
||||
return ExternalModulesHandler.instance().getDocText(modid, name, "*");
|
||||
} else if (ExternalModulesHandler.instance().hasDocTextSpecificMeta(modid, name, "0")){
|
||||
return ExternalModulesHandler.instance().getDocText(modid, name, "0");
|
||||
}
|
||||
|
||||
} else if (ExternalModulesHandler.instance().getDoxTextWildcardMatch(modid, name) != null) {
|
||||
String key = ExternalModulesHandler.instance().getDoxTextWildcardMatch(modid, name);
|
||||
if (ExternalModulesHandler.instance().hasDocTextMeta(modid, key, meta)){
|
||||
return ExternalModulesHandler.instance().getDocText(modid, key, meta);
|
||||
} else if (ExternalModulesHandler.instance().hasDocTextSpecificMeta(modid, key, "*")){
|
||||
return ExternalModulesHandler.instance().getDocText(modid, key, "*");
|
||||
} else if (ExternalModulesHandler.instance().hasDocTextSpecificMeta(modid, key, "0")){
|
||||
return ExternalModulesHandler.instance().getDocText(modid, key, "0");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return String.format("No description for %s$$%s",modid, name);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyID) {
|
||||
ItemStack stackover = gui.manager.getStackMouseOver();
|
||||
if(stackover == null)
|
||||
return false;
|
||||
|
||||
if(keyID == NEIClientConfig.getKeyBinding(Constants.BIND_SCREEN_WIKI)){
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
GuiIngameWiki wikiScreen = new GuiIngameWiki(mc.currentScreen);
|
||||
|
||||
wikiScreen.widReader.setText(this.getDescriptionString(mod_Waila.instance.getModID(stackover), stackover.getItemName(), String.valueOf(stackover.getItemDamage())));
|
||||
wikiScreen.widStack.setStack(stackover);
|
||||
wikiScreen.widItemName.setLabel(stackover.getDisplayName());
|
||||
|
||||
LinkedHashMap<String, String> entries = SummaryProvider.instance().getSummary(stackover, (ConfigHandler.instance()));
|
||||
int nvalidentries = 0;
|
||||
for (String s : entries.keySet())
|
||||
if (entries.get(s) != null)
|
||||
nvalidentries += 1;
|
||||
|
||||
if (nvalidentries == 0)
|
||||
for (int i = 0; i < 6; i++)
|
||||
wikiScreen.widTable.addRow(new Label(""), new Label(entries.get("")));
|
||||
else
|
||||
for (String s : entries.keySet())
|
||||
if (entries.get(s) != null)
|
||||
wikiScreen.widTable.addRow(new Label(s), new Label(entries.get(s)));
|
||||
|
||||
mc.displayGuiScreen(wikiScreen);
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyTyped(GuiContainer gui, char keyChar, int keyCode) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeyTyped(GuiContainer gui, char keyChar, int keyID) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(GuiContainer gui, int mousex, int mousey,
|
||||
int button) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseClicked(GuiContainer gui, int mousex, int mousey,
|
||||
int button) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseUp(GuiContainer gui, int mousex, int mousey, int button) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseScrolled(GuiContainer gui, int mousex, int mousey,
|
||||
int scrolled) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseScrolled(GuiContainer gui, int mousex, int mousey,
|
||||
int scrolled) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseDragged(GuiContainer gui, int mousex, int mousey,
|
||||
int button, long heldTime) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,215 +0,0 @@
|
||||
package mcp.mobius.waila.gui_old.widget;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
|
||||
public abstract class BaseWidget implements IWidget {
|
||||
|
||||
protected int width, height;
|
||||
protected String label;
|
||||
protected int posX, posY, posZ;
|
||||
protected GuiScreen parent;
|
||||
protected FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;;
|
||||
protected TextureManager renderEngine = Minecraft.getMinecraft().renderEngine;
|
||||
protected HashMap<String, IWidget> widgets = new HashMap<String, IWidget>();
|
||||
protected IWidget[] focusWidget = new IWidget[Mouse.getButtonCount()];
|
||||
protected IWidget mainFocusWidget = null;
|
||||
protected int backgroundColor = 0;
|
||||
|
||||
public BaseWidget(){}
|
||||
|
||||
@Override
|
||||
public abstract int getWidth();
|
||||
@Override
|
||||
public abstract int getHeight();
|
||||
@Override
|
||||
public void setWidth(int width) { this.width = width; }
|
||||
@Override
|
||||
public void setHeight(int height) { this.height = height; }
|
||||
|
||||
@Override
|
||||
public void setPos (int posX, int posY, int posZ){
|
||||
this.posX = posX;
|
||||
this.posY = posY;
|
||||
this.posZ = posZ;
|
||||
}
|
||||
@Override
|
||||
public int getPosX(){return this.posX;}
|
||||
@Override
|
||||
public int getPosY(){return this.posY;}
|
||||
|
||||
@Override
|
||||
public String getLabel(){ return this.label;}
|
||||
@Override
|
||||
public void setLabel(String label){ this.label = label; }
|
||||
|
||||
@Override
|
||||
public abstract void draw();
|
||||
@Override
|
||||
public void draw(int x, int y, int z){
|
||||
this.posX = x;
|
||||
this.posY = y;
|
||||
this.posZ = z;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.0f,0.0f, this.posZ);
|
||||
this.draw();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
@Override
|
||||
public void draw(float scale){
|
||||
int oldX = this.posX;
|
||||
int oldY = this.posY;
|
||||
this.posX /= scale;
|
||||
this.posY /= scale;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(0.0f,0.0f, this.posZ);
|
||||
this.draw();
|
||||
GL11.glPopMatrix();
|
||||
this.posX = oldX;
|
||||
this.posY = oldY;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(int mouseX, int mouseY, int buttonID){
|
||||
IWidget widget = this.getWidgetAtCoordinates(mouseX, mouseY);
|
||||
if (widget != null){
|
||||
if (buttonID == 0)
|
||||
this.mainFocusWidget = widget;
|
||||
this.focusWidget[buttonID] = widget;
|
||||
return widget.mouseClicked(mouseX, mouseY, buttonID);
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean mouseReleased(int mouseX, int mouseY, int buttonID){
|
||||
if (buttonID == 0)
|
||||
this.mainFocusWidget = null;
|
||||
|
||||
if (this.focusWidget[buttonID] != null){
|
||||
boolean retval = this.focusWidget[buttonID].mouseReleased(mouseX, mouseY, buttonID);
|
||||
this.focusWidget[buttonID] = null;
|
||||
return retval;
|
||||
}
|
||||
this.focusWidget[buttonID] = null;
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean mouseWheel(int mouseX, int mouseY, int mouseZ){
|
||||
IWidget widget = this.getWidgetAtCoordinates(mouseX, mouseY);
|
||||
if (widget != null)
|
||||
return widget.mouseWheel(mouseX, mouseY, mouseZ);
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean mouseMoved(int mouseX, int mouseY){
|
||||
if (this.mainFocusWidget != null)
|
||||
return this.mainFocusWidget.mouseMoved(mouseX, mouseY);
|
||||
|
||||
IWidget widget = this.getWidgetAtCoordinates(mouseX, mouseY);
|
||||
if (widget != null)
|
||||
return widget.mouseMoved(mouseX, mouseY);
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public boolean mouseDragged(int mouseX, int mouseY, int buttonID, long deltaTime){
|
||||
IWidget widget = this.getWidgetAtCoordinates(mouseX, mouseY);
|
||||
if (widget != null)
|
||||
return widget.mouseDragged(mouseX, mouseY, buttonID, deltaTime);
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
public void startScissorFilter(int posX, int posY, int width, int height){
|
||||
ScaledResolution res = new ScaledResolution(Minecraft.getMinecraft().gameSettings,
|
||||
Minecraft.getMinecraft().displayWidth,
|
||||
Minecraft.getMinecraft().displayHeight);
|
||||
int scaleFactor = res.getScaleFactor();
|
||||
|
||||
int glLeft = posX * scaleFactor;
|
||||
int glBottom = (res.getScaledHeight() - (posY + height)) * scaleFactor;
|
||||
|
||||
GL11.glScissor(posX*scaleFactor, glBottom, width*scaleFactor, height*scaleFactor);
|
||||
GL11.glEnable(GL11.GL_SCISSOR_TEST);
|
||||
}
|
||||
|
||||
public void stopScissorFilter(){
|
||||
GL11.glDisable(GL11.GL_SCISSOR_TEST);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWidget getWidgetAtCoordinates(int posX, int posY){
|
||||
for (IWidget widget : this.getWidgets())
|
||||
if ((posX >= widget.getPosX()) &&
|
||||
(posX <= widget.getPosX() + widget.getWidth()) &&
|
||||
(posY >= widget.getPosY()) &&
|
||||
(posY <= widget.getPosY() + widget.getHeight()))
|
||||
return widget;
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public void addWidget(String name, IWidget widget){
|
||||
this.widgets.put(name, widget);
|
||||
}
|
||||
@Override
|
||||
public Collection<IWidget> getWidgets(){
|
||||
return this.widgets.values();
|
||||
}
|
||||
@Override
|
||||
public IWidget getWidget(String name){
|
||||
return this.widgets.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBackgroundColor(int color){
|
||||
this.backgroundColor = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBackground(){
|
||||
if (this.backgroundColor != 0)
|
||||
this.drawGradientRect(this.posX, this.posY, this.posX+this.getWidth(), this.posY+this.getHeight(), 0.0, this.backgroundColor, this.backgroundColor);
|
||||
}
|
||||
|
||||
public void drawGradientRect(int left, int top, int right, int bottom, double zlevel, int colorStart, int colorStop)
|
||||
{
|
||||
float f = (colorStart >> 24 & 255) / 255.0F;
|
||||
float f1 = (colorStart >> 16 & 255) / 255.0F;
|
||||
float f2 = (colorStart >> 8 & 255) / 255.0F;
|
||||
float f3 = (colorStart & 255) / 255.0F;
|
||||
float f4 = (colorStop >> 24 & 255) / 255.0F;
|
||||
float f5 = (colorStop >> 16 & 255) / 255.0F;
|
||||
float f6 = (colorStop >> 8 & 255) / 255.0F;
|
||||
float f7 = (colorStop & 255) / 255.0F;
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorRGBA_F(f1, f2, f3, f);
|
||||
tessellator.addVertex(right, top, zlevel);
|
||||
tessellator.addVertex(left, top, zlevel);
|
||||
tessellator.setColorRGBA_F(f5, f6, f7, f4);
|
||||
tessellator.addVertex(left, bottom, zlevel);
|
||||
tessellator.addVertex(right, bottom, zlevel);
|
||||
tessellator.draw();
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
}
|
||||
}
|
||||
Loaded 100 of 389 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user