Compare commits

..

393 commits

Author SHA1 Message Date
Sen
0a95fbaaad
fix chest materials 2025-08-07 18:13:03 +02:00
Sen
2eda9771ad
add armor slot textures 2025-08-07 16:43:48 +02:00
Sen
3960bff398
impove camera entity handling 2025-08-07 15:28:07 +02:00
Sen
8a72694a74
fix freecam 2025-08-07 02:28:04 +02:00
Sen
46858621ee
fix and improve camera system 2025-08-07 02:20:47 +02:00
Sen
72dc4a1305
fix and improve camera system 2025-08-07 02:17:59 +02:00
Sen
a76c0c66e1
add camera system 2025-08-06 19:07:15 +02:00
Sen
e0a031c5d0
integrate renderer class 2025-08-06 13:53:25 +02:00
Sen
dc85ecc293
fix dice 2025-08-06 10:43:01 +02:00
Sen
20633332c8
fix dragons 2025-08-06 00:46:35 +02:00
Sen
9a31abbb41
fix dragons 2025-08-05 19:21:20 +02:00
Sen
da3dfaf37c
fix alpha-like planet size 2025-08-05 15:43:22 +02:00
Sen
08c0422902
re-add alpha-like gen 2025-08-05 13:37:51 +02:00
Sen
bc612ee9c8
fix some gui issues 2025-08-05 01:10:02 +02:00
Sen
16889889d4
fix some gui issues 2025-08-04 16:52:23 +02:00
Sen
03fbf90a68
fix wires 2025-08-04 14:05:50 +02:00
Sen
4e16421651
add more slabs and stairs 2025-08-04 12:32:29 +02:00
Sen
c27619e538
add slabs and stairs 2025-08-04 11:33:17 +02:00
Sen
e115ca1707
add item descriptions 2025-08-04 00:50:14 +02:00
Sen
1c33159e64
add item descriptions 2025-08-04 00:29:41 +02:00
Sen
1d19cddcef
split time into 3 categories 2025-08-03 21:58:30 +02:00
Sen
2f9e7ba728
add relative time 2025-08-03 16:45:14 +02:00
Sen
83082f4f3c
add /tick, /freeze and variable overrides 2025-08-03 14:33:45 +02:00
Sen
50fec6dd56
remove custom names from non-living 2025-08-02 20:53:00 +02:00
Sen
f29623eec6
add dense coal textures 2025-08-02 16:52:20 +02:00
Sen
1766dfd4dc
improve item burning 2025-08-02 16:48:05 +02:00
Sen
32d6f15c4a
add explosive items 2025-08-02 16:32:24 +02:00
Sen
ad83255833
add slots 2025-08-02 12:39:17 +02:00
Sen
3396dd73b2
improve overlay 2025-08-02 00:57:11 +02:00
Sen
f1bca42611
add fps camera 2025-08-01 23:44:59 +02:00
Sen
843fb8b079
add fps camera 2025-08-01 23:39:20 +02:00
Sen
81355293e3
improve overlay, fix spawner 2025-08-01 22:29:41 +02:00
Sen
330ee75a27
fix overlay 2025-08-01 20:54:39 +02:00
Sen
b5e5cb0444
fix textures 2025-08-01 20:08:26 +02:00
Sen
6fb9ded711
item slot refactor 2025-08-01 18:19:14 +02:00
Sen
c3f9655338
add milk texture 2025-08-01 03:35:16 +02:00
Sen
e1fc81962a
remove slot magic value for npcs 2025-08-01 03:30:06 +02:00
Sen
acc43e2d42
remove ItemTool subclassing 2025-07-31 17:13:19 +02:00
Sen
37f912cb6d
change tools 2025-07-31 16:13:40 +02:00
Sen
1272f87ea0
fix block harvest tools 2025-07-31 14:26:28 +02:00
Sen
3bdc5fb4a0
add colred textures back 2025-07-31 11:56:11 +02:00
Sen
2d34d139c5
add vanity enchantment 2025-07-31 01:45:29 +02:00
Sen
fb6b612934
fix biomes somewhat 2025-07-30 18:11:16 +02:00
Sen
02c007f0c0
fix terra gen biomes + river layers 2025-07-30 17:18:52 +02:00
Sen
cef99a063a
fix terra gen 2025-07-29 23:12:16 +02:00
Sen
e1c75f577d
complete item retexture 2025-07-29 15:05:33 +02:00
Sen
9c4287dcad
item retexture - most fixed 2025-07-29 14:10:19 +02:00
Sen
ff4b41acc1
item retexture (WIP) 2025-07-29 01:13:32 +02:00
Sen
7fb0edff33
change storage format to short identifiers, fix bush update causing potential stack overflow on drop check 2025-07-28 18:53:06 +02:00
Sen
b9753203ec
change storage format to single block array 2025-07-28 18:21:42 +02:00
Sen
9e72902142
color changes 2025-07-28 17:36:14 +02:00
Sen
c8bb712930
item texture rework temp 3 2025-07-26 18:09:55 +02:00
Sen
22b73973c4
item texture rework temp 2 2025-07-26 16:59:10 +02:00
Sen
28b26d4881
item texture rework temp 1 2025-07-26 13:43:07 +02:00
Sen
edfd5332ee
fix model provider 2025-07-25 13:33:01 +02:00
Sen
0e179b0410
make all blocks except some liquids non-translucent 2025-07-25 12:22:04 +02:00
Sen
1f149583d5
make most textures non-translucent 2025-07-25 11:40:17 +02:00
Sen
95948c7602
remove useless mipped layer 2025-07-25 10:44:34 +02:00
Sen
af68ad3f30
cleanup; remove Block##getRenderType 2025-07-25 10:32:13 +02:00
Sen
d56f28e6d2
make worldgen classes server side 2025-07-24 22:49:22 +02:00
Sen
4de4f41a5d
make dimension registry server side 2025-07-24 15:54:34 +02:00
Sen
b9d62c2253
initial populator reimplementation 2025-07-23 16:04:55 +02:00
Sen
9688d1d802
code cleanup 2025-07-23 14:23:06 +02:00
Sen
76e018b4ed
minimize client world class 2025-07-23 13:19:32 +02:00
Sen
eec61c9258
biome rework test 2 2025-07-23 00:59:37 +02:00
Sen
b524eeeaa3
biome rework test 2025-07-22 23:59:00 +02:00
Sen
0f128c1b1b
pre genlayer rework 2025-07-22 21:20:06 +02:00
Sen
0525ba5d56
remove block tinting 2025-07-21 19:54:21 +02:00
Sen
189d6883b9
fix some textures 2025-07-21 01:37:52 +02:00
Sen
028156c6a6
eliminate special render types except liquids 2025-07-20 17:59:51 +02:00
Sen
1b52b26f15
make standing signs rotatable in normal directions 2025-07-20 17:05:18 +02:00
Sen
ba3e80b15c
remove chest renderer 2025-07-20 16:20:24 +02:00
Sen
e92e74336e
rename classes 2025-07-20 14:56:03 +02:00
Sen
2b03be33a7
rename method 2025-07-20 14:35:27 +02:00
Sen
a1fcaa5f67
fix te particles 2025-07-20 14:29:55 +02:00
Sen
828d215048
block base class cleanup 2025-07-20 14:20:55 +02:00
Sen
346937ba4a
blocks/items init cleanup 2025-07-20 10:11:56 +02:00
Sen
c31c040fd2
remove useless cases 2025-07-20 00:31:36 +02:00
Sen
f97d952e7f
rename method 2025-07-20 00:10:36 +02:00
Sen
3e58287efa
update textures #3 + item code cleanup 2025-07-19 23:55:20 +02:00
Sen
3c7f2cf874
update textures #2 2025-07-19 18:06:14 +02:00
Sen
a3ceadd0ff
update textures #1 2025-07-19 15:46:25 +02:00
Sen
4b313dd869
remove useless wield type 2025-07-18 00:15:11 +02:00
Sen
33b6333683
fix shears 2025-07-18 00:01:17 +02:00
Sen
c396475ebd
improve wielding concept 2025-07-17 23:55:47 +02:00
Sen
3a9ec2ab32
fix lighting 2025-07-17 17:28:30 +02:00
Sen
2ea8656390
fix lighting 2025-07-17 16:20:46 +02:00
Sen
e289dc7d5b
universe cleanup 2025-07-17 15:37:39 +02:00
Sen
9b5eab4f57
universe cleanup 2025-07-17 03:11:29 +02:00
Sen
cf37d48292
clanup 2025-07-16 16:01:56 +02:00
Sen
5a69c0545b
the (no) redstone patch TM 2025-07-16 11:02:09 +02:00
Sen
73962c7ecd
add clickable commands 2025-07-15 14:34:07 +02:00
Sen
dabef4a3fd
fixes, burning out torches, remove some redstone 2025-07-15 03:24:57 +02:00
Sen
13b6a4e280
fixes, starting to replace redstone 2025-07-14 22:15:46 +02:00
Sen
92b7214c69
initial large chests 2025-07-14 17:57:06 +02:00
Sen
2e43f24e23
pre-fix for guis, large chests 2025-07-14 17:01:04 +02:00
Sen
ab3bc0407c
fix planet max size 2025-07-13 20:58:04 +02:00
Sen
c2dc0e7247
add world size, space around worlds 2025-07-13 20:34:50 +02:00
Sen
629e8aadc5
add a moon, fix multi moon rendering 2025-07-13 15:42:11 +02:00
Sen
dc7726f0b4
change dimension mapping 2025-07-13 15:14:12 +02:00
Sen
cad8ff6adb
fix dimension names 2025-07-13 14:54:37 +02:00
Sen
d09b9516a8
fix exterminated state 2025-07-13 13:53:53 +02:00
Sen
8b983f15c2
fix dimensions 2025-07-13 12:49:19 +02:00
Sen
0e848f01c4
cleanup 2025-07-12 16:52:56 +02:00
Sen
318a8885ba
cleanup 2025-07-12 16:48:23 +02:00
Sen
c126bdd8b0
fix datamap saving 2025-07-12 12:23:56 +02:00
Sen
05e00d389b
improve ping drawing + tab overlay 2025-07-12 11:49:48 +02:00
Sen
ecbc21d712
client class cleanup 2025-07-12 11:10:56 +02:00
Sen
aee94aa14d
add variable sync 2025-07-11 23:01:59 +02:00
Sen
b6242d5de1
add /set 2025-07-11 15:39:08 +02:00
Sen
b3f7b5a07b
item changes 2025-07-11 14:40:09 +02:00
Sen
3e59edd36b
add exteminated check to setBiome 2025-07-11 13:20:48 +02:00
Sen
59ecf5c6c1
fix world reset chunk repop (just noticed world gerneration is not actually seed-accurate) 2025-07-11 13:13:17 +02:00
Sen
0c6ea439eb
fix world reset chunk repop 2025-07-11 12:33:53 +02:00
Sen
c261317be9
add world reset 2025-07-11 12:10:10 +02:00
Sen
e784b65be7
change xp 2025-07-11 11:21:41 +02:00
Sen
f647862095
fix lighting color 2025-07-11 09:47:33 +02:00
Sen
d996d36742
add lighting color, fix later! 2025-07-11 00:45:15 +02:00
Sen
3a38411e13
removed herobrine??! 2025-07-11 00:00:43 +02:00
Sen
560bc1399a
texture change 2025-07-10 18:50:57 +02:00
Sen
d95a3f8b11
more particle improvements 2025-07-10 18:24:08 +02:00
Sen
28d6850668
fixes 2025-07-10 00:22:29 +02:00
Sen
d404c1743a
fixes 2025-07-09 23:25:56 +02:00
Sen
936154e5ce
effect cleanup 2025-07-09 19:41:37 +02:00
Sen
319e27870f
fix 2 textures 2025-07-09 17:26:58 +02:00
Sen
ebf31c2078
fix particles 2025-07-09 16:46:18 +02:00
Sen
2e7a3dd09a
clean up particles 2025-07-08 22:27:26 +02:00
Sen
baa3f501b6
clean up particles 2025-07-08 22:15:03 +02:00
Sen
874e118d9d
remove old particles 2025-07-08 18:08:51 +02:00
Sen
eca1f242c4
add rocket launcher + fixes 2025-07-08 01:51:47 +02:00
Sen
987c76d2c5
remove anvil ICrafting (useless) 2025-07-07 17:55:51 +02:00
Sen
454e38d1ab
remove remaining metadata from enums 2025-07-07 16:11:16 +02:00
Sen
c376d92790
fix itemstack sizes 2025-07-07 15:20:52 +02:00
Sen
4e94a660ff
remove arbitary item data 2025-07-07 00:38:38 +02:00
Sen
97b708bb23
add generic dyeing 2025-07-06 22:19:14 +02:00
Sen
b14a99dc05
data changes 2025-07-06 21:43:15 +02:00
Sen
575015abd6
remove unstackable blocks 2025-07-06 18:20:30 +02:00
Sen
dd1b9c5e52
remove banners 2025-07-06 18:13:19 +02:00
Sen
b0f33c3be1
add basic displays 2025-07-06 17:51:22 +02:00
Sen
2fbdfde2ee
add basic displays 2025-07-06 14:55:47 +02:00
Sen
e18a151f6c
add RUDIMENTARY displays 2025-07-06 13:20:13 +02:00
Sen
f6b036b517
add single item crafting 2025-07-05 17:13:02 +02:00
Sen
5c68feedbb
change tabs, make ash gravity affected 2025-07-05 15:21:18 +02:00
Sen
7706c20bf5
fix input field buttons 2025-07-05 14:53:22 +02:00
Sen
eed9ea565f
improve protocol 2025-07-05 14:46:56 +02:00
Sen
0c7459d371
further cheat improvements, change some tabs 2025-07-05 14:17:57 +02:00
Sen
7e9673dc25
improve renaming and cheats 2025-07-05 14:03:49 +02:00
Sen
4d406a70e1
add commands 2025-07-04 16:02:34 +02:00
Sen
e78bd9cce6
add crosshair customization 2025-07-03 12:45:26 +02:00
Sen
9cefe7602b
make ticked explosions less laggy 2025-07-01 17:43:31 +02:00
Sen
f241158cc1
fix chunk glitch 2025-07-01 16:36:33 +02:00
Sen
24e249913d
fix some guis 2025-07-01 16:04:50 +02:00
Sen
8d6957d6e1
fully implement cheat menu 2025-07-01 01:29:46 +02:00
Sen
0171d81724
fix particles 2025-07-01 00:58:54 +02:00
Sen
30e6b4eb74
improve cheat gui, fix particle bug 2025-07-01 00:20:02 +02:00
Sen
8a9e9451b7
change defaults, add texture 2025-06-30 21:06:13 +02:00
Sen
1fe5003028
cleanup, change dye colors 2025-06-30 20:48:53 +02:00
Sen
a73901a584
add more fonts 2025-06-30 18:34:06 +02:00
Sen
681bb4dc4e
fix debug mode clutter 2025-06-30 16:08:29 +02:00
Sen
b801a47df6
change cheat tab icons 2025-06-30 15:07:36 +02:00
Sen
eed510250d
force cheat tab categories 2025-06-30 15:00:13 +02:00
Sen
ac5ac815b0
initial cheat menu expansion 2025-06-30 14:49:20 +02:00
Sen
f4b83b8e01
fix item models 2025-06-30 13:50:23 +02:00
Sen
b2d3f5a641
change slabs 2025-06-30 13:10:18 +02:00
Sen
ea2d11ae3a
add option to fix rain lag 2025-06-30 11:37:23 +02:00
Sen
2a0e6c3cf7
fix converter torches 2025-06-29 21:43:41 +02:00
Sen
5357dde0e3
fix lighting 2025-06-29 21:33:06 +02:00
Sen
15459fc627
extend biome ids, remove biome id saving 2025-06-29 20:03:00 +02:00
Sen
f613bd2122
extend dimension system, remove dim ids 2025-06-29 19:09:47 +02:00
Sen
a080ed5583
remove params from sub itema 2025-06-29 00:16:29 +02:00
Sen
12fb849fa3
remove old converter IF 2025-06-28 20:09:21 +02:00
Sen
8263c549e3
fix converter static leaves 2025-06-28 19:58:08 +02:00
Sen
614e859146
add import/load command 2025-06-28 19:36:55 +02:00
Sen
96fb940087
fix converter + doors 2025-06-28 17:22:41 +02:00
Sen
601a331ee3
fix converter adding unneccesary data 2025-06-28 14:14:18 +02:00
Sen
264c7ffae3
fix block id world serialization 2025-06-28 14:01:46 +02:00
Sen
0f82ccb890
fix block id registering 2025-06-27 22:30:10 +02:00
Sen
244220f78c
remove block metadata functions 2025-06-27 21:16:54 +02:00
Sen
6ef8caddbe
remove block metadata 2025-06-27 20:57:58 +02:00
Sen
a1a15dcdf6
remove door metadata 2025-06-27 18:34:29 +02:00
Sen
a4a488523b
remove block metadata 2025-06-27 18:19:35 +02:00
Sen
3db0dca073
remove block metadata T2 2025-06-27 18:04:17 +02:00
Sen
2919d99126
remove block metadata TEMP 2025-06-27 16:56:08 +02:00
Sen
30a78ad279
remove block metadata TEMP 2025-06-27 16:27:16 +02:00
Sen
1e104d5db8
improve cheat gui scrollbar 2025-06-26 23:46:39 +02:00
Sen
bf54705350
decrease spawn egg max stack size 2025-06-26 20:05:46 +02:00
Sen
720ad59f77
fix clipboard rotation 2025-06-26 18:17:58 +02:00
Sen
1c6939d61f
fix clipboard rotation 2025-06-26 18:07:57 +02:00
Sen
66d1b9befe
converter cleanup 2025-06-26 13:55:32 +02:00
Sen
0d8f7ea1c9
converter remove fixed block meta ids 2025-06-26 13:33:30 +02:00
Sen
5bd5fe6d34
converter TEMP -> check remap B 2025-06-26 13:26:19 +02:00
Sen
401c355d2d
converter TEMP -> check remap A 2025-06-26 13:16:50 +02:00
Sen
8fc08b50ab
converter TEMP -> cleaned 2025-06-26 13:09:33 +02:00
Sen
113951b48c
converter TEMP -> cleaned 2025-06-26 12:46:23 +02:00
Sen
f5bf95ad69
converter TEMP -> hash correct! 2025-06-26 12:23:43 +02:00
Sen
ad6d6c12ca
converter TEMP 2025-06-26 12:07:43 +02:00
Sen
3a1679f0e9
converter TEMP 2025-06-26 12:04:44 +02:00
Sen
445c1be8af
fix leaves 2025-06-23 12:26:52 +02:00
Sen
1d6fef0eee
more block data fixes 2025-06-23 11:58:16 +02:00
Sen
ea76cecba3
more block data fixes 2025-06-23 11:41:33 +02:00
Sen
eb815a8e21
block data fixes 2025-06-23 10:18:24 +02:00
Sen
cde7bf84c1
fix converter, concludes id removal for now 2025-06-23 00:38:00 +02:00
Sen
18962cd653
more cleanup 2025-06-22 23:29:33 +02:00
Sen
72d46bfe72
cleanup, rename 2 items 2025-06-22 22:14:22 +02:00
Sen
73f5951962
clean imports 2025-06-22 21:48:52 +02:00
Sen
9ee7f5483b
inline item registry blocks 2025-06-22 21:45:20 +02:00
Sen
34a3f52b50
registry cleanup 2025-06-22 19:28:18 +02:00
Sen
de8d2477a3
clean up mapping classes 2025-06-22 19:08:24 +02:00
Sen
7ec9c174a1
clean up mapping classes 2025-06-22 19:02:08 +02:00
Sen
0ca276b561
clean up mapping classes 2025-06-22 18:53:23 +02:00
Sen
7c495f3d1c
clean up mapping classes 2025-06-22 18:34:43 +02:00
Sen
e85166666f
fix fallback textures 2025-06-22 18:21:07 +02:00
Sen
eb5c03dda3
inline fluid registry 2025-06-22 18:03:33 +02:00
Sen
039a7d7d9e
inline dispenser registry 2025-06-22 16:44:11 +02:00
Sen
e3e9598fc5
remove (useless) flammabilty registry 2025-06-22 13:01:09 +02:00
Sen
3ae27fc27f
rendering cleanup 2025-06-22 12:27:25 +02:00
Sen
1d937b466d
small cleanup 2025-06-21 21:57:12 +02:00
Sen
0a701b55d2
item sprite names 2025-06-21 21:56:11 +02:00
Sen
153e53ba9a
item sprite names 2025-06-21 21:55:13 +02:00
Sen
5c0e71f80c
fix item sprites 2025-06-21 21:47:16 +02:00
Sen
1ef1b4ae30
small cleanup 2025-06-21 21:10:00 +02:00
Sen
827d9585c3
add registered debug log 2025-06-21 20:51:00 +02:00
Sen
8a87f32678
small cleanup 2025-06-21 20:44:42 +02:00
Sen
3079a4bb67
imports, cleanup, fix tallgrass 2025-06-21 20:42:22 +02:00
Sen
55aac31bb9
change charged golden apple 2025-06-21 20:29:40 +02:00
Sen
e24794aa84
fix potion overlay 2025-06-21 20:25:12 +02:00
Sen
8c44c024ab
fix server block id loading 2025-06-21 20:17:36 +02:00
Sen
1b041cbf56
block cleanup #11 + textures 2025-06-21 20:09:28 +02:00
Sen
518300e68f
block cleanup #10 2025-06-21 19:59:52 +02:00
Sen
18d4ea7167
block cleanup #9 2025-06-21 19:26:04 +02:00
Sen
9cc439d774
block cleanup #8 2025-06-21 19:06:58 +02:00
Sen
9de6017751
block cleanup #7 2025-06-21 18:58:35 +02:00
Sen
7b25e6181e
block cleanup #6 2025-06-21 14:04:15 +02:00
Sen
9a6abe495c
block cleanup #5 2025-06-21 12:08:26 +02:00
Sen
84611eef7f
block cleanup #4 2025-06-21 11:23:42 +02:00
Sen
a836d7a2a5
property cleanup 2025-06-21 10:31:07 +02:00
Sen
734279ad95
block cleanup #3 2025-06-20 23:54:12 +02:00
Sen
473ef16043
block cleanup #2 2025-06-20 23:10:16 +02:00
Sen
54511912dd
block cleanup #1 2025-06-20 15:40:56 +02:00
Sen
1713ca7f96
temp remove ids, broken 2025-06-20 00:13:42 +02:00
Sen
bc74b3a29d
temp fixed block id removal 2025-06-19 19:49:45 +02:00
Sen
7c8a51bcac
temp fixed block id removal 2025-06-19 18:33:54 +02:00
Sen
dd3ac39530
add block map properly 2025-06-19 18:28:10 +02:00
Sen
64cff6a171
add block map (will reimplement this) 2025-06-19 16:21:15 +02:00
Sen
9930d1bb6d
clean up enchantments 2 2025-06-17 23:03:26 +02:00
Sen
38d29ba9c8
clean up enchantments 2025-06-17 22:05:02 +02:00
Sen
89e5775632
add some commands 2025-06-17 15:31:09 +02:00
Sen
a9770ecea1
add god+noclip command, fix completion list bug 2025-06-17 14:27:55 +02:00
Sen
f579eee88b
add magic command, fix arg parser single digit negative numbers getting interpreted as flags 2025-06-17 11:41:25 +02:00
Sen
f7bb1b0fe7
change mob spawners: fix egg collision 2025-06-16 18:23:05 +02:00
Sen
d45a1a8c4a
change mob spawners 2025-06-16 17:58:55 +02:00
Sen
9e5ca9dd95
change key exchange to ED25519 2025-06-16 15:19:07 +02:00
Sen
6afc26e601
change key exchange to ED25519 2025-06-16 15:12:39 +02:00
Sen
256721aa12
cleanup setClientPosition 2025-06-16 11:14:56 +02:00
Sen
431d54f779
cleanup entitybullet 2025-06-16 11:04:56 +02:00
Sen
d0984b143b
cleanup entitybullet comments 2025-06-16 10:53:10 +02:00
Sen
2281e55a09
fix client bullet physics 2025-06-16 10:37:36 +02:00
Sen
d566db0fc5
improve bullet physics 2025-06-16 10:31:48 +02:00
Sen
fcc5e9b640
remove atrributes, rework item modifiers 2025-06-15 20:21:08 +02:00
Sen
339a7679f7
add foxes, complete texture 2025-06-15 13:15:24 +02:00
Sen
ad930fcbdc
add foxes, temp textures 2025-06-15 01:06:10 +02:00
Sen
cdf8db1b50
add exp command, fix game over screen 2025-06-14 13:08:46 +02:00
Sen
8f1fda3f3d
remove internal link 2025-06-13 12:43:41 +02:00
Sen
85028fd82a
clarify license 2025-06-13 12:41:26 +02:00
Sen
1128aa34ab
cleanup entity debug display 2025-06-13 12:34:04 +02:00
Sen
e3edb3be8a
improve @ and ~ commands 2025-06-13 12:01:33 +02:00
Sen
06517a0d34
fix dev mode, add @ cmd 2025-06-13 11:19:29 +02:00
Sen
53a4f5f1a8
allow cancelling character creation 2025-06-13 00:27:03 +02:00
Sen
58163db658
ui scale fix 2025-06-13 00:02:32 +02:00
Sen
17bb2e57ab
fix ui scaling 2025-06-12 21:30:36 +02:00
Sen
836094a00b
more ui improvements 2025-06-12 20:11:59 +02:00
Sen
48918f0139
add various ui improvements 2025-06-12 19:27:41 +02:00
Sen
6d9522c80d
fix imperial time millenia 2025-06-12 14:15:55 +02:00
Sen
83f66723c9
remove xp usage 2025-06-12 13:50:50 +02:00
Sen
47021f9e49
fix flat world floor, replace read/writeState 2025-06-12 12:39:44 +02:00
Sen
1dea7e9645
add item command, remove legacy ids 2025-06-12 12:28:37 +02:00
Sen
678f37e184
improve some instanceof expressions 2025-06-12 10:01:16 +02:00
Sen
9eb5f2cfd3
fix NO_PLAYERS policy completion 2025-06-12 00:27:31 +02:00
Sen
fa94de734b
modify splashes 2025-06-12 00:11:27 +02:00
Sen
22fa5734a3
remove old credits 2025-06-11 23:29:02 +02:00
Sen
1258c07c1b
add evil chickens, fix shouldFlee bug 2025-06-11 23:11:26 +02:00
Sen
46c73c8c46
remove blackened biome from terra 2025-06-11 21:43:16 +02:00
Sen
8c414d53e3
fix font rendering and gui scale (for now) 2025-06-11 21:34:00 +02:00
Sen
7c2ce73de5
remove old font 2025-06-11 18:46:52 +02:00
Sen
6114da126a
fix fonts 2025-06-11 18:42:53 +02:00
Sen
cd7a739c5d
update README 2025-06-09 12:18:23 +02:00
Sen
98cf245b8d
update .gitignore 2025-06-03 09:46:15 +02:00
Sen
166064f21a
remove legacy gradle eclipse plugin 2025-06-03 09:40:45 +02:00
Sen
4a6da6d0f7
add spring water 2025-06-01 17:24:32 +02:00
Sen
1ae189c238
remove skull tile entity 2025-06-01 16:06:08 +02:00
Sen
618a076c0f
remove skull tile entity 2025-06-01 16:02:45 +02:00
Sen
bda91dac26
move banner blocks to new clkaases 2025-06-01 14:54:13 +02:00
Sen
ee3bf79c4c
renme config class, add blocks/items devmode startup check 2025-06-01 14:51:22 +02:00
Sen
141c1b1f5c
add coomand: clear 2025-06-01 13:45:36 +02:00
Sen
81613186e5
change svar implementation 2025-05-31 23:38:49 +02:00
Sen
126ce64a24
change svar implementation 2025-05-31 22:56:43 +02:00
Sen
367e6f5bfd
remove spawn rotation 2025-05-31 21:19:45 +02:00
Sen
c201df68b2
fix npc jumping 2025-05-31 20:27:12 +02:00
Sen
669fc77eab
fix potions 2025-05-31 20:09:23 +02:00
Sen
821a46b720
remove note block tes 2025-05-31 19:57:32 +02:00
Sen
493230c4a6
fix unneccesary debug classes 2025-05-31 18:56:55 +02:00
Sen
5534531416
make guis more generic 2025-05-31 18:38:53 +02:00
Sen
374e0c4617
remove server side debug 2025-05-31 16:46:48 +02:00
Sen
f4c024cde7
fix command system a bit 2025-05-31 14:02:55 +02:00
Sen
35277daca8
fix command default and required params 2025-05-31 10:47:06 +02:00
Sen
6562d18dc1
fix world parser default 2025-05-31 00:53:32 +02:00
Sen
663ef31db9
gradle: fix server console run 2025-05-31 00:47:33 +02:00
Sen
a6c2695ccb
complete login system for now, misc fixes 2025-05-31 00:23:35 +02:00
Sen
06a14ae645
small fixes 2025-05-30 22:12:50 +02:00
Sen
228eec0a79
encryptutil field cleanup 2025-05-30 21:14:35 +02:00
Sen
ec0a1aa5c3
add password hashing and commands 2025-05-30 21:12:59 +02:00
Sen
1b61f085e3
fix exceptions from net handlers, raise rsa key size to 4096 2025-05-30 19:39:54 +02:00
Sen
d1a0847303
cleanup, remove ambient occlusion from models 2025-05-30 18:08:07 +02:00
Sen
8e0bbd06c2
code cleanup: use records where possible 2025-05-30 17:57:14 +02:00
Sen
f30141c8f3
netty cleanup 2025-05-30 13:30:29 +02:00
Sen
c8e5c16e41
fix gradle compile errors 2025-05-30 13:00:33 +02:00
Sen
18be47866c
upgrade to java 21, remove netty unsafe, remove deprecated features 2025-05-30 12:49:37 +02:00
Sen
b14e539464
add key serialization 2025-05-30 01:43:37 +02:00
Sen
be0ab15153
add float scaling 2025-05-29 16:40:33 +02:00
Sen
f3117767fd
add basic scaling 2025-05-29 16:12:19 +02:00
Sen
414dc668ff
add flying types 2025-05-29 15:03:03 +02:00
Sen
b317139c97
fix client window refresh (useless) 2025-05-29 13:55:20 +02:00
Sen
3d0cc9665a
improve client server guis 2025-05-29 13:52:36 +02:00
Sen
18f37874fa
fix acces password server behaviour and default password auth 2025-05-29 12:57:35 +02:00
Sen
902c795ecc
extend and fix pubkeys 2025-05-29 12:51:39 +02:00
Sen
5a394749bf
add pubkey auth 2025-05-29 03:04:44 +02:00
Sen
bdf67a89f7
add server base seed 2025-05-28 18:44:41 +02:00
Sen
252c157cf0
add server base seed 2025-05-28 18:34:02 +02:00
Sen
b01b602728
formatting for compressed data tree 2025-05-28 18:12:28 +02:00
Sen
815c52e5d7
further compressed data tree cleanup 2025-05-28 17:07:33 +02:00
Sen
b52053f5ea
compressed data tree cleanup, streamlining 2025-05-28 13:51:07 +02:00
Sen
f76d3c8b89
change compressed data tree ids and clean up 2025-05-28 11:29:49 +02:00
Sen
6c55d59f1f
cleanup, rename, nbt->cdt "compressed data tree" 2025-05-28 01:11:46 +02:00
Sen
753b4b8b5d
rename tag methods 2025-05-27 22:57:25 +02:00
Sen
c527989ada
locale fix 2025-05-27 22:51:30 +02:00
Sen
8be702b3aa
change nbt format: small fix 2025-05-27 21:57:15 +02:00
Sen
688d5710c7
change nbt format: rename tags package 2025-05-27 21:47:36 +02:00
Sen
47a69ce8bc
change nbt format: change class names 2025-05-27 21:46:30 +02:00
Sen
4433d3b3df
change nbt format: fix visibility 2025-05-27 21:38:31 +02:00
Sen
dda5ac3573
change nbt format: fix method names 2025-05-27 21:34:46 +02:00
Sen
17aad1f023
change nbt format 2025-05-27 21:25:11 +02:00
Sen
ad4949af16
add some commands, fix exception spam, split converter nbt implementation 2025-05-27 14:29:40 +02:00
Sen
2cee1d6632
raise packet compression limit from 2 to 20mb 2025-05-26 23:57:36 +02:00
Sen
435e3f3e29
make access password mandatory 2025-05-26 20:29:08 +02:00
Sen
5f49d6c036
initial crafting registry cleanup (comments) 2025-05-26 17:35:17 +02:00
Sen
4e51e18bdc
add gradle 2025-05-26 17:09:08 +02:00
Sen
bb6ebb0be8
raise version 2025-05-26 14:14:14 +02:00
Sen
fafcf0e0ab
clean history 2025-05-26 14:07:50 +02:00
Sen
adc81d56d2 change port, config and version mechanisms 2025-05-26 13:27:03 +02:00
Sen
f879b060e8 clean data folder history 2025-05-26 11:27:34 +02:00
Sen
ed02e53122 change gitignore 2025-05-26 11:15:17 +02:00
Sen
72df57fb3d change gitignore 2025-05-26 11:13:34 +02:00
Sen
6af3fd71e5 change netty to modified version from initial commit 2025-05-26 11:10:08 +02:00
Sen
d8be274083 add ore min heights 2025-05-25 22:02:31 +02:00
Sen
0b2ad9f92d cleanup 2025-05-25 21:34:16 +02:00
Sen
e66758cd73 add cloud type and skybox enums 2025-05-25 21:32:32 +02:00
Sen
c0369d14b8 fix ore generation height limit 2025-05-25 20:55:53 +02:00
Sen
1d0dfddf25 remove unused import 2025-05-25 20:49:48 +02:00
Sen
a62dc2309d fix audio issues + potential crash 2025-05-25 20:43:52 +02:00
Sen
93d997c3c0 fix window position restoration on client startup 2025-05-25 20:20:46 +02:00
Sen
09149c7b88 update splashes 2025-05-25 20:11:35 +02:00
Sen
f1219070d2 fix invalid chars in splashes 2025-05-25 20:00:30 +02:00
Sen
8fed598b51 Revert "test chunk array perf"
This reverts commit e2ec9f0c84.
2025-05-25 18:41:45 +02:00
Sen
e2ec9f0c84 test chunk array perf 2025-05-25 18:40:34 +02:00
Sen
20abca12f2 remove server stop double logging 2025-05-25 18:33:08 +02:00
Sen
63c2a18c3a fix all logger names 2025-05-25 18:30:12 +02:00
Sen
bb64949927 change logger (netconnection) 2025-05-25 17:59:22 +02:00
Sen
77b5a34a33 downgrade netty to old version to fix annoying network bugs WHYYYYYYYYYYYYYYYYYYYYY?!?!?!?! 2025-05-25 17:53:55 +02:00
Sen
10fdaf0b1a cleanup player controller method names 2025-05-25 15:41:41 +02:00
Sen
2bc84f0c66 cleanup player controller var names 2025-05-25 15:38:12 +02:00
Sen
64b256c713 cleanup player controller comment 2025-05-25 15:27:36 +02:00
Sen
4a84f9e096 format PlayerController 2025-05-25 15:26:14 +02:00
Sen
2cf7f0036d cleanup player controller comments 2025-05-25 15:25:38 +02:00
Sen
d41ad4db01 change fire type behaviour 2025-05-25 15:04:14 +02:00
Sen
7299ab8e5c general Block* code cleanup 2025-05-25 14:45:04 +02:00
Sen
7fd8879c73 general Block* code cleanup 2025-05-25 12:13:15 +02:00
Sen
8bd9370bab make larger crafting grids possible 2025-05-25 00:10:02 +02:00
Sen
aa0ff6cf96 code cleanup 2025-05-24 21:24:13 +02:00
Sen
d6d934f1f3 small network code cleanup 2025-05-24 20:42:53 +02:00
Sen
bd4b8d427a network code cleanup 2025-05-24 20:38:49 +02:00
Sen
1eefb197f0 rename biome packet 2025-05-24 18:49:50 +02:00
Sen
ffca1f62e5 change biome packet 2025-05-24 18:49:24 +02:00
Sen
88c43d0824 Merge branch 'master' into chunk-intmap 2025-05-24 18:19:21 +02:00
Sen
71e50743fd split chunk class into server and client 2025-05-24 18:18:04 +02:00
Sen
7126ca5a9f add soul+black fire 2025-05-24 11:46:37 +02:00
Sen
0055cbf806 remove some old comments 2025-05-23 09:36:57 +02:00
Sen
41fae1317f network bug workaround test 2025-05-21 18:45:45 +02:00
Sen
f6b2fdf422 fix entity void height 2025-05-21 16:50:59 +02:00
Sen
688522c5ca change view distance default to 8 2025-05-21 16:35:37 +02:00
Sen
272392c8ea change world floor and ceiling to filler an optional flag 2025-05-21 16:32:28 +02:00
Sen
dfa5026a29 cap chunk height check in worldgen 2025-05-21 15:49:02 +02:00
Sen
2dd83c61dc make chunk storage a map 2025-05-21 15:31:50 +02:00
Sen
4d1d323c72 Revert "make world taller"
This reverts commit caef42dc16.
2025-05-20 19:09:19 +02:00
3686 changed files with 151375 additions and 147193 deletions

12
.gitattributes vendored Normal file
View file

@ -0,0 +1,12 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf
# These are Windows script files and should use crlf
*.bat text eol=crlf
# Binary files should be left untouched
*.jar binary

16
.gitignore vendored
View file

@ -1,8 +1,8 @@
/common/dev
/common/bin
/client/bin
/client/run
/server/bin
/server/run
/export
/.metadata
/dev
.metadata
.classpath
.project
.settings
.gradle
bin
build

View file

@ -1,3 +1,8 @@
# TCR
# TCR - That Cube Rocks
Ein Minecraft®™ 1.8.9 "Fork"
Ein Block-basiertes Open-World-Spiel mit vielen Dimensionen und RPG-Elementen.
**Projekt ist in der frühen Entwicklungsphase / Alpha**
Dieses Projekt ist Public Domain, siehe UNLICENSE.
Der Client verwendet LWJGL für GLFW und OpenGL, für dessen Lizenz siehe [Die LWJGL Website](https://www.lwjgl.org/license).

47
client/build.gradle.kts Normal file
View file

@ -0,0 +1,47 @@
plugins {
application
id("com.gradleup.shadow") version "8.3.6"
}
repositories {
mavenCentral()
}
dependencies {
implementation(project(":common"))
implementation(platform("org.lwjgl:lwjgl-bom:3.3.6"))
implementation("org.lwjgl", "lwjgl")
implementation("org.lwjgl", "lwjgl-glfw")
implementation("org.lwjgl", "lwjgl-opengl")
runtimeOnly("org.lwjgl", "lwjgl", classifier = "natives-linux")
runtimeOnly("org.lwjgl", "lwjgl", classifier = "natives-freebsd")
runtimeOnly("org.lwjgl", "lwjgl", classifier = "natives-windows")
runtimeOnly("org.lwjgl", "lwjgl-glfw", classifier = "natives-linux")
runtimeOnly("org.lwjgl", "lwjgl-glfw", classifier = "natives-freebsd")
runtimeOnly("org.lwjgl", "lwjgl-glfw", classifier = "natives-windows")
runtimeOnly("org.lwjgl", "lwjgl-opengl", classifier = "natives-linux")
runtimeOnly("org.lwjgl", "lwjgl-opengl", classifier = "natives-freebsd")
runtimeOnly("org.lwjgl", "lwjgl-opengl", classifier = "natives-windows")
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
application {
mainClass = "client.Client"
tasks.run.get().workingDir = rootProject.file("dev/client")
tasks.run.get().workingDir.mkdirs()
tasks.run.get().systemProperties.put("runtime.devmode", "")
}
tasks.shadowJar {
destinationDirectory = rootProject.file("dev")
archiveFileName = "tcr_client.jar"
}

File diff suppressed because it is too large Load diff

View file

@ -1,603 +0,0 @@
package client;
import client.network.ClientPlayer;
import client.world.WorldClient;
import common.block.Block;
import common.entity.Entity;
import common.entity.npc.EntityNPC;
import common.init.BlockRegistry;
import common.init.EntityRegistry;
import common.item.ItemBlock;
import common.item.ItemControl;
import common.item.ItemStack;
import common.material.Material;
import common.packet.CPacketAction;
import common.packet.CPacketBreak;
import common.packet.CPacketClick;
import common.packet.CPacketPlace;
import common.sound.PositionedSound;
import common.util.BlockPos;
import common.util.Facing;
import common.util.Vec3;
import common.world.State;
import common.world.World;
public class PlayerController
{
private final Client gm;
private final ClientPlayer netClientHandler;
private BlockPos currentBlock = new BlockPos(-1, -1, -1);
private ItemStack currentItemHittingBlock;
private float curBlockDamageMP;
private float stepSoundTickCounter;
private int blockHitDelay;
private boolean isHittingBlock;
private boolean noclip;
private int currentPlayerItem;
private boolean interacting;
public PlayerController(Client gmIn, ClientPlayer netHandler)
{
this.gm = gmIn;
this.netClientHandler = netHandler;
}
// public static void clickBlockCreative(Game gmIn, PlayerController playerController, BlockPos pos, Facing facing)
// {
// if (!gmIn.theWorld.extinguishFire(gmIn.thePlayer, pos, facing))
// {
// playerController.onPlayerDestroyBlock(pos, facing);
// }
// }
// public void setPlayerCapabilities()
// {
// this.gm.thePlayer.flying &= this.gm.thePlayer.hasEffect(Potion.flying) || this.gm.thePlayer.noclip;
// }
// public boolean isNoclip()
// {
// return this.gm.thePlayer.capabilities.noClip;
// }
// public void setNoclip(boolean noclip)
// {
// this.noclip = noclip;
// }
// public void setCheat(boolean cheat)
// {
// this.cheat = cheat;
// this.setPlayerCapabilities();
// }
// public boolean shouldDrawHUD()
// {
// return !this.creative;
// }
/**
* Called when a player completes the destruction of a block
*/
public boolean onPlayerDestroyBlock(BlockPos pos, Facing side)
{
// if (this.gamemode.isAdventure())
// {
// if (this.gamemode == Gamemode.SPECTATOR)
// {
// return false;
// }
// if (!this.gm.thePlayer.isAllowEdit())
// {
// Block block = this.gm.theWorld.getBlockState(pos).getBlock();
// ItemStack itemstack = this.gm.thePlayer.getCurrentEquippedItem();
//
// if (itemstack == null)
// {
// return false;
// }
//
// if (!itemstack.canDestroy(block))
// {
// return false;
// }
// }
// }
// if (this.gm.thePlayer.getHeldItem() != null && !this.gm.thePlayer.getHeldItem().getItem().canBreakBlocks())
// {
// return false;
// }
// else
// {
World world = this.gm.world;
State iblockstate = world.getState(pos);
Block block1 = iblockstate.getBlock();
if (block1.getMaterial() == Material.air)
{
return false;
}
else
{
world.playAuxSFX(2001, pos, BlockRegistry.getStateId(iblockstate));
boolean flag = world.setBlockToAir(pos);
if (flag)
{
block1.onBlockDestroyedByPlayer(world, pos, iblockstate);
}
this.currentBlock = new BlockPos(this.currentBlock.getX(), -1, this.currentBlock.getZ());
// if (!this.creative)
// {
ItemStack itemstack1 = this.gm.player.getCurrentEquippedItem();
if (itemstack1 != null)
{
itemstack1.onBlockDestroyed(world, block1, pos, this.gm.player);
if (itemstack1.stackSize == 0)
{
this.gm.player.destroyCurrentEquippedItem();
}
}
// }
return flag;
}
// }
}
/**
* Called when the player is hitting a block with an item.
*/
public boolean clickBlock(BlockPos loc, Facing face)
{
// if (this.gamemode.isAdventure())
// {
// if (this.gamemode == Gamemode.SPECTATOR)
// {
// return false;
// }
// if (!this.gm.thePlayer.isAllowEdit())
// {
// Block block = this.gm.theWorld.getBlockState(loc).getBlock();
// ItemStack itemstack = this.gm.thePlayer.getCurrentEquippedItem();
//
// if (itemstack == null)
// {
// return false;
// }
//
// if (!itemstack.canDestroy(block))
// {
// return false;
// }
// }
// }
if (!World.isValidXZ(loc))
{
return false;
}
else
{
ItemStack stack = this.gm.player.getHeldItem();
if(stack != null && stack.getItem().onAction(stack, this.gm.player, this.gm.world, ItemControl.PRIMARY, loc)) {
this.interacting = true;
this.netClientHandler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.START_DESTROY_BLOCK, loc, face));
return true;
}
// if (this.creative)
// {
// this.netClientHandler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.START_DESTROY_BLOCK, loc, face));
// clickBlockCreative(this.gm, this, loc, face);
// this.blockHitDelay = 5;
// }
// else
if (!this.isHittingBlock || !this.isHittingPosition(loc))
{
if (this.isHittingBlock)
{
this.netClientHandler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.ABORT_DESTROY_BLOCK, this.currentBlock, face));
}
this.netClientHandler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.START_DESTROY_BLOCK, loc, face));
Block block1 = this.gm.world.getState(loc).getBlock();
boolean flag = block1.getMaterial() != Material.air;
if (flag && this.curBlockDamageMP == 0.0F)
{
block1.onBlockClicked(this.gm.world, loc, this.gm.player);
}
if (flag && block1.getPlayerRelativeBlockHardness(this.gm.player, this.gm.player.worldObj, loc) >= 1.0F)
{
this.onPlayerDestroyBlock(loc, face);
// if(this.cheat && block1.getPlayerRelativeBlockHardness(this.gm.thePlayer, this.gm.thePlayer.worldObj, loc) < 1.0F)
this.blockHitDelay = 3;
}
else
{
this.isHittingBlock = true;
this.currentBlock = loc;
this.currentItemHittingBlock = this.gm.player.getHeldItem();
this.curBlockDamageMP = 0.0F;
this.stepSoundTickCounter = 0.0F;
this.gm.world.sendBlockBreakProgress(this.gm.player.getId(), this.currentBlock, (int)(this.curBlockDamageMP * 10.0F) - 1);
}
}
return true;
}
}
/**
* Resets current block damage and isHittingBlock
*/
public void resetBlockRemoving()
{
if (this.isHittingBlock)
{
this.netClientHandler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.ABORT_DESTROY_BLOCK, this.currentBlock, Facing.DOWN));
this.isHittingBlock = false;
this.curBlockDamageMP = 0.0F;
this.gm.world.sendBlockBreakProgress(this.gm.player.getId(), this.currentBlock, -1);
}
}
public void resetInteraction()
{
this.interacting = false;
}
public boolean onPlayerDamageBlock(BlockPos posBlock, Facing directionFacing)
{
if(this.interacting)
return false;
this.syncCurrentPlayItem();
if (this.blockHitDelay > 0)
{
--this.blockHitDelay;
return true;
}
// else if (this.creative && World.isValidXZ(posBlock))
// {
// this.blockHitDelay = 5;
// this.netClientHandler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.START_DESTROY_BLOCK, posBlock, directionFacing));
// clickBlockCreative(this.gm, this, posBlock, directionFacing);
// return true;
// }
else if (this.isHittingPosition(posBlock))
{
Block block = this.gm.world.getState(posBlock).getBlock();
if (block.getMaterial() == Material.air)
{
this.isHittingBlock = false;
return false;
}
else
{
this.curBlockDamageMP += block.getPlayerRelativeBlockHardness(this.gm.player, this.gm.player.worldObj, posBlock);
if (this.stepSoundTickCounter % 4.0F == 0.0F && block.sound.getStepSound() != null)
{
this.gm.getSoundManager().playSound(new PositionedSound(block.sound.getStepSound(), 0.25F, /* block.sound.getFrequency() * 0.5F, */ (float)posBlock.getX() + 0.5F, (float)posBlock.getY() + 0.5F, (float)posBlock.getZ() + 0.5F));
}
++this.stepSoundTickCounter;
if (this.curBlockDamageMP >= 1.0F)
{
this.isHittingBlock = false;
this.netClientHandler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.STOP_DESTROY_BLOCK, posBlock, directionFacing));
this.onPlayerDestroyBlock(posBlock, directionFacing);
this.curBlockDamageMP = 0.0F;
this.stepSoundTickCounter = 0.0F;
this.blockHitDelay = 5;
}
this.gm.world.sendBlockBreakProgress(this.gm.player.getId(), this.currentBlock, (int)(this.curBlockDamageMP * 10.0F) - 1);
return true;
}
}
else
{
return this.clickBlock(posBlock, directionFacing);
}
}
// /**
// * player reach distance = 4F
// */
// public float getBlockReachDistance()
// {
// return ;
// }
public void updateController()
{
this.syncCurrentPlayItem();
if (this.netClientHandler.getNetworkManager().isChannelOpen())
{
this.netClientHandler.getNetworkManager().processReceivedPackets();
}
else
{
this.netClientHandler.getNetworkManager().checkDisconnected();
}
}
private boolean isHittingPosition(BlockPos pos)
{
ItemStack itemstack = this.gm.player.getHeldItem();
boolean flag = this.currentItemHittingBlock == null && itemstack == null;
if (this.currentItemHittingBlock != null && itemstack != null)
{
flag = itemstack.getItem() == this.currentItemHittingBlock.getItem() && ItemStack.areItemStackTagsEqual(itemstack, this.currentItemHittingBlock) && (itemstack.isItemStackDamageable() || itemstack.getMetadata() == this.currentItemHittingBlock.getMetadata());
}
return pos.equals(this.currentBlock) && flag;
}
/**
* Syncs the current player item with the server
*/
private void syncCurrentPlayItem()
{
int i = this.gm.player.inventory.currentItem;
if (i != this.currentPlayerItem)
{
this.currentPlayerItem = i;
this.netClientHandler.addToSendQueue(new CPacketAction(CPacketAction.Action.SET_ITEMSLOT, this.currentPlayerItem));
}
}
public boolean onPlayerRightClick(EntityNPC player, WorldClient worldIn, ItemStack heldStack, BlockPos hitPos, Facing side, Vec3 hitVec)
{
this.syncCurrentPlayItem();
float f = (float)(hitVec.xCoord - (double)hitPos.getX());
float f1 = (float)(hitVec.yCoord - (double)hitPos.getY());
float f2 = (float)(hitVec.zCoord - (double)hitPos.getZ());
boolean flag = false;
if (!World.isValidXZ(hitPos))
{
return false;
}
else
{
if(heldStack == null || !heldStack.getItem().onAction(heldStack, player, worldIn, ItemControl.SECONDARY, hitPos)) {
// if (this.gamemode != Gamemode.SPECTATOR)
// {
State iblockstate = worldIn.getState(hitPos);
if ((!player.isSneaking() || player.getHeldItem() == null) // && (player.getHeldItem() == null || !player.getHeldItem().getItem().ignoresBlocks())
&& iblockstate.getBlock().onBlockActivated(worldIn, hitPos, iblockstate, player, side, f, f1, f2))
{
flag = true;
}
if (!flag && heldStack != null && heldStack.getItem() instanceof ItemBlock)
{
ItemBlock itemblock = (ItemBlock)heldStack.getItem();
if (!itemblock.canPlaceBlockOnSide(worldIn, hitPos, side, player, heldStack))
{
return false;
}
}
// }
}
else {
heldStack.getItem().onItemUse(heldStack, player, worldIn, hitPos, side, f, f1, f2);
flag = true;
}
this.netClientHandler.addToSendQueue(new CPacketPlace(hitPos, side.getIndex(), player.inventory.getCurrentItem(), f, f1, f2));
if (!flag) // && this.gamemode != Gamemode.SPECTATOR)
{
if (heldStack == null)
{
return false;
}
// else if (this.creative)
// {
// int i = heldStack.getMetadata();
// int j = heldStack.stackSize;
// boolean flag1 = heldStack.onItemUse(player, worldIn, hitPos, side, f, f1, f2);
// heldStack.setItemDamage(i);
// heldStack.stackSize = j;
// return flag1;
// }
else
{
return heldStack.onItemUse(player, worldIn, hitPos, side, f, f1, f2);
}
}
else
{
return true;
}
}
}
/**
* Notifies the server of things like consuming food, etc...
*/
public boolean sendUseItem(EntityNPC playerIn, World worldIn, ItemStack itemStackIn)
{
// if (this.gamemode == Gamemode.SPECTATOR)
// {
// return false;
// }
// else
// {
this.syncCurrentPlayItem();
this.netClientHandler.addToSendQueue(new CPacketPlace(playerIn.inventory.getCurrentItem()));
int i = itemStackIn.stackSize;
ItemStack itemstack = itemStackIn.useItemRightClick(worldIn, playerIn);
if (itemstack != itemStackIn || itemstack != null && itemstack.stackSize != i)
{
playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = itemstack;
if (itemstack.stackSize == 0)
{
playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = null;
}
return true;
}
else
{
return false;
}
// }
}
public EntityNPC createPlayerEntity(WorldClient worldIn, int type)
{
EntityNPC player = (EntityNPC)EntityRegistry.createEntityByID(type, worldIn);
player.setClientPlayer(this.netClientHandler);
return player;
}
/**
* Attacks an entity
*/
public void attackEntity(EntityNPC playerIn, Entity targetEntity)
{
this.syncCurrentPlayItem();
this.netClientHandler.addToSendQueue(new CPacketAction(CPacketAction.Action.ATTACK, targetEntity.getId()));
// if (this.gamemode != Gamemode.SPECTATOR)
// {
playerIn.attackTargetEntityWithCurrentItem(targetEntity);
// }
}
/**
* Send packet to server - player is interacting with another entity (left click)
*/
public boolean interactWithEntitySendPacket(EntityNPC playerIn, Entity targetEntity)
{
this.syncCurrentPlayItem();
this.netClientHandler.addToSendQueue(new CPacketAction(CPacketAction.Action.INTERACT, targetEntity.getId()));
return /* this.gamemode != Gamemode.SPECTATOR && */ playerIn.interactWith(targetEntity);
}
// /**
// * Return true when the player rightclick on an entity
// *
// * @param player The player's instance
// * @param entityIn The entity clicked
// * @param movingObject The object clicked
// */
// public boolean isPlayerRightClickingOnEntity(EntityNPC player, Entity entityIn, MovingObjectPosition movingObject)
// {
// this.syncCurrentPlayItem();
// Vec3 vec3 = new Vec3(movingObject.hitVec.xCoord - entityIn.posX, movingObject.hitVec.yCoord - entityIn.posY, movingObject.hitVec.zCoord - entityIn.posZ);
// this.netClientHandler.addToSendQueue(new C02PacketUseEntity(entityIn, vec3));
// return this.gamemode != Gamemode.SPECTATOR && entityIn.interactAt(player, vec3);
// }
/**
* Handles slot clicks sends a packet to the server.
*/
public ItemStack windowClick(int windowId, int slotId, int mouseButtonClicked, int mode, EntityNPC playerIn)
{
short short1 = playerIn.openContainer.getNextTransactionID(playerIn.inventory);
ItemStack itemstack = playerIn.openContainer.slotClick(slotId, mouseButtonClicked, mode, playerIn);
this.netClientHandler.addToSendQueue(new CPacketClick(windowId, slotId, mouseButtonClicked, mode, itemstack, short1));
return itemstack;
}
/**
* GuiEnchantment uses this during multiplayer to tell PlayerControllerMP to send a packet indicating the
* enchantment action the player has taken.
*
* @param windowID The ID of the current window
* @param button The button id (enchantment selected)
*/
public void sendEnchantPacket(int windowID, int button)
{
this.netClientHandler.addToSendQueue(new CPacketAction(CPacketAction.Action.ENCHANT_ITEM, windowID | (button << 8)));
}
// /**
// * Used in PlayerControllerMP to update the server with an ItemStack in a slot.
// */
// public void sendCheatPacket(ItemStack itemStackIn, boolean full)
// {
// }
// /**
// * Sends a Packet107 to the server to drop the item on the ground
// */
// public void sendPacketDropItem(ItemStack itemStackIn)
// {
// if (this.creative && itemStackIn != null)
// {
// this.netClientHandler.addToSendQueue(new CPacketCreative(-1, itemStackIn));
// }
// }
public void onStoppedUsingItem(EntityNPC playerIn)
{
this.syncCurrentPlayItem();
this.netClientHandler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, Facing.DOWN));
playerIn.stopUsingItem();
}
// /**
// * Checks if the player is not creative, used for checking if it should break a block instantly
// */
// public boolean isNotCreative()
// {
// return !this.creative;
// }
// /**
// * returns true if player is in creative mode
// */
// public boolean isCreative()
// {
// return this.creative;
// }
// /**
// * Checks if the player is riding a horse, used to chose the GUI to open
// */
// public boolean isRidingHorse()
// {
// return ;
// }
// public Gamemode getGamemode()
// {
// return this.gamemode;
// }
/**
* Return isHittingBlock
*/
public boolean getIsHittingBlock()
{
return this.isHittingBlock;
}
}

View file

@ -1,30 +0,0 @@
package client;
public class Timing {
public static long tmr_timer;
public static long tmr_start;
public static long tmr_current;
public static long tmr_last;
public static long tmr_delta;
public static long tmr_update;
public static long tmr_frames;
public static long tmr_iters;
public static long tick_torun;
public static long tick_done;
public static long tick_total;
public static long tick_time;
public static long tick_stime;
public static long tick_ftime;
public static long tick_ttime;
public static long tick_update;
public static double tick_fraction;
public static float framerate;
public static float tickrate;
public static float fdelta;
public static int tickTarget;
public static int tickFrame;
}

View file

@ -1,107 +0,0 @@
package client.gui;
import java.awt.image.BufferedImage;
import java.io.FileNotFoundException;
import java.io.IOException;
import org.lwjgl.opengl.GL11;
import client.renderer.GlState;
import client.renderer.texture.TextureUtil;
import common.log.Log;
import common.util.FileUtils;
public class Font {
public static final FontChar[] SIZES = new FontChar[256];
public static final int XGLYPH = 12;
public static final int YGLYPH = 18;
private static int texture;
public static void bindTexture() {
GlState.bindTexture(texture);
}
private static int stride(int width, int height, int x, int y, int c) {
return ((c & 15) * width + x) + (((c >> 4) & 15) * height + y) * (width << 4); // << 2;
}
private static byte specialChar(int width, int ch) {
return (byte)((ch == Log.CHR_UNK) ? width : ((ch == Log.CHR_SPC) ? (width / 6) : 127));
}
private static void calculate(int[] data, FontChar[] glyphs, int width, int height, int page) {
int off;
for(int z = 0; z < 256; z++) {
byte s, t, u, v;
if((u = specialChar(width, (page << 8) + z)) != 127) {
s = t = 0;
v = (byte)(((int)u) * height / width);
if(((page << 8) + z) != Log.CHR_UNK) {
for(int x = 0; x < width; x++) {
for(int y = 0; y < height; y++) {
off = stride(width, height, x, y, z);
data[off/*+3*/] = 0;
}
}
}
glyphs[z] = new FontChar(s, t, u, v);
continue;
}
s = t = 127;
u = v = 0;
for(int x = 0; x < width; x++) {
for(int y = 0; y < height; y++) {
off = stride(width, height, x, y, z);
if((data[off/*+3*/] & 0xff000000) != 0) {
s = x < s ? (byte)x : s;
t = y < t ? (byte)y : t;
u = x > u ? (byte)x : u;
v = y > v ? (byte)y : v;
}
}
}
if(s == 127 && t == 127 && u == 0 && v == 0) {
s = t = 0;
}
else {
u += 1;
v += 1;
}
glyphs[z] = new FontChar(s, t, u, v);
}
}
public static void load() {
BufferedImage img = null;
try {
img = TextureUtil.readImage(FileUtils.getResource("textures/font.png"));
}
catch(FileNotFoundException e) {
Log.IO.error("Konnte Font-Textur nicht laden: Datei nicht vorhanden");
}
catch(IOException e) {
Log.IO.error(e, "Konnte Font-Textur nicht laden");
}
if(img != null && (img.getWidth() != XGLYPH * 16 || img.getHeight() != YGLYPH * 16)) {
Log.IO.error("Konnte Font-Textur nicht laden: Größe ist nicht %dx%d", XGLYPH * 16, YGLYPH * 16);
img = null;
}
if(img == null)
throw new IllegalStateException("Konnte erforderliche Schriftart nicht laden");
int[] data = new int[XGLYPH * 16 * YGLYPH * 16];
img.getRGB(0, 0, XGLYPH * 16, YGLYPH * 16, data, 0, XGLYPH * 16);
calculate(data, SIZES, XGLYPH, YGLYPH, 0);
texture = GL11.glGenTextures();
TextureUtil.uploadImage(texture, img);
Log.RENDER.debug("Font-Textur wurde mit ID #%d geladen", texture);
}
public static void unload() {
if(texture != 0) {
GL11.glDeleteTextures(texture);
Log.RENDER.debug("Font-Textur mit ID #%d wurde gelöscht", texture);
texture = 0;
}
}
}

View file

@ -1,329 +0,0 @@
package client.gui;
import java.util.List;
import org.lwjgl.opengl.GL13;
import client.Client;
import client.gui.element.Dropdown;
import client.gui.element.Dropdown.Handle;
import client.gui.element.Element;
import client.renderer.Drawing;
import client.renderer.GlState;
import client.window.Bind;
import client.window.Button;
import client.window.Keysym;
import common.collect.Lists;
public abstract class Gui {
public static final String DIRT_BACKGROUND = "textures/background.png";
public static final int HOVER_COLOR = 0x288080ff;
public static final int PRESS_COLOR = 0x30afafff;
protected final Client gm = Client.CLIENT;
public Element selected;
private int min_x;
private int min_y;
private int max_x;
private int max_y;
public final List<Element> elems = Lists.newArrayList();
public abstract void init(int width, int height);
public abstract String getTitle();
public void updateScreen() {
}
public void onGuiClosed() {
}
public void mouseClicked(int mouseX, int mouseY, int mouseButton) {
}
public void mouseReleased(int mouseX, int mouseY, int state) {
}
public void mouseDragged(int mouseX, int mouseY) {
}
public void drawPost() {
}
// public void drawGuiContainerForegroundLayer() {
// }
//
// public void drawGuiContainerBackgroundLayer() {
// }
public void drawOverlays() {
}
public void useHotbar(int slot) {
}
public void dropItem() {
}
public void drawBackground() {
}
public Element clicked(int x, int y) {
if(this.selected != null && this.selected.visible && (this.selected instanceof Handle) && this.selected.inside(x, y))
return this.selected; // fix (?)
for(Element elem : this.elems) {
if(elem.visible && elem.enabled && elem.inside(x, y))
return elem;
}
return null;
}
public void reformat() {
for(Element elem : this.elems) {
elem.reformat();
}
}
public void deselect() {
if(this.selected != null && !(this.selected instanceof Handle)) {
this.selected.deselect();
this.selected = null;
}
}
public void select(Element elem) {
if(this.selected != elem && !(this.selected instanceof Handle) && !(elem instanceof Handle)) {
if(this.selected != null)
this.selected.deselect();
if(elem != null)
elem.select();
this.selected = elem;
}
}
public void mouse(Button btn, int x, int y, boolean ctrl, boolean shift) {
int prev;
Element elem = this.clicked(x, y);
if(this.selected != null && this.selected != elem && this.selected instanceof Handle) {
this.selected.deselect();
return;
}
else if(this.selected != elem) {
if(this.selected != null)
this.selected.deselect();
if(elem != null)
elem.select();
this.selected = elem;
}
if(elem != null)
elem.mouse(btn, x, y, ctrl, shift);
}
public void mouserel(Button btn, int x, int y) {
if(this.selected != null)
this.selected.mouserel();
}
public void drag(int x, int y) {
if(this.selected != null && (Button.MOUSE_LEFT.isDown() || Button.MOUSE_RIGHT.isDown()))
this.selected.drag(x, y);
}
public void scroll(int scr_x, int scr_y, int x, int y, boolean ctrl, boolean shift) {
Element elem = this.clicked(x, y);
if(elem != null)
elem.scroll(scr_x, scr_y, x, y, ctrl, shift);
}
public void key(Keysym key, boolean ctrl, boolean shift) {
if(this.selected != null)
this.selected.key(key, ctrl, shift);
}
public void character(char code) {
if(this.selected != null)
this.selected.character(code);
}
protected void shift() {
if(this.gm.fb_x != 0 && this.gm.fb_y != 0) {
int shift_x = (this.gm.fb_x - (this.max_x - this.min_x)) / 2 - this.min_x;
int shift_y = (this.gm.fb_y - (this.max_y - this.min_y)) / 2 - this.min_y;
for(Element elem : this.elems) {
elem.shift(shift_x, shift_y);
}
}
}
public void init() {
this.selected = null;
this.min_x = this.min_y = Integer.MAX_VALUE;
this.max_x = this.max_y = Integer.MIN_VALUE;
this.elems.clear();
this.init(this.gm.fb_x, this.gm.fb_y);
}
public void update() {
if(this.selected != null)
this.selected.update();
}
protected <T extends Element> T add(T elem) {
this.elems.add(elem);
elem.setGui(this);
this.min_x = Math.min(this.min_x, elem.getX());
this.min_y = Math.min(this.min_y, elem.getY());
this.max_x = Math.max(this.max_x, elem.getX() + elem.getWidth());
this.max_y = Math.max(this.max_y, elem.getY() + elem.getHeight());
if(elem instanceof Dropdown)
this.add(((Dropdown)elem).getHandle());
return elem;
}
protected Element addSelector(String cvar, int x, int y, int w, int h) {
return this.add(this.gm.getVar(cvar).selector(x, y, w, h));
}
public void draw() {
if(this.selected != null && /* this.selected.r_dirty && */ this.selected instanceof Handle && !this.selected.visible) {
this.selected = null;
}
for(Element elem : this.elems) {
if(/* this.selected != e || */ !(elem instanceof Handle)) // || !e.visible)
elem.draw();
}
if(this.selected != null && /* elem.r_dirty && */ this.selected instanceof Handle && this.selected.visible) {
this.selected.draw();
}
}
public void drawOverlay() {
Element elem = this.selected;
if(Button.isMouseDown() && elem != null && elem.enabled && elem.visible && elem.canClick()) {
elem.drawPress();
return;
}
if(elem != null && elem.enabled && elem.visible)
elem.drawOverlay();
elem = this.clicked(this.gm.mouse_x, this.gm.mouse_y);
if(elem != null && elem.enabled && elem.visible && elem.canHover())
elem.drawHover();
}
// public static void drawRect(int left, int top, int right, int bottom, int color)
// {
// if (left < right)
// {
// int i = left;
// left = right;
// right = i;
// }
//
// if (top < bottom)
// {
// int j = top;
// top = bottom;
// bottom = j;
// }
//
// float f3 = (float)(color >> 24 & 255) / 255.0F;
// float f = (float)(color >> 16 & 255) / 255.0F;
// float f1 = (float)(color >> 8 & 255) / 255.0F;
// float f2 = (float)(color & 255) / 255.0F;
// RenderBuffer worldrenderer = Tessellator.getBuffer();
// GlState.enableBlend();
// GlState.disableTexture2D();
// GlState.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
// GlState.color(f, f1, f2, f3);
// worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
// worldrenderer.pos((double)left, (double)bottom, 0.0D).endVertex();
// worldrenderer.pos((double)right, (double)bottom, 0.0D).endVertex();
// worldrenderer.pos((double)right, (double)top, 0.0D).endVertex();
// worldrenderer.pos((double)left, (double)top, 0.0D).endVertex();
// Tessellator.draw();
// GlState.enableTexture2D();
// GlState.disableBlend();
// }
// public static void drawTexturedModalRect(int x, int y, int textureX, int textureY, int width, int height)
// {
// float f = 0.00390625F;
// float f1 = 0.00390625F;
// RenderBuffer worldrenderer = Tessellator.getBuffer();
// worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
// worldrenderer.pos((double)(x + 0), (double)(y + height), 0.0D).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + height) * f1)).endVertex();
// worldrenderer.pos((double)(x + width), (double)(y + height), 0.0D).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + height) * f1)).endVertex();
// worldrenderer.pos((double)(x + width), (double)(y + 0), 0.0D).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + 0) * f1)).endVertex();
// worldrenderer.pos((double)(x + 0), (double)(y + 0), 0.0D).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + 0) * f1)).endVertex();
// Tessellator.draw();
// }
//
// public static void drawScaledCustomSizeModalRect(int x, int y, float u, float v, int uWidth, int vHeight, int width, int height, float tileWidth, float tileHeight)
// {
// float f = 1.0F / tileWidth;
// float f1 = 1.0F / tileHeight;
// RenderBuffer worldrenderer = Tessellator.getBuffer();
// worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
// worldrenderer.pos((double)x, (double)(y + height), 0.0D).tex((double)(u * f), (double)((v + (float)vHeight) * f1)).endVertex();
// worldrenderer.pos((double)(x + width), (double)(y + height), 0.0D).tex((double)((u + (float)uWidth) * f), (double)((v + (float)vHeight) * f1)).endVertex();
// worldrenderer.pos((double)(x + width), (double)y, 0.0D).tex((double)((u + (float)uWidth) * f), (double)(v * f1)).endVertex();
// worldrenderer.pos((double)x, (double)y, 0.0D).tex((double)(u * f), (double)(v * f1)).endVertex();
// Tessellator.draw();
// }
//
// public static void drawGradientRect(int left, int top, int right, int bottom, int startColor, int endColor)
// {
// float f = (float)(startColor >> 24 & 255) / 255.0F;
// float f1 = (float)(startColor >> 16 & 255) / 255.0F;
// float f2 = (float)(startColor >> 8 & 255) / 255.0F;
// float f3 = (float)(startColor & 255) / 255.0F;
// float f4 = (float)(endColor >> 24 & 255) / 255.0F;
// float f5 = (float)(endColor >> 16 & 255) / 255.0F;
// float f6 = (float)(endColor >> 8 & 255) / 255.0F;
// float f7 = (float)(endColor & 255) / 255.0F;
// GlState.disableTexture2D();
// GlState.enableBlend();
// GlState.disableAlpha();
// GlState.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
// GlState.shadeModel(GL11.GL_SMOOTH);
// RenderBuffer worldrenderer = Tessellator.getBuffer();
// worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
// worldrenderer.pos((double)right, (double)top, 0.0).color(f1, f2, f3, f).endVertex();
// worldrenderer.pos((double)left, (double)top, 0.0).color(f1, f2, f3, f).endVertex();
// worldrenderer.pos((double)left, (double)bottom, 0.0).color(f5, f6, f7, f4).endVertex();
// worldrenderer.pos((double)right, (double)bottom, 0.0).color(f5, f6, f7, f4).endVertex();
// Tessellator.draw();
// GlState.shadeModel(GL11.GL_FLAT);
// GlState.disableBlend();
// GlState.enableAlpha();
// GlState.enableTexture2D();
// }
public void drawMainBackground() {
if(this.gm.world != null && !this.gm.charEditor) {
// Drawing.drawGradient(0, 0, this.fb_x, this.fb_y, this.theWorld == null ? this.style.bg_top : 0x3f202020,
// this.theWorld == null ? this.style.bg_btm : 0x3f000000);
Drawing.drawGradient(0, 0, this.gm.fb_x, this.gm.fb_y, 0xc0101010, 0xd0101010);
}
else {
Drawing.drawScaled(this.gm, DIRT_BACKGROUND);
}
}
public void render() {
this.drawMainBackground();
this.drawBackground();
if(this.gm.fb_x != 0 && this.gm.fb_y != 0)
this.draw();
GlState.bindTexture(0);
GlState.setActiveTexture(GL13.GL_TEXTURE0);
GlState.enableTexture2D();
GlState.disableDepth();
this.drawPost();
GlState.disableDepth();
this.drawOverlays();
if(Bind.isWindowActive())
this.drawOverlay();
}
}

View file

@ -1,45 +0,0 @@
package client.gui;
import client.gui.element.ActButton;
import client.gui.element.ButtonCallback;
import client.gui.element.Label;
import client.gui.element.PressType;
import client.gui.element.TransparentArea;
public class GuiConfirm extends Gui implements ButtonCallback {
public static interface Callback {
void confirm(boolean confirmed);
}
protected Callback callback;
protected String messageLine1;
private String messageLine2;
protected String confirmButtonText;
protected String cancelButtonText;
private ActButton confirmBtn;
private ActButton cancelBtn;
public GuiConfirm(Callback callback, String msg1, String msg2, String msgConfirm, String msgCancel) {
this.callback = callback;
this.messageLine1 = msg1;
this.messageLine2 = msg2;
this.confirmButtonText = msgConfirm;
this.cancelButtonText = msgCancel;
}
public void init(int width, int height) {
this.add(new Label(0, 0, 500, 24, this.messageLine1, true));
this.add(new TransparentArea(0, 80, 500, 300, this.messageLine2, this.gm.world != null && !this.gm.charEditor));
this.confirmBtn = this.add(new ActButton(48, 500, 200, 24, this, this.confirmButtonText));
this.cancelBtn = this.add(new ActButton(252, 500, 200, 24, this, this.cancelButtonText));
this.shift();
}
public String getTitle() {
return "Aktion bestätigen";
}
public void use(ActButton btn, PressType mode) {
this.callback.confirm(btn == this.confirmBtn);
}
}

View file

@ -1,268 +0,0 @@
package client.gui;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Date;
import client.gui.element.ActButton;
import client.gui.element.ButtonCallback;
import client.gui.element.GuiList;
import client.gui.element.ListEntry;
import client.gui.element.NavButton;
import client.gui.element.PressType;
import client.renderer.Drawing;
import common.color.TextColor;
import common.init.Config;
import common.log.Log;
import common.network.IPlayer;
import common.util.FileUtils;
import common.util.Tuple;
import common.util.Util;
public class GuiConnect extends GuiList<GuiConnect.ServerInfo> implements ButtonCallback {
public class ServerInfo implements Comparable<ServerInfo>, ListEntry {
private String name;
private String address;
private int port;
private String user;
private String password;
private String access;
private long lastConnected;
public ServerInfo(String name, String address, int port, String user, String password, String access, long lastConnected) {
this.name = name;
this.address = address;
this.port = port;
this.user = user;
this.password = password;
this.access = access;
this.lastConnected = lastConnected;
}
public String getName() {
return this.name;
}
public String getAddress() {
return this.address;
}
public int getPort() {
return this.port;
}
public String getUser() {
return this.user;
}
public String getPassword() {
return this.password;
}
public String getAccess() {
return this.access;
}
public long getLastConnected() {
return this.lastConnected;
}
public void setData(String name, String address, int port, String user, String password, String access) {
this.name = name;
this.address = address;
this.port = port;
this.user = user;
this.password = password;
this.access = access;
}
public void setLastConnected() {
this.lastConnected = System.currentTimeMillis();
}
public int compareTo(ServerInfo comp) {
return this.lastConnected < comp.lastConnected ? 1 : (this.lastConnected > comp.lastConnected ? -1 : this.name.compareTo(comp.name));
}
public void select(boolean isDoubleClick, int mouseX, int mouseY) {
GuiConnect.this.selectButton.enabled = true;
GuiConnect.this.deleteButton.enabled = true;
GuiConnect.this.editButton.enabled = true;
GuiConnect.this.copyButton.enabled = true;
if(isDoubleClick) {
GuiConnect.this.use(GuiConnect.this.selectButton, PressType.PRIMARY);
}
}
public void draw(int x, int y, int mouseXIn, int mouseYIn, boolean hover) {
Drawing.drawText(this.name + TextColor.GRAY + " - " + TextColor.RESET + this.user, x + 2, y, 0xffffffff);
Drawing.drawText(this.address + TextColor.GRAY + " Port " + TextColor.RESET + this.port, x + 2, y + 18, 0xff808080);
Drawing.drawText("Zuletzt verbunden: " + (this.lastConnected == -1L ? "nie" : DATE_FORMAT.format(new Date(this.lastConnected))), x + 2, y + 18 + 16, 0xff808080);
}
}
public static final GuiConnect INSTANCE = new GuiConnect();
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
private static final File SERVERS_FILE = new File("servers.cfg");
private ActButton deleteButton;
private ActButton selectButton;
private ActButton copyButton;
private ActButton editButton;
private ActButton createButton;
private GuiConnect() {
}
public void init(int width, int height) {
super.init(width, height);
this.setDimensions(width, height, 32, height - 32);
this.elements.clear();
if(SERVERS_FILE.exists()) {
try {
String[] lines = FileUtils.read(SERVERS_FILE).split("\n");
String name = "";
String address = "";
int port = -1;
String user = "";
String password = "";
String access = "";
long time = -1L;
for(int z = 0; z <= lines.length; z++) {
String line = z == lines.length ? null : lines[z];
if(line == null || (line.startsWith("[") && line.endsWith("]"))) {
if(!name.isEmpty() && !address.isEmpty() && !user.isEmpty() && user.length() < IPlayer.MAX_USER_LENGTH && IPlayer.isValidUser(user) && password.length() < IPlayer.MAX_PASS_LENGTH && access.length() < IPlayer.MAX_PASS_LENGTH && address.length() < 128 && name.length() < 128 && port >= 0 && port < 65536)
this.elements.add(new ServerInfo(name, address, port, user, password, access, time));
if(line != null) {
address = "";
port = -1;
user = "";
password = "";
access = "";
time = -1L;
name = line.substring(1, line.length() - 1);
}
}
else {
Tuple<String, String> value = Util.getKeyValue(line);
if(value.first.equals("address"))
address = value.second;
else if(value.first.equals("port"))
try {
port = Integer.parseInt(value.second);
}
catch(NumberFormatException e) {
}
else if(value.first.equals("user"))
user = value.second;
else if(value.first.equals("password"))
password = value.second;
else if(value.first.equals("access"))
access = value.second;
else if(value.first.equals("connected"))
try {
time = Long.parseLong(value.second);
}
catch(NumberFormatException e) {
}
}
}
Collections.sort(this.elements);
}
catch(Exception e) {
Log.IO.error("Konnte Serverliste nicht laden", e);
this.elements.clear();
}
}
this.add(this.selectButton = new ActButton(width / 2 - 383, height - 28, 150, 24, this, "Verbinden"));
this.add(this.createButton = new ActButton(width - 204, 4, 200, 24, this, "Server hinzufügen ..."));
this.add(this.deleteButton = new ActButton(width / 2 - 75, height - 28, 150, 24, this, "Löschen"));
this.add(this.editButton = new ActButton(width / 2 + 79, height - 28, 150, 24, this, "Bearbeiten"));
this.add(this.copyButton = new ActButton(width / 2 - 229, height - 28, 150, 24, this, "Kopieren"));
this.add(new NavButton(width / 2 + 233, height - 28, 150, 24, GuiMenu.INSTANCE, "Abbrechen"));
this.selectButton.enabled = false;
this.deleteButton.enabled = false;
this.editButton.enabled = false;
this.copyButton.enabled = false;
}
public void onGuiClosed() {
this.save();
}
public void applyServer(ServerInfo server) {
if(this.selectedElement < 0)
this.elements.add(server);
this.save();
this.gm.displayGuiScreen(this);
}
private void save() {
try {
StringBuilder sb = new StringBuilder();
for(ServerInfo server : this.elements) {
if(sb.length() > 0)
sb.append("\n");
sb.append("[" + server.getName() + "]\n");
sb.append("address " + server.getAddress() + "\n");
sb.append("port " + server.getPort() + "\n");
sb.append("user " + server.getUser() + "\n");
sb.append("password " + server.getPassword() + "\n");
sb.append("access " + server.getAccess() + "\n");
sb.append("connected " + server.getLastConnected());
}
FileUtils.write(SERVERS_FILE, sb.toString());
}
catch(Exception e) {
Log.IO.error("Konnte Serverliste nicht speichern", e);
}
}
public String getTitle() {
return "Server auswählen";
}
public int getListWidth() {
return 660;
}
public int getSlotHeight() {
return 56;
}
public void use(ActButton button, PressType mode) {
if(button == this.deleteButton) {
if(this.selectedElement >= 0) {
this.elements.remove(this.selectedElement);
this.gm.displayGuiScreen(this);
}
}
else if(button == this.selectButton) {
ServerInfo server = this.getSelected();
if(server != null) {
server.setLastConnected();
this.gm.connect(server.address, server.port, server.user, server.password, server.access);
}
}
else if(button == this.createButton) {
this.setSelected(-1);
this.gm.displayGuiScreen(new GuiServer(new ServerInfo("", "", Config.PORT, "", "", "", -1L)));
}
else if(button == this.editButton) {
ServerInfo server = this.getSelected();
if(server != null)
this.gm.displayGuiScreen(new GuiServer(server));
}
else if(button == this.copyButton) {
ServerInfo server = this.getSelected();
if(server != null) {
this.setSelected(-1);
this.gm.displayGuiScreen(new GuiServer(new ServerInfo(server.name, server.address, server.port, server.user, server.password, server.access, -1L)));
}
}
}
}

View file

@ -1,135 +0,0 @@
package client.gui;
import client.gui.element.NavButton;
import client.gui.element.TransparentArea;
import common.color.TextColor;
import common.init.Config;
import common.log.Log;
public class GuiInfo extends Gui {
private static final String VER =
TextColor.GREEN + "" + TextColor.BUG + "" + TextColor.BUG + "" + TextColor.BUG + " " + TextColor.VIOLET + "" + Config.CLIENT_VERSION + "" +
TextColor.GREEN + " " + TextColor.BUG + "" + TextColor.BUG + "" + TextColor.BUG;
private static final String INFO = "Ein Spiel zur Simulation, zum Testen, für Rollenspiele, Mehrspieler und vieles mehr." + "\n" +
"Optimiert für Geschwindigkeit, Stabilität und" + TextColor.UNKNOWN + "" + TextColor.UNKNOWN + " [Speicherzugriffsfehler]";
private static final String HACKED = "Ein weiterer Release von WAAAAAAAAAAAAAAAAAAAAAAAAAAAAGHDRIVE!!!1!!!ONEoneOnetyone!1!!!" + "\n" +
"Update 0.2 - Läuft jetzt auch mit nur 512KB Fast-RAM!";
private static final String[] LIBRARIES = {
"LWJGL 3.3.6+1 (GLFW + OpenGL)",
"Netty 4.1.119-Final"
};
private static final String[] CODE = {
"Albert Pham - WorldEdit (Snippets)",
"Joonas Vali - NameGenerator",
"LWJGL 2.9.4-nightly-20150209 - Project, Vector*, Matrix*",
"Guava 17.0 - collect, future, Predicates",
"JOrbis 20101023 (JCraft) - jogg, jorbis, CodecJOrbis",
"MC 1.8.9"
};
public static final GuiInfo INSTANCE = new GuiInfo("Über dieses Programm", getFormat(false));
public static final GuiInfo HAX = new GuiInfo("Üb3r d1es3n Cr4ck", getFormat(true));
private final String header;
private final String info;
private static String getFormat(boolean hax) {
return getInfo(hax) + "\n\n" + getCredits(hax) + "\n\n" + getLibraries(hax) + "\n\n" + getCode(hax) + "\n\n" + getOldCredits(hax) + "\n\n" + getColors();
}
private static String getHeader(boolean hax, String normal, String hacked) {
return (hax ? TextColor.RED : TextColor.YELLOW) + (hax ? hacked : normal) + "\n" +
(hax ? TextColor.CYAN : TextColor.WHITE) + "==========================================+==========================================";
}
private static void addLines(StringBuilder sb, boolean hax, String alternate, String category, String... authors) {
sb.append("\n" + (hax ? TextColor.BLUE : TextColor.GRAY)
+ (hax ? alternate : category) + "\n ");
for(int z = 0; z < authors.length; z++) {
if(z > 0)
sb.append((hax ? TextColor.VIOLET : TextColor.GRAY) + ", ");
sb.append((hax ? TextColor.DVIOLET : TextColor.WHITE) + authors[z]);
}
}
private static String getInfo(boolean hax) {
return getHeader(hax, VER, VER) + "\n" + (hax ? (TextColor.VIOLET + HACKED) : (TextColor.LGRAY + INFO));
}
private static String getLibraries(boolean hax) {
StringBuilder sb = new StringBuilder(getHeader(hax, "Verwendete Programmbibliotheken", "U$3d 3xpl0its"));
for(String lib : LIBRARIES) {
sb.append("\n" + TextColor.LGRAY + "-> " + TextColor.NEON + lib);
}
return sb.toString();
}
private static String getCode(boolean hax) {
StringBuilder sb = new StringBuilder(getHeader(hax, "Zusätzlicher Quellcode", "M0ar 3xpl01ts"));
for(String lib : CODE) {
sb.append("\n" + TextColor.LGRAY + "-> " + TextColor.NEON + lib);
}
return sb.toString();
}
private static String getColors() {
StringBuilder sb = new StringBuilder();
int num = 0;
for(TextColor color : TextColor.values()) {
if(num > 0)
sb.append(' ');
if((color.code >= Log.CHR_COLORS1 && color.code <= Log.CHR_COLORE1) || (color.code >= Log.CHR_COLORS2 && color.code <= Log.CHR_COLORE2)) {
sb.append(color + "#" + (char)(num < 10 ? ('0' + num) : ('A' + (num - 10))));
num++;
}
}
return sb.toString();
}
private static String getOldCredits(boolean hax) {
StringBuilder sb = new StringBuilder(getHeader(hax, "Ursprüngliche Mitwirkende", "Das Team -- Nicht TCQ"));
addLines(sb, hax, "Absolut größter Lamer des Universums", "Spielidee und ursprüngliche Umsetzung",
"Markus Persson");
addLines(sb, hax, "Crack und weitere Programmierung", "Spiel-Design, Programmierung und Grafiken",
"Jens Bergensten", "Nathan Adams", "Ryan Holtz", "Michael Stoyke");
addLines(sb, hax, "Entschlüsselung von Ressourcen", "Programmierung",
"Erik Broes", "Paul Spooner", "Ryan Hitchman", "Elliot Segal");
addLines(sb, hax, "Cracktro, Grafiken und Intromusik", "Töne und Geräusche",
"Daniel Rosenfeld", "freesound.org");
addLines(sb, hax, "Packing und Verbreitung", "Management, Administration und Spaß",
"Carl Manneh", "Daniel Kaplan", "Lydia Winters");
addLines(sb, hax, "Server und Hosting", "Zahlen und Statistiken",
"Patrick Geuder");
addLines(sb, hax, "Weiterer Dank und Grüße", "Entwickler von Mo' Creatures (Pferde usw.)",
"John Olarte", "Kent Christian Jensen", "Dan Roque");
return sb.toString();
}
private static String getCredits(boolean hax) {
StringBuilder sb = new StringBuilder(getHeader(hax, "Mitwirkende dieses Programms", "Das Team -- TCQ"));
addLines(sb, hax, "Die dunklen Herrscher", "Quellcode, Design, Grafiken, Refactoring und Code-Cleanup",
TextColor.CYAN + "Sen der \"kleine\" Dämon " + TextColor.CRIMSON + TextColor.DEMON + TextColor.BLACK + TextColor.BLKHEART,
TextColor.RED + "Shen, Herrscher des Schattenlandes " + TextColor.CRIMSON + TextColor.IMP);
return sb.toString();
}
public GuiInfo(String header, String info) {
this.header = header;
this.info = info;
}
public void init(int width, int height) {
this.add(new TransparentArea(10, 10, width - 20, height - 44, this.info, this.gm.world != null && !this.gm.charEditor));
this.add(new NavButton(0, height - 24, width, 24, GuiMenu.INSTANCE, "Zurück"));
}
public String getTitle() {
return this.header;
}
}

View file

@ -1,301 +0,0 @@
package client.gui;
import client.Timing;
import client.gui.character.GuiChar;
import client.gui.character.GuiCharacters;
import client.gui.element.ActButton;
import client.gui.element.ButtonCallback;
import client.gui.element.Label;
import client.gui.element.NavButton;
import client.gui.element.PressType;
import client.gui.options.GuiOptions;
import client.renderer.Drawing;
import client.window.Keysym;
import common.color.TextColor;
import common.init.Config;
import common.rng.Random;
import common.util.ExtMath;
public class GuiMenu extends Gui {
public static final GuiMenu INSTANCE = new GuiMenu();
private GuiMenu() {
}
public void drawMainBackground() {
if(this.gm.world != null)
super.drawMainBackground();
else
this.gm.renderGlobal.renderStarField(this.gm.fb_x, this.gm.fb_y, 0x000000, 0xffffff, (float)this.ticks + (float)Timing.tick_fraction, this.rand);
}
private final Random rand = new Random();
private Label splashLabel;
private ActButton infoButton;
private int ticks;
private int hacked;
private int animWidth = 32;
private int animGrowth = 10;
private int[] animGrow = new int[this.animWidth];
private String animStr = "";
private String animBack = "";
private int animPos;
private int animLen;
private int animDir;
private boolean animStep;
public void init(int width, int height) {
if(this.gm.world == null) {
this.ticks = 0;
this.hacked = 0;
this.resetAnimation();
this.add(new ActButton(0, -28, 400, 24, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
if(GuiMenu.this.hacked == 9) {
GuiMenu.this.hacked++;
GuiMenu.this.splashLabel.setText(TextColor.VIOLET + "Hax!");
}
else {
GuiMenu.this.gm.displayGuiScreen(GuiConnect.INSTANCE);
}
}
}, "Server beitreten"));
this.add(new NavButton(0, 0, 400, 24, GuiServer.INSTANCE, "Schnellverbindung"));
this.add(new ActButton(0, 28, 400, 24, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
if(GuiMenu.this.hacked == 8)
GuiMenu.this.hacked++;
else
GuiMenu.this.gm.displayGuiScreen(GuiOptions.getPage());
}
}, "Einstellungen"));
this.infoButton = this.add(new ActButton(0, 56, 400, 24, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
GuiMenu.this.gm.displayGuiScreen(GuiMenu.this.hacked == 10 ? GuiInfo.HAX : GuiInfo.INSTANCE);
}
}, "Info / Über / Mitwirkende") {
public void drawHover() {
if(GuiMenu.this.hacked == 10) {
Drawing.drawRect(this.pos_x, this.pos_y, this.size_x, this.size_y, 0x287f00ff);
GuiMenu.this.rand.setSeed(((long)this.gm.mouse_x * 7652657L) ^ ((long)this.gm.mouse_y * 87262826276L));
int width = Drawing.getWidth("Hax!");
for(int z = 0; z < 64; z++) {
Drawing.drawText("Hax!", GuiMenu.this.rand.zrange(Math.max(1, this.gm.fb_x - width)) +
(int)(ExtMath.sin(((float)(GuiMenu.this.ticks + GuiMenu.this.rand.zrange(256)) + (float)Timing.tick_fraction) / 100.0f * (float)Math.PI * 2.0f) * 16.0f),
GuiMenu.this.rand.zrange(Math.max(1, this.gm.fb_y - Font.YGLYPH)) +
(int)(ExtMath.sin(((float)(GuiMenu.this.ticks + GuiMenu.this.rand.zrange(256)) + (float)Timing.tick_fraction) / 100.0f * (float)Math.PI * 2.0f) * 16.0f),
0xff0000ff | (GuiMenu.this.rand.zrange(256) << 16));
}
}
else {
super.drawHover();
}
}
});
this.add(new ActButton(0, 102, 400, 24, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
GuiMenu.this.gm.interrupted = true;
}
}, "Client schließen"));
this.shift();
this.add(new Label(4, /* this.gm.fb_y - 2 */ 0, 200, 20, TextColor.VIOLET + Config.CLIENT_VERSION, true));
this.splashLabel = this.add(new Label(0, 160, width, 24, ""));
this.pickSplash();
}
else {
this.add(new NavButton(0, 0, 400, 24, this.gm.charEditor ? GuiChar.INSTANCE : null, this.gm.charEditor ? "Zurück zum Charakter-Editor" : "Zurück zum Spiel"));
this.add(new NavButton(0, 28, this.gm.charEditor ? 400 : 198, 24, GuiOptions.getPage(), "Einstellungen"));
if(!this.gm.charEditor)
this.add(new NavButton(202, 28, 198, 24, GuiCharacters.INSTANCE, "Charakter"));
this.add(new ActButton(0, 102, 400, 24, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
GuiMenu.this.gm.unload(true);
// GuiMenu.this.gm.displayGuiScreen(INSTANCE);
}
}, "Server verlassen und Verbindung trennen"));
this.shift();
}
}
public String getTitle() {
return this.gm.world == null ? "Hauptmenü" : "Menü";
}
private void pickSplash() {
this.splashLabel.setText(TextColor.VIOLET + this.rand.pick(Splashes.SPLASHES));
}
private void resetAnimation() {
this.animStr = "";
this.animBack = "";
this.animPos = 0;
this.animLen = 0;
this.animDir = 0;
this.animStep = false;
this.animWidth = Math.max(5, (this.gm.fb_x - 5) / 10);
this.animGrowth = this.animWidth / 15;
this.animGrow = new int[this.animWidth];
}
private void updateAnimation() {
if(this.animLen == 0) {
this.animDir = this.rand.zrange(3) - 1;
this.animLen = this.animDir == 0 ? (2 + this.rand.zrange(2)) : (8 + this.rand.zrange(96));
}
else {
this.animPos += this.animDir;
if(this.animPos == -1) {
this.animPos = 0;
this.animDir = 1;
}
else if(this.animPos == this.animWidth - 3) {
this.animPos = this.animWidth - 4;
this.animDir = -1;
}
this.animLen--;
}
this.animStep = !this.animStep;
StringBuilder sb = new StringBuilder(11);
sb.append(TextColor.GRAY);
sb.append("[");
sb.append(TextColor.YELLOW);
switch(this.animDir) {
case -1:
sb.append((this.animStep ? '>' : '-') + "' ");
break;
case 0:
sb.append("`" + (this.animStep ? 'O' : 'o') + "'");
break;
case 1:
sb.append(" `" + (this.animStep ? '<' : '-'));
break;
}
sb.append(TextColor.GRAY);
sb.append("]");
this.animStr = sb.toString();
for(int z = this.animPos; z < this.animPos + 4; z++) {
this.animGrow[z] = 0;
}
for(int z = 0; z < this.animGrowth; z++) {
this.animGrow[this.rand.zrange(this.animWidth)] += 1;
}
sb = new StringBuilder(this.animWidth + 2);
sb.append(TextColor.DGREEN);
for(int z = 0; z < this.animWidth; z++) {
switch(this.animGrow[z] / 5) {
case 0:
sb.append(TextColor.BLACK);
break;
case 1:
sb.append(TextColor.GRAY);
break;
case 2:
case 3:
sb.append(TextColor.LGRAY);
break;
case 4:
case 5:
case 6:
sb.append(TextColor.WHITE);
break;
case 7:
case 8:
case 9:
case 10:
sb.append(TextColor.MAGENTA);
break;
case 11:
case 12:
case 13:
case 14:
case 15:
sb.append(TextColor.DVIOLET);
break;
default:
sb.append(TextColor.VIOLET);
break;
}
sb.append(",.");
}
this.animBack = sb.toString();
}
public void updateScreen() {
if(this.gm.world == null) {
this.ticks++;
if(this.gm.shift())
this.pickSplash();
this.updateAnimation();
}
}
public void key(Keysym key, boolean ctrl, boolean shift) {
super.key(key, ctrl, shift);
if(this.gm.world == null) {
if((key == Keysym.UP || key == Keysym.W) && (this.hacked == 0 || this.hacked == 1))
this.hacked++;
else if((key == Keysym.DOWN || key == Keysym.S) && (this.hacked == 2 || this.hacked == 3))
this.hacked++;
else if((key == Keysym.LEFT || key == Keysym.A) && (this.hacked == 4 || this.hacked == 6))
this.hacked++;
else if((key == Keysym.RIGHT || key == Keysym.D) && (this.hacked == 5 || this.hacked == 7))
this.hacked++;
else
this.hacked = 0;
}
}
/*
protected void actionPerformed(Button button) throws IOException {
if(button.id == 2 && this.hacked == 8) {
this.hacked++;
return;
}
else if(button.id == 1 && this.hacked == 9) {
this.hacked++;
return;
}
if(button.id != 3 || this.hacked != 10)
this.hacked = 0;
switch(button.id) {
case 0:
this.gm.displayGuiScreen(new GuiOptions(this));
break;
case 1:
this.gm.displayGuiScreen(new GuiWorlds(this));
break;
case 2:
this.gm.displayGuiScreen(new GuiMultiplayer(this));
break;
case 3:
if(this.hacked == 10)
Log.info("Hax!");
this.gm.displayGuiScreen(new GuiCredits(this.hacked == 10));
this.hacked = 0;
break;
// case 4:
// this.gm.displayGuiScreen(new GuiLanguage());
// break;
case 4:
this.gm.shutdown();
break;
}
}
*/
public void drawOverlays() {
super.drawOverlays();
if(this.gm.world == null) {
int y = 164;
int h = 16;
int n = Drawing.getWidth(this.splashLabel.getText());
Drawing.drawRect(0, y, this.gm.fb_x / 2 - n / 2 - 10, h, 0x7f7f00ff);
Drawing.drawRect(this.gm.fb_x / 2 + n / 2 + 10, y, this.gm.fb_x - (this.gm.fb_x / 2 + n / 2 + 10), h, 0x7f7f00ff);
Drawing.drawText(this.animBack, this.gm.fb_x - Drawing.getWidth(this.animBack), this.gm.fb_y - 18, 0xffffffff);
Drawing.drawText(this.animStr, this.gm.fb_x - Drawing.getWidth(this.animStr) - 3 - ((this.animWidth - this.animPos - 4) * 10), this.gm.fb_y - 20, 0xffffffff);
}
}
}

View file

@ -1,149 +0,0 @@
package client.gui;
import client.gui.GuiConnect.ServerInfo;
import client.gui.element.ActButton;
import client.gui.element.ButtonCallback;
import client.gui.element.Label;
import client.gui.element.NavButton;
import client.gui.element.PressType;
import client.gui.element.FieldAction;
import client.gui.element.Field;
import client.gui.element.FieldCallback;
import client.vars.CVarCategory;
import client.vars.Variable;
import common.color.TextColor;
import common.init.Config;
import common.network.IPlayer;
public class GuiServer extends Gui implements FieldCallback {
public static final GuiServer INSTANCE = new GuiServer(null);
private final ServerInfo server;
private Field nameBox;
private Field addrBox;
private Field portBox;
private Field userBox;
private Field passBox;
private Field accBox;
private Label nameLabel;
private Label addrLabel;
private Label portLabel;
private Label userLabel;
private Label passLabel;
private Label accLabel;
public GuiServer(ServerInfo server) {
this.server = server;
}
@Variable(name = "srv_last_address", category = CVarCategory.SYSTEM, min = 1, max = 128, display = "Letzte Server-Adresse")
private String lastAddr = "";
@Variable(name = "srv_last_port", category = CVarCategory.SYSTEM, min = 0, max = 65535, display = "Letzter Server-Port")
private int lastPort = Config.PORT;
@Variable(name = "srv_last_user", category = CVarCategory.SYSTEM, max = IPlayer.MAX_USER_LENGTH, display = "Letzter Server-Nutzer", validator = IPlayer.UserValidator.class)
private String lastUser = "";
@Variable(name = "srv_last_password", category = CVarCategory.SYSTEM, max = IPlayer.MAX_PASS_LENGTH, display = "Letztes Server-Passwort")
private String lastPass = "";
@Variable(name = "srv_last_access", category = CVarCategory.SYSTEM, max = IPlayer.MAX_PASS_LENGTH, display = "Letzter Server-Zugang")
private String lastAcc = "";
public void init(int width, int height) {
if(this.server != null)
this.nameBox = this.add(new Field(0, -50, 400, 24, 128, this, this.server.getName()));
this.addrBox = this.add(new Field(0, 20, 400, 24, 128, this, this.server == null ? this.lastAddr : this.server.getAddress()));
this.portBox = this.add(new Field(404, 20, 76, 24, 5, this, "" + (this.server == null ? this.lastPort : this.server.getPort())));
this.userBox = this.add(new Field(0, 70, 220, 24, IPlayer.MAX_USER_LENGTH, this, IPlayer.VALID_USER, this.server == null ? this.lastUser : this.server.getUser()));
this.passBox = this.add(new Field(0, 120, 480, 24, IPlayer.MAX_PASS_LENGTH, this, this.server == null ? this.lastPass : this.server.getPassword()));
this.accBox = this.add(new Field(0, 170, 480, 24, IPlayer.MAX_PASS_LENGTH, this, this.server == null ? this.lastAcc : this.server.getAccess()));
this.add(new ActButton(0, 220, 480, 24, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
GuiServer.this.connect();
}
}, this.server == null ? "Verbinden" : (this.server.getName().isEmpty() ? "Hinzufügen" : "Übernehmen")));
this.add(new NavButton(0, 250, 480, 24, this.server != null ? GuiConnect.INSTANCE : GuiMenu.INSTANCE, "Zurück"));
if(this.server != null)
this.nameLabel = this.add(new Label(0, -70, 410, 20, "Name", true));
this.addrLabel = this.add(new Label(0, 0, 410, 20, "Adresse", true));
this.portLabel = this.add(new Label(414, 0, 66, 20, "Port", true));
this.userLabel = this.add(new Label(0, 50, 220, 20, "Nutzer", true));
this.passLabel = this.add(new Label(0, 100, 480, 20, "Passwort", true));
this.accLabel = this.add(new Label(0, 150, 480, 20, "Zugang", true));
this.shift();
}
public String getTitle() {
return this.server == null ? "Mit Server verbinden" : (this.server.getName().isEmpty() ? "Server hinzufügen" : "Server bearbeiten");
}
private void connect() {
if(this.gm.world != null)
return;
String name = null;
if(this.server != null) {
name = this.nameBox.getText();
if(name.isEmpty()) {
this.nameLabel.setText(TextColor.RED + "Name");
return;
}
}
String addr = this.addrBox.getText();
if(addr.isEmpty()) {
this.addrLabel.setText(TextColor.RED + "Adresse");
return;
}
int port = -1;
if(this.portBox.getText().isEmpty()) {
this.portLabel.setText(TextColor.RED + "Port");
return;
}
else {
try {
port = Integer.parseInt(this.portBox.getText());
}
catch(NumberFormatException e) {
}
if(port < 0 || port > 65535) {
this.portLabel.setText(TextColor.RED + "Port");
return;
}
}
String user = this.userBox.getText();
if(user.isEmpty()) {
this.userLabel.setText(TextColor.RED + "Nutzer");
return;
}
String pass = this.passBox.getText();
String acc = this.accBox.getText();
if(this.server == null) {
this.lastAddr = addr;
this.lastPort = port;
this.lastUser = user;
this.lastPass = pass;
this.lastAcc = acc;
this.gm.setDirty();
this.gm.connect(addr, port, user, pass, acc);
}
else {
this.server.setData(name, addr, port, user, pass, acc);
GuiConnect.INSTANCE.applyServer(this.server);
}
}
public void use(Field elem, FieldAction value) {
if(value == FieldAction.SEND) {
elem.setDeselected();
this.connect();
}
else if(value == FieldAction.FOCUS) {
if(elem == this.addrBox)
this.addrLabel.setText("Adresse");
else if(elem == this.portBox)
this.portLabel.setText("Port");
else if(elem == this.userBox)
this.userLabel.setText("Nutzer");
else if(this.server != null && elem == this.nameBox)
this.nameLabel.setText("Name");
}
}
}

View file

@ -1,123 +0,0 @@
package client.gui.character;
import client.gui.GuiConfirm;
import client.gui.GuiMenu;
import client.gui.element.ActButton;
import client.gui.element.ButtonCallback;
import client.gui.element.GuiList;
import client.gui.element.ListEntry;
import client.gui.element.NavButton;
import client.gui.element.PressType;
import client.gui.element.TransparentArea;
import client.renderer.Drawing;
import common.color.TextColor;
import common.entity.npc.PlayerCharacter;
import common.packet.CPacketAction;
public class GuiCharacters extends GuiList<GuiCharacters.CharacterEntry> implements ButtonCallback
{
protected class CharacterEntry implements ListEntry
{
private final PlayerCharacter character;
private final boolean initial;
protected CharacterEntry(PlayerCharacter character, boolean initial)
{
this.character = character;
this.initial = initial;
}
public void draw(int x, int y, int mouseX, int mouseY, boolean hovered)
{
if(this.initial)
Drawing.drawRect(x, y, 1, 36, 0xffaf0000);
String str = this.character == null ? TextColor.BLUE + "[" + TextColor.CYAN + "+" + TextColor.BLUE + "]" :
String.format(TextColor.GREEN + "Level " + TextColor.DGREEN + "%d " + TextColor.YELLOW + "%s " + TextColor.VIOLET + "%s" + TextColor.GRAY + " [%s%s" + TextColor.GRAY + "]",
character.level, character.type, character.name, character.align.color, character.align.display);
String pos = this.character == null ? TextColor.BROWN + "Neuen Charakter erstellen" :
String.format(TextColor.NEON + "%s " + TextColor.GRAY + "bei " + TextColor.ACID + "%d" + TextColor.GRAY + ", " + TextColor.ACID + "%d" + TextColor.GRAY + ", " + TextColor.ACID + "%d",
character.dim, character.pos.getX(), character.pos.getY(), character.pos.getZ());
Drawing.drawText(str, x + 3, y, 0xffffffff);
Drawing.drawText(pos, x + 3, y + 16, 0xffffffff);
}
public void select(boolean dclick, int mx, int my)
{
if(dclick)
GuiCharacters.this.use(GuiCharacters.this.actionButtom, PressType.PRIMARY);
GuiCharacters.this.updateButtons();
}
}
public static final GuiCharacters INSTANCE = new GuiCharacters();
private TransparentArea descField;
private ActButton actionButtom;
private ActButton deleteButtom;
private GuiCharacters() {
}
private void updateButtons() {
CharacterEntry entry = this.getSelected();
this.descField.setText(entry == null ? "" : (entry.character == null ? "*neuer Charakter*" : (entry.character.info == null ? "*keine Beschreibung vorhanden*" : this.getSelected().character.info)));
this.actionButtom.setText(entry != null && entry.character == null ? "Charakter erstellen" : "Charakter spielen");
this.actionButtom.enabled = entry != null && !entry.initial;
this.deleteButtom.enabled = entry != null && entry.character != null && !entry.initial;
}
public void init(int width, int height)
{
super.init(width, height);
this.setDimensions(600, height, 32, height - 32);
this.elements.clear();
if(this.gm.getNetHandler() != null) {
int initialSelection = this.gm.getNetHandler().getSelectedCharacter();
for(PlayerCharacter character : this.gm.getNetHandler().getCharacterList()) {
this.elements.add(new CharacterEntry(initialSelection == this.elements.size() ? new PlayerCharacter(character.name, character.info, character.align, this.gm.player.worldObj.dimension.getFormattedName(false), this.gm.player.getPosition(), character.type, this.gm.player.experienceLevel) : character, initialSelection == this.elements.size()));
}
this.elements.add(new CharacterEntry(null, false));
this.setSelected(initialSelection);
}
this.descField = this.add(new TransparentArea(width - 390, 62, 380, height - 124, "", false));
this.deleteButtom = this.add(new ActButton(width / 2 - 304, height - 28, 200, 24, this, "Charakter löschen"));
this.actionButtom = this.add(new ActButton(width / 2 - 100, height - 28, 200, 24, this, ""));
this.add(new NavButton(width / 2 + 104, height - 28, 200, 24, GuiMenu.INSTANCE, "Abbrechen"));
this.updateButtons();
}
public String getTitle() {
return "Charakter anpassen";
}
public int getListWidth()
{
return 560;
}
public int getSlotHeight()
{
return 36 + 4;
}
public void use(ActButton elem, PressType action) {
CharacterEntry entry = GuiCharacters.this.getSelected();
if(entry != null && GuiCharacters.this.gm.getNetHandler() != null) {
if(elem == this.actionButtom) {
if(entry.character == null)
this.gm.getNetHandler().addToSendQueue(new CPacketAction(CPacketAction.Action.OPEN_EDITOR));
else
this.gm.getNetHandler().addToSendQueue(new CPacketAction(CPacketAction.Action.SELECT_CHARACTER, this.selectedElement));
}
else if(elem == this.deleteButtom && entry.character != null) {
this.gm.displayGuiScreen(new GuiConfirm(new GuiConfirm.Callback() {
public void confirm(boolean confirmed) {
if(confirmed)
GuiCharacters.this.gm.getNetHandler().addToSendQueue(new CPacketAction(CPacketAction.Action.DELETE_CHARACTER, GuiCharacters.this.selectedElement));
GuiCharacters.this.gm.displayGuiScreen(GuiCharacters.this);
}
}, "Möchtest du diesen Charakter wirklich löschen?", "Der Fortschritt, die Gegenstände und die Historie von \"" + entry.character.name + "\" werden für imer verloren sein!", "Löschen", "Abbrechen"));
}
}
}
}

View file

@ -1,50 +0,0 @@
package client.gui.container;
import common.inventory.ContainerBrewingStand;
import common.inventory.IInventory;
import common.inventory.InventoryPlayer;
public class GuiBrewing extends GuiContainer
{
// private static final String brewingStandGuiTextures = "textures/gui/brewing_stand.png";
/** The player inventory bound to this GUI. */
private final InventoryPlayer playerInventory;
private IInventory tileBrewingStand;
public GuiBrewing(InventoryPlayer playerInv, IInventory p_i45506_2_)
{
super(new ContainerBrewingStand(playerInv, p_i45506_2_));
this.playerInventory = playerInv;
this.tileBrewingStand = p_i45506_2_;
}
/**
* Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY
*/
public void drawGuiContainerForegroundLayer()
{
String s = this.tileBrewingStand.getCommandName();
this.drawString(s, 8, 6);
this.drawString(this.playerInventory.getCommandName(), 8, this.ySize - 96 + 2);
}
/**
* Args : renderPartialTicks, mouseX, mouseY
*/
public void drawGuiContainerBackgroundLayer()
{
int k = this.tileBrewingStand.getField(0);
if (k > 0)
{
int l = (int)(28.0F * (1.0F - (float)k / 400.0F));
if (l > 0)
{
this.rect(97, 16, 9, l, 0xffff20);
}
}
}
}

View file

@ -1,53 +0,0 @@
package client.gui.container;
import client.Client;
import common.inventory.ContainerChest;
import common.inventory.IInventory;
public class GuiChest extends GuiContainer
{
// /** The ResourceLocation containing the chest GUI texture. */
// private static final String CHEST_GUI_TEXTURE = "textures/gui/generic_54.png";
private IInventory upperChestInventory;
private IInventory lowerChestInventory;
/**
* window height is calculated with these values; the more rows, the heigher
*/
private int inventoryRows;
public GuiChest(IInventory upperInv, IInventory lowerInv)
{
super(new ContainerChest(upperInv, lowerInv, Client.CLIENT.player));
this.upperChestInventory = upperInv;
this.lowerChestInventory = lowerInv;
// this.allowUserInput = false;
int i = 222;
int j = i - 108;
this.inventoryRows = lowerInv.getSizeInventory() / 9;
this.ySize = j + this.inventoryRows * 18;
}
/**
* Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY
*/
public void drawGuiContainerForegroundLayer()
{
this.drawString(this.lowerChestInventory.getCommandName(), 8, 6);
this.drawString(this.upperChestInventory.getCommandName(), 8, this.ySize - 96 + 2);
}
/**
* Args : renderPartialTicks, mouseX, mouseY
*/
// protected void drawGuiContainerBackgroundLayer(int mouseX, int mouseY)
// {
// GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
// this.gm.getTextureManager().bindTexture(CHEST_GUI_TEXTURE);
// int i = (this.width - this.xSize) / 2;
// int j = (this.height - this.ySize) / 2;
//// this.rect(i, j, 0, 0, this.xSize, this.inventoryRows * 18 + 17);
//// this.rect(i, j + this.inventoryRows * 18 + 17, 0, 126, this.xSize, 96);
// }
}

File diff suppressed because it is too large Load diff

View file

@ -1,42 +0,0 @@
package client.gui.container;
import common.inventory.ContainerWorkbench;
import common.inventory.InventoryPlayer;
import common.util.BlockPos;
import common.world.World;
public class GuiCrafting extends GuiContainer
{
// private static final String craftingTableGuiTextures = "textures/gui/crafting_table.png";
public GuiCrafting(InventoryPlayer playerInv, World worldIn)
{
this(playerInv, worldIn, BlockPos.ORIGIN);
}
public GuiCrafting(InventoryPlayer playerInv, World worldIn, BlockPos blockPosition)
{
super(new ContainerWorkbench(playerInv, worldIn, blockPosition));
}
/**
* Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY
*/
public void drawGuiContainerForegroundLayer()
{
this.drawString("Handwerk", 28, 6);
this.drawString("Inventar", 8, this.ySize - 96 + 2);
}
// /**
// * Args : renderPartialTicks, mouseX, mouseY
// */
// protected void drawGuiContainerBackgroundLayer(int mouseX, int mouseY)
// {
// GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
// this.gm.getTextureManager().bindTexture(craftingTableGuiTextures);
// int i = (this.width - this.xSize) / 2;
// int j = (this.height - this.ySize) / 2;
//// this.rect(i, j, 0, 0, this.xSize, this.ySize);
// }
}

View file

@ -1,46 +0,0 @@
package client.gui.container;
import common.inventory.ContainerDispenser;
import common.inventory.IInventory;
import common.inventory.InventoryPlayer;
public class GuiDispenser extends GuiContainer
{
// private static final String dispenserGuiTextures = "textures/gui/dispenser.png";
/** The player inventory bound to this GUI. */
private final InventoryPlayer playerInventory;
/** The inventory contained within the corresponding Dispenser. */
public IInventory dispenserInventory;
public GuiDispenser(InventoryPlayer playerInv, IInventory dispenserInv)
{
super(new ContainerDispenser(playerInv, dispenserInv));
this.playerInventory = playerInv;
this.dispenserInventory = dispenserInv;
}
/**
* Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY
*/
public void drawGuiContainerForegroundLayer()
{
String s = this.dispenserInventory.getCommandName();
this.drawString(s, 8, 6);
this.drawString(this.playerInventory.getCommandName(), 8, this.ySize - 96 + 2);
}
// /**
// * Args : renderPartialTicks, mouseX, mouseY
// */
// protected void drawGuiContainerBackgroundLayer(int mouseX, int mouseY)
// {
// GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
// this.gm.getTextureManager().bindTexture(dispenserGuiTextures);
// int i = (this.width - this.xSize) / 2;
// int j = (this.height - this.ySize) / 2;
//// this.rect(i, j, 0, 0, this.xSize, this.ySize);
// }
}

View file

@ -1,288 +0,0 @@
package client.gui.container;
import common.color.TextColor;
import common.enchantment.Enchantment;
import common.inventory.ContainerEnchantment;
import common.inventory.InventoryPlayer;
import common.rng.Random;
import common.tileentity.IWorldNameable;
import common.world.World;
public class GuiEnchant extends GuiContainer
{
/** The ResourceLocation containing the Enchantment GUI texture location */
// private static final String ENCHANTMENT_TABLE_GUI_TEXTURE = "textures/gui/enchanting_table.png";
private static final String[] NAMES = "the elder scrolls klaatu berata niktu xyzzy bless curse light darkness fire air earth water hot dry cold wet ignite snuff embiggen twist shorten stretch fiddle destroy imbue galvanize enchant free limited range of towards inside sphere cube self other ball mental physical grow shrink demon elemental spirit animal creature beast humanoid undead fresh stale ".split(" ");
/** The player inventory currently bound to this GuiEnchantment instance. */
private final InventoryPlayer playerInventory;
private final Random nameRand = new Random();
private final Random random = new Random();
private final ContainerEnchantment container;
private final IWorldNameable table;
// public int field_147073_u;
// public float field_147071_v;
// public float field_147069_w;
// public float field_147082_x;
// public float field_147081_y;
// public float field_147080_z;
// public float field_147076_A;
// ItemStack field_147077_B;
public GuiEnchant(InventoryPlayer inventory, World worldIn, IWorldNameable table)
{
super(new ContainerEnchantment(inventory, worldIn));
this.playerInventory = inventory;
this.container = (ContainerEnchantment)this.inventorySlots;
this.table = table;
}
/**
* Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY
*/
public void drawGuiContainerForegroundLayer()
{
this.drawString(this.table.getCommandName(), 12, 5);
this.drawString(this.playerInventory.getCommandName(), 8, this.ySize - 96 + 2);
}
// /**
// * Called from the main game loop to update the screen.
// */
// public void updateScreen()
// {
// super.updateScreen();
// this.updateAnimation();
// }
/**
* Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton
*/
public void mouseClicked(int mouseX, int mouseY, int mouseButton)
{
super.mouseClicked(mouseX, mouseY, mouseButton);
// int i = (this.width - this.xSize) / 2;
// int j = (this.height - this.ySize) / 2;
for (int k = 0; k < 3; ++k)
{
int l = mouseX - 60;
int i1 = mouseY - (14 + 19 * k);
if (l >= 0 && i1 >= 0 && l < 108 && i1 < 19 && this.container.enchantItem(this.gm.player, k))
{
this.gm.controller.sendEnchantPacket(this.container.windowId, k);
}
}
}
public void addButtons() {
super.addButtons();
this.button(60, 14 + 19 * 0, 108, 19);
this.button(60, 14 + 19 * 1, 108, 19);
this.button(60, 14 + 19 * 2, 108, 19);
}
/**
* Args : renderPartialTicks, mouseX, mouseY
*/
public void drawGuiContainerBackgroundLayer()
{
this.nameRand.setSeed((long)this.container.xpSeed);
for (int l = 0; l < 3; ++l)
{
int i1 = 60;
int j1 = i1 + 20;
String s = this.getRandomName();
int l1 = this.container.enchantLevels[l];
if (l1 == 0)
{
this.rect(i1, 14 + 19 * l, 108, 19, 0x404040);
}
else
{
String s1 = "" + l1;
int i2 = 6839882;
if (/* (k < l + 1 || */ this.gm.player.experienceLevel < l1) // && !this.gm.thePlayer.creative)
{
this.rect(i1, 14 + 19 * l, 108, 19, 0x400000);
this.rect(i1 + 1, 15 + 19 * l, 16, 16, 0x200000);
this.drawString(s, j1, 16 + 19 * l); // , /*k1,*/ (i2 & 16711422) >> 1);
i2 = 4226832;
}
else
{
// int j2 = SKC.getMouseX() - this.guiLeft - 60;
// int k2 = SKC.getMouseY() - this.guiTop - (14 + 19 * l);
// if (j2 >= 0 && k2 >= 0 && j2 < 108 && k2 < 19)
// {
// this.rect(i1, 14 + 19 * l, 108, 19, 0x20ff20);
// i2 = 16777088;
// }
// else
// {
this.rect(i1, 14 + 19 * l, 108, 19, 0x20ff20);
// }
this.rect(i1 + 1, 15 + 19 * l, 16, 16, 0x008000);
this.drawString(s, j1, 16 + 19 * l);
i2 = 8453920;
}
this.drawString(s1, j1 + 86 - this.getStringWidth(s1), 16 + 19 * l + 7);
}
}
}
/**
* Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks
*/
public void drawScreen(int mouseX, int mouseY)
{
super.drawScreen(mouseX, mouseY);
// boolean flag = this.gm.thePlayer.creative;
// int i = this.container.getLapisAmount();
for (int j = 0; j < 3; ++j)
{
int k = this.container.enchantLevels[j];
int l = this.container.enchantmentIds[j];
int i1 = j + 1;
if (this.isPointInRegion(60, 14 + 19 * j, 108, 17, mouseX, mouseY) && k > 0 && l >= 0)
{
StringBuilder sb = new StringBuilder();
if (l >= 0 && Enchantment.getEnchantmentById(l & 255) != null)
{
String s = Enchantment.getEnchantmentById(l & 255).getFormattedName((l & 65280) >> 8);
sb.append(TextColor.WHITE + s + " . . . ?");
}
// if (!flag)
// {
// if (l >= 0 && sb.length() != 0)
// {
// sb.append("\n");
// }
if (this.gm.player.experienceLevel < k)
{
sb.append((sb.length() != 0 ? "\n" : "") + TextColor.RED + String.format("Erfahrungsstufe %d erforderlich", this.container.enchantLevels[j]));
}
else
{
String s1 = "";
// if (i1 == 1)
// {
// s1 = I18n.format("container.enchant.lapis.one");
// }
// else
// {
// s1 = I18n.format("container.enchant.lapis.many", i1);
// }
//
// if (i >= i1)
// {
// list.add(ChatFormat.GRAY.toString() + "" + s1);
// }
// else
// {
// list.add(ChatFormat.RED.toString() + "" + s1);
// }
if (i1 == 1)
{
s1 = "1 Erfahrungsstufe";
}
else
{
s1 = String.format("%d Erfahrungsstufen", i1);
}
sb.append((sb.length() != 0 ? "\n" : "") + TextColor.LGRAY.toString() + "" + s1);
}
// }
this.hover(sb.toString(), mouseX, mouseY);
break;
}
}
}
private String getRandomName()
{
int i = this.nameRand.zrange(2) + 3;
String s = "";
for (int j = 0; j < i; ++j)
{
if (j > 0)
{
s = s + " ";
}
String name = NAMES[this.nameRand.zrange(NAMES.length)];
for(int z = 0; z < name.length(); z++) {
s += (char)(name.charAt(z) - 0x61 + 0x80);
}
}
return s;
}
// private void updateAnimation()
// {
// ItemStack itemstack = this.inventorySlots.getSlot(0).getStack();
//
// if (!ItemStack.areItemStacksEqual(itemstack, this.field_147077_B))
// {
// this.field_147077_B = itemstack;
//
// while (true)
// {
// this.field_147082_x += (float)(this.random.zrange(4) - this.random.zrange(4));
//
// if (this.field_147071_v > this.field_147082_x + 1.0F || this.field_147071_v < this.field_147082_x - 1.0F)
// {
// break;
// }
// }
// }
//
// ++this.field_147073_u;
// this.field_147069_w = this.field_147071_v;
// this.field_147076_A = this.field_147080_z;
// boolean flag = false;
//
// for (int i = 0; i < 3; ++i)
// {
// if (this.container.enchantLevels[i] != 0)
// {
// flag = true;
// }
// }
//
// if (flag)
// {
// this.field_147080_z += 0.2F;
// }
// else
// {
// this.field_147080_z -= 0.2F;
// }
//
// this.field_147080_z = ExtMath.clampf(this.field_147080_z, 0.0F, 1.0F);
// float f1 = (this.field_147082_x - this.field_147071_v) * 0.4F;
// float f = 0.2F;
// f1 = ExtMath.clampf(f1, -f, f);
// this.field_147081_y += (f1 - this.field_147081_y) * 0.9F;
// this.field_147071_v += this.field_147081_y;
// }
}

View file

@ -1,71 +0,0 @@
package client.gui.container;
import common.inventory.ContainerFurnace;
import common.inventory.IInventory;
import common.inventory.InventoryPlayer;
import common.tileentity.TileEntityFurnace;
public class GuiFurnace extends GuiContainer
{
// private static final String furnaceGuiTextures = "textures/gui/furnace.png";
/** The player inventory bound to this GUI. */
private final InventoryPlayer playerInventory;
private IInventory tileFurnace;
public GuiFurnace(InventoryPlayer playerInv, IInventory furnaceInv)
{
super(new ContainerFurnace(playerInv, furnaceInv));
this.playerInventory = playerInv;
this.tileFurnace = furnaceInv;
}
/**
* Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY
*/
public void drawGuiContainerForegroundLayer()
{
String s = this.tileFurnace.getCommandName();
this.drawString(s, 8, 6);
this.drawString(this.playerInventory.getCommandName(), 8, this.ySize - 96 + 2);
}
/**
* Args : renderPartialTicks, mouseX, mouseY
*/
public void drawGuiContainerBackgroundLayer()
{
this.rect(58, 36, 12, 14, 0x202020);
if (TileEntityFurnace.isBurning(this.tileFurnace))
{
int k = this.getBurnLeftScaled(13);
k = Math.min(k, 13);
this.rect(58, 36 + 13 - k, 12, k + 1, 0xff7f00);
}
int l = this.getCookProgressScaled(24);
this.rect(79, 39, 24, 8, 0x606060);
if(l > 0)
this.rect(79, 39, l + 1, 8, 0xffaf00);
}
private int getCookProgressScaled(int pixels)
{
int i = this.tileFurnace.getField(2);
int j = this.tileFurnace.getField(3);
return j != 0 && i != 0 ? i * pixels / j : 0;
}
private int getBurnLeftScaled(int pixels)
{
int i = this.tileFurnace.getField(1);
if (i == 0)
{
i = 200;
}
return this.tileFurnace.getField(0) * pixels / i;
}
}

View file

@ -1,49 +0,0 @@
package client.gui.container;
import client.Client;
import common.inventory.ContainerHopper;
import common.inventory.IInventory;
import common.inventory.InventoryPlayer;
public class GuiHopper extends GuiContainer
{
// /** The ResourceLocation containing the gui texture for the hopper */
// private static final String HOPPER_GUI_TEXTURE = "textures/gui/hopper.png";
/** The player inventory currently bound to this GUI instance */
private IInventory playerInventory;
/** The hopper inventory bound to this GUI instance */
private IInventory hopperInventory;
public GuiHopper(InventoryPlayer playerInv, IInventory hopperInv)
{
super(new ContainerHopper(playerInv, hopperInv, Client.CLIENT.player));
this.playerInventory = playerInv;
this.hopperInventory = hopperInv;
// this.allowUserInput = false;
this.ySize = 133;
}
/**
* Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY
*/
public void drawGuiContainerForegroundLayer()
{
this.drawString(this.hopperInventory.getCommandName(), 8, 6);
this.drawString(this.playerInventory.getCommandName(), 8, this.ySize - 96 + 2);
}
// /**
// * Args : renderPartialTicks, mouseX, mouseY
// */
// protected void drawGuiContainerBackgroundLayer(int mouseX, int mouseY)
// {
// GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
// this.gm.getTextureManager().bindTexture(HOPPER_GUI_TEXTURE);
// int i = (this.width - this.xSize) / 2;
// int j = (this.height - this.ySize) / 2;
//// this.rect(i, j, 0, 0, this.xSize, this.ySize);
// }
}

View file

@ -1,79 +0,0 @@
package client.gui.container;
import client.Client;
import common.entity.animal.EntityHorse;
import common.inventory.ContainerHorseInventory;
import common.inventory.IInventory;
public class GuiHorse extends GuiContainer
{
// private static final String horseGuiTextures = "textures/gui/horse.png";
/** The player inventory bound to this GUI. */
private IInventory playerInventory;
/** The horse inventory bound to this GUI. */
private IInventory horseInventory;
// /** The EntityHorse whose inventory is currently being accessed. */
// private EntityHorse horseEntity;
// /** The mouse x-position recorded during the last rendered frame. */
// private float mousePosx;
//
// /** The mouse y-position recorded during the last renderered frame. */
// private float mousePosY;
public GuiHorse(IInventory playerInv, IInventory horseInv, EntityHorse horse)
{
super(new ContainerHorseInventory(playerInv, horseInv, horse, Client.CLIENT.player));
this.playerInventory = playerInv;
this.horseInventory = horseInv;
// this.horseEntity = horse;
// this.allowUserInput = false;
}
/**
* Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY
*/
public void drawGuiContainerForegroundLayer()
{
this.drawString(this.horseInventory.getCommandName(), 8, 6);
this.drawString(this.playerInventory.getCommandName(), 8, this.ySize - 96 + 2);
}
// /**
// * Args : renderPartialTicks, mouseX, mouseY
// */
// protected void drawGuiContainerBackgroundLayer(int mouseX, int mouseY)
// {
// GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
// this.gm.getTextureManager().bindTexture(horseGuiTextures);
// int i = (this.width - this.xSize) / 2;
// int j = (this.height - this.ySize) / 2;
//// this.rect(i, j, 0, 0, this.xSize, this.ySize);
//
//// if (this.horseEntity.isChested())
//// {
//// this.rect(i + 79, j + 17, 0, this.ySize, 90, 54);
//// }
//
//// if (this.horseEntity.canWearArmor())
//// {
//// this.rect(i + 7, j + 35, 0, this.ySize + 54, 18, 18);
//// }
//
//// GuiInventory.drawEntityOnScreen(i + 51, j + 60, 17, (float)(i + 51) - this.mousePosx, (float)(j + 75 - 50) - this.mousePosY, this.horseEntity);
// }
// /**
// * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks
// */
// public void drawScreen(int mouseX, int mouseY)
// {
// this.mousePosx = (float)mouseX;
// this.mousePosY = (float)mouseY;
// super.drawScreen(mouseX, mouseY);
// }
}

View file

@ -1,58 +0,0 @@
package client.gui.container;
import common.entity.npc.EntityNPC;
public class GuiInventory extends GuiContainer
{
// private final GuiCheat cheat;
// private float oldMouseX;
// private float oldMouseY;
public GuiInventory(EntityNPC player)
{
super(player.inventoryContainer);
// this.allowUserInput = true;
// this.cheat = cheat;
}
// public void updateScreen()
// {
// this.updateActivePotionEffects();
// }
// public void initGui()
// {
//// this.buttonList.clear();
// super.initGui();
// if(this.cheat != null)
// this.buttonList.add(new Button(1, this.guiLeft + this.xSize - 16, this.guiTop + 4, 12, 12, "X"));
// }
public void drawGuiContainerForegroundLayer()
{
this.drawString("Handwerk", 86, 16);
}
// public void drawScreen(int mouseX, int mouseY, float partialTicks)
// {
// super.drawScreen(mouseX, mouseY, partialTicks);
// this.oldMouseX = (float)mouseX;
// this.oldMouseY = (float)mouseY;
// }
// protected void drawGuiContainerBackgroundLayer(int mouseX, int mouseY)
// {
// GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
// this.gm.getTextureManager().bindTexture(inventoryBackground);
// int i = this.guiLeft;
// int j = this.guiTop;
//// this.rect(i, j, 0, 0, this.xSize, this.ySize);
//// drawEntityOnScreen(i + 51, j + 75, 30, (float)(i + 51) - this.oldMouseX, (float)(j + 75 - 50) - this.oldMouseY, this.gm.thePlayer);
// }
// public void actionPerformed(int button)
// {
// if(button == 1 && this.cheat != null && this.gm.thePlayer.inventory.getItemStack() == null)
// this.gm.displayGuiScreen(this.cheat);
// }
}

View file

@ -1,44 +0,0 @@
package client.gui.container;
import client.Client;
import common.inventory.ContainerMachine;
import common.inventory.IInventory;
import common.inventory.InventoryPlayer;
import common.tileentity.TileEntityMachine;
public class GuiMachine extends GuiContainer
{
// private final String texture;
private final IInventory playerInv;
private final IInventory machineInv;
private final TileEntityMachine machine;
public GuiMachine(InventoryPlayer player, IInventory inv, TileEntityMachine machine)
{
super(new ContainerMachine(player, machine, inv, Client.CLIENT.player));
this.playerInv = player;
this.machineInv = machine;
// this.allowUserInput = false;
this.ySize = 153;
// this.texture = "textures/gui/" + texture + ".png";
this.machine = machine;
}
public void drawGuiContainerForegroundLayer()
{
this.drawString(this.machine.getStatus().color + this.machineInv.getCommandName() + " - " + this.machine.getStatus().name, 8, 6);
this.drawString(this.playerInv.getCommandName(), 8, this.ySize - 96 + 2);
this.drawString(String.format("Temperatur: %d °", this.machine.getTemperature()), 8, 18);
this.drawString(this.machine.formatDisplay(), 8, 28);
}
// protected void drawGuiContainerBackgroundLayer(int mouseX, int mouseY)
// {
// GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
// this.gm.getTextureManager().bindTexture(this.texture);
// int i = (this.width - this.xSize) / 2;
// int j = (this.height - this.ySize) / 2;
//// this.rect(i, j, 0, 0, this.xSize, this.ySize);
// }
}

View file

@ -1,287 +0,0 @@
package client.gui.container;
import org.lwjgl.opengl.GL11;
import client.renderer.GlState;
import client.renderer.ItemRenderer;
import common.inventory.ContainerMerchant;
import common.inventory.InventoryPlayer;
import common.item.ItemStack;
import common.packet.CPacketAction;
import common.village.MerchantRecipe;
import common.village.MerchantRecipeList;
import common.world.World;
public class GuiMerchant extends GuiContainer
{
// private static final String MERCHANT_GUI_TEXTURE = "textures/gui/trading.png";
private int selectedMerchantRecipe;
private String chatComponent;
public GuiMerchant(InventoryPlayer inv, String name, World worldIn)
{
super(new ContainerMerchant(inv, null, worldIn));
this.chatComponent = name != null ? name : "NSC";
}
/**
* Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
* window resizes, the buttonList is cleared beforehand.
*/
// public void initGui()
// {
// super.initGui();
// }
public void addButtons() {
super.addButtons();
this.button(120 + 27, 24, 12, 16);
this.button(36 - 19, 24, 12, 16);
this.button(36 - 1, 24 - 1, 18, 18);
this.button(62 - 1, 24 - 1, 18, 18);
this.button(120 - 1, 24 - 1, 18, 18);
}
public void mouseClicked(int mouseX, int mouseY, int mouseButton)
{
if (mouseButton == 0)
{
// int i = (this.width - this.xSize) / 2;
// int j = (this.height - this.ySize) / 2;
if(mouseX >= 147 && mouseX < 147 + 12 && mouseY >= 24 && mouseY < 24 + 16) {
this.switchTrade(true);
return;
}
else if(mouseX >= 17 && mouseX < 17 + 12 && mouseY >= 24 && mouseY < 24 + 16) {
this.switchTrade(false);
return;
}
// this.buttonList.add(new Button(1, i + 120 + 27, j + 24 - 1, 12, 19, ">"));
// this.buttonList.add(new Button(2, i + 36 - 19, j + 24 - 1, 12, 19, "<"));
}
super.mouseClicked(mouseX, mouseY, mouseButton);
}
/**
* Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY
*/
public void drawGuiContainerForegroundLayer()
{
String s = this.chatComponent;
this.drawString(s, 8, 6);
this.drawString("Inventar", 8, this.ySize - 96 + 2);
}
public void drawOverlays() {
super.drawOverlays();
MerchantRecipeList merchantrecipelist = this.getRecipes();
if (merchantrecipelist != null && !merchantrecipelist.isEmpty()) {
int k = this.selectedMerchantRecipe;
MerchantRecipe merchantrecipe = (MerchantRecipe)merchantrecipelist.get(k);
ItemStack itemstack = merchantrecipe.getItemToBuy();
ItemStack itemstack1 = merchantrecipe.getSecondItemToBuy();
ItemStack itemstack2 = merchantrecipe.getItemToSell();
this.renderItemOverlayIntoGUI(itemstack, 36, 24, null);
if(itemstack1 != null)
this.renderItemOverlayIntoGUI(itemstack1, 62, 24, null);
this.renderItemOverlayIntoGUI(itemstack2, 120, 24, null);
}
}
/**
* Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
*/
public void switchTrade(boolean forward)
{
boolean flag = false;
if (forward)
{
++this.selectedMerchantRecipe;
MerchantRecipeList merchantrecipelist = this.getRecipes();
if (merchantrecipelist != null && this.selectedMerchantRecipe >= merchantrecipelist.size())
{
this.selectedMerchantRecipe = merchantrecipelist.size() - 1;
}
flag = true;
}
else
{
--this.selectedMerchantRecipe;
if (this.selectedMerchantRecipe < 0)
{
this.selectedMerchantRecipe = 0;
}
flag = true;
}
if (flag)
{
((ContainerMerchant)this.inventorySlots).setCurrentRecipeIndex(this.selectedMerchantRecipe);
// PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
// packetbuffer.writeInt(this.selectedMerchantRecipe);
this.gm.getNetHandler().addToSendQueue(new CPacketAction(CPacketAction.Action.SELECT_TRADE,
this.selectedMerchantRecipe));
}
}
// /**
// * Args : renderPartialTicks, mouseX, mouseY
// */
// protected void drawGuiContainerBackgroundLayer(int mouseX, int mouseY)
// {
// GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
// this.gm.getTextureManager().bindTexture(MERCHANT_GUI_TEXTURE);
// int i = (this.width - this.xSize) / 2;
// int j = (this.height - this.ySize) / 2;
//// this.rect(i, j, 0, 0, this.xSize, this.ySize);
//// MerchantRecipeList merchantrecipelist = this.merchant.getRecipes(this.gm.thePlayer);
//
//// if (merchantrecipelist != null && !merchantrecipelist.isEmpty())
//// {
//// int k = this.selectedMerchantRecipe;
////
//// if (k < 0 || k >= merchantrecipelist.size())
//// {
//// return;
//// }
//
//// MerchantRecipe merchantrecipe = (MerchantRecipe)merchantrecipelist.get(k);
//
//// if (merchantrecipe.isRecipeDisabled())
//// {
//// this.gm.getTextureManager().bindTexture(MERCHANT_GUI_TEXTURE);
//// GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
//// GlState.disableLighting();
//// this.rect(this.guiLeft + 83, this.guiTop + 21, 212, 0, 28, 21);
//// this.rect(this.guiLeft + 83, this.guiTop + 51, 212, 0, 28, 21);
//// }
//// }
// }
/**
* Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks
*/
public void drawScreen(int mouseX, int mouseY)
{
super.drawScreen(mouseX, mouseY);
MerchantRecipeList merchantrecipelist = this.getRecipes();
if (merchantrecipelist != null && !merchantrecipelist.isEmpty())
{
// int i = (this.width - this.xSize) / 2;
// int j = (this.height - this.ySize) / 2;
int k = this.selectedMerchantRecipe;
MerchantRecipe merchantrecipe = (MerchantRecipe)merchantrecipelist.get(k);
ItemStack itemstack = merchantrecipe.getItemToBuy();
ItemStack itemstack1 = merchantrecipe.getSecondItemToBuy();
ItemStack itemstack2 = merchantrecipe.getItemToSell();
GL11.glPushMatrix();
ItemRenderer.enableGUIStandardItemLighting();
GlState.disableLighting();
GlState.enableRescaleNormal();
GlState.enableColorMaterial();
GlState.enableLighting();
this.itemRender.zLevel = 100.0F;
this.itemRender.renderItemAndEffectIntoGUI(itemstack, 36, 24);
// this.itemRender.renderItemOverlays(itemstack, 36, 24);
if (itemstack1 != null)
{
this.itemRender.renderItemAndEffectIntoGUI(itemstack1, 62, 24);
// this.itemRender.renderItemOverlays(itemstack1, 62, 24);
}
this.itemRender.renderItemAndEffectIntoGUI(itemstack2, 120, 24);
// this.itemRender.renderItemOverlays(itemstack2, 120, 24);
this.itemRender.zLevel = 0.0F;
GlState.disableLighting();
if (this.isPointInRegion(36, 24, 16, 16, mouseX, mouseY) && itemstack != null)
{
this.renderToolTip(itemstack, mouseX, mouseY);
}
else if (itemstack1 != null && this.isPointInRegion(62, 24, 16, 16, mouseX, mouseY) && itemstack1 != null)
{
this.renderToolTip(itemstack1, mouseX, mouseY);
}
else if (itemstack2 != null && this.isPointInRegion(120, 24, 16, 16, mouseX, mouseY) && itemstack2 != null)
{
this.renderToolTip(itemstack2, mouseX, mouseY);
}
// else if (merchantrecipe.isRecipeDisabled() && (this.isPointInRegion(83, 21, 28, 21, mouseX, mouseY) || this.isPointInRegion(83, 51, 28, 21, mouseX, mouseY)))
// {
// this.drawCreativeTabHoveringText(I18n.format("merchant.deprecated"), mouseX, mouseY);
// }
GL11.glPopMatrix();
GlState.enableLighting();
GlState.enableDepth();
ItemRenderer.enableStandardItemLighting();
// int i = (this.width - this.xSize) / 2;
// int j = (this.height - this.ySize) / 2;
// if(mouseX >= i + 147 && mouseX < i + 147 + 12 && mouseY >= j + 23 && mouseX < j + 23 + 19) {
// SKC.highlight(i + 147, j + 23, 12, 19);
// }
// else if(mouseX >= i + 17 && mouseX < i + 17 + 12 && mouseY >= j + 23 && mouseX < j + 23 + 19) {
// SKC.highlight(i + 17, j + 23, 12, 19);
// }
}
}
public void setRecipes(MerchantRecipeList recipes)
{
((ContainerMerchant)this.inventorySlots).getMerchantInventory().setRecipes(recipes);
}
private MerchantRecipeList getRecipes()
{
return ((ContainerMerchant)this.inventorySlots).getMerchantInventory().getRecipes();
}
// static class MerchantButton extends Button
// {
// private final boolean next;
//
// public MerchantButton(int buttonID, int x, int y, boolean isNext)
// {
// super(buttonID, x, y, 12, 19, "");
// this.next = isNext;
// }
//
// public void drawButton(Game gm, int mouseX, int mouseY)
// {
// if (this.visible)
// {
// gm.getTextureManager().bindTexture(GuiMerchant.MERCHANT_GUI_TEXTURE);
// GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
// boolean flag = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
// int i = 0;
// int j = 176;
//
// if (!this.enabled)
// {
// j += this.width * 2;
// }
// else if (flag)
// {
// j += this.width;
// }
//
// if (!this.next)
// {
// i += this.height;
// }
//
// this.rect(this.xPosition, this.yPosition, j, i, this.width, this.height);
// }
// }
// }
}

View file

@ -1,218 +0,0 @@
package client.gui.container;
import java.util.List;
import client.Client;
import common.inventory.Container;
import common.inventory.ContainerRepair;
import common.inventory.ICrafting;
import common.inventory.IInventory;
import common.inventory.InventoryPlayer;
import common.item.ItemStack;
import common.world.World;
public class GuiRepair extends GuiContainer implements ICrafting
{
// private static final String anvilResource = "textures/gui/anvil.png";
private ContainerRepair anvil;
// private TextField nameField;
private InventoryPlayer playerInventory;
public GuiRepair(InventoryPlayer inventoryIn, World worldIn)
{
super(new ContainerRepair(inventoryIn, worldIn, Client.CLIENT.player));
this.playerInventory = inventoryIn;
this.anvil = (ContainerRepair)this.inventorySlots;
}
/**
* Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
* window resizes, the buttonList is cleared beforehand.
*/
public void initGui()
{
super.initGui();
// Keyboard.enableRepeatEvents(true);
// int i = (this.width - this.xSize) / 2;
// int j = (this.height - this.ySize) / 2;
// this.nameField = new TextField(i + 62, j + 24, 103, 12);
// this.nameField.setTextColor(-1);
// this.nameField.setDisabledTextColour(-1);
// this.nameField.setEnableBackgroundDrawing(false);
// this.nameField.setMaxStringLength(30);
this.inventorySlots.removeCraftingFromCrafters(this);
this.inventorySlots.onCraftGuiOpened(this);
}
/**
* Called when the screen is unloaded. Used to disable keyboard repeat events
*/
public void onGuiClosed()
{
super.onGuiClosed();
// Keyboard.enableRepeatEvents(false);
this.inventorySlots.removeCraftingFromCrafters(this);
}
/**
* Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY
*/
public void drawGuiContainerForegroundLayer()
{
// GlState.disableLighting();
// GlState.disableBlend();
this.drawString("Amboss", 60, 6);
if (this.anvil.maximumCost > 0)
{
int i = 8453920;
boolean flag = true;
String s = String.format("Erfahrungskosten: %d", this.anvil.maximumCost);
if (this.anvil.maximumCost >= 40) // && !this.gm.thePlayer.creative)
{
s = "Zu teuer!";
i = 16736352;
}
else if (!this.anvil.getSlot(2).getHasStack())
{
flag = false;
}
else if (!this.anvil.getSlot(2).canTakeStack(this.playerInventory.player))
{
i = 16736352;
}
if (flag)
{
int j = -16777216 | (i & 16579836) >> 2 | i & -16777216;
int k = this.xSize - 8 - this.getStringWidth(s);
int l = 67;
// if (FontRenderer.getUnicodeFlag())
// {
// drawRect(k - 3, l - 2, this.xSize - 7, l + 10, -16777216);
// drawRect(k - 2, l - 1, this.xSize - 8, l + 9, -12895429);
// }
// else
// {
this.drawString(s, k, l + 1);
this.drawString(s, k + 1, l);
this.drawString(s, k + 1, l + 1);
// }
this.drawString(s, k, l);
}
}
// GlState.enableLighting();
}
/**
* Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of
* KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code)
*/
// protected void keyTyped(char typedChar, int keyCode)
// {
// if (this.nameField.textboxKeyTyped(typedChar, keyCode))
//// {
// this.renameItem();
//// }
//// else
//// {
//// super.keyTyped(typedChar, keyCode);
//// }
// }
//
// private void renameItem()
// {
// String s = this.nameField.getText();
// Slot slot = this.anvil.getSlot(0);
//
// if (slot != null && slot.getHasStack() && !slot.getStack().hasDisplayName() && s.equals(slot.getStack().getDisplayName()))
// {
// s = "";
// }
//
// this.anvil.updateItemName(s);
// this.gm.thePlayer.sendQueue.addToSendQueue(new CPacketMessage(CPacketMessage.Type.ITEM, s));
// }
//
// /**
// * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton
// */
// protected void mouseClicked(int mouseX, int mouseY, int mouseButton)
// {
// super.mouseClicked(mouseX, mouseY, mouseButton);
// this.nameField.mouseClicked(mouseX, mouseY, mouseButton);
// }
/**
* Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks
*/
// public void drawScreen(int mouseX, int mouseY, float partialTicks)
// {
// super.drawScreen(mouseX, mouseY, partialTicks);
// GlState.disableLighting();
// GlState.disableBlend();
// this.nameField.drawTextBox();
// }
// /**
// * Args : renderPartialTicks, mouseX, mouseY
// */
// protected void drawGuiContainerBackgroundLayer(int mouseX, int mouseY)
// {
// GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
// this.gm.getTextureManager().bindTexture(anvilResource);
// int i = (this.width - this.xSize) / 2;
// int j = (this.height - this.ySize) / 2;
//// this.rect(i, j, 0, 0, this.xSize, this.ySize);
//// this.rect(i + 59, j + 20, 0, this.ySize + (this.anvil.getSlot(0).getHasStack() ? 0 : 16), 110, 16);
//
//// if ((this.anvil.getSlot(0).getHasStack() || this.anvil.getSlot(1).getHasStack()) && !this.anvil.getSlot(2).getHasStack())
//// {
//// this.rect(i + 99, j + 45, this.xSize, 0, 28, 21);
//// }
// }
/**
* update the crafting window inventory with the items in the list
*/
public void updateCraftingInventory(Container containerToSend, List<ItemStack> itemsList)
{
this.sendSlotContents(containerToSend, 0, containerToSend.getSlot(0).getStack());
}
/**
* Sends the contents of an inventory slot to the client-side Container. This doesn't have to match the actual
* contents of that slot. Args: Container, slot number, slot contents
*/
public void sendSlotContents(Container containerToSend, int slotInd, ItemStack stack)
{
// if (slotInd == 0)
// {
// this.nameField.setText(stack == null ? "" : stack.getDisplayName());
// this.nameField.setEnabled(stack != null);
//
// if (stack != null)
// {
// this.renameItem();
// }
// }
}
/**
* Sends two ints to the client-side Container. Used for furnace burning time, smelting progress, brewing progress,
* and enchanting level. Normally the first int identifies which variable to update, and the second contains the new
* value. Both are truncated to shorts in non-local SMP.
*/
public void sendProgressBarUpdate(Container containerIn, int varToUpdate, int newValue)
{
}
public void sendAllWindowProperties(Container p_175173_1_, IInventory p_175173_2_)
{
}
}

View file

@ -1,159 +0,0 @@
package client.gui.element;
import client.gui.Font;
import client.renderer.Drawing;
import client.renderer.Drawing.Offset;
import client.renderer.Drawing.Vec2i;
import common.util.CharValidator;
import common.util.ExtMath;
import common.util.Util;
public class Area extends Textbox {
private int textHeight;
private int scrollPos;
private int cursorX;
private int cursorY;
private Area(int x, int y, int w, int h, int cap, boolean editable, CharValidator validator, String text) {
super(x, y, w, h, cap, editable, null, validator);
this.setText(text);
}
public Area(int x, int y, int w, int h, int cap, CharValidator validator, String text) {
this(x, y, w, h, cap, true, validator, text);
}
public Area(int x, int y, int w, int h, int cap, String text) {
this(x, y, w, h, cap, true, null, text);
}
public Area(int x, int y, int w, int h, String text) {
this(x, y, w, h, Integer.MAX_VALUE, false, null, text);
}
public void updateText() {
this.textHeight = Drawing.txt_size(this.pos_x + this.margin_x1, this.pos_y + this.margin_y1,
this.pos_x + this.margin_x1, this.pos_y + this.margin_y1,
this.pos_x + (this.size_x - (this.margin_x1 + this.margin_x2)), Integer.MAX_VALUE, this.text).ypos;
}
public void scroll(int scr_x, int scr_y, int x, int y, boolean ctrl, boolean shift) {
if(scr_y != 0) {
int limit = Font.YGLYPH + this.textHeight - (this.size_y - (this.margin_y1 + this.margin_y2));
limit = ExtMath.clampi(limit, 0, 0x7fffffff);
int prev = this.text_y;
this.text_y += (scr_y < 0 ? -1 : 1) * (ctrl ? 1 : Font.YGLYPH) * this.gm.scrollLines * (shift ? 10 : 1);
this.text_y = ExtMath.clampi(this.text_y, -limit, 0);
if(this.sel_start >= 0)
this.cursorY += (this.text_y - prev);
}
}
public void mouserel() {
this.scrollPos = 0;
}
public void onReturn(boolean shift) {
insertText("\n");
}
public void onSelection(boolean up) {
if(!up && this.sel_start != this.sel_end) {
this.sel_start = this.sel_drag = this.sel_end;
}
else if(up && this.sel_start != this.sel_end) {
this.sel_end = this.sel_drag = this.sel_start;
}
if(!up && this.sel_start >= 0) {
if(this.sel_end < this.text.length()) {
int nl = this.text.indexOf('\n', this.sel_end);
this.sel_end = nl >= 0 ? nl + 1 : this.text.length();
this.sel_start = this.sel_drag = this.sel_end;
}
else {
this.sel_end = this.sel_drag = this.sel_start;
}
gui_text_update_cur(this.sel_end, true);
}
else if(up && this.sel_start >= 0) {
if(this.sel_start > 0) {
int nl = this.text.lastIndexOf('\n', this.sel_start);
this.sel_start = nl >= 0 ? nl : 0;
}
this.sel_end = this.sel_drag = this.sel_start;
gui_text_update_cur(this.sel_end, true);
}
}
public void update() {
if(this.scrollPos != 0) {
int n = this.updateScroll(this.scrollPos);
this.text_y += n;
if(n != 0)
gui_text_clamp_scroll();
}
}
public void shift(int shift_x, int shift_y) {
super.shift(shift_x, shift_y);
this.cursorX += shift_x;
this.cursorY += shift_y;
}
protected void gui_text_clamp_scroll() {
int limit = Font.YGLYPH + this.textHeight - (this.size_y - (this.margin_y1 + this.margin_y2));
limit = ExtMath.clampi(limit, 0, 0x7fffffff);
this.text_y = ExtMath.clampi(this.text_y, -limit, 0);
}
protected void updateCursor(int offset, boolean shift, int x1, int y1, int x2, int y2) {
Vec2i coord = Drawing.txt_coord(offset, x1, y1 + this.text_y,
x1 + this.text_x, y1 + this.text_y, this.pos_x + x2, 0x7fffffff, this.text);
this.cursorX = coord.xpos;
this.cursorY = coord.ypos;
if(shift) {
if(this.cursorY < y1)
this.text_y += y1 - this.cursorY;
else if((this.cursorY + Font.YGLYPH) >= (y1 + y2))
this.text_y -= (this.cursorY + Font.YGLYPH) - (y1 + y2);
gui_text_update_cur(offset, false);
}
}
protected int onCursorOffset(int x, int y, int x1, int y1, int x2, int y2) {
Offset off = Drawing.txt_offset(x, y, x1, y1 + this.text_y,
x1 + this.text_x, y1 + this.text_y, this.pos_x + x2, 0x7fffffff, this.text);
if(off != null) {
this.cursorX = off.xpos;
this.cursorY = off.ypos;
}
int offset = off == null ? 0 : off.offset;
if(y < y1)
this.scrollPos = y1 - y;
else if(y >= (y1 + y2))
this.scrollPos = -(y - (y1 + y2));
return offset;
}
protected void drawForeground(int x1, int y1, int x2, int y2) {
Drawing.txt_draw(x1, y1 + this.text_y,
x1 + this.text_x, y1 + this.text_y,
this.pos_x + x2, Integer.MAX_VALUE, this.enabled ? this.gm.style.text_field : Util.mulColor(this.gm.style.text_field, 0.5f), this.text);
if(this.sel_start >= 0 && this.sel_end != this.sel_start)
Drawing.txt_overlay(this.sel_start, this.sel_end, x1, y1 + this.text_y,
x1 + this.text_x, y1 + this.text_y,
this.pos_x + x2, Integer.MAX_VALUE, this.enabled ? 0x808080ff : 0x80404040, this.text);
}
protected char getNewline() {
return '\n';
}
protected int getCursorX(int x1, int x2) {
return this.cursorX;
}
protected int getCursorY(int y1, int y2) {
return this.cursorY;
}
}

View file

@ -1,413 +0,0 @@
package client.gui.element;
import java.util.List;
import org.lwjgl.opengl.GL11;
import client.gui.Gui;
import client.renderer.DefaultVertexFormats;
import client.renderer.Drawing;
import client.renderer.GlState;
import client.renderer.RenderBuffer;
import client.renderer.Tessellator;
import client.window.Button;
import common.collect.Lists;
import common.util.ExtMath;
public abstract class GuiList<T extends ListEntry> extends Gui
{
protected final List<T> elements = Lists.newArrayList();
protected int width;
protected int height;
protected int top;
protected int bottom;
protected int right;
protected int left;
protected int mouseX;
protected int mouseY;
protected int initialClickY = -2;
protected float scrollMultiplier;
protected float amountScrolled;
protected int selectedElement = -1;
protected long lastClicked;
public abstract int getListWidth(); // 220
public abstract int getSlotHeight();
protected int getScrollBarX()
{
return 0;
}
public void setDimensions(int widthIn, int heightIn, int topIn, int bottomIn)
{
this.width = widthIn;
this.height = heightIn;
this.top = topIn;
this.bottom = bottomIn;
this.left = 0;
this.right = widthIn;
}
public void init(int width, int height) {
this.selectedElement = -1;
}
public void setSlotXBoundsFromLeft(int leftIn)
{
this.left = leftIn;
this.right = leftIn + this.width;
}
public final T getListEntry(int index) {
return this.elements.get(index);
}
public final T getSelected() {
return this.selectedElement < 0 ? null : this.elements.get(this.selectedElement);
}
public final int getSize() {
return this.elements.size();
}
public final void setSelected(int index) {
this.selectedElement = index;
}
protected int getContentHeight()
{
return this.getSize() * this.getSlotHeight();
}
public int getSlotIndexFromScreenCoords(int x, int y)
{
int i = this.left + this.width / 2 - this.getListWidth() / 2;
int j = this.left + this.width / 2 + this.getListWidth() / 2;
int k = y - this.top + (int)this.amountScrolled - 4;
int l = k / this.getSlotHeight();
return this.isInList(x, y) && x >= i && x <= j && l >= 0 && k >= 0 && l < this.getSize() ? l : -1;
}
protected boolean isInList(int x, int y)
{
return x >= this.getScrollBarX() + 6; // x < this.getScrollBarX();
}
protected final boolean isSelected(int slotIndex)
{
return slotIndex == this.selectedElement;
}
protected void bindAmountScrolled()
{
this.amountScrolled = ExtMath.clampf(this.amountScrolled, 0.0F, (float)this.getMaxScroll());
}
public int getMaxScroll()
{
return Math.max(0, this.getContentHeight() - (this.bottom - this.top - 4));
}
public int getAmountScrolled()
{
return (int)this.amountScrolled;
}
public boolean isMouseYWithinSlotBounds(int p_148141_1_)
{
return p_148141_1_ >= this.top && p_148141_1_ <= this.bottom && this.mouseX >= this.left && this.mouseX <= this.right;
}
public void scrollBy(int amount)
{
this.amountScrolled += (float)amount;
this.bindAmountScrolled();
this.initialClickY = -2;
}
// public void actionPerformed(Button button)
// {
// if (button.enabled)
// {
// if (button.id == this.scrollUpButtonID)
// {
// this.amountScrolled -= (float)(this.slotHeight * 2 / 3);
// this.initialClickY = -2;
// this.bindAmountScrolled();
// }
// else if (button.id == this.scrollDownButtonID)
// {
// this.amountScrolled += (float)(this.slotHeight * 2 / 3);
// this.initialClickY = -2;
// this.bindAmountScrolled();
// }
// }
// }
public void draw()
{
int mouseXIn = this.gm.mouse_x;
int mouseYIn = this.gm.mouse_y;
this.mouseX = mouseXIn;
this.mouseY = mouseYIn;
this.drawBackground();
int i = this.getScrollBarX();
int j = i + 6;
this.bindAmountScrolled();
GlState.disableLighting();
GlState.disableFog();
GlState.enableTexture2D();
RenderBuffer worldrenderer = Tessellator.getBuffer();
this.gm.getTextureManager().bindTexture(Gui.DIRT_BACKGROUND);
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
float f = 32.0F;
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
worldrenderer.pos((double)0, (double)this.bottom, 0.0D).tex((double)((float)0 / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
worldrenderer.pos((double)this.gm.fb_x, (double)this.bottom, 0.0D).tex((double)((float)this.gm.fb_x / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
worldrenderer.pos((double)this.gm.fb_x, (double)this.top, 0.0D).tex((double)((float)this.gm.fb_x / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
worldrenderer.pos((double)0, (double)this.top, 0.0D).tex((double)((float)0 / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
Tessellator.draw();
int x = this.left + this.width / 2 - this.getListWidth() / 2 + 2;
int y = this.top + 4 - (int)this.amountScrolled;
this.drawSelectionBox(x, y, mouseXIn, mouseYIn);
GlState.disableDepth();
this.overlayBackground(0, this.top, 255, 255);
this.overlayBackground(this.bottom, this.height, 255, 255);
GlState.enableBlend();
GlState.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ZERO, GL11.GL_ONE);
GlState.disableAlpha();
GlState.shadeModel(GL11.GL_SMOOTH);
GlState.disableTexture2D();
int i1 = 4;
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
worldrenderer.pos((double)0, (double)(this.top + i1), 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 0).endVertex();
worldrenderer.pos((double)this.gm.fb_x, (double)(this.top + i1), 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 0).endVertex();
worldrenderer.pos((double)this.gm.fb_x, (double)this.top, 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 255).endVertex();
worldrenderer.pos((double)0, (double)this.top, 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 255).endVertex();
Tessellator.draw();
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
worldrenderer.pos((double)0, (double)this.bottom, 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 255).endVertex();
worldrenderer.pos((double)this.gm.fb_x, (double)this.bottom, 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 255).endVertex();
worldrenderer.pos((double)this.gm.fb_x, (double)(this.bottom - i1), 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 0).endVertex();
worldrenderer.pos((double)0, (double)(this.bottom - i1), 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 0).endVertex();
Tessellator.draw();
int j1 = this.getMaxScroll();
if (j1 > 0)
{
int k1 = (this.bottom - this.top) * (this.bottom - this.top) / this.getContentHeight();
k1 = ExtMath.clampi(k1, 32, this.bottom - this.top - 8);
int l1 = (int)this.amountScrolled * (this.bottom - this.top - k1) / j1 + this.top;
if (l1 < this.top)
{
l1 = this.top;
}
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
worldrenderer.pos((double)i, (double)this.bottom, 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 255).endVertex();
worldrenderer.pos((double)j, (double)this.bottom, 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 255).endVertex();
worldrenderer.pos((double)j, (double)this.top, 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 255).endVertex();
worldrenderer.pos((double)i, (double)this.top, 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 255).endVertex();
Tessellator.draw();
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
worldrenderer.pos((double)i, (double)(l1 + k1), 0.0D).tex(0.0D, 1.0D).color(128, 128, 128, 255).endVertex();
worldrenderer.pos((double)j, (double)(l1 + k1), 0.0D).tex(1.0D, 1.0D).color(128, 128, 128, 255).endVertex();
worldrenderer.pos((double)j, (double)l1, 0.0D).tex(1.0D, 0.0D).color(128, 128, 128, 255).endVertex();
worldrenderer.pos((double)i, (double)l1, 0.0D).tex(0.0D, 0.0D).color(128, 128, 128, 255).endVertex();
Tessellator.draw();
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
worldrenderer.pos((double)i, (double)(l1 + k1 - 1), 0.0D).tex(0.0D, 1.0D).color(192, 192, 192, 255).endVertex();
worldrenderer.pos((double)(j - 1), (double)(l1 + k1 - 1), 0.0D).tex(1.0D, 1.0D).color(192, 192, 192, 255).endVertex();
worldrenderer.pos((double)(j - 1), (double)l1, 0.0D).tex(1.0D, 0.0D).color(192, 192, 192, 255).endVertex();
worldrenderer.pos((double)i, (double)l1, 0.0D).tex(0.0D, 0.0D).color(192, 192, 192, 255).endVertex();
Tessellator.draw();
}
GlState.enableTexture2D();
GlState.shadeModel(GL11.GL_FLAT);
GlState.enableAlpha();
GlState.disableBlend();
super.draw();
}
public void handleMouseInput()
{
if (this.isMouseYWithinSlotBounds(this.mouseY))
{
// if (Button.MOUSE_LEFT.isDown() && this.getEnabled())
// {
if (this.initialClickY == -1)
{
boolean flag1 = true;
if (this.mouseY >= this.top && this.mouseY <= this.bottom)
{
int j2 = (this.width - this.getListWidth()) / 2;
int k2 = (this.width + this.getListWidth()) / 2;
int l2 = this.mouseY - this.top + (int)this.amountScrolled - 4;
int i1 = l2 / this.getSlotHeight();
if (i1 < this.getSize() && this.mouseX >= j2 && this.mouseX <= k2 && i1 >= 0 && l2 >= 0)
{
}
else if (this.mouseX >= j2 && this.mouseX <= k2 && l2 < 0)
{
flag1 = false;
}
int i3 = this.getScrollBarX();
int j1 = i3 + 6;
if (this.mouseX >= i3 && this.mouseX <= j1)
{
this.scrollMultiplier = -1.0F;
int k1 = this.getMaxScroll();
if (k1 < 1)
{
k1 = 1;
}
int l1 = (int)((float)((this.bottom - this.top) * (this.bottom - this.top)) / (float)this.getContentHeight());
l1 = ExtMath.clampi(l1, 32, this.bottom - this.top - 8);
this.scrollMultiplier /= (float)(this.bottom - this.top - l1) / (float)k1;
}
else
{
this.scrollMultiplier = 1.0F;
}
if (flag1)
{
this.initialClickY = this.mouseY;
}
else
{
this.initialClickY = -2;
}
}
else
{
this.initialClickY = -2;
}
}
else if (this.initialClickY >= 0)
{
this.amountScrolled -= (float)(this.mouseY - this.initialClickY) * this.scrollMultiplier;
this.initialClickY = this.mouseY;
}
// }
// else
// {
// this.initialClickY = -1;
// }
}
}
protected void drawSelectionBox(int x, int y, int mouseXIn, int mouseYIn)
{
int size = this.getSize();
RenderBuffer rb = Tessellator.getBuffer();
for (int z = 0; z < size; z++)
{
int y1 = y + z * this.getSlotHeight();
int h = this.getSlotHeight() - 4;
if (this.isSelected(z))
{
int x1 = this.left + (this.width / 2 - this.getListWidth() / 2);
int x2 = this.left + this.width / 2 + this.getListWidth() / 2;
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
GlState.disableTexture2D();
rb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
rb.pos((double)x1, (double)(y1 + h + 2), 0.0D).tex(0.0D, 1.0D).color(128, 128, 128, 255).endVertex();
rb.pos((double)x2, (double)(y1 + h + 2), 0.0D).tex(1.0D, 1.0D).color(128, 128, 128, 255).endVertex();
rb.pos((double)x2, (double)(y1 - 2), 0.0D).tex(1.0D, 0.0D).color(128, 128, 128, 255).endVertex();
rb.pos((double)x1, (double)(y1 - 2), 0.0D).tex(0.0D, 0.0D).color(128, 128, 128, 255).endVertex();
rb.pos((double)(x1 + 1), (double)(y1 + h + 1), 0.0D).tex(0.0D, 1.0D).color(0, 0, 0, 255).endVertex();
rb.pos((double)(x2 - 1), (double)(y1 + h + 1), 0.0D).tex(1.0D, 1.0D).color(0, 0, 0, 255).endVertex();
rb.pos((double)(x2 - 1), (double)(y1 - 1), 0.0D).tex(1.0D, 0.0D).color(0, 0, 0, 255).endVertex();
rb.pos((double)(x1 + 1), (double)(y1 - 1), 0.0D).tex(0.0D, 0.0D).color(0, 0, 0, 255).endVertex();
Tessellator.draw();
GlState.enableTexture2D();
}
boolean hover = this.getSlotIndexFromScreenCoords(mouseXIn, mouseYIn) == z;
this.getListEntry(z).draw(x, y1, mouseXIn - x, mouseYIn - y1, hover);
if(hover)
Drawing.drawRect(x - 2, y1 - 2, this.getListWidth(), this.getSlotHeight(), Gui.HOVER_COLOR);
}
}
protected void overlayBackground(int startY, int endY, int startAlpha, int endAlpha)
{
RenderBuffer rb = Tessellator.getBuffer();
this.gm.getTextureManager().bindTexture(Gui.DIRT_BACKGROUND);
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
float f = 32.0F;
rb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
rb.pos((double)0, (double)endY, 0.0D).tex(0.0D, (double)((float)endY / 32.0F)).color(64, 64, 64, endAlpha).endVertex();
rb.pos((double)this.gm.fb_x, (double)endY, 0.0D).tex((double)((float)this.gm.fb_x / 32.0F), (double)((float)endY / 32.0F)).color(64, 64, 64, endAlpha).endVertex();
rb.pos((double)this.gm.fb_x, (double)startY, 0.0D).tex((double)((float)this.gm.fb_x / 32.0F), (double)((float)startY / 32.0F)).color(64, 64, 64, startAlpha).endVertex();
rb.pos((double)0, (double)startY, 0.0D).tex(0.0D, (double)((float)startY / 32.0F)).color(64, 64, 64, startAlpha).endVertex();
Tessellator.draw();
}
public void mouse(Button btn, int x, int y, boolean ctrl, boolean shift)
{
super.mouse(btn, x, y, ctrl, shift);
if (this.isMouseYWithinSlotBounds(y))
{
int i = this.getSlotIndexFromScreenCoords(x, y);
if (i >= 0)
{
int j = this.left + this.width / 2 - this.getListWidth() / 2 + 2;
int k = this.top + 4 - this.getAmountScrolled() + i * this.getSlotHeight();
int l = x - j;
int i1 = y - k;
boolean flag = i == this.selectedElement && System.currentTimeMillis() - this.lastClicked < (long)this.gm.dclickDelay;
this.selectedElement = i;
this.lastClicked = System.currentTimeMillis();
this.getListEntry(i).select(flag, l, i1);
}
}
if(btn == Button.MOUSE_LEFT && this.clicked(x, y) == null)
this.handleMouseInput();
}
public void mouserel(Button btn, int x, int y) {
super.mouserel(btn, x, y);
if(btn == Button.MOUSE_LEFT)
this.initialClickY = -1;
}
public void scroll(int scr_x, int scr_y, int x, int y, boolean ctrl, boolean shift) {
super.scroll(scr_x, scr_y, x, y, ctrl, shift);
if(scr_y != 0 && this.clicked(x, y) == null)
this.amountScrolled -= (float)(ExtMath.clampi(scr_y, -1, 1) * this.getSlotHeight() / 2);
}
public void drag(int x, int y) {
super.drag(x, y);
if(this.selected == null && Button.MOUSE_LEFT.isDown())
this.handleMouseInput();
}
}

View file

@ -1,17 +0,0 @@
package client.gui.element;
import client.renderer.Drawing;
public class InventoryButton extends Element {
public InventoryButton(int x, int y, int w, int h) {
super(x, y, w, h, null);
}
protected void drawBackground() {
// Drawing.drawRect2Border(this.pos_x, this.pos_y, this.size_x, this.size_y, 0xff6f6f6f, 0xffafafaf);
Drawing.drawRectBorder(this.pos_x, this.pos_y, this.size_x, this.size_y, 0xff6f6f6f, 0xff000000, 0xffafafaf, 0xff4f4f4f);
}
protected void drawForeground(int x1, int y1, int x2, int y2) {
}
}

View file

@ -1,33 +0,0 @@
package client.gui.element;
import client.renderer.Drawing;
import common.util.Util;
public class Label extends Fill {
public Label(int x, int y, int w, int h, String text, boolean top, boolean left) {
super(x, y, w, h, text, top, left);
}
public Label(int x, int y, int w, int h, String text, boolean left) {
super(x, y, w, h, text, left);
}
public Label(int x, int y, int w, int h, String text) {
super(x, y, w, h, text);
}
protected void drawBackground() {
}
protected void drawForeground(int x1, int y1, int x2, int y2) {
Drawing.drawText(this.text, x1 + this.text_x, y1 + this.text_y, this.enabled ? this.gm.style.text_label : Util.mulColor(this.gm.style.text_label, 0.5f));
}
protected int getMarginX() {
return 0;
}
protected int getMarginY() {
return 0;
}
}

View file

@ -1,7 +0,0 @@
package client.gui.element;
public interface ListEntry
{
void draw(int x, int y, int mouseX, int mouseY, boolean hovered);
void select(boolean dclick, int mx, int my);
}

View file

@ -1,20 +0,0 @@
package client.gui.element;
import client.renderer.Drawing;
import common.util.Util;
public class PasswordField extends Field {
public PasswordField(int x, int y, int w, int h, int cap, FieldCallback callback, String text) {
super(x, y, w, h, cap, callback, text);
}
protected void drawForeground(int x1, int y1, int x2, int y2) {
Drawing.txt_draw(x1 + this.text_x, y1 + this.text_y,
x1 + this.text_x, y1 + this.text_y,
Integer.MAX_VALUE, Integer.MAX_VALUE, this.enabled ? this.gm.style.text_field : Util.mulColor(this.gm.style.text_field, 0.5f), this.text.isEmpty() ? "" : "****");
}
protected int getCursorX(int x1, int x2) {
return x1;
}
}

View file

@ -1,17 +0,0 @@
package client.gui.element;
import client.renderer.Drawing;
public class TransparentArea extends Area {
private final boolean background;
public TransparentArea(int x, int y, int w, int h, String text, boolean background) {
super(x, y, w, h, text);
this.background = background;
}
protected void drawBackground() {
if(this.background)
Drawing.drawRect(this.pos_x, this.pos_y, this.size_x, this.size_y, 0x3f000000);
}
}

View file

@ -1,125 +0,0 @@
package client.gui.ingame;
import client.gui.Gui;
import client.gui.element.ActButton;
import client.gui.element.ButtonCallback;
import client.gui.element.Element;
import client.gui.element.Label;
import client.gui.element.NavButton;
import client.gui.element.PasswordField;
import client.gui.element.PressType;
import client.gui.element.Switch;
import client.gui.element.SwitchCallback;
import client.gui.element.FieldAction;
import client.gui.element.Field;
import client.gui.element.FieldCallback;
import client.gui.element.Toggle;
import client.gui.element.ToggleCallback;
import client.network.ClientPlayer;
import common.color.TextColor;
import common.packet.CPacketForm;
import common.util.ExtMath;
import common.util.Triplet;
public class GuiForm extends Gui implements ButtonCallback {
private final int id;
private final String title;
private final Element[] inputs;
private final Label[] labels;
private final Triplet<String, Object, Integer>[] inputData;
private final Object[] outputData;
private boolean sent;
public void init(int width, int height) {
this.add(new Label(0, -100, 300, 20, this.title));
for(int z = 0; z < this.inputs.length; z++) {
final int index = z;
final String name = this.inputData[z].first;
Object obj = this.inputData[z].second;
int param = this.inputData[z].third;
if(obj instanceof Boolean) {
this.inputs[z] = this.add(new Toggle(0, 50 * z, 300, 24, (Boolean)obj, (Boolean)obj, new ToggleCallback() {
public void use(Toggle elem, boolean value) {
GuiForm.this.outputData[index] = value;
}
}, name));
}
else if(obj instanceof String[]) {
final String[] strs = (String[])obj;
param = ExtMath.clampi(param, 0, strs.length - 1);
this.inputs[z] = this.add(new Switch<String>(0, 50 * z, 300, 24, strs, strs[param], strs[param], new SwitchCallback<String>() {
public void use(Switch<String> elem, String value) {
for(int n = 0; n < strs.length; n++) {
if(value == strs[n]) {
GuiForm.this.outputData[index] = n;
break;
}
}
}
}, name));
}
else {
this.labels[z] = this.add(new Label(0, 50 * z - 20, 300, 20, name, true));
FieldCallback callback = new FieldCallback() {
public void use(Field elem, FieldAction value) {
if(value == FieldAction.FOCUS)
GuiForm.this.labels[index].setText(name);
}
};
this.inputs[z] = this.add((param & 0x80000000) != 0 ? new PasswordField(0, 50 * z, 300, 24, Math.min(param & 0xffff, 256), callback, (String)obj) :
new Field(0, 50 * z, 300, 24, Math.min(param & 0xffff, 256), callback, (String)obj));
}
}
this.add(new NavButton(0, 50 * (this.inputs.length + 1), 148, 24, null, "Abbrechen"));
this.add(new ActButton(152, 50 * (this.inputs.length + 1), 148, 24, this, "Senden"));
this.shift();
}
public String getTitle() {
return this.title;
}
public void onGuiClosed() {
if(!this.sent) {
ClientPlayer nethandler = this.gm.getNetHandler();
if(nethandler != null) {
nethandler.addToSendQueue(new CPacketForm(this.id, null));
}
}
}
public GuiForm(int id, String title, Triplet<String, Object, Integer>[] data) {
this.id = id;
this.title = title;
this.inputs = new Element[data.length];
this.labels = new Label[data.length];
this.inputData = data;
this.outputData = new Object[data.length];
for(int z = 0; z < data.length; z++) {
Object obj = data[z].second;
this.outputData[z] = obj instanceof String[] ? data[z].third : obj;
}
}
public void use(ActButton elem, PressType action) {
for(int z = 0; z < this.inputs.length; z++) {
if(this.inputs[z] instanceof Field) {
int min = (this.inputData[z].third & 0x7fffffff) >> 16;
String text = this.inputs[z].getText();
if(text.length() < min) {
if(!GuiForm.this.labels[z].getText().startsWith("" + TextColor.RED))
GuiForm.this.labels[z].setText(TextColor.RED + GuiForm.this.labels[z].getText());
return;
}
this.outputData[z] = text;
}
}
this.sent = true;
ClientPlayer nethandler = this.gm.getNetHandler();
if(nethandler != null) {
nethandler.addToSendQueue(new CPacketForm(this.id, this.outputData));
}
this.gm.displayGuiScreen(null);
}
}

View file

@ -1,41 +0,0 @@
package client.gui.ingame;
import client.gui.Gui;
import client.gui.element.ActButton;
import client.gui.element.ButtonCallback;
import common.color.TextColor;
import client.gui.element.Label;
import client.gui.element.PressType;
public class GuiGameOver extends Gui {
public static final GuiGameOver INSTANCE = new GuiGameOver();
private ActButton button;
private int timer;
private GuiGameOver() {
}
public void init(int width, int height) {
this.timer = 0;
this.add(new Label(0, 0, 200, 20, "Du bist gestorben!"));
this.add(new Label(0, 32, 200, 20, "Punktestand: " + TextColor.YELLOW + this.gm.player.experienceLevel));
this.button = this.add(new ActButton(0, 100, 200, 24, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
GuiGameOver.this.gm.player.respawnPlayer();
GuiGameOver.this.gm.displayGuiScreen(null);
}
}, "Wiederbeleben"));
this.shift();
this.button.enabled = false;
}
public String getTitle() {
return "Game over";
}
public void updateScreen() {
if(++this.timer >= 20)
this.button.enabled = true;
}
}

View file

@ -1,54 +0,0 @@
package client.gui.ingame;
import client.gui.Gui;
import client.gui.element.Label;
import client.gui.element.NavButton;
import client.gui.element.FieldAction;
import client.gui.element.Field;
import client.gui.element.FieldCallback;
import client.network.ClientPlayer;
import common.packet.CPacketSign;
import common.util.BlockPos;
public class GuiSign extends Gui implements FieldCallback {
private final BlockPos position;
private final Field[] lines;
private final String[] tempLines;
public void init(int width, int height) {
this.add(new Label(0, -140, 300, 20, "Bearbeite Schild"));
this.add(new Label(0, -80, 300, 20, String.format("%d, %d, %d", this.position.getX(), this.position.getY(), this.position.getZ())));
this.add(new Label(0, -50, 300, 20, this.gm.world == null ? "<?>" : this.gm.world.dimension.getFormattedName(false)));
for(int z = 0; z < this.lines.length; z++) {
this.lines[z] = this.add(new Field(0, 40 * z, 300, 24, 50, this, this.tempLines[z] == null ? "" : this.tempLines[z]));
}
this.add(new NavButton(0, 40 * (this.lines.length + 1), 300, 24, null, "Fertig"));
this.shift();
}
public String getTitle() {
return "Schild bearbeiten";
}
public void onGuiClosed() {
ClientPlayer nethandler = this.gm.getNetHandler();
if(nethandler != null) {
for(int z = 0; z < this.lines.length; z++) {
this.tempLines[z] = this.lines[z].getText();
}
nethandler.addToSendQueue(new CPacketSign(this.position, this.tempLines));
}
}
public GuiSign(BlockPos sign, String[] lines) {
this.position = sign;
this.lines = new Field[lines.length];
this.tempLines = new String[lines.length];
System.arraycopy(lines, 0, this.tempLines, 0, lines.length);
}
public void use(Field elem, FieldAction value) {
if(value == FieldAction.SEND)
this.gm.displayGuiScreen(null);
}
}

View file

@ -1,75 +0,0 @@
package client.gui.options;
import client.gui.Formatter;
import client.gui.element.ActButton;
import client.gui.element.ButtonCallback;
import client.gui.element.Label;
import client.gui.element.PressType;
import client.window.Bind;
import common.color.TextColor;
public class GuiBinds extends GuiOptions {
protected GuiBinds() {
}
public void init(int width, int height) {
int y = 0;
int x = 0;
for(Bind bind : Bind.values()) {
this.add(new Label(10 + x * 190, 80 + y * 50, 180, 20, bind.getDisplay()));
this.add(new ActButton(10 + x * 190, 100 + y * 50, 180, 24, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
if(action == PressType.SECONDARY) {
if(!bind.isDefault()) {
bind.setDefault();
GuiBinds.this.gm.setDirty();
GuiBinds.this.reformat();
}
}
else if(action == PressType.TERTIARY) {
if(bind.getInput() != null) {
bind.setInput(null);
GuiBinds.this.gm.setDirty();
GuiBinds.this.reformat();
}
}
else {
Bind.disableInput(bind);
}
}
}, new Formatter<ActButton>() {
public String use(ActButton elem) {
if(bind == Bind.getWaiting())
return /* TextColor.BLINK + "" + */ TextColor.BLUE + "***";
else
return (bind.isDupe() ? TextColor.RED : TextColor.YELLOW) + (bind.getInput() == null ? "---" : bind.getInput().getDisplay());
}
}));
if(++x == 5) {
x = 0;
y++;
}
}
y += x != 0 ? 1 : 0;
this.add(new ActButton(200, 100 + y * 50, 560, 24, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
boolean flag = false;
for(Bind bind : Bind.values()) {
flag |= !bind.isDefault();
bind.setDefault();
}
if(flag) {
GuiBinds.this.gm.setDirty();
GuiBinds.this.reformat();
}
}
}, "Zurücksetzen"));
this.addSelector("phy_sensitivity", 30, 160 + y * 50, 440, 24);
this.addSelector("gui_dclick_delay", 490, 160 + y * 50, 440, 24);
super.init(width, height);
}
public String getTitle() {
return "Tastenbelegung und Maus";
}
}

View file

@ -1,106 +0,0 @@
package client.gui.options;
import client.gui.Formatter;
import client.gui.element.Dropdown;
import client.gui.element.DropdownCallback;
import client.gui.element.Element;
import client.gui.element.Fill;
import client.gui.element.Slider;
import client.gui.element.SliderCallback;
import client.gui.element.Toggle;
import client.gui.element.ToggleCallback;
import client.window.Button;
import client.window.DisplayMode;
import client.window.Window;
import common.color.TextColor;
public class GuiDisplay extends GuiOptions {
private static final String[] DISTANCES = new String[] {"Gruselig", "Winzig", "Gering", "Normal", "Weit"};
private Element distanceSlider;
protected GuiDisplay() {
}
public void init(int width, int height) {
DisplayMode[] dmodes = Window.getDisplayModes();
if(dmodes != null && dmodes.length > 0) {
int offset = 0;
int pos = 0;
int num = dmodes.length;
if(dmodes.length > DisplayMode.VID_MODES) {
offset = dmodes.length - DisplayMode.VID_MODES;
num = DisplayMode.VID_MODES;
}
DisplayMode[] modes = new DisplayMode[num];
DisplayMode selected = dmodes[num + offset - 1];
for(int z = 0; z < num; z++) {
modes[z] = dmodes[z + offset];
if(modes[z].equals(this.gm.vidMode))
selected = modes[z];
}
this.add(new Dropdown<DisplayMode>(30, 80, 440, 24, false, modes, modes[modes.length - 1], selected, new DropdownCallback<DisplayMode>() {
public void use(Dropdown<DisplayMode> elem, DisplayMode value) {
GuiDisplay.this.gm.vidMode = value;
GuiDisplay.this.gm.full(true);
}
}, "Auflösung"));
}
else {
this.add(new Fill(30, 80, 440, 24, TextColor.RED + "Auflösung: <?>"));
}
this.add(new Toggle(490, 80, 440, 24, false, GuiDisplay.this.gm.fullscreen, new ToggleCallback() {
public void use(Toggle elem, boolean value) {
GuiDisplay.this.gm.full(value);
}
}, "Vollbild"));
this.add(new Slider(30, 120, 440, 24, 0, 0, 360 - 8, 0, (this.gm.sync < 0) ? (360 - 8) : (this.gm.sync != 0 ? ((this.gm.sync < 10) ? 1 : (this.gm.sync - 9)) : 0), new SliderCallback() {
public void use(Slider elem, int value) {
GuiDisplay.this.gm.getVar("win_sync").parse("" + ((value > 0 && value < 360 - 8) ? (value + 9) : (value != 0 ? -1 : 0)));
GuiDisplay.this.gm.setDirty();
}
}, new Formatter<Slider>() {
public String use(Slider elem) {
int value = elem.getValue();
return "Max. Bildrate: " + (value > 0 && value < (360 - 8) ? (value + 9) + " FPS" : (value != 0 ? "Unbegrenzt" : "VSync"));
}
}));
this.addSelector("gl_vsync_flush", 490, 120, 440, 24);
this.addSelector("overlay_enabled", 30, 200, 440, 24);
this.addSelector("overlay_opacity", 490, 200, 440, 24);
this.addSelector("overlay_fadeout", 30, 240, 440, 24);
this.addSelector("chat_permanent", 490, 240, 440, 24);
this.addSelector("console_size", 30, 280, 440, 24);
this.addSelector("chat_size", 490, 280, 440, 24);
this.addSelector("feed_size", 30, 320, 440, 24);
this.addSelector("hotbar_size", 490, 320, 440, 24);
this.addSelector("gl_fov", 30, 400, 440, 24);
this.distanceSlider = this.addSelector("chunk_view_distance", 30, 440, 440, 24);
this.addSelector("chunk_build_time", 490, 440, 440, 24);
super.init(width, height);
}
public String getTitle() {
return "Grafik und Anzeige";
}
private String getDistanceName() {
int distance = this.gm.renderDistance;
distance = distance > 16 ? 16 : distance;
String str = distance < 0 ? DISTANCES[0] : DISTANCES[(distance + 1) / 4];
if(distance > 2 && (((distance + 1) / 2) & 1) == 1)
str = str + "+";
return String.format("Sichtweite: %d Chunks [%d Blöcke, %s]", this.gm.renderDistance, this.gm.renderDistance * 16, str);
}
public void updateScreen() {
if(!Button.isMouseDown())
this.distanceSlider.setText(this.getDistanceName());
}
}

View file

@ -1,31 +0,0 @@
package client.gui.options;
import client.gui.Gui;
import client.gui.GuiMenu;
import client.gui.element.NavButton;
public abstract class GuiOptions extends Gui {
private static final GuiOptions[] PAGES = {lastPage = new GuiBinds(), new GuiStyle(), new GuiDisplay(), new GuiSound()};
private static GuiOptions lastPage;
public static GuiOptions getPage() {
return lastPage;
}
public void init(int width, int height) {
lastPage = this;
this.shift();
int x = 0;
int y = 0;
for(GuiOptions gui : PAGES) {
this.add( // gui == this ? new SelectedButton(240 * x, 24 * y, 240, 24, gui, gui.getTitle()) :
new NavButton(240 * x, 24 * y, 240, 24, gui, gui.getTitle()));
if(++x == 4) {
x = 0;
++y;
}
}
this.add(new NavButton(width - 240, 0, 240, 24, GuiMenu.INSTANCE, "Zurück"));
}
}

View file

@ -1,38 +0,0 @@
package client.gui.options;
import client.audio.Volume;
import client.gui.element.ActButton;
import client.gui.element.ButtonCallback;
import client.gui.element.PressType;
public class GuiSound extends GuiOptions {
protected GuiSound() {
}
public void init(int width, int height) {
this.addSelector("snd_enabled", 30, 380, 440, 24);
this.addSelector("snd_buffer_size", 30, 420, 440, 24);
this.addSelector("snd_frame_size", 490, 420, 440, 24);
this.add(new ActButton(30, 480, 900, 24, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
GuiSound.this.gm.restartSound(false);
}
}, "Übernehmen und Audio-Thread neu starten"));
int x = 30;
int y = 220;
for(Volume volume : Volume.values()) {
this.addSelector(volume.getCVarName(), x, y, 440, 24);
x = (x == 30) ? 490 : 30;
if(x == 30)
y += 40;
}
super.init(width, height);
}
public String getTitle() {
return "Audio und Ton";
}
}

View file

@ -1,129 +0,0 @@
package client.gui.options;
import client.gui.Style;
import client.gui.element.ActButton;
import client.gui.element.ButtonCallback;
import client.gui.element.Dropdown;
import client.gui.element.DropdownCallback;
import client.gui.element.Element;
import client.gui.element.SelectableButton;
import client.gui.element.Slider;
import client.gui.element.SliderCallback;
import client.gui.element.Switch;
import client.gui.element.SwitchCallback;
import client.gui.element.FieldAction;
import client.gui.element.Field;
import client.gui.element.FieldCallback;
import client.gui.element.PressType;
import client.vars.CVar;
import client.vars.ColorVar;
import client.gui.element.Toggle;
import client.gui.element.ToggleCallback;
public class GuiStyle extends GuiOptions implements DropdownCallback<String>, ButtonCallback, ToggleCallback, SwitchCallback<String>, SliderCallback, FieldCallback {
private static final String[] STYLE_CVARS = {
"color_button_top",
"color_textbox_top",
"color_border_top",
"color_button_btm",
"color_textbox_btm",
"color_border_btm",
"color_button_text",
"color_textbox_text",
"color_label_text"
};
protected GuiStyle() {
}
protected Element addSelector(String cvar, int x, int y, int w, int h) {
CVar cv = this.gm.getVar(cvar);
if(cv instanceof ColorVar) {
ColorVar color = (ColorVar)cv;
if(!color.getDisplay().isEmpty())
this.add(color.label(x, y - 20, w, 20));
if(this.gm.style != Style.CUSTOM)
return this.add(new Field(x, y, w, h, color.getFieldValue(this.gm.style)));
else
return this.add(color.editor(x, y, w, h));
}
return super.addSelector(cvar, x, y, w, h);
}
public void init(int width, int height) {
int z;
for(z = 0; z < STYLE_CVARS.length; z++) {
this.addSelector(STYLE_CVARS[z], 10 + ((z % 3) + 1) * 190, 100 + z / 3 * 50, 180, 24);
}
z = 0;
for(Style theme : Style.values()) {
ButtonCallback callback = new ButtonCallback() {
public void use(ActButton elem, PressType action) {
if(GuiStyle.this.gm.style != theme) {
GuiStyle.this.gm.style = theme;
GuiStyle.this.gm.setDirty();
GuiStyle.this.gm.displayGuiScreen(GuiStyle.this);
}
}
};
this.add( // theme == this.gm.style ? new SelectedButton(10 + (z % 3) * 320, 360 + (z / 3) * 40, 300, 24, callback, theme.name) :
new SelectableButton(10 + (z % 3) * 320, 360 + (z / 3) * 40, 300, 24, callback, theme.name, theme == this.gm.style));
z++;
}
String[] values = new String[] {"VALUE 1", "VALUE 2"};
this.add(new Dropdown(10, height - 74, 300, 24, false, values, values[1], values[0], this, "DROPDOWN"));
this.add(new ActButton(330, height - 74, 300, 24, this, "BUTTON"));
this.add(new Toggle(650, height - 74, 140, 24, false, true, this, "TOGGLE"));
this.add(new Toggle(810, height - 74, 140, 24, true, false, this, "TOGGLE"));
values = new String[] {"VALUE 1", "VALUE 2", "VALUE 3", "VALUE 4"};
this.add(new Switch(10, height - 34, 300, 24, values, values[2], values[0], this, "ENUM"));
this.add(new Slider(330, height - 34, 300, 24, 0, -20, 827, 60, 120, this, "SLIDER"));
this.add(new Field(650, height - 34, 300, 24, 128, this, "FIELD"));
if(this.gm.style != Style.CUSTOM) {
this.add(new ActButton(200, 100 + 3 * 50, 560, 24, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
if(GuiStyle.this.gm.style != Style.CUSTOM) {
GuiStyle.this.gm.style.copyToCustom();
GuiStyle.this.gm.style = Style.CUSTOM;
GuiStyle.this.gm.setDirty();
GuiStyle.this.gm.displayGuiScreen(GuiStyle.this);
}
}
}, "In angepasstes Design kopieren"));
}
else {
this.add(new ActButton(200, 100 + 3 * 50, 560, 24, new ButtonCallback() {
public void use(ActButton elem, PressType action) {
GuiStyle.this.gm.style = Style.CUSTOM;
for(String cvar : STYLE_CVARS) {
GuiStyle.this.gm.getVar(cvar).setDefault();
}
GuiStyle.this.gm.setDirty();
GuiStyle.this.gm.displayGuiScreen(GuiStyle.this);
}
}, "Angepasstes Design zurücksetzen"));
}
super.init(width, height);
}
public String getTitle() {
return "Benutzeroberfläche";
}
public void use(Field elem, FieldAction value) {
}
public void use(Slider elem, int value) {
}
public void use(Switch<String> elem, String value) {
}
public void use(Toggle elem, boolean value) {
}
public void use(ActButton elem, PressType action) {
}
public void use(Dropdown<String> elem, String value) {
}
}

View file

@ -1,173 +0,0 @@
package client.init;
import java.util.Map;
import client.renderer.entity.Render;
import client.renderer.entity.RenderArachnoid;
import client.renderer.entity.RenderArrow;
import client.renderer.entity.RenderBat;
import client.renderer.entity.RenderBlockEntity;
import client.renderer.entity.RenderBoat;
import client.renderer.entity.RenderBullet;
import client.renderer.entity.RenderChicken;
import client.renderer.entity.RenderCow;
import client.renderer.entity.RenderCrystal;
import client.renderer.entity.RenderDie;
import client.renderer.entity.RenderDragon;
import client.renderer.entity.RenderDynamite;
import client.renderer.entity.RenderEntity;
import client.renderer.entity.RenderEntityItem;
import client.renderer.entity.RenderFallingBlock;
import client.renderer.entity.RenderFireball;
import client.renderer.entity.RenderFish;
import client.renderer.entity.RenderFlyingBox;
import client.renderer.entity.RenderHorse;
import client.renderer.entity.RenderHumanoid;
import client.renderer.entity.RenderItem;
import client.renderer.entity.RenderItemEntity;
import client.renderer.entity.RenderLeashKnot;
import client.renderer.entity.RenderLightning;
import client.renderer.entity.RenderManager;
import client.renderer.entity.RenderMinecart;
import client.renderer.entity.RenderMooshroom;
import client.renderer.entity.RenderMouse;
import client.renderer.entity.RenderNpc;
import client.renderer.entity.RenderOcelot;
import client.renderer.entity.RenderPig;
import client.renderer.entity.RenderPotion;
import client.renderer.entity.RenderRabbit;
import client.renderer.entity.RenderSheep;
import client.renderer.entity.RenderSlime;
import client.renderer.entity.RenderSpaceMarine;
import client.renderer.entity.RenderSquid;
import client.renderer.entity.RenderTntMinecart;
import client.renderer.entity.RenderTntPrimed;
import client.renderer.entity.RenderWolf;
import client.renderer.entity.RenderXpOrb;
import client.renderer.model.ModelChicken;
import client.renderer.model.ModelCow;
import client.renderer.model.ModelHorse;
import client.renderer.model.ModelMouse;
import client.renderer.model.ModelOcelot;
import client.renderer.model.ModelPig;
import client.renderer.model.ModelRabbit;
import client.renderer.model.ModelSheep2;
import client.renderer.model.ModelSquid;
import client.renderer.model.ModelWolf;
import client.renderer.texture.TextureTicked;
import client.renderer.ticked.TextureFlamesFX1;
import client.renderer.ticked.TextureFlamesFX2;
import client.renderer.ticked.TextureLavaFX;
import client.renderer.ticked.TextureLavaFlowFX;
import client.renderer.ticked.TextureWaterFX;
import client.renderer.ticked.TextureWaterFlowFX;
import common.entity.Entity;
import common.entity.animal.EntityBat;
import common.entity.animal.EntityChicken;
import common.entity.animal.EntityCow;
import common.entity.animal.EntityDragon;
import common.entity.animal.EntityHorse;
import common.entity.animal.EntityMooshroom;
import common.entity.animal.EntityMouse;
import common.entity.animal.EntityOcelot;
import common.entity.animal.EntityPig;
import common.entity.animal.EntityRabbit;
import common.entity.animal.EntitySheep;
import common.entity.animal.EntitySquid;
import common.entity.animal.EntityWolf;
import common.entity.effect.EntityLightning;
import common.entity.item.EntityBoat;
import common.entity.item.EntityCart;
import common.entity.item.EntityCrystal;
import common.entity.item.EntityFalling;
import common.entity.item.EntityFireworks;
import common.entity.item.EntityItem;
import common.entity.item.EntityLeashKnot;
import common.entity.item.EntityNuke;
import common.entity.item.EntityOrb;
import common.entity.item.EntityTnt;
import common.entity.item.EntityTntCart;
import common.entity.item.EntityXp;
import common.entity.item.EntityXpBottle;
import common.entity.npc.SpeciesInfo;
import common.entity.projectile.EntityArrow;
import common.entity.projectile.EntityBox;
import common.entity.projectile.EntityBullet;
import common.entity.projectile.EntityDie;
import common.entity.projectile.EntityDynamite;
import common.entity.projectile.EntityEgg;
import common.entity.projectile.EntityFireCharge;
import common.entity.projectile.EntityFireball;
import common.entity.projectile.EntityHook;
import common.entity.projectile.EntityPotion;
import common.entity.projectile.EntitySnowball;
import common.init.Blocks;
import common.init.Items;
import common.init.SpeciesRegistry;
import common.init.SpeciesRegistry.ModelType;
public abstract class RenderRegistry {
public static void registerRenderers(Map<Class<? extends Entity>, Render<? extends Entity>> map,
Map<ModelType, RenderNpc> models, RenderManager mgr, RenderItem ritem) {
map.put(EntityPig.class, new RenderPig(mgr, new ModelPig()));
map.put(EntitySheep.class, new RenderSheep(mgr, new ModelSheep2()));
map.put(EntityCow.class, new RenderCow(mgr, new ModelCow()));
map.put(EntityMooshroom.class, new RenderMooshroom(mgr, new ModelCow()));
map.put(EntityWolf.class, new RenderWolf(mgr, new ModelWolf()));
map.put(EntityChicken.class, new RenderChicken(mgr, new ModelChicken()));
map.put(EntityOcelot.class, new RenderOcelot(mgr, new ModelOcelot()));
map.put(EntityRabbit.class, new RenderRabbit(mgr, new ModelRabbit()));
map.put(EntitySquid.class, new RenderSquid(mgr, new ModelSquid()));
map.put(EntityBat.class, new RenderBat(mgr));
map.put(EntityDragon.class, new RenderDragon(mgr));
map.put(EntityCrystal.class, new RenderCrystal(mgr));
map.put(Entity.class, new RenderEntity(mgr));
// map.put(EntityPainting.class, new RenderPainting(mgr));
// map.put(EntityFrame.class, new RenderItemFrame(mgr, ritem));
map.put(EntityLeashKnot.class, new RenderLeashKnot(mgr));
map.put(EntityArrow.class, new RenderArrow(mgr));
map.put(EntitySnowball.class, new RenderItemEntity(mgr, Items.snowball, ritem));
map.put(EntityOrb.class, new RenderItemEntity(mgr, Items.charged_orb, ritem));
map.put(EntityEgg.class, new RenderItemEntity(mgr, Items.egg, ritem));
map.put(EntityPotion.class, new RenderPotion(mgr, ritem));
map.put(EntityXpBottle.class, new RenderItemEntity(mgr, Items.experience_bottle, ritem));
map.put(EntityFireworks.class, new RenderItemEntity(mgr, Items.fireworks, ritem));
map.put(EntityFireball.class, new RenderFireball(mgr, 0.75F));
map.put(EntityFireCharge.class, new RenderFireball(mgr, 0.5F));
map.put(EntityBox.class, new RenderFlyingBox(mgr));
map.put(EntityItem.class, new RenderEntityItem(mgr, ritem));
map.put(EntityXp.class, new RenderXpOrb(mgr));
map.put(EntityTnt.class, new RenderTntPrimed(mgr));
map.put(EntityFalling.class, new RenderFallingBlock(mgr));
map.put(EntityTntCart.class, new RenderTntMinecart(mgr));
map.put(EntityCart.class, new RenderMinecart(mgr));
map.put(EntityBoat.class, new RenderBoat(mgr));
map.put(EntityHook.class, new RenderFish(mgr));
map.put(EntityHorse.class, new RenderHorse(mgr, new ModelHorse()));
map.put(EntityDynamite.class, new RenderDynamite(mgr, Items.dynamite, ritem));
map.put(EntityNuke.class, new RenderBlockEntity(mgr, Blocks.nuke.getState()));
map.put(EntityMouse.class, new RenderMouse(mgr, new ModelMouse()));
map.put(EntityDie.class, new RenderDie(mgr));
map.put(EntityBullet.class, new RenderBullet(mgr));
map.put(EntityLightning.class, new RenderLightning(mgr));
models.put(ModelType.HUMANOID, new RenderHumanoid(mgr, 12, 12, "textures/entity/char.png"));
models.put(ModelType.ARACHNOID, new RenderArachnoid(mgr));
models.put(ModelType.SLIME, new RenderSlime(mgr));
models.put(ModelType.DWARF, new RenderHumanoid(mgr, 10, 10, "textures/entity/dwarf.png"));
models.put(ModelType.HALFLING, new RenderHumanoid(mgr, 8, 8, "textures/entity/goblin.png"));
models.put(ModelType.SPACE_MARINE, new RenderSpaceMarine(mgr));
for(int z = 0; z < SpeciesRegistry.SPECIMEN.size(); z++) {
SpeciesInfo info = SpeciesRegistry.SPECIMEN.get(z);
map.put(info.clazz, models.get(info.renderer));
}
}
public static void registerAnimations(Map<String, Class<? extends TextureTicked>> anim) {
anim.put("fire1", TextureFlamesFX1.class);
anim.put("fire2", TextureFlamesFX2.class);
anim.put("lavaflow", TextureLavaFlowFX.class);
anim.put("lava", TextureLavaFX.class);
anim.put("waterflow", TextureWaterFlowFX.class);
anim.put("water", TextureWaterFX.class);
}
}

View file

@ -1,69 +0,0 @@
package client.network;
import java.security.PublicKey;
import javax.crypto.SecretKey;
import client.Client;
import common.network.IClientLoginHandler;
import common.network.NetConnection;
import common.network.NetHandler;
import common.network.PacketRegistry;
import common.packet.LPacketPasswordResponse;
import common.packet.LPacketStartEncrypt;
import common.packet.RPacketDisconnect;
import common.packet.RPacketEnableCompression;
import common.packet.RPacketLoginSuccess;
import common.packet.RPacketRequestEncrypt;
import common.util.EncryptUtil;
import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.GenericFutureListener;
public class ClientLoginHandler extends NetHandler implements IClientLoginHandler {
private final Client gm;
private final NetConnection networkManager;
private final String user;
private final String access;
private final String password;
public ClientLoginHandler(NetConnection conn, Client gmIn, String userIn, String accessIn, String passwordIn) {
this.networkManager = conn;
this.gm = gmIn;
this.user = userIn;
this.access = accessIn;
this.password = passwordIn;
}
public void onDisconnect(String reason)
{
this.gm.disconnected(reason);
}
public void handleDisconnect(RPacketDisconnect packetIn)
{
this.networkManager.closeChannel(packetIn.getReason());
}
public void handleEncrypt(RPacketRequestEncrypt packet) {
final SecretKey secret = EncryptUtil.createNewSharedKey();
PublicKey pubkey = packet.getKey();
this.networkManager.sendPacket(new LPacketStartEncrypt(secret, pubkey, packet.getToken()), new GenericFutureListener < Future <? super Void >> () {
public void operationComplete(Future <? super Void > u) throws Exception {
ClientLoginHandler.this.networkManager.startEncryption(secret);
ClientLoginHandler.this.networkManager.sendPacket(new LPacketPasswordResponse(ClientLoginHandler.this.user, ClientLoginHandler.this.access, ClientLoginHandler.this.password));
}
});
}
public void handleLoginSuccess(RPacketLoginSuccess packetIn)
{
this.gm.debugWorld = packetIn.isDebug();
this.networkManager.setConnectionState(PacketRegistry.PLAY);
this.networkManager.setNetHandler(new ClientPlayer(this.gm, this.networkManager));
}
public void handleEnableCompression(RPacketEnableCompression packetIn)
{
this.networkManager.setCompressionTreshold(packetIn.getValue());
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,150 +0,0 @@
package client.renderer;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import org.lwjgl.opengl.GL11;
import common.block.Block;
import common.block.BlockLiquid;
import common.entity.Entity;
import common.entity.npc.EntityNPC;
import common.util.BlockPos;
import common.util.ExtMath;
import common.util.Vec3;
import common.world.State;
import common.world.World;
public class ActiveRenderInfo
{
/** The current GL viewport */
private static final IntBuffer VIEWPORT = ByteBuffer.allocateDirect(16 << 2).order(ByteOrder.nativeOrder()).asIntBuffer();
/** The current GL modelview matrix */
private static final FloatBuffer MODELVIEW = ByteBuffer.allocateDirect(16 << 2).order(ByteOrder.nativeOrder()).asFloatBuffer();
/** The current GL projection matrix */
private static final FloatBuffer PROJECTION = ByteBuffer.allocateDirect(16 << 2).order(ByteOrder.nativeOrder()).asFloatBuffer();
/** The computed view object coordinates */
private static final FloatBuffer OBJECTCOORDS = ByteBuffer.allocateDirect(3 << 2).order(ByteOrder.nativeOrder()).asFloatBuffer();
private static Vec3 position = new Vec3(0.0D, 0.0D, 0.0D);
private static final FloatBuffer SCREENCOORDS = ByteBuffer.allocateDirect(3 << 2).order(ByteOrder.nativeOrder()).asFloatBuffer();
/** The X component of the entity's yaw rotation */
private static float rotationX;
/** The combined X and Z components of the entity's pitch rotation */
private static float rotationXZ;
/** The Z component of the entity's yaw rotation */
private static float rotationZ;
/**
* The Y component (scaled along the Z axis) of the entity's pitch rotation
*/
private static float rotationYZ;
/**
* The Y component (scaled along the X axis) of the entity's pitch rotation
*/
private static float rotationXY;
/**
* Updates the current render info and camera location based on entity look angles and 1st/3rd person view mode
*/
public static void updateRenderInfo(EntityNPC entityplayerIn, boolean p_74583_1_)
{
GL11.glGetFloatv(2982, MODELVIEW);
GL11.glGetFloatv(2983, PROJECTION);
GL11.glGetIntegerv(GL11.GL_VIEWPORT, VIEWPORT);
float f = (float)((VIEWPORT.get(0) + VIEWPORT.get(2)) / 2);
float f1 = (float)((VIEWPORT.get(1) + VIEWPORT.get(3)) / 2);
Project.gluUnProject(f, f1, 0.0F, MODELVIEW, PROJECTION, VIEWPORT, OBJECTCOORDS);
position = new Vec3((double)OBJECTCOORDS.get(0), (double)OBJECTCOORDS.get(1), (double)OBJECTCOORDS.get(2));
int i = p_74583_1_ ? 1 : 0;
float f2 = entityplayerIn.rotPitch;
float f3 = entityplayerIn.rotYaw;
rotationX = ExtMath.cos(f3 * (float)Math.PI / 180.0F) * (float)(1 - i * 2);
rotationZ = ExtMath.sin(f3 * (float)Math.PI / 180.0F) * (float)(1 - i * 2);
rotationYZ = -rotationZ * ExtMath.sin(f2 * (float)Math.PI / 180.0F) * (float)(1 - i * 2);
rotationXY = rotationX * ExtMath.sin(f2 * (float)Math.PI / 180.0F) * (float)(1 - i * 2);
rotationXZ = ExtMath.cos(f2 * (float)Math.PI / 180.0F);
}
public static Vec3 getDisplayCoords(float x, float y, float z) {
Project.gluProject(x, y, z, MODELVIEW, PROJECTION, VIEWPORT, SCREENCOORDS);
return new Vec3((double)SCREENCOORDS.get(0), (double)SCREENCOORDS.get(1), (double)SCREENCOORDS.get(2));
}
public static Vec3 projectViewFromEntity(Entity p_178806_0_, double p_178806_1_)
{
double d0 = p_178806_0_.prevX + (p_178806_0_.posX - p_178806_0_.prevX) * p_178806_1_;
double d1 = p_178806_0_.prevY + (p_178806_0_.posY - p_178806_0_.prevY) * p_178806_1_;
double d2 = p_178806_0_.prevZ + (p_178806_0_.posZ - p_178806_0_.prevZ) * p_178806_1_;
double d3 = d0 + position.xCoord;
double d4 = d1 + position.yCoord;
double d5 = d2 + position.zCoord;
return new Vec3(d3, d4, d5);
}
public static Block getBlockAtEntityViewpoint(World worldIn, Entity p_180786_1_, float p_180786_2_)
{
Vec3 vec3 = projectViewFromEntity(p_180786_1_, (double)p_180786_2_);
BlockPos blockpos = new BlockPos(vec3);
State iblockstate = worldIn.getState(blockpos);
Block block = iblockstate.getBlock();
if (block.getMaterial().isLiquid())
{
float f = 0.0F;
if (iblockstate.getBlock() instanceof BlockLiquid)
{
f = BlockLiquid.getLiquidHeightPercent(((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue()) - 0.11111111F;
}
float f1 = (float)(blockpos.getY() + 1) - f;
if (vec3.yCoord >= (double)f1)
{
block = worldIn.getState(blockpos.up()).getBlock();
}
}
return block;
}
public static Vec3 getPosition()
{
return position;
}
public static float getRotationX()
{
return rotationX;
}
public static float getRotationXZ()
{
return rotationXZ;
}
public static float getRotationZ()
{
return rotationZ;
}
public static float getRotationYZ()
{
return rotationYZ;
}
public static float getRotationXY()
{
return rotationXY;
}
}

View file

@ -1,682 +0,0 @@
package client.renderer;
import java.util.BitSet;
import java.util.List;
import java.util.Map;
import org.lwjgl.opengl.GL11;
import client.Client;
import client.renderer.blockmodel.BakedModel;
import client.renderer.blockmodel.BakedQuad;
import client.renderer.blockmodel.IBakedModel;
import client.renderer.blockmodel.ModelManager;
import client.renderer.texture.TextureAtlasSprite;
import client.renderer.texture.TextureMap;
import client.renderer.tileentity.TileEntityItemStackRenderer;
import common.block.Block;
import common.block.BlockLiquid;
import common.collect.Maps;
import common.init.BlockRegistry;
import common.init.FluidRegistry;
import common.item.ItemStack;
import common.material.Material;
import common.util.BlockPos;
import common.util.ExtMath;
import common.util.Facing;
import common.util.Vec3i;
import common.world.IBlockAccess;
import common.world.IWorldAccess;
import common.world.State;
public class BlockRenderer
{
private ModelManager manager;
private final Client gm;
private final Map<BlockLiquid, TextureAtlasSprite[]> fluids = Maps.newHashMap();
public BlockRenderer(ModelManager manager, Client gm)
{
this.manager = manager;
this.gm = gm;
this.initAtlasSprites();
}
public ModelManager getModelManager()
{
return this.manager;
}
public void renderBlockDamage(State state, BlockPos pos, TextureAtlasSprite texture, IWorldAccess blockAccess)
{
Block block = state.getBlock();
int i = block.getRenderType();
if (i == 3)
{
state = block.getActualState(state, blockAccess, pos);
IBakedModel ibakedmodel = this.manager.getModelForState(state);
IBakedModel ibakedmodel1 = (new BakedModel.Builder(ibakedmodel, texture)).makeBakedModel();
// Tessellator.getInstance();
this.renderModel(blockAccess, ibakedmodel1, state, pos, Tessellator.getBuffer());
}
}
public boolean renderBlock(State state, BlockPos pos, IWorldAccess blockAccess, RenderBuffer worldRendererIn)
{
if(this.gm.xrayActive && !state.getBlock().isXrayVisible())
return false;
int i = state.getBlock().getRenderType();
if (i == -1)
{
return false;
}
else
{
switch (i)
{
case 1:
return this.renderFluid(blockAccess, state, pos, worldRendererIn);
case 2:
return false;
case 3:
IBakedModel ibakedmodel = this.getModelFromBlockState(state, blockAccess, pos);
return this.renderBase(blockAccess, ibakedmodel, state, pos, worldRendererIn, !this.gm.xrayActive);
default:
return false;
}
}
}
public IBakedModel getModelFromBlockState(State state, IWorldAccess worldIn, BlockPos pos)
{
Block block = state.getBlock();
if (!this.gm.debugWorld)
{
try
{
state = block.getActualState(state, worldIn, pos);
}
catch (Exception var6)
{
;
}
}
return this.manager.getModelForState(state);
// if (pos != null && this.gameSettings.allowBlockAlternatives && ibakedmodel instanceof WeightedBakedModel)
// {
// ibakedmodel = ((WeightedBakedModel)ibakedmodel).getAlternativeModel(MathHelper.getPositionRandom(pos));
// }
//
// return ibakedmodel;
}
public void renderBlockBrightness(State state, float brightness)
{
int i = state.getBlock().getRenderType();
if (i != -1)
{
switch (i)
{
case 1:
default:
break;
case 2:
// this.chestRenderer.renderChestBrightness(state.getBlock(), brightness);
GlState.color(brightness, brightness, brightness, 1.0F);
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
TileEntityItemStackRenderer.instance.renderByItem(new ItemStack(state.getBlock()));
break;
case 3:
IBakedModel ibakedmodel = this.manager.getModelForState(state);
this.renderModelBrightness(ibakedmodel, state, brightness, true);
}
}
}
// public boolean isRenderTypeChest(Block p_175021_1_, int p_175021_2_)
// {
// if (p_175021_1_ == null)
// {
// return false;
// }
// else
// {
// int i = p_175021_1_.getRenderType();
// return i == 3 ? false : i == 2;
// }
// }
public void onReload()
{
this.initAtlasSprites();
}
private boolean renderBase(IWorldAccess blockAccessIn, IBakedModel modelIn, State blockStateIn, BlockPos blockPosIn, RenderBuffer worldRendererIn, boolean checkSides)
{
Block block = blockStateIn.getBlock();
block.setBlockBoundsBasedOnState(blockAccessIn, blockPosIn);
return this.renderModel(blockAccessIn, modelIn, blockStateIn, blockPosIn, worldRendererIn, checkSides);
}
private boolean renderModel(IWorldAccess blockAccessIn, IBakedModel modelIn, State blockStateIn, BlockPos blockPosIn, RenderBuffer worldRendererIn)
{
Block block = blockStateIn.getBlock();
block.setBlockBoundsBasedOnState(blockAccessIn, blockPosIn);
return this.renderModel(blockAccessIn, modelIn, blockStateIn, blockPosIn, worldRendererIn, true);
}
public boolean renderModel(IWorldAccess blockAccessIn, IBakedModel modelIn, State blockStateIn, BlockPos blockPosIn, RenderBuffer worldRendererIn, boolean checkSides)
{
// return this.renderModelStandard(blockAccessIn, modelIn, , blockPosIn, worldRendererIn, checkSides);
// }
//
// public boolean renderModelStandard(IWorldAccess blockAccessIn, IBakedModel modelIn, Block blockIn, BlockPos blockPosIn, RenderBuffer worldRendererIn, boolean checkSides)
// {
Block blockIn = blockStateIn.getBlock();
boolean flag = false;
BitSet bitset = new BitSet(3);
for (Facing enumfacing : Facing.values())
{
List<BakedQuad> list = modelIn.getFaceQuads(enumfacing);
if (!list.isEmpty())
{
BlockPos blockpos = blockPosIn.offset(enumfacing);
if (!checkSides || blockIn.shouldSideBeRendered(blockAccessIn, blockpos, enumfacing))
{
int i = blockIn.getMixedBrightnessForBlock(blockAccessIn, blockpos);
this.renderModelStandardQuads(blockAccessIn, blockIn, blockPosIn, enumfacing, i, false, worldRendererIn, list, bitset);
flag = true;
}
}
}
List<BakedQuad> list1 = modelIn.getGeneralQuads();
if (list1.size() > 0)
{
this.renderModelStandardQuads(blockAccessIn, blockIn, blockPosIn, (Facing)null, -1, true, worldRendererIn, list1, bitset);
flag = true;
}
return flag;
}
private void fillQuadBounds(Block blockIn, int[] vertexData, Facing facingIn, float[] quadBounds, BitSet boundsFlags)
{
float f = 32.0F;
float f1 = 32.0F;
float f2 = 32.0F;
float f3 = -32.0F;
float f4 = -32.0F;
float f5 = -32.0F;
for (int i = 0; i < 4; ++i)
{
float f6 = Float.intBitsToFloat(vertexData[i * 7]);
float f7 = Float.intBitsToFloat(vertexData[i * 7 + 1]);
float f8 = Float.intBitsToFloat(vertexData[i * 7 + 2]);
f = Math.min(f, f6);
f1 = Math.min(f1, f7);
f2 = Math.min(f2, f8);
f3 = Math.max(f3, f6);
f4 = Math.max(f4, f7);
f5 = Math.max(f5, f8);
}
if (quadBounds != null)
{
quadBounds[Facing.WEST.getIndex()] = f;
quadBounds[Facing.EAST.getIndex()] = f3;
quadBounds[Facing.DOWN.getIndex()] = f1;
quadBounds[Facing.UP.getIndex()] = f4;
quadBounds[Facing.NORTH.getIndex()] = f2;
quadBounds[Facing.SOUTH.getIndex()] = f5;
quadBounds[Facing.WEST.getIndex() + Facing.values().length] = 1.0F - f;
quadBounds[Facing.EAST.getIndex() + Facing.values().length] = 1.0F - f3;
quadBounds[Facing.DOWN.getIndex() + Facing.values().length] = 1.0F - f1;
quadBounds[Facing.UP.getIndex() + Facing.values().length] = 1.0F - f4;
quadBounds[Facing.NORTH.getIndex() + Facing.values().length] = 1.0F - f2;
quadBounds[Facing.SOUTH.getIndex() + Facing.values().length] = 1.0F - f5;
}
float f9 = 1.0E-4F;
float f10 = 0.9999F;
switch (facingIn)
{
case DOWN:
boundsFlags.set(1, f >= 1.0E-4F || f2 >= 1.0E-4F || f3 <= 0.9999F || f5 <= 0.9999F);
boundsFlags.set(0, (f1 < 1.0E-4F || blockIn.isFullCube()) && f1 == f4);
break;
case UP:
boundsFlags.set(1, f >= 1.0E-4F || f2 >= 1.0E-4F || f3 <= 0.9999F || f5 <= 0.9999F);
boundsFlags.set(0, (f4 > 0.9999F || blockIn.isFullCube()) && f1 == f4);
break;
case NORTH:
boundsFlags.set(1, f >= 1.0E-4F || f1 >= 1.0E-4F || f3 <= 0.9999F || f4 <= 0.9999F);
boundsFlags.set(0, (f2 < 1.0E-4F || blockIn.isFullCube()) && f2 == f5);
break;
case SOUTH:
boundsFlags.set(1, f >= 1.0E-4F || f1 >= 1.0E-4F || f3 <= 0.9999F || f4 <= 0.9999F);
boundsFlags.set(0, (f5 > 0.9999F || blockIn.isFullCube()) && f2 == f5);
break;
case WEST:
boundsFlags.set(1, f1 >= 1.0E-4F || f2 >= 1.0E-4F || f4 <= 0.9999F || f5 <= 0.9999F);
boundsFlags.set(0, (f < 1.0E-4F || blockIn.isFullCube()) && f == f3);
break;
case EAST:
boundsFlags.set(1, f1 >= 1.0E-4F || f2 >= 1.0E-4F || f4 <= 0.9999F || f5 <= 0.9999F);
boundsFlags.set(0, (f3 > 0.9999F || blockIn.isFullCube()) && f == f3);
}
}
private void renderModelStandardQuads(IWorldAccess blockAccessIn, Block blockIn, BlockPos blockPosIn, Facing faceIn, int brightnessIn, boolean ownBrightness, RenderBuffer worldRendererIn, List<BakedQuad> listQuadsIn, BitSet boundsFlags)
{
double d0 = (double)blockPosIn.getX();
double d1 = (double)blockPosIn.getY();
double d2 = (double)blockPosIn.getZ();
// EnumOffsetType block$enumoffsettype = blockIn.getOffsetType();
//
// if (block$enumoffsettype != EnumOffsetType.NONE)
// {
// int i = blockPosIn.getX();
// int j = blockPosIn.getZ();
// long k = (long)(i * 3129871) ^ (long)j * 116129781L;
// k = k * k * 42317861L + k * 11L;
// d0 += ((double)((float)(k >> 16 & 15L) / 15.0F) - 0.5D) * 0.5D;
// d2 += ((double)((float)(k >> 24 & 15L) / 15.0F) - 0.5D) * 0.5D;
//
// if (block$enumoffsettype == EnumOffsetType.XYZ)
// {
// d1 += ((double)((float)(k >> 20 & 15L) / 15.0F) - 1.0D) * 0.2D;
// }
// }
for (BakedQuad bakedquad : listQuadsIn)
{
if (ownBrightness)
{
this.fillQuadBounds(blockIn, bakedquad.getVertexData(), bakedquad.getFace(), (float[])null, boundsFlags);
brightnessIn = boundsFlags.get(0) ? blockIn.getMixedBrightnessForBlock(blockAccessIn, blockPosIn.offset(bakedquad.getFace())) : blockIn.getMixedBrightnessForBlock(blockAccessIn, blockPosIn);
}
worldRendererIn.addVertexData(bakedquad.getVertexData());
worldRendererIn.putBrightness4(brightnessIn, brightnessIn, brightnessIn, brightnessIn);
if (bakedquad.hasTintIndex())
{
int l = blockIn.colorMultiplier(blockAccessIn, blockPosIn, bakedquad.getTintIndex());
// if (EntityRenderer.anaglyphEnable)
// {
// l = TextureUtil.anaglyphColor(l);
// }
float f = (float)(l >> 16 & 255) / 255.0F;
float f1 = (float)(l >> 8 & 255) / 255.0F;
float f2 = (float)(l & 255) / 255.0F;
worldRendererIn.putColorMultiplier(f, f1, f2, 4);
worldRendererIn.putColorMultiplier(f, f1, f2, 3);
worldRendererIn.putColorMultiplier(f, f1, f2, 2);
worldRendererIn.putColorMultiplier(f, f1, f2, 1);
}
worldRendererIn.putPosition(d0, d1, d2);
}
}
public void renderModelBrightnessColor(IBakedModel bakedModel, float p_178262_2_, float red, float green, float blue)
{
for (Facing enumfacing : Facing.values())
{
this.renderModelBrightnessColorQuads(p_178262_2_, red, green, blue, bakedModel.getFaceQuads(enumfacing));
}
this.renderModelBrightnessColorQuads(p_178262_2_, red, green, blue, bakedModel.getGeneralQuads());
}
private void renderModelBrightness(IBakedModel model, State p_178266_2_, float brightness, boolean p_178266_4_)
{
Block block = p_178266_2_.getBlock();
block.setBlockBoundsForItemRender();
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
int i = block.getRenderColor(block.getStateForEntityRender(p_178266_2_));
// if (EntityRenderer.anaglyphEnable)
// {
// i = TextureUtil.anaglyphColor(i);
// }
float f = (float)(i >> 16 & 255) / 255.0F;
float f1 = (float)(i >> 8 & 255) / 255.0F;
float f2 = (float)(i & 255) / 255.0F;
if (!p_178266_4_)
{
GlState.color(brightness, brightness, brightness, 1.0F);
}
this.renderModelBrightnessColor(model, brightness, f, f1, f2);
}
private void renderModelBrightnessColorQuads(float brightness, float red, float green, float blue, List<BakedQuad> listQuads)
{
// Tessellator tessellator = Tessellator.getInstance();
RenderBuffer worldrenderer = Tessellator.getBuffer();
for (BakedQuad bakedquad : listQuads)
{
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
worldrenderer.addVertexData(bakedquad.getVertexData());
if (bakedquad.hasTintIndex())
{
worldrenderer.putColorRGB_F4(red * brightness, green * brightness, blue * brightness);
}
else
{
worldrenderer.putColorRGB_F4(brightness, brightness, brightness);
}
Vec3i vec3i = bakedquad.getFace().getDirectionVec();
worldrenderer.putNormal((float)vec3i.getX(), (float)vec3i.getY(), (float)vec3i.getZ());
Tessellator.draw();
}
}
private void initAtlasSprites()
{
TextureMap texturemap = Client.CLIENT.getTextureMapBlocks();
for(int z = 0; z < FluidRegistry.getNumFluids(); z++) {
BlockLiquid block = FluidRegistry.getStaticBlock(z);
String name = BlockRegistry.REGISTRY.getNameForObject(block).toString();
TextureAtlasSprite[] sprites = new TextureAtlasSprite[] {texturemap.getAtlasSprite("blocks/" + name + "_still"), texturemap.getAtlasSprite("blocks/" + name + "_flow")};
this.fluids.put(FluidRegistry.getFluidBlock(z), sprites);
this.fluids.put(block, sprites);
}
}
private boolean renderFluid(IWorldAccess blockAccess, State blockStateIn, BlockPos blockPosIn, RenderBuffer worldRendererIn)
{
BlockLiquid blockliquid = (BlockLiquid)blockStateIn.getBlock();
blockliquid.setBlockBoundsBasedOnState(blockAccess, blockPosIn);
TextureAtlasSprite[] atextureatlassprite = this.fluids.get(blockliquid);
int i = blockliquid.colorMultiplier(blockAccess, blockPosIn);
float f = (float)(i >> 16 & 255) / 255.0F;
float f1 = (float)(i >> 8 & 255) / 255.0F;
float f2 = (float)(i & 255) / 255.0F;
boolean flag = blockliquid.shouldSideBeRendered(blockAccess, blockPosIn.up(), Facing.UP);
boolean flag1 = blockliquid.shouldSideBeRendered(blockAccess, blockPosIn.down(), Facing.DOWN);
boolean[] aboolean = new boolean[] {blockliquid.shouldSideBeRendered(blockAccess, blockPosIn.north(), Facing.NORTH), blockliquid.shouldSideBeRendered(blockAccess, blockPosIn.south(), Facing.SOUTH), blockliquid.shouldSideBeRendered(blockAccess, blockPosIn.west(), Facing.WEST), blockliquid.shouldSideBeRendered(blockAccess, blockPosIn.east(), Facing.EAST)};
if (!flag && !flag1 && !aboolean[0] && !aboolean[1] && !aboolean[2] && !aboolean[3])
{
return false;
}
else
{
boolean flag2 = false;
float f3 = 0.5F;
float f4 = 1.0F;
float f5 = 0.8F;
float f6 = 0.6F;
Material material = blockliquid.getMaterial();
float f7 = this.getFluidHeight(blockAccess, blockPosIn, material);
float f8 = this.getFluidHeight(blockAccess, blockPosIn.south(), material);
float f9 = this.getFluidHeight(blockAccess, blockPosIn.east().south(), material);
float f10 = this.getFluidHeight(blockAccess, blockPosIn.east(), material);
double d0 = (double)blockPosIn.getX();
double d1 = (double)blockPosIn.getY();
double d2 = (double)blockPosIn.getZ();
float f11 = 0.001F;
if (flag)
{
flag2 = true;
TextureAtlasSprite textureatlassprite = atextureatlassprite[0];
float f12 = (float)BlockLiquid.getFlowDirection(blockAccess, blockPosIn, blockliquid);
if (f12 > -999.0F)
{
textureatlassprite = atextureatlassprite[1];
}
f7 -= f11;
f8 -= f11;
f9 -= f11;
f10 -= f11;
float f13;
float f14;
float f15;
float f16;
float f17;
float f18;
float f19;
float f20;
if (f12 < -999.0F)
{
f13 = textureatlassprite.getInterpolatedU(0.0D);
f17 = textureatlassprite.getInterpolatedV(0.0D);
f14 = f13;
f18 = textureatlassprite.getInterpolatedV(16.0D);
f15 = textureatlassprite.getInterpolatedU(16.0D);
f19 = f18;
f16 = f15;
f20 = f17;
}
else
{
float f21 = ExtMath.sin(f12) * 0.25F;
float f22 = ExtMath.cos(f12) * 0.25F;
float f23 = 8.0F;
f13 = textureatlassprite.getInterpolatedU((double)(8.0F + (-f22 - f21) * 16.0F));
f17 = textureatlassprite.getInterpolatedV((double)(8.0F + (-f22 + f21) * 16.0F));
f14 = textureatlassprite.getInterpolatedU((double)(8.0F + (-f22 + f21) * 16.0F));
f18 = textureatlassprite.getInterpolatedV((double)(8.0F + (f22 + f21) * 16.0F));
f15 = textureatlassprite.getInterpolatedU((double)(8.0F + (f22 + f21) * 16.0F));
f19 = textureatlassprite.getInterpolatedV((double)(8.0F + (f22 - f21) * 16.0F));
f16 = textureatlassprite.getInterpolatedU((double)(8.0F + (f22 - f21) * 16.0F));
f20 = textureatlassprite.getInterpolatedV((double)(8.0F + (-f22 - f21) * 16.0F));
}
int k2 = blockliquid.getMixedBrightnessForBlock(blockAccess, blockPosIn);
int l2 = k2 >> 16 & 65535;
int i3 = k2 & 65535;
float f24 = f4 * f;
float f25 = f4 * f1;
float f26 = f4 * f2;
worldRendererIn.pos(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).color(f24, f25, f26, 1.0F).tex((double)f13, (double)f17).lightmap(l2, i3).endVertex();
worldRendererIn.pos(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).color(f24, f25, f26, 1.0F).tex((double)f14, (double)f18).lightmap(l2, i3).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).color(f24, f25, f26, 1.0F).tex((double)f15, (double)f19).lightmap(l2, i3).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).color(f24, f25, f26, 1.0F).tex((double)f16, (double)f20).lightmap(l2, i3).endVertex();
if (blockliquid.shouldRenderSides(blockAccess, blockPosIn.up()))
{
worldRendererIn.pos(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).color(f24, f25, f26, 1.0F).tex((double)f13, (double)f17).lightmap(l2, i3).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).color(f24, f25, f26, 1.0F).tex((double)f16, (double)f20).lightmap(l2, i3).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).color(f24, f25, f26, 1.0F).tex((double)f15, (double)f19).lightmap(l2, i3).endVertex();
worldRendererIn.pos(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).color(f24, f25, f26, 1.0F).tex((double)f14, (double)f18).lightmap(l2, i3).endVertex();
}
}
if (flag1)
{
float f35 = atextureatlassprite[0].getMinU();
float f36 = atextureatlassprite[0].getMaxU();
float f37 = atextureatlassprite[0].getMinV();
float f38 = atextureatlassprite[0].getMaxV();
int l1 = blockliquid.getMixedBrightnessForBlock(blockAccess, blockPosIn.down());
int i2 = l1 >> 16 & 65535;
int j2 = l1 & 65535;
worldRendererIn.pos(d0, d1, d2 + 1.0D).color(f3, f3, f3, 1.0F).tex((double)f35, (double)f38).lightmap(i2, j2).endVertex();
worldRendererIn.pos(d0, d1, d2).color(f3, f3, f3, 1.0F).tex((double)f35, (double)f37).lightmap(i2, j2).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1, d2).color(f3, f3, f3, 1.0F).tex((double)f36, (double)f37).lightmap(i2, j2).endVertex();
worldRendererIn.pos(d0 + 1.0D, d1, d2 + 1.0D).color(f3, f3, f3, 1.0F).tex((double)f36, (double)f38).lightmap(i2, j2).endVertex();
flag2 = true;
}
for (int i1 = 0; i1 < 4; ++i1)
{
int j1 = 0;
int k1 = 0;
if (i1 == 0)
{
--k1;
}
if (i1 == 1)
{
++k1;
}
if (i1 == 2)
{
--j1;
}
if (i1 == 3)
{
++j1;
}
BlockPos blockpos = blockPosIn.add(j1, 0, k1);
TextureAtlasSprite textureatlassprite1 = atextureatlassprite[1];
if (aboolean[i1])
{
float f39;
float f40;
double d3;
double d4;
double d5;
double d6;
if (i1 == 0)
{
f39 = f7;
f40 = f10;
d3 = d0;
d5 = d0 + 1.0D;
d4 = d2 + (double)f11;
d6 = d2 + (double)f11;
}
else if (i1 == 1)
{
f39 = f9;
f40 = f8;
d3 = d0 + 1.0D;
d5 = d0;
d4 = d2 + 1.0D - (double)f11;
d6 = d2 + 1.0D - (double)f11;
}
else if (i1 == 2)
{
f39 = f8;
f40 = f7;
d3 = d0 + (double)f11;
d5 = d0 + (double)f11;
d4 = d2 + 1.0D;
d6 = d2;
}
else
{
f39 = f10;
f40 = f9;
d3 = d0 + 1.0D - (double)f11;
d5 = d0 + 1.0D - (double)f11;
d4 = d2;
d6 = d2 + 1.0D;
}
flag2 = true;
float f41 = textureatlassprite1.getInterpolatedU(0.0D);
float f27 = textureatlassprite1.getInterpolatedU(8.0D);
float f28 = textureatlassprite1.getInterpolatedV((double)((1.0F - f39) * 16.0F * 0.5F));
float f29 = textureatlassprite1.getInterpolatedV((double)((1.0F - f40) * 16.0F * 0.5F));
float f30 = textureatlassprite1.getInterpolatedV(8.0D);
int j = blockliquid.getMixedBrightnessForBlock(blockAccess, blockpos);
int k = j >> 16 & 65535;
int l = j & 65535;
float f31 = i1 < 2 ? f5 : f6;
float f32 = f4 * f31 * f;
float f33 = f4 * f31 * f1;
float f34 = f4 * f31 * f2;
worldRendererIn.pos(d3, d1 + (double)f39, d4).color(f32, f33, f34, 1.0F).tex((double)f41, (double)f28).lightmap(k, l).endVertex();
worldRendererIn.pos(d5, d1 + (double)f40, d6).color(f32, f33, f34, 1.0F).tex((double)f27, (double)f29).lightmap(k, l).endVertex();
worldRendererIn.pos(d5, d1 + 0.0D, d6).color(f32, f33, f34, 1.0F).tex((double)f27, (double)f30).lightmap(k, l).endVertex();
worldRendererIn.pos(d3, d1 + 0.0D, d4).color(f32, f33, f34, 1.0F).tex((double)f41, (double)f30).lightmap(k, l).endVertex();
worldRendererIn.pos(d3, d1 + 0.0D, d4).color(f32, f33, f34, 1.0F).tex((double)f41, (double)f30).lightmap(k, l).endVertex();
worldRendererIn.pos(d5, d1 + 0.0D, d6).color(f32, f33, f34, 1.0F).tex((double)f27, (double)f30).lightmap(k, l).endVertex();
worldRendererIn.pos(d5, d1 + (double)f40, d6).color(f32, f33, f34, 1.0F).tex((double)f27, (double)f29).lightmap(k, l).endVertex();
worldRendererIn.pos(d3, d1 + (double)f39, d4).color(f32, f33, f34, 1.0F).tex((double)f41, (double)f28).lightmap(k, l).endVertex();
}
}
return flag2;
}
}
private float getFluidHeight(IBlockAccess blockAccess, BlockPos blockPosIn, Material blockMaterial)
{
int i = 0;
float f = 0.0F;
for (int j = 0; j < 4; ++j)
{
BlockPos blockpos = blockPosIn.add(-(j & 1), 0, -(j >> 1 & 1));
if (blockAccess.getState(blockpos.up()).getBlock().getMaterial() == blockMaterial)
{
return 1.0F;
}
State iblockstate = blockAccess.getState(blockpos);
Material material = iblockstate.getBlock().getMaterial();
if (material != blockMaterial)
{
if (!material.isSolid())
{
++f;
++i;
}
}
else
{
int k = ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue();
if (k >= 8 || k == 0)
{
f += BlockLiquid.getLiquidHeightPercent(k) * 10.0F;
i += 10;
}
f += BlockLiquid.getLiquidHeightPercent(k);
++i;
}
}
return 1.0F - f / (float)i;
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,137 +0,0 @@
package client.renderer;
import java.util.List;
import java.util.Map;
import client.renderer.blockmodel.IBakedModel;
import client.renderer.blockmodel.ModelManager;
import client.renderer.texture.TextureAtlasSprite;
import common.collect.Lists;
import common.collect.Maps;
import common.init.ItemRegistry;
import common.item.Item;
import common.item.ItemStack;
import common.model.ItemMeshDefinition;
public class ItemModelMesher
{
// private final Map<Integer, ResourceLocation> simpleShapes = Maps.<Integer, ResourceLocation>newHashMap();
private final Map<Integer, IBakedModel> simpleShapesCache = Maps.<Integer, IBakedModel>newHashMap();
private final Map<Item, ItemMeshDefinition> shapers = Maps.<Item, ItemMeshDefinition>newHashMap();
private final ModelManager modelManager;
public ItemModelMesher(ModelManager modelManager)
{
this.modelManager = modelManager;
for(Item item : ItemRegistry.REGISTRY) {
ItemMeshDefinition mesher = item.getMesher();
if(mesher != null)
this.shapers.put(item, mesher);
}
}
public TextureAtlasSprite getParticleIcon(Item item)
{
return this.getParticleIcon(item, 0);
}
public TextureAtlasSprite getParticleIcon(Item item, int meta)
{
return this.getItemModel(new ItemStack(item, 1, meta)).getParticleTexture();
}
public IBakedModel getItemModel(ItemStack stack)
{
Item item = stack.getItem();
IBakedModel ibakedmodel = this.simpleShapesCache.get(Integer.valueOf(this.getIndex(item,
stack.isItemStackDamageable() ? 0 : stack.getMetadata())));
if (ibakedmodel == null)
{
ItemMeshDefinition itemmeshdefinition = this.shapers.get(item);
if (itemmeshdefinition != null)
{
ibakedmodel = this.modelManager.getModel(itemmeshdefinition.getModelLocation(stack));
}
}
if (ibakedmodel == null)
{
ibakedmodel = this.modelManager.getMissingModel();
}
return ibakedmodel;
}
private int getIndex(Item item, int meta)
{
return ItemRegistry.getIdFromItem(item) << 16 | meta;
}
// public void register(Item item, int meta, ResourceLocation location)
// {
// this.simpleShapes.put(Integer.valueOf(this.getIndex(item, meta)), location);
// this.simpleShapesCache.put(Integer.valueOf(this.getIndex(item, meta)), this.modelManager.getModel(location));
// }
// public void register(Item item, ItemMeshDefinition definition)
// {
// this.shapers.put(item, definition);
// }
// public void registerItem(Item itm, int subType, String identifier)
// {
// this.register(itm, subType, new ResourceLocation(identifier, "inventory"));
//// String id = ItemRegistry.REGISTRY.getNameForObject(itm).toString();
//// if(id.equals(identifier)) {
////// throw new IllegalArgumentException("Duplikat: " + identifier);
//// Log.DATA.info("MATCHING: " + ItemRegistry.REGISTRY.getNameForObject(itm) + ":" + subType);
//// }
//// else {
//// Log.DATA.info("MISMATCH: " + ItemRegistry.REGISTRY.getNameForObject(itm) + ":" + subType + ": " + identifier);
//// }
// }
// public void registerBlock(Block blk, int subType, String identifier)
// {
// this.registerItem(ItemRegistry.getItemFromBlock(blk), subType, identifier);
// }
//
// public void registerBlock(Block blk, String identifier)
// {
// this.registerBlock(blk, 0, identifier);
// }
//
// public void registerItem(Item itm, String identifier)
// {
// this.registerItem(itm, 0, identifier);
// }
public ModelManager getModelManager()
{
return this.modelManager;
}
public void rebuildCache()
{
this.simpleShapesCache.clear();
List<ItemStack> stacks = Lists.newArrayList();
for(Item item : ItemRegistry.REGISTRY) {
if(this.shapers.containsKey(item))
continue;
item.getRenderItems(item, stacks);
for(ItemStack stack : stacks) {
this.simpleShapesCache.put(this.getIndex(item, stack.getMetadata()),
this.modelManager.getModel("item/" +
ItemRegistry.REGISTRY.getNameForObject(item).toString() + "#" + stack.getMetadata() + '#' + "inventory"));
}
stacks.clear();
}
// for (Entry<Integer, ResourceLocation> entry : this.simpleShapes.entrySet())
// {
// this.simpleShapesCache.put(entry.getKey(), this.modelManager.getModel((ResourceLocation)entry.getValue()));
// }
}
}

View file

@ -1,203 +0,0 @@
package client.renderer;
import java.util.Arrays;
import common.biome.Biome;
import common.init.Blocks;
import common.tileentity.TileEntity;
import common.util.BlockPos;
import common.util.Facing;
import common.util.Vec3i;
import common.world.Chunk;
import common.world.ChunkCache;
import common.world.IWorldAccess;
import common.world.LightType;
import common.world.State;
import common.world.World;
public class RegionRenderCache extends ChunkCache implements IWorldAccess
{
private static final State DEFAULT_STATE = Blocks.air.getState();
private final World worldObj;
private final BlockPos position;
private final boolean empty;
private int[] combinedLights;
private State[] blockStates;
public RegionRenderCache(World worldIn, BlockPos posFromIn, BlockPos posToIn, int subIn)
{
super(worldIn, posFromIn, posToIn, subIn);
this.worldObj = worldIn;
boolean empty = true;
for (int i1 = posFromIn.getX() >> 4; i1 <= posToIn.getX() >> 4; ++i1)
{
for (int j1 = posFromIn.getZ() >> 4; j1 <= posToIn.getZ() >> 4; ++j1)
{
Chunk chunk = this.chunkArray[i1 - this.chunkX][j1 - this.chunkZ];
if (chunk != null && !chunk.isEmpty(posFromIn.getY(), posToIn.getY()))
{
empty = false;
}
}
}
this.empty = empty;
this.position = posFromIn.subtract(new Vec3i(subIn, subIn, subIn));
int i = 16000;
this.combinedLights = new int[16000];
Arrays.fill((int[])this.combinedLights, (int) - 1);
this.blockStates = new State[16000];
}
public TileEntity getTileEntity(BlockPos pos)
{
int i = (pos.getX() >> 4) - this.chunkX;
int j = (pos.getZ() >> 4) - this.chunkZ;
return this.chunkArray[i][j].getTileEntity(pos, TileEntity.EnumCreateEntityType.QUEUED);
}
public int getCombinedLight(BlockPos pos, int lightValue)
{
int i = this.getPositionIndex(pos);
int j = this.combinedLights[i];
if (j == -1)
{
j = this.getLight(pos, lightValue);
this.combinedLights[i] = j;
}
return j;
}
public State getState(BlockPos pos)
{
int i = this.getPositionIndex(pos);
State iblockstate = this.blockStates[i];
if (iblockstate == null)
{
iblockstate = this.getBlockStateRaw(pos);
this.blockStates[i] = iblockstate;
}
return iblockstate;
}
private State getBlockStateRaw(BlockPos pos)
{
if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
{
int i = (pos.getX() >> 4) - this.chunkX;
int j = (pos.getZ() >> 4) - this.chunkZ;
return this.chunkArray[i][j].getState(pos);
}
else
{
return DEFAULT_STATE;
}
}
private int getPositionIndex(BlockPos p_175630_1_)
{
int i = p_175630_1_.getX() - this.position.getX();
int j = p_175630_1_.getY() - this.position.getY();
int k = p_175630_1_.getZ() - this.position.getZ();
return i * 800 + k * 40 + j;
}
public boolean isEmpty()
{
return this.empty;
}
public int getLight(BlockPos pos, int lightValue)
{
int i = this.getLightForExt(LightType.SKY, pos);
int j = this.getLightForExt(LightType.BLOCK, pos);
if (j < lightValue)
{
j = lightValue;
}
return i << 20 | j << 4;
}
public Biome getBiomeGenForCoords(BlockPos pos)
{
return this.worldObj.getBiomeGenForCoords(pos);
}
private int getLightForExt(LightType p_175629_1_, BlockPos pos)
{
if (p_175629_1_ == LightType.SKY && this.worldObj.dimension.hasNoLight())
{
return 0;
}
else if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
{
if (this.getState(pos).getBlock().getSumBrightness())
{
int l = 0;
for (Facing enumfacing : Facing.values())
{
int k = this.getLightFor(p_175629_1_, pos.offset(enumfacing));
if (k > l)
{
l = k;
}
if (l >= 15)
{
return l;
}
}
return l;
}
else
{
int i = (pos.getX() >> 4) - this.chunkX;
int j = (pos.getZ() >> 4) - this.chunkZ;
return this.chunkArray[i][j].getLight(p_175629_1_, pos);
}
}
else
{
return p_175629_1_.defValue;
}
}
// /**
// * Checks to see if an air block exists at the provided location. Note that this only checks to see if the blocks
// * material is set to air, meaning it is possible for non-vanilla blocks to still pass this check.
// */
// public boolean isAirBlock(BlockPos pos)
// {
// return this.getBlockState(pos).getBlock().getMaterial() == Material.air;
// }
public int getLightFor(LightType p_175628_1_, BlockPos pos)
{
if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
{
int i = (pos.getX() >> 4) - this.chunkX;
int j = (pos.getZ() >> 4) - this.chunkZ;
return this.chunkArray[i][j].getLight(p_175628_1_, pos);
}
else
{
return p_175628_1_.defValue;
}
}
// public int getStrongPower(BlockPos pos, EnumFacing direction)
// {
// IBlockState iblockstate = this.getBlockState(pos);
// return iblockstate.getBlock().getStrongPower(this, pos, iblockstate, direction);
// }
}

File diff suppressed because it is too large Load diff

View file

@ -1,51 +0,0 @@
package client.renderer;
import java.nio.ByteBuffer;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL15;
public class VertexBuffer
{
private int glBufferId;
private final VertexFormat vertexFormat;
private int count;
public VertexBuffer(VertexFormat vertexFormatIn)
{
this.vertexFormat = vertexFormatIn;
this.glBufferId = GL15.glGenBuffers();
}
public void bindBuffer()
{
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, this.glBufferId);
}
public void bufferData(ByteBuffer buffer)
{
this.bindBuffer();
GL15.glBufferData(GL15.GL_ARRAY_BUFFER, buffer, GL15.GL_STATIC_DRAW);
this.unbindBuffer();
this.count = buffer.limit() / this.vertexFormat.getNextOffset();
}
public void drawArrays(int mode)
{
GL11.glDrawArrays(mode, 0, this.count);
}
public void unbindBuffer()
{
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
}
public void deleteGlBuffers()
{
if (this.glBufferId >= 0)
{
GL15.glDeleteBuffers(this.glBufferId);
this.glBufferId = -1;
}
}
}

View file

@ -1,156 +0,0 @@
package client.renderer;
import org.lwjgl.opengl.GL11;
import common.log.Log;
public class VertexFormatElement
{
private final VertexFormatElement.EnumType type;
private final VertexFormatElement.EnumUsage usage;
private int index;
private int elementCount;
public VertexFormatElement(int indexIn, VertexFormatElement.EnumType typeIn, VertexFormatElement.EnumUsage usageIn, int count)
{
if (!this.isValid(indexIn, usageIn))
{
Log.JNI.warn("Mehrere Vertex-Elemente des gleichen Typs außer UVs sind nicht unterstützt. Erzwinge Typ UV.");
this.usage = VertexFormatElement.EnumUsage.UV;
}
else
{
this.usage = usageIn;
}
this.type = typeIn;
this.index = indexIn;
this.elementCount = count;
}
private final boolean isValid(int index, VertexFormatElement.EnumUsage usage)
{
return index == 0 || usage == VertexFormatElement.EnumUsage.UV;
}
public final VertexFormatElement.EnumType getType()
{
return this.type;
}
public final VertexFormatElement.EnumUsage getUsage()
{
return this.usage;
}
public final int getElementCount()
{
return this.elementCount;
}
public final int getIndex()
{
return this.index;
}
public String toString()
{
return this.elementCount + "," + this.usage.getDisplayName() + "," + this.type.getDisplayName();
}
public final int getSize()
{
return this.type.getSize() * this.elementCount;
}
public final boolean isPositionElement()
{
return this.usage == VertexFormatElement.EnumUsage.POSITION;
}
public boolean equals(Object p_equals_1_)
{
if (this == p_equals_1_)
{
return true;
}
else if (p_equals_1_ != null && this.getClass() == p_equals_1_.getClass())
{
VertexFormatElement vertexformatelement = (VertexFormatElement)p_equals_1_;
return this.elementCount != vertexformatelement.elementCount ? false : (this.index != vertexformatelement.index ? false : (this.type != vertexformatelement.type ? false : this.usage == vertexformatelement.usage));
}
else
{
return false;
}
}
public int hashCode()
{
int i = this.type.hashCode();
i = 31 * i + this.usage.hashCode();
i = 31 * i + this.index;
i = 31 * i + this.elementCount;
return i;
}
public static enum EnumType
{
FLOAT(4, "Float", GL11.GL_FLOAT),
UBYTE(1, "Unsigned Byte", GL11.GL_UNSIGNED_BYTE),
BYTE(1, "Byte", GL11.GL_BYTE),
USHORT(2, "Unsigned Short", GL11.GL_UNSIGNED_SHORT),
SHORT(2, "Short", GL11.GL_SHORT),
UINT(4, "Unsigned Int", GL11.GL_UNSIGNED_INT),
INT(4, "Int", GL11.GL_INT);
private final int size;
private final String displayName;
private final int glConstant;
private EnumType(int sizeIn, String displayNameIn, int glConstantIn)
{
this.size = sizeIn;
this.displayName = displayNameIn;
this.glConstant = glConstantIn;
}
public int getSize()
{
return this.size;
}
public String getDisplayName()
{
return this.displayName;
}
public int getGlConstant()
{
return this.glConstant;
}
}
public static enum EnumUsage
{
POSITION("Position"),
NORMAL("Normal"),
COLOR("Vertex Color"),
UV("UV"),
// MATRIX("Bone Matrix"),
// BLEND_WEIGHT("Blend Weight"),
PADDING("Padding");
private final String displayName;
private EnumUsage(String displayNameIn)
{
this.displayName = displayNameIn;
}
public String getDisplayName()
{
return this.displayName;
}
}
}

View file

@ -1,153 +0,0 @@
package client.renderer.blockmodel;
import java.util.ArrayList;
import java.util.List;
import client.renderer.texture.TextureAtlasSprite;
import common.collect.Lists;
import common.model.Transforms;
import common.util.Facing;
public class BakedModel implements IBakedModel
{
protected final List<BakedQuad> generalQuads;
protected final List<List<BakedQuad>> faceQuads;
protected final boolean ambientOcclusion;
protected final boolean gui3d;
protected final TextureAtlasSprite texture;
protected final Transforms cameraTransforms;
public BakedModel(List<BakedQuad> generalQuadsIn, List<List<BakedQuad>> faceQuadsIn, boolean ambientOcclusionIn, boolean gui3dIn, TextureAtlasSprite textureIn, Transforms cameraTransformsIn)
{
this.generalQuads = generalQuadsIn;
this.faceQuads = faceQuadsIn;
this.ambientOcclusion = ambientOcclusionIn;
this.gui3d = gui3dIn;
this.texture = textureIn;
this.cameraTransforms = cameraTransformsIn;
}
public List<BakedQuad> getFaceQuads(Facing facing)
{
return this.faceQuads.get(facing.ordinal());
}
public List<BakedQuad> getGeneralQuads()
{
return this.generalQuads;
}
public boolean isAmbientOcclusion()
{
return this.ambientOcclusion;
}
public boolean isGui3d()
{
return this.gui3d;
}
public boolean isBuiltInRenderer()
{
return false;
}
public TextureAtlasSprite getParticleTexture()
{
return this.texture;
}
public Transforms getItemCameraTransforms()
{
return this.cameraTransforms;
}
public static class Builder
{
private final List<BakedQuad> builderGeneralQuads;
private final List<List<BakedQuad>> builderFaceQuads;
private final boolean builderAmbientOcclusion;
private TextureAtlasSprite builderTexture;
private boolean builderGui3d;
private Transforms builderCameraTransforms;
public Builder(ModelBlock model)
{
this(model.isAmbientOcclusion(), model.isGui3d(), model.getTransform());
}
public Builder(IBakedModel bakedModel, TextureAtlasSprite texture)
{
this(bakedModel.isAmbientOcclusion(), bakedModel.isGui3d(), bakedModel.getItemCameraTransforms());
this.builderTexture = bakedModel.getParticleTexture();
for (Facing enumfacing : Facing.values())
{
this.addFaceBreakingFours(bakedModel, texture, enumfacing);
}
this.addGeneralBreakingFours(bakedModel, texture);
}
private void addFaceBreakingFours(IBakedModel bakedModel, TextureAtlasSprite texture, Facing facing)
{
for (BakedQuad bakedquad : bakedModel.getFaceQuads(facing))
{
this.addFaceQuad(facing, new BreakingFour(bakedquad, texture));
}
}
private void addGeneralBreakingFours(IBakedModel p_177647_1_, TextureAtlasSprite texture)
{
for (BakedQuad bakedquad : p_177647_1_.getGeneralQuads())
{
this.addGeneralQuad(new BreakingFour(bakedquad, texture));
}
}
private Builder(boolean ambientOcclusion, boolean gui3d, Transforms cameraTransforms)
{
this.builderGeneralQuads = Lists.<BakedQuad>newArrayList();
this.builderFaceQuads = new ArrayList<List<BakedQuad>>(6);
for (Facing enumfacing : Facing.values())
{
this.builderFaceQuads.add(Lists.<BakedQuad>newArrayList());
}
this.builderAmbientOcclusion = ambientOcclusion;
this.builderGui3d = gui3d;
this.builderCameraTransforms = cameraTransforms;
}
public BakedModel.Builder addFaceQuad(Facing facing, BakedQuad quad)
{
((List)this.builderFaceQuads.get(facing.ordinal())).add(quad);
return this;
}
public BakedModel.Builder addGeneralQuad(BakedQuad quad)
{
this.builderGeneralQuads.add(quad);
return this;
}
public BakedModel.Builder setTexture(TextureAtlasSprite texture)
{
this.builderTexture = texture;
return this;
}
public BakedModel makeBakedModel()
{
if (this.builderTexture == null)
{
throw new RuntimeException("Missing particle!");
}
else
{
return new BakedModel(this.builderGeneralQuads, this.builderFaceQuads, this.builderAmbientOcclusion, this.builderGui3d, this.builderTexture, this.builderCameraTransforms);
}
}
}
}

View file

@ -1,52 +0,0 @@
package client.renderer.blockmodel;
import java.util.List;
import client.renderer.texture.TextureAtlasSprite;
import common.model.Transforms;
import common.util.Facing;
public class BuiltInModel implements IBakedModel
{
private Transforms cameraTransforms;
public BuiltInModel(Transforms p_i46086_1_)
{
this.cameraTransforms = p_i46086_1_;
}
public List<BakedQuad> getFaceQuads(Facing facing)
{
return null;
}
public List<BakedQuad> getGeneralQuads()
{
return null;
}
public boolean isAmbientOcclusion()
{
return false;
}
public boolean isGui3d()
{
return true;
}
public boolean isBuiltInRenderer()
{
return true;
}
public TextureAtlasSprite getParticleTexture()
{
return null;
}
public Transforms getItemCameraTransforms()
{
return this.cameraTransforms;
}
}

View file

@ -1,24 +0,0 @@
package client.renderer.blockmodel;
import java.util.List;
import client.renderer.texture.TextureAtlasSprite;
import common.model.Transforms;
import common.util.Facing;
public interface IBakedModel
{
List<BakedQuad> getFaceQuads(Facing facing);
List<BakedQuad> getGeneralQuads();
boolean isAmbientOcclusion();
boolean isGui3d();
boolean isBuiltInRenderer();
TextureAtlasSprite getParticleTexture();
Transforms getItemCameraTransforms();
}

View file

@ -1,321 +0,0 @@
package client.renderer.blockmodel;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import client.renderer.texture.IIconCreator;
import client.renderer.texture.TextureAtlasSprite;
import client.renderer.texture.TextureMap;
import common.collect.Lists;
import common.collect.Maps;
import common.collect.Sets;
import common.init.BlockRegistry;
import common.init.FluidRegistry;
import common.init.ItemRegistry;
import common.item.Item;
import common.item.ItemStack;
import common.model.ModelRotation;
import common.util.Facing;
import common.util.IRegistry;
import common.util.RegistrySimple;
import common.world.State;
public abstract class ModelBakery
{
private static final Set<String> LOCATIONS_BUILTIN_TEXTURES = Sets.newHashSet(
// "blocks/water_flow", "blocks/water_still",
// "blocks/lava_flow", "blocks/lava_still",
"blocks/destroy_stage_0", "blocks/destroy_stage_1",
"blocks/destroy_stage_2", "blocks/destroy_stage_3",
"blocks/destroy_stage_4", "blocks/destroy_stage_5",
"blocks/destroy_stage_6", "blocks/destroy_stage_7",
"blocks/destroy_stage_8", "blocks/destroy_stage_9",
"items/empty_armor_slot_helmet", "items/empty_armor_slot_chestplate",
"items/empty_armor_slot_leggings", "items/empty_armor_slot_boots");
protected static final String MISSING = "builtin/missing" + '#' + "missing";
public static final ModelBlock MODEL_GENERATED = (ModelBlock)new ModelBlock(null).add().d("");
public static final ModelBlock MODEL_ENTITY = (ModelBlock)new ModelBlock(null).add().d("");
static {
for(int z = 0; z < FluidRegistry.getNumFluids(); z++) {
String name = BlockRegistry.REGISTRY.getNameForObject(FluidRegistry.getStaticBlock(z)).toString();
LOCATIONS_BUILTIN_TEXTURES.add("blocks/" + name + "_flow");
LOCATIONS_BUILTIN_TEXTURES.add("blocks/" + name + "_still");
}
}
public static IRegistry<String, IBakedModel> setupModelRegistry(TextureMap textureMap,
Map<State, String> map)
{
final Map<String, TextureAtlasSprite> sprites = Maps.<String, TextureAtlasSprite>newHashMap();
Map<String, ModelBlock> models = Maps.<String, ModelBlock>newLinkedHashMap();
List<String> variants = Lists.<String>newArrayList();
FaceBakery faceBakery = new FaceBakery();
RegistrySimple<String, IBakedModel> bakedRegistry = new RegistrySimple();
List<String> itemLocations = Lists.<String>newArrayList();
// Map<Item, List<Integer>> variantNames = Maps.<Item, List<Integer>>newIdentityHashMap();
// variants.clear();
// Map<IBlockState, String> map = blockModelShapes.getMap();
models.put(MISSING, (ModelBlock)new ModelBlock(null).add().all());
variants.add(MISSING);
for(Entry<State, String> entry : map.entrySet()) {
ModelBlock model = (ModelBlock)entry.getKey().getBlock().getModel(ModelBlock.PROVIDER, BlockRegistry.REGISTRY.getNameForObject(entry.getKey().getBlock())
.toString(), entry.getKey());
// ResourceLocation blk = new ResourceLocation(entry.getValue().getName());
models.put(entry.getValue(), model);
variants.add(entry.getValue());
}
// ResourceLocation loc = new ResourceLocation("item_frame");
// String res = "item_frame" + '#' + "normal";
// ModelBlock model = new ModelBlock("birch_planks")
// .add(3, 3, 15.5f, 13, 13, 16)
// .n("itemframe_background").uv(3, 3, 13, 13).noCull()
// .s("itemframe_background").uv(3, 3, 13, 13).noCull()
// .add(2, 2, 15, 14, 3, 16)
// .d().uv(2, 0, 14, 1).noCull()
// .u().uv(2, 15, 14, 16).noCull()
// .n().uv(2, 13, 14, 14).noCull()
// .s().uv(2, 13, 14, 14).noCull()
// .w().uv(15, 13, 16, 14).noCull()
// .e().uv(0, 13, 1, 14).noCull()
// .add(2, 13, 15, 14, 14, 16)
// .d().uv(2, 0, 14, 1).noCull()
// .u().uv(2, 15, 14, 16).noCull()
// .n().uv(2, 2, 14, 3).noCull()
// .s().uv(2, 2, 14, 3).noCull()
// .w().uv(15, 2, 16, 3).noCull()
// .e().uv(0, 2, 1, 3).noCull()
// .add(2, 3, 15, 3, 13, 16)
// .n().uv(13, 3, 14, 13).noCull()
// .s().uv(2, 3, 3, 13).noCull()
// .w().uv(15, 3, 16, 13).noCull()
// .e().uv(0, 3, 1, 13).noCull()
// .add(13, 3, 15, 14, 13, 16)
// .n().uv(2, 3, 3, 13).noCull()
// .s().uv(13, 3, 14, 13).noCull()
// .w().uv(15, 3, 16, 13).noCull()
// .e().uv(0, 3, 1, 13).noCull();
// models.put(res, model);
// variants.add(res);
// res = "item_frame" + '#' + "map";
// model = new ModelBlock("birch_planks")
// .add(1, 1, 15.001f, 15, 15, 16)
// .n("itemframe_background").uv(1, 1, 15, 15).noCull()
// .s("itemframe_background").uv(1, 1, 15, 15).noCull()
// .add(0, 0, 15.001f, 16, 1, 16)
// .d().uv(0, 0, 16, 1).noCull()
// .u().uv(0, 15, 16, 16).noCull()
// .n().uv(0, 15, 16, 16).noCull()
// .s().uv(0, 15, 16, 16).noCull()
// .w().uv(15, 15, 16, 16).noCull()
// .e().uv(0, 15, 1, 16).noCull()
// .add(0, 15, 15.001f, 16, 16, 16)
// .d().uv(0, 0, 16, 1).noCull()
// .u().uv(0, 15, 16, 16).noCull()
// .n().uv(0, 0, 16, 1).noCull()
// .s().uv(0, 0, 16, 1).noCull()
// .w().uv(15, 0, 16, 1).noCull()
// .e().uv(0, 0, 1, 1).noCull()
// .add(0, 1, 15.001f, 1, 15, 16)
// .n().uv(15, 1, 16, 15).noCull()
// .s().uv(0, 1, 1, 15).noCull()
// .w().uv(15, 1, 16, 15).noCull()
// .e().uv(0, 1, 1, 15).noCull()
// .add(15, 1, 15.001f, 16, 15, 16)
// .n().uv(0, 1, 1, 15).noCull()
// .s().uv(15, 1, 16, 15).noCull()
// .w().uv(15, 1, 16, 15).noCull()
// .e().uv(0, 1, 1, 15).noCull();
// models.put(res, model);
// variants.add(res);
// RenderRegistry.registerVariants(variantNames);
List<ItemStack> stacks = Lists.newArrayList();
for (Item item : ItemRegistry.REGISTRY)
{
// List<Integer> list = variantNames.get(item);
// if(list == null)
// list = Collections.<Integer>singletonList(0);
// for(Integer s : list)
// {
item.getRenderItems(item, stacks);
for(ItemStack stack : stacks) {
String resourcelocation = "item/" + ItemRegistry.REGISTRY.getNameForObject(item).toString() + "#" + stack.getMetadata() + '#' + "inventory";
models.put(resourcelocation, (ModelBlock)item.getModel(ModelBlock.PROVIDER, ItemRegistry.REGISTRY.getNameForObject(item).toString(), stack.getMetadata()));
itemLocations.add(resourcelocation);
}
stacks.clear();
}
final Set<String> set = Sets.<String>newHashSet();
List<String> list = Lists.newArrayList(variants);
Collections.sort(list, new Comparator<String>()
{
public int compare(String p_compare_1_, String p_compare_2_)
{
return p_compare_1_.compareTo(p_compare_2_);
}
});
for (String modelresourcelocation : list)
{
ModelBlock modelblock = models.get(modelresourcelocation);
if (modelblock == null)
{
throw new RuntimeException("Fehlendes Modell für: " + modelresourcelocation);
}
else
{
for (BlockPart blockpart : modelblock.getElements())
{
for (BlockPartFace blockpartface : blockpart.mapFaces.values())
{
set.add(blockpartface.texture);
}
}
set.add(modelblock.getPrimary());
// return set;
// set.addAll(getTextureLocations(modelblock));
}
}
set.addAll(LOCATIONS_BUILTIN_TEXTURES);
// final Set<ResourceLocation> set = getVariantsTextureLocations();
for (String resourcelocation : itemLocations) // .values())
{
ModelBlock modelblock = (ModelBlock)models.get(resourcelocation);
if (modelblock != null)
{
set.add(modelblock.getPrimary());
if (modelblock.getParent() == MODEL_GENERATED)
{
for (int n = 0; n < modelblock.getNumTextures(); n++)
{
set.add(modelblock.getTexture(n));
}
}
else if (modelblock.getParent() != MODEL_ENTITY)
{
for (BlockPart blockpart : modelblock.getElements())
{
for (BlockPartFace blockpartface : blockpart.mapFaces.values())
{
set.add(blockpartface.texture);
}
}
}
}
}
// set.addAll(getItemsTextureLocations());
set.remove(TextureMap.LOCATION_MISSING_TEXTURE);
IIconCreator iiconcreator = new IIconCreator()
{
public void registerSprites(TextureMap iconRegistry)
{
for (String resourcelocation : set)
{
TextureAtlasSprite textureatlassprite = iconRegistry.registerSprite(resourcelocation);
sprites.put(resourcelocation, textureatlassprite);
}
}
};
textureMap.loadSprites(iiconcreator);
sprites.put(TextureMap.LOCATION_MISSING_TEXTURE, textureMap.getMissingSprite());
for (String resourcelocation : itemLocations) // .values())
{
ModelBlock modelblock = models.get(resourcelocation);
if (modelblock != null && modelblock.getParent() == MODEL_GENERATED)
{
ModelBlock modelblock1 = ModelGenerator.makeItemModel(textureMap, modelblock);
models.put(resourcelocation, modelblock1);
}
else if (modelblock != null && modelblock.getParent() == MODEL_ENTITY)
{
models.put(resourcelocation, modelblock);
}
}
for (TextureAtlasSprite textureatlassprite : sprites.values())
{
if (!textureatlassprite.isAnimated())
{
textureatlassprite.clearFramesTextureData();
}
}
for (String modelresourcelocation : variants)
{
ModelBlock modelblock = models.get(modelresourcelocation);
if (modelblock != null)
{
bakedRegistry.putObject(modelresourcelocation, bakeModel(sprites, faceBakery, textureMap.getMissingSprite(),
modelblock, modelblock.getRotation(), modelblock.isUvLocked()));
}
else
{
throw new RuntimeException("Fehlendes Modell für: " + modelresourcelocation);
}
}
// for (Entry<String, ResourceLocation> entry : itemLocations.entrySet())
for (String entry : itemLocations)
{
// ResourceLocation resourcelocation = (ResourceLocation)entry.getValue();
// ResourceLocation inventory = new ResourceLocation((String)entry.getKey(), "inventory");
ModelBlock modelblock1 = (ModelBlock)models.get(entry) ; // resourcelocation);
if (modelblock1 != null)
{
if (modelblock1.getParent() == MODEL_ENTITY)
{
bakedRegistry.putObject(entry /* inventory */, new BuiltInModel(modelblock1.getTransform()));
}
else
{
bakedRegistry.putObject(entry /* inventory */, bakeModel(sprites, faceBakery, textureMap.getMissingSprite(),
modelblock1, ModelRotation.X0_Y0, false));
}
}
else
{
throw new RuntimeException("Fehlendes Modell für: " + entry); // resourcelocation);
}
}
return bakedRegistry;
}
private static IBakedModel bakeModel(Map<String, TextureAtlasSprite> sprites, FaceBakery faceBakery,
TextureAtlasSprite fallback, ModelBlock modelBlockIn, ModelRotation modelRotationIn, boolean uvLocked)
{
TextureAtlasSprite particle = sprites.get(modelBlockIn.getPrimary());
BakedModel.Builder builder = new BakedModel.Builder(modelBlockIn).setTexture(particle == null ? fallback : particle);
for (BlockPart blockpart : modelBlockIn.getElements())
{
for (Facing enumfacing : blockpart.mapFaces.keySet())
{
BlockPartFace face = blockpart.mapFaces.get(enumfacing);
TextureAtlasSprite sprite = sprites.get(face.texture);
sprite = sprite == null ? fallback : sprite;
if (face.cull == null)
builder.addGeneralQuad(faceBakery.makeBakedQuad(blockpart.positionFrom, blockpart.positionTo, face, sprite, enumfacing, modelRotationIn, blockpart.partRotation, uvLocked, blockpart.shade));
else
builder.addFaceQuad(modelRotationIn.rotateFace(face.cull), faceBakery.makeBakedQuad(blockpart.positionFrom, blockpart.positionTo, face, sprite, enumfacing, modelRotationIn, blockpart.partRotation, uvLocked, blockpart.shade));
}
}
return builder.makeBakedModel();
}
}

View file

@ -1,203 +0,0 @@
package client.renderer.blockmodel;
import java.util.List;
import client.renderer.texture.TextureMap;
import common.collect.Lists;
import common.collect.Maps;
import common.model.Model;
import common.model.ModelProvider;
import common.model.ModelRotation;
import common.model.Transforms;
import common.util.Facing;
import common.util.Vector3f;
public class ModelBlock extends Model {
static final ModelProvider PROVIDER = new ModelProvider() {
public Model getModel(String primary) {
return new ModelBlock(primary);
}
public Model getModel(Transforms transform, String... layers) {
return new ModelBlock(transform, layers);
}
public Model getModel(Model parent, Transforms transform) {
return new ModelBlock((ModelBlock)parent, transform);
}
public Model getEntityModel() {
return ModelBakery.MODEL_ENTITY;
}
};
private final List<BlockPart> elements;
private final boolean gui3d;
private final String primary;
private final String[] layers;
private final ModelBlock parent;
private boolean occlusion;
private ModelRotation rotation;
private boolean uvLock;
private Transforms transform;
private BlockPart lastPart;
private BlockPartFace[] last;
public static void setAsProvider() {
ModelProvider.setProvider(PROVIDER);
}
public ModelBlock noOcclude() {
this.occlusion = false;
return this;
}
public ModelBlock uvLock() {
this.uvLock = true;
return this;
}
public ModelBlock rotate(ModelRotation rot) {
this.rotation = rot;
return this;
}
public ModelBlock add(float x1, float y1, float z1, float x2, float y2, float z2) {
this.elements.add(this.lastPart = new BlockPart(new Vector3f(x1, y1, z1), new Vector3f(x2, y2, z2),
Maps.newEnumMap(Facing.class), null, true));
return this;
}
public ModelBlock noShade() {
this.lastPart.shade = false;
return this;
}
public ModelBlock rotate(float x, float y, float z, Facing.Axis axisIn, float angleIn, boolean rescaleIn) {
this.lastPart.partRotation = new BlockPartRotation(x, y, z, axisIn, angleIn, rescaleIn);
return this;
}
public ModelBlock face(String texture, Facing ... faces) {
texture = !texture.equals(TextureMap.LOCATION_MISSING_TEXTURE) && texture.indexOf('/') == -1 ? "blocks/" + texture : texture;
this.last = new BlockPartFace[faces.length];
for(int z = 0; z < faces.length; z++) {
this.lastPart.mapFaces.put(faces[z], this.last[z] =
new BlockPartFace(faces[z], -1, texture, new BlockFaceUV(this.lastPart.getFaceUvs(faces[z]), 0)));
}
return this;
}
public ModelBlock cull(Facing cull) {
for(BlockPartFace last : this.last) {
last.cull = cull;
}
return this;
}
public ModelBlock tint() {
for(BlockPartFace last : this.last) {
last.tint = 0;
}
return this;
}
public ModelBlock rot(int rot) {
for(BlockPartFace last : this.last) {
last.uv = new BlockFaceUV(last.uv.uvs, rot);
}
return this;
}
public ModelBlock uv(float x1, float y1, float x2, float y2) {
for(BlockPartFace last : this.last) {
last.uv = new BlockFaceUV(new float[] {x1, y1, x2, y2}, last.uv.rotation);
}
return this;
}
public String getPrimary() {
return this.primary;
}
public ModelBlock(String primary) {
this(null, Lists.newArrayList(), primary != null && primary.indexOf('/') == -1 ? "blocks/" + primary : primary, true, true, Transforms.DEFAULT, null);
}
public ModelBlock(Transforms transform, String ... layers) {
this(ModelBakery.MODEL_GENERATED, ModelBakery.MODEL_GENERATED.elements,
layers[0].indexOf('/') == -1 ? "items/" + layers[0] : layers[0], false, false, transform, layers);
}
public ModelBlock(ModelBlock parent, Transforms transform) {
this(parent, Lists.newArrayList(), parent.getPrimary(), false, true, transform, null);
}
public ModelBlock(String primary, Transforms transform, String ... layers) {
this(ModelBakery.MODEL_GENERATED, ModelBakery.MODEL_GENERATED.elements,
primary.indexOf('/') == -1 ? "items/" + primary : primary, false, false, transform, layers);
}
public ModelBlock(String primary, List<BlockPart> elements, Transforms transform, String ... layers) {
this(null, elements, primary, false, false, transform, layers);
}
private ModelBlock(ModelBlock parent, List<BlockPart> elements, String primary, boolean occlude, boolean gui3d,
Transforms transform, String[] layers) {
for(int z = 0; layers != null && z < layers.length; z++) {
layers[z] = layers[z].indexOf('/') == -1 ? "items/" + layers[z] : layers[z];
}
this.elements = parent == null ? elements : parent.getElements();
this.occlusion = parent == null ? occlude : parent.isAmbientOcclusion();
this.gui3d = gui3d;
this.primary = primary == null ? TextureMap.LOCATION_MISSING_TEXTURE : primary;
this.parent = parent;
this.transform = transform;
this.uvLock = false;
this.rotation = ModelRotation.X0_Y0;
this.layers = layers;
}
public List<BlockPart> getElements() {
return this.elements;
}
public boolean isAmbientOcclusion() {
return this.occlusion;
}
public boolean isGui3d() {
return this.gui3d;
}
public String[] getTextures() {
return this.layers;
}
public int getNumTextures() {
return this.layers == null ? 0 : this.layers.length;
}
public String getTexture(int layer) {
return this.layers == null || this.layers[layer] == null ? TextureMap.LOCATION_MISSING_TEXTURE : this.layers[layer];
}
public ModelBlock getParent() {
return this.parent;
}
public Transforms getTransform() {
return this.transform;
}
public ModelRotation getRotation() {
return this.rotation;
}
public boolean isUvLocked() {
return this.uvLock;
}
}

View file

@ -1,165 +0,0 @@
package client.renderer.blockmodel;
import java.util.Collections;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import client.renderer.texture.TextureAtlasSprite;
import client.renderer.texture.TextureMap;
import common.block.Block;
import common.block.BlockLiquid;
import common.collect.Maps;
import common.init.BlockRegistry;
import common.init.Blocks;
import common.init.FluidRegistry;
import common.properties.IProperty;
import common.util.IRegistry;
import common.world.State;
public class ModelManager
{
private IRegistry<String, IBakedModel> modelRegistry;
private final TextureMap texMap;
private final Map<State, IBakedModel> bakedModelStore = Maps.<State, IBakedModel>newIdentityHashMap();
private final Map<Block, String> liquidMap = Maps.<Block, String>newIdentityHashMap();
private final Map<Block, StateMap> mappers = Maps.<Block, StateMap>newIdentityHashMap();
private final Set<Block> builtin = Collections.newSetFromMap(Maps.<Block, Boolean>newIdentityHashMap());
private IBakedModel defaultModel;
public ModelManager(TextureMap textures)
{
this.texMap = textures;
for(Block block : BlockRegistry.REGISTRY) {
if(block.getRenderType() != 3) {
this.builtin.add(block);
// Log.info("Builtin: " + BlockRegistry.REGISTRY.getNameForObject(block));
}
else {
IProperty<?>[] ignored = block.getIgnoredProperties();
if(ignored != null)
this.mappers.put(block, new MultiStateMap.Builder().ignore(ignored).build());
}
}
}
public void onReload()
{
this.modelRegistry = ModelBakery.setupModelRegistry(this.texMap, this.getMap());
this.defaultModel = this.modelRegistry.getObject(ModelBakery.MISSING);
this.reloadModels();
}
public IBakedModel getModel(String modelLocation)
{
if (modelLocation == null)
{
return this.defaultModel;
}
else
{
IBakedModel ibakedmodel = this.modelRegistry.getObject(modelLocation);
return ibakedmodel == null ? this.defaultModel : ibakedmodel;
}
}
public IBakedModel getMissingModel()
{
return this.defaultModel;
}
public TextureMap getTextureMap()
{
return this.texMap;
}
public TextureAtlasSprite getTexture(State state)
{
Block block = state.getBlock();
IBakedModel ibakedmodel = this.getModelForState(state);
if (ibakedmodel == null || ibakedmodel == this.defaultModel)
{
if (block == Blocks.wall_sign || block == Blocks.sign || block == Blocks.chest || block == Blocks.trapped_chest || block == Blocks.banner || block == Blocks.wall_banner)
{
return this.texMap.getAtlasSprite("blocks/oak_planks");
}
if (block == Blocks.floor_portal)
{
return this.texMap.getAtlasSprite("blocks/obsidian");
}
if (block == Blocks.flowing_lava || block == Blocks.lava)
{
return this.texMap.getAtlasSprite("blocks/lava_still");
}
if (block == Blocks.flowing_water || block == Blocks.water)
{
return this.texMap.getAtlasSprite("blocks/water_still");
}
if (block == Blocks.skull)
{
return this.texMap.getAtlasSprite("blocks/soul_sand");
}
// if (block == Blocks.barrier)
// {
// return this.modelManager.getTextureMap().getAtlasSprite("items/barrier");
// }
if (block.getMaterial().isLiquid())
{
String texture = this.liquidMap.get(block);
if(texture == null)
this.liquidMap.put(block, texture = "blocks/" + BlockRegistry.REGISTRY.getNameForObject(FluidRegistry.getStaticBlock(FluidRegistry.getFluidMeta((BlockLiquid)block))) + "_still");
return this.texMap.getAtlasSprite(texture);
}
}
if (ibakedmodel == null)
{
ibakedmodel = this.defaultModel;
}
return ibakedmodel.getParticleTexture();
}
public IBakedModel getModelForState(State state)
{
IBakedModel ibakedmodel = (IBakedModel)this.bakedModelStore.get(state);
if (ibakedmodel == null)
{
ibakedmodel = this.defaultModel;
}
return ibakedmodel;
}
public void reloadModels()
{
this.bakedModelStore.clear();
for (Entry<State, String> entry : this.getMap().entrySet())
{
this.bakedModelStore.put(entry.getKey(), this.getModel(entry.getValue()));
}
}
public Map<State, String> getMap() {
Map<State, String> map = Maps.<State, String>newIdentityHashMap();
for(Block block : BlockRegistry.REGISTRY) {
if(!this.builtin.contains(block)) {
StateMap mapper = this.mappers.get(block);
if(mapper == null)
mapper = new SingleStateMap();
map.putAll( // (Objects.firstNonNull(, ))
mapper.putStateModelLocations(block));
}
}
return map;
}
}

View file

@ -1,82 +0,0 @@
package client.renderer.blockmodel;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import common.collect.Lists;
import common.collect.Maps;
import common.init.BlockRegistry;
import common.properties.IProperty;
import common.world.State;
public class MultiStateMap extends StateMap
{
private final IProperty<?> name;
private final String suffix;
private final List < IProperty<? >> ignored;
private MultiStateMap(IProperty<?> name, String suffix, List < IProperty<? >> ignored)
{
this.name = name;
this.suffix = suffix;
this.ignored = ignored;
}
protected String getResourceLocation(State state)
{
Map<IProperty, Comparable> map = Maps.<IProperty, Comparable>newLinkedHashMap(state.getProperties());
String s;
if (this.name == null)
{
s = BlockRegistry.REGISTRY.getNameForObject(state.getBlock());
}
else
{
s = ((IProperty)this.name).getName((Comparable)map.remove(this.name));
}
if (this.suffix != null)
{
s = s + this.suffix;
}
for (IProperty<?> iproperty : this.ignored)
{
map.remove(iproperty);
}
return s + '#' + this.getPropertyString(map);
}
public static class Builder
{
private IProperty<?> name;
private String suffix;
private final List < IProperty<? >> ignored = Lists. < IProperty<? >> newArrayList();
public MultiStateMap.Builder withName(IProperty<?> builderPropertyIn)
{
this.name = builderPropertyIn;
return this;
}
public MultiStateMap.Builder withSuffix(String builderSuffixIn)
{
this.suffix = builderSuffixIn;
return this;
}
public MultiStateMap.Builder ignore(IProperty<?>... p_178442_1_)
{
Collections.addAll(this.ignored, p_178442_1_);
return this;
}
public MultiStateMap build()
{
return new MultiStateMap(this.name, this.suffix, this.ignored);
}
}
}

View file

@ -1,13 +0,0 @@
package client.renderer.blockmodel;
import common.init.BlockRegistry;
import common.world.State;
public class SingleStateMap extends StateMap
{
protected String getResourceLocation(State state)
{
return BlockRegistry.REGISTRY.getNameForObject(state.getBlock()).toString() + '#' + this.getPropertyString(state.getProperties());
}
}

View file

@ -1,204 +0,0 @@
package client.renderer.chunk;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CancellationException;
import client.Client;
import client.renderer.RegionRenderCacheBuilder;
import common.collect.Lists;
import common.entity.Entity;
import common.future.FutureCallback;
import common.future.Futures;
import common.future.ListenableFuture;
import common.log.Log;
import common.model.BlockLayer;
public class ChunkRenderWorker implements Runnable
{
private final ChunkRenderDispatcher chunkRenderDispatcher;
private final RegionRenderCacheBuilder regionRenderCacheBuilder;
private boolean running = true;
public ChunkRenderWorker(ChunkRenderDispatcher p_i46201_1_)
{
this(p_i46201_1_, (RegionRenderCacheBuilder)null);
}
public ChunkRenderWorker(ChunkRenderDispatcher chunkRenderDispatcherIn, RegionRenderCacheBuilder regionRenderCacheBuilderIn)
{
this.chunkRenderDispatcher = chunkRenderDispatcherIn;
this.regionRenderCacheBuilder = regionRenderCacheBuilderIn;
}
public void run()
{
while (this.running)
{
try
{
this.processTask(this.chunkRenderDispatcher.getNextChunkUpdate());
}
catch (InterruptedException var3)
{
// Log.debug("Stoppe wegen Unterbrechung");
return;
}
}
}
public void end() {
this.running = false;
}
protected void processTask(final ChunkCompileTaskGenerator generator) throws InterruptedException
{
generator.getLock().lock();
try
{
if (generator.getStatus() != ChunkCompileTaskGenerator.Status.PENDING)
{
if (!generator.isFinished())
{
Log.JNI.warn("Chunk-Rendering-Aufgabe war " + generator.getStatus() + " wenn PENDING erwartet war; ignoriere Aufgabe");
}
return;
}
generator.setStatus(ChunkCompileTaskGenerator.Status.COMPILING);
}
finally
{
generator.getLock().unlock();
}
Entity lvt_2_1_ = Client.CLIENT.getRenderViewEntity();
if (lvt_2_1_ == null)
{
generator.finish();
}
else
{
generator.setRegionRenderCacheBuilder(this.getRegionRenderCacheBuilder());
float f = (float)lvt_2_1_.posX;
float f1 = (float)lvt_2_1_.posY + lvt_2_1_.getEyeHeight();
float f2 = (float)lvt_2_1_.posZ;
ChunkCompileTaskGenerator.Type chunkcompiletaskgenerator$type = generator.getType();
if (chunkcompiletaskgenerator$type == ChunkCompileTaskGenerator.Type.REBUILD_CHUNK)
{
generator.getRenderChunk().rebuildChunk(f, f1, f2, generator);
}
else if (chunkcompiletaskgenerator$type == ChunkCompileTaskGenerator.Type.RESORT_TRANSPARENCY)
{
generator.getRenderChunk().resortTransparency(f, f1, f2, generator);
}
generator.getLock().lock();
try
{
if (generator.getStatus() != ChunkCompileTaskGenerator.Status.COMPILING)
{
if (!generator.isFinished())
{
Log.JNI.warn("Chunk-Rendering-Aufgabe war " + generator.getStatus() + " wenn COMPILING erwartet war; breche Aufgabe ab");
}
this.freeRenderBuilder(generator);
return;
}
generator.setStatus(ChunkCompileTaskGenerator.Status.UPLOADING);
}
finally
{
generator.getLock().unlock();
}
final CompiledChunk lvt_7_1_ = generator.getCompiledChunk();
ArrayList lvt_8_1_ = Lists.newArrayList();
if (chunkcompiletaskgenerator$type == ChunkCompileTaskGenerator.Type.REBUILD_CHUNK)
{
for (BlockLayer enumworldblocklayer : BlockLayer.values())
{
if (lvt_7_1_.isLayerStarted(enumworldblocklayer))
{
lvt_8_1_.add(this.chunkRenderDispatcher.uploadChunk(enumworldblocklayer, generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(enumworldblocklayer), generator.getRenderChunk(), lvt_7_1_));
}
}
}
else if (chunkcompiletaskgenerator$type == ChunkCompileTaskGenerator.Type.RESORT_TRANSPARENCY)
{
lvt_8_1_.add(this.chunkRenderDispatcher.uploadChunk(BlockLayer.TRANSLUCENT, generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(BlockLayer.TRANSLUCENT), generator.getRenderChunk(), lvt_7_1_));
}
final ListenableFuture<List<Object>> listenablefuture = Futures.allAsList(lvt_8_1_);
generator.addFinishRunnable(new Runnable()
{
public void run()
{
listenablefuture.cancel(false);
}
});
Futures.addCallback(listenablefuture, new FutureCallback<List<Object>>()
{
public void onSuccess(List<Object> p_onSuccess_1_)
{
ChunkRenderWorker.this.freeRenderBuilder(generator);
generator.getLock().lock();
label21:
{
try
{
if (generator.getStatus() == ChunkCompileTaskGenerator.Status.UPLOADING)
{
generator.setStatus(ChunkCompileTaskGenerator.Status.DONE);
break label21;
}
if (!generator.isFinished())
{
Log.JNI.warn("Chunk-Rendering-Aufgabe war " + generator.getStatus() + " wenn UPLOADING erwartet war; breche Aufgabe ab");
}
}
finally
{
generator.getLock().unlock();
}
return;
}
generator.getRenderChunk().setCompiledChunk(lvt_7_1_);
}
public void onFailure(Throwable p_onFailure_1_)
{
ChunkRenderWorker.this.freeRenderBuilder(generator);
if (!(p_onFailure_1_ instanceof CancellationException) && !(p_onFailure_1_ instanceof InterruptedException))
{
Log.JNI.error(p_onFailure_1_, "Fehler beim Rendern des Chunks");
}
}
});
}
}
private RegionRenderCacheBuilder getRegionRenderCacheBuilder() throws InterruptedException
{
return this.regionRenderCacheBuilder != null ? this.regionRenderCacheBuilder : this.chunkRenderDispatcher.allocateRenderBuilder();
}
private void freeRenderBuilder(ChunkCompileTaskGenerator taskGenerator)
{
if (this.regionRenderCacheBuilder == null)
{
this.chunkRenderDispatcher.freeRenderBuilder(taskGenerator.getRegionRenderCacheBuilder());
}
}
}

View file

@ -1,378 +0,0 @@
package client.renderer.entity;
import org.lwjgl.opengl.GL11;
import client.Client;
import client.renderer.DefaultVertexFormats;
import client.renderer.Drawing;
import client.renderer.Frustum;
import client.renderer.GlState;
import client.renderer.RenderBuffer;
import client.renderer.Tessellator;
import client.renderer.texture.TextureAtlasSprite;
import client.renderer.texture.TextureMap;
import common.block.Block;
import common.entity.Entity;
import common.util.BlockPos;
import common.util.BoundingBox;
import common.world.World;
public abstract class Render<T extends Entity>
{
// public static boolean drawNames = true;
// private static final String shadowTextures = "textures/world/shadow.png";
protected final RenderManager renderManager;
// protected float shadowSize;
//
// /**
// * Determines the darkness of the object's shadow. Higher value makes a darker shadow.
// */
// protected float shadowOpaque = 1.0F;
protected Render(RenderManager renderManager)
{
this.renderManager = renderManager;
}
public boolean shouldRender(T livingEntity, double camX, double camY, double camZ)
{
BoundingBox axisalignedbb = livingEntity.getEntityBoundingBox();
if (axisalignedbb.hasNaN() || axisalignedbb.getAverageEdgeLength() == 0.0D)
{
axisalignedbb = new BoundingBox(livingEntity.posX - 2.0D, livingEntity.posY - 2.0D, livingEntity.posZ - 2.0D, livingEntity.posX + 2.0D, livingEntity.posY + 2.0D, livingEntity.posZ + 2.0D);
}
return livingEntity.isInRangeToRender3d(camX, camY, camZ) && (livingEntity.noFrustumCheck || Frustum.isInFrustum(axisalignedbb));
}
/**
* Renders the desired {@code T} type Entity.
*/
public void doRender(T entity, double x, double y, double z, float partialTicks)
{
this.renderName(entity, x, y, z);
}
protected void renderName(T entity, double x, double y, double z)
{
String name = entity.getDisplayName();
if(name != null && !name.isEmpty())
this.renderLivingLabel(entity, name, x, y, z, 64);
}
// protected boolean canRenderName(T entity)
// {
// return entity.hasCustomName();
// }
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected abstract String getEntityTexture(T entity);
public boolean bindEntityTexture(T entity)
{
String resourcelocation = this.getEntityTexture(entity);
if (resourcelocation == null)
{
return false;
}
else
{
this.bindTexture(resourcelocation);
return true;
}
}
public void bindTexture(String location)
{
this.renderManager.renderEngine.bindTexture(location);
}
/**
* Renders fire on top of the entity. Args: entity, x, y, z, partialTickTime
*/
private void renderEntityOnFire(Entity entity, double x, double y, double z, float partialTicks)
{
GlState.disableLighting();
TextureMap texturemap = Client.CLIENT.getTextureMapBlocks();
TextureAtlasSprite textureatlassprite = texturemap.getAtlasSprite("blocks/fire_layer_0");
TextureAtlasSprite textureatlassprite1 = texturemap.getAtlasSprite("blocks/fire_layer_1");
GL11.glPushMatrix();
GL11.glTranslatef((float)x, (float)y, (float)z);
float f = entity.width * 1.4F;
GL11.glScalef(f, f, f);
// Tessellator tessellator = Tessellator.getInstance();
RenderBuffer worldrenderer = Tessellator.getBuffer();
float f1 = 0.5F;
float f2 = 0.0F;
float f3 = entity.height / f;
float f4 = (float)(entity.posY - entity.getEntityBoundingBox().minY);
GL11.glRotatef(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(0.0F, 0.0F, -0.3F + (float)((int)f3) * 0.02F);
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
float f5 = 0.0F;
int i = 0;
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
while (f3 > 0.0F)
{
TextureAtlasSprite textureatlassprite2 = i % 2 == 0 ? textureatlassprite : textureatlassprite1;
this.bindTexture(TextureMap.locationBlocksTexture);
float f6 = textureatlassprite2.getMinU();
float f7 = textureatlassprite2.getMinV();
float f8 = textureatlassprite2.getMaxU();
float f9 = textureatlassprite2.getMaxV();
if (i / 2 % 2 == 0)
{
float f10 = f8;
f8 = f6;
f6 = f10;
}
worldrenderer.pos((double)(f1 - f2), (double)(0.0F - f4), (double)f5).tex((double)f8, (double)f9).endVertex();
worldrenderer.pos((double)(-f1 - f2), (double)(0.0F - f4), (double)f5).tex((double)f6, (double)f9).endVertex();
worldrenderer.pos((double)(-f1 - f2), (double)(1.4F - f4), (double)f5).tex((double)f6, (double)f7).endVertex();
worldrenderer.pos((double)(f1 - f2), (double)(1.4F - f4), (double)f5).tex((double)f8, (double)f7).endVertex();
f3 -= 0.45F;
f4 -= 0.45F;
f1 *= 0.9F;
f5 += 0.03F;
++i;
}
Tessellator.draw();
GL11.glPopMatrix();
GlState.enableLighting();
}
// /**
// * Renders the entity shadows at the position, shadow alpha and partialTickTime. Args: entity, x, y, z, shadowAlpha,
// * partialTickTime
// */
// private void renderShadow(Entity entityIn, double x, double y, double z, float shadowAlpha, float partialTicks)
// {
// GlState.enableBlend();
// GlState.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
// this.renderManager.renderEngine.bindTexture(shadowTextures);
// World world = this.getWorldFromRenderManager();
// GlState.depthMask(false);
// float f = this.shadowSize;
//
// if (entityIn instanceof EntityLiving)
// {
// EntityLiving entityliving = (EntityLiving)entityIn;
// f *= entityliving.getShadowSize();
//
// if (entityliving.isChild())
// {
// f *= 0.5F;
// }
// }
//
// double d5 = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double)partialTicks;
// double d0 = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double)partialTicks;
// double d1 = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double)partialTicks;
// int i = MathHelper.floor_double(d5 - (double)f);
// int j = MathHelper.floor_double(d5 + (double)f);
// int k = MathHelper.floor_double(d0 - (double)f);
// int l = MathHelper.floor_double(d0);
// int i1 = MathHelper.floor_double(d1 - (double)f);
// int j1 = MathHelper.floor_double(d1 + (double)f);
// double d2 = x - d5;
// double d3 = y - d0;
// double d4 = z - d1;
//// Tessellator tessellator = Tessellator.getInstance();
// RenderBuffer worldrenderer = Tessellator.getBuffer();
// worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
//
// for (BlockPos blockpos : BlockPos.getAllInBoxMutable(new BlockPos(i, k, i1), new BlockPos(j, l, j1)))
// {
// Block block = world.getBlockState(blockpos.down()).getBlock();
//
// if (block.getRenderType() != -1 && world.getLightFromNeighbors(blockpos) > 3)
// {
// this.renderShadowBlock(block, x, y, z, blockpos, shadowAlpha, f, d2, d3, d4);
// }
// }
//
// Tessellator.draw();
// GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
// GlState.disableBlend();
// GlState.depthMask(true);
// }
/**
* Returns the render manager's world object
*/
private World getWorldFromRenderManager()
{
return this.renderManager.worldObj;
}
private void renderShadowBlock(Block blockIn, double p_180549_2_, double p_180549_4_, double p_180549_6_, BlockPos pos, float p_180549_9_, float p_180549_10_, double p_180549_11_, double p_180549_13_, double p_180549_15_)
{
if (blockIn.isFullCube())
{
// Tessellator tessellator = Tessellator.getInstance();
RenderBuffer worldrenderer = Tessellator.getBuffer();
double d0 = ((double)p_180549_9_ - (p_180549_4_ - ((double)pos.getY() + p_180549_13_)) / 2.0D) * 0.5D * (double)this.getWorldFromRenderManager().getLightBrightness(pos);
if (d0 >= 0.0D)
{
if (d0 > 1.0D)
{
d0 = 1.0D;
}
double d1 = (double)pos.getX() + blockIn.getBlockBoundsMinX() + p_180549_11_;
double d2 = (double)pos.getX() + blockIn.getBlockBoundsMaxX() + p_180549_11_;
double d3 = (double)pos.getY() + blockIn.getBlockBoundsMinY() + p_180549_13_ + 0.015625D;
double d4 = (double)pos.getZ() + blockIn.getBlockBoundsMinZ() + p_180549_15_;
double d5 = (double)pos.getZ() + blockIn.getBlockBoundsMaxZ() + p_180549_15_;
float f = (float)((p_180549_2_ - d1) / 2.0D / (double)p_180549_10_ + 0.5D);
float f1 = (float)((p_180549_2_ - d2) / 2.0D / (double)p_180549_10_ + 0.5D);
float f2 = (float)((p_180549_6_ - d4) / 2.0D / (double)p_180549_10_ + 0.5D);
float f3 = (float)((p_180549_6_ - d5) / 2.0D / (double)p_180549_10_ + 0.5D);
worldrenderer.pos(d1, d3, d4).tex((double)f, (double)f2).color(1.0F, 1.0F, 1.0F, (float)d0).endVertex();
worldrenderer.pos(d1, d3, d5).tex((double)f, (double)f3).color(1.0F, 1.0F, 1.0F, (float)d0).endVertex();
worldrenderer.pos(d2, d3, d5).tex((double)f1, (double)f3).color(1.0F, 1.0F, 1.0F, (float)d0).endVertex();
worldrenderer.pos(d2, d3, d4).tex((double)f1, (double)f2).color(1.0F, 1.0F, 1.0F, (float)d0).endVertex();
}
}
}
/**
* Renders a white box with the bounds of the AABB translated by the offset. Args: aabb, x, y, z
*/
public static void renderOffsetAABB(BoundingBox boundingBox, double x, double y, double z)
{
GlState.disableTexture2D();
// Tessellator tessellator = Tessellator.getInstance();
RenderBuffer worldrenderer = Tessellator.getBuffer();
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
worldrenderer.setTranslation(x, y, z);
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_NORMAL);
worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).normal(0.0F, 0.0F, -1.0F).endVertex();
worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).normal(0.0F, 0.0F, -1.0F).endVertex();
worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).normal(0.0F, 0.0F, -1.0F).endVertex();
worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).normal(0.0F, 0.0F, -1.0F).endVertex();
worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex();
worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex();
worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex();
worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex();
worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).normal(0.0F, -1.0F, 0.0F).endVertex();
worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).normal(0.0F, -1.0F, 0.0F).endVertex();
worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).normal(0.0F, -1.0F, 0.0F).endVertex();
worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).normal(0.0F, -1.0F, 0.0F).endVertex();
worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).normal(0.0F, 1.0F, 0.0F).endVertex();
worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).normal(0.0F, 1.0F, 0.0F).endVertex();
worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).normal(0.0F, 1.0F, 0.0F).endVertex();
worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).normal(0.0F, 1.0F, 0.0F).endVertex();
worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).normal(-1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).normal(-1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).normal(-1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).normal(-1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).normal(1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).normal(1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).normal(1.0F, 0.0F, 0.0F).endVertex();
worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).normal(1.0F, 0.0F, 0.0F).endVertex();
Tessellator.draw();
worldrenderer.setTranslation(0.0D, 0.0D, 0.0D);
GlState.enableTexture2D();
}
public void doRenderShadowAndFire(Entity entityIn, double x, double y, double z, float partialTicks)
{
if (this.renderManager.gm != null)
{
// if (this.renderManager.options.entityShadows && this.shadowSize > 0.0F && !entityIn.isInvisible() && this.renderManager.isRenderShadow())
// {
// double d0 = this.renderManager.getDistanceToCamera(entityIn.posX, entityIn.posY, entityIn.posZ);
// float f = (float)((1.0D - d0 / 256.0D) * (double)this.shadowOpaque);
//
// if (f > 0.0F)
// {
// this.renderShadow(entityIn, x, y, z, f, partialTicks);
// }
// }
if (entityIn.canRenderOnFire()) // && (!(entityIn.isPlayer()) || !((EntityNPC)entityIn).isSpectator()))
{
this.renderEntityOnFire(entityIn, x, y, z, partialTicks);
}
}
}
protected void renderLivingLabel(T entityIn, String str, double x, double y, double z, int maxDistance) {
double d0 = entityIn.getDistanceSqToEntity(this.renderManager.livingPlayer);
if (d0 <= (double)(maxDistance * maxDistance) && this.renderManager.gm.canRenderHud()) {
// WCF.glPushMatrix();
// WCF.glTranslatef((float)x, (float)y + entityIn.height + 0.5f, (float)z);
// float f = 1.0f / 64.0f;
// WCF.glScalef(f, f, f);
// int w, h;
// Vec2i size = Drawing.txt_size(0, 0, 0, 0, 65536, 65536, Font.DEFAULT, str);
// int tx = - size.xpos / 2;
// int ty = - size.ypos;
// Drawing.txt_draw(tx, ty, tx, ty, tx + 440, ty + 260, 0xffffffff, 0x3f000000, Font.DEFAULT, str);
//// this.renderManager.addOverlay(x, y + (double)entityIn.height + 0.5, z, str);
// WCF.glPopMatrix();
// FontRenderer fontrenderer = this.getFontRendererFromRenderManager();
float f = 1.0f; // 1.6F;
float f1 = 0.016666668F * f;
GL11.glPushMatrix();
GL11.glTranslatef((float)x + 0.0F, (float)y + entityIn.height + 0.5F, (float)z);
GL11.glNormal3f(0.0F, 1.0F, 0.0F);
GL11.glRotatef(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
GL11.glScalef(-f1, -f1, f1);
GlState.disableLighting();
GlState.depthMask(false);
// GlState.disableDepth();
GlState.enableBlend();
GlState.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
// Tessellator tessellator = Tessellator.getInstance();
RenderBuffer worldrenderer = Tessellator.getBuffer();
// int i = 0;
// if (str.equals("deadmau5"))
// {
// i = -10;
// }
// Vec2i size = Drawing.txt_size(0, 0, 0, 0, 65536, 65536, str);
// int j = size.xpos / 2;
// GlState.disableTexture2D();
// worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
// worldrenderer.pos((double)(-j - 1), (double)(-1 + i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
// worldrenderer.pos((double)(-j - 1), (double)(8 + i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
// worldrenderer.pos((double)(j + 1), (double)(8 + i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
// worldrenderer.pos((double)(j + 1), (double)(-1 + i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
// Tessellator.draw();
// GlState.enableTexture2D();
// int tx = -size.xpos / 2; // j;
// int ty = 0; // i;
// Drawing.txt_draw(tx, ty, tx, ty, tx + 440, ty + 260, /* 0xffffffff */ 553648127, 0x3f000000, Font.DEFAULT, str);
// FontRenderer.drawString(str, -FontRenderer.getStringWidth(str) / 2, i, 553648127);
// GlState.enableDepth();
GlState.depthMask(true);
Drawing.drawTextboxCentered(str, 0, 0, 0x3f000000);
// FontRenderer.drawString(str, -FontRenderer.getStringWidth(str) / 2, i, -1);
GlState.enableLighting();
GlState.disableBlend();
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glPopMatrix();
}
}
public RenderManager getRenderManager()
{
return this.renderManager;
}
}

View file

@ -1,34 +0,0 @@
package client.renderer.entity;
import client.renderer.model.ModelBase;
import common.entity.animal.EntityChicken;
import common.util.ExtMath;
public class RenderChicken extends RenderLiving<EntityChicken>
{
private static final String chickenTextures = "textures/entity/chicken.png";
public RenderChicken(RenderManager renderManagerIn, ModelBase modelBaseIn)
{
super(renderManagerIn, modelBaseIn);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected String getEntityTexture(EntityChicken entity)
{
return chickenTextures;
}
/**
* Defines what float the third param in setRotationAngles of ModelBase is
*/
protected float handleRotationFloat(EntityChicken livingBase, float partialTicks)
{
float f = livingBase.field_70888_h + (livingBase.wingRotation - livingBase.field_70888_h) * partialTicks;
float f1 = livingBase.field_70884_g + (livingBase.destPos - livingBase.field_70884_g) * partialTicks;
return (ExtMath.sin(f) + 1.0F) * f1;
}
}

View file

@ -1,46 +0,0 @@
package client.renderer.entity;
import org.lwjgl.opengl.GL11;
import client.Client;
import client.renderer.model.ModelDie;
import client.renderer.texture.TextureMap;
import common.entity.projectile.EntityDie;
import common.model.Transforms.Camera;
public class RenderDie extends Render<EntityDie>
{
private final ModelDie model = new ModelDie();
public RenderDie(RenderManager renderManagerIn)
{
super(renderManagerIn);
// this.shadowSize = 0.09F;
}
protected String getEntityTexture(EntityDie entity)
{
return TextureMap.locationBlocksTexture;
}
public void doRender(EntityDie entity, double x, double y, double z, float partialTicks)
{
// BlockRendererDispatcher blockrendererdispatcher = Game.getClient().getBlockRendererDispatcher();
GL11.glPushMatrix();
GL11.glTranslatef((float)x, (float)y + 0.05F, (float)z);
this.bindEntityTexture(entity);
if(entity.getValue() == 0)
GL11.glRotatef((float)((entity.ticksExisted % 10) * (360 / 10)), 0.3f, 0.4f, 0.1f);
// GlState.translate(-0.05F, -0.05F, 0.05F);
GL11.glScalef(0.5f, 0.5f, 0.5f);
Client.CLIENT.getRenderItem().renderItem(entity.getStack(), Camera.GROUND);
// blockrendererdispatcher.renderBlockBrightness(Blocks.planks.getDefaultState(), entity.getBrightness(partialTicks));
GL11.glPopMatrix();
super.doRender(entity, x, y, z, partialTicks);
}
// protected boolean canRenderName(EntityDie entity)
// {
// return entity.getValue() != 0 || super.canRenderName(entity);
// }
}

View file

@ -1,104 +0,0 @@
package client.renderer.entity;
import org.lwjgl.opengl.GL11;
import client.renderer.GlState;
import client.renderer.layers.LayerEnderDragonEyes;
import client.renderer.model.ModelDragon;
import common.entity.animal.EntityDragon;
import common.util.ExtMath;
public class RenderDragon extends RenderLiving<EntityDragon>
{
private static final String enderDragonTextures = "textures/entity/dragon.png";
/** An instance of the dragon model in RenderDragon */
protected ModelDragon modelDragon;
public RenderDragon(RenderManager renderManagerIn)
{
super(renderManagerIn, new ModelDragon(0.0F));
this.modelDragon = (ModelDragon)this.mainModel;
this.addLayer(new LayerEnderDragonEyes(this));
// this.addLayer(new LayerEntityBreak());
}
protected void rotateCorpse(EntityDragon bat, float p_77043_2_, float p_77043_3_, float partialTicks)
{
float f = (float)bat.getMovementOffsets(7, partialTicks)[0];
float f1 = (float)(bat.getMovementOffsets(5, partialTicks)[1] - bat.getMovementOffsets(10, partialTicks)[1]);
GL11.glRotatef(-f, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(f1 * 10.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslatef(0.0F, 0.0F, 1.0F);
if (bat.deathTime > 0)
{
float f2 = ((float)bat.deathTime + partialTicks - 1.0F) / 20.0F * 1.6F;
f2 = ExtMath.sqrtf(f2);
if (f2 > 1.0F)
{
f2 = 1.0F;
}
GL11.glRotatef(f2 * this.getDeathMaxRotation(bat), 0.0F, 0.0F, 1.0F);
}
}
/**
* Renders the model in RenderLiving
*/
protected void renderModel(EntityDragon entitylivingbaseIn, float p_77036_2_, float p_77036_3_, float p_77036_4_, float p_77036_5_, float p_77036_6_, float scaleFactor)
{
// if (entitylivingbaseIn.deathTicks > 0)
// {
// float f = (float)entitylivingbaseIn.deathTicks / 200.0F;
// GlState.depthFunc(GL11.GL_LEQUAL);
// GlState.enableAlpha();
// GlState.alphaFunc(GL11.GL_GREATER, f);
// this.bindTexture(enderDragonExplodingTextures);
// this.mainModel.render(entitylivingbaseIn, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, scaleFactor);
// GlState.alphaFunc(GL11.GL_GREATER, 0.1F);
// GlState.depthFunc(GL11.GL_EQUAL);
// }
this.bindEntityTexture(entitylivingbaseIn);
this.mainModel.render(entitylivingbaseIn, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, scaleFactor);
if (entitylivingbaseIn.hurtTime > 0)
{
GlState.depthFunc(GL11.GL_EQUAL);
GlState.disableTexture2D();
GlState.enableBlend();
GlState.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlState.color(1.0F, 0.0F, 0.0F, 0.5F);
this.mainModel.render(entitylivingbaseIn, p_77036_2_, p_77036_3_, p_77036_4_, p_77036_5_, p_77036_6_, scaleFactor);
GlState.enableTexture2D();
GlState.disableBlend();
GlState.depthFunc(GL11.GL_LEQUAL);
}
}
// /**
// * Renders the desired {@code T} type Entity.
// */
// public void doRender(EntityDragon entity, double x, double y, double z, float entityYaw, float partialTicks)
// {
// BossStatus.setBossStatus(entity);
// super.doRender(entity, x, y, z, entityYaw, partialTicks);
//
//// if (entity.healingEnderCrystal != null)
//// {
//// this.drawRechargeRay(entity, x, y, z, partialTicks);
//// }
// }
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected String getEntityTexture(EntityDragon entity)
{
return enderDragonTextures;
}
}

View file

@ -1,16 +0,0 @@
package client.renderer.entity;
import common.entity.projectile.EntityDynamite;
import common.item.Item;
import common.item.ItemStack;
public class RenderDynamite extends RenderItemEntity<EntityDynamite> {
public RenderDynamite(RenderManager renderManagerIn, Item itemIn, RenderItem renderItemIn) {
super(renderManagerIn, itemIn, renderItemIn);
}
public ItemStack getStack(EntityDynamite entityIn)
{
return new ItemStack(this.item, 1, entityIn.explosionSize);
}
}

View file

@ -1,33 +0,0 @@
package client.renderer.entity;
import org.lwjgl.opengl.GL11;
import common.entity.Entity;
public class RenderEntity extends Render<Entity>
{
public RenderEntity(RenderManager renderManagerIn)
{
super(renderManagerIn);
}
/**
* Renders the desired {@code T} type Entity.
*/
public void doRender(Entity entity, double x, double y, double z, float partialTicks)
{
GL11.glPushMatrix();
renderOffsetAABB(entity.getEntityBoundingBox(), x - entity.lastTickPosX, y - entity.lastTickPosY, z - entity.lastTickPosZ);
GL11.glPopMatrix();
super.doRender(entity, x, y, z, partialTicks);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected String getEntityTexture(Entity entity)
{
return null;
}
}

View file

@ -1,74 +0,0 @@
package client.renderer.entity;
import org.lwjgl.opengl.GL11;
import client.Client;
import client.renderer.BlockRenderer;
import client.renderer.DefaultVertexFormats;
import client.renderer.GlState;
import client.renderer.RenderBuffer;
import client.renderer.Tessellator;
import client.renderer.blockmodel.IBakedModel;
import client.renderer.texture.TextureMap;
import common.block.Block;
import common.entity.item.EntityFalling;
import common.util.BlockPos;
import common.world.State;
import common.world.World;
public class RenderFallingBlock extends Render<EntityFalling>
{
public RenderFallingBlock(RenderManager renderManagerIn)
{
super(renderManagerIn);
// this.shadowSize = 0.5F;
}
/**
* Renders the desired {@code T} type Entity.
*/
public void doRender(EntityFalling entity, double x, double y, double z, float partialTicks)
{
if (entity.getBlock() != null)
{
this.bindTexture(TextureMap.locationBlocksTexture);
State iblockstate = entity.getBlock();
Block block = iblockstate.getBlock();
BlockPos blockpos = new BlockPos(entity);
World world = entity.getWorldObj();
if (iblockstate != world.getState(blockpos) && block.getRenderType() != -1)
{
if (block.getRenderType() == 3)
{
GL11.glPushMatrix();
GL11.glTranslatef((float)x, (float)y, (float)z);
GlState.disableLighting();
// Tessellator tessellator = Tessellator.getInstance();
RenderBuffer worldrenderer = Tessellator.getBuffer();
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
int i = blockpos.getX();
int j = blockpos.getY();
int k = blockpos.getZ();
worldrenderer.setTranslation((double)((float)(-i) - 0.5F), (double)(-j), (double)((float)(-k) - 0.5F));
BlockRenderer blockrendererdispatcher = Client.CLIENT.getBlockRendererDispatcher();
IBakedModel ibakedmodel = blockrendererdispatcher.getModelFromBlockState(iblockstate, world, (BlockPos)null);
blockrendererdispatcher.renderModel(world, ibakedmodel, iblockstate, blockpos, worldrenderer, false);
worldrenderer.setTranslation(0.0D, 0.0D, 0.0D);
Tessellator.draw();
GlState.enableLighting();
GL11.glPopMatrix();
super.doRender(entity, x, y, z, partialTicks);
}
}
}
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected String getEntityTexture(EntityFalling entity)
{
return TextureMap.locationBlocksTexture;
}
}

View file

@ -1,100 +0,0 @@
package client.renderer.entity;
import java.util.Set;
import org.lwjgl.opengl.GL11;
import client.Client;
import client.renderer.model.ModelHorse;
import client.renderer.texture.LayeredTexture;
import common.collect.Sets;
import common.entity.animal.EntityHorse;
public class RenderHorse extends RenderLiving<EntityHorse>
{
private static final Set<String> loaded = Sets.<String>newHashSet();
private static final String whiteHorseTextures = "textures/entity/horse_white.png";
private static final String muleTextures = "textures/entity/mule.png";
private static final String donkeyTextures = "textures/entity/donkey.png";
private static final String zombieHorseTextures = "textures/entity/horse_zombie.png";
private static final String skeletonHorseTextures = "textures/entity/horse_skeleton.png";
public RenderHorse(RenderManager rendermanagerIn, ModelHorse model)
{
super(rendermanagerIn, model);
}
/**
* Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
* entityLiving, partialTickTime
*/
protected void preRenderCallback(EntityHorse entitylivingbaseIn, float partialTickTime)
{
float f = 1.0F;
int i = entitylivingbaseIn.getHorseType();
if (i == 1)
{
f *= 0.87F;
}
else if (i == 2)
{
f *= 0.92F;
}
GL11.glScalef(f, f, f);
super.preRenderCallback(entitylivingbaseIn, partialTickTime);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected String getEntityTexture(EntityHorse entity)
{
if (!entity.func_110239_cn())
{
switch (entity.getHorseType())
{
case 0:
default:
return whiteHorseTextures;
case 1:
return donkeyTextures;
case 2:
return muleTextures;
case 3:
return zombieHorseTextures;
case 4:
return skeletonHorseTextures;
}
}
else
{
return this.func_110848_b(entity);
}
}
private String func_110848_b(EntityHorse horse)
{
String s = horse.getHorseTexture();
if (!horse.func_175507_cI())
{
return null;
}
else
{
if (!loaded.contains(s))
{
Client.CLIENT.getTextureManager().loadTexture(s, new LayeredTexture(horse.getVariantTexturePaths()));
loaded.add(s);
}
return s;
}
}
}

View file

@ -1,372 +0,0 @@
package client.renderer.entity;
import java.util.List;
import org.lwjgl.opengl.GL11;
import client.renderer.DefaultVertexFormats;
import client.renderer.GlState;
import client.renderer.ItemModelMesher;
import client.renderer.RenderBuffer;
import client.renderer.Tessellator;
import client.renderer.blockmodel.BakedQuad;
import client.renderer.blockmodel.IBakedModel;
import client.renderer.blockmodel.ModelManager;
import client.renderer.texture.TextureManager;
import client.renderer.texture.TextureMap;
import client.renderer.tileentity.TileEntityItemStackRenderer;
import common.entity.npc.EntityNPC;
import common.entity.types.EntityLiving;
import common.init.Items;
import common.item.Item;
import common.item.ItemStack;
import common.model.Transform;
import common.model.Transforms;
import common.util.Facing;
import common.util.Vec3i;
public class RenderItem
{
private static final String RES_ITEM_GLINT = "textures/glint.png";
/** False when the renderer is rendering the item's effects into a GUI */
// private boolean notRenderingEffectsInGUI = true;
/** Defines the zLevel of rendering of item on GUI. */
public float zLevel;
private final ItemModelMesher itemModelMesher;
private final TextureManager textureManager;
public RenderItem(TextureManager textureManager, ModelManager modelManager)
{
this.textureManager = textureManager;
this.itemModelMesher = new ItemModelMesher(modelManager);
// RenderRegistry.registerItems(this.itemModelMesher);
}
/**
* False when the renderer is rendering the item's effects into a GUI
*
* @param isNot If the renderer is not rendering the effects in a GUI
*/
// public void isNotRenderingEffectsInGUI(boolean isNot)
// {
// this.notRenderingEffectsInGUI = isNot;
// }
public ItemModelMesher getItemModelMesher()
{
return this.itemModelMesher;
}
private void renderModel(IBakedModel model, ItemStack stack)
{
this.renderModel(model, -1, stack);
}
private void renderModel(IBakedModel model, int color)
{
this.renderModel(model, color, (ItemStack)null);
}
private void renderModel(IBakedModel model, int color, ItemStack stack)
{
// Tessellator tessellator = Tessellator.getInstance();
RenderBuffer worldrenderer = Tessellator.getBuffer();
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
for (Facing enumfacing : Facing.values())
{
this.renderQuads(worldrenderer, model.getFaceQuads(enumfacing), color, stack);
}
this.renderQuads(worldrenderer, model.getGeneralQuads(), color, stack);
Tessellator.draw();
}
public void renderItem(ItemStack stack, IBakedModel model)
{
if (stack != null)
{
GL11.glPushMatrix();
GL11.glScalef(0.5F, 0.5F, 0.5F);
if (model.isBuiltInRenderer())
{
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
GlState.enableRescaleNormal();
TileEntityItemStackRenderer.instance.renderByItem(stack);
}
else
{
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
this.renderModel(model, stack);
if (stack.hasEffect())
{
this.renderEffect(model);
}
}
GL11.glPopMatrix();
}
}
private void renderEffect(IBakedModel model)
{
GlState.depthMask(false);
GlState.depthFunc(GL11.GL_EQUAL);
GlState.disableLighting();
GlState.blendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
this.textureManager.bindTexture(RES_ITEM_GLINT);
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glPushMatrix();
GL11.glScalef(8.0F, 8.0F, 8.0F);
float f = (float)(System.currentTimeMillis() % 3000L) / 3000.0F / 8.0F;
GL11.glTranslatef(f, 0.0F, 0.0F);
GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
this.renderModel(model, -8372020);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glScalef(8.0F, 8.0F, 8.0F);
float f1 = (float)(System.currentTimeMillis() % 4873L) / 4873.0F / 8.0F;
GL11.glTranslatef(-f1, 0.0F, 0.0F);
GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
this.renderModel(model, -8372020);
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GlState.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlState.enableLighting();
GlState.depthFunc(GL11.GL_LEQUAL);
GlState.depthMask(true);
this.textureManager.bindTexture(TextureMap.locationBlocksTexture);
}
private void putQuadNormal(RenderBuffer renderer, BakedQuad quad)
{
Vec3i vec3i = quad.getFace().getDirectionVec();
renderer.putNormal((float)vec3i.getX(), (float)vec3i.getY(), (float)vec3i.getZ());
}
private void renderQuad(RenderBuffer renderer, BakedQuad quad, int color)
{
renderer.addVertexData(quad.getVertexData());
renderer.putColor4(color);
this.putQuadNormal(renderer, quad);
}
private void renderQuads(RenderBuffer renderer, List<BakedQuad> quads, int color, ItemStack stack)
{
boolean flag = color == -1 && stack != null;
int i = 0;
for (int j = quads.size(); i < j; ++i)
{
BakedQuad bakedquad = (BakedQuad)quads.get(i);
int k = color;
if (flag && bakedquad.hasTintIndex())
{
k = stack.getItem().getColorFromItemStack(stack, bakedquad.getTintIndex());
// if (EntityRenderer.anaglyphEnable)
// {
// k = TextureUtil.anaglyphColor(k);
// }
k = k | -16777216;
}
this.renderQuad(renderer, bakedquad, k);
}
}
public boolean shouldRenderItemIn3D(ItemStack stack)
{
IBakedModel ibakedmodel = this.itemModelMesher.getItemModel(stack);
return ibakedmodel == null ? false : ibakedmodel.isGui3d();
}
private void preTransform(ItemStack stack)
{
IBakedModel ibakedmodel = this.itemModelMesher.getItemModel(stack);
Item item = stack.getItem();
if (item != null)
{
boolean flag = ibakedmodel.isGui3d();
if (!flag)
{
GL11.glScalef(2.0F, 2.0F, 2.0F);
}
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
}
}
public void renderItem(ItemStack stack, Transforms.Camera cameraTransformType)
{
if (stack != null)
{
IBakedModel ibakedmodel = this.itemModelMesher.getItemModel(stack);
this.renderItemModelTransform(stack, ibakedmodel, cameraTransformType);
}
}
public void renderItemModelForEntity(ItemStack stack, EntityLiving entityToRenderFor, Transforms.Camera cameraTransformType)
{
if (stack != null && entityToRenderFor != null)
{
IBakedModel ibakedmodel = this.itemModelMesher.getItemModel(stack);
if (entityToRenderFor.isPlayer())
{
EntityNPC entityplayer = (EntityNPC)entityToRenderFor;
Item item = stack.getItem();
String modelresourcelocation = null;
if (item == Items.fishing_rod && entityplayer.fishEntity != null)
{
modelresourcelocation = "item/fishing_rod#1" + '#' + "inventory";
}
else if (item == Items.bow && entityplayer.getItemInUse() != null)
{
int i = stack.getMaxItemUseDuration() - entityplayer.getItemInUseCount();
if (i >= 18)
{
modelresourcelocation = "item/bow#3" + '#' + "inventory";
}
else if (i > 13)
{
modelresourcelocation = "item/bow#2" + '#' + "inventory";
}
else if (i > 0)
{
modelresourcelocation = "item/bow#1" + '#' + "inventory";
}
}
if (modelresourcelocation != null)
{
ibakedmodel = this.itemModelMesher.getModelManager().getModel(modelresourcelocation);
}
}
this.renderItemModelTransform(stack, ibakedmodel, cameraTransformType);
}
}
protected void renderItemModelTransform(ItemStack stack, IBakedModel model, Transforms.Camera cameraTransformType)
{
this.textureManager.bindTexture(TextureMap.locationBlocksTexture);
// this.textureManager.getTexture(TextureMap.locationBlocksTexture).unsetMipmap();
this.preTransform(stack);
GlState.enableRescaleNormal();
GlState.alphaFunc(GL11.GL_GREATER, 0.1F);
GlState.enableBlend();
GlState.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
GL11.glPushMatrix();
Transforms itemcameratransforms = model.getItemCameraTransforms();
RenderItem.apply(itemcameratransforms, cameraTransformType);
if (this.isThereOneNegativeScale(itemcameratransforms.get(cameraTransformType)))
{
GlState.cullFace(GL11.GL_FRONT);
}
this.renderItem(stack, model);
GlState.cullFace(GL11.GL_BACK);
GL11.glPopMatrix();
GlState.disableRescaleNormal();
GlState.disableBlend();
this.textureManager.bindTexture(TextureMap.locationBlocksTexture);
// this.textureManager.getTexture(TextureMap.locationBlocksTexture).restoreLastMipmap();
}
/**
* Return true if only one scale is negative
*
* @param itemTranformVec The ItemTransformVec3f instance
*/
private boolean isThereOneNegativeScale(Transform itemTranformVec)
{
return itemTranformVec.scale.x < 0.0F ^ itemTranformVec.scale.y < 0.0F ^ itemTranformVec.scale.z < 0.0F;
}
private void renderItemIntoGUI(ItemStack stack, int x, int y)
{
IBakedModel ibakedmodel = this.itemModelMesher.getItemModel(stack);
GL11.glPushMatrix();
this.textureManager.bindTexture(TextureMap.locationBlocksTexture);
// this.textureManager.getTexture(TextureMap.locationBlocksTexture).unsetMipmap();
GlState.enableRescaleNormal();
GlState.enableAlpha();
GlState.alphaFunc(GL11.GL_GREATER, 0.1F);
GlState.enableBlend();
GlState.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
this.setupGuiTransform(x, y, ibakedmodel.isGui3d());
RenderItem.apply(ibakedmodel.getItemCameraTransforms(), Transforms.Camera.GUI);
this.renderItem(stack, ibakedmodel);
GlState.disableAlpha();
GlState.disableRescaleNormal();
GlState.disableLighting();
GL11.glPopMatrix();
this.textureManager.bindTexture(TextureMap.locationBlocksTexture);
// this.textureManager.getTexture(TextureMap.locationBlocksTexture).restoreLastMipmap();
}
private void setupGuiTransform(int xPosition, int yPosition, boolean isGui3d)
{
GL11.glTranslatef((float)xPosition, (float)yPosition, 100.0F + this.zLevel);
GL11.glTranslatef(8.0F, 8.0F, 0.0F);
GL11.glScalef(1.0F, 1.0F, -1.0F);
GL11.glScalef(0.5F, 0.5F, 0.5F);
if (isGui3d)
{
GL11.glScalef(40.0F, 40.0F, 40.0F);
GL11.glRotatef(210.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F);
GlState.enableLighting();
}
else
{
GL11.glScalef(64.0F, 64.0F, 64.0F);
GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
GlState.disableLighting();
}
}
public void renderItemAndEffectIntoGUI(final ItemStack stack, int xPosition, int yPosition)
{
if (stack != null && stack.getItem() != null)
{
this.zLevel += 50.0F;
this.renderItemIntoGUI(stack, xPosition, yPosition);
this.zLevel -= 50.0F;
}
}
public void onReload()
{
this.itemModelMesher.rebuildCache();
}
public static void apply(Transforms trans, Transforms.Camera type) {
Transform vec = trans.get(type);
if(vec != Transform.IDENTITY) {
GL11.glTranslatef(vec.translation.x, vec.translation.y, vec.translation.z);
GL11.glRotatef(vec.rotation.y, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(vec.rotation.x, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(vec.rotation.z, 0.0F, 0.0F, 1.0F);
GL11.glScalef(vec.scale.x, vec.scale.y, vec.scale.z);
}
}
}

View file

@ -1,49 +0,0 @@
package client.renderer.entity;
import org.lwjgl.opengl.GL11;
import client.renderer.GlState;
import client.renderer.texture.TextureMap;
import common.entity.Entity;
import common.item.Item;
import common.item.ItemStack;
import common.model.Transforms;
public class RenderItemEntity<T extends Entity> extends Render<T>
{
protected final Item item;
private final RenderItem itemRenderer;
public RenderItemEntity(RenderManager renderManagerIn, Item itemIn, RenderItem renderItemIn)
{
super(renderManagerIn);
this.item = itemIn;
this.itemRenderer = renderItemIn;
}
public void doRender(T entity, double x, double y, double z, float partialTicks)
{
GL11.glPushMatrix();
GL11.glTranslatef((float)x, (float)y, (float)z);
GlState.enableRescaleNormal();
GL11.glScalef(0.5F, 0.5F, 0.5F);
GL11.glRotatef(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
this.bindTexture(TextureMap.locationBlocksTexture);
this.itemRenderer.renderItem(this.getStack(entity), Transforms.Camera.GROUND);
GlState.disableRescaleNormal();
GL11.glPopMatrix();
super.doRender(entity, x, y, z, partialTicks);
}
public ItemStack getStack(T entityIn)
{
return new ItemStack(this.item, 1, 0);
}
protected String getEntityTexture(Entity entity)
{
return TextureMap.locationBlocksTexture;
}
}

View file

@ -1,367 +0,0 @@
package client.renderer.entity;
import java.util.Map;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL13;
import client.Client;
import client.init.RenderRegistry;
import client.renderer.DefaultVertexFormats;
import client.renderer.GlState;
import client.renderer.RenderBuffer;
import client.renderer.RenderGlobal;
import client.renderer.Tessellator;
import client.renderer.texture.TextureManager;
import common.collect.Maps;
import common.entity.Entity;
import common.entity.types.EntityLiving;
import common.init.SpeciesRegistry.ModelType;
import common.util.BoundingBox;
import common.util.Vec3;
import common.world.World;
public class RenderManager
{
// private class Overlay {
// private final int x;
// private final int y;
// private final String str;
//
// private Overlay(int x, int y, String str) {
// this.x = x;
// this.y = y;
// this.str = str;
// }
// }
private Map < Class <? extends Entity > , Render <? extends Entity >> entityRenderMap = Maps. < Class <? extends Entity > , Render <? extends Entity >> newHashMap();
private Map<ModelType, RenderNpc> models = Maps.newEnumMap(ModelType.class);
// private final List<Overlay> overlays = Lists.newArrayList();
/** Renders fonts */
// private FontRenderer textRenderer;
private double renderPosX;
private double renderPosY;
private double renderPosZ;
public TextureManager renderEngine;
/** Reference to the World object. */
public World worldObj;
/** Rendermanager's variable for the player */
public Entity livingPlayer;
public Entity pointedEntity;
public float playerViewY;
public float playerViewX;
public Client gm;
public double viewerPosX;
public double viewerPosY;
public double viewerPosZ;
private boolean renderOutlines = false;
// private boolean renderShadow = true;
/** whether bounding box should be rendered or not */
private boolean debugBoundingBox = false;
public RenderManager(TextureManager renderEngineIn, RenderItem itemRendererIn)
{
this.renderEngine = renderEngineIn;
RenderRegistry.registerRenderers(this.entityRenderMap, this.models, this, itemRendererIn);
for(RenderNpc render : this.models.values()) {
render.initSegments();
}
// this.playerRenderer = new RenderPlayer(this);
}
// public void addOverlay(double x, double y, double z, String str) {
// Vec3 vec = ActiveRenderInfo.getDisplayCoords((float)x, (float)y, (float)z);
// this.overlays.add(new Overlay((int)vec.xCoord, this.gm.fb_y - 1 - (int)vec.yCoord, str));
// }
//
// public void drawOverlays(boolean render) {
// if(render)
// for(Overlay overlay : this.overlays) {
// this.drawOverlay(overlay.str, overlay.x, overlay.y);
// }
// this.overlays.clear();
// }
// private void drawOverlay(String text, int x, int y) {
// int w, h;
// Vec2i size = Drawing.txt_size(0, 0, 0, 0, 65536, 65536, Font.DEFAULT, text);
// x -= size.xpos / 2;
// y -= size.ypos;
// Drawing.txt_draw(x, y, x, y, x + 440, y + 260, 0xffffffff, 0x3f000000, Font.DEFAULT, text);
// }
public void setRenderPosition(double renderPosXIn, double renderPosYIn, double renderPosZIn)
{
this.renderPosX = renderPosXIn;
this.renderPosY = renderPosYIn;
this.renderPosZ = renderPosZIn;
}
private <T extends Entity> Render<T> getEntityClassRenderObject(Class <? extends Entity > entityClass)
{
Render <? extends Entity > render = (Render)this.entityRenderMap.get(entityClass);
if (render == null && entityClass != Entity.class)
{
render = this.<Entity>getEntityClassRenderObject((Class <? extends Entity >)entityClass.getSuperclass());
this.entityRenderMap.put(entityClass, render);
}
return (Render<T>)render;
}
// private <T extends EntityLiving> Render<T> getLivingRenderObject(Class <? extends EntityLiving > entityClass)
// {
// if(EntityNPCClient.class.isAssignableFrom(entityClass)) {
// return (Render<T>)this.playerRenderer;
// }
// Render <? extends EntityLiving > render = (Render)this.entityRenderMap.get(entityClass);
// if (render == null && entityClass != EntityLiving.class)
// {
// render = this.<EntityLiving>getLivingRenderObject((Class <? extends EntityLiving >)entityClass.getSuperclass());
// }
// return (Render<T>)render;
// }
private <T extends Entity> Render<T> getEntityRenderObject(Entity entityIn)
{
// if (entityIn.isPlayer())
// {
// return (Render<T>)this.models.get(((EntityNPC)entityIn).getModel());
// }
// else
// {
return this.<T>getEntityClassRenderObject(entityIn.getClass());
// }
}
public RenderNpc getRenderObject(ModelType model) {
return this.models.get(model);
}
public void cacheActiveRenderInfo(World worldIn, Entity livingPlayerIn, Entity pointedEntityIn, Client optionsIn, float partialTicks)
{
this.worldObj = worldIn;
this.gm = optionsIn;
this.livingPlayer = livingPlayerIn;
this.pointedEntity = pointedEntityIn;
// this.textRenderer = textRendererIn;
// if (livingPlayerIn instanceof EntityLivingBase && ((EntityLivingBase)livingPlayerIn).isPlayerSleeping())
// {
// IBlockState iblockstate = worldIn.getBlockState(new BlockPos(livingPlayerIn));
// Block block = iblockstate.getBlock();
//
// if (block instanceof BlockBed)
// {
// int i = ((EnumFacing)iblockstate.getValue(BlockBed.FACING)).getHorizontalIndex();
// this.playerViewY = (float)(i * 90 + 180);
// this.playerViewX = 0.0F;
// }
// }
// else
// {
this.playerViewY = livingPlayerIn.prevYaw + (livingPlayerIn.rotYaw - livingPlayerIn.prevYaw) * partialTicks;
this.playerViewX = livingPlayerIn.prevPitch + (livingPlayerIn.rotPitch - livingPlayerIn.prevPitch) * partialTicks;
// }
if (optionsIn.thirdPersonView == 2)
{
this.playerViewY += 180.0F;
}
this.viewerPosX = livingPlayerIn.lastTickPosX + (livingPlayerIn.posX - livingPlayerIn.lastTickPosX) * (double)partialTicks;
this.viewerPosY = livingPlayerIn.lastTickPosY + (livingPlayerIn.posY - livingPlayerIn.lastTickPosY) * (double)partialTicks;
this.viewerPosZ = livingPlayerIn.lastTickPosZ + (livingPlayerIn.posZ - livingPlayerIn.lastTickPosZ) * (double)partialTicks;
}
public void setPlayerViewY(float playerViewYIn)
{
this.playerViewY = playerViewYIn;
}
// public boolean isRenderShadow()
// {
// return this.renderShadow;
// }
//
// public void setRenderShadow(boolean renderShadowIn)
// {
// this.renderShadow = renderShadowIn;
// }
public void setDebugBoundingBox(boolean debugBoundingBoxIn)
{
this.debugBoundingBox = debugBoundingBoxIn;
}
public boolean isDebugBoundingBox()
{
return this.debugBoundingBox;
}
public boolean shouldRender(Entity entityIn, double camX, double camY, double camZ)
{
Render<Entity> render = this.<Entity>getEntityRenderObject(entityIn);
return render != null && render.shouldRender(entityIn, camX, camY, camZ);
}
public boolean renderEntity(Entity entity, float partialTicks)
{
if (entity.ticksExisted == 0)
{
entity.lastTickPosX = entity.posX;
entity.lastTickPosY = entity.posY;
entity.lastTickPosZ = entity.posZ;
}
double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks;
double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks;
double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partialTicks;
// float f = entity.prevYaw + (entity.rotYaw - entity.prevYaw) * partialTicks;
int i = entity.getBrightnessForRender(partialTicks);
if (entity.isBurning())
{
i = 15728880;
}
int j = i % 65536;
int k = i / 65536;
GL13.glMultiTexCoord2f(GL13.GL_TEXTURE1, (float)j / 1.0F, (float)k / 1.0F);
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
return this.renderEntity(entity, d0 - this.renderPosX, d1 - this.renderPosY, d2 - this.renderPosZ, partialTicks);
}
public void renderFloatingBox(Entity entityIn, float partialTicks)
{
double d0 = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double)partialTicks;
double d1 = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double)partialTicks;
double d2 = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double)partialTicks;
Render<Entity> render = this.<Entity>getEntityRenderObject(entityIn);
if (render != null && this.renderEngine != null)
{
int i = entityIn.getBrightnessForRender(partialTicks);
int j = i % 65536;
int k = i / 65536;
GL13.glMultiTexCoord2f(GL13.GL_TEXTURE1, (float)j / 1.0F, (float)k / 1.0F);
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
render.renderName(entityIn, d0 - this.renderPosX, d1 - this.renderPosY, d2 - this.renderPosZ);
}
}
public boolean renderEntity(Entity entity, double x, double y, double z, float partialTicks)
{
Render<Entity> render = this.<Entity>getEntityRenderObject(entity);
if (render != null && this.renderEngine != null)
{
if (render instanceof RendererLivingEntity)
{
((RendererLivingEntity)render).setRenderOutlines(this.renderOutlines);
}
render.doRender(entity, x, y, z, partialTicks);
if (!this.renderOutlines)
{
render.doRenderShadowAndFire(entity, x, y, z, partialTicks);
}
if (this.debugBoundingBox) // && !entity.isInvisible()) // && !hideDebugBox)
{
this.renderDebugBoundingBox(entity, x, y, z, partialTicks);
}
}
else if (this.renderEngine != null)
{
return false;
}
return true;
}
private void renderDebugBoundingBox(Entity entityIn, double x, double y, double z, float partialTicks)
{
GlState.depthMask(false);
GlState.disableTexture2D();
GlState.disableLighting();
GlState.disableCull();
GlState.disableBlend();
float f = entityIn.width / 2.0F;
BoundingBox axisalignedbb = entityIn.getEntityBoundingBox();
BoundingBox axisalignedbb1 = new BoundingBox(axisalignedbb.minX - entityIn.posX + x, axisalignedbb.minY - entityIn.posY + y, axisalignedbb.minZ - entityIn.posZ + z, axisalignedbb.maxX - entityIn.posX + x, axisalignedbb.maxY - entityIn.posY + y, axisalignedbb.maxZ - entityIn.posZ + z);
RenderGlobal.drawOutlinedBoundingBox(axisalignedbb1, 255, 255, 255, 255);
if (entityIn instanceof EntityLiving)
{
float f1 = 0.01F;
RenderGlobal.drawOutlinedBoundingBox(new BoundingBox(x - (double)f, y + (double)entityIn.getEyeHeight() - 0.009999999776482582D, z - (double)f, x + (double)f, y + (double)entityIn.getEyeHeight() + 0.009999999776482582D, z + (double)f), 255, 0, 0, 255);
}
// Tessellator tessellator = Tessellator.getInstance();
RenderBuffer worldrenderer = Tessellator.getBuffer();
Vec3 vec3 = entityIn.getLook(partialTicks);
worldrenderer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR);
worldrenderer.pos(x, y + (double)entityIn.getEyeHeight(), z).color(0, 0, 255, 255).endVertex();
worldrenderer.pos(x + vec3.xCoord * 2.0D, y + (double)entityIn.getEyeHeight() + vec3.yCoord * 2.0D, z + vec3.zCoord * 2.0D).color(0, 0, 255, 255).endVertex();
Tessellator.draw();
GlState.enableTexture2D();
GlState.enableLighting();
GlState.enableCull();
GlState.disableBlend();
GlState.depthMask(true);
}
public boolean renderBox(Entity entity, float partialTicks) {
if(this.debugBoundingBox) { // && !entity.isInvisible()) {
if(entity.ticksExisted == 0) {
entity.lastTickPosX = entity.posX;
entity.lastTickPosY = entity.posY;
entity.lastTickPosZ = entity.posZ;
}
double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks;
double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks;
double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partialTicks;
this.renderDebugBoundingBox(entity, d0 - this.renderPosX, d1 - this.renderPosY, d2 - this.renderPosZ, partialTicks);
return true;
}
return false;
}
/**
* World sets this RenderManager's worldObj to the world provided
*/
public void set(World worldIn)
{
this.worldObj = worldIn;
}
// public double getDistanceToCamera(double x, double y, double z)
// {
// double d0 = x - this.viewerPosX;
// double d1 = y - this.viewerPosY;
// double d2 = z - this.viewerPosZ;
// return d0 * d0 + d1 * d1 + d2 * d2;
// }
// /**
// * Returns the font renderer
// */
// public FontRenderer getFontRenderer()
// {
// return this.textRenderer;
// }
public void setRenderOutlines(boolean renderOutlinesIn)
{
this.renderOutlines = renderOutlinesIn;
}
}

View file

@ -1,25 +0,0 @@
package client.renderer.entity;
import client.renderer.layers.LayerMooshroomMushroom;
import client.renderer.model.ModelBase;
import common.entity.animal.EntityMooshroom;
public class RenderMooshroom extends RenderLiving<EntityMooshroom>
{
private static final String mooshroomTextures = "textures/entity/mooshroom.png";
public RenderMooshroom(RenderManager renderManagerIn, ModelBase modelBaseIn)
{
super(renderManagerIn, modelBaseIn);
this.addLayer(new LayerMooshroomMushroom(this));
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected String getEntityTexture(EntityMooshroom entity)
{
return mooshroomTextures;
}
}

View file

@ -1,56 +0,0 @@
package client.renderer.entity;
import org.lwjgl.opengl.GL11;
import client.renderer.model.ModelBase;
import common.entity.animal.EntityOcelot;
public class RenderOcelot extends RenderLiving<EntityOcelot>
{
private static final String blackOcelotTextures = "textures/entity/cat_black.png";
private static final String ocelotTextures = "textures/entity/cat_ocelot.png";
private static final String redOcelotTextures = "textures/entity/cat_red.png";
private static final String siameseOcelotTextures = "textures/entity/cat_siamese.png";
public RenderOcelot(RenderManager renderManagerIn, ModelBase modelBaseIn)
{
super(renderManagerIn, modelBaseIn);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected String getEntityTexture(EntityOcelot entity)
{
switch (entity.getTameSkin())
{
case 0:
default:
return ocelotTextures;
case 1:
return blackOcelotTextures;
case 2:
return redOcelotTextures;
case 3:
return siameseOcelotTextures;
}
}
/**
* Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
* entityLiving, partialTickTime
*/
protected void preRenderCallback(EntityOcelot entitylivingbaseIn, float partialTickTime)
{
super.preRenderCallback(entitylivingbaseIn, partialTickTime);
if (entitylivingbaseIn.isTamed())
{
GL11.glScalef(0.8F, 0.8F, 0.8F);
}
}
}

View file

@ -1,18 +0,0 @@
package client.renderer.entity;
import common.entity.projectile.EntityPotion;
import common.init.Items;
import common.item.ItemStack;
public class RenderPotion extends RenderItemEntity<EntityPotion>
{
public RenderPotion(RenderManager renderManagerIn, RenderItem itemRendererIn)
{
super(renderManagerIn, Items.potion, itemRendererIn);
}
public ItemStack getStack(EntityPotion entityIn)
{
return new ItemStack(this.item, 1, entityIn.getPotionDamage());
}
}

View file

@ -1,37 +0,0 @@
package client.renderer.entity;
import client.renderer.model.ModelBase;
import common.color.TextColor;
import common.entity.animal.EntityRabbit;
public class RenderRabbit extends RenderLiving<EntityRabbit> {
private static final String[] TYPES = new String[] {
"textures/entity/rabbit_brown.png",
"textures/entity/rabbit_white.png",
"textures/entity/rabbit_black.png",
"textures/entity/rabbit_white_splotched.png",
"textures/entity/rabbit_gold.png",
"textures/entity/rabbit_salt.png",
"textures/entity/rabbit_gray.png",
"textures/entity/rabbit_dark_gray.png",
"textures/entity/rabbit_dark.png",
"textures/entity/rabbit_black_splotched.png"
};
private static final String TOAST = "textures/entity/rabbit_toast.png";
private static final String CAERBANNOG = "textures/entity/rabbit_caerbannog.png";
public RenderRabbit(RenderManager manager, ModelBase model) {
super(manager, model);
}
protected String getEntityTexture(EntityRabbit entity) {
String name = TextColor.stripCodes(entity.getCustomNameTag());
if(name != null && name.equals("Toast"))
return TOAST;
int type = entity.getRabbitType();
if(type == 99)
return CAERBANNOG;
return type >= 0 && type < TYPES.length ? TYPES[type] : TOAST;
}
}

View file

@ -1,44 +0,0 @@
package client.renderer.entity;
import org.lwjgl.opengl.GL11;
import client.renderer.model.ModelBase;
import common.entity.animal.EntitySquid;
public class RenderSquid extends RenderLiving<EntitySquid>
{
private static final String squidTextures = "textures/entity/squid.png";
public RenderSquid(RenderManager renderManagerIn, ModelBase modelBaseIn)
{
super(renderManagerIn, modelBaseIn);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected String getEntityTexture(EntitySquid entity)
{
return squidTextures;
}
protected void rotateCorpse(EntitySquid bat, float p_77043_2_, float p_77043_3_, float partialTicks)
{
float f = bat.prevSquidPitch + (bat.squidPitch - bat.prevSquidPitch) * partialTicks;
float f1 = bat.prevSquidYaw + (bat.squidYaw - bat.prevSquidYaw) * partialTicks;
GL11.glTranslatef(0.0F, 0.5F, 0.0F);
GL11.glRotatef(180.0F - p_77043_3_, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(f, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(f1, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(0.0F, -1.2F, 0.0F);
}
/**
* Defines what float the third param in setRotationAngles of ModelBase is
*/
protected float handleRotationFloat(EntitySquid livingBase, float partialTicks)
{
return livingBase.lastTentacleAngle + (livingBase.tentacleAngle - livingBase.lastTentacleAngle) * partialTicks;
}
}

View file

@ -1,77 +0,0 @@
package client.renderer.entity;
import org.lwjgl.opengl.GL11;
import client.Client;
import client.renderer.BlockRenderer;
import client.renderer.GlState;
import client.renderer.texture.TextureMap;
import common.block.BlockTNT;
import common.entity.item.EntityTnt;
import common.init.Blocks;
import common.util.ExtMath;
public class RenderTntPrimed extends Render<EntityTnt>
{
public RenderTntPrimed(RenderManager renderManagerIn)
{
super(renderManagerIn);
// this.shadowSize = 0.5F;
}
/**
* Renders the desired {@code T} type Entity.
*/
public void doRender(EntityTnt entity, double x, double y, double z, float partialTicks)
{
BlockRenderer blockrendererdispatcher = Client.CLIENT.getBlockRendererDispatcher();
GL11.glPushMatrix();
GL11.glTranslatef((float)x, (float)y + 0.5F, (float)z);
if ((float)entity.fuse - partialTicks + 1.0F < 10.0F)
{
float f = 1.0F - ((float)entity.fuse - partialTicks + 1.0F) / 10.0F;
f = ExtMath.clampf(f, 0.0F, 1.0F);
f = f * f;
f = f * f;
float f1 = 1.0F + f * 0.3F;
GL11.glScalef(f1, f1, f1);
}
float f2 = (1.0F - ((float)entity.fuse - partialTicks + 1.0F) / 100.0F) * 0.8F;
this.bindEntityTexture(entity);
GL11.glTranslatef(-0.5F, -0.5F, 0.5F);
blockrendererdispatcher.renderBlockBrightness(Blocks.tnt.getState().withProperty(BlockTNT.POWER, Integer.valueOf(entity.explosionSize)), entity.getBrightness(partialTicks));
GL11.glTranslatef(0.0F, 0.0F, 1.0F);
if (entity.fuse / 5 % 2 == 0)
{
GlState.disableTexture2D();
GlState.disableLighting();
GlState.enableBlend();
GlState.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_ALPHA);
GlState.color(1.0F, 1.0F, 1.0F, f2);
GlState.doPolygonOffset(-3.0F, -3.0F);
GlState.enablePolygonOffset();
blockrendererdispatcher.renderBlockBrightness(Blocks.tnt.getState().withProperty(BlockTNT.POWER, Integer.valueOf(entity.explosionSize)), 1.0F);
GlState.doPolygonOffset(0.0F, 0.0F);
GlState.disablePolygonOffset();
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
GlState.disableBlend();
GlState.enableLighting();
GlState.enableTexture2D();
}
GL11.glPopMatrix();
super.doRender(entity, x, y, z, partialTicks);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected String getEntityTexture(EntityTnt entity)
{
return TextureMap.locationBlocksTexture;
}
}

View file

@ -1,85 +0,0 @@
package client.renderer.entity;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL13;
import client.renderer.DefaultVertexFormats;
import client.renderer.GlState;
import client.renderer.RenderBuffer;
import client.renderer.Tessellator;
import common.entity.item.EntityXp;
import common.util.ExtMath;
public class RenderXpOrb extends Render<EntityXp>
{
private static final String experienceOrbTextures = "textures/entity/experience_orb.png";
public RenderXpOrb(RenderManager renderManagerIn)
{
super(renderManagerIn);
// this.shadowSize = 0.15F;
// this.shadowOpaque = 0.75F;
}
/**
* Renders the desired {@code T} type Entity.
*/
public void doRender(EntityXp entity, double x, double y, double z, float partialTicks)
{
GL11.glPushMatrix();
GL11.glTranslatef((float)x, (float)y, (float)z);
this.bindEntityTexture(entity);
int i = entity.getXpValue();
float f = (float)(i % 4 * 16 + 0) / 64.0F;
float f1 = (float)(i % 4 * 16 + 16) / 64.0F;
float f2 = (float)(i / 4 * 16 + 0) / 64.0F;
float f3 = (float)(i / 4 * 16 + 16) / 64.0F;
float f4 = 1.0F;
float f5 = 0.5F;
float f6 = 0.25F;
int j = entity.getBrightnessForRender(partialTicks);
int k = j % 65536;
int l = j / 65536;
GL13.glMultiTexCoord2f(GL13.GL_TEXTURE1, (float)k / 1.0F, (float)l / 1.0F);
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
float f8 = 255.0F;
float f9 = ((float)entity.xpColor + partialTicks) / 2.0F;
l = (int)((ExtMath.sin(f9 + 0.0F) + 1.0F) * 0.5F * 255.0F);
int i1 = 255;
int j1 = (int)((ExtMath.sin(f9 + 4.1887903F) + 1.0F) * 0.1F * 255.0F);
GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
float f7 = 0.3F;
GL11.glScalef(0.3F, 0.3F, 0.3F);
// Tessellator tessellator = Tessellator.getInstance();
RenderBuffer worldrenderer = Tessellator.getBuffer();
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL);
worldrenderer.pos((double)(0.0F - f5), (double)(0.0F - f6), 0.0D).tex((double)f, (double)f3).color(l, 255, j1, 128).normal(0.0F, 1.0F, 0.0F).endVertex();
worldrenderer.pos((double)(f4 - f5), (double)(0.0F - f6), 0.0D).tex((double)f1, (double)f3).color(l, 255, j1, 128).normal(0.0F, 1.0F, 0.0F).endVertex();
worldrenderer.pos((double)(f4 - f5), (double)(1.0F - f6), 0.0D).tex((double)f1, (double)f2).color(l, 255, j1, 128).normal(0.0F, 1.0F, 0.0F).endVertex();
worldrenderer.pos((double)(0.0F - f5), (double)(1.0F - f6), 0.0D).tex((double)f, (double)f2).color(l, 255, j1, 128).normal(0.0F, 1.0F, 0.0F).endVertex();
Tessellator.draw();
GlState.disableBlend();
GlState.disableRescaleNormal();
GL11.glPopMatrix();
super.doRender(entity, x, y, z, partialTicks);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected String getEntityTexture(EntityXp entity)
{
return experienceOrbTextures;
}
// protected boolean canRenderName(EntityXp entity)
// {
// return entity.hasCustomName() || super.canRenderName(entity);
// }
protected void renderLivingLabel(EntityXp entityIn, String str, double x, double y, double z, int maxDistance) {
super.renderLivingLabel(entityIn, str, x, y - 0.5, z, maxDistance);
}
}

View file

@ -1,28 +0,0 @@
package client.renderer.layers;
import client.renderer.entity.RendererLivingEntity;
import client.renderer.model.ModelBiped;
public class LayerArachnoidArmor extends LayerArmor
{
public LayerArachnoidArmor(RendererLivingEntity<?> rendererIn)
{
super(rendererIn, 12, 12);
}
protected void setModelPartVisible(ModelBiped model, int armorSlot)
{
switch (armorSlot)
{
case 1:
case 2:
model.setVisible(false);
break;
case 3:
case 4:
super.setModelPartVisible(model, armorSlot);
}
}
}

View file

@ -1,203 +0,0 @@
package client.renderer.layers;
import org.lwjgl.opengl.GL11;
import client.renderer.GlState;
import client.renderer.entity.RendererLivingEntity;
import client.renderer.model.ModelArmor;
import client.renderer.model.ModelBiped;
import common.entity.types.EntityLiving;
import common.item.ItemArmor;
import common.item.ItemStack;
public class LayerArmor implements LayerRenderer<EntityLiving>
{
protected static final String ENCHANTED_ITEM_GLINT_RES = "textures/glint.png";
protected ModelBiped modelLeggings;
protected ModelBiped modelArmor;
private final RendererLivingEntity<?> renderer;
private float alpha = 1.0F;
private float colorR = 1.0F;
private float colorG = 1.0F;
private float colorB = 1.0F;
private boolean skipRenderGlint;
// private static final Map<String, String> ARMOR_TEXTURE_RES_MAP = Maps.<String, String>newHashMap();
public LayerArmor(RendererLivingEntity<?> rendererIn, int arms, int legs)
{
this.renderer = rendererIn;
// this.initArmor();
this.modelLeggings = new ModelArmor(0.5F, arms, legs);
this.modelArmor = new ModelArmor(1.0F, arms, legs);
}
public void doRenderLayer(EntityLiving entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale)
{
this.renderLayer(entitylivingbaseIn, p_177141_2_, p_177141_3_, partialTicks, p_177141_5_, p_177141_6_, p_177141_7_, scale, 4);
this.renderLayer(entitylivingbaseIn, p_177141_2_, p_177141_3_, partialTicks, p_177141_5_, p_177141_6_, p_177141_7_, scale, 3);
this.renderLayer(entitylivingbaseIn, p_177141_2_, p_177141_3_, partialTicks, p_177141_5_, p_177141_6_, p_177141_7_, scale, 2);
this.renderLayer(entitylivingbaseIn, p_177141_2_, p_177141_3_, partialTicks, p_177141_5_, p_177141_6_, p_177141_7_, scale, 1);
}
public boolean shouldCombineTextures()
{
return false;
}
private void renderLayer(EntityLiving entitylivingbaseIn, float p_177182_2_, float p_177182_3_, float partialTicks, float p_177182_5_, float p_177182_6_, float p_177182_7_, float scale, int armorSlot)
{
ItemStack itemstack = this.getCurrentArmor(entitylivingbaseIn, armorSlot);
if (itemstack != null && itemstack.getItem() instanceof ItemArmor)
{
ItemArmor itemarmor = (ItemArmor)itemstack.getItem();
ModelBiped t = this.getArmorModel(armorSlot);
t.setModelAttributes(this.renderer.getMainModel());
t.setLivingAnimations(entitylivingbaseIn, p_177182_2_, p_177182_3_, partialTicks);
this.setModelPartVisible(t, armorSlot);
boolean flag = this.isSlotForLeggings(armorSlot);
this.renderer.bindTexture(this.getArmorResource(itemarmor, flag, null));
if (itemarmor.getArmorMaterial().canBeDyed())
{
int i = itemarmor.getArmorColor(itemstack);
float f = (float)(i >> 16 & 255) / 255.0F;
float f1 = (float)(i >> 8 & 255) / 255.0F;
float f2 = (float)(i & 255) / 255.0F;
GlState.color(this.colorR * f, this.colorG * f1, this.colorB * f2, this.alpha);
t.render(entitylivingbaseIn, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, scale);
this.renderer.bindTexture(this.getArmorResource(itemarmor, flag, "overlay"));
}
// case CHAIN:
// case IRON:
// case GOLD:
// case DIAMOND:
if(itemarmor.getArmorMaterial().hasArmor()) {
GlState.color(this.colorR, this.colorG, this.colorB, this.alpha);
t.render(entitylivingbaseIn, p_177182_2_, p_177182_3_, p_177182_5_, p_177182_6_, p_177182_7_, scale);
}
// default:
if (!this.skipRenderGlint && itemstack.isItemEnchanted())
{
this.renderGlint(entitylivingbaseIn, t, p_177182_2_, p_177182_3_, partialTicks, p_177182_5_, p_177182_6_, p_177182_7_, scale);
}
}
}
public ItemStack getCurrentArmor(EntityLiving entitylivingbaseIn, int armorSlot)
{
return entitylivingbaseIn.getArmor(armorSlot - 1);
}
public ModelBiped getArmorModel(int armorSlot)
{
return this.isSlotForLeggings(armorSlot) ? this.modelLeggings : this.modelArmor;
}
private boolean isSlotForLeggings(int armorSlot)
{
return armorSlot == 2;
}
private void renderGlint(EntityLiving entitylivingbaseIn, ModelBiped modelbaseIn, float p_177183_3_, float p_177183_4_, float partialTicks, float p_177183_6_, float p_177183_7_, float p_177183_8_, float scale)
{
float f = (float)entitylivingbaseIn.ticksExisted + partialTicks;
this.renderer.bindTexture(ENCHANTED_ITEM_GLINT_RES);
GlState.enableBlend();
GlState.depthFunc(GL11.GL_EQUAL);
GlState.depthMask(false);
float f1 = 0.5F;
GlState.color(f1, f1, f1, 1.0F);
for (int i = 0; i < 2; ++i)
{
GlState.disableLighting();
GlState.blendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
float f2 = 0.76F;
GlState.color(0.5F * f2, 0.25F * f2, 0.8F * f2, 1.0F);
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glLoadIdentity();
float f3 = 0.33333334F;
GL11.glScalef(f3, f3, f3);
GL11.glRotatef(30.0F - (float)i * 60.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(0.0F, f * (0.001F + (float)i * 0.003F) * 20.0F, 0.0F);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
modelbaseIn.render(entitylivingbaseIn, p_177183_3_, p_177183_4_, p_177183_6_, p_177183_7_, p_177183_8_, scale);
}
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glLoadIdentity();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GlState.enableLighting();
GlState.depthMask(true);
GlState.depthFunc(GL11.GL_LEQUAL);
GlState.disableBlend();
}
// private String getArmorResource(ItemArmor item, boolean legs)
// {
// return this.getArmorResource(item, legs, null);
// }
private String getArmorResource(ItemArmor item, boolean legs, String layer)
{
return String.format("textures/armor/%s_layer_%d%s.png", item.getArmorTexture(), legs ? 2 : 1,
layer == null ? "" : ("_" + layer));
// ResourceLocation resourcelocation = (ResourceLocation)ARMOR_TEXTURE_RES_MAP.get(s);
//
// if (resourcelocation == null)
// {
// resourcelocation = new ResourceLocation(s);
// ARMOR_TEXTURE_RES_MAP.put(s, resourcelocation);
// }
//
// return s;
}
// protected abstract void initArmor();
// protected abstract void setModelPartVisible(T model, int armorSlot);
// protected void initArmor()
// {
// this.modelLeggings = new ModelBiped(0.5F);
// this.modelArmor = new ModelBiped(1.0F);
// }
protected void setModelPartVisible(ModelBiped model, int armorSlot)
{
model.setVisible(false);
switch (armorSlot)
{
case 1:
model.bipedRightLeg.showModel = true;
model.bipedLeftLeg.showModel = true;
break;
case 2:
model.bipedBody.showModel = true;
model.bipedRightLeg.showModel = true;
model.bipedLeftLeg.showModel = true;
break;
case 3:
model.bipedBody.showModel = true;
model.bipedRightArm.showModel = true;
model.bipedLeftArm.showModel = true;
break;
case 4:
model.bipedHead.showModel = true;
model.bipedHeadwear.showModel = true;
}
}
// protected void setModelVisible(ModelBiped model)
// {
// model.setVisible(false);
// }
}

View file

@ -1,46 +0,0 @@
package client.renderer.layers;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL13;
import client.renderer.GlState;
import client.renderer.entity.RenderDragon;
import common.entity.animal.EntityDragon;
public class LayerEnderDragonEyes implements LayerRenderer<EntityDragon>
{
private static final String TEXTURE = "textures/entity/dragon_eyes.png";
private final RenderDragon dragonRenderer;
public LayerEnderDragonEyes(RenderDragon dragonRendererIn)
{
this.dragonRenderer = dragonRendererIn;
}
public void doRenderLayer(EntityDragon entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale)
{
this.dragonRenderer.bindTexture(TEXTURE);
GlState.enableBlend();
GlState.disableAlpha();
GlState.blendFunc(GL11.GL_ONE, GL11.GL_ONE);
GlState.disableLighting();
GlState.depthFunc(GL11.GL_EQUAL);
int i = 61680;
int j = i % 65536;
int k = i / 65536;
GL13.glMultiTexCoord2f(GL13.GL_TEXTURE1, (float)j / 1.0F, (float)k / 1.0F);
GlState.enableLighting();
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
this.dragonRenderer.getMainModel().render(entitylivingbaseIn, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_, scale);
this.dragonRenderer.setLightmap(entitylivingbaseIn, partialTicks);
GlState.disableBlend();
GlState.enableAlpha();
GlState.depthFunc(GL11.GL_LEQUAL);
}
public boolean shouldCombineTextures()
{
return false;
}
}

View file

@ -1,81 +0,0 @@
package client.renderer.layers;
import org.lwjgl.opengl.GL11;
import client.Client;
import client.renderer.entity.RendererLivingEntity;
import client.renderer.model.ModelBiped;
import common.entity.npc.EntityNPC;
import common.entity.types.EntityLiving;
import common.init.Items;
import common.item.Item;
import common.item.ItemBlock;
import common.item.ItemStack;
import common.model.Transforms;
public class LayerHeldItem implements LayerRenderer<EntityLiving>
{
private final RendererLivingEntity<?> livingEntityRenderer;
private final float xshift;
private final float yshift;
public LayerHeldItem(RendererLivingEntity<?> livingEntityRendererIn, float xshift, float yshift)
{
this.livingEntityRenderer = livingEntityRendererIn;
this.xshift = xshift * 0.0625F; // -0.0625F
this.yshift = yshift * 0.0625F; // 0.4375F
}
public void doRenderLayer(EntityLiving entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale)
{
ItemStack itemstack = entitylivingbaseIn.getHeldItem();
if (itemstack != null)
{
GL11.glPushMatrix();
// if (this.livingEntityRenderer.getMainModel().isChild)
// {
// float f = 0.5F;
// SKC.glTranslatef(0.0F, 0.625F, 0.0F);
// if(this.rotate) {
// SKC.glRotatef(-20.0F, -1.0F, 0.0F, 0.0F);
// }
// SKC.glScalef(f, f, f);
// }
((ModelBiped)this.livingEntityRenderer.getMainModel()).postRenderArm(0.0625F);
GL11.glTranslatef(this.xshift, this.yshift, 0.0625F);
if (entitylivingbaseIn.isPlayer() && ((EntityNPC)entitylivingbaseIn).fishEntity != null)
{
itemstack = new ItemStack(Items.fishing_rod, 0);
}
Item item = itemstack.getItem();
Client gm = Client.CLIENT;
if (item instanceof ItemBlock && item.getBlock().getRenderType() == 2)
{
GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
float f1 = 0.375F;
GL11.glScalef(-f1, -f1, f1);
}
if (entitylivingbaseIn.isSneakingVisually())
{
GL11.glTranslatef(0.0F, 0.203125F, 0.0F);
}
gm.getItemRenderer().renderItem(entitylivingbaseIn, itemstack, Transforms.Camera.THIRD_PERSON);
GL11.glPopMatrix();
}
}
public boolean shouldCombineTextures()
{
return false;
}
}

View file

@ -1,63 +0,0 @@
package client.renderer.layers;
import org.lwjgl.opengl.GL11;
import client.Client;
import client.renderer.BlockRenderer;
import client.renderer.GlState;
import client.renderer.entity.RenderMooshroom;
import client.renderer.model.ModelQuadruped;
import client.renderer.texture.TextureMap;
import common.entity.animal.EntityMooshroom;
import common.init.Blocks;
public class LayerMooshroomMushroom implements LayerRenderer<EntityMooshroom>
{
private final RenderMooshroom mooshroomRenderer;
public LayerMooshroomMushroom(RenderMooshroom mooshroomRendererIn)
{
this.mooshroomRenderer = mooshroomRendererIn;
}
public void doRenderLayer(EntityMooshroom entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale)
{
if (!entitylivingbaseIn.isChild()) // && !entitylivingbaseIn.isInvisible())
{
BlockRenderer blockrendererdispatcher = Client.CLIENT.getBlockRendererDispatcher();
this.mooshroomRenderer.bindTexture(TextureMap.locationBlocksTexture);
GlState.enableCull();
GlState.cullFace(GL11.GL_FRONT);
GL11.glPushMatrix();
GL11.glScalef(1.0F, -1.0F, 1.0F);
GL11.glTranslatef(0.2F, 0.35F, 0.5F);
GL11.glRotatef(42.0F, 0.0F, 1.0F, 0.0F);
GL11.glPushMatrix();
GL11.glTranslatef(-0.5F, -0.5F, 0.5F);
blockrendererdispatcher.renderBlockBrightness(Blocks.red_mushroom.getState(), 1.0F);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslatef(0.1F, 0.0F, -0.6F);
GL11.glRotatef(42.0F, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(-0.5F, -0.5F, 0.5F);
blockrendererdispatcher.renderBlockBrightness(Blocks.red_mushroom.getState(), 1.0F);
GL11.glPopMatrix();
GL11.glPopMatrix();
GL11.glPushMatrix();
((ModelQuadruped)this.mooshroomRenderer.getMainModel()).head.postRender(0.0625F);
GL11.glScalef(1.0F, -1.0F, 1.0F);
GL11.glTranslatef(0.0F, 0.7F, -0.2F);
GL11.glRotatef(12.0F, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(-0.5F, -0.5F, 0.5F);
blockrendererdispatcher.renderBlockBrightness(Blocks.red_mushroom.getState(), 1.0F);
GL11.glPopMatrix();
GlState.cullFace(GL11.GL_BACK);
GlState.disableCull();
}
}
public boolean shouldCombineTextures()
{
return true;
}
}

View file

@ -1,36 +0,0 @@
package client.renderer.layers;
import client.renderer.GlState;
import client.renderer.entity.RenderWolf;
import common.color.DyeColor;
import common.entity.animal.EntitySheep;
import common.entity.animal.EntityWolf;
public class LayerWolfCollar implements LayerRenderer<EntityWolf>
{
private static final String WOLF_COLLAR = "textures/entity/wolf_collar.png";
private final RenderWolf wolfRenderer;
public LayerWolfCollar(RenderWolf wolfRendererIn)
{
this.wolfRenderer = wolfRendererIn;
}
public void doRenderLayer(EntityWolf entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale)
{
if (entitylivingbaseIn.isTamed()) // && !entitylivingbaseIn.isInvisible())
{
this.wolfRenderer.bindTexture(WOLF_COLLAR);
DyeColor enumdyecolor = DyeColor.byMetadata(entitylivingbaseIn.getCollarColor().getMetadata());
float[] afloat = EntitySheep.getDyeRgb(enumdyecolor);
GlState.color(afloat[0], afloat[1], afloat[2], 1.0F);
this.wolfRenderer.getMainModel().render(entitylivingbaseIn, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_, scale);
}
}
public boolean shouldCombineTextures()
{
return true;
}
}

View file

@ -1,31 +0,0 @@
package client.renderer.model;
public class ModelBanner extends ModelBase
{
public ModelRenderer bannerSlate;
public ModelRenderer bannerStand;
public ModelRenderer bannerTop;
public ModelBanner()
{
this.textureWidth = 64;
this.textureHeight = 64;
this.bannerSlate = new ModelRenderer(this, 0, 0);
this.bannerSlate.addBox(-10.0F, 0.0F, -2.0F, 20, 40, 1, 0.0F);
this.bannerStand = new ModelRenderer(this, 44, 0);
this.bannerStand.addBox(-1.0F, -30.0F, -1.0F, 2, 42, 2, 0.0F);
this.bannerTop = new ModelRenderer(this, 0, 42);
this.bannerTop.addBox(-10.0F, -32.0F, -1.0F, 20, 2, 2, 0.0F);
}
/**
* Renders the banner model in.
*/
public void renderBanner()
{
this.bannerSlate.rotationPointY = -32.0F;
this.bannerSlate.render(0.0625F);
this.bannerStand.render(0.0625F);
this.bannerTop.render(0.0625F);
}
}

View file

@ -1,42 +0,0 @@
package client.renderer.model;
public class ModelChest extends ModelBase
{
/** The chest lid in the chest's model. */
public ModelRenderer chestLid = (new ModelRenderer(this, 0, 0)).setTextureSize(64, 64);
/** The model of the bottom of the chest. */
public ModelRenderer chestBelow;
/** The chest's knob in the chest model. */
public ModelRenderer chestKnob;
public ModelChest()
{
this.chestLid.addBox(0.0F, -5.0F, -14.0F, 14, 5, 14, 0.0F);
this.chestLid.rotationPointX = 1.0F;
this.chestLid.rotationPointY = 7.0F;
this.chestLid.rotationPointZ = 15.0F;
this.chestKnob = (new ModelRenderer(this, 0, 0)).setTextureSize(64, 64);
this.chestKnob.addBox(-1.0F, -2.0F, -15.0F, 2, 4, 1, 0.0F);
this.chestKnob.rotationPointX = 8.0F;
this.chestKnob.rotationPointY = 7.0F;
this.chestKnob.rotationPointZ = 15.0F;
this.chestBelow = (new ModelRenderer(this, 0, 19)).setTextureSize(64, 64);
this.chestBelow.addBox(0.0F, 0.0F, 0.0F, 14, 10, 14, 0.0F);
this.chestBelow.rotationPointX = 1.0F;
this.chestBelow.rotationPointY = 6.0F;
this.chestBelow.rotationPointZ = 1.0F;
}
/**
* This method renders out all parts of the chest model.
*/
public void renderAll()
{
this.chestKnob.rotateAngleX = this.chestLid.rotateAngleX;
this.chestLid.render(0.0625F);
this.chestKnob.render(0.0625F);
this.chestBelow.render(0.0625F);
}
}

View file

@ -1,27 +0,0 @@
package client.renderer.model;
import org.lwjgl.opengl.GL11;
import common.entity.Entity;
public class ModelDie extends ModelBase
{
ModelRenderer cube;
public ModelDie()
{
this.cube = new ModelRenderer(this, 0, 0);
this.cube.addBox(-8.0F, -8.0F, -8.0F, 16, 16, 16);
// this.cube.rotationPointY += (float)(24 - 16);
}
public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale)
{
GL11.glPushMatrix();
GL11.glTranslatef(0.0F, 0.6F, 0.0F);
if(Math.abs(entityIn.motionX) > 0.05 || Math.abs(entityIn.motionY) > 0.05 || Math.abs(entityIn.motionZ) > 0.05)
GL11.glRotatef((float)((entityIn.ticksExisted % 20) * (360 / 20)), 0.3f, 0.4f, 0.1f);
this.cube.render(scale);
GL11.glPopMatrix();
}
}

View file

@ -1,36 +0,0 @@
package client.renderer.model;
import common.entity.Entity;
public class ModelHumanoidHead extends ModelHead
{
private final ModelRenderer head = new ModelRenderer(this, 32, 0);
public ModelHumanoidHead()
{
super(0, 0, 64, 64);
this.head.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, 0.25F);
this.head.setRotationPoint(0.0F, 0.0F, 0.0F);
}
/**
* Sets the models various rotation angles then renders the model.
*/
public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale)
{
super.render(entityIn, p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale);
this.head.render(scale);
}
/**
* Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
* and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
* "far" arms and legs can swing at most.
*/
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)
{
super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
this.head.rotateAngleY = this.mainHead.rotateAngleY;
this.head.rotateAngleX = this.mainHead.rotateAngleX;
}
}

View file

@ -1,23 +0,0 @@
package client.renderer.model;
public class ModelLargeChest extends ModelChest
{
public ModelLargeChest()
{
this.chestLid = (new ModelRenderer(this, 0, 0)).setTextureSize(128, 64);
this.chestLid.addBox(0.0F, -5.0F, -14.0F, 30, 5, 14, 0.0F);
this.chestLid.rotationPointX = 1.0F;
this.chestLid.rotationPointY = 7.0F;
this.chestLid.rotationPointZ = 15.0F;
this.chestKnob = (new ModelRenderer(this, 0, 0)).setTextureSize(128, 64);
this.chestKnob.addBox(-1.0F, -2.0F, -15.0F, 2, 4, 1, 0.0F);
this.chestKnob.rotationPointX = 16.0F;
this.chestKnob.rotationPointY = 7.0F;
this.chestKnob.rotationPointZ = 15.0F;
this.chestBelow = (new ModelRenderer(this, 0, 19)).setTextureSize(128, 64);
this.chestBelow.addBox(0.0F, 0.0F, 0.0F, 30, 10, 14, 0.0F);
this.chestBelow.rotationPointX = 1.0F;
this.chestBelow.rotationPointY = 6.0F;
this.chestBelow.rotationPointZ = 1.0F;
}
}

View file

@ -1,220 +0,0 @@
package client.renderer.model;
import org.lwjgl.opengl.GL11;
import common.entity.Entity;
import common.entity.animal.EntityOcelot;
import common.entity.types.EntityLiving;
import common.util.ExtMath;
public class ModelOcelot extends ModelBase
{
/** The back left leg model for the Ocelot. */
ModelRenderer ocelotBackLeftLeg;
/** The back right leg model for the Ocelot. */
ModelRenderer ocelotBackRightLeg;
/** The front left leg model for the Ocelot. */
ModelRenderer ocelotFrontLeftLeg;
/** The front right leg model for the Ocelot. */
ModelRenderer ocelotFrontRightLeg;
/** The tail model for the Ocelot. */
ModelRenderer ocelotTail;
/** The second part of tail model for the Ocelot. */
ModelRenderer ocelotTail2;
/** The head model for the Ocelot. */
ModelRenderer ocelotHead;
/** The body model for the Ocelot. */
ModelRenderer ocelotBody;
int field_78163_i = 1;
public ModelOcelot()
{
this.setTextureOffset("head.main", 0, 0);
this.setTextureOffset("head.nose", 0, 24);
this.setTextureOffset("head.ear1", 0, 10);
this.setTextureOffset("head.ear2", 6, 10);
this.ocelotHead = new ModelRenderer(this, "head");
this.ocelotHead.addBox("main", -2.5F, -2.0F, -3.0F, 5, 4, 5);
this.ocelotHead.addBox("nose", -1.5F, 0.0F, -4.0F, 3, 2, 2);
this.ocelotHead.addBox("ear1", -2.0F, -3.0F, 0.0F, 1, 1, 2);
this.ocelotHead.addBox("ear2", 1.0F, -3.0F, 0.0F, 1, 1, 2);
this.ocelotHead.setRotationPoint(0.0F, 15.0F, -9.0F);
this.ocelotBody = new ModelRenderer(this, 20, 0);
this.ocelotBody.addBox(-2.0F, 3.0F, -8.0F, 4, 16, 6, 0.0F);
this.ocelotBody.setRotationPoint(0.0F, 12.0F, -10.0F);
this.ocelotTail = new ModelRenderer(this, 0, 15);
this.ocelotTail.addBox(-0.5F, 0.0F, 0.0F, 1, 8, 1);
this.ocelotTail.rotateAngleX = 0.9F;
this.ocelotTail.setRotationPoint(0.0F, 15.0F, 8.0F);
this.ocelotTail2 = new ModelRenderer(this, 4, 15);
this.ocelotTail2.addBox(-0.5F, 0.0F, 0.0F, 1, 8, 1);
this.ocelotTail2.setRotationPoint(0.0F, 20.0F, 14.0F);
this.ocelotBackLeftLeg = new ModelRenderer(this, 8, 13);
this.ocelotBackLeftLeg.addBox(-1.0F, 0.0F, 1.0F, 2, 6, 2);
this.ocelotBackLeftLeg.setRotationPoint(1.1F, 18.0F, 5.0F);
this.ocelotBackRightLeg = new ModelRenderer(this, 8, 13);
this.ocelotBackRightLeg.addBox(-1.0F, 0.0F, 1.0F, 2, 6, 2);
this.ocelotBackRightLeg.setRotationPoint(-1.1F, 18.0F, 5.0F);
this.ocelotFrontLeftLeg = new ModelRenderer(this, 40, 0);
this.ocelotFrontLeftLeg.addBox(-1.0F, 0.0F, 0.0F, 2, 10, 2);
this.ocelotFrontLeftLeg.setRotationPoint(1.2F, 13.8F, -5.0F);
this.ocelotFrontRightLeg = new ModelRenderer(this, 40, 0);
this.ocelotFrontRightLeg.addBox(-1.0F, 0.0F, 0.0F, 2, 10, 2);
this.ocelotFrontRightLeg.setRotationPoint(-1.2F, 13.8F, -5.0F);
}
/**
* Sets the models various rotation angles then renders the model.
*/
public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale)
{
this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn);
if (this.isChild)
{
float f = 2.0F;
GL11.glPushMatrix();
GL11.glScalef(1.5F / f, 1.5F / f, 1.5F / f);
GL11.glTranslatef(0.0F, 10.0F * scale, 4.0F * scale);
this.ocelotHead.render(scale);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glScalef(1.0F / f, 1.0F / f, 1.0F / f);
GL11.glTranslatef(0.0F, 24.0F * scale, 0.0F);
this.ocelotBody.render(scale);
this.ocelotBackLeftLeg.render(scale);
this.ocelotBackRightLeg.render(scale);
this.ocelotFrontLeftLeg.render(scale);
this.ocelotFrontRightLeg.render(scale);
this.ocelotTail.render(scale);
this.ocelotTail2.render(scale);
GL11.glPopMatrix();
}
else
{
this.ocelotHead.render(scale);
this.ocelotBody.render(scale);
this.ocelotTail.render(scale);
this.ocelotTail2.render(scale);
this.ocelotBackLeftLeg.render(scale);
this.ocelotBackRightLeg.render(scale);
this.ocelotFrontLeftLeg.render(scale);
this.ocelotFrontRightLeg.render(scale);
}
}
/**
* Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
* and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
* "far" arms and legs can swing at most.
*/
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)
{
this.ocelotHead.rotateAngleX = headPitch / (180F / (float)Math.PI);
this.ocelotHead.rotateAngleY = netHeadYaw / (180F / (float)Math.PI);
if (this.field_78163_i != 3)
{
this.ocelotBody.rotateAngleX = ((float)Math.PI / 2F);
if (this.field_78163_i == 2)
{
this.ocelotBackLeftLeg.rotateAngleX = ExtMath.cos(limbSwing * 0.6662F) * 1.0F * limbSwingAmount;
this.ocelotBackRightLeg.rotateAngleX = ExtMath.cos(limbSwing * 0.6662F + 0.3F) * 1.0F * limbSwingAmount;
this.ocelotFrontLeftLeg.rotateAngleX = ExtMath.cos(limbSwing * 0.6662F + (float)Math.PI + 0.3F) * 1.0F * limbSwingAmount;
this.ocelotFrontRightLeg.rotateAngleX = ExtMath.cos(limbSwing * 0.6662F + (float)Math.PI) * 1.0F * limbSwingAmount;
this.ocelotTail2.rotateAngleX = 1.7278761F + ((float)Math.PI / 10F) * ExtMath.cos(limbSwing) * limbSwingAmount;
}
else
{
this.ocelotBackLeftLeg.rotateAngleX = ExtMath.cos(limbSwing * 0.6662F) * 1.0F * limbSwingAmount;
this.ocelotBackRightLeg.rotateAngleX = ExtMath.cos(limbSwing * 0.6662F + (float)Math.PI) * 1.0F * limbSwingAmount;
this.ocelotFrontLeftLeg.rotateAngleX = ExtMath.cos(limbSwing * 0.6662F + (float)Math.PI) * 1.0F * limbSwingAmount;
this.ocelotFrontRightLeg.rotateAngleX = ExtMath.cos(limbSwing * 0.6662F) * 1.0F * limbSwingAmount;
if (this.field_78163_i == 1)
{
this.ocelotTail2.rotateAngleX = 1.7278761F + ((float)Math.PI / 4F) * ExtMath.cos(limbSwing) * limbSwingAmount;
}
else
{
this.ocelotTail2.rotateAngleX = 1.7278761F + 0.47123894F * ExtMath.cos(limbSwing) * limbSwingAmount;
}
}
}
}
/**
* Used for easily adding entity-dependent animations. The second and third float params here are the same second
* and third as in the setRotationAngles method.
*/
public void setLivingAnimations(EntityLiving entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime)
{
EntityOcelot entityocelot = (EntityOcelot)entitylivingbaseIn;
this.ocelotBody.rotationPointY = 12.0F;
this.ocelotBody.rotationPointZ = -10.0F;
this.ocelotHead.rotationPointY = 15.0F;
this.ocelotHead.rotationPointZ = -9.0F;
this.ocelotTail.rotationPointY = 15.0F;
this.ocelotTail.rotationPointZ = 8.0F;
this.ocelotTail2.rotationPointY = 20.0F;
this.ocelotTail2.rotationPointZ = 14.0F;
this.ocelotFrontLeftLeg.rotationPointY = this.ocelotFrontRightLeg.rotationPointY = 13.8F;
this.ocelotFrontLeftLeg.rotationPointZ = this.ocelotFrontRightLeg.rotationPointZ = -5.0F;
this.ocelotBackLeftLeg.rotationPointY = this.ocelotBackRightLeg.rotationPointY = 18.0F;
this.ocelotBackLeftLeg.rotationPointZ = this.ocelotBackRightLeg.rotationPointZ = 5.0F;
this.ocelotTail.rotateAngleX = 0.9F;
if (entityocelot.isSneakingVisually())
{
++this.ocelotBody.rotationPointY;
this.ocelotHead.rotationPointY += 2.0F;
++this.ocelotTail.rotationPointY;
this.ocelotTail2.rotationPointY += -4.0F;
this.ocelotTail2.rotationPointZ += 2.0F;
this.ocelotTail.rotateAngleX = ((float)Math.PI / 2F);
this.ocelotTail2.rotateAngleX = ((float)Math.PI / 2F);
this.field_78163_i = 0;
}
else if (entityocelot.isSprinting())
{
this.ocelotTail2.rotationPointY = this.ocelotTail.rotationPointY;
this.ocelotTail2.rotationPointZ += 2.0F;
this.ocelotTail.rotateAngleX = ((float)Math.PI / 2F);
this.ocelotTail2.rotateAngleX = ((float)Math.PI / 2F);
this.field_78163_i = 2;
}
else if (entityocelot.isSitting())
{
this.ocelotBody.rotateAngleX = ((float)Math.PI / 4F);
this.ocelotBody.rotationPointY += -4.0F;
this.ocelotBody.rotationPointZ += 5.0F;
this.ocelotHead.rotationPointY += -3.3F;
++this.ocelotHead.rotationPointZ;
this.ocelotTail.rotationPointY += 8.0F;
this.ocelotTail.rotationPointZ += -2.0F;
this.ocelotTail2.rotationPointY += 2.0F;
this.ocelotTail2.rotationPointZ += -0.8F;
this.ocelotTail.rotateAngleX = 1.7278761F;
this.ocelotTail2.rotateAngleX = 2.670354F;
this.ocelotFrontLeftLeg.rotateAngleX = this.ocelotFrontRightLeg.rotateAngleX = -0.15707964F;
this.ocelotFrontLeftLeg.rotationPointY = this.ocelotFrontRightLeg.rotationPointY = 15.8F;
this.ocelotFrontLeftLeg.rotationPointZ = this.ocelotFrontRightLeg.rotationPointZ = -7.0F;
this.ocelotBackLeftLeg.rotateAngleX = this.ocelotBackRightLeg.rotateAngleX = -((float)Math.PI / 2F);
this.ocelotBackLeftLeg.rotationPointY = this.ocelotBackRightLeg.rotationPointY = 21.0F;
this.ocelotBackLeftLeg.rotationPointZ = this.ocelotBackRightLeg.rotationPointZ = 1.0F;
this.field_78163_i = 3;
}
else
{
this.field_78163_i = 1;
}
}
}

View file

@ -1,26 +0,0 @@
package client.renderer.model;
public class ModelSign extends ModelBase
{
/** The board on a sign that has the writing on it. */
public ModelRenderer signBoard = new ModelRenderer(this, 0, 0);
/** The stick a sign stands on. */
public ModelRenderer signStick;
public ModelSign()
{
this.signBoard.addBox(-12.0F, -14.0F, -1.0F, 24, 12, 2, 0.0F);
this.signStick = new ModelRenderer(this, 0, 14);
this.signStick.addBox(-1.0F, -2.0F, -1.0F, 2, 14, 2, 0.0F);
}
/**
* Renders the sign model through TileEntitySignRenderer
*/
public void renderSign()
{
this.signBoard.render(0.0625F);
this.signStick.render(0.0625F);
}
}

View file

@ -1,61 +0,0 @@
package client.renderer.model;
import common.entity.Entity;
public class ModelSquid extends ModelBase
{
/** The squid's body */
ModelRenderer squidBody;
/** The squid's tentacles */
ModelRenderer[] squidTentacles = new ModelRenderer[8];
public ModelSquid()
{
int i = -16;
this.squidBody = new ModelRenderer(this, 0, 0);
this.squidBody.addBox(-6.0F, -8.0F, -6.0F, 12, 16, 12);
this.squidBody.rotationPointY += (float)(24 + i);
for (int j = 0; j < this.squidTentacles.length; ++j)
{
this.squidTentacles[j] = new ModelRenderer(this, 48, 0);
double d0 = (double)j * Math.PI * 2.0D / (double)this.squidTentacles.length;
float f = (float)Math.cos(d0) * 5.0F;
float f1 = (float)Math.sin(d0) * 5.0F;
this.squidTentacles[j].addBox(-1.0F, 0.0F, -1.0F, 2, 18, 2);
this.squidTentacles[j].rotationPointX = f;
this.squidTentacles[j].rotationPointZ = f1;
this.squidTentacles[j].rotationPointY = (float)(31 + i);
d0 = (double)j * Math.PI * -2.0D / (double)this.squidTentacles.length + (Math.PI / 2D);
this.squidTentacles[j].rotateAngleY = (float)d0;
}
}
/**
* Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
* and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
* "far" arms and legs can swing at most.
*/
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)
{
for (ModelRenderer modelrenderer : this.squidTentacles)
{
modelrenderer.rotateAngleX = ageInTicks;
}
}
/**
* Sets the models various rotation angles then renders the model.
*/
public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale)
{
this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn);
this.squidBody.render(scale);
for (int i = 0; i < this.squidTentacles.length; ++i)
{
this.squidTentacles[i].render(scale);
}
}
}

View file

@ -1,431 +0,0 @@
package client.renderer.particle;
import java.util.List;
import java.util.Map;
import org.lwjgl.opengl.GL11;
import client.renderer.ActiveRenderInfo;
import client.renderer.DefaultVertexFormats;
import client.renderer.GlState;
import client.renderer.RenderBuffer;
import client.renderer.Tessellator;
import client.renderer.texture.TextureManager;
import client.renderer.texture.TextureMap;
import common.block.Block;
import common.collect.Lists;
import common.collect.Maps;
import common.entity.Entity;
import common.material.Material;
import common.model.ParticleType;
import common.rng.Random;
import common.util.BlockPos;
import common.util.ExtMath;
import common.util.Facing;
import common.world.State;
import common.world.World;
public class EffectRenderer
{
public static final String particleTextures = "textures/world/particles.png";
/** Reference to the World object. */
protected World worldObj;
private List<EntityFX>[][] fxLayers = new List[4][];
private List<EntityParticleEmitter> particleEmitters = Lists.<EntityParticleEmitter>newArrayList();
private TextureManager renderer;
/** RNG. */
private Random rand = new Random();
private Map<Integer, IParticleFactory> particleTypes = Maps.<Integer, IParticleFactory>newHashMap();
public EffectRenderer(World worldIn, TextureManager rendererIn)
{
this.worldObj = worldIn;
this.renderer = rendererIn;
for (int i = 0; i < 4; ++i)
{
this.fxLayers[i] = new List[2];
for (int j = 0; j < 2; ++j)
{
this.fxLayers[i][j] = Lists.newArrayList();
}
}
this.registerVanillaParticles();
}
private void registerVanillaParticles()
{
this.registerParticle(ParticleType.EXPLOSION_NORMAL.getParticleID(), new EntityExplodeFX.Factory());
this.registerParticle(ParticleType.WATER_BUBBLE.getParticleID(), new EntityBubbleFX.Factory());
this.registerParticle(ParticleType.WATER_SPLASH.getParticleID(), new EntitySplashFX.Factory());
this.registerParticle(ParticleType.WATER_WAKE.getParticleID(), new EntityFishWakeFX.Factory());
this.registerParticle(ParticleType.WATER_DROP.getParticleID(), new EntityDownfallFX.RainFactory());
this.registerParticle(ParticleType.SUSPENDED.getParticleID(), new EntitySuspendFX.Factory());
this.registerParticle(ParticleType.SUSPENDED_DEPTH.getParticleID(), new EntityAuraFX.SuspendFactory());
this.registerParticle(ParticleType.CRIT.getParticleID(), new EntityCrit2FX.Factory());
this.registerParticle(ParticleType.CRIT_MAGIC.getParticleID(), new EntityCrit2FX.MagicFactory());
this.registerParticle(ParticleType.SMOKE_NORMAL.getParticleID(), new EntitySmokeFX.Factory());
this.registerParticle(ParticleType.SMOKE_LARGE.getParticleID(), new EntityCritFX.Factory());
this.registerParticle(ParticleType.SPELL.getParticleID(), new EntitySpellParticleFX.Factory());
this.registerParticle(ParticleType.SPELL_INSTANT.getParticleID(), new EntitySpellParticleFX.InstantFactory());
this.registerParticle(ParticleType.SPELL_MOB.getParticleID(), new EntitySpellParticleFX.MobFactory());
this.registerParticle(ParticleType.SPELL_MOB_AMBIENT.getParticleID(), new EntitySpellParticleFX.AmbientMobFactory());
this.registerParticle(ParticleType.SPELL_WITCH.getParticleID(), new EntitySpellParticleFX.WitchFactory());
this.registerParticle(ParticleType.DRIP_WATER.getParticleID(), new EntityDropParticleFX.WaterFactory());
this.registerParticle(ParticleType.DRIP_LAVA.getParticleID(), new EntityDropParticleFX.LavaFactory());
// this.registerParticle(EnumParticleTypes.VILLAGER_ANGRY.getParticleID(), new EntityHeartFX.AngryVillagerFactory());
this.registerParticle(ParticleType.GROW.getParticleID(), new EntityAuraFX.GrowFactory());
this.registerParticle(ParticleType.TOWN_AURA.getParticleID(), new EntityAuraFX.Factory());
this.registerParticle(ParticleType.NOTE.getParticleID(), new EntityNoteFX.Factory());
this.registerParticle(ParticleType.PORTAL.getParticleID(), new EntityPortalFX.Factory());
this.registerParticle(ParticleType.ENCHANTMENT_TABLE.getParticleID(), new EntityEnchantmentTableParticleFX.EnchantmentTable());
this.registerParticle(ParticleType.FLAME.getParticleID(), new EntityFlameFX.Factory());
this.registerParticle(ParticleType.LAVA.getParticleID(), new EntityLavaFX.Factory());
this.registerParticle(ParticleType.FOOTSTEP.getParticleID(), new EntityFootStepFX.Factory());
this.registerParticle(ParticleType.CLOUD.getParticleID(), new EntityCloudFX.Factory());
this.registerParticle(ParticleType.REDSTONE.getParticleID(), new EntityReddustFX.Factory());
this.registerParticle(ParticleType.SNOWBALL.getParticleID(), new EntityBreakingFX.SnowballFactory());
this.registerParticle(ParticleType.SNOW_SHOVEL.getParticleID(), new EntitySnowShovelFX.Factory());
this.registerParticle(ParticleType.SLIME.getParticleID(), new EntityBreakingFX.SlimeFactory());
this.registerParticle(ParticleType.HEART.getParticleID(), new EntityHeartFX.Factory());
// this.registerParticle(EnumParticleTypes.BARRIER.getParticleID(), new Barrier.Factory());
this.registerParticle(ParticleType.ITEM_CRACK.getParticleID(), new EntityBreakingFX.Factory());
this.registerParticle(ParticleType.BLOCK_CRACK.getParticleID(), new EntityDiggingFX.Factory());
this.registerParticle(ParticleType.BLOCK_DUST.getParticleID(), new EntityBlockDustFX.Factory());
this.registerParticle(ParticleType.EXPLOSION_HUGE.getParticleID(), new EntityHugeExplodeFX.Factory());
this.registerParticle(ParticleType.EXPLOSION_LARGE.getParticleID(), new EntityLargeExplodeFX.Factory());
this.registerParticle(ParticleType.FIREWORKS_SPARK.getParticleID(), new EntityFirework.Factory());
this.registerParticle(ParticleType.HAIL_CORN.getParticleID(), new EntityDownfallFX.HailFactory());
}
public void registerParticle(int id, IParticleFactory particleFactory)
{
this.particleTypes.put(Integer.valueOf(id), particleFactory);
}
public void emitParticleAtEntity(Entity entityIn, ParticleType particleTypes)
{
this.particleEmitters.add(new EntityParticleEmitter(this.worldObj, entityIn, particleTypes));
}
/**
* Spawns the relevant particle according to the particle id.
*
* @param xCoord X position of the particle
* @param yCoord Y position of the particle
* @param zCoord Z position of the particle
* @param xSpeed X speed of the particle
* @param ySpeed Y speed of the particle
* @param zSpeed Z speed of the particle
* @param parameters Parameters for the particle (color for redstone, ...)
*/
public EntityFX spawnEffectParticle(int particleId, double xCoord, double yCoord, double zCoord, double xSpeed, double ySpeed, double zSpeed, int[] parameters)
{
IParticleFactory iparticlefactory = (IParticleFactory)this.particleTypes.get(Integer.valueOf(particleId));
if (iparticlefactory != null)
{
EntityFX entityfx = iparticlefactory.getEntityFX(particleId, this.worldObj, xCoord, yCoord, zCoord, xSpeed, ySpeed, zSpeed, parameters);
if (entityfx != null)
{
this.addEffect(entityfx);
return entityfx;
}
}
return null;
}
public void addEffect(EntityFX effect)
{
int i = effect.getFXLayer();
int j = effect.getAlpha() != 1.0F ? 0 : 1;
if (this.fxLayers[i][j].size() >= 4000)
{
this.fxLayers[i][j].remove(0);
}
this.fxLayers[i][j].add(effect);
}
public void updateEffects()
{
for (int i = 0; i < 4; ++i)
{
this.updateEffectLayer(i);
}
List<EntityParticleEmitter> list = Lists.<EntityParticleEmitter>newArrayList();
for (EntityParticleEmitter entityparticleemitter : this.particleEmitters)
{
entityparticleemitter.onUpdate();
if (entityparticleemitter.dead)
{
list.add(entityparticleemitter);
}
}
this.particleEmitters.removeAll(list);
}
private void updateEffectLayer(int layer)
{
for (int i = 0; i < 2; ++i)
{
this.updateEffectAlphaLayer(this.fxLayers[layer][i]);
}
}
private void updateEffectAlphaLayer(List<EntityFX> entitiesFX)
{
List<EntityFX> list = Lists.<EntityFX>newArrayList();
for (int i = 0; i < entitiesFX.size(); ++i)
{
EntityFX entityfx = (EntityFX)entitiesFX.get(i);
this.tickParticle(entityfx);
if (entityfx.dead)
{
list.add(entityfx);
}
}
entitiesFX.removeAll(list);
}
private void tickParticle(final EntityFX particle)
{
particle.onUpdate();
}
/**
* Renders all current particles. Args player, partialTickTime
*/
public void renderParticles(Entity entityIn, float partialTicks)
{
float f = ActiveRenderInfo.getRotationX();
float f1 = ActiveRenderInfo.getRotationZ();
float f2 = ActiveRenderInfo.getRotationYZ();
float f3 = ActiveRenderInfo.getRotationXY();
float f4 = ActiveRenderInfo.getRotationXZ();
EntityFX.interpPosX = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double)partialTicks;
EntityFX.interpPosY = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double)partialTicks;
EntityFX.interpPosZ = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double)partialTicks;
GlState.enableBlend();
GlState.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlState.alphaFunc(GL11.GL_GREATER, 0.003921569F);
for (int i = 0; i < 3; ++i)
{
for (int j = 0; j < 2; ++j)
{
final int i_f = i;
if (!this.fxLayers[i][j].isEmpty())
{
switch (j)
{
case 0:
GlState.depthMask(false);
break;
case 1:
GlState.depthMask(true);
}
switch (i)
{
case 0:
default:
this.renderer.bindTexture(particleTextures);
break;
case 1:
this.renderer.bindTexture(TextureMap.locationBlocksTexture);
}
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
// Tessellator tessellator = Tessellator.getInstance();
RenderBuffer worldrenderer = Tessellator.getBuffer();
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
for (int k = 0; k < this.fxLayers[i][j].size(); ++k)
{
final EntityFX entityfx = (EntityFX)this.fxLayers[i][j].get(k);
entityfx.renderParticle(worldrenderer, entityIn, partialTicks, f, f4, f1, f2, f3);
}
Tessellator.draw();
}
}
}
GlState.depthMask(true);
GlState.disableBlend();
GlState.alphaFunc(GL11.GL_GREATER, 0.1F);
}
public void renderLitParticles(Entity entityIn, float partialTick)
{
float f = 0.017453292F;
float f1 = ExtMath.cos(entityIn.rotYaw * 0.017453292F);
float f2 = ExtMath.sin(entityIn.rotYaw * 0.017453292F);
float f3 = -f2 * ExtMath.sin(entityIn.rotPitch * 0.017453292F);
float f4 = f1 * ExtMath.sin(entityIn.rotPitch * 0.017453292F);
float f5 = ExtMath.cos(entityIn.rotPitch * 0.017453292F);
for (int i = 0; i < 2; ++i)
{
List<EntityFX> list = this.fxLayers[3][i];
if (!list.isEmpty())
{
// Tessellator tessellator = Tessellator.getInstance();
RenderBuffer worldrenderer = Tessellator.getBuffer();
for (int j = 0; j < list.size(); ++j)
{
EntityFX entityfx = (EntityFX)list.get(j);
entityfx.renderParticle(worldrenderer, entityIn, partialTick, f1, f5, f2, f3, f4);
}
}
}
}
public void clearEffects(World worldIn)
{
this.worldObj = worldIn;
for (int i = 0; i < 4; ++i)
{
for (int j = 0; j < 2; ++j)
{
this.fxLayers[i][j].clear();
}
}
this.particleEmitters.clear();
}
public void addBlockDestroyEffects(BlockPos pos, State state)
{
if (state.getBlock().getMaterial() != Material.air)
{
state = state.getBlock().getActualState(state, this.worldObj, pos);
int i = 4;
for (int j = 0; j < i; ++j)
{
for (int k = 0; k < i; ++k)
{
for (int l = 0; l < i; ++l)
{
double d0 = (double)pos.getX() + ((double)j + 0.5D) / (double)i;
double d1 = (double)pos.getY() + ((double)k + 0.5D) / (double)i;
double d2 = (double)pos.getZ() + ((double)l + 0.5D) / (double)i;
this.addEffect((new EntityDiggingFX(this.worldObj, d0, d1, d2, d0 - (double)pos.getX() - 0.5D, d1 - (double)pos.getY() - 0.5D, d2 - (double)pos.getZ() - 0.5D, state)).setBlockPos(pos));
}
}
}
}
}
/**
* Adds block hit particles for the specified block
*/
public void addBlockHitEffects(BlockPos pos, Facing side)
{
State iblockstate = this.worldObj.getState(pos);
Block block = iblockstate.getBlock();
if (block.getRenderType() != -1)
{
int i = pos.getX();
int j = pos.getY();
int k = pos.getZ();
float f = 0.1F;
double d0 = (double)i + this.rand.doublev() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - (double)(f * 2.0F)) + (double)f + block.getBlockBoundsMinX();
double d1 = (double)j + this.rand.doublev() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - (double)(f * 2.0F)) + (double)f + block.getBlockBoundsMinY();
double d2 = (double)k + this.rand.doublev() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - (double)(f * 2.0F)) + (double)f + block.getBlockBoundsMinZ();
if (side == Facing.DOWN)
{
d1 = (double)j + block.getBlockBoundsMinY() - (double)f;
}
if (side == Facing.UP)
{
d1 = (double)j + block.getBlockBoundsMaxY() + (double)f;
}
if (side == Facing.NORTH)
{
d2 = (double)k + block.getBlockBoundsMinZ() - (double)f;
}
if (side == Facing.SOUTH)
{
d2 = (double)k + block.getBlockBoundsMaxZ() + (double)f;
}
if (side == Facing.WEST)
{
d0 = (double)i + block.getBlockBoundsMinX() - (double)f;
}
if (side == Facing.EAST)
{
d0 = (double)i + block.getBlockBoundsMaxX() + (double)f;
}
this.addEffect((new EntityDiggingFX(this.worldObj, d0, d1, d2, 0.0D, 0.0D, 0.0D, iblockstate)).setBlockPos(pos).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F));
}
}
public void moveToAlphaLayer(EntityFX effect)
{
this.moveToLayer(effect, 1, 0);
}
public void moveToNoAlphaLayer(EntityFX effect)
{
this.moveToLayer(effect, 0, 1);
}
private void moveToLayer(EntityFX effect, int layerFrom, int layerTo)
{
for (int i = 0; i < 4; ++i)
{
if (this.fxLayers[i][layerFrom].contains(effect))
{
this.fxLayers[i][layerFrom].remove(effect);
this.fxLayers[i][layerTo].add(effect);
}
}
}
public String getStatistics()
{
int i = 0;
for (int j = 0; j < 4; ++j)
{
for (int k = 0; k < 2; ++k)
{
i += this.fxLayers[j][k].size();
}
}
return "" + i;
}
}

View file

@ -1,82 +0,0 @@
package client.renderer.particle;
import common.world.World;
public class EntityAuraFX extends EntityFX
{
private final boolean fullBright;
protected EntityAuraFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double speedIn, boolean fullBright)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, speedIn);
float f = this.rand.floatv() * 0.1F + 0.2F;
this.particleRed = f;
this.particleGreen = f;
this.particleBlue = f;
this.setParticleTextureIndex(0);
this.setSize(0.02F, 0.02F);
this.particleScale *= this.rand.floatv() * 0.6F + 0.5F;
this.motionX *= 0.019999999552965164D;
this.motionY *= 0.019999999552965164D;
this.motionZ *= 0.019999999552965164D;
this.particleMaxAge = (int)(20.0D / (Math.random() * 0.8D + 0.2D));
this.noClip = true;
this.fullBright = fullBright;
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
this.prevX = this.posX;
this.prevY = this.posY;
this.prevZ = this.posZ;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.99D;
this.motionY *= 0.99D;
this.motionZ *= 0.99D;
if (this.particleMaxAge-- <= 0)
{
this.setDead();
}
}
public int getBrightnessForRender(float partialTicks)
{
return this.fullBright ? 15728880 : super.getBrightnessForRender(partialTicks);
}
public float getBrightness(float partialTicks)
{
return this.fullBright ? 1.0F : super.getBrightness(partialTicks);
}
public static class SuspendFactory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntityAuraFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, true);
}
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntityAuraFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, false);
}
}
public static class GrowFactory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
EntityFX entityfx = new EntityAuraFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, false);
entityfx.setParticleTextureIndex(82);
entityfx.setRBGColorF(1.0F, 1.0F, 1.0F);
return entityfx;
}
}
}

View file

@ -1,25 +0,0 @@
package client.renderer.particle;
import common.init.BlockRegistry;
import common.world.State;
import common.world.World;
public class EntityBlockDustFX extends EntityDiggingFX
{
protected EntityBlockDustFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, State state)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, state);
this.motionX = xSpeedIn;
this.motionY = ySpeedIn;
this.motionZ = zSpeedIn;
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
State iblockstate = BlockRegistry.getStateById(p_178902_15_[0]);
return iblockstate.getBlock().getRenderType() == -1 ? null : (new EntityBlockDustFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, iblockstate)).calculateColor();
}
}
}

View file

@ -1,98 +0,0 @@
package client.renderer.particle;
import client.Client;
import client.renderer.RenderBuffer;
import common.entity.Entity;
import common.init.ItemRegistry;
import common.init.Items;
import common.item.Item;
import common.world.World;
public class EntityBreakingFX extends EntityFX
{
protected EntityBreakingFX(World worldIn, double posXIn, double posYIn, double posZIn, Item p_i1195_8_)
{
this(worldIn, posXIn, posYIn, posZIn, p_i1195_8_, 0);
}
protected EntityBreakingFX(World worldIn, double posXIn, double posYIn, double posZIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, Item p_i1197_14_, int p_i1197_15_)
{
this(worldIn, posXIn, posYIn, posZIn, p_i1197_14_, p_i1197_15_);
this.motionX *= 0.10000000149011612D;
this.motionY *= 0.10000000149011612D;
this.motionZ *= 0.10000000149011612D;
this.motionX += xSpeedIn;
this.motionY += ySpeedIn;
this.motionZ += zSpeedIn;
}
protected EntityBreakingFX(World worldIn, double posXIn, double posYIn, double posZIn, Item p_i1196_8_, int p_i1196_9_)
{
super(worldIn, posXIn, posYIn, posZIn, 0.0D, 0.0D, 0.0D);
this.setParticleIcon(Client.CLIENT.getRenderItem().getItemModelMesher().getParticleIcon(p_i1196_8_, p_i1196_9_));
this.particleRed = this.particleGreen = this.particleBlue = 1.0F;
this.particleGravity = 1.0F; // Blocks.snow.particleGravity;
this.particleScale /= 2.0F;
}
public int getFXLayer()
{
return 1;
}
/**
* Renders the particle
*/
public void renderParticle(RenderBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
float f = ((float)this.particleTextureIndexX + this.particleTextureJitterX / 4.0F) / 16.0F;
float f1 = f + 0.015609375F;
float f2 = ((float)this.particleTextureIndexY + this.particleTextureJitterY / 4.0F) / 16.0F;
float f3 = f2 + 0.015609375F;
float f4 = 0.1F * this.particleScale;
if (this.particleIcon != null)
{
f = this.particleIcon.getInterpolatedU((double)(this.particleTextureJitterX / 4.0F * 16.0F));
f1 = this.particleIcon.getInterpolatedU((double)((this.particleTextureJitterX + 1.0F) / 4.0F * 16.0F));
f2 = this.particleIcon.getInterpolatedV((double)(this.particleTextureJitterY / 4.0F * 16.0F));
f3 = this.particleIcon.getInterpolatedV((double)((this.particleTextureJitterY + 1.0F) / 4.0F * 16.0F));
}
float f5 = (float)(this.prevX + (this.posX - this.prevX) * (double)partialTicks - interpPosX);
float f6 = (float)(this.prevY + (this.posY - this.prevY) * (double)partialTicks - interpPosY);
float f7 = (float)(this.prevZ + (this.posZ - this.prevZ) * (double)partialTicks - interpPosZ);
int i = this.getBrightnessForRender(partialTicks);
int j = i >> 16 & 65535;
int k = i & 65535;
worldRendererIn.pos((double)(f5 - rotationX * f4 - rotationXY * f4), (double)(f6 - rotationZ * f4), (double)(f7 - rotationYZ * f4 - rotationXZ * f4)).tex((double)f, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
worldRendererIn.pos((double)(f5 - rotationX * f4 + rotationXY * f4), (double)(f6 + rotationZ * f4), (double)(f7 - rotationYZ * f4 + rotationXZ * f4)).tex((double)f, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
worldRendererIn.pos((double)(f5 + rotationX * f4 + rotationXY * f4), (double)(f6 + rotationZ * f4), (double)(f7 + rotationYZ * f4 + rotationXZ * f4)).tex((double)f1, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
worldRendererIn.pos((double)(f5 + rotationX * f4 - rotationXY * f4), (double)(f6 - rotationZ * f4), (double)(f7 + rotationYZ * f4 - rotationXZ * f4)).tex((double)f1, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(j, k).endVertex();
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
int i = p_178902_15_.length > 1 ? p_178902_15_[1] : 0;
return new EntityBreakingFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, ItemRegistry.getItemById(p_178902_15_[0]), i);
}
}
public static class SlimeFactory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntityBreakingFX(worldIn, xCoordIn, yCoordIn, zCoordIn, Items.slime_ball);
}
}
public static class SnowballFactory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntityBreakingFX(worldIn, xCoordIn, yCoordIn, zCoordIn, Items.snowball);
}
}
}

View file

@ -1,56 +0,0 @@
package client.renderer.particle;
import common.material.Material;
import common.util.BlockPos;
import common.world.World;
public class EntityBubbleFX extends EntityFX
{
protected EntityBubbleFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn)
{
super(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
this.particleRed = 1.0F;
this.particleGreen = 1.0F;
this.particleBlue = 1.0F;
this.setParticleTextureIndex(32);
this.setSize(0.02F, 0.02F);
this.particleScale *= this.rand.floatv() * 0.6F + 0.2F;
this.motionX = xSpeedIn * 0.20000000298023224D + (Math.random() * 2.0D - 1.0D) * 0.019999999552965164D;
this.motionY = ySpeedIn * 0.20000000298023224D + (Math.random() * 2.0D - 1.0D) * 0.019999999552965164D;
this.motionZ = zSpeedIn * 0.20000000298023224D + (Math.random() * 2.0D - 1.0D) * 0.019999999552965164D;
this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
this.prevX = this.posX;
this.prevY = this.posY;
this.prevZ = this.posZ;
this.motionY += 0.002D;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.8500000238418579D;
this.motionY *= 0.8500000238418579D;
this.motionZ *= 0.8500000238418579D;
if (this.worldObj.getState(new BlockPos(this)).getBlock().getMaterial() != Material.water)
{
this.setDead();
}
if (this.particleMaxAge-- <= 0)
{
this.setDead();
}
}
public static class Factory implements IParticleFactory
{
public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_)
{
return new EntityBubbleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn);
}
}
}

Some files were not shown because too many files have changed in this diff Show more