Compare commits

...
Author SHA1 Message Date
Vincent Lee 400bf95a44 Fix some lingering GoG worldgen and rendering issues. Closes #8. 2016-01-23 16:56:30 -06:00
Vincent Lee ba3d9ff9f8 Update garden of glass 2016-01-23 16:44:34 -06:00
Vincent Lee b3a140b8dd Temporary bandaid for thaumcraft brew integration. Closes #69. 2016-01-23 12:50:47 -06:00
Vincent Lee fabedeb31a Bump forge version, improve brewery JEI integration 2016-01-23 12:22:33 -06:00
Vincent Lee 2a738209b7 Revert "Tentative fix for multiblock transparency"
This reverts commit 03cfbfa73e.
2016-01-22 23:47:41 -06:00
Vincent Lee 03cfbfa73e Tentative fix for multiblock transparency 2016-01-22 23:28:46 -06:00
Vincent Lee eece9a08c1 Actually commit spreader blockstate json 2016-01-22 23:20:04 -06:00
Vincent Lee e5ee04113f placeholder model for spreader so it shows in JEI. make monocle use blockstates like it should 2016-01-22 22:32:02 -06:00
Vincent Lee 4bf8fd3b98 Remove some unused states from tiny potato 2016-01-22 21:18:54 -06:00
Vincent Lee 09fb64982a A bunch of more baubles 2016-01-22 20:42:12 -06:00
Vincent Lee b012f5152d Fix fab pools not being special snowflakes (colors same between all) 2016-01-21 23:14:45 -06:00
Vincent Lee 540baa4152 A little debug thign 2016-01-21 23:06:24 -06:00
Vincent Lee 77cd24b58a Merge upstream 2016-01-21 22:04:45 -06:00
Vincent Lee 98620bb1c5 Serverside the distributor. Closes #63 2016-01-21 21:30:22 -06:00
Vincent Lee 071bcefa6f Anotehr hoepful bandaid for all the clientside crashes 2016-01-21 21:23:23 -06:00
Vincent Lee 2a077adb6f Safeguard in the smartmodels. Closes #66 2016-01-21 21:21:26 -06:00
Vincent Lee 3d821e5da4 Fix some recipes not taking vanilla prismarine. closes #62 2016-01-21 21:16:00 -06:00
Vincent Lee 5991387f22 Actually close #59 2016-01-20 21:35:14 -06:00
Vincent Lee d0e4e436ad MOve recipes to init and remove thaumcraft after requirement. CLoses #53 2016-01-20 19:52:38 -06:00
Vincent Lee 27be487b7e Add a gradlew.bat. Closes #56 2016-01-20 19:15:46 -06:00
Vincent Lee 36976e6321 Fix divining rod looking up blocks with no item form in the OD. CLoses #57 2016-01-20 19:12:22 -06:00
Vincent Lee a6d89e3d4d Fix thorn chakram impact crash. Closes #59 2016-01-20 19:08:48 -06:00
Vincent Lee ab3bc85f20 Fix magic missile crash. closes #54 2016-01-20 19:07:29 -06:00
Vincent Lee ebf399edaa Most body based cosmetic baubles 2016-01-18 17:08:31 -06:00
Vincent Lee 4448a6a498 Blood, ice, lava, super lava pendants and itemfinder bauble renders 2016-01-18 15:41:55 -06:00
Vincent Lee a13d6fca53 Sideonly some things 2016-01-18 15:16:48 -06:00
Vincent Lee fef9f1b406 Flugel tiara bauble render 2016-01-18 15:12:57 -06:00
Vincent Lee 86ce88f068 Diva charm and golden laurel baubles render 2016-01-18 14:55:28 -06:00
Vincent Lee 9b2fa9de65 Monocle baubles render 2016-01-18 14:11:21 -06:00
Vincent Lee f87e2373f8 Tiny planet bauble render 2016-01-18 13:22:54 -06:00
Vincent Lee 4df1d500ed Remove unnecessary face from creative pool item json 2016-01-18 12:45:52 -06:00
Vincent Lee cec10471fb Fix two multiblock crashes, closes #48 2016-01-18 12:15:56 -06:00
Vincent Lee 177f50ca61 Bandaid for more client chunk unload crashes >.> 2016-01-18 11:45:07 -06:00
Vincent Lee e184394f55 Fix mana tablets and terrasteel helm will rendering 2016-01-18 11:30:13 -06:00
Vincent Lee eb28396d98 Fully fix contributor fanciness renders. Fix mana gun not being held like a tool in third person 2016-01-18 10:31:05 -06:00
Vincent Lee dda3151b73 Fix piston lens not working properly. Serverside some of the other lenses where safe 2016-01-17 17:30:01 -06:00
Vincent Lee 4e5cb59ebe Fix crash and possible desync in flash lens. Closes #47 2016-01-17 16:41:37 -06:00
Vincent Lee fef0857603 Desert, forest, fungal apothecary textures 2016-01-17 16:31:01 -06:00
Vincent Lee 8922ad5362 Use the non-insane calendar API 2016-01-16 18:38:22 -06:00
Vincent Lee be2b66dddf Partially restore bauble rendering. Everything is probably in the wrong place, but should render. 2016-01-16 18:25:31 -06:00
Vincent Lee 6e870f4e79 Remove some leftover debug messages 2016-01-16 16:57:51 -06:00
Vincent Lee 4d4ba74ac1 Fix ender air bottle event handler not being registered, closes #44 2016-01-16 16:56:17 -06:00
Vincent Lee 5e3345a1d7 Fix terra pick and elementium shovel not working correctly. Closes #43 2016-01-16 13:37:18 -06:00
Vincent Lee 568ee043df God dammit 2016-01-16 12:33:05 -06:00
Vincent Lee a615538289 Stop spamming packets when done digesting 2016-01-16 02:07:18 -06:00
Vincent Lee 7907d1d582 Fix passives decaying directly into nothing instead of a dead bush 2016-01-16 01:57:31 -06:00
Vincent Lee 46900df6cb Serverside gourmaryllis 2016-01-16 01:42:07 -06:00
Vincent Lee 1d8c536139 Fix pool minecart rendery fully 2016-01-15 21:48:29 -06:00
Vincent Lee eb028d6c05 Fully fix mana pool models 2016-01-15 21:20:49 -06:00
Vincent Lee 406f89a968 Cleanup, implement some easter egg models I missed 2016-01-15 14:14:10 -06:00
Vincent Lee 2c15b6150c Lots of MOP guards. closes #41 2016-01-15 11:27:32 -06:00
Vincent Lee bee13337ad Made laputa shard save string block id's instead of integer id's. Also, a possible fix for #40 2016-01-15 10:56:23 -06:00
Vincent Lee 98e28a0967 Made some things one sided only 2016-01-14 22:44:50 -06:00
Vincent Lee 4a4e583aa8 Fix wonky petal apothecary collision 2016-01-14 21:53:18 -06:00
Vincent Lee 300b1926de Possible fix for #38 2016-01-14 17:20:05 -06:00
Vincent Lee 3818d2879d no longer register gaia tesr onto vanilla skulls 2016-01-14 16:47:48 -06:00
Vincent Lee e12163f70c Merge upstream 2016-01-14 16:40:14 -06:00
Vincent Lee dcb236607d Fix hopperhock placing items one block too far away. Closes #39 2016-01-14 12:08:57 -06:00
Vincent Lee 08de553593 No longer use the raw potion array, use potio registry 2016-01-14 11:54:08 -06:00
Vincent Lee b01e9dfed7 Staging changes would be a good idea. Also fix possible potion crash 2016-01-13 17:14:12 -06:00
Vincent Lee 4b7608fc2a Add nag that this is unofficial right now 2016-01-13 14:13:19 -06:00
Vincent Lee 103efe9c7b Destitch cocoon texmap 2016-01-13 12:54:02 -06:00
Vincent Lee 1402e2a50a Start work on destitching apothecary texmaps 2016-01-13 12:37:15 -06:00
Vincent Lee c8d9764fe3 Read atlas size dynamically 2016-01-13 10:59:10 -06:00
Vincent Lee 3e19a84b6d Fix terra shatterer tooltip darkening screen. Closes #37 2016-01-13 00:42:32 -06:00
Vincent Lee a30887d6f9 Debug thing for me, to dump the texture atlas 2016-01-13 00:02:18 -06:00
Vincent Lee 80bd63be0b Bunch of TE particle textures. Fix a bellows crash and teru teru bozu not working with sunflower 2016-01-12 23:27:36 -06:00
Vincent Lee 6c9a01978a Cocoon of caprice model 2016-01-12 15:04:08 -06:00
Vincent Lee 19e387f359 Fix off by one in forest drum meta to state 2016-01-12 13:58:19 -06:00
Vincent Lee f799f7bc32 Revert "Trying to render AO pool"
This reverts commit d8a74e2e44.
2016-01-12 12:00:29 -06:00
Vincent Lee d8a74e2e44 Trying to render AO pool 2016-01-11 20:06:59 -06:00
Vincent Lee 30578abfb4 Merge pull request #36 from GirafiStudios/MC18
Fixed special named Tiny Potatoes. (Besides Ible)
2016-01-11 17:14:30 -06:00
GirafiStudios a172a325e1 Fixed named Tiny Potatoes rendering (Besides Ible) 2016-01-11 23:45:43 +01:00
Vincent Lee 64e3a96651 I is retarded 2016-01-11 14:25:00 -06:00
Vincent Lee 94d72161a9 Revert mesher lambdas 2016-01-11 14:10:11 -06:00
Vincent Lee 8e7f1cfac1 Temporary java 8 reobfuscation fix closes #33. 2016-01-11 11:23:46 -06:00
Vincent Lee f3cce3d24e Global safety checks for blockstates while chunks are unloading 2016-01-10 22:53:21 -06:00
Vincent Lee 84204db587 Fix ender air bottle render, move to java 8, giant import cleanup 2016-01-10 18:16:30 -06:00
Vincent Lee 404d99445e Sleeves render on spreaders again. Closes #6 2016-01-09 23:35:18 -06:00
Vincent Lee f3f055a58e More 2016-01-09 21:26:43 -06:00
Vincent Lee e142561799 Model cleanup 2016-01-09 21:22:37 -06:00
Vincent Lee 14a7f6b14b COrrect Crafty crate models 2016-01-09 21:01:50 -06:00
Vincent Lee a6899a9f40 Special flower lighting crash 2016-01-09 19:31:58 -06:00
Vincent Lee 57398723a4 Cleanup 2016-01-09 19:05:37 -06:00
Vincent Lee 4345bd9728 More blockstate guards in TE and blockstate conversions 2016-01-09 19:01:31 -06:00
Vincent Lee 1c14dcf8ff Fix pylon crash 2016-01-09 18:37:12 -06:00
Vincent Lee 7615d0b893 Fix recipes for 1.9 purpur not being registered 2016-01-09 17:49:59 -06:00
Vincent Lee 568ed80ede Allow platform to render other smart models 2016-01-09 00:03:04 -06:00
Vincent Lee c3dce97e0d Fix pylon and pool rendering in multiblock. Closes #25 2016-01-08 23:03:30 -06:00
Vincent Lee 61b8616008 Fix double flowers not dropping from both halves. Closes #24 2016-01-08 20:34:55 -06:00
Vincent Lee f61d47f2dc Some cleanup, fix wand of the forest minor bugs. Closes #22 2016-01-08 19:53:28 -06:00
Vincent Lee 9e16c4490b Rename RenderEventHandler, restore flugel tiara extra renders, and fix sparkles renderirng too low. Closes #21 2016-01-08 19:10:28 -06:00
Vincent Lee b4df8ce418 Full platform models. Fix bore lens crash and add copyleft headers to some things 2016-01-08 18:47:31 -06:00
Vincent Lee 84d0c75605 Fix lighting, AO is still broken 2016-01-08 14:56:16 -06:00
Vincent Lee 9c3a042089 pool tesr now uses baked model 2016-01-08 14:14:17 -06:00
Vincent Lee a1aa50b532 Merge upstream release 248 2016-01-08 12:34:51 -06:00
Vincent Lee 972943a9ac Updates to internal handler and icons 2016-01-08 12:33:49 -06:00
Vincent Lee a4a77fb20f Merge upstream 2016-01-08 12:00:01 -06:00
Vincent Lee 3a54166954 Revert "Tentatively change relics to use UUID. Still use playernames for display" due to a better solution being merged upstream.
This reverts commit 0687f56c32.
2016-01-08 11:29:03 -06:00
Vincent Lee cd77b41d31 Incense plate converted to json 2016-01-07 21:19:39 -06:00
Vincent Lee 20b5743221 Safety guards for blockstates, remove all useless casts 2016-01-07 19:55:54 -06:00
Vincent Lee e58eb1b345 Fix alfportal derp 2016-01-07 17:03:28 -06:00
Vincent Lee 064fd20edb Mana flash and water bowl items 2016-01-07 16:56:03 -06:00
Vincent Lee 85102dea89 Mana inkwell item model. Pylon models fully working 2016-01-07 14:32:38 -06:00
Vincent Lee baf14c361b Fix third person render 2016-01-07 11:59:22 -06:00
Vincent Lee 3b7d7628cf Derp 2016-01-07 11:46:36 -06:00
Vincent Lee 8155dc3059 Life imbuer model complete 2016-01-07 11:35:41 -06:00
Vincent Lee 0494c0eba2 Generify stuff, fix gaia head render, hourglass inventory model 2016-01-07 10:32:51 -06:00
Vincent Lee 12dfecb8ac Add a bunch of dirty, dirty tesr item hook items. Also fix fabulous mana pool leaking its fabulousness 2016-01-07 08:52:58 -06:00
Vincent Lee 92aaa9f70a Spreader turntable model 2016-01-06 21:40:18 -06:00
Vincent Lee 929860f8fa Partial claw model. Fix cell block being a debug floating island. Fix a pure daisy oredict bug by checking for drops instead of state 2016-01-06 20:56:25 -06:00
Vincent Lee 383cd059cc Fix hourglass having inverted redstone power. How come no one caught this?! 2016-01-06 20:16:22 -06:00
Vincent Lee 2ddf71d76f Cleanup 2016-01-05 21:41:07 -06:00
Vincent Lee 34fae04641 Made API dediserver-safe. Remove icon methods from SubTileSignature. 2016-01-05 21:39:56 -06:00
Vincent Lee dc6af948d9 Don't use a sideonly client method. Closes #18 2016-01-05 21:23:50 -06:00
Vincent Lee 3fe2a0006c Change crystal bow draw animation to better reflect when it's fully charged 2016-01-05 19:51:41 -06:00
Vincent Lee 89dac440c8 Change starfield item model to match upstream 2016-01-05 19:27:54 -06:00
Vincent Lee 5797d18d9b Fix a bunch of coloring mistakes. Fix flower particles because I'm dumb 2016-01-05 19:24:30 -06:00
Vincent Lee 52cf3df27e Fix tessellator bugs, fix alf portal crash 2016-01-05 17:15:22 -06:00
Vincent Lee b976ed5df1 Cleanup JEI integration, add copyleft. 2016-01-05 17:01:46 -06:00
Vincent Lee e727cb7f2b Merge branch 'jei' into MC18 2016-01-05 16:51:18 -06:00
Vincent Lee 8e6dc7c637 JEI integration complete (runic altar, mana infusion) 2016-01-05 16:51:03 -06:00
Vincent Lee 28249d1e33 Elven trade integration 2016-01-05 15:36:10 -06:00
Vincent Lee b24585b13d Update a bunch of recipes to take vanilla blocks and items. Also remove prismarine lex entry and move infusion recipe to mana pool page. 2016-01-05 12:25:53 -06:00
Vincent Lee 86880bfd49 Fix helmet of revealing inv model 2016-01-05 00:05:09 -06:00
Vincent Lee c8c50f9af0 Future is now part 1: conversions recipes to vanilla 2016-01-04 23:29:50 -06:00
Vincent Lee 0e301a4e33 Fix apothecary light level crash, tiny potato render crash. Closes #17 2016-01-04 22:47:47 -06:00
Vincent Lee 10d095d656 Finish pure daisy integration 2016-01-04 22:46:24 -06:00
Vincent Lee 9bf2e0c555 Semi working petal apothecary itnegration 2016-01-04 22:34:45 -06:00
Vincent Lee 95118696ce Half complete petal apothecary 2016-01-04 20:57:14 -06:00
Vincent Lee ab4f6f6433 workaround for pylon enchant power. closes #16 2016-01-04 19:58:54 -06:00
Vincent Lee 46c13be698 Fix rotations and nameplates for tiny potato 2016-01-04 14:09:18 -06:00
Vincent Lee ad58fb1855 Partial tiny potato 2016-01-04 12:18:19 -06:00
Vincent Lee 12ae7ed3d1 Fix thaumcraft integration crashing 2016-01-04 10:01:04 -06:00
Vincent Lee 6cf82eb98d Rudimentary pure daisy integration 2016-01-03 23:43:24 -06:00
Vincent Lee b10a642297 Brewery recipe support 2016-01-03 22:02:02 -06:00
Vincent Lee 75ab210227 Item models fully working. TESRs may be changed in future 2016-01-03 19:59:27 -06:00
Vincent Lee 0b27d9d0b5 Attempt at json pool model 2016-01-03 19:29:09 -06:00
Vincent Lee 3c102bbc75 Move mc dep ver out of @Mod 2016-01-02 23:32:55 -06:00
Vincent Lee 4e1065855e Some formatting cleanups. Add copyleft header to all new classes 2016-01-02 23:21:55 -06:00
Vincent Lee 3eb67e3fea Corporea index and cube item model 2016-01-02 19:43:41 -06:00
Vincent Lee 5d80b7d9ce Fix thaumcraft 5 goggles of revealing integration. closes #14 2016-01-02 19:07:52 -06:00
Vincent Lee f7e5054bf4 Fix armor rendering - thanks primetoxinz for the find! 2016-01-01 16:05:17 -06:00
Vincent Lee 906fb74ec0 Fix santaweave inv icons 2016-01-01 15:35:08 -06:00
Vincent Lee 48cf387682 Unssuccessful attempt to fix sky renderer leaking state. Mark for release 2015-12-31 14:28:13 -06:00
Vincent Lee c54b85dfd5 Cacophonium block model 2015-12-31 13:34:09 -06:00
Vincent Lee bd98879d49 Fix piston relays 2015-12-31 13:13:32 -06:00
Vincent Lee b3a83031c1 Misc rendering fixes 2015-12-31 12:45:18 -06:00
Vincent Lee c8d4c54ed7 Bandaid for one block off multiblock render 2015-12-30 23:47:16 -06:00
Vincent Lee 9ee02b55ad Fix bifrost rod, gateway core and root model 2015-12-30 23:37:49 -06:00
Vincent Lee 2cc7e133cc fluxfield model, fix pump crash, fix gaia render 2015-12-30 22:25:08 -06:00
Vincent Lee 0c062967a0 Mana Bomb, Mana Detector 2015-12-30 21:23:54 -06:00
Vincent Lee 1cf175d412 Baubles and stuff 2015-12-30 20:56:50 -06:00
Vincent Lee 5293f811c8 Fix king key weapon and item render 2015-12-30 19:34:14 -06:00
Vincent Lee c5a5657810 Missed some >.> also a teeny bit of attribution that probably won't even show up because it runs off the screen 2015-12-30 18:33:56 -06:00
Vincent Lee 4dd62fae37 Corporea blocks, luminizers, comment out nei and cbmp stuff so it can actually build. 2015-12-30 18:27:06 -06:00
Vincent Lee a67aeee496 SPark changer, terrasteel plate, fix spark entity render 2015-12-30 14:51:14 -06:00
Vincent Lee c2470f80ee Fixes so server works 2015-12-30 13:11:18 -06:00
Vincent Lee b4300a9e3b Corporea item icons (world render broken still). Temp fix for pylon multiblock rendering. 2015-12-30 00:55:21 -06:00
Vincent Lee 9f5455aa9f Let it run on 1.8.8 as well. 2015-12-29 23:47:28 -06:00
Vincent Lee 37b5d00388 Update to 1.8.9, fix apothecary collision 2015-12-29 23:45:26 -06:00
Vincent Lee 1973779897 Petal apothecaries fully restored 2015-12-29 22:37:19 -06:00
Vincent Lee 71607ae3bd Merge release build 246 2015-12-29 19:36:50 -06:00
Vincent Lee 965ab01889 Fix the textures 2015-12-29 14:56:19 -06:00
Vincent Lee 5a630fbf39 Done with floating flowers completely. Can't get the spinning right though. 2015-12-29 14:45:50 -06:00
Vincent Lee 3aef9efe8b Floating flowers kinda sorta mostly working 2015-12-29 00:34:13 -06:00
Vincent Lee 8f70814ae6 Partially working floaters 2015-12-28 22:21:22 -06:00
Vincent Lee 43cd84d2cd Fix multiblock rendering and enchanter activation bug 2015-12-28 19:11:20 -06:00
Vincent Lee 2f0915e18c Lots more item models, red string block models 2015-12-28 17:50:33 -06:00
Vincent Lee 8eedaa5563 Fix texture errors, fix pool and apothecary collision detection 2015-12-28 16:11:01 -06:00
Vincent Lee b701f197ee Some progress on floating flowers 2015-12-28 14:17:10 -06:00
Vincent Lee bf07f10ac7 Fix brewery rendering and operation 2015-12-27 22:38:26 -06:00
Vincent Lee 90fcc98bd0 Fix wisp particle 2015-12-27 20:33:24 -06:00
Vincent Lee c513f17f88 All brews, mana tablet, mana gun, incense, and other items 2015-12-27 20:16:31 -06:00
Vincent Lee e83d1600cf Blood pendant, enchanted soil, enchanter, open bucket, prism, fix some rendering 2015-12-27 16:52:30 -06:00
Vincent Lee 5b1ac0368d Quartz, prismarine, various items, fix upper slab uvlock 2015-12-27 15:39:45 -06:00
Vincent Lee 65837fbf38 Punt on apothecary. Items first 2015-12-27 12:52:02 -06:00
Vincent Lee 33a8d5e33c Done with apothecaries for today >.> 2015-12-27 01:51:06 -06:00
Vincent Lee b740a22684 Fix old tex, temporary json 2015-12-27 00:42:24 -06:00
Vincent Lee 7c41ffcaa1 Destitched model files 2015-12-27 00:26:41 -06:00
Vincent Lee 781f586d19 Upload some files so I can use modelcreator in windows >.> 2015-12-26 21:55:32 -06:00
Vincent Lee 794e1352e8 Lenses and lens rendering on spreader 2015-12-26 20:00:34 -06:00
Vincent Lee f449fca882 Actually commit this time 2015-12-26 17:41:50 -06:00
Vincent Lee 73663e8a0a Fix rod models, made runic altar and avatar render their items 2015-12-26 17:38:07 -06:00
Vincent Lee 86cd656360 Merge branch 'MC18' of github.com:williewillus/Botania into MC18 2015-12-26 16:27:00 -06:00
Vincent Lee 20b433af3c Merge pull request #2 from primetoxinz/MC18
More Item Models :D
2015-12-26 16:22:09 -06:00
Vincent Lee 5fe696875f More various models 2015-12-26 16:21:21 -06:00
primetoxinz 18dceeeb5f fix for merge 2015-12-26 16:43:32 -05:00
Tyler ccbf325a76 Merge pull request #2 from williewillus/MC18
Merge
2015-12-26 16:32:18 -05:00
Vincent Lee 2f4785c7b4 Clean up flower and mushroom jsons 2015-12-26 12:35:46 -06:00
Vincent Lee e2ac5ecad1 Fix double flowers fully, a couple more models 2015-12-26 00:49:30 -06:00
Vincent Lee 8cda41cdb8 Finish walls, and ALL slabs. Made floating flowers render properly in world. 2015-12-25 22:44:10 -06:00
Vincent Lee b36f51f6d8 Clean up a ton of models, add some walls 2015-12-24 22:00:24 -06:00
Vincent Lee 32fe7f6ce3 Fix landing and break particles in specail flowers 2015-12-24 15:05:52 -06:00
Vincent Lee 0687f56c32 Tentatively change relics to use UUID. Still use playernames for display 2015-12-24 14:42:52 -06:00
Vincent Lee 70d4450a6a Wand of the Forest, Fel pumpkin, trodden path 2015-12-24 14:00:11 -06:00
Vincent Lee dcd08963e9 Special item models 2015-12-24 12:33:25 -06:00
Vincent Lee 23cab39892 All special flowers. item model system not yet done 2015-12-24 11:05:00 -06:00
Vincent Lee f4ea60ba2c IT WORKS 2015-12-24 03:04:16 -06:00
Vincent Lee 319bab35a0 Lay all groundwork for special flower models. Not yet tested. 2015-12-24 02:14:21 -06:00
Vincent Lee d58f153742 Solid vine and crash fixes for it 2015-12-23 23:54:59 -06:00
Vincent Lee 64a8dfbcfe Drums, runic altar, mana pool kinda, distributor, force relay, starfield 2015-12-23 20:26:33 -06:00
Vincent Lee eabb0f94e3 Mana beacon, unstable block, petal block 2015-12-23 17:19:23 -06:00
primetoxinz d23cca33e1 More Item models 2015-12-23 17:07:32 -05:00
Tyler cbbefff0ce Merge pull request #1 from williewillus/MC18
merge
2015-12-23 17:03:30 -05:00
Vincent Lee cfaeecc41a Panes, and fixes so no crashes in debug world 2015-12-23 16:03:07 -06:00
Vincent Lee 0887191a64 All stair models done 2015-12-23 14:30:18 -06:00
Vincent Lee b10615c909 Revert unnecessary changes 2015-12-23 00:42:00 -06:00
Vincent Lee 2c660ba82b Merge branch 'primetoxinz-MC18' into MC18 2015-12-23 00:40:40 -06:00
Vincent Lee 92e90ed2b9 Merge branch 'MC18' of github.com:primetoxinz/Botania into primetoxinz-MC18 2015-12-23 00:39:40 -06:00
Vincent Lee 3d41be585b Pylons kinda working 2015-12-22 23:26:27 -06:00
Vincent Lee 57e5a3d0ac Pylon obj model possibly. item working, tile not so 2015-12-22 22:47:29 -06:00
primetoxinz 1b1e5e3bf0 Fixed Formatting 2015-12-22 23:34:35 -05:00
primetoxinz 7e0145bf34 remove debug code, whoops 2015-12-22 23:17:09 -05:00
primetoxinz e77678593f remove launch files 2015-12-22 23:09:21 -05:00
primetoxinz 9f429c7e17 Added most tools and armour models 2015-12-22 23:06:33 -05:00
primetoxinz 305b99b3f5 Added Models for Resources and other items 2015-12-22 22:37:27 -05:00
Vincent Lee 33b423aaa1 Lexicon item model. Alf/managlass blocks, altgrass 2015-12-22 20:28:14 -06:00
Vincent Lee d2340905d6 Livingwood, and livingrock and livingwood stairs 2015-12-22 17:43:51 -06:00
Vincent Lee 70353cf143 Livingrock, and reorganize model names. Sorry for the diff thrashing 2015-12-22 16:48:56 -06:00
Vincent Lee 42110cec45 Fix duplicate eventhandler 2015-12-22 16:18:34 -06:00
Vincent Lee cff6120aaf First block models 2015-12-22 16:16:04 -06:00
Vincent Lee 56228446b8 Stub out all rendering. Compiles and runsgit add -A 2015-12-22 12:49:18 -06:00
Vincent Lee b21d6f5ee6 All non rendering components compile 2015-12-22 11:13:23 -06:00
Vincent Lee 0db00970ab Made futurestone registration a bit less hardcody 2015-12-21 22:44:11 -06:00
Vincent Lee 320f6405e4 Rendering tweaks, and fix up all stairs/slabs/walls 2015-12-21 22:40:52 -06:00
Vincent Lee a23f317368 Finish BC integratoin 2015-12-21 19:49:51 -06:00
Vincent Lee 5379cda754 Update buildcraft api to 7.2.0 and integration mostly 2015-12-21 19:44:52 -06:00
Vincent Lee a9b060257f 1.8.8 tess fixes, potential double plant fix, bunch of reflectoin in spawner claw 2015-12-21 19:25:58 -06:00
Vincent Lee 5d666cd891 Some 1.8.8 tessellator changes 2015-12-21 13:53:31 -06:00
Vincent Lee ffe7b4ccc8 API looks to be good again 2015-12-21 13:01:33 -06:00
Vincent Lee c480a3303a Remove unneeded casts since 1.8.8 restores generics 2015-12-21 12:53:59 -06:00
Vincent Lee dbb549ba2a Merge upstream release 245 2015-12-21 12:47:58 -06:00
Vincent Lee b8a1a9cd5d Some 1.8.8 fixes before merging upstream 2015-12-21 12:24:28 -06:00
Vincent Lee 5211ed9149 Merge upstream and probably introduce a zillion errors 2015-12-14 16:38:07 -06:00
Vincent Lee 6b03424e2c Commit before merging upstream 2015-12-14 12:46:31 -06:00
Vincent Lee 8361d1743d Some rendering experiements, update notes 2015-11-30 12:53:36 -06:00
Vincent Lee 6cc88f1c5a Almost done with TEs 2015-11-29 16:45:36 -06:00
Vincent Lee 4736be9d61 Corporea done 2015-11-29 15:59:17 -06:00
Vincent Lee e4864d2e7b Red string blocks and tiles 2015-11-29 15:26:59 -06:00
Vincent Lee d0a14a451b More IIcon exorcisms, various compilation fixes now that we know states 2015-11-29 15:06:03 -06:00
Vincent Lee f58440b79a Misc cleanups and fixes. All magic flowers compile now! 2015-11-29 12:59:22 -06:00
Vincent Lee 9ea899bad5 Fix alf portal states, made the api compile now! 2015-11-28 20:54:09 -06:00
Vincent Lee e4b58e0c2d Remove InterpolatedIcon. Now present natively in 1.8 2015-11-28 19:57:33 -06:00
Vincent Lee a9baf71924 TESRs and fixed quite a few todos 2015-11-28 19:55:12 -06:00
Vincent Lee 4a4763b075 Light work on decor 2015-11-27 22:58:18 -06:00
Vincent Lee 1817e75b5d More decor states 2015-11-27 13:04:23 -06:00
Vincent Lee 6c637d27b2 Lots of rendering work. Multiblock structures migrated from to states 2015-11-26 22:14:46 -06:00
Vincent Lee e679a2062d Misc touchups everywhere. Move ModBanners in block pkg 2015-11-26 17:33:36 -06:00
Vincent Lee bf81e002e8 More blockstates 2015-11-26 12:03:33 -06:00
Vincent Lee a40a443607 Merge upstream 2015-11-26 02:27:25 -06:00
Vincent Lee ddf2a94aa1 Some states in the root package. here we go! 2015-11-26 02:18:20 -06:00
Vincent Lee 2dae52a9ff Full GLStatemanager substitution 2015-11-26 00:50:46 -06:00
Vincent Lee 9cd7a4a0d5 Tweak multiblocks a bit 2015-11-26 00:20:11 -06:00
Vincent Lee 0a7268fc98 Move botaniaStateProps and all state enums into the api so others can use them to set our blockstates 2015-11-26 00:09:29 -06:00
Vincent Lee 4426f8904f Some touchups on entities 2015-11-25 01:36:21 -06:00
Vincent Lee c0bcfb6448 Most functional flora 2015-11-24 17:31:19 -06:00
Vincent Lee b4d9c3ded8 Some of genereating flora 2015-11-24 01:10:03 -06:00
Vincent Lee 605e38337a Rest of root package TE 2015-11-24 00:49:57 -06:00
Vincent Lee b72be67dd7 Smaller TE's in the root package. several of the bigger ones left 2015-11-22 23:56:18 -06:00
Vincent Lee c2f1a9ab17 corporea, mana, and string tile entities 2015-11-22 16:19:02 -06:00
Vincent Lee 999705294d root package of block, first pass done 2015-11-22 15:28:50 -06:00
Vincent Lee 3fe15e6b7d Remove trivial IIcon refs in Item to get a better sense of my progress there 2015-11-21 23:12:46 -06:00
Vincent Lee 921370b546 block. corporea, dispenser, mana, string. some of the base pkg too 2015-11-21 22:53:58 -06:00
Vincent Lee 3f9d5c888f Finish rods (a bit of block leaked in, oops) 2015-11-20 18:36:01 -06:00
Vincent Lee 55bf02798d Most of rod package 2015-11-20 13:45:35 -06:00
Vincent Lee e3b22975cb Merge upstream 2015-11-20 01:00:31 -06:00
Vincent Lee 3ebcd10233 Finish ring of Loki 2015-11-20 00:53:35 -06:00
Vincent Lee 02ed9f1c84 Finish tools and relics except some of Loki 2015-11-18 19:07:37 -06:00
Vincent Lee 27126c074d Some of tool package 2015-11-18 18:39:52 -06:00
Vincent Lee 8cc23c7fb3 Update readme 2015-11-18 08:38:20 -06:00
Vincent Lee 9cbd2708db Base item package, tc interaction items 2015-11-18 08:33:32 -06:00
Vincent Lee 4c0922f0b4 Update Botania refs to TC api 2015-11-18 01:04:51 -06:00
Vincent Lee ed75f4a4b7 Delete parts of TC5 api that actually weren't needed. Oops. 2015-11-18 01:01:46 -06:00
Vincent Lee 5c98dc562c Update RF API to Progressive Automation / FluxDucts' variant 2015-11-18 00:54:48 -06:00
Vincent Lee da1dc51202 Update to TC5 API 2015-11-18 00:49:52 -06:00
Vincent Lee 2376287dd7 Some items 2015-11-17 13:09:45 -06:00
Vincent Lee 750276db9b Merge upstream 2015-11-17 01:07:15 -06:00
Vincent Lee 58dbb0f9cf Lenses, materials, records, relics, equipment 2015-11-17 01:03:09 -06:00
Vincent Lee 6fb9b0101e Some entities 2015-11-17 00:30:32 -06:00
Vincent Lee 3b8926c24b Easy stuff in common.core 2015-11-16 16:37:03 -06:00
Vincent Lee bbbe93a8de common.lexicon 2015-11-16 13:40:19 -06:00
Vincent Lee 9da9d61880 break from client for now 2015-11-16 13:35:58 -06:00
Vincent Lee 29e42d86ea Some of client.render.tile 2015-11-16 13:15:32 -06:00
Vincent Lee 88ca096ae0 client.gui.lexicon 2015-11-14 19:48:26 -06:00
Vincent Lee b07cac07a0 Fix the ctors oops 2015-11-14 15:50:23 -06:00
Vincent Lee afb9650b12 Update EntityThrowableCopy to 1.8 ver 2015-11-14 15:49:58 -06:00
Vincent Lee a1c3b00ae0 client.core.fx 2015-11-14 12:28:02 -06:00
Vincent Lee b22e485217 Some of client.core.handler. Most of this will need to be migrated to layerrenderers 2015-11-14 12:21:30 -06:00
Vincent Lee 7ad1820fcb Low hanging fruit: core.world, core.network, core.lib, core.crafting, some miscs 2015-11-14 00:59:47 -06:00
Vincent Lee 8591551a1b Lots of tessellator substitutions, full findreplace from CC to BlockPos. Some low hanging fruit in client 2015-11-14 00:39:42 -06:00
Vincent Lee 4d674da1b7 Most of what I can do with API done. 2015-11-14 00:28:00 -06:00
Vincent Lee d293a7dcc7 update readme 2015-11-13 20:22:39 -06:00
Vincent Lee 920324b135 Much of the API (blockpos and enumfacing, some low hanging fruit). Not done with it yet though. 2015-11-13 20:19:29 -06:00
Vincent Lee 67d5d65902 Shotgun tile.getWorldObj into tile.getWorld. May cause some individual errors but fix later 2015-11-13 19:53:37 -06:00
Vincent Lee f6cfeedd1d Vec3 and AABB factory to plain ctor 2015-11-13 19:51:23 -06:00
Vincent Lee 5a11a58346 cpw.mods.fml to net.minecraftforge.fml 2015-11-13 19:50:23 -06:00
Vincent Lee da2e5dfa51 Update build.gradle 2015-11-13 19:49:41 -06:00
1709 changed files with 31890 additions and 14469 deletions

No files matched your search

Binary file not shown.
BIN
View File
Binary file not shown.
+28
View File
@@ -0,0 +1,28 @@
-- API --
* Updated to BlockPos and EnumFacing everywhere where it made sense
* Registering repainting blocks will need to also receive a PropertyEnum with EnumDyeColor as the component type
so Botania knows what property to set the color on
* ICorporeaSpark.getInventory had to be changed to ICorporeaSpark.getSparkInventory because the signature clashed (IInventory vs ItemStack[], respectively)
This can be changed to match vanilla signature, but either would break backward compat.
* SubTileEntity.getComparatorInputOverride parameter removed (it was actually incorrect also. Not side, but the meta of the block).
Anyways, vanilla removed it from their method so we follow suit.
* SubTileEntity's methods that are copied from block (onBlockadded, etc.) updated to match vanilla counterparts
* Multiblock system reworked to use states and blockposes
* Magnet blacklist still uses metas instead of states because they need to support the short maxvalue wildcard.
* Now includes a way for addons to pass the Botania loader the models they want to use to render their subtile with
* Removed icon methods from SubTileSignature
-- Other --
* Most things left untouched to make patches from upstream easier
* Most uses of chunkcoordinates directly convert blockpos (THANK YOU VAZKII FOR USING THEM). Remove creation of extra instances
since BlockPos'es are immutable and thus can be reused everywhere.
* Some really needed fields in EntityItem are private now. Reflection time :(
* Alfglass now just uses the vanilla random model selection system to choose a pattern. Some of your builds may look different.
Unless someone figures out a way to use the old one
* The alt textures will probably be a resource pack now to decrease complexity...
sorry :/ The systems needed to dynamically switch out the textures like that is not worth just throwing them into a resource pack
* Slabs are kinda janky if you look at them - Mojang made some extremely silly assumptions and we're going to have to go with them
* Quartz stair textures may be assigned incorrectly - resource pack authors check me
* Glass pane inner faces are not getting culled (vanilla bug?)
* Some item forms of technical/non-user blocks are removed
* Full list: [all double slab items, all solid vine items]
+12
View File
@@ -1,3 +1,15 @@
1.8 PORT README:
This is williewillus' 1.8(.8) port of Botania!
All licensing and distribution rights are exactly as 1.7.10 Botania
Use at your own risk as bugs may pop up unexpectedly.
I will EXACTLY match Vazkii/upstream design wise so NEVER ask me for balance or design changes. No.
Please report all 1.8 bugs to MY REPOSITORY, NOT VAZKII'S.
![](https://github.com/Vazkii/Botania/blob/master/web/img/logo.png)
Welcome to the Botania repository.
+32 -15
View File
@@ -11,7 +11,8 @@ buildscript {
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT'
classpath 'com.matthewprenger:CurseGradle:1.0-SNAPSHOT'
}
}
@@ -20,10 +21,13 @@ repositories {
name = "chickenbones"
url = "http://chickenbones.net/maven/"
}
maven {
url "http://dvs1.progwml6.com/files/maven"
}
}
apply plugin: 'forge'
apply plugin: 'curseforge'
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'com.matthewprenger.cursegradle'
ext.configFile = file('build.properties')
@@ -36,14 +40,16 @@ archivesBaseName = config.mod_name
minecraft {
version = "${config.mc_version}-${config.forge_version}"
assetDir = "eclipse/assets"
runDir = "eclipse/assets"
mappings = "snapshot_20151229"
//This, does the token replacement.
//Though, I reccomend this to be replaced with a token such as @VERSION@
replace 'GRADLE:BUILD', config.build_number
replace 'GRADLE:VERSION', config.version
replaceIn 'LibMisc.java' //I may have missed another file, though I can only find it in here.
useDepAts = true
}
//This here is for SCP
@@ -60,15 +66,22 @@ dependencies {
compile files(
'Baubles-deobf.jar'
)
compile "codechicken:CodeChickenLib:1.7.10-1.1.1.109:dev"
compile "codechicken:CodeChickenCore:1.7.10-1.0.2.9:dev"
compile "codechicken:NotEnoughItems:1.7.10-1.0.2.15:dev"
compile "codechicken:ForgeMultipart:1.7.10-1.1.1.320:dev"
//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.8.9:2.13.7.64"
//and a bit more for SCP
sshAntTask "org.apache.ant:ant-jsch:1.7.1", "jsch:jsch:0.1.29"
}
compileJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
processResources {
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
@@ -207,14 +220,18 @@ jar {
archiveName = "${baseName} ${version}.${extension}"
}
curse {
curseforge {
apiKey = priv.cfkey
projectId = "225643"
changelog = """
See http://botaniamod.net/changelog.php#${version}
"""
releaseType = "release"
relatedProject 'baubles': 'requiredLibrary'
project {
id = "225643"
changelog = """
See http://botaniamod.net/changelog.php#${version}
"""
releaseType = "release"
relations {
requiredLibrary 'baubles'
}
}
}
defaultTasks 'clean', 'build', 'sort', 'forgecraft', 'incrementBuildNumber', 'curse', 'upload'
+2 -2
View File
@@ -2,8 +2,8 @@
#Fri Jan 08 18:17:27 GMT 2016
version=r1.8
dir_output=../Build Output/Botania/
mc_version=1.7.10
forge_version=10.13.2.1291
forge_version=11.15.0.1715
mc_version=1.8.9
dir_repo=./
build_number=249
mod_name=Botania
Binary file not shown.
+6 -6
View File
@@ -1,6 +1,6 @@
#Mon Oct 27 18:34:11 EDT 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.1-bin.zip
#Mon Sep 14 12:28:28 PDT 2015
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
Vendored Executable
+90
View File
@@ -0,0 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
+25 -43
View File
@@ -1,60 +1,42 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.core;
import java.lang.reflect.Method;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public final class BCLog {
public static final Logger logger = LogManager.getLogger("BuildCraft");
public static final Logger logger = LogManager.getLogger("BuildCraft");
/**
* Deactivate constructor
*/
private BCLog() {
}
public static void initLog() {
logger.info("Starting BuildCraft " + getVersion());
logger.info("Copyright (c) SpaceToad, 2011-2015");
logger.info("http://www.mod-buildcraft.com");
}
/** Deactivate constructor */
private BCLog() {}
@Deprecated
public static void logErrorAPI(String mod, Throwable error, Class<?> classFile) {
StringBuilder msg = new StringBuilder(mod);
msg.append(" API error, please update your mods. Error: ").append(error);
StackTraceElement[] stackTrace = error.getStackTrace();
if (stackTrace.length > 0) {
msg.append(", ").append(stackTrace[0]);
}
logErrorAPI(error, classFile);
}
logger.log(Level.ERROR, msg.toString());
public static void logErrorAPI(Throwable error, Class<?> classFile) {
StringBuilder msg = new StringBuilder("API error! Please update your mods. Error: ");
msg.append(error);
StackTraceElement[] stackTrace = error.getStackTrace();
if (stackTrace.length > 0) {
msg.append(", ").append(stackTrace[0]);
}
if (classFile != null) {
msg = new StringBuilder(mod);
msg.append(" API error: ").append(classFile.getSimpleName()).append(" is loaded from ").append(classFile.getProtectionDomain().getCodeSource().getLocation());
logger.log(Level.ERROR, msg.toString());
}
}
logger.log(Level.ERROR, msg.toString());
public static String getVersion() {
try {
Class<?> clazz = Class.forName("buildcraft.core.Version");
Method method = clazz.getDeclaredMethod("getVersion");
return String.valueOf(method.invoke(null));
} catch (Exception e) {
return "UNKNOWN VERSION";
if (classFile != null) {
msg.append("API error: ").append(classFile.getSimpleName()).append(" is loaded from ").append(classFile.getProtectionDomain().getCodeSource().getLocation());
logger.log(Level.ERROR, msg.toString());
}
}
@Deprecated
public static String getVersion() {
return BuildCraftAPI.getVersion();
}
}
@@ -1,115 +0,0 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
package buildcraft.api.core;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
/**
* This class is a comparable container for integer block positions.
*/
public class BlockIndex implements Comparable<BlockIndex> {
public int x;
public int y;
public int z;
public BlockIndex() {
}
/**
* Creates an index for a block located on x, y. z
*/
public BlockIndex(int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
}
public BlockIndex(NBTTagCompound c) {
this.x = c.getInteger("i");
this.y = c.getInteger("j");
this.z = c.getInteger("k");
}
public BlockIndex(Entity entity) {
x = (int) Math.floor(entity.posX);
y = (int) Math.floor(entity.posY);
z = (int) Math.floor(entity.posZ);
}
public BlockIndex(TileEntity entity) {
this(entity.xCoord, entity.yCoord, entity.zCoord);
}
/**
* Provides a deterministic and complete ordering of block positions.
*/
@Override
public int compareTo(BlockIndex o) {
if (o.x < x) {
return 1;
} else if (o.x > x) {
return -1;
} else if (o.z < z) {
return 1;
} else if (o.z > z) {
return -1;
} else if (o.y < y) {
return 1;
} else if (o.y > y) {
return -1;
} else {
return 0;
}
}
public void writeTo(NBTTagCompound c) {
c.setInteger("i", x);
c.setInteger("j", y);
c.setInteger("k", z);
}
public Block getBlock(World world) {
return world.getBlock(x, y, z);
}
@Override
public String toString() {
return "{" + x + ", " + y + ", " + z + "}";
}
@Override
public boolean equals(Object obj) {
if (obj instanceof BlockIndex) {
BlockIndex b = (BlockIndex) obj;
return b.x == x && b.y == y && b.z == z;
}
return false;
}
@Override
public int hashCode() {
return (x * 37 + y) * 37 + z;
}
public boolean nextTo(BlockIndex blockIndex) {
return (Math.abs(blockIndex.x - x) <= 1 && blockIndex.y == y && blockIndex.z == z)
|| (blockIndex.x == x && Math.abs(blockIndex.y - y) <= 1 && blockIndex.z == z)
|| (blockIndex.x == x && blockIndex.y == y && Math.abs(blockIndex.z - z) <= 1);
}
}
@@ -1,45 +1,52 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.core;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import net.minecraft.block.Block;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
public final class BuildCraftAPI {
public static ICoreProxy proxy;
public static ICoreProxy proxy;
public static final Set<Block> softBlocks = new HashSet<Block>();
public static final HashMap<String, IWorldProperty> worldProperties = new HashMap<String, IWorldProperty>();
public static final Set<Block> softBlocks = Sets.newHashSet();
public static final HashMap<String, IWorldProperty> worldProperties = Maps.newHashMap();
/**
* Deactivate constructor
*/
private BuildCraftAPI() {
}
/** Deactivate constructor */
private BuildCraftAPI() {}
public static IWorldProperty getWorldProperty(String name) {
return worldProperties.get(name);
}
public static void registerWorldProperty(String name, IWorldProperty property) {
if (worldProperties.containsKey(name)) {
BCLog.logger.warn("The WorldProperty key '" + name + "' is being overidden with " + property.getClass().getSimpleName() + "!");
public static String getVersion() {
try {
Class<?> clazz = Class.forName("buildcraft.core.Version");
Method method = clazz.getDeclaredMethod("getVersion");
return String.valueOf(method.invoke(null));
} catch (Exception e) {
return "UNKNOWN VERSION";
}
worldProperties.put(name, property);
}
public static boolean isSoftBlock(World world, int x, int y, int z) {
return worldProperties.get("soft").get(world, x, y, z);
}
public static IWorldProperty getWorldProperty(String name) {
return worldProperties.get(name);
}
public static void registerWorldProperty(String name, IWorldProperty property) {
if (worldProperties.containsKey(name)) {
BCLog.logger.warn("The WorldProperty key '" + name + "' is being overidden with " + property.getClass().getSimpleName() + "!");
}
worldProperties.put(name, property);
}
public static boolean isSoftBlock(World world, BlockPos pos) {
return worldProperties.get("soft").get(world, pos);
}
}
@@ -0,0 +1,48 @@
package buildcraft.api.core;
import java.util.Map;
import com.google.common.collect.Maps;
import net.minecraftforge.common.config.Property;
/** Use this to access the various config options. It is recommended that you use this as opposed to the variables in
* the mod, as users may only install the modules that they want, and not the one you may have refereed to. */
@Deprecated
public final class ConfigAccessor {
public enum EMod {
CORE,
BUILDERS,
ENERGY,
FACTORY,
ROBITICS,
SILICON,
TRANSPORT
}
private static Map<EMod, IBuildCraftMod> mods = Maps.newHashMap();
private ConfigAccessor() {}
public static Property getOption(EMod mod, String name) {
if (mods.containsKey(mod)) {
return mods.get(mod).getOption(name);
} else {
return null;
}
}
public static boolean getBoolean(EMod mod, String name, boolean defaultBoolean) {
Property prop = getOption(mod, name);
if (prop == null) {
return defaultBoolean;
} else {
return prop.getBoolean(defaultBoolean);
}
}
/** WARNING: INTERNAL USE ONLY! */
public static void addMod(EMod mod, IBuildCraftMod actual) {
mods.put(mod, actual);
}
}
+118 -172
View File
@@ -1,201 +1,147 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.core;
import java.util.Locale;
import java.util.Random;
import net.minecraft.util.IIcon;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public enum EnumColor {
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
BLACK,
RED,
GREEN,
BROWN,
BLUE,
PURPLE,
CYAN,
LIGHT_GRAY,
GRAY,
PINK,
LIME,
YELLOW,
LIGHT_BLUE,
MAGENTA,
ORANGE,
WHITE;
/** Use minecraft's EnumDyeColor in as many places as possible. */
@Deprecated
public enum EnumColor implements IStringSerializable {
public static final EnumColor[] VALUES = values();
public static final String[] DYES = {
"dyeBlack",
"dyeRed",
"dyeGreen",
"dyeBrown",
"dyeBlue",
"dyePurple",
"dyeCyan",
"dyeLightGray",
"dyeGray",
"dyePink",
"dyeLime",
"dyeYellow",
"dyeLightBlue",
"dyeMagenta",
"dyeOrange",
"dyeWhite"};
public static final String[] NAMES = {
"Black",
"Red",
"Green",
"Brown",
"Blue",
"Purple",
"Cyan",
"LightGray",
"Gray",
"Pink",
"Lime",
"Yellow",
"LightBlue",
"Magenta",
"Orange",
"White"};
public static final int[] DARK_HEX = {
0x2D2D2D,
0xA33835,
0x394C1E,
0x5C3A24,
0x3441A2,
0x843FBF,
0x36809E,
0x888888,
0x444444,
0xE585A0,
0x3FAA36,
0xCFC231,
0x7F9AD1,
0xFF64FF,
0xFF6A00,
0xFFFFFF};
public static final int[] LIGHT_HEX = {
0x181414,
0xBE2B27,
0x007F0E,
0x89502D,
0x253193,
0x7e34bf,
0x299799,
0xa0a7a7,
0x7A7A7A,
0xD97199,
0x39D52E,
0xFFD91C,
0x66AAFF,
0xD943C6,
0xEA7835,
0xe4e4e4};
BLACK,
RED,
GREEN,
BROWN,
BLUE,
PURPLE,
CYAN,
LIGHT_GRAY,
GRAY,
PINK,
LIME,
YELLOW,
LIGHT_BLUE,
MAGENTA,
ORANGE,
WHITE;
@SideOnly(Side.CLIENT)
private static IIcon[] brushIcons;
public static final EnumColor[] VALUES = values();
public static final String[] DYES = { "dyeBlack", "dyeRed", "dyeGreen", "dyeBrown", "dyeBlue", "dyePurple", "dyeCyan", "dyeLightGray", "dyeGray",
"dyePink", "dyeLime", "dyeYellow", "dyeLightBlue", "dyeMagenta", "dyeOrange", "dyeWhite" };
public static final String[] NAMES = { "Black", "Red", "Green", "Brown", "Blue", "Purple", "Cyan", "LightGray", "Gray", "Pink", "Lime", "Yellow",
"LightBlue", "Magenta", "Orange", "White" };
public static final int[] DARK_HEX = { 0x2D2D2D, 0xA33835, 0x394C1E, 0x5C3A24, 0x3441A2, 0x843FBF, 0x36809E, 0x888888, 0x444444, 0xE585A0,
0x3FAA36, 0xCFC231, 0x7F9AD1, 0xFF64FF, 0xFF6A00, 0xFFFFFF };
public static final int[] LIGHT_HEX = { 0x181414, 0xBE2B27, 0x007F0E, 0x89502D, 0x253193, 0x7e34bf, 0x299799, 0xa0a7a7, 0x7A7A7A, 0xD97199,
0x39D52E, 0xFFD91C, 0x66AAFF, 0xD943C6, 0xEA7835, 0xe4e4e4 };
public int getDarkHex() {
return DARK_HEX[ordinal()];
}
@SideOnly(Side.CLIENT)
private static ResourceLocation iconSheet;
public int getLightHex() {
return LIGHT_HEX[ordinal()];
}
@SideOnly(Side.CLIENT)
private static TextureAtlasSprite[] brushSprites;
public static EnumColor fromId(int id) {
if (id < 0 || id >= VALUES.length) {
return WHITE;
}
return VALUES[id];
}
public int getDarkHex() {
return DARK_HEX[ordinal()];
}
public static EnumColor fromDye(String dyeTag) {
for (int id = 0; id < DYES.length; id++) {
if (DYES[id].equals(dyeTag)) {
return VALUES[id];
}
}
return null;
}
public int getLightHex() {
return LIGHT_HEX[ordinal()];
}
public static EnumColor fromName(String name) {
for (int id = 0; id < NAMES.length; id++) {
if (NAMES[id].equals(name)) {
return VALUES[id];
}
}
return null;
}
public static EnumColor fromId(int id) {
if (id < 0 || id >= VALUES.length) {
return WHITE;
}
return VALUES[id];
}
public static EnumColor getRand() {
return VALUES[new Random().nextInt(VALUES.length)];
}
public static EnumColor fromDye(String dyeTag) {
for (int id = 0; id < DYES.length; id++) {
if (DYES[id].equals(dyeTag)) {
return VALUES[id];
}
}
return null;
}
public EnumColor getNext() {
EnumColor next = VALUES[(ordinal() + 1) % VALUES.length];
return next;
}
public static EnumColor fromName(String name) {
for (int id = 0; id < NAMES.length; id++) {
if (NAMES[id].equals(name)) {
return VALUES[id];
}
}
return null;
}
public EnumColor getPrevious() {
EnumColor previous = VALUES[(ordinal() + VALUES.length - 1) % VALUES.length];
return previous;
}
public static EnumColor getRand() {
return VALUES[new Random().nextInt(VALUES.length)];
}
public EnumColor inverse() {
return EnumColor.VALUES[15 - ordinal()];
}
public EnumColor getNext() {
EnumColor next = VALUES[(ordinal() + 1) % VALUES.length];
return next;
}
public String getTag() {
return "color." + name().replace("_", ".").toLowerCase(Locale.ENGLISH);
}
public EnumColor getPrevious() {
EnumColor previous = VALUES[(ordinal() + VALUES.length - 1) % VALUES.length];
return previous;
}
public String getBasicTag() {
return name().replace("_", ".").toLowerCase(Locale.ENGLISH);
}
public EnumColor inverse() {
return EnumColor.VALUES[15 - ordinal()];
}
public String getName() {
return NAMES[ordinal()];
}
public String getTag() {
return "color." + name().replace("_", ".").toLowerCase(Locale.ENGLISH);
}
public String getLocalizedName() {
return StatCollector.translateToLocal(getTag());
}
public String getBasicTag() {
return name().replace("_", ".").toLowerCase(Locale.ENGLISH);
}
public String getDye() {
return DYES[ordinal()];
}
@Override
public String getName() {
return NAMES[ordinal()];
}
@Override
public String toString() {
String s = name().replace("_", " ");
String[] words = s.split(" ");
StringBuilder b = new StringBuilder();
for (String word : words) {
b.append(word.charAt(0)).append(word.substring(1).toLowerCase(Locale.ENGLISH)).append(" ");
}
return b.toString().trim();
}
public String getLocalizedName() {
return StatCollector.translateToLocal(getTag());
}
public static void setIconArray(IIcon[] icons) {
brushIcons = icons;
}
public String getDye() {
return DYES[ordinal()];
}
@SideOnly(Side.CLIENT)
public IIcon getIcon() {
return brushIcons [ordinal()];
}
@Override
public String toString() {
String s = name().replace("_", " ");
String[] words = s.split(" ");
StringBuilder b = new StringBuilder();
for (String word : words) {
b.append(word.charAt(0)).append(word.substring(1).toLowerCase(Locale.ENGLISH)).append(" ");
}
return b.toString().trim();
}
@SideOnly(Side.CLIENT)
public static void registerSprites(TextureAtlasSprite[] sprites) {
brushSprites = sprites;
}
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getSprite() {
return brushSprites[ordinal()];
}
}
@@ -0,0 +1,118 @@
package buildcraft.api.core;
import java.util.Locale;
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.NBTTagString;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IStringSerializable;
import io.netty.buffer.ByteBuf;
public enum EnumPipePart implements IStringSerializable,INetworkLoadable_BC8<EnumPipePart> {
DOWN(EnumFacing.DOWN),
UP(EnumFacing.UP),
NORTH(EnumFacing.NORTH),
SOUTH(EnumFacing.SOUTH),
WEST(EnumFacing.WEST),
EAST(EnumFacing.EAST),
/** CENTER, UNKNOWN and ALL are all valid uses of this constant. */
CENTER(null);
private static final Map<EnumFacing, EnumPipePart> facingMap = Maps.newEnumMap(EnumFacing.class);
private static final Map<String, EnumPipePart> nameMap = Maps.newHashMap();
private static final int MAX_VALUES = values().length;
public final EnumFacing face;
static {
for (EnumPipePart part : values()) {
nameMap.put(part.name(), part);
if (part.face != null) facingMap.put(part.face, part);
}
}
public static EnumPipePart fromFacing(EnumFacing face) {
if (face == null) return EnumPipePart.CENTER;
return facingMap.get(face);
}
public static EnumPipePart[] validFaces() {
return new EnumPipePart[] { DOWN, UP, NORTH, SOUTH, WEST, EAST };
}
public static EnumPipePart fromMeta(int meta) {
if (meta < 0 || meta >= MAX_VALUES) return EnumPipePart.CENTER;
return values()[meta];
}
private EnumPipePart(EnumFacing face) {
this.face = face;
}
public int getIndex() {
if (face == null) return 6;
return face.getIndex();
}
@Override
public String getName() {
return name().toLowerCase(Locale.ROOT);
}
public EnumPipePart next() {
switch (this) {
case DOWN:
return EAST;
case EAST:
return NORTH;
case NORTH:
return SOUTH;
case SOUTH:
return UP;
case UP:
return WEST;
case WEST:
return DOWN;
default:
return DOWN;
}
}
public EnumPipePart opposite() {
if (this == CENTER) return CENTER;
return fromFacing(face.getOpposite());
}
public static EnumPipePart readFromNBT(NBTBase base) {
if (base == null) return CENTER;
if (base instanceof NBTTagString) {
NBTTagString nbtString = (NBTTagString) base;
String string = nbtString.getString();
return nameMap.containsKey(string) ? nameMap.get(string) : CENTER;
} else {
byte ord = ((NBTPrimitive) base).getByte();
if (ord < 0 || ord > 6) return CENTER;
return values()[ord];
}
}
public NBTBase writeToNBT() {
return new NBTTagString(name());
}
@Override
public EnumPipePart readFromByteBuf(ByteBuf buf) {
byte ord = buf.readByte();
return fromMeta(ord);
}
@Override
public void writeToByteBuf(ByteBuf buf) {
buf.writeByte(ordinal());
}
}
@@ -1,31 +1,17 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.core;
/**
* To be implemented by TileEntities able to provide a square area on the world, typically BuildCraft markers.
*/
import net.minecraft.util.BlockPos;
/** To be implemented by TileEntities able to provide a square area on the world, typically BuildCraft markers. */
public interface IAreaProvider {
int xMin();
BlockPos min();
int yMin();
BlockPos max();
int zMin();
int xMax();
int yMax();
int zMax();
/**
* Remove from the world all objects used to define the area.
*/
void removeFromWorld();
/** Remove from the world all objects used to define the area. */
void removeFromWorld();
}
+10 -14
View File
@@ -1,23 +1,19 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.core;
import net.minecraft.util.BlockPos;
public interface IBox extends IZone {
IBox expand(int amount);
IBox expand(int amount);
IBox contract(int amount);
IBox contract(int amount);
BlockPos min();
Position pMin();
Position pMax();
void createLaserData();
BlockPos max();
void createLaserData();
}
@@ -0,0 +1,7 @@
package buildcraft.api.core;
import net.minecraftforge.common.config.Property;
public interface IBuildCraftMod {
Property getOption(String name);
}
@@ -1,11 +1,7 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.core;
import java.lang.ref.WeakReference;
@@ -14,5 +10,5 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.WorldServer;
public interface ICoreProxy {
WeakReference<EntityPlayer> getBuildCraftPlayer(WorldServer world);
WeakReference<EntityPlayer> getBuildCraftPlayer(WorldServer world);
}
@@ -1,31 +1,13 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
package buildcraft.api.core;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public interface IIconProvider {
public TextureAtlasSprite getIcon(int iconIndex);
/**
* @param iconIndex
*/
@SideOnly(Side.CLIENT)
IIcon getIcon(int iconIndex);
/**
* A call for the provider to register its Icons. This may be called multiple times but should only be executed once per provider
* @param iconRegister
*/
@SideOnly(Side.CLIENT)
void registerIcons(IIconRegister iconRegister);
@SideOnly(Side.CLIENT)
public void registerIcons(TextureMap iconRegister);
}
+6 -12
View File
@@ -1,21 +1,15 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.core;
import net.minecraft.item.ItemStack;
public interface IInvSlot {
/**
* Returns the slot number of the underlying Inventory.
/** Returns the slot number of the underlying Inventory.
*
* @return the slot number
*/
* @return the slot number */
int getIndex();
boolean canPutStackInSlot(ItemStack stack);
@@ -24,7 +18,7 @@ public interface IInvSlot {
boolean isItemValidForSlot(ItemStack stack);
ItemStack decreaseStackInSlot(int amount);
ItemStack decreaseStackInSlot(int amount);
ItemStack getStackInSlot();
@@ -0,0 +1,14 @@
package buildcraft.api.core;
import net.minecraft.nbt.NBTBase;
/** @param <T> The type that will be loaded from and saved too. This essentially allows Immutable objects to be safely
* loaded without helper methods everywhere. However you are allowed to return this if you are a mutable
* object */
public interface INBTLoadable_BC8<T> {
/** @return An object that has the properties loaded. WARNIG! This might be the same object as the one this method
* was called on! (You should always replace the object you have stored with whatever this returns) */
T readFromNBT(NBTBase nbt);
NBTBase writeToNBT();
}
@@ -2,7 +2,11 @@ package buildcraft.api.core;
import net.minecraft.nbt.NBTTagCompound;
/** Use {@link INBTLoadable_BC8} instead of this, as this gives you more control over what NBT goes where, and what
* objects are allowed to do. */
@Deprecated
public interface INBTStoreable {
void readFromNBT(NBTTagCompound tag);
void writeToNBT(NBTTagCompound tag);
void readFromNBT(NBTTagCompound tag);
void writeToNBT(NBTTagCompound tag);
}
@@ -0,0 +1,9 @@
package buildcraft.api.core;
import io.netty.buffer.ByteBuf;
public interface INetworkLoadable_BC8<T> {
T readFromByteBuf(ByteBuf buf);
void writeToByteBuf(ByteBuf buf);
}
@@ -2,9 +2,14 @@ package buildcraft.api.core;
import java.util.List;
/**
* To be implemented by TileEntities able to provide a path on the world, typically BuildCraft path markers.
*/
import net.minecraft.util.BlockPos;
/** To be implemented by TileEntities able to provide a path on the world, typically BuildCraft path markers. */
public interface IPathProvider {
List<BlockIndex> getPath();
List<BlockPos> getPath();
/**
* Remove from the world all objects used to define the path.
*/
void removeFromWorld();
}
@@ -1,30 +1,21 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
package buildcraft.api.core;
import io.netty.buffer.ByteBuf;
/**
* Implemented by classes representing serializable packet state
*/
/** Use {@link INetworkLoadable_BC8} instead, as that gives you more control over how you use objects */
@Deprecated
public interface ISerializable {
/**
* Serializes the state to the stream
*
* @param data
*/
void writeData(ByteBuf data);
/** Serializes the state to the stream
*
* @param data */
void writeData(ByteBuf data);
/**
* Deserializes the state from the stream
*
* @param data
*/
void readData(ByteBuf data);
/** Deserializes the state from the stream
*
* @param data */
void readData(ByteBuf data);
}
@@ -1,17 +1,14 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.core;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
public interface IWorldProperty {
boolean get(World world, int x, int y, int z);
boolean get(World world, BlockPos pos);
void clear();
void clear();
}
+16 -13
View File
@@ -1,23 +1,26 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.core;
import java.util.Random;
import net.minecraft.util.BlockPos;
import net.minecraft.util.Vec3;
public interface IZone {
/** Returns the smallest possible distance that the index would have to be changed by in order for
* {@link #contains(Vec3)} to return true. If the position is already inside then this will return 0 */
double distanceTo(BlockPos index);
double distanceTo(BlockIndex index);
/** Returns {@link #distanceTo(BlockPos)} but squared. Usually this will be quicker to calculate. */
double distanceToSquared(BlockPos index);
double distanceToSquared(BlockIndex index);
boolean contains(double x, double y, double z);
BlockIndex getRandomBlockIndex(Random rand);
/** Returns true if the point is enclosed by this zone, such that none of the coordinates lie outside the range
* specified by this zone. */
boolean contains(Vec3 point);
/** Gets a random position that {@link #contains(Vec3)} will return true. */
BlockPos getRandomBlockPos(Random rand);
}
+28 -32
View File
@@ -1,43 +1,39 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.core;
import java.util.Arrays;
public final class JavaTools {
private JavaTools(){
}
public static <T> T[] concat(T[] first, T[] second) {
T[] result = Arrays.copyOf(first, first.length + second.length);
System.arraycopy(second, 0, result, first.length, second.length);
return result;
}
private JavaTools() {
public static int[] concat(int[] first, int[] second) {
int[] result = Arrays.copyOf(first, first.length + second.length);
System.arraycopy(second, 0, result, first.length, second.length);
return result;
}
}
public static float[] concat(float[] first, float[] second) {
float[] result = Arrays.copyOf(first, first.length + second.length);
System.arraycopy(second, 0, result, first.length, second.length);
return result;
}
public static <T> T[] concat(T[] first, T[] second) {
T[] result = Arrays.copyOf(first, first.length + second.length);
System.arraycopy(second, 0, result, first.length, second.length);
return result;
}
public static String surroundWithQuotes(String stringToSurroundWithQuotes) {
return String.format("\"%s\"", stringToSurroundWithQuotes);
}
public static int[] concat(int[] first, int[] second) {
int[] result = Arrays.copyOf(first, first.length + second.length);
System.arraycopy(second, 0, result, first.length, second.length);
return result;
}
public static String stripSurroundingQuotes(String stringToStripQuotes) {
return stringToStripQuotes.replaceAll("^\"|\"$", "");
}
public static float[] concat(float[] first, float[] second) {
float[] result = Arrays.copyOf(first, first.length + second.length);
System.arraycopy(second, 0, result, first.length, second.length);
return result;
}
public static String surroundWithQuotes(String stringToSurroundWithQuotes) {
return String.format("\"%s\"", stringToSurroundWithQuotes);
}
public static String stripSurroundingQuotes(String stringToStripQuotes) {
return stringToStripQuotes.replaceAll("^\"|\"$", "");
}
}
@@ -1,200 +0,0 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
package buildcraft.api.core;
import io.netty.buffer.ByteBuf;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
public class Position implements ISerializable {
public double x, y, z;
public ForgeDirection orientation;
public Position() {
x = 0;
y = 0;
z = 0;
orientation = ForgeDirection.UNKNOWN;
}
public Position(double ci, double cj, double ck) {
x = ci;
y = cj;
z = ck;
orientation = ForgeDirection.UNKNOWN;
}
public Position(double ci, double cj, double ck, ForgeDirection corientation) {
x = ci;
y = cj;
z = ck;
orientation = corientation;
if (orientation == null) {
orientation = ForgeDirection.UNKNOWN;
}
}
public Position(Position p) {
x = p.x;
y = p.y;
z = p.z;
orientation = p.orientation;
}
public Position(NBTTagCompound nbttagcompound) {
readFromNBT(nbttagcompound);
}
public Position(TileEntity tile) {
x = tile.xCoord;
y = tile.yCoord;
z = tile.zCoord;
orientation = ForgeDirection.UNKNOWN;
}
public Position(BlockIndex index) {
x = index.x;
y = index.y;
z = index.z;
orientation = ForgeDirection.UNKNOWN;
}
public void moveRight(double step) {
switch (orientation) {
case SOUTH:
x = x - step;
break;
case NORTH:
x = x + step;
break;
case EAST:
z = z + step;
break;
case WEST:
z = z - step;
break;
default:
}
}
public void moveLeft(double step) {
moveRight(-step);
}
public void moveForwards(double step) {
switch (orientation) {
case UP:
y = y + step;
break;
case DOWN:
y = y - step;
break;
case SOUTH:
z = z + step;
break;
case NORTH:
z = z - step;
break;
case EAST:
x = x + step;
break;
case WEST:
x = x - step;
break;
default:
}
}
public void moveBackwards(double step) {
moveForwards(-step);
}
public void moveUp(double step) {
switch (orientation) {
case SOUTH:
case NORTH:
case EAST:
case WEST:
y = y + step;
break;
default:
}
}
public void moveDown(double step) {
moveUp(-step);
}
public void writeToNBT(NBTTagCompound nbttagcompound) {
if (orientation == null) {
orientation = ForgeDirection.UNKNOWN;
}
nbttagcompound.setDouble("i", x);
nbttagcompound.setDouble("j", y);
nbttagcompound.setDouble("k", z);
nbttagcompound.setByte("orientation", (byte) orientation.ordinal());
}
public void readFromNBT(NBTTagCompound nbttagcompound) {
x = nbttagcompound.getDouble("i");
y = nbttagcompound.getDouble("j");
z = nbttagcompound.getDouble("k");
orientation = ForgeDirection.values() [nbttagcompound.getByte("orientation")];
}
@Override
public String toString() {
return "{" + x + ", " + y + ", " + z + "}";
}
public Position min(Position p) {
return new Position(p.x > x ? x : p.x, p.y > y ? y : p.y, p.z > z ? z : p.z);
}
public Position max(Position p) {
return new Position(p.x < x ? x : p.x, p.y < y ? y : p.y, p.z < z ? z : p.z);
}
public boolean isClose(Position newPosition, float f) {
double dx = x - newPosition.x;
double dy = y - newPosition.y;
double dz = z - newPosition.z;
double sqrDis = dx * dx + dy * dy + dz * dz;
return !(sqrDis > f * f);
}
@Override
public void readData(ByteBuf stream) {
x = stream.readDouble();
y = stream.readDouble();
z = stream.readDouble();
orientation = ForgeDirection.getOrientation(stream.readByte());
}
@Override
public void writeData(ByteBuf stream) {
stream.writeDouble(x);
stream.writeDouble(y);
stream.writeDouble(z);
stream.writeByte(orientation.ordinal());
}
@Override
public int hashCode() {
return (51 * (int) x) + (13 * (int) y) + (int) z;
}
}
@@ -1,85 +1,68 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.core;
import net.minecraft.world.World;
public class SafeTimeTracker {
private long lastMark = Long.MIN_VALUE;
private long duration = -1;
private long randomRange = 0;
private long lastRandomDelay = 0;
private long internalDelay = 1;
private long lastMark = Long.MIN_VALUE;
private long duration = -1;
private long randomRange = 0;
private long lastRandomDelay = 0;
private long internalDelay = 1;
/**
* @deprecated should use constructors with parameters instead
*/
public SafeTimeTracker () {
/** Only use this if the delay time changes (say, if you use this to determine when a refining should be complete */
public SafeTimeTracker() {
}
}
public SafeTimeTracker (long delay) {
internalDelay = delay;
}
public SafeTimeTracker(long delay) {
internalDelay = delay;
}
/**
* In many situations, it is a bad idea to have all objects of the same
* kind to be waiting for the exact same amount of time, as that can lead
* to some situation where they're all synchronized and got to work all
* at the same time. When created with a random range, the mark that is set
* when reaching the expect delay will be added with a random number
* between [0, range[, meaning that the event will take between 0 and range
* more tick to run.
*/
public SafeTimeTracker (long delay, long random) {
internalDelay = delay;
randomRange = random;
}
/** In many situations, it is a bad idea to have all objects of the same kind to be waiting for the exact same
* amount of time, as that can lead to some situation where they're all synchronized and got to work all at the same
* time. When created with a random range, the mark that is set when reaching the expect delay will be added with a
* random number between [0, range[, meaning that the event will take between 0 and range more tick to run. */
public SafeTimeTracker(long delay, long random) {
internalDelay = delay;
randomRange = random;
}
public boolean markTimeIfDelay(World world) {
return markTimeIfDelay(world, internalDelay);
}
public boolean markTimeIfDelay(World world) {
return markTimeIfDelay(world, internalDelay);
}
/**
* Return true if a given delay has passed since last time marked was called
* successfully.
*
* @deprecated should use the constructor with a delay instead, and call
* this function without a parameter
*/
public boolean markTimeIfDelay(World world, long delay) {
if (world == null) {
return false;
}
/** Return true if a given delay has passed since last time marked was called successfully. */
public boolean markTimeIfDelay(World world, long delay) {
if (world == null) {
return false;
}
long currentTime = world.getTotalWorldTime();
long currentTime = world.getTotalWorldTime();
if (currentTime < lastMark) {
lastMark = currentTime;
return false;
} else if (lastMark + delay + lastRandomDelay <= currentTime) {
duration = currentTime - lastMark;
lastMark = currentTime;
lastRandomDelay = (int) (Math.random() * randomRange);
if (currentTime < lastMark) {
lastMark = currentTime;
return false;
} else if (lastMark + delay + lastRandomDelay <= currentTime) {
duration = currentTime - lastMark;
lastMark = currentTime;
lastRandomDelay = (int) (Math.random() * randomRange);
return true;
} else {
return false;
}
}
return true;
} else {
return false;
}
}
public long durationOfLastDelay() {
return duration > 0 ? duration : 0;
}
public long durationOfLastDelay() {
return duration > 0 ? duration : 0;
}
public void markTime(World world) {
lastMark = world.getTotalWorldTime();
}
}
public void markTime(World world) {
lastMark = world.getTotalWorldTime();
}
}
+98 -107
View File
@@ -1,11 +1,7 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.core;
import net.minecraft.block.Block;
@@ -15,120 +11,115 @@ import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
/**
* This class is used whenever stacks needs to be stored as keys.
*/
/** This class is used whenever stacks needs to be stored as keys. */
public final class StackKey {
public final ItemStack stack;
public final FluidStack fluidStack;
public final ItemStack stack;
public final FluidStack fluidStack;
public StackKey(FluidStack fluidStack) {
this(null, fluidStack);
}
public StackKey(FluidStack fluidStack) {
this(null, fluidStack);
}
public StackKey(ItemStack stack) {
this(stack, null);
}
public StackKey(ItemStack stack) {
this(stack, null);
}
public StackKey(ItemStack stack, FluidStack fluidStack) {
this.stack = stack;
this.fluidStack = fluidStack;
}
public StackKey(ItemStack stack, FluidStack fluidStack) {
this.stack = stack;
this.fluidStack = fluidStack;
}
public static StackKey stack(Item item, int amount, int damage) {
return new StackKey(new ItemStack(item, amount, damage));
}
public static StackKey stack(Item item, int amount, int damage) {
return new StackKey(new ItemStack(item, amount, damage));
}
public static StackKey stack(Block block, int amount, int damage) {
return new StackKey(new ItemStack(block, amount, damage));
}
public static StackKey stack(Block block, int amount, int damage) {
return new StackKey(new ItemStack(block, amount, damage));
}
public static StackKey stack(Item item) {
return new StackKey(new ItemStack(item, 1, 0));
}
public static StackKey stack(Item item) {
return new StackKey(new ItemStack(item, 1, 0));
}
public static StackKey stack(Block block) {
return new StackKey(new ItemStack(block, 1, 0));
}
public static StackKey stack(Block block) {
return new StackKey(new ItemStack(block, 1, 0));
}
public static StackKey stack(ItemStack itemStack) {
return new StackKey(itemStack);
}
public static StackKey stack(ItemStack itemStack) {
return new StackKey(itemStack);
}
public static StackKey fluid(Fluid fluid, int amount) {
return new StackKey(new FluidStack(fluid, amount));
}
public static StackKey fluid(Fluid fluid, int amount) {
return new StackKey(new FluidStack(fluid, amount));
}
public static StackKey fluid(Fluid fluid) {
return new StackKey(new FluidStack(fluid, FluidContainerRegistry.BUCKET_VOLUME));
}
public static StackKey fluid(Fluid fluid) {
return new StackKey(new FluidStack(fluid, FluidContainerRegistry.BUCKET_VOLUME));
}
public static StackKey fluid(FluidStack fluidStack) {
return new StackKey(fluidStack);
}
public static StackKey fluid(FluidStack fluidStack) {
return new StackKey(fluidStack);
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || o.getClass() != StackKey.class) {
return false;
}
StackKey k = (StackKey) o;
if ((stack == null ^ k.stack == null) || (fluidStack == null ^ k.fluidStack == null)) {
return false;
}
if (stack != null) {
if (stack.getItem() != k.stack.getItem() ||
stack.getHasSubtypes() && stack.getItemDamage() != k.stack.getItemDamage() ||
!objectsEqual(stack.getTagCompound(), k.stack.getTagCompound())) {
return false;
}
}
if (fluidStack != null) {
if (fluidStack.getFluid().getID() != k.fluidStack.getFluid().getID() ||
fluidStack.amount != k.fluidStack.amount ||
!objectsEqual(fluidStack.tag, k.fluidStack.tag)) {
return false;
}
}
return true;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || o.getClass() != StackKey.class) {
return false;
}
StackKey k = (StackKey) o;
if ((stack == null ^ k.stack == null) || (fluidStack == null ^ k.fluidStack == null)) {
return false;
}
if (stack != null) {
if (stack.getItem() != k.stack.getItem() || stack.getHasSubtypes() && stack.getItemDamage() != k.stack.getItemDamage() || !objectsEqual(
stack.getTagCompound(), k.stack.getTagCompound())) {
return false;
}
}
if (fluidStack != null) {
if (fluidStack.getFluid().getID() != k.fluidStack.getFluid().getID() || fluidStack.amount != k.fluidStack.amount || !objectsEqual(
fluidStack.tag, k.fluidStack.tag)) {
return false;
}
}
return true;
}
@Override
public int hashCode() {
int result = 7;
if (stack != null) {
result = 31 * result + stack.getItem().hashCode();
result = 31 * result + stack.getItemDamage();
result = 31 * result + objectHashCode(stack.getTagCompound());
}
result = 31 * result + 7;
if (fluidStack != null) {
result = 31 * result + fluidStack.getFluid().getID();
result = 31 * result + fluidStack.amount;
result = 31 * result + objectHashCode(fluidStack.tag);
}
return result;
}
@Override
public int hashCode() {
int result = 7;
if (stack != null) {
result = 31 * result + stack.getItem().hashCode();
result = 31 * result + stack.getItemDamage();
result = 31 * result + objectHashCode(stack.getTagCompound());
}
result = 31 * result + 7;
if (fluidStack != null) {
result = 31 * result + fluidStack.getFluid().getID();
result = 31 * result + fluidStack.amount;
result = 31 * result + objectHashCode(fluidStack.tag);
}
return result;
}
private boolean objectsEqual(Object o1, Object o2) {
if (o1 == null && o2 == null) {
return true;
} else if (o1 == null || o2 == null) {
return false;
} else {
return o1.equals(o2);
}
}
private int objectHashCode(Object o) {
return o != null ? o.hashCode() : 0;
}
private boolean objectsEqual(Object o1, Object o2) {
if (o1 == null && o2 == null) {
return true;
} else if (o1 == null || o2 == null) {
return false;
} else {
return o1.equals(o2);
}
}
public StackKey copy() {
return new StackKey(stack != null ? stack.copy() : null,
fluidStack != null ? fluidStack.copy() : null);
}
private int objectHashCode(Object o) {
return o != null ? o.hashCode() : 0;
}
public StackKey copy() {
return new StackKey(stack != null ? stack.copy() : null, fluidStack != null ? fluidStack.copy() : null);
}
}
@@ -1,12 +1,10 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
@API(apiVersion = "1.5", owner = "BuildCraft|Core", provides = "BuildCraftAPI|core")
@API(apiVersion = "2.0", owner = "BuildCraft|Core", provides = "BuildCraftAPI|core")
package buildcraft.api.core;
import cpw.mods.fml.common.API;
import net.minecraftforge.fml.common.API;
@@ -1,32 +1,27 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
package buildcraft.api.core.render;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection;
/*
* This interface designates a block as a state machine responsible for culling
* For implementation details look into FakeBlock implementation
*/
/* This interface designates a block as a state machine responsible for culling For implementation details look into
* FakeBlock implementation */
public interface ICullable {
//Side Rendering States
//They are used to effectively cull obstructed sides while processing facades.
//Make sure your implementation is correct otherwise expect FPS drop
void setRenderSide(ForgeDirection side, boolean render);
void setRenderAllSides();
boolean shouldSideBeRendered(IBlockAccess blockAccess, int x, int y, int z, int side);
void setRenderMask(int mask);
// Side Rendering States
// They are used to effectively cull obstructed sides while processing facades.
// Make sure your implementation is correct otherwise expect FPS drop
void setRenderSide(EnumFacing side, boolean render);
void setRenderAllSides();
boolean shouldSideBeRendered(IBlockAccess blockAccess, BlockPos pos, int side);
void setRenderMask(int mask);
}
@@ -1,7 +1,7 @@
package buildcraft.api.core.render;
import net.minecraft.util.IIcon;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
public interface ITextureStateManager {
void set(IIcon icon);
void set(TextureAtlasSprite icon);
}
@@ -1,22 +1,18 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
package buildcraft.api.core.render;
import net.minecraft.block.Block;
import net.minecraft.util.IIcon;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
public interface ITextureStates extends ICullable {
ITextureStateManager getTextureState();
IIcon getIcon(int side, int meta);
Block getBlock();
ITextureStateManager getTextureState();
TextureAtlasSprite getIcon(int side, int meta);
Block getBlock();
}
@@ -1,11 +1,7 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.gates;
import java.util.List;
@@ -20,45 +16,39 @@ import buildcraft.api.statements.ITriggerInternal;
public abstract class GateExpansionController {
public final IGateExpansion type;
public final TileEntity pipeTile;
public final IGateExpansion type;
public final TileEntity pipeTile;
public GateExpansionController(IGateExpansion type, TileEntity pipeTile) {
this.pipeTile = pipeTile;
this.type = type;
}
public GateExpansionController(IGateExpansion type, TileEntity pipeTile) {
this.pipeTile = pipeTile;
this.type = type;
}
public IGateExpansion getType() {
return type;
}
public IGateExpansion getType() {
return type;
}
public boolean isActive() {
return false;
}
public boolean isActive() {
return false;
}
public void tick(IGate gate) {
}
public void tick(IGate gate) {}
public void startResolution() {
}
public void startResolution() {}
public boolean resolveAction(IStatement action, int count) {
return false;
}
public boolean resolveAction(IStatement action, int count) {
return false;
}
public boolean isTriggerActive(IStatement trigger, IStatementParameter[] parameters) {
return false;
}
public boolean isTriggerActive(IStatement trigger, IStatementParameter[] parameters) {
return false;
}
public void addTriggers(List<ITriggerInternal> list) {
}
public void addTriggers(List<ITriggerInternal> list) {}
public void addActions(List<IActionInternal> list) {
}
public void addActions(List<IActionInternal> list) {}
public void writeToNBT(NBTTagCompound nbt) {
}
public void writeToNBT(NBTTagCompound nbt) {}
public void readFromNBT(NBTTagCompound nbt) {
}
public void readFromNBT(NBTTagCompound nbt) {}
}
@@ -1,11 +1,7 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.gates;
import java.util.ArrayList;
@@ -19,48 +15,47 @@ import com.google.common.collect.HashBiMap;
import net.minecraft.item.ItemStack;
public final class GateExpansions {
private static final Map<String, IGateExpansion> expansions = new HashMap<String, IGateExpansion>();
private static final ArrayList<IGateExpansion> expansionIDs = new ArrayList<IGateExpansion>();
private static final Map<IGateExpansion, ItemStack> recipes = HashBiMap.create();
private static final Map<String, IGateExpansion> expansions = new HashMap<String, IGateExpansion>();
private static final ArrayList<IGateExpansion> expansionIDs = new ArrayList<IGateExpansion>();
private static final Map<IGateExpansion, ItemStack> recipes = HashBiMap.create();
private GateExpansions() {
}
private GateExpansions() {}
public static void registerExpansion(IGateExpansion expansion) {
registerExpansion(expansion.getUniqueIdentifier(), expansion);
}
public static void registerExpansion(IGateExpansion expansion) {
registerExpansion(expansion.getUniqueIdentifier(), expansion);
}
public static void registerExpansion(String identifier, IGateExpansion expansion) {
expansions.put(identifier, expansion);
expansionIDs.add(expansion);
}
public static void registerExpansion(String identifier, IGateExpansion expansion) {
expansions.put(identifier, expansion);
expansionIDs.add(expansion);
}
public static void registerExpansion(IGateExpansion expansion, ItemStack addedRecipe) {
registerExpansion(expansion.getUniqueIdentifier(), expansion);
recipes.put(expansion, addedRecipe);
}
public static void registerExpansion(IGateExpansion expansion, ItemStack addedRecipe) {
registerExpansion(expansion.getUniqueIdentifier(), expansion);
recipes.put(expansion, addedRecipe);
}
public static IGateExpansion getExpansion(String identifier) {
return expansions.get(identifier);
}
public static IGateExpansion getExpansion(String identifier) {
return expansions.get(identifier);
}
public static Set<IGateExpansion> getExpansions() {
Set<IGateExpansion> set = new HashSet<IGateExpansion>();
set.addAll(expansionIDs);
return set;
}
public static Set<IGateExpansion> getExpansions() {
Set<IGateExpansion> set = new HashSet<IGateExpansion>();
set.addAll(expansionIDs);
return set;
}
public static Map<IGateExpansion, ItemStack> getRecipesForPostInit() {
return recipes;
}
// The code below is used by networking.
public static IGateExpansion getExpansionByID(int id) {
return expansionIDs.get(id);
}
public static int getExpansionID(IGateExpansion expansion) {
return expansionIDs.indexOf(expansion);
}
public static Map<IGateExpansion, ItemStack> getRecipesForPostInit() {
return recipes;
}
// The code below is used by networking.
public static IGateExpansion getExpansionByID(int id) {
return expansionIDs.get(id);
}
public static int getExpansionID(IGateExpansion expansion) {
return expansionIDs.indexOf(expansion);
}
}
+13 -15
View File
@@ -1,11 +1,7 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.gates;
import java.util.List;
@@ -17,16 +13,18 @@ import buildcraft.api.statements.containers.ISidedStatementContainer;
import buildcraft.api.transport.IPipe;
public interface IGate extends ISidedStatementContainer {
@Deprecated
void setPulsing(boolean pulse);
@Deprecated
void setPulsing(boolean pulse);
IPipe getPipe();
IPipe getPipe();
List<IStatement> getTriggers();
List<IStatement> getActions();
List<IStatement> getTriggers();
List<StatementSlot> getActiveActions();
List<IStatement> getActions();
List<IStatementParameter> getTriggerParameters(int index);
List<IStatementParameter> getActionParameters(int index);
List<StatementSlot> getActiveActions();
List<IStatementParameter> getTriggerParameters(int index);
List<IStatementParameter> getActionParameters(int index);
}
@@ -1,30 +1,34 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.gates;
import net.minecraft.client.renderer.texture.IIconRegister;
import java.util.List;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public interface IGateExpansion {
String getUniqueIdentifier();
String getUniqueIdentifier();
String getDisplayName();
String getDisplayName();
GateExpansionController makeController(TileEntity pipeTile);
GateExpansionController makeController(TileEntity pipeTile);
void registerBlockOverlay(IIconRegister iconRegister);
@SideOnly(Side.CLIENT)
void textureStitch(TextureMap map);
void registerItemOverlay(IIconRegister iconRegister);
@SideOnly(Side.CLIENT)
IGateStaticRenderState getRenderState();
IIcon getOverlayBlock();
IIcon getOverlayItem();
public interface IGateStaticRenderState {
List<BakedQuad> bake(VertexFormat format);
}
}
@@ -1,12 +1,8 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
@API(apiVersion = "4.1", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|gates")
package buildcraft.api.gates;
import cpw.mods.fml.common.API;
import net.minecraftforge.fml.common.API;
@@ -1,11 +1,7 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.statements;
public class ActionState {
@@ -1,16 +1,12 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.statements;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
public interface IActionExternal extends IStatement {
void actionActivate(TileEntity target, ForgeDirection side, IStatementContainer source, IStatementParameter[] parameters);
void actionActivate(TileEntity target, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters);
}
@@ -1,15 +1,11 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.statements;
public interface IActionInternal extends IStatement {
void actionActivate(IStatementContainer source, IStatementParameter[] parameters);
void actionActivate(IStatementContainer source, IStatementParameter[] parameters);
}
@@ -1,28 +1,19 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.statements;
import java.util.Collection;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
public interface IActionProvider {
/**
* Returns the list of actions that are available from the statement container holding the
* gate.
*/
Collection<IActionInternal> getInternalActions(IStatementContainer container);
/** Returns the list of actions that are available from the statement container holding the gate. */
Collection<IActionInternal> getInternalActions(IStatementContainer container);
/**
* Returns the list of actions available to a gate next to the given block.
*/
Collection<IActionExternal> getExternalActions(ForgeDirection side, TileEntity tile);
/** Returns the list of actions available to a gate next to the given block. */
Collection<IActionExternal> getExternalActions(EnumFacing side, TileEntity tile);
}
@@ -1,13 +1,9 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.statements;
public interface IActionReceptor {
void actionActivated(IStatement statement, IStatementParameter[] parameters);
void actionActivated(IStatement statement, IStatementParameter[] parameters);
}
@@ -1,16 +1,13 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.statements;
import java.util.List;
public interface IOverrideDefaultStatements {
List<ITriggerExternal> overrideTriggers();
List<IActionExternal> overrideActions();
List<ITriggerExternal> overrideTriggers();
List<IActionExternal> overrideActions();
}
@@ -1,56 +1,36 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.statements;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public interface IStatement {
/**
* Every statement needs a unique tag, it should be in the format of
* "&lt;modid&gt;:&lt;name&gt;.
*
* @return the unique id
*/
String getUniqueTag();
/** Every statement needs a unique tag, it should be in the format of "&lt;modid&gt;:&lt;name&gt;.
*
* @return the unique id */
String getUniqueTag();
@SideOnly(Side.CLIENT)
IIcon getIcon();
/** Return the maximum number of parameter this statement can have, 0 if none. */
int maxParameters();
@SideOnly(Side.CLIENT)
void registerIcons(IIconRegister iconRegister);
/** Return the minimum number of parameter this statement can have, 0 if none. */
int minParameters();
/**
* Return the maximum number of parameter this statement can have, 0 if none.
*/
int maxParameters();
/** Return the statement description in the UI */
String getDescription();
/**
* Return the minimum number of parameter this statement can have, 0 if none.
*/
int minParameters();
/** Create parameters for the statement. */
IStatementParameter createParameter(int index);
/**
* Return the statement description in the UI
*/
String getDescription();
/** This returns the statement after a left rotation. Used in particular in blueprints orientation. */
IStatement rotateLeft();
/**
* Create parameters for the statement.
*/
IStatementParameter createParameter(int index);
/**
* This returns the statement after a left rotation. Used in particular in
* blueprints orientation.
*/
IStatement rotateLeft();
/** This should return the icon for this statement, suitable for rending directly into a GUI. This should refer to a
* texture on the map block texture map. */
@SideOnly(Side.CLIENT)
TextureAtlasSprite getGuiSprite();
}
@@ -1,19 +1,12 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.statements;
import net.minecraft.tileentity.TileEntity;
/**
* This is implemented by objects containing Statements, such as
* Gates and TileEntities.
*/
/** This is implemented by objects containing Statements, such as Gates and TileEntities. */
public interface IStatementContainer {
TileEntity getTile();
TileEntity getTile();
}
@@ -1,59 +1,36 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.statements;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public interface IStatementParameter {
/**
* Every parameter needs a unique tag, it should be in the format of
* "&lt;modi&gt;:&lt;name&gt;".
*
* @return the unique id
*/
String getUniqueTag();
@SideOnly(Side.CLIENT)
IIcon getIcon();
ItemStack getItemStack();
/** Every parameter needs a unique tag, it should be in the format of "&lt;modid&gt;:&lt;name&gt;".
*
* @return the unique id */
String getUniqueTag();
/**
* Something that is initially unintuitive: you HAVE to
* keep your icons as static variables, due to the fact
* that every IStatementParameter is instantiated upon creation,
* in opposition to IStatements which are singletons (due to the
* fact that they, unlike Parameters, store no additional data)
*/
@SideOnly(Side.CLIENT)
void registerIcons(IIconRegister iconRegister);
/**
* Return the parameter description in the UI
*/
String getDescription();
@SideOnly(Side.CLIENT)
TextureAtlasSprite getIcon();
void onClick(IStatementContainer source, IStatement stmt, ItemStack stack, StatementMouseClick mouse);
ItemStack getItemStack();
void readFromNBT(NBTTagCompound compound);
/** Return the parameter description in the UI */
String getDescription();
void writeToNBT(NBTTagCompound compound);
void onClick(IStatementContainer source, IStatement stmt, ItemStack stack, StatementMouseClick mouse);
/**
* This returns the parameter after a left rotation. Used in particular in
* blueprints orientation.
*/
IStatementParameter rotateLeft();
void readFromNBT(NBTTagCompound compound);
void writeToNBT(NBTTagCompound compound);
/** This returns the parameter after a left rotation. Used in particular in blueprints orientation. */
IStatementParameter rotateLeft();
}
@@ -1,18 +1,14 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.statements;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
public interface ITriggerExternal extends IStatement {
boolean isTriggerActive(TileEntity target, ForgeDirection side, IStatementContainer source, IStatementParameter[] parameters);
boolean isTriggerActive(TileEntity target, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters);
}
@@ -1,17 +1,16 @@
package buildcraft.api.statements;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
/**
* This interface can be used by tiles to override external trigger
* behaviour.
/** This interface can be used by tiles to override external trigger behaviour.
*
* Please use wisely.
*/
* Please use wisely. */
public interface ITriggerExternalOverride {
public enum Result {
TRUE, FALSE, IGNORE
}
public enum Result {
TRUE,
FALSE,
IGNORE
}
Result override(ForgeDirection side, IStatementContainer source, IStatementParameter[] parameters);
Result override(EnumFacing side, IStatementContainer source, IStatementParameter[] parameters);
}
@@ -1,15 +1,11 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.statements;
public interface ITriggerInternal extends IStatement {
boolean isTriggerActive(IStatementContainer source, IStatementParameter[] parameters);
boolean isTriggerActive(IStatementContainer source, IStatementParameter[] parameters);
}
@@ -1,28 +1,20 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.statements;
import java.util.Collection;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
public interface ITriggerProvider {
/**
* Returns the list of triggers that are available from the object holding the gate.
*/
Collection<ITriggerInternal> getInternalTriggers(IStatementContainer container);
/** Returns the list of triggers that are available from the object holding the gate. */
Collection<ITriggerInternal> getInternalTriggers(IStatementContainer container);
/**
* Returns the list of triggers available to a gate next to the given block.
*/
Collection<ITriggerExternal> getExternalTriggers(ForgeDirection side, TileEntity tile);
/** Returns the list of triggers available to a gate next to the given block. */
Collection<ITriggerExternal> getExternalTriggers(EnumFacing side, TileEntity tile);
}
@@ -1,11 +1,7 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.statements;
import java.util.Collection;
@@ -14,169 +10,168 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.tileentity.TileEntity;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
import buildcraft.api.core.BCLog;
public final class StatementManager {
public static Map<String, IStatement> statements = new HashMap<String, IStatement>();
public static Map<String, Class<? extends IStatementParameter>> parameters = new HashMap<String, Class<? extends IStatementParameter>>();
private static List<ITriggerProvider> triggerProviders = new LinkedList<ITriggerProvider>();
private static List<IActionProvider> actionProviders = new LinkedList<IActionProvider>();
public static Map<String, IStatement> statements = new HashMap<String, IStatement>();
public static Map<String, Class<? extends IStatementParameter>> parameters = new HashMap<String, Class<? extends IStatementParameter>>();
private static List<ITriggerProvider> triggerProviders = new LinkedList<ITriggerProvider>();
private static List<IActionProvider> actionProviders = new LinkedList<IActionProvider>();
/**
* Deactivate constructor
*/
private StatementManager() {
}
/** Deactivate constructor */
private StatementManager() {}
public static void registerTriggerProvider(ITriggerProvider provider) {
if (provider != null && !triggerProviders.contains(provider)) {
triggerProviders.add(provider);
}
}
public static void registerTriggerProvider(ITriggerProvider provider) {
if (provider != null && !triggerProviders.contains(provider)) {
triggerProviders.add(provider);
}
}
public static void registerActionProvider(IActionProvider provider) {
if (provider != null && !actionProviders.contains(provider)) {
actionProviders.add(provider);
}
}
public static void registerActionProvider(IActionProvider provider) {
if (provider != null && !actionProviders.contains(provider)) {
actionProviders.add(provider);
}
}
public static void registerStatement(IStatement statement) {
statements.put(statement.getUniqueTag(), statement);
}
public static void registerStatement(IStatement statement) {
statements.put(statement.getUniqueTag(), statement);
}
public static void registerParameterClass(Class<? extends IStatementParameter> param) {
parameters.put(createParameter(param).getUniqueTag(), param);
}
@Deprecated
public static void registerParameterClass(String name, Class<? extends IStatementParameter> param) {
parameters.put(name, param);
}
public static void registerParameterClass(Class<? extends IStatementParameter> param) {
parameters.put(createParameter(param).getUniqueTag(), param);
}
public static List<ITriggerExternal> getExternalTriggers(ForgeDirection side, TileEntity entity) {
List<ITriggerExternal> result;
@Deprecated
public static void registerParameterClass(String name, Class<? extends IStatementParameter> param) {
parameters.put(name, param);
}
if (entity instanceof IOverrideDefaultStatements) {
result = ((IOverrideDefaultStatements) entity).overrideTriggers();
if (result != null) {
return result;
}
}
public static List<ITriggerExternal> getExternalTriggers(EnumFacing side, TileEntity entity) {
List<ITriggerExternal> result;
if (entity instanceof IOverrideDefaultStatements) {
result = ((IOverrideDefaultStatements) entity).overrideTriggers();
if (result != null) {
return result;
}
}
result = new LinkedList<ITriggerExternal>();
for (ITriggerProvider provider : triggerProviders) {
Collection<ITriggerExternal> toAdd = provider.getExternalTriggers(side, entity);
if (toAdd != null) {
for (ITriggerExternal t : toAdd) {
if (!result.contains(t)) {
result.add(t);
}
}
}
}
return result;
}
public static List<IActionExternal> getExternalActions(EnumFacing side, TileEntity entity) {
List<IActionExternal> result = new LinkedList<IActionExternal>();
if (entity instanceof IOverrideDefaultStatements) {
result = ((IOverrideDefaultStatements) entity).overrideActions();
if (result != null) {
return result;
}
}
result = new LinkedList<IActionExternal>();
result = new LinkedList<ITriggerExternal>();
for (ITriggerProvider provider : triggerProviders) {
Collection<ITriggerExternal> toAdd = provider.getExternalTriggers(side, entity);
for (IActionProvider provider : actionProviders) {
Collection<IActionExternal> toAdd = provider.getExternalActions(side, entity);
if (toAdd != null) {
for (ITriggerExternal t : toAdd) {
if (!result.contains(t)) {
result.add(t);
}
}
}
}
if (toAdd != null) {
for (IActionExternal t : toAdd) {
if (!result.contains(t)) {
result.add(t);
}
}
}
}
return result;
}
return result;
}
public static List<IActionExternal> getExternalActions(ForgeDirection side, TileEntity entity) {
List<IActionExternal> result = new LinkedList<IActionExternal>();
public static List<ITriggerInternal> getInternalTriggers(IStatementContainer container) {
List<ITriggerInternal> result = new LinkedList<ITriggerInternal>();
if (entity instanceof IOverrideDefaultStatements) {
result = ((IOverrideDefaultStatements) entity).overrideActions();
if (result != null) {
return result;
} else {
result = new LinkedList<IActionExternal>();
}
}
for (IActionProvider provider : actionProviders) {
Collection<IActionExternal> toAdd = provider.getExternalActions(side, entity);
for (ITriggerProvider provider : triggerProviders) {
Collection<ITriggerInternal> toAdd = provider.getInternalTriggers(container);
if (toAdd != null) {
for (IActionExternal t : toAdd) {
if (!result.contains(t)) {
result.add(t);
}
}
}
}
if (toAdd != null) {
for (ITriggerInternal t : toAdd) {
if (!result.contains(t)) {
result.add(t);
}
}
}
}
return result;
}
return result;
}
public static List<ITriggerInternal> getInternalTriggers(IStatementContainer container) {
List<ITriggerInternal> result = new LinkedList<ITriggerInternal>();
public static List<IActionInternal> getInternalActions(IStatementContainer container) {
List<IActionInternal> result = new LinkedList<IActionInternal>();
for (ITriggerProvider provider : triggerProviders) {
Collection<ITriggerInternal> toAdd = provider.getInternalTriggers(container);
for (IActionProvider provider : actionProviders) {
Collection<IActionInternal> toAdd = provider.getInternalActions(container);
if (toAdd != null) {
for (ITriggerInternal t : toAdd) {
if (!result.contains(t)) {
result.add(t);
}
}
}
}
if (toAdd != null) {
for (IActionInternal t : toAdd) {
if (!result.contains(t)) {
result.add(t);
}
}
}
}
return result;
}
return result;
}
public static List<IActionInternal> getInternalActions(IStatementContainer container) {
List<IActionInternal> result = new LinkedList<IActionInternal>();
public static IStatementParameter createParameter(String kind) {
return createParameter(parameters.get(kind));
}
for (IActionProvider provider : actionProviders) {
Collection<IActionInternal> toAdd = provider.getInternalActions(container);
private static IStatementParameter createParameter(Class<? extends IStatementParameter> param) {
try {
return param.newInstance();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (Error error) {
BCLog.logErrorAPI(error, IStatementParameter.class);
throw error;
}
if (toAdd != null) {
for (IActionInternal t : toAdd) {
if (!result.contains(t)) {
result.add(t);
}
}
}
}
return null;
}
return result;
}
public static IStatementParameter createParameter(String kind) {
return createParameter(parameters.get(kind));
}
private static IStatementParameter createParameter(Class<? extends IStatementParameter> param) {
try {
return param.newInstance();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return null;
}
/**
* Generally, this function should be called by every mod implementing
* the Statements API ***as a container*** (that is, adding its own gates)
* on the client side from a given Item of choice.
*/
@SideOnly(Side.CLIENT)
public static void registerIcons(IIconRegister register) {
for (IStatement statement : statements.values()) {
statement.registerIcons(register);
}
for (Class<? extends IStatementParameter> parameter : parameters.values()) {
createParameter(parameter).registerIcons(register);
}
}
// /**
// * Generally, this function should be called by every mod implementing
// * the Statements API ***as a container*** (that is, adding its own gates)
// * on the client side from a given Item of choice.
// */
// @SideOnly(Side.CLIENT)
// public static void registerIcons(TextureAtlasSpriteRegister register) {
// for (IStatement statement : statements.values()) {
// statement.registerIcons(register);
// }
//
// for (Class<? extends IStatementParameter> parameter : parameters.values()) {
// createParameter(parameter).registerIcons(register);
// }
// }
}
@@ -1,27 +1,23 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.statements;
public final class StatementMouseClick {
private int button;
private boolean shift;
public StatementMouseClick(int button, boolean shift) {
this.button = button;
this.shift = shift;
}
public boolean isShift() {
return shift;
}
public int getButton() {
return button;
}
private int button;
private boolean shift;
public StatementMouseClick(int button, boolean shift) {
this.button = button;
this.shift = shift;
}
public boolean isShift() {
return shift;
}
public int getButton() {
return button;
}
}
@@ -1,88 +1,83 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.statements;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.IIcon;
public class StatementParameterItemStack implements IStatementParameter {
protected ItemStack stack;
@Override
public IIcon getIcon() {
return null;
}
protected ItemStack stack;
@Override
public ItemStack getItemStack() {
return stack;
}
@Override
public TextureAtlasSprite getIcon() {
return null;
}
@Override
public void onClick(IStatementContainer source, IStatement stmt, ItemStack stack, StatementMouseClick mouse) {
if (stack != null) {
this.stack = stack.copy();
this.stack.stackSize = 1;
} else {
this.stack = null;
}
}
@Override
public ItemStack getItemStack() {
return stack;
}
@Override
public void writeToNBT(NBTTagCompound compound) {
if (stack != null) {
NBTTagCompound tagCompound = new NBTTagCompound();
stack.writeToNBT(tagCompound);
compound.setTag("stack", tagCompound);
}
}
@Override
public void onClick(IStatementContainer source, IStatement stmt, ItemStack stack, StatementMouseClick mouse) {
if (stack != null) {
this.stack = stack.copy();
this.stack.stackSize = 1;
} else {
this.stack = null;
}
}
@Override
public void readFromNBT(NBTTagCompound compound) {
stack = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("stack"));
}
@Override
public void writeToNBT(NBTTagCompound compound) {
if (stack != null) {
NBTTagCompound tagCompound = new NBTTagCompound();
stack.writeToNBT(tagCompound);
compound.setTag("stack", tagCompound);
}
}
@Override
public boolean equals(Object object) {
if (object instanceof StatementParameterItemStack) {
StatementParameterItemStack param = (StatementParameterItemStack) object;
@Override
public void readFromNBT(NBTTagCompound compound) {
stack = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("stack"));
}
return ItemStack.areItemStacksEqual(stack, param.stack)
&& ItemStack.areItemStackTagsEqual(stack, param.stack);
} else {
return false;
}
}
@Override
public boolean equals(Object object) {
if (object instanceof StatementParameterItemStack) {
StatementParameterItemStack param = (StatementParameterItemStack) object;
@Override
public String getDescription() {
if (stack != null) {
return stack.getDisplayName();
} else {
return "";
}
}
return ItemStack.areItemStacksEqual(stack, param.stack) && ItemStack.areItemStackTagsEqual(stack, param.stack);
} else {
return false;
}
}
@Override
public String getUniqueTag() {
return "buildcraft:stack";
}
@Override
public String getDescription() {
if (stack != null) {
return stack.getDisplayName();
} else {
return "";
}
}
@Override
public void registerIcons(IIconRegister iconRegister) {
}
@Override
public String getUniqueTag() {
return "buildcraft:stack";
}
@Override
public IStatementParameter rotateLeft() {
return this;
}
// @Override
// public void registerIcons(TextureAtlasSpriteRegister iconRegister) {
//
// }
@Override
public IStatementParameter rotateLeft() {
return this;
}
}
+26 -30
View File
@@ -1,36 +1,32 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
package buildcraft.api.statements;
public class StatementSlot {
public IStatement statement;
public IStatementParameter[] parameters;
public IStatement statement;
public IStatementParameter[] parameters;
@Override
public boolean equals(Object o) {
if (o == null || !(o instanceof StatementSlot)) {
return false;
}
StatementSlot s = (StatementSlot) o;
if (s.statement != statement || parameters.length != s.parameters.length) {
return false;
}
for (int i = 0; i < parameters.length; i++) {
IStatementParameter p1 = parameters[i];
IStatementParameter p2 = s.parameters[i];
if (p1 == null && p2 != null) {
return false;
}
if (!(p1.equals(p2))) {
return false;
}
}
return true;
}
@Override
public boolean equals(Object o) {
if (o == null || !(o instanceof StatementSlot)) {
return false;
}
StatementSlot s = (StatementSlot) o;
if (s.statement != statement || parameters.length != s.parameters.length) {
return false;
}
for (int i = 0; i < parameters.length; i++) {
IStatementParameter p1 = parameters[i];
IStatementParameter p2 = s.parameters[i];
if (p1 == null && p2 != null) {
return false;
}
if (!(p1.equals(p2))) {
return false;
}
}
return true;
}
}
@@ -1,19 +1,17 @@
package buildcraft.api.statements.containers;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
public interface IRedstoneStatementContainer {
/**
* Get the redstone input from a given side.
* @param side The side - use "UNKNOWN" for maximum input.
* @return The redstone input, from 0 to 15.
*/
int getRedstoneInput(ForgeDirection side);
/** Get the redstone input from a given side.
*
* @param side The side - use "UNKNOWN" for maximum input.
* @return The redstone input, from 0 to 15. */
int getRedstoneInput(EnumFacing side);
/**
* Set the redstone input for a given side.
* @param side The side - use "UNKNOWN" for all sides.
* @return Whether the set was successful.
*/
boolean setRedstoneOutput(ForgeDirection side, int value);
/** Set the redstone input for a given side.
*
* @param side The side - use "UNKNOWN" for all sides.
* @return Whether the set was successful. */
boolean setRedstoneOutput(EnumFacing side, int value);
}
@@ -1,12 +1,10 @@
package buildcraft.api.statements.containers;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
import buildcraft.api.statements.IStatementContainer;
/**
* Created by asie on 3/14/15.
*/
/** Created by asie on 3/14/15. */
public interface ISidedStatementContainer extends IStatementContainer {
ForgeDirection getSide();
EnumFacing getSide();
}
@@ -1,12 +1,8 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
@API(apiVersion = "1.1", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|statements")
package buildcraft.api.statements;
import cpw.mods.fml.common.API;
import net.minecraftforge.fml.common.API;
@@ -0,0 +1,12 @@
package buildcraft.api.transport;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
public interface ICustomPipeConnection {
/** @return How long the connecting pipe should extend for. Values less than -4/16 indicate that the pipe will not
* connect at all, and will render as it it was not connected. */
public float getExtension(World world, BlockPos pos, EnumFacing face, IBlockState state);
}
@@ -1,23 +1,18 @@
package buildcraft.api.transport;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.core.EnumColor;
import net.minecraft.util.EnumFacing;
public interface IInjectable {
boolean canInjectItems(ForgeDirection from);
boolean canInjectItems(EnumFacing from);
/**
* Offers an ItemStack for 3addition to the pipe. Will be rejected if the
* pipe doesn't accept items from that side.
*
* @param stack ItemStack offered for addition. Do not manipulate this!
* @param doAdd If false no actual addition should take place. Implementors
* should simulate.
* @param from Orientation the ItemStack is offered from.
* @param color The color of the item to be added to the pipe, or null for no color.
* @return Amount of items used from the passed stack.
*/
int injectItem(ItemStack stack, boolean doAdd, ForgeDirection from, EnumColor color);
/** Offers an ItemStack for 3addition to the pipe. Will be rejected if the pipe doesn't accept items from that side.
*
* @param stack ItemStack offered for addition. Do not manipulate this!
* @param doAdd If false no actual addition should take place. Implementors should simulate.
* @param from Orientation the ItemStack is offered from.
* @param color The color of the item to be added to the pipe, or null for no color.
* @return Amount of items used from the passed stack. */
int injectItem(ItemStack stack, boolean doAdd, EnumFacing from, EnumDyeColor color);
}
@@ -1,16 +1,11 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
* BuildCraft is distributed under the terms of the Minecraft Mod Public License 1.0, or MMPL. Please check the contents
* of the license located in http://www.mod-buildcraft.com/MMPL-1.0.txt */
package buildcraft.api.transport;
/**
* To be implemented by the real item pipe in Transport mod, but leaves knowledge for classes that do not have direct dependency on transport.
*/
/** To be implemented by the real item pipe in Transport mod, but leaves knowledge for classes that do not have direct
* dependency on transport. */
public interface IItemPipe {
}
@@ -1,25 +1,21 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.transport;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
import buildcraft.api.gates.IGate;
public interface IPipe {
IPipeTile getTile();
IPipeTile getTile();
IGate getGate(ForgeDirection side);
boolean hasGate(ForgeDirection side);
boolean isWired(PipeWire wire);
boolean isWireActive(PipeWire wire);
IGate getGate(EnumFacing side);
boolean hasGate(EnumFacing side);
boolean isWired(PipeWire wire);
boolean isWireActive(PipeWire wire);
}
@@ -1,29 +1,24 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.transport;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
public interface IPipeConnection {
enum ConnectOverride {
enum ConnectOverride {
CONNECT, DISCONNECT, DEFAULT
}
CONNECT,
DISCONNECT,
DEFAULT
}
/**
* Allows you to override pipe connection logic.
*
* @param type
* @param with
* @return CONNECT to force a connection, DISCONNECT to force no connection,
* and DEFAULT to let the pipe decide.
*/
ConnectOverride overridePipeConnection(IPipeTile.PipeType type, ForgeDirection with);
/** Allows you to override pipe connection logic.
*
* @param type
* @param with
* @return CONNECT to force a connection, DISCONNECT to force no connection, and DEFAULT to let the pipe decide. */
ConnectOverride overridePipeConnection(IPipeTile.PipeType type, EnumFacing with);
}
@@ -1,62 +1,51 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.transport;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.core.EnumColor;
import buildcraft.api.transport.pluggable.PipePluggable;
public interface IPipeTile extends IInjectable {
enum PipeType {
ITEM, FLUID, POWER, STRUCTURE
}
enum PipeType {
ITEM,
FLUID,
POWER,
STRUCTURE
}
PipeType getPipeType();
PipeType getPipeType();
World getWorld();
World getWorldBC();
int x();
/** True if the pipe is connected to the block/pipe in the specific direction
*
* @param with
* @return true if connect */
boolean isPipeConnected(EnumFacing with);
int y();
Block getNeighborBlock(EnumFacing dir);
int z();
TileEntity getNeighborTile(EnumFacing dir);
/**
* True if the pipe is connected to the block/pipe in the specific direction
*
* @param with
* @return true if connect
*/
boolean isPipeConnected(ForgeDirection with);
IPipe getNeighborPipe(EnumFacing dir);
Block getNeighborBlock(ForgeDirection dir);
TileEntity getNeighborTile(ForgeDirection dir);
IPipe getNeighborPipe(ForgeDirection dir);
IPipe getPipe();
int getPipeColor();
IPipe getPipe();
PipePluggable getPipePluggable(ForgeDirection direction); // Now in IPluggableProvider
boolean hasPipePluggable(ForgeDirection direction); // Now in IPluggableProvider
boolean hasBlockingPluggable(ForgeDirection direction);
int getPipeColor();
void scheduleNeighborChange();
void scheduleRenderUpdate();
PipePluggable getPipePluggable(EnumFacing direction); // Now in IPluggableProvider
// For compatibility with BC 6.2.x and below
int injectItem(ItemStack stack, boolean doAdd, ForgeDirection from, EnumColor color);
boolean hasPipePluggable(EnumFacing direction); // Now in IPluggableProvider
@Deprecated // Now in IInjectable
int injectItem(ItemStack stack, boolean doAdd, ForgeDirection from);
boolean hasBlockingPluggable(EnumFacing direction);
void scheduleNeighborChange();
void scheduleRenderUpdate();
}
@@ -1,17 +1,14 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.transport;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
public interface IStripesActivator {
void sendItem(ItemStack itemStack, ForgeDirection direction);
void dropItem(ItemStack itemStack, ForgeDirection direction);
void sendItem(ItemStack itemStack, EnumFacing direction);
void dropItem(ItemStack itemStack, EnumFacing direction);
}
@@ -1,28 +1,24 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.transport;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public interface IStripesHandler {
enum StripesHandlerType {
ITEM_USE,
BLOCK_BREAK
}
StripesHandlerType getType();
boolean shouldHandle(ItemStack stack);
boolean handle(World world, int x, int y, int z, ForgeDirection direction,
ItemStack stack, EntityPlayer player, IStripesActivator activator);
enum StripesHandlerType {
ITEM_USE,
BLOCK_BREAK
}
StripesHandlerType getType();
boolean shouldHandle(ItemStack stack);
boolean handle(World world, BlockPos pos, EnumFacing direction, ItemStack stack, EntityPlayer player, IStripesActivator activator);
}
@@ -1,12 +1,9 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.transport;
public interface IStripesPipe extends IPipe, IStripesActivator {
}
import cofh.api.energy.IEnergyHandler;
public interface IStripesPipe extends IPipe, IStripesActivator, IEnergyHandler {}
@@ -0,0 +1,48 @@
package buildcraft.api.transport;
import java.util.Map;
import com.google.common.collect.Maps;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
/** Use this class to register blocks with custom block sizes so that pipes can connect to them properly. Note that you
* do not need to register a custom pipe connection if your block implements ICustomPipeConnection. The registered
* version does not override your own implementation. */
public final class PipeConnectionAPI {
private static final Map<Block, ICustomPipeConnection> connections = Maps.newHashMap();
private static final ICustomPipeConnection NOTHING = new ICustomPipeConnection() {
@Override
public float getExtension(World world, BlockPos pos, EnumFacing face, IBlockState state) {
return 0;
}
};
/** Register a block with a custom connection. Useful if you don't own the block class or are adding it for some-one
*
* @param block The block instance
* @param connection The connection instance */
public static void registerConnection(Block block, ICustomPipeConnection connection) {
connections.put(block, connection);
}
public static void registerConnectionAsNothing(Block block) {
connections.put(block, NOTHING);
}
/** Gets the current custom connection that the block uses. Will be null if nothing has been set. */
public static ICustomPipeConnection getCustomConnection(Block block) {
if (block instanceof ICustomPipeConnection) {
return (ICustomPipeConnection) block;
}
ICustomPipeConnection connection = connections.get(block);
if (connection != null) {
return connection;
}
return null;
}
}
@@ -1,11 +1,7 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.transport;
import java.util.ArrayList;
@@ -15,64 +11,61 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import buildcraft.api.transport.pluggable.PipePluggable;
public abstract class PipeManager {
public static List<IStripesHandler> stripesHandlers = new ArrayList<IStripesHandler>();
public static ArrayList<Class<? extends PipePluggable>> pipePluggables = new ArrayList<Class<? extends PipePluggable>>();
private static Map<String, Class<? extends PipePluggable>> pipePluggableNames =
new HashMap<String, Class<? extends PipePluggable>>();
private static Map<Class<? extends PipePluggable>, String> pipePluggableByNames =
new HashMap<Class<? extends PipePluggable>, String>();
private static Map<IStripesHandler, Integer> stripesHandlerPriorities =
new HashMap<IStripesHandler, Integer>();
public static List<IStripesHandler> stripesHandlers = new ArrayList<IStripesHandler>();
public static ArrayList<Class<? extends PipePluggable>> pipePluggables = new ArrayList<Class<? extends PipePluggable>>();
private static Map<String, Class<? extends PipePluggable>> pipePluggableNames = new HashMap<String, Class<? extends PipePluggable>>();
private static Map<Class<? extends PipePluggable>, String> pipePluggableByNames = new HashMap<Class<? extends PipePluggable>, String>();
private static Map<IStripesHandler, Integer> stripesHandlerPriorities = new HashMap<IStripesHandler, Integer>();
@Deprecated
public static boolean canExtractItems(Object extractor, World world, int i, int j, int k) {
return true;
}
@Deprecated
public static boolean canExtractItems(Object extractor, World world, BlockPos pos) {
return true;
}
@Deprecated
public static boolean canExtractFluids(Object extractor, World world, int i, int j, int k) {
return true;
}
@Deprecated
public static boolean canExtractFluids(Object extractor, World world, BlockPos pos) {
return true;
}
@Deprecated
public static void registerStripesHandler(IStripesHandler handler) {
registerStripesHandler(handler, 0);
}
@Deprecated
public static void registerStripesHandler(IStripesHandler handler) {
registerStripesHandler(handler, 0);
}
/**
* Register a Stripes Pipe handler.
* @param handler The handler.
* @param priority The priority - 0 is normal, higher numbers have higher priority.
*/
public static void registerStripesHandler(IStripesHandler handler, int priority) {
stripesHandlers.add(handler);
stripesHandlerPriorities.put(handler, priority);
/** Register a Stripes Pipe handler.
*
* @param handler The handler.
* @param priority The priority - 0 is normal, higher numbers have higher priority. */
public static void registerStripesHandler(IStripesHandler handler, int priority) {
stripesHandlers.add(handler);
stripesHandlerPriorities.put(handler, priority);
Collections.sort(stripesHandlers, new Comparator<IStripesHandler>() {
@Override
public int compare(IStripesHandler o1, IStripesHandler o2) {
return stripesHandlerPriorities.get(o2) - stripesHandlerPriorities.get(o1);
}
});
}
Collections.sort(stripesHandlers, new Comparator<IStripesHandler>() {
@Override
public int compare(IStripesHandler o1, IStripesHandler o2) {
return stripesHandlerPriorities.get(o2) - stripesHandlerPriorities.get(o1);
}
});
}
public static void registerPipePluggable(Class<? extends PipePluggable> pluggable, String name) {
pipePluggables.add(pluggable);
pipePluggableNames.put(name, pluggable);
pipePluggableByNames.put(pluggable, name);
}
public static void registerPipePluggable(Class<? extends PipePluggable> pluggable, String name) {
pipePluggables.add(pluggable);
pipePluggableNames.put(name, pluggable);
pipePluggableByNames.put(pluggable, name);
}
public static Class<?> getPluggableByName(String pluggableName) {
return pipePluggableNames.get(pluggableName);
}
public static Class<?> getPluggableByName(String pluggableName) {
return pipePluggableNames.get(pluggableName);
}
public static String getPluggableName(Class<? extends PipePluggable> aClass) {
return pipePluggableByNames.get(aClass);
}
public static String getPluggableName(Class<? extends PipePluggable> aClass) {
return pipePluggableByNames.get(aClass);
}
}
@@ -1,11 +1,7 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.transport;
import java.util.Locale;
@@ -15,60 +11,63 @@ import net.minecraft.item.ItemStack;
public enum PipeWire {
RED, BLUE, GREEN, YELLOW;
public static Item item;
public static final PipeWire[] VALUES = values();
RED,
BLUE,
GREEN,
YELLOW;
public static Item item;
public static final PipeWire[] VALUES = values();
public PipeWire reverse() {
switch (this) {
case RED:
return YELLOW;
case BLUE:
return GREEN;
case GREEN:
return BLUE;
default:
return RED;
}
}
public PipeWire reverse() {
switch (this) {
case RED:
return YELLOW;
case BLUE:
return GREEN;
case GREEN:
return BLUE;
default:
return RED;
}
}
public String getTag() {
return name().toLowerCase(Locale.ENGLISH) + "PipeWire";
}
public String getTag() {
return name().toLowerCase(Locale.ENGLISH) + "PipeWire";
}
public String getColor() {
String name = this.toString().toLowerCase(Locale.ENGLISH);
char first = Character.toUpperCase(name.charAt(0));
return first + name.substring(1);
}
public String getColor() {
String name = this.toString().toLowerCase(Locale.ENGLISH);
char first = Character.toUpperCase(name.charAt(0));
return first + name.substring(1);
}
public ItemStack getStack() {
return getStack(1);
}
public ItemStack getStack() {
return getStack(1);
}
public ItemStack getStack(int qty) {
if (item == null) {
return null;
} else {
return new ItemStack(item, qty, ordinal());
}
}
public ItemStack getStack(int qty) {
if (item == null) {
return null;
} else {
return new ItemStack(item, qty, ordinal());
}
}
public boolean isPipeWire(ItemStack stack) {
if (stack == null) {
return false;
} else if (stack.getItem() != item) {
return false;
} else {
return stack.getItemDamage() == ordinal();
}
}
public boolean isPipeWire(ItemStack stack) {
if (stack == null) {
return false;
} else if (stack.getItem() != item) {
return false;
} else {
return stack.getItemDamage() == ordinal();
}
}
public static PipeWire fromOrdinal(int ordinal) {
if (ordinal < 0 || ordinal >= VALUES.length) {
return RED;
} else {
return VALUES[ordinal];
}
}
public static PipeWire fromOrdinal(int ordinal) {
if (ordinal < 0 || ordinal >= VALUES.length) {
return RED;
} else {
return VALUES[ordinal];
}
}
}
@@ -1,12 +1,8 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
@API(apiVersion = "4.1", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|transport")
package buildcraft.api.transport;
import cpw.mods.fml.common.API;
import net.minecraftforge.fml.common.API;
@@ -0,0 +1,7 @@
package buildcraft.api.transport.pluggable;
import net.minecraft.util.EnumFacing;
public interface IConnectionMatrix {
boolean isConnected(EnumFacing face);
}
@@ -1,13 +1,11 @@
package buildcraft.api.transport.pluggable;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
public interface IFacadePluggable {
Block getCurrentBlock();
IBlockState getCurrentState();
int getCurrentMetadata();
boolean isTransparent();
boolean isTransparent();
boolean isHollow();
boolean isHollow();
}
@@ -1,9 +1,9 @@
package buildcraft.api.transport.pluggable;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
import buildcraft.api.transport.IPipe;
public interface IPipePluggableDynamicRenderer {
void renderPluggable(IPipe pipe, ForgeDirection side, PipePluggable pipePluggable, double x, double y, double z);
void renderDynamicPluggable(IPipe pipe, EnumFacing side, PipePluggable pipePluggable, double x, double y, double z);
}
@@ -1,10 +1,10 @@
package buildcraft.api.transport.pluggable;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
import buildcraft.api.transport.IPipe;
public interface IPipePluggableItem {
PipePluggable createPipePluggable(IPipe pipe, ForgeDirection side, ItemStack stack);
PipePluggable createPipePluggable(IPipe pipe, EnumFacing side, ItemStack stack);
}
@@ -1,13 +0,0 @@
package buildcraft.api.transport.pluggable;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.api.core.render.ITextureStates;
import buildcraft.api.transport.IPipe;
public interface IPipePluggableRenderer {
void renderPluggable(RenderBlocks renderblocks, IPipe pipe, ForgeDirection side,
PipePluggable pipePluggable, ITextureStates blockStateMachine,
int renderPass, int x, int y, int z);
}
@@ -0,0 +1,9 @@
package buildcraft.api.transport.pluggable;
import net.minecraft.util.EnumFacing;
public interface IPipePluggableState {
IConnectionMatrix getPluggableConnections();
PipePluggable getPluggable(EnumFacing face);
}
@@ -0,0 +1,19 @@
package buildcraft.api.transport.pluggable;
import java.util.List;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.util.EnumFacing;
import buildcraft.api.transport.IPipe;
public interface IPipePluggableStaticRenderer {
List<BakedQuad> bakeCutout(IPipeRenderState render, IPipePluggableState pluggableState, IPipe pipe, PipePluggable pluggable, EnumFacing face);
/** Use this if you need to render in the translucent pass. */
public interface Translucent extends IPipePluggableStaticRenderer {
/** For performance return a list that is as small as possible */
List<BakedQuad> bakeTranslucent(IPipeRenderState render, IPipePluggableState pluggableState, IPipe pipe, PipePluggable pluggable,
EnumFacing face);
}
}
@@ -0,0 +1,5 @@
package buildcraft.api.transport.pluggable;
public interface IPipeRenderState {
IConnectionMatrix getPipeConnectionMatrix();
}
+34 -41
View File
@@ -1,67 +1,60 @@
/**
* Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
*
* The BuildCraft API is distributed under the terms of the MIT License.
* Please check the contents of the license, which should be located
* as "LICENSE.API" in the BuildCraft source code distribution.
*/
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
package buildcraft.api.transport.pluggable;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import buildcraft.api.core.INBTStoreable;
import buildcraft.api.core.ISerializable;
import buildcraft.api.transport.IPipeTile;
/**
* An IPipePluggable MUST have an empty constructor for client-side
* rendering!
*/
/** An IPipePluggable MUST have an empty constructor for client-side rendering! */
public abstract class PipePluggable implements INBTStoreable, ISerializable {
public abstract ItemStack[] getDropItems(IPipeTile pipe);
public abstract ItemStack[] getDropItems(IPipeTile pipe);
public void update(IPipeTile pipe, ForgeDirection direction) {
public void update(IPipeTile pipe, EnumFacing direction) {
}
}
public void onAttachedPipe(IPipeTile pipe, ForgeDirection direction) {
validate(pipe, direction);
}
public void onAttachedPipe(IPipeTile pipe, EnumFacing direction) {
validate(pipe, direction);
}
public void onDetachedPipe(IPipeTile pipe, ForgeDirection direction) {
invalidate();
}
public void onDetachedPipe(IPipeTile pipe, EnumFacing direction) {
invalidate();
}
public abstract boolean isBlocking(IPipeTile pipe, ForgeDirection direction);
public abstract boolean isBlocking(IPipeTile pipe, EnumFacing direction);
public void invalidate() {
public void invalidate() {
}
}
public void validate(IPipeTile pipe, ForgeDirection direction) {
public void validate(IPipeTile pipe, EnumFacing direction) {
}
}
public boolean isSolidOnSide(IPipeTile pipe, ForgeDirection direction) {
return false;
}
public boolean isSolidOnSide(IPipeTile pipe, EnumFacing direction) {
return false;
}
public abstract AxisAlignedBB getBoundingBox(ForgeDirection side);
public abstract AxisAlignedBB getBoundingBox(EnumFacing side);
@SideOnly(Side.CLIENT)
public abstract IPipePluggableRenderer getRenderer();
@SideOnly(Side.CLIENT)
public abstract IPipePluggableStaticRenderer getRenderer();
@SideOnly(Side.CLIENT)
public IPipePluggableDynamicRenderer getDynamicRenderer() {
return null;
}
@SideOnly(Side.CLIENT)
public IPipePluggableDynamicRenderer getDynamicRenderer() {
return null;
}
public boolean requiresRenderUpdate(PipePluggable old) {
return true;
}
public boolean requiresRenderUpdate(PipePluggable old) {
return true;
}
}
@@ -1,11 +1,11 @@
package cofh.api.energy;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
/**
* Implement this interface on TileEntities which should connect to energy transportation blocks. This is intended for blocks which generate energy but do not
* accept it; otherwise just use IEnergyHandler.
*
* <p>
* Note that {@link IEnergyHandler} is an extension of this.
*
* @author King Lemming
@@ -16,6 +16,6 @@ public interface IEnergyConnection {
/**
* Returns TRUE if the TileEntity can connect on a given side.
*/
boolean canConnectEnergy(ForgeDirection from);
boolean canConnectEnergy(EnumFacing facing);
}
}
@@ -0,0 +1,59 @@
package cofh.api.energy;
import net.minecraft.util.EnumFacing;
/**
* Implement this interface on Tile Entities which should handle energy, generally storing it in one or more internal {@link IEnergyStorage} objects.
* <p>
* A reference implementation is provided {@link TileEnergyHandler}.
*
* @author King Lemming
*
*/
public interface IEnergyHandler extends IEnergyProvider, IEnergyReceiver {
// merely a convenience interface (remove these methods in 1.8; provided here for back-compat via compiler doing things)
/**
* Add energy to an IEnergyReceiver, internal distribution is left entirely to the IEnergyReceiver.
*
* @param from
* Orientation the energy is received from.
* @param maxReceive
* Maximum amount of energy to receive.
* @param simulate
* If TRUE, the charge will only be simulated.
* @return Amount of energy that was (or would have been, if simulated) received.
*/
@Override
int receiveEnergy(EnumFacing facing, int maxReceive, boolean simulate);
/**
* Remove energy from an IEnergyProvider, internal distribution is left entirely to the IEnergyProvider.
*
* @param from
* Orientation the energy is extracted from.
* @param maxExtract
* Maximum amount of energy to extract.
* @param simulate
* If TRUE, the extraction will only be simulated.
* @return Amount of energy that was (or would have been, if simulated) extracted.
*/
@Override
int extractEnergy(EnumFacing facing, int maxExtract, boolean simulate);
/**
* Returns the amount of energy currently stored.
*/
@Override
int getEnergyStored(EnumFacing facing);
/**
* Returns the maximum amount of energy that can be stored.
*/
@Override
int getMaxEnergyStored(EnumFacing facing);
}
@@ -0,0 +1,39 @@
package cofh.api.energy;
import net.minecraft.util.EnumFacing;
/**
* Implement this interface on Tile Entities which should provide energy, generally storing it in one or more internal {@link IEnergyStorage} objects.
* <p>
* A reference implementation is provided {@link TileEnergyHandler}.
*
* @author King Lemming
*
*/
public interface IEnergyProvider extends IEnergyConnection {
/**
* Remove energy from an IEnergyProvider, internal distribution is left entirely to the IEnergyProvider.
*
* @param from
* Orientation the energy is extracted from.
* @param maxExtract
* Maximum amount of energy to extract.
* @param simulate
* If TRUE, the extraction will only be simulated.
* @return Amount of energy that was (or would have been, if simulated) extracted.
*/
int extractEnergy(EnumFacing facing, int maxExtract, boolean simulate);
/**
* Returns the amount of energy currently stored.
*/
int getEnergyStored(EnumFacing facing);
/**
* Returns the maximum amount of energy that can be stored.
*/
int getMaxEnergyStored(EnumFacing facing);
}
@@ -1,38 +1,39 @@
package cofh.api.energy;
import net.minecraftforge.common.util.ForgeDirection;
/**
* Implement this interface on Tile Entities which should receive energy, generally storing it in one or more internal {@link IEnergyStorage} objects.
* <p>
* A reference implementation is provided {@link TileEnergyHandler}.
*
* @author King Lemming
*
*/
public interface IEnergyReceiver extends IEnergyConnection {
/**
* Add energy to an IEnergyReceiver, internal distribution is left entirely to the IEnergyReceiver.
*
* @param from
* Orientation the energy is received from.
* @param maxReceive
* Maximum amount of energy to receive.
* @param simulate
* If TRUE, the charge will only be simulated.
* @return Amount of energy that was (or would have been, if simulated) received.
*/
int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate);
/**
* Returns the amount of energy currently stored.
*/
int getEnergyStored(ForgeDirection from);
/**
* Returns the maximum amount of energy that can be stored.
*/
int getMaxEnergyStored(ForgeDirection from);
}
package cofh.api.energy;
import net.minecraft.util.EnumFacing;
/**
* Implement this interface on Tile Entities which should receive energy, generally storing it in one or more internal {@link IEnergyStorage} objects.
* <p>
* A reference implementation is provided {@link TileEnergyHandler}.
*
* @author King Lemming
*
*/
public interface IEnergyReceiver extends IEnergyConnection {
/**
* Add energy to an IEnergyReceiver, internal distribution is left entirely to the IEnergyReceiver.
*
* @param from
* Orientation the energy is received from.
* @param maxReceive
* Maximum amount of energy to receive.
* @param simulate
* If TRUE, the charge will only be simulated.
* @return Amount of energy that was (or would have been, if simulated) received.
*/
int receiveEnergy(EnumFacing facing, int maxReceive, boolean simulate);
/**
* Returns the amount of energy currently stored.
*/
int getEnergyStored(EnumFacing facing);
/**
* Returns the maximum amount of energy that can be stored.
*/
int getMaxEnergyStored(EnumFacing facing);
}
@@ -1,19 +1,20 @@
package thaumcraft.api.crafting;
import net.minecraft.world.World;
/**
*
* @author Azanor
*
* Blocks that implement this interface act as infusion crafting stabilisers like candles and skulls
*
*/
public interface IInfusionStabiliser {
/**
* returns true if the block can stabilise things
*/
public boolean canStabaliseInfusion(World world, int x, int y, int z);
}
package thaumcraft.api.crafting;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
/**
*
* @author Azanor
*
* Blocks that implement this interface act as infusion crafting stabilisers like candles and skulls
*
*/
public interface IInfusionStabiliser {
/**
* returns true if the block can stabilise things
*/
public boolean canStabaliseInfusion(World world, BlockPos pos);
}
@@ -1,22 +1,22 @@
package thaumcraft.api;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
/**
*
* @author Azanor
*
* Equipped head slot items that extend this class will be able to perform most functions that
* goggles of revealing can apart from view nodes which is handled by IRevealer.
*
*/
public interface IGoggles {
/*
* If this method returns true things like block essentia contents will be shown.
*/
public boolean showIngamePopups(ItemStack itemstack, EntityLivingBase player);
}
package thaumcraft.api.items;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
/**
*
* @author Azanor
*
* Equipped or held items that extend this class will be able to perform most functions that
* goggles of revealing can apart from view nodes which is handled by IRevealer.
*
*/
public interface IGoggles {
/*
* If this method returns true things like block essentia contents will be shown.
*/
public boolean showIngamePopups(ItemStack itemstack, EntityLivingBase player);
}
@@ -1,22 +1,22 @@
package thaumcraft.api.nodes;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
/**
*
* @author Azanor
*
* Equipped head slot items that extend this class will make nodes visible in world.
*
*/
public interface IRevealer {
/*
* If this method returns true the nodes will be visible.
*/
public boolean showNodes(ItemStack itemstack, EntityLivingBase player);
}
package thaumcraft.api.items;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
/**
*
* @author Azanor
*
* Equipped or held items that extend this class will make nodes or related objects visible in world.
*
*/
public interface IRevealer {
/*
* If this method returns true the nodes will be visible.
*/
public boolean showNodes(ItemStack itemstack, EntityLivingBase player);
}
@@ -1,22 +1,22 @@
package thaumcraft.api;
import net.minecraft.item.ItemStack;
/**
*
* @author Azanor
*
* Armor or bauble slot items that implement this interface can provide runic shielding.
* Recharging, hardening, etc. is handled internally by thaumcraft.
*
*/
public interface IRunicArmor {
/**
* returns how much charge this item can provide. This is the base shielding value - any hardening is stored and calculated internally.
*/
public int getRunicCharge(ItemStack itemstack);
}
package thaumcraft.api.items;
import net.minecraft.item.ItemStack;
/**
*
* @author Azanor
*
* Armor or bauble slot items that implement this interface can provide runic shielding.
* Recharging, hardening, etc. is handled internally by thaumcraft.
*
*/
public interface IRunicArmor {
/**
* returns how much charge this item can provide. This is the base shielding value - any hardening is stored and calculated internally.
*/
public int getRunicCharge(ItemStack itemstack);
}
@@ -1,14 +1,14 @@
package thaumcraft.api;
/**
*
* @author Azanor
*
* Interface used to identify scribing tool items used in research table
*
*/
public interface IScribeTools {
}
package thaumcraft.api.items;
/**
*
* @author Azanor
*
* Interface used to identify scribing tool items used in research table
*
*/
public interface IScribeTools {
}
@@ -18,10 +18,17 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import net.minecraft.block.BlockCarpet;
import net.minecraft.block.BlockColored;
import net.minecraft.block.BlockStainedGlass;
import net.minecraft.block.BlockStainedGlassPane;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
@@ -56,52 +63,54 @@ import vazkii.botania.api.wiki.WikiHooks;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import cpw.mods.fml.common.Loader;
import net.minecraftforge.fml.common.Loader;
public final class BotaniaAPI {
private static List<LexiconCategory> categories = new ArrayList<LexiconCategory>();
private static List<LexiconEntry> allEntries = new ArrayList<LexiconEntry>();
private static List<LexiconCategory> categories = new ArrayList<>();
private static List<LexiconEntry> allEntries = new ArrayList<>();
public static Map<String, KnowledgeType> knowledgeTypes = new HashMap<String, KnowledgeType>();
public static Map<String, KnowledgeType> knowledgeTypes = new HashMap<>();
public static Map<String, Brew> brewMap = new LinkedHashMap<String, Brew>();
public static List<String> disposableBlocks = new ArrayList<String>();
public static List<String> semiDisposableBlocks = new ArrayList<String>();
public static List<RecipePetals> petalRecipes = new ArrayList<RecipePetals>();
public static List<RecipePureDaisy> pureDaisyRecipes = new ArrayList<RecipePureDaisy>();
public static List<RecipeManaInfusion> manaInfusionRecipes = new ArrayList<RecipeManaInfusion>();
public static List<RecipeRuneAltar> runeAltarRecipes = new ArrayList<RecipeRuneAltar>();
public static List<RecipeElvenTrade> elvenTradeRecipes = new ArrayList<RecipeElvenTrade>();
public static List<RecipeBrew> brewRecipes = new ArrayList<RecipeBrew>();
public static List<RecipeManaInfusion> miniFlowerRecipes = new ArrayList<RecipeManaInfusion>();
public static List<RecipePetals> petalRecipes = new ArrayList<>();
public static List<RecipePureDaisy> pureDaisyRecipes = new ArrayList<>();
public static List<RecipeManaInfusion> manaInfusionRecipes = new ArrayList<>();
public static List<RecipeRuneAltar> runeAltarRecipes = new ArrayList<>();
public static List<RecipeElvenTrade> elvenTradeRecipes = new ArrayList<>();
public static List<RecipeBrew> brewRecipes = new ArrayList<>();
public static List<RecipeManaInfusion> miniFlowerRecipes = new ArrayList<>();
private static BiMap<String, Class<? extends SubTileEntity>> subTiles = HashBiMap.<String, Class<? extends SubTileEntity>> create();
private static Map<Class<? extends SubTileEntity>, SubTileSignature> subTileSignatures = new HashMap<Class<? extends SubTileEntity>, SubTileSignature>();
private static Map<Class<? extends SubTileEntity>, SubTileSignature> subTileSignatures = new HashMap<>();
public static Set<String> subtilesForCreativeMenu = new LinkedHashSet();
public static Map<String, String> subTileMods = new HashMap<String, String>();
public static Map<String, String> subTileMods = new HashMap<>();
public static BiMap<String, String> miniFlowers = HashBiMap.<String, String> create();
public static Map<String, Integer> oreWeights = new HashMap<String, Integer>();
public static Map<String, Integer> oreWeightsNether = new HashMap<String, Integer>();
public static Map<String, Integer> oreWeights = new HashMap<>();
public static Map<String, Integer> oreWeightsNether = new HashMap<>();
public static Map<Item, Block> seeds = new HashMap();
public static Set<Item> looniumBlacklist = new LinkedHashSet<Item>();
public static Set<Block> paintableBlocks = new LinkedHashSet<Block>();
public static Set<String> magnetBlacklist = new LinkedHashSet<String>();
public static Set<Item> looniumBlacklist = new LinkedHashSet<>();
public static Map<Block, PropertyEnum<EnumDyeColor>> paintableBlocks = new LinkedHashMap<>();
public static Set<String> magnetBlacklist = new LinkedHashSet<>();
public static Set<Class<? extends Entity>> gravityRodBlacklist = new LinkedHashSet<Class<? extends Entity>>();
public static ArmorMaterial manasteelArmorMaterial = EnumHelper.addArmorMaterial("MANASTEEL", 16, new int[] { 2, 6, 5, 2 }, 18);
public static ArmorMaterial manasteelArmorMaterial = EnumHelper.addArmorMaterial("MANASTEEL", "manasteel", 16, new int[] { 2, 6, 5, 2 }, 18);
public static ToolMaterial manasteelToolMaterial = EnumHelper.addToolMaterial("MANASTEEL", 3, 300, 6.2F, 2F, 20);
public static ArmorMaterial elementiumArmorMaterial = EnumHelper.addArmorMaterial("B_ELEMENTIUM", 18, new int[] { 2, 6, 5, 2 }, 18);
public static ArmorMaterial elementiumArmorMaterial = EnumHelper.addArmorMaterial("B_ELEMENTIUM", "b_elementium", 18, new int[] { 2, 6, 5, 2 }, 18);
public static ToolMaterial elementiumToolMaterial = EnumHelper.addToolMaterial("B_ELEMENTIUM", 3, 720, 6.2F, 2F, 20);
public static ArmorMaterial terrasteelArmorMaterial = EnumHelper.addArmorMaterial("TERRASTEEL", 34, new int[] {3, 8, 6, 3}, 26);
public static ArmorMaterial terrasteelArmorMaterial = EnumHelper.addArmorMaterial("TERRASTEEL", "terrasteel", 34, new int[] {3, 8, 6, 3}, 26);
public static ToolMaterial terrasteelToolMaterial = EnumHelper.addToolMaterial("TERRASTEEL", 4, 2300, 9F, 3F, 26);
public static ArmorMaterial manaweaveArmorMaterial = EnumHelper.addArmorMaterial("MANAWEAVE", 5, new int[] { 1, 2, 2, 1 }, 18);
public static ArmorMaterial manaweaveArmorMaterial = EnumHelper.addArmorMaterial("MANAWEAVE", "manaweave", 5, new int[] { 1, 2, 2, 1 }, 18);
public static EnumRarity rarityRelic = EnumHelper.addRarity("RELIC", EnumChatFormatting.GOLD, "Relic");
@@ -236,21 +245,21 @@ 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);
registerPaintableBlock(Blocks.stained_glass_pane);
registerPaintableBlock(Blocks.stained_hardened_clay);
registerPaintableBlock(Blocks.wool);
registerPaintableBlock(Blocks.carpet);
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
registerDisposableBlock("cobblestone"); // Vanilla
registerDisposableBlock("netherrack"); // Vanilla
registerSemiDisposableBlock("stoneAndesite"); // Botania
registerSemiDisposableBlock("stoneBasalt"); // Botania
registerSemiDisposableBlock("stoneDiorite"); // Botania
registerSemiDisposableBlock("stoneGranite"); // Botania
registerSemiDisposableBlock("stoneAndesite"); // Vanilla
registerSemiDisposableBlock("stoneBasalt"); // Vanilla
registerSemiDisposableBlock("stoneDiorite"); // Vanilla
registerSemiDisposableBlock("stoneGranite"); // Vanilla
}
/**
@@ -307,9 +316,11 @@ public final class BotaniaAPI {
/**
* Registers a paintableBlock and returns it.
* You must also provide the PropertyEnum that this block uses to express its color
* The component type of the property must be EnumDyeColor
*/
public static Block registerPaintableBlock(Block paintable){
paintableBlocks.add(paintable);
public static Block registerPaintableBlock(Block paintable, PropertyEnum<EnumDyeColor> colorProp){
paintableBlocks.put(paintable, colorProp);
return paintable;
}
@@ -365,7 +376,11 @@ public final class BotaniaAPI {
String key = getMagnetKey(stack);
return magnetBlacklist.contains(key);
}
public static boolean isBlockBlacklistedFromMagnet(IBlockState state) {
return isBlockBlacklistedFromMagnet(state.getBlock(), state.getBlock().getMetaFromState(state));
}
public static boolean isBlockBlacklistedFromMagnet(Block block, int meta) {
return isBlockBlacklistedFromMagnet(block, meta, 0);
}
@@ -400,12 +415,11 @@ public final class BotaniaAPI {
/**
* Registers a Pure Daisy Recipe.
* @param input The block that works as an input for the recipe. Can be a Block or an oredict String.
* @param output The block to be placed upon recipe completion.
* @param outputMeta The metadata to be placed upon recipe completion.
* @param outputState The blockstate to be placed upon recipe completion.
* @return The recipe created.
*/
public static RecipePureDaisy registerPureDaisyRecipe(Object input, Block output, int outputMeta) {
RecipePureDaisy recipe = new RecipePureDaisy(input, output, outputMeta);
public static RecipePureDaisy registerPureDaisyRecipe(Object input, IBlockState outputState) {
RecipePureDaisy recipe = new RecipePureDaisy(input, outputState);
pureDaisyRecipes.add(recipe);
return recipe;
}
@@ -0,0 +1,98 @@
package vazkii.botania.api;
import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.LoaderState;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import vazkii.botania.api.subtile.SubTileEntity;
import vazkii.botania.api.item.IFloatingFlower;
import java.util.Collections;
import java.util.Map;
/**
* Class for API calls that must be made clientside
*/
@SideOnly(Side.CLIENT)
public final class BotaniaAPIClient {
private static final Map<String, ModelResourceLocation> subtileBlockModels = Maps.newHashMap();
private static final Map<String, ModelResourceLocation> subtileItemModels = Maps.newHashMap();
private static final Map<IFloatingFlower.IslandType, ModelResourceLocation> islandTypeModels = Maps.newHashMap();
/**
* Register your model for the given subtile class here.
* Call this DURING PREINIT. Calling it anytime after blockModels have already baked does not guarantee that your model will work.
* Your model json must specify key "tintindex" in all the faces it wants tint applied.
* Tint is applied whenever a player recolors the flower using floral dye
*
* @param subTileName The String ID of the subtile
* @param model A path to a blockstate json and variant to be used for this subtile
* @param itemModel A path to a blockstate json and variant to be used for this subtile's item form
*/
public static void registerSubtileModel(String subTileName, ModelResourceLocation model, ModelResourceLocation itemModel) {
Preconditions.checkState(Loader.instance().isInState(LoaderState.PREINITIALIZATION));
subtileBlockModels.put(subTileName, model);
subtileItemModels.put(subTileName, itemModel);
}
/**
* Register your model for the given subtile class here.
* Call this DURING PREINIT.
* Your model json must specify key "tintindex" in all the faces it wants tint applied.
* Tint is applied whenever a player recolors the flower using floral dye
*
* @param subTileName The String ID of the subtile
* @param model A path to a blockstate json and variant to be used the block. The item model will be drawn from the same blockstate json, from variant "inventory"
*/
public static void registerSubtileModel(String subTileName, ModelResourceLocation model) {
registerSubtileModel(subTileName, model, new ModelResourceLocation(model.getResourceDomain() + ":" + model.getResourcePath(), "inventory"));
}
// Convenience overloads for the above two calls
public static void registerSubtileModel(Class<? extends SubTileEntity> clazz, ModelResourceLocation model) {
registerSubtileModel(BotaniaAPI.getSubTileStringMapping(clazz), model);
}
public static void registerSubtileModel(Class<? extends SubTileEntity> clazz, ModelResourceLocation model, ModelResourceLocation itemModel) {
registerSubtileModel(BotaniaAPI.getSubTileStringMapping(clazz), model, itemModel);
}
/**
* @return An immutable and live view of the registered subtile block model map
*/
public static Map<String, ModelResourceLocation> getRegisteredSubtileBlockModels() {
return Collections.unmodifiableMap(subtileBlockModels);
}
/**
* @return An immutable and live view of the registered subtile item model map
*/
public static Map<String, ModelResourceLocation> getRegisteredSubtileItemModels() {
return Collections.unmodifiableMap(subtileItemModels);
}
/**
* Registers your model for island type islandType here.
* Call this DURING PREINIT.
* @param islandType The islandtype to register
* @param model The variant within a blockstate json to use as the islandtype's model
*/
public static void registerIslandTypeModel(IFloatingFlower.IslandType islandType, ModelResourceLocation model) {
Preconditions.checkState(Loader.instance().isInState(LoaderState.PREINITIALIZATION));
islandTypeModels.put(islandType, model);
}
/**
* @return An immutable and live view of the registered island type model map
*/
public static Map<IFloatingFlower.IslandType, ModelResourceLocation> getRegisteredIslandTypeModels() {
return Collections.unmodifiableMap(islandTypeModels);
}
private BotaniaAPIClient() {}
}
@@ -15,8 +15,8 @@ import java.awt.Rectangle;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.entity.boss.IBossDisplayData;
import net.minecraft.util.ResourceLocation;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
/**
* An extension of IBossDisplayData. This counts as a botania boss and as a normal
@@ -11,8 +11,8 @@
package vazkii.botania.api.boss;
import vazkii.botania.api.internal.ShaderCallback;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
/**
* A Botania boss whose HP bar makes use of shaders. Shaders
@@ -17,20 +17,23 @@ import java.util.Map;
import java.util.WeakHashMap;
import java.util.regex.Pattern;
import com.google.common.base.Predicates;
import net.minecraft.entity.Entity;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;
public final class CorporeaHelper {
private static final List<IInventory> empty = Collections.unmodifiableList(new ArrayList());
private static final WeakHashMap<List<ICorporeaSpark>, List<IInventory>> cachedNetworks = new WeakHashMap();
private static final List<ICorporeaAutoCompleteController> autoCompleteControllers = new ArrayList<ICorporeaAutoCompleteController>();
private static final List<ICorporeaAutoCompleteController> autoCompleteControllers = new ArrayList<>();
private static final Pattern patternControlCode = Pattern.compile("(?i)\\u00A7[0-9A-FK-OR]");
@@ -67,7 +70,7 @@ public final class CorporeaHelper {
if(network != null)
for(ICorporeaSpark otherSpark : network)
if(otherSpark != null) {
IInventory inv = otherSpark.getInventory();
IInventory inv = otherSpark.getSparkInventory();
if(inv != null)
inventories.add(inv);
}
@@ -237,31 +240,31 @@ public final class CorporeaHelper {
return null;
TileEntity tile = (TileEntity) inv;
return getSparkForBlock(tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord);
return getSparkForBlock(tile.getWorld(), tile.getPos());
}
/**
* Gets the spark attached to the block in the coords passed in. Note that the coords passed
* in are for the block that the spark will be on, not the coords of the spark itself.
*/
public static ICorporeaSpark getSparkForBlock(World world, int x, int y, int z) {
List<ICorporeaSpark> sparks = world.getEntitiesWithinAABB(ICorporeaSpark.class, AxisAlignedBB.getBoundingBox(x, y + 1, z, x + 1, y + 2, z + 1));
return sparks.isEmpty() ? null : sparks.get(0);
public static ICorporeaSpark getSparkForBlock(World world, BlockPos pos) {
List<Entity> sparks = world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(pos.up(), pos.add(1, 2, 1)), Predicates.instanceOf(ICorporeaSpark.class));
return sparks.isEmpty() ? null : ((ICorporeaSpark) sparks.get(0));
}
/**
* Gets if the block in the coords passed in has a spark attached. Note that the coords passed
* in are for the block that the spark will be on, not the coords of the spark itself.
*/
public static boolean doesBlockHaveSpark(World world, int x, int y, int z) {
return getSparkForBlock(world, x, y, z) != null;
public static boolean doesBlockHaveSpark(World world, BlockPos pos) {
return getSparkForBlock(world, pos) != null;
}
/**
* Gets if the slot passed in can be extracted from by a spark.
*/
public static boolean isValidSlot(IInventory inv, int slot) {
return !(inv instanceof ISidedInventory) || arrayHas(((ISidedInventory) inv).getAccessibleSlotsFromSide(ForgeDirection.UP.ordinal()), slot) && ((ISidedInventory) inv).canExtractItem(slot, inv.getStackInSlot(slot), ForgeDirection.UP.ordinal());
return !(inv instanceof ISidedInventory) || arrayHas(((ISidedInventory) inv).getSlotsForFace(EnumFacing.UP), slot) && ((ISidedInventory) inv).canExtractItem(slot, inv.getStackInSlot(slot), EnumFacing.UP);
}
/**
@@ -10,8 +10,8 @@
*/
package vazkii.botania.api.corporea;
import cpw.mods.fml.common.eventhandler.Cancelable;
import cpw.mods.fml.common.eventhandler.Event;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
/**
* Fired when a corporea request is initiated. Can be cancelled.
@@ -10,8 +10,8 @@
*/
package vazkii.botania.api.corporea;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
/**
* An interface for systems which may control if the item auto complete system should be active
@@ -38,7 +38,7 @@ public interface ICorporeaSpark {
/**
* Gets the inventory this spark is bound to, generally the one right below it.
*/
public IInventory getInventory();
public IInventory getSparkInventory();
/**
* Gets the list of sparks this spark is connected to, see registerConnections(). This list
Loaded 100 of 1709 files, more files were not shown because too many files have changed in this diff. Show more