Compare commits

...
442 Commits
Author SHA1 Message Date
mezz e2a49158f3 Update to 1.12 2017-08-06 19:41:48 -07:00
Nedelosk cb81d0ead4 Fix #246 Gene Database Issue 2017-08-04 22:12:08 +02:00
Nedelosk 21728bcab1 Add CraftTweaker Support for Extra Trees Machines 2017-08-04 21:21:52 +02:00
Nedelosk dbdb5478c2 Clean Up Flowers 2017-08-04 13:10:34 +02:00
Nedelosk 46c5b95d82 Remove FieldsAreNonnullByDefault Annotation from the api 2017-08-03 23:19:53 +02:00
Nedelosk e6547caacc Create Distillery and Fruit Press Recipe Api 2017-08-03 21:10:23 +02:00
Nedelosk f7b1805e95 Create Lumbermill Recipe Api 2017-08-03 19:54:47 +02:00
Nedelosk 123b47f038 Create Brewery Recipe Api 2017-08-03 19:09:40 +02:00
Nedelosk c96ab68f19 Fix Refresh Packet 2017-08-03 14:48:54 +02:00
Nedelosk 35d6304a96 Clean Up Biology Page 2017-08-02 18:22:47 +02:00
Nedelosk 8f69af62f8 Clean Up Fence Model 2017-08-02 16:50:31 +02:00
Nedelosk d2b14b6320 Fix #236 Extra Bees config incorrectly located and clean up honey combs 2017-08-02 16:36:49 +02:00
Nedelosk 65431e73d4 Clean Up Flower 2017-08-02 15:42:10 +02:00
Nedelosk fa4a5b0a17 Clean Up Flower TileEntity 2017-08-02 03:37:05 +02:00
Nedelosk 714ba830d7 Fix Analyst Window 2017-08-02 03:13:41 +02:00
Nedelosk ed3cfe12a1 Clean Up Analyst Window 2017-08-02 03:05:45 +02:00
Nedelosk d2a9e62cb2 Clean Up Mutation Page 2017-08-02 02:41:39 +02:00
Nedelosk cbfb25647a Clean Up Bee Effects 2017-08-02 01:39:55 +02:00
Nedelosk 6587200dd3 Fix NPE 2017-08-01 23:59:46 +02:00
Nedelosk b488570a5f Fix some Refactoring Fails 2017-08-01 23:37:26 +02:00
Nedelosk 40a1c94a86 Clean Up more Widget Code 2017-08-01 22:40:43 +02:00
Nedelosk 79c303b12d Fix Extra Trees error code 2017-08-01 17:03:32 +02:00
Nedelosk 065d795622 Refactoring some Gui Classes 2017-08-01 16:57:04 +02:00
Nedelosk 2b54db9342 Fix tolerance allele 2017-08-01 15:11:06 +02:00
Nedelosk 8f8e497f58 Clean Genesis Class 2017-08-01 14:32:41 +02:00
Nedelosk 34fda5ddd1 Clean Up More Gui Classes 2017-08-01 14:18:10 +02:00
Nedelosk ab1a2eeb89 Clean Up Point Code 2017-08-01 12:16:01 +02:00
Nedelosk 5c40de2eba Rename Widget some Methods 2017-08-01 12:08:46 +02:00
Nedelosk b0503fe523 Rename Widget some Methods 2017-08-01 00:43:43 +02:00
Nedelosk 3e3c9c30a4 Start Clean Up Gui 2017-08-01 00:37:15 +02:00
Nedelosk 1b338efca9 Fix machine fx rendering and add item cloning 2017-07-31 23:42:16 +02:00
Nedelosk ddc9764a23 Fix item rendering 2017-07-31 21:54:39 +02:00
Nedelosk f23e28deaf Fix Field Kit Animation 2017-07-31 20:32:12 +02:00
Nedelosk afb9a62686 Fix #235 Field Kit GUI missing 2017-07-31 20:09:58 +02:00
Nedelosk 79a49341e9 Fix Error States on Server 2017-07-31 16:36:57 +02:00
Nedelosk 5a93a3d0a9 Fix Extra Trees Machine Localisation 2017-07-31 16:05:52 +02:00
Nedelosk 2afb3c52f3 Improve Extra Trees Machine Localisation 2017-07-31 16:01:07 +02:00
Nedelosk cbe86e814f Fix #160 Ceramic Brick Block Meta 2017-07-31 13:32:58 +02:00
Nedelosk c5f2368e1d Move Botany Gardening Items 2017-07-31 12:27:36 +02:00
Nedelosk 7e4e518d7b Localise Analyst Title and Description 2017-07-31 12:14:16 +02:00
Nedelosk 21aa0c43a6 Clean Up Gui 2017-07-31 12:09:50 +02:00
Nedelosk 724c3d1fbd Fix item wrong lang key 2017-07-31 10:45:34 +02:00
Nedelosk 6c3d7d3bb0 Fix item rendering 2017-07-31 01:37:04 +02:00
Nedelosk afb9460ff9 Clean Up 2017-07-31 01:28:14 +02:00
Nedelosk 687c440c69 Change IAllele.getName() to IAllele.getAlleleName() 2017-07-30 23:40:19 +02:00
Nedelosk 1b722df37a More localisation 2017-07-30 23:34:07 +02:00
Nedelosk dcdf4b1cac Clean Up and Move some classes 2017-07-30 22:31:16 +02:00
Nedelosk 705581b9ac Fix #210 Database missed description 2017-07-30 22:04:25 +02:00
Nedelosk 2a451bc72e Fix item slot rendering 2017-07-30 21:01:59 +02:00
Nedelosk faf2b88ed8 Fix some bugs 2017-07-30 20:25:33 +02:00
Nedelosk fcef87b3da Fix #234 Analyst Eating Items 2017-07-30 19:58:20 +02:00
Nedelosk fcbbd06c63 Fix Mod Support and Fix #208 Added Tech Reborn Support 2017-07-30 19:17:54 +02:00
Nedelosk 1b3b452900 Refactoring bee species 2017-07-30 16:23:27 +02:00
Alexander Kornilov 0726954433 Feature/lang Simplify en_GB and add missing keys (#220) 2017-07-29 15:09:54 -07:00
Nedelosk 6ff11f4eea Fix jenkins link 2017-07-29 23:57:33 +02:00
Nedelosk 03eaa2510c Update README.md 2017-07-29 23:55:03 +02:00
Nedelosk a3103bce5e Update README.md 2017-07-29 23:44:46 +02:00
Nedelosk a9030ef60b Update README.md 2017-07-29 23:37:27 +02:00
Nedelosk 4062adee6c Fix possible NPE 2017-07-29 23:23:25 +02:00
Nedelosk 2ca2cef6a2 Merge remote-tracking branch 'origin/master-MC1.11.2' into master-MC1.11.2 2017-07-29 23:21:17 +02:00
Nedelosk 95dca83465 Fix #232 2017-07-29 23:21:02 +02:00
mezz f977a29ad6 Fix mcmod.info 2017-07-29 12:25:23 -07:00
Nedelosk 68ed8a1511 Fix #229 Game Crash from looking at wood in JEI 2017-07-29 21:07:41 +02:00
Nedelosk c9d3001b47 Merge remote-tracking branch 'origin/master-MC1.11.2' into master-MC1.11.2 2017-07-29 21:01:07 +02:00
Nedelosk 75c875868a Fix #230 Crash when opening a diamond compartment 2017-07-29 21:00:50 +02:00
mezz c51a9273f9 Fix gradle 2017-07-28 22:38:29 -07:00
mezz 4edd2e9d5d Update mcmodinfo 2017-07-28 22:11:49 -07:00
mezz bc310023df Fix version number in filename 2017-07-28 21:48:22 -07:00
mezz 703e99e916 Bump version for first 1.11.2 release 2017-07-28 21:47:08 -07:00
mezz f73667c173 Fix grade git changelog 2017-07-28 21:38:27 -07:00
mezz 0101eae8f8 Make gradlew executable 2017-07-28 20:56:54 -07:00
mezz 5be32a2a3a Set up gradle for jenkins and auto-upload to curse 2017-07-28 20:49:07 -07:00
Alexander Kornilov 3ff4957a10 Feature/code improve (#221)
* Code improvement for genetics.api
Code improvement for genetics.core
Fix missed localization for info of Lab Stand
* Code improvement for genetics.genetics package
2017-07-16 18:08:38 -07:00
Alexander Kornilov 9e1ec59b86 Feature/refactoring (#211)
* Some code improve readability for botany.ceramic package
* Code improvement for botany.core package
* Code improvement for botany.craftgui package
* Fixed TextJustification from all code files
* Code improvement for botany.farm package
* Code improvement for botany.flower
* Code improvement for root botany package
Code improvement for botany.network package
Code improvement for botany.proxypackage
* Code improvement for botany.gargdening package
Added missed localization for Soil Meter
* Code improvement for botany.genetic package
* Code improvement for botany.items package
* Removed "// TODO fix deprecated" comment
* Reformatted code by Forestry format settings
* Reformat code with new format settings
2017-07-15 12:27:20 -07:00
Alexander Kornilov 0aa9853da2 Feature/refactoring (#207)
* Fixed deprecated I18n usage
* Code improve readability for botany.api package
* Fix naming of templateAsGenome method params
2017-07-14 22:48:11 -07:00
mezz 96fe27e834 Cleanup 2017-07-13 23:35:09 -07:00
mezz 934bb3b8f9 Fix #162 Crash when hovering over drinks with AppleSkin and AppleCore 2017-07-13 23:25:53 -07:00
mezz 83d9da7797 Update gradle and dependencies 2017-07-13 23:11:57 -07:00
Nedelosk 1e0d11b1ac Merge branch 'master-MC1.11.2' of https://github.com/ForestryMC/Binnie into master-MC1.11.2 2017-07-10 00:48:04 +02:00
Nedelosk 808b04c3b8 More localisation 2017-07-10 00:47:53 +02:00
marcin212 2425ae959e Fixed recipe for Apiarist Database 2017-07-08 14:36:12 +02:00
marcin212 3679551882 Fixed SOF when machine has full inventory 2017-07-08 14:35:30 +02:00
marcin212 83fd00cad5 Fixed brewery recipes 2017-07-07 13:41:45 +02:00
marcin212 f3d93b47b9 Fixed shitf-click stack overflow #180 2017-07-07 12:34:32 +02:00
marcin212 62fc457808 Fixed second NPE in machines 2017-07-06 20:00:37 +02:00
marcin212 2811aabc2e Fixed NPE in machines 2017-07-06 15:04:19 +02:00
marcin212 8573f087eb Fixed blue/black background in machines GUI 2017-07-06 15:03:55 +02:00
marcin212 d0215ce0aa Color changed to hex 2017-07-06 15:00:40 +02:00
Nedelosk b6d5901f07 Star to rework Machine localisation 2017-06-28 19:10:09 +02:00
Nedelosk 18f30c8c0d Fix Farm Circuit Dictionary localisation 2017-06-28 16:07:19 +02:00
Nedelosk cf8634546c Fix Botany Dictionary localisation 2017-06-27 18:25:04 +02:00
Nedelosk 864e5e0dfc Add Botany Dictionary localisation 2017-06-27 17:42:13 +02:00
Nedelosk 6df4570bca Improve ceramic localization 2017-06-27 16:56:02 +02:00
Nedelosk e0d23ada41 Change colour to color 2017-06-27 16:35:15 +02:00
Nedelosk b7b663640d Improve insulated tube and color localization 2017-06-27 16:33:41 +02:00
Nedelosk 9989eef753 Improve flower localization 2017-06-27 16:01:25 +02:00
Nedelosk 941c377c58 Improve localization 2017-06-27 15:10:47 +02:00
Nedelosk be827a17a7 Moving gardening helper class to the api 2017-06-27 14:01:56 +02:00
Nedelosk beb1ba9ae1 Clean Up Soil and Plank Block 2017-06-27 13:22:32 +02:00
Nedelosk 709d80adc6 Fix #151 [1.11.2] Implement Hive Attack 2017-06-27 12:54:53 +02:00
Nedelosk 552a907d58 Fix #157 Using normal logs in the logs to planks recipe always produces fireproof planks 2017-06-26 18:56:39 +02:00
Nedelosk e0409c17ba Update Forestry and add village hope field 2017-06-26 14:52:52 +02:00
Nedelosk b1de19e1f1 Change the machine sink tier from 1 to 4 2017-06-25 14:06:16 +02:00
Nedelosk 09754111f0 Add hops as a grass seed 2017-06-25 01:50:40 +02:00
Nedelosk a7da3c5297 Fix machine particle texture 2017-06-24 15:48:29 +02:00
Nedelosk 866e8d0711 Fix #149 GUI scrollbar working differently 2017-06-24 15:22:29 +02:00
Nedelosk bbc87beb38 Improve Glass Fix #148, Fix #147 2017-06-24 15:08:59 +02:00
Nedelosk d0cb769a2b Update Forestry and Fix #143 2017-06-24 14:30:16 +02:00
Nedelosk d678903d68 Improve Extra Trees Wood Fix #144, Fix #145, Fix #146 2017-06-24 13:54:54 +02:00
Nedelosk 140df9ce4e Merge remote-tracking branch 'origin/master-MC1.11.2' into master-MC1.11.2 2017-06-24 01:50:51 +02:00
Nedelosk db2f4b7360 Add hops crop 2017-06-24 01:50:32 +02:00
marcin212 b9dfb8ee31 Fixed block alveary 2017-06-23 00:01:00 +02:00
marcin212 a408df86ed Fixed Alveary transmitter and lighting 2017-06-22 23:52:20 +02:00
Nedelosk 564f586c58 Fix #137 [1.11.2] Lumbermill keeps working when bark and sawdust slots full. 2017-06-21 20:27:04 +02:00
marcin212 05308e82c8 Added recipes for glassware 2017-06-21 12:01:51 +02:00
marcin212 e9d5c638c7 Fixed crash without IC2 2017-06-18 17:59:22 +02:00
Nedelosk a51bfd196c Add drink models 2017-06-18 02:24:56 +02:00
Nedelosk 81f632168b Add et wood doors 2017-06-17 13:42:07 +02:00
Nedelosk 6ec7808b25 Fix #115 Add a botanist backpack recipe and fix OreDictionary integration 2017-06-17 01:44:59 +02:00
Nedelosk f3770bf545 Add a botanist backpack Fix #115 2017-06-16 14:08:11 +02:00
marcin212 2a873e8bfb Merge branch 'master-MC1.11.2' of https://github.com/ForestryMC/Binnie into master-MC1.11.2
# Conflicts:
#	src/main/java/binnie/extrabees/worldgen/ExtraBeesWorldGenerator.java
#	src/main/java/binnie/extrabees/worldgen/WorldGenHiveNether.java
2017-06-16 12:49:49 +02:00
marcin212 6968ebed3f Added marble bees #36 2017-06-16 12:46:38 +02:00
Nedelosk 88c7daf024 Move drain input fluid from onFinishTask to onUpdate 2017-06-16 00:58:03 +02:00
Nedelosk e72bda24e3 Merge remote-tracking branch 'origin/master-MC1.11.2' into master-MC1.11.2 2017-06-16 00:55:12 +02:00
Nedelosk b3e514355b Fix #119 Infinity Alcohol crafting and some other brewery bugs 2017-06-16 00:54:46 +02:00
marcin212 c530745d8e Merge branch 'master-MC1.11.2' of https://github.com/ForestryMC/Binnie into master-MC1.11.2 2017-06-15 23:12:56 +02:00
marcin212 c30629eac4 Fixed ic2 mod id in optional method 2017-06-15 23:12:17 +02:00
Nedelosk 10e641506e Optimize imports 2017-06-15 23:11:48 +02:00
Nedelosk f1df70aeec Fix #98 Analyzer doesn't add researched data to the tracker. 2017-06-15 23:06:19 +02:00
marcin212 0d35e58106 Added flower farm harvesting logic #126 2017-06-15 22:44:50 +02:00
Nedelosk ae1168ea60 Fixed Compartment dupe bug 2017-06-15 22:41:54 +02:00
Nedelosk a91c578829 Add ic2 energy support back to power components 2017-06-15 22:26:30 +02:00
Nedelosk 7ac50de818 Add ic2 energy support back to IPoweredMachine 2017-06-15 22:18:50 +02:00
Nedelosk a61b6c9397 Add modelmanager back 2017-06-15 21:33:26 +02:00
Nedelosk 8ccb633925 Clean Up 2017-06-15 21:27:17 +02:00
Nedelosk 96a747518e Remove license header from IItemModelProvider 2017-06-15 21:16:59 +02:00
Nedelosk 31d0a03d3f Clean Up and fix some bugs 2017-06-15 21:15:09 +02:00
Nedelosk 21752a8b28 Update Forestry 2017-06-15 19:52:46 +02:00
Nedelosk ef371173c9 Make the honey crystal to a energy storage 2017-06-15 19:41:41 +02:00
Nedelosk d460bcab77 Clean Up ModuleItems and add two fluid names to ManagerLiquid 2017-06-15 17:08:13 +02:00
Nedelosk c5d0520299 Fix #23 Corn recipe yields barley grain 2017-06-15 16:45:32 +02:00
marcin212 bf40504ddf Fixed spawn fruit block 2017-06-14 15:20:26 +02:00
marcin212 e0ab7a89cc Removed null parameter 2017-06-14 15:18:09 +02:00
marcin212 24fd7e89d3 Updated Forge, Forestry and JEI 2017-06-14 12:59:26 +02:00
marcin212 287b1a5b10 Clean up 2017-06-14 12:58:32 +02:00
marcin212 81a2268e1d Fixed synchronization with container 2017-06-13 13:12:18 +02:00
marcin212 7ddd7d976e Fixed selecting distillery level 2017-06-13 11:36:52 +02:00
marcin212 d43d770024 Fixed drop of Corrosive bees 2017-06-11 20:35:11 +02:00
marcin212 876b214a97 Fixed leaves 2017-06-11 16:38:49 +02:00
marcin212 57eea26c1a Fixed creative Gene Database 2017-06-09 23:19:01 +02:00
marcin212 a5019da906 Merge branch 'master-MC1.11.2' of https://github.com/ForestryMC/Binnie into master-MC1.11.2 2017-06-09 21:08:39 +02:00
marcin212 0b3dbe6ef5 Fixed NPE caused by missing FlowerAlyzerPlugin 2017-06-09 21:07:45 +02:00
marcin212 c4db4fa664 Fixed missing textures for leaves 2017-06-09 20:43:53 +02:00
marcin212 99cef245d0 Fix flower rendering after reconnect. 2017-06-08 12:04:31 +02:00
marcin212 97a2b939cf Fixed flower tooltip formatting 2017-06-08 11:51:32 +02:00
marcin212 3ebb628a56 Fixed Fluid duplication in Incubator #103 2017-06-08 11:08:33 +02:00
marcin212 0c64d703d8 Fixed garden logic crash 2017-06-07 21:03:40 +02:00
marcin212 852c9a9a3e Fixed Player inventory in Gene Bank 2017-06-07 17:57:48 +02:00
marcin212 87ac2c18a3 Fixed rendering in MasterRegistry 2017-06-07 16:22:54 +02:00
marcin212 3aa8fb19c7 Added Nonnull 2017-06-07 16:22:19 +02:00
marcin212 ab03f3f734 Fixed Crash when placing flower on soil #104 2017-06-07 15:38:05 +02:00
marcin212 9fb03893b2 Fixed wrong import 2017-06-05 23:50:28 +02:00
marcin212 e6b087319c Fixed #101 TileEntityMachine has throw an exception trying to write state. 2017-06-05 23:19:21 +02:00
marcin212 aa567e190e remove unsed import 2017-06-05 21:57:04 +02:00
marcin212 6907f4159e Fixed incubator recipes 2017-06-05 21:56:47 +02:00
marcin212 dc2c63c856 Fixed Inoculator don't need Bacteria Vector to process #66 2017-06-05 21:06:30 +02:00
marcin212 dde90817d7 Fixed progress texture for Acclimatiser 2017-06-05 20:44:43 +02:00
marcin212 559ab4176d Fixed wrong texture in WindowPolymeriser 2017-06-05 20:21:11 +02:00
marcin212 5f234cc94e Fixed IndexOutOfBoundsException when crafting in 2x2 grid 2017-06-05 20:07:07 +02:00
marcin212 3936c0d377 Removed unused imports 2017-06-05 19:50:15 +02:00
marcin212 9fae7c1866 Fixed Sequencer progress control 2017-06-05 19:44:54 +02:00
marcin212 814b717aaf Fixed crash caused by opening Registry 2017-06-05 19:41:52 +02:00
marcin212 314e632e47 Fixed rotating block design 2017-06-05 19:39:56 +02:00
marcin212 e1fbb78c8a Fixed world generating lag 2017-06-05 19:38:45 +02:00
marcin212 f85e312c1a Fixed wooden tile kicks player from server when placing #90 2017-06-05 19:37:24 +02:00
marcin212 f4903fc1bc Fixed hives drop #97 2017-06-05 01:09:16 +02:00
marcin212 248a07e311 Fixed color of bees 2017-06-05 01:08:29 +02:00
marcin212 8f0bdf698a Fixed #98 2017-06-05 00:22:32 +02:00
marcin212 218e1c6f8c Fixed #89 2017-06-04 23:38:07 +02:00
marcin212 14bedffe0e Fixed NPE 2017-06-04 23:37:45 +02:00
marcin212 b772f7c305 Fixed lumbermill crash 2017-06-04 22:47:56 +02:00
marcin212 c8be69796f Fixed #99 2017-06-04 22:44:07 +02:00
marcin212 41bf3bfdbb Fixed some missing textures 2017-06-04 22:01:43 +02:00
Nedelosk 7a8dfc3012 Update forestry version 2017-06-04 00:45:36 +02:00
marcin212 04706d12c8 Fix bee mutations 2017-06-03 19:24:15 +02:00
marcin212 34d57cda35 Fix problem in PlankType with "getName", which conflicts during obfuscation. 2017-06-03 18:50:39 +02:00
marcin212 6c3eaca546 Remove unused imports 2017-06-03 18:14:13 +02:00
marcin212 05648ce05a Fix problem in EnumFlowerColor with "getName", which conflicts during obfuscation. 2017-06-03 18:11:05 +02:00
marcin212 b59f541a10 Fix extrabees dependencies 2017-06-03 17:49:00 +02:00
Alexander Kornilov 966f4e0693 Fix build script (#83)
* Fix build.gradlew
Added README.md

* Fix

* Fix build.gradle and README.md
2017-06-01 00:48:31 -07:00
Alexander Kornilov c3809fbc27 Some reformat code for 1.11.2 source (#84)
* Optimized imports

* Some code reformat

* Some refactoring and code reformat

* Some code reformat
2017-06-01 00:48:08 -07:00
Elec332 886c36a308 Fixed last dependancies on one another 2017-05-14 21:14:21 +02:00
Elec332 0630d0e0f1 Added item filters for alveary parts & added recipes for alveary parts 2017-05-14 20:48:17 +02:00
Elec332 2dac035df0 Separation basically done 2017-05-13 22:25:42 +02:00
Elec332 b7da877963 Moved punnett square and apiarist database to the genetics mod 2017-05-13 18:42:38 +02:00
Elec332 34a9a90ab3 Fixed textures, split the alveary stuff, onlt GUI left to do! 2017-05-13 17:10:55 +02:00
Elec332 a5e27bfd47 Only the client and apiary packages left to do! 2017-05-13 11:59:49 +02:00
Elec332 60607354dd Split the proxy from the rest 2017-05-12 21:57:54 +02:00
Elec332 2c45413a6b Fixes and more ExtraBees unhooking stuff 2017-05-12 20:49:12 +02:00
Elec332 1828ad9f3b Packages done: worldgen, utils, items, init, genetics & blocks. Now on to the hard part... 2017-05-12 18:13:06 +02:00
Elec332 a1aa3661d5 Unhook mutation & species classes 2017-05-12 17:25:44 +02:00
Elec332 b12d19c9ea More work on splitting ExtraBees 2017-05-12 16:02:25 +02:00
Elec332 ac05f9013a Started on splitting ExtraBees 2017-05-12 12:32:53 +02:00
mezz 601e20fe99 Move the strange block-scope class SpeciesList which was breaking S2S
See https://github.com/MinecraftForge/Srg2Source/issues/18
2017-05-09 23:14:18 -07:00
mezz 9e47e018cf Add .travis.yml 2017-05-09 14:22:29 -07:00
mezz a97f5a2baa SideOnly fixes 2017-04-19 01:57:44 -07:00
mezz 14c107ab71 Minor cleanup and fixes 2017-04-19 01:57:02 -07:00
mezz 3bb678258f Clean up some null annotations 2017-04-19 00:52:10 -07:00
mezz cc20e2d339 Clean up some parameter names 2017-04-19 00:15:55 -07:00
Nedelosk f5e52163b4 Clean Up 2017-04-12 15:59:06 +02:00
Nedelosk d3b2c99c60 Some todos 2017-04-12 15:46:47 +02:00
marcin212 fd0783afee Fix effect: Power 2017-04-12 13:14:54 +02:00
marcin212 319bf4ea2c Fix item rotation in GUI 2017-04-12 13:07:14 +02:00
Nedelosk d1306b174c Fix Size MultiFenceRecipe 2017-04-11 23:02:01 +02:00
Nedelosk aa1e797cf7 Remove Unused Stuff 2017-04-11 17:51:42 +02:00
Nedelosk 8ba9d8609b Add MultiFenceRecipe Jei Registry Plugin 2017-04-11 17:50:41 +02:00
Nedelosk 7964e56c77 Remove Gooseberry from world gen 2017-04-11 01:29:55 +02:00
Nedelosk 6d54f6a8a8 Imrpove ShrubLog 2017-04-11 01:18:32 +02:00
Nedelosk 498fe87e49 Work on Tree generation and add shrubs to world gen 2017-04-11 01:04:19 +02:00
Nedelosk 9fe3d8bbf1 Fix Ceramic Model 2017-04-10 21:24:36 +02:00
Nedelosk 4202534e1f Fix MultiFence Model 2017-04-10 21:17:35 +02:00
Nedelosk c5c76f4009 Cache MultiFence Models 2017-04-10 21:01:13 +02:00
Nedelosk 3124c00152 Fix MultiFence Name 2017-04-10 20:49:10 +02:00
Nedelosk bb9427367d Remove old ETFenceGate class 2017-04-10 20:19:22 +02:00
Nedelosk 36c0409e5a Clean Up Multi Fences 2017-04-10 20:15:51 +02:00
Nedelosk f1640ff21b Work on MultiFence 2017-04-10 19:19:19 +02:00
Nedelosk c949131976 Clean Up and remove BlockFence 2017-04-10 16:27:04 +02:00
Nedelosk fa67089c77 Remove model text gui 2017-04-10 15:59:55 +02:00
Nedelosk a17d9015c1 Rename ModelBaker, fix uv and add multifence model 2017-04-10 15:56:56 +02:00
Nedelosk 892dee2eb0 Add .name to fluid keys 2017-04-10 13:20:07 +02:00
Nedelosk c980cf68b1 Add extra bees fluid names 2017-04-10 13:13:14 +02:00
Nedelosk b84e29a3f0 Fix some names 2017-04-10 13:06:19 +02:00
Nedelosk 12ade3a559 Clean Up Bee Mutations 2017-04-10 12:28:25 +02:00
Nedelosk 2faa08c1b6 Clean Up 2017-04-10 11:53:54 +02:00
Nedelosk 11b8fce668 Clean Up Butterflies 2017-04-10 11:52:02 +02:00
Nedelosk 1626b6ec03 Make shrub logs flammable 2017-04-10 02:20:04 +02:00
Nedelosk 1cbf2ad892 Add Fruit pods and update forestry version 2017-04-10 01:52:17 +02:00
Nedelosk c90b134ded Add butterfly item textures 2017-04-09 23:01:31 +02:00
Nedelosk 72567d3706 Improve shrub log 2017-04-09 21:56:33 +02:00
Nedelosk 3919edcc3e Add tiny shrub log 2017-04-09 21:26:40 +02:00
Nedelosk 11c40fa158 Clean Up and fix missing fruit sprites 2017-04-09 14:33:31 +02:00
Nedelosk b044244dc6 Move craftgui to binnie core 2017-04-09 01:58:51 +02:00
mezz 1ea33829b3 Update JEI integration 2017-04-04 03:26:39 -07:00
mezz 79af0241e8 Remove SimpleRecipeHandler (unused now) 2017-04-03 18:05:40 -07:00
mezz c6ee1184ff Update JEI integration 2017-04-03 18:04:31 -07:00
mezz 2c277cc311 Update Forestry integration 2017-04-03 18:03:54 -07:00
mezz d3dd0467d9 update required Forge version 2017-03-23 18:11:13 -07:00
mezz a0843d9523 More sideonly cleanup 2017-03-23 18:10:55 -07:00
Nedelosk 475f4b63da Start to clean up Analyst Gui 2017-03-23 15:32:55 +01:00
Nedelosk 044a8a1984 Clean up Genetics Mod 2017-03-22 17:17:12 +01:00
Nedelosk e88822fb3d Add color to serums 2017-03-22 16:35:38 +01:00
Nedelosk 14deee0df7 Clean up some Items 2017-03-22 16:21:29 +01:00
Nedelosk 8f77efae6e Start to clean up tree generation 2017-03-21 15:50:03 +01:00
Nedelosk c93a79887f Clean Up and move guis 2017-03-20 21:21:17 +01:00
Nedelosk 490feb915f Clean Up 2017-03-18 22:58:25 +01:00
Nedelosk 4825f402fc Fix PanelModelBaker 2017-02-18 18:52:19 +01:00
mezz cce3b7b901 Auto-format fix imports, tabs/spaces 2017-02-12 00:09:28 -08:00
mezz 5816af57bc Add tooltips to frames to show what each does 2017-02-12 00:01:53 -08:00
mezz bdcefcb5be Fix some gui crashes 2017-02-11 23:51:03 -08:00
mezz 5ecfb694c5 Fix mutation multiplier and add gui mutation tooltip to accepted items 2017-02-09 23:00:32 -08:00
mezz e851fb5bc8 Use Forge tooltips where possible 2017-02-09 22:59:51 -08:00
mezz 8654b9d054 Fix crashes on the Debug map 2017-02-09 22:17:22 -08:00
mezz 93419395c3 Fix JEI integration crash 2017-02-09 21:58:45 -08:00
mezz 4936316ef3 Fix render crash with ceramic bricks 2017-02-09 21:58:31 -08:00
mezz fef0b7ede9 Fix assets to use lowercase for 1.11 2017-02-09 21:58:01 -08:00
mezz 2423adae4c Resolve more client/server sided issues
using Minecraft Development for IntelliJ IDEA plugin.
https://plugins.jetbrains.com/idea/plugin/8327-minecraft-development
2017-02-09 20:13:10 -08:00
mezz b8acba968e Fix many server crashes from client-side code 2017-02-09 02:27:31 -08:00
mezz f660f213f6 Updates for 1.11. Running but missing textures. 2017-02-09 01:41:06 -08:00
mezz 424fdaaf48 Begin 1.11 (compiles, does not run yet) 2017-02-08 00:52:37 -08:00
mezz 5310003659 Fix fruit press interface 2017-02-07 18:34:40 -08:00
mezz e38b8531da Improve tooltips and information for insulated electron tubes 2017-02-07 17:54:26 -08:00
mezz a5daa93bf1 More null annotations 2017-02-07 00:05:24 -08:00
mezz da8a833485 More null annotations 2017-02-06 01:34:48 -08:00
mezz 16b955b443 Begin adding stricter null annotations to prepare for 1.11 2017-02-05 23:47:40 -08:00
Nedelosk 4140ba7d7f Fix block carpentry panel 2017-01-27 20:15:44 +01:00
Chocohead 23ed2dcaea Generics for everyone \o/ 2017-01-26 18:18:14 +00:00
Chocohead ac9344cbda Add back planks to arborist's database 2017-01-26 17:46:47 +00:00
Nedelosk ce5232841a Improve Fluid Containers 2017-01-25 22:13:28 +01:00
Nedelosk f35f247cb4 Clean Up 2017-01-25 20:58:37 +01:00
Nedelosk 923d3791cd Fix fluid containers 2017-01-25 20:58:11 +01:00
Nedelosk cdea827464 Clean Up BinnieSprite 2017-01-25 20:57:52 +01:00
Nedelosk 58c36b3c92 Clean Up 2017-01-25 15:05:17 +01:00
Nedelosk 49d80c847e Move some craftguis 2017-01-25 15:01:41 +01:00
Nedelosk fff40b966d Add more models 2017-01-25 13:35:12 +01:00
mezz 6f42dfdef9 Fix Distillery 2017-01-24 23:28:30 -08:00
mezz f9dc27a063 Fix uses of liquid containers 2017-01-24 23:15:52 -08:00
mezz fd77975c6e Fix item rendering in inventories 2017-01-24 21:56:56 -08:00
mezz 460a7db190 Move static rendering methods to RenderUtil 2017-01-24 21:36:55 -08:00
mezz 9c4b081f6d Use GlStateManager 2017-01-24 21:18:28 -08:00
mezz 31a305ffc2 Gui rendering cleanup 2017-01-24 20:53:27 -08:00
mezz 17f036522e Fix compilation problems 2017-01-24 16:01:26 -08:00
Nedelosk 1a3b8fae21 Clean Up 2017-01-24 22:05:32 +01:00
Nedelosk 172afd0574 Fix design blocks 2017-01-24 21:44:39 +01:00
Nedelosk 7666e96542 Clean Up extra tree modules and add wood fences and fence gates 2017-01-24 18:41:35 +01:00
mezz 1276bd4b18 Fix some TODOs 2017-01-24 01:47:00 -08:00
mezz 7c048de845 Stop suppressing exceptions that may be important 2017-01-24 01:19:28 -08:00
mezz 163abc377e Remove unused machine types from alveary blockstate json 2017-01-24 00:44:25 -08:00
mezz 89edfaa7c7 Remove ItemParser 2017-01-23 23:40:13 -08:00
mezz 159dc804a2 Improve Brewery JEI representation 2017-01-23 22:19:24 -08:00
mezz d0dffe7edd Fix the brewery not consuming input items 2017-01-23 22:18:55 -08:00
mezz 2d459dd953 Complete the implementation of ComponentInventorySlots 2017-01-23 22:17:17 -08:00
mezz aede7bf7ec Fix IDesignMaterials not compiling 2017-01-23 14:46:59 -08:00
Nedelosk 9fcdc34b5a Fix wood blocks 2017-01-23 21:00:17 +01:00
Nedelosk 9ba257dec5 Merge branch 'master-MC1.10.2' of https://github.com/ForestryMC/Binnie into master-MC1.10.2 2017-01-23 15:49:21 +01:00
Nedelosk 87cf7386c6 Improve fluid rendering 2017-01-23 15:44:46 +01:00
mezz b79b279a17 Add Distilling JEI recipes 2017-01-23 01:34:30 -08:00
mezz 1d96c9d349 Refactor Distillery 2017-01-22 23:52:15 -08:00
mezz e5f01e82a2 Add Brewing JEI recipes 2017-01-22 22:24:01 -08:00
mezz 25a2752907 Fix concurrent modification exceptions from networking 2017-01-22 22:23:27 -08:00
mezz c195cfaa19 Fix concurrent modification exceptions from networking 2017-01-22 22:21:25 -08:00
mezz 427f030110 Refactor Brewing Recipes 2017-01-22 21:51:59 -08:00
Nedelosk f0d8d6b89d Work on extra trees 2017-01-22 10:36:25 +01:00
Nedelosk 192943cb3e Add decorative leaves and food models 2017-01-21 15:57:39 +01:00
mezz 31d7d6e76e Add Fruit Press JEI recipes 2017-01-21 00:28:28 -08:00
mezz b6f91fe870 Add Lumbermill JEI recipes 2017-01-20 23:42:29 -08:00
Nedelosk 88ad994a8c Update Forestry Version 2017-01-20 16:48:11 +01:00
mezz aa8ff6556b Add Genetic Database JEI recipes 2017-01-19 23:12:00 -08:00
mezz 0f716a0a16 Add Genepool JEI recipes 2017-01-19 22:15:25 -08:00
mezz 3530a0e9df Add Splicer JEI recipes, improve Inoculator JEI recipes 2017-01-19 19:34:31 -08:00
Nedelosk a990ce3dc9 Improve wood blocks 2017-01-19 23:54:13 +01:00
Nedelosk 3ed915f9d5 Fix soil item model and start to move craftgui 2017-01-15 18:41:45 +01:00
Nedelosk de2dc3dabb Update jei and improve other things 2017-01-15 18:07:05 +01:00
Nedelosk 3059231363 Update Forestry Version 2017-01-15 14:33:09 +01:00
Nedelosk 154839594d Fix fluid container models 2017-01-15 00:46:39 +01:00
Nedelosk c7635db7e8 Clean Up and fluid texture fix 2017-01-14 23:56:44 +01:00
mezz 41e847b944 Add Inoculator JEI recipes 2017-01-03 03:16:55 -08:00
mezz 125cd54b66 Update Forestry version 2017-01-03 00:25:27 -08:00
Nedelosk 56f2be5817 Merge pull request #6 from RossRKK/master-MC1.10.2
Added proven and scented gears to the oredictionary
2016-12-04 19:03:48 +01:00
Ross Kelso e93934fdf8 Removed an import
This was accidentally moved over when I copied the line of code
2016-12-04 02:10:23 +00:00
Ross Kelso 1ad0dcc0ae Added proven and scented gears to the oredictionary 2016-12-04 01:52:35 +00:00
marcin212 cee31027e6 Work on items from wood - part 2 2016-11-04 00:54:45 +01:00
marcin212 38c1aa5b4b Fix planks textures and add banana planks 2016-11-03 17:00:14 +01:00
Nedelosk bebb663768 Improve default statemapper 2016-11-01 16:52:41 +01:00
Nedelosk f288984833 Merge branch 'master-MC1.10.2' of https://github.com/ForestryMC/Binnie into master-MC1.10.2 2016-11-01 16:48:14 +01:00
Nedelosk 9e68539431 Start to work on ceramic blocks 2016-11-01 16:48:01 +01:00
marcin212 a903d57103 Work on items from wood 2016-11-01 02:39:35 +01:00
marcin212 8c9cd7c202 Merge branch 'master-MC1.10.2' of https://github.com/ForestryMC/Binnie into master-MC1.10.2
# Conflicts:
#	src/main/java/binnie/extratrees/genetics/ExtraTreeSpecies.java
#	src/main/java/binnie/extratrees/genetics/ModuleGenetics.java
2016-10-31 21:11:27 +01:00
marcin212 8e14eb81a1 Rewrite ExtraTreeSpecies class 2016-10-31 21:03:38 +01:00
mezz 4b6e3e5424 Fix cast warning 2016-10-30 21:57:40 -07:00
mezz 61f7878acc Cleanup 2016-10-30 21:34:53 -07:00
mezz 307374ca2b improve null checks for Mods.java 2016-10-30 20:56:24 -07:00
mezz 975309598a Auto-fix formatting 2016-10-30 20:56:03 -07:00
mezz 697ccabf53 Fix several broken ItemStacks and recipes 2016-10-30 19:24:46 -07:00
marcin212 775b4109a9 Merge branch 'master-MC1.10.2' of https://github.com/ForestryMC/Binnie into master-MC1.10.2 2016-10-31 00:25:42 +01:00
marcin212 977d295680 Remove unused classes 2016-10-31 00:24:45 +01:00
Nedelosk 21db702ee7 Fix GUIs do not always update their displayed items #4 2016-10-30 22:30:33 +01:00
Nedelosk cef5f4963f Work on GardenLogic and localize the tubes 2016-10-30 18:59:39 +01:00
Nedelosk 1cd3dc1ac8 Update Forestry Version 2016-10-30 13:54:12 +01:00
mezz ef722ec0d0 Update Forestry, JEI, Forge version 2016-10-29 18:37:01 -07:00
mezz c40cdb281f Add Sequencer JEI recipes 2016-10-29 01:20:39 -07:00
mezz 7c37c3f126 Add Polymeriser JEI recipes 2016-10-29 00:17:04 -07:00
mezz f082500fc0 Add Isolator JEI recipes 2016-10-28 21:47:06 -07:00
mezz b6191ab4b0 Fix DefaultTankContainer 2016-10-28 18:58:14 -07:00
Nedelosk 91933a738b Adding Fluid and Item Capability to the machine tile entity 2016-10-28 14:11:28 +02:00
Nedelosk d77daf41d0 Localise three analyst pages and fix analyser 2016-10-28 13:31:40 +02:00
Nedelosk 489ce3dece Clean Up Machines: Genetic 2016-10-28 12:43:12 +02:00
Nedelosk 154207f60f Clean Up 2016-10-28 02:20:36 +02:00
Nedelosk 84d8ad9144 Clean up Acclimatiser 2016-10-28 00:22:46 +02:00
Nedelosk 6b7b6480c0 Start to clean up machines 2016-10-28 00:01:33 +02:00
Nedelosk 3bf37f8838 Work on things 2016-10-27 16:05:15 +02:00
mezz 5bb4b5d9a5 Auto-format spaces to tabs (#2) 2016-10-27 02:49:49 -07:00
mezz 25be7fd254 Complete JEI integration of the Incubator 2016-10-27 02:42:11 -07:00
mezz 49542b0851 Minor cleanup 2016-10-27 02:41:42 -07:00
marcin212 09fa488cff Merge branch 'master-MC1.10.2' of https://github.com/ForestryMC/Binnie into master-MC1.10.2 2016-10-27 05:21:18 +02:00
marcin212 c201768ffa Fix sapling rendering 2016-10-27 05:20:23 +02:00
marcin212 c91a0c601f Fix textures of leaves and remove redundant enum (replace LeafType to EnumLeafType from Forestry) 2016-10-27 05:16:43 +02:00
Nedelosk ccb718b84d Fix Flower Mutation Registration 2016-10-27 01:34:14 +02:00
Nedelosk 5b4d490e94 Remove unused classes 2016-10-27 01:13:55 +02:00
Nedelosk 1982cbc615 Clean Up 2016-10-27 01:12:43 +02:00
Nedelosk b356c65a73 Register Fluid Textures 2016-10-27 01:09:37 +02:00
Nedelosk d7b5954d42 Clean Up 2016-10-27 00:01:23 +02:00
Nedelosk fe1c8b77c9 Remove unused ore dicts 2016-10-27 00:00:08 +02:00
Nedelosk 8a103a72cc Remove Unused Encylopedia 2016-10-26 23:59:04 +02:00
Nedelosk 5927258a90 Improve Soil 2016-10-26 23:44:47 +02:00
Nedelosk a300bc0a11 Adding database and soil localisation 2016-10-26 23:23:47 +02:00
Nedelosk 7e9a87f08b Remove Log 2016-10-26 22:15:47 +02:00
Nedelosk 2c8285651f Adding Flower localisation and Clean Up 2016-10-26 22:10:55 +02:00
Nedelosk df17dccad7 Add Flower Item Models and Flower Double Models 2016-10-26 22:01:13 +02:00
Nedelosk fb732b9398 Adding more flower models 2016-10-26 16:24:17 +02:00
Nedelosk 2a23e60cdb Adding flower blockstate and blockstatemapper 2016-10-26 01:32:05 +02:00
Nedelosk 5a64454906 Clean Up and localise flower tooltip 2016-10-25 19:07:29 +02:00
Nedelosk d706224e56 Clean Up Botany Mod Class 2016-10-25 18:39:41 +02:00
Nedelosk f993d0571d Merge branch 'master-MC1.10.2' of https://github.com/ForestryMC/Binnie into master-MC1.10.2 2016-10-25 18:14:30 +02:00
Nedelosk 7dba116937 Working on Flower Models and Update Forestry 2016-10-25 18:08:12 +02:00
Elec332 0f67d73b30 Cleanup main mod classes, ran import optimiser 2016-10-25 15:13:44 +02:00
marcin212 bedfd6e402 Fix sprite color in Butterfly module 2016-10-25 02:28:09 +02:00
marcin212 d4519ffee6 Add JEIBees for debugging 2016-10-25 02:23:46 +02:00
marcin212 5171e33764 Merge branch 'master-MC1.10.2' of https://github.com/ForestryMC/Binnie into master-MC1.10.2 2016-10-25 00:42:37 +02:00
marcin212 e00101e0c0 Fix missing GUI icons 2016-10-25 00:42:29 +02:00
Nedelosk 9e31a19f34 Merge branch 'master-MC1.10.2' of https://github.com/ForestryMC/Binnie into master-MC1.10.2 2016-10-25 00:28:35 +02:00
Nedelosk 7ce53b0c23 Working on Ceramic and other Botany things 2016-10-25 00:28:26 +02:00
marcin212 62a4efaa53 Merge branch 'master-MC1.10.2' of https://github.com/ForestryMC/Binnie into master-MC1.10.2 2016-10-25 00:01:04 +02:00
marcin212 6801529ca5 Working on module apiary 2016-10-25 00:00:47 +02:00
Nedelosk f814808f20 Working on Ceramic 2016-10-24 23:27:17 +02:00
Nedelosk 9884a13c6e Merge branch 'master-MC1.10.2' of https://github.com/ForestryMC/Binnie into master-MC1.10.2 2016-10-24 21:58:05 +02:00
Nedelosk 57494b1f81 Working on Gardening 2016-10-24 21:57:50 +02:00
marcin212 3a0c551668 Add ItemGenesis model 2016-10-24 21:56:35 +02:00
marcin212 9d5144ddea Merge branch 'master-MC1.10.2' of https://github.com/ForestryMC/Binnie into master-MC1.10.2 2016-10-24 21:35:41 +02:00
marcin212 eacfa331e3 Add extrabees item models 2016-10-24 21:35:14 +02:00
marcin212 43efa66c20 Move ItemMisc models to subdirectory 2016-10-24 21:34:29 +02:00
Nedelosk 9f04dc7ed0 Merge branch 'master-MC1.10.2' of https://github.com/ForestryMC/Binnie into master-MC1.10.2 2016-10-24 20:26:19 +02:00
Nedelosk 7de922264a Adding new Models 2016-10-24 20:25:24 +02:00
marcin212 7e1e92ae2c Decompiler mess cleanup 2016-10-24 19:33:53 +02:00
Nedelosk 2ed7e79478 Update Soil and add Soil Models 2016-10-24 18:23:30 +02:00
Nedelosk 0caaa095a2 Update Jei Integration 2016-10-24 16:24:42 +02:00
Nedelosk 0806d2ac38 Clean Up Api 2016-10-22 19:18:25 +02:00
Nedelosk 8b1bce6963 Clean Up and start to work on flower models 2016-10-22 18:56:37 +02:00
Nedelosk fd7c73c354 Add Flower Definition and Add Flower Factory 2016-10-22 03:39:42 +02:00
marcin212 4cca08af79 Fix flickering GUI 2016-10-21 18:06:45 +02:00
marcin212 59e21d05ef Fix wrong allele name and enable module genetics in botany 2016-10-21 15:30:06 +02:00
Nedelosk ff41a6e83b Rename FlowerHelper to FlowerRoot and improve it 2016-10-21 14:23:48 +02:00
Nedelosk 86bde197ec Clean Up 2016-10-21 13:40:04 +02:00
Nedelosk 8c61cacb57 Add Item models 2016-10-21 13:39:50 +02:00
Nedelosk ef6cbb1090 Adding basic Item and improve genetic Items 2016-10-21 12:20:02 +02:00
Nedelosk 2adc2e3562 Improve .gitignore and Adding ModelManager like that from Forestry 2016-10-21 12:07:12 +02:00
marcin212 ce2629a9f4 Fix itemstack display name for soil, serum and serum array 2016-10-21 11:27:53 +02:00
marcin212 a7af5980a1 Merge branch 'master-MC1.10.2' of https://github.com/ForestryMC/Binnie into master-MC1.10.2 2016-10-21 10:37:23 +02:00
marcin212 8a2fc188ae Support for Forge Energy 2016-10-21 10:36:20 +02:00
mezz f27454a73d Begin work on JEI integration 2016-10-21 01:31:57 -07:00
mezz 827c260442 Remove System.out.println spam 2016-10-21 00:39:55 -07:00
mezz a4cd13282a Remove redundant casts, unnecessary object creation, and string == 2016-10-21 00:32:06 -07:00
mezz 100784b51b Fix bug with mutation discovery in ControlMutationsBox 2016-10-21 00:29:36 -07:00
mezz b2963069fc Fix more null warnings 2016-10-21 00:22:24 -07:00
mezz ca1b4b03b1 Clean up genetic item recipes 2016-10-21 00:18:44 -07:00
mezz 4e3fb7e0bd fix bug in IBorder 2016-10-20 23:54:21 -07:00
mezz 0806b3b562 Fix missing import 2016-10-20 23:52:52 -07:00
mezz fc47c969f1 Remove FakeWorld 2016-10-20 23:51:42 -07:00
mezz 3178aa890d Fix some null warnings 2016-10-20 23:51:14 -07:00
mezz c6783e573c Use Collections.addAll 2016-10-20 23:18:49 -07:00
mezz 57930991ec Remove unnecessary boxing/unboxing 2016-10-20 23:14:07 -07:00
mezz f96bf5ba5f Use foreach loops 2016-10-20 23:13:41 -07:00
mezz 7a90a5cbbf Remove unused imports 2016-10-20 23:13:09 -07:00
mezz dac491c788 remove default template file headers 2016-10-20 23:12:50 -07:00
mezz d06b1d6304 Clean up some odd casts and obfuscated param names 2016-10-20 23:08:28 -07:00
mezz 507b8fa2d6 Remove unnecessary modifiers from enums and interfaces 2016-10-20 22:46:07 -07:00
mezz 55c58cf5d9 Use diamond operator everywhere 2016-10-20 22:41:23 -07:00
mezz 9812ddc4ce Fix mod names and dependencies 2016-10-20 22:38:23 -07:00
mezz 61d2d5ce30 Fix PlankType for Forestry planks 2016-10-20 22:00:47 -07:00
mezz d4cb398ac1 Fix crash from WATER effect bees 2016-10-20 21:48:08 -07:00
mezz 885ee83ede Fix null items in flowermanager registration 2016-10-20 21:47:29 -07:00
mezz edf9f0a9d0 Update gradle wrapper and build.gradle 2016-10-20 21:26:21 -07:00
marcin212 6a7c4bf67d start 1.10.2 2016-10-20 04:32:47 +02:00
2706 changed files with 68230 additions and 52101 deletions

No files matched your search

+20 -1
View File
@@ -1,3 +1,6 @@
# everything
/*
.gradle
# IntelliJ
/build
@@ -6,4 +9,20 @@
.idea
*.iml
*.ipr
*.iws
*.iws
classes/
# folders
!/gradle/wrapper
!/src
# files
!/.gitignore
!/LICENSE.txt
!/license-header.txt
!/README.md
!/gradle.properties
!/build.gradle
!/gradlew
!/gradlew.bat
+24
View File
@@ -0,0 +1,24 @@
sudo: required
dist: trusty
language: java
jdk: oraclejdk8
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
- rm -f $HOME/.gradle/caches/minecraft/deobfedDeps/providedDummy.jar
- rm -f $HOME/.gradle/caches/minecraft/deobfedDeps/compileDummy.jar
cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
before_install: chmod +x gradlew
install:
- ./gradlew setupCIWorkspace -S
script:
- ./gradlew build
notifications:
email: false
+56
View File
@@ -0,0 +1,56 @@
[Binnie mods](https://minecraft.curseforge.com/projects/binnies-mods/files)
====================================
### What is it?
Binnie’s Mods is a suite of mods designed to expand the [Forestry](https://github.com/ForestryMC/ForestryMC) mod.
It both extends the bee and tree breeding aspect by adding many new species with varied products,
along with new features such as fully breedable flowers and genetic manipulation.
### Homepage
[Wiki](https://binnie.mods.wiki/wiki/Main_Page)
[Latest Builds for 1.11 / 1.11.2](http://jenkins.ic2.player.to/job/Binnie's%201.11.2/)
### Mods
[![](https://binnie.mods.wiki/w/images/binnie/9/91/Extra_Bees_Header.png)](https://binnie.mods.wiki/wiki/Extra_Bees)
Extra Bees expands upon the bee breeding of Forestry by adding 107 new bee species to forestry. These bees cover a large spectrum of different effects and products, giving you the ability to produce everything from dyes to rare metal dusts purely from bees. It also adds the Apiarist Database, a tool to keep track of discovered species, mutations and traits. There are also new alveary components which help improve and streamline bee production.
[![](https://binnie.mods.wiki/w/images/binnie/5/59/Extra_Trees_Header.png)](https://binnie.mods.wiki/wiki/Extra_Trees)
Extra Trees both increases the number of tree species and adds many new aesthetic uses. There are 96 new tree species, such as Banana, Brazil nut and Douglas-fir. This comes with many new fruits as well as 35 new wooden planks. Extra Trees allows these, as well as Forestry and vanilla planks, to be combined to give doors, gates and various designs of fences. The woodworker allows planks to be combined to give patterned tiles, allowing you to build beautiful wooden floors, and the same can be done with stained glass. A group of machines such as the brewery and distillery allow you to use the fruits you grow to make a variety of wines, ciders and spirits.
[![](https://binnie.mods.wiki/w/images/binnie/3/34/Botany_Header.png)](https://binnie.mods.wiki/wiki/Botany)
Botany adds an entirely new breeding system to Forestry: flowers. There are 46 different species that can be bred, including both vanilla flowers and new ones such as Fuschia and Lilies. The colour of the flowers can be transferred and selectively bred, meaning that each flower can be one of a possible 80 different colours. These new flowers can be bred manually in small gardens using a trowel and fertiliser, with careful care taken to maintain the desired pH or moisture, or grown on the large scale in Forestry farms.
[![](https://binnie.mods.wiki/w/images/binnie/4/4e/Genetics_Header.png)](https://binnie.mods.wiki/wiki/Genetics)
Genetics is for those who want to eschew conventional breeding, and want to enter the realm of genetic manipulation. Here, genes can be isolated, sequenced and then inoculated back into different species, making it easier to obtain the perfect genome. Bees, trees, butterflies and flowers can all be manipulated in this way. They can also be acclimatised to different environments to build tolerance to hostile climates.
[![](https://binnie.mods.wiki/w/images/binnie/d/d7/Binnie_Core_Header.png)](https://binnie.mods.wiki/wiki/Binnie_Core)
Binnie Core is a mod which contains a lot of the core functionality such as networking and GUI's for the other mods. The only in game features it currently contains are the Compartments
### Building
The master branch will always contain the latest released version with possibly some bug fixes for that version that will eventually be released.
New versions will be created in branched named like {mc_version}-{mod_version}
#### IntelliJ IDEA
1. Execute the following gradle command to setup your workspace and create the necessary idea project files:
```
./gradlew setupDecompWorkspace idea genIntellijRuns
```
2. Open the `Binnie*.ipr` project file using IntelliJ IDEA
3. Select `Minecraft Client` from _Run configurations_ and press the green play button.
Minecraft should now launch with Binnie and all of its dependencies loaded :)
+99 -32
View File
@@ -1,53 +1,76 @@
buildscript {
repositories {
mavenCentral()
jcenter()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath "gradle.plugin.se.bjurr.gitchangelog:git-changelog-gradle-plugin:1.47"
}
}
apply plugin: 'forge'
plugins {
id "com.matthewprenger.cursegradle" version "1.0.9"
}
version = "1.0"
group= "binnie" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "binnie"
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'idea'
apply plugin: 'maven'
apply plugin: "se.bjurr.gitchangelog.git-changelog-gradle-plugin"
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
version = version_major + '.' + version_minor + '.' + version_patch
if (System.getenv("BUILD_NUMBER") != null) {
version = version + "." + System.getenv("BUILD_NUMBER")
}
group = "binnie" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "binnie-mods-" + mcversion
minecraft {
version = "1.7.10-10.13.4.1558-1.7.10"
if (file('../run').exists()){
assetDir = "../run/assets"
}else{
assetDir = "assets"
version = mcversion + "-" + forgeversion
mappings = mcp_mappings
runDir = "run"
replace '@VERSION@', project.version
}
repositories {
maven {
name = "jei"
url "http://dvs1.progwml6.com/files/maven"
}
maven {
name = "ic2, forestry"
url = "http://maven.ic2.player.to/"
}
maven {
name = "CurseForge"
url = "https://minecraft.curseforge.com/api/maven/"
}
maven {
name "Jared"
url "http://maven.blamejared.com/"
}
}
dependencies {
// you may put jars on which you depend on in ./libs
// or you may define them like so..
//compile "some.group:artifact:version:classifier"
//compile "some.group:artifact:version"
// real examples
//compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
//compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
// for more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
deobfCompile("net.sengir.forestry:forestry_${mcversion}:${forestry_version}") {
transitive = false
}
deobfProvided "mezz.jei:jei_${mcversion}:${jei_version}:api"
runtime "mezz.jei:jei_${mcversion}:${jei_version}"
runtime "jei-bees:jeibees:${jeibees_version}:mc${mcversion}"
deobfProvided "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
runtime "net.industrial-craft:industrialcraft-2:${ic2_version}"
deobfProvided "CraftTweaker2:CraftTweaker2-API:${minetweaker_version}"
}
processResources
{
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
@@ -55,13 +78,57 @@ processResources
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
// prevent java 8's strict doclint for javadocs from failing builds
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
uploadArchives {
repositories {
if (project.hasProperty('mavenDir')) {
mavenDeployer {
repository(url: "file://" + mavenDir)
}
} else {
println 'Archives upload disabled, mavenDir in gradle.properties is missing.'
}
}
}
task makeChangelog(type: se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask) {
filePath = "changelog.html"
untaggedName = "Current release ${project.version}"
fromCommit = "dbc5c1a564c39e4a9c042411d1bdbe450985ce2c"
toRef = "HEAD"
templateContent = file('changelog.mustache').getText('UTF-8')
}
curseforge {
apiKey = project.hasProperty('curseforge_apikey') ? project.curseforge_apikey : '0'
project {
id = curse_project_id
changelog = file('changelog.html')
changelogType = 'html'
releaseType = 'alpha'
relations {
requiredLibrary 'forestry'
}
}
}
afterEvaluate {
tasks.curseforge223525.dependsOn.add(makeChangelog)
}
+10
View File
@@ -0,0 +1,10 @@
Alpha version. Do not create a world you care about with this version, it may break things severely.<br/>
Please help the project by trying it out and <a href="https://github.com/ForestryMC/Binnie/issues">reporting issues here.</a><br/>
{{#tags}}
<h3>{{name}}</h3>
<ul>
{{#commits}}
<li>{{{message}}} - {{authorName}}</li>
{{/commits}}
</ul>
{{/tags}}
+19
View File
@@ -0,0 +1,19 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G
mcversion=1.12
forgeversion=14.21.1.2443
mcp_mappings=snapshot_20170806
curse_project_id=223525
forestry_version=5.5.0.154
ic2_version=2.8.14-ex112
version_major=2
version_minor=2
version_patch=0
jei_version=4.7.4.82
jeibees_version=0.9.0.2
minetweaker_version=4.0.3.239
Binary file not shown.
+2 -2
View File
@@ -1,6 +1,6 @@
#Wed Jul 02 15:54:47 CDT 2014
#Thu Jul 13 23:08:17 PDT 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0.1-all.zip
Vendored Regular → Executable
+26 -26
View File
@@ -6,12 +6,30 @@
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
@@ -30,6 +48,7 @@ die ( ) {
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
@@ -40,31 +59,11 @@ case "`uname`" in
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
@@ -90,7 +89,7 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
@@ -114,6 +113,7 @@ fi
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
Vendored Regular → Executable
+4 -4
View File
@@ -8,14 +8,14 @@
@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 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=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
@@ -46,7 +46,7 @@ echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
Binary file not shown.
Binary file not shown.
Binary file not shown.
+13 -32
View File
@@ -1,39 +1,20 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie;
import java.util.ArrayList;
import binnie.core.resource.ManagerResource;
import binnie.core.item.ManagerItem;
import binnie.core.machines.ManagerMachine;
import binnie.core.liquid.ManagerLiquid;
import binnie.core.mod.config.ManagerConfig;
import binnie.core.genetics.ManagerGenetics;
import binnie.core.language.ManagerLanguage;
import binnie.core.ManagerBase;
import java.util.List;
public final class Binnie
{
public static final List<ManagerBase> Managers;
public static final ManagerLanguage Language;
public static final ManagerGenetics Genetics;
public static final ManagerConfig Configuration;
public static final ManagerLiquid Liquid;
public static final ManagerMachine Machine;
public static final ManagerItem Item;
public static final ManagerResource Resource;
import binnie.core.ManagerBase;
import binnie.core.genetics.ManagerGenetics;
import binnie.core.liquid.ManagerLiquid;
import binnie.core.machines.ManagerMachine;
import binnie.core.mod.config.ManagerConfig;
import binnie.core.resource.ManagerResource;
static {
Managers = new ArrayList<ManagerBase>();
Language = new ManagerLanguage();
Genetics = new ManagerGenetics();
Configuration = new ManagerConfig();
Liquid = new ManagerLiquid();
Machine = new ManagerMachine();
Item = new ManagerItem();
Resource = new ManagerResource();
}
public final class Binnie {
public static final List<ManagerBase> MANAGERS = new ArrayList<>();
public static final ManagerGenetics GENETICS = new ManagerGenetics();
public static final ManagerConfig CONFIGURATION = new ManagerConfig();
public static final ManagerLiquid LIQUID = new ManagerLiquid();
public static final ManagerMachine MACHINE = new ManagerMachine();
public static final ManagerResource RESOURCE = new ManagerResource();
}
+13 -12
View File
@@ -1,15 +1,16 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie;
public final class Constants
{
public static final String LiquidJuice = "juice";
public static final String LiquidWater = "water";
public static final String LiquidSeedOil = "seedoil";
public static final String LiquidCreosote = "Creosote Oil";
public static final String LiquidEthanol = "bioethanol";
public static final String LiquidHoney = "for.honey";
public final class Constants {
public static final String CORE_MOD_ID = "binniecore";
public static final String BOTANY_MOD_ID = "botany";
public static final String EXTRA_TREES_MOD_ID = "extratrees";
public static final String GENETICS_MOD_ID = "genetics";
public static final String LIQUID_JUICE = "juice";
public static final String LIQUID_WATER = "water";
public static final String LIQUID_SEED_OIL = "seedoil";
public static final String LIQUID_CREOSOTE = "Creosote Oil";
public static final String LIQUID_BIO_ETHANOL = "bioethanol";
public static final String LIQUID_FOR_HONEY = "for.honey";
}
+204 -220
View File
@@ -1,122 +1,113 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.eventhandler.Event;
import net.minecraftforge.event.entity.player.BonemealEvent;
import net.minecraft.world.IBlockAccess;
import binnie.core.BinnieCore;
import net.minecraft.world.World;
import net.minecraftforge.event.world.BlockEvent;
import com.google.common.base.Preconditions;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.player.BonemealEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.event.world.BlockEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import binnie.Constants;
import binnie.botany.api.EnumAcidity;
import binnie.botany.api.EnumSoilType;
import binnie.botany.api.gardening.IBlockSoil;
import binnie.botany.gardening.Gardening;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.item.ItemStack;
import binnie.botany.api.IBlockSoil;
import binnie.botany.api.IFlower;
import net.minecraft.tileentity.TileEntity;
import forestry.api.genetics.IIndividual;
import binnie.botany.api.IFlowerRoot;
import binnie.botany.api.IGardeningManager;
import binnie.botany.core.BotanyCore;
import net.minecraft.entity.EntityLivingBase;
import binnie.botany.flower.TileEntityFlower;
import net.minecraft.init.Items;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import binnie.core.network.BinniePacketHandler;
import binnie.core.proxy.IProxyCore;
import binnie.botany.network.PacketID;
import binnie.core.network.IPacketID;
import binnie.botany.core.BotanyGUI;
import binnie.core.gui.IBinnieGUID;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import binnie.botany.gardening.ModuleGardening;
import binnie.botany.genetics.ModuleGenetics;
import binnie.botany.core.ModuleCore;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import binnie.botany.ceramic.BlockCeramicBrick;
import binnie.botany.ceramic.BlockStained;
import binnie.botany.ceramic.BlockCeramicPatterned;
import binnie.botany.ceramic.BlockCeramic;
import binnie.botany.items.ItemClay;
import binnie.botany.items.ItemPigment;
import binnie.botany.flower.ItemFlower;
import binnie.botany.genetics.ItemEncyclopedia;
import binnie.core.item.ItemMisc;
import binnie.botany.gardening.ItemSoilMeter;
import binnie.botany.flower.ItemInsulatedTube;
import binnie.botany.gardening.BlockSoil;
import binnie.botany.gardening.ItemTrowel;
import binnie.botany.gardening.BlockPlant;
import binnie.botany.genetics.ItemDictionary;
import net.minecraft.item.Item;
import binnie.botany.flower.BlockFlower;
import cpw.mods.fml.common.SidedProxy;
import binnie.botany.flower.ItemBotany;
import binnie.botany.flower.TileEntityFlower;
import binnie.botany.gardening.ModuleGardening;
import binnie.botany.genetics.ItemDictionary;
import binnie.botany.genetics.ModuleGenetics;
import binnie.botany.network.PacketID;
import binnie.botany.proxy.Proxy;
import cpw.mods.fml.common.Mod;
import binnie.core.AbstractMod;
import binnie.core.BinnieCore;
import binnie.core.gui.IBinnieGUID;
import binnie.core.network.BinniePacketHandler;
import binnie.core.network.IPacketID;
import binnie.core.proxy.IProxyCore;
@Mod(modid = "Botany", name = "Botany", useMetadata = true, dependencies = "after:BinnieCore")
public class Botany extends AbstractMod
{
@Mod(
modid = Constants.BOTANY_MOD_ID,
name = "Binnie's Botany",
dependencies = "required-after:" + Constants.CORE_MOD_ID
)
public class Botany extends AbstractMod {
public static final float AGE_CHANCE = 0.2f;
@Mod.Instance("Botany")
@SuppressWarnings("NullableProblems")
@Mod.Instance(Constants.BOTANY_MOD_ID)
public static Botany instance;
@SuppressWarnings("NullableProblems")
@SidedProxy(clientSide = "binnie.botany.proxy.ProxyClient", serverSide = "binnie.botany.proxy.ProxyServer")
public static Proxy proxy;
/* MODULE GENETIC */
public static BlockFlower flower;
public static Item seed;
public static Item pollen;
public static ItemBotany flowerItem;
public static ItemBotany seed;
public static ItemBotany pollen;
public static ItemDictionary database;
public static BlockPlant plant;
public static ItemTrowel trowelWood;
public static ItemTrowel trowelStone;
public static ItemTrowel trowelIron;
public static ItemTrowel trowelDiamond;
public static ItemTrowel trowelGold;
public static BlockSoil soil;
public static BlockSoil loam;
public static BlockSoil flowerbed;
public static BlockSoil soilNoWeed;
public static BlockSoil loamNoWeed;
public static BlockSoil flowerbedNoWeed;
public static ItemInsulatedTube insulatedTube;
public static ItemSoilMeter soilMeter;
public static ItemMisc misc;
public static ItemEncyclopedia encyclopedia;
public static ItemEncyclopedia encyclopediaIron;
public static ItemFlower flowerItem;
public static ItemPigment pigment;
public static ItemClay clay;
public static BlockCeramic ceramic;
public static BlockCeramicPatterned ceramicTile;
public static BlockStained stained;
public static BlockCeramicBrick ceramicBrick;
@Nullable
public static Item botanistBackpack;
@Nullable
private static ModuleGardening gardening;
@Nullable
private static ModuleGenetics genetics;
@Mod.EventHandler
public void preInit(final FMLPreInitializationEvent evt) {
this.addModule(new ModuleCore());
this.addModule(new ModuleGenetics());
this.addModule(new ModuleGardening());
this.preInit();
public void preInit(FMLPreInitializationEvent evt) {
preInit();
}
@Mod.EventHandler
public void init(final FMLInitializationEvent evt) {
this.init();
public void init(FMLInitializationEvent evt) {
init();
}
@Mod.EventHandler
public void postInit(final FMLPostInitializationEvent evt) {
this.postInit();
public void postInit(FMLPostInitializationEvent evt) {
postInit();
}
public Botany() {
Botany.instance = this;
@Override
protected void registerModules() {
addModule(new ModuleCore());
addModule(genetics = new ModuleGenetics());
addModule(gardening = new ModuleGardening());
}
public static ModuleGardening gardening() {
Preconditions.checkState(gardening != null);
return gardening;
}
public static ModuleGenetics genetics() {
Preconditions.checkState(genetics != null);
return genetics;
}
@Override
@@ -146,7 +137,7 @@ public class Botany extends AbstractMod
@Override
public String getModID() {
return "botany";
return Constants.BOTANY_MOD_ID;
}
@Override
@@ -154,179 +145,172 @@ public class Botany extends AbstractMod
return PacketHandler.class;
}
@Override
public boolean isAvailable() {
return BinnieCore.isBotanyActive();
}
@SubscribeEvent
public void onShearFlower(final PlayerInteractEvent event) {
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
public void onShearFlower(PlayerInteractEvent.RightClickBlock event) {
EntityPlayer player = event.getEntityPlayer();
if (player == null) {
return;
}
if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null && event.entityPlayer.getHeldItem().getItem() == Items.shears) {
final TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
if (tile instanceof TileEntityFlower) {
final TileEntityFlower flower = (TileEntityFlower) tile;
flower.onShear();
event.entityPlayer.getHeldItem().damageItem(1, event.entityPlayer);
}
ItemStack heldItem = player.getHeldItemMainhand();
if (heldItem.isEmpty()) {
return;
}
if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null && event.entityPlayer.getHeldItem().getItem() == Botany.pollen) {
final TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
if (tile instanceof TileEntityFlower) {
final TileEntityFlower flower = (TileEntityFlower) tile;
final IFlower pollen = BotanyCore.getFlowerRoot().getMember(event.entityPlayer.getHeldItem());
if (pollen != null && flower.canMateWith(pollen)) {
flower.mateWith(pollen);
if (!event.entityPlayer.capabilities.isCreativeMode) {
final ItemStack heldItem = event.entityPlayer.getHeldItem();
--heldItem.stackSize;
}
TileEntity tile = event.getWorld().getTileEntity(event.getPos());
if (!(tile instanceof TileEntityFlower)) {
return;
}
TileEntityFlower flower = (TileEntityFlower) tile;
if (heldItem.getItem() == Items.SHEARS) {
flower.onShear();
heldItem.damageItem(1, player);
} else if (heldItem.getItem() == Botany.pollen) {
IFlower pollen = BotanyCore.getFlowerRoot().getMember(heldItem);
if (pollen != null && flower.canMateWith(pollen)) {
flower.mateWith(pollen);
if (!player.capabilities.isCreativeMode) {
heldItem.shrink(1);
}
}
}
}
@SubscribeEvent
public void onFertiliseSoil(final PlayerInteractEvent event) {
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
public void onFertiliseSoil(PlayerInteractEvent.RightClickBlock event) {
World world = event.getWorld();
if (world == null) {
return;
}
if (event.world == null) {
BlockPos pos = event.getPos();
EntityPlayer player = event.getEntityPlayer();
if (player == null) {
return;
}
if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null) {
int y = event.y;
Block block = event.world.getBlock(event.x, y, event.z);
if (block == null || !Gardening.isSoil(block)) {
block = event.world.getBlock(event.x, --y, event.z);
}
if (block == null) {
ItemStack heldItem = player.getHeldItemMainhand();
if (heldItem.isEmpty()) {
return;
}
IGardeningManager gardening = BotanyCore.getGardening();
Block block = world.getBlockState(event.getPos()).getBlock();
if (!gardening.isSoil(block)) {
pos = pos.down();
block = world.getBlockState(pos).getBlock();
}
if (!gardening.isSoil(block)) {
return;
}
IBlockSoil soil = (IBlockSoil) block;
int fertiliserStrength = gardening.getFertiliserStrength(heldItem);
if (gardening.isNutrientFertiliser(heldItem) && soil.getType(world, pos) != EnumSoilType.FLOWERBED) {
EnumSoilType type = soil.getType(world, pos);
int next = Math.min(type.ordinal() + fertiliserStrength, 2);
if (soil.fertilise(world, pos, EnumSoilType.values()[next]) && !player.capabilities.isCreativeMode) {
heldItem.shrink(1);
return;
}
if (Gardening.isSoil(block)) {
final IBlockSoil soil = (IBlockSoil) block;
if (Gardening.isNutrientFertiliser(event.entityPlayer.getHeldItem()) && soil.getType(event.world, event.x, y, event.z) != EnumSoilType.FLOWERBED) {
final EnumSoilType type = soil.getType(event.world, event.x, y, event.z);
final int next = Math.min(type.ordinal() + Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 2);
if (soil.fertilise(event.world, event.x, y, event.z, EnumSoilType.values()[next]) && !event.entityPlayer.capabilities.isCreativeMode) {
final ItemStack heldItem = event.entityPlayer.getHeldItem();
--heldItem.stackSize;
return;
}
}
if (Gardening.isAcidFertiliser(event.entityPlayer.getHeldItem()) && soil.getPH(event.world, event.x, y, event.z) != EnumAcidity.Acid) {
final EnumAcidity pH = soil.getPH(event.world, event.x, y, event.z);
final int next = Math.max(pH.ordinal() - Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 0);
if (soil.setPH(event.world, event.x, y, event.z, EnumAcidity.values()[next]) && !event.entityPlayer.capabilities.isCreativeMode) {
final ItemStack heldItem2 = event.entityPlayer.getHeldItem();
--heldItem2.stackSize;
return;
}
}
if (Gardening.isAlkalineFertiliser(event.entityPlayer.getHeldItem()) && soil.getPH(event.world, event.x, y, event.z) != EnumAcidity.Alkaline) {
final EnumAcidity pH = soil.getPH(event.world, event.x, y, event.z);
final int next = Math.min(pH.ordinal() + Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 2);
if (soil.setPH(event.world, event.x, y, event.z, EnumAcidity.values()[next]) && !event.entityPlayer.capabilities.isCreativeMode) {
final ItemStack heldItem3 = event.entityPlayer.getHeldItem();
--heldItem3.stackSize;
return;
}
}
if (Gardening.isWeedkiller(event.entityPlayer.getHeldItem()) && Gardening.addWeedKiller(event.world, event.x, y, event.z) && !event.entityPlayer.capabilities.isCreativeMode) {
final ItemStack heldItem4 = event.entityPlayer.getHeldItem();
--heldItem4.stackSize;
}
}
if (gardening.isAcidFertiliser(heldItem) && soil.getPH(world, pos) != EnumAcidity.ACID) {
EnumAcidity pH = soil.getPH(world, pos);
int next = Math.max(pH.ordinal() - fertiliserStrength, 0);
if (soil.setPH(world, pos, EnumAcidity.values()[next]) && !player.capabilities.isCreativeMode) {
heldItem.shrink(1);
return;
}
}
if (gardening.isAlkalineFertiliser(heldItem) && soil.getPH(world, pos) != EnumAcidity.ALKALINE) {
EnumAcidity pH = soil.getPH(world, pos);
int next = Math.min(pH.ordinal() + fertiliserStrength, 2);
if (soil.setPH(world, pos, EnumAcidity.values()[next]) && !player.capabilities.isCreativeMode) {
heldItem.shrink(1);
return;
}
}
if (gardening.isWeedkiller(heldItem) && gardening.addWeedKiller(world, pos) && !player.capabilities.isCreativeMode) {
heldItem.shrink(1);
}
}
@SubscribeEvent
public void plantVanilla(final BlockEvent.PlaceEvent event) {
final World world = event.world;
final int x = event.x;
final int y = event.y;
final int z = event.z;
final Block block = world.getBlock(x, y - 1, z);
if (!(block instanceof IBlockSoil)) {
public void plantVanilla(BlockEvent.PlaceEvent event) {
World world = event.getWorld();
BlockPos pos = event.getPos();
Block block = world.getBlockState(pos.down()).getBlock();
if (!BotanyCore.getGardening().isSoil(block)) {
return;
}
final IFlower flower = BotanyCore.getFlowerRoot().getConversion(event.itemInHand);
EntityPlayer player = event.getPlayer();
ItemStack heldItem = player.getHeldItem(event.getHand());
IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot();
IFlower flower = flowerRoot.getConversion(heldItem);
if (flower != null) {
Gardening.plant(world, x, y, z, flower, event.player.getGameProfile());
flowerRoot.plant(world, pos, flower, player.getGameProfile());
}
}
@Deprecated
public void onPlantVanilla(final PlayerInteractEvent event) {
if (!BinnieCore.proxy.isSimulating(event.world)) {
public void onPlantVanilla(PlayerInteractEvent.RightClickBlock event) {
BlockPos pos = event.getPos();
World world = event.getWorld();
EntityPlayer player = event.getEntityPlayer();
ItemStack heldItem = player.getHeldItemMainhand();
if (!BinnieCore.getBinnieProxy().isSimulating(event.getWorld())) {
return;
}
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
if (heldItem.isEmpty()) {
return;
}
if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null) {
final World world = event.world;
final int x = event.x;
final int y = event.y;
final int z = event.z;
final Block block = world.getBlock(x, y, z);
int py = -1;
if (block instanceof IBlockSoil && (world.isAirBlock(x, y + 1, z) || world.getBlock(x, y, z).isReplaceable(world, x, y, z))) {
py = 1;
}
if (py >= 0) {
final IFlower flower = BotanyCore.getFlowerRoot().getConversion(event.entityPlayer.getHeldItem());
if (flower != null && Gardening.plant(world, x, y + py, z, flower, event.entityPlayer.getGameProfile()) && !event.entityPlayer.capabilities.isCreativeMode) {
final ItemStack heldItem = event.entityPlayer.getHeldItem();
--heldItem.stackSize;
}
}
Block block = world.getBlockState(pos).getBlock();
int py = -1;
if (block instanceof IBlockSoil && (world.isAirBlock(pos.up()) || block.isReplaceable(world, pos))) {
py = 1;
}
if (py < 0) {
return;
}
IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot();
IFlower flower = flowerRoot.getConversion(heldItem);
if (flower != null && flowerRoot.plant(world, pos.add(0, py, 0), flower, player.getGameProfile()) && !player.capabilities.isCreativeMode) {
heldItem.shrink(1);
}
}
@SubscribeEvent
public void onBonemeal(final BonemealEvent event) {
final Block block = event.world.getBlock(event.x, event.y, event.z);
if (Gardening.isSoil(block)) {
final IBlockSoil soil = (IBlockSoil) block;
if (soil.fertilise(event.world, event.x, event.y, event.z, EnumSoilType.LOAM)) {
public void onBonemeal(BonemealEvent event) {
BlockPos pos = event.getPos();
Block block = event.getBlock().getBlock();
if (BotanyCore.getGardening().isSoil(block)) {
IBlockSoil soil = (IBlockSoil) block;
if (soil.fertilise(event.getWorld(), pos, EnumSoilType.LOAM)) {
event.setResult(Event.Result.ALLOW);
}
}
final TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
TileEntity tile = event.getWorld().getTileEntity(pos);
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).onBonemeal()) {
event.setResult(Event.Result.ALLOW);
}
}
@Override
public boolean isActive() {
return BinnieCore.isBotanyActive();
}
@Mod.EventHandler
public void onIMC(final FMLInterModComms.IMCEvent event) {
for (final FMLInterModComms.IMCMessage message : event.getMessages()) {
if (message.key.equals("add-nutrient-fertiliser-1")) {
ModuleGardening.queuedNutrientFertilisers.put(message.getItemStackValue(), 1);
}
if (message.key.equals("add-nutrient-fertiliser-2")) {
ModuleGardening.queuedNutrientFertilisers.put(message.getItemStackValue(), 2);
}
if (message.key.equals("add-acid-fertiliser-1")) {
ModuleGardening.queuedAcidFertilisers.put(message.getItemStackValue(), 1);
}
if (message.key.equals("add-acid-fertiliser-2")) {
ModuleGardening.queuedAcidFertilisers.put(message.getItemStackValue(), 2);
}
if (message.key.equals("add-alkaline-fertiliser-1")) {
ModuleGardening.queuedAlkalineFertilisers.put(message.getItemStackValue(), 1);
}
if (message.key.equals("add-alkaline-fertiliser-2")) {
ModuleGardening.queuedAlkalineFertilisers.put(message.getItemStackValue(), 1);
}
}
}
public static class PacketHandler extends BinniePacketHandler
{
public static class PacketHandler extends BinniePacketHandler {
public PacketHandler() {
super(Botany.instance);
}
@@ -1,48 +1,41 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany;
import net.minecraft.item.Item;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.creativetab.CreativeTabs;
public class CreativeTabBotany extends CreativeTabs
{
public static CreativeTabs instance;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@Override
public ItemStack getIconItemStack() {
return new ItemStack(Blocks.red_flower, 1, 5);
}
import binnie.core.util.I18N;
public class CreativeTabBotany extends CreativeTabs {
public static CreativeTabs instance = new CreativeTabBotany();
public CreativeTabBotany() {
super("Botany");
}
@Override
public ItemStack getIconItemStack() {
return new ItemStack(Blocks.RED_FLOWER, 1, 5);
}
@Override
@SideOnly(Side.CLIENT)
public String getTranslatedTabLabel() {
return this.getTabLabel();
return getTabLabel();
}
@Override
@SideOnly(Side.CLIENT)
public String getTabLabel() {
return Botany.proxy.localise("tab.botany");
return I18N.localise("botany.tab.botany");
}
@Override
@SideOnly(Side.CLIENT)
public Item getTabIconItem() {
return Item.getItemFromBlock(Blocks.yellow_flower);
}
static {
CreativeTabBotany.instance = new CreativeTabBotany();
public ItemStack getTabIconItem() {
return new ItemStack(Blocks.YELLOW_FLOWER);
}
}
@@ -1,16 +1,34 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.api;
public enum EnumAcidity
{
Acid,
Neutral,
Alkaline;
import javax.annotation.Nullable;
public String getID() {
return this.name().toLowerCase();
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.text.TextFormatting;
import binnie.core.util.I18N;
public enum EnumAcidity implements IStringSerializable {
ACID(TextFormatting.RED),
NEUTRAL(null),
ALKALINE(TextFormatting.AQUA);
@Nullable
TextFormatting color;
EnumAcidity(@Nullable TextFormatting color) {
this.color = color;
}
@Override
public String getName() {
return name().toLowerCase();
}
public String getLocalisedName(boolean withColor) {
String localisedName = I18N.localise("botany.ph." + getName());
if (withColor && color != null) {
localisedName += color;
}
return localisedName;
}
}
@@ -1,20 +1,17 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.api;
import forestry.api.genetics.IAlleleFloat;
import forestry.api.genetics.IAlleleTolerance;
import forestry.api.genetics.IAlleleArea;
import forestry.api.genetics.IAlleleInteger;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.ISpeciesRoot;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IChromosomeType;
import java.util.Locale;
public enum EnumFlowerChromosome implements IChromosomeType
{
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleArea;
import forestry.api.genetics.IAlleleFloat;
import forestry.api.genetics.IAlleleInteger;
import forestry.api.genetics.IAlleleTolerance;
import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.ISpeciesRoot;
public enum EnumFlowerChromosome implements IChromosomeType {
SPECIES(IAlleleFlowerSpecies.class),
PRIMARY(IAlleleInteger.class),
SECONDARY(IAlleleInteger.class),
@@ -30,18 +27,18 @@ public enum EnumFlowerChromosome implements IChromosomeType
private Class<? extends IAllele> cls;
private EnumFlowerChromosome(final Class<? extends IAllele> cls) {
EnumFlowerChromosome(Class<? extends IAllele> cls) {
this.cls = cls;
}
@Override
public Class<? extends IAllele> getAlleleClass() {
return this.cls;
return cls;
}
@Override
public String getName() {
return this.toString().toLowerCase();
return toString().toLowerCase(Locale.ENGLISH);
}
@Override
@@ -1,28 +1,31 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.api;
public enum EnumFlowerStage
{
import forestry.api.genetics.ISpeciesType;
public enum EnumFlowerStage implements ISpeciesType {
FLOWER("Flower"),
SEED("Seed"),
POLLEN("Pollen"),
NONE("NONE");
POLLEN("Pollen");
public static final EnumFlowerStage[] VALUES;
public static final EnumFlowerStage[] VALUES = values();
String name;
private EnumFlowerStage(final String name) {
EnumFlowerStage(String name) {
this.name = name;
}
public String getName() {
return this.name;
public static EnumFlowerStage getStage(IFlower flower) {
return getStage(flower.getAge());
}
static {
VALUES = values();
public static EnumFlowerStage getStage(int age) {
return age == 0
? EnumFlowerStage.SEED
: EnumFlowerStage.FLOWER;
}
public String getName() {
return name;
}
}
@@ -1,16 +1,34 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.api;
public enum EnumMoisture
{
Dry,
Normal,
Damp;
import javax.annotation.Nullable;
public String getID() {
return this.name().toLowerCase();
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.text.TextFormatting;
import binnie.core.util.I18N;
public enum EnumMoisture implements IStringSerializable {
DRY(TextFormatting.YELLOW),
NORMAL(null),
DAMP(TextFormatting.DARK_BLUE);
@Nullable
final TextFormatting color;
EnumMoisture(@Nullable TextFormatting color) {
this.color = color;
}
@Override
public String getName() {
return name().toLowerCase();
}
public String getLocalisedName(boolean withColor) {
String localisedName = I18N.localise("botany.moisture." + getName());
if (withColor && color != null) {
localisedName += color;
}
return localisedName;
}
}
@@ -1,16 +1,29 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.api;
public enum EnumSoilType
{
SOIL,
LOAM,
FLOWERBED;
import java.util.Locale;
public String getID() {
return this.name().toLowerCase();
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.text.TextFormatting;
import binnie.core.util.I18N;
public enum EnumSoilType implements IStringSerializable {
SOIL(TextFormatting.DARK_GRAY),
LOAM(TextFormatting.GOLD),
FLOWERBED(TextFormatting.LIGHT_PURPLE);
private final TextFormatting color;
EnumSoilType(TextFormatting color) {
this.color = color;
}
@Override
public String getName() {
return name().toLowerCase(Locale.ENGLISH);
}
public String getTranslated() {
return color + I18N.localise("botany.soil." + getName());
}
}
@@ -0,0 +1,18 @@
package binnie.botany.api;
public class FlowerManager {
/**
* Convenient access to AlleleManager.alleleRegistry.getSpeciesRoot("rootFlowers")
*/
public static IFlowerRoot flowerRoot;
/**
* Used to create new flowers.
*/
public static IFlowerFactory flowerFactory;
/**
* Used to manager soil.
*/
public static IGardeningManager gardening;
}
@@ -1,14 +1,10 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.api;
import net.minecraft.world.World;
import forestry.api.genetics.IEffectData;
import forestry.api.genetics.IAlleleEffect;
public interface IAlleleFlowerEffect extends IAlleleEffect
{
IEffectData doEffect(final IFlowerGenome p0, final IEffectData p1, final World p2, final int p3, final int p4, final int p5);
import forestry.api.genetics.IAlleleEffect;
import forestry.api.genetics.IEffectData;
public interface IAlleleFlowerEffect extends IAlleleEffect {
IEffectData doEffect(IFlowerGenome genome, IEffectData effect, World world, int x, int y, int z);
}
@@ -1,16 +1,28 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.api;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.core.IModelManager;
import forestry.api.genetics.IAlleleProperty;
import forestry.api.genetics.IAlleleSpecies;
public interface IAlleleFlowerSpecies extends IAlleleSpecies
{
public interface IAlleleFlowerSpecies extends IAlleleSpecies, IAlleleProperty<IAlleleFlowerSpecies> {
IFlowerType getType();
EnumAcidity getPH();
EnumMoisture getMoisture();
@SideOnly(Side.CLIENT)
int getFlowerColor(EnumFlowerStage type, int renderPass);
@SideOnly(Side.CLIENT)
ModelResourceLocation getFlowerModel(EnumFlowerStage type, boolean flowered);
@SideOnly(Side.CLIENT)
void registerModels(Item item, IModelManager manager, EnumFlowerStage type);
}
@@ -0,0 +1,12 @@
package binnie.botany.api;
import forestry.api.genetics.IAlleleSpeciesBuilder;
public interface IAlleleFlowerSpeciesBuilder extends IAlleleSpeciesBuilder {
@Override
IAlleleFlowerSpecies build();
IAlleleFlowerSpeciesBuilder setPH(EnumAcidity acidity);
IAlleleFlowerSpeciesBuilder setMoisture(EnumMoisture moisture);
}
@@ -0,0 +1,22 @@
package binnie.botany.api;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public interface IBlockSoil {
EnumAcidity getPH(World world, BlockPos pos);
EnumMoisture getMoisture(World world, BlockPos pos);
EnumSoilType getType(World world, BlockPos pos);
boolean fertilise(World world, BlockPos pos, EnumSoilType soilType);
boolean degrade(World world, BlockPos pos, EnumSoilType soilType);
boolean setPH(World world, BlockPos pos, EnumAcidity acidity);
boolean setMoisture(World world, BlockPos pos, EnumMoisture moisture);
boolean resistsWeeds(World world, BlockPos pos);
}
@@ -1,11 +1,6 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.api;
import forestry.api.genetics.IBreedingTracker;
public interface IBotanistTracker extends IBreedingTracker
{
public interface IBotanistTracker extends IBreedingTracker {
}
@@ -0,0 +1,13 @@
package binnie.botany.api;
public interface IColorMix {
IFlowerColor getColorFirst();
IFlowerColor getColorSecond();
boolean isMutation(IFlowerColor colorFirst, IFlowerColor colorSecond);
int getChance();
IFlowerColor getResult();
}
@@ -1,18 +0,0 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.api;
public interface IColourMix
{
IFlowerColour getColour1();
IFlowerColour getColour2();
boolean isMutation(final IFlowerColour p0, final IFlowerColour p1);
int getChance();
IFlowerColour getResult();
}
+12 -12
View File
@@ -1,38 +1,38 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.api;
import javax.annotation.Nullable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import forestry.api.genetics.IIndividual;
public interface IFlower extends IIndividual
{
public interface IFlower extends IIndividual {
@Override
IFlowerGenome getGenome();
@Nullable
IFlowerGenome getMate();
void mate(final IFlower p0);
void mate(IFlower flower);
int getAge();
void setAge(int age);
void age();
void setAge(final int p0);
IFlower getOffspring(final World p0);
IFlower getOffspring(World world, BlockPos pos);
int getMaxAge();
boolean isWilted();
void setWilted(final boolean p0);
void setWilted(boolean p0);
boolean hasFlowered();
void setFlowered(final boolean p0);
void setFlowered(boolean p0);
void removeMate();
}
@@ -0,0 +1,13 @@
package binnie.botany.api;
import forestry.api.genetics.IAlleleInteger;
public interface IFlowerColor {
int getColor(boolean dis);
IAlleleInteger getAllele();
int getID();
String getColorName();
}
@@ -1,18 +0,0 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.api;
import forestry.api.genetics.IAlleleInteger;
public interface IFlowerColour
{
int getColor(final boolean p0);
IAlleleInteger getAllele();
int getID();
String getName();
}
@@ -0,0 +1,15 @@
package binnie.botany.api;
import net.minecraft.item.ItemStack;
import forestry.core.genetics.IGeneticDefinition;
public interface IFlowerDefinition extends IGeneticDefinition {
@Override
IFlowerGenome getGenome();
@Override
IFlower getIndividual();
ItemStack getMemberStack(EnumFlowerStage flowerStage);
}
@@ -0,0 +1,10 @@
package binnie.botany.api;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IClassification;
public interface IFlowerFactory {
IAlleleFlowerSpeciesBuilder createSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean isDominant, IClassification branch, String binomial, IFlowerType flowerType);
IFlowerMutationBuilder createMutation(IAlleleFlowerSpecies allele0, IAlleleFlowerSpecies allele1, IAllele[] result, int chance);
}
@@ -1,26 +1,21 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.api;
import forestry.api.core.EnumTemperature;
import forestry.api.genetics.EnumTolerance;
import forestry.api.genetics.IGenome;
public interface IFlowerGenome extends IGenome
{
public interface IFlowerGenome extends IGenome {
@Override
IAlleleFlowerSpecies getPrimary();
@Override
IAlleleFlowerSpecies getSecondary();
IFlowerColour getPrimaryColor();
IFlowerColor getPrimaryColor();
IFlowerColour getSecondaryColor();
IFlowerColor getSecondaryColor();
IFlowerColour getStemColor();
IFlowerColor getStemColor();
int getFertility();
@@ -38,9 +33,9 @@ public interface IFlowerGenome extends IGenome
float getSappiness();
boolean canTolerate(final EnumAcidity p0);
boolean canTolerate(EnumAcidity acidity);
boolean canTolerate(final EnumMoisture p0);
boolean canTolerate(EnumMoisture moisture);
boolean canTolerate(final EnumTemperature p0);
boolean canTolerate(EnumTemperature temperature);
}
@@ -1,14 +1,13 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.api;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IAllele;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import forestry.api.genetics.IMutation;
public interface IFlowerMutation extends IMutation
{
float getChance(final IAllele p0, final IAllele p1, final IGenome p2, final IGenome p3);
public interface IFlowerMutation extends IMutation {
@Override
IFlowerRoot getRoot();
float getChance(World world, BlockPos pos, IAlleleFlowerSpecies allele0, IAlleleFlowerSpecies allele1, IFlowerGenome genome0, IFlowerGenome genome1);
}
@@ -0,0 +1,6 @@
package binnie.botany.api;
import forestry.api.genetics.IMutationBuilder;
public interface IFlowerMutationBuilder extends IMutationBuilder {
}
@@ -1,48 +1,59 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.api;
import javax.annotation.Nullable;
import java.util.Collection;
import com.mojang.authlib.GameProfile;
import net.minecraft.world.World;
import forestry.api.genetics.IAllele;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import com.mojang.authlib.GameProfile;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.ISpeciesRoot;
public interface IFlowerRoot extends ISpeciesRoot
{
public interface IFlowerRoot extends ISpeciesRoot {
@Override
IFlower getMember(final ItemStack p0);
@Nullable
IFlower getMember(ItemStack memberStack);
@Override
IFlower templateAsIndividual(final IAllele[] p0);
IFlower templateAsIndividual(IAllele[] template);
@Override
IFlower templateAsIndividual(final IAllele[] p0, final IAllele[] p1);
IFlower templateAsIndividual(IAllele[] templateFirst, IAllele[] templateSecond);
@Override
IFlowerGenome templateAsGenome(final IAllele[] p0);
IFlowerGenome templateAsGenome(IAllele[] template);
@Override
IFlowerGenome templateAsGenome(final IAllele[] p0, final IAllele[] p1);
IFlowerGenome templateAsGenome(IAllele[] templateActive, IAllele[] templateInactive);
@Override
IBotanistTracker getBreedingTracker(final World p0, final GameProfile p1);
IBotanistTracker getBreedingTracker(World world, @Nullable GameProfile profile);
@Override
Collection<IFlowerMutation> getMutations(final boolean p0);
List<? extends IFlowerMutation> getMutations(boolean shuffle);
EnumFlowerStage getStageType(final ItemStack p0);
@Override
@Nullable
EnumFlowerStage getType(ItemStack itemStack);
IFlower getFlower(final World p0, final IFlowerGenome p1);
IFlower getFlower(IFlowerGenome genome);
void addConversion(final ItemStack p0, final IAllele[] p1);
void addConversion(ItemStack memberStack, IAllele[] template);
IFlower getConversion(final ItemStack p0);
@Nullable
IFlower getConversion(ItemStack memberStack);
Collection<IColourMix> getColourMixes(final boolean p0);
Collection<IColorMix> getColorMixes(boolean shuffle);
void registerColourMix(final IColourMix p0);
void registerColourMix(IColorMix colorMix);
boolean plant(World world, BlockPos pos, IFlower flower, GameProfile owner);
void tryGrowSection(World world, BlockPos pos);
void onGrowFromSeed(World world, BlockPos pos);
}
@@ -1,18 +1,21 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.api;
import net.minecraft.util.IIcon;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
public interface IFlowerType
{
IIcon getStem(final EnumFlowerStage p0, final boolean p1, final int p2);
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
IIcon getPetalIcon(final EnumFlowerStage p0, final boolean p1, final int p2);
import forestry.api.core.IModelManager;
IIcon getVariantIcon(final EnumFlowerStage p0, final boolean p1, final int p2);
public interface IFlowerType<I extends IFlowerType<I>> extends Comparable<I> {
@SideOnly(Side.CLIENT)
void registerModels(Item item, IModelManager manager, EnumFlowerStage type);
@SideOnly(Side.CLIENT)
ModelResourceLocation getModel(EnumFlowerStage type, boolean flowered);
String getName();
int getID();
@@ -0,0 +1,68 @@
package binnie.botany.api;
import javax.annotation.Nullable;
import java.util.Collection;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import forestry.api.core.EnumTemperature;
public interface IGardeningManager {
default boolean isSoil(Block block) {
return block instanceof IBlockSoil;
}
boolean isSoil(Item item);
boolean isSoil(ItemStack item);
EnumMoisture getNaturalMoisture(World world, BlockPos pos);
EnumAcidity getNaturalPH(World world, BlockPos pos);
float getBiomeMoisture(World world, BlockPos pos);
float getBiomePH(World world, BlockPos pos);
void plantSoil(World world, BlockPos pos, EnumSoilType soil, EnumMoisture moisture, EnumAcidity acidity);
Collection<ItemStack> getAcidFertilisers();
Collection<ItemStack> getAlkalineFertilisers();
Collection<ItemStack> getNutrientFertilisers();
void registerAcidFertiliser(ItemStack stack, int strength);
void registerAlkalineFertiliser(ItemStack stack, int strength);
void registerNutrientFertiliser(ItemStack stack, int strength);
boolean isAcidFertiliser(ItemStack stack);
boolean isAlkalineFertiliser(ItemStack stack);
boolean isNutrientFertiliser(ItemStack stack);
int getFertiliserStrength(ItemStack stack);
boolean canTolerate(@Nullable IFlower flower, World world, BlockPos pos);
EnumSoilType getSoilType(World world, BlockPos pos);
default Block getSoilBlock(EnumSoilType type) {
return getSoilBlock(type, false);
}
Block getSoilBlock(EnumSoilType type, boolean weedKill);
boolean canTolerate(IFlower flower, EnumAcidity acidity, EnumMoisture moisture, EnumTemperature temperature);
boolean isWeedkiller(ItemStack heldItem);
boolean addWeedKiller(World world, BlockPos pos);
}
@@ -1,29 +0,0 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.api.gardening;
import binnie.botany.api.EnumSoilType;
import binnie.botany.api.EnumMoisture;
import binnie.botany.api.EnumAcidity;
import net.minecraft.world.World;
public interface IBlockSoil
{
EnumAcidity getPH(final World p0, final int p1, final int p2, final int p3);
EnumMoisture getMoisture(final World p0, final int p1, final int p2, final int p3);
EnumSoilType getType(final World p0, final int p1, final int p2, final int p3);
boolean fertilise(final World p0, final int p1, final int p2, final int p3, final EnumSoilType p4);
boolean degrade(final World p0, final int p1, final int p2, final int p3, final EnumSoilType p4);
boolean setPH(final World p0, final int p1, final int p2, final int p3, final EnumAcidity p4);
boolean setMoisture(final World p0, final int p1, final int p2, final int p3, final EnumMoisture p4);
boolean resistsWeeds(final World p0, final int p1, final int p2, final int p3);
}
@@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
package binnie.botany.api;
import javax.annotation.ParametersAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
@@ -1,147 +1,118 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.ceramic;
import net.minecraft.util.MovingObjectPosition;
import binnie.botany.Botany;
import net.minecraft.client.renderer.texture.IIconRegister;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import java.util.List;
import binnie.botany.genetics.EnumFlowerColor;
import net.minecraftforge.common.util.ForgeDirection;
import binnie.core.block.TileEntityMetadata;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.entity.player.EntityPlayer;
import binnie.core.block.BlockMetadata;
import net.minecraft.item.ItemStack;
import javax.annotation.Nullable;
import java.util.ArrayList;
import net.minecraft.world.World;
import binnie.botany.CreativeTabBotany;
import net.minecraft.block.material.Material;
import binnie.core.block.IBlockMetadata;
import java.util.Collections;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockCeramic extends Block implements IBlockMetadata
{
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.core.IItemModelRegister;
import forestry.api.core.IModelManager;
import forestry.core.blocks.IColoredBlock;
import binnie.botany.CreativeTabBotany;
import binnie.botany.genetics.EnumFlowerColor;
import binnie.core.BinnieCore;
import binnie.core.util.TileUtil;
public class BlockCeramic extends Block implements IColoredBlock, IItemModelRegister {
public BlockCeramic() {
super(Material.rock);
this.setHardness(1.0f);
this.setResistance(5.0f);
this.setBlockName("ceramic");
this.setCreativeTab(CreativeTabBotany.instance);
super(Material.ROCK);
setHardness(1.0f);
setResistance(5.0f);
setRegistryName("ceramic");
setCreativeTab(CreativeTabBotany.instance);
}
@Override
public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int blockMeta, final int fortune) {
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
@SideOnly(Side.CLIENT)
public void registerModel(Item item, IModelManager manager) {
for (EnumFlowerColor c : EnumFlowerColor.values()) {
manager.registerItemModel(item, c.ordinal());
}
}
@Override
public boolean removedByPlayer(final World world, final EntityPlayer player, final int x, final int y, final int z) {
return BlockMetadata.breakBlock(this, player, world, x, y, z);
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
return Collections.emptyList();
}
@Override
public TileEntity createNewTileEntity(final World var1, final int i) {
return new TileEntityMetadata();
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, @Nullable EntityPlayer player, boolean willHarvest) {
List<ItemStack> drops = new ArrayList<>();
TileCeramic ceramic = TileUtil.getTile(world, pos, TileCeramic.class);
if (ceramic != null) {
drops = Collections.singletonList(ceramic.getStack());
}
boolean hasBeenBroken = world.setBlockToAir(pos);
if (hasBeenBroken && BinnieCore.getBinnieProxy().isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
for (ItemStack drop : drops) {
spawnAsEntity(world, pos, drop);
}
}
return hasBeenBroken;
}
@Override
public boolean hasTileEntity(final int meta) {
public TileEntity createTileEntity(World world, IBlockState state) {
return new TileCeramic();
}
@Override
public boolean hasTileEntity(IBlockState state) {
return true;
}
@Override
public boolean onBlockEventReceived(final World par1World, final int par2, final int par3, final int par4, final int par5, final int par6) {
super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6);
final TileEntity tileentity = par1World.getTileEntity(par2, par3, par4);
return tileentity != null && tileentity.receiveClientEvent(par5, par6);
}
@Override
public int getPlacedMeta(final ItemStack stack, final World world, final int x, final int y, final int z, final ForgeDirection clickedBlock) {
return TileEntityMetadata.getItemDamage(stack);
}
@Override
public int getDroppedMeta(final int blockMeta, final int tileMeta) {
return tileMeta;
}
@Override
public String getBlockName(final ItemStack par1ItemStack) {
final int meta = TileEntityMetadata.getItemDamage(par1ItemStack);
return EnumFlowerColor.get(meta).getName() + " Ceramic Block";
}
@Override
public void getBlockTooltip(final ItemStack par1ItemStack, final List par3List) {
}
@Override
public void dropAsStack(final World world, final int x, final int y, final int z, final ItemStack drop) {
this.dropBlockAsItem(world, x, y, z, drop);
}
@Override
public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List itemList) {
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
TileCeramic ceramic = TileUtil.getTile(worldIn, pos, TileCeramic.class);
if (ceramic != null) {
ceramic.setColor(EnumFlowerColor.VALUES[stack.getItemDamage()]);
}
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) {
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
if (tile != null) {
return this.getIcon(side, tile.getTileMetadata());
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> itemList) {
for (EnumFlowerColor c : EnumFlowerColor.values()) {
itemList.add(new ItemStack(this, 1, c.getFlowerColorAllele().getID()));
}
return super.getIcon(world, x, y, z, side);
}
@Override
public IIcon getIcon(final int side, final int meta) {
return this.blockIcon;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(final IIconRegister register) {
this.blockIcon = Botany.proxy.getIcon(register, "ceramic");
}
@Override
@SideOnly(Side.CLIENT)
public int colorMultiplier(final IBlockAccess world, final int x, final int y, final int z) {
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
if (tile != null) {
return this.getRenderColor(tile.getTileMetadata());
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
TileCeramic ceramic = TileUtil.getTile(world, pos, TileCeramic.class);
if (ceramic != null) {
return ceramic.getStack();
}
return 16777215;
return super.getPickBlock(state, target, world, pos, player);
}
@Override
public void breakBlock(final World par1World, final int par2, final int par3, final int par4, final Block par5, final int par6) {
super.breakBlock(par1World, par2, par3, par4, par5, par6);
par1World.removeTileEntity(par2, par3, par4);
}
@Override
public ItemStack getPickBlock(final MovingObjectPosition target, final World world, final int x, final int y, final int z) {
return BlockMetadata.getPickBlock(world, x, y, z);
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderColor(final int meta) {
return EnumFlowerColor.get(meta).getColor(false);
@Override
public int colorMultiplier(IBlockState state, @Nullable IBlockAccess world, @Nullable BlockPos pos, int tintIndex) {
if (world != null && pos != null) {
TileCeramic ceramic = TileUtil.getTile(world, pos, TileCeramic.class);
if (ceramic != null) {
return ceramic.getColor().getFlowerColorAllele().getColor(false);
}
}
return EnumFlowerColor.get(0).getFlowerColorAllele().getColor(false);
}
}
@@ -1,529 +0,0 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.ceramic;
import binnie.botany.items.BotanyItems;
import binnie.core.BinnieCore;
import net.minecraft.util.MovingObjectPosition;
import binnie.botany.Botany;
import net.minecraft.client.renderer.texture.IIconRegister;
import binnie.core.block.MultipassBlockRenderer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import binnie.botany.genetics.EnumFlowerColor;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import java.util.List;
import net.minecraftforge.common.util.ForgeDirection;
import binnie.core.block.TileEntityMetadata;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.entity.player.EntityPlayer;
import binnie.core.block.BlockMetadata;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
import net.minecraft.world.World;
import binnie.botany.CreativeTabBotany;
import net.minecraft.block.material.Material;
import binnie.core.block.IMultipassBlock;
import binnie.core.block.IBlockMetadata;
import net.minecraft.block.Block;
public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipassBlock
{
public BlockCeramicBrick() {
super(Material.rock);
this.setHardness(1.0f);
this.setResistance(5.0f);
this.setBlockName("ceramicBrick");
this.setCreativeTab(CreativeTabBotany.instance);
}
private static BlockType getType(final int meta) {
return new BlockType(meta);
}
@Override
public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int blockMeta, final int fortune) {
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
}
@Override
public boolean removedByPlayer(final World world, final EntityPlayer player, final int x, final int y, final int z) {
return BlockMetadata.breakBlock(this, player, world, x, y, z);
}
@Override
public TileEntity createNewTileEntity(final World var1, final int i) {
return new TileEntityMetadata();
}
@Override
public boolean hasTileEntity(final int meta) {
return true;
}
@Override
public boolean onBlockEventReceived(final World par1World, final int par2, final int par3, final int par4, final int par5, final int par6) {
super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6);
final TileEntity tileentity = par1World.getTileEntity(par2, par3, par4);
return tileentity != null && tileentity.receiveClientEvent(par5, par6);
}
@Override
public int getPlacedMeta(final ItemStack stack, final World world, final int x, final int y, final int z, final ForgeDirection clickedBlock) {
return TileEntityMetadata.getItemDamage(stack);
}
@Override
public int getDroppedMeta(final int blockMeta, final int tileMeta) {
return tileMeta;
}
@Override
public String getBlockName(final ItemStack par1ItemStack) {
final int meta = TileEntityMetadata.getItemDamage(par1ItemStack);
return getType(meta).getName();
}
@Override
public void getBlockTooltip(final ItemStack par1ItemStack, final List par3List) {
}
@Override
public void dropAsStack(final World world, final int x, final int y, final int z, final ItemStack drop) {
this.dropBlockAsItem(world, x, y, z, drop);
}
@Override
public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List itemList) {
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
final BlockType type = new BlockType(c, c, TileType.Tile);
itemList.add(TileEntityMetadata.getItemStack(this, type.ordinal()));
}
for (final TileType type2 : TileType.values()) {
if (type2.canDouble()) {
itemList.add(new BlockType(EnumFlowerColor.Brown, EnumFlowerColor.Gold, type2).getStack(1));
}
}
itemList.add(new BlockType(EnumFlowerColor.Gold, EnumFlowerColor.Gold, TileType.Split).getStack(1));
itemList.add(new BlockType(EnumFlowerColor.Brown, EnumFlowerColor.Brown, TileType.Chequered).getStack(1));
itemList.add(new BlockType(EnumFlowerColor.Gold, EnumFlowerColor.Brown, TileType.LargeBrick).getStack(1));
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) {
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
if (tile != null) {
return this.getIcon(side, tile.getTileMetadata());
}
return super.getIcon(world, x, y, z, side);
}
@Override
public IIcon getIcon(final int side, final int meta) {
return getType(meta).getIcon(MultipassBlockRenderer.getLayer());
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(final IIconRegister register) {
for (final TileType type : TileType.values()) {
for (int i = 0; i < 3; ++i) {
type.icons[i] = Botany.proxy.getIcon(register, "ceramic." + type.id + "." + i);
}
}
}
@Override
@SideOnly(Side.CLIENT)
public int colorMultiplier(final IBlockAccess world, final int x, final int y, final int z) {
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
if (tile != null) {
return this.getRenderColor(tile.getTileMetadata());
}
return 16777215;
}
@Override
public void breakBlock(final World par1World, final int par2, final int par3, final int par4, final Block par5, final int par6) {
super.breakBlock(par1World, par2, par3, par4, par5, par6);
par1World.removeTileEntity(par2, par3, par4);
}
@Override
public ItemStack getPickBlock(final MovingObjectPosition target, final World world, final int x, final int y, final int z) {
return BlockMetadata.getPickBlock(world, x, y, z);
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderColor(final int meta) {
return this.colorMultiplier(meta);
}
@Override
public int getNumberOfPasses() {
return 3;
}
@Override
public int colorMultiplier(final int meta) {
final BlockType type = getType(meta);
if (MultipassBlockRenderer.getLayer() == 0) {
return 16777215;
}
if (MultipassBlockRenderer.getLayer() == 1) {
return type.color1.getColor(false);
}
return type.color2.getColor(false);
}
@Override
public int getRenderType() {
return BinnieCore.multipassRenderID;
}
public enum TileType
{
Tile("tile", "Ceramic Tile"),
Brick("brick", "Ceramic Bricks"),
StripeBrick("brickstripe", "Striped Ceramic Bricks"),
LargeBrick("bricklarge", "Large Ceramic Bricks"),
Split("split", "Split Ceramic Tile"),
Chequered("cheque", "Chequered Ceramic Tile"),
Mixed("mixed", "Mixed Ceramic Tile"),
VerticalBrick("verticalbrick", "Vertical Ceramic Bricks"),
VerticalStripeBrick("verticalbrickstripe", "Vertical Striped Ceramic Bricks"),
VerticalLargeBrick("verticalbricklarge", "Large Vertical Ceramic Bricks");
String id;
String name;
IIcon[] icons;
private TileType(final String id, final String name) {
this.icons = new IIcon[3];
this.id = id;
this.name = name;
}
public static TileType get(final int id) {
return values()[id % values().length];
}
public boolean canDouble() {
return this != TileType.Tile;
}
public ItemStack getRecipe(final List<ItemStack> stacks) {
switch (this) {
case Tile: {
if (stacks.size() != 4) {
return null;
}
int mortars = 0;
int blocks = 0;
int blockColor = -1;
for (final ItemStack stack : stacks) {
if (this.isMortar(stack)) {
++mortars;
}
else {
if (stack.getItem() != Item.getItemFromBlock(Botany.ceramic)) {
return null;
}
++blocks;
final int color = TileEntityMetadata.getItemDamage(stack);
if (blockColor == -1) {
blockColor = color;
}
else {
if (blockColor != color) {
return null;
}
continue;
}
}
}
if (mortars != 1) {
return null;
}
final EnumFlowerColor c = EnumFlowerColor.get(blockColor);
return new BlockType(c, c, TileType.Tile).getStack(3);
}
case Split: {
if (stacks.size() != 4) {
return null;
}
final int[] colors = { -1, -1 };
int altCounter = 0;
for (final ItemStack stack2 : stacks) {
final int alt = (altCounter != 0 && altCounter != 3) ? 1 : 0;
if (stack2.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
return null;
}
final BlockType type = new BlockType(stack2);
if (type.type != TileType.Tile) {
return null;
}
final int color2 = type.color1.ordinal();
if (colors[alt] == -1) {
colors[alt] = color2;
}
else if (colors[alt] != color2) {
return null;
}
++altCounter;
}
return new BlockType(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), TileType.Split).getStack(4);
}
case Chequered: {
if (stacks.size() != 4) {
return null;
}
final int[] colors = { -1, -1 };
for (final ItemStack stack2 : stacks) {
if (stack2.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
return null;
}
final BlockType type2 = new BlockType(stack2);
if (type2.type != TileType.Split) {
return null;
}
final int color3 = type2.color1.ordinal();
final int color4 = type2.color2.ordinal();
if (colors[0] == -1) {
colors[0] = color3;
colors[1] = color4;
}
else {
if (colors[0] != color3 || colors[1] != color4) {
return null;
}
continue;
}
}
return new BlockType(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), TileType.Chequered).getStack(4);
}
case Mixed: {
if (stacks.size() != 4) {
return null;
}
final int[] colors = { -1, -1 };
for (int index = 0; index < stacks.size(); ++index) {
final ItemStack stack2 = stacks.get(index);
if (stack2.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
return null;
}
final BlockType type2 = new BlockType(stack2);
if (type2.isTwoColors()) {
return null;
}
final int color3 = type2.color1.ordinal();
if (type2.type == TileType.Split) {
if (colors[1] != -1) {
return null;
}
colors[1] = color3;
}
else {
if (type2.type != TileType.Chequered) {
return null;
}
if (colors[0] == -1) {
colors[0] = color3;
}
else if (colors[0] != color3) {
return null;
}
}
final int color4 = type2.color2.ordinal();
}
if (colors[0] == -1 || colors[1] == -1) {
return null;
}
return new BlockType(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), TileType.Mixed).getStack(4);
}
case LargeBrick: {
if (stacks.size() == 1) {
final ItemStack stack3 = stacks.get(0);
final BlockType type3 = new BlockType(stack3);
if (type3.type == TileType.VerticalLargeBrick) {
type3.type = this;
return type3.getStack(1);
}
return null;
}
else {
if (stacks.size() != 3) {
return null;
}
final int[] colors = { -1, -1 };
int a = 0;
int b = 0;
for (int index2 = 0; index2 < stacks.size(); ++index2) {
final ItemStack stack4 = stacks.get(index2);
if (stack4.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
return null;
}
final BlockType type4 = new BlockType(stack4);
if (type4.type != TileType.Tile) {
return null;
}
final int color5 = type4.color1.ordinal();
if (colors[0] == -1) {
colors[0] = color5;
++a;
}
else if (colors[0] == color5) {
++a;
}
else if (colors[1] == -1) {
colors[1] = color5;
++b;
}
else {
if (colors[1] != color5) {
return null;
}
++b;
}
}
if (colors[1] == -1) {
colors[1] = colors[0];
}
return new BlockType(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), TileType.LargeBrick).getStack(3);
}
}
case Brick:
case StripeBrick: {
if (stacks.size() == 1) {
final ItemStack stack5 = stacks.get(0);
final BlockType type = new BlockType(stack5);
if (type.type == TileType.VerticalBrick) {
type.type = this;
return type.getStack(1);
}
if (type.type == TileType.StripeBrick) {
type.type = this;
return type.getStack(1);
}
return null;
}
else {
if (stacks.size() != 4) {
return null;
}
final int[] colors = { -1, -1 };
for (int index2 = 0; index2 < stacks.size(); ++index2) {
final ItemStack stack4 = stacks.get(index2);
if (stack4.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
return null;
}
final BlockType type4 = new BlockType(stack4);
if (type4.type != TileType.LargeBrick) {
return null;
}
final int color5 = type4.color1.ordinal();
final int color6 = type4.color2.ordinal();
int alt2 = (index2 != 0 && index2 != 3) ? 1 : 0;
if (this == TileType.StripeBrick) {
alt2 = 0;
}
if (colors[alt2] == -1) {
colors[alt2] = color5;
colors[1 - alt2] = color6;
}
else if (colors[alt2] != color5 || colors[1 - alt2] != color6) {
return null;
}
}
return new BlockType(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), this).getStack(4);
}
}
case VerticalLargeBrick:
case VerticalBrick:
case VerticalStripeBrick: {
if (stacks.size() != 1) {
return null;
}
final ItemStack stack5 = stacks.get(0);
final BlockType type = new BlockType(stack5);
if (type.type == TileType.LargeBrick) {
type.type = TileType.VerticalLargeBrick;
return type.getStack(1);
}
if (type.type == TileType.Brick) {
type.type = TileType.VerticalBrick;
return type.getStack(1);
}
if (type.type == TileType.StripeBrick) {
type.type = TileType.VerticalStripeBrick;
return type.getStack(1);
}
return null;
}
default: {
return null;
}
}
}
private boolean isMortar(final ItemStack stack) {
return stack.getItem() == Botany.misc && stack.getItemDamage() == BotanyItems.Mortar.ordinal();
}
}
public static class BlockType
{
EnumFlowerColor color1;
EnumFlowerColor color2;
TileType type;
private BlockType(final EnumFlowerColor color1, final EnumFlowerColor color2, final TileType type) {
this.color1 = color1;
this.color2 = color2;
this.type = type;
}
public boolean isTwoColors() {
return this.type.canDouble() && this.color2 != this.color1;
}
public BlockType(final ItemStack stack) {
this(TileEntityMetadata.getItemDamage(stack));
}
public ItemStack getStack(final int i) {
final ItemStack s = TileEntityMetadata.getItemStack(Botany.ceramicBrick, this.ordinal());
s.stackSize = i;
return s;
}
public BlockType(final int id) {
this.color1 = EnumFlowerColor.get(id & 0xFF);
this.color2 = EnumFlowerColor.get(id >> 8 & 0xFF);
this.type = TileType.get(id >> 16 & 0xFF);
}
public String getName() {
String name = this.color1.getName();
if (this.type.canDouble() && this.color2 != this.color1) {
name = name + " & " + this.color2.getName();
}
return name + " " + this.type.name;
}
public int ordinal() {
return this.color1.ordinal() + this.color2.ordinal() * 256 + this.type.ordinal() * 256 * 256;
}
public IIcon getIcon(final int layer) {
return this.type.icons[layer];
}
}
}
@@ -1,35 +1,32 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.ceramic;
import net.minecraft.block.material.Material;
import net.minecraft.item.ItemStack;
import binnie.botany.CreativeTabBotany;
import binnie.botany.genetics.EnumFlowerColor;
import binnie.core.util.I18N;
import binnie.extratrees.api.IDesign;
import binnie.extratrees.carpentry.BlockDesign;
import binnie.extratrees.carpentry.DesignBlock;
import binnie.extratrees.carpentry.ModuleCarpentry;
import binnie.botany.genetics.EnumFlowerColor;
import net.minecraft.item.ItemStack;
import binnie.extratrees.api.IDesign;
import binnie.botany.CreativeTabBotany;
import net.minecraft.block.material.Material;
import binnie.extratrees.carpentry.BlockDesign;
public class BlockCeramicPatterned extends BlockDesign
{
public class BlockCeramicPatterned extends BlockDesign {
public BlockCeramicPatterned() {
super(CeramicDesignSystem.instance, Material.rock);
this.setHardness(1.0f);
this.setResistance(5.0f);
this.setCreativeTab(CreativeTabBotany.instance);
this.setBlockName("ceramicPattern");
super(CeramicDesignSystem.instance, Material.ROCK);
setHardness(1.0f);
setResistance(5.0f);
setCreativeTab(CreativeTabBotany.instance);
setRegistryName("ceramicPattern");
}
@Override
public ItemStack getCreativeStack(final IDesign design) {
public ItemStack getCreativeStack(IDesign design) {
return ModuleCarpentry.getItemStack(this, CeramicColor.get(EnumFlowerColor.White), CeramicColor.get(EnumFlowerColor.Black), design);
}
@Override
public String getBlockName(final DesignBlock design) {
return design.getDesign().getName() + " Ceramic Block";
public String getBlockName(DesignBlock design) {
return I18N.localise("botany.ceramic.block.name", design.getDesign().getName());
}
}
@@ -1,197 +0,0 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.ceramic;
import net.minecraft.util.MovingObjectPosition;
import binnie.botany.Botany;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import java.util.List;
import binnie.botany.genetics.EnumFlowerColor;
import net.minecraftforge.common.util.ForgeDirection;
import binnie.core.block.TileEntityMetadata;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.entity.player.EntityPlayer;
import binnie.core.block.BlockMetadata;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
import net.minecraft.world.World;
import binnie.extratrees.ExtraTrees;
import net.minecraft.util.Facing;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.Random;
import binnie.botany.CreativeTabBotany;
import net.minecraft.block.material.Material;
import binnie.core.block.IBlockMetadata;
import net.minecraft.block.Block;
public class BlockStained extends Block implements IBlockMetadata
{
public BlockStained() {
super(Material.glass);
this.setCreativeTab(CreativeTabBotany.instance);
this.setBlockName("stained");
}
@Override
public int quantityDropped(final Random p_149745_1_) {
return 0;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderBlockPass() {
return 1;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(final IBlockAccess p_149646_1_, final int p_149646_2_, final int p_149646_3_, final int p_149646_4_, final int p_149646_5_) {
final Block block2 = p_149646_1_.getBlock(p_149646_2_ - Facing.offsetsXForSide[p_149646_5_], p_149646_3_ - Facing.offsetsYForSide[p_149646_5_], p_149646_4_ - Facing.offsetsZForSide[p_149646_5_]);
final Block block3 = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_);
return block3 != this && block3 != ExtraTrees.blockStained && super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_);
}
@Override
public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int blockMeta, final int fortune) {
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
}
@Override
public boolean removedByPlayer(final World world, final EntityPlayer player, final int x, final int y, final int z) {
return BlockMetadata.breakBlock(this, player, world, x, y, z);
}
@Override
public TileEntity createNewTileEntity(final World var1, final int i) {
return new TileEntityMetadata();
}
@Override
public boolean hasTileEntity(final int meta) {
return true;
}
@Override
public boolean onBlockEventReceived(final World par1World, final int par2, final int par3, final int par4, final int par5, final int par6) {
super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6);
final TileEntity tileentity = par1World.getTileEntity(par2, par3, par4);
return tileentity != null && tileentity.receiveClientEvent(par5, par6);
}
@Override
public int getPlacedMeta(final ItemStack stack, final World world, final int x, final int y, final int z, final ForgeDirection clickedBlock) {
return TileEntityMetadata.getItemDamage(stack);
}
@Override
public int getDroppedMeta(final int blockMeta, final int tileMeta) {
return tileMeta;
}
@Override
public String getBlockName(final ItemStack par1ItemStack) {
final int meta = TileEntityMetadata.getItemDamage(par1ItemStack);
return EnumFlowerColor.get(meta).getName() + " Pigmented Glass";
}
@Override
public void getBlockTooltip(final ItemStack par1ItemStack, final List par3List) {
}
@Override
public void dropAsStack(final World world, final int x, final int y, final int z, final ItemStack drop) {
this.dropBlockAsItem(world, x, y, z, drop);
}
@Override
public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List itemList) {
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
}
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) {
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
if (tile != null) {
return this.getIcon(side, tile.getTileMetadata());
}
return super.getIcon(world, x, y, z, side);
}
@Override
public IIcon getIcon(final int side, final int meta) {
return this.blockIcon;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(final IIconRegister register) {
this.blockIcon = Botany.proxy.getIcon(register, "stained");
}
@Override
@SideOnly(Side.CLIENT)
public int colorMultiplier(final IBlockAccess world, final int x, final int y, final int z) {
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
if (tile != null) {
return this.getRenderColor(tile.getTileMetadata());
}
return 16777215;
}
@Override
public void breakBlock(final World par1World, final int par2, final int par3, final int par4, final Block par5, final int par6) {
super.breakBlock(par1World, par2, par3, par4, par5, par6);
par1World.removeTileEntity(par2, par3, par4);
}
@Override
public boolean isWood(final IBlockAccess world, final int x, final int y, final int z) {
return true;
}
@Override
public int getFlammability(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
return 20;
}
@Override
public boolean isFlammable(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
return true;
}
@Override
public int getFireSpreadSpeed(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
return 5;
}
@Override
public ItemStack getPickBlock(final MovingObjectPosition target, final World world, final int x, final int y, final int z) {
return BlockMetadata.getPickBlock(world, x, y, z);
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderColor(final int meta) {
return EnumFlowerColor.get(meta).getColor(false);
}
}
@@ -0,0 +1,185 @@
package binnie.botany.ceramic;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Enchantments;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.core.IItemModelRegister;
import forestry.api.core.IModelManager;
import forestry.core.blocks.IColoredBlock;
import binnie.botany.CreativeTabBotany;
import binnie.botany.genetics.EnumFlowerColor;
import binnie.core.block.BlockMetadata;
import binnie.core.block.IBlockMetadata;
import binnie.core.block.TileEntityMetadata;
import binnie.core.util.I18N;
public class BlockStainedGlass extends Block implements IBlockMetadata, IColoredBlock, IItemModelRegister {
public BlockStainedGlass() {
super(Material.GLASS);
setCreativeTab(CreativeTabBotany.instance);
setRegistryName("stained");
setSoundType(SoundType.GLASS);
setHardness(0.3F);
}
@Override
public int quantityDropped(Random rand) {
return 0;
}
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
}
@SideOnly(Side.CLIENT)
@Override
public BlockRenderLayer getBlockLayer() {
return BlockRenderLayer.TRANSLUCENT;
}
@SideOnly(Side.CLIENT)
@Override
public void registerModel(Item item, IModelManager manager) {
for (EnumFlowerColor color : EnumFlowerColor.values()) {
manager.registerItemModel(item, color.getFlowerColorAllele().getID());
}
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
IBlockState iblockstate = blockAccess.getBlockState(pos.offset(side));
Block block = iblockstate.getBlock();
return block != this;
}
@Override
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, ItemStack stack) {
player.addStat(StatList.getBlockStats(this));
player.addExhaustion(0.005F);
if (EnchantmentHelper.getEnchantmentLevel(Enchantments.SILK_TOUCH, stack) > 0 && te instanceof TileEntityMetadata) {
List<ItemStack> items = new ArrayList<>();
TileEntityMetadata tile = (TileEntityMetadata) te;
int damage = getDroppedMeta(state, tile.getTileMetadata());
ItemStack itemstack = TileEntityMetadata.getItemStack(this, damage);
if (!itemstack.isEmpty()) {
items.add(itemstack);
}
ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, state, 0, 1.0f, true, player);
for (ItemStack item : items) {
spawnAsEntity(worldIn, pos, item);
}
}
}
@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
return Collections.emptyList();
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityMetadata();
}
@Override
public boolean hasTileEntity(IBlockState state) {
return true;
}
@Override
public boolean eventReceived(IBlockState state, World worldIn, BlockPos pos, int id, int param) {
TileEntity tileentity = worldIn.getTileEntity(pos);
return tileentity != null && tileentity.receiveClientEvent(id, param);
}
@Override
public int getPlacedMeta(ItemStack stack, World world, BlockPos pos, EnumFacing clickedBlock) {
return TileEntityMetadata.getItemDamage(stack);
}
@Override
public int getDroppedMeta(IBlockState state, int tileMetadata) {
return tileMetadata;
}
@Override
public String getDisplayName(ItemStack itemStack) {
EnumFlowerColor color = EnumFlowerColor.get(TileEntityMetadata.getItemDamage(itemStack));
return I18N.localise("botany.pigmented.glass.name", color.getDisplayName());
}
@Override
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> itemList) {
for (EnumFlowerColor color : EnumFlowerColor.values()) {
itemList.add(TileEntityMetadata.getItemStack(this, color.ordinal()));
}
}
@Override
public boolean isWood(IBlockAccess world, BlockPos pos) {
return true;
}
@Override
public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face) {
return 20;
}
@Override
public boolean isFlammable(IBlockAccess world, BlockPos pos, EnumFacing face) {
return true;
}
@Override
public int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face) {
return 5;
}
@Override
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
return BlockMetadata.getPickBlock(world, pos);
}
@Override
public int colorMultiplier(IBlockState state, @Nullable IBlockAccess worldIn, @Nullable BlockPos pos, int tintIndex) {
if (worldIn == null || pos == null) {
return 0;
}
EnumFlowerColor color = EnumFlowerColor.get(TileEntityMetadata.getTileMetadata(worldIn, pos));
return color.getFlowerColorAllele().getColor(false);
}
}
@@ -1,49 +1,51 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.ceramic;
import java.util.LinkedHashMap;
import binnie.core.block.TileEntityMetadata;
import binnie.botany.Botany;
import net.minecraft.item.ItemStack;
import java.util.Map;
import net.minecraft.item.ItemStack;
import binnie.botany.Botany;
import binnie.botany.genetics.EnumFlowerColor;
import binnie.core.block.TileEntityMetadata;
import binnie.extratrees.api.IDesignMaterial;
public class CeramicColor implements IDesignMaterial
{
EnumFlowerColor color;
static Map<EnumFlowerColor, CeramicColor> map;
public class CeramicColor implements IDesignMaterial {
private final static Map<EnumFlowerColor, CeramicColor> map = new LinkedHashMap<>();
CeramicColor(final EnumFlowerColor color) {
static {
for (EnumFlowerColor c : EnumFlowerColor.values()) {
CeramicColor.map.put(c, new CeramicColor(c));
}
}
EnumFlowerColor color;
CeramicColor(EnumFlowerColor color) {
this.color = color;
}
public static CeramicColor get(final EnumFlowerColor c) {
public static CeramicColor get(EnumFlowerColor c) {
return CeramicColor.map.get(c);
}
@Override
public ItemStack getStack() {
return TileEntityMetadata.getItemStack(Botany.ceramic, this.color.ordinal());
return TileEntityMetadata.getItemStack(Botany.gardening().ceramic, color.ordinal());
}
@Override
public String getName() {
return this.color.getName();
public ItemStack getStack(boolean fireproof) {
return getStack();
}
@Override
public String getDesignMaterialName() {
return color.getName();
}
@Override
public int getColour() {
return this.color.getColor(false);
}
static {
CeramicColor.map = new LinkedHashMap<EnumFlowerColor, CeramicColor>();
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
CeramicColor.map.put(c, new CeramicColor(c));
}
return color.getFlowerColorAllele().getColor(false);
}
}
@@ -1,36 +1,37 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.ceramic;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import binnie.botany.items.BotanyItems;
import net.minecraft.item.ItemStack;
import binnie.botany.Botany;
import binnie.core.AbstractMod;
import binnie.core.BinnieCore;
import net.minecraft.client.renderer.texture.IIconRegister;
import binnie.extratrees.carpentry.EnumPattern;
import binnie.extratrees.api.IPattern;
import binnie.botany.genetics.EnumFlowerColor;
import binnie.extratrees.api.IDesignMaterial;
import binnie.extratrees.carpentry.DesignerManager;
import javax.annotation.Nullable;
import java.util.HashMap;
import net.minecraft.util.IIcon;
import java.util.Map;
import binnie.extratrees.api.IDesignSystem;
public class CeramicDesignSystem implements IDesignSystem
{
public static CeramicDesignSystem instance;
Map<Integer, IIcon> primary;
Map<Integer, IIcon> secondary;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import binnie.botany.Botany;
import binnie.botany.genetics.EnumFlowerColor;
import binnie.botany.items.BotanyItems;
import binnie.core.AbstractMod;
import binnie.extratrees.api.IDesignMaterial;
import binnie.extratrees.api.IDesignSystem;
import binnie.extratrees.api.IPattern;
import binnie.extratrees.carpentry.DesignerManager;
import binnie.extratrees.carpentry.EnumPattern;
public class CeramicDesignSystem implements IDesignSystem {
public static CeramicDesignSystem instance = new CeramicDesignSystem();
Map<Integer, TextureAtlasSprite> primary;
Map<Integer, TextureAtlasSprite> secondary;
CeramicDesignSystem() {
this.primary = new HashMap<Integer, IIcon>();
this.secondary = new HashMap<Integer, IIcon>();
primary = new HashMap<>();
secondary = new HashMap<>();
DesignerManager.instance.registerDesignSystem(this);
}
@@ -45,40 +46,48 @@ public class CeramicDesignSystem implements IDesignSystem
}
@Override
public IDesignMaterial getMaterial(final int id) {
public IDesignMaterial getMaterial(int id) {
return CeramicColor.get(EnumFlowerColor.get(id));
}
@Override
public int getMaterialIndex(final IDesignMaterial id) {
public int getMaterialIndex(IDesignMaterial id) {
return ((CeramicColor) id).color.ordinal();
}
public String getTexturePath() {
return "ceramic";
return "blocks/ceramic";
}
@Override
public IIcon getPrimaryIcon(final IPattern pattern) {
@Nullable
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getPrimarySprite(IPattern pattern) {
if (pattern instanceof EnumPattern) {
return this.primary.get(((EnumPattern) pattern).ordinal());
return primary.get(((EnumPattern) pattern).ordinal());
}
return null;
}
@Override
public IIcon getSecondaryIcon(final IPattern pattern) {
@Nullable
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getSecondarySprite(IPattern pattern) {
if (pattern instanceof EnumPattern) {
return this.secondary.get(((EnumPattern) pattern).ordinal());
return secondary.get(((EnumPattern) pattern).ordinal());
}
return null;
}
@Override
public void registerIcons(final IIconRegister register) {
for (final EnumPattern pattern : EnumPattern.values()) {
this.primary.put(pattern.ordinal(), BinnieCore.proxy.getIcon(register, this.getMod().getModID(), this.getTexturePath() + "/" + pattern.toString().toLowerCase() + ".0"));
this.secondary.put(pattern.ordinal(), BinnieCore.proxy.getIcon(register, this.getMod().getModID(), this.getTexturePath() + "/" + pattern.toString().toLowerCase() + ".1"));
@SideOnly(Side.CLIENT)
public void registerSprites() {
TextureMap textureMap = Minecraft.getMinecraft().getTextureMapBlocks();
for (EnumPattern pattern : EnumPattern.values()) {
ResourceLocation primaryLocation = new ResourceLocation(getMod().getModID(), getTexturePath() + "/" + pattern.toString().toLowerCase() + ".0");
ResourceLocation secondaryLocation = new ResourceLocation(getMod().getModID(), getTexturePath() + "/" + pattern.toString().toLowerCase() + ".1");
primary.put(pattern.ordinal(), textureMap.registerSprite(primaryLocation));
secondary.put(pattern.ordinal(), textureMap.registerSprite(secondaryLocation));
}
}
@@ -88,15 +97,14 @@ public class CeramicDesignSystem implements IDesignSystem
@Override
public ItemStack getAdhesive() {
return BotanyItems.Mortar.get(1);
return BotanyItems.MORTAR.get(1);
}
@Override
public IDesignMaterial getMaterial(final ItemStack itemStack) {
return (itemStack.getItem() == Item.getItemFromBlock(Botany.ceramic)) ? this.getMaterial(itemStack.getItemDamage()) : null;
}
static {
CeramicDesignSystem.instance = new CeramicDesignSystem();
@Nullable
public IDesignMaterial getMaterial(ItemStack itemStack) {
return (itemStack.getItem() == Item.getItemFromBlock(Botany.gardening().ceramic))
? getMaterial(itemStack.getItemDamage())
: null;
}
}
@@ -1,72 +1,85 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.ceramic;
import java.util.List;
import java.util.ArrayList;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import binnie.botany.Botany;
import net.minecraft.world.World;
import java.util.List;
import binnie.Constants;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
public class CeramicTileRecipe implements IRecipe
{
ItemStack cached;
import net.minecraftforge.common.ForgeHooks;
@Override
public boolean matches(final InventoryCrafting inv, final World world) {
this.cached = this.getCraftingResult(inv);
return this.cached != null;
import binnie.botany.Botany;
import binnie.botany.ceramic.brick.CeramicBrickType;
import binnie.botany.gardening.ModuleGardening;
import net.minecraftforge.registries.IForgeRegistryEntry;
public class CeramicTileRecipe extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe { private ItemStack cached = ItemStack.EMPTY;
public CeramicTileRecipe() {
setRegistryName(new ResourceLocation(Constants.BOTANY_MOD_ID, "ceramic_tile"));
}
@Override
public ItemStack getCraftingResult(final InventoryCrafting inv) {
final Item ceramicBlock = Item.getItemFromBlock(Botany.ceramic);
final Item ceramicTile = Item.getItemFromBlock(Botany.ceramicTile);
final Item ceramicBrick = Item.getItemFromBlock(Botany.ceramicBrick);
final Item mortar = Botany.misc;
final List<ItemStack> stacks = new ArrayList<ItemStack>();
public boolean matches(InventoryCrafting inv, World world) {
cached = getCraftingResult(inv);
return !cached.isEmpty();
}
@Override
public ItemStack getCraftingResult(InventoryCrafting inv) {
ModuleGardening gardening = Botany.gardening();
Item ceramicBlock = Item.getItemFromBlock(gardening.ceramic);
Item ceramicTile = Item.getItemFromBlock(gardening.ceramicTile);
Item ceramicBrick = Item.getItemFromBlock(gardening.ceramicBrick);
Item mortar = gardening.misc;
List<ItemStack> stacks = new ArrayList<>();
int ix = -1;
int iy = -1;
for (int i = 0; i < inv.getSizeInventory(); ++i) {
final ItemStack stack = inv.getStackInSlot(i);
if (stack != null) {
final int x = i / 3;
final int y = i % 3;
ItemStack stack = inv.getStackInSlot(i);
if (!stack.isEmpty()) {
int x = i / 3;
int y = i % 3;
if (ix == -1) {
ix = x;
iy = y;
}
if (x - ix >= 2 || y - iy >= 2 || y < iy || x < ix) {
return null;
return ItemStack.EMPTY;
}
if (stack.getItem() != ceramicBlock && stack.getItem() != ceramicTile && stack.getItem() != ceramicBrick && stack.getItem() != mortar) {
return null;
return ItemStack.EMPTY;
}
stacks.add(stack);
}
}
for (final BlockCeramicBrick.TileType type : BlockCeramicBrick.TileType.values()) {
final ItemStack stack2 = type.getRecipe(stacks);
if (stack2 != null) {
return stack2;
for (CeramicBrickType type : CeramicBrickType.VALUES) {
ItemStack result = type.getRecipe(stacks);
if (!result.isEmpty()) {
return result;
}
}
return null;
return ItemStack.EMPTY;
}
@Override
public int getRecipeSize() {
return 2;
public boolean canFit(int width, int height) {
return width >= 2 && height >= 2;
}
@Override
public ItemStack getRecipeOutput() {
return this.cached;
return cached;
}
@Override
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) {
return ForgeHooks.defaultRecipeGetRemainingItems(inv);
}
}
@@ -1,24 +1,37 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.ceramic;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.block.Block;
import binnie.core.block.ItemMetadata;
public class ItemCeramic extends ItemMetadata
{
public ItemCeramic(final Block block) {
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.core.items.IColoredItem;
import binnie.botany.genetics.EnumFlowerColor;
import binnie.core.util.I18N;
public class ItemCeramic extends ItemBlock implements IColoredItem {
public ItemCeramic(BlockCeramic block) {
super(block);
}
@Override
public int getMetadata(int metadata) {
return metadata;
}
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(final ItemStack stack, final int p_82790_2_) {
return 16711935;
@Override
public int getColorFromItemstack(ItemStack stack, int tintIndex) {
EnumFlowerColor color = EnumFlowerColor.get(stack.getItemDamage());
return color.getFlowerColorAllele().getColor(false);
}
@Override
@SideOnly(Side.CLIENT)
public String getItemStackDisplayName(ItemStack itemStack) {
EnumFlowerColor color = EnumFlowerColor.get(itemStack.getItemDamage());
return I18N.localise("botany.ceramic.name", color.getDisplayName());
}
}
@@ -0,0 +1,26 @@
package binnie.botany.ceramic;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.core.items.IColoredItem;
import binnie.botany.genetics.EnumFlowerColor;
import binnie.core.block.ItemMetadata;
import binnie.core.block.TileEntityMetadata;
public class ItemStainedGlass extends ItemMetadata implements IColoredItem {
public ItemStainedGlass(Block block) {
super(block);
}
@SideOnly(Side.CLIENT)
@Override
public int getColorFromItemstack(ItemStack stack, int tintIndex) {
EnumFlowerColor color = EnumFlowerColor.get(TileEntityMetadata.getItemDamage(stack));
return color.getFlowerColorAllele().getColor(false);
}
}
@@ -1,53 +1,45 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.ceramic;
import binnie.botany.api.IFlower;
import net.minecraft.item.Item;
import binnie.botany.Botany;
import binnie.Binnie;
import net.minecraft.world.World;
import binnie.Constants;
import binnie.botany.Botany;
import binnie.botany.api.IFlower;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.registries.IForgeRegistryEntry;
public class PigmentRecipe implements IRecipe
{
private final ItemStack unknown;
ItemStack cached;
public class PigmentRecipe extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe {
public PigmentRecipe() {
this.unknown = null;
setRegistryName(new ResourceLocation(Constants.BOTANY_MOD_ID, "pigment"));
}
@Override
public boolean matches(final InventoryCrafting crafting, final World world) {
return this.getCraftingResult(crafting) != null;
public boolean matches(InventoryCrafting crafting, World world) {
return !getCraftingResult(crafting).isEmpty();
}
@Override
public ItemStack getRecipeOutput() {
if (this.cached != null) {
return this.cached;
}
return this.unknown;
return ItemStack.EMPTY;
}
@Override
public ItemStack getCraftingResult(final InventoryCrafting crafting) {
public ItemStack getCraftingResult(InventoryCrafting crafting) {
int n = 0;
ItemStack stack = null;
ItemStack stack = ItemStack.EMPTY;
for (int i = 0; i < crafting.getSizeInventory(); ++i) {
if (crafting.getStackInSlot(i) != null) {
ItemStack stackInSlot = crafting.getStackInSlot(i);
if (!stackInSlot.isEmpty()) {
if (++n > 1) {
return null;
return ItemStack.EMPTY;
}
if (Binnie.Genetics.getFlowerRoot().isMember(crafting.getStackInSlot(i))) {
final IFlower flower = Binnie.Genetics.getFlowerRoot().getMember(crafting.getStackInSlot(i));
if (flower.getAge() >= 1) {
stack = new ItemStack(Botany.pigment, 1, flower.getGenome().getPrimaryColor().getID());
if (Binnie.GENETICS.getFlowerRoot().isMember(stackInSlot)) {
IFlower flower = Binnie.GENETICS.getFlowerRoot().getMember(stackInSlot);
if (flower != null && flower.getAge() >= 1) {
stack = new ItemStack(Botany.gardening().pigment, 1, flower.getGenome().getPrimaryColor().getID());
}
}
}
@@ -56,7 +48,7 @@ public class PigmentRecipe implements IRecipe
}
@Override
public int getRecipeSize() {
return 1;
public boolean canFit(int width, int height) {
return width >= 1 && height >= 1;
}
}
@@ -0,0 +1,44 @@
package binnie.botany.ceramic;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import binnie.botany.Botany;
import binnie.botany.genetics.EnumFlowerColor;
public class TileCeramic extends TileEntity {
protected EnumFlowerColor color = EnumFlowerColor.Black;
public EnumFlowerColor getColor() {
return color;
}
public void setColor(EnumFlowerColor color) {
this.color = color;
}
@Override
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
compound.setInteger("Color", color.getFlowerColorAllele().getID());
return super.writeToNBT(compound);
}
@Override
public void readFromNBT(NBTTagCompound compound) {
super.readFromNBT(compound);
color = EnumFlowerColor.VALUES[compound.getInteger("Color")];
}
public ItemStack getStack() {
return getStack(1);
}
public ItemStack getStack(int amount) {
int ID = 0;
if (color != null) {
ID = color.getFlowerColorAllele().getID();
}
return new ItemStack(Botany.gardening().ceramic, amount, ID);
}
}
@@ -0,0 +1,263 @@
package binnie.botany.ceramic.brick;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.core.IItemModelRegister;
import forestry.api.core.IModelManager;
import forestry.api.core.ISpriteRegister;
import forestry.api.core.IStateMapperRegister;
import forestry.api.core.ITextureManager;
import forestry.core.blocks.IColoredBlock;
import forestry.core.blocks.properties.UnlistedBlockAccess;
import forestry.core.blocks.properties.UnlistedBlockPos;
import forestry.core.models.BlockModelEntry;
import binnie.Constants;
import binnie.botany.CreativeTabBotany;
import binnie.botany.ceramic.TileCeramic;
import binnie.botany.genetics.EnumFlowerColor;
import binnie.core.BinnieCore;
import binnie.core.block.IMultipassBlock;
import binnie.core.models.DefaultStateMapper;
import binnie.core.models.ModelManager;
import binnie.core.models.ModelMutlipass;
import binnie.core.util.TileUtil;
public class BlockCeramicBrick extends Block implements IMultipassBlock<CeramicBrickPair>, IColoredBlock, ISpriteRegister, IStateMapperRegister, IItemModelRegister {
private static final PropertyEnum<CeramicBrickType> TYPE = PropertyEnum.create("type", CeramicBrickType.class);
public BlockCeramicBrick() {
super(Material.ROCK);
setHardness(1.0f);
setResistance(5.0f);
setRegistryName("ceramicBrick");
setCreativeTab(CreativeTabBotany.instance);
}
@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
return Collections.emptyList();
}
@Override
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, @Nullable EntityPlayer player, boolean willHarvest) {
List<ItemStack> drops = new ArrayList<>();
TileCeramic ceramic = TileUtil.getTile(world, pos, TileCeramic.class);
if (ceramic != null) {
drops = Collections.singletonList(ceramic.getStack());
}
boolean hasBeenBroken = world.setBlockToAir(pos);
if (hasBeenBroken && BinnieCore.getBinnieProxy().isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
for (ItemStack drop : drops) {
spawnAsEntity(world, pos, drop);
}
}
return hasBeenBroken;
}
@Override
public TileEntity createTileEntity(World world, IBlockState state) {
return new TileCeramicBrick();
}
@Override
public boolean hasTileEntity(IBlockState state) {
return true;
}
@Override
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> itemList) {
for (EnumFlowerColor color : EnumFlowerColor.values()) {
itemList.add(new CeramicBrickPair(color, color, CeramicBrickType.TILE).getStack(1));
}
for (CeramicBrickType type : CeramicBrickType.VALUES) {
if (type.canDouble()) {
itemList.add(new CeramicBrickPair(EnumFlowerColor.Brown, EnumFlowerColor.Gold, type).getStack(1));
}
}
itemList.add(new CeramicBrickPair(EnumFlowerColor.Gold, EnumFlowerColor.Gold, CeramicBrickType.SPLIT).getStack(1));
itemList.add(new CeramicBrickPair(EnumFlowerColor.Brown, EnumFlowerColor.Brown, CeramicBrickType.CHEQUERED).getStack(1));
itemList.add(new CeramicBrickPair(EnumFlowerColor.Gold, EnumFlowerColor.Brown, CeramicBrickType.LARGE_BRICK).getStack(1));
}
@SideOnly(Side.CLIENT)
@Override
public void registerStateMapper() {
ResourceLocation resourceLocation = new ResourceLocation(Constants.BOTANY_MOD_ID, "ceramicBrick");
ModelLoader.setCustomStateMapper(this, new DefaultStateMapper(resourceLocation));
ModelManager.registerCustomBlockModel(new BlockModelEntry(
new ModelResourceLocation(resourceLocation, "normal"),
new ModelResourceLocation(resourceLocation, "inventory"),
new ModelMutlipass<>(BlockCeramicBrick.class),
this
));
}
@SideOnly(Side.CLIENT)
@Override
public void registerModel(Item item, IModelManager manager) {
manager.registerItemModel(item, new CeramicBrickMeshDefinition());
}
@Override
protected BlockStateContainer createBlockState() {
return new ExtendedBlockState(
this,
new IProperty[]{TYPE},
new IUnlistedProperty[]{
UnlistedBlockPos.POS,
UnlistedBlockAccess.BLOCKACCESS
}
);
}
@Override
public IBlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(TYPE, CeramicBrickType.VALUES[meta]);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(TYPE).ordinal();
}
@Override
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
return ((IExtendedBlockState) super.getExtendedState(state, world, pos)).withProperty(UnlistedBlockPos.POS, pos).withProperty(UnlistedBlockAccess.BLOCKACCESS, world);
}
@Override
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) {
ItemStack stack = placer.getHeldItem(hand);
CeramicBrickPair pair = new CeramicBrickPair(stack);
return getDefaultState().withProperty(TYPE, pair.type);
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
TileCeramicBrick ceramic = TileUtil.getTile(worldIn, pos, TileCeramicBrick.class);
if (ceramic != null) {
CeramicBrickPair pair = new CeramicBrickPair(stack);
ceramic.setColors(pair.colorFirst, pair.colorSecond);
}
}
@Override
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
TileCeramicBrick ceramic = TileUtil.getTile(world, pos, TileCeramicBrick.class);
if (ceramic != null) {
return ceramic.pair().getStack(0);
}
return super.getPickBlock(state, target, world, pos, player);
}
@SideOnly(Side.CLIENT)
@Override
public int colorMultiplier(IBlockState state, @Nullable IBlockAccess world, @Nullable BlockPos pos, int tintIndex) {
if (world != null && pos != null) {
TileCeramicBrick ceramic = TileUtil.getTile(world, pos, TileCeramicBrick.class);
if (ceramic != null) {
if (tintIndex == 1) {
return ceramic.getColorFirst().getFlowerColorAllele().getColor(false);
} else if (tintIndex == 2) {
return ceramic.getColorSecond().getFlowerColorAllele().getColor(false);
}
}
}
return 0xffffff;
}
@SideOnly(Side.CLIENT)
@Override
public BlockRenderLayer getBlockLayer() {
return BlockRenderLayer.CUTOUT;
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderPasses() {
return 3;
}
@Override
@SideOnly(Side.CLIENT)
public CeramicBrickPair getInventoryKey(ItemStack stack) {
return new CeramicBrickPair(stack);
}
@Override
@SideOnly(Side.CLIENT)
public CeramicBrickPair getWorldKey(IBlockState state) {
IExtendedBlockState extendedState = (IExtendedBlockState) state;
IBlockAccess world = extendedState.getValue(UnlistedBlockAccess.BLOCKACCESS);
BlockPos pos = extendedState.getValue(UnlistedBlockPos.POS);
TileCeramicBrick ceramic = TileUtil.getTile(world, pos, TileCeramicBrick.class);
if (ceramic != null) {
return ceramic.pair();
}
return null;
}
@Override
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getSprite(CeramicBrickPair type, @Nullable EnumFacing facing, int pass) {
return type.getSprite(pass);
}
@Override
@SideOnly(Side.CLIENT)
public void registerSprites(ITextureManager manager) {
TextureMap textureMap = Minecraft.getMinecraft().getTextureMapBlocks();
for (CeramicBrickType type : CeramicBrickType.VALUES) {
type.sprites = new TextureAtlasSprite[3];
for (int i = 0; i < 3; ++i) {
type.sprites[i] = textureMap.registerSprite(new ResourceLocation(Constants.BOTANY_MOD_ID + ":blocks/ceramic." + type.id + "." + i));
}
}
}
private class CeramicBrickMeshDefinition implements ItemMeshDefinition {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
return new ModelResourceLocation(Constants.BOTANY_MOD_ID + ":ceramicBrick", "inventory");
}
}
}
@@ -0,0 +1,90 @@
package binnie.botany.ceramic.brick;
import com.google.common.base.Preconditions;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagInt;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import binnie.botany.Botany;
import binnie.botany.genetics.EnumFlowerColor;
import binnie.core.util.I18N;
public class CeramicBrickPair {
public static final CeramicBrickPair EMPTY = new CeramicBrickPair(EnumFlowerColor.DarkSeaGreen, EnumFlowerColor.DarkSeaGreen, CeramicBrickType.TILE);
public final EnumFlowerColor colorFirst;
public final EnumFlowerColor colorSecond;
public CeramicBrickType type;
public int ordinal;
CeramicBrickPair(EnumFlowerColor colorFirst, EnumFlowerColor colorSecond, CeramicBrickType type) {
this.colorFirst = colorFirst;
this.colorSecond = colorSecond;
this.type = type;
ordinal = colorFirst.ordinal() + colorSecond.ordinal() * 256 + type.ordinal() * 256 * 256;
}
public CeramicBrickPair(ItemStack stack) {
this(getId(stack));
}
public CeramicBrickPair(int id) {
colorFirst = EnumFlowerColor.get(id & 0xFF);
colorSecond = EnumFlowerColor.get(id >> 8 & 0xFF);
type = CeramicBrickType.get(id >> 16 & 0xFF);
}
public boolean isTwoColors() {
return type.canDouble() && colorSecond != colorFirst;
}
public static int getId(ItemStack stack){
if(!stack.hasTagCompound()){
return EMPTY.ordinal();
}
NBTTagCompound nbtTagCompound = stack.getTagCompound();
return nbtTagCompound.getInteger("id");
}
public ItemStack getStack(int i) {
ItemStack stack = new ItemStack(Botany.gardening().ceramicBrick, i);
stack.setTagInfo("id", new NBTTagInt(ordinal()));
return stack;
}
public String getName() {
String name = colorFirst.getFlowerColorAllele().getColorName();
if (type.canDouble() && colorSecond != colorFirst) {
name = name + " & " + colorSecond.getFlowerColorAllele().getColorName();
}
return I18N.localise("botany.ceramic.type." + type.id + ".name", name);
}
public int ordinal() {
return ordinal;
}
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getSprite(int pass) {
TextureAtlasSprite[] sprites = type.sprites;
Preconditions.checkState(sprites != null, "Sprites have not been registered.");
return sprites[pass];
}
@Override
public int hashCode() {
return Integer.hashCode(type.ordinal());
}
@Override
public boolean equals(Object obj) {
return obj instanceof CeramicBrickPair
&& ((CeramicBrickPair) obj).type == type;
}
}
@@ -0,0 +1,329 @@
package binnie.botany.ceramic.brick;
import javax.annotation.Nullable;
import java.util.List;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IStringSerializable;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import binnie.botany.Botany;
import binnie.botany.genetics.EnumFlowerColor;
import binnie.botany.items.BotanyItems;
import binnie.core.block.TileEntityMetadata;
public enum CeramicBrickType implements IStringSerializable {
TILE("tile") {
@Override
public ItemStack getRecipe(List<ItemStack> stacks) {
if (stacks.size() != 4) {
return ItemStack.EMPTY;
}
int mortars = 0;
int blocks = 0;
int blockColor = -1;
for (ItemStack stack : stacks) {
if (isMortar(stack)) {
++mortars;
} else {
if (stack.getItem() != Item.getItemFromBlock(Botany.gardening().ceramic)) {
return ItemStack.EMPTY;
}
++blocks;
int color = TileEntityMetadata.getItemDamage(stack);
if (blockColor == -1) {
blockColor = color;
} else {
if (blockColor != color) {
return ItemStack.EMPTY;
}
}
}
}
if (mortars != 1) {
return ItemStack.EMPTY;
}
EnumFlowerColor c = EnumFlowerColor.get(blockColor);
return new CeramicBrickPair(c, c, CeramicBrickType.TILE).getStack(3);
}
},
BRICK("brick") {
@Override
public ItemStack getRecipe(List<ItemStack> stacks) {
return getBrickRecipe(this, stacks);
}
},
STRIPE_BRICK("brickstripe") {
@Override
public ItemStack getRecipe(List<ItemStack> stacks) {
return getBrickRecipe(this, stacks);
}
},
LARGE_BRICK("bricklarge") {
@Override
public ItemStack getRecipe(List<ItemStack> stacks) {
if (stacks.size() == 1) {
ItemStack stack3 = stacks.get(0);
CeramicBrickPair type3 = new CeramicBrickPair(stack3);
if (type3.type == CeramicBrickType.VERTICAL_LARGE_BRICK) {
type3.type = this;
return type3.getStack(1);
}
return ItemStack.EMPTY;
} else {
if (stacks.size() != 3) {
return ItemStack.EMPTY;
}
int[] colors = {-1, -1};
int a = 0;
int b = 0;
for (ItemStack stack4 : stacks) {
if (stack4.getItem() != Item.getItemFromBlock(Botany.gardening().ceramicBrick)) {
return ItemStack.EMPTY;
}
CeramicBrickPair type4 = new CeramicBrickPair(stack4);
if (type4.type != CeramicBrickType.TILE) {
return ItemStack.EMPTY;
}
int color5 = type4.colorFirst.ordinal();
if (colors[0] == -1) {
colors[0] = color5;
a++;
} else if (colors[0] == color5) {
a++;
} else if (colors[1] == -1) {
colors[1] = color5;
b++;
} else {
if (colors[1] != color5) {
return ItemStack.EMPTY;
}
b++;
}
}
if (colors[1] == -1) {
colors[1] = colors[0];
}
return new CeramicBrickPair(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), CeramicBrickType.LARGE_BRICK).getStack(3);
}
}
},
SPLIT("split") {
@Override
public ItemStack getRecipe(List<ItemStack> stacks) {
if (stacks.size() != 4) {
return ItemStack.EMPTY;
}
int[] colors = {-1, -1};
int altCounter = 0;
for (ItemStack stack2 : stacks) {
int alt = (altCounter != 0 && altCounter != 3) ? 1 : 0;
if (stack2.getItem() != Item.getItemFromBlock(Botany.gardening().ceramicBrick)) {
return ItemStack.EMPTY;
}
CeramicBrickPair type = new CeramicBrickPair(stack2);
if (type.type != CeramicBrickType.TILE) {
return ItemStack.EMPTY;
}
int color2 = type.colorFirst.ordinal();
if (colors[alt] == -1) {
colors[alt] = color2;
} else if (colors[alt] != color2) {
return ItemStack.EMPTY;
}
++altCounter;
}
return new CeramicBrickPair(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), CeramicBrickType.SPLIT).getStack(4);
}
},
CHEQUERED("cheque") {
@Override
public ItemStack getRecipe(List<ItemStack> stacks) {
if (stacks.size() != 4) {
return ItemStack.EMPTY;
}
int[] colors = {-1, -1};
for (ItemStack stack2 : stacks) {
if (stack2.getItem() != Item.getItemFromBlock(Botany.gardening().ceramicBrick)) {
return ItemStack.EMPTY;
}
CeramicBrickPair type2 = new CeramicBrickPair(stack2);
if (type2.type != CeramicBrickType.SPLIT) {
return ItemStack.EMPTY;
}
int color3 = type2.colorFirst.ordinal();
int color4 = type2.colorSecond.ordinal();
if (colors[0] == -1) {
colors[0] = color3;
colors[1] = color4;
} else {
if (colors[0] != color3 || colors[1] != color4) {
return ItemStack.EMPTY;
}
}
}
return new CeramicBrickPair(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), CeramicBrickType.CHEQUERED).getStack(4);
}
},
MIXED("mixed") {
@Override
public ItemStack getRecipe(List<ItemStack> stacks) {
if (stacks.size() != 4) {
return ItemStack.EMPTY;
}
int[] colors = {-1, -1};
for (ItemStack stack2 : stacks) {
if (stack2.getItem() != Item.getItemFromBlock(Botany.gardening().ceramicBrick)) {
return ItemStack.EMPTY;
}
CeramicBrickPair type2 = new CeramicBrickPair(stack2);
if (type2.isTwoColors()) {
return ItemStack.EMPTY;
}
int color3 = type2.colorFirst.ordinal();
if (type2.type == CeramicBrickType.SPLIT) {
if (colors[1] != -1) {
return ItemStack.EMPTY;
}
colors[1] = color3;
} else {
if (type2.type != CeramicBrickType.CHEQUERED) {
return ItemStack.EMPTY;
}
if (colors[0] == -1) {
colors[0] = color3;
} else if (colors[0] != color3) {
return ItemStack.EMPTY;
}
}
int color4 = type2.colorSecond.ordinal();
}
if (colors[0] == -1 || colors[1] == -1) {
return ItemStack.EMPTY;
}
return new CeramicBrickPair(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), CeramicBrickType.MIXED).getStack(4);
}
},
VERTICAL_BRICK("verticalbrick") {
@Override
public ItemStack getRecipe(List<ItemStack> stacks) {
return getVerticalBrickRecipe(stacks);
}
},
VERTICAL_STRIPE_BRICK("verticalbrickstripe") {
@Override
public ItemStack getRecipe(List<ItemStack> stacks) {
return getVerticalBrickRecipe(stacks);
}
},
VERTICAL_LARGE_BRICK("verticalbricklarge") {
@Override
public ItemStack getRecipe(List<ItemStack> stacks) {
return getVerticalBrickRecipe(stacks);
}
};
public static final CeramicBrickType[] VALUES = values();
public String id;
@SideOnly(Side.CLIENT)
@Nullable
TextureAtlasSprite[] sprites;
CeramicBrickType(String id) {
this.id = id;
}
public static CeramicBrickType get(int id) {
return VALUES[id % VALUES.length];
}
public boolean canDouble() {
return this != CeramicBrickType.TILE;
}
public abstract ItemStack getRecipe(List<ItemStack> stacks);
protected ItemStack getVerticalBrickRecipe(List<ItemStack> stacks) {
if (stacks.size() != 1) {
return ItemStack.EMPTY;
}
ItemStack stack5 = stacks.get(0);
CeramicBrickPair type = new CeramicBrickPair(stack5);
if (type.type == CeramicBrickType.LARGE_BRICK) {
type.type = CeramicBrickType.VERTICAL_LARGE_BRICK;
return type.getStack(1);
}
if (type.type == CeramicBrickType.BRICK) {
type.type = CeramicBrickType.VERTICAL_BRICK;
return type.getStack(1);
}
if (type.type == CeramicBrickType.STRIPE_BRICK) {
type.type = CeramicBrickType.VERTICAL_STRIPE_BRICK;
return type.getStack(1);
}
return ItemStack.EMPTY;
}
protected ItemStack getBrickRecipe(CeramicBrickType ceramicType, List<ItemStack> stacks) {
if (stacks.size() == 1) {
ItemStack stack5 = stacks.get(0);
CeramicBrickPair type = new CeramicBrickPair(stack5);
if (type.type == CeramicBrickType.VERTICAL_BRICK) {
type.type = ceramicType;
return type.getStack(1);
}
if (type.type == CeramicBrickType.STRIPE_BRICK) {
type.type = ceramicType;
return type.getStack(1);
}
return ItemStack.EMPTY;
} else if (stacks.size() == 4) {
int[] colors = {-1, -1};
for (int index2 = 0; index2 < stacks.size(); ++index2) {
ItemStack stack4 = stacks.get(index2);
if (stack4.getItem() != Item.getItemFromBlock(Botany.gardening().ceramicBrick)) {
return ItemStack.EMPTY;
}
CeramicBrickPair type4 = new CeramicBrickPair(stack4);
if (type4.type != CeramicBrickType.LARGE_BRICK) {
return ItemStack.EMPTY;
}
int color5 = type4.colorFirst.ordinal();
int color6 = type4.colorSecond.ordinal();
int alt2 = (index2 != 0 && index2 != 3) ? 1 : 0;
if (ceramicType == CeramicBrickType.STRIPE_BRICK) {
alt2 = 0;
}
if (colors[alt2] == -1) {
colors[alt2] = color5;
colors[1 - alt2] = color6;
} else if (colors[alt2] != color5 || colors[1 - alt2] != color6) {
return ItemStack.EMPTY;
}
}
return new CeramicBrickPair(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), ceramicType).getStack(4);
}
return ItemStack.EMPTY;
}
protected boolean isMortar(ItemStack stack) {
return stack.getItem() == Botany.gardening().misc && stack.getItemDamage() == BotanyItems.MORTAR.ordinal();
}
@Override
public String getName() {
return id;
}
}
@@ -0,0 +1,38 @@
package binnie.botany.ceramic.brick;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.core.items.IColoredItem;
public class ItemCeramicBrick extends ItemBlock implements IColoredItem {
public ItemCeramicBrick(BlockCeramicBrick block) {
super(block);
}
@Override
public int getMetadata(int metadata) {
return metadata;
}
@SideOnly(Side.CLIENT)
@Override
public int getColorFromItemstack(ItemStack stack, int tintIndex) {
CeramicBrickPair ceramic = new CeramicBrickPair(stack);
if (tintIndex == 1) {
return ceramic.colorFirst.getFlowerColorAllele().getColor(false);
} else if (tintIndex == 2) {
return ceramic.colorSecond.getFlowerColorAllele().getColor(false);
}
return 0xffffff;
}
@Override
@SideOnly(Side.CLIENT)
public String getItemStackDisplayName(ItemStack itemStack) {
return new CeramicBrickPair(itemStack).getName();
}
}
@@ -0,0 +1,69 @@
package binnie.botany.ceramic.brick;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import binnie.botany.Botany;
import binnie.botany.genetics.EnumFlowerColor;
import binnie.core.block.TileEntityMetadata;
public class TileCeramicBrick extends TileEntity {
private EnumFlowerColor colorFirst = EnumFlowerColor.Black;
private EnumFlowerColor colorSecond = EnumFlowerColor.White;
public void setColors(EnumFlowerColor colorFirst, EnumFlowerColor colorSecond) {
this.colorFirst = colorFirst;
this.colorSecond = colorSecond;
}
public boolean hasTwoColors() {
return CeramicBrickType.VALUES[getBlockMetadata()].canDouble() && colorSecond != colorFirst;
}
public ItemStack getStack(int i) {
ItemStack s = TileEntityMetadata.getItemStack(Botany.gardening().ceramicBrick, ordinal());
s.setCount(i);
return s;
}
public int ordinal() {
return colorFirst.ordinal() + colorSecond.ordinal() * 256 + getBlockMetadata() * 256 * 256;
}
public CeramicBrickPair pair() {
return new CeramicBrickPair(colorFirst, colorSecond, CeramicBrickType.VALUES[getBlockMetadata()]);
}
public EnumFlowerColor getColorFirst() {
return colorFirst;
}
public EnumFlowerColor getColorSecond() {
return colorSecond;
}
@Override
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
compound.setInteger("First", colorFirst.ordinal());
compound.setInteger("Second", colorSecond.ordinal());
return super.writeToNBT(compound);
}
@Override
public NBTTagCompound getUpdateTag() {
return writeToNBT(new NBTTagCompound());
}
@Override
public void readFromNBT(NBTTagCompound compound) {
super.readFromNBT(compound);
if (compound.hasKey("First")) {
colorFirst = EnumFlowerColor.VALUES[compound.getInteger("First")];
}
if (compound.hasKey("Second")) {
colorSecond = EnumFlowerColor.VALUES[compound.getInteger("Second")];
}
}
}
@@ -0,0 +1,9 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@FieldsAreNonnullByDefault
package binnie.botany.ceramic.brick;
import javax.annotation.ParametersAreNonnullByDefault;
import binnie.core.util.FieldsAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
@@ -0,0 +1,9 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@FieldsAreNonnullByDefault
package binnie.botany.ceramic;
import javax.annotation.ParametersAreNonnullByDefault;
import binnie.core.util.FieldsAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
@@ -1,22 +1,25 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.core;
import binnie.botany.genetics.FlowerHelper;
import binnie.botany.api.FlowerManager;
import binnie.botany.api.IFlowerRoot;
import binnie.botany.api.IGardeningManager;
import binnie.botany.gardening.Gardening;
import binnie.botany.genetics.FlowerRoot;
public class BotanyCore
{
public class BotanyCore {
public static final int CHANCE_INTERPOLLINATION = 20;
public static IFlowerRoot speciesRoot;
public static IFlowerRoot getFlowerRoot() {
return BotanyCore.speciesRoot;
if (FlowerManager.flowerRoot == null) {
FlowerManager.flowerRoot = new FlowerRoot();
}
return FlowerManager.flowerRoot;
}
static {
BotanyCore.speciesRoot = new FlowerHelper();
public static IGardeningManager getGardening() {
if (FlowerManager.gardening == null) {
FlowerManager.gardening = new Gardening();
}
return FlowerManager.gardening;
}
}
+20 -22
View File
@@ -1,37 +1,35 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.core;
import net.minecraft.tileentity.TileEntity;
import binnie.craftgui.botany.WindowBotanistDatabase;
import net.minecraft.inventory.IInventory;
import binnie.craftgui.minecraft.Window;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.world.World;
import net.minecraft.entity.player.EntityPlayer;
import binnie.core.gui.IBinnieGUID;
import net.minecraft.inventory.IInventory;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public enum BotanyGUI implements IBinnieGUID
{
Database,
DatabaseNEI;
import net.minecraftforge.fml.relauncher.Side;
import binnie.botany.gui.database.WindowBotanistDatabase;
import binnie.core.gui.IBinnieGUID;
import binnie.core.gui.minecraft.Window;
public enum BotanyGUI implements IBinnieGUID {
DATABASE,
DATABASE_NEI;
@Override
public Window getWindow(final EntityPlayer player, final World world, final int x, final int y, final int z, final Side side) {
public Window getWindow(EntityPlayer player, World world, int x, int y, int z, Side side) {
Window window = null;
final TileEntity tileEntity = world.getTileEntity(x, y, z);
TileEntity tileEntity = world.getTileEntity(new BlockPos(x, y, z));
IInventory object = null;
if (tileEntity instanceof IInventory) {
object = (IInventory) tileEntity;
}
switch (this) {
case Database:
case DatabaseNEI: {
window = WindowBotanistDatabase.create(player, side, this != BotanyGUI.Database);
break;
}
case DATABASE:
case DATABASE_NEI: {
window = WindowBotanistDatabase.create(player, side, this != BotanyGUI.DATABASE);
break;
}
}
return window;
}
@@ -1,28 +0,0 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.core;
import binnie.extrabees.ExtraBees;
import binnie.Binnie;
import binnie.core.resource.BinnieResource;
import binnie.core.resource.ResourceType;
import binnie.core.resource.IBinnieTexture;
public enum BotanyTexture implements IBinnieTexture
{
;
String texture;
ResourceType type;
private BotanyTexture(final ResourceType base, final String texture) {
this.texture = texture;
this.type = base;
}
@Override
public BinnieResource getTexture() {
return Binnie.Resource.getPNG(ExtraBees.instance, this.type, this.texture);
}
}
@@ -1,36 +1,20 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.core;
import binnie.botany.api.EnumSoilType;
import binnie.botany.api.EnumMoisture;
import binnie.botany.Botany;
import binnie.Binnie;
import binnie.botany.api.EnumAcidity;
import binnie.core.IInitializable;
public class ModuleCore implements IInitializable
{
public class ModuleCore implements IInitializable {
@Override
public void preInit() {
for (final EnumAcidity pH : EnumAcidity.values()) {
Binnie.Language.addObjectName(pH, Binnie.Language.unlocalised(Botany.instance, "ph." + pH.getID()));
}
for (final EnumMoisture pH2 : EnumMoisture.values()) {
Binnie.Language.addObjectName(pH2, Binnie.Language.unlocalised(Botany.instance, "moisture." + pH2.getID()));
}
for (final EnumSoilType pH3 : EnumSoilType.values()) {
Binnie.Language.addObjectName(pH3, Binnie.Language.unlocalised(Botany.instance, "soil." + pH3.getID()));
}
// ignored
}
@Override
public void init() {
// ignored
}
@Override
public void postInit() {
// ignored
}
}
@@ -0,0 +1,9 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@FieldsAreNonnullByDefault
package binnie.botany.core;
import javax.annotation.ParametersAreNonnullByDefault;
import binnie.core.util.FieldsAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
@@ -1,67 +1,63 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.farm;
import com.google.common.base.Preconditions;
import javax.annotation.Nullable;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting;
import forestry.api.circuits.ChipsetManager;
import forestry.api.circuits.ICircuitLayout;
import forestry.api.farming.FarmDirection;
import forestry.api.farming.IFarmHousing;
import forestry.api.farming.IFarmLogic;
import binnie.Binnie;
import binnie.botany.api.EnumAcidity;
import binnie.botany.api.EnumMoisture;
import binnie.core.circuits.BinnieCircuit;
import binnie.core.util.I18N;
public class CircuitGarden extends BinnieCircuit
{
private Class<? extends FarmLogic> logicClass;
public class CircuitGarden extends BinnieCircuit {
private boolean isManual;
private boolean isFertilised;
private ItemStack icon;
private EnumMoisture moisture;
private EnumAcidity acidity;
private GardenLogic logic;
public CircuitGarden(final EnumMoisture moisture, final EnumAcidity ph, final boolean manual, final boolean fertilised, final ItemStack recipe, final ItemStack icon) {
super("garden." + moisture.getID() + ((ph != null) ? ("." + ph.getID()) : "") + (manual ? ".manual" : "") + (fertilised ? ".fert" : ""), 4, manual ? ChipsetManager.circuitRegistry.getLayout("forestry.farms.manual") : ChipsetManager.circuitRegistry.getLayout("forestry.farms.managed"), recipe);
this.isManual = false;
this.isFertilised = false;
this.isManual = manual;
this.isFertilised = fertilised;
this.moisture = moisture;
this.acidity = ph;
this.icon = icon;
String info = "";
if (moisture == EnumMoisture.Dry) {
info += "§eDry§f";
public CircuitGarden(EnumMoisture moisture, @Nullable EnumAcidity ph, boolean manual, boolean fertilised, ItemStack recipe, ItemStack icon) {
super(getName(moisture, ph, manual, fertilised), 4, getLayout(manual), recipe);
isManual = manual;
logic = new GardenLogic(moisture, ph, isManual, fertilised, icon, I18N.localise(getUnlocalizedName()));
String info = I18N.localise("botany.moisture") + ": " + moisture.getLocalisedName(true);
if (ph != null) {
info += TextFormatting.GRAY + ", " + I18N.localise("botany.ph") + ": " + moisture.getLocalisedName(true);
}
if (moisture == EnumMoisture.Damp) {
info += "§9Damp§f";
String fertilizedKey = fertilised ? "for.binnie.circuit.garden.fertilized" : "for.binnie.circuit.garden.unfertilized";
info += TextFormatting.GRAY + " " + I18N.localise(fertilizedKey);
addTooltipString(I18N.localise("for.binnie.circuit.garden.info", info));
}
private static ICircuitLayout getLayout(boolean manual) {
String layoutUid = manual ? "forestry.farms.manual" : "forestry.farms.managed";
ICircuitLayout layout = ChipsetManager.circuitRegistry.getLayout(layoutUid);
Preconditions.checkState(layout != null, "Couldn't find Forestry circuit layout %s.", layoutUid);
return layout;
}
private static String getName(EnumMoisture moisture, @Nullable EnumAcidity ph, boolean manual, boolean fertilised) {
String name = "garden." + moisture.getName();
if (ph != null) {
name += "." + ph.getName();
}
if (this.acidity == EnumAcidity.Acid) {
if (info.length() > 0) {
info += ", ";
}
info += "§cAcidic§f";
if (manual) {
name += ".manual";
}
if (this.acidity == EnumAcidity.Neutral) {
if (info.length() > 0) {
info += ", ";
}
info += "§aNeutral§f";
if (fertilised) {
name += ".fert";
}
if (this.acidity == EnumAcidity.Alkaline) {
if (info.length() > 0) {
info += ", ";
}
info += "§bAlkaline§f";
}
if (info.length() > 0) {
info = " (" + info + "§f)";
}
this.addTooltipString("Flowers" + info);
return name;
}
public CircuitGarden setManual() {
isManual = true;
return this;
}
@Override
@@ -69,31 +65,43 @@ public class CircuitGarden extends BinnieCircuit
return tile instanceof IFarmHousing;
}
@Nullable
private IFarmHousing getCircuitable(Object tile) {
if (!isCircuitable(tile)) {
return null;
}
return (IFarmHousing) tile;
}
@Override
public void onInsertion(int slot, Object tile) {
if (!this.isCircuitable(tile)) {
IFarmHousing housing = getCircuitable(tile);
if (housing == null) {
return;
}
final GardenLogic logic = new GardenLogic((IFarmHousing) tile);
logic.setData(this.moisture, this.acidity, this.isManual, this.isFertilised, this.icon, Binnie.Language.localise(this.getName()));
((IFarmHousing) tile).setFarmLogic(FarmDirection.values()[slot], logic);
logic.setManual(isManual);
housing.setFarmLogic(FarmDirection.values()[slot], logic);
}
@Override
public void onLoad(int slot, Object tile) {
this.onInsertion(slot, tile);
onInsertion(slot, tile);
}
@Override
public void onRemoval(int slot, Object tile) {
if (!this.isCircuitable(tile)) {
IFarmHousing farmHousing = getCircuitable(tile);
if (farmHousing == null) {
return;
}
((IFarmHousing) tile).resetFarmLogic(FarmDirection.values()[slot]);
farmHousing.resetFarmLogic(FarmDirection.values()[slot]);
}
@Override
public void onTick(int arg0, Object arg1) {
public void onTick(int slot, Object tile) {
// ignored
}
}
+21 -33
View File
@@ -1,61 +1,49 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.farm;
import net.minecraft.item.ItemStack;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import forestry.api.farming.FarmDirection;
import forestry.api.farming.IFarmHousing;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import forestry.api.farming.IFarmLogic;
public abstract class FarmLogic implements IFarmLogic
{
World world;
IFarmHousing housing;
public abstract class FarmLogic implements IFarmLogic {
boolean isManual;
public FarmLogic(final IFarmHousing housing) {
this.housing = housing;
}
@Override
public IFarmLogic setManual(final boolean flag) {
this.isManual = flag;
public IFarmLogic setManual(boolean flag) {
isManual = flag;
return this;
}
protected final boolean isAirBlock(final Vect position) {
return this.world.isAirBlock(position.x, position.y, position.z);
protected final boolean isAirBlock(World world, BlockPos pos) {
return world.isAirBlock(pos);
}
protected final boolean isWaterBlock(final Vect position) {
return this.world.getBlock(position.x, position.y, position.z) == Blocks.water;
protected final IBlockState getBlockState(World world, BlockPos pos) {
return world.getBlockState(pos);
}
protected final Block getBlock(final Vect position) {
return this.world.getBlock(position.x, position.y, position.z);
protected final Block getBlock(World world, BlockPos pos) {
return getBlockState(world, pos).getBlock();
}
protected final int getBlockMeta(final Vect position) {
return this.world.getBlockMetadata(position.x, position.y, position.z);
protected final int getBlockMeta(World world, BlockPos pos) {
IBlockState blockState = world.getBlockState(pos);
return blockState.getBlock().getMetaFromState(blockState);
}
protected final ItemStack getAsItemStack(final Vect position) {
return new ItemStack(this.getBlock(position), 1, this.getBlockMeta(position));
protected final ItemStack getAsItemStack(World world, BlockPos position) {
return new ItemStack(getBlock(world, position), 1, getBlockMeta(world, position));
}
protected final Vect translateWithOffset(final int x, final int y, final int z, final FarmDirection direction, final int step) {
return new Vect(x + direction.getForgeDirection().offsetX * step, y + direction.getForgeDirection().offsetY * step, z + direction.getForgeDirection().offsetZ * step);
protected final boolean isWaterBlock(World world, BlockPos pos) {
return getBlock(world, pos) == Blocks.WATER;
}
protected final void setBlock(final Vect position, final Block block, final int meta) {
this.world.setBlock(position.x, position.y, position.z, block, meta, 2);
protected final void setBlock(World world, BlockPos pos, Block block, int meta) {
world.setBlockState(pos, block.getStateFromMeta(meta), 2);
}
}
@@ -1,47 +1,67 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.farm;
import binnie.botany.api.IFlower;
import binnie.botany.gardening.Gardening;
import javax.annotation.Nullable;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import binnie.botany.api.EnumFlowerStage;
import binnie.botany.core.BotanyCore;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import forestry.api.farming.ICrop;
import binnie.botany.Botany;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import forestry.api.farming.ICrop;
import forestry.api.farming.IFarmable;
public class FarmableFlower implements IFarmable
{
import binnie.botany.Botany;
import binnie.botany.api.EnumFlowerStage;
import binnie.botany.api.IFlower;
import binnie.botany.api.IFlowerRoot;
import binnie.botany.core.BotanyCore;
import binnie.botany.flower.TileEntityFlower;
public class FarmableFlower implements IFarmable {
@Override
public boolean isSaplingAt(final World world, final int x, final int y, final int z) {
return world.getBlock(x, y, z) == Botany.flower;
public boolean isSaplingAt(World world, BlockPos pos) {
return world.getBlockState(pos) == Botany.flower;
}
@Nullable
@Override
public ICrop getCropAt(final World world, final int x, final int y, final int z) {
public ICrop getCropAt(World world, BlockPos pos, IBlockState blockState) {
IFlower flower = null;
if (world.getTileEntity(pos) instanceof TileEntityFlower) {
flower = ((TileEntityFlower) world.getTileEntity(pos)).getFlower();
}
// TODO Look at TileEntityFlower::onShear logic
if (flower != null && flower.getAge() > 1) {
IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot();
ItemStack mature = flowerRoot.getMemberStack(flower, EnumFlowerStage.FLOWER);
ItemStack seed = flowerRoot.getMemberStack(flower, EnumFlowerStage.SEED);
if (mature != null && seed != null) {
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
return new FlowerCrop(pos, mature, seed);
}
}
return null;
}
@Override
public boolean isGermling(final ItemStack itemstack) {
final EnumFlowerStage stage = BotanyCore.speciesRoot.getStageType(itemstack);
public boolean isGermling(ItemStack itemstack) {
EnumFlowerStage stage = BotanyCore.getFlowerRoot().getType(itemstack);
return stage == EnumFlowerStage.FLOWER || stage == EnumFlowerStage.SEED;
}
@Override
public boolean isWindfall(final ItemStack itemstack) {
public boolean isWindfall(ItemStack itemstack) {
return false;
}
@Override
public boolean plantSaplingAt(final EntityPlayer player, final ItemStack germling, final World world, final int x, final int y, final int z) {
final IFlower flower = BotanyCore.getFlowerRoot().getMember(germling);
Gardening.plant(world, x, y, z, flower, player.getGameProfile());
public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, BlockPos pos) {
IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot();
IFlower flower = flowerRoot.getMember(germling);
flowerRoot.plant(world, pos, flower, player.getGameProfile());
return true;
}
}
@@ -1,26 +1,24 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.farm;
import binnie.botany.api.IFlower;
import binnie.botany.gardening.Gardening;
import net.minecraft.world.World;
import net.minecraft.entity.player.EntityPlayer;
import binnie.botany.core.BotanyCore;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class FarmableVanillaFlower extends FarmableFlower
{
import binnie.botany.api.IFlower;
import binnie.botany.api.IFlowerRoot;
import binnie.botany.core.BotanyCore;
public class FarmableVanillaFlower extends FarmableFlower {
@Override
public boolean isGermling(final ItemStack itemstack) {
public boolean isGermling(ItemStack itemstack) {
return BotanyCore.getFlowerRoot().getConversion(itemstack) != null;
}
@Override
public boolean plantSaplingAt(final EntityPlayer player, final ItemStack germling, final World world, final int x, final int y, final int z) {
final IFlower flower = BotanyCore.getFlowerRoot().getConversion(germling);
return Gardening.plant(world, x, y, z, flower, player.getGameProfile());
public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, BlockPos pos) {
IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot();
IFlower flower = flowerRoot.getConversion(germling);
return flowerRoot.plant(world, pos, flower, player.getGameProfile());
}
}
@@ -0,0 +1,31 @@
package binnie.botany.farm;
import javax.annotation.Nullable;
import java.util.Collections;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import forestry.api.farming.ICrop;
public class FlowerCrop implements ICrop {
NonNullList<ItemStack> drops = NonNullList.create();
BlockPos position;
public FlowerCrop(BlockPos pos, ItemStack... drops) {
Collections.addAll(this.drops, drops);
position = pos;
}
@Nullable
@Override
public NonNullList<ItemStack> harvest() {
return drops;
}
@Override
public BlockPos getPosition() {
return position;
}
}
+261 -233
View File
@@ -1,166 +1,169 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.farm;
import net.minecraft.tileentity.TileEntity;
import com.mojang.authlib.GameProfile;
import binnie.core.Mods;
import binnie.botany.flower.TileEntityFlower;
import forestry.core.access.IOwnable;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.util.IIcon;
import forestry.api.farming.ICrop;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
import binnie.Binnie;
import net.minecraft.item.ItemBlock;
import net.minecraft.world.IBlockAccess;
import binnie.botany.Botany;
import binnie.botany.api.EnumSoilType;
import binnie.botany.api.gardening.IBlockSoil;
import java.util.Collection;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.init.Blocks;
import binnie.botany.gardening.Gardening;
import forestry.api.farming.FarmDirection;
import forestry.api.farming.ICrop;
import forestry.api.farming.IFarmHousing;
import forestry.api.farming.IFarmable;
import forestry.core.owner.IOwnedTile;
import forestry.core.utils.BlockUtil;
import java.util.List;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
import binnie.Binnie;
import binnie.botany.Botany;
import binnie.botany.api.EnumAcidity;
import binnie.botany.api.EnumMoisture;
import binnie.botany.api.EnumSoilType;
import binnie.botany.api.IBlockSoil;
import binnie.botany.api.IGardeningManager;
import binnie.botany.core.BotanyCore;
import binnie.botany.flower.TileEntityFlower;
import binnie.core.liquid.ManagerLiquid;
public class GardenLogic extends FarmLogic
{
EnumMoisture moisture;
EnumAcidity acidity;
boolean fertilised;
String name;
ArrayList<ItemStack> produce;
private ItemStack icon;
public class GardenLogic extends FarmLogic {
List<IFarmable> farmables;
private EnumMoisture moisture;
@Nullable
private EnumAcidity acidity;
private boolean fertilised;
private String name;
private NonNullList<ItemStack> produce;
private ItemStack icon;
public GardenLogic(final IFarmHousing housing) {
super(housing);
this.produce = new ArrayList<ItemStack>();
(this.farmables = new ArrayList<IFarmable>()).add(new FarmableFlower());
this.farmables.add(new FarmableVanillaFlower());
public GardenLogic(EnumMoisture moisture2, @Nullable EnumAcidity acidity2, boolean isManual, boolean isFertilised, ItemStack icon2, String name2) {
this.isManual = isManual;
produce = NonNullList.create();
farmables = new ArrayList<>();
farmables.add(new FarmableFlower());
farmables.add(new FarmableVanillaFlower());
moisture = moisture2;
acidity = acidity2;
fertilised = isFertilised;
icon = icon2;
name = name2;
}
@Override
public int getFertilizerConsumption() {
return this.fertilised ? 8 : 2;
return fertilised ? 8 : 2;
}
@Override
public int getWaterConsumption(final float hydrationModifier) {
return (int) (this.moisture.ordinal() * 40 * hydrationModifier);
public int getWaterConsumption(float hydrationModifier) {
return (int) (moisture.ordinal() * 40 * hydrationModifier);
}
@Override
public boolean isAcceptedResource(final ItemStack itemstack) {
return Gardening.isSoil(itemstack.getItem()) || itemstack.getItem() == Item.getItemFromBlock(Blocks.sand) || itemstack.getItem() == Item.getItemFromBlock(Blocks.dirt) || Gardening.isAcidFertiliser(itemstack) || Gardening.isAlkalineFertiliser(itemstack);
public boolean isAcceptedResource(ItemStack itemstack) {
IGardeningManager gardening = BotanyCore.getGardening();
return gardening.isSoil(itemstack.getItem()) ||
itemstack.getItem() == Item.getItemFromBlock(Blocks.SAND) ||
itemstack.getItem() == Item.getItemFromBlock(Blocks.DIRT) ||
gardening.isAcidFertiliser(itemstack) ||
gardening.isAlkalineFertiliser(itemstack);
}
@Override
public Collection<ItemStack> collect() {
final Collection<ItemStack> products = this.produce;
this.produce = new ArrayList<ItemStack>();
public NonNullList<ItemStack> collect(World world, IFarmHousing farmHousing) {
NonNullList<ItemStack> products = produce;
produce = NonNullList.create();
return products;
}
@Override
public boolean cultivate(final int x, final int y, final int z, final FarmDirection direction, final int extent) {
this.world = this.housing.getWorld();
return this.maintainSoil(x, y, z, direction, extent) || (!this.isManual && this.maintainWater(x, y, z, direction, extent)) || this.maintainCrops(x, y + 1, z, direction, extent);
public boolean cultivate(World world, IFarmHousing farmHousing, BlockPos pos, FarmDirection direction, int extent) {
return maintainSoil(world, pos, direction, extent, farmHousing) ||
(!isManual && maintainWater(world, pos, direction, extent, farmHousing)) ||
maintainCrops(world, pos.up(), direction, extent, farmHousing);
}
private boolean isWaste(final ItemStack stack) {
return stack.getItem() == Item.getItemFromBlock(Blocks.dirt);
private boolean isWaste(ItemStack stack) {
return stack.getItem() == Item.getItemFromBlock(Blocks.DIRT);
}
private boolean maintainSoil(final int x2, final int y2, final int z2, final FarmDirection direction, final int extent) {
private boolean maintainSoil(World world, BlockPos pos, FarmDirection direction, int extent, IFarmHousing housing) {
IGardeningManager gardening = BotanyCore.getGardening();
for (int i = 0; i < extent; ++i) {
final Vect position = this.translateWithOffset(x2, y2, z2, direction, i);
if (this.fertilised && Gardening.isSoil(this.world.getBlock(position.x, position.y, position.z))) {
final IBlockSoil soil = (IBlockSoil) this.world.getBlock(position.x, position.y, position.z);
if (soil.fertilise(this.world, position.x, position.y, position.z, EnumSoilType.FLOWERBED)) {
BlockPos position = pos.offset(direction.getFacing(), i);
if (fertilised && gardening.isSoil(getBlock(world, position))) {
IBlockSoil soil = (IBlockSoil) getBlock(world, position);
if (soil.fertilise(world, position, EnumSoilType.FLOWERBED)) {
continue;
}
}
if (this.world.getBlock(position.x, position.y + 1, position.z) == Botany.plant) {
this.world.setBlockToAir(position.x, position.y + 1, position.z);
}
else {
if (this.acidity != null && Gardening.isSoil(this.world.getBlock(position.x, position.y, position.z))) {
final IBlockSoil soil = (IBlockSoil) this.world.getBlock(position.x, position.y, position.z);
final EnumAcidity pH = soil.getPH(this.world, position.x, position.y, position.z);
if (pH.ordinal() < this.acidity.ordinal()) {
final ItemStack stack = this.getAvailableAlkaline();
if (stack != null && soil.setPH(this.world, position.x, position.y, position.z, EnumAcidity.values()[pH.ordinal() + 1])) {
this.housing.getFarmInventory().removeResources(new ItemStack[] { stack });
if (getBlock(world, position.up()) == Botany.gardening().plant) {
world.setBlockToAir(position.up());
} else {
if (acidity != null && gardening.isSoil(getBlock(world, position))) {
IBlockSoil soil = (IBlockSoil) getBlock(world, position);
EnumAcidity pH = soil.getPH(world, position);
if (pH.ordinal() < acidity.ordinal()) {
ItemStack stack = getAvailableAlkaline(housing);
if (!stack.isEmpty() && soil.setPH(world, position, EnumAcidity.values()[pH.ordinal() + 1])) {
NonNullList<ItemStack> resources = NonNullList.create();
resources.add(stack);
housing.getFarmInventory().removeResources(resources);
continue;
}
}
if (pH.ordinal() > this.acidity.ordinal()) {
final ItemStack stack = this.getAvailableAcid();
if (stack != null && soil.setPH(this.world, position.x, position.y, position.z, EnumAcidity.values()[pH.ordinal() - 1])) {
this.housing.getFarmInventory().removeResources(new ItemStack[] { stack });
if (pH.ordinal() > acidity.ordinal()) {
ItemStack stack = getAvailableAcid(housing);
if (!stack.isEmpty() && soil.setPH(world, position, EnumAcidity.values()[pH.ordinal() - 1])) {
NonNullList<ItemStack> resources = NonNullList.create();
resources.add(stack);
housing.getFarmInventory().removeResources(resources);
continue;
}
}
}
if (!this.isAirBlock(position) && !this.world.getBlock(position.x, position.y, position.z).isReplaceable(this.world, position.x, position.y, position.z)) {
final ItemStack block = this.getAsItemStack(position);
final ItemStack loam = this.getAvailableLoam();
if (this.isWaste(block) && loam != null) {
this.produce.addAll(Blocks.dirt.getDrops(this.world, position.x, position.y, position.z, block.getItemDamage(), 0));
this.setBlock(position, Blocks.air, 0);
return this.trySetSoil(position, loam);
if (!isAirBlock(world, position) && !BlockUtil.isReplaceableBlock(getBlockState(world, position), world, position)) {
ItemStack block = getAsItemStack(world, position);
ItemStack loam = getAvailableLoam(housing);
if (isWaste(block) && !loam.isEmpty()) {
produce.addAll(Blocks.DIRT.getDrops(world, position, Block.getBlockFromItem(block.getItem()).getStateFromMeta(block.getItemDamage()), 0));
setBlock(world, position, Blocks.AIR, 0);
return trySetSoil(world, position, loam, housing);
}
}
else if (!this.isManual) {
if (!this.isWaterBlock(position)) {
} else if (!isManual) {
if (!isWaterBlock(world, position)) {
if (i % 2 == 0) {
return this.trySetSoil(position);
return trySetSoil(world, position, housing);
}
FarmDirection cclock = FarmDirection.EAST;
if (direction == FarmDirection.EAST) {
cclock = FarmDirection.SOUTH;
}
else if (direction == FarmDirection.SOUTH) {
} else if (direction == FarmDirection.SOUTH) {
cclock = FarmDirection.EAST;
}
else if (direction == FarmDirection.WEST) {
} else if (direction == FarmDirection.WEST) {
cclock = FarmDirection.SOUTH;
}
final Vect previous = this.translateWithOffset(position.x, position.y, position.z, cclock, 1);
final ItemStack soil2 = this.getAsItemStack(previous);
if (!Gardening.isSoil(soil2.getItem())) {
this.trySetSoil(position);
BlockPos previous = position.offset(cclock.getFacing());
ItemStack soil2 = getAsItemStack(world, previous);
if (!gardening.isSoil(soil2.getItem())) {
trySetSoil(world, position, housing);
}
}
}
@@ -169,111 +172,139 @@ public class GardenLogic extends FarmLogic
return false;
}
private boolean maintainWater(final int x, final int y, final int z, final FarmDirection direction, final int extent) {
private boolean maintainWater(World world, BlockPos pos, FarmDirection direction, int extent, IFarmHousing housing) {
for (int i = 0; i < extent; ++i) {
final Vect position = this.translateWithOffset(x, y, z, direction, i);
if (this.isAirBlock(position) || this.world.getBlock(x, y, z).isReplaceable(this.world, position.x, position.y, position.z)) {
if (!this.isWaterBlock(position)) {
boolean isEnclosed = true;
if (this.world.isAirBlock(position.x + 1, position.y, position.z)) {
isEnclosed = false;
}
else if (this.world.isAirBlock(position.x - 1, position.y, position.z)) {
isEnclosed = false;
}
else if (this.world.isAirBlock(position.x, position.y, position.z + 1)) {
isEnclosed = false;
}
else if (this.world.isAirBlock(position.x, position.y, position.z - 1)) {
isEnclosed = false;
}
isEnclosed = (isEnclosed || this.moisture != EnumMoisture.Damp);
if (isEnclosed) {
return this.trySetWater(position);
}
}
BlockPos position = pos.offset(direction.getFacing(), i);
if (!isAirBlock(world, position) && !BlockUtil.isReplaceableBlock(getBlockState(world, position), world, position)) {
continue;
}
if (isWaterBlock(world, position)) {
continue;
}
boolean isEnclosed = true;
if (world.isAirBlock(position.east())) {
isEnclosed = false;
} else if (world.isAirBlock(position.west())) {
isEnclosed = false;
} else if (world.isAirBlock(position.south())) {
isEnclosed = false;
} else if (world.isAirBlock(position.north())) {
isEnclosed = false;
}
isEnclosed = (isEnclosed || moisture != EnumMoisture.DAMP);
if (isEnclosed) {
return trySetWater(world, position, housing);
}
}
return false;
}
private ItemStack getAvailableLoam() {
private ItemStack getAvailableLoam(IFarmHousing housing) {
EnumMoisture[] moistures;
if (this.moisture == EnumMoisture.Damp) {
moistures = new EnumMoisture[] { EnumMoisture.Damp, EnumMoisture.Normal, EnumMoisture.Dry };
if (moisture == EnumMoisture.DAMP) {
moistures = new EnumMoisture[]{
EnumMoisture.DAMP,
EnumMoisture.NORMAL,
EnumMoisture.DRY
};
} else if (moisture == EnumMoisture.DRY) {
moistures = new EnumMoisture[]{
EnumMoisture.DRY,
EnumMoisture.DAMP,
EnumMoisture.DRY
};
} else {
moistures = new EnumMoisture[]{
EnumMoisture.DRY,
EnumMoisture.NORMAL,
EnumMoisture.DAMP
};
}
else if (this.moisture == EnumMoisture.Damp) {
moistures = new EnumMoisture[] { EnumMoisture.Dry, EnumMoisture.Damp, EnumMoisture.Dry };
}
else {
moistures = new EnumMoisture[] { EnumMoisture.Dry, EnumMoisture.Normal, EnumMoisture.Damp };
}
final EnumAcidity[] acidities = { EnumAcidity.Neutral, EnumAcidity.Acid, EnumAcidity.Alkaline };
for (final EnumMoisture moist : moistures) {
for (final EnumAcidity acid : acidities) {
for (final Block type : new Block[] { Botany.flowerbed, Botany.loam, Botany.soil }) {
final int meta = acid.ordinal() * 3 + moist.ordinal();
final ItemStack[] resource = { new ItemStack(type, 1, meta) };
if (this.housing.getFarmInventory().hasResources(resource)) {
return resource[0];
EnumAcidity[] acidities = {
EnumAcidity.NEUTRAL,
EnumAcidity.ACID,
EnumAcidity.ALKALINE
};
for (EnumMoisture moist : moistures) {
for (EnumAcidity acid : acidities) {
for (Block type : new Block[]{Botany.gardening().flowerbed, Botany.gardening().loam, Botany.gardening().soil}) {
int meta = acid.ordinal() * 3 + moist.ordinal();
NonNullList<ItemStack> resources = NonNullList.create();
ItemStack resourceStack = new ItemStack(type, 1, meta);
resources.add(resourceStack);
if (housing.getFarmInventory().hasResources(resources)) {
return resourceStack;
}
}
}
}
if (this.housing.getFarmInventory().hasResources(new ItemStack[] { new ItemStack(Blocks.dirt) })) {
return new ItemStack(Blocks.dirt);
NonNullList<ItemStack> resources = NonNullList.create();
ItemStack resourceStack = new ItemStack(Blocks.DIRT);
resources.add(resourceStack);
if (housing.getFarmInventory().hasResources(resources)) {
return new ItemStack(Blocks.DIRT);
}
return null;
return ItemStack.EMPTY;
}
private boolean trySetSoil(final Vect position) {
return this.trySetSoil(position, this.getAvailableLoam());
private boolean trySetSoil(World world, BlockPos position, IFarmHousing housing) {
return trySetSoil(world, position, getAvailableLoam(housing), housing);
}
private boolean trySetSoil(final Vect position, ItemStack loam) {
private boolean trySetSoil(World world, BlockPos position, ItemStack loam, IFarmHousing housing) {
ItemStack copy = loam;
if (loam != null) {
if (loam.getItem() == Item.getItemFromBlock(Blocks.dirt)) {
loam = new ItemStack(Botany.soil, 0, 4);
}
this.setBlock(position, ((ItemBlock) loam.getItem()).field_150939_a, loam.getItemDamage());
this.housing.getFarmInventory().removeResources(new ItemStack[] { copy });
return true;
if (loam.isEmpty()) {
return false;
}
return false;
if (loam.getItem() == Item.getItemFromBlock(Blocks.DIRT)) {
loam = new ItemStack(Botany.gardening().soil, 1, 4);
}
setBlock(world, position, ((ItemBlock) loam.getItem()).getBlock(), loam.getItemDamage());
NonNullList<ItemStack> resources = NonNullList.create();
resources.add(copy);
housing.getFarmInventory().removeResources(resources);
return true;
}
private boolean trySetWater(final Vect position) {
final FluidStack water = Binnie.Liquid.getLiquidStack("water", 1000);
if (this.moisture == EnumMoisture.Damp) {
if (!this.housing.hasLiquid(water)) {
private boolean trySetWater(World world, BlockPos position, IFarmHousing housing) {
FluidStack water = Binnie.LIQUID.getFluidStack(ManagerLiquid.WATER, 1000);
if (moisture == EnumMoisture.DAMP) {
if (water == null || !housing.hasLiquid(water)) {
return false;
}
this.setBlock(position, Blocks.water, 0);
this.housing.removeLiquid(water);
setBlock(world, position, Blocks.WATER, 0);
housing.removeLiquid(water);
return true;
}
else {
if (this.moisture != EnumMoisture.Dry) {
return this.trySetSoil(position);
}
final ItemStack[] sand = { new ItemStack(Blocks.sand, 1) };
if (!this.housing.getFarmInventory().hasResources(sand)) {
return false;
}
this.setBlock(position, Blocks.sand, 0);
this.housing.getFarmInventory().removeResources(sand);
return true;
if (moisture != EnumMoisture.DRY) {
return trySetSoil(world, position, housing);
}
ItemStack sand = new ItemStack(Blocks.SAND, 1);
NonNullList<ItemStack> resources = NonNullList.create();
resources.add(sand);
if (!housing.getFarmInventory().hasResources(resources)) {
return false;
}
setBlock(world, position, Blocks.SAND, 0);
housing.getFarmInventory().removeResources(resources);
return true;
}
public void setIcon(final ItemStack icon) {
public void setIcon(ItemStack icon) {
this.icon = icon;
}
@Override
public boolean isAcceptedGermling(final ItemStack itemstack) {
for (final IFarmable farmable : this.farmables) {
public boolean isAcceptedGermling(ItemStack itemstack) {
for (IFarmable farmable : farmables) {
if (farmable.isGermling(itemstack)) {
return true;
}
@@ -282,89 +313,86 @@ public class GardenLogic extends FarmLogic
}
@Override
public Collection<ICrop> harvest(final int x, final int y, final int z, final FarmDirection direction, final int extent) {
return null;
public Collection<ICrop> harvest(World world, BlockPos pos, FarmDirection direction, int extent) {
if (isManual) {
return Collections.emptyList();
}
return farmables.stream().map(farmable -> farmable.getCropAt(world, pos.up(), world.getBlockState(pos.up())))
.filter(Objects::nonNull).collect(Collectors.toList());
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon() {
return this.icon.getIconIndex();
}
@Override
public ResourceLocation getSpriteSheet() {
return TextureMap.locationBlocksTexture;
public ResourceLocation getTextureMap() {
return TextureMap.LOCATION_BLOCKS_TEXTURE;
}
@Override
public String getName() {
return this.name;
return name;
}
protected boolean maintainCrops(final int x, final int y, final int z, final FarmDirection direction, final int extent) {
@Override
public ItemStack getIconItemStack() {
return icon;
}
protected boolean maintainCrops(World world, BlockPos pos, FarmDirection direction, int extent, IFarmHousing housing) {
IGardeningManager gardening = BotanyCore.getGardening();
for (int i = 0; i < extent; ++i) {
final Vect position = this.translateWithOffset(x, y, z, direction, i);
if (this.isAirBlock(position) || this.world.getBlock(x, y, z).isReplaceable(this.world, position.x, position.y, position.z)) {
final ItemStack below = this.getAsItemStack(position.add(new Vect(0, -1, 0)));
if (Gardening.isSoil(below.getItem())) {
return this.trySetCrop(position);
BlockPos position = pos.offset(direction.getFacing(), i);
if (isAirBlock(world, position) || BlockUtil.isReplaceableBlock(getBlockState(world, position), world, position)) {
ItemStack below = getAsItemStack(world, position.down());
if (gardening.isSoil(below.getItem())) {
return trySetCrop(world, position, housing);
}
}
}
return false;
}
private boolean trySetCrop(final Vect position) {
for (final IFarmable farmable : this.farmables) {
final boolean success = this.housing.plantGermling(farmable, this.world, position.x, position.y, position.z);
if (success && this.housing instanceof IOwnable) {
final TileEntity tile = this.housing.getWorld().getTileEntity(position.x, position.y, position.z);
private boolean trySetCrop(World world, BlockPos position, IFarmHousing housing) {
for (IFarmable farmable : farmables) {
if (!housing.plantGermling(farmable, world, position)) {
continue;
}
if (housing instanceof IOwnedTile) {
TileEntity tile = world.getTileEntity(position);
if (tile instanceof TileEntityFlower) {
try {
final IOwnable housing2 = (IOwnable) this.housing;
GameProfile prof = null;
if (Mods.Forestry.dev()) {
prof = (GameProfile) IOwnable.class.getMethod("getOwner", new Class[0]).invoke(housing2, new Object[0]);
}
else {
prof = (GameProfile) IOwnable.class.getMethod("getOwnerProfile", new Class[0]).invoke(housing2, new Object[0]);
}
((TileEntityFlower) tile).setOwner(prof);
} catch (Exception ex) {
}
TileEntityFlower flower = (TileEntityFlower) tile;
IOwnedTile owned = (IOwnedTile) housing;
flower.setOwner(owned.getOwnerHandler().getOwner());
}
return true;
}
return true;
}
return false;
}
public ItemStack getAvailableAcid() {
for (final ItemStack stack : Gardening.getAcidFertilisers()) {
if (stack != null && stack.getItem() != null && this.housing.getFarmInventory().hasResources(new ItemStack[] { stack })) {
return stack;
public ItemStack getAvailableAcid(IFarmHousing housing) {
for (ItemStack stack : BotanyCore.getGardening().getAcidFertilisers()) {
if (!stack.isEmpty()) {
NonNullList<ItemStack> resources = NonNullList.create();
resources.add(stack);
if (housing.getFarmInventory().hasResources(resources)) {
return stack;
}
}
}
return null;
return ItemStack.EMPTY;
}
public ItemStack getAvailableAlkaline() {
for (final ItemStack stack : Gardening.getAlkalineFertilisers()) {
if (stack != null && stack.getItem() != null && this.housing.getFarmInventory().hasResources(new ItemStack[] { stack })) {
return stack;
public ItemStack getAvailableAlkaline(IFarmHousing housing) {
for (ItemStack stack : BotanyCore.getGardening().getAlkalineFertilisers()) {
if (!stack.isEmpty()) {
NonNullList<ItemStack> resources = NonNullList.create();
resources.add(stack);
if (housing.getFarmInventory().hasResources(resources)) {
return stack;
}
}
}
return null;
return ItemStack.EMPTY;
}
public void setData(final EnumMoisture moisture2, final EnumAcidity acidity2, final boolean isManual, final boolean isFertilised, final ItemStack icon2, final String name2) {
this.moisture = moisture2;
this.acidity = acidity2;
this.isManual = isManual;
this.fertilised = isFertilised;
this.icon = icon2;
this.name = name2;
}
}
@@ -1,79 +0,0 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.farm;
public class Vect
{
public int x;
public int y;
public int z;
public Vect(final int[] dim) {
if (dim.length != 3) {
throw new RuntimeException("Cannot instantiate a vector with less or more than 3 points.");
}
this.x = dim[0];
this.y = dim[1];
this.z = dim[2];
}
public Vect(final int x, final int y, final int z) {
this.x = x;
this.y = y;
this.z = z;
}
public Vect add(final Vect other) {
final Vect vect;
final Vect result = vect = new Vect(this.x, this.y, this.z);
vect.x += other.x;
final Vect vect2 = result;
vect2.y += other.y;
final Vect vect3 = result;
vect3.z += other.z;
return result;
}
public Vect multiply(final float factor) {
final Vect vect;
final Vect result = vect = new Vect(this.x, this.y, this.z);
vect.x *= (int) factor;
final Vect vect2 = result;
vect2.y *= (int) factor;
final Vect vect3 = result;
vect3.z *= (int) factor;
return result;
}
@Override
public String toString() {
return String.format("%sx%sx%s;", this.x, this.y, this.z);
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = 31 * result + this.x;
result = 31 * result + this.y;
result = 31 * result + this.z;
return result;
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (this.getClass() != obj.getClass()) {
return false;
}
final Vect other = (Vect) obj;
return this.x == other.x && this.y == other.y && this.z == other.z;
}
}
@@ -0,0 +1,9 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@FieldsAreNonnullByDefault
package binnie.botany.farm;
import javax.annotation.ParametersAreNonnullByDefault;
import binnie.core.util.FieldsAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
@@ -1,202 +1,320 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.flower;
import java.util.List;
import java.util.ArrayList;
import java.util.Random;
import binnie.botany.Botany;
import net.minecraft.init.Blocks;
import net.minecraft.block.Block;
import binnie.botany.api.IFlowerType;
import binnie.botany.api.EnumFlowerStage;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import com.mojang.authlib.GameProfile;
import binnie.botany.api.IFlower;
import binnie.botany.gardening.Gardening;
import net.minecraft.entity.player.EntityPlayer;
import binnie.botany.core.BotanyCore;
import binnie.core.BinnieCore;
import net.minecraft.item.ItemStack;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraft.block.material.Material;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import binnie.botany.genetics.EnumFlowerType;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.block.BlockContainer;
public class BlockFlower extends BlockContainer
{
@Override
public int getRenderType() {
return RendererBotany.renderID;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(final IIconRegister par1IconRegister) {
for (final EnumFlowerType type : EnumFlowerType.values()) {
type.registerIcons(par1IconRegister);
}
}
public BlockFlower() {
super(Material.plants);
final float f = 0.2f;
this.setBlockBounds(0.5f - f, 0.0f, 0.5f - f, 0.5f + f, f * 3.0f, 0.5f + f);
this.setTickRandomly(true);
this.setBlockName("flower");
}
@Override
public TileEntity createNewTileEntity(final World var1, final int i) {
return new TileEntityFlower();
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(final World par1World, final int par2, final int par3, final int par4) {
return null;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public void onBlockPlacedBy(final World world, final int x, final int y, final int z, final EntityLivingBase living, final ItemStack stack) {
super.onBlockPlacedBy(world, x, y, z, living, stack);
final TileEntity flower = world.getTileEntity(x, y, z);
if (!BinnieCore.proxy.isSimulating(world)) {
if (flower != null && flower instanceof TileEntityFlower) {
final IFlower f = BotanyCore.getFlowerRoot().getMember(stack);
((TileEntityFlower) flower).setRender(new TileEntityFlower.RenderInfo(f, (TileEntityFlower) flower));
}
return;
}
final TileEntity below = world.getTileEntity(x, y - 1, z);
if (flower != null && flower instanceof TileEntityFlower) {
if (below instanceof TileEntityFlower) {
((TileEntityFlower) flower).setSection(((TileEntityFlower) below).getSection());
}
else {
final GameProfile owner = (living instanceof EntityPlayer) ? ((EntityPlayer) living).getGameProfile() : null;
((TileEntityFlower) flower).create(stack, owner);
}
}
Gardening.tryGrowSection(world, x, y, z);
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) {
final TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileEntityFlower) {
final TileEntityFlower f = (TileEntityFlower) tile;
final EnumFlowerStage stage = (f.getAge() == 0) ? EnumFlowerStage.SEED : EnumFlowerStage.FLOWER;
final IFlowerType flower = f.getType();
final int section = f.getRenderSection();
final boolean flowered = f.isFlowered();
return (RendererBotany.pass == 0) ? flower.getStem(stage, flowered, section) : ((RendererBotany.pass == 1) ? flower.getPetalIcon(stage, flowered, section) : flower.getVariantIcon(stage, flowered, section));
}
return super.getIcon(world, x, y, z, side);
}
@Override
@SideOnly(Side.CLIENT)
public int colorMultiplier(final IBlockAccess world, final int x, final int y, final int z) {
final TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileEntityFlower) {
final TileEntityFlower f = (TileEntityFlower) tile;
return (RendererBotany.pass == 0) ? f.getStemColour() : ((RendererBotany.pass == 1) ? f.getPrimaryColour() : f.getSecondaryColour());
}
return 16777215;
}
@Override
public boolean canPlaceBlockAt(final World world, final int x, final int y, final int z) {
return super.canPlaceBlockAt(world, x, y, z) && this.canBlockStay(world, x, y, z);
}
protected boolean canPlaceBlockOn(final Block block) {
return block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland || Gardening.isSoil(block);
}
@Override
public void onNeighborBlockChange(final World world, final int x, final int y, final int z, final Block block) {
super.onNeighborBlockChange(world, x, y, z, block);
this.checkAndDropBlock(world, x, y, z);
final TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileEntityFlower) {
final TileEntityFlower flower = (TileEntityFlower) tile;
if (flower.getSection() == 0 && flower.getFlower() != null && flower.getFlower().getAge() > 0 && flower.getFlower().getGenome().getPrimary().getType().getSections() > 1 && world.getBlock(x, y + 1, z) != Botany.flower) {
this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
world.setBlockToAir(x, y, z);
}
}
}
@Override
public void updateTick(final World world, final int x, final int y, final int z, final Random rand) {
final TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileEntityFlower) {
((TileEntityFlower) tile).randomUpdate(rand);
this.checkAndDropBlock(world, x, y, z);
return;
}
world.setBlockToAir(x, y, z);
}
protected void checkAndDropBlock(final World world, final int x, final int y, final int z) {
if (!this.canBlockStay(world, x, y, z)) {
this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
world.setBlockToAir(x, y, z);
}
}
@Override
public boolean canBlockStay(final World world, final int x, final int y, final int z) {
final TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() > 0) {
return world.getBlock(x, y - 1, z) == Botany.flower;
}
return this.canPlaceBlockOn(world.getBlock(x, y - 1, z));
}
@Override
public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int blockMeta, final int fortune) {
final ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
final TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() == 0) {
final ItemStack flower = ((TileEntityFlower) tile).getItemStack();
if (flower != null) {
drops.add(flower);
}
}
return drops;
}
@Override
public boolean removedByPlayer(final World world, final EntityPlayer player, final int x, final int y, final int z) {
final List<ItemStack> drops = this.getDrops(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
final boolean hasBeenBroken = world.setBlockToAir(x, y, z);
if (hasBeenBroken && BinnieCore.proxy.isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
for (final ItemStack drop : drops) {
this.dropBlockAsItem(world, x, y, z, drop);
}
}
return hasBeenBroken;
}
}
package binnie.botany.flower;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import com.mojang.authlib.GameProfile;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.core.IStateMapperRegister;
import forestry.core.blocks.IColoredBlock;
import binnie.botany.Botany;
import binnie.botany.api.IFlower;
import binnie.botany.api.IFlowerGenome;
import binnie.botany.api.IFlowerRoot;
import binnie.botany.api.IFlowerType;
import binnie.botany.core.BotanyCore;
import binnie.botany.genetics.EnumFlowerType;
import binnie.botany.genetics.FlowerDefinition;
import binnie.botany.network.PacketID;
import binnie.core.BinnieCore;
import binnie.core.network.packet.MessageNBT;
import binnie.core.util.TileUtil;
public class BlockFlower extends BlockContainer implements IColoredBlock, IStateMapperRegister {
public static final AxisAlignedBB FLOWER_BLOCK_AABB = new AxisAlignedBB(0.3D, 0.0D, 0.3D, 0.7D, 0.6D, 0.7D);
/* PROPERTIES */
public static final PropertyFlower FLOWER = new PropertyFlower("flower", IFlowerType.class);
public static final PropertyInteger SECTION = PropertyInteger.create("section", 0, EnumFlowerType.highestSection - 1);
public static final PropertyBool FLOWERED = PropertyBool.create("flowered");
public static final PropertyBool SEED = PropertyBool.create("seed");
public BlockFlower() {
super(Material.PLANTS);
setTickRandomly(true);
setRegistryName("flower");
setSoundType(SoundType.PLANT);
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TileEntityFlower();
}
@Override
@SideOnly(Side.CLIENT)
public void registerStateMapper() {
ModelLoader.setCustomStateMapper(this, new StateMapperFlower());
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
ItemStack heldItem = player.getHeldItemMainhand();
if (heldItem.isEmpty() || heldItem.getItem() != BinnieCore.getFieldKit() || !player.isSneaking()) {
return false;
}
if (world.isRemote) {
return true;
}
TileEntity tile = world.getTileEntity(pos);
if (!(tile instanceof TileEntityFlower)) {
return true;
}
TileEntityFlower tileFlower = (TileEntityFlower) tile;
IFlower flower = tileFlower.getFlower();
if (flower == null) {
return true;
}
IFlowerGenome flowerGenome = flower.getGenome();
NBTTagCompound info = new NBTTagCompound();
info.setString("Species", flowerGenome.getPrimary().getUID());
info.setString("Species2", flowerGenome.getSecondary().getUID());
info.setFloat("Age", flower.getAge() / flowerGenome.getLifespan());
info.setShort("Colour", (short) flowerGenome.getPrimaryColor().getID());
info.setShort("Colour2", (short) flowerGenome.getSecondaryColor().getID());
info.setBoolean("Wilting", flower.isWilted());
info.setBoolean("Flowered", flower.hasFlowered());
Botany.proxy.sendToPlayer(new MessageNBT(PacketID.FIELDKIT.ordinal(), info), player);
heldItem.damageItem(1, player);
return true;
}
@Override
@Nullable
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) {
return null;
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
TileEntity tile = source.getTileEntity(pos);
if (tile instanceof TileEntityFlower) {
TileEntityFlower flower = (TileEntityFlower) tile;
if (flower.getType().getSections() > 1) {
return FULL_BLOCK_AABB;
}
}
return FLOWER_BLOCK_AABB;
}
@Override
public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World world, BlockPos pos) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileEntityFlower) {
TileEntityFlower flower = (TileEntityFlower) tile;
if (flower.getType().getSections() > 1) {
return FULL_BLOCK_AABB.offset(pos);
}
}
return FLOWER_BLOCK_AABB.offset(pos);
}
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
}
@Override
public boolean isFullCube(IBlockState state) {
return false;
}
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
super.onBlockPlacedBy(world, pos, state, placer, stack);
IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot();
TileEntity flower = world.getTileEntity(pos);
if (!BinnieCore.getBinnieProxy().isSimulating(world)) {
if (flower != null && flower instanceof TileEntityFlower) {
IFlower f = flowerRoot.getMember(stack);
if (f != null) {
((TileEntityFlower) flower).setRender(new TileEntityFlower.RenderInfo(f, (TileEntityFlower) flower));
}
}
return;
}
TileEntity below = world.getTileEntity(pos.down());
if (flower != null && flower instanceof TileEntityFlower) {
if (below instanceof TileEntityFlower) {
((TileEntityFlower) flower).setSection(((TileEntityFlower) below).getSection());
} else {
GameProfile owner = (placer instanceof EntityPlayer) ? ((EntityPlayer) placer).getGameProfile() : null;
((TileEntityFlower) flower).create(stack, owner);
}
}
flowerRoot.tryGrowSection(world, pos);
}
@Override
@SideOnly(Side.CLIENT)
public int colorMultiplier(IBlockState state, @Nullable IBlockAccess world, @Nullable BlockPos pos, int tintIndex) {
if (world != null && pos != null) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileEntityFlower) {
TileEntityFlower flower = (TileEntityFlower) tile;
if (tintIndex == 0) {
return flower.getStemColour();
} else if (tintIndex == 1) {
return flower.getPrimaryColour();
}
return flower.getSecondaryColour();
}
}
return 0xffffff;
}
@Override
public boolean canPlaceBlockAt(World world, BlockPos pos) {
return super.canPlaceBlockAt(world, pos) && canBlockStay(world, pos);
}
public boolean canBlockStay(World world, BlockPos pos) {
TileEntity tile = world.getTileEntity(pos);
IBlockState downState = world.getBlockState(pos.down());
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() > 0) {
return downState.getBlock() == Botany.flower;
}
return canPlaceBlockOn(downState.getBlock());
}
protected boolean canPlaceBlockOn(Block block) {
return block == Blocks.GRASS
|| block == Blocks.DIRT
|| block == Blocks.FARMLAND
|| BotanyCore.getGardening().isSoil(block);
}
@Override
@SideOnly(Side.CLIENT)
public EnumBlockRenderType getRenderType(IBlockState state) {
return EnumBlockRenderType.MODEL;
}
@Override
@SideOnly(Side.CLIENT)
public EnumOffsetType getOffsetType() {
return EnumOffsetType.XZ;
}
@Override
@SideOnly(Side.CLIENT)
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
TileEntityFlower flower = TileUtil.getTile(world, pos, TileEntityFlower.class);
if (flower != null && flower.getType() != null) {
state = state.withProperty(FLOWER, flower.getType());
state = state.withProperty(FLOWERED, flower.isFlowered());
state = state.withProperty(SECTION, flower.getRenderSection());
state = state.withProperty(SEED, flower.getAge() == 0);
} else {
state = state.withProperty(FLOWER, FlowerDefinition.Dandelion.getSpecies().getType());
state = state.withProperty(FLOWERED, false);
state = state.withProperty(SEED, false);
}
return state;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, FLOWER, FLOWERED, SECTION, SEED);
}
@Override
public int getMetaFromState(IBlockState state) {
return 0;
}
@Override
public BlockRenderLayer getBlockLayer() {
return BlockRenderLayer.CUTOUT;
}
@Override
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) {
checkAndDropBlock(worldIn, pos);
TileEntity tile = worldIn.getTileEntity(pos);
if (tile instanceof TileEntityFlower) {
TileEntityFlower flower = (TileEntityFlower) tile;
if (flower.getSection() == 0 && flower.getFlower() != null && flower.getFlower().getAge() > 0 && flower.getFlower().getGenome().getPrimary().getType().getSections() > 1 && worldIn.getBlockState(pos.up()).getBlock() != Botany.flower) {
dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0);
worldIn.setBlockToAir(pos);
}
}
}
@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileEntityFlower) {
((TileEntityFlower) tile).randomUpdate(rand);
checkAndDropBlock(world, pos);
return;
}
world.setBlockToAir(pos);
}
protected void checkAndDropBlock(World world, BlockPos pos) {
if (!canBlockStay(world, pos)) {
dropBlockAsItem(world, pos, world.getBlockState(pos), 0);
world.setBlockToAir(pos);
}
}
@Override
public NonNullList<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
NonNullList<ItemStack> drops = NonNullList.create();
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() == 0) {
ItemStack flower = ((TileEntityFlower) tile).getItemStack();
if (!flower.isEmpty()) {
drops.add(flower);
}
}
return drops;
}
@Override
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
List<ItemStack> drops = getDrops(world, pos, world.getBlockState(pos), 0);
boolean hasBeenBroken = world.setBlockToAir(pos);
if (hasBeenBroken && BinnieCore.getBinnieProxy().isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
for (ItemStack drop : drops) {
spawnAsEntity(world, pos, drop);
}
}
return hasBeenBroken;
}
}
@@ -0,0 +1,64 @@
package binnie.botany.flower;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import binnie.core.util.I18N;
public enum EnumTubeInsulate {
CLAY(0xa1aacc, "clay"),
COBBLE(0x7b7b7b, "cobblestone"),
SAND(0xefeab5, "sandstone"),
HARDENED_CLAY(0x935c43, "hardened_clay"),
STONE(0x6d6d6d, "stone"),
SANDSTONE(0xc1b989, "sandstone");
public static final EnumTubeInsulate[] VALUES = values();
int color;
String uid;
EnumTubeInsulate(int color, String uid) {
this.color = color;
this.uid = uid;
}
public static EnumTubeInsulate get(int meta) {
return VALUES[meta / 128 % VALUES.length];
}
public int getColor() {
return color;
}
public String getDisplayName() {
return I18N.localise("botany.tube.insulate." + uid + ".name");
}
public String getUid() {
return uid;
}
public ItemStack getStack() {
switch (this) {
case CLAY:
return new ItemStack(Blocks.CLAY);
case COBBLE:
return new ItemStack(Blocks.COBBLESTONE);
case HARDENED_CLAY:
return new ItemStack(Blocks.HARDENED_CLAY);
case SAND:
return new ItemStack(Blocks.SAND);
case SANDSTONE:
return new ItemStack(Blocks.SANDSTONE);
case STONE:
return new ItemStack(Blocks.STONE);
}
throw new IllegalStateException("Unknown insulated tube type: " + this);
}
}
@@ -0,0 +1,36 @@
package binnie.botany.flower;
import binnie.core.util.I18N;
public enum EnumTubeMaterial {
COPPER(0xe3b78e, "copper"),
TIN(0xe1eef4, "tin"),
BRONZE(0xddc276, "bronze"),
IRON(0xd8d8d8, "iron");
public static final EnumTubeMaterial[] VALUES = values();
int color;
String uid;
EnumTubeMaterial(int color, String uid) {
this.color = color;
this.uid = uid;
}
public static EnumTubeMaterial get(int meta) {
return VALUES[meta % VALUES.length];
}
public String getUid() {
return uid;
}
public int getColor() {
return color;
}
public String getDisplayName() {
return I18N.localise("botany.tube.material." + uid + ".name");
}
}
@@ -0,0 +1,96 @@
package binnie.botany.flower;
import javax.annotation.Nullable;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import binnie.Binnie;
import binnie.botany.Botany;
import binnie.botany.api.IFlowerType;
import binnie.core.resource.BinnieSprite;
public class FlowerSpriteManager {
private static final Map<IFlowerType, FlowerSprites> flowerSprites = new HashMap<>();
public static void initSprites(IFlowerType type) {
if (flowerSprites.containsKey(type)) {
return;
}
flowerSprites.put(type, new FlowerSprites(type));
}
@Nullable
@SideOnly(Side.CLIENT)
public static TextureAtlasSprite getStem(IFlowerType type, int section, boolean flowered) {
FlowerSprites flower = flowerSprites.get(type);
if (flower == null) {
return null;
}
return flower.getStem(type, section, flowered);
}
@Nullable
@SideOnly(Side.CLIENT)
public static TextureAtlasSprite getPetal(IFlowerType type, int section, boolean flowered) {
FlowerSprites flower = flowerSprites.get(type);
if (flower == null) {
return null;
}
return flower.getPetal(type, section, flowered);
}
@Nullable
@SideOnly(Side.CLIENT)
public static TextureAtlasSprite getVariant(IFlowerType type, int section, boolean flowered) {
FlowerSprites flower = flowerSprites.get(type);
if (flower == null) {
return null;
}
return flower.getVariant(type, section, flowered);
}
private static class FlowerSprites {
private BinnieSprite[] stem;
private BinnieSprite[] variant;
private BinnieSprite[] petal;
private BinnieSprite[] unflowered;
private int sections;
public FlowerSprites(IFlowerType type) {
sections = type.getSections();
stem = new BinnieSprite[sections];
petal = new BinnieSprite[sections];
variant = new BinnieSprite[sections];
unflowered = new BinnieSprite[sections];
for (int section = 0; section < sections; ++section) {
String suf = (section == 0) ? "" : ("" + (section + 1));
String pre = (sections == 1) ? "" : "double/";
stem[section] = Binnie.RESOURCE.getBlockSprite(Botany.instance, "flowers/" + pre + type.toString().toLowerCase() + suf + ".0");
petal[section] = Binnie.RESOURCE.getBlockSprite(Botany.instance, "flowers/" + pre + type.toString().toLowerCase() + suf + ".1");
variant[section] = Binnie.RESOURCE.getBlockSprite(Botany.instance, "flowers/" + pre + type.toString().toLowerCase() + suf + ".2");
unflowered[section] = Binnie.RESOURCE.getBlockSprite(Botany.instance, "flowers/" + pre + type.toString().toLowerCase() + suf + ".3");
}
}
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getStem(IFlowerType type, int section, boolean flowered) {
return stem[section % sections].getSprite();
}
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getPetal(IFlowerType type, int section, boolean flowered) {
return (flowered ? petal[section % sections] : unflowered[section % sections]).getSprite();
}
@Nullable
@SideOnly(Side.CLIENT)
public TextureAtlasSprite getVariant(IFlowerType type, int section, boolean flowered) {
return flowered ? variant[section % sections].getSprite() : null;
}
}
}
+187 -209
View File
@@ -1,53 +1,67 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.flower;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.block.Block;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.entity.Entity;
import net.minecraft.world.IBlockAccess;
import net.minecraft.init.Blocks;
import binnie.botany.Botany;
import forestry.api.genetics.IPollinatable;
import binnie.Binnie;
import binnie.botany.api.EnumFlowerStage;
import net.minecraft.world.World;
import binnie.botany.api.IFlowerType;
import binnie.botany.genetics.EnumFlowerType;
import net.minecraft.util.IIcon;
import forestry.core.config.Config;
import net.minecraft.creativetab.CreativeTabs;
import binnie.botany.api.EnumFlowerChromosome;
import binnie.botany.core.BotanyCore;
import binnie.botany.api.IAlleleFlowerSpecies;
import binnie.botany.genetics.Flower;
import net.minecraft.client.renderer.texture.IIconRegister;
import binnie.core.BinnieCore;
import binnie.botany.api.IFlower;
import com.google.common.base.Preconditions;
import javax.annotation.Nullable;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import forestry.api.genetics.IIndividual;
import net.minecraft.item.ItemStack;
import binnie.botany.CreativeTabBotany;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
public abstract class ItemBotany extends Item
{
@Override
@SideOnly(Side.CLIENT)
public int getSpriteNumber() {
return 0;
}
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public ItemBotany(final String name) {
this.setCreativeTab(CreativeTabBotany.instance);
this.setUnlocalizedName(name);
this.hasSubtypes = true;
import forestry.api.core.IItemModelRegister;
import forestry.api.core.IModelManager;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IPollinatable;
import forestry.core.config.Config;
import forestry.core.items.IColoredItem;
import binnie.Binnie;
import binnie.botany.Botany;
import binnie.botany.CreativeTabBotany;
import binnie.botany.api.EnumFlowerChromosome;
import binnie.botany.api.EnumFlowerStage;
import binnie.botany.api.IAlleleFlowerSpecies;
import binnie.botany.api.IFlower;
import binnie.botany.api.IFlowerGenome;
import binnie.botany.api.IFlowerType;
import binnie.botany.core.BotanyCore;
import binnie.botany.genetics.Flower;
import binnie.core.util.I18N;
public class ItemBotany extends Item implements IColoredItem, IItemModelRegister {
private EnumFlowerStage type;
private String tag;
public ItemBotany(String name, EnumFlowerStage type, String tag) {
this.type = type;
this.tag = tag;
setCreativeTab(CreativeTabBotany.instance);
setUnlocalizedName(name);
setRegistryName(name);
hasSubtypes = true;
}
@Override
@@ -66,223 +80,187 @@ public abstract class ItemBotany extends Item
}
@Override
public boolean hasEffect(final ItemStack itemstack) {
public boolean hasEffect(ItemStack itemstack) {
if (!itemstack.hasTagCompound()) {
return false;
}
final IIndividual individual = this.getIndividual(itemstack);
return individual != null && individual.getGenome() != null && individual.hasEffect();
}
@Override
public void addInformation(final ItemStack itemstack, final EntityPlayer player, final List list, final boolean flag) {
if (!itemstack.hasTagCompound()) {
return;
}
final IFlower individual = (IFlower) this.getIndividual(itemstack);
if (individual == null) {
list.add("This item is bugged. Destroy it!");
return;
}
list.add("§e" + individual.getGenome().getPrimaryColor().getName() + ((individual.getGenome().getPrimaryColor() == individual.getGenome().getSecondaryColor()) ? "" : (" and " + individual.getGenome().getSecondaryColor().getName())) + ", " + individual.getGenome().getStemColor().getName() + " Stem");
if (individual.isAnalyzed()) {
if (BinnieCore.proxy.isShiftDown()) {
individual.addTooltip(list);
}
else {
list.add("§o<Hold shift for details>");
}
}
else {
list.add("<Unknown>");
}
IIndividual individual = getIndividual(itemstack);
return individual != null && individual.hasEffect();
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(final IIconRegister par1IconRegister) {
public void addInformation(ItemStack itemStack, @Nullable World worldIn, List<String> list, ITooltipFlag flagIn) {
IFlower individual = (IFlower) getIndividual(itemStack);
if (individual == null) {
list.add(TextFormatting.DARK_RED + I18N.localise("item.botany.flower.destroy"));
return;
}
IFlowerGenome genome = individual.getGenome();
//Colors
String primaryColor = genome.getPrimaryColor().getColorName();
String secondaryColor = genome.getSecondaryColor().getColorName();
String stemColor = genome.getStemColor().getColorName();
String colorInfo;
if (!primaryColor.equals(secondaryColor)) {
colorInfo = I18N.localise("item.botany.grammar.flower.secondary");
} else {
colorInfo = I18N.localise("item.botany.grammar.flower");
}
list.add(TextFormatting.YELLOW + colorInfo.replaceAll("%PRIMARY", primaryColor).replaceAll("%SECONDARY", secondaryColor).replaceAll("%STEM", stemColor));
if (individual.isAnalyzed()) {
if (GuiScreen.isShiftKeyDown()) {
individual.addTooltip(list);
} else {
list.add(TextFormatting.ITALIC + "<" + I18N.localise("for.gui.tooltip.tmi") + ">");
}
} else {
list.add("<" + I18N.localise("for.gui.unknown") + ">");
}
}
protected IIndividual getIndividual(final ItemStack itemstack) {
return new Flower(itemstack.getTagCompound());
@Nullable
protected IIndividual getIndividual(ItemStack itemstack) {
NBTTagCompound tagCompound = itemstack.getTagCompound();
if (tagCompound == null) {
return null;
}
return new Flower(tagCompound);
}
private IAlleleFlowerSpecies getPrimarySpecies(final ItemStack itemstack) {
final IFlower tree = BotanyCore.speciesRoot.getMember(itemstack);
private IAlleleFlowerSpecies getPrimarySpecies(ItemStack itemstack) {
IFlower tree = BotanyCore.getFlowerRoot().getMember(itemstack);
if (tree == null) {
return (IAlleleFlowerSpecies) BotanyCore.speciesRoot.getDefaultTemplate()[EnumFlowerChromosome.SPECIES.ordinal()];
return (IAlleleFlowerSpecies) BotanyCore.getFlowerRoot().getDefaultTemplate()[EnumFlowerChromosome.SPECIES.ordinal()];
}
return tree.getGenome().getPrimary();
}
@Override
public String getItemStackDisplayName(final ItemStack itemstack) {
public String getItemStackDisplayName(ItemStack itemstack) {
if (!itemstack.hasTagCompound()) {
return "Unknown";
return I18N.localise("item.botany.flower.corrupted.name");
}
final IIndividual individual = this.getIndividual(itemstack);
return (individual != null && individual.getGenome() != null) ? (individual.getDisplayName() + this.getTag()) : "Corrupted Flower";
IIndividual individual = getIndividual(itemstack);
if (individual != null) {
return individual.getDisplayName() + (!tag.isEmpty() ? " " + I18N.localise("item.botany." + tag + ".name") : "");
}
return I18N.localise("item.botany.flower.corrupted.name");
}
@Override
public void getSubItems(final Item item, final CreativeTabs par2CreativeTabs, final List itemList) {
this.addCreativeItems(itemList, true);
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> items) {
if (this.isInCreativeTab(tab)) {
addCreativeItems(items, true);
}
}
public void addCreativeItems(final List itemList, final boolean hideSecrets) {
for (final IIndividual individual : BotanyCore.speciesRoot.getIndividualTemplates()) {
public void addCreativeItems(NonNullList<ItemStack> itemList, boolean hideSecrets) {
for (IIndividual individual : BotanyCore.getFlowerRoot().getIndividualTemplates()) {
if (hideSecrets && individual.isSecret() && !Config.isDebug) {
continue;
}
itemList.add(BotanyCore.speciesRoot.getMemberStack(individual.copy(), this.getStage().ordinal()));
itemList.add(BotanyCore.getFlowerRoot().getMemberStack(individual.copy(), type));
}
}
@Override
public int getColorFromItemStack(final ItemStack itemstack, final int renderPass) {
final IFlower flower = BotanyCore.speciesRoot.getMember(itemstack);
if (flower == null || flower.getGenome() == null) {
return 16777215;
public int getColorFromItemstack(ItemStack stack, int tintIndex) {
IFlower flower = BotanyCore.getFlowerRoot().getMember(stack);
if (flower == null) {
return 0xffffff;
}
return (renderPass == 0) ? flower.getGenome().getStemColor().getColor(flower.isWilted()) : ((renderPass == 1) ? flower.getGenome().getPrimaryColor().getColor(flower.isWilted()) : flower.getGenome().getSecondaryColor().getColor(flower.isWilted()));
}
@Override
public boolean requiresMultipleRenderPasses() {
return true;
}
@Override
public int getRenderPasses(final int metadata) {
return 3;
if (tintIndex == 0) {
return flower.getGenome().getStemColor().getColor(flower.isWilted());
}
return (tintIndex == 1)
? flower.getGenome().getPrimaryColor().getColor(flower.isWilted())
: flower.getGenome().getSecondaryColor().getColor(flower.isWilted());
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(final ItemStack itemstack, final int renderPass) {
final IFlower flower = BotanyCore.speciesRoot.getMember(itemstack);
if (flower == null || flower.getGenome() == null || flower.getGenome().getPrimary() == null) {
return EnumFlowerType.Allium.getBlank();
public void registerModel(Item item, IModelManager manager) {
for (IFlowerType flowerType : (List<IFlowerType>) BlockFlower.FLOWER.getAllowedValues()) {
flowerType.registerModels(item, manager, type);
}
final IFlowerType type = flower.getGenome().getPrimary().getType();
if (renderPass == 0) {
return type.getStem(this.getStage(), flower.hasFlowered(), type.getSections() - 1);
}
if (renderPass == 1) {
return type.getPetalIcon(this.getStage(), flower.hasFlowered(), type.getSections() - 1);
}
return type.getVariantIcon(this.getStage(), flower.hasFlowered(), type.getSections() - 1);
manager.registerItemModel(item, new BotanyMeshDefinition());
}
@Override
public boolean onItemUse(final ItemStack itemstack, final EntityPlayer player, final World world, int x, int y, int z, int side, final float px, final float py, final float pz) {
if (this.getStage() == EnumFlowerStage.POLLEN) {
final IFlower flower = Binnie.Genetics.getFlowerRoot().getMember(itemstack);
final TileEntity target = world.getTileEntity(x, y, z);
if (!(target instanceof IPollinatable)) {
return false;
}
final IPollinatable pollinatable = (IPollinatable) target;
if (!pollinatable.canMateWith(flower)) {
return false;
}
pollinatable.mateWith(flower);
if (!player.capabilities.isCreativeMode) {
--itemstack.stackSize;
}
return true;
}
else {
final Block blockFlower = Botany.flower;
final Block blockAlreadyThere = world.getBlock(x, y, z);
if (blockAlreadyThere == Blocks.snow_layer && (world.getBlockMetadata(x, y, z) & 0x7) < 1) {
side = 1;
}
else if (blockAlreadyThere != Blocks.vine && blockAlreadyThere != Blocks.tallgrass && blockAlreadyThere != Blocks.deadbush && !blockAlreadyThere.isReplaceable(world, x, y, z)) {
if (side == 0) {
--y;
}
if (side == 1) {
++y;
}
if (side == 2) {
--z;
}
if (side == 3) {
++z;
}
if (side == 4) {
--x;
}
if (side == 5) {
++x;
}
}
if (itemstack.stackSize == 0) {
return false;
}
if (!player.canPlayerEdit(x, y, z, side, itemstack)) {
return false;
}
if (y == 255 && blockFlower.getMaterial().isSolid()) {
return false;
}
if (world.canPlaceEntityOnSide(blockFlower, x, y, z, false, side, player, itemstack)) {
final int i1 = this.getMetadata(itemstack.getItemDamage());
final int j1 = blockFlower.onBlockPlaced(world, x, y, z, side, px, py, pz, i1);
if (this.placeBlockAt(itemstack, player, world, x, y, z, side, px, py, pz, j1)) {
world.playSoundEffect(x + 0.5f, y + 0.5f, z + 0.5f, blockFlower.stepSound.func_150496_b(), (blockFlower.stepSound.getVolume() + 1.0f) / 2.0f, blockFlower.stepSound.getPitch() * 0.8f);
--itemstack.stackSize;
}
return true;
}
return false;
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
ItemStack stack = player.getHeldItem(hand);
if (type == EnumFlowerStage.POLLEN) {
return pollinateFlower(world, pos, player, stack);
}
return placeFlower(player, stack, world, pos, hand, facing, hitX, hitY, hitZ);
}
@SideOnly(Side.CLIENT)
public boolean func_150936_a(final World p_150936_1_, int p_150936_2_, int p_150936_3_, int p_150936_4_, int p_150936_5_, final EntityPlayer p_150936_6_, final ItemStack p_150936_7_) {
final Block field_150939_a = Botany.flower;
final Block block = p_150936_1_.getBlock(p_150936_2_, p_150936_3_, p_150936_4_);
if (block == Blocks.snow_layer) {
p_150936_5_ = 1;
private EnumActionResult pollinateFlower(World world, BlockPos pos, EntityPlayer player, ItemStack stack){
IFlower flower = Binnie.GENETICS.getFlowerRoot().getMember(stack);
TileEntity target = world.getTileEntity(pos);
if (!(target instanceof IPollinatable)) {
return EnumActionResult.PASS;
}
else if (block != Blocks.vine && block != Blocks.tallgrass && block != Blocks.deadbush && !block.isReplaceable(p_150936_1_, p_150936_2_, p_150936_3_, p_150936_4_)) {
if (p_150936_5_ == 0) {
--p_150936_3_;
}
if (p_150936_5_ == 1) {
++p_150936_3_;
}
if (p_150936_5_ == 2) {
--p_150936_4_;
}
if (p_150936_5_ == 3) {
++p_150936_4_;
}
if (p_150936_5_ == 4) {
--p_150936_2_;
}
if (p_150936_5_ == 5) {
++p_150936_2_;
}
IPollinatable pollinatable = (IPollinatable) target;
if (!pollinatable.canMateWith(flower)) {
return EnumActionResult.FAIL;
}
return p_150936_1_.canPlaceEntityOnSide(field_150939_a, p_150936_2_, p_150936_3_, p_150936_4_, false, p_150936_5_, (Entity) null, p_150936_7_);
pollinatable.mateWith(flower);
if (!player.capabilities.isCreativeMode) {
stack.shrink(1);
}
return EnumActionResult.SUCCESS;
}
public boolean placeBlockAt(final ItemStack stack, final EntityPlayer player, final World world, final int x, final int y, final int z, final int side, final float hitX, final float hitY, final float hitZ, final int metadata) {
final Block field_150939_a = Botany.flower;
if (!world.setBlock(x, y, z, field_150939_a, metadata, 3)) {
private EnumActionResult placeFlower(EntityPlayer player, ItemStack stack, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ){
IBlockState blockState = world.getBlockState(pos);
Block block = blockState.getBlock();
if (!block.isReplaceable(world, pos)) {
pos = pos.offset(facing);
}
if (stack.getCount() != 0 && player.canPlayerEdit(pos, facing, stack) && world.mayPlace(Botany.flower, pos, false, facing, null)) {
int i = getMetadata(stack.getMetadata());
IBlockState stateForPlacement = Botany.flower.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, i, player, hand);
if (placeBlockAt(stack, player, world, pos, facing, hitX, hitY, hitZ, stateForPlacement)) {
SoundType soundType = block.getSoundType(stateForPlacement, world, pos, player);
world.playSound(player, pos, soundType.getPlaceSound(), SoundCategory.BLOCKS, (soundType.getVolume() + 1.0F) / 2.0F, soundType.getPitch() * 0.8F);
stack.shrink(1);
}
return EnumActionResult.SUCCESS;
}
return EnumActionResult.FAIL;
}
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) {
if (!world.setBlockState(pos, newState, 3)) {
return false;
}
if (world.getBlock(x, y, z) == field_150939_a) {
field_150939_a.onBlockPlacedBy(world, x, y, z, player, stack);
field_150939_a.onPostBlockPlaced(world, x, y, z, metadata);
IBlockState state = world.getBlockState(pos);
if (state.getBlock() == Botany.flower) {
ItemBlock.setTileEntityNBT(world, player, pos, stack);
Botany.flower.onBlockPlacedBy(world, pos, state, player, stack);
}
return true;
}
public abstract EnumFlowerStage getStage();
public abstract String getTag();
@SideOnly(Side.CLIENT)
private class BotanyMeshDefinition implements ItemMeshDefinition {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
IFlower flower = BotanyCore.getFlowerRoot().getMember(stack);
Preconditions.checkNotNull(flower);
IAlleleFlowerSpecies flowerSpecies = flower.getGenome().getPrimary();
IFlowerType flowerType = flowerSpecies.getType();
return flowerSpecies.getFlowerModel(type, flower.hasFlowered());
}
}
}
@@ -1,24 +0,0 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.flower;
import binnie.botany.api.EnumFlowerStage;
public class ItemFlower extends ItemBotany
{
public ItemFlower() {
super("itemFlower");
}
@Override
public EnumFlowerStage getStage() {
return EnumFlowerStage.FLOWER;
}
@Override
public String getTag() {
return "";
}
}
@@ -1,173 +1,126 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.flower;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import binnie.botany.CreativeTabBotany;
import net.minecraft.entity.player.EntityPlayer;
import binnie.botany.Botany;
import net.minecraft.client.renderer.texture.IIconRegister;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.item.ItemStack;
import javax.annotation.Nullable;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
import java.util.Collection;
import java.util.List;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.util.IIcon;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.util.text.TextFormatting;
public class ItemInsulatedTube extends Item
{
IIcon[] icons;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(final Item p_150895_1_, final CreativeTabs p_150895_2_, final List p_150895_3_) {
for (final Material mat : Material.values()) {
for (final Insulate ins : Insulate.values()) {
p_150895_3_.add(new ItemStack(this, 1, mat.ordinal() + ins.ordinal() * 128));
}
}
}
import forestry.api.circuits.ChipsetManager;
import forestry.api.circuits.ICircuit;
import forestry.api.circuits.ICircuitLayout;
import forestry.api.core.IModelManager;
import forestry.core.circuits.SolderManager;
import forestry.core.items.IColoredItem;
import forestry.core.utils.Translator;
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(final IIconRegister p_94581_1_) {
for (int i = 0; i < 3; ++i) {
this.icons[i] = Botany.proxy.getIcon(p_94581_1_, "insulatedTube." + i);
}
}
@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(final ItemStack stack, final int pass) {
return (pass == 0) ? 16777215 : ((pass == 1) ? Material.get(stack.getItemDamage()).getColor() : Insulate.get(stack.getItemDamage()).getColor());
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(final ItemStack p_77624_1_, final EntityPlayer p_77624_2_, final List p_77624_3_, final boolean p_77624_4_) {
super.addInformation(p_77624_1_, p_77624_2_, p_77624_3_, p_77624_4_);
p_77624_3_.add(Insulate.get(p_77624_1_.getItemDamage()).getName());
}
@Override
public String getItemStackDisplayName(final ItemStack p_77653_1_) {
return Material.get(p_77653_1_.getItemDamage()).getName() + " Insulated Tube";
}
@Override
public int getRenderPasses(final int metadata) {
return 3;
}
@Override
public IIcon getIcon(final ItemStack stack, final int pass) {
return this.icons[pass % 3];
}
@Override
public boolean requiresMultipleRenderPasses() {
return true;
}
import binnie.botany.CreativeTabBotany;
import binnie.core.item.ItemCore;
import binnie.core.util.I18N;
public class ItemInsulatedTube extends ItemCore implements IColoredItem {
public ItemInsulatedTube() {
this.icons = new IIcon[3];
this.setUnlocalizedName("insulatedTube");
this.setCreativeTab(CreativeTabBotany.instance);
super("insulated_tube");
setUnlocalizedName("botany.insulated_tube");
setCreativeTab(CreativeTabBotany.instance);
setHasSubtypes(true);
}
public static String getInsulate(final ItemStack stack) {
return Insulate.get(stack.getItemDamage()).getName();
private static Multimap<ICircuitLayout, ICircuit> getCircuits(ItemStack itemStack) {
Multimap<ICircuitLayout, ICircuit> circuits = ArrayListMultimap.create();
Collection<ICircuitLayout> allLayouts = ChipsetManager.circuitRegistry.getRegisteredLayouts().values();
for (ICircuitLayout circuitLayout : allLayouts) {
ICircuit circuit = SolderManager.getCircuit(circuitLayout, itemStack);
if (circuit != null) {
circuits.put(circuitLayout, circuit);
}
}
return circuits;
}
public static ItemStack getInsulateStack(final ItemStack stack) {
return Insulate.get(stack.getItemDamage()).getStack();
public static String getInsulate(ItemStack stack) {
return EnumTubeInsulate.get(stack.getItemDamage()).getDisplayName();
}
enum Material
{
Copper(14923662, "Copper"),
Tin(14806772, "Tin"),
Bronze(14533238, "Bronze"),
Iron(14211288, "Iron");
public static ItemStack getInsulateStack(ItemStack stack) {
return EnumTubeInsulate.get(stack.getItemDamage()).getStack();
}
int color;
String name;
public int getColor() {
return this.color;
}
public String getName() {
return this.name;
}
private Material(final int color, final String name) {
this.color = color;
this.name = name;
}
public static Material get(final int i) {
return values()[i % values().length];
@Override
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> items) {
if (this.isInCreativeTab(tab)) {
for (EnumTubeMaterial mat : EnumTubeMaterial.values()) {
for (EnumTubeInsulate ins : EnumTubeInsulate.values()) {
items.add(new ItemStack(this, 1, mat.ordinal() + ins.ordinal() * 128));
}
}
}
}
enum Insulate
{
Clay(10595020, "Clay"),
Cobble(8092539, "Cobblestone"),
Sand(15723189, "Sand"),
HardenedClay(9657411, "Hardened Clay"),
Stone(7171437, "Smooth Stone"),
Sandstone(12695945, "Sandstone");
int color;
String name;
public int getColor() {
return this.color;
}
public String getName() {
return this.name;
}
private Insulate(final int color, final String name) {
this.color = color;
this.name = name;
}
public static Insulate get(final int i) {
return values()[i / 128 % values().length];
}
public ItemStack getStack() {
switch (this) {
case Clay: {
return new ItemStack(Blocks.clay);
}
case Cobble: {
return new ItemStack(Blocks.cobblestone);
}
case HardenedClay: {
return new ItemStack(Blocks.hardened_clay);
}
case Sand: {
return new ItemStack(Blocks.sand);
}
case Sandstone: {
return new ItemStack(Blocks.sandstone);
}
case Stone: {
return new ItemStack(Blocks.stone);
}
default: {
return null;
}
@SideOnly(Side.CLIENT)
@Override
public void registerModel(Item item, IModelManager manager) {
for (EnumTubeMaterial mat : EnumTubeMaterial.values()) {
for (EnumTubeInsulate ins : EnumTubeInsulate.values()) {
manager.registerItemModel(item, mat.ordinal() + ins.ordinal() * 128);
}
}
}
@Override
public int getColorFromItemstack(ItemStack stack, int tintIndex) {
if (tintIndex == 0) {
return 0xffffff;
} else if (tintIndex == 1) {
return EnumTubeMaterial.get(stack.getItemDamage()).getColor();
}
return EnumTubeInsulate.get(stack.getItemDamage()).getColor();
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemstack, @Nullable World worldIn, List<String> list, ITooltipFlag flagIn) {
super.addInformation(itemstack, worldIn, list, flagIn);
Multimap<ICircuitLayout, ICircuit> circuits = getCircuits(itemstack);
if (!circuits.isEmpty()) {
if (GuiScreen.isShiftKeyDown()) {
for (ICircuitLayout circuitLayout : circuits.keys()) {
String circuitLayoutName = circuitLayout.getUsage();
list.add(TextFormatting.WHITE.toString() + TextFormatting.UNDERLINE + circuitLayoutName);
for (ICircuit circuit : circuits.get(circuitLayout)) {
circuit.addTooltip(list);
}
}
} else {
list.add(TextFormatting.ITALIC + "<" + Translator.translateToLocal("for.gui.tooltip.tmi") + ">");
}
} else {
list.add("<" + Translator.translateToLocal("for.gui.noeffect") + ">");
}
}
@Override
public String getItemStackDisplayName(ItemStack itemStack) {
int meta = itemStack.getMetadata();
return I18N.localise(
"item.botany.insulated_tube.name",
EnumTubeMaterial.get(meta).getDisplayName(),
EnumTubeInsulate.get(meta).getDisplayName()
);
}
}
@@ -1,24 +0,0 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.flower;
import binnie.botany.api.EnumFlowerStage;
public class ItemPollen extends ItemBotany
{
public ItemPollen() {
super("pollen");
}
@Override
public EnumFlowerStage getStage() {
return EnumFlowerStage.POLLEN;
}
@Override
public String getTag() {
return " Pollen";
}
}
@@ -1,24 +0,0 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.flower;
import binnie.botany.api.EnumFlowerStage;
public class ItemSeed extends ItemBotany
{
public ItemSeed() {
super("seed");
}
@Override
public EnumFlowerStage getStage() {
return EnumFlowerStage.SEED;
}
@Override
public String getTag() {
return " Germling";
}
}
@@ -0,0 +1,53 @@
package binnie.botany.flower;
import com.google.common.base.Optional;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import net.minecraft.block.properties.PropertyHelper;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import binnie.botany.api.IAlleleFlowerSpecies;
import binnie.botany.api.IFlowerType;
public class PropertyFlower<I extends IFlowerType<I>> extends PropertyHelper<I> {
public PropertyFlower(String name, Class<I> flowerTypeClass) {
super(name, flowerTypeClass);
}
@Override
public List<I> getAllowedValues() {
List<I> flowerTypes = new ArrayList<>();
for (IAllele allele : AlleleManager.alleleRegistry.getRegisteredAlleles().values()) {
if (allele instanceof IAlleleFlowerSpecies) {
IFlowerType flowerType = ((IAlleleFlowerSpecies) allele).getType();
if (!flowerTypes.contains(flowerType)) {
flowerTypes.add((I) flowerType);
}
}
}
return flowerTypes;
}
/**
* Get the name for the given value.
*/
@Override
public String getName(IFlowerType value) {
return value.getName().toLowerCase(Locale.ENGLISH);
}
@Override
public Optional<I> parseValue(String value) {
IAllele allele = AlleleManager.alleleRegistry.getAllele(value);
if (IAlleleFlowerSpecies.class.isInstance(allele)) {
IAlleleFlowerSpecies alleleValue = IAlleleFlowerSpecies.class.cast(allele);
return Optional.of((I) alleleValue.getType());
}
return Optional.absent();
}
}
@@ -1,66 +0,0 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.flower;
import net.minecraft.util.IIcon;
import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.IBlockAccess;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.block.Block;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
public class RendererBotany implements ISimpleBlockRenderingHandler
{
public static int renderID;
public static int pass;
@Override
public void renderInventoryBlock(final Block block, final int metadata, final int modelID, final RenderBlocks renderer) {
}
@Override
public boolean renderWorldBlock(final IBlockAccess world, final int x, final int y, final int z, final Block block, final int modelId, final RenderBlocks renderer) {
final Tessellator tessellator = Tessellator.instance;
tessellator.setBrightness(block.getMixedBrightnessForBlock(renderer.blockAccess, x, y, z));
double d1 = x;
final double d2 = y;
double d3 = z;
long i1 = x * 3129871 ^ z * 116129781L;
i1 = i1 * i1 * 42317861L + i1 * 11L;
d1 += ((i1 >> 16 & 0xFL) / 15.0f - 0.5) * 0.3;
d3 += ((i1 >> 24 & 0xFL) / 15.0f - 0.5) * 0.3;
final int rot = (int) (i1 % 4L);
for (int j = 0; j < 3; ++j) {
RendererBotany.pass = j;
final int l = block.colorMultiplier(renderer.blockAccess, x, y, z);
float f = (l >> 16 & 0xFF) / 255.0f;
float f2 = (l >> 8 & 0xFF) / 255.0f;
float f3 = (l & 0xFF) / 255.0f;
if (EntityRenderer.anaglyphEnable) {
final float f4 = (f * 30.0f + f2 * 59.0f + f3 * 11.0f) / 100.0f;
final float f5 = (f * 30.0f + f2 * 70.0f) / 100.0f;
final float f6 = (f * 30.0f + f3 * 70.0f) / 100.0f;
f = f4;
f2 = f5;
f3 = f6;
}
tessellator.setColorOpaque_F(f, f2, f3);
final IIcon iicon = block.getIcon(world, x, y, z, 0);
renderer.drawCrossedSquares(iicon, d1, d2, d3, 1.0f);
}
return false;
}
@Override
public boolean shouldRender3DInInventory(final int i) {
return false;
}
@Override
public int getRenderId() {
return RendererBotany.renderID;
}
}
@@ -0,0 +1,39 @@
package binnie.botany.flower;
import com.google.common.collect.Maps;
import java.util.Map;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import binnie.Constants;
import binnie.botany.api.IFlowerType;
@SideOnly(Side.CLIENT)
public class StateMapperFlower extends StateMapperBase {
@Override
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
Map<IProperty<?>, Comparable<?>> properties = Maps.newLinkedHashMap(state.getProperties());
IFlowerType flowerType = (IFlowerType) state.getValue(BlockFlower.FLOWER);
if (flowerType.getSections() < 2) {
properties.remove(BlockFlower.SECTION);
} else if (flowerType.getSections() <= state.getValue(BlockFlower.SECTION)) {
properties.put(BlockFlower.SECTION, flowerType.getSections() - 1);
}
if (state.getValue(BlockFlower.SEED)) {
properties.remove(BlockFlower.SECTION);
properties.remove(BlockFlower.FLOWER);
properties.remove(BlockFlower.FLOWERED);
} else {
properties.remove(BlockFlower.SEED);
}
return new ModelResourceLocation(Constants.BOTANY_MOD_ID + ":flower", getPropertyString(properties));
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,9 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@FieldsAreNonnullByDefault
package binnie.botany.flower;
import javax.annotation.ParametersAreNonnullByDefault;
import binnie.core.util.FieldsAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
@@ -1,156 +1,153 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.gardening;
import net.minecraft.world.IBlockAccess;
import binnie.botany.api.EnumSoilType;
import binnie.botany.api.gardening.IBlockSoil;
import java.util.Random;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockBush;
import net.minecraft.block.SoundType;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.util.IIcon;
import net.minecraft.block.Block;
import binnie.botany.CreativeTabBotany;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import binnie.botany.Botany;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraft.block.BlockBush;
public class BlockPlant extends BlockBush
{
@Override
public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int metadata, final int fortune) {
return new ArrayList<ItemStack>();
}
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(final IIconRegister p_149651_1_) {
for (final Type t : Type.values()) {
t.icon = Botany.proxy.getIcon(p_149651_1_, t.name().toLowerCase());
}
}
import forestry.api.core.IItemModelRegister;
import forestry.api.core.IModelManager;
import binnie.botany.CreativeTabBotany;
import binnie.botany.api.EnumSoilType;
import binnie.botany.api.IBlockSoil;
import binnie.botany.core.BotanyCore;
public class BlockPlant extends BlockBush implements IItemModelRegister {
public static final PropertyEnum<PlantType> PLANT_TYPE = PropertyEnum.create("plant_type", PlantType.class);
public BlockPlant() {
this.setBlockName("plant");
this.setCreativeTab(CreativeTabBotany.instance);
this.setTickRandomly(true);
setRegistryName("plant");
setCreativeTab(CreativeTabBotany.instance);
setTickRandomly(true);
setSoundType(SoundType.PLANT);
}
@Override
protected boolean canPlaceBlockOn(final Block p_149854_1_) {
return super.canPlaceBlockOn(p_149854_1_) || Gardening.isSoil(p_149854_1_);
public static boolean isWeed(IBlockAccess world, BlockPos pos) {
IBlockState blockState = world.getBlockState(pos);
if (!(blockState.getBlock() instanceof BlockPlant)) {
return false;
}
PlantType type = blockState.getValue(PLANT_TYPE);
return type.isWeed();
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(final int side, final int meta) {
return Type.values()[meta % Type.values().length].icon;
}
@Override
public int damageDropped(final int p_149692_1_) {
return p_149692_1_;
}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(final Item p_149666_1_, final CreativeTabs p_149666_2_, final List p_149666_3_) {
for (final Type type : Type.values()) {
p_149666_3_.add(type.get());
public void registerModel(Item item, IModelManager manager) {
int index = 0;
for (PlantType type : PlantType.values()) {
manager.registerItemModel(item, index, type.getName());
index++;
}
}
@Override
public void updateTick(final World world, final int x, final int y, final int z, final Random random) {
final Type type = Type.get(world.getBlockMetadata(x, y, z));
if (random.nextInt(4) == 0) {
if (type == Type.Weeds) {
world.setBlockMetadataWithNotify(x, y, z, Type.WeedsLong.ordinal(), 2);
}
else if (type == Type.WeedsLong) {
world.setBlockMetadataWithNotify(x, y, z, Type.WeedsVeryLong.ordinal(), 2);
}
else if (type == Type.DeadFlower) {
world.setBlockMetadataWithNotify(x, y, z, Type.DecayingFlower.ordinal(), 2);
}
else if (type == Type.DecayingFlower) {
world.setBlockToAir(x, y, z);
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, PLANT_TYPE);
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(PLANT_TYPE).ordinal();
}
@Override
public IBlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(PLANT_TYPE, PlantType.values()[meta]);
}
@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
return new ArrayList<>();
}
@Override
public boolean canPlaceBlockAt(World worldIn, BlockPos pos) {
return super.canPlaceBlockAt(worldIn, pos) || BotanyCore.getGardening().isSoil(worldIn.getBlockState(pos).getBlock());
}
@Override
public int damageDropped(IBlockState state) {
return getMetaFromState(state);
}
@Override
public void getSubBlocks(CreativeTabs p_149666_2_, NonNullList<ItemStack> subBlocks) {
for (PlantType type : PlantType.values()) {
subBlocks.add(type.get());
}
}
@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
PlantType type = state.getValue(PLANT_TYPE);
if (rand.nextInt(4) == 0) {
if (type == PlantType.WEEDS) {
world.setBlockState(pos, state.withProperty(PLANT_TYPE, PlantType.WEEDS_LONG), 2);
} else if (type == PlantType.WEEDS_LONG) {
world.setBlockState(pos, state.withProperty(PLANT_TYPE, PlantType.WEEDS_VERY_LONG), 2);
} else if (type == PlantType.DEAD_FLOWER) {
world.setBlockState(pos, state.withProperty(PLANT_TYPE, PlantType.DECAYING_FLOWER), 2);
} else if (type == PlantType.DECAYING_FLOWER) {
world.setBlockToAir(pos);
return;
}
}
if (random.nextInt(6) == 0) {
if (type == Type.Weeds) {
world.setBlockToAir(x, y, z);
}
else if (type == Type.WeedsLong) {
world.setBlockMetadataWithNotify(x, y, z, Type.Weeds.ordinal(), 2);
}
else if (type == Type.WeedsVeryLong) {
world.setBlockMetadataWithNotify(x, y, z, Type.WeedsLong.ordinal(), 2);
if (rand.nextInt(6) == 0) {
if (type == PlantType.WEEDS) {
world.setBlockToAir(pos);
} else if (type == PlantType.WEEDS_LONG) {
world.setBlockState(pos, state.withProperty(PLANT_TYPE, PlantType.WEEDS), 2);
} else if (type == PlantType.WEEDS_VERY_LONG) {
world.setBlockState(pos, state.withProperty(PLANT_TYPE, PlantType.WEEDS_LONG), 2);
}
}
final Block below = world.getBlock(x, y - 1, z);
if (Gardening.isSoil(below)) {
final IBlockSoil soil = (IBlockSoil) below;
if (random.nextInt(3) == 0) {
if (type == Type.Weeds || type == Type.WeedsLong || type == Type.WeedsVeryLong) {
if (!soil.degrade(world, x, y - 1, z, EnumSoilType.LOAM)) {
soil.degrade(world, x, y - 1, z, EnumSoilType.SOIL);
}
}
else if (type == Type.DecayingFlower && !soil.fertilise(world, x, y - 1, z, EnumSoilType.LOAM)) {
soil.fertilise(world, x, y - 1, z, EnumSoilType.FLOWERBED);
}
Block below = world.getBlockState(pos.down()).getBlock();
if (!BotanyCore.getGardening().isSoil(below)) {
return;
}
IBlockSoil soil = (IBlockSoil) below;
if (rand.nextInt(3) != 0) {
return;
}
if (type.isWeed()) {
if (!soil.degrade(world, pos.down(), EnumSoilType.LOAM)) {
soil.degrade(world, pos.down(), EnumSoilType.SOIL);
}
} else if (type == PlantType.DECAYING_FLOWER && !soil.fertilise(world, pos.down(), EnumSoilType.LOAM)) {
soil.fertilise(world, pos.down(), EnumSoilType.FLOWERBED);
}
}
@Override
public boolean isReplaceable(final IBlockAccess world, final int x, final int y, final int z) {
public boolean isReplaceable(IBlockAccess worldIn, BlockPos pos) {
return true;
}
public static boolean isWeed(final IBlockAccess world, final int x, final int y, final int z) {
if (!(world.getBlock(x, y, z) instanceof BlockPlant)) {
return false;
}
final Type type = Type.get(world.getBlockMetadata(x, y, z));
return type == Type.Weeds || type == Type.WeedsLong || type == Type.WeedsVeryLong;
}
public enum Type
{
Weeds("Weeds"),
WeedsLong("Long Weeds"),
WeedsVeryLong("Very Long Weeds"),
DeadFlower("Dead Flower"),
DecayingFlower("Decaying Flower");
public IIcon icon;
String name;
private Type(final String name) {
this.name = name;
}
public ItemStack get() {
return new ItemStack(Botany.plant, 1, this.ordinal());
}
public static Type get(final int id) {
return values()[id % values().length];
}
public String getName() {
return this.name;
}
@Override
public EnumOffsetType getOffsetType() {
return EnumOffsetType.XZ;
}
}
@@ -1,220 +1,314 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.gardening;
import net.minecraftforge.common.IPlantable;
import binnie.Binnie;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.AxisAlignedBB;
import javax.annotation.Nullable;
import java.util.Random;
import net.minecraft.world.World;
import binnie.botany.CreativeTabBotany;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import binnie.botany.Botany;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.core.IItemModelRegister;
import forestry.api.core.IModelManager;
import binnie.botany.Botany;
import binnie.botany.CreativeTabBotany;
import binnie.botany.api.EnumAcidity;
import binnie.botany.api.EnumMoisture;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.item.ItemStack;
import java.util.List;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import binnie.botany.api.EnumSoilType;
import net.minecraft.util.IIcon;
import binnie.botany.api.gardening.IBlockSoil;
import net.minecraft.block.Block;
import binnie.botany.api.IBlockSoil;
import binnie.botany.core.BotanyCore;
import binnie.core.util.I18N;
public class BlockSoil extends Block implements IBlockSoil
{
boolean weedKilled;
IIcon[] iconsTop;
IIcon[] iconsSide;
IIcon[] iconsNoWeed;
EnumSoilType type;
public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister {
public static final PropertyEnum<EnumMoisture> MOISTURE = PropertyEnum.create("moisture", EnumMoisture.class);
public static final PropertyEnum<EnumAcidity> ACIDITY = PropertyEnum.create("acidity", EnumAcidity.class);
public static final AxisAlignedBB SOIL_BLOCK_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.9375D, 1.0D);
private final boolean weedKilled;
private final EnumSoilType type;
public BlockSoil(EnumSoilType type, String blockName, boolean weedKilled) {
super(Material.GROUND);
this.type = type;
this.weedKilled = weedKilled;
setUnlocalizedName("botany.soil." + type.getName());
setCreativeTab(CreativeTabBotany.instance);
setRegistryName(blockName);
setTickRandomly(true);
setLightOpacity(255);
setHardness(0.5f);
setSoundType(SoundType.GROUND);
}
public static int getMeta(EnumAcidity acid, EnumMoisture moisture) {
return acid.ordinal() * 3 + moisture.ordinal();
}
public static String getPH(ItemStack stack, boolean withColor, boolean byNeutralNone) {
EnumAcidity ph = EnumAcidity.values()[stack.getItemDamage() / 3];
if (byNeutralNone) {
if (ph == EnumAcidity.NEUTRAL) {
return "";
}
}
return TextFormatting.GRAY + I18N.localise("botany.ph") + ": " + ph.getLocalisedName(withColor);
}
public static String getMoisture(ItemStack stack, boolean withColor, boolean byNormalNone) {
EnumMoisture moisure = EnumMoisture.values()[stack.getItemDamage() % 3];
if (byNormalNone) {
if (moisure == EnumMoisture.NORMAL) {
return "";
}
}
return TextFormatting.GRAY + I18N.localise("botany.moisture") + ": " + moisure.getLocalisedName(withColor);
}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List par3List) {
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
switch (side) {
case UP:
return true;
case NORTH:
case SOUTH:
case WEST:
case EAST:
IBlockState iblockstate = blockAccess.getBlockState(pos.offset(side));
Block block = iblockstate.getBlock();
return !iblockstate.isOpaqueCube() && block != Blocks.FARMLAND && block != Blocks.GRASS_PATH && block != this;
}
return super.shouldSideBeRendered(blockState, blockAccess, pos, side);
}
/**
* Used to determine ambient occlusion and culling when rebuilding chunks for render
*/
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
}
@Override
public boolean isFullCube(IBlockState state) {
return false;
}
@Override
public String getUnlocalizedName() {
return super.getUnlocalizedName().replaceFirst("tile.", "");
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
return SOIL_BLOCK_AABB;
}
@Nullable
@Override
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) {
return SOIL_BLOCK_AABB;
}
@Override
public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World worldIn, BlockPos pos) {
return SOIL_BLOCK_AABB;
}
@Override
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
for (int i = 0; i < 9; ++i) {
par3List.add(new ItemStack(this, 1, i));
list.add(new ItemStack(this, 1, i));
}
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) {
return this.getIcon(side, world.getBlockMetadata(x, y, z));
}
public void registerModel(Item item, IModelManager manager) {
for (EnumAcidity acidity : EnumAcidity.values()) {
for (EnumMoisture moisture : EnumMoisture.values()) {
String modelName = "";
if (acidity != EnumAcidity.NEUTRAL) {
modelName += acidity.getName();
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(final int side, int meta) {
meta = ((meta >= 9) ? 8 : meta);
final EnumMoisture moisture = EnumMoisture.values()[meta % 3];
final EnumAcidity acidity = EnumAcidity.values()[meta / 3];
return (side == 1) ? (this.weedKilled ? this.iconsNoWeed[meta] : this.iconsTop[meta]) : ((side == 0) ? Blocks.dirt.getIcon(side, 0) : this.iconsSide[meta]);
}
if (moisture != EnumMoisture.NORMAL) {
if (!modelName.isEmpty()) {
modelName += "_";
}
modelName += moisture.getName();
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(final IIconRegister register) {
for (final EnumMoisture moisture : EnumMoisture.values()) {
for (final EnumAcidity pH : EnumAcidity.values()) {
this.iconsTop[moisture.ordinal() + pH.ordinal() * 3] = Botany.proxy.getIcon(register, "soil/" + this.getType().getID() + "." + pH.getID() + "." + moisture.getID() + ".0");
this.iconsSide[moisture.ordinal() + pH.ordinal() * 3] = Botany.proxy.getIcon(register, "soil/" + this.getType().getID() + "." + pH.getID() + "." + moisture.getID() + ".1");
this.iconsNoWeed[moisture.ordinal() + pH.ordinal() * 3] = Botany.proxy.getIcon(register, "soil/" + this.getType().getID() + "." + pH.getID() + "." + moisture.getID() + ".2");
if (modelName.isEmpty()) {
modelName = "normal";
}
String identifier;
if (weedKilled) {
identifier = type.getName() + "_no_weed/" + modelName;
} else {
identifier = type.getName() + "/" + modelName;
}
manager.registerItemModel(item, moisture.ordinal() + acidity.ordinal() * 3, identifier);
}
}
}
public EnumSoilType getType() {
return this.type;
}
public BlockSoil(final EnumSoilType type, final String blockName, final boolean weedKilled) {
super(Material.ground);
this.weedKilled = false;
this.iconsTop = new IIcon[9];
this.iconsSide = new IIcon[9];
this.iconsNoWeed = new IIcon[9];
this.weedKilled = weedKilled;
this.setCreativeTab(CreativeTabBotany.instance);
this.setBlockName(blockName);
this.setTickRandomly(true);
this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 0.9375f, 1.0f);
this.setLightOpacity(255);
this.setHardness(0.5f);
this.setStepSound(Block.soundTypeGravel);
this.type = type;
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, MOISTURE, ACIDITY);
}
@Override
public int damageDropped(final int p_149692_1_) {
return p_149692_1_;
public int getMetaFromState(IBlockState state) {
return getMeta(state.getValue(ACIDITY), state.getValue(MOISTURE));
}
@Override
public void updateTick(final World world, final int x, final int y, final int z, final Random random) {
final int meta = world.getBlockMetadata(x, y, z);
public IBlockState getStateFromMeta(int meta) {
EnumMoisture moisture = EnumMoisture.values()[meta % 3];
final EnumAcidity acidity = EnumAcidity.values()[meta / 3];
final EnumMoisture desiredMoisture = Gardening.getNaturalMoisture(world, x, y, z);
EnumAcidity acidity = EnumAcidity.values()[meta / 3];
return getDefaultState().withProperty(MOISTURE, moisture).withProperty(ACIDITY, acidity);
}
public EnumSoilType getType() {
return type;
}
@Override
public int damageDropped(IBlockState state) {
return getMetaFromState(state);
}
@Override
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
EnumMoisture moisture = state.getValue(MOISTURE);
EnumMoisture desiredMoisture = BotanyCore.getGardening().getNaturalMoisture(world, pos);
if (desiredMoisture.ordinal() > moisture.ordinal()) {
moisture = ((moisture == EnumMoisture.Dry) ? EnumMoisture.Normal : EnumMoisture.Damp);
moisture = ((moisture == EnumMoisture.DRY) ? EnumMoisture.NORMAL : EnumMoisture.DAMP);
} else if (desiredMoisture.ordinal() < moisture.ordinal()) {
moisture = ((moisture == EnumMoisture.DAMP) ? EnumMoisture.NORMAL : EnumMoisture.DRY);
}
if (desiredMoisture.ordinal() < moisture.ordinal()) {
moisture = ((moisture == EnumMoisture.Damp) ? EnumMoisture.Normal : EnumMoisture.Dry);
IBlockState blockState = state.withProperty(MOISTURE, moisture);
if (state != blockState) {
world.setBlockState(pos, blockState, 2);
}
final int meta2 = getMeta(acidity, moisture);
if (meta != meta2) {
world.setBlockMetadataWithNotify(x, y, z, meta2, 2);
}
if (!this.weedKilled && random.nextInt(5 - this.getType(world, x, y, z).ordinal()) == 0 && world.getBlock(x, y + 1, z) == Blocks.air) {
world.setBlock(x, y + 1, z, Botany.plant, BlockPlant.Type.Weeds.ordinal(), 2);
if (!weedKilled) {
if (rand.nextInt(5 - getType(world, pos).ordinal()) != 0) {
return;
}
pos = pos.up();
if (!world.isAirBlock(pos)) {
return;
}
world.setBlockState(pos, Botany.gardening().plant.getStateFromMeta(PlantType.WEEDS.ordinal()), 2);
}
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(final World p_149668_1_, final int p_149668_2_, final int p_149668_3_, final int p_149668_4_) {
return AxisAlignedBB.getBoundingBox(p_149668_2_ + 0, p_149668_3_ + 0, p_149668_4_ + 0, p_149668_2_ + 1, p_149668_3_ + 1, p_149668_4_ + 1);
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) {
super.neighborChanged(state, worldIn, pos, blockIn, fromPos);
if (worldIn.getBlockState(pos.up()).getMaterial().isSolid()) {
worldIn.setBlockState(pos, Blocks.DIRT.getDefaultState());
}
}
@Override
public boolean isOpaqueCube() {
return false;
public EnumAcidity getPH(World world, BlockPos pos) {
return world.getBlockState(pos).getValue(ACIDITY);
}
@Override
public boolean renderAsNormalBlock() {
return false;
public EnumMoisture getMoisture(World world, BlockPos pos) {
return world.getBlockState(pos).getValue(MOISTURE);
}
@Override
public EnumAcidity getPH(final World world, final int x, final int y, final int z) {
return EnumAcidity.values()[world.getBlockMetadata(x, y, z) / 3];
public EnumSoilType getType(World world, BlockPos pos) {
return type;
}
@Override
public EnumMoisture getMoisture(final World world, final int x, final int y, final int z) {
return EnumMoisture.values()[world.getBlockMetadata(x, y, z) % 3];
}
@Override
public EnumSoilType getType(final World world, final int x, final int y, final int z) {
return this.type;
}
@Override
public boolean fertilise(final World world, final int x, final int y, final int z, final EnumSoilType maxLevel) {
final EnumSoilType type = this.getType(world, x, y, z);
public boolean fertilise(World world, BlockPos pos, EnumSoilType maxLevel) {
EnumSoilType type = getType(world, pos);
if (type.ordinal() >= maxLevel.ordinal()) {
return false;
}
final int meta = world.getBlockMetadata(x, y, z);
return world.setBlock(x, y, z, Gardening.getSoilBlock(maxLevel, this.weedKilled), meta, 2);
IBlockState old = world.getBlockState(pos);
return world.setBlockState(pos, BotanyCore.getGardening().getSoilBlock(maxLevel, weedKilled).getDefaultState().withProperty(ACIDITY, old.getValue(ACIDITY)).withProperty(MOISTURE, old.getValue(MOISTURE)), 2);
}
@Override
public boolean degrade(final World world, final int x, final int y, final int z, final EnumSoilType minLevel) {
final EnumSoilType type = this.getType(world, x, y, z);
public boolean degrade(World world, BlockPos pos, EnumSoilType minLevel) {
EnumSoilType type = getType(world, pos);
if (type.ordinal() <= minLevel.ordinal()) {
return false;
}
final int meta = world.getBlockMetadata(x, y, z);
return world.setBlock(x, y, z, Gardening.getSoilBlock(minLevel, this.weedKilled), meta, 2);
IBlockState old = world.getBlockState(pos);
return world.setBlockState(pos, BotanyCore.getGardening().getSoilBlock(minLevel, weedKilled).getDefaultState().withProperty(ACIDITY, old.getValue(ACIDITY)).withProperty(MOISTURE, old.getValue(MOISTURE)), 2);
}
@Override
public boolean setPH(final World world, final int x, final int y, final int z, final EnumAcidity pH) {
final int meta = getMeta(pH, this.getMoisture(world, x, y, z));
return world.setBlockMetadataWithNotify(x, y, z, meta, 2);
public boolean setPH(World world, BlockPos pos, EnumAcidity pH) {
IBlockState blockState = world.getBlockState(pos);
return world.setBlockState(pos, blockState.withProperty(ACIDITY, pH));
}
@Override
public boolean setMoisture(final World world, final int x, final int y, final int z, final EnumMoisture moisture) {
final int meta = getMeta(this.getPH(world, x, y, z), moisture);
return world.setBlockMetadataWithNotify(x, y, z, meta, 2);
}
public static int getMeta(final EnumAcidity acid, final EnumMoisture moisture) {
return acid.ordinal() * 3 + moisture.ordinal();
public boolean setMoisture(World world, BlockPos pos, EnumMoisture moisture) {
IBlockState blockState = world.getBlockState(pos);
return world.setBlockState(pos, blockState.withProperty(MOISTURE, moisture));
}
@Override
public void onNeighborBlockChange(final World world, final int x, final int y, final int z, final Block p_149695_5_) {
super.onNeighborBlockChange(world, x, y, z, p_149695_5_);
if (world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN, false)) {
world.setBlock(x, y, z, Blocks.dirt, 0, 2);
public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) {
super.onNeighborChange(world, pos, neighbor);
if (world.isSideSolid(pos.up(), EnumFacing.DOWN, false)) {
((World) world).setBlockState(pos, Blocks.DIRT.getDefaultState(), 2);
}
}
public static String getPH(final ItemStack stack) {
return Binnie.Language.localise(EnumAcidity.values()[stack.getItemDamage() / 3]);
}
public static String getMoisture(final ItemStack stack) {
return Binnie.Language.localise(EnumMoisture.values()[stack.getItemDamage() % 3]);
}
@Override
public boolean canSustainPlant(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection direction, final IPlantable plantable) {
final Block plant = plantable.getPlant(world, x, y + 1, z);
if (plant == Botany.flower) {
public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable) {
IBlockState plant = plantable.getPlant(world, pos.up());
if (plant.getBlock() == Botany.flower) {
return true;
}
if (plant == Botany.plant) {
return !this.weedKilled || !BlockPlant.isWeed(world, x, y, z);
if (plant.getBlock() == Botany.gardening().plant) {
return !weedKilled || !BlockPlant.isWeed(world, pos);
}
return world instanceof World && Blocks.dirt.canSustainPlant(world, x, y, z, direction, plantable);
return world instanceof World && Blocks.DIRT.canSustainPlant(state, world, pos, direction, plantable);
}
@Override
public boolean resistsWeeds(final World world, final int x, final int y, final int z) {
return this.weedKilled;
public boolean resistsWeeds(World world, BlockPos pos) {
return weedKilled;
}
public boolean isWeedKilled() {
return weedKilled;
}
}
@@ -1,198 +1,197 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.gardening;
import java.util.LinkedHashMap;
import net.minecraft.world.IBlockAccess;
import binnie.botany.items.BotanyItems;
import forestry.api.core.EnumTemperature;
import javax.annotation.Nullable;
import java.util.Collection;
import binnie.core.BinnieCore;
import net.minecraft.tileentity.TileEntity;
import binnie.botany.flower.TileEntityFlower;
import binnie.botany.Botany;
import com.mojang.authlib.GameProfile;
import binnie.botany.api.IFlower;
import binnie.botany.api.EnumSoilType;
import net.minecraft.world.biome.BiomeGenBase;
import binnie.botany.api.EnumAcidity;
import net.minecraft.init.Blocks;
import binnie.botany.api.EnumMoisture;
import net.minecraft.world.World;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.Item;
import binnie.botany.api.gardening.IBlockSoil;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
public class Gardening
{
public static Map<ItemStack, Integer> fertiliserAcid;
public static Map<ItemStack, Integer> fertiliserAlkaline;
public static Map<ItemStack, Integer> fertiliserNutrient;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
public static boolean isSoil(final Block block) {
import forestry.api.climate.IClimateInfo;
import forestry.api.core.EnumTemperature;
import forestry.api.core.ForestryAPI;
import binnie.botany.Botany;
import binnie.botany.api.EnumAcidity;
import binnie.botany.api.EnumMoisture;
import binnie.botany.api.EnumSoilType;
import binnie.botany.api.IBlockSoil;
import binnie.botany.api.IFlower;
import binnie.botany.api.IGardeningManager;
import binnie.botany.items.BotanyItems;
public class Gardening implements IGardeningManager {
private final Map<ItemStack, Integer> fertiliserAcid = new LinkedHashMap<>();
private final Map<ItemStack, Integer> fertiliserAlkaline = new LinkedHashMap<>();
private final Map<ItemStack, Integer> fertiliserNutrient = new LinkedHashMap<>();
public Gardening() {
// ignored
}
@Override
public boolean isSoil(Block block) {
return block instanceof IBlockSoil;
}
public static boolean isSoil(final Item item) {
return item instanceof ItemBlock && isSoil(((ItemBlock) item).field_150939_a);
@Override
public boolean isSoil(Item item) {
return item instanceof ItemBlock && isSoil(((ItemBlock) item).getBlock());
}
public static boolean isSoil(final ItemStack item) {
@Override
public boolean isSoil(ItemStack item) {
return isSoil(item.getItem());
}
public static EnumMoisture getNaturalMoisture(final World world, final int x, final int y, final int z) {
float bias = getBiomeMoisture(world.getBiomeGenForCoords(x, z), y);
@Override
public EnumMoisture getNaturalMoisture(World world, BlockPos pos) {
float bias = getBiomeMoisture(world, pos);
for (int dx = -1; dx < 2; ++dx) {
for (int dz = -1; dz < 2; ++dz) {
if (dx != 0 || dz != 0) {
if (world.getBlock(x + dx, y, z + dz) == Blocks.sand) {
if (world.getBlockState(pos.add(dx, 0, dz)) == Blocks.SAND) {
bias -= 1.5;
}
else if (world.getBlock(x + dx, y, z + dz) == Blocks.water) {
} else if (world.getBlockState(pos.add(dx, 0, dz)) == Blocks.WATER) {
bias += 1.5;
}
}
}
}
if (world.isRaining() && world.canBlockSeeTheSky(x, y + 1, z) && world.getPrecipitationHeight(x, z) <= y + 1) {
if (world.isRaining() && world.canBlockSeeSky(pos.up()) && world.getPrecipitationHeight(pos).getY() <= pos.getY() + 1) {
bias += 1.5;
}
for (int dx = -1; dx < 2; ++dx) {
for (int dz = -1; dz < 2; ++dz) {
if (dx != 0 || dz != 0) {
if (world.getBlock(x + dx, y, z + dz) == Blocks.gravel && bias > 0.0f) {
if (world.getBlockState(pos.add(dx, 0, dz)).getBlock() == Blocks.GRAVEL && bias > 0.0f) {
bias *= 0.4f;
}
}
}
}
return (bias <= -1.0f) ? EnumMoisture.Dry : ((bias >= 1.0f) ? EnumMoisture.Damp : EnumMoisture.Normal);
return (bias <= -1.0f) ? EnumMoisture.DRY : ((bias >= 1.0f) ? EnumMoisture.DAMP : EnumMoisture.NORMAL);
}
public static EnumAcidity getNaturalPH(final World world, final int x, final int y, final int z) {
final float bias = getBiomePH(world.getBiomeGenForCoords(x, z), y);
return (bias <= -1.0f) ? EnumAcidity.Acid : ((bias >= 1.0f) ? EnumAcidity.Alkaline : EnumAcidity.Neutral);
@Override
public EnumAcidity getNaturalPH(World world, BlockPos pos) {
float bias = getBiomePH(world, pos);
if (bias <= -1.0f) {
return EnumAcidity.ACID;
}
return (bias >= 1.0f) ? EnumAcidity.ALKALINE : EnumAcidity.NEUTRAL;
}
public static float getBiomeMoisture(final BiomeGenBase biome, final int H) {
final double R = biome.rainfall;
final double T = biome.temperature;
final double m = 3.2 * (R - 0.5) - 0.4 * (1.0 + T + 0.5 * T * T) + 1.1 - 1.6 * (T - 0.9) * (T - 0.9) - 0.002 * (H - 64);
@Override
public float getBiomeMoisture(World world, BlockPos pos) {
IClimateInfo info = ForestryAPI.climateManager.getInfo(world, pos);
double humidity = info.getHumidity();
double temperature = info.getTemperature();
double m = 3.2 * (humidity - 0.5) - 0.4 * (1.0 + temperature + 0.5 * temperature * temperature) + 1.1 - 1.6 * (temperature - 0.9) * (temperature - 0.9) - 0.002 * (pos.getY() - 64);
return (float) ((m == 0.0) ? m : ((m < 0.0) ? (-Math.sqrt(m * m)) : Math.sqrt(m * m)));
}
public static float getBiomePH(final BiomeGenBase biome, final int H) {
final double R = biome.rainfall;
final double T = biome.temperature;
return (float) (-3.0 * (R - 0.5) + 0.5 * (T - 0.699999988079071) * (T - 0.699999988079071) + 0.02f * (H - 64) - 0.15000000596046448);
@Override
public float getBiomePH(World world, BlockPos pos) {
IClimateInfo info = ForestryAPI.climateManager.getInfo(world, pos);
double humidity = info.getHumidity();
double temperature = info.getTemperature();
return (float) (-3.0 * (humidity - 0.5) + 0.5 * (temperature - 0.699999988079071) * (temperature - 0.699999988079071) + 0.02f * (pos.getY() - 64) - 0.15000000596046448);
}
public static void createSoil(final World world, final int x, final int y, final int z, final EnumSoilType soil, final EnumMoisture moisture, final EnumAcidity acidity) {
final int meta = moisture.ordinal() + acidity.ordinal() * 3;
world.setBlock(x, y, z, getSoilBlock(soil), meta, 2);
@Override
public void plantSoil(World world, BlockPos pos, EnumSoilType soil, EnumMoisture moisture, EnumAcidity acidity) {
int meta = moisture.ordinal() + acidity.ordinal() * 3;
world.setBlockState(pos, getSoilBlock(soil).getStateFromMeta(meta), 2);
}
public static boolean plant(final World world, final int x, final int y, final int z, final IFlower flower, final GameProfile owner) {
final boolean set = world.setBlock(x, y, z, Botany.flower, 0, 2);
if (!set) {
return false;
}
final TileEntity tileFlower = world.getTileEntity(x, y, z);
final TileEntity below = world.getTileEntity(x, y - 1, z);
if (tileFlower != null && tileFlower instanceof TileEntityFlower) {
if (below instanceof TileEntityFlower) {
((TileEntityFlower) tileFlower).setSection(((TileEntityFlower) below).getSection());
}
else {
((TileEntityFlower) tileFlower).create(flower, owner);
}
}
tryGrowSection(world, x, y, z);
return true;
@Override
public Collection<ItemStack> getAcidFertilisers() {
return Collections.unmodifiableSet(fertiliserAcid.keySet());
}
public static void tryGrowSection(final World world, final int x, final int y, final int z) {
if (!BinnieCore.proxy.isSimulating(world)) {
return;
}
final TileEntity flower = world.getTileEntity(x, y, z);
if (flower != null && flower instanceof TileEntityFlower) {
final IFlower iflower = ((TileEntityFlower) flower).getFlower();
final int section = ((TileEntityFlower) flower).getSection();
if (iflower != null && section < iflower.getGenome().getPrimary().getType().getSections() - 1 && iflower.getAge() > 0) {
world.setBlock(x, y + 1, z, Botany.flower, 0, 2);
final TileEntity tileFlower = world.getTileEntity(x, y + 1, z);
if (tileFlower != null && tileFlower instanceof TileEntityFlower) {
((TileEntityFlower) tileFlower).setSection(section + 1);
}
}
}
@Override
public Collection<ItemStack> getAlkalineFertilisers() {
return Collections.unmodifiableSet(fertiliserAlkaline.keySet());
}
public static void onGrowFromSeed(final World world, final int x, final int y, final int z) {
tryGrowSection(world, x, y, z);
@Override
public Collection<ItemStack> getNutrientFertilisers() {
return Collections.unmodifiableSet(fertiliserNutrient.keySet());
}
public static Collection<ItemStack> getAcidFertilisers() {
return Gardening.fertiliserAcid.keySet();
@Override
public void registerAcidFertiliser(ItemStack stack, int strength) {
ModuleGardening.queuedAcidFertilisers.put(stack, strength);
fertiliserAcid.put(stack, strength);
}
public static Collection<ItemStack> getAlkalineFertilisers() {
return Gardening.fertiliserAlkaline.keySet();
@Override
public void registerAlkalineFertiliser(ItemStack stack, int strength) {
ModuleGardening.queuedAlkalineFertilisers.put(stack, strength);
fertiliserAlkaline.put(stack, strength);
}
public static Collection<ItemStack> getNutrientFertilisers() {
return Gardening.fertiliserNutrient.keySet();
@Override
public void registerNutrientFertiliser(ItemStack stack, int strength) {
ModuleGardening.queuedNutrientFertilisers.put(stack, strength);
fertiliserNutrient.put(stack, strength);
}
public static boolean isAcidFertiliser(final ItemStack itemstack) {
for (final ItemStack stack : getAcidFertilisers()) {
if (stack != null && stack.isItemEqual(itemstack)) {
@Override
public boolean isAcidFertiliser(ItemStack itemstack) {
for (ItemStack stack : getAcidFertilisers()) {
if (!stack.isEmpty() && stack.isItemEqual(itemstack)) {
return true;
}
}
return false;
}
public static boolean isAlkalineFertiliser(final ItemStack itemstack) {
for (final ItemStack stack : getAlkalineFertilisers()) {
if (stack != null && stack.isItemEqual(itemstack)) {
@Override
public boolean isAlkalineFertiliser(ItemStack itemstack) {
for (ItemStack stack : getAlkalineFertilisers()) {
if (!stack.isEmpty() && stack.isItemEqual(itemstack)) {
return true;
}
}
return false;
}
public static boolean isNutrientFertiliser(final ItemStack itemstack) {
for (final ItemStack stack : getNutrientFertilisers()) {
if (stack != null && stack.isItemEqual(itemstack)) {
@Override
public boolean isNutrientFertiliser(ItemStack itemstack) {
for (ItemStack stack : getNutrientFertilisers()) {
if (!stack.isEmpty() && stack.isItemEqual(itemstack)) {
return true;
}
}
return false;
}
public static int getFertiliserStrength(final ItemStack stack) {
if (stack == null) {
return 1;
}
for (final Map.Entry<ItemStack, Integer> entry : Gardening.fertiliserAcid.entrySet()) {
@Override
public int getFertiliserStrength(ItemStack stack) {
for (Map.Entry<ItemStack, Integer> entry : fertiliserAcid.entrySet()) {
if (entry.getKey().isItemEqual(stack)) {
return entry.getValue();
}
}
for (final Map.Entry<ItemStack, Integer> entry : Gardening.fertiliserAlkaline.entrySet()) {
for (Map.Entry<ItemStack, Integer> entry : fertiliserAlkaline.entrySet()) {
if (entry.getKey().isItemEqual(stack)) {
return entry.getValue();
}
}
for (final Map.Entry<ItemStack, Integer> entry : Gardening.fertiliserNutrient.entrySet()) {
for (Map.Entry<ItemStack, Integer> entry : fertiliserNutrient.entrySet()) {
if (entry.getKey().isItemEqual(stack)) {
return entry.getValue();
}
@@ -200,65 +199,74 @@ public class Gardening
return 1;
}
public static boolean canTolerate(final IFlower flower, final World world, final int x, final int y, final int z) {
if (flower == null || flower.getGenome() == null) {
@Override
public boolean canTolerate(@Nullable IFlower flower, World world, BlockPos pos) {
if (flower == null) {
return false;
}
final Block soil = world.getBlock(x, y - 1, z);
final int soilMeta = world.getBlockMetadata(x, y - 1, z);
final BiomeGenBase biome = world.getBiomeGenForCoords(x, z);
return canTolerate(flower, EnumAcidity.values()[soilMeta / 3 % 3], EnumMoisture.values()[soilMeta % 3], EnumTemperature.getFromValue(biome.temperature));
IBlockState soil = world.getBlockState(pos.down());
Block soilBlock = soil.getBlock();
int soilMeta = soilBlock.getMetaFromState(soil);
Biome biome = world.getBiome(pos);
return canTolerate(
flower,
EnumAcidity.values()[soilMeta / 3 % 3],
EnumMoisture.values()[soilMeta % 3],
EnumTemperature.getFromValue(biome.getTemperature())
);
}
public static EnumSoilType getSoilType(final World world, final int x, final int y, final int z) {
if (world.getBlock(x, y, z) instanceof IBlockSoil) {
return ((IBlockSoil) world.getBlock(x, y, z)).getType(world, x, y, z);
@Override
public EnumSoilType getSoilType(World world, BlockPos pos) {
if (world.getBlockState(pos).getBlock() instanceof IBlockSoil) {
return ((IBlockSoil) world.getBlockState(pos).getBlock()).getType(world, pos);
}
return EnumSoilType.SOIL;
}
public static Block getSoilBlock(final EnumSoilType type) {
@Override
public Block getSoilBlock(EnumSoilType type) {
return getSoilBlock(type, false);
}
public static Block getSoilBlock(final EnumSoilType type, final boolean weedkill) {
@Override
public Block getSoilBlock(EnumSoilType type, boolean weedKill) {
switch (type) {
case FLOWERBED: {
return weedkill ? Botany.flowerbedNoWeed : Botany.flowerbed;
}
case LOAM: {
return weedkill ? Botany.loamNoWeed : Botany.loam;
}
default: {
return weedkill ? Botany.soilNoWeed : Botany.soil;
}
case FLOWERBED:
return weedKill ? Botany.gardening().flowerbedNoWeed : Botany.gardening().flowerbed;
case LOAM:
return weedKill ? Botany.gardening().loamNoWeed : Botany.gardening().loam;
}
return weedKill ? Botany.gardening().soilNoWeed : Botany.gardening().soil;
}
public static boolean canTolerate(final IFlower flower, final EnumAcidity ePH, final EnumMoisture eMoisture, final EnumTemperature eTemp) {
return flower.getGenome().canTolerate(ePH) && flower.getGenome().canTolerate(eMoisture) && flower.getGenome().canTolerate(eTemp);
@Override
public boolean canTolerate(IFlower flower, EnumAcidity acidity, EnumMoisture moisture, EnumTemperature temperature) {
return flower.getGenome().canTolerate(acidity)
&& flower.getGenome().canTolerate(moisture)
&& flower.getGenome().canTolerate(temperature);
}
public static boolean isWeedkiller(final ItemStack heldItem) {
return heldItem != null && heldItem.isItemEqual(BotanyItems.Weedkiller.get(1));
@Override
public boolean isWeedkiller(ItemStack heldItem) {
return heldItem.isItemEqual(BotanyItems.WEEDKILLER.get(1));
}
public static boolean addWeedKiller(final World world, final int x, final int y, final int z) {
if (!(world.getBlock(x, y, z) instanceof IBlockSoil)) {
@Override
public boolean addWeedKiller(World world, BlockPos pos) {
if (!(world.getBlockState(pos).getBlock() instanceof IBlockSoil)) {
return false;
}
final EnumSoilType type = getSoilType(world, x, y, z);
final Block block = getSoilBlock(type, true);
final boolean done = world.setBlock(x, y, z, block, world.getBlockMetadata(x, y, z), 2);
if (done && BlockPlant.isWeed(world, x, y + 1, z)) {
world.setBlockToAir(x, y + 1, z);
EnumSoilType type = getSoilType(world, pos);
Block block = getSoilBlock(type, true);
IBlockState oldState = world.getBlockState(pos);
IBlockState newState = block.getStateFromMeta(oldState.getBlock().getMetaFromState(oldState));
boolean done = world.setBlockState(pos, newState, 2);
if (done && BlockPlant.isWeed(world, pos.up())) {
world.setBlockToAir(pos.up());
}
return done;
}
static {
Gardening.fertiliserAcid = new LinkedHashMap<ItemStack, Integer>();
Gardening.fertiliserAlkaline = new LinkedHashMap<ItemStack, Integer>();
Gardening.fertiliserNutrient = new LinkedHashMap<ItemStack, Integer>();
}
}
@@ -1,72 +1,57 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.gardening;
import net.minecraft.block.Block;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import binnie.botany.api.EnumAcidity;
import binnie.botany.api.EnumMoisture;
import javax.annotation.Nullable;
import java.util.List;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import binnie.botany.api.EnumSoilType;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting;
public class ItemSoil extends ItemBlock
{
EnumSoilType type;
private boolean noWeed;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import binnie.botany.api.EnumSoilType;
import binnie.core.util.I18N;
public class ItemSoil extends ItemBlock {
private final EnumSoilType type;
private final boolean noWeed;
public ItemSoil(BlockSoil block) {
super(block);
type = block.getType();
noWeed = block.isWeedKilled();
hasSubtypes = true;
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(final ItemStack stack, final EntityPlayer p_77624_2_, final List p_77624_3_, final boolean p_77624_4_) {
super.addInformation(stack, p_77624_2_, p_77624_3_, p_77624_4_);
final EnumMoisture moisture = EnumMoisture.values()[stack.getItemDamage() % 3];
final EnumAcidity acidity = EnumAcidity.values()[stack.getItemDamage() / 3];
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
String info = "";
if (moisture == EnumMoisture.Dry) {
info += "§eDry§f";
}
if (moisture == EnumMoisture.Damp) {
info += "§9Damp§f";
}
if (acidity == EnumAcidity.Acid) {
if (info.length() > 0) {
info += ", ";
}
info += "§cAcidic§f";
}
if (acidity == EnumAcidity.Alkaline) {
if (info.length() > 0) {
info += ", ";
}
info += "§bAlkaline§f";
}
info += BlockSoil.getMoisture(stack, true, true);
if (info.length() > 0) {
p_77624_3_.add(info);
info += ", ";
}
if (this.noWeed) {
p_77624_3_.add("Weedkiller");
info += BlockSoil.getPH(stack, true, true);
if (info.length() > 0) {
tooltip.add(info);
}
if (noWeed) {
tooltip.add(TextFormatting.GREEN + I18N.localise("botany.soil.weedkiller"));
}
}
public ItemSoil(final Block p_i45328_1_) {
super(p_i45328_1_);
this.type = ((BlockSoil) this.field_150939_a).getType();
this.noWeed = ((BlockSoil) this.field_150939_a).weedKilled;
this.hasSubtypes = true;
@Override
public String getItemStackDisplayName(ItemStack stack) {
return getUnlocalizedNameInefficiently(stack).trim();
}
@Override
public String getItemStackDisplayName(final ItemStack stack) {
return this.type.name().substring(0, 1) + this.type.name().toLowerCase().substring(1);
}
@Override
public int getMetadata(final int p_77647_1_) {
return p_77647_1_;
public int getMetadata(int damage) {
return damage;
}
}
@@ -1,68 +1,93 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.gardening;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.core.IItemModelRegister;
import forestry.api.core.IModelManager;
import binnie.botany.CreativeTabBotany;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import binnie.botany.Botany;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IChatComponent;
import binnie.botany.api.EnumAcidity;
import binnie.botany.api.EnumMoisture;
import binnie.botany.api.EnumSoilType;
import net.minecraft.block.Block;
import net.minecraft.util.ChatComponentText;
import binnie.Binnie;
import binnie.botany.api.gardening.IBlockSoil;
import binnie.botany.api.IBlockSoil;
import binnie.botany.api.IGardeningManager;
import binnie.botany.core.BotanyCore;
import binnie.core.BinnieCore;
import net.minecraft.world.World;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Item;
public class ItemSoilMeter extends Item
{
@Override
public boolean onItemUse(final ItemStack stack, final EntityPlayer player, final World world, final int x, int y, final int z, final int p_77648_7_, final float p_77648_8_, final float p_77648_9_, final float p_77648_10_) {
Block block = world.getBlock(x, y, z);
if (!Gardening.isSoil(block)) {
--y;
block = world.getBlock(x, y, z);
}
if (Gardening.isSoil(block) && !BinnieCore.proxy.isSimulating(world)) {
final IBlockSoil soil = (IBlockSoil) block;
final EnumSoilType type = soil.getType(world, x, y, z);
final EnumMoisture moisture = soil.getMoisture(world, x, y, z);
final EnumAcidity pH = soil.getPH(world, x, y, z);
String info = "Type: ";
info = info + "§" + (new char[] { '8', '6', 'd' })[type.ordinal()] + Binnie.Language.localise(type) + "§f";
info += ", Moisture: ";
info = info + "§" + (new char[] { 'e', '7', '9' })[moisture.ordinal()] + Binnie.Language.localise(moisture) + "§f";
info += ", pH: ";
info = info + "§" + (new char[] { 'c', 'a', 'b' })[pH.ordinal()] + Binnie.Language.localise(pH) + "§f";
final IChatComponent chat = new ChatComponentText(info);
player.addChatMessage(chat);
}
return super.onItemUse(stack, player, world, x, y, z, p_77648_7_, p_77648_8_, p_77648_9_, p_77648_10_);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(final IIconRegister register) {
this.itemIcon = Botany.proxy.getIcon(register, "soilMeter");
}
import binnie.core.util.I18N;
public class ItemSoilMeter extends Item implements IItemModelRegister {
public ItemSoilMeter() {
this.setCreativeTab(CreativeTabBotany.instance);
this.setUnlocalizedName("soilMeter");
this.setMaxStackSize(1);
setCreativeTab(CreativeTabBotany.instance);
setUnlocalizedName("botany.soil_meter");
setMaxStackSize(1);
setRegistryName("soil_meter");
}
public static String getPH(ItemStack stack, boolean withColor, boolean byNeutralNone) {
EnumAcidity ph = EnumAcidity.values()[stack.getItemDamage() / 3];
if (byNeutralNone) {
if (ph == EnumAcidity.NEUTRAL) {
return "";
}
}
return TextFormatting.GRAY + I18N.localise("botany.ph") + ": " + ph.getLocalisedName(withColor);
}
public static String getMoisture(ItemStack stack, boolean withColor, boolean byNormalNone) {
EnumMoisture moisure = EnumMoisture.values()[stack.getItemDamage() % 3];
if (byNormalNone) {
if (moisure == EnumMoisture.NORMAL) {
return "";
}
}
return TextFormatting.GRAY + I18N.localise("botany.moisture") + ": " + moisure.getLocalisedName(withColor);
}
@SideOnly(Side.CLIENT)
@Override
public void registerModel(Item item, IModelManager manager) {
manager.registerItemModel(item, 0);
}
@Override
public String getItemStackDisplayName(final ItemStack i) {
return "Soil Meter";
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
Block block = worldIn.getBlockState(pos).getBlock();
IGardeningManager gardening = BotanyCore.getGardening();
if (!gardening.isSoil(block)) {
pos = pos.down();
block = worldIn.getBlockState(pos).getBlock();
}
if (!gardening.isSoil(block)) {
pos = pos.down();
block = worldIn.getBlockState(pos).getBlock();
}
if (gardening.isSoil(block) && !BinnieCore.getBinnieProxy().isSimulating(worldIn)) {
IBlockSoil soil = (IBlockSoil) block;
String info = I18N.localise("botany.soil.type") + ": "
+ soil.getType(worldIn, pos).getTranslated() + ", "
+ TextFormatting.WHITE + I18N.localise("botany.moisture") + ": "
+ soil.getMoisture(worldIn, pos).getLocalisedName(true) + ", "
+ TextFormatting.WHITE + I18N.localise("botany.ph") + ": "
+ soil.getPH(worldIn, pos).getLocalisedName(true);
ITextComponent chat = new TextComponentString(info);
player.sendStatusMessage(chat, false);
}
return EnumActionResult.SUCCESS;
}
}
@@ -1,65 +1,98 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.gardening;
import com.google.common.collect.Multimap;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.ModelBakery;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.SoundEvents;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.core.IItemModelRegister;
import forestry.api.core.IModelManager;
import binnie.Constants;
import binnie.botany.Botany;
import binnie.botany.CreativeTabBotany;
import binnie.botany.api.EnumAcidity;
import binnie.botany.api.EnumMoisture;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityLivingBase;
import binnie.botany.api.EnumSoilType;
import net.minecraft.init.Blocks;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import binnie.botany.Botany;
import net.minecraft.client.renderer.texture.IIconRegister;
import binnie.botany.CreativeTabBotany;
import net.minecraft.item.Item;
import binnie.botany.api.IGardeningManager;
import binnie.botany.core.BotanyCore;
public class ItemTrowel extends Item
{
protected Item.ToolMaterial theToolMaterial;
String locName;
public class ItemTrowel extends Item implements IItemModelRegister {
protected final ToolMaterial theToolMaterial;
protected final String modelName;
public ItemTrowel(final Item.ToolMaterial p_i45343_1_, final String material) {
this.theToolMaterial = p_i45343_1_;
this.maxStackSize = 1;
this.setMaxDamage(p_i45343_1_.getMaxUses());
this.setCreativeTab(CreativeTabBotany.instance);
this.setUnlocalizedName("trowel" + material);
this.locName = "trowel" + material;
public ItemTrowel(ToolMaterial toolMaterial, String materialName) {
theToolMaterial = toolMaterial;
setMaxStackSize(1);
setMaxDamage(toolMaterial.getMaxUses());
setCreativeTab(CreativeTabBotany.instance);
modelName = "trowel_" + materialName;
setUnlocalizedName("botany." + modelName);
setRegistryName(modelName);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(final IIconRegister p_94581_1_) {
this.itemIcon = Botany.proxy.getIcon(p_94581_1_, "tools/" + this.locName);
@Override
public void registerModel(Item item, IModelManager manager) {
manager.registerItemModel(item, new ItemTrowelMeshDefinition());
ModelBakery.registerItemVariants(item, new ResourceLocation(Constants.BOTANY_MOD_ID + ":tools/" + modelName));
}
@Override
public boolean onItemUse(final ItemStack stack, final EntityPlayer player, final World world, final int x, final int y, final int z, final int p_77648_7_, final float p_77648_8_, final float p_77648_9_, final float p_77648_10_) {
if (!player.canPlayerEdit(x, y, z, p_77648_7_, stack)) {
return false;
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
ItemStack stack = player.getHeldItem(hand);
if (!player.canPlayerEdit(pos, facing, stack)) {
return EnumActionResult.FAIL;
}
final Block block = world.getBlock(x, y, z);
if (p_77648_7_ == 0 || (!world.getBlock(x, y + 1, z).isAir(world, x, y + 1, z) && world.getBlock(x, y + 1, z) != Botany.flower) || (block != Blocks.grass && block != Blocks.dirt)) {
return false;
Block block = worldIn.getBlockState(pos).getBlock();
if (facing == EnumFacing.DOWN || (!worldIn.isAirBlock(pos.up()) && worldIn.getBlockState(pos.up()).getBlock() != Botany.flower) || (block != Blocks.GRASS && block != Blocks.DIRT && block != Blocks.GRASS_PATH)) {
return EnumActionResult.PASS;
}
final Block block2 = Botany.soil;
world.playSoundEffect(x + 0.5f, y + 0.5f, z + 0.5f, block2.stepSound.getStepResourcePath(), (block2.stepSound.getVolume() + 1.0f) / 2.0f, block2.stepSound.getPitch() * 0.8f);
if (world.isRemote) {
return true;
worldIn.playSound(player, pos, SoundEvents.ITEM_SHOVEL_FLATTEN, SoundCategory.BLOCKS, 1.0F, 1.0F);
if (worldIn.isRemote) {
return EnumActionResult.SUCCESS;
}
final EnumMoisture moisture = Gardening.getNaturalMoisture(world, x, y, z);
final EnumAcidity acidity = Gardening.getNaturalPH(world, x, y, z);
Gardening.createSoil(world, x, y, z, EnumSoilType.SOIL, moisture, acidity);
IGardeningManager gardening = BotanyCore.getGardening();
EnumMoisture moisture = gardening.getNaturalMoisture(worldIn, pos);
EnumAcidity acidity = gardening.getNaturalPH(worldIn, pos);
gardening.plantSoil(worldIn, pos, EnumSoilType.SOIL, moisture, acidity);
stack.damageItem(1, player);
return true;
return EnumActionResult.SUCCESS;
}
@Override
public Multimap<String, AttributeModifier> getItemAttributeModifiers(EntityEquipmentSlot equipmentSlot) {
Multimap<String, AttributeModifier> multimap = super.getItemAttributeModifiers(equipmentSlot);
if (equipmentSlot == EntityEquipmentSlot.MAINHAND) {
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Tool modifier", theToolMaterial.getDamageVsEntity() + 0.5, 0));
multimap.put(SharedMonsterAttributes.ATTACK_SPEED.getName(), new AttributeModifier(ATTACK_SPEED_MODIFIER, "Tool modifier", -1.5, 0));
}
return multimap;
}
@Override
@@ -69,6 +102,14 @@ public class ItemTrowel extends Item
}
public String getToolMaterialName() {
return this.theToolMaterial.toString();
return theToolMaterial.toString();
}
@SideOnly(Side.CLIENT)
private class ItemTrowelMeshDefinition implements ItemMeshDefinition {
@Override
public ModelResourceLocation getModelLocation(ItemStack stack) {
return new ModelResourceLocation(Constants.BOTANY_MOD_ID + ":tools/" + modelName, "inventory");
}
}
}
@@ -1,37 +1,25 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.gardening;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.util.IIcon;
import net.minecraft.item.ItemStack;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
public class ItemWeed extends ItemBlock
{
public ItemWeed(final Block p_i45328_1_) {
super(p_i45328_1_);
this.setHasSubtypes(true);
this.hasSubtypes = true;
import binnie.core.util.I18N;
public class ItemWeed extends ItemBlock {
public ItemWeed(Block block) {
super(block);
setHasSubtypes(true);
hasSubtypes = true;
}
@Override
public String getItemStackDisplayName(final ItemStack stack) {
return BlockPlant.Type.values()[stack.getItemDamage()].getName();
public String getItemStackDisplayName(ItemStack stack) {
return I18N.localise("botany.plant." + PlantType.values()[stack.getItemDamage()].getName());
}
@Override
public int getMetadata(final int p_77647_1_) {
return p_77647_1_;
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamage(final int p_77617_1_) {
return this.field_150939_a.getIcon(2, p_77617_1_);
public int getMetadata(int damage) {
return damage;
}
}
@@ -1,114 +1,170 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.gardening;
import binnie.core.block.TileEntityMetadata;
import java.util.HashMap;
import java.util.Map;
import binnie.botany.genetics.EnumFlowerColor;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import net.minecraft.init.Items;
import net.minecraftforge.oredict.ShapedOreRecipe;
import binnie.core.Mods;
import net.minecraft.item.crafting.IRecipe;
import binnie.botany.api.EnumAcidity;
import binnie.botany.farm.CircuitGarden;
import binnie.botany.api.EnumMoisture;
import binnie.Constants;
import binnie.botany.flower.EnumTubeInsulate;
import binnie.botany.flower.EnumTubeMaterial;
import binnie.core.util.RecipeUtil;
import net.minecraft.init.Blocks;
import binnie.botany.ceramic.PigmentRecipe;
import net.minecraftforge.oredict.RecipeSorter;
import binnie.botany.ceramic.CeramicTileRecipe;
import binnie.core.block.MultipassItemRenderer;
import binnie.botany.ceramic.BlockCeramicBrick;
import binnie.botany.ceramic.BlockCeramicPatterned;
import net.minecraftforge.client.IItemRenderer;
import binnie.core.block.ItemMetadataRenderer;
import binnie.core.BinnieCore;
import binnie.core.block.ItemMetadata;
import binnie.botany.ceramic.BlockStained;
import binnie.botany.ceramic.BlockCeramic;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.RecipeSorter;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import net.minecraftforge.fml.common.registry.GameRegistry;
import binnie.botany.Botany;
import binnie.botany.CreativeTabBotany;
import binnie.botany.api.EnumAcidity;
import binnie.botany.api.EnumMoisture;
import binnie.botany.api.EnumSoilType;
import binnie.botany.api.IGardeningManager;
import binnie.botany.ceramic.BlockCeramic;
import binnie.botany.ceramic.BlockCeramicPatterned;
import binnie.botany.ceramic.BlockStainedGlass;
import binnie.botany.ceramic.CeramicTileRecipe;
import binnie.botany.ceramic.ItemCeramic;
import binnie.botany.ceramic.ItemStainedGlass;
import binnie.botany.ceramic.PigmentRecipe;
import binnie.botany.ceramic.TileCeramic;
import binnie.botany.ceramic.brick.BlockCeramicBrick;
import binnie.botany.ceramic.brick.ItemCeramicBrick;
import binnie.botany.ceramic.brick.TileCeramicBrick;
import binnie.botany.core.BotanyCore;
import binnie.botany.farm.CircuitGarden;
import binnie.botany.flower.ItemInsulatedTube;
import binnie.botany.genetics.EnumFlowerColor;
import binnie.botany.items.BotanyItems;
import binnie.botany.items.ItemClay;
import binnie.botany.items.ItemPigment;
import binnie.botany.CreativeTabBotany;
import binnie.botany.items.BotanyItems;
import binnie.Binnie;
import net.minecraft.item.Item;
import binnie.botany.flower.ItemInsulatedTube;
import net.minecraft.block.Block;
import cpw.mods.fml.common.registry.GameRegistry;
import binnie.botany.Botany;
import binnie.botany.api.EnumSoilType;
import net.minecraft.item.ItemStack;
import java.util.HashMap;
import binnie.core.BinnieCore;
import binnie.core.IInitializable;
import binnie.core.Mods;
import binnie.core.block.TileEntityMetadata;
import binnie.core.item.ItemMisc;
import binnie.extratrees.carpentry.ItemDesign;
public class ModuleGardening implements IInitializable
{
public static HashMap<ItemStack, Integer> queuedAcidFertilisers;
public static HashMap<ItemStack, Integer> queuedAlkalineFertilisers;
public static HashMap<ItemStack, Integer> queuedNutrientFertilisers;
public class ModuleGardening implements IInitializable {
public static final HashMap<ItemStack, Integer> queuedAcidFertilisers = new HashMap<>();
public static final HashMap<ItemStack, Integer> queuedAlkalineFertilisers = new HashMap<>();
public static final HashMap<ItemStack, Integer> queuedNutrientFertilisers = new HashMap<>();
public BlockPlant plant;
public ItemTrowel trowelWood;
public ItemTrowel trowelStone;
public ItemTrowel trowelIron;
public ItemTrowel trowelDiamond;
public ItemTrowel trowelGold;
public BlockSoil soil;
public BlockSoil loam;
public BlockSoil flowerbed;
public BlockSoil soilNoWeed;
public BlockSoil loamNoWeed;
public BlockSoil flowerbedNoWeed;
public ItemInsulatedTube insulatedTube;
public ItemSoilMeter soilMeter;
public ItemMisc misc;
public ItemPigment pigment;
public ItemClay clay;
public BlockCeramic ceramic;
public BlockCeramicPatterned ceramicTile;
public BlockStainedGlass stained;
public BlockCeramicBrick ceramicBrick;
@Override
public void preInit() {
Botany.soil = new BlockSoil(EnumSoilType.SOIL, "soil", false);
Botany.loam = new BlockSoil(EnumSoilType.LOAM, "loam", false);
Botany.flowerbed = new BlockSoil(EnumSoilType.FLOWERBED, "flowerbed", false);
Botany.soilNoWeed = new BlockSoil(EnumSoilType.SOIL, "soilNoWeed", true);
Botany.loamNoWeed = new BlockSoil(EnumSoilType.LOAM, "loamNoWeed", true);
Botany.flowerbedNoWeed = new BlockSoil(EnumSoilType.FLOWERBED, "flowerbedNoWeed", true);
GameRegistry.registerBlock(Botany.plant = new BlockPlant(), ItemWeed.class, "plant");
GameRegistry.registerBlock(Botany.soil, ItemSoil.class, "soil");
GameRegistry.registerBlock(Botany.loam, ItemSoil.class, "loam");
GameRegistry.registerBlock(Botany.flowerbed, ItemSoil.class, "flowerbed");
GameRegistry.registerBlock(Botany.soilNoWeed, ItemSoil.class, "soilNoWeed");
GameRegistry.registerBlock(Botany.loamNoWeed, ItemSoil.class, "loamNoWeed");
GameRegistry.registerBlock(Botany.flowerbedNoWeed, ItemSoil.class, "flowerbedNoWeed");
Botany.soilMeter = new ItemSoilMeter();
Botany.insulatedTube = new ItemInsulatedTube();
Botany.trowelWood = new ItemTrowel(Item.ToolMaterial.WOOD, "Wood");
Botany.trowelStone = new ItemTrowel(Item.ToolMaterial.STONE, "Stone");
Botany.trowelIron = new ItemTrowel(Item.ToolMaterial.IRON, "Iron");
Botany.trowelDiamond = new ItemTrowel(Item.ToolMaterial.EMERALD, "Diamond");
Botany.trowelGold = new ItemTrowel(Item.ToolMaterial.GOLD, "Gold");
Botany.misc = Binnie.Item.registerMiscItems(BotanyItems.values(), CreativeTabBotany.instance);
Botany.pigment = new ItemPigment();
Botany.clay = new ItemClay();
Botany.ceramic = new BlockCeramic();
Botany.stained = new BlockStained();
GameRegistry.registerBlock(Botany.ceramic, ItemMetadata.class, "ceramic");
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramic), new ItemMetadataRenderer());
GameRegistry.registerBlock(Botany.stained, ItemMetadata.class, "stained");
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.stained), new ItemMetadataRenderer());
Botany.ceramicTile = new BlockCeramicPatterned();
Botany.ceramicBrick = new BlockCeramicBrick();
GameRegistry.registerBlock(Botany.ceramicTile, ItemMetadata.class, "ceramicPattern");
GameRegistry.registerBlock(Botany.ceramicBrick, ItemMetadata.class, "ceramicBrick");
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramicTile), new MultipassItemRenderer());
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramicBrick), new MultipassItemRenderer());
plant = new BlockPlant();
soil = new BlockSoil(EnumSoilType.SOIL, "soil", false);
loam = new BlockSoil(EnumSoilType.LOAM, "loam", false);
flowerbed = new BlockSoil(EnumSoilType.FLOWERBED, "flowerbed", false);
soilNoWeed = new BlockSoil(EnumSoilType.SOIL, "soil_no_weed", true);
loamNoWeed = new BlockSoil(EnumSoilType.LOAM, "loam_no_weed", true);
flowerbedNoWeed = new BlockSoil(EnumSoilType.FLOWERBED, "flowerbed_no_weed", true);
soilMeter = new ItemSoilMeter();
insulatedTube = new ItemInsulatedTube();
trowelWood = new ItemTrowel(Item.ToolMaterial.WOOD, "wood");
trowelStone = new ItemTrowel(Item.ToolMaterial.STONE, "stone");
trowelIron = new ItemTrowel(Item.ToolMaterial.IRON, "iron");
trowelDiamond = new ItemTrowel(Item.ToolMaterial.DIAMOND, "diamond");
trowelGold = new ItemTrowel(Item.ToolMaterial.GOLD, "gold");
misc = new ItemMisc(CreativeTabBotany.instance, BotanyItems.values());
pigment = new ItemPigment();
clay = new ItemClay();
ceramic = new BlockCeramic();
stained = new BlockStainedGlass();
ceramicTile = new BlockCeramicPatterned();
ceramicBrick = new BlockCeramicBrick();
Botany.proxy.registerBlock(plant, new ItemWeed(plant));
Botany.proxy.registerBlock(soil, new ItemSoil(soil));
Botany.proxy.registerBlock(loam, new ItemSoil(loam));
Botany.proxy.registerBlock(flowerbed, new ItemSoil(flowerbed));
Botany.proxy.registerBlock(soilNoWeed, new ItemSoil(soilNoWeed));
Botany.proxy.registerBlock(loamNoWeed, new ItemSoil(loamNoWeed));
Botany.proxy.registerBlock(flowerbedNoWeed, new ItemSoil(flowerbedNoWeed));
Botany.proxy.registerItem(soilMeter);
Botany.proxy.registerItem(insulatedTube);
Botany.proxy.registerItem(trowelWood);
Botany.proxy.registerItem(trowelStone);
Botany.proxy.registerItem(trowelIron);
Botany.proxy.registerItem(trowelDiamond);
Botany.proxy.registerItem(trowelGold);
Botany.proxy.registerItem(misc);
Botany.proxy.registerItem(pigment);
Botany.proxy.registerItem(clay);
Botany.proxy.registerBlock(ceramic, new ItemCeramic(ceramic));
Botany.proxy.registerBlock(stained, new ItemStainedGlass(stained));
Botany.proxy.registerBlock(ceramicTile, new ItemDesign(ceramicTile));
Botany.proxy.registerBlock(ceramicBrick, new ItemCeramicBrick(ceramicBrick));
BinnieCore.getBinnieProxy().registerTileEntity(TileCeramic.class, "botany.tile.ceramic");
//BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(ceramic), new ItemMetadataRenderer());
//BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(stained), new ItemMetadataRenderer());
BinnieCore.getBinnieProxy().registerTileEntity(TileCeramicBrick.class, "botany.tile.ceramicBrick");
//BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(ceramicTile), new MultipassItemRenderer());
//BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(ceramicBrick), new MultipassItemRenderer());
OreDictionary.registerOre("pigment", pigment);
OreDictionary.registerOre("toolTrowel", trowelWood);
OreDictionary.registerOre("toolTrowel", trowelStone);
OreDictionary.registerOre("toolTrowel", trowelIron);
OreDictionary.registerOre("toolTrowel", trowelGold);
OreDictionary.registerOre("toolTrowel", trowelDiamond);
}
@Override
public void init() {
OreDictionary.registerOre("pigment", Botany.pigment);
RecipeSorter.register("botany:ceramictile", CeramicTileRecipe.class, RecipeSorter.Category.SHAPED, "");
RecipeSorter.register("botany:pigment", PigmentRecipe.class, RecipeSorter.Category.SHAPED, "");
final ItemStack yellow = new ItemStack(Blocks.yellow_flower, 1);
final ItemStack red = new ItemStack(Blocks.red_flower, 1);
final ItemStack blue = new ItemStack(Blocks.red_flower, 1, 7);
for (final boolean manual : new boolean[] { true, false }) {
for (final boolean fertilised : new boolean[] { true, false }) {
for (final EnumMoisture moist : EnumMoisture.values()) {
final ItemStack icon = (moist == EnumMoisture.Dry) ? yellow : ((moist == EnumMoisture.Normal) ? red : blue);
ItemStack yellow = new ItemStack(Blocks.YELLOW_FLOWER, 1);
ItemStack red = new ItemStack(Blocks.RED_FLOWER, 1);
ItemStack blue = new ItemStack(Blocks.RED_FLOWER, 1, 7);
for (boolean manual : new boolean[]{true, false}) {
for (boolean fertilised : new boolean[]{true, false}) {
for (EnumMoisture moist : EnumMoisture.values()) {
ItemStack icon;
if (moist == EnumMoisture.DRY) {
icon = yellow;
} else if (moist == EnumMoisture.NORMAL) {
icon = red;
} else {
icon = blue;
}
int insulate = 2 - moist.ordinal();
if (fertilised) {
insulate += 3;
}
new CircuitGarden(moist, null, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 0 + 128 * insulate), icon);
new CircuitGarden(moist, EnumAcidity.Acid, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 1 + 128 * insulate), icon);
new CircuitGarden(moist, EnumAcidity.Neutral, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 2 + 128 * insulate), icon);
new CircuitGarden(moist, EnumAcidity.Alkaline, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 3 + 128 * insulate), icon);
new CircuitGarden(moist, null, manual, fertilised, new ItemStack(insulatedTube, 1, 128 * insulate), icon);
new CircuitGarden(moist, EnumAcidity.ACID, manual, fertilised, new ItemStack(insulatedTube, 1, 1 + 128 * insulate), icon);
new CircuitGarden(moist, EnumAcidity.NEUTRAL, manual, fertilised, new ItemStack(insulatedTube, 1, 2 + 128 * insulate), icon);
new CircuitGarden(moist, EnumAcidity.ALKALINE, manual, fertilised, new ItemStack(insulatedTube, 1, 3 + 128 * insulate), icon);
}
}
}
@@ -116,92 +172,179 @@ public class ModuleGardening implements IInitializable
@Override
public void postInit() {
GameRegistry.addRecipe(new CeramicTileRecipe());
for (int mat = 0; mat < 4; ++mat) {
for (int insulate = 0; insulate < 6; ++insulate) {
final ItemStack tubes = new ItemStack(Botany.insulatedTube, 2, mat + 128 * insulate);
final ItemStack insulateStack = ItemInsulatedTube.getInsulateStack(tubes);
final ItemStack forestryTube = new ItemStack(Mods.Forestry.item("thermionicTubes"), 1, mat);
GameRegistry.addShapelessRecipe(tubes, new Object[] { forestryTube, forestryTube, insulateStack });
RecipeUtil recipeUtil = new RecipeUtil(Constants.BOTANY_MOD_ID);
IGardeningManager gardening = BotanyCore.getGardening();
ForgeRegistries.RECIPES.register(new CeramicTileRecipe());
for (EnumTubeMaterial mat: EnumTubeMaterial.VALUES) {
for (EnumTubeInsulate insulate : EnumTubeInsulate.VALUES) {
ItemStack tubes = new ItemStack(insulatedTube, 2, mat.ordinal() + 128 * insulate.ordinal());
ItemStack insulateStack = ItemInsulatedTube.getInsulateStack(tubes);
ItemStack forestryTube = new ItemStack(Mods.Forestry.item("thermionic_tubes"), 1, mat.ordinal());
String recipeName = "thermionic_tubes_" + insulate.getUid() + "_" + mat.getUid();
recipeUtil.addShapelessRecipe(recipeName, tubes, forestryTube, forestryTube, insulateStack);
}
}
GameRegistry.addRecipe(new ShapedOreRecipe((Item) Botany.trowelWood, new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "plankWood" }));
GameRegistry.addRecipe(new ShapedOreRecipe((Item) Botany.trowelStone, new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "cobblestone" }));
GameRegistry.addRecipe(new ShapedOreRecipe((Item) Botany.trowelIron, new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "ingotIron" }));
GameRegistry.addRecipe(new ShapedOreRecipe((Item) Botany.trowelGold, new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "ingotGold" }));
GameRegistry.addRecipe(new ShapedOreRecipe((Item) Botany.trowelDiamond, new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "gemDiamond" }));
GameRegistry.addRecipe(new ShapedOreRecipe((Item) Botany.soilMeter, new Object[] { " gg", " rg", "i ", 'g', "ingotGold", 'r', "dustRedstone", 'i', "ingotIron" }));
GameRegistry.addShapelessRecipe(BotanyItems.Weedkiller.get(4), new Object[] { new ItemStack(Items.spider_eye), new ItemStack(Items.wheat_seeds), new ItemStack(Items.wheat_seeds), new ItemStack(Items.wheat_seeds) });
GameRegistry.addShapelessRecipe(BotanyItems.AshPowder.get(4), new Object[] { Mods.Forestry.stack("ash") });
GameRegistry.addShapelessRecipe(BotanyItems.MulchPowder.get(4), new Object[] { Mods.Forestry.stack("mulch") });
GameRegistry.addShapelessRecipe(BotanyItems.CompostPowder.get(4), new Object[] { Mods.Forestry.stack("fertilizerBio") });
GameRegistry.addShapelessRecipe(BotanyItems.FertiliserPowder.get(4), new Object[] { Mods.Forestry.stack("fertilizerCompound") });
GameRegistry.addShapelessRecipe(BotanyItems.PulpPowder.get(4), new Object[] { Mods.Forestry.stack("woodPulp") });
GameRegistry.addRecipe(new ShapelessOreRecipe(BotanyItems.SulphurPowder.get(4), new Object[] { "dustSulphur" }));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Botany.pigment, 2, EnumFlowerColor.Black.ordinal()), new Object[] { "pigment", "pigment", "dyeBlack" }));
ModuleGardening.queuedAcidFertilisers.put(BotanyItems.SulphurPowder.get(1), 1);
ModuleGardening.queuedAcidFertilisers.put(BotanyItems.MulchPowder.get(1), 1);
ModuleGardening.queuedAcidFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "mulch")), 2);
for (final ItemStack stack : OreDictionary.getOres("dustSulfur")) {
ModuleGardening.queuedAcidFertilisers.put(stack, 2);
recipeUtil.addRecipe("trowel_wood",
trowelWood,
"d ", " x ", " s",
'd', Blocks.DIRT,
's', "stickWood",
'x', "plankWood"
);
recipeUtil.addRecipe("trowel_stone",
trowelStone,
"d ", " x ", " s",
'd', Blocks.DIRT,
's', "stickWood",
'x', "cobblestone"
);
recipeUtil.addRecipe("trowel_iron",
trowelIron,
"d ", " x ", " s",
'd', Blocks.DIRT,
's', "stickWood",
'x', "ingotIron"
);
recipeUtil.addRecipe("trowel_gold",
trowelGold,
"d ", " x ", " s",
'd', Blocks.DIRT,
's', "stickWood",
'x', "ingotGold"
);
recipeUtil.addRecipe("trowel_diamond",
trowelDiamond,
"d ", " x ", " s",
'd', Blocks.DIRT,
's', "stickWood",
'x', "gemDiamond"
);
recipeUtil.addRecipe("soil_meter",
soilMeter,
" gg", " rg", "i ",
'g', "ingotGold",
'r', "dustRedstone",
'i', "ingotIron"
);
recipeUtil.addShapelessRecipe("weed_killer",
BotanyItems.WEEDKILLER.get(4),
new ItemStack(Items.SPIDER_EYE),
new ItemStack(Items.WHEAT_SEEDS),
new ItemStack(Items.WHEAT_SEEDS),
new ItemStack(Items.WHEAT_SEEDS)
);
recipeUtil.addShapelessRecipe("powder_ash",
BotanyItems.POWDER_ASH.get(4),
Mods.Forestry.stack("ash")
);
recipeUtil.addShapelessRecipe("powder_mulch",
BotanyItems.POWDER_MULCH.get(4),
Mods.Forestry.stack("mulch")
);
recipeUtil.addShapelessRecipe("powder_compost",
BotanyItems.POWDER_COMPOST.get(4),
Mods.Forestry.stack("fertilizer_bio")
);
recipeUtil.addShapelessRecipe("powder_fertilizer",
BotanyItems.POWDER_FERTILISER.get(4),
Mods.Forestry.stack("fertilizer_compound")
);
recipeUtil.addShapelessRecipe("powder_pulp",
BotanyItems.POWDER_PULP.get(4),
Mods.Forestry.stack("wood_pulp")
);
recipeUtil.addShapelessRecipe("powder_sulphur",
BotanyItems.POWDER_SULPHUR.get(4),
"dustSulphur"
);
recipeUtil.addShapelessRecipe("pigment_black",
new ItemStack(pigment, 2, EnumFlowerColor.Black.ordinal()),
"pigment", "pigment", "dyeBlack"
);
gardening.registerAcidFertiliser(BotanyItems.POWDER_SULPHUR.get(1), 1);
gardening.registerAcidFertiliser(BotanyItems.POWDER_MULCH.get(1), 1);
gardening.registerAcidFertiliser(Mods.Forestry.stack("mulch"), 2);
for (ItemStack stack : OreDictionary.getOres("dustSulfur")) {
gardening.registerAcidFertiliser(stack, 2);
}
ModuleGardening.queuedAlkalineFertilisers.put(BotanyItems.AshPowder.get(1), 1);
ModuleGardening.queuedAlkalineFertilisers.put(BotanyItems.PulpPowder.get(1), 1);
ModuleGardening.queuedAlkalineFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "ash")), 2);
ModuleGardening.queuedAlkalineFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "woodPulp")), 2);
ModuleGardening.queuedNutrientFertilisers.put(BotanyItems.CompostPowder.get(1), 1);
ModuleGardening.queuedNutrientFertilisers.put(BotanyItems.FertiliserPowder.get(1), 1);
ModuleGardening.queuedNutrientFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "fertilizerBio")), 2);
ModuleGardening.queuedNutrientFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "fertilizerCompound")), 2);
for (final Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedAcidFertilisers.entrySet()) {
this.addAcidFertiliser(entry.getKey(), entry.getValue());
gardening.registerAlkalineFertiliser(BotanyItems.POWDER_ASH.get(1), 1);
gardening.registerAlkalineFertiliser(BotanyItems.POWDER_PULP.get(1), 1);
gardening.registerAlkalineFertiliser(Mods.Forestry.stack("ash"), 2);
gardening.registerAlkalineFertiliser(Mods.Forestry.stack("wood_pulp"), 2);
gardening.registerNutrientFertiliser(BotanyItems.POWDER_COMPOST.get(1), 1);
gardening.registerNutrientFertiliser(BotanyItems.POWDER_FERTILISER.get(1), 1);
gardening.registerNutrientFertiliser(Mods.Forestry.stack("fertilizer_bio"), 2);
gardening.registerNutrientFertiliser(Mods.Forestry.stack("fertilizer_compound"), 2);
for (Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedAcidFertilisers.entrySet()) {
addAcidFertiliserRecipe(recipeUtil, entry.getKey(), entry.getValue());
}
for (final Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedAlkalineFertilisers.entrySet()) {
this.addAlkalineFertiliser(entry.getKey(), entry.getValue());
for (Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedAlkalineFertilisers.entrySet()) {
addAlkalineFertiliserRecipe(recipeUtil, entry.getKey(), entry.getValue());
}
for (final Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedNutrientFertilisers.entrySet()) {
this.addNutrientFertiliser(entry.getKey(), entry.getValue());
for (Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedNutrientFertilisers.entrySet()) {
addNutrientFertiliserRecipe(recipeUtil, entry.getKey(), entry.getValue());
}
GameRegistry.addRecipe(BotanyItems.Mortar.get(6), new Object[] { " c ", "cgc", " c ", 'c', Items.clay_ball, 'g', Blocks.gravel });
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
final ItemStack clay = new ItemStack(Botany.clay, 1, c.ordinal());
final ItemStack pigment = new ItemStack(Botany.pigment, 1, c.ordinal());
GameRegistry.addShapelessRecipe(clay, new Object[] { Items.clay_ball, Items.clay_ball, Items.clay_ball, pigment });
GameRegistry.addSmelting(clay, TileEntityMetadata.getItemStack(Botany.ceramic, c.ordinal()), 0.0f);
final ItemStack glass = TileEntityMetadata.getItemStack(Botany.stained, c.ordinal());
glass.stackSize = 4;
GameRegistry.addShapedRecipe(glass, new Object[] { " g ", "gpg", " g ", 'g', Blocks.glass, 'p', pigment });
recipeUtil.addRecipe("mortar", BotanyItems.MORTAR.get(6), " c ", "cgc", " c ", 'c', Items.CLAY_BALL, 'g', Blocks.GRAVEL);
for (EnumFlowerColor c : EnumFlowerColor.values()) {
ItemStack clay = new ItemStack(this.clay, 1, c.ordinal());
ItemStack pigment = new ItemStack(this.pigment, 1, c.ordinal());
recipeUtil.addShapelessRecipe("clay_" + c.getIdent(), clay, Items.CLAY_BALL, Items.CLAY_BALL, Items.CLAY_BALL, pigment);
GameRegistry.addSmelting(clay, TileEntityMetadata.getItemStack(ceramic, c.ordinal()), 0.0f);
ItemStack glass = TileEntityMetadata.getItemStack(stained, c.ordinal());
glass.setCount(4);
recipeUtil.addRecipe("mortar_" + c.getIdent(),
glass,
" g ", "gpg", " g ",
'g', Blocks.GLASS,
'p', pigment
);
}
GameRegistry.addRecipe(new PigmentRecipe());
ForgeRegistries.RECIPES.register(new PigmentRecipe());
}
private ItemStack getStack(final int type, final int pH, final int moisture) {
if (type < 0 || type > 2 || pH < 0 || pH > 2 || moisture < 0 || moisture > 2) {
return null;
private ItemStack getStack(int type, int pH, int moisture) {
if (type >= 0 && type <= 2 && pH >= 0 && pH <= 2 && moisture >= 0 && moisture <= 2) {
return new ItemStack(BotanyCore.getGardening().getSoilBlock(EnumSoilType.values()[type]), 1, BlockSoil.getMeta(EnumAcidity.values()[pH], EnumMoisture.values()[moisture]));
}
return new ItemStack(Gardening.getSoilBlock(EnumSoilType.values()[type]), 1, BlockSoil.getMeta(EnumAcidity.values()[pH], EnumMoisture.values()[moisture]));
return ItemStack.EMPTY;
}
private void addAcidFertiliser(final ItemStack stack, final int strengthMax) {
if (stack == null) {
return;
}
Gardening.fertiliserAcid.put(stack, strengthMax);
private void addAcidFertiliserRecipe(RecipeUtil recipeUtil, ItemStack stack, int strengthMax) {
for (int moisture = 0; moisture < 3; ++moisture) {
for (int pH = 0; pH < 3; ++pH) {
for (int type = 0; type < 3; ++type) {
int numOfBlocks = strengthMax * strengthMax;
for (int strength = 1; strength < strengthMax; ++strength) {
final ItemStack start = this.getStack(type, pH, moisture);
final ItemStack end = this.getStack(type, pH - strength, moisture);
if (end != null) {
end.stackSize = numOfBlocks;
final Object[] stacks = new Object[numOfBlocks + 1];
ItemStack start = getStack(type, pH, moisture);
ItemStack end = getStack(type, pH - strength, moisture);
if (!start.isEmpty() && !end.isEmpty()) {
end.setCount(numOfBlocks);
Object[] stacks = new Object[numOfBlocks + 1];
for (int i = 0; i < numOfBlocks; ++i) {
stacks[i] = start;
}
stacks[numOfBlocks] = stack.copy();
GameRegistry.addShapelessRecipe(end, stacks);
String recipeName = "acid_fertiliser_moisture" + moisture + "_ph" + pH + "_type" + type + "_strength" + strength;
recipeUtil.addShapelessRecipe(recipeName, end, stacks);
}
numOfBlocks /= 2;
}
@@ -210,26 +353,23 @@ public class ModuleGardening implements IInitializable
}
}
private void addAlkalineFertiliser(final ItemStack stack, final int strengthMax) {
if (stack == null) {
return;
}
Gardening.fertiliserAlkaline.put(stack, strengthMax);
private void addAlkalineFertiliserRecipe(RecipeUtil recipeUtil, ItemStack stack, int strengthMax) {
for (int moisture = 0; moisture < 3; ++moisture) {
for (int pH = 0; pH < 3; ++pH) {
for (int type = 0; type < 3; ++type) {
int numOfBlocks = strengthMax * strengthMax;
for (int strength = 1; strength < strengthMax; ++strength) {
final ItemStack start = this.getStack(type, pH, moisture);
final ItemStack end = this.getStack(type, pH + strength, moisture);
if (end != null) {
end.stackSize = numOfBlocks;
final Object[] stacks = new Object[numOfBlocks + 1];
ItemStack start = getStack(type, pH, moisture);
ItemStack end = getStack(type, pH + strength, moisture);
if (!end.isEmpty()) {
end.setCount(numOfBlocks);
Object[] stacks = new Object[numOfBlocks + 1];
for (int i = 0; i < numOfBlocks; ++i) {
stacks[i] = start;
}
stacks[numOfBlocks] = stack.copy();
GameRegistry.addShapelessRecipe(end, stacks);
String recipeName = "alkaline_fertiliser_moisture" + moisture + "_ph" + pH + "_type" + type + "_strength" + strength;
recipeUtil.addShapelessRecipe(recipeName, end, stacks);
}
numOfBlocks /= 2;
}
@@ -238,26 +378,23 @@ public class ModuleGardening implements IInitializable
}
}
private void addNutrientFertiliser(final ItemStack stack, final int strengthMax) {
if (stack == null) {
return;
}
Gardening.fertiliserNutrient.put(stack, strengthMax);
private void addNutrientFertiliserRecipe(RecipeUtil recipeUtil, ItemStack stack, int strengthMax) {
for (int moisture = 0; moisture < 3; ++moisture) {
for (int pH = 0; pH < 3; ++pH) {
for (int type = 0; type < 3; ++type) {
int numOfBlocks = strengthMax * strengthMax;
for (int strength = 1; strength < strengthMax; ++strength) {
final ItemStack start = this.getStack(type, pH, moisture);
final ItemStack end = this.getStack(type + strength, pH, moisture);
if (end != null) {
end.stackSize = numOfBlocks;
final Object[] stacks = new Object[numOfBlocks + 1];
ItemStack start = getStack(type, pH, moisture);
ItemStack end = getStack(type + strength, pH, moisture);
if (!end.isEmpty()) {
end.setCount(numOfBlocks);
Object[] stacks = new Object[numOfBlocks + 1];
for (int i = 0; i < numOfBlocks; ++i) {
stacks[i] = start;
}
stacks[numOfBlocks] = stack.copy();
GameRegistry.addShapelessRecipe(end, stacks);
String recipeName = "nutrient_fertiliser_moisture" + moisture + "_ph" + pH + "_type" + type + "_strength" + strength;
recipeUtil.addShapelessRecipe(recipeName, end, stacks);
}
numOfBlocks /= 2;
}
@@ -265,10 +402,4 @@ public class ModuleGardening implements IInitializable
}
}
}
static {
ModuleGardening.queuedAcidFertilisers = new HashMap<ItemStack, Integer>();
ModuleGardening.queuedAlkalineFertilisers = new HashMap<ItemStack, Integer>();
ModuleGardening.queuedNutrientFertilisers = new HashMap<ItemStack, Integer>();
}
}
@@ -0,0 +1,43 @@
package binnie.botany.gardening;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IStringSerializable;
import binnie.botany.Botany;
public enum PlantType implements IStringSerializable {
WEEDS("weeds", true),
WEEDS_LONG("weeds_long", true),
WEEDS_VERY_LONG("weeds_very_long", true),
DEAD_FLOWER("dead_flower"),
DECAYING_FLOWER("decaying_flower");
String name;
boolean isWeed;
PlantType(String name) {
this(name, false);
}
PlantType(String name, boolean isWeed) {
this.name = name;
this.isWeed = isWeed;
}
public static PlantType get(int id) {
return values()[id % values().length];
}
public ItemStack get() {
return new ItemStack(Botany.gardening().plant, 1, ordinal());
}
public boolean isWeed() {
return isWeed;
}
@Override
public String getName() {
return name;
}
}
@@ -0,0 +1,9 @@
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@FieldsAreNonnullByDefault
package binnie.botany.gardening;
import javax.annotation.ParametersAreNonnullByDefault;
import binnie.core.util.FieldsAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
@@ -1,52 +0,0 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.botany.genetics;
import forestry.api.genetics.IAlleleInteger;
public class AlleleColor implements IAlleleInteger
{
String uid;
boolean dominant;
String name;
int value;
EnumFlowerColor color;
public AlleleColor(final EnumFlowerColor color, final String uid, final String name, final int value) {
this.color = color;
this.uid = uid;
this.name = name;
this.value = value;
}
@Override
public String getUID() {
return this.uid;
}
@Override
public boolean isDominant() {
return true;
}
@Override
public String getName() {
return this.color.getName();
}
@Override
public int getValue() {
return this.value;
}
public EnumFlowerColor getColor() {
return this.color;
}
@Override
public String getUnlocalizedName() {
return this.getUID();
}
}
Loaded 100 of 2706 files, more files were not shown because too many files have changed in this diff. Show more