Compare commits

...
413 Commits
Author SHA1 Message Date
Vincent Lee 37d2f8190e Update README.md 2016-09-05 17:19:59 -05:00
Vincent Lee 7eb9a89ef4 Disable bergamute on custom sound classes. Closes #458 2016-09-03 17:00:02 -05:00
Vincent Lee adf0d08cde Fix avatar icon and cocoon hitbox 2016-09-02 12:36:33 -05:00
Vincent Lee ec4fe8bdb9 Bump pack_format to 2 (1.9) even though it doesn't really matter 2016-08-28 12:43:07 -05:00
Vincent Lee 7837381123 Split floating island jsons 2016-08-28 12:32:32 -05:00
Vincent Lee f0d863d30f Move colorhandlers and get rid of icolorable 2016-08-28 11:50:06 -05:00
Vincent Lee f6a68a0d83 Eliminate the IRegisterCallback shim 2016-08-28 10:33:29 -05:00
Vincent Lee e5ec84e040 Build 320 2016-08-28 09:03:21 -05:00
Vincent Lee 8ac2d2fb19 Missing sideonly 2016-08-28 08:39:17 -05:00
Vincent Lee ae84d99013 Delete mana petal class 2016-08-28 08:39:05 -05:00
Vincent Lee 659ab9cf5c Fix item sideonly derps 2016-08-28 08:34:33 -05:00
Vincent Lee c077d4d464 Remove category from sounds.json as it is no longer used by vanilla 2016-08-27 19:46:50 -05:00
Vincent Lee 2aa05a4b07 Clean up libobf more 2016-08-27 19:34:08 -05:00
Vincent Lee d57354de2f Remove unnecessary new String[] libobfuscation 2016-08-27 19:12:04 -05:00
Vincent Lee 392a02e945 Modernize GoG skybox code. Fixes #460 2016-08-27 19:08:43 -05:00
Vincent Lee 0642754886 Build 319 2016-08-27 12:57:21 -05:00
Vincent Lee 2d225337af Stop spawning particles serverside 2016-08-27 12:53:33 -05:00
Vincent Lee 9f66216832 Item sideonly checks 2016-08-26 20:14:42 -05:00
Vincent Lee ed1cbbe9dd Merge pull request #455 from LGcommisar/master
Added textures for shields, see Issue #453.
2016-08-24 21:28:21 -05:00
Vincent Lee 6db2aa7dee Merge branch 'master' of github.com:williewillus/Botania 2016-08-24 21:27:50 -05:00
Vincent Lee 4ce5b40ebb Build 318 metadata 2016-08-24 21:27:44 -05:00
Vincent Lee c969ea3f72 Merge pull request #456 from pau101/master
Add floral powder to ore dictionary for wildcard dye
2016-08-24 21:27:06 -05:00
Vincent Lee 90085c4379 Fix comodification derpage 2016-08-24 21:22:25 -05:00
Vincent Lee 14851e751d Build 317 2016-08-24 21:19:24 -05:00
pau101 c3da70b52e Add floral powder to ore dictionary for wildcard dye 2016-08-23 21:02:25 -07:00
LGcommisar 29868d7d8e Delete keep 2016-08-23 23:42:59 -04:00
LGcommisar 656c0de2a3 Shield textures 2016-08-23 23:42:09 -04:00
LGcommisar b777e5856e Create keep 2016-08-23 23:41:42 -04:00
Vincent Lee f3dea919a6 Fix banner textures not being reversed properly 2016-08-23 17:02:29 -05:00
Vincent Lee af9588ff11 Pylons use new hidden model system instead of OBJState 2016-08-23 12:11:09 -05:00
Vincent Lee 8d52bb686f Merge branch 'master' of github.com:williewillus/Botania 2016-08-23 11:21:48 -05:00
Vincent Lee d4d42208a2 Merge pull request #454 from Luxor5393/master
Update crafty crate entry picture.
2016-08-23 11:12:59 -05:00
Vincent Lee fb34e7e848 Shorten config name 2016-08-23 11:09:54 -05:00
Luxor5393 53a582e188 Update crafty crate picture 2016-08-23 15:53:16 +02:00
Vincent Lee bffa5a1171 Remove redundant code and fix pixies being slow 2016-08-22 15:10:41 -05:00
Vincent Lee a47619879a Fix pixies instantly despawning clientside 2016-08-22 14:42:26 -05:00
Vincent Lee 6545845850 Reduce watch task range 2016-08-22 14:13:38 -05:00
Vincent Lee 8809524d6d Imports 2016-08-22 13:13:14 -05:00
Vincent Lee a9062856d1 Extend entityliving instead of entitycreature 2016-08-22 13:12:40 -05:00
Vincent Lee ddcff076a7 Cleanup and pull unneeded stuff out of datawatcher 2016-08-20 16:44:27 -05:00
Vincent Lee 9e56e04e6c Remove potions more cleanly 2016-08-20 16:32:37 -05:00
Vincent Lee b91ab69cea Remove unneeded world arg from particle methods 2016-08-20 14:38:24 -05:00
Vincent Lee d12717c29f Get rid of silly common proxy pattern 2016-08-20 14:31:25 -05:00
Vincent Lee 808d80affa Add note to refresh rendering after toggling config option 2016-08-19 20:33:32 -05:00
Vincent Lee 6478eb907e Localize config option 2016-08-19 20:21:14 -05:00
Vincent Lee 334d910086 Merge branch 'master' of github.com:williewillus/Botania 2016-08-19 20:19:11 -05:00
Vincent Lee 1b97974d0e Add config to render floating flowers in static renderer 2016-08-19 20:19:00 -05:00
Vincent Lee 2fe7d5e025 Slightly more efficient quad gathering 2016-08-19 19:57:51 -05:00
Vincent Lee 360a398fca Delete old model 2016-08-19 19:54:41 -05:00
Vincent Lee a9171cd215 Merge branch 'improvedfloaters' 2016-08-19 19:53:47 -05:00
Vincent Lee 815cdc9f52 Fix all textures 2016-08-19 16:09:18 -05:00
Vincent Lee 0a235cf5e8 Finish UV remapping 2016-08-19 15:12:52 -05:00
Vincent Lee 25a4877e1a Halved the texture size 2016-08-19 12:52:22 -05:00
Vincent Lee 28febcac08 UV map the bottom of the model. Add placeholders for sides 2016-08-19 12:42:30 -05:00
Vincent Lee 757abbe6d7 Merge pull request #448 from 3TUSK/zhCN
Update zh_CN.lang
2016-08-16 20:57:36 -05:00
3TUSK 28aa8bc0d5 Update zh_CN.lang
Signed-off-by: 3TUSK <urey.s.knowledge@gmail.com>
2016-08-16 21:20:42 -04:00
Vincent Lee 5392f00ff9 Fix orechid running clientside, closes #447 2016-08-16 18:09:06 -05:00
Vincent Lee 64712d315f WIP 2016-08-15 17:14:40 -05:00
Vincent Lee 789832bdc1 Merge branch 'master' into improvedfloaters 2016-08-15 15:55:50 -05:00
Vincent Lee a0a7428116 Bergamute now blocks moving/ticking sounds. Closes #407 2016-08-15 15:52:51 -05:00
Vincent Lee 37eb1a781c Fix bergamute having a nonmatching color 2016-08-15 15:34:06 -05:00
Vincent Lee a0a78ea203 Build 316 2016-08-15 13:43:18 -05:00
Vincent Lee ba3f337520 Remove moss stone botaina recipe, remove old tooltips 2016-08-15 12:11:51 -05:00
Vincent Lee 9e13eda148 Add missing sideonly to blocks 2016-08-15 12:00:51 -05:00
Vincent Lee 4f26ea9893 Use vanilla mechanisms to sync TE's instead of rolling own 2016-08-14 11:46:45 -05:00
Vincent Lee 878c0dbeba Make ender hand less desyncy and clean some old filesy 2016-08-14 10:46:10 -05:00
Vincent Lee 687d475aeb Corporea no longer runs clientside 2016-08-13 15:21:32 -05:00
Vincent Lee 1eafb2e85e Update forge, fix tooltips additions not matching item tooltip. Closes #219 2016-08-13 14:26:10 -05:00
Vincent Lee 2877d304ce Mana blaster now shows active lens on model 2016-08-13 12:50:17 -05:00
Vincent Lee dc1eab4dd8 Fix weird model name clash. Closes #436 2016-08-12 22:17:12 -05:00
Vincent Lee f71b4b6cf2 Fix all other potatoes. Closes #409 2016-08-12 21:41:27 -05:00
Vincent Lee 2b3cfd985c Don't spam quite so many stacks 2016-08-11 21:00:04 -05:00
Vincent Lee 2a4b489eca Bunch more potato fixes, and one for me! 2016-08-11 20:38:54 -05:00
Vincent Lee 348b52eb9f Fix some of the easier potatoes 2016-08-11 19:50:01 -05:00
Vincent Lee 12be321b73 Merge pull request #433 from yrsegal/potatoes
Do initial work on potatoes
2016-08-11 18:27:12 -05:00
Vincent Lee 07f68b37da Fix missing sideonly 2016-08-09 21:04:09 -05:00
Vincent Lee 8d9996cb6b Fix corporea retainer comparator output not working. Closes #430 2016-08-09 19:57:41 -05:00
Vincent Lee 32a28e83a5 Magic flowers now show properly in JEI. Closes #431 2016-08-09 19:48:54 -05:00
Vincent Lee 0b34fe7193 Fix porting derp in flare lens. Closes #429 2016-08-08 20:17:22 -05:00
Vincent Lee a3e8d88f1c Fix a corproea animation being absent 2016-08-07 20:10:44 -05:00
Vincent Lee 8423607b29 Reinstate null subtile check. Closes #428 2016-08-07 18:30:31 -05:00
Vincent Lee 90c42b25c7 Get rid of some triple nested for loops 2016-08-07 12:27:01 -05:00
Vincent Lee ddda9db4ac Make bubbell less laggy 2016-08-07 12:00:52 -05:00
Vincent Lee 16615ce429 Tweak cacophonium interactions 2016-08-06 12:04:18 -05:00
Vincent Lee aeaa2a76c4 Tweak black hole talisman interactions, fix a crash 2016-08-06 11:48:01 -05:00
Vincent Lee 921825aca3 Fix pickup delay not getting set properly in thrown items 2016-08-05 20:59:05 -05:00
Vincent Lee c3e4a02825 A few inconsequential cleanups 2016-08-05 20:51:21 -05:00
Vincent Lee 3d7c9e8b94 Update forge, remove some unneeded particle methods 2016-08-05 20:21:50 -05:00
Vincent Lee a0aac5a9bf Stupid compile derp 2016-08-05 18:36:04 -05:00
Vincent Lee acd5cce7ce Fix a bunch of things assuming the player only has main hand. Closes #424 2016-08-05 18:31:44 -05:00
Vincent Lee 8eccfad65e If we can't see the extended state bail. This is not a big deal. CLose #423 2016-08-04 19:54:16 -05:00
Vincent Lee 59771083d2 Merge branch 'master' of github.com:williewillus/Botania 2016-08-03 20:31:05 -05:00
Vincent Lee 3a5e78a4c6 Build 315 2016-08-03 20:30:33 -05:00
Vincent Lee b648c36111 Merge pull request #420 from shadowfacts/master
Allow Elven Trade recipes to have multiple outputs
2016-08-02 18:49:16 -05:00
Shadowfacts 5e8eaf8c77 Fix Elven Trade JEI handling for trades with multiple outputs 2016-08-02 16:34:59 -04:00
Shadowfacts 6cde8299c4 Modify Elven Trade recipes to allow for recipes with multiple outputs 2016-08-02 16:23:40 -04:00
Vincent Lee 947a225d23 TIL you don't set default values for unlisted properties 2016-07-31 20:55:04 -05:00
Vincent Lee 67ef25de09 Prep for debug helper build 2016-07-31 20:07:49 -05:00
Vincent Lee 4656680250 New optimized floating island model 2016-07-31 17:05:51 -05:00
Vincent Lee 072e3a693b Fix extended state blocks shitting themselves 2016-07-31 15:05:27 -05:00
Vincent Lee b29c810a80 Use face quads in floating models. Partially alleviates #414 2016-07-31 12:55:53 -05:00
Vincent Lee 3f8e3f72d9 Version checker just piggybacks off forge one now 2016-07-30 16:37:50 -05:00
Vincent Lee 5041e23ede Cleanup, black hole talisman uses caps, debug handler shows extended state 2016-07-30 16:24:42 -05:00
Vincent Lee 21a35c9c92 1.8 recipes now permanently on, fix initial loop recipe being oredicted. Closes #413 2016-07-30 14:38:46 -05:00
Vincent Lee 6d542dec5a Clean up methodhandles 2016-07-30 14:06:07 -05:00
Vincent Lee 4552a451ae Fix lexicon 3d model 2016-07-30 14:02:25 -05:00
Vincent Lee 5c33e95a54 Remove unused overload 2016-07-30 12:12:33 -05:00
Vincent Lee 1e2bd1d4cd Blocks now own their itemblock model registration 2016-07-30 12:11:28 -05:00
Vincent Lee 1cc995c986 Split black lotus metas 2016-07-30 10:56:14 -05:00
Vincent Lee 1799380064 Blocks own their statemappers 2016-07-30 10:52:48 -05:00
Vincent Lee 0d3ffa2598 Final model splitting, on to code cleanup 2016-07-30 10:38:57 -05:00
yrsegal f8abe9d7b1 initial work on potatoes 2016-07-30 00:07:20 -04:00
Vincent Lee 3dc65c80d8 More model cleanup, and add a readme for artists 2016-07-29 20:55:59 -05:00
Vincent Lee bc0da61058 Build 314 2016-07-29 18:41:07 -05:00
Vincent Lee c9e1647070 Fix crash 2016-07-29 18:24:16 -05:00
Vincent Lee d622f0cd58 Move block registration out of constructors 2016-07-29 18:04:17 -05:00
Vincent Lee 32a505a575 More model reorganization 2016-07-27 22:04:23 -05:00
Vincent Lee 7ce589c6db Made treasure enchants more expensive to apply, remove some log spam 2016-07-27 19:02:31 -05:00
Vincent Lee f0aa44999f Some biomestone jsons 2016-07-27 18:59:27 -05:00
Vincent Lee 88f99a636c Merge branch 'master' of github.com:williewillus/Botania 2016-07-26 20:31:08 -05:00
Vincent Lee 568139fd17 Merge pull request #406 from Flaxbeard/master
Added ManaDiscountEvent
2016-07-26 20:30:49 -05:00
Flaxbeard cf0189c3ee Added ManaDiscountEvent 2016-07-25 16:07:35 -05:00
Vincent Lee 2ee0d7f0ed More borign model cleaning 2016-07-24 21:36:49 -05:00
Vincent Lee 6997a96460 Slabs/walls/stairs own their own model registration 2016-07-24 15:45:43 -05:00
Vincent Lee 179ca23f6c Items now 'own' their own model registration! 2016-07-24 15:09:05 -05:00
Vincent Lee e7e5b1b484 Migrate other meshers 2016-07-24 14:01:14 -05:00
Vincent Lee fbd9917fd4 FOld more methods in 2016-07-24 13:18:46 -05:00
Vincent Lee 881e271a0b Lambdafy everything as they now work 2016-07-24 10:36:58 -05:00
Vincent Lee 3b5c500bc9 Clean up meshers 2016-07-24 10:12:12 -05:00
Vincent Lee 4751da9e7b Panes 2016-07-23 21:18:48 -05:00
Vincent Lee 1c4ae58377 Clean up the pools 2016-07-23 21:08:01 -05:00
Vincent Lee 9f0c710479 More 2016-07-23 20:51:45 -05:00
Vincent Lee 8a13a03016 Optimize number of slab models 2016-07-23 19:41:19 -05:00
Vincent Lee 7ef27df0bc Cleanup the cleanup 2016-07-23 19:29:36 -05:00
Vincent Lee 01a913c96c More model cleanup 2016-07-23 17:49:00 -05:00
Vincent Lee 110396f39e More model cleanup 2016-07-23 17:29:22 -05:00
Vincent Lee 233bc705b0 More model cleanup 2016-07-23 16:39:05 -05:00
Vincent Lee 6264ebddbc Move itemblock jsons to their own subfolder 2016-07-23 16:04:03 -05:00
Vincent Lee bedbf55b33 Separate out biome wall models. Don't worry it'll get organized. Closes #401 2016-07-23 15:58:03 -05:00
Vincent Lee a5d688883e Fix some walls being flipped, separate the models out 2016-07-23 15:31:18 -05:00
Vincent Lee 83d0b8dc12 Remvoe the nag (you're welcome) 2016-07-23 15:09:20 -05:00
Vincent Lee c05c1ef8bf Clean out lang files 2016-07-23 15:08:26 -05:00
Vincent Lee c5d5e59b96 Byebye Future (hah) stones! 2016-07-23 14:50:03 -05:00
Vincent Lee 1fd48994d7 Byebye ender stuff! 2016-07-23 14:17:27 -05:00
Vincent Lee cf56634a91 Byebye thatch and reeds! 2016-07-23 14:04:49 -05:00
Vincent Lee 1344bb8c08 Exorcism begins: remove (almost) all prismarine 2016-07-23 13:51:19 -05:00
Vincent Lee 2bf69eaa56 Useless constant change 2016-07-23 13:32:31 -05:00
Vincent Lee b242d43861 Update forge 2016-07-23 10:48:57 -05:00
Vincent Lee 404c39c8f8 Fix slingshot not firing properly, fixes #402 2016-07-22 18:33:36 -05:00
Vincent Lee d8bdb6a31d Fix cacophonium. Closes #400 2016-07-21 19:02:23 -05:00
Vincent Lee c5208175d7 Made a bunch of evthandlers static 2016-07-20 21:22:33 -05:00
Vincent Lee a0d0fefe8d Move to 1.10 2016-07-20 20:55:20 -05:00
Vincent Lee 87172ea3f2 Build 314 2016-07-20 20:29:16 -05:00
Vincent Lee 16381383cb Fix wills not applying. Closes #372 2016-07-20 20:18:16 -05:00
Vincent Lee 252e3191dc Fix some particles being missing 2016-07-17 21:16:50 -05:00
Vincent Lee ce0ba85397 Made it more reliable 2016-07-17 20:58:30 -05:00
Vincent Lee aa8dc5d16c Fix something in bows not being cross proxied. Closes #398 2016-07-17 20:33:56 -05:00
Vincent Lee dff2cf2bf1 Change flavour text 2016-07-16 17:40:10 -05:00
Vincent Lee 347c100e93 Add the version txt for 1.10.2 that never got added .-. 2016-07-16 17:35:56 -05:00
Vincent Lee 003fb22733 Tidy up, add texture 2016-07-16 17:34:57 -05:00
Vincent Lee 7f5d3859e4 Added the Bergamute 2016-07-16 16:52:59 -05:00
Vincent Lee 124fdeeee3 Possible fix for #343 2016-07-13 21:44:10 -05:00
Vincent Lee 611f33a133 Fix #395 2016-07-13 21:13:36 -05:00
Vincent Lee a76efcc6fc Actually fix #386 2016-07-06 21:46:39 -05:00
Vincent Lee cd3daf2b47 Fix rod of bifrost going batshit. Closes #386 2016-07-04 13:17:57 -05:00
Vincent Lee dc05115497 Merge pull request #370 from howtonotwin/chordata
Rewrite some of the Ring of Chordata
2016-07-04 12:55:41 -05:00
Vincent Lee 44a4657cd8 Fix crafting halo crash and cleanup inventory utils, closes #385 2016-07-04 12:09:52 -05:00
Vincent Lee 8e70e9fa68 FIx starcaller not working, blacklist aura nodes from rod of shaded mesa. Closes #387: 2016-06-30 21:24:40 -05:00
Vincent Lee 0b635c5bc7 Fix missed change in gradle 2016-06-29 20:28:36 -05:00
Vincent Lee 6f69d5d154 Build 312 2016-06-29 20:28:09 -05:00
Vincent Lee 589b4e49b6 Prep buildscripts for 1.10.2 2016-06-29 20:24:25 -05:00
Vincent Lee b30ad911fa Reflect since trying to get around inlining isn't working 2016-06-29 20:22:14 -05:00
Vincent Lee be667b2ee3 Fix some items not being held right 2016-06-29 19:30:06 -05:00
Vincent Lee bea1c6ecdc Fix cross proxy detection to support 1.10.2 2016-06-29 19:29:54 -05:00
Vincent Lee 971b1ee3e2 Fix typo in king key, closes #381 2016-06-28 21:19:18 -05:00
Vincent Lee 4172637bcc Fix drum sound 2016-06-26 17:18:10 -05:00
Vincent Lee 2650813f95 Fix burst range being much smaller than it should be. Closes #376 2016-06-26 16:19:40 -05:00
Vincent Lee 1fbcb0b39b Fix desyncing in runic altar, closes #374 2016-06-26 11:29:47 -05:00
Vincent Lee e28f82dc7d Apothecary right click uses caps 2016-06-26 11:07:46 -05:00
Vincent Lee d3d94e46d7 Special flower item models fall back to poppy. Close #375 2016-06-26 09:05:35 -05:00
Vincent Lee b2d7bc2794 Pick block for entities 2016-06-25 16:09:46 -05:00
Vincent Lee 2afaac9f20 Fix flowers emitting light. Closes #369 2016-06-25 15:27:34 -05:00
Vincent Lee 28b3e5d22b Build 311 2016-06-25 15:10:02 -05:00
Vincent Lee da3958a414 Fix more build stuff 2016-06-25 14:59:39 -05:00
Vincent Lee 4ddf3767c5 Update buildscript for 1.10 2016-06-25 14:50:07 -05:00
Vincent Lee 81c45fb079 Fix ring of far reach and fix proxy selection 2016-06-25 14:43:24 -05:00
Vincent Lee 49d79abb83 Include 1.10 in accepted mc versions 2016-06-24 19:59:24 -05:00
Vincent Lee 1a3b6833b5 Update JEI 2016-06-24 19:58:57 -05:00
Vincent Lee 38cd0fbf55 Switch pain spots to using crossproxy 2016-06-24 19:43:31 -05:00
Vincent Lee 9d1e7f86cf Futureproof update json url 2016-06-24 19:35:24 -05:00
Vincent Lee 5863b165ad Added cross version proxies 2016-06-24 19:33:58 -05:00
Vincent Lee f7a1f629be JEI hack for 1.10 2016-06-24 18:59:23 -05:00
Vincent Lee 6f348e7db1 Made dispenser behaviours 1.10 safe 2016-06-24 18:55:41 -05:00
Howtonotwin b6ddefcaf4 Rewrite some of the Ring of Chordata
Add guard against having two rings equipped; the second ring will be
inactive. Fixes #340
2016-06-24 17:11:55 -04:00
Vincent Lee c6df7c260a Fix lexicon word count 2016-06-22 19:29:06 -05:00
Vincent Lee 9a11ebef1f Fix 1.8 stones not being voided, clean up ore dict registrations that are no longer needed 2016-06-22 19:16:52 -05:00
Vincent Lee 1bb254a4fc Workaround subtiles crashing when dug 2016-06-22 19:04:19 -05:00
Vincent Lee 8600b75691 Fix solegnolia not working on dediserver and threadsafe the collection. Fixes #346 2016-06-22 18:41:21 -05:00
Vincent Lee 337851994f Fix bad portuguese brick recipes. Closes #368 2016-06-21 19:44:14 -05:00
Vincent Lee b232d8bb93 Fix #367 2016-06-21 19:31:24 -05:00
Vincent Lee 2a2971f75a Merge branch 'MC19' of github.com:williewillus/Botania into MC19 2016-06-21 19:26:56 -05:00
Vincent Lee dced32bf4c Merge pull request #365 from Luxor5393/patch-1
Fix two typos.
2016-06-21 19:23:58 -05:00
Luxor5393 420d4b0aa4 Fix two typos. 2016-06-21 16:57:47 +02:00
Vincent Lee d4b0d0aec9 Cleanup 2016-06-20 19:54:33 -05:00
Vincent Lee e37b3ac3e6 Soulscribe only effective when fully charged 2016-06-20 19:34:08 -05:00
Vincent Lee 6a4f8e9f4b Switch some things to tessellator 2016-06-19 10:37:32 -05:00
Vincent Lee d7929eed08 Fix terra pick darkening screen 2016-06-19 10:21:37 -05:00
Vincent Lee 028f0c4c82 Minor opt to red string interceptor 2016-06-19 10:05:10 -05:00
Vincent Lee 71edb3abb1 Fix transforms on runic altar. Closes #351 2016-06-19 09:47:58 -05:00
Vincent Lee 4fede6f49e Cleanup 2016-06-18 23:12:37 -05:00
Vincent Lee 4ef18f3347 Fully serverside enchanter 2016-06-18 23:09:27 -05:00
Vincent Lee eaa9c89684 Optimize spectator net traffic more - don't use nbt list of nbt longs just use nbt int array 2016-06-18 21:42:53 -05:00
Vincent Lee 37c2adece1 Fix spark particles not spreading out 2016-06-18 21:28:19 -05:00
Vincent Lee 9f94407be0 Fix armor format error 2016-06-18 21:09:08 -05:00
Vincent Lee 7b6d2e843e JK it's 2 overrides 2016-06-18 19:10:27 -05:00
Vincent Lee 7d87732ccb Actually prevent shoving. Why the heck does it require three overrides?? 2016-06-18 19:04:54 -05:00
Vincent Lee 3c9388702c Prevent GG from being shoved while it's still spawning 2016-06-18 18:42:27 -05:00
Vincent Lee e338735814 Allow non-melle player damage to GG (arrows) damage cap still applies. Damage reduction in hard mode now done using armor 2016-06-18 18:36:15 -05:00
Vincent Lee d34fc5a3e1 GG now deals damage if a player is in its path of teleport 2016-06-18 18:03:21 -05:00
Vincent Lee d9522fcc18 Fix gaia removed potion effects not syncing, made magic landmines deal magic (armor bypassing) damage 2016-06-18 17:25:51 -05:00
Vincent Lee 53147606c1 GG automatically distributes drops to appropriate players. Also fix mobs getting too short of a fire resist 2016-06-18 16:48:58 -05:00
Vincent Lee cfb368f67e Immutabilize vector3 as it being defensively copied all over already 2016-06-18 16:11:03 -05:00
Vincent Lee 6c307d16f4 Made Quats proper value type 2016-06-18 15:28:54 -05:00
Vincent Lee 3a8fc10cc9 Fix TE resyncs sending a bit too much stuff 2016-06-18 14:57:13 -05:00
Vincent Lee f2544a6fa4 Remove debug logging in special flower model 2016-06-18 14:37:07 -05:00
Vincent Lee b7e77936b3 Remove guards in TileMod since forge has them now 2016-06-18 14:36:36 -05:00
Vincent Lee 8767180a7b Made special flower models use a guava cache. Fixes threading issues, closes #338 2016-06-18 14:21:56 -05:00
Vincent Lee bc52c67c89 Fix tiara conflicting with spectator mode, closes #356 2016-06-18 12:42:18 -05:00
Vincent Lee 0001f9c8f1 Save flare chakram state in NBT, closes upstream issue 1620 2016-06-17 19:43:45 -05:00
Vincent Lee 9fef518968 Fix broken hsb calculation because mojang's function is broken. Also fix upstream issue 1672 2016-06-17 19:41:59 -05:00
Vincent Lee 6b10ada28a Build 310 I need sleep 2016-06-17 00:21:01 -05:00
Vincent Lee f3a3e80334 Revert "Revert "Fix other mods crashing because of alternate implementations of metadata""
This reverts commit fc23dedd05.
2016-06-17 00:17:51 -05:00
Vincent Lee 5cdd2ee32f Revert "Cleaner solution"
This reverts commit a9cc76576a.
2016-06-17 00:17:48 -05:00
Vincent Lee a9cc76576a Cleaner solution 2016-06-17 00:03:35 -05:00
Vincent Lee fc23dedd05 Revert "Fix other mods crashing because of alternate implementations of metadata"
This reverts commit 25cd574662.
2016-06-17 00:03:04 -05:00
Vincent Lee 65bf209835 Merge branch 'MC19' of github.com:williewillus/Botania into MC19 2016-06-16 23:46:35 -05:00
Vincent Lee d2e84babb7 Fix flowers popping off on relay and mycelium 2016-06-16 23:44:44 -05:00
Vincent Lee 850ea37f4d Merge pull request #354 from yrsegal/patch-1
Fix other mods crashing because of alternate implementations of metadata
2016-06-16 23:32:23 -05:00
Vincent Lee 2d0af453b3 Tweak various model transforms. Closes #350: 2016-06-16 23:30:23 -05:00
Vincent Lee d5c9c7815e Clean up lightning code 2016-06-16 23:12:22 -05:00
Wire Segal 25cd574662 Fix other mods crashing because of alternate implementations of metadata
Closes #352
Closes #353
2016-06-16 23:57:43 -04:00
Vincent Lee 3cf1619b2e Build 309 2016-06-16 21:22:51 -05:00
Vincent Lee 73c06c10eb Fix server crash 2016-06-16 21:18:35 -05:00
Vincent Lee 1d5dfa149e TIL Collection.removeIf 2016-06-16 21:04:36 -05:00
Vincent Lee c1fff324d1 Remove extraneous debug print 2016-06-16 20:59:52 -05:00
Vincent Lee 95f1e768fe Update forge, fix mana blaster overrides 2016-06-16 20:40:11 -05:00
Vincent Lee ec9496b0e7 Remove some unused stuff 2016-06-16 19:48:14 -05:00
Vincent Lee 5f3951c7fa Fix solegnolia having lower range than advertised. Closes #346 2016-06-16 19:39:26 -05:00
Vincent Lee 47ac6fc65a Check for blocks with no item in overgrowth seed. Closes #347 2016-06-16 19:26:29 -05:00
Vincent Lee ae0894a8d0 Fix keybinding crash. Closes #344 2016-06-16 19:24:12 -05:00
Vincent Lee 96bf87333b Clean up lightning code, batch the render by 200's to not overflow the tess. Closes #342 2016-06-14 20:30:52 -05:00
Vincent Lee 9e09a3f42d Update forge and fix pylon transforms, closes #252 2016-06-12 13:19:31 -05:00
Vincent Lee bc0ca77960 Terra blade now respects 1.9 cooldown 2016-06-11 21:11:47 -05:00
Vincent Lee 8bca8bb5f6 Get rid of some of the many stupid parXX parameter names 2016-06-11 14:42:18 -05:00
Vincent Lee ece95aca1c Big parameter name cleanup, part 1 2016-06-11 14:28:22 -05:00
Vincent Lee c357ab68c3 Super minor optimization for object alloc 2016-06-11 13:58:05 -05:00
Vincent Lee cfc1ba8baf Gaia head can now be worn. Closes #305 2016-06-11 12:57:46 -05:00
Vincent Lee f56eca23fc Fix #330 2016-06-11 11:24:00 -05:00
Vincent Lee b7aab995db Merge pull request #337 from yrsegal/MC19
Fix all outstanding auxiliary renders.
2016-06-10 22:48:18 -05:00
yrsegal ec5fcef90c fix devil tail 2016-06-10 23:22:41 -04:00
yrsegal f4d7a80e49 Fix all cosmetic baubles and use NONE 2016-06-10 22:49:53 -04:00
Vincent Lee c289edd825 Serverside normal sparks 2016-06-10 20:31:34 -05:00
Vincent Lee 5ac09b830d Some net stuff for later 2016-06-10 19:52:05 -05:00
Vincent Lee 709fc130d5 Merge branch 'MC19' of github.com:williewillus/Botania into MC19 2016-06-10 19:31:29 -05:00
Vincent Lee 873aedf4e5 Fix #332 2016-06-10 19:31:11 -05:00
Vincent Lee 27410530d6 Tweak horn sidings 2016-06-10 19:18:28 -05:00
yrsegal 491452ac7b Fix all outstanding auxiliary renders.
close #49 until the next time renders break
2016-06-10 16:56:39 -04:00
Vincent Lee 4e905ede36 Merge pull request #336 from isambourgg/patch-1
Update fr_FR.lang
2016-06-10 14:46:44 -05:00
Vincent Lee 6afc33c57b Merge branch 'MC19' of github.com:williewillus/Botania into MC19 2016-06-09 20:50:15 -05:00
Vincent Lee 5f35b8aef0 Readd old overrides, not working because of forge bug 2016-06-09 20:49:49 -05:00
isambourgg 699ee5027a Update fr_FR.lang
Relecture et correction jusqu'à la Ligne 559.
2016-06-09 16:42:34 -04:00
Vincent Lee 7c32f5fbaf Merge pull request #331 from yrsegal/patch
Fix sneaking transforms being out of place for baubles
2016-06-08 18:08:35 -05:00
yrsegal 3c0fe199d5 Fix sneaking transforms being out of place for baubles 2016-06-08 17:02:41 -04:00
Vincent Lee c15f08b066 Remove unofficial port message from login nag 2016-06-07 20:18:05 -05:00
Vincent Lee c47de38ec9 Fix inventory transforms for floating flowers 2016-06-05 18:14:07 -05:00
Vincent Lee 9b3c1d721d Minor potion cleanup 2016-06-05 17:45:58 -05:00
Vincent Lee 5d19a0dd6c Workaround for armorstand helmets. Closes #23 2016-06-05 16:37:52 -05:00
Vincent Lee 89834b4053 Clean up some other models 2016-06-05 15:15:45 -05:00
Vincent Lee 85eef6c461 Steal the transforms from Psi :P 2016-06-05 15:11:17 -05:00
Vincent Lee 9897d3ed80 Merge branch 'newblaster' into MC19 2016-06-05 14:57:44 -05:00
Vincent Lee 02cfe14d94 Move bauble box to caps as well. Closes #297 2016-06-05 14:32:08 -05:00
Vincent Lee 4b4b9a308c Tweaks to previous commit 2016-06-04 23:14:33 -05:00
Vincent Lee 55df4f0619 Move flower pouch to caps 2016-06-04 22:59:53 -05:00
Vincent Lee c83578b920 Clean up basic section lexicon and some misc lang entries 2016-06-04 21:35:43 -05:00
Vincent Lee 39517588e7 Clean up some todos 2016-06-04 20:10:13 -05:00
Vincent Lee 14f0c43850 Fix armor material registration, buff terrasteel armor slightly 2016-06-04 20:00:10 -05:00
Vincent Lee 05c6a07bc2 Clean up logging and log spam. #cleanloginitiative 2016-06-04 19:01:34 -05:00
Vincent Lee d241f95bee Zap some duplicated code 2016-06-04 12:06:39 -05:00
Vincent Lee 49a6f00b41 Update Forge, some fluid cap stuff 2016-06-03 23:10:33 -05:00
Vincent Lee 14b2a35862 Clean up English present in es_ES, fr_FR. My pinkie hurts. 2016-06-03 20:41:32 -05:00
Vincent Lee 4aeed07f75 Clean up English present in nl_NL, pt_BR 2016-06-03 20:27:21 -05:00
Vincent Lee cdcfe75325 Clean up English present in es_AR, ru_RU 2016-06-03 20:20:51 -05:00
Vincent Lee 303e89f6c5 Clean up English present in ja_JP and ko_KR 2016-06-03 20:11:55 -05:00
Vincent Lee c9e501fd02 Clean up English present in zh_CN, zh_TW 2016-06-03 20:03:19 -05:00
Vincent Lee 3049ac9767 Clean up English present in de_DE 2016-06-03 19:52:54 -05:00
Vincent Lee 11c0e4b274 Add warning header to all lang files 2016-06-03 19:41:54 -05:00
Vincent Lee fab5fc0087 Remove ColoredLights integration 2016-06-03 19:28:15 -05:00
Vincent Lee a5df917d5a Update BM mod id 2016-06-03 18:56:06 -05:00
Vincent Lee c2931d1517 Merge branch 'MC19' of github.com:williewillus/Botania into MC19 2016-06-02 21:41:10 -05:00
Vincent Lee b71cb163a7 Fix fallback for contributors with flowers not in main botania. Closes #321 2016-06-02 21:40:36 -05:00
Vincent Lee ff69a2e458 Merge pull request #320 from yrsegal/MC19
Make the lexicon recipe mappings accept the wildcard value
2016-06-01 21:20:35 -05:00
Vincent Lee 4cfd420cc1 Let some technical blocks drop normal drop from weight lens 2016-06-01 21:09:33 -05:00
Vincent Lee 95bd4689d6 Fix halo crashing, also tweak visuals slightly. Closes #314 2016-06-01 20:39:49 -05:00
Vincent Lee d2aa4e0ebc Fix some missing glstatemanager substitutions. Fixes #307 2016-06-01 20:19:40 -05:00
yrsegal 1bff638075 Make the lexicon recipe mappings accept the wildcard value 2016-06-01 18:39:36 -04:00
Vincent Lee 78f296d0cf Merge branch 'MC19' of github.com:williewillus/Botania into MC19 2016-05-31 20:58:30 -05:00
Vincent Lee 6014df2b12 Fix a couple baubles 2016-05-31 20:57:45 -05:00
Vincent Lee 30c208aa55 Merge pull request #315 from howtonotwin/258-bhtalisman
Limit BH Talisman to world height. Fixes #258
2016-05-31 20:35:52 -05:00
Vincent Lee 96a2da61f5 Fix wrong import 2016-05-31 20:03:39 -05:00
Howtonotwin fd35d25423 Limit BH Talisman to world height. Fixes #258 2016-05-31 17:17:20 -04:00
Vincent Lee 2065f01b8d Fix pool crafting particles 2016-05-30 21:37:56 -05:00
Vincent Lee 6c52c4f5f9 Fix chakrams being weird. Closes #306 2016-05-30 17:14:06 -05:00
Vincent Lee 307068c9c4 Lower spawn fuzz to 0 in gog, fixes #287 2016-05-30 16:21:56 -05:00
Vincent Lee 688da731ab Spell cloth can no longer be enchanted at an anvil, closes #308 2016-05-30 12:57:21 -05:00
Vincent Lee ac003f1307 Gaia guardian now looks like whoever is viewing it. spooky. 2016-05-28 16:45:57 -05:00
Vincent Lee 3e0f5da01d Clean up gaia head renderer. Closes #303 2016-05-28 15:44:20 -05:00
Vincent Lee cc1b66f3cd Gradle script automatically updates update.json 2016-05-28 12:50:41 -05:00
Vincent Lee c08fa024a0 Add update.json not done yet, bump forge minimum req version 2016-05-28 11:46:06 -05:00
Vincent Lee 4f0d63f5a0 Build 308 2016-05-28 11:09:08 -05:00
Vincent Lee 8ef557e51b Remove loot debug -.- 2016-05-28 11:04:40 -05:00
Vincent Lee 974e8d0316 Build 307 2016-05-27 20:55:48 -05:00
Vincent Lee cf82603f04 Update bow methods. Closes #300 2016-05-27 20:26:54 -05:00
Vincent Lee 1d54442e01 Fix axe digging closes #301 2016-05-27 19:56:07 -05:00
Vincent Lee a07f7914ae Add chest textures, update Forge 2016-05-27 19:51:59 -05:00
Vincent Lee 51c7d310a7 Moar clenaup 2016-05-26 23:22:50 -05:00
Vincent Lee e3e6f8996f Cleanup 2016-05-26 23:08:53 -05:00
Vincent Lee 7f759c1b88 Fix ender air bottle being underpowered 2016-05-24 21:16:18 -05:00
Vincent Lee 57e1fd5b41 Merge branch 'master' of https://github.com/Vazkii/Botania into MC19 2016-05-22 13:20:39 -05:00
Vincent Lee 8b88289789 Fix issues associated with last commit 2016-05-22 13:19:11 -05:00
Vincent Lee ff2afbf037 Untested: replace most uses of common i18n with client one 2016-05-22 11:41:33 -05:00
Vincent Lee 41b3e6cd4f Use all bits for effect packet args. Closes #296 2016-05-21 23:40:10 -05:00
Vincent Lee 930703b5c1 Workaround for 'global' particles at small render distances. Close #15 (mostly) 2016-05-21 23:38:17 -05:00
Vincent Lee f52dca111f Flower bag plays sound and animation. Closes #295 2016-05-21 22:55:30 -05:00
Vincent Lee 9694664922 Fix mana cookie lasting too short (thanks wiresegal) 2016-05-21 22:13:52 -05:00
Vincent Lee e2e00f7ef1 Use chunk util method that exists instead of own thing 2016-05-21 12:13:37 -05:00
Vincent Lee c9de3bcc03 Mana pools now try catalyst recipes first before recipes without catalyst specified. Also make mana bar not render in spectator. Closes #291 2016-05-20 14:36:28 -05:00
Vincent Lee 995c19c04a Fix TE syncing on login, 2 minor optimizations 2016-05-19 14:07:52 -05:00
Vincent Lee 96983a1d6b Merge branch 'MC19' of github.com:williewillus/Botania into MC19 2016-05-19 10:03:48 -05:00
Vincent Lee 8f00e9bdd6 Build 306 2016-05-19 10:03:24 -05:00
Vincent Lee 49d3004c60 Merge pull request #288 from yrsegal/MC19
Fix recipesorter complaining
2016-05-18 21:36:57 -05:00
Vincent Lee 8fb3b886a8 Get rid of all the nullable-nonnull stuff, warning huge diff 2016-05-18 21:03:12 -05:00
yrsegal 3c159e2485 Fix recipesorter complaining
Closes #269
2016-05-18 21:01:09 -04:00
Vincent Lee bdf51cbc8b Move IManaCollisionGhost to blocks. Closes #280 2016-05-18 19:16:51 -05:00
Vincent Lee 056f46b1f8 Update to 1.9.4 - untested waiting on baubles 2016-05-18 15:22:35 -05:00
Vincent Lee a59ee11da4 Build 305 2016-05-18 14:14:07 -05:00
Vincent Lee 9b06371a4e Fix dirt path and spreader binding. Closes #279 2016-05-18 11:31:12 -05:00
Vincent Lee afb3f6f44b Fix lexicon model i accidentally broke 2016-05-18 11:22:13 -05:00
Vincent Lee 1deb617f72 Fix GOG sound #285 2016-05-18 11:13:38 -05:00
Jonathan Smith 5495271fa2 Merge pull request #1849 from NatsuArashi/patch-3
Update zh_TW.lang
2016-05-18 10:49:15 +01:00
NatsuArashi 588a02f385 Update zh_TW.lang
*部分日本語使用原文
2016-05-18 17:39:27 +08:00
Vincent Lee b1fad332b8 Fix terraaxe icon when inactive, closes #281 2016-05-15 21:51:24 -05:00
Vincent Lee df478b0ff8 Fix picking root block giving bad item. Closes #282 2016-05-15 21:25:54 -05:00
Vincent Lee 68560a335e Minor cleanup 2016-05-13 22:47:18 -05:00
Vincent Lee 13905a174c Fix smoke particles 2016-05-13 00:08:35 -05:00
Vincent Lee ef0f31f2de Some probably useless optimizations 2016-05-12 20:02:57 -05:00
Vincent Lee 1d7a402c6e Optimize itemfinder heavily 2016-05-12 19:45:51 -05:00
Vincent Lee b0fad5db16 Fix hopperhock being broken with vanilla chests 2016-05-12 17:51:58 -05:00
Vincent Lee 481eb5e711 Serverside many subtiles 2016-05-12 17:38:25 -05:00
Vincent Lee 1e26be3c77 Weaken boss collection 2016-05-12 16:30:01 -05:00
Vincent Lee a2d8aa17d2 Fix petal burying #274 2016-05-12 14:47:29 -05:00
Vincent Lee ebc6f1a8c6 Loonium now can be set to a custom loot table. For mapmakers 2016-05-11 19:27:15 -05:00
Vincent Lee 6a5e37b632 Update forge, fully fix loot generation 2016-05-11 11:50:06 -05:00
Vincent Lee 6b55f97a44 Build 304 2016-05-10 23:24:27 -05:00
Vincent Lee ae71a4756c I messed that up >.>. Fix server crash on startup #272 2016-05-10 23:21:38 -05:00
Vincent Lee bf0712a75c Build 302 2016-05-10 23:18:46 -05:00
Vincent Lee 79e2ee7c0a Shim in loot table to suppress errors in public build 2016-05-10 19:54:09 -05:00
Vincent Lee fb7fda6996 Update versionchecker links 2016-05-10 19:39:02 -05:00
Vincent Lee c944512519 Fix pump rendering, pool cart rendering. Made pool cart spawn particles 2016-05-10 19:11:18 -05:00
Vincent Lee dc8104f68b Preliminary work on new loot system 2016-05-10 11:55:50 -05:00
Vincent Lee 46417330a4 Fix #266 log spam 2016-05-07 22:32:09 -05:00
Vincent Lee 2f292ed3be Fix #271 incense rendering 2016-05-07 22:29:46 -05:00
Vincent Lee 4231dc839f Add reverse petal block recipes 2016-05-07 11:56:57 -05:00
Vincent Lee be1eb570ef More minor cleaning 2016-05-06 23:50:00 -05:00
Vincent Lee d524a0b2e9 Fold a couple interfaces together, we have way too many .-. 2016-05-06 23:39:33 -05:00
Vincent Lee afc5f93b55 Fix #265 2016-05-06 22:38:07 -05:00
Vincent Lee 072f13d3db Update JEI and add support for recipe category crafting items 2016-05-06 22:24:15 -05:00
Vincent Lee 5e11fe6e06 Removed model registration for last commit 2016-05-06 19:34:33 -05:00
Vincent Lee a3abfb6aad Removed buried petals and mana flash item forms. Closes #268 2016-05-06 19:30:58 -05:00
Vincent Lee c0c1db1aa7 Fix #267 2016-05-06 19:11:33 -05:00
Vincent Lee e99d5dff63 Update to recommended forge, removed useless synchronization in ManaNetworkHandler 2016-05-06 18:49:11 -05:00
Vincent Lee 1b144e6b58 Fix #264 2016-05-04 19:32:33 -05:00
Vincent Lee 7dcd0281b8 Actually commit new zip 2016-05-04 18:58:15 -05:00
Vincent Lee 2d412ac70f Various cleanups, updated alt textures to 1.9 2016-05-04 18:38:09 -05:00
Vincent Lee a0d251fafd Update forge and close #245 2016-05-03 12:38:52 -05:00
Vincent Lee f24409f336 Add workarounds for the silly forge light bug. Closes #221, probably closes #251 as well 2016-05-03 11:31:59 -05:00
Vincent Lee 7a66a9756b Revert stupid find replace hit 2016-05-02 22:08:10 -05:00
Vincent Lee a802650289 Merge branch 'derpbranch' into MC19 2016-05-02 22:06:29 -05:00
Vincent Lee 130c67e758 Fully serverside gaia guardian, buff it a bit 2016-05-02 22:05:35 -05:00
Vincent Lee d0e2f474bc Resync hourglass whenever it flips, hopefully helps with desyncs 2016-05-02 20:14:46 -05:00
Vincent Lee 6889afc34e Delete old models 2016-05-02 19:59:08 -05:00
Vincent Lee bb152907a7 Fix TESR item transforms 2016-05-02 19:45:30 -05:00
Vincent Lee 3996c5d078 Guard against null chunk in packethandler 2016-05-02 19:24:13 -05:00
Vincent Lee 8f4f63453a Move nonfabulous pools into static renderer. Yay performance improvements! 2016-05-02 19:20:31 -05:00
Vincent Lee 725ae1cef1 Fix crystal cube, closes #253 2016-05-02 08:34:30 -05:00
Vincent Lee 93656a9d43 Fix+tweak paint lens particles 2016-05-01 22:43:33 -05:00
Vincent Lee 96a1db97a9 Serverside TilePool 2016-05-01 22:03:58 -05:00
Vincent Lee a339397fcc Some network boilerplate 2016-05-01 21:25:30 -05:00
Vincent Lee e37255a997 Make platform disappear with managlass, and fix version checker 2016-05-01 11:42:40 -05:00
Vincent Lee 95427b1c9d Fix missing texture on fungal apothecary 2016-04-30 14:03:09 -05:00
Vincent Lee 4a6bf0ed0d Fix incorrect horn sound. Closes #257 2016-04-30 13:26:05 -05:00
Vincent Lee b6827ca04e Remove new cooldown from signal flare, remove redundant check from fire/rainbowrod 2016-04-29 08:15:54 -05:00
Vincent Lee 45df392cce Close #259 2016-04-28 23:37:20 -05:00
Vincent Lee abf5d9672b Make some items use new cooldowns, closes #261 2016-04-28 23:34:40 -05:00
Vincent Lee dc35d395cf Some balance changes 2016-04-27 19:26:56 -05:00
Vincent Lee fca4e2bfa8 Properly check kekimurus. Closes #255 2016-04-27 17:23:00 -05:00
Vincent Lee 543b5a1958 Guard against null item stacks in OD -.-. Closes #254 2016-04-27 17:20:18 -05:00
Vincent Lee f8d18ae769 All other sound subtitles 2016-04-23 22:03:27 -05:00
Vincent Lee 6d350451fc Some sound subtitles 2016-04-23 21:05:11 -05:00
Vincent Lee 5d1829a00e Camo block now respects directional blocks. Closes #110 2016-04-23 18:44:32 -05:00
Vasco Lavos da11e497fc Update contributors.properties 2016-04-22 02:41:54 +01:00
Vincent Lee b7fead0e4d Initial stuff 2016-04-16 17:34:17 -05:00
Jonathan Smith 3fb76acf57 Merge pull request #1835 from elbo2525/master
Update ja_JP.lang
2016-04-07 09:42:02 +01:00
elbo2525 2471642df7 Update ja_JP.lang 2016-04-07 15:53:52 +09:00
1551 changed files with 17740 additions and 24365 deletions

No files matched your search

+3 -7
View File
@@ -1,14 +1,10 @@
README:
This is williewillus' port and continuation of Botania for Minecraft versions 1.8.x and above
This is williewillus' old port and of Botania for Minecraft versions 1.8.x up to 1.10.2, build 320.
All licensing and distribution rights are exactly as 1.7.10 Botania.
Vazkii took a break from Botania from 2016-02-25 to 2016-09-05, I have ported it in this time and fixed things here and there.
Use at your own risk as bugs may pop up unexpectedly.
As of 2016 02 25, Vazkii has stopped working on Botania. Requests for design changes will still not be accepted here (post them on reddit). Even then, don't expect anything to be added without severe deliberation scrutiny.
Please report all 1.8+ issues to this repository.
Future development is now at Vazkii's BotaniaV2 Repository; remaining issues in this repository will be fixed, but new issue reports will not be accepted. Thanks!
These non-CurseForge builds can be openly used in modpacks of any kind, in accordance with the requirements of the license of this mod.
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
{
"pack": {
"pack_format": 1,
"pack_format": 2,
"description": "Alternate Botania textures by Futureazoo"
}
}
+31 -16
View File
@@ -1,3 +1,6 @@
import groovy.json.JsonSlurper
import groovy.json.JsonOutput
buildscript {
repositories {
mavenCentral()
@@ -11,7 +14,7 @@ buildscript {
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT'
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
classpath 'com.matthewprenger:CurseGradle:1.0-SNAPSHOT'
}
}
@@ -43,7 +46,7 @@ minecraft {
version = "${config.mc_version}-${config.forge_version}"
runDir = "eclipse/assets"
mappings = "snapshot_20160402"
mappings = "snapshot_20160718"
//This, does the token replacement.
//Though, I reccomend this to be replaced with a token such as @VERSION@
replace 'GRADLE:BUILD', config.build_number
@@ -64,11 +67,7 @@ dependencies {
compile files(
'Baubles-deobf.jar'
)
//compile "codechicken:CodeChickenLib:1.8-1.1.2.139:dev"
//compile "codechicken:CodeChickenCore:1.8-1.0.5.36:dev"
//compile "codechicken:NotEnoughItems:1.8-1.0.5.104:dev"
//compile "codechicken:ForgeMultipart:1.7.10-1.1.1.320:dev"
deobfCompile "mezz.jei:jei_1.9:3.2.3.176"
deobfCompile "mezz.jei:jei_1.10.2:3.7.8.234"
//and a bit more for SCP
sshAntTask "org.apache.ant:ant-jsch:1.7.1", "jsch:jsch:0.1.29"
@@ -79,6 +78,9 @@ compileJava {
targetCompatibility = 1.8
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
processResources {
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
@@ -114,10 +116,27 @@ task incrementBuildNumber(dependsOn: 'reobfJar') << {
config.toProperties().store(it, "")
}
// todo make this flexibile - collection of supported mc versions
file('web/versions.ini').append("\n${version}=${minecraft.version}")
file("${config.dir_repo}/version/${minecraft.version}.txt").write("${version}")
def updateJsonFile = file('version/update.json')
def updateJson = new JsonSlurper().parse(updateJsonFile) as Map
// todo detect if the mcversion is absent
// Add to version section
updateJson."${minecraft.version}"."${version}" = "See https://github.com/williewillus/Botania/releases/${version}"
// Update promos
updateJson.promos."${minecraft.version}-latest" = "${version}"
updateJson.promos."${minecraft.version}-recommended" = "${version}"
updateJsonFile.write(JsonOutput.prettyPrint(JsonOutput.toJson(updateJson)))
}
/* Unused - Forgecraft and web server stuff
// I have no idea what I'm doing
task wtfGradle2(type: Copy) {
from(jar.destinationDir)
@@ -155,9 +174,7 @@ task sort(type: Delete) {
delete "${config.dir_output}/${deobfJar.archiveName}", "${config.dir_output}/wtf"
}
/**
* This is the upload task from the build.xml
*/
// This is the upload task from the build.xml
task upload() << {
scp('/files') {
fileset(file: jar.archivePath)
@@ -173,9 +190,7 @@ task upload() << {
}
}
/**
* This is deply_web task
*/
// This is deploy_web task
task deployWeb << {
scp('/') {
fileset(dir: 'web') //everything from the web directory
@@ -203,6 +218,7 @@ def scp(String dir, Closure antFileset = {}) {
}
}
}
*/
def parseConfig(File config) {
config.withReader {
@@ -224,9 +240,8 @@ curseforge {
changelog = """
See https://github.com/williewillus/Botania/releases/tag/${version}
"""
releaseType = "beta"
addGameVersion '1.8.9'
addGameVersion 'Java 8'
releaseType = "release"
addGameVersion "${minecraft.version}"
relations {
requiredLibrary 'baubles'
}
+4 -4
View File
@@ -1,9 +1,9 @@
#
#Wed Apr 13 10:09:00 CDT 2016
#Sun Aug 28 08:42:14 CDT 2016
version=r1.8
dir_output=../Build Output/Botania/
forge_version=12.16.0.1865-1.9
mc_version=1.9
forge_version=12.18.1.2056
mc_version=1.10.2
dir_repo=./
build_number=302
build_number=321
mod_name=Botania
+1
View File
@@ -56,3 +56,4 @@ loraanicus=10
samerater=8
coolcabbage16=13
eladkay=3
tobiasling=9
+2 -2
View File
@@ -1,6 +1,6 @@
#Mon Sep 14 12:28:28 PDT 2015
#Sat May 28 11:56:22 CDT 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-all.zip
@@ -15,6 +15,8 @@ import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
/** Use minecraft's EnumDyeColor in as many places as possible. */
@Deprecated
public enum EnumColor implements IStringSerializable {
@@ -111,6 +113,7 @@ public enum EnumColor implements IStringSerializable {
return name().replace("_", ".").toLowerCase(Locale.ENGLISH);
}
@Nonnull
@Override
public String getName() {
return NAMES[ordinal()];
@@ -6,7 +6,7 @@ import java.util.Map;
import com.google.common.collect.Maps;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTBase.NBTPrimitive;
import net.minecraft.nbt.NBTPrimitive;
import net.minecraft.nbt.NBTTagString;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IStringSerializable;
@@ -2,10 +2,10 @@
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
*
* File Created @ [Jan 14, 2014, 6:15:28 PM (GMT)]
*/
package vazkii.botania.api;
@@ -32,6 +32,7 @@ import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.common.util.EnumHelper;
import net.minecraftforge.fml.common.Loader;
@@ -74,7 +75,7 @@ public final class BotaniaAPI {
public static final Map<String, KnowledgeType> knowledgeTypes = new HashMap<>();
public static final Map<String, Brew> brewMap = new LinkedHashMap<>();
public static final List<String> disposableBlocks = new ArrayList<>();
public static final List<String> semiDisposableBlocks = new ArrayList<>();
@@ -102,16 +103,20 @@ public final class BotaniaAPI {
public static final Set<Class<? extends Entity>> gravityRodBlacklist = new LinkedHashSet<>();
public static final ArmorMaterial manasteelArmorMaterial = EnumHelper.addArmorMaterial("MANASTEEL", "manasteel", 16, new int[] { 2, 6, 5, 2 }, 18, SoundEvents.item_armor_equip_iron);
public static final ArmorMaterial manasteelArmorMaterial = EnumHelper.addArmorMaterial("MANASTEEL", "manasteel", 16,
new int[] { 2, 6, 5, 2 }, 18, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0);
public static final ToolMaterial manasteelToolMaterial = EnumHelper.addToolMaterial("MANASTEEL", 3, 300, 6.2F, 2F, 20);
public static final ArmorMaterial elementiumArmorMaterial = EnumHelper.addArmorMaterial("B_ELEMENTIUM", "b_elementium", 18, new int[] { 2, 6, 5, 2 }, 18, SoundEvents.item_armor_equip_iron);
public static final ArmorMaterial elementiumArmorMaterial = EnumHelper.addArmorMaterial("B_ELEMENTIUM", "b_elementium", 18,
new int[] { 2, 6, 5, 2 }, 18, SoundEvents.ITEM_ARMOR_EQUIP_IRON, 0);
public static final ToolMaterial elementiumToolMaterial = EnumHelper.addToolMaterial("B_ELEMENTIUM", 3, 720, 6.2F, 2F, 20);
public static final ArmorMaterial terrasteelArmorMaterial = EnumHelper.addArmorMaterial("TERRASTEEL", "terrasteel", 34, new int[] {3, 8, 6, 3}, 26, SoundEvents.item_armor_equip_diamond);
public static final ArmorMaterial terrasteelArmorMaterial = EnumHelper.addArmorMaterial("TERRASTEEL", "terrasteel", 34,
new int[] { 3, 8, 6, 3 }, 26, SoundEvents.ITEM_ARMOR_EQUIP_DIAMOND, 3F);
public static final ToolMaterial terrasteelToolMaterial = EnumHelper.addToolMaterial("TERRASTEEL", 4, 2300, 9F, 3F, 26);
public static final ArmorMaterial manaweaveArmorMaterial = EnumHelper.addArmorMaterial("MANAWEAVE", "manaweave", 5, new int[] { 1, 2, 2, 1 }, 18, SoundEvents.item_armor_equip_leather);
public static final ArmorMaterial manaweaveArmorMaterial = EnumHelper.addArmorMaterial("MANAWEAVE", "manaweave", 5,
new int[] { 1, 2, 2, 1 }, 18, SoundEvents.ITEM_ARMOR_EQUIP_LEATHER, 0);
public static final EnumRarity rarityRelic = EnumHelper.addRarity("RELIC", TextFormatting.GOLD, "Relic");
@@ -211,12 +216,12 @@ public final class BotaniaAPI {
addOreWeightNether("oreOnyx", 500); // SimpleOres 2
addOreWeightNether("oreHaditeCoal", 500); // Hadite
addSeed(Items.wheat_seeds, Blocks.wheat);
addSeed(Items.potato, Blocks.potatoes);
addSeed(Items.carrot, Blocks.carrots);
addSeed(Items.nether_wart, Blocks.nether_wart);
addSeed(Items.pumpkin_seeds, Blocks.pumpkin_stem);
addSeed(Items.melon_seeds, Blocks.melon_stem);
addSeed(Items.WHEAT_SEEDS, Blocks.WHEAT);
addSeed(Items.POTATO, Blocks.POTATOES);
addSeed(Items.CARROT, Blocks.CARROTS);
addSeed(Items.NETHER_WART, Blocks.NETHER_WART);
addSeed(Items.PUMPKIN_SEEDS, Blocks.PUMPKIN_STEM);
addSeed(Items.MELON_SEEDS, Blocks.MELON_STEM);
registerModWiki("Minecraft", new SimpleWikiProvider("Minecraft Wiki", "http://minecraft.gamepedia.com/%s"));
@@ -246,12 +251,12 @@ public final class BotaniaAPI {
registerModWiki("GanysNether", new SimpleWikiProvider("Gany's Nether Wiki", "http://ganys-nether.wikia.com/wiki/%s"));
registerModWiki("GanysEnd", new SimpleWikiProvider("Gany's End Wiki", "http://ganys-end.wikia.com/wiki/%s"));
registerPaintableBlock(Blocks.stained_glass, BlockStainedGlass.COLOR);
registerPaintableBlock(Blocks.stained_glass_pane, BlockStainedGlassPane.COLOR);
registerPaintableBlock(Blocks.stained_hardened_clay, BlockColored.COLOR);
registerPaintableBlock(Blocks.wool, BlockColored.COLOR);
registerPaintableBlock(Blocks.carpet, BlockCarpet.COLOR);
registerPaintableBlock(Blocks.STAINED_GLASS, BlockStainedGlass.COLOR);
registerPaintableBlock(Blocks.STAINED_GLASS_PANE, BlockStainedGlassPane.COLOR);
registerPaintableBlock(Blocks.STAINED_HARDENED_CLAY, BlockColored.COLOR);
registerPaintableBlock(Blocks.WOOL, BlockColored.COLOR);
registerPaintableBlock(Blocks.CARPET, BlockCarpet.COLOR);
registerDisposableBlock("dirt"); // Vanilla
registerDisposableBlock("sand"); // Vanilla
registerDisposableBlock("gravel"); // Vanilla
@@ -306,7 +311,7 @@ public final class BotaniaAPI {
public static void registerDisposableBlock(String oreDictName) {
disposableBlocks.add(oreDictName);
}
/**
* Registers a Block as semi disposable using its Ore Dictionary Name.
* This means it will not be trashed when sneaking.
@@ -314,7 +319,7 @@ public final class BotaniaAPI {
public static void registerSemiDisposableBlock(String oreDictName) {
semiDisposableBlocks.add(oreDictName);
}
/**
* Registers a paintableBlock and returns it.
* You must also provide the PropertyEnum that this block uses to express its color
@@ -331,7 +336,7 @@ public final class BotaniaAPI {
public static void blacklistEntityFromGravityRod(Class<? extends Entity> entity) {
gravityRodBlacklist.add(entity);
}
/**
* Checks if the provided Entity is contained in the Blacklist.
* Pass in the class for the Entity, e.g. entity.getClass()
@@ -339,7 +344,7 @@ public final class BotaniaAPI {
public static boolean isEntityBlacklistedFromGravityRod(Class entity) {
return gravityRodBlacklist.contains(entity);
}
/**
* Blacklists an item from being pulled by the Ring of Magnetization.
* Short.MAX_VALUE can be used as the stack's damage for a wildcard.
@@ -361,11 +366,11 @@ public final class BotaniaAPI {
public static boolean isItemBlacklistedFromMagnet(ItemStack stack) {
return isItemBlacklistedFromMagnet(stack, 0);
}
public static boolean isItemBlacklistedFromMagnet(ItemStack stack, int recursion) {
if(recursion > 5)
return false;
if(stack.getItemDamage() != Short.MAX_VALUE) {
ItemStack copy = new ItemStack(stack.getItem(), 0, Short.MAX_VALUE);
boolean general = isItemBlacklistedFromMagnet(copy, recursion + 1);
@@ -388,7 +393,7 @@ public final class BotaniaAPI {
public static boolean isBlockBlacklistedFromMagnet(Block block, int meta, int recursion) {
if(recursion >= 5)
return false;
if(meta != Short.MAX_VALUE) {
boolean general = isBlockBlacklistedFromMagnet(block, Short.MAX_VALUE, recursion + 1);
if(general)
@@ -490,16 +495,26 @@ public final class BotaniaAPI {
/**
* Registers a Elven Trade recipe (throw an item in an Alfheim Portal).
* @param output The ItemStack to return.
* @param outputs The ItemStacks to return.
* @param inputs The items required, can be ItemStack or ore dictionary entry string.
* @return The recipe created.
*/
public static RecipeElvenTrade registerElvenTradeRecipe(ItemStack output, Object... inputs) {
RecipeElvenTrade recipe = new RecipeElvenTrade(output, inputs);
public static RecipeElvenTrade registerElvenTradeRecipe(ItemStack[] outputs, Object... inputs) {
RecipeElvenTrade recipe = new RecipeElvenTrade(outputs, inputs);
elvenTradeRecipes.add(recipe);
return recipe;
}
/**
* Registers a Elven Trade recipe (throw an item into an Alfeim Portal).
* @param output The ItemStack to return
* @param inputs The items required, can be an ItemStack or an Ore Dictionary entry string.
* @return The recipe created.
*/
public static RecipeElvenTrade registerElvenTradeRecipe(ItemStack output, Object... inputs) {
return registerElvenTradeRecipe(new ItemStack[]{ output }, inputs);
}
/**
* Registers a Brew Recipe (for the Botanical Brewery).
* @param brew The brew in to be set in this recipe.
@@ -11,11 +11,10 @@
package vazkii.botania.api.boss;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.BossInfo;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import vazkii.botania.api.internal.ShaderCallback;
import java.awt.*;
import java.util.UUID;
@@ -63,4 +62,20 @@ public interface IBotaniaBoss {
*/
public UUID getBossInfoUuid();
/**
* The Shader Program to use for this boss's bar. Return 0 case
* you don't want a shader to be used. You can use separate shaders
* for the background and foreground.
* @param background True if rendering the background of the boss bar,
* false if rendering the bar itself that shows the HP.
* @return OpenGL program ID of the shader to use
*/
public int getBossBarShaderProgram(boolean background);
/**
* A callback for the shader, used to pass in uniforms. Return null for no callback.
* @return a ShaderCallback to use. If getBossBarShaderProgram returns an invalid shader the result of this method is ignored.
*/
public ShaderCallback getBossBarShaderCallback(boolean background, int shader);
}
@@ -1,38 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Oct 29, 2014, 6:13:21 PM (GMT)]
*/
package vazkii.botania.api.boss;
import vazkii.botania.api.internal.ShaderCallback;
/**
* A Botania boss whose HP bar makes use of shaders. Shaders
* used through this have a few uniforms available:
* <li><b><i>int</i> time</b> - The amount of total ticks elapsed.</li>
* <li><b><i>int</i> startX</b> - The U coordinate passed in for the render of this bar's texture.</li>
* <li><b><i>int</i> startY</b> - The V coordinate passed in for the render of this bar's texture.</li>
*/
public interface IBotaniaBossWithShader extends IBotaniaBoss {
/**
* The Shader Program to use for this boss bar. Return 0 case
* you don't want a shader to be used. You can use separate shaders
* for the background and foreground.
* @param background True if rendering the background of the boss bar,
* false if rendering the bar itself that shows the HP.
*/
public int getBossBarShaderProgram(boolean background);
/**
* A callback for the shader, used to pass in uniforms. Return null for no callback.
*/
public ShaderCallback getBossBarShaderCallback(boolean background, int shader);
}
@@ -10,8 +10,8 @@
package vazkii.botania.api.corporea;
public class CorporeaRequest {
public Object matcher;
public boolean checkNBT;
public final Object matcher;
public final boolean checkNBT;
public int count;
public int foundItems = 0;
public int extractedItems = 0;
@@ -23,9 +23,7 @@ public class DummyManaNetwork implements IManaNetwork {
public static final DummyManaNetwork instance = new DummyManaNetwork();
@Override
public void clear() {
// NO-OP
}
public void clear() {}
@Override
public TileEntity getClosestPool(BlockPos pos, World world, int limit) {
@@ -25,7 +25,6 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.items.IItemHandlerModifiable;
import vazkii.botania.api.boss.IBotaniaBoss;
import vazkii.botania.api.corporea.IWrappedInventory;
import vazkii.botania.api.corporea.InvWithLocation;
import vazkii.botania.api.lexicon.LexiconPage;
@@ -122,7 +121,7 @@ public class DummyMethodHandler implements IInternalMethodHandler {
@Override
public ItemStack getSubTileAsStack(String subTile) {
return new ItemStack(Blocks.stone, 0, 0);
return new ItemStack(Blocks.STONE, 0, 0);
}
@Override
@@ -151,29 +150,21 @@ public class DummyMethodHandler implements IInternalMethodHandler {
}
@Override
public void drawSimpleManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res) {
// NO-OP
}
public void drawSimpleManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res) {}
@Override
public void drawComplexManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res, ItemStack bindDisplay, boolean properlyBound) {
// NO-OP
}
public void drawComplexManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res, ItemStack bindDisplay, boolean properlyBound) {}
@Override
public ItemStack getBindDisplayForFlowerType(SubTileEntity e) {
return new ItemStack(Blocks.stone, 0, 0);
return new ItemStack(Blocks.STONE, 0, 0);
}
@Override
public void renderLexiconText(int x, int y, int width, int height, String unlocalizedText) {
// NO-OP
}
public void renderLexiconText(int x, int y, int width, int height, String unlocalizedText) {}
@Override
public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m) {
// NO-OP
}
public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m) {}
@Override
public IInventory getBaublesInventory(EntityPlayer player) {
@@ -206,9 +197,7 @@ public class DummyMethodHandler implements IInternalMethodHandler {
}
@Override
public void breakOnAllCursors(EntityPlayer player, Item item, ItemStack stack, BlockPos pos, EnumFacing side) {
// NO-OP
}
public void breakOnAllCursors(EntityPlayer player, Item item, ItemStack stack, BlockPos pos, EnumFacing side) {}
@Override
public boolean hasSolegnoliaAround(Entity e) {
@@ -226,9 +215,7 @@ public class DummyMethodHandler implements IInternalMethodHandler {
}
@Override
public void sendBaubleUpdatePacket(EntityPlayer player, int slot) {
// NO-OP
}
public void sendBaubleUpdatePacket(EntityPlayer player, int slot) {}
@Override
public List<IWrappedInventory> wrapInventory(List<InvWithLocation> inventories) {
@@ -27,8 +27,6 @@ public class DummyPage extends LexiconPage {
@Override
@SideOnly(Side.CLIENT)
public void renderScreen(IGuiLexiconEntry gui, int x, int y) {
// NO-OP
}
public void renderScreen(IGuiLexiconEntry gui, int x, int y) {}
}
@@ -26,7 +26,6 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.items.IItemHandlerModifiable;
import vazkii.botania.api.boss.IBotaniaBoss;
import vazkii.botania.api.corporea.IWrappedInventory;
import vazkii.botania.api.corporea.InvWithLocation;
import vazkii.botania.api.lexicon.LexiconPage;
@@ -10,24 +10,20 @@
*/
package vazkii.botania.api.internal;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import java.util.List;
import net.minecraft.world.WorldServer;
public final class VanillaPacketDispatcher {
public static void dispatchTEToNearbyPlayers(TileEntity tile) {
World world = tile.getWorld();
List players = world.playerEntities;
for(Object player : players)
if(player instanceof EntityPlayerMP) {
EntityPlayerMP mp = (EntityPlayerMP) player;
if(pointDistancePlane(mp.posX, mp.posZ, tile.getPos().getX() + 0.5, tile.getPos().getZ() + 0.5) < 64)
((EntityPlayerMP) player).playerNetServerHandler.sendPacket(tile.getDescriptionPacket());
}
IBlockState state = tile.getWorld().getBlockState(tile.getPos());
tile.getWorld().notifyBlockUpdate(tile.getPos(), state, state, 8);
}
public static void dispatchTEToNearbyPlayers(World world, BlockPos pos) {
@@ -13,6 +13,7 @@ package vazkii.botania.api.item;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.MathHelper;
/**
* A Bauble Item that implements this will be have hooks to render something on
@@ -34,24 +35,67 @@ public interface IBaubleRender {
/**
* A few helper methods for the render.
*/
public static class Helper {
final class Helper {
/**
* Rotates the render for a bauble correctly if the player is sneaking.
* Use for renders under {@link RenderType#BODY}.
*/
public static void rotateIfSneaking(EntityPlayer player) {
if(player.isSneaking())
applySneakingRotation();
}
/**
* Rotates the render for a bauble correctly for a sneaking player.
* Use for renders under {@link RenderType#BODY}.
*/
public static void applySneakingRotation() {
GlStateManager.rotate(28.64789F, 1.0F, 0.0F, 0.0F);
GlStateManager.translate(0F, 0.2F, 0F);
GlStateManager.rotate(90F / (float) Math.PI, 1.0F, 0.0F, 0.0F);
}
/**
* Shifts the render for a bauble correctly to the head, including sneaking rotation.
* Use for renders under {@link RenderType#HEAD}.
*/
public static void translateToHeadLevel(EntityPlayer player) {
GlStateManager.translate(0, -player.getDefaultEyeHeight() + (player.isSneaking() ? 0.25 : 0), 0);
GlStateManager.translate(0, -player.getDefaultEyeHeight(), 0);
if (player.isSneaking())
GlStateManager.translate(0.25F * MathHelper.sin(player.rotationPitch * (float) Math.PI / 180), 0.25F * MathHelper.cos(player.rotationPitch * (float) Math.PI / 180), 0F);
}
/**
* Shifts the render for a bauble correctly to the face.
* Use for renders under {@link RenderType#HEAD}, and usually after calling {@link Helper#translateToHeadLevel(EntityPlayer)}.
*/
public static void translateToFace() {
GlStateManager.rotate(90F, 0F, 1F, 0F);
GlStateManager.rotate(180F, 1F, 0F, 0F);
GlStateManager.translate(0f, -4.35f, -1.27f);
}
/**
* Scales down the render to a correct size.
* Use for any render.
*/
public static void defaultTransforms() {
GlStateManager.translate(0.0, 3.0, 1.0);
GlStateManager.scale(0.55, 0.55, 0.55);
}
/**
* Shifts the render for a bauble correctly to the chest.
* Use for renders under {@link RenderType#BODY}, and usually after calling {@link Helper#rotateIfSneaking(EntityPlayer)}.
*/
public static void translateToChest() {
GlStateManager.rotate(180F, 1F, 0F, 0F);
GlStateManager.translate(0F, -3.2F, -0.85F);
}
}
public static enum RenderType {
enum RenderType {
/**
* Render Type for the player's body, translations apply on the player's rotation.
* Sneaking is not handled and should be done during the render.
@@ -61,7 +105,7 @@ public interface IBaubleRender {
/**
* Render Type for the player's body, translations apply on the player's head rotations.
* Sneaking is not handled and should be done during the render.~
* Sneaking is not handled and should be done during the render.
* @see IBaubleRender.Helper
*/
HEAD;
@@ -1,26 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jan 18, 2015, 12:20:44 AM (GMT)]
*/
package vazkii.botania.api.item;
import net.minecraft.item.EnumDyeColor;
/**
* Used to define a Mana Pool that can be dyed through floral powder.
*/
public interface IDyablePool {
public EnumDyeColor getColor();
public void setColor(EnumDyeColor color);
}
@@ -1,28 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Apr 30, 2015, 1:43:17 PM (GMT)]
*/
package vazkii.botania.api.item;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
/**
* An extension of IWireframeCoordinateListProvider that allows for
* rendering a single thicker wireframe.
*/
public interface IExtendedWireframeCoordinateListProvider extends IWireframeCoordinateListProvider {
/**
* Gets the source wireframe to draw, this one will be drawn thicker.
*/
public BlockPos getSourceWireframe(EntityPlayer player, ItemStack stack);
}
@@ -23,7 +23,7 @@ public interface IFloatingFlower {
public void setIslandType(IslandType type);
public class IslandType {
private static HashMap<String, IslandType> registry = new HashMap<>();
private static final HashMap<String, IslandType> registry = new HashMap<>();
public static final IslandType GRASS = new IslandType("GRASS");
public static final IslandType PODZOL = new IslandType("PODZOL");
@@ -9,7 +9,7 @@
* File Created @ [17/11/2015, 20:10:53 (GMT)]
*/
package vazkii.botania.api.item;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import vazkii.botania.api.subtile.SubTileEntity;
@@ -20,9 +20,15 @@ import vazkii.botania.api.subtile.SubTileEntity;
public interface IFlowerPlaceable {
/**
* Gets the block to be placed, return null to not place anything.
* Gets the state to be placed, return null to not place anything.
*/
public Block getBlockToPlaceByFlower(ItemStack stack, SubTileEntity flower, BlockPos pos);
public IBlockState getBlockToPlaceByFlower(ItemStack stack, SubTileEntity flower, BlockPos pos);
/**
* Called after the block is placed.
* @param stack The stack that was placed.
* @param flower The flower doing the placing.
* @param pos The position that was placed at.
*/
public void onBlockPlacedByFlower(ItemStack stack, SubTileEntity flower, BlockPos pos);
}
@@ -11,7 +11,7 @@
package vazkii.botania.api.item;
import net.minecraft.world.World;
/**
* A BiomeGenBase that implements this will not have Botania flowers generated.
* A Biome that implements this will not have Botania flowers generated.
*/
public interface IFlowerlessBiome {
/**
@@ -22,7 +22,7 @@ public interface IManaDissolvable {
/**
* Called for every tick the item is on a mana pool. If the stack has stack
* size 0 the item is killed. This is called in both the server and client.
* size 0 the item is killed. This is called serverside.
*/
public void onDissolveTick(IManaPool pool, ItemStack stack, EntityItem item);
@@ -29,4 +29,12 @@ public interface IWireframeCoordinateListProvider {
*/
public List<BlockPos> getWireframesToDraw(EntityPlayer player, ItemStack stack);
/**
* Gets a wireframe to draw thicker than the rest.
* This is useful to indicate the precedence of some position over the others.
* @return The position of a single wireframe to draw thicker than all the others.
*/
public BlockPos getSourceWireframe(EntityPlayer player, ItemStack stack);
}
@@ -12,6 +12,7 @@ package vazkii.botania.api.lexicon;
import net.minecraft.util.ResourceLocation;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
@@ -70,7 +71,7 @@ public class LexiconCategory implements Comparable<LexiconCategory> {
}
@Override
public int compareTo(LexiconCategory category) {
public int compareTo(@Nonnull LexiconCategory category) {
return priority == category.priority ? sortingId - category.sortingId : category.priority - priority;
}
}
@@ -16,6 +16,7 @@ import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import vazkii.botania.api.BotaniaAPI;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -27,11 +28,11 @@ public class LexiconEntry implements Comparable<LexiconEntry> {
private KnowledgeType type = BotaniaAPI.basicKnowledge;
public List<LexiconPage> pages = new ArrayList<>();
public final List<LexiconPage> pages = new ArrayList<>();
private boolean priority = false;
private ItemStack icon = null;
private List<ItemStack> extraDisplayedRecipes = new ArrayList<>();
private final List<ItemStack> extraDisplayedRecipes = new ArrayList<>();
/**
* @param unlocalizedName The unlocalized name of this entry. This will be localized by the client display.
@@ -159,7 +160,7 @@ public class LexiconEntry implements Comparable<LexiconEntry> {
}
@Override
public int compareTo(LexiconEntry o) {
public int compareTo(@Nonnull LexiconEntry o) {
return getNameForSorting().compareTo(o.getNameForSorting());
}
@@ -40,9 +40,7 @@ public abstract class LexiconPage {
* Called per update tick. Non gui-sensitive version, kept for backwards compatibility only.
*/
@SideOnly(Side.CLIENT)
public void updateScreen() {
// NO-OP
}
public void updateScreen() {}
/**
* Called per update tick. Feel free to override fully, the
@@ -58,41 +56,31 @@ public abstract class LexiconPage {
* You can add buttons and whatever you'd do on initGui() here.
*/
@SideOnly(Side.CLIENT)
public void onOpened(IGuiLexiconEntry gui) {
// NO-OP
}
public void onOpened(IGuiLexiconEntry gui) {}
/**
* Called when this page is opened, be it via closing the gui or when the player changes page.
* Make sure to dispose of anything you don't use any more, such as buttons in the gui's buttonList.
*/
@SideOnly(Side.CLIENT)
public void onClosed(IGuiLexiconEntry gui) {
// NO-OP
}
public void onClosed(IGuiLexiconEntry gui) {}
/**
* Called when a button is pressed, equivalent to GuiScreen.actionPerformed.
*/
@SideOnly(Side.CLIENT)
public void onActionPerformed(IGuiLexiconEntry gui, GuiButton button) {
// NO-OP
}
public void onActionPerformed(IGuiLexiconEntry gui, GuiButton button) {}
/**
* Called when a key is pressed.
*/
@SideOnly(Side.CLIENT)
public void onKeyPressed(char c, int key) {
// NO-OP
}
public void onKeyPressed(char c, int key) {}
/**
* Called when {@link LexiconEntry#setLexiconPages(LexiconPage...)} is called.
*/
public void onPageAdded(LexiconEntry entry, int index) {
// NO-OP
}
public void onPageAdded(LexiconEntry entry, int index) {}
/**
* Shows the list of recipes present in this page for display in the category
@@ -11,6 +11,7 @@
package vazkii.botania.api.lexicon;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import vazkii.botania.api.mana.IManaItem;
import java.util.HashMap;
@@ -23,7 +24,7 @@ import java.util.Map;
*/
public final class LexiconRecipeMappings {
private static Map<String, EntryData> mappings = new HashMap<>();
private static final Map<String, EntryData> mappings = new HashMap<>();
/**
* Maps the given stack to the given page of the entry.
@@ -47,21 +48,28 @@ public final class LexiconRecipeMappings {
}
public static EntryData getDataForStack(ItemStack stack) {
String wildKey = stackToString(stack, true);
if (mappings.containsKey(wildKey))
return mappings.get(wildKey);
return mappings.get(stackToString(stack));
}
public static String stackToString(ItemStack stack) {
return stackToString(stack, false);
}
public static String stackToString(ItemStack stack, boolean forceIgnore) {
if(stack == null || stack.getItem() == null)
return "NULL";
if(stack.hasTagCompound() && stack.getItem() instanceof IRecipeKeyProvider)
return ((IRecipeKeyProvider) stack.getItem()).getKey(stack);
return stack.getUnlocalizedName() + (ignoreMeta(stack) ? "" : "~" + stack.getItemDamage());
return stack.getUnlocalizedName() + (forceIgnore || ignoreMeta(stack) ? "" : "~" + stack.getItemDamage());
}
public static boolean ignoreMeta(ItemStack stack) {
return stack.isItemStackDamageable() || stack.getItem() instanceof IManaItem;
return stack.isItemStackDamageable() || stack.getItem() instanceof IManaItem || stack.getItemDamage() == OreDictionary.WILDCARD_VALUE;
}
public static class EntryData {
@@ -29,14 +29,14 @@ import java.util.Map;
*/
public class Multiblock {
public List<MultiblockComponent> components = new ArrayList<>();
public List<ItemStack> materials = new ArrayList<>();
public final List<MultiblockComponent> components = new ArrayList<>();
public final List<ItemStack> materials = new ArrayList<>();
public BlockPos minPos = BlockPos.ORIGIN;
public BlockPos maxPos = BlockPos.ORIGIN;
public BlockPos offPos = BlockPos.ORIGIN;
public HashMap<BlockPos, MultiblockComponent> locationCache = new HashMap<>();
public final HashMap<BlockPos, MultiblockComponent> locationCache = new HashMap<>();
/**
* Adds a multiblock component to this multiblock. The component's x y z
@@ -27,7 +27,7 @@ public class MultiblockComponent {
protected BlockPos relPos;
protected final IBlockState state;
protected final TileEntity tileEntity;
private boolean doFancyRender;
private final boolean doFancyRender;
public MultiblockComponent(BlockPos relPos, IBlockState state) {
this(relPos, state, null);
@@ -17,8 +17,32 @@ package vazkii.botania.api.mana;
*/
public interface IDirectioned {
/**
* @return The X rotation, in degrees
*/
public float getRotationX();
/**
* @return The Y rotation, in degrees
*/
public float getRotationY();
/**
* Set the X rotation
* @param rot X rotation, in degrees
*/
public void setRotationX(float rot);
/**
* Set the Y rotation
* @param rot Y rotation, in degrees
*/
public void setRotationY(float rot);
/**
* This should be called after rotation setting is done to allow
* for the block to re-calculate.
*/
public void commitRedirection();
}
@@ -1,23 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jun 19, 2015, 10:05:24 PM (GMT)]
*/
package vazkii.botania.api.mana;
import java.util.UUID;
/**
* This interface marks a TileEntity that can be identified through
* an UUID. This UUID must presist between sessions.
*/
public interface IIdentifiable {
public UUID getIdentifier();
}
@@ -10,12 +10,16 @@
*/
package vazkii.botania.api.mana;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
/**
* Any TileEntity that implements this can be counted as a "ghost" block of
* Any Block that implements this can be counted as a "ghost" block of
* sorts, that won't call the collision code for the mana bursts.
*/
public interface IManaCollisionGhost {
public boolean isGhost();
public boolean isGhost(IBlockState state, World world, BlockPos pos);
}
@@ -10,6 +10,8 @@
*/
package vazkii.botania.api.mana;
import net.minecraft.item.EnumDyeColor;
/**
* Any TileEntity that implements this is considered a Mana Pool,
* by which nearby functional flowers will pull mana from it.<br>
@@ -27,4 +29,15 @@ public interface IManaPool extends IManaReceiver {
*/
public boolean isOutputtingPower();
/**
* @return The color of this pool.
*/
public EnumDyeColor getColor();
/**
* Sets the color of this pool.
* @param color The color to set.
*/
public void setColor(EnumDyeColor color);
}
@@ -18,7 +18,7 @@ import java.util.UUID;
* This describes an interface of a Mana Sender block that should be able to pingbackable
* by a burst to tell it that the burst is still alive.
*/
public interface IPingable extends IIdentifiable {
public interface IPingable {
/**
* Pings this object back, telling it that the burst passed in is still alive
@@ -28,4 +28,9 @@ public interface IPingable extends IIdentifiable {
*/
public void pingback(IManaBurst burst, UUID expectedIdentity);
/**
* @return A unique and persistent identifier for this IPingable
*/
public UUID getIdentifier();
}
@@ -1,29 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [15/11/2015, 19:28:18 (GMT)]
*/
package vazkii.botania.api.mana;
/**
* This is an extension of IDirectioned for TileEntities
* that allow for their rotation to be public and modifiable outside.
* This is used in botania for the Redirective mana lens.
*/
public interface IRedirectable extends IDirectioned {
public void setRotationX(float rot);
public void setRotationY(float rot);
/**
* This should be called after rotation setting is done to allow
* for the block to re-calculate.
*/
public void commitRedirection();
}
@@ -0,0 +1,39 @@
/**
* This class was created by <Flaxbeard>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Jul 25, 2016, 9:02:12 PM (GMT)]
*/
package vazkii.botania.api.mana;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.Event;
public class ManaDiscountEvent extends Event {
private final EntityPlayer entityPlayer;
private float discount;
public ManaDiscountEvent(EntityPlayer entityPlayer, float discount) {
this.entityPlayer = entityPlayer;
this.discount = discount;
}
public EntityPlayer getEntityPlayer() {
return entityPlayer;
}
public float getDiscount() {
return discount;
}
public void setDiscount(float discount) {
this.discount = discount;
}
}
@@ -13,6 +13,7 @@ package vazkii.botania.api.mana;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import vazkii.botania.api.BotaniaAPI;
public final class ManaItemHandler {
@@ -145,7 +146,7 @@ public final class ManaItemHandler {
if(stack.getItem() instanceof IManaItem && !((IManaItem) stack.getItem()).canExportManaToItem(stack, stackInSlot))
continue;
int received = 0;
int received;
if(manaItemSlot.getMana(stackInSlot) + manaToSend <= manaItemSlot.getMaxMana(stackInSlot))
received = manaToSend;
else received = manaToSend - (manaItemSlot.getMana(stackInSlot) + manaToSend - manaItemSlot.getMaxMana(stackInSlot));
@@ -249,6 +250,10 @@ public final class ManaItemHandler {
if(armor != null && armor.getItem() instanceof IManaDiscountArmor)
discount += ((IManaDiscountArmor) armor.getItem()).getDiscount(armor, i, player);
}
ManaDiscountEvent event = new ManaDiscountEvent(player, discount);
MinecraftForge.EVENT_BUS.post(event);
discount = event.getDiscount();
return discount;
}
@@ -1,4 +1,4 @@
@API(owner = "Botania", apiVersion = "78", provides = "BotaniaAPI")
@API(owner = "Botania", apiVersion = "79", provides = "BotaniaAPI")
package vazkii.botania.api;
import net.minecraftforge.fml.common.API;
@@ -106,7 +106,7 @@ public class RecipeBrew {
public ItemStack getOutput(ItemStack stack) {
if(stack == null || !(stack.getItem() instanceof IBrewContainer))
return new ItemStack(Items.glass_bottle); // Fallback...
return new ItemStack(Items.GLASS_BOTTLE); // Fallback...
IBrewContainer container = (IBrewContainer) stack.getItem();
return container.getItemForBrew(brew, stack);
@@ -9,11 +9,11 @@ import java.util.List;
public class RecipeElvenTrade {
private final ItemStack output;
private final ImmutableList<ItemStack> outputs;
private final ImmutableList<Object> inputs;
public RecipeElvenTrade(ItemStack output, Object... inputs) {
this.output = output;
public RecipeElvenTrade(ItemStack[] outputs, Object... inputs) {
this.outputs = ImmutableList.copyOf(outputs);
ImmutableList.Builder<Object> inputsToSet = ImmutableList.builder();
for(Object obj : inputs) {
@@ -88,8 +88,8 @@ public class RecipeElvenTrade {
return inputs;
}
public ItemStack getOutput() {
return output;
public List<ItemStack> getOutputs() {
return outputs;
}
}
@@ -22,7 +22,8 @@ public final class BotaniaSoundEvents {
public static final SoundEvent divaCharm = getRegisteredSoundEvent("botania:divaCharm");
public static final SoundEvent divinationRod = getRegisteredSoundEvent("botania:divinationRod");
public static final SoundEvent doit = getRegisteredSoundEvent("botania:doit");
public static final SoundEvent enchanterBlock = getRegisteredSoundEvent("botania:enchanterBlock");
public static final SoundEvent enchanterFade = getRegisteredSoundEvent("botania:enchanterForm");
public static final SoundEvent enchanterForm = getRegisteredSoundEvent("botania:enchanterFade");
public static final SoundEvent enchanterEnchant = getRegisteredSoundEvent("botania:enchanterEnchant");
public static final SoundEvent endoflame = getRegisteredSoundEvent("botania:endoflame");
public static final SoundEvent equipBauble = getRegisteredSoundEvent("botania:equipBauble");
@@ -54,7 +55,7 @@ public final class BotaniaSoundEvents {
public static final SoundEvent gaiaMusic2 = getRegisteredSoundEvent("botania:music.gaia2");
private static SoundEvent getRegisteredSoundEvent(String name) {
return SoundEvent.soundEventRegistry.getObject(new ResourceLocation(name));
return SoundEvent.REGISTRY.getObject(new ResourceLocation(name));
}
private BotaniaSoundEvents() {}
@@ -30,14 +30,11 @@ import vazkii.botania.api.state.enums.CratePattern;
import vazkii.botania.api.state.enums.CrateVariant;
import vazkii.botania.api.state.enums.CustomBrickVariant;
import vazkii.botania.api.state.enums.DrumVariant;
import vazkii.botania.api.state.enums.EndBrickVariant;
import vazkii.botania.api.state.enums.FutureStoneVariant;
import vazkii.botania.api.state.enums.LivingRockVariant;
import vazkii.botania.api.state.enums.LivingWoodVariant;
import vazkii.botania.api.state.enums.LuminizerVariant;
import vazkii.botania.api.state.enums.PlatformVariant;
import vazkii.botania.api.state.enums.PoolVariant;
import vazkii.botania.api.state.enums.PrismarineVariant;
import vazkii.botania.api.state.enums.PylonVariant;
import vazkii.botania.api.state.enums.QuartzVariant;
import vazkii.botania.api.state.enums.SpreaderVariant;
@@ -90,18 +87,6 @@ public final class BotaniaStateProps {
/** Properties for individual blocks **/
// Block18Stone
public static final PropertyEnum<FutureStoneVariant> FUTURESTONE_VARIANT = PropertyEnum.create("variant", FutureStoneVariant.class);
// Block18StoneWall
public static final PropertyEnum<FutureStoneVariant> FUTURESTONEWALL_VARIANT = PropertyEnum.create("fswall_variant", FutureStoneVariant.class, new Predicate<FutureStoneVariant>() {
@Override
public boolean apply(FutureStoneVariant variant) {
// Just the four kinds (no polished, chiseled, etc.)
return variant.ordinal() >= 0 && variant.ordinal() <= 3;
}
});
// BlockAlfPortal
public static final PropertyEnum<AlfPortalState> ALFPORTAL_STATE = PropertyEnum.create("state", AlfPortalState.class);
@@ -134,9 +119,6 @@ public final class BotaniaStateProps {
// BlockEnchanter
public static final PropertyEnum<EnumFacing.Axis> ENCHANTER_DIRECTION = PropertyEnum.create("facing", EnumFacing.Axis.class, Predicates.not(Predicates.equalTo(EnumFacing.Axis.Y)));
// BlockEndStoneBrick
public static final PropertyEnum<EndBrickVariant> ENDBRICK_VARIANT = PropertyEnum.create("variant", EndBrickVariant.class);
// BlockForestDrum
public static final PropertyEnum<DrumVariant> DRUM_VARIANT = PropertyEnum.create("variant", DrumVariant.class);
@@ -188,9 +170,6 @@ public final class BotaniaStateProps {
// BlockPrism
public static final PropertyBool HAS_LENS = PropertyBool.create("has_lens");
// BlockPrismarine
public static final PropertyEnum<PrismarineVariant> PRISMARINE_VARIANT = PropertyEnum.create("variant", PrismarineVariant.class);
// BlockPylon
public static final PropertyEnum<PylonVariant> PYLON_VARIANT = PropertyEnum.create("variant", PylonVariant.class);
@@ -1,26 +0,0 @@
/**
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
package vazkii.botania.api.state.enums;
import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum EndBrickVariant implements IStringSerializable {
END_STONE_BRICKS,
CHISELED_END_STONE_BRICKS,
ENDER_BRICKS,
PILLAR_ENDER_BRICKS;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -1,38 +0,0 @@
/**
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
package vazkii.botania.api.state.enums;
import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum FutureStoneVariant implements IStringSerializable {
ANDESITE,
BASALT,
DIORITE,
GRANITE,
POLISHED_ANDESITE,
POLISHED_BASALT,
POLISHED_DIORITE,
POLISHED_GRANITE,
ANDESITE_BRICK,
BASALT_BRICK,
DIORITE_BRICK,
GRANITE_BRICK,
CHISELED_ANDESITE,
CHISELED_BASALT,
CHISELED_DIORITE,
CHISELED_GRANITE;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -1,25 +0,0 @@
/**
* This class was created by <williewillus>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
package vazkii.botania.api.state.enums;
import net.minecraft.util.IStringSerializable;
import java.util.Locale;
public enum PrismarineVariant implements IStringSerializable {
PRISMARINE,
PRISMARINE_BRICKS,
DARK_PRISMARINE;
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
}
@@ -52,6 +52,14 @@ public class SubTileEntity {
public static final String TAG_TYPE = "type";
public static final String TAG_TICKS_EXISTED = "ticksExisted";
public final BlockPos getPos() {
return supertile.getPos();
}
public final World getWorld() {
return supertile.getWorld();
}
public void setSupertile(TileEntity tile) {
supertile = tile;
}
@@ -120,9 +128,7 @@ public class SubTileEntity {
/**
* Called when this sub tile is placed in the world (by an entity).
*/
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack) {
// NO-OP
}
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase entity, ItemStack stack) {}
/**
* Called when a player right clicks this sub tile.
@@ -132,16 +138,12 @@ public class SubTileEntity {
/**
* Called when this sub tile is added to the world.
*/
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
//NO-OP
}
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {}
/**
* Called when this sub tile is harvested
*/
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
//NO-OP
}
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player) {}
/**
* Allows additional processing of sub tile drops
@@ -201,15 +203,13 @@ public class SubTileEntity {
* Used to render a HUD portraying some data from this sub tile.
*/
@SideOnly(Side.CLIENT)
public void renderHUD(Minecraft mc, ScaledResolution res) {
// NO-OP
}
public void renderHUD(Minecraft mc, ScaledResolution res) {}
/**
* Gets the light value for this SubTileEntity, this is a int (-1 to default to the flower)
*/
public int getLightValue() {
return -1;
return 0;
}
/**
@@ -12,6 +12,7 @@ package vazkii.botania.api.subtile;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -19,7 +20,8 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.internal.IManaNetwork;
import vazkii.botania.api.mana.IManaPool;
@@ -32,7 +34,7 @@ import java.awt.*;
*/
public class SubTileFunctional extends SubTileEntity {
public static final int RANGE = 10;
public static final int LINK_RANGE = 10;
private static final String TAG_MANA = "mana";
@@ -115,7 +117,7 @@ public class SubTileFunctional extends SubTileEntity {
IManaNetwork network = BotaniaAPI.internalHandler.getManaNetworkInstance();
int size = network.getAllPoolsInWorld(supertile.getWorld()).size();
if(BotaniaAPI.internalHandler.shouldForceCheck() || size != sizeLastCheck) {
linkedPool = network.getClosestPool(supertile.getPos(), supertile.getWorld(), RANGE);
linkedPool = network.getClosestPool(supertile.getPos(), supertile.getWorld(), LINK_RANGE);
sizeLastCheck = size;
}
}
@@ -211,9 +213,10 @@ public class SubTileFunctional extends SubTileEntity {
return linkedPool != null && linkedPool.hasWorldObj() && !linkedPool.isInvalid() && supertile.getWorld().isBlockLoaded(linkedPool.getPos(), false) && supertile.getWorld().getTileEntity(linkedPool.getPos()) == linkedPool;
}
@SideOnly(Side.CLIENT)
@Override
public void renderHUD(Minecraft mc, ScaledResolution res) {
String name = I18n.translateToLocal("tile.botania:flower." + getUnlocalizedName() + ".name");
String name = I18n.format("tile.botania:flower." + getUnlocalizedName() + ".name");
int color = getColor();
BotaniaAPI.internalHandler.drawComplexManaHUD(color, knownMana, getMaxMana(), name, res, BotaniaAPI.internalHandler.getBindDisplayForFlowerType(this), isValidBinding());
}
@@ -14,6 +14,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
@@ -23,8 +24,9 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.translation.I18n;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.internal.IManaNetwork;
import vazkii.botania.api.mana.IManaCollector;
@@ -38,7 +40,7 @@ import java.util.List;
*/
public class SubTileGenerating extends SubTileEntity {
public static final int RANGE = 6;
public static final int LINK_RANGE = 6;
private static final String TAG_MANA = "mana";
@@ -102,9 +104,9 @@ public class SubTileGenerating extends SubTileEntity {
if(passive && muhBalance > 0 && passiveDecayTicks > muhBalance) {
IBlockState state = supertile.getWorld().getBlockState(supertile.getPos());
supertile.getWorld().playAuxSFX(2001, supertile.getPos(), Block.getStateId(state));
supertile.getWorld().playEvent(2001, supertile.getPos(), Block.getStateId(state));
if(supertile.getWorld().getBlockState(supertile.getPos().down()).isSideSolid(supertile.getWorld(), supertile.getPos().down(), EnumFacing.UP))
supertile.getWorld().setBlockState(supertile.getPos(), Blocks.deadbush.getDefaultState());
supertile.getWorld().setBlockState(supertile.getPos(), Blocks.DEADBUSH.getDefaultState());
else supertile.getWorld().setBlockToAir(supertile.getPos());
}
}
@@ -140,7 +142,7 @@ public class SubTileGenerating extends SubTileEntity {
IManaNetwork network = BotaniaAPI.internalHandler.getManaNetworkInstance();
int size = network.getAllCollectorsInWorld(supertile.getWorld()).size();
if(BotaniaAPI.internalHandler.shouldForceCheck() || size != sizeLastCheck) {
linkedCollector = network.getClosestCollector(supertile.getPos(), supertile.getWorld(), RANGE);
linkedCollector = network.getClosestCollector(supertile.getPos(), supertile.getWorld(), LINK_RANGE);
sizeLastCheck = size;
}
}
@@ -302,9 +304,10 @@ public class SubTileGenerating extends SubTileEntity {
return linkedCollector != null && !linkedCollector.isInvalid() && supertile.getWorld().getTileEntity(linkedCollector.getPos()) == linkedCollector;
}
@SideOnly(Side.CLIENT)
@Override
public void renderHUD(Minecraft mc, ScaledResolution res) {
String name = I18n.translateToLocal("tile.botania:flower." + getUnlocalizedName() + ".name");
String name = I18n.format("tile.botania:flower." + getUnlocalizedName() + ".name");
int color = getColor();
BotaniaAPI.internalHandler.drawComplexManaHUD(color, knownMana, getMaxMana(), name, res, BotaniaAPI.internalHandler.getBindDisplayForFlowerType(this), isValidBinding());
}
@@ -37,8 +37,6 @@ public abstract class SubTileSignature {
/**
* Adds additional text to the tooltip. This text is added after getUnlocalizedLoreTextForStack.
*/
public void addTooltip(ItemStack stack, EntityPlayer player, List<String> tooltip) {
// NO-OP
}
public void addTooltip(ItemStack stack, EntityPlayer player, List<String> tooltip) {}
}
@@ -14,6 +14,8 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
/**
* Any block that implements this has a HUD rendered when being hovered
@@ -21,6 +23,7 @@ import net.minecraft.world.World;
*/
public interface IWandHUD {
@SideOnly(Side.CLIENT)
public void renderHUD(Minecraft mc, ScaledResolution res, World world, BlockPos pos);
}
@@ -23,7 +23,7 @@ public class WikiHooks {
private static final Map<String, IWikiProvider> modWikis = new HashMap<>();
public static IWikiProvider getWikiFor(Block block) {
ResourceLocation mod = Block.blockRegistry.getNameForObject(block);
ResourceLocation mod = Block.REGISTRY.getNameForObject(block);
return getWikiFor(mod == null ? "" : mod.getResourceDomain().toLowerCase());
}
@@ -17,7 +17,7 @@ public enum EnumChallengeLevel {
HARD("botania.challengelevel.hard"),
LUNATIC("botania.challengelevel.lunatic");
String name;
final String name;
private EnumChallengeLevel(String name) {
this.name = name;
@@ -34,26 +34,26 @@ public final class ModChallenges {
challenges.put(level, new ArrayList<>());
addChallenge(EnumChallengeLevel.EASY, "flowerFarm", new ItemStack(ModBlocks.flower, 1, 6));
addChallenge(EnumChallengeLevel.EASY, "recordFarm", new ItemStack(Items.record_13));
addChallenge(EnumChallengeLevel.EASY, "reedFarm", new ItemStack(Items.reeds));
addChallenge(EnumChallengeLevel.EASY, "cobbleGen", new ItemStack(Blocks.cobblestone));
addChallenge(EnumChallengeLevel.EASY, "recordFarm", new ItemStack(Items.RECORD_13));
addChallenge(EnumChallengeLevel.EASY, "reedFarm", new ItemStack(Items.REEDS));
addChallenge(EnumChallengeLevel.EASY, "cobbleGen", new ItemStack(Blocks.COBBLESTONE));
addChallenge(EnumChallengeLevel.EASY, "pureDaisy", ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_PUREDAISY));
addChallenge(EnumChallengeLevel.EASY, "battery", new ItemStack(ModBlocks.pool));
addChallenge(EnumChallengeLevel.NORMAL, "apothecaryRefill", new ItemStack(ModBlocks.altar));
addChallenge(EnumChallengeLevel.NORMAL, "treeFarm", new ItemStack(Blocks.sapling));
addChallenge(EnumChallengeLevel.NORMAL, "fullCropFarm", new ItemStack(Items.wheat_seeds));
addChallenge(EnumChallengeLevel.NORMAL, "animalFarm", new ItemStack(Items.leather));
addChallenge(EnumChallengeLevel.NORMAL, "boneMealFarm", new ItemStack(Items.dye, 1, 15));
addChallenge(EnumChallengeLevel.NORMAL, "treeFarm", new ItemStack(Blocks.SAPLING));
addChallenge(EnumChallengeLevel.NORMAL, "fullCropFarm", new ItemStack(Items.WHEAT_SEEDS));
addChallenge(EnumChallengeLevel.NORMAL, "animalFarm", new ItemStack(Items.LEATHER));
addChallenge(EnumChallengeLevel.NORMAL, "boneMealFarm", new ItemStack(Items.DYE, 1, 15));
addChallenge(EnumChallengeLevel.NORMAL, "orechid", ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_ORECHID));
addChallenge(EnumChallengeLevel.HARD, "mobTower", new ItemStack(Items.bone));
addChallenge(EnumChallengeLevel.HARD, "mobTower", new ItemStack(Items.BONE));
addChallenge(EnumChallengeLevel.HARD, "entropinnyumSetup", ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_ENTROPINNYUM));
addChallenge(EnumChallengeLevel.HARD, "spectrolusSetup", ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_SPECTROLUS));
addChallenge(EnumChallengeLevel.HARD, "potionBrewer", new ItemStack(ModBlocks.brewery));
addChallenge(EnumChallengeLevel.LUNATIC, "kekimurusSetup", ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_KEKIMURUS));
addChallenge(EnumChallengeLevel.LUNATIC, "autoQuarry", new ItemStack(Items.diamond_pickaxe));
addChallenge(EnumChallengeLevel.LUNATIC, "autoQuarry", new ItemStack(Items.DIAMOND_PICKAXE));
addChallenge(EnumChallengeLevel.LUNATIC, "runeCrafter", new ItemStack(ModItems.rune));
}
@@ -33,11 +33,13 @@ import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.equipment.armor.terrasteel.ItemTerrasteelHelm;
import javax.annotation.Nonnull;
public final class BaubleRenderHandler implements LayerRenderer<EntityPlayer> {
@Override
public void doRenderLayer(EntityPlayer player, 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(!ConfigHandler.renderBaubles || player.getActivePotionEffect(MobEffects.invisibility) != null)
public void doRenderLayer(@Nonnull EntityPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
if(!ConfigHandler.renderBaubles || player.getActivePotionEffect(MobEffects.INVISIBILITY) != null)
return;
InventoryBaubles inv = PlayerHandler.getPlayerBaubles(player);
@@ -106,7 +108,7 @@ public final class BaubleRenderHandler implements LayerRenderer<EntityPlayer> {
ItemStack stack = player.inventory.getStackInSlot(i);
if(stack != null && stack.getItem() == ModItems.manaTablet) {
GlStateManager.pushMatrix();
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
Helper.rotateIfSneaking(player);
boolean armor = player.getItemStackFromSlot(EntityEquipmentSlot.LEGS) != null;
GlStateManager.rotate(90, 0, 1, 0);
@@ -11,38 +11,35 @@
package vazkii.botania.client.core.handler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.lwjgl.opengl.ARBShaderObjects;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.boss.IBotaniaBoss;
import vazkii.botania.api.boss.IBotaniaBossWithShader;
import vazkii.botania.api.internal.ShaderCallback;
import vazkii.botania.client.core.helper.RenderHelper;
import vazkii.botania.client.core.helper.ShaderHelper;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.core.helper.MathHelper;
import java.awt.*;
import java.util.HashSet;
import java.util.Collections;
import java.util.Set;
import java.util.UUID;
import java.util.WeakHashMap;
public final class BossBarHandler {
private BossBarHandler() {}
// Only access on the client thread!
public static final Set<IBotaniaBoss> bosses = new HashSet<>();
public static final Set<IBotaniaBoss> bosses = Collections.newSetFromMap(new WeakHashMap<>());
public static final ResourceLocation defaultBossBar = new ResourceLocation(LibResources.GUI_BOSS_BAR);
private static final BarCallback barUniformCallback = new BarCallback();
@SubscribeEvent
public void onBarRender(RenderGameOverlayEvent.BossInfo evt) {
public static void onBarRender(RenderGameOverlayEvent.BossInfo evt) {
UUID infoUuid = evt.getBossInfo().getUniqueId();
for(IBotaniaBoss currentBoss : bosses) {
if(currentBoss.getBossInfoUuid().equals(infoUuid)) {
@@ -75,13 +72,12 @@ public final class BossBarHandler {
}
private static void drawBar(IBotaniaBoss currentBoss, int x, int y, int u, int v, int w, int h, boolean bg) {
boolean useShader = currentBoss instanceof IBotaniaBossWithShader;
if(useShader) {
IBotaniaBossWithShader shader = (IBotaniaBossWithShader) currentBoss;
int program = shader.getBossBarShaderProgram(bg);
ShaderCallback callback = program == 0 ? null : shader.getBossBarShaderCallback(bg, program);
barUniformCallback.set(u, v, callback);
int program = currentBoss.getBossBarShaderProgram(bg);
boolean useShader = program > 0;
if(useShader) {
ShaderCallback callback = currentBoss.getBossBarShaderCallback(bg, program);
barUniformCallback.set(u, v, callback);
ShaderHelper.useShader(program, barUniformCallback);
}
@@ -22,8 +22,8 @@ public class BotaniaPlayerController extends PlayerControllerMP implements IExte
private float distance = 0F;
public BotaniaPlayerController(Minecraft p_i45062_1_, NetHandlerPlayClient p_i45062_2_) {
super(p_i45062_1_, p_i45062_2_);
public BotaniaPlayerController(Minecraft mc, NetHandlerPlayClient netHandler) {
super(mc, netHandler);
}
@Override
@@ -30,7 +30,6 @@ import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.wrapper.CombinedInvWrapper;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.item.IExtendedWireframeCoordinateListProvider;
import vazkii.botania.api.item.IWireframeCoordinateListProvider;
import vazkii.botania.api.wand.ICoordBoundItem;
import vazkii.botania.api.wand.IWireframeAABBProvider;
@@ -40,10 +39,12 @@ import java.util.List;
public final class BoundTileRenderer {
private BoundTileRenderer() {}
@SubscribeEvent
public void onWorldRenderLast(RenderWorldLastEvent event) {
public static void onWorldRenderLast(RenderWorldLastEvent event) {
GlStateManager.pushMatrix();
GL11.glPushAttrib(GL11.GL_LIGHTING);
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
GlStateManager.disableDepth();
GlStateManager.disableTexture2D();
GlStateManager.enableBlend();
@@ -77,11 +78,9 @@ public final class BoundTileRenderer {
for(BlockPos coords : coordsList)
renderBlockOutlineAt(coords, color);
if(stackInSlot.getItem() instanceof IExtendedWireframeCoordinateListProvider) {
BlockPos coords = ((IExtendedWireframeCoordinateListProvider) stackInSlot.getItem()).getSourceWireframe(player, stackInSlot);
if(coords != null && coords.getY() > -1)
renderBlockOutlineAt(coords, color, 5F);
}
BlockPos coords = provider.getSourceWireframe(player, stackInSlot);
if(coords != null && coords.getY() > -1)
renderBlockOutlineAt(coords, color, 5F);
}
}
@@ -92,11 +91,11 @@ public final class BoundTileRenderer {
GlStateManager.popMatrix();
}
private void renderBlockOutlineAt(BlockPos pos, int color) {
private static void renderBlockOutlineAt(BlockPos pos, int color) {
renderBlockOutlineAt(pos, color, 1F);
}
private void renderBlockOutlineAt(BlockPos pos, int color, float thickness) {
private static void renderBlockOutlineAt(BlockPos pos, int color, float thickness) {
double renderPosX, renderPosY, renderPosZ;
try {
@@ -143,7 +142,7 @@ public final class BoundTileRenderer {
GlStateManager.popMatrix();
}
private void renderBlockOutline(AxisAlignedBB aabb) {
private static void renderBlockOutline(AxisAlignedBB aabb) {
Tessellator tessellator = Tessellator.getInstance();
double ix = aabb.minX;
@@ -2,9 +2,10 @@ package vazkii.botania.client.core.handler;
import com.google.common.base.Throwables;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import vazkii.botania.common.Botania;
import vazkii.botania.common.lib.LibObfuscation;
import java.lang.invoke.MethodHandle;
@@ -16,10 +17,7 @@ public final class ClientMethodHandles {
public static final MethodHandle
renderPosX_getter, renderPosY_getter, renderPosZ_getter, // RenderManager
farPlaneDistance_getter,
hurtCameraEffect, setupViewBobbing, getFOVModifier,
enableLightmap, disableLightmap; // EntityRenderer
//prevEquippedProgress_getter, equippedProgress_getter; // ItemRenderer
starGLCallList_getter, starVBO_getter, glSkyList_getter, skyVBO_getter; // RenderGlobal
static {
try {
@@ -35,39 +33,23 @@ public final class ClientMethodHandles {
f.setAccessible(true);
renderPosZ_getter = MethodHandles.publicLookup().unreflectGetter(f);
f = ReflectionHelper.findField(EntityRenderer.class, LibObfuscation.FAR_PLANE_DISTANCE);
f = ReflectionHelper.findField(RenderGlobal.class, LibObfuscation.STAR_GL_CALL_LIST);
f.setAccessible(true);
farPlaneDistance_getter = MethodHandles.publicLookup().unreflectGetter(f);
starGLCallList_getter = MethodHandles.publicLookup().unreflectGetter(f);
Method m = ReflectionHelper.findMethod(EntityRenderer.class, null, LibObfuscation.HURT_CAMERA_EFFECT, float.class);
m.setAccessible(true);
hurtCameraEffect = MethodHandles.publicLookup().unreflect(m);
f = ReflectionHelper.findField(RenderGlobal.class, LibObfuscation.STAR_VBO);
f.setAccessible(true);
starVBO_getter = MethodHandles.publicLookup().unreflectGetter(f);
m = ReflectionHelper.findMethod(EntityRenderer.class, null, LibObfuscation.SETUP_VIEW_BOBBING, float.class);
m.setAccessible(true);
setupViewBobbing = MethodHandles.publicLookup().unreflect(m);
f = ReflectionHelper.findField(RenderGlobal.class, LibObfuscation.GL_SKY_LIST);
f.setAccessible(true);
glSkyList_getter = MethodHandles.publicLookup().unreflectGetter(f);
m = ReflectionHelper.findMethod(EntityRenderer.class, null, LibObfuscation.ENABLE_LIGHTMAP);
m.setAccessible(true);
enableLightmap = MethodHandles.publicLookup().unreflect(m);
m = ReflectionHelper.findMethod(EntityRenderer.class, null, LibObfuscation.DISABLE_LIGHTMAP);
m.setAccessible(true);
disableLightmap = MethodHandles.publicLookup().unreflect(m);
m = ReflectionHelper.findMethod(EntityRenderer.class, null, LibObfuscation.GET_FOV_MODIFIER, float.class, boolean.class);
m.setAccessible(true);
getFOVModifier = MethodHandles.publicLookup().unreflect(m);
// f = ReflectionHelper.findField(ItemRenderer.class, LibObfuscation.PREV_EQUIPPED_PROGRESS);
// f.setAccessible(true);
// prevEquippedProgress_getter = MethodHandles.publicLookup().unreflectGetter(f);
//
// f = ReflectionHelper.findField(ItemRenderer.class, LibObfuscation.EQUIPPED_PROGRESS);
// f.setAccessible(true);
// equippedProgress_getter = MethodHandles.publicLookup().unreflectGetter(f);
f = ReflectionHelper.findField(RenderGlobal.class, LibObfuscation.SKY_VBO);
f.setAccessible(true);
skyVBO_getter = MethodHandles.publicLookup().unreflectGetter(f);
} catch (IllegalAccessException e) {
FMLLog.severe("[Botania]: Couldn't initialize client methodhandles! Things will be broken!");
Botania.LOGGER.fatal("Couldn't initialize client methodhandles! Things will be broken!");
e.printStackTrace();
throw Throwables.propagate(e);
}
@@ -21,7 +21,6 @@ import net.minecraftforge.fml.common.gameevent.TickEvent.Phase;
import net.minecraftforge.fml.common.gameevent.TickEvent.RenderTickEvent;
import vazkii.botania.api.mana.IManaCollector;
import vazkii.botania.api.mana.TileSignature;
import vazkii.botania.client.core.handler.LightningHandler.LightningBolt;
import vazkii.botania.client.gui.lexicon.GuiLexicon;
import vazkii.botania.common.block.subtile.functional.SubTileVinculotus;
import vazkii.botania.common.block.tile.corporea.TileCorporeaIndex;
@@ -29,7 +28,9 @@ import vazkii.botania.common.core.handler.ManaNetworkHandler;
import vazkii.botania.common.core.helper.PlayerHelper;
import vazkii.botania.common.item.ModItems;
public class ClientTickHandler {
public final class ClientTickHandler {
private ClientTickHandler() {}
public static int ticksWithLexicaOpen = 0;
public static int pageFlipTicks = 0;
@@ -38,26 +39,24 @@ public class ClientTickHandler {
public static float delta = 0;
public static float total = 0;
private void calcDelta() {
private static void calcDelta() {
float oldTotal = total;
total = ticksInGame + partialTicks;
delta = total - oldTotal;
}
@SubscribeEvent
public void renderTick(RenderTickEvent event) {
public static void renderTick(RenderTickEvent event) {
if(event.phase == Phase.START)
partialTicks = event.renderTickTime;
else {
TooltipAdditionDisplayHandler.render();
calcDelta();
}
}
@SubscribeEvent
public void clientTickEnd(ClientTickEvent event) {
public static void clientTickEnd(ClientTickEvent event) {
if(event.phase == Phase.END) {
LightningBolt.update();
RedStringRenderer.tick();
ItemsRemainingRenderHandler.tick();
@@ -5,24 +5,35 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.color.BlockColors;
import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.client.renderer.color.ItemColors;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fml.common.registry.RegistryDelegate;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.brew.Brew;
import vazkii.botania.api.brew.IBrewItem;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.api.state.enums.PoolVariant;
import vazkii.botania.api.state.enums.SpreaderVariant;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.BlockCamo;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.tile.TileCamo;
import vazkii.botania.common.item.IColorable;
import vazkii.botania.common.block.tile.mana.TilePool;
import vazkii.botania.common.entity.EntityManaBurst;
import vazkii.botania.common.item.ItemManaGun;
import vazkii.botania.common.item.ItemManaMirror;
import vazkii.botania.common.item.ItemManaTablet;
import vazkii.botania.common.item.ItemSignalFlare;
import vazkii.botania.common.item.ItemTwigWand;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.equipment.bauble.ItemBloodPendant;
import vazkii.botania.common.item.equipment.tool.terrasteel.ItemTerraPick;
import vazkii.botania.common.item.lens.ItemLens;
import java.awt.*;
import java.util.Map;
@@ -34,29 +45,21 @@ public final class ColorHandler {
Map<RegistryDelegate<Block>, IBlockColor> map = ReflectionHelper.getPrivateValue(BlockColors.class, blocks, "blockColorMap");
// Steal vine colorer
blocks.registerBlockColorHandler(map.get(Blocks.vine.delegate), ModBlocks.solidVines);
blocks.registerBlockColorHandler(map.get(Blocks.VINE.delegate), ModBlocks.solidVines);
// 16 colors
blocks.registerBlockColorHandler(
new IBlockColor() {
@Override
public int colorMultiplier(IBlockState state, IBlockAccess p_186720_2_, BlockPos pos, int tintIndex) {
return state.getValue(BotaniaStateProps.COLOR).getMapColor().colorValue;
}
},
(state, world, pos, tintIndex) -> state.getValue(BotaniaStateProps.COLOR).getMapColor().colorValue,
ModBlocks.specialFlower, ModBlocks.manaBeacon, ModBlocks.petalBlock, ModBlocks.unstableBlock);
// Pool
blocks.registerBlockColorHandler(
new IBlockColor() {
@Override
public int colorMultiplier(IBlockState state, IBlockAccess p_186720_2_, BlockPos pos, int tintIndex) {
if (state.getValue(BotaniaStateProps.POOL_VARIANT) == PoolVariant.FABULOUS) {
float time = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
return Color.getHSBColor(time * 0.005F, 0.6F, 1F).hashCode();
} else {
return 16777215;
}
(state, world, pos, tintIndex) -> {
if (state.getValue(BotaniaStateProps.POOL_VARIANT) == PoolVariant.FABULOUS) {
float time = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
return Color.HSBtoRGB(time * 0.005F, 0.6F, 1F);
} else {
return state.getValue(BotaniaStateProps.COLOR).getMapColor().colorValue;
}
},
ModBlocks.pool
@@ -64,50 +67,97 @@ public final class ColorHandler {
// Spreader
blocks.registerBlockColorHandler(
new IBlockColor() {
@Override
public int colorMultiplier(IBlockState state, IBlockAccess p_186720_2_, BlockPos pos, int tintIndex) {
if(state.getValue(BotaniaStateProps.SPREADER_VARIANT) != SpreaderVariant.GAIA)
return 0xFFFFFF;
float time = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
return Color.getHSBColor((time * 5) % 360 / 360F, 0.4F, 0.9F).hashCode();
}
(state, world, pos, tintIndex) -> {
if(state.getValue(BotaniaStateProps.SPREADER_VARIANT) != SpreaderVariant.GAIA)
return 0xFFFFFF;
float time = ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks;
return Color.HSBtoRGB((time * 5) % 360 / 360F, 0.4F, 0.9F);
},
ModBlocks.spreader
);
// Platforms
blocks.registerBlockColorHandler(
new IBlockColor() {
@Override
public int colorMultiplier(IBlockState state, IBlockAccess world, BlockPos pos, int tintIndex) {
(state, world, pos, tintIndex) -> {
if (world != null && pos != null) {
TileEntity tile = world.getTileEntity(pos);
if(tile instanceof TileCamo) {
TileCamo camo = (TileCamo) tile;
IBlockState camoState = camo.camoState;
if(camoState != null)
return camoState.getBlock() instanceof BlockCamo ? 0xFFFFFF : Minecraft.getMinecraft().getBlockColors().colorMultiplier(camoState, world, pos, tintIndex);
return camoState.getBlock() instanceof BlockCamo
? 0xFFFFFF
: Minecraft.getMinecraft().getBlockColors().colorMultiplier(camoState, world, pos, tintIndex);
}
return 0xFFFFFF;
}
return 0xFFFFFF;
}, ModBlocks.platform);
ItemColors items = Minecraft.getMinecraft().getItemColors();
items.registerItemColorHandler(new IItemColor() {
@Override
public int getColorFromItemstack(ItemStack stack, int tintIndex) {
Item item = stack.getItem();
if (item instanceof IColorable) {
return ((IColorable) item).getColorFromItemStack(stack, tintIndex);
} else {
return 0xFFFFFF;
}
}
}, ModItems.manaResource, ModItems.twigWand, ModItems.dye, ModItems.petal, ModItems.manaGun, ModItems.manaMirror, ModItems.manaTablet, ModItems.signalFlare,
ModItems.spellCloth, ModItems.brewFlask, ModItems.brewVial, ModItems.incenseStick, ModItems.bloodPendant, ModItems.enderDagger,
ModItems.terraPick, ModItems.lens, Item.getItemFromBlock(ModBlocks.manaBeacon), Item.getItemFromBlock(ModBlocks.petalBlock),
Item.getItemFromBlock(ModBlocks.unstableBlock), Item.getItemFromBlock(ModBlocks.pool), Item.getItemFromBlock(ModBlocks.spreader));
items.registerItemColorHandler((s, t) -> (s.getItemDamage() == 5 || s.getItemDamage() == 14)
? Color.HSBtoRGB(Botania.proxy.getWorldElapsedTicks() * 2 % 360 / 360F, 0.25F, 1F) : -1,
ModItems.manaResource);
items.registerItemColorHandler((s, t) ->
t == 1 ? EnumDyeColor.byMetadata(ItemTwigWand.getColor1(s)).getMapColor().colorValue
: t == 2 ? EnumDyeColor.byMetadata(ItemTwigWand.getColor2(s)).getMapColor().colorValue
: -1,
ModItems.twigWand);
items.registerItemColorHandler((s, t) -> EnumDyeColor.byMetadata(s.getItemDamage()).getMapColor().colorValue, ModItems.dye, ModItems.petal);
items.registerItemColorHandler((s, t) -> Minecraft.getMinecraft().getBlockColors().colorMultiplier(((ItemBlock)s.getItem()).block.getStateFromMeta(s.getMetadata()), null, null, t),
ModBlocks.manaBeacon, ModBlocks.petalBlock, ModBlocks.unstableBlock, ModBlocks.pool, ModBlocks.spreader);
items.registerItemColorHandler((s, t) -> t == 1 ? Color.HSBtoRGB(0.528F, ((ItemManaMirror) ModItems.manaMirror).getMana(s) / TilePool.MAX_MANA, 1F) : -1, ModItems.manaMirror);
items.registerItemColorHandler((s, t) -> t == 1 ? Color.HSBtoRGB(0.528F, ((ItemManaTablet) ModItems.manaTablet).getMana(s) / ItemManaTablet.MAX_MANA, 1F) : -1, ModItems.manaTablet);
items.registerItemColorHandler((s, t) -> t == 1 ? EnumDyeColor.byMetadata(ItemSignalFlare.getColor(s)).getMapColor().colorValue : -1, ModItems.signalFlare);
items.registerItemColorHandler((s, t) -> Color.HSBtoRGB(0.55F, ((float) s.getMaxDamage() - (float) s.getItemDamage()) / s.getMaxDamage() * 0.5F, 1F), ModItems.spellCloth);
items.registerItemColorHandler((s, t) -> {
if(t != 1)
return -1;
Brew brew = ((IBrewItem) s.getItem()).getBrew(s);
if(brew == BotaniaAPI.fallbackBrew)
return s.getItem() instanceof ItemBloodPendant ? 0xC6000E : 0x989898;
Color color = new Color(brew.getColor(s));
double speed = s.getItem() == ModItems.brewFlask || s.getItem() == ModItems.brewVial ? 0.1 : 0.2;
int add = (int) (Math.sin(ClientTickHandler.ticksInGame * speed) * 24);
int r = Math.max(0, Math.min(255, color.getRed() + add));
int g = Math.max(0, Math.min(255, color.getGreen() + add));
int b = Math.max(0, Math.min(255, color.getBlue() + add));
return r << 16 | g << 8 | b;
}, ModItems.bloodPendant, ModItems.incenseStick, ModItems.brewFlask, ModItems.brewVial);
items.registerItemColorHandler((s, t) -> {
ItemStack lens = ItemManaGun.getLens(s);
if(lens != null && t == 0)
return Minecraft.getMinecraft().getItemColors().getColorFromItemstack(lens, t);
if(t == 2) {
EntityManaBurst burst = ((ItemManaGun) s.getItem()).getBurst(Minecraft.getMinecraft().thePlayer, s, false);
Color color = new Color(burst == null ? 0x20FF20 : burst.getColor());
float mul = (float) (Math.sin((double) ClientTickHandler.ticksInGame / 5) * 0.15F);
int c = (int) (255 * mul);
return new Color(Math.max(0, Math.min(255, color.getRed() + c)), Math.max(0, Math.min(255, color.getGreen() + c)), Math.max(0, Math.min(255, color.getBlue() + c))).getRGB();
} else return -1;
}, ModItems.manaGun);
items.registerItemColorHandler((s, t) -> t == 1 ? Color.HSBtoRGB(0.75F, 1F, 1.5F - (float) Math.min(1F, Math.sin(System.currentTimeMillis() / 100D) * 0.5 + 1.2F)) : -1, ModItems.enderDagger);
items.registerItemColorHandler((s, t) -> t == 1 && ItemTerraPick.isEnabled(s) ? Color.HSBtoRGB(0.375F, (float) Math.min(1F, Math.sin(System.currentTimeMillis() / 200D) * 0.5 + 1F), 1F) : -1, ModItems.terraPick);
items.registerItemColorHandler((s, t) -> t == 0 ? ((ItemLens) s.getItem()).getLensColor(s) : -1, ModItems.lens);
}
private ColorHandler() {}
@@ -19,17 +19,20 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EnumPlayerModelParts;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.FMLLog;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.BotaniaAPIClient;
import vazkii.botania.api.item.IBaubleRender.Helper;
import vazkii.botania.api.subtile.signature.SubTileSignature;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.client.core.helper.ShaderHelper;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.core.version.VersionChecker;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
import javax.annotation.Nonnull;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
@@ -42,10 +45,10 @@ public final class ContributorFancinessHandler implements LayerRenderer<EntityPl
public volatile static Map<String, ItemStack> flowerMap = null;
private volatile static boolean startedLoading = false;
public static final boolean phi = false;
private static final boolean phi = false;
@Override
public void doRenderLayer(EntityPlayer player, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) {
public void doRenderLayer(@Nonnull EntityPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
String name = player.getDisplayName().getUnformattedText();
float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialTicks;
@@ -96,9 +99,7 @@ public final class ContributorFancinessHandler implements LayerRenderer<EntityPl
throw new NumberFormatException();
flowerMap.put(key, new ItemStack(ModBlocks.flower, 1, i));
} catch(NumberFormatException e) {
SubTileSignature sig = BotaniaAPI.getSignatureForName(value);
if(sig != null)
flowerMap.put(key, ItemBlockSpecialFlower.ofType(value));
flowerMap.put(key, ItemBlockSpecialFlower.ofType(value));
}
}
}
@@ -111,7 +112,7 @@ public final class ContributorFancinessHandler implements LayerRenderer<EntityPl
float f2 = icon.getMinV();
float f3 = icon.getMaxV();
Helper.translateToHeadLevel(player);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
GlStateManager.color(1F, 1F, 1F, 1F);
GlStateManager.rotate(90F, 0F, 1F, 0F);
GlStateManager.translate(0, 1.62, 0);
@@ -145,7 +146,7 @@ public final class ContributorFancinessHandler implements LayerRenderer<EntityPl
GlStateManager.rotate(90F, 0F, 1F, 0F);
GlStateManager.rotate(180F, 1F, 0F, 0F);
GlStateManager.translate(-0.4F, 0.1F, -0.25F);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
GlStateManager.rotate(90F, 0F, 1F, 0F);
GlStateManager.scale(0.4F, 0.4F, 0.4F);
GlStateManager.translate(-1F, -3.5F, 0.125F);
@@ -166,7 +167,7 @@ public final class ContributorFancinessHandler implements LayerRenderer<EntityPl
GlStateManager.rotate(90F, 0F, 1F, 0F);
GlStateManager.scale(0.4F, 0.4F, 0.4F);
GlStateManager.translate(-0.5F, 1.6F, 0F);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
IconHelper.renderIconIn3D(Tessellator.getInstance(), f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 1F / 16F);
GlStateManager.popMatrix();
}
@@ -175,7 +176,7 @@ public final class ContributorFancinessHandler implements LayerRenderer<EntityPl
private static void renderFlower(EntityPlayer player, ItemStack flower) {
GlStateManager.pushMatrix();
Helper.translateToHeadLevel(player);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
GlStateManager.rotate(180, 0, 0, 1);
GlStateManager.translate(0, -0.85, 0);
GlStateManager.rotate(-90, 0, 1, 0);
@@ -204,7 +205,7 @@ public final class ContributorFancinessHandler implements LayerRenderer<EntityPl
load(props);
}
} catch (IOException e) {
FMLLog.info("[Botania] Could not load contributors list. Either you're offline or github is down. Nothing to worry about, carry on~");
Botania.LOGGER.info("Could not load contributors list. Either you're offline or github is down. Nothing to worry about, carry on~");
}
VersionChecker.doneChecking = true;
}
@@ -26,6 +26,7 @@ import org.lwjgl.input.Keyboard;
import vazkii.botania.api.corporea.CorporeaHelper;
import vazkii.botania.common.lib.LibObfuscation;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -39,13 +40,13 @@ public class CorporeaAutoCompleteHandler {
private List<CompletionData> completions = new ArrayList<>();
private int position;
static TreeSet<String> itemNames = new TreeSet<>(String::compareToIgnoreCase);
static final TreeSet<String> itemNames = new TreeSet<>(String::compareToIgnoreCase);
private boolean tabLastTick = false;
public static void updateItemList() {
itemNames.clear();
Iterator<Item> iterator = Item.itemRegistry.iterator();
Iterator<Item> iterator = Item.REGISTRY.iterator();
ArrayList<ItemStack> curList = new ArrayList<>();
while(iterator.hasNext()) {
@@ -164,8 +165,8 @@ public class CorporeaAutoCompleteHandler {
private static class CompletionData implements Comparable<CompletionData> {
private String string;
private int prefixLength;
private final String string;
private final int prefixLength;
public CompletionData(String string, int prefixLength) {
this.string = string;
@@ -173,7 +174,7 @@ public class CorporeaAutoCompleteHandler {
}
@Override
public int compareTo(CompletionData arg0) {
public int compareTo(@Nonnull CompletionData arg0) {
return string.compareTo(arg0.string);
}
}
@@ -10,12 +10,17 @@
*/
package vazkii.botania.client.core.handler;
import com.google.common.base.Optional;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.lwjgl.opengl.ARBFragmentShader;
import org.lwjgl.opengl.ContextCapabilities;
@@ -27,17 +32,20 @@ import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.core.handler.ManaNetworkHandler;
import vazkii.botania.common.lib.LibMisc;
import java.util.Map;
import java.util.UUID;
public final class DebugHandler {
private DebugHandler() {}
private static final String PREFIX = TextFormatting.GREEN + "[Botania] " + TextFormatting.RESET;
@SubscribeEvent
public void onDrawDebugText(RenderGameOverlayEvent.Text event) {
public static void onDrawDebugText(RenderGameOverlayEvent.Text event) {
World world = Minecraft.getMinecraft().theWorld;
if(Minecraft.getMinecraft().gameSettings.showDebugInfo) {
event.getLeft().add(null);
event.getLeft().add("");
String version = LibMisc.VERSION;
if(version.contains("GRADLE"))
version = "N/A";
@@ -68,7 +76,24 @@ public final class DebugHandler {
event.getLeft().add(" GL_ARB_multitexture: " + caps.GL_ARB_multitexture);
event.getLeft().add(" GL_ARB_texture_non_power_of_two: " + caps.GL_ARB_texture_non_power_of_two);
event.getLeft().add(" OpenGL13: " + caps.OpenGL13);
} else if(Minecraft.isRunningOnMac)
if (Minecraft.getMinecraft().objectMouseOver != null
&& Minecraft.getMinecraft().objectMouseOver.getBlockPos() != null) {
BlockPos pos = Minecraft.getMinecraft().objectMouseOver.getBlockPos();
IBlockState state = world.getBlockState(pos);
state = state.getActualState(world, pos);
state = state.getBlock().getExtendedState(state, world, pos);
if (state instanceof IExtendedBlockState) {
try {
for (Map.Entry<IUnlistedProperty<?>, Optional<?>> e : ((IExtendedBlockState) state).getUnlistedProperties().entrySet()) {
event.getRight().add(TextFormatting.LIGHT_PURPLE + e.getKey().getName() + ": " + TextFormatting.RESET + e.getValue().orNull());
}
} catch (Throwable t) {
event.getRight().add("Error getting extended state");
}
}
}
} else if(Minecraft.IS_RUNNING_ON_MAC)
event.getLeft().add(PREFIX + "SHIFT+CMD for context");
else event.getLeft().add(PREFIX + "SHIFT+CTRL for context");
}
@@ -21,6 +21,7 @@ import net.minecraft.client.gui.GuiChat;
import net.minecraft.client.gui.GuiIngame;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
@@ -30,14 +31,12 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.ILexicon;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
@@ -71,10 +70,12 @@ import java.awt.*;
public final class HUDHandler {
private HUDHandler() {}
public static final ResourceLocation manaBar = new ResourceLocation(LibResources.GUI_MANA_HUD);
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onDrawScreenPre(RenderGameOverlayEvent.Pre event) {
public static void onDrawScreenPre(RenderGameOverlayEvent.Pre event) {
Minecraft mc = Minecraft.getMinecraft();
Profiler profiler = mc.mcProfiler;
@@ -91,7 +92,7 @@ public final class HUDHandler {
}
@SubscribeEvent
public void onDrawScreenPost(RenderGameOverlayEvent.Post event) {
public static void onDrawScreenPost(RenderGameOverlayEvent.Post event) {
Minecraft mc = Minecraft.getMinecraft();
Profiler profiler = mc.mcProfiler;
ItemStack main = mc.thePlayer.getHeldItemMainhand();
@@ -137,15 +138,19 @@ public final class HUDHandler {
if(MultiblockRenderHandler.currentMultiblock != null && MultiblockRenderHandler.anchor == null) {
profiler.startSection("multiblockRightClick");
String s = I18n.translateToLocal("botaniamisc.rightClickToAnchor");
String s = I18n.format("botaniamisc.rightClickToAnchor");
mc.fontRendererObj.drawStringWithShadow(s, event.getResolution().getScaledWidth() / 2 - mc.fontRendererObj.getStringWidth(s) / 2, event.getResolution().getScaledHeight() / 2 - 30, 0xFFFFFF);
profiler.endSection();
}
if(main != null && main.getItem() instanceof ItemCraftingHalo) {
profiler.startSection("craftingHalo");
profiler.startSection("craftingHalo_main");
ItemCraftingHalo.renderHUD(event.getResolution(), mc.thePlayer, main);
profiler.endSection();
} else if(offhand != null && offhand.getItem() instanceof ItemCraftingHalo) {
profiler.startSection("craftingHalo_off");
ItemCraftingHalo.renderHUD(event.getResolution(), mc.thePlayer, offhand);
profiler.endSection();
}
if(main != null && main.getItem() instanceof ItemSextant) {
@@ -167,44 +172,47 @@ public final class HUDHandler {
}
profiler.startSection("manaBar");
EntityPlayer player = mc.thePlayer;
int totalMana = 0;
int totalMaxMana = 0;
boolean anyRequest = false;
boolean creative = false;
if(!player.isSpectator()) {
int totalMana = 0;
int totalMaxMana = 0;
boolean anyRequest = false;
boolean creative = false;
IInventory mainInv = player.inventory;
IInventory baublesInv = PlayerHandler.getPlayerBaubles(player);
IInventory mainInv = player.inventory;
IInventory baublesInv = PlayerHandler.getPlayerBaubles(player);
int invSize = mainInv.getSizeInventory();
int size = invSize;
if(baublesInv != null)
size += baublesInv.getSizeInventory();
int invSize = mainInv.getSizeInventory();
int size = invSize;
if(baublesInv != null)
size += baublesInv.getSizeInventory();
for(int i = 0; i < size; i++) {
boolean useBaubles = i >= invSize;
IInventory inv = useBaubles ? baublesInv : mainInv;
ItemStack stack = inv.getStackInSlot(i - (useBaubles ? invSize : 0));
for(int i = 0; i < size; i++) {
boolean useBaubles = i >= invSize;
IInventory inv = useBaubles ? baublesInv : mainInv;
ItemStack stack = inv.getStackInSlot(i - (useBaubles ? invSize : 0));
if(stack != null) {
Item item = stack.getItem();
if(item instanceof IManaUsingItem)
anyRequest = anyRequest || ((IManaUsingItem) item).usesMana(stack);
if(stack != null) {
Item item = stack.getItem();
if(item instanceof IManaUsingItem)
anyRequest = anyRequest || ((IManaUsingItem) item).usesMana(stack);
if(item instanceof IManaItem) {
if(!((IManaItem) item).isNoExport(stack)) {
totalMana += ((IManaItem) item).getMana(stack);
totalMaxMana += ((IManaItem) item).getMaxMana(stack);
if(item instanceof IManaItem) {
if(!((IManaItem) item).isNoExport(stack)) {
totalMana += ((IManaItem) item).getMana(stack);
totalMaxMana += ((IManaItem) item).getMaxMana(stack);
}
}
if(item instanceof ICreativeManaProvider && ((ICreativeManaProvider) item).isCreative(stack))
creative = true;
}
if(item instanceof ICreativeManaProvider && ((ICreativeManaProvider) item).isCreative(stack))
creative = true;
}
}
if(anyRequest)
renderManaInvBar(event.getResolution(), creative, totalMana, totalMaxMana);
if(anyRequest)
renderManaInvBar(event.getResolution(), creative, totalMana, totalMaxMana);
}
profiler.endStartSection("itemsRemaining");
ItemsRemainingRenderHandler.render(event.getResolution(), event.getPartialTicks());
@@ -215,7 +223,7 @@ public final class HUDHandler {
}
}
private void renderWandModeDisplay(ItemStack stack, ScaledResolution res) {
private static void renderWandModeDisplay(ItemStack stack, ScaledResolution res) {
Minecraft mc = Minecraft.getMinecraft();
Profiler profiler = mc.mcProfiler;
@@ -225,7 +233,7 @@ public final class HUDHandler {
if(ticks > 0) {
int alpha = Math.min(255, (int) (ticks * 256.0F / 10.0F));
int color = 0x00CC00 + (alpha << 24);
String disp = I18n.translateToLocal(ItemTwigWand.getModeString(stack));
String disp = I18n.format(ItemTwigWand.getModeString(stack));
int x = res.getScaledWidth() / 2 - mc.fontRendererObj.getStringWidth(disp) / 2;
int y = res.getScaledHeight() - 70;
@@ -238,7 +246,7 @@ public final class HUDHandler {
profiler.endSection();
}
private void renderManaInvBar(ScaledResolution res, boolean hasCreative, int totalMana, int totalMaxMana) {
private static void renderManaInvBar(ScaledResolution res, boolean hasCreative, int totalMana, int totalMaxMana) {
Minecraft mc = Minecraft.getMinecraft();
int width = 182;
int x = res.getScaledWidth() / 2 - width / 2;
@@ -267,46 +275,39 @@ public final class HUDHandler {
GL11.glColor4ub(((byte) 255), ((byte) 255), ((byte) 255), ((byte) 255));
}
private void renderPoolRecipeHUD(ScaledResolution res, TilePool tile, ItemStack stack) {
private static void renderPoolRecipeHUD(ScaledResolution res, TilePool tile, ItemStack stack) {
Minecraft mc = Minecraft.getMinecraft();
Profiler profiler = mc.mcProfiler;
profiler.startSection("poolRecipe");
for(RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) {
if(recipe.matches(stack)) {
if(recipe.getCatalyst() == null || recipe.getCatalyst() == tile.getWorld().getBlockState(tile.getPos().down())) {
int x = res.getScaledWidth() / 2 - 11;
int y = res.getScaledHeight() / 2 + 10;
RecipeManaInfusion recipe = TilePool.getMatchingRecipe(stack, tile.getWorld().getBlockState(tile.getPos().down()));
if(recipe != null) {
int x = res.getScaledWidth() / 2 - 11;
int y = res.getScaledHeight() / 2 + 10;
int u = tile.getCurrentMana() >= recipe.getManaToConsume() ? 0 : 22;
int v = mc.thePlayer.getName().equals("haighyorkie") && mc.thePlayer.isSneaking() ? 23 : 8;
int u = tile.getCurrentMana() >= recipe.getManaToConsume() ? 0 : 22;
int v = mc.thePlayer.getName().equals("haighyorkie") && mc.thePlayer.isSneaking() ? 23 : 8;
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
mc.renderEngine.bindTexture(manaBar);
RenderHelper.drawTexturedModalRect(x, y, 0, u, v, 22, 15);
GlStateManager.color(1F, 1F, 1F, 1F);
mc.renderEngine.bindTexture(manaBar);
RenderHelper.drawTexturedModalRect(x, y, 0, u, v, 22, 15);
GlStateManager.color(1F, 1F, 1F, 1F);
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
mc.getRenderItem().renderItemAndEffectIntoGUI(stack, x - 20, y);
mc.getRenderItem().renderItemAndEffectIntoGUI(recipe.getOutput(), x + 26, y);
mc.getRenderItem().renderItemOverlayIntoGUI(mc.fontRendererObj, recipe.getOutput(), x + 26, y, "");
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
mc.getRenderItem().renderItemAndEffectIntoGUI(stack, x - 20, y);
mc.getRenderItem().renderItemAndEffectIntoGUI(recipe.getOutput(), x + 26, y);
mc.getRenderItem().renderItemOverlayIntoGUI(mc.fontRendererObj, recipe.getOutput(), x + 26, y, "");
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
GlStateManager.disableLighting();
GlStateManager.disableBlend();
break;
}
}
GlStateManager.disableLighting();
GlStateManager.disableBlend();
}
profiler.endSection();
}
private void renderCrystalCubeHUD(ScaledResolution res, TileCorporeaCrystalCube tile) {
private static void renderCrystalCubeHUD(ScaledResolution res, TileCorporeaCrystalCube tile) {
Minecraft mc = Minecraft.getMinecraft();
Profiler profiler = mc.mcProfiler;
@@ -332,7 +333,7 @@ public final class HUDHandler {
profiler.endSection();
}
private void drawLexiconHUD(ItemStack stack, IBlockState state, RayTraceResult pos, ScaledResolution res) {
private static void drawLexiconHUD(ItemStack stack, IBlockState state, RayTraceResult pos, ScaledResolution res) {
Minecraft mc = Minecraft.getMinecraft();
Block block = state.getBlock();
Profiler profiler = mc.mcProfiler;
@@ -354,8 +355,8 @@ public final class HUDHandler {
if(!((ILexicon) stack.getItem()).isKnowledgeUnlocked(stack, entry.getKnowledgeType()))
font = mc.standardGalacticFontRenderer;
drawStr = I18n.translateToLocal(entry.getUnlocalizedName());
secondLine = TextFormatting.ITALIC + I18n.translateToLocal(entry.getTagline());
drawStr = I18n.format(entry.getUnlocalizedName());
secondLine = TextFormatting.ITALIC + I18n.format(entry.getTagline());
draw = true;
}
}
@@ -399,11 +400,11 @@ public final class HUDHandler {
profiler.endSection();
}
private void renderNearIndexDisplay(ScaledResolution res) {
private static void renderNearIndexDisplay(ScaledResolution res) {
Minecraft mc = Minecraft.getMinecraft();
String txt0 = I18n.translateToLocal("botaniamisc.nearIndex0");
String txt1 = TextFormatting.GRAY + I18n.translateToLocal("botaniamisc.nearIndex1");
String txt2 = TextFormatting.GRAY + I18n.translateToLocal("botaniamisc.nearIndex2");
String txt0 = I18n.format("botaniamisc.nearIndex0");
String txt1 = TextFormatting.GRAY + I18n.format("botaniamisc.nearIndex1");
String txt2 = TextFormatting.GRAY + I18n.format("botaniamisc.nearIndex2");
int l = Math.max(mc.fontRendererObj.getStringWidth(txt0), Math.max(mc.fontRendererObj.getStringWidth(txt1), mc.fontRendererObj.getStringWidth(txt2))) + 20;
int x = res.getScaledWidth() - l - 20;
@@ -436,7 +437,7 @@ public final class HUDHandler {
renderManaBar(x, y, color, mana < 0 ? 0.5F : 1F, mana, maxMana);
if(mana < 0) {
String text = I18n.translateToLocal("botaniamisc.statusUnknown");
String text = I18n.format("botaniamisc.statusUnknown");
x = res.getScaledWidth() / 2 - mc.fontRendererObj.getStringWidth(text) / 2;
y -= 1;
mc.fontRendererObj.drawString(text, x, y, color);
@@ -25,8 +25,8 @@ import java.util.regex.Pattern;
public final class ItemsRemainingRenderHandler {
private static int maxTicks = 30;
private static int leaveTicks = 20;
private static final int maxTicks = 30;
private static final int leaveTicks = 20;
private static ItemStack stack;
private static int ticks, count;
@@ -10,50 +10,35 @@
*/
package vazkii.botania.client.core.handler;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.profiler.Profiler;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.lwjgl.opengl.GL11;
import vazkii.botania.client.core.handler.LightningHandler.LightningBolt.Segment;
import vazkii.botania.client.fx.FXLightning;
import vazkii.botania.client.fx.ParticleRenderDispatcher;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.core.helper.Vector3;
import java.awt.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Random;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.ArrayDeque;
import java.util.Deque;
public class LightningHandler {
private LightningHandler() {}
private static final int BATCH_THRESHOLD = 200;
private static final ResourceLocation outsideResource = new ResourceLocation(LibResources.MISC_WISP_LARGE);
private static final ResourceLocation insideResource = new ResourceLocation(LibResources.MISC_WISP_SMALL);
private static Vector3 getRelativeViewVector(Vector3 pos) {
Entity renderEntity = Minecraft.getMinecraft().getRenderViewEntity();
return new Vector3((float) renderEntity.posX - pos.x, (float) renderEntity.posY + renderEntity.getEyeHeight() - pos.y, (float) renderEntity.posZ - pos.z);
}
public static final Deque<FXLightning> queuedLightningBolts = new ArrayDeque<>();
@SubscribeEvent
public void onRenderWorldLast(RenderWorldLastEvent event) {
public static void onRenderWorldLast(RenderWorldLastEvent event) {
Profiler profiler = Minecraft.getMinecraft().mcProfiler;
profiler.startSection("botania-particles");
@@ -82,17 +67,35 @@ public class LightningHandler {
ParticleRenderDispatcher.lightningCount = 0;
render.bindTexture(outsideResource);
int counter = 0;
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR);
for(LightningBolt bolt : LightningBolt.boltlist)
renderBolt(bolt, tessellator, frame, ActiveRenderInfo.getRotationX(), ActiveRenderInfo.getRotationXZ(), ActiveRenderInfo.getRotationZ(), ActiveRenderInfo.getRotationXY(), 0, false);
for (FXLightning bolt : queuedLightningBolts) {
bolt.renderBolt(0, false);
if(counter % BATCH_THRESHOLD == BATCH_THRESHOLD - 1) {
tessellator.draw();
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR);
}
counter++;
}
tessellator.draw();
render.bindTexture(insideResource);
counter = 0;
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR);
for(LightningBolt bolt : LightningBolt.boltlist)
renderBolt(bolt, tessellator, frame, ActiveRenderInfo.getRotationX(), ActiveRenderInfo.getRotationXZ(), ActiveRenderInfo.getRotationZ(), ActiveRenderInfo.getRotationXY(), 1, true);
for (FXLightning bolt : queuedLightningBolts) {
bolt.renderBolt(1, true);
if(counter % BATCH_THRESHOLD == BATCH_THRESHOLD - 1) {
tessellator.draw();
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR);
}
counter++;
}
tessellator.draw();
queuedLightningBolts.clear();
GlStateManager.disableBlend();
GlStateManager.depthMask(true);
@@ -103,386 +106,4 @@ public class LightningHandler {
profiler.endSection();
}
public static void spawnLightningBolt(World world, Vector3 vectorStart, Vector3 vectorEnd, float ticksPerMeter, long seed, int colorOuter, int colorInner) {
LightningBolt bolt = new LightningBolt(world, vectorStart, vectorEnd, ticksPerMeter, seed, colorOuter, colorInner);
bolt.defaultFractal();
bolt.finalizeBolt();
LightningBolt.boltlist.add(bolt);
}
private void renderBolt(LightningBolt bolt, Tessellator tessellator, float partialframe, float cosyaw, float cospitch, float sinyaw, float cossinpitch, int pass, boolean inner) {
ParticleRenderDispatcher.lightningCount++;
float boltage = bolt.particleAge < 0 ? 0 : (float) bolt.particleAge / (float) bolt.particleMaxAge;
float mainalpha = 1;
if(pass == 0)
mainalpha = (1 - boltage) * 0.4F;
else mainalpha = 1 - boltage * 0.5F;
int expandTime = (int) (bolt.length * bolt.speed);
int renderstart = (int) ((expandTime / 2 - bolt.particleMaxAge + bolt.particleAge) / (float) (expandTime / 2) * bolt.numsegments0);
int renderend = (int) ((bolt.particleAge + expandTime) / (float) expandTime * bolt.numsegments0);
for(Segment rendersegment : bolt.segments) {
if(rendersegment.segmentno < renderstart || rendersegment.segmentno > renderend)
continue;
Vector3 playervec = getRelativeViewVector(rendersegment.startpoint.point).multiply(-1);
double width = 0.025F * (playervec.mag() / 5 + 1) * (1 + rendersegment.light) * 0.5F;
Vector3 diff1 = playervec.copy().crossProduct(rendersegment.prevdiff).normalize().multiply(width / rendersegment.sinprev);
Vector3 diff2 = playervec.copy().crossProduct(rendersegment.nextdiff).normalize().multiply(width / rendersegment.sinnext);
Vector3 startvec = rendersegment.startpoint.point;
Vector3 endvec = rendersegment.endpoint.point;
int color = inner ? bolt.colorInner : bolt.colorOuter;
int r = (color & 0xFF0000) >> 16;
int g = (color & 0xFF00) >> 8;
int b = (color & 0xFF);
int a = (int) (mainalpha * rendersegment.light * new Color(color).getAlpha());
tessellator.getBuffer().pos(endvec.x - diff2.x, endvec.y - diff2.y, endvec.z - diff2.z).tex(0.5, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
tessellator.getBuffer().pos(startvec.x - diff1.x, startvec.y - diff1.y, startvec.z - diff1.z).tex(0.5, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
tessellator.getBuffer().pos(startvec.x + diff1.x, startvec.y + diff1.y, startvec.z + diff1.z).tex(0.5, 1).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
tessellator.getBuffer().pos(endvec.x + diff2.x, endvec.y + diff2.y, endvec.z + diff2.z).tex(0.5, 1).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
if(rendersegment.next == null) {
Vector3 roundend = rendersegment.endpoint.point.copy().add(rendersegment.diff.copy().normalize().multiply(width));
tessellator.getBuffer().pos(roundend.x - diff2.x, roundend.y - diff2.y, roundend.z - diff2.z).tex(0, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
tessellator.getBuffer().pos(endvec.x - diff2.x, endvec.y - diff2.y, endvec.z - diff2.z).tex(0.5, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
tessellator.getBuffer().pos(endvec.x + diff2.x, endvec.y + diff2.y, endvec.z + diff2.z).tex(0.5, 1).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
tessellator.getBuffer().pos(roundend.x + diff2.x, roundend.y + diff2.y, roundend.z + diff2.z).tex(0, 1).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
}
if(rendersegment.prev == null) {
Vector3 roundend = rendersegment.startpoint.point.copy().subtract(rendersegment.diff.copy().normalize().multiply(width));
tessellator.getBuffer().pos(startvec.x - diff1.x, startvec.y - diff1.y, startvec.z - diff1.z).tex(0.5, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
tessellator.getBuffer().pos(roundend.x - diff1.x, roundend.y - diff1.y, roundend.z - diff1.z).tex(0, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
tessellator.getBuffer().pos(roundend.x + diff1.x, roundend.y + diff1.y, roundend.z + diff1.z).tex(0, 1).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
tessellator.getBuffer().pos(startvec.x + diff1.x, startvec.y + diff1.y, startvec.z + diff1.z).tex(0.5, 1).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
}
}
}
public static class LightningBolt {
public ArrayList<Segment> segments = new ArrayList<>();
public Vector3 start;
public Vector3 end;
BlockPos target;
HashMap<Integer, Integer> splitparents = new HashMap<>();
public double length;
public int numsegments0;
private int numsplits;
private boolean finalized;
private Random rand;
public long seed;
public int particleAge;
public int particleMaxAge;
public boolean isDead;
private AxisAlignedBB boundingBox;
private World world;
private Entity source;
public static final ConcurrentLinkedQueue<LightningBolt> boltlist = new ConcurrentLinkedQueue<>();
public float speed = 1.5F;
public static final int fadetime = 20;
public static int playerdamage = 1;
public static int entitydamage = 1;
public int colorOuter;
public int colorInner;
public static class BoltPoint {
public BoltPoint(Vector3 basepoint, Vector3 offsetvec) {
point = basepoint.copy().add(offsetvec);
this.basepoint = basepoint;
this.offsetvec = offsetvec;
}
public Vector3 point;
Vector3 basepoint;
Vector3 offsetvec;
}
private static final Comparator<Segment> SEGMENT_SORTER = (o1, o2) -> {
int comp = Integer.valueOf(o1.splitno).compareTo(o2.splitno);
if(comp == 0)
return Integer.valueOf(o1.segmentno).compareTo(o2.segmentno);
else return comp;
};
private static final Comparator<Segment> SEGMENT_LIGHT_SORTER = (o1, o2) -> Float.compare(o2.light, o1.light);
public class Segment {
public Segment(BoltPoint start, BoltPoint end, float light, int segmentnumber, int splitnumber) {
startpoint = start;
endpoint = end;
this.light = light;
segmentno = segmentnumber;
splitno = splitnumber;
calcDiff();
}
public Segment(Vector3 start, Vector3 end) {
this(new BoltPoint(start, new Vector3(0, 0, 0)), new BoltPoint(end, new Vector3(0, 0, 0)), 1, 0, 0);
}
public void calcDiff() {
diff = endpoint.point.copy().subtract(startpoint.point);
}
public void calcEndDiffs() {
if(prev != null) {
Vector3 prevdiffnorm = prev.diff.copy().normalize();
Vector3 thisdiffnorm = diff.copy().normalize();
prevdiff = thisdiffnorm.copy().add(prevdiffnorm).normalize();
sinprev = (float) Math.sin(thisdiffnorm.angle(prevdiffnorm.multiply(-1)) / 2);
} else {
prevdiff = diff.copy().normalize();
sinprev = 1;
}
if(next != null) {
Vector3 nextdiffnorm = next.diff.copy().normalize();
Vector3 thisdiffnorm = diff.copy().normalize();
nextdiff = thisdiffnorm.add(nextdiffnorm).normalize();
sinnext = (float) Math.sin(thisdiffnorm.angle(nextdiffnorm.multiply(-1)) / 2);
} else {
nextdiff = diff.copy().normalize();
sinnext = 1;
}
}
@Override
public String toString() {
return startpoint.point.toString() + " " + endpoint.point.toString();
}
public BoltPoint startpoint;
public BoltPoint endpoint;
public Vector3 diff;
public Segment prev;
public Segment next;
public Vector3 nextdiff;
public Vector3 prevdiff;
public float sinprev;
public float sinnext;
public float light;
public int segmentno;
public int splitno;
}
public LightningBolt(World world, Vector3 sourcevec, Vector3 targetvec, float ticksPerMeter, long seed, int colorOuter, int colorInner) {
this.world = world;
this.seed = seed;
rand = new Random(seed);
start = sourcevec;
end = targetvec;
speed = ticksPerMeter;
this.colorOuter = colorOuter;
this.colorInner = colorInner;
numsegments0 = 1;
length = end.copy().subtract(start).mag();
particleMaxAge = fadetime + rand.nextInt(fadetime) - fadetime / 2;
particleAge = -(int) (length * speed);
boundingBox = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
boundingBox = new AxisAlignedBB(Math.min(start.x, end.x), Math.min(start.y, end.y), Math.min(start.z, end.z), Math.max(start.x, end.x), Math.max(start.y, end.y), Math.max(start.z, end.z)).expand(length / 2, length / 2, length / 2);
segments.add(new Segment(start, end));
}
public static Vector3 getFocalPoint(TileEntity tile) {
return Vector3.fromTileEntityCenter(tile);
}
public LightningBolt(World world, Vector3 sourcevec, TileEntity target, float ticksPerMeter, long seed, int colorOuter, int colorInner) {
this(world, sourcevec, getFocalPoint(target), ticksPerMeter, seed, colorOuter, colorInner);
this.target = target.getPos();
}
public void setWrapper(Entity entity) {
source = entity;
}
public void fractal(int splits, double amount, double splitchance, double splitlength, double splitangle) {
if(finalized)
return;
ArrayList<Segment> oldsegments = segments;
segments = new ArrayList<>();
Segment prev = null;
for(Segment segment : oldsegments) {
prev = segment.prev;
Vector3 subsegment = segment.diff.copy().multiply(1F / splits);
BoltPoint[] newpoints = new BoltPoint[splits + 1];
Vector3 startpoint = segment.startpoint.point;
newpoints[0] = segment.startpoint;
newpoints[splits] = segment.endpoint;
for(int i = 1; i < splits; i++) {
Vector3 randoff = segment.diff.copy().perpendicular().normalize().rotate(rand.nextFloat() * 360, segment.diff);
randoff.multiply((rand.nextFloat() - 0.5F) * amount * 2);
Vector3 basepoint = startpoint.copy().add(subsegment.copy().multiply(i));
newpoints[i] = new BoltPoint(basepoint, randoff);
}
for(int i = 0; i < splits; i++) {
Segment next = new Segment(newpoints[i], newpoints[i + 1], segment.light, segment.segmentno * splits + i, segment.splitno);
next.prev = prev;
if (prev != null)
prev.next = next;
if(i != 0 && rand.nextFloat() < splitchance) {
Vector3 splitrot = next.diff.copy().xCrossProduct().rotate(rand.nextFloat() * 360, next.diff);
Vector3 diff = next.diff.copy().rotate((rand.nextFloat() * 0.66F + 0.33F) * splitangle, splitrot).multiply(splitlength);
numsplits++;
splitparents.put(numsplits, next.splitno);
Segment split = new Segment(newpoints[i], new BoltPoint(newpoints[i + 1].basepoint, newpoints[i + 1].offsetvec.copy().add(diff)), segment.light / 2F, next.segmentno, numsplits);
split.prev = prev;
segments.add(split);
}
prev = next;
segments.add(next);
}
if(segment.next != null)
segment.next.prev = prev;
}
numsegments0 *= splits;
}
public void defaultFractal() {
fractal(2, length / 1.5, 0.7F, 0.7F, 45);
fractal(2, length / 4, 0.5F, 0.8F, 50);
fractal(2, length / 15, 0.5F, 0.9F, 55);
fractal(2, length / 30, 0.5F, 1.0F, 60);
fractal(2, length / 60, 0, 0, 0);
fractal(2, length / 100, 0, 0, 0);
fractal(2, length / 400, 0, 0, 0);
}
private float rayTraceResistance(Vector3 start, Vector3 end, float prevresistance) {
RayTraceResult mop = world.rayTraceBlocks(start.toVec3D(), end.toVec3D());
if(mop == null)
return prevresistance;
if(mop.typeOfHit == RayTraceResult.Type.BLOCK) {
Block block = world.getBlockState(mop.getBlockPos()).getBlock();
if(world.isAirBlock(mop.getBlockPos()))
return prevresistance;
return prevresistance + block.getExplosionResistance(source) + 0.3F;
} else return prevresistance;
}
private void calculateCollisionAndDiffs() {
HashMap<Integer, Integer> lastactivesegment = new HashMap<>();
Collections.sort(segments, SEGMENT_SORTER);
int lastsplitcalc = 0;
int lastactiveseg = 0;// unterminated
float splitresistance = 0;
for(Segment segment : segments) {
if(segment.splitno > lastsplitcalc) {
lastactivesegment.put(lastsplitcalc, lastactiveseg);
lastsplitcalc = segment.splitno;
lastactiveseg = lastactivesegment.get(splitparents.get(segment.splitno));
splitresistance = lastactiveseg < segment.segmentno ? 50 : 0;
}
if(splitresistance >= 40 * segment.light)
continue;
splitresistance = rayTraceResistance(segment.startpoint.point, segment.endpoint.point, splitresistance);
lastactiveseg = segment.segmentno;
}
lastactivesegment.put(lastsplitcalc, lastactiveseg);
lastsplitcalc = 0;
lastactiveseg = lastactivesegment.get(0);
for(Iterator<Segment> iterator = segments.iterator(); iterator.hasNext();) {
Segment segment = iterator.next();
if(lastsplitcalc != segment.splitno) {
lastsplitcalc = segment.splitno;
lastactiveseg = lastactivesegment.get(segment.splitno);
}
if(segment.segmentno > lastactiveseg)
iterator.remove();
segment.calcEndDiffs();
}
}
public void finalizeBolt() {
if(finalized)
return;
finalized = true;
calculateCollisionAndDiffs();
Collections.sort(segments, SEGMENT_LIGHT_SORTER);
boltlist.add(this);
}
public void onUpdate() {
particleAge++;
if (particleAge >= particleMaxAge)
isDead = true;
}
// Called in ClientTickHandler
public static void update() {
for(Iterator<LightningBolt> iterator = boltlist.iterator(); iterator.hasNext();) {
LightningBolt bolt = iterator.next();
bolt.onUpdate();
if(bolt.isDead)
iterator.remove();
}
}
}
}
@@ -10,6 +10,7 @@ package vazkii.botania.client.core.handler;
import com.google.common.collect.Maps;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
@@ -17,7 +18,6 @@ import net.minecraft.launchwrapper.Launch;
import net.minecraftforge.client.event.ModelBakeEvent;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.event.entity.player.ArrowLooseEvent;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.apache.commons.lang3.text.WordUtils;
import org.lwjgl.BufferUtils;
@@ -25,8 +25,10 @@ import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.client.model.FloatingFlowerModel;
import vazkii.botania.client.model.GunModel;
import vazkii.botania.client.model.LexiconModel;
import vazkii.botania.client.model.PlatformModel;
import vazkii.botania.common.Botania;
import vazkii.botania.common.integration.buildcraft.TriggerManaLevel;
import vazkii.botania.common.item.ItemSparkUpgrade;
import vazkii.botania.common.item.equipment.bauble.ItemFlightTiara;
@@ -63,7 +65,7 @@ public class MiscellaneousIcons {
public TextureAtlasSprite[] sparkUpgradeIcons;
public TextureAtlasSprite[] kingKeyWeaponIcons;
public Map<TriggerManaLevel.State, TextureAtlasSprite> manaLevelTriggerIcons = Maps.newEnumMap(TriggerManaLevel.State.class);
public final Map<TriggerManaLevel.State, TextureAtlasSprite> manaLevelTriggerIcons = Maps.newEnumMap(TriggerManaLevel.State.class);
public TextureAtlasSprite[] tiaraWingIcons;
// begin dank_memes
@@ -86,16 +88,26 @@ public class MiscellaneousIcons {
@SubscribeEvent
public void onModelBake(ModelBakeEvent evt) {
// Floating flowers
evt.getModelRegistry().putObject(new ModelResourceLocation("botania:miniIsland", "normal"), FloatingFlowerModel.INSTANCE);
evt.getModelRegistry().putObject(new ModelResourceLocation("botania:miniIsland", "inventory"), FloatingFlowerModel.INSTANCE);
evt.getModelRegistry().putObject(new ModelResourceLocation("botania:floatingSpecialFlower", "normal"), FloatingFlowerModel.INSTANCE);
evt.getModelRegistry().putObject(new ModelResourceLocation("botania:floatingSpecialFlower", "inventory"), FloatingFlowerModel.INSTANCE);
FloatingFlowerModel model = new FloatingFlowerModel();
evt.getModelRegistry().putObject(new ModelResourceLocation("botania:miniIsland", "normal"), model);
evt.getModelRegistry().putObject(new ModelResourceLocation("botania:miniIsland", "inventory"), model);
evt.getModelRegistry().putObject(new ModelResourceLocation("botania:floatingSpecialFlower", "normal"), model);
evt.getModelRegistry().putObject(new ModelResourceLocation("botania:floatingSpecialFlower", "inventory"), model);
// Platforms
evt.getModelRegistry().putObject(new ModelResourceLocation("botania:platform", "normal"), new PlatformModel());
// Lexicon
evt.getModelRegistry().putObject(new ModelResourceLocation("botania:lexicon", "inventory"), new LexiconModel());
// Mana Blaster
ModelResourceLocation key = new ModelResourceLocation("botania:manaGun", "inventory");
IBakedModel originalModel = evt.getModelRegistry().getObject(key);
evt.getModelRegistry().putObject(key, new GunModel(originalModel));
key = new ModelResourceLocation("botania:manaGunClip", "inventory");
originalModel = evt.getModelRegistry().getObject(key);
evt.getModelRegistry().putObject(key, new GunModel(originalModel));
}
@SubscribeEvent
@@ -155,12 +167,12 @@ public class MiscellaneousIcons {
if (!evt.getEntityPlayer().worldObj.isRemote || !((Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment"))
|| !evt.getEntityPlayer().isSneaking())
return;
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
int width = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH);
int height = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_HEIGHT);
FMLLog.info("[Botania]: Dumped atlas %d wide by %d tall%n", width, height);
Botania.LOGGER.debug("Dumped atlas %d wide by %d tall%n", width, height);
int pixels = width * height;
@@ -190,7 +202,7 @@ public class MiscellaneousIcons {
try {
ImageIO.write(bufferedimage, "png", result);
} catch (IOException e) {
FMLLog.warning("[Botania]: Failed to dump debug atlas");
Botania.LOGGER.warn("Failed to dump debug atlas");
}
}
@@ -8,59 +8,31 @@
*/
package vazkii.botania.client.core.handler;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDoublePlant;
import net.minecraft.block.BlockFlower;
import net.minecraft.block.BlockSkull;
import net.minecraft.block.BlockSlab;
import net.minecraft.block.BlockWall;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.block.statemap.StateMap;
import net.minecraft.client.resources.IReloadableResourceManager;
import net.minecraft.client.renderer.block.statemap.DefaultStateMapper;
import net.minecraft.client.renderer.block.statemap.IStateMapper;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.client.model.ModelLoaderRegistry;
import net.minecraftforge.client.model.obj.OBJLoader;
import net.minecraftforge.fml.common.registry.RegistryDelegate;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import vazkii.botania.api.BotaniaAPIClient;
import vazkii.botania.api.item.IFloatingFlower;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.api.state.enums.AltGrassVariant;
import vazkii.botania.api.state.enums.AltarVariant;
import vazkii.botania.api.state.enums.BiomeBrickVariant;
import vazkii.botania.api.state.enums.BiomeStoneVariant;
import vazkii.botania.api.state.enums.CrateVariant;
import vazkii.botania.api.state.enums.CustomBrickVariant;
import vazkii.botania.api.state.enums.DrumVariant;
import vazkii.botania.api.state.enums.EndBrickVariant;
import vazkii.botania.api.state.enums.FutureStoneVariant;
import vazkii.botania.api.state.enums.LivingRockVariant;
import vazkii.botania.api.state.enums.LivingWoodVariant;
import vazkii.botania.api.state.enums.LuminizerVariant;
import vazkii.botania.api.state.enums.PlatformVariant;
import vazkii.botania.api.state.enums.PoolVariant;
import vazkii.botania.api.state.enums.PrismarineVariant;
import vazkii.botania.api.state.enums.PylonVariant;
import vazkii.botania.api.state.enums.SpreaderVariant;
import vazkii.botania.api.state.enums.StorageVariant;
import vazkii.botania.client.model.FloatingFlowerModel;
import vazkii.botania.client.model.SpecialFlowerModel;
import vazkii.botania.client.render.IModelRegister;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.ModFluffBlocks;
import vazkii.botania.common.block.decor.slabs.BlockModSlab;
import vazkii.botania.common.block.subtile.SubTileDecor;
import vazkii.botania.common.block.subtile.SubTileManastar;
import vazkii.botania.common.block.subtile.SubTilePureDaisy;
import vazkii.botania.common.block.subtile.functional.SubTileAgricarnation;
import vazkii.botania.common.block.subtile.functional.SubTileBellethorn;
import vazkii.botania.common.block.subtile.functional.SubTileBergamute;
import vazkii.botania.common.block.subtile.functional.SubTileBubbell;
import vazkii.botania.common.block.subtile.functional.SubTileClayconia;
import vazkii.botania.common.block.subtile.functional.SubTileDaffomill;
@@ -98,118 +70,30 @@ import vazkii.botania.common.block.subtile.generating.SubTileNightshade;
import vazkii.botania.common.block.subtile.generating.SubTileRafflowsia;
import vazkii.botania.common.block.subtile.generating.SubTileSpectrolus;
import vazkii.botania.common.block.subtile.generating.SubTileThermalily;
import vazkii.botania.common.block.tile.TileAvatar;
import vazkii.botania.common.block.tile.TileBrewery;
import vazkii.botania.common.block.tile.TileGaiaHead;
import vazkii.botania.common.block.tile.TileHourglass;
import vazkii.botania.common.block.tile.TileTeruTeruBozu;
import vazkii.botania.common.block.tile.corporea.TileCorporeaCrystalCube;
import vazkii.botania.common.block.tile.corporea.TileCorporeaIndex;
import vazkii.botania.common.block.tile.mana.TileBellows;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.brew.ItemBrewBase;
import vazkii.botania.common.item.equipment.bauble.ItemFlightTiara;
import vazkii.botania.common.item.relic.ItemInfiniteFruit;
import vazkii.botania.common.lib.LibBlockNames;
import vazkii.botania.common.lib.LibItemNames;
import vazkii.botania.common.lib.LibMisc;
import java.util.List;
import java.util.Locale;
import static vazkii.botania.common.item.ModItems.*;
import java.util.Map;
import java.util.function.IntFunction;
public final class ModelHandler {
// todo reorganize, alphabetize
public static void registerModels() {
ModelLoaderRegistry.registerLoader(SpecialFlowerModel.Loader.INSTANCE);
OBJLoader.INSTANCE.addDomain(LibMisc.MOD_ID.toLowerCase(Locale.ROOT));
((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(FloatingFlowerModel.INSTANCE);
/** Subtile block models **/
registerSubtiles();
/** Custom statemappers **/
registerStateMappers();
for(Block block : Block.REGISTRY) {
if(block instanceof IModelRegister)
((IModelRegister) block).registerModels();
}
/** ItemBlocks **/
registerStandardBlocks();
registerMushrooms();
registerFlowers();
registerPavement();
registerStairs();
registerSlabs();
registerWalls();
registerPanes();
registerAltars();
registerQuartzBlocks();
registerLuminizers();
/** Normal Items **/
registerStandardItems();
registerTESRItems();
registerManaResources();
registerRunes();
registerLens();
registerBrews();
/** Special Item Meshers **/
// Cannot use lambdas directly yet because FG/SS can't reobfuscate them, need a dummy wrapper
// See https://github.com/MinecraftForge/ForgeGradle/issues/314.
ModelLoader.registerItemVariants(Item.getItemFromBlock(ModBlocks.pool),
new ModelResourceLocation("botania:pool", "variant=default"),
new ModelResourceLocation("botania:pool", "variant=diluted"),
new ModelResourceLocation("botania:pool", "variant=creative"),
new ModelResourceLocation("botania:pool", "variant=fabulous"),
new ModelResourceLocation("botania:pool", "default_full"),
new ModelResourceLocation("botania:pool", "diluted_full"),
new ModelResourceLocation("botania:pool", "creative_full"),
new ModelResourceLocation("botania:pool", "fabulous_full"));
ModelLoader.setCustomMeshDefinition(Item.getItemFromBlock(ModBlocks.pool), MesherWrapper.of(stack -> {
int meta = stack.getMetadata();
if (meta < 0 || meta > 3)
meta = 0;
PoolVariant v = PoolVariant.values()[meta];
boolean renderFull = v == PoolVariant.CREATIVE || (stack.hasTagCompound() && stack.getTagCompound().getBoolean("RenderFull"));
return new ModelResourceLocation("botania:pool", renderFull ? v.getName() + "_full" : "variant=" + v.getName());
}));
ModelLoader.registerItemVariants(elementiumShears,
new ModelResourceLocation("botania:elementiumShears", "inventory"),
new ModelResourceLocation("botania:dammitReddit", "inventory"));
ModelLoader.setCustomMeshDefinition(elementiumShears, MesherWrapper.of(stack ->
stack.getDisplayName().equalsIgnoreCase("dammit reddit")
? new ModelResourceLocation("botania:dammitReddit", "inventory")
: new ModelResourceLocation("botania:elementiumShears", "inventory")));
ModelLoader.registerItemVariants(grassHorn,
new ModelResourceLocation("botania:grassHorn0", "inventory"),
new ModelResourceLocation("botania:grassHorn1", "inventory"),
new ModelResourceLocation("botania:grassHorn2", "inventory"),
new ModelResourceLocation("botania:vuvuzela", "inventory"));
ModelLoader.setCustomMeshDefinition(grassHorn, MesherWrapper.of(stack ->
stack.getDisplayName().toLowerCase().contains("vuvuzela")
? new ModelResourceLocation("botania:vuvuzela", "inventory")
: new ModelResourceLocation("botania:grassHorn" + stack.getMetadata(), "inventory")));
ModelLoader.registerItemVariants(infiniteFruit,
new ModelResourceLocation("botania:infiniteFruit", "inventory"),
new ModelResourceLocation("botania:infiniteFruitBoot", "inventory"));
ModelLoader.setCustomMeshDefinition(infiniteFruit, MesherWrapper.of(stack ->
ItemInfiniteFruit.isBoot(stack)
? new ModelResourceLocation("botania:infiniteFruitBoot", "inventory")
: new ModelResourceLocation("botania:infiniteFruit", "inventory")));
ModelLoader.registerItemVariants(manaCookie,
new ModelResourceLocation("botania:manaCookie", "inventory"),
new ModelResourceLocation("botania:totalBiscuit", "inventory"));
ModelLoader.setCustomMeshDefinition(manaCookie, MesherWrapper.of(stack ->
stack.getDisplayName().toLowerCase().equals("totalbiscuit")
? new ModelResourceLocation("botania:totalBiscuit", "inventory")
: new ModelResourceLocation("botania:manaCookie", "inventory")));
for(Item item : Item.REGISTRY) {
if(item instanceof IModelRegister)
((IModelRegister) item).registerModels();
}
}
private static void registerSubtiles() {
@@ -280,689 +164,70 @@ public final class ModelHandler {
BotaniaAPIClient.registerSubtileModel(SubTileBubbell.Mini.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_BUBBELL + "Chibi"));
BotaniaAPIClient.registerSubtileModel(SubTileSolegnolia.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_SOLEGNOLIA));
BotaniaAPIClient.registerSubtileModel(SubTileSolegnolia.Mini.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_SOLEGNOLIA + "Chibi"));
BotaniaAPIClient.registerSubtileModel(SubTileBergamute.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_BERGAMUTE));
}
private static void registerStandardBlocks() {
registerItemModel(ModBlocks.alchemyCatalyst);
registerItemModel(ModBlocks.alfPortal);
registerItemModel(ModBlocks.bifrost);
registerItemModel(ModBlocks.bifrostPerm);
registerItemModel(ModBlocks.blazeBlock);
registerItemModel(ModBlocks.cacophonium);
registerItemModel(ModBlocks.cellBlock);
registerItemModel(ModBlocks.conjurationCatalyst);
registerItemModel(ModBlocks.cocoon);
registerItemModel(ModBlocks.corporeaFunnel);
registerItemModel(ModBlocks.corporeaInterceptor);
registerItemModel(ModBlocks.corporeaRetainer);
registerItemModel(ModBlocks.dirtPath);
registerItemModel(ModBlocks.distributor);
registerItemModel(ModBlocks.elfGlass);
registerItemModel(ModBlocks.enchantedSoil);
registerItemModel(ModBlocks.enchanter);
registerItemModel(ModBlocks.enderEye);
registerItemModel(ModBlocks.felPumpkin);
registerItemModel(ModBlocks.floatingSpecialFlower);
registerItemModel(ModBlocks.forestEye);
registerItemModel(ModBlocks.ghostRail);
registerItemModel(ModBlocks.incensePlate);
registerItemModel(ModBlocks.lightLauncher);
registerItemModel(ModBlocks.manaBomb);
registerItemModel(ModBlocks.manaDetector);
registerItemModel(ModBlocks.manaFlame);
registerItemModel(ModBlocks.manaGlass);
registerItemModel(ModBlocks.manaVoid);
registerItemModel(ModBlocks.prism);
registerItemModel(ModBlocks.pistonRelay);
registerItemModel(ModBlocks.pump);
registerItemModel(ModBlocks.redStringComparator);
registerItemModel(ModBlocks.redStringContainer);
registerItemModel(ModBlocks.redStringDispenser);
registerItemModel(ModBlocks.redStringFertilizer);
registerItemModel(ModBlocks.redStringInterceptor);
registerItemModel(ModBlocks.redStringRelay);
registerItemModel(ModBlocks.reedBlock);
registerItemModel(ModBlocks.rfGenerator);
registerItemModel(ModBlocks.root);
registerItemModel(ModBlocks.runeAltar);
registerItemModel(ModBlocks.seaLamp);
registerItemModel(ModBlocks.shimmerrock);
registerItemModel(ModBlocks.shimmerwoodPlanks);
registerItemModel(ModBlocks.sparkChanger);
registerItemModel(ModBlocks.spawnerClaw);
registerItemModel(ModBlocks.specialFlower);
registerItemModel(ModBlocks.starfield);
registerItemModel(ModBlocks.thatch);
registerItemModel(ModBlocks.terraPlate);
registerItemModel(ModBlocks.tinyPlanet);
registerItemModel(ModBlocks.tinyPotato);
registerItemModel(ModBlocks.turntable);
// Register all metas to variant inventory, so the smartmodel can take over from there. See MiscellaneousIcons
registerItemModelAllMeta(Item.getItemFromBlock(ModBlocks.floatingFlower), EnumDyeColor.values().length);
// Item models which all use the same base model and recolored by render layer
registerItemModelAllMeta(Item.getItemFromBlock(ModBlocks.manaBeacon), EnumDyeColor.values().length);
registerItemModelAllMeta(Item.getItemFromBlock(ModBlocks.petalBlock), EnumDyeColor.values().length);
registerItemModelAllMeta(Item.getItemFromBlock(ModBlocks.unstableBlock), EnumDyeColor.values().length);
// Blocks which share models with their item, and have only one variant to switch over
registerVariantsDefaulted(ModBlocks.pylon, PylonVariant.class, "variant");
registerVariantsDefaulted(ModBlocks.altGrass, AltGrassVariant.class, "variant");
registerVariantsDefaulted(ModFluffBlocks.biomeStoneA, BiomeStoneVariant.class, "variant");
registerVariantsDefaulted(ModFluffBlocks.biomeStoneB, BiomeBrickVariant.class, "variant");
registerVariantsDefaulted(ModBlocks.customBrick, CustomBrickVariant.class, "variant");
registerVariantsDefaulted(ModBlocks.endStoneBrick, EndBrickVariant.class, "variant");
registerVariantsDefaulted(ModBlocks.dreamwood, LivingWoodVariant.class, "variant");
registerVariantsDefaulted(ModBlocks.forestDrum, DrumVariant.class, "variant");
registerVariantsDefaulted(ModBlocks.livingrock, LivingRockVariant.class, "variant");
registerVariantsDefaulted(ModBlocks.livingwood, LivingWoodVariant.class, "variant");
registerVariantsDefaulted(ModBlocks.openCrate, CrateVariant.class, "pattern=none,variant");
registerVariantsDefaulted(ModBlocks.platform, PlatformVariant.class, "variant");
registerVariantsDefaulted(ModBlocks.prismarine, PrismarineVariant.class, "variant");
registerVariantsDefaulted(ModBlocks.spreader, SpreaderVariant.class, "variant");
// todo 1.8 this is temporary until animation API is done, currnetly item model textures will not match true spreader texture
registerVariantsDefaulted(ModFluffBlocks.stone, FutureStoneVariant.class, "variant");
registerVariantsDefaulted(ModBlocks.storage, StorageVariant.class, "variant");
public static void registerItemAllMeta(Item item, int range) {
registerItemMetas(item, range, i -> item.getRegistryName().getResourcePath());
}
private static void registerStandardItems() {
registerItemModel(manasteelSword);
registerItemModel(spawnerMover);
registerItemModel(terraPick);
registerItemModel(magnetRing);
registerItemModel(magnetRingGreater);
registerItemModel(manaGun);
registerItemModel(tornadoRod);
registerItemModel(twigWand);
registerItemModel(pestleAndMortar);
registerItemModel(blackLotus);
registerItemModel(blackLotus, 1);
ModelLoader.registerItemVariants(lexicon, new ModelResourceLocation("botania:lexicon_default", "inventory"));
registerItemModel(lexicon);
registerItemModel(manasteelHelm);
registerItemModel(manasteelHelmRevealing);
registerItemModel(manasteelChest);
registerItemModel(manasteelLegs);
registerItemModel(manasteelBoots);
registerItemModel(manasteelPick);
registerItemModel(manasteelShovel);
registerItemModel(manasteelAxe);
registerItemModel(manasteelShears);
registerItemModel(manaweaveHelm);
registerItemModel(manaweaveChest);
registerItemModel(manaweaveLegs);
registerItemModel(manaweaveBoots);
registerItemModel(elementiumHelm);
registerItemModel(elementiumHelmRevealing);
registerItemModel(elementiumChest);
registerItemModel(elementiumLegs);
registerItemModel(elementiumBoots);
registerItemModel(elementiumPick);
registerItemModel(elementiumShovel);
registerItemModel(elementiumAxe);
registerItemModel(elementiumSword);
registerItemModel(terrasteelHelm);
registerItemModel(terrasteelHelmRevealing);
registerItemModel(terrasteelChest);
registerItemModel(terrasteelLegs);
registerItemModel(terrasteelBoots);
registerItemModel(terraSword);
registerItemModelMetas(terraAxe, LibItemNames.TERRA_AXE, 2);
registerItemModel(starSword);
registerItemModel(thunderSword);
registerItemModel(crystalBow);
registerItemModel(livingwoodBow);
registerItemModel(glassPick);
registerItemModel(flowerBag);
registerItemModel(fertilizer);
registerItemModel(obedienceStick);
registerItemModel(dirtRod);
registerItemModel(waterRod);
registerItemModel(cobbleRod);
registerItemModel(fireRod);
registerItemModel(rainbowRod);
registerItemModel(skyDirtRod);
registerItemModel(terraformRod);
registerItemModel(diviningRod);
registerItemModel(gravityRod);
registerItemModel(missileRod);
registerItemModel(smeltRod);
registerItemModel(exchangeRod);
registerItemModel(openBucket);
registerItemModel(bloodPendant);
registerItemModel(manaTablet);
registerItemModel(enderDagger);
registerItemModel(slingshot);
registerItemModel(vineBall);
registerItemModel(regenIvy);
registerItemModel(keepIvy);
registerItemModel(recordGaia1);
registerItemModel(recordGaia2);
registerItemModel(overgrowthSeed);
registerItemModel(worldSeed);
registerItemModel(incenseStick);
registerItemModel(enderHand);
registerItemModel(craftingHalo);
registerItemModel(spellCloth);
registerItemModel(autocraftingHalo);
registerItemModel(sextant);
registerItemModel(cacophonium);
registerItemModel(clip);
registerItemModel(phantomInk);
registerItemModel(poolMinecart);
registerItemModel(pinkinator);
registerItemModel(dice);
registerItemModel(kingKey);
registerItemModel(flugelEye);
registerItemModel(thorRing);
registerItemModel(lokiRing);
registerItemModel(odinRing);
registerItemModel(aesirRing);
registerItemModel(baubleBox);
registerItemModel(tinyPlanet);
registerItemModel(manaRing);
registerItemModel(manaRingGreater);
registerItemModel(auraRing);
registerItemModel(auraRingGreater);
registerItemModel(spark);
registerItemModel(waterRing);
registerItemModel(miningRing);
registerItemModel(reachRing);
registerItemModel(swapRing);
registerItemModel(pixieRing);
registerItemModel(travelBelt);
registerItemModel(superTravelBelt);
registerItemModel(speedUpBelt);
registerItemModel(knockbackBelt);
registerItemModel(itemFinder);
registerItemModel(monocle);
registerItemModel(icePendant);
registerItemModel(lavaPendant);
registerItemModel(superLavaPendant);
registerItemModel(holyCloak);
registerItemModel(unholyCloak);
registerItemModel(goldLaurel);
registerItemModel(flightTiara);
registerItemModel(divaCharm);
registerItemModel(manaMirror);
registerItemModel(manaInkwell);
registerItemModel(waterBowl);
registerItemModelAllMeta(flightTiara, ItemFlightTiara.WING_TYPES);
registerItemModelAllMeta(laputaShard, 20);
registerItemModelAllMeta(signalFlare, EnumDyeColor.values().length);
registerItemModelAllMeta(dye, EnumDyeColor.values().length);
registerItemModelAllMeta(petal, EnumDyeColor.values().length);
registerItemModelMetas(sparkUpgrade, LibItemNames.SPARK_UPGRADE, 4);
registerItemModelMetas(corporeaSpark, LibItemNames.CORPOREA_SPARK, 2);
registerItemModelMetas(manaBottle, LibItemNames.MANA_BOTTLE, 6);
registerItemModelMetas(ancientWill, LibItemNames.ANCIENT_WILL, 6);
registerItemModelMetas(temperanceStone, LibItemNames.TEMPERANCE_STONE, 2);
registerItemModelMetas(thornChakram, LibItemNames.THORN_CHAKRAM, 2);
registerItemModelMetas(blackHoleTalisman, LibItemNames.BLACK_HOLE_TALISMAN, 2);
registerItemModelMetas(slimeBottle, LibItemNames.SLIME_BOTTLE, 2);
registerItemModelMetas(grassSeeds, LibItemNames.GRASS_SEEDS, 9);
registerItemModelMetas(quartz, LibItemNames.QUARTZ, 7);
registerItemModelMetas(cosmetic, LibItemNames.COSMETIC, 32);
registerItemModelMetas(craftPattern, LibItemNames.CRAFT_PATTERN, 9);
registerItemModelMetas(virus, LibItemNames.VIRUS, 2);
public static void registerItemAppendMeta(Item item, int maxExclusive, String loc) {
registerItemMetas(item, maxExclusive, i -> loc + i);
}
// Only for models that absolutely can't be converted to JSON. Use VERY sparingly
@SuppressWarnings("deprecation")
private static void registerTESRItems() {
registerItemModel(ModBlocks.avatar);
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.avatar), 0, TileAvatar.class);
registerItemModel(ModBlocks.bellows); // todo await animation api
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.bellows), 0, TileBellows.class);
registerItemModel(ModBlocks.brewery);
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.brewery), 0, TileBrewery.class);
registerItemModel(ModBlocks.corporeaCrystalCube);
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.corporeaCrystalCube), 0, TileCorporeaCrystalCube.class);
registerItemModel(ModBlocks.corporeaIndex); // todo json maybe? await animation api
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.corporeaIndex), 0, TileCorporeaIndex.class);
registerItemModel(ModItems.gaiaHead);
ForgeHooksClient.registerTESRItemStack(ModItems.gaiaHead, 0, TileGaiaHead.class);
registerItemModel(ModBlocks.hourglass); // todo json maybe?
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.hourglass), 0, TileHourglass.class);
registerItemModel(ModBlocks.teruTeruBozu);
ForgeHooksClient.registerTESRItemStack(Item.getItemFromBlock(ModBlocks.teruTeruBozu), 0, TileTeruTeruBozu.class);
}
private static void registerManaResources() {
Item item = manaResource;
for (int i = 0; i < LibItemNames.MANA_RESOURCE_NAMES.length; i++) {
String name = "botania:" + LibItemNames.MANA_RESOURCE_NAMES[i];
ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(name, "inventory"));
public static void registerItemMetas(Item item, int maxExclusive, IntFunction<String> metaToName) {
for (int i = 0; i < maxExclusive; i++) {
ModelLoader.setCustomModelResourceLocation(
item, i,
new ModelResourceLocation(LibMisc.MOD_ID + ":" + metaToName.apply(i), "inventory")
);
}
}
private static void registerRunes() {
List<String> variantNames = ImmutableList.of("water", "fire", "earth", "air", "spring", "summer", "autumn", "winter", "mana", "lust", "gluttony", "greed", "sloth", "wrath", "envy", "pride");
for (int i = 0; i < variantNames.size(); i++) {
ModelLoader.setCustomModelResourceLocation(rune, i, new ModelResourceLocation("botania:rune_" + variantNames.get(i), "inventory"));
}
private static final Map<RegistryDelegate<Block>, IStateMapper> customStateMappers = ReflectionHelper.getPrivateValue(ModelLoader.class, null, "customStateMappers");
private static final DefaultStateMapper fallbackMapper = new DefaultStateMapper();
private static ModelResourceLocation getMrlForState(IBlockState state) {
return customStateMappers
.getOrDefault(state.getBlock().delegate, fallbackMapper)
.putStateModelLocations(state.getBlock())
.get(state);
}
private static void registerLens() {
int counter = 0;
for (String s : LibItemNames.LENS_NAMES) {
ModelLoader.setCustomModelResourceLocation(lens, counter++, new ModelResourceLocation("botania:" + s, "inventory"));
}
public static void registerBlockToState(Block b, int meta, IBlockState state) {
ModelLoader.setCustomModelResourceLocation(
Item.getItemFromBlock(b),
meta,
getMrlForState(state)
);
}
private static void registerBrews() {
ModelLoader.setCustomModelResourceLocation(vial, 0, new ModelResourceLocation("botania:vial", "inventory"));
ModelLoader.setCustomModelResourceLocation(vial, 1, new ModelResourceLocation("botania:flask", "inventory"));
for (int i = 0; i < 6; i++) {
ModelLoader.registerItemVariants(brewFlask, new ModelResourceLocation("botania:flask1_" + i, "inventory"));
}
ModelLoader.setCustomMeshDefinition(brewFlask, MesherWrapper.of(stack -> {
int swigsTaken = 6 - ((ItemBrewBase) brewFlask).getSwigsLeft(stack);
return new ModelResourceLocation("botania:flask1_" + swigsTaken, "inventory");
}));
for (int i = 0; i < 4; i++) {
ModelLoader.registerItemVariants(brewVial, new ModelResourceLocation("botania:vial1_" + i, "inventory"));
}
ModelLoader.setCustomMeshDefinition(brewVial, MesherWrapper.of(stack -> {
int swigsTaken = 4 - ((ItemBrewBase) brewVial).getSwigsLeft(stack);
return new ModelResourceLocation("botania:vial1_" + swigsTaken, "inventory");
}));
public static void registerBlockToState(Block b, int maxExclusive) {
for(int i = 0; i < maxExclusive; i++)
registerBlockToState(b, i, b.getStateFromMeta(i));
}
private static void registerStateMappers() {
// Override to let custom model loader work, see SpecialFlowerModel
ModelLoader.setCustomStateMapper(ModBlocks.specialFlower, new StateMap.Builder().ignore(BotaniaStateProps.COLOR).ignore(((BlockFlower) ModBlocks.specialFlower).getTypeProperty()).build());
// Override to let smart models work, see MiscellaneousIcons
ModelLoader.setCustomStateMapper(ModBlocks.floatingSpecialFlower, new StateMap.Builder().ignore(BotaniaStateProps.COLOR).build());
ModelLoader.setCustomStateMapper(ModBlocks.floatingFlower, new StateMap.Builder().ignore(BotaniaStateProps.COLOR).build());
ModelLoader.setCustomStateMapper(ModBlocks.platform, new StateMap.Builder().ignore(BotaniaStateProps.PLATFORM_VARIANT).build());
// Ignore vanilla facing, variant in double flower
ModelLoader.setCustomStateMapper(ModBlocks.doubleFlower1, (new StateMap.Builder()).ignore(BlockDoublePlant.VARIANT, BlockDoublePlant.FACING).build());
ModelLoader.setCustomStateMapper(ModBlocks.doubleFlower2, (new StateMap.Builder()).ignore(BlockDoublePlant.VARIANT, BlockDoublePlant.FACING).build());
// Ignore color in unstable cube, mana beacon, special flower, and petals (handled by Block.colorMultiplier)
ModelLoader.setCustomStateMapper(ModBlocks.unstableBlock, (new StateMap.Builder()).ignore(BotaniaStateProps.COLOR).build());
ModelLoader.setCustomStateMapper(ModBlocks.manaBeacon, (new StateMap.Builder()).ignore(BotaniaStateProps.COLOR).build());
ModelLoader.setCustomStateMapper(ModBlocks.petalBlock, (new StateMap.Builder()).ignore(BotaniaStateProps.COLOR).build());
ModelLoader.setCustomStateMapper(ModBlocks.specialFlower, (new StateMap.Builder()).ignore(BotaniaStateProps.COLOR, ((BlockFlower) ModBlocks.specialFlower).getTypeProperty()).build());
// Ignore vanilla variant in flowers
ModelLoader.setCustomStateMapper(ModBlocks.flower, (new StateMap.Builder()).ignore(((BlockFlower) ModBlocks.flower).getTypeProperty()).build());
ModelLoader.setCustomStateMapper(ModBlocks.shinyFlower, (new StateMap.Builder()).ignore(((BlockFlower) ModBlocks.shinyFlower).getTypeProperty()).build());
ModelLoader.setCustomStateMapper(ModBlocks.buriedPetals, (new StateMap.Builder()).ignore(((BlockFlower) ModBlocks.buriedPetals).getTypeProperty()).build());
// Ignore vanilla variant in walls
ModelLoader.setCustomStateMapper(ModFluffBlocks.biomeStoneWall, (new StateMap.Builder()).ignore(BlockWall.VARIANT).build());
ModelLoader.setCustomStateMapper(ModFluffBlocks.dreamwoodWall, (new StateMap.Builder()).ignore(BlockWall.VARIANT).build());
ModelLoader.setCustomStateMapper(ModFluffBlocks.livingrockWall, (new StateMap.Builder()).ignore(BlockWall.VARIANT).build());
ModelLoader.setCustomStateMapper(ModFluffBlocks.livingwoodWall, (new StateMap.Builder()).ignore(BlockWall.VARIANT).build());
ModelLoader.setCustomStateMapper(ModFluffBlocks.prismarineWall, (new StateMap.Builder()).ignore(BlockWall.VARIANT).build());
ModelLoader.setCustomStateMapper(ModFluffBlocks.reedWall, (new StateMap.Builder()).ignore(BlockWall.VARIANT).build());
ModelLoader.setCustomStateMapper(ModFluffBlocks.stoneWall, (new StateMap.Builder()).ignore(BlockWall.VARIANT).build());
// Ignore dummy variant in slabs
for (Block b : ModFluffBlocks.biomeStoneSlabs) {
ModelLoader.setCustomStateMapper(b, (new StateMap.Builder()).ignore(BlockModSlab.DUMMY).build());
}
for (Block b : ModFluffBlocks.pavementSlabs) {
ModelLoader.setCustomStateMapper(b, (new StateMap.Builder()).ignore(BlockModSlab.DUMMY).build());
}
for (Block b : ModFluffBlocks.stoneSlabs) {
ModelLoader.setCustomStateMapper(b, (new StateMap.Builder()).ignore(BlockModSlab.DUMMY).build());
}
List<Block> otherSlabs = Lists.newArrayList(ModFluffBlocks.livingwoodSlab, ModFluffBlocks.livingwoodPlankSlab, ModFluffBlocks.livingrockSlab, ModFluffBlocks.dreamwoodSlab, ModFluffBlocks.livingrockBrickSlab,
ModFluffBlocks.dreamwoodPlankSlab, ModFluffBlocks.prismarineSlab, ModFluffBlocks.prismarineBrickSlab, ModFluffBlocks.darkPrismarineSlab,
ModFluffBlocks.reedSlab, ModFluffBlocks.thatchSlab, ModFluffBlocks.netherBrickSlab, ModFluffBlocks.soulBrickSlab, ModFluffBlocks.snowBrickSlab,
ModFluffBlocks.tileSlab, ModFluffBlocks.manaQuartzSlab, ModFluffBlocks.blazeQuartzSlab, ModFluffBlocks.darkQuartzSlab,
ModFluffBlocks.lavenderQuartzSlab, ModFluffBlocks.redQuartzSlab, ModFluffBlocks.elfQuartzSlab, ModFluffBlocks.sunnyQuartzSlab, ModFluffBlocks.dirtPathSlab,
ModFluffBlocks.shimmerrockSlab, ModFluffBlocks.shimmerwoodPlankSlab, ModFluffBlocks.endStoneSlab, ModFluffBlocks.enderBrickSlab);
for (Block b : otherSlabs) {
if (b == null) // Dark quartz disabled
continue;
ModelLoader.setCustomStateMapper(b, (new StateMap.Builder()).ignore(BlockModSlab.DUMMY).build());
}
// Ignore both dummy variant and half prop in full slabs
for (Block b : ModFluffBlocks.biomeStoneFullSlabs) {
ModelLoader.setCustomStateMapper(b, (new StateMap.Builder()).ignore(BlockModSlab.DUMMY, BlockSlab.HALF).build());
}
for (Block b : ModFluffBlocks.pavementFullSlabs) {
ModelLoader.setCustomStateMapper(b, (new StateMap.Builder()).ignore(BlockModSlab.DUMMY, BlockSlab.HALF).build());
}
for (Block b : ModFluffBlocks.stoneFullSlabs) {
ModelLoader.setCustomStateMapper(b, (new StateMap.Builder()).ignore(BlockModSlab.DUMMY, BlockSlab.HALF).build());
}
List<Block> otherFullSlabs = Lists.newArrayList(ModFluffBlocks.livingwoodSlabFull, ModFluffBlocks.livingwoodPlankSlabFull, ModFluffBlocks.livingrockSlabFull, ModFluffBlocks.dreamwoodSlabFull, ModFluffBlocks.livingrockBrickSlabFull,
ModFluffBlocks.dreamwoodPlankSlabFull, ModFluffBlocks.prismarineSlabFull, ModFluffBlocks.prismarineBrickSlabFull, ModFluffBlocks.darkPrismarineSlabFull,
ModFluffBlocks.reedSlabFull, ModFluffBlocks.thatchSlabFull, ModFluffBlocks.netherBrickSlabFull, ModFluffBlocks.soulBrickSlabFull, ModFluffBlocks.snowBrickSlabFull,
ModFluffBlocks.tileSlabFull, ModFluffBlocks.darkQuartzSlabFull, ModFluffBlocks.manaQuartzSlabFull, ModFluffBlocks.blazeQuartzSlabFull,
ModFluffBlocks.lavenderQuartzSlabFull, ModFluffBlocks.redQuartzSlabFull, ModFluffBlocks.elfQuartzSlabFull, ModFluffBlocks.sunnyQuartzSlabFull, ModFluffBlocks.dirtPathSlabFull,
ModFluffBlocks.shimmerrockSlabFull, ModFluffBlocks.shimmerwoodPlankSlabFull, ModFluffBlocks.endStoneSlabFull, ModFluffBlocks.enderBrickSlabFull);
for (Block b : otherFullSlabs) {
if (b == null) // Dark quartz disabled
continue;
ModelLoader.setCustomStateMapper(b, (new StateMap.Builder()).ignore(BlockModSlab.DUMMY, BlockSlab.HALF).build());
}
// Ignore everything in TESR items to suppress missing model errors
ModelLoader.setCustomStateMapper(ModBlocks.avatar, new StateMap.Builder().ignore(BotaniaStateProps.CARDINALS).build());
ModelLoader.setCustomStateMapper(ModBlocks.bellows, new StateMap.Builder().ignore(BotaniaStateProps.CARDINALS).build());
ModelLoader.setCustomStateMapper(ModBlocks.brewery, new StateMap.Builder().ignore(BotaniaStateProps.POWERED).build());
ModelLoader.setCustomStateMapper(ModBlocks.gaiaHead, new StateMap.Builder().ignore(BlockSkull.FACING, BlockSkull.NODROP).build());
ModelLoader.setCustomStateMapper(ModBlocks.hourglass, new StateMap.Builder().ignore(BotaniaStateProps.POWERED).build());
// Registers the ItemBlock to models/item/<registryname>#inventory
public static void registerInventoryVariant(Block b) {
ModelLoader.setCustomModelResourceLocation(
Item.getItemFromBlock(b), 0,
new ModelResourceLocation(b.getRegistryName(), "inventory"));
}
private static void registerMushrooms() {
Item item = Item.getItemFromBlock(ModBlocks.mushroom);
for (EnumDyeColor color : EnumDyeColor.values()) {
String name = Block.blockRegistry.getNameForObject(ModBlocks.mushroom).toString();
ModelLoader.setCustomModelResourceLocation(item, color.getMetadata(), new ModelResourceLocation(name, "inventory_" + color.getName()));
}
// Registers the ItemBlock to a custom path in models/item/itemblock/
public static void registerCustomItemblock(Block b, String path) {
registerCustomItemblock(b, 1, i -> path);
}
private static void registerFlowers() {
Item item = Item.getItemFromBlock(ModBlocks.flower);
for (EnumDyeColor color : EnumDyeColor.values()) {
String name = Block.blockRegistry.getNameForObject(ModBlocks.flower).toString();
ModelLoader.setCustomModelResourceLocation(item, color.getMetadata(), new ModelResourceLocation(name, "inventory_" + color.getName()));
}
item = Item.getItemFromBlock(ModBlocks.shinyFlower);
for (EnumDyeColor color : EnumDyeColor.values()) {
String name = Block.blockRegistry.getNameForObject(ModBlocks.shinyFlower).toString();
ModelLoader.setCustomModelResourceLocation(item, color.getMetadata(), new ModelResourceLocation(name, "inventory_" + color.getName()));
}
item = Item.getItemFromBlock(ModBlocks.doubleFlower1);
for (EnumDyeColor color : BotaniaStateProps.DOUBLEFLOWER_VARIANT_1.getAllowedValues()) {
String name = Block.blockRegistry.getNameForObject(ModBlocks.doubleFlower1).toString();
String variant = "inventory_" + color.getName();
ModelLoader.setCustomModelResourceLocation(item, color.getMetadata(), new ModelResourceLocation(name, variant));
}
item = Item.getItemFromBlock(ModBlocks.doubleFlower2);
for (EnumDyeColor color : BotaniaStateProps.DOUBLEFLOWER_VARIANT_2.getAllowedValues()) {
String name = Block.blockRegistry.getNameForObject(ModBlocks.doubleFlower2).toString();
String variant = "inventory_" + color.getName();
ModelLoader.setCustomModelResourceLocation(item, color.getMetadata() - 8, new ModelResourceLocation(name, variant));
}
}
private static void registerPavement() {
Item item = Item.getItemFromBlock(ModFluffBlocks.pavement);
String name = Block.blockRegistry.getNameForObject(ModFluffBlocks.pavement).toString();
for (EnumDyeColor e : BotaniaStateProps.PAVEMENT_COLOR.getAllowedValues()) {
String variant = "color=" + e.getName();
switch (e) { // Explicit switch needed because saved meta does not match EnumDyeColor
case BLACK: {
ModelLoader.setCustomModelResourceLocation(item, 1, new ModelResourceLocation(name, variant));
break;
}
case BLUE: {
ModelLoader.setCustomModelResourceLocation(item, 2, new ModelResourceLocation(name, variant));
break;
}
case RED: {
ModelLoader.setCustomModelResourceLocation(item, 3, new ModelResourceLocation(name, variant));
break;
}
case YELLOW: {
ModelLoader.setCustomModelResourceLocation(item, 4, new ModelResourceLocation(name, variant));
break;
}
case GREEN: {
ModelLoader.setCustomModelResourceLocation(item, 5, new ModelResourceLocation(name, variant));
break;
}
case WHITE:
default: {
ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(name, variant));
break;
}
}
}
}
private static void registerStairs() {
for (Block b : ModFluffBlocks.stoneStairs) {
registerItemModel(b);
}
for (Block b : ModFluffBlocks.pavementStairs) {
registerItemModel(b);
}
for (Block b : ModFluffBlocks.biomeStoneStairs) {
registerItemModel(b);
}
registerItemModel(ModFluffBlocks.blazeQuartzStairs);
registerItemModel(ModFluffBlocks.darkPrismarineStairs);
if (ConfigHandler.darkQuartzEnabled)
registerItemModel(ModFluffBlocks.darkQuartzStairs);
registerItemModel(ModFluffBlocks.dreamwoodStairs);
registerItemModel(ModFluffBlocks.dreamwoodPlankStairs);
registerItemModel(ModFluffBlocks.elfQuartzStairs);
registerItemModel(ModFluffBlocks.enderBrickStairs);
registerItemModel(ModFluffBlocks.endStoneStairs);
registerItemModel(ModFluffBlocks.lavenderQuartzStairs);
registerItemModel(ModFluffBlocks.livingrockStairs);
registerItemModel(ModFluffBlocks.livingrockBrickStairs);
registerItemModel(ModFluffBlocks.livingwoodStairs);
registerItemModel(ModFluffBlocks.livingwoodPlankStairs);
registerItemModel(ModFluffBlocks.manaQuartzStairs);
registerItemModel(ModFluffBlocks.netherBrickStairs);
registerItemModel(ModFluffBlocks.prismarineStairs);
registerItemModel(ModFluffBlocks.prismarineBrickStairs);
registerItemModel(ModFluffBlocks.redQuartzStairs);
registerItemModel(ModFluffBlocks.reedStairs);
registerItemModel(ModFluffBlocks.shimmerrockStairs);
registerItemModel(ModFluffBlocks.shimmerwoodPlankStairs);
registerItemModel(ModFluffBlocks.snowBrickStairs);
registerItemModel(ModFluffBlocks.soulBrickStairs);
registerItemModel(ModFluffBlocks.sunnyQuartzStairs);
registerItemModel(ModFluffBlocks.thatchStairs);
registerItemModel(ModFluffBlocks.tileStairs);
}
private static void registerSlabs() {
for (Block b : ModFluffBlocks.biomeStoneSlabs) {
registerItemModel(b);
}
for (Block b : ModFluffBlocks.pavementSlabs) {
registerItemModel(b);
}
for (Block b : ModFluffBlocks.stoneSlabs) {
registerItemModel(b);
}
registerItemModel(ModFluffBlocks.livingwoodSlab);
registerItemModel(ModFluffBlocks.livingwoodPlankSlab);
registerItemModel(ModFluffBlocks.livingrockSlab);
registerItemModel(ModFluffBlocks.livingrockBrickSlab);
registerItemModel(ModFluffBlocks.blazeQuartzSlab);
if (ConfigHandler.darkQuartzEnabled)
registerItemModel(ModFluffBlocks.darkQuartzSlab);
registerItemModel(ModFluffBlocks.elfQuartzSlab);
registerItemModel(ModFluffBlocks.lavenderQuartzSlab);
registerItemModel(ModFluffBlocks.manaQuartzSlab);
registerItemModel(ModFluffBlocks.redQuartzSlab);
registerItemModel(ModFluffBlocks.sunnyQuartzSlab);
registerItemModel(ModFluffBlocks.dreamwoodSlab);
registerItemModel(ModFluffBlocks.dreamwoodPlankSlab);
registerItemModel(ModFluffBlocks.prismarineSlab);
registerItemModel(ModFluffBlocks.prismarineBrickSlab);
registerItemModel(ModFluffBlocks.darkPrismarineSlab);
registerItemModel(ModFluffBlocks.dirtPathSlab);
registerItemModel(ModFluffBlocks.shimmerrockSlab);
registerItemModel(ModFluffBlocks.shimmerwoodPlankSlab);
registerItemModel(ModFluffBlocks.endStoneSlab);
registerItemModel(ModFluffBlocks.enderBrickSlab);
registerItemModel(ModFluffBlocks.netherBrickSlab);
registerItemModel(ModFluffBlocks.soulBrickSlab);
registerItemModel(ModFluffBlocks.snowBrickSlab);
registerItemModel(ModFluffBlocks.tileSlab);
registerItemModel(ModFluffBlocks.reedSlab);
registerItemModel(ModFluffBlocks.thatchSlab);
}
private static void registerWalls() {
Item item = Item.getItemFromBlock(ModFluffBlocks.biomeStoneWall);
for (BiomeStoneVariant variant : BotaniaStateProps.BIOMESTONEWALL_VARIANT.getAllowedValues()) {
String variantName = "inventory_" + variant.getName();
ModelLoader.setCustomModelResourceLocation(item, variant.ordinal() - 8, new ModelResourceLocation("botania:biomeStoneA0Wall", variantName));
}
item = Item.getItemFromBlock(ModFluffBlocks.stoneWall);
for (FutureStoneVariant variant : BotaniaStateProps.FUTURESTONEWALL_VARIANT.getAllowedValues()) {
String variantName = "inventory_" + variant.getName();
ModelLoader.setCustomModelResourceLocation(item, variant.ordinal(), new ModelResourceLocation("botania:stone0Wall", variantName));
}
registerItemModel(ModFluffBlocks.livingrockWall);
registerItemModel(ModFluffBlocks.livingwoodWall);
registerItemModel(ModFluffBlocks.dreamwoodWall);
registerItemModel(ModFluffBlocks.prismarineWall);
registerItemModel(ModFluffBlocks.reedWall);
}
private static void registerPanes() {
registerItemModel(ModFluffBlocks.alfglassPane);
registerItemModel(ModFluffBlocks.bifrostPane);
registerItemModel(ModFluffBlocks.managlassPane);
}
private static void registerAltars() {
Item item = Item.getItemFromBlock(ModBlocks.altar);
String name = Block.blockRegistry.getNameForObject(ModBlocks.altar).toString();
for (int i = 0; i < AltarVariant.values().length - 1; i++) { // Off by one on purpose to exclude MOSSY
String variantName = "variant=" + AltarVariant.values()[i].getName();
ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(name, variantName));
}
}
private static void registerQuartzBlocks() {
for (Block b : Lists.newArrayList(ModFluffBlocks.blazeQuartz, ModFluffBlocks.darkQuartz, ModFluffBlocks.elfQuartz, ModFluffBlocks.lavenderQuartz, ModFluffBlocks.manaQuartz, ModFluffBlocks.redQuartz, ModFluffBlocks.sunnyQuartz)) {
if (b == null) // Dark quartz disabled
continue;
Item item = Item.getItemFromBlock(b);
String name = Block.blockRegistry.getNameForObject(b).toString();
ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(name, "variant=normal"));
ModelLoader.setCustomModelResourceLocation(item, 1, new ModelResourceLocation(name, "variant=chiseled"));
ModelLoader.setCustomModelResourceLocation(item, 2, new ModelResourceLocation(name, "variant=pillar_y"));
}
}
private static void registerLuminizers() {
Item item = Item.getItemFromBlock(ModBlocks.lightRelay);
String name = Block.blockRegistry.getNameForObject(ModBlocks.lightRelay).toString();
for (LuminizerVariant v : LuminizerVariant.values()) {
ModelLoader.setCustomModelResourceLocation(item, v.ordinal(), new ModelResourceLocation(name, "powered=false,variant=" + v.getName()));
}
}
private static <T extends Enum<T> & IStringSerializable> void registerVariantsDefaulted(Block b, Class<T> enumclazz, String variantHeader) {
public static void registerCustomItemblock(Block b, int maxExclusive, IntFunction<String> metaToPath) {
Item item = Item.getItemFromBlock(b);
for (T e : enumclazz.getEnumConstants()) {
String baseName = Block.blockRegistry.getNameForObject(b).toString();
String variantName = variantHeader + "=" + e.getName();
ModelLoader.setCustomModelResourceLocation(item, e.ordinal(), new ModelResourceLocation(baseName, variantName));
for (int i = 0; i < maxExclusive; i++) {
ModelLoader.setCustomModelResourceLocation(
item, i,
new ModelResourceLocation(LibMisc.MOD_ID + ":itemblock/" + metaToPath.apply(i), "inventory")
);
}
}
/**
* Registers all metas of the given item to models/item/registryname.json
*/
private static void registerItemModelAllMeta(Item item, int range) {
String loc = Item.itemRegistry.getNameForObject(item).toString();
for(int i = 0; i < range; i++) {
ModelLoader.registerItemVariants(item, new ModelResourceLocation(loc, "inventory"));
ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(loc, "inventory"));
}
}
/**
* Registers each meta of an item to models/item/registryname<meta>.json
* Range is exclusive upper bound
*/
private static void registerItemModelMetas(Item item, String loc, int range) {
for(int i = 0; i < range; i++) {
String name = "botania:" + loc + i;
ModelLoader.registerItemVariants(item, new ModelResourceLocation(name, "inventory"));
ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(name, "inventory"));
}
}
private static void registerItemModel(Block b) {
registerItemModel(Item.getItemFromBlock(b));
}
private static void registerItemModel(Item i,int meta) {
ResourceLocation loc = i.getRegistryName();
ModelLoader.setCustomModelResourceLocation(i, meta, new ModelResourceLocation(loc, "inventory"));
}
private static void registerItemModel(Item i) {
registerItemModel(i, 0);
}
private ModelHandler() {}
private interface MesherWrapper extends ItemMeshDefinition {
static MesherWrapper of(MesherWrapper w) {
return w;
}
ModelResourceLocation getLocation(ItemStack stack);
@Override
default ModelResourceLocation getModelLocation(ItemStack stack) {
return getLocation(stack);
}
}
}
@@ -17,10 +17,12 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.WorldType;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import vazkii.botania.api.lexicon.multiblock.Multiblock;
import vazkii.botania.api.lexicon.multiblock.component.MultiblockComponent;
import javax.annotation.Nonnull;
/**
* This class acts as a wrapper around a block access to
* replace blocks with the blocks involved in the multiblock specified
@@ -32,18 +34,19 @@ public class MultiblockBlockAccess implements IBlockAccess {
private BlockPos anchorPos;
protected Multiblock multiblock;
@Nonnull
@Override
public IBlockState getBlockState(BlockPos pos) {
public IBlockState getBlockState(@Nonnull BlockPos pos) {
MultiblockComponent comp=getComponent(pos);
if(comp != null)
return comp.getBlockState();
if(hasBlockAccess)
return originalBlockAccess.getBlockState(pos);
return Blocks.air.getDefaultState();
return Blocks.AIR.getDefaultState();
}
@Override
public TileEntity getTileEntity(BlockPos pos) {
public TileEntity getTileEntity(@Nonnull BlockPos pos) {
MultiblockComponent comp=getComponent(pos);
if(comp != null)
return comp.getTileEntity();
@@ -53,24 +56,25 @@ public class MultiblockBlockAccess implements IBlockAccess {
}
@Override
public int getCombinedLight(BlockPos pos, int p_72802_4_) {
public int getCombinedLight(@Nonnull BlockPos pos, int lightValue) {
if(hasBlockAccess)
return originalBlockAccess.getCombinedLight(pos, p_72802_4_);
return originalBlockAccess.getCombinedLight(pos, lightValue);
return 15728640;
}
@Override
public int getStrongPower(BlockPos pos, EnumFacing direction) {
public int getStrongPower(@Nonnull BlockPos pos, @Nonnull EnumFacing direction) {
return 0;
}
@Nonnull
@Override
public WorldType getWorldType() {
return WorldType.DEFAULT;
}
@Override
public boolean isAirBlock(BlockPos pos) {
public boolean isAirBlock(@Nonnull BlockPos pos) {
MultiblockComponent comp=getComponent(pos);
if(comp != null)
return false;
@@ -79,20 +83,16 @@ public class MultiblockBlockAccess implements IBlockAccess {
return true;
}
@Nonnull
@Override
public BiomeGenBase getBiomeGenForCoords(BlockPos pos) {
public Biome getBiome(@Nonnull BlockPos pos) {
if(hasBlockAccess)
return originalBlockAccess.getBiomeGenForCoords(pos);
return originalBlockAccess.getBiome(pos);
return null;
}
@Override
public boolean extendedLevelsInChunkCache() {
return hasBlockAccess && originalBlockAccess.extendedLevelsInChunkCache();
}
@Override
public boolean isSideSolid(BlockPos pos, EnumFacing side, boolean _default) {
public boolean isSideSolid(@Nonnull BlockPos pos, @Nonnull EnumFacing side, boolean _default) {
if(hasBlockAccess)
return originalBlockAccess.isSideSolid(pos, side, _default);
return _default;
@@ -40,7 +40,9 @@ import vazkii.botania.common.block.ModBlocks;
public final class MultiblockRenderHandler {
private static MultiblockBlockAccess blockAccess = new MultiblockBlockAccess();
private MultiblockRenderHandler() {}
private static final MultiblockBlockAccess blockAccess = new MultiblockBlockAccess();
private static int dimension;
public static boolean rendering = false;
@@ -66,21 +68,6 @@ public final class MultiblockRenderHandler {
return true;
}
});
// TODO also a temporary shim for same reason as above
IMultiblockRenderHook.renderHooks.put(ModBlocks.pool, new IMultiblockRenderHook() {
@Override
public void renderBlockForMultiblock(IBlockAccess world, Multiblock mb, IBlockState state, MultiblockComponent comp) {
GlStateManager.translate(-0.5F, -0.5F, 0.5F);
IBakedModel model = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelForState(ModBlocks.pool.getDefaultState());
Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelRenderer().renderModelBrightness(model, ModBlocks.pool.getDefaultState(), 1.0F, false);
}
@Override
public boolean needsTranslate(IBlockState state) {
return true;
}
});
}
public static void setMultiblock(MultiblockSet set) {
@@ -94,7 +81,7 @@ public final class MultiblockRenderHandler {
}
@SubscribeEvent
public void onWorldRenderLast(RenderWorldLastEvent event) {
public static void onWorldRenderLast(RenderWorldLastEvent event) {
Minecraft mc = Minecraft.getMinecraft();
if(mc.thePlayer != null && mc.objectMouseOver != null && mc.objectMouseOver.getBlockPos() != null && (!mc.thePlayer.isSneaking() || anchor != null)) {
renderPlayerLook(mc.thePlayer, mc.objectMouseOver);
@@ -102,7 +89,7 @@ public final class MultiblockRenderHandler {
}
@SubscribeEvent
public void onPlayerInteract(PlayerInteractEvent.RightClickBlock event) {
public static void onPlayerInteract(PlayerInteractEvent.RightClickBlock event) {
if(currentMultiblock != null && anchor == null && event.getEntityPlayer() == Minecraft.getMinecraft().thePlayer) {
anchor = event.getPos();
angle = event.getEntityPlayer().getHorizontalFacing();
@@ -110,12 +97,12 @@ public final class MultiblockRenderHandler {
}
}
private void renderPlayerLook(EntityPlayer player, RayTraceResult src) {
private static void renderPlayerLook(EntityPlayer player, RayTraceResult src) {
if(currentMultiblock != null && dimension == player.worldObj.provider.getDimension()) {
BlockPos anchorPos = anchor != null ? anchor : src.getBlockPos();
GlStateManager.pushMatrix();
GL11.glPushAttrib(GL11.GL_LIGHTING);
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.disableLighting();
@@ -148,7 +135,7 @@ public final class MultiblockRenderHandler {
}
}
private boolean renderComponentInWorld(World world, Multiblock mb, MultiblockComponent comp, BlockPos anchorPos) {
private static boolean renderComponentInWorld(World world, Multiblock mb, MultiblockComponent comp, BlockPos anchorPos) {
double renderPosX, renderPosY, renderPosZ;
try {
@@ -186,7 +173,7 @@ public final class MultiblockRenderHandler {
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
IBlockState state = comp.getBlockState();
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
if(state == null)
return;
if(IMultiblockRenderHook.renderHooks.containsKey(state.getBlock())) {
@@ -37,7 +37,7 @@ public final class RedStringRenderer {
GlStateManager.pushMatrix();
GlStateManager.disableTexture2D();
GlStateManager.enableBlend();
GL11.glPushAttrib(GL11.GL_LIGHTING);
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
GlStateManager.disableLighting();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.color(1F, 0F, 0F, sizeAlpha);
@@ -81,9 +81,9 @@ public final class RedStringRenderer {
GlStateManager.pushMatrix();
GlStateManager.translate(tile.getPos().getX() + 0.5 - renderPosX, tile.getPos().getY() + 0.5 - renderPosY, tile.getPos().getZ() + 0.5 - renderPosZ);
Vector3 vecOrig = new Vector3(bind.getX() - tile.getPos().getX(), bind.getY() - tile.getPos().getY(), bind.getZ() - tile.getPos().getZ());
Vector3 vecNorm = vecOrig.copy().normalize();
Vector3 vecMag = vecNorm.copy().multiply(0.025);
Vector3 vecApply = vecMag.copy();
Vector3 vecNorm = vecOrig.normalize();
Vector3 vecMag = vecNorm.multiply(0.025);
Vector3 vecApply = vecMag;
int stages = (int) (vecOrig.mag() / vecMag.mag());
@@ -97,7 +97,7 @@ public final class RedStringRenderer {
for(int i = 0; i < stages; i++) {
addVertexAtWithTranslation(tessellator, dir, vecApply.x, vecApply.y, vecApply.z, rand, len);
rand = Math.random() - 0.5;
vecApply.add(vecMag);
vecApply = vecApply.add(vecMag);
len += add;
addVertexAtWithTranslation(tessellator, dir, vecApply.x, vecApply.y, vecApply.z, rand, len);
}
@@ -8,20 +8,23 @@ import net.minecraft.client.model.ModelBook;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumHandSide;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.client.event.RenderHandEvent;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.client.event.RenderSpecificHandEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.lwjgl.util.glu.Project;
import vazkii.botania.client.gui.lexicon.GuiLexicon;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.core.helper.PlayerHelper;
import vazkii.botania.common.item.ItemLexicon;
@@ -30,115 +33,59 @@ import vazkii.botania.common.item.ModItems;
// Hacky way to render 3D lexicon, will be reevaluated in the future.
public class RenderLexicon {
ModelBook model = new ModelBook();
ResourceLocation texture = new ResourceLocation(LibResources.MODEL_LEXICA);
private final ModelBook model = new ModelBook();
private final ResourceLocation texture = new ResourceLocation(LibResources.MODEL_LEXICA);
@SubscribeEvent
public void renderItem(RenderHandEvent evt) {
public void renderItem(RenderSpecificHandEvent evt) {
Minecraft mc = Minecraft.getMinecraft();
if(true || !ConfigHandler.lexicon3dModel || mc.gameSettings.thirdPersonView != 0 || !PlayerHelper.hasHeldItem(mc.thePlayer, ModItems.lexicon))
if(!ConfigHandler.lexicon3dModel
|| mc.gameSettings.thirdPersonView != 0
|| mc.thePlayer.getHeldItem(evt.getHand()) == null
|| mc.thePlayer.getHeldItem(evt.getHand()).getItem() != ModItems.lexicon)
return;
evt.setCanceled(true);
try {
// Called immediately before EntityRenderer.renderHand
GlStateManager.clear(256);
// Begin copy EntityRenderer.renderHand
GlStateManager.matrixMode(5889);
GlStateManager.loadIdentity();
float f = 0.07F;
if (mc.gameSettings.anaglyph)
{
GlStateManager.translate((float)(-(/*xOffset*/0 * 2 - 1)) * f, 0.0F, 0.0F);
}
float fovModifier = ((float) ClientMethodHandles.getFOVModifier.invokeExact(mc.entityRenderer, ClientTickHandler.partialTicks, false));
float farPlane = ((float) ClientMethodHandles.farPlaneDistance_getter.invokeExact(mc.entityRenderer));
Project.gluPerspective(fovModifier, (float)mc.displayWidth / (float)mc.displayHeight, 0.05F, farPlane * 2.0F);
GlStateManager.matrixMode(5888);
GlStateManager.loadIdentity();
if (mc.gameSettings.anaglyph)
{
GlStateManager.translate((float)(/*xOffset*/0 * 2 - 1) * 0.1F, 0.0F, 0.0F);
}
GlStateManager.pushMatrix();
ClientMethodHandles.hurtCameraEffect.invokeExact(mc.entityRenderer, ClientTickHandler.partialTicks);
if (mc.gameSettings.viewBobbing)
{
ClientMethodHandles.setupViewBobbing.invokeExact(mc.entityRenderer, ClientTickHandler.partialTicks);
}
boolean flag = mc.getRenderViewEntity() instanceof EntityLivingBase && ((EntityLivingBase)mc.getRenderViewEntity()).isPlayerSleeping();
if (mc.gameSettings.thirdPersonView == 0 && !flag && !mc.gameSettings.hideGUI && !mc.playerController.isSpectator())
{
ClientMethodHandles.enableLightmap.invokeExact(mc.entityRenderer);
renderItemInFirstPerson();
ClientMethodHandles.disableLightmap.invokeExact(mc.entityRenderer);
}
GlStateManager.popMatrix();
if (mc.gameSettings.thirdPersonView == 0 && !flag)
{
mc.getItemRenderer().renderOverlays(ClientTickHandler.partialTicks);
ClientMethodHandles.hurtCameraEffect.invokeExact(mc.entityRenderer, ClientTickHandler.partialTicks);
}
if (mc.gameSettings.viewBobbing)
{
ClientMethodHandles.setupViewBobbing.invokeExact(mc.entityRenderer, ClientTickHandler.partialTicks);
}
// End EntityRenderer.renderHand copy
renderItemInFirstPerson(mc.thePlayer, evt.getPartialTicks(), evt.getInterpolatedPitch(), evt.getHand(), evt.getSwingProgress(), evt.getItemStack(), evt.getEquipProgress());
} catch (Throwable throwable) {
FMLLog.warning("[Botania]: Failed to render lexicon");
throwable.printStackTrace();
Botania.LOGGER.warn("Failed to render lexicon");
}
}
private void renderItemInFirstPerson() throws Throwable {
private void renderItemInFirstPerson(AbstractClientPlayer player, float partialTicks, float interpPitch, EnumHand hand, float swingProgress, ItemStack stack, float equipProgress) throws Throwable {
// Cherry picked from ItemRenderer.renderItemInFirstPerson
float prevEquippedProgress = 0;//((float) ClientMethodHandles.prevEquippedProgress_getter.invokeExact(Minecraft.getMinecraft().getItemRenderer()));
float equippedProgress = 0;//((float) ClientMethodHandles.equippedProgress_getter.invokeExact(Minecraft.getMinecraft().getItemRenderer()));
float f = 1.0F - (prevEquippedProgress + (equippedProgress - prevEquippedProgress) * ClientTickHandler.partialTicks);
EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
float f1 = player.getSwingProgress(ClientTickHandler.partialTicks);
float f2 = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * ClientTickHandler.partialTicks;
float f3 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * ClientTickHandler.partialTicks;
this.func_178101_a(f2, f3);
this.func_178109_a(player);
this.func_178110_a(player, ClientTickHandler.partialTicks);
GlStateManager.enableRescaleNormal();
boolean flag = hand == EnumHand.MAIN_HAND;
EnumHandSide enumhandside = flag ? player.getPrimaryHand() : player.getPrimaryHand().opposite();
GlStateManager.pushMatrix();
this.func_178105_d(f1);
this.transformFirstPersonItem(f, f1);
doRender();
boolean flag1 = enumhandside == EnumHandSide.RIGHT;
float f = -0.4F * MathHelper.sin(MathHelper.sqrt_float(swingProgress) * (float)Math.PI);
float f1 = 0.2F * MathHelper.sin(MathHelper.sqrt_float(swingProgress) * ((float)Math.PI * 2F));
float f2 = -0.2F * MathHelper.sin(swingProgress * (float)Math.PI);
int i = flag1 ? 1 : -1;
GlStateManager.translate((float)i * f, f1, f2);
this.transformSideFirstPerson(enumhandside, equipProgress);
this.transformFirstPerson(enumhandside, swingProgress);
doRender(enumhandside, partialTicks, stack);
GlStateManager.popMatrix();
GlStateManager.disableRescaleNormal();
RenderHelper.disableStandardItemLighting();
}
private void doRender() {
private void doRender(EnumHandSide side, float partialTicks, ItemStack stack) {
Minecraft mc = Minecraft.getMinecraft();
GlStateManager.pushMatrix();
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
float opening = 0F;
float pageFlip = 0F;
mc.renderEngine.bindTexture(texture);
float opening;
float pageFlip;
float ticks = ClientTickHandler.ticksWithLexicaOpen;
if(ticks > 0 && ticks < 10) {
if(Minecraft.getMinecraft().currentScreen instanceof GuiLexicon)
ticks += ClientTickHandler.partialTicks;
else ticks -= ClientTickHandler.partialTicks;
ticks += partialTicks;
else ticks -= partialTicks;
}
GlStateManager.translate(0.3F + 0.02F * ticks, 0.475F + 0.01F * ticks, -0.2F - 0.01F * ticks);
GlStateManager.rotate(87.5F + ticks * 5, 0F, 1F, 0F);
GlStateManager.rotate(87.5F + ticks * (side == EnumHandSide.RIGHT ? 5 : 10), 0F, 1F, 0F);
GlStateManager.rotate(ticks * 2.85F, 0F, 0F, 1F);
opening = ticks / 12F;
@@ -154,91 +101,71 @@ public class RenderLexicon {
GlStateManager.rotate(180F, 0F, 0F, 1F);
GlStateManager.translate(-0.3F, -0.21F, -0.07F);
GlStateManager.scale(0.0035F, 0.0035F, -0.0035F);
boolean bevo = Minecraft.getMinecraft().thePlayer.getName().equalsIgnoreCase("BevoLJ");
boolean saice = Minecraft.getMinecraft().thePlayer.getName().equalsIgnoreCase("saice");
boolean bevo = mc.thePlayer.getName().equalsIgnoreCase("BevoLJ");
boolean saice = mc.thePlayer.getName().equalsIgnoreCase("saice");
String title = ModItems.lexicon.getItemStackDisplayName(null);
String origTitle = title;
ItemStack stack = PlayerHelper.getFirstHeldItemClass(Minecraft.getMinecraft().thePlayer, Item.class);
if(stack != null)
title = stack.getDisplayName();
if(title.equals(origTitle) && bevo)
title = I18n.translateToLocal("item.botania:lexicon.bevo");
title = I18n.format("item.botania:lexicon.bevo");
if(title.equals(origTitle) && saice)
title = I18n.translateToLocal("item.botania:lexicon.saice");
title = I18n.format("item.botania:lexicon.saice");
font.drawString(font.trimStringToWidth(title, 80), 0, 0, 0xD69700);
GlStateManager.translate(0F, 10F, 0F);
GlStateManager.scale(0.6F, 0.6F, 0.6F);
font.drawString(TextFormatting.ITALIC + "" + TextFormatting.BOLD + String.format(I18n.translateToLocal("botaniamisc.edition"), ItemLexicon.getEdition()), 0, 0, 0xA07100);
font.drawString(TextFormatting.ITALIC + "" + TextFormatting.BOLD + I18n.format("botaniamisc.edition", ItemLexicon.getEdition()), 0, 0, 0xA07100);
GlStateManager.translate(0F, 15F, 0F);
font.drawString(I18n.translateToLocal("botaniamisc.lexiconcover0"), 0, 0, 0x79ff92);
font.drawString(I18n.format("botaniamisc.lexiconcover0"), 0, 0, 0x79ff92);
GlStateManager.translate(0F, 10F, 0F);
font.drawString(I18n.translateToLocal("botaniamisc.lexiconcover1"), 0, 0, 0x79ff92);
font.drawString(I18n.format("botaniamisc.lexiconcover1"), 0, 0, 0x79ff92);
GlStateManager.translate(0F, 50F, 0F);
font.drawString(I18n.translateToLocal("botaniamisc.lexiconcover2"), 0, 0, 0x79ff92);
font.drawString(I18n.format("botaniamisc.lexiconcover2"), 0, 0, 0x79ff92);
GlStateManager.translate(0F, 10F, 0F);
font.drawString(TextFormatting.UNDERLINE + "" + TextFormatting.ITALIC + I18n.translateToLocal("botaniamisc.lexiconcover3"), 0, 0, 0x79ff92);
font.drawString(TextFormatting.UNDERLINE + "" + TextFormatting.ITALIC + I18n.format("botaniamisc.lexiconcover3"), 0, 0, 0x79ff92);
if(bevo || saice) {
GlStateManager.translate(0F, 10F, 0F);
font.drawString(I18n.translateToLocal("botaniamisc.lexiconcover" + (bevo ? 4 : 5)), 0, 0, 0x79ff92);
font.drawString(I18n.format("botaniamisc.lexiconcover" + (bevo ? 4 : 5)), 0, 0, 0x79ff92);
}
GlStateManager.color(1F, 1F, 1F);
}
GlStateManager.popMatrix();
}
// Copy - ItemRenderer.func_178101_a
private void func_178101_a(float angle, float p_178101_2_) {
GlStateManager.pushMatrix();
GlStateManager.rotate(angle, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(p_178101_2_, 0.0F, 1.0F, 0.0F);
RenderHelper.enableStandardItemLighting();
GlStateManager.popMatrix();
// Copy - ItemRenderer.transformSideFirstPerson
// Arg - Side, EquipProgress
private void transformSideFirstPerson(EnumHandSide p_187459_1_, float p_187459_2_)
{
int i = p_187459_1_ == EnumHandSide.RIGHT ? 1 : -1;
GlStateManager.translate((float)i * 0.56F, -0.52F + p_187459_2_ * -0.6F, -0.72F);
}
// Copy - ItemRenderer.func_178109_a
private void func_178109_a(AbstractClientPlayer clientPlayer) {
int i = Minecraft.getMinecraft().theWorld.getCombinedLight(new BlockPos(clientPlayer.posX, clientPlayer.posY + (double)clientPlayer.getEyeHeight(), clientPlayer.posZ), 0);
float f = (float)(i & 65535);
float f1 = (float)(i >> 16);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, f, f1);
}
// Copy - ItemRenderer.func_178110_a
private void func_178110_a(EntityPlayerSP entityplayerspIn, float partialTicks) {
float f = entityplayerspIn.prevRenderArmPitch + (entityplayerspIn.renderArmPitch - entityplayerspIn.prevRenderArmPitch) * partialTicks;
float f1 = entityplayerspIn.prevRenderArmYaw + (entityplayerspIn.renderArmYaw - entityplayerspIn.prevRenderArmYaw) * partialTicks;
GlStateManager.rotate((entityplayerspIn.rotationPitch - f) * 0.1F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate((entityplayerspIn.rotationYaw - f1) * 0.1F, 0.0F, 1.0F, 0.0F);
}
// Copy - ItemRenderer.func_178105_d
private void func_178105_d(float p_178105_1_) {
float f = -0.4F * MathHelper.sin(MathHelper.sqrt_float(p_178105_1_) * (float)Math.PI);
float f1 = 0.2F * MathHelper.sin(MathHelper.sqrt_float(p_178105_1_) * (float)Math.PI * 2.0F);
float f2 = -0.2F * MathHelper.sin(p_178105_1_ * (float)Math.PI);
GlStateManager.translate(f, f1, f2);
}
// Copy with modification - ItemRenderer.transformFirstPersonItem
private void transformFirstPersonItem(float equipProgress, float swingProgress) {
GlStateManager.translate(1.2F, -1F, -0.71999997F); // Botania - x(0.56) -> 1; y(-0.52) -> -1
GlStateManager.translate(0.0F, equipProgress * -0.6F, 0.0F);
GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F); // Botania - 45 -> 90
GlStateManager.rotate(-20, 0, 0, 1); // Botania - added
float f = MathHelper.sin(swingProgress * swingProgress * (float)Math.PI);
float f1 = MathHelper.sin(MathHelper.sqrt_float(swingProgress) * (float)Math.PI);
GlStateManager.rotate(f * -20.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(f1 * -20.0F, 0.0F, 0.0F, 1.0F);
// Copy with modification - ItemRenderer.transformFirstPerson
// Arg - Side, SwingProgress
private void transformFirstPerson(EnumHandSide p_187453_1_, float p_187453_2_)
{
int i = p_187453_1_ == EnumHandSide.RIGHT ? 1 : -1;
// Botania - added
GlStateManager.translate(p_187453_1_ == EnumHandSide.RIGHT ? 0.5F : 0.3F, -0.25F, 0.2F);
GlStateManager.rotate(90F, 0F, 1F, 0F);
GlStateManager.rotate(12F, 0F, 0F, -1F);
// End add
float f = MathHelper.sin(p_187453_2_ * p_187453_2_ * (float)Math.PI);
GlStateManager.rotate((float)i * (45.0F + f * -20.0F), 0.0F, 1.0F, 0.0F);
float f1 = MathHelper.sin(MathHelper.sqrt_float(p_187453_2_) * (float)Math.PI);
GlStateManager.rotate((float)i * f1 * -20.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.rotate(f1 * -80.0F, 1.0F, 0.0F, 0.0F);
// GlStateManager.scale(0.4F, 0.4F, 0.4F); Botania - removed
GlStateManager.rotate((float)i * -45.0F, 0.0F, 1.0F, 0.0F);
}
}
@@ -34,8 +34,10 @@ import java.awt.*;
public final class SubTileRadiusRenderHandler {
private SubTileRadiusRenderHandler() {}
@SubscribeEvent
public void onWorldRenderLast(RenderWorldLastEvent event) {
public static void onWorldRenderLast(RenderWorldLastEvent event) {
Minecraft mc = Minecraft.getMinecraft();
RayTraceResult pos = mc.objectMouseOver;
@@ -64,7 +66,7 @@ public final class SubTileRadiusRenderHandler {
GlStateManager.pushMatrix();
GlStateManager.disableTexture2D();
GL11.glPushAttrib(GL11.GL_LIGHTING);
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
GlStateManager.disableLighting();
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
@@ -79,7 +81,7 @@ public final class SubTileRadiusRenderHandler {
GlStateManager.popMatrix();
}
private void renderRectangle(AxisAlignedBB aabb) {
private static void renderRectangle(AxisAlignedBB aabb) {
double renderPosX, renderPosY, renderPosZ;
try {
@@ -124,7 +126,7 @@ public final class SubTileRadiusRenderHandler {
GlStateManager.popMatrix();
}
private void renderCircle(BlockPos center, double radius) {
private static void renderCircle(BlockPos center, double radius) {
double renderPosX, renderPosY, renderPosZ;
try {
@@ -17,11 +17,16 @@ import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.client.event.RenderTooltipEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
@@ -44,132 +49,105 @@ public final class TooltipAdditionDisplayHandler {
private static float lexiconLookupTime = 0F;
public static void render() {
@SubscribeEvent
public static void onToolTipRender(RenderTooltipEvent.PostText evt) {
if(evt.getStack() == null)
return;
ItemStack stack = evt.getStack();
Minecraft mc = Minecraft.getMinecraft();
GuiScreen gui = mc.currentScreen;
if(gui != null && gui instanceof GuiContainer && mc.thePlayer != null && mc.thePlayer.inventory.getItemStack() == null) {
GuiContainer container = (GuiContainer) gui;
Slot slot = ReflectionHelper.getPrivateValue(GuiContainer.class, container, LibObfuscation.THE_SLOT);
if(slot != null && slot.getHasStack()) {
ItemStack stack = slot.getStack();
if(stack != null) {
ScaledResolution res = new ScaledResolution(mc);
FontRenderer font = mc.fontRendererObj;
int mouseX = Mouse.getX() * res.getScaledWidth() / mc.displayWidth;
int mouseY = res.getScaledHeight() - Mouse.getY() * res.getScaledHeight() / mc.displayHeight;
int width = evt.getWidth();
int height = 3;
int tooltipX = evt.getX();
int tooltipY = evt.getY() - 4;
FontRenderer font = evt.getFontRenderer();
List<String> tooltip;
try {
tooltip = stack.getTooltip(mc.thePlayer, mc.gameSettings.advancedItemTooltips);
} catch(Exception e) {
tooltip = new ArrayList<>();
if(stack.getItem() instanceof ItemTerraPick)
drawTerraPick(stack, tooltipX, tooltipY, width, height, font);
else if(stack.getItem() instanceof IManaTooltipDisplay)
drawManaBar(stack, (IManaTooltipDisplay) stack.getItem(), tooltipX, tooltipY, width, height);
EntryData data = LexiconRecipeMappings.getDataForStack(stack);
if(data != null) {
int lexSlot = -1;
ItemStack lexiconStack = null;
for(int i = 0; i < InventoryPlayer.getHotbarSize(); i++) {
ItemStack stackAt = mc.thePlayer.inventory.getStackInSlot(i);
if(stackAt != null && stackAt.getItem() instanceof ILexicon && ((ILexicon) stackAt.getItem()).isKnowledgeUnlocked(stackAt, data.entry.getKnowledgeType())) {
lexiconStack = stackAt;
lexSlot = i;
break;
}
}
if(lexSlot > -1) {
int x = tooltipX - 34;
GlStateManager.disableDepth();
Gui.drawRect(x - 4, tooltipY - 4, x + 20, tooltipY + 26, 0x44000000);
Gui.drawRect(x - 6, tooltipY - 6, x + 22, tooltipY + 28, 0x44000000);
if(ConfigHandler.useShiftForQuickLookup ? GuiScreen.isShiftKeyDown() : GuiScreen.isCtrlKeyDown()) {
lexiconLookupTime += ClientTickHandler.delta;
int cx = x + 8;
int cy = tooltipY + 8;
float r = 12;
float time = 20F;
float angles = lexiconLookupTime / time * 360F;
GlStateManager.disableLighting();
GlStateManager.disableTexture2D();
GlStateManager.shadeModel(GL11.GL_SMOOTH);
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
VertexBuffer buf = Tessellator.getInstance().getBuffer();
buf.begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION_COLOR);
float a = 0.5F + 0.2F * ((float) Math.cos((double) (ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) / 10) * 0.5F + 0.5F);
buf.pos(cx, cy, 0).color(0F, 0.5F, 0F, a).endVertex();
for(float i = angles; i > 0; i--) {
double rad = (i - 90) / 180F * Math.PI;
buf.pos(cx + Math.cos(rad) * r, cy + Math.sin(rad) * r, 0).color(0F, 1F, 0F, 1F).endVertex();
}
int width = 0;
for(String s : tooltip)
width = Math.max(width, font.getStringWidth(s) + 2);
int tooltipHeight = (tooltip.size() - 1) * 10 + 5;
int height = 3;
int offx = 11;
int offy = 17;
buf.pos(cx, cy, 0).color(0F, 1F, 0F, 0F).endVertex();
Tessellator.getInstance().draw();
boolean offscreen = mouseX + width + 19 >= res.getScaledWidth();
GlStateManager.disableBlend();
GlStateManager.enableTexture2D();
GlStateManager.shadeModel(GL11.GL_FLAT);
int fixY = res.getScaledHeight() - (mouseY + tooltipHeight);
if(fixY < 0)
offy -= fixY;
if(offscreen)
offx = -13 - width;
if(lexiconLookupTime >= time) {
mc.thePlayer.inventory.currentItem = lexSlot;
Botania.proxy.setEntryToOpen(data.entry);
Botania.proxy.setLexiconStack(lexiconStack);
mc.thePlayer.closeScreen();
ItemLexicon.openBook(mc.thePlayer, lexiconStack, mc.theWorld, false);
if(stack.getItem() instanceof ItemTerraPick)
drawTerraPick(stack, mouseX, mouseY, offx, offy, width, height, font);
else if(stack.getItem() instanceof IManaTooltipDisplay)
drawManaBar(stack, (IManaTooltipDisplay) stack.getItem(), mouseX, mouseY, offx, offy, width, height);
EntryData data = LexiconRecipeMappings.getDataForStack(stack);
if(data != null) {
int lexSlot = -1;
ItemStack lexiconStack = null;
for(int i = 0; i < InventoryPlayer.getHotbarSize(); i++) {
ItemStack stackAt = mc.thePlayer.inventory.getStackInSlot(i);
if(stackAt != null && stackAt.getItem() instanceof ILexicon && ((ILexicon) stackAt.getItem()).isKnowledgeUnlocked(stackAt, data.entry.getKnowledgeType())) {
lexiconStack = stackAt;
lexSlot = i;
break;
}
}
if(lexSlot > -1) {
int x = mouseX + offx - 34;
int y = mouseY - offy;
GlStateManager.disableDepth();
Gui.drawRect(x - 4, y - 4, x + 20, y + 26, 0x44000000);
Gui.drawRect(x - 6, y - 6, x + 22, y + 28, 0x44000000);
if(ConfigHandler.useShiftForQuickLookup ? GuiScreen.isShiftKeyDown() : GuiScreen.isCtrlKeyDown()) {
lexiconLookupTime += ClientTickHandler.delta;
int cx = x + 8;
int cy = y + 8;
float r = 12;
float time = 20F;
float angles = lexiconLookupTime / time * 360F;
GlStateManager.disableLighting();
GlStateManager.disableTexture2D();
GlStateManager.shadeModel(GL11.GL_SMOOTH);
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glBegin(GL11.GL_TRIANGLE_FAN);
float a = 0.5F + 0.2F * ((float) Math.cos((double) (ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) / 10) * 0.5F + 0.5F);
GlStateManager.color(0F, 0.5F, 0F, a);
GL11.glVertex2i(cx, cy);
GlStateManager.color(0F, 1F, 0F, 1F);
for(float i = angles; i > 0; i--) {
double rad = (i - 90) / 180F * Math.PI;
GL11.glVertex2d(cx + Math.cos(rad) * r, cy + Math.sin(rad) * r);
}
GL11.glVertex2i(cx, cy);
GL11.glEnd();
GlStateManager.disableBlend();
GlStateManager.enableTexture2D();
GlStateManager.shadeModel(GL11.GL_FLAT);
if(lexiconLookupTime >= time) {
mc.thePlayer.inventory.currentItem = lexSlot;
Botania.proxy.setEntryToOpen(data.entry);
Botania.proxy.setLexiconStack(lexiconStack);
mc.thePlayer.closeScreen();
ItemLexicon.openBook(mc.thePlayer, lexiconStack, mc.theWorld, false);
}
} else lexiconLookupTime = 0F;
mc.getRenderItem().renderItemIntoGUI(new ItemStack(ModItems.lexicon), x, y);
GlStateManager.disableLighting();
font.drawStringWithShadow("?", x + 10, y + 8, 0xFFFFFFFF);
GlStateManager.scale(0.5F, 0.5F, 1F);
boolean mac = Minecraft.isRunningOnMac;
mc.fontRendererObj.drawStringWithShadow(TextFormatting.BOLD + (ConfigHandler.useShiftForQuickLookup ? "Shift" : mac ? "Cmd" : "Ctrl"), (x + 10) * 2 - 16, (y + 8) * 2 + 20, 0xFFFFFFFF);
GlStateManager.scale(2F, 2F, 1F);
GlStateManager.enableDepth();
} else lexiconLookupTime = 0F;
} else lexiconLookupTime = 0F;
}
} else lexiconLookupTime = 0F;
mc.getRenderItem().renderItemIntoGUI(new ItemStack(ModItems.lexicon), x, tooltipY);
GlStateManager.disableLighting();
font.drawStringWithShadow("?", x + 10, tooltipY + 8, 0xFFFFFFFF);
GlStateManager.scale(0.5F, 0.5F, 1F);
boolean mac = Minecraft.IS_RUNNING_ON_MAC;
mc.fontRendererObj.drawStringWithShadow(TextFormatting.BOLD + (ConfigHandler.useShiftForQuickLookup ? "Shift" : mac ? "Cmd" : "Ctrl"), (x + 10) * 2 - 16, (tooltipY + 8) * 2 + 20, 0xFFFFFFFF);
GlStateManager.scale(2F, 2F, 1F);
GlStateManager.enableDepth();
} else lexiconLookupTime = 0F;
} else lexiconLookupTime = 0F;
}
private static void drawTerraPick(ItemStack stack, int mouseX, int mouseY, int offx, int offy, int width, int height, FontRenderer font) {
private static void drawTerraPick(ItemStack stack, int mouseX, int mouseY, int width, int height, FontRenderer font) {
int level = ItemTerraPick.getLevel(stack);
int max = ItemTerraPick.LEVELS[Math.min(ItemTerraPick.LEVELS.length - 1, level + 1)];
boolean ss = level >= ItemTerraPick.LEVELS.length - 1;
@@ -180,33 +158,33 @@ public final class TooltipAdditionDisplayHandler {
float hueOff = (ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.01F;
GlStateManager.disableDepth();
Gui.drawRect(mouseX + offx - 1, mouseY - offy - height - 1, mouseX + offx + width + 1, mouseY - offy, 0xFF000000);
Gui.drawRect(mouseX - 1, mouseY - height - 1, mouseX + width + 1, mouseY, 0xFF000000);
for(int i = 0; i < rainbowWidth; i++)
Gui.drawRect(mouseX + offx + i, mouseY - offy - height, mouseX + offx + i + 1, mouseY - offy, Color.HSBtoRGB(hueOff + huePer * i, 1F, 1F));
Gui.drawRect(mouseX + offx + rainbowWidth, mouseY - offy - height, mouseX + offx + width, mouseY - offy, 0xFF555555);
Gui.drawRect(mouseX + i, mouseY - height, mouseX + i + 1, mouseY, Color.HSBtoRGB(hueOff + huePer * i, 1F, 1F));
Gui.drawRect(mouseX + rainbowWidth, mouseY - height, mouseX + width, mouseY, 0xFF555555);
String rank = I18n.translateToLocal("botania.rank" + level).replaceAll("&", "\u00a7");
String rank = I18n.format("botania.rank" + level).replaceAll("&", "\u00a7");
GL11.glPushAttrib(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_LIGHTING);
font.drawStringWithShadow(rank, mouseX + offx, mouseY - offy - 12, 0xFFFFFF);
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
GlStateManager.disableLighting();
font.drawStringWithShadow(rank, mouseX, mouseY - 12, 0xFFFFFF);
if(!ss) {
rank = I18n.translateToLocal("botania.rank" + (level + 1)).replaceAll("&", "\u00a7");
font.drawStringWithShadow(rank, mouseX + offx + width - font.getStringWidth(rank), mouseY - offy - 12, 0xFFFFFF);
rank = I18n.format("botania.rank" + (level + 1)).replaceAll("&", "\u00a7");
font.drawStringWithShadow(rank, mouseX + width - font.getStringWidth(rank), mouseY - 12, 0xFFFFFF);
}
GlStateManager.enableLighting();
GlStateManager.enableDepth();
GL11.glPopAttrib();
}
private static void drawManaBar(ItemStack stack, IManaTooltipDisplay display, int mouseX, int mouseY, int offx, int offy, int width, int height) {
private static void drawManaBar(ItemStack stack, IManaTooltipDisplay display, int mouseX, int mouseY, int width, int height) {
float fraction = display.getManaFractionForDisplay(stack);
int manaBarWidth = (int) Math.ceil(width * fraction);
GlStateManager.disableDepth();
Gui.drawRect(mouseX + offx - 1, mouseY - offy - height - 1, mouseX + offx + width + 1, mouseY - offy, 0xFF000000);
Gui.drawRect(mouseX + offx, mouseY - offy - height, mouseX + offx + manaBarWidth, mouseY - offy, Color.HSBtoRGB(0.528F, ((float) Math.sin((ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.2) + 1F) * 0.3F + 0.4F, 1F));
Gui.drawRect(mouseX + offx + manaBarWidth, mouseY - offy - height, mouseX + offx + width, mouseY - offy, 0xFF555555);
Gui.drawRect(mouseX - 1, mouseY - height - 1, mouseX + width + 1, mouseY, 0xFF000000);
Gui.drawRect(mouseX, mouseY - height, mouseX + manaBarWidth, mouseY, Color.HSBtoRGB(0.528F, ((float) Math.sin((ClientTickHandler.ticksInGame + ClientTickHandler.partialTicks) * 0.2) + 1F) * 0.3F + 0.4F, 1F));
Gui.drawRect(mouseX + manaBarWidth, mouseY - height, mouseX + width, mouseY, 0xFF555555);
}
}
@@ -10,9 +10,9 @@
*/
package vazkii.botania.client.core.handler;
import net.minecraft.client.resources.I18n;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@@ -23,17 +23,11 @@ import vazkii.botania.common.item.ItemRegenIvy;
public final class TooltipHandler {
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onTooltipEvent(ItemTooltipEvent event) {
if(event.getItemStack().getItem() == Item.getItemFromBlock(Blocks.dirt) && event.getItemStack().getItemDamage() == 1) {
event.getToolTip().add(I18n.translateToLocal("botaniamisc.coarseDirt0"));
event.getToolTip().add(I18n.translateToLocal("botaniamisc.coarseDirt1"));
} else if(event.getItemStack().getItem() == Item.getItemFromBlock(Blocks.mob_spawner) && event.getEntityPlayer().capabilities.isCreativeMode)
event.getToolTip().add(I18n.translateToLocal("botaniamisc.spawnerTip"));
public static void onTooltipEvent(ItemTooltipEvent event) {
if(ItemNBTHelper.detectNBT(event.getItemStack()) && ItemNBTHelper.getBoolean(event.getItemStack(), ItemRegenIvy.TAG_REGEN, false))
event.getToolTip().add(I18n.translateToLocal("botaniamisc.hasIvy"));
event.getToolTip().add(I18n.format("botaniamisc.hasIvy"));
if(ItemNBTHelper.detectNBT(event.getItemStack()) && ItemNBTHelper.getBoolean(event.getItemStack(), ItemKeepIvy.TAG_KEEP, false))
event.getToolTip().add(I18n.translateToLocal("botaniamisc.hasKeepIvy"));
event.getToolTip().add(I18n.format("botaniamisc.hasKeepIvy"));
}
}
@@ -14,6 +14,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.item.ItemStack;
@@ -220,16 +221,19 @@ public final class RenderHelper {
GlStateManager.depthMask(true);
GL11.glStencilMask(0x00);
GL11.glStencilFunc(GL11.GL_EQUAL, 1, 0xFF);
GL11.glBegin(GL11.GL_TRIANGLE_FAN);
GlStateManager.color(0F, 0.5F, 0.5F, a);
GL11.glVertex2i(centerX, centerY);
GlStateManager.color(0F, 1F, 0.5F, a);
VertexBuffer buf = Tessellator.getInstance().getBuffer();
buf.begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION_COLOR);
buf.pos(centerX, centerY, 0).color(0, 0.5F, 0.5F, a).endVertex();
for(int i = degs; i > 0; i--) {
double rad = (i - 90) / 180F * Math.PI;
GL11.glVertex2d(centerX + Math.cos(rad) * r, centerY + Math.sin(rad) * r);
buf.pos(centerX + Math.cos(rad) * r, centerY + Math.sin(rad) * r, 0).color(0F, 1F, 0.5F, a).endVertex();
}
GL11.glVertex2i(centerX, centerY);
GL11.glEnd();
buf.pos(centerX, centerY, 0).color(0F, 1F, 0.5F, a).endVertex();
Tessellator.getInstance().draw();
GlStateManager.disableBlend();
GlStateManager.enableTexture2D();
GlStateManager.shadeModel(GL11.GL_FLAT);
@@ -241,7 +245,7 @@ public final class RenderHelper {
KeyBinding[] keys = Minecraft.getMinecraft().gameSettings.keyBindings;
for(KeyBinding otherKey : keys)
if(otherKey.getKeyDescription().equals(keyName)) {
key = Keyboard.getKeyName(otherKey.getKeyCode());
key = otherKey.getDisplayName();
break;
}
@@ -11,8 +11,6 @@
package vazkii.botania.client.core.helper;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraftforge.fml.common.FMLLog;
import org.apache.logging.log4j.Level;
import org.lwjgl.opengl.ARBFragmentShader;
import org.lwjgl.opengl.ARBShaderObjects;
import org.lwjgl.opengl.ARBVertexShader;
@@ -20,6 +18,7 @@ import org.lwjgl.opengl.GL11;
import vazkii.botania.api.internal.ShaderCallback;
import vazkii.botania.client.core.handler.ClientTickHandler;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.handler.ConfigHandler;
import java.io.BufferedReader;
@@ -92,7 +91,7 @@ public final class ShaderHelper {
// http://lwjgl.org/wiki/index.php?title=GLSL_Shaders_with_LWJGL
private static int createProgram(String vert, String frag) {
int vertId = 0, fragId = 0, program = 0;
int vertId = 0, fragId = 0, program;
if(vert != null)
vertId = createShader(vert, VERT);
if(frag != null)
@@ -109,13 +108,13 @@ public final class ShaderHelper {
ARBShaderObjects.glLinkProgramARB(program);
if(ARBShaderObjects.glGetObjectParameteriARB(program, ARBShaderObjects.GL_OBJECT_LINK_STATUS_ARB) == GL11.GL_FALSE) {
FMLLog.log(Level.ERROR, getLogInfo(program));
Botania.LOGGER.error(getLogInfo(program));
return 0;
}
ARBShaderObjects.glValidateProgramARB(program);
if (ARBShaderObjects.glGetObjectParameteriARB(program, ARBShaderObjects.GL_OBJECT_VALIDATE_STATUS_ARB) == GL11.GL_FALSE) {
FMLLog.log(Level.ERROR, getLogInfo(program));
Botania.LOGGER.error(getLogInfo(program));
return 0;
}
@@ -12,6 +12,7 @@ package vazkii.botania.client.core.proxy;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.multiplayer.PlayerControllerMP;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.client.renderer.entity.RenderPlayer;
@@ -25,16 +26,16 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraft.world.WorldSettings.GameType;
import net.minecraftforge.client.model.animation.AnimationTESR;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import net.minecraftforge.fml.relauncher.Side;
import vazkii.botania.api.boss.IBotaniaBoss;
import vazkii.botania.api.item.IExtendedPlayerController;
import vazkii.botania.api.lexicon.LexiconEntry;
@@ -61,13 +62,16 @@ import vazkii.botania.client.core.handler.MultiblockRenderHandler;
import vazkii.botania.client.core.handler.PersistentVariableHelper;
import vazkii.botania.client.core.handler.RenderLexicon;
import vazkii.botania.client.core.handler.SubTileRadiusRenderHandler;
import vazkii.botania.client.core.handler.TooltipAdditionDisplayHandler;
import vazkii.botania.client.core.handler.TooltipHandler;
import vazkii.botania.client.core.helper.ShaderHelper;
import vazkii.botania.client.fx.FXLightning;
import vazkii.botania.client.fx.FXSparkle;
import vazkii.botania.client.fx.FXWisp;
import vazkii.botania.client.gui.lexicon.GuiLexicon;
import vazkii.botania.client.gui.lexicon.GuiLexiconEntry;
import vazkii.botania.client.gui.lexicon.GuiLexiconIndex;
import vazkii.botania.client.render.entity.LayerGaiaHead;
import vazkii.botania.client.render.entity.RenderBabylonWeapon;
import vazkii.botania.client.render.entity.RenderCorporeaSpark;
import vazkii.botania.client.render.entity.RenderDoppleganger;
@@ -95,7 +99,7 @@ import vazkii.botania.client.render.tile.RenderTilePrism;
import vazkii.botania.client.render.tile.RenderTilePylon;
import vazkii.botania.client.render.tile.RenderTileRedString;
import vazkii.botania.client.render.tile.RenderTileRuneAltar;
import vazkii.botania.client.render.tile.RenderTileSkullOverride;
import vazkii.botania.client.render.tile.RenderTileGaiaHead;
import vazkii.botania.client.render.tile.RenderTileSparkChanger;
import vazkii.botania.client.render.tile.RenderTileSpreader;
import vazkii.botania.client.render.tile.RenderTileStarfield;
@@ -103,6 +107,8 @@ import vazkii.botania.client.render.tile.RenderTileTerraPlate;
import vazkii.botania.client.render.tile.RenderTileTeruTeruBozu;
import vazkii.botania.client.render.tile.RenderTileTinyPotato;
import vazkii.botania.client.render.world.SkyblockRenderEvents;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.subtile.functional.BergamuteEventHandler;
import vazkii.botania.common.block.tile.TileAlfPortal;
import vazkii.botania.common.block.tile.TileAltar;
import vazkii.botania.common.block.tile.TileAvatar;
@@ -133,7 +139,7 @@ import vazkii.botania.common.block.tile.string.TileRedString;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.core.helper.MathHelper;
import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.core.proxy.CommonProxy;
import vazkii.botania.common.core.proxy.IProxy;
import vazkii.botania.common.core.version.AdaptorNotifier;
import vazkii.botania.common.core.version.VersionChecker;
import vazkii.botania.common.entity.EntityBabylonWeapon;
@@ -161,11 +167,16 @@ import java.time.LocalDateTime;
import java.time.Month;
import java.util.Map;
public class ClientProxy extends CommonProxy {
public class ClientProxy implements IProxy {
public static boolean jingleTheBells = false;
public static boolean dootDoot = false;
private static final ModelBiped EMPTY_MODEL = new ModelBiped();
static {
EMPTY_MODEL.setInvisible(true);
}
@Override
public void preInit(FMLPreInitializationEvent event) {
PersistentVariableHelper.setCacheFile(new File(Minecraft.getMinecraft().mcDataDir, "BotaniaVars.dat"));
@@ -173,12 +184,9 @@ public class ClientProxy extends CommonProxy {
PersistentVariableHelper.load();
PersistentVariableHelper.save();
} catch (IOException e) {
FMLLog.severe("Botania's persistent Variables couldn't load!");
e.printStackTrace();
Botania.LOGGER.fatal("Persistent Variables couldn't load!!");
}
super.preInit(event);
MinecraftForge.EVENT_BUS.register(MiscellaneousIcons.INSTANCE);
ModelHandler.registerModels();
initRenderers();
@@ -186,29 +194,30 @@ public class ClientProxy extends CommonProxy {
@Override
public void init(FMLInitializationEvent event) {
super.init(event);
ColorHandler.init();
initAuxiliaryRender();
ModChallenges.init();
MinecraftForge.EVENT_BUS.register(new ClientTickHandler());
MinecraftForge.EVENT_BUS.register(new HUDHandler());
MinecraftForge.EVENT_BUS.register(new LightningHandler());
MinecraftForge.EVENT_BUS.register(ClientTickHandler.class);
MinecraftForge.EVENT_BUS.register(HUDHandler.class);
MinecraftForge.EVENT_BUS.register(LightningHandler.class);
if(ConfigHandler.boundBlockWireframe)
MinecraftForge.EVENT_BUS.register(new BoundTileRenderer());
MinecraftForge.EVENT_BUS.register(new TooltipHandler());
MinecraftForge.EVENT_BUS.register(new DebugHandler());
MinecraftForge.EVENT_BUS.register(new SubTileRadiusRenderHandler());
MinecraftForge.EVENT_BUS.register(new MultiblockRenderHandler());
MinecraftForge.EVENT_BUS.register(new SkyblockRenderEvents());
MinecraftForge.EVENT_BUS.register(BoundTileRenderer.class);
MinecraftForge.EVENT_BUS.register(TooltipHandler.class);
MinecraftForge.EVENT_BUS.register(TooltipAdditionDisplayHandler.class);
MinecraftForge.EVENT_BUS.register(DebugHandler.class);
MinecraftForge.EVENT_BUS.register(SubTileRadiusRenderHandler.class);
MinecraftForge.EVENT_BUS.register(MultiblockRenderHandler.class);
MinecraftForge.EVENT_BUS.register(SkyblockRenderEvents.class);
MinecraftForge.EVENT_BUS.register(new RenderLexicon());
MinecraftForge.EVENT_BUS.register(new BossBarHandler());
MinecraftForge.EVENT_BUS.register(BossBarHandler.class);
MinecraftForge.EVENT_BUS.register(BergamuteEventHandler.class);
if(ConfigHandler.useAdaptativeConfig)
MinecraftForge.EVENT_BUS.register(new AdaptorNotifier());
MinecraftForge.EVENT_BUS.register(AdaptorNotifier.class);
if(ConfigHandler.versionCheckEnabled)
new VersionChecker().init();
VersionChecker.init();
if(ConfigHandler.enableSeasonalFeatures) {
LocalDateTime now = LocalDateTime.now();
@@ -222,7 +231,6 @@ public class ClientProxy extends CommonProxy {
@Override
public void postInit(FMLPostInitializationEvent event) {
super.postInit(event);
CorporeaAutoCompleteHandler.updateItemList();
}
@@ -252,7 +260,7 @@ public class ClientProxy extends CommonProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileCocoon.class, new RenderTileCocoon());
ClientRegistry.bindTileEntitySpecialRenderer(TileLightRelay.class, new RenderTileLightRelay());
ClientRegistry.bindTileEntitySpecialRenderer(TileBellows.class, new RenderTileBellows());
ClientRegistry.bindTileEntitySpecialRenderer(TileGaiaHead.class, new RenderTileSkullOverride());
ClientRegistry.bindTileEntitySpecialRenderer(TileGaiaHead.class, new RenderTileGaiaHead());
ClientRegistry.bindTileEntitySpecialRenderer(TileTeruTeruBozu.class, new RenderTileTeruTeruBozu());
ClientRegistry.bindTileEntitySpecialRenderer(TileAvatar.class, new RenderTileAvatar());
@@ -278,10 +286,12 @@ public class ClientProxy extends CommonProxy {
render = skinMap.get("default");
render.addLayer(new ContributorFancinessHandler());
render.addLayer(new BaubleRenderHandler());
render.addLayer(new LayerGaiaHead(render.getMainModel().bipedHead));
render = skinMap.get("slim");
render.addLayer(new ContributorFancinessHandler());
render.addLayer(new BaubleRenderHandler());
render.addLayer(new LayerGaiaHead(render.getMainModel().bipedHead));
}
@Override
@@ -305,6 +315,11 @@ public class ClientProxy extends CommonProxy {
return entity == Minecraft.getMinecraft().thePlayer;
}
@Override
public EntityPlayer getClientPlayer() {
return Minecraft.getMinecraft().thePlayer;
}
@Override
public boolean isClientPlayerWearingMonocle() {
return ItemMonocle.hasMonocle(Minecraft.getMinecraft().thePlayer);
@@ -312,17 +327,15 @@ public class ClientProxy extends CommonProxy {
@Override
public void setExtraReach(EntityLivingBase entity, float reach) {
super.setExtraReach(entity, reach);
Minecraft mc = Minecraft.getMinecraft();
EntityPlayer player = mc.thePlayer;
if(entity == player) {
if(!(mc.playerController instanceof IExtendedPlayerController)) {
GameType type = ReflectionHelper.getPrivateValue(PlayerControllerMP.class, mc.playerController, LibObfuscation.CURRENT_GAME_TYPE);
NetHandlerPlayClient net = ReflectionHelper.getPrivateValue(PlayerControllerMP.class, mc.playerController, LibObfuscation.NET_CLIENT_HANDLER);
BotaniaPlayerController controller = new BotaniaPlayerController(mc, net);
boolean isFlying = player.capabilities.isFlying;
boolean allowFlying = player.capabilities.allowFlying;
controller.setGameType(type);
controller.setGameType(mc.playerController.getCurrentGameType());
player.capabilities.isFlying = isFlying;
player.capabilities.allowFlying = allowFlying;
mc.playerController = controller;
@@ -365,9 +378,9 @@ public class ClientProxy extends CommonProxy {
public void playRecordClientSided(World world, BlockPos pos, ItemRecord record) {
Minecraft mc = Minecraft.getMinecraft();
if(record == null)
world.playAuxSFXAtEntity(null, 1010, pos, 0);
world.playEvent(null, 1010, pos, 0);
else {
world.playAuxSFXAtEntity(null, 1010, pos, Item.getIdFromItem(record));
world.playEvent(null, 1010, pos, Item.getIdFromItem(record));
mc.ingameGUI.setRecordPlayingMessage(record.getRecordNameLocal());
}
}
@@ -419,11 +432,11 @@ public class ClientProxy extends CommonProxy {
}
@Override
public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m, boolean fake) {
if(!doParticle(world) && !fake)
public void sparkleFX(double x, double y, double z, float r, float g, float b, float size, int m, boolean fake) {
if(!doParticle() && !fake)
return;
FXSparkle sparkle = new FXSparkle(world, x, y, z, size, r, g, b, m);
FXSparkle sparkle = new FXSparkle(Minecraft.getMinecraft().theWorld, x, y, z, size, r, g, b, m);
sparkle.fake = sparkle.noClip = fake;
if(noclipEnabled)
sparkle.noClip = true;
@@ -446,17 +459,17 @@ public class ClientProxy extends CommonProxy {
}
@Override
public void wispFX(World world, double x, double y, double z, float r, float g, float b, float size, float motionx, float motiony, float motionz, float maxAgeMul) {
if(!doParticle(world))
public void wispFX(double x, double y, double z, float r, float g, float b, float size, float motionx, float motiony, float motionz, float maxAgeMul) {
if(!doParticle())
return;
FXWisp wisp = new FXWisp(world, x, y, z, size, r, g, b, distanceLimit, depthTest, maxAgeMul);
FXWisp wisp = new FXWisp(Minecraft.getMinecraft().theWorld, x, y, z, size, r, g, b, distanceLimit, depthTest, maxAgeMul);
wisp.setSpeed(motionx, motiony, motionz);
Minecraft.getMinecraft().effectRenderer.addEffect(wisp);
}
private boolean doParticle(World world) {
if(!world.isRemote)
private boolean doParticle() {
if(FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER)
return false;
if(!ConfigHandler.useVanillaParticleLimiter)
@@ -472,8 +485,8 @@ public class ClientProxy extends CommonProxy {
}
@Override
public void lightningFX(World world, Vector3 vectorStart, Vector3 vectorEnd, float ticksPerMeter, long seed, int colorOuter, int colorInner) {
LightningHandler.spawnLightningBolt(world, vectorStart, vectorEnd, ticksPerMeter, seed, colorOuter, colorInner);
public void lightningFX(Vector3 vectorStart, Vector3 vectorEnd, float ticksPerMeter, long seed, int colorOuter, int colorInner) {
Minecraft.getMinecraft().effectRenderer.addEffect(new FXLightning(Minecraft.getMinecraft().theWorld, vectorStart, vectorEnd, ticksPerMeter, seed, colorOuter, colorInner));
}
@Override
@@ -485,5 +498,15 @@ public class ClientProxy extends CommonProxy {
public void removeBoss(IBotaniaBoss boss) {
BossBarHandler.bosses.remove(boss);
}
@Override
public int getClientRenderDistance() {
return Minecraft.getMinecraft().gameSettings.renderDistanceChunks;
}
@Override
public ModelBiped getEmptyModelBiped() {
return EMPTY_MODEL;
}
}
@@ -20,9 +20,7 @@ import java.util.Set;
public class GuiFactory implements IModGuiFactory {
@Override
public void initialize(Minecraft minecraftInstance) {
// NO-OP
}
public void initialize(Minecraft minecraftInstance) {}
@Override
public Class<? extends GuiScreen> mainConfigGuiClass() {
@@ -0,0 +1,248 @@
package vazkii.botania.client.fx;
import gnu.trove.map.hash.TIntIntHashMap;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import vazkii.botania.client.core.handler.LightningHandler;
import vazkii.botania.common.core.helper.Vector3;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
// Originally taken with permission from WRCBE - heavily modified
public class FXLightning extends Particle {
private static final int fadetime = 20;
private final TIntIntHashMap splitParents = new TIntIntHashMap();
private final double length;
private final Random rand;
private final int colorOuter;
private final int colorInner;
private List<FXLightningSegment> segments = new ArrayList<>();
private int segmentCount = 1;
private int splitCount;
private float speed = 1.5F;
public FXLightning(World world, Vector3 sourcevec, Vector3 targetvec, float ticksPerMeter, long seed, int colorOuter, int colorInner) {
super(world, sourcevec.x, sourcevec.y, sourcevec.z);
this.rand = new Random(seed);
this.speed = ticksPerMeter;
this.colorOuter = colorOuter;
this.colorInner = colorInner;
this.length = targetvec.subtract(sourcevec).mag();
this.particleMaxAge = fadetime + rand.nextInt(fadetime) - fadetime / 2;
this.particleAge = -(int) (length * speed);
segments.add(new FXLightningSegment(sourcevec, targetvec));
fractal(2, length / 1.5, 0.7F, 0.7F, 45);
fractal(2, length / 4, 0.5F, 0.8F, 50);
fractal(2, length / 15, 0.5F, 0.9F, 55);
fractal(2, length / 30, 0.5F, 1.0F, 60);
fractal(2, length / 60, 0, 0, 0);
fractal(2, length / 100, 0, 0, 0);
fractal(2, length / 400, 0, 0, 0);
calculateCollisionAndDiffs();
Collections.sort(segments, (o1, o2) -> Float.compare(o2.light, o1.light));
}
@Override
public void renderParticle(VertexBuffer wr, Entity entity, float partialTicks, float rotX, float rotZ, float rotYZ, float rotXY, float rotXZ) {
LightningHandler.queuedLightningBolts.offer(this);
}
public void renderBolt(int pass, boolean inner) {
ParticleRenderDispatcher.lightningCount++;
VertexBuffer wr = Tessellator.getInstance().getBuffer();
float boltAge = particleAge < 0 ? 0 : (float) particleAge / (float) particleMaxAge;
float mainAlpha;
if(pass == 0)
mainAlpha = (1 - boltAge) * 0.4F;
else mainAlpha = 1 - boltAge * 0.5F;
int expandTime = (int) (length * speed);
int renderstart = (int) ((expandTime / 2 - particleMaxAge + particleAge) / (float) (expandTime / 2) * segmentCount);
int renderend = (int) ((particleAge + expandTime) / (float) expandTime * segmentCount);
for(FXLightningSegment rendersegment : segments) {
if(rendersegment.segmentNo < renderstart || rendersegment.segmentNo > renderend)
continue;
Vector3 playerVec = getRelativeViewVector(rendersegment.startPoint.point).multiply(-1);
double width = 0.025F * (playerVec.mag() / 5 + 1) * (1 + rendersegment.light) * 0.5F;
Vector3 diff1 = playerVec.crossProduct(rendersegment.prevDiff).normalize().multiply(width / rendersegment.sinPrev);
Vector3 diff2 = playerVec.crossProduct(rendersegment.nextDiff).normalize().multiply(width / rendersegment.sinNext);
Vector3 startvec = rendersegment.startPoint.point;
Vector3 endvec = rendersegment.endPoint.point;
int color = inner ? colorInner : colorOuter;
int r = (color & 0xFF0000) >> 16;
int g = (color & 0xFF00) >> 8;
int b = (color & 0xFF);
int a = (int) (mainAlpha * rendersegment.light * 0xFF);
wr.pos(endvec.x - diff2.x, endvec.y - diff2.y, endvec.z - diff2.z).tex(0.5, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
wr.pos(startvec.x - diff1.x, startvec.y - diff1.y, startvec.z - diff1.z).tex(0.5, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
wr.pos(startvec.x + diff1.x, startvec.y + diff1.y, startvec.z + diff1.z).tex(0.5, 1).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
wr.pos(endvec.x + diff2.x, endvec.y + diff2.y, endvec.z + diff2.z).tex(0.5, 1).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
if(rendersegment.next == null) {
Vector3 roundend = rendersegment.endPoint.point.add(rendersegment.diff.normalize().multiply(width));
wr.pos(roundend.x - diff2.x, roundend.y - diff2.y, roundend.z - diff2.z).tex(0, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
wr.pos(endvec.x - diff2.x, endvec.y - diff2.y, endvec.z - diff2.z).tex(0.5, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
wr.pos(endvec.x + diff2.x, endvec.y + diff2.y, endvec.z + diff2.z).tex(0.5, 1).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
wr.pos(roundend.x + diff2.x, roundend.y + diff2.y, roundend.z + diff2.z).tex(0, 1).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
}
if(rendersegment.prev == null) {
Vector3 roundend = rendersegment.startPoint.point.subtract(rendersegment.diff.normalize().multiply(width));
wr.pos(startvec.x - diff1.x, startvec.y - diff1.y, startvec.z - diff1.z).tex(0.5, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
wr.pos(roundend.x - diff1.x, roundend.y - diff1.y, roundend.z - diff1.z).tex(0, 0).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
wr.pos(roundend.x + diff1.x, roundend.y + diff1.y, roundend.z + diff1.z).tex(0, 1).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
wr.pos(startvec.x + diff1.x, startvec.y + diff1.y, startvec.z + diff1.z).tex(0.5, 1).lightmap(0xF0, 0xF0).color(r, g, b, a).endVertex();
}
}
}
private void fractal(int splits, double amount, double splitChance, double splitLength, double splitAngle) {
List<FXLightningSegment> oldSegments = segments;
segments = new ArrayList<>();
FXLightningSegment prev;
for(FXLightningSegment segment : oldSegments) {
prev = segment.prev;
Vector3 subsegment = segment.diff.multiply(1F / splits);
FXLightningBoltPoint[] newpoints = new FXLightningBoltPoint[splits + 1];
Vector3 startpoint = segment.startPoint.point;
newpoints[0] = segment.startPoint;
newpoints[splits] = segment.endPoint;
for(int i = 1; i < splits; i++) {
Vector3 randoff = segment.diff.perpendicular().normalize().rotate(rand.nextFloat() * 360, segment.diff);
randoff = randoff.multiply((rand.nextFloat() - 0.5F) * amount * 2);
Vector3 basepoint = startpoint.add(subsegment.multiply(i));
newpoints[i] = new FXLightningBoltPoint(basepoint, randoff);
}
for(int i = 0; i < splits; i++) {
FXLightningSegment next = new FXLightningSegment(newpoints[i], newpoints[i + 1], segment.light, segment.segmentNo * splits + i, segment.splitNo);
next.prev = prev;
if (prev != null)
prev.next = next;
if(i != 0 && rand.nextFloat() < splitChance) {
Vector3 splitrot = next.diff.xCrossProduct().rotate(rand.nextFloat() * 360, next.diff);
Vector3 diff = next.diff.rotate((rand.nextFloat() * 0.66F + 0.33F) * splitAngle, splitrot).multiply(splitLength);
splitCount++;
splitParents.put(splitCount, next.splitNo);
FXLightningSegment split = new FXLightningSegment(newpoints[i], new FXLightningBoltPoint(newpoints[i + 1].basepoint, newpoints[i + 1].offsetvec.add(diff)), segment.light / 2F, next.segmentNo, splitCount);
split.prev = prev;
segments.add(split);
}
prev = next;
segments.add(next);
}
if(segment.next != null)
segment.next.prev = prev;
}
segmentCount *= splits;
}
private float rayTraceResistance(Vector3 start, Vector3 end, float prevresistance) {
RayTraceResult mop = worldObj.rayTraceBlocks(start.toVec3D(), end.toVec3D());
if(mop == null)
return prevresistance;
if(mop.typeOfHit == RayTraceResult.Type.BLOCK) {
Block block = worldObj.getBlockState(mop.getBlockPos()).getBlock();
if(worldObj.isAirBlock(mop.getBlockPos()))
return prevresistance;
return prevresistance + block.getExplosionResistance(null) + 0.3F;
} else return prevresistance;
}
private void calculateCollisionAndDiffs() {
TIntIntHashMap lastactivesegment = new TIntIntHashMap();
Collections.sort(segments, (o1, o2) -> {
int comp = Integer.valueOf(o1.splitNo).compareTo(o2.splitNo);
if(comp == 0)
return Integer.valueOf(o1.segmentNo).compareTo(o2.segmentNo);
else return comp;
});
int lastSplitCalc = 0;
int lastActiveSegment = 0;// unterminated
float splitResistance = 0;
for(FXLightningSegment segment : segments) {
if(segment.splitNo > lastSplitCalc) {
lastactivesegment.put(lastSplitCalc, lastActiveSegment);
lastSplitCalc = segment.splitNo;
lastActiveSegment = lastactivesegment.get(splitParents.get(segment.splitNo));
splitResistance = lastActiveSegment < segment.segmentNo ? 50 : 0;
}
if(splitResistance >= 40 * segment.light)
continue;
splitResistance = rayTraceResistance(segment.startPoint.point, segment.endPoint.point, splitResistance);
lastActiveSegment = segment.segmentNo;
}
lastactivesegment.put(lastSplitCalc, lastActiveSegment);
lastSplitCalc = 0;
lastActiveSegment = lastactivesegment.get(0);
for(Iterator<FXLightningSegment> iterator = segments.iterator(); iterator.hasNext();) {
FXLightningSegment segment = iterator.next();
if(lastSplitCalc != segment.splitNo) {
lastSplitCalc = segment.splitNo;
lastActiveSegment = lastactivesegment.get(segment.splitNo);
}
if(segment.segmentNo > lastActiveSegment)
iterator.remove();
segment.calcEndDiffs();
}
}
private static Vector3 getRelativeViewVector(Vector3 pos) {
Entity renderEntity = Minecraft.getMinecraft().getRenderViewEntity();
return new Vector3((float) renderEntity.posX - pos.x, (float) renderEntity.posY + renderEntity.getEyeHeight() - pos.y, (float) renderEntity.posZ - pos.z);
}
}
@@ -0,0 +1,17 @@
package vazkii.botania.client.fx;
import vazkii.botania.common.core.helper.Vector3;
public class FXLightningBoltPoint {
public final Vector3 point;
public final Vector3 basepoint;
public final Vector3 offsetvec;
public FXLightningBoltPoint(Vector3 basepoint, Vector3 offsetvec) {
point = basepoint.add(offsetvec);
this.basepoint = basepoint;
this.offsetvec = offsetvec;
}
}
@@ -0,0 +1,71 @@
package vazkii.botania.client.fx;
import vazkii.botania.common.core.helper.Vector3;
public class FXLightningSegment {
public final FXLightningBoltPoint startPoint;
public final FXLightningBoltPoint endPoint;
public Vector3 diff;
public FXLightningSegment prev;
public FXLightningSegment next;
public Vector3 nextDiff;
public Vector3 prevDiff;
public float sinPrev;
public float sinNext;
public final float light;
public final int segmentNo;
public final int splitNo;
public FXLightningSegment(FXLightningBoltPoint start, FXLightningBoltPoint end, float light, int segmentnumber, int splitnumber) {
startPoint = start;
endPoint = end;
this.light = light;
segmentNo = segmentnumber;
splitNo = splitnumber;
calcDiff();
}
public FXLightningSegment(Vector3 start, Vector3 end) {
this(new FXLightningBoltPoint(start, new Vector3(0, 0, 0)), new FXLightningBoltPoint(end, new Vector3(0, 0, 0)), 1, 0, 0);
}
public void calcDiff() {
diff = endPoint.point.subtract(startPoint.point);
}
public void calcEndDiffs() {
if(prev != null) {
Vector3 prevdiffnorm = prev.diff.normalize();
Vector3 thisdiffnorm = diff.normalize();
prevDiff = thisdiffnorm.add(prevdiffnorm).normalize();
sinPrev = (float) Math.sin(thisdiffnorm.angle(prevdiffnorm.multiply(-1)) / 2);
} else {
prevDiff = diff.normalize();
sinPrev = 1;
}
if(next != null) {
Vector3 nextdiffnorm = next.diff.normalize();
Vector3 thisdiffnorm = diff.normalize();
nextDiff = thisdiffnorm.add(nextdiffnorm).normalize();
sinNext = (float) Math.sin(thisdiffnorm.angle(nextdiffnorm.multiply(-1)) / 2);
} else {
nextDiff = diff.normalize();
sinNext = 1;
}
}
@Override
public String toString() {
return startPoint.point.toString() + " " + endPoint.point.toString();
}
}
@@ -11,16 +11,16 @@
package vazkii.botania.client.fx;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EffectRenderer;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.particle.ParticleManager;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import org.lwjgl.opengl.GL11;
@@ -32,12 +32,13 @@ import vazkii.botania.common.lib.LibObfuscation;
import java.util.ArrayDeque;
import java.util.Queue;
public class FXSparkle extends EntityFX {
public class FXSparkle extends Particle {
private static final ResourceLocation vanillaParticles = new ResourceLocation("textures/particle/particles.png");
public static final ResourceLocation particles = new ResourceLocation(LibResources.MISC_PARTICLES);
private static Queue<FXSparkle> queuedRenders = new ArrayDeque<>();
private static Queue<FXSparkle> queuedCorruptRenders = new ArrayDeque<>();
private static final Queue<FXSparkle> queuedRenders = new ArrayDeque<>();
private static final Queue<FXSparkle> queuedCorruptRenders = new ArrayDeque<>();
// Queue values
private float f;
@@ -57,7 +58,7 @@ public class FXSparkle extends EntityFX {
particleBlue = blue;
particleAlpha = 0.5F; // So MC renders us on the alpha layer, value not actually used
particleGravity = 0;
xSpeed = ySpeed = zSpeed = 0;
motionX = motionY = motionZ = 0;
particleScale *= size;
particleMaxAge = 3 * m;
multiplier = m;
@@ -73,7 +74,7 @@ public class FXSparkle extends EntityFX {
ParticleRenderDispatcher.fakeSparkleFxCount = 0;
GlStateManager.color(1.0F, 1.0F, 1.0F, 0.75F);
Minecraft.getMinecraft().renderEngine.bindTexture(ConfigHandler.matrixMode ? ReflectionHelper.getPrivateValue(EffectRenderer.class, null, LibObfuscation.PARTICLE_TEXTURES) : particles);
Minecraft.getMinecraft().renderEngine.bindTexture(ConfigHandler.matrixMode ? vanillaParticles : particles);
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
for(FXSparkle sparkle : queuedRenders)
@@ -117,7 +118,7 @@ public class FXSparkle extends EntityFX {
}
@Override
public void renderParticle(VertexBuffer worldRendererIn, Entity p_180434_2_, float f, float f1, float f2, float f3, float f4, float f5) {
public void renderParticle(VertexBuffer worldRendererIn, Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
this.f = f;
this.f1 = f1;
this.f2 = f2;
@@ -139,23 +140,23 @@ public class FXSparkle extends EntityFX {
if (particleAge++ >= particleMaxAge)
setExpired();
ySpeed -= 0.04D * particleGravity;
motionY -= 0.04D * particleGravity;
if (!noClip && !fake)
pushOutOfBlocks(posX, (getEntityBoundingBox().minY + getEntityBoundingBox().maxY) / 2.0D, posZ);
wiggleAround(posX, (getEntityBoundingBox().minY + getEntityBoundingBox().maxY) / 2.0D, posZ);
posX += xSpeed;
posY += ySpeed;
posZ += zSpeed;
posX += motionX;
posY += motionY;
posZ += motionZ;
if (slowdown) {
xSpeed *= 0.908000001907348633D;
ySpeed *= 0.908000001907348633D;
zSpeed *= 0.908000001907348633D;
motionX *= 0.908000001907348633D;
motionY *= 0.908000001907348633D;
motionZ *= 0.908000001907348633D;
if (isCollided) {
xSpeed *= 0.69999998807907104D;
zSpeed *= 0.69999998807907104D;
motionX *= 0.69999998807907104D;
motionZ *= 0.69999998807907104D;
}
}
@@ -167,98 +168,83 @@ public class FXSparkle extends EntityFX {
particleGravity = value;
}
private boolean pushOutOfBlocks(double par1, double par3, double par5) {
int var7 = MathHelper.floor_double(par1);
int var8 = MathHelper.floor_double(par3);
int var9 = MathHelper.floor_double(par5);
double var10 = par1 - var7;
double var12 = par3 - var8;
double var14 = par5 - var9;
// Copy of Entity.pushOutOfBlocks with several important changes
private boolean wiggleAround(double x, double y, double z)
{
BlockPos blockpos = new BlockPos(x, y, z);
double d0 = x - (double)blockpos.getX();
double d1 = y - (double)blockpos.getY();
double d2 = z - (double)blockpos.getZ();
BlockPos bPos = new BlockPos(var7, var8, var9);
if (!worldObj.isAirBlock(bPos)) {
boolean var16 = !worldObj.isBlockNormalCube(bPos.west(), false);
boolean var17 = !worldObj.isBlockNormalCube(bPos.east(), false);
boolean var18 = !worldObj.isBlockNormalCube(bPos.down(), false);
boolean var19 = !worldObj.isBlockNormalCube(bPos.up(), false);
boolean var20 = !worldObj.isBlockNormalCube(bPos.north(), false);
boolean var21 = !worldObj.isBlockNormalCube(bPos.south(), false);
byte var22 = -1;
double var23 = 9999.0D;
// Botania - change collision box list check to !airblock check
if (!worldObj.isAirBlock(blockpos))
{
EnumFacing enumfacing = EnumFacing.UP;
double d3 = Double.MAX_VALUE;
if (var16 && var10 < var23) {
var23 = var10;
var22 = 0;
if (!this.worldObj.isBlockFullCube(blockpos.west()) && d0 < d3)
{
d3 = d0;
enumfacing = EnumFacing.WEST;
}
if (var17 && 1.0D - var10 < var23) {
var23 = 1.0D - var10;
var22 = 1;
if (!this.worldObj.isBlockFullCube(blockpos.east()) && 1.0D - d0 < d3)
{
d3 = 1.0D - d0;
enumfacing = EnumFacing.EAST;
}
if (var18 && var12 < var23) {
var23 = var12;
var22 = 2;
if (!this.worldObj.isBlockFullCube(blockpos.north()) && d2 < d3)
{
d3 = d2;
enumfacing = EnumFacing.NORTH;
}
if (var19 && 1.0D - var12 < var23) {
var23 = 1.0D - var12;
var22 = 3;
if (!this.worldObj.isBlockFullCube(blockpos.south()) && 1.0D - d2 < d3)
{
d3 = 1.0D - d2;
enumfacing = EnumFacing.SOUTH;
}
if (var20 && var14 < var23) {
var23 = var14;
var22 = 4;
if (!this.worldObj.isBlockFullCube(blockpos.up()) && 1.0D - d1 < d3)
{
d3 = 1.0D - d1;
enumfacing = EnumFacing.UP;
}
if (var21 && 1.0D - var14 < var23) {
var23 = 1.0D - var14;
var22 = 5;
float f = this.rand.nextFloat() * 0.05F + 0.01F; // Botania - made multiplier and add both smaller
float f1 = (float)enumfacing.getAxisDirection().getOffset();
float secondary = (rand.nextFloat() - rand.nextFloat()) * 0.1F; // Botania - Make and use a secondary movement variable below
if (enumfacing.getAxis() == EnumFacing.Axis.X)
{
this.motionX += (double)(f1 * f);
this.motionY = this.motionZ = secondary;
}
float var25 = rand.nextFloat() * 0.05F + 0.025F;
float var26 = (rand.nextFloat() - rand.nextFloat()) * 0.1F;
if (var22 == 0) {
xSpeed = -var25;
ySpeed=zSpeed=var26;
else if (enumfacing.getAxis() == EnumFacing.Axis.Y)
{
this.motionY += (double)(f1 * f);
this.motionX = this.motionZ = secondary;
}
if (var22 == 1) {
xSpeed = var25;
ySpeed=zSpeed=var26;
}
if (var22 == 2) {
ySpeed = -var25;
xSpeed=zSpeed=var26;
}
if (var22 == 3) {
ySpeed = var25;
xSpeed=zSpeed=var26;
}
if (var22 == 4) {
zSpeed = -var25;
ySpeed=xSpeed=var26;
}
if (var22 == 5) {
zSpeed = var25;
ySpeed=xSpeed=var26;
else if (enumfacing.getAxis() == EnumFacing.Axis.Z)
{
this.motionZ += (double)(f1 * f);
this.motionX = this.motionY = secondary;
}
return true;
} else return false;
}
return false;
}
public boolean corrupt = false;
public boolean fake = false;
private int multiplier = 2;
private boolean shrink = true;
public int particle = 16;
private final boolean shrink = true;
public final int particle = 16;
public boolean tinkle = false;
public boolean slowdown = true;
public final boolean slowdown = true;
public int currentColor = 0;
}
@@ -11,8 +11,8 @@
package vazkii.botania.client.fx;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EffectRenderer;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.particle.ParticleManager;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
@@ -30,12 +30,13 @@ import vazkii.botania.common.lib.LibObfuscation;
import java.util.ArrayDeque;
import java.util.Queue;
public class FXWisp extends EntityFX {
public class FXWisp extends Particle {
private static final ResourceLocation vanillaParticles = new ResourceLocation("textures/particle/particles.png");
public static final ResourceLocation particles = new ResourceLocation(LibResources.MISC_WISP_LARGE);
private static Queue<FXWisp> queuedRenders = new ArrayDeque<>();
private static Queue<FXWisp> queuedDepthIgnoringRenders = new ArrayDeque<>();
private static final Queue<FXWisp> queuedRenders = new ArrayDeque<>();
private static final Queue<FXWisp> queuedDepthIgnoringRenders = new ArrayDeque<>();
// Queue values
private float f;
@@ -52,7 +53,7 @@ public class FXWisp extends EntityFX {
particleBlue = blue;
particleAlpha = 0.5F; // So MC renders us on the alpha layer, value not actually used
particleGravity = 0;
xSpeed = ySpeed = zSpeed = 0;
motionX = motionY = motionZ = 0;
particleScale *= size;
moteParticleScale = particleScale;
particleMaxAge = (int)(28D / (Math.random() * 0.3D + 0.7D) * maxAgeMul);
@@ -81,7 +82,7 @@ public class FXWisp extends EntityFX {
ParticleRenderDispatcher.depthIgnoringWispFxCount = 0;
GlStateManager.color(1.0F, 1.0F, 1.0F, 0.75F);
Minecraft.getMinecraft().renderEngine.bindTexture(ConfigHandler.matrixMode ? ReflectionHelper.getPrivateValue(EffectRenderer.class, null, LibObfuscation.PARTICLE_TEXTURES) : particles);
Minecraft.getMinecraft().renderEngine.bindTexture(ConfigHandler.matrixMode ? vanillaParticles : particles);
if(!queuedRenders.isEmpty()) {
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_LMAP_COLOR);
@@ -150,13 +151,13 @@ public class FXWisp extends EntityFX {
if (particleAge++ >= particleMaxAge)
setExpired();
ySpeed -= 0.04D * particleGravity;
posX += xSpeed;
posY += ySpeed;
posZ += zSpeed;
xSpeed *= 0.98000001907348633D;
ySpeed *= 0.98000001907348633D;
zSpeed *= 0.98000001907348633D;
motionY -= 0.04D * particleGravity;
posX += motionX;
posY += motionY;
posZ += motionZ;
motionX *= 0.98000001907348633D;
motionY *= 0.98000001907348633D;
motionZ *= 0.98000001907348633D;
}
public void setGravity(float value) {
@@ -164,15 +165,15 @@ public class FXWisp extends EntityFX {
}
public void setSpeed(float mx, float my, float mz) {
xSpeed = mx;
ySpeed = my;
zSpeed = mz;
motionX = mx;
motionY = my;
motionZ = mz;
}
private boolean depthTest = true;
public boolean distanceLimit = true;
private float moteParticleScale;
private int moteHalfLife;
private final float moteParticleScale;
private final int moteHalfLife;
public boolean tinkle = false;
public int blendmode = 1;
}
@@ -32,7 +32,7 @@ public final class ParticleRenderDispatcher {
Profiler profiler = Minecraft.getMinecraft().mcProfiler;
GL11.glPushAttrib(GL11.GL_LIGHTING);
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
GlStateManager.depthMask(false);
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
@@ -12,14 +12,14 @@ package vazkii.botania.client.gui;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.achievement.GuiAchievements;
import net.minecraft.stats.StatFileWriter;
import net.minecraft.stats.StatisticsManager;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import vazkii.botania.common.achievement.ModAchievements;
public class GuiAchievementsHacky extends GuiAchievements {
public GuiAchievementsHacky(GuiScreen p_i45026_1_, StatFileWriter p_i45026_2_) {
super(p_i45026_1_, p_i45026_2_);
public GuiAchievementsHacky(GuiScreen screen, StatisticsManager stats) {
super(screen, stats);
ReflectionHelper.setPrivateValue(GuiAchievements.class, this, ModAchievements.pageIndex, "currentPage");
}
@@ -17,17 +17,17 @@ import net.minecraft.item.ItemStack;
public class SlotLocked extends Slot {
public SlotLocked(IInventory p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_) {
super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_);
public SlotLocked(IInventory inv, int index, int xPos, int yPos) {
super(inv, index, xPos, yPos);
}
@Override
public boolean canTakeStack(EntityPlayer p_82869_1_) {
public boolean canTakeStack(EntityPlayer player) {
return false;
}
@Override
public boolean isItemValid(ItemStack p_75214_1_) {
public boolean isItemValid(ItemStack stack) {
return false;
}
@@ -11,28 +11,31 @@
package vazkii.botania.client.gui.bag;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ClickType;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.SlotItemHandler;
import vazkii.botania.client.gui.SlotLocked;
import javax.annotation.Nonnull;
public class ContainerFlowerBag extends Container {
InventoryFlowerBag flowerBagInv;
private final InventoryFlowerBag flowerBagInv;
public ContainerFlowerBag(EntityPlayer player) {
public ContainerFlowerBag(InventoryPlayer playerInv, InventoryFlowerBag flowerBagInv) {
int i;
int j;
int slot = player.inventory.currentItem;
IInventory playerInv = player.inventory;
flowerBagInv = new InventoryFlowerBag(player, slot);
this.flowerBagInv = flowerBagInv;
for(i = 0; i < 2; ++i)
for(j = 0; j < 8; ++j) {
int k = j + i * 8;
addSlotToContainer(new SlotFlower(flowerBagInv, k, 17 + j * 18, 26 + i * 18, k));
addSlotToContainer(new SlotItemHandler(flowerBagInv, k, 17 + j * 18, 26 + i * 18));
}
for(i = 0; i < 3; ++i)
@@ -40,7 +43,7 @@ public class ContainerFlowerBag extends Container {
addSlotToContainer(new Slot(playerInv, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
for(i = 0; i < 9; ++i) {
if(player.inventory.currentItem == i)
if(playerInv.getStackInSlot(i) == flowerBagInv.bag)
addSlotToContainer(new SlotLocked(playerInv, i, 8 + i * 18, 142));
else addSlotToContainer(new Slot(playerInv, i, 8 + i * 18, 142));
}
@@ -48,30 +51,21 @@ public class ContainerFlowerBag extends Container {
}
@Override
public boolean canInteractWith(EntityPlayer player) {
boolean can = flowerBagInv.isUseableByPlayer(player);
if(!can)
onContainerClosed(player);
return can;
public boolean canInteractWith(@Nonnull EntityPlayer player) {
return player.getHeldItemMainhand() == flowerBagInv.bag
|| player.getHeldItemOffhand() == flowerBagInv.bag;
}
@Override
public void onContainerClosed(EntityPlayer player) {
super.onContainerClosed(player);
flowerBagInv.pushInventory();
}
@Override
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) {
public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) {
ItemStack itemstack = null;
Slot slot = inventorySlots.get(p_82846_2_);
Slot slot = inventorySlots.get(slotIndex);
if(slot != null && slot.getHasStack()) {
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
if(p_82846_2_ < 16) {
if(slotIndex < 16) {
if(!mergeItemStack(itemstack1, 16, 52, true))
return null;
} else {
@@ -90,7 +84,7 @@ public class ContainerFlowerBag extends Container {
if(itemstack1.stackSize == itemstack.stackSize)
return null;
slot.onPickupFromSlot(p_82846_1_, itemstack1);
slot.onPickupFromSlot(player, itemstack1);
}
return itemstack;
@@ -13,11 +13,13 @@ package vazkii.botania.client.gui.bag;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.items.SlotItemHandler;
import vazkii.botania.client.lib.LibResources;
import vazkii.botania.common.block.ModBlocks;
@@ -27,19 +29,19 @@ public class GuiFlowerBag extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation(LibResources.GUI_FLOWER_BAG);
public GuiFlowerBag(EntityPlayer player) {
super(new ContainerFlowerBag(player));
public GuiFlowerBag(InventoryPlayer playerInv, InventoryFlowerBag flowerBagInv) {
super(new ContainerFlowerBag(playerInv, flowerBagInv));
}
@Override
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) {
String s = I18n.translateToLocal("item.botania:flowerBag.name");
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
String s = I18n.format("item.botania:flowerBag.name");
fontRendererObj.drawString(s, xSize / 2 - fontRendererObj.getStringWidth(s) / 2, 6, 4210752);
fontRendererObj.drawString(I18n.translateToLocal("container.inventory"), 8, ySize - 96 + 2, 4210752);
fontRendererObj.drawString(I18n.format("container.inventory"), 8, ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(texture);
int k = (width - xSize) / 2;
@@ -48,10 +50,10 @@ public class GuiFlowerBag extends GuiContainer {
List<Slot> slotList = inventorySlots.inventorySlots;
for(Slot slot : slotList)
if(slot instanceof SlotFlower) {
SlotFlower slotf = (SlotFlower) slot;
if(slot instanceof SlotItemHandler) {
SlotItemHandler slotf = (SlotItemHandler) slot;
if(!slotf.getHasStack()) {
ItemStack stack = new ItemStack(ModBlocks.flower, 0, slotf.color);
ItemStack stack = new ItemStack(ModBlocks.flower, 0, slotf.getSlotIndex()); // index matches colors
int x = guiLeft + slotf.xDisplayPosition;
int y = guiTop + slotf.yDisplayPosition;
RenderHelper.enableGUIStandardItemLighting();
@@ -62,9 +64,4 @@ public class GuiFlowerBag extends GuiContainer {
}
}
@Override
protected boolean checkHotbarKeys(int p_146983_1_) {
return false;
}
}
@@ -10,180 +10,42 @@
*/
package vazkii.botania.client.gui.bag;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import vazkii.botania.common.item.ItemFlowerBag;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lib.LibItemNames;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandlerModifiable;
import java.util.Arrays;
public class InventoryFlowerBag implements IItemHandlerModifiable {
public class InventoryFlowerBag implements IInventory {
private final IItemHandlerModifiable bagInv;
final ItemStack bag;
private static final ItemStack[] FALLBACK_INVENTORY = new ItemStack[16];
EntityPlayer player;
int slot;
ItemStack[] stacks = null;
boolean invPushed = false;
ItemStack storedInv = null;
public InventoryFlowerBag(EntityPlayer player, int slot) {
this.player = player;
this.slot = slot;
}
public static boolean isFlowerBag(ItemStack stack) {
return stack != null && stack.getItem() == ModItems.flowerBag;
}
ItemStack getStack() {
ItemStack stack = player.inventory.getStackInSlot(slot);
if(stack != null)
storedInv = stack;
return stack;
}
ItemStack[] getInventory() {
if(stacks != null)
return stacks;
ItemStack stack = getStack();
if(isFlowerBag(getStack())) {
stacks = ItemFlowerBag.loadStacks(stack);
return stacks;
}
return FALLBACK_INVENTORY;
}
public void pushInventory() {
if(invPushed)
return;
ItemStack stack = getStack();
if(stack == null)
stack = storedInv;
if(stack != null) {
ItemStack[] inv = getInventory();
ItemFlowerBag.setStacks(stack, inv);
}
invPushed = true;
public InventoryFlowerBag(ItemStack bag) {
this.bag = bag;
this.bagInv = (IItemHandlerModifiable) bag.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
}
@Override
public int getSizeInventory() {
return 16;
public void setStackInSlot(int slot, ItemStack stack) {
bagInv.setStackInSlot(slot, stack);
}
@Override
public ItemStack getStackInSlot(int i) {
return getInventory()[i];
public int getSlots() {
return bagInv.getSlots();
}
@Override
public ItemStack decrStackSize(int i, int j) {
ItemStack[] inventorySlots = getInventory();
if (inventorySlots[i] != null) {
ItemStack stackAt;
if (inventorySlots[i].stackSize <= j) {
stackAt = inventorySlots[i];
inventorySlots[i] = null;
return stackAt;
} else {
stackAt = inventorySlots[i].splitStack(j);
if (inventorySlots[i].stackSize == 0)
inventorySlots[i] = null;
return stackAt;
}
}
return null;
public ItemStack getStackInSlot(int slot) {
return bagInv.getStackInSlot(slot);
}
@Override
public ItemStack removeStackFromSlot(int i) {
return getStackInSlot(i);
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
return bagInv.insertItem(slot, stack, simulate);
}
@Override
public void setInventorySlotContents(int i, ItemStack itemstack) {
ItemStack[] inventorySlots = getInventory();
inventorySlots[i] = itemstack;
public ItemStack extractItem(int slot, int amount, boolean simulate) {
return bagInv.extractItem(slot, amount, simulate);
}
@Override
public int getInventoryStackLimit() {
return isFlowerBag(getStack()) ? 64 : 0;
}
@Override
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
return isFlowerBag(getStack());
}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
return isFlowerBag(getStack());
}
@Override
public int getField(int id) {
return 0;
}
@Override
public void setField(int id, int value) {}
@Override
public int getFieldCount() {
return 0;
}
@Override
public void clear() {
if (stacks != null) {
Arrays.fill(stacks, null);
}
}
@Override
public boolean hasCustomName() {
return false;
}
@Override
public ITextComponent getDisplayName() {
return new TextComponentString(getName());
}
@Override
public void openInventory(EntityPlayer player) {
// NO-OP
}
@Override
public void closeInventory(EntityPlayer player) {
// NO-OP
}
@Override
public String getName() {
return LibItemNames.FLOWER_BAG;
}
@Override
public void markDirty() {
// NO-OP
}
}
@@ -1,39 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [Mar 16, 2015, 7:20:05 PM (GMT)]
*/
package vazkii.botania.client.gui.bag;
import net.minecraft.inventory.Slot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import vazkii.botania.common.block.ModBlocks;
public class SlotFlower extends Slot {
InventoryFlowerBag inv;
int color;
public SlotFlower(InventoryFlowerBag p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_, int color) {
super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_);
this.color = color;
inv = p_i1824_1_;
}
@Override
public void onSlotChange(ItemStack oldStack, ItemStack newStack) {
inv.setInventorySlotContents(color, newStack);
}
@Override
public boolean isItemValid(ItemStack stack) {
return stack.getItem() == Item.getItemFromBlock(ModBlocks.flower) && stack.getItemDamage() == color;
}
}
@@ -20,21 +20,23 @@ import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.SlotItemHandler;
import vazkii.botania.api.mana.IManaItem;
import vazkii.botania.client.gui.SlotLocked;
import javax.annotation.Nonnull;
public class ContainerBaubleBox extends Container {
InventoryBaubleBox baubleBoxInv;
InventoryBaubles baubles;
private final InventoryBaubleBox baubleBoxInv;
private final InventoryBaubles baubles;
public ContainerBaubleBox(EntityPlayer player) {
public ContainerBaubleBox(EntityPlayer player, InventoryBaubleBox boxInv) {
int i;
int j;
int slot = player.inventory.currentItem;
IInventory playerInv = player.inventory;
baubleBoxInv = new InventoryBaubleBox(player, slot);
baubleBoxInv = boxInv;
baubles = new InventoryBaubles(player);
baubles.setEventHandler(this);
@@ -49,7 +51,7 @@ public class ContainerBaubleBox extends Container {
for(i = 0; i < 4; ++i)
for(j = 0; j < 6; ++j) {
int k = j + i * 6;
addSlotToContainer(new SlotAnyBauble(baubleBoxInv, k, 62 + j * 18, 8 + i * 18));
addSlotToContainer(new SlotItemHandler(baubleBoxInv, k, 62 + j * 18, 8 + i * 18));
}
for(i = 0; i < 3; ++i)
@@ -57,7 +59,7 @@ public class ContainerBaubleBox extends Container {
addSlotToContainer(new Slot(playerInv, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
for(i = 0; i < 9; ++i) {
if(player.inventory.currentItem == i)
if(playerInv.getStackInSlot(i) == baubleBoxInv.box)
addSlotToContainer(new SlotLocked(playerInv, i, 8 + i * 18, 142));
else addSlotToContainer(new Slot(playerInv, i, 8 + i * 18, 142));
}
@@ -65,40 +67,35 @@ public class ContainerBaubleBox extends Container {
}
@Override
public boolean canInteractWith(EntityPlayer player) {
boolean can = baubleBoxInv.isUseableByPlayer(player);
if(!can)
onContainerClosed(player);
return can;
public boolean canInteractWith(@Nonnull EntityPlayer player) {
return player.getHeldItemMainhand() == baubleBoxInv.box
|| player.getHeldItemOffhand() == baubleBoxInv.box;
}
@Override
public void onContainerClosed(EntityPlayer player) {
super.onContainerClosed(player);
baubleBoxInv.pushInventory();
if(!player.worldObj.isRemote)
PlayerHandler.setPlayerBaubles(player, baubles);
}
@Override
public void putStacksInSlots(ItemStack[] p_75131_1_) {
public void putStacksInSlots(ItemStack[] arr) {
baubles.blockEvents = true;
super.putStacksInSlots(p_75131_1_);
super.putStacksInSlots(arr);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_) {
public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) {
ItemStack itemstack = null;
Slot slot = inventorySlots.get(p_82846_2_);
Slot slot = inventorySlots.get(slotIndex);
if(slot != null && slot.getHasStack()) {
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
System.out.println(p_82846_2_ + " " + itemstack);
if(p_82846_2_ < 28) {
if(slotIndex < 28) {
if(!mergeItemStack(itemstack1, 28, 64, true))
return null;
} else {
@@ -113,7 +110,7 @@ public class ContainerBaubleBox extends Container {
if(itemstack1.stackSize == itemstack.stackSize)
return null;
slot.onPickupFromSlot(p_82846_1_, itemstack1);
slot.onPickupFromSlot(player, itemstack1);
}
return itemstack;
@@ -22,17 +22,12 @@ public class GuiBaubleBox extends InventoryEffectRenderer {
private static final ResourceLocation texture = new ResourceLocation(LibResources.GUI_BAUBLE_BOX);
public GuiBaubleBox(EntityPlayer player) {
super(new ContainerBaubleBox(player));
public GuiBaubleBox(EntityPlayer player, InventoryBaubleBox box) {
super(new ContainerBaubleBox(player, box));
}
@Override
protected boolean checkHotbarKeys(int p_146983_1_) {
return false;
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
@@ -43,7 +38,7 @@ public class GuiBaubleBox extends InventoryEffectRenderer {
drawTexturedModalRect(guiLeft+slot.xDisplayPosition, guiTop+slot.yDisplayPosition, 200, 0, 16, 16);
}
GuiInventory.drawEntityOnScreen(guiLeft + 43, guiTop + 61, 20, guiLeft + 43 - p_146976_2_, guiTop + 45 - 30 - p_146976_3_, mc.thePlayer);
GuiInventory.drawEntityOnScreen(guiLeft + 43, guiTop + 61, 20, guiLeft + 43 - mouseX, guiTop + 45 - 30 - mouseY, mc.thePlayer);
}
}
@@ -10,179 +10,43 @@
*/
package vazkii.botania.client.gui.box;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import vazkii.botania.common.item.ItemBaubleBox;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lib.LibItemNames;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandlerModifiable;
import java.util.Arrays;
public class InventoryBaubleBox implements IItemHandlerModifiable {
public class InventoryBaubleBox implements IInventory {
private final IItemHandlerModifiable boxInv;
final ItemStack box;
private static final ItemStack[] FALLBACK_INVENTORY = new ItemStack[16];
EntityPlayer player;
int slot;
ItemStack[] stacks = null;
boolean invPushed = false;
ItemStack storedInv = null;
public InventoryBaubleBox(EntityPlayer player, int slot) {
this.player = player;
this.slot = slot;
}
public static boolean isBaubleBox(ItemStack stack) {
return stack != null && stack.getItem() == ModItems.baubleBox;
}
ItemStack getStack() {
ItemStack stack = player.inventory.getStackInSlot(slot);
if(stack != null)
storedInv = stack;
return stack;
}
ItemStack[] getInventory() {
if(stacks != null)
return stacks;
ItemStack stack = getStack();
if(isBaubleBox(getStack())) {
stacks = ItemBaubleBox.loadStacks(stack);
return stacks;
}
return FALLBACK_INVENTORY;
}
public void pushInventory() {
if(invPushed)
return;
ItemStack stack = getStack();
if(stack == null)
stack = storedInv;
if(stack != null) {
ItemStack[] inv = getInventory();
ItemBaubleBox.setStacks(stack, inv);
}
invPushed = true;
public InventoryBaubleBox(ItemStack box) {
this.box = box;
this.boxInv = (IItemHandlerModifiable) box.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
}
@Override
public int getSizeInventory() {
return 16;
public void setStackInSlot(int slot, ItemStack stack) {
boxInv.setStackInSlot(slot, stack);
}
@Override
public ItemStack getStackInSlot(int i) {
return getInventory()[i];
public int getSlots() {
return boxInv.getSlots();
}
@Override
public ItemStack decrStackSize(int i, int j) {
ItemStack[] inventorySlots = getInventory();
if (inventorySlots[i] != null) {
ItemStack stackAt;
if (inventorySlots[i].stackSize <= j) {
stackAt = inventorySlots[i];
inventorySlots[i] = null;
return stackAt;
} else {
stackAt = inventorySlots[i].splitStack(j);
if (inventorySlots[i].stackSize == 0)
inventorySlots[i] = null;
return stackAt;
}
}
return null;
public ItemStack getStackInSlot(int slot) {
return boxInv.getStackInSlot(slot);
}
@Override
public ItemStack removeStackFromSlot(int i) {
return getStackInSlot(i);
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate) {
return boxInv.insertItem(slot, stack, simulate);
}
@Override
public void setInventorySlotContents(int slot, ItemStack itemstack) {
ItemStack[] inventorySlots = getInventory();
inventorySlots[slot] = itemstack;
}
@Override
public int getInventoryStackLimit() {
return isBaubleBox(getStack()) ? 64 : 0;
}
@Override
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
return isBaubleBox(getStack());
}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
return isBaubleBox(getStack());
}
@Override
public int getField(int id) {
return 0;
}
@Override
public void setField(int id, int value) {}
@Override
public int getFieldCount() {
return 0;
}
@Override
public void clear() {
if (stacks != null)
Arrays.fill(stacks, null);
}
@Override
public boolean hasCustomName() {
return false;
}
@Override
public ITextComponent getDisplayName() {
return new TextComponentString(getName());
}
@Override
public void openInventory(EntityPlayer player) {
// NO-OP
}
@Override
public void closeInventory(EntityPlayer player) {
// NO-OP
}
@Override
public String getName() {
return LibItemNames.BAUBLE_BOX;
}
@Override
public void markDirty() {
// NO-OP
public ItemStack extractItem(int slot, int amount, boolean simulate) {
return boxInv.extractItem(slot, amount, simulate);
}
}
@@ -1,37 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
* File Created @ [25/11/2015, 19:59:22 (GMT)]
*/
package vazkii.botania.client.gui.box;
import baubles.api.IBauble;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import vazkii.botania.api.mana.IManaItem;
public class SlotAnyBauble extends Slot {
InventoryBaubleBox inv;
public SlotAnyBauble(InventoryBaubleBox p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_) {
super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_);
inv = p_i1824_1_;
}
@Override
public void onSlotChange(ItemStack oldStack, ItemStack newStack) {
inv.setInventorySlotContents(slotNumber, newStack);
}
@Override
public boolean isItemValid(ItemStack stack) {
return stack.getItem() instanceof IBauble || stack.getItem() instanceof IManaItem;
}
}
@@ -18,10 +18,12 @@ import net.minecraft.inventory.SlotCrafting;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class ContainerCraftingHalo extends ContainerWorkbench {
public ContainerCraftingHalo(InventoryPlayer p_i1808_1_, World p_i1808_2_) {
super(p_i1808_1_, p_i1808_2_, BlockPos.ORIGIN);
public ContainerCraftingHalo(InventoryPlayer playerInv, World world) {
super(playerInv, world, BlockPos.ORIGIN);
craftMatrix = new InventoryCraftingHalo(this, 3, 3);
@@ -29,7 +31,7 @@ public class ContainerCraftingHalo extends ContainerWorkbench {
inventoryItemStacks.clear();
// Le copypasta
addSlotToContainer(new SlotCrafting(p_i1808_1_.player, craftMatrix, craftResult, 0, 124, 35));
addSlotToContainer(new SlotCrafting(playerInv.player, craftMatrix, craftResult, 0, 124, 35));
int l;
int i1;
@@ -45,20 +47,20 @@ public class ContainerCraftingHalo extends ContainerWorkbench {
{
for (i1 = 0; i1 < 9; ++i1)
{
addSlotToContainer(new Slot(p_i1808_1_, i1 + l * 9 + 9, 8 + i1 * 18, 84 + l * 18));
addSlotToContainer(new Slot(playerInv, i1 + l * 9 + 9, 8 + i1 * 18, 84 + l * 18));
}
}
for (l = 0; l < 9; ++l)
{
addSlotToContainer(new Slot(p_i1808_1_, l, 8 + l * 18, 142));
addSlotToContainer(new Slot(playerInv, l, 8 + l * 18, 142));
}
onCraftMatrixChanged(craftMatrix);
}
@Override
public boolean canInteractWith(EntityPlayer p_75145_1_) {
public boolean canInteractWith(@Nonnull EntityPlayer player) {
return true;
}
}
Loaded 100 of 1551 files, more files were not shown because too many files have changed in this diff. Show more