Compare commits

...
262 Commits
Author SHA1 Message Date
mezz d2d9da6af7 Version 5.8.1 Release 2018-07-15 13:42:27 -07:00
temp1011 a9819781d0 Clean up some condition checking (#2191) 2018-07-12 22:11:41 +02:00
temp1011 055834b63a Fix some crashes when disabling fluids #2188 (#2190) 2018-07-12 22:11:29 +02:00
temp1011 e244a0c82c Fix cocoon tile name (#2181) 2018-07-12 22:10:21 +02:00
temp1011 ef96f754d8 fix uncraftable capsules with apiculture disabled #2183 (#2184) 2018-07-11 15:34:30 +02:00
Nedelosk 32270601e7 Merge remote-tracking branch 'origin/mc-1.12' into mc 2018-07-11 15:28:20 +02:00
Nedelosk 823305dd94 Fix #2165, #2186, #2166 De-Sync of all inventory containers and guis 2018-07-11 15:27:56 +02:00
Konstantin bbf80a4320 Update ru_ru.lang (#2122) 2018-07-11 14:21:08 +02:00
Urey. Xue 4057537027 Update zh_cn.lang (#2187) 2018-07-11 14:20:38 +02:00
temp1011 3a294b79a7 Fix buildcraft dependencies (#2180) 2018-07-10 00:00:40 +02:00
temp1011 206d483422 Fix tree gen #2178 (#2179) 2018-07-08 15:14:23 +02:00
Nedelosk 6d51d53da1 Add interface for more easy handling of charcoal pile walls 2018-07-06 01:43:28 +02:00
Nedelosk 1ee6c05494 Update JEI and add farming JEI Category 2018-07-05 17:12:20 +02:00
therealfarfetchd 8feb3500a4 BuildCraft support (#2158) 2018-06-28 21:54:17 +02:00
Nedelosk 4515aa513a Update TileEntityDataFixable log from 'info' to 'debug' 2018-06-28 21:48:21 +02:00
Nedelosk c06057ddd0 Merge branch 'mc-1.12' of https://github.com/ForestryMC/ForestryMC into tile-test 2018-06-28 21:43:16 +02:00
Nedelosk 9b4a4c2b1d Fix Tile Entity Registration 2018-06-28 18:23:45 +02:00
temp1011 2b3d21b05d prevent effect damage underwater (#2149) 2018-06-27 03:06:57 +02:00
temp1011 cb43bbee52 fix broken texture in butterfly model #2171 (#2173) 2018-06-27 03:06:46 +02:00
temp1011 b92a1a10e9 add kill count to butterfly kill command (#2174) 2018-06-27 03:06:38 +02:00
Urey. Xue 8a431e56ef Update zh_cn.lang (#2169) 2018-06-23 23:01:51 +02:00
Nedelosk f73b48695e Merge remote-tracking branch 'origin/mc-1.12' into bug-1.12 2018-06-22 11:25:19 +02:00
Nedelosk 0454fea0a8 Fix broken Flower Cache synchronisation to the client and disk 2018-06-22 11:25:03 +02:00
temp1011 4ff772954e fix a bug in hasFlowersCache (#2168) 2018-06-19 19:48:32 +02:00
temp1011 d8304d5d7e fix log not formatting correctly #2023 (#2164) 2018-06-19 19:48:24 +02:00
Nedelosk a12cfff9d9 Clean Up Analyzer Provider 2018-06-16 17:50:56 +02:00
Nedelosk d34ad60d31 Fix #2159 Minecart Apiary Gui Crash 2018-06-16 17:46:27 +02:00
Nedelosk 508b26ca45 Update ForestryPacket.java 2018-06-15 10:30:37 +02:00
Nedelosk 255bd9da99 Fix #2157 Crash on attempt to break Dehumidifier while camouflaged as block from Chisel 2018-06-14 20:09:35 +02:00
Nedelosk 5cedc2adca Merge branch 'mc-1.12' of https://github.com/ForestryMC/ForestryMC into dev 2018-06-14 19:36:39 +02:00
Nedelosk c968278d27 Fix #2160 Remove @SideOnly(Side.CLIENT) from IAlyzerPlugin 2018-06-14 19:36:20 +02:00
src_resources 2392785daa Better zh_cn.lang translation file update. (#2146)
Better zh_cn.lang translation file update.
2018-06-14 18:10:57 +02:00
temp1011 e82691165f Add config for global biome blacklisting for trees and bees (#2150) 2018-06-14 18:09:54 +02:00
temp1011 e54cd57162 clean up some config comments (#2153) 2018-06-14 18:07:42 +02:00
temp1011 0a3a933b77 Cleanup (#2138) 2018-06-14 18:07:31 +02:00
Nedelosk 10dbed1406 Merge pull request #2151 from rosebeats/mc-1.12
fixed the localization names for the StorageJeiPlugin
2018-06-14 18:05:48 +02:00
Nedelosk b515870cb4 Merge remote-tracking branch 'origin/mc-1.12' into dev 2018-06-14 18:02:36 +02:00
Nedelosk 30010d2554 Improve and Clean Up Gui Elements 2018-06-14 18:01:27 +02:00
rosebeats 317d9abfda fixed the localization names for the StorageJeiPlugin 2018-06-07 21:14:09 -04:00
Nedelosk 7df3a94916 Merge pull request #2142 from temp1011/plugin-compat
fix ic2 crash with apiculture #2139
2018-05-28 22:58:09 +02:00
temp1011 8158562974 fix ic2 crash with apiculture #2139 2018-05-28 14:28:55 +01:00
temp1011 a96ce6c873 use new maven for teslaAPI (#2133) 2018-05-28 14:06:39 +02:00
temp1011 6efbdd747d Improve Industrialcraft2 plugin (#2057) 2018-05-28 14:05:32 +02:00
Jason Carrete 82dd0e5eed Update frames.json (#2137) 2018-05-27 11:57:29 +02:00
Nedelosk 64c0590bef Fix Manual Multi-Farms placing humus 2018-05-17 15:28:49 +02:00
Nedelosk 691ccd578e Fix #1525 Balance Electric Engine Circuits 2018-05-11 12:27:58 +02:00
Nedelosk 98cd99aa4e Fix #1914 Forestry Not Playing Right with Fast Leaf Rendering Options. 2018-05-11 12:17:12 +02:00
Nedelosk cd8e78f60a Merge remote-tracking branch 'origin/mc-1.12' into dev 2018-05-11 11:37:21 +02:00
Nedelosk 5ed536da7c Fix #2021 Multifarm configurable without board bug 2018-05-11 11:19:07 +02:00
temp1011 96ca20c784 Add configuration for crates (#2047) 2018-05-11 11:04:11 +02:00
Dmitriy Medvedev 764d969bb4 Fixed Backpacks Localization (#2120) 2018-05-11 11:02:55 +02:00
temp1011 a26a86fe99 use mod log rather than fml log (#2129) 2018-05-11 11:02:43 +02:00
Nedelosk ebe6580aaf Fix #2130 Can't insert Immersive engineering industrial hemp into crop multifarm block 2018-05-11 11:01:02 +02:00
Nedelosk e90ab8caf6 Merge branch 'mc-1.12' of https://github.com/ForestryMC/ForestryMC into dev 2018-05-04 15:04:20 +02:00
Nedelosk efdffd31c8 Fix #2113 Conduits / Itemducts not working with alveary 2018-05-04 15:04:07 +02:00
mezz fa515f0941 Fix #2114 Limit crafting operations to 64 crafts per shift-click 2018-05-02 21:57:28 -07:00
temp1011 78c033a7d2 Clean up code (#2053) 2018-05-01 19:48:06 +02:00
temp1011 4975fa80c3 Make tree gen be configurable (#2046) 2018-05-01 18:42:46 +02:00
temp1011 aa642a3ee8 small fix for a JEI log error (#2110) 2018-05-01 18:42:24 +02:00
Nedelosk b19809bd3c Merge branch 'mc-1.12' of https://github.com/ForestryMC/ForestryMC into dev 2018-05-01 18:42:01 +02:00
temp1011 b566a1befd small fix comb recipes (#2112) 2018-05-01 18:41:49 +02:00
Nedelosk 88c9270316 Fix #2082 Unable to put fuel into the fermenter 2018-05-01 18:41:32 +02:00
Nedelosk f52cc3893b Add lang file back 2018-04-29 12:27:25 +02:00
Nedelosk b7578e3a11 Remove lang files 2018-04-29 12:26:58 +02:00
Nedelosk c124a34533 Remove outdated lang files and lowercase the names of the other files 2018-04-29 12:24:44 +02:00
Nedelosk ae038b23f2 Update Lang files to 1.12 2018-04-29 12:11:34 +02:00
mezz df29777b49 Update README.md 2018-04-28 15:34:43 -07:00
mezz a786d71cfd Rename LANG.md to README.md 2018-04-28 15:33:41 -07:00
temp1011 2b757ae91a Move lang files in to the main project (#2104) 2018-04-28 15:23:56 -07:00
Nedelosk decc351e04 Fix Machine Hit Particles 2018-04-28 14:16:33 +02:00
Nedelosk 98806129bc Merge branch 'mc-1.12' of https://github.com/ForestryMC/ForestryMC into dev 2018-04-28 09:49:31 +02:00
Nedelosk 55c01f4cea Fix #1503 Machine Breaking Particle Speed 2018-04-28 09:48:07 +02:00
temp1011 38447d4d13 Start removing metadata from code in preparation for 1.13 (#2068) 2018-04-27 13:51:41 +02:00
temp1011 348149f4d6 Add config to let capsules be reusable (#2066)
* Add config option to make capsules non consumable

* Fix naming
2018-04-27 13:51:22 +02:00
Jose dfb4504cde Tweak ash texture (#1902)
* Make ash less confusing

* Updated textures
2018-04-27 13:51:13 +02:00
temp1011 f12c6d2d11 Add IMC for registering flowers (#2027) 2018-04-27 13:51:04 +02:00
temp1011 0ff0aa802c Tech reborn plugin (#2078)
* Add Plugin Tech Reborn
2018-04-27 13:50:38 +02:00
temp1011 fd25e0822d fix crash when raytrace result is null #2090 (#2105) 2018-04-27 13:49:57 +02:00
temp1011 649c13f5f0 fix wrong localisation key for habitat locator #2100 (#2106) 2018-04-27 13:49:51 +02:00
Nedelosk 630dcde28a Add missing code 2018-04-20 17:43:56 +02:00
Nedelosk d4dee797d7 Fix book entry loading after reloading the resource manager 2018-04-20 17:35:01 +02:00
Nedelosk 47ff5d9ad1 Fix #2094, Fix #2096 Wrong entry order and Clean Up resource loading 2018-04-20 15:01:31 +02:00
Nedelosk 6ff1d8b8d7 Fix #2095 Duplicated Book Entries 2018-04-20 14:05:02 +02:00
Nedelosk 934ffde12a Merge remote-tracking branch 'origin/mc-1.12' into dev 2018-04-16 20:30:39 +02:00
Nedelosk 6c806c377a Fix #2087 Issue with guide book 2018-04-16 20:30:09 +02:00
temp1011 24c8add7fc Update README (#2080) 2018-04-14 16:42:08 -07:00
temp1011 8c39ad956e Optimise Worldgen Hives (#2063) 2018-04-14 16:41:25 -07:00
Nedelosk 36ccd5c3e1 Fix #2077 Crash from disabling the Arboriculture Module 2018-04-09 18:55:51 +02:00
Nedelosk d621d8a5df Add more methods to ModuleHelper 2018-04-06 16:14:13 +02:00
Nedelosk 76d77b4784 Clean Up Book 2018-04-06 15:57:39 +02:00
Nedelosk 6efbd6e158 Add missing Side Only Annotations Fix #2076 2018-04-06 00:45:53 +02:00
temp1011 aa45da81ba Fix extra drop from greenhouse window (#2072) 2018-04-05 21:22:48 +02:00
temp1011 3cd1c30dbc Update Forge and Mappings (#2075) 2018-04-05 21:21:48 +02:00
Nedelosk 8ba478d758 Add Guide Book and Analyzer Screen (#2073) 2018-04-05 21:20:16 +02:00
Nedelosk b5a8740e4a Merge pull request #2016 from temp1011/engine-output
Stop peat fired engine outputting ash through power side
2018-03-30 18:23:19 +02:00
Nedelosk 8f6b056776 Merge pull request #2051 from temp1011/remove-chisel-plugin
Remove Chisel Plugin
2018-03-30 18:22:24 +02:00
Nedelosk d72ba48a1a Merge pull request #2055 from temp1011/butterfly-gamerule
Make butterflies obey mob spawning gamerules
2018-03-30 18:21:50 +02:00
Nedelosk c0a3e2240f Merge pull request #2054 from temp1011/block-xp-drop
Use different method to drop xp from Apatite Ore
2018-03-30 18:21:39 +02:00
temp1011 46f78ce7b3 Make butterflies obey mob spawning gamerules 2018-03-24 02:13:28 +00:00
temp1011 b0bc8429ac Don't drop xp orbs into world directly 2018-03-24 01:52:15 +00:00
temp1011 9c44111665 Remove Chisel Plugin 2018-03-23 22:18:37 +00:00
mezz 54a9da917d Replace Forestry IRC link with discord badge 2018-03-17 23:51:56 -07:00
temp1011 bcafbcbc32 resolve conflict 2018-03-14 18:53:30 +00:00
Nedelosk 2ce018d84b Merge pull request #1998 from asiekierka/mc-1.12
minor ShapedRecipeCustom optimization
2018-03-14 17:06:35 +01:00
Nedelosk 0638822b74 Merge pull request #2006 from temp1011/self-breeding
Add self-pollination of leaves near bees
2018-03-14 17:06:24 +01:00
Nedelosk 2b8d905e0e Merge branch 'mc-1.12' into self-breeding 2018-03-14 17:06:16 +01:00
Nedelosk d0f28a32b2 Merge pull request #2012 from temp1011/repairable-armour
Make Apiarist Armour Repairable
2018-03-14 17:04:20 +01:00
Nedelosk b74e142ce1 Merge pull request #2025 from temp1011/flowerpot-flowers
Add potted plants as flowers for bees
2018-03-14 17:03:47 +01:00
Nedelosk 3d95b9f6d9 Merge pull request #2032 from temp1011/charcoal-block-oredict
Register Charcoal Block with Ore Dictionary
2018-03-14 17:03:00 +01:00
Nedelosk 571d158809 Merge remote-tracking branch 'origin/mc-1.12' into mc-1.12 2018-03-14 17:02:11 +01:00
Nedelosk 9cd6bfcfa8 Merge pull request #2033 from temp1011/fix-jei-errors
Fix JEI errors for disabled modules
2018-03-14 17:01:44 +01:00
Nedelosk ebc70ab22a Fix #2037 Add Comparator Support for Engines 2018-03-14 16:45:38 +01:00
Nedelosk e3e4a4341d Fix #2042 Another crash with butterflies 2018-03-14 15:35:49 +01:00
Nedelosk 918e4f0099 Fix #2040 Villager AI Crashes Server 2018-03-14 15:25:00 +01:00
temp1011 123bed88a2 Add AI for Apiarist to Replace Bees in Village Bee Houses (#2001) 2018-03-12 21:09:09 -07:00
temp1011 9de446cc4e Fix Broken Ore Dictionary Registration 2018-03-11 19:29:39 +00:00
temp1011 f328efa4e9 Fix JEI errors for disabled modules 2018-03-11 17:40:16 +00:00
temp1011 cdb5ddeb6a Register Charcoal Block with Ore Dictionary 2018-03-11 16:56:47 +00:00
temp1011 7f83c387e3 Remove test, use Enum instead of ordinal 2018-03-06 23:54:34 +00:00
temp1011 95c52f3607 Add potted plants as flowers for bees 2018-03-06 15:32:23 +00:00
temp1011 19a30bdb91 Stop peat fired engine outputting ash through power side 2018-03-01 15:52:00 +00:00
temp1011 1b262d6604 Improve logic 2018-02-28 19:33:09 +00:00
temp1011 ca73687940 Make Apiarist Armour Repairable 2018-02-26 22:39:57 +00:00
temp1011 ed2f06c514 formatting, re-include config 2018-02-26 21:44:12 +00:00
temp1011 bef36c15b0 Move self pollination into main pollination method
- Only happens if normal pollination can't occur
- Will not cause return otherwise would worsen chance for cross pollination
2018-02-26 21:39:19 +00:00
temp1011 7dba583c26 Add self-pollination of leaves near bees 2018-02-24 18:04:17 +00:00
Adrian Siekierka 3168639c89 minor ShapedRecipeCustom optimization 2018-02-19 11:59:44 +01:00
Nedelosk e9019fd8c3 Fix #1997 Actually Additions Integration 2018-02-18 09:58:55 +01:00
Nedelosk d43cc63367 Close #1859, Close #1858 Add Natura huge glowshrooms farm support 2018-02-17 15:54:49 +01:00
Nedelosk 89e8ec8e38 Update Lang 2018-02-17 14:27:23 +01:00
Nedelosk f270231e67 Fix "X-Ray" Leaves and wrong leaf particle color 2018-02-17 14:25:11 +01:00
Nedelosk 34be92d462 Fix #1959 Forestry leaves causing server crash 2018-02-16 18:56:25 +01:00
Nedelosk eea193aa83 Fix #1962 Wood Pile fire spread might be a bit too aggressive 2018-02-16 18:51:33 +01:00
Nedelosk d6a5827f0b Fix #1974 Add Support for Animania wool types in recipes 2018-02-16 18:46:13 +01:00
Nedelosk a093e7c094 Fix #1982 Wrong drop Greenhouse Window 2018-02-16 18:34:17 +01:00
Nedelosk 4ea0795063 Fix #1975 Farm blocks change type on world reload 2018-02-16 18:01:31 +01:00
Nedelosk 31b83ea852 Fix #1963 Forestry leaves confuse minimap mods 2018-02-16 17:55:40 +01:00
Nedelosk 0f494d4ac7 Merge remote-tracking branch 'origin/mc-1.12' into mc-1.12 2018-02-16 17:12:27 +01:00
Nedelosk 0cfddef397 Fix #1984 Server crash when placing an arboretum 2018-02-16 17:12:10 +01:00
Nedelosk e4478bc296 Merge pull request #1968 from temp1011/more-blacklisting
Add whitelist for generation based on dimension
2018-02-16 17:09:45 +01:00
Nedelosk 6a921c78fb Merge pull request #1986 from temp1011/modules-disable
Fix a disabled module crash
2018-02-16 17:09:28 +01:00
Nedelosk 5f9e0f30fd Merge remote-tracking branch 'origin/mc-1.12' into mc-1.12 2018-02-16 17:08:04 +01:00
Nedelosk 355ba9a7ed Fix #1993, Fix #1972 Managed Succulent Farm doesn't work and Farm multiblock causing chunks to be loaded 2018-02-16 17:07:40 +01:00
Nedelosk 424bc8910d Fix #1988 Arborist's Chests causing suffocation damage 2018-02-16 16:50:39 +01:00
Nedelosk 6eab284cd1 Fix #1989 "X-Ray" Leaves 2018-02-16 16:37:17 +01:00
temp1011 1745a7e946 More correct method 2018-02-11 11:52:59 +00:00
temp1011 74e381f184 formatting 2018-02-11 11:24:07 +00:00
temp1011 0b2589b007 Fix crash if HarvestCraft present but Apiculture disabled 2018-02-11 11:22:35 +00:00
Nedelosk d29187746d Merge pull request #1980 from temp1011/gear-fix
Oredict for bronze gear in sorting pipe recipe
2018-02-10 13:11:35 +01:00
temp1011 26d538cb50 Add oredict for bronze gear in sorting pipe recipe 2018-02-08 11:19:34 +00:00
Nedelosk d48fca4652 Fix #1969 Multiblock farms server-crash 2018-02-03 23:17:38 +01:00
temp1011 211ab566a7 Fix return statement 2018-02-03 18:32:24 +00:00
temp1011 bb7a42dff5 Woops 2018-02-03 18:21:31 +00:00
temp1011 31bcc661cd Added whitelist for dimension generation too 2018-02-03 18:13:53 +00:00
temp1011 43a29e7ec8 Merge branch 'mc-1.12' of https://github.com/temp1011/ForestryMC into mc-1.12 2018-02-03 11:57:09 +00:00
temp1011 13905ee4a9 merge (#1)
* Reintroduce the old-style farm

* Remove Unused Files

* Fix #1945 Database duping trees / bees

* Fix broken model baker uvs

* Improve Farm Logic System and add ring farm layout

* Rebalance electron tubes and add ender farm

* Improve fertilizer config and Clean Up

* Clean Up API

* Add missing farm logic localisation

* Add missing fluid handler capability to the planter

* Remove unneeded GL state changes

* Update Lang

* Fix #1955 Add Filter Sorting to fix a server sided bug

* Make cultivation farms more expensive

* Round fertilizer values

* Add deprecated circuit replacement and Version 5.8
2018-02-03 11:55:03 +00:00
Nedelosk 2b9b105211 Add deprecated circuit replacement and Version 5.8 2018-02-03 12:45:27 +01:00
Nedelosk 8b10349309 Merge pull request #1948 from ForestryMC/farm
Reintroduce the old-style farm and Rebalance electron tubes
2018-02-03 12:10:48 +01:00
Nedelosk 0d26b6b2f2 Merge pull request #1965 from temp1011/mc-1.12
Add IMC messages for dimension blacklist
2018-02-03 12:08:05 +01:00
temp1011 3e5de52efd fix imports 2018-02-02 00:18:41 +00:00
temp1011 e30e9f4ab9 Add IMC messages for mods to blacklist dimensions in 2018-02-02 00:07:59 +00:00
Nedelosk 05d1eb87ce Round fertilizer values 2018-01-28 22:54:35 +01:00
Nedelosk 7679dfc393 Make cultivation farms more expensive 2018-01-28 18:38:29 +01:00
Nedelosk bb52acc67c Fix #1955 Add Filter Sorting to fix a server sided bug 2018-01-23 16:24:56 +01:00
Nedelosk 3caf8cbfef Update Lang 2018-01-23 15:36:38 +01:00
Nedelosk 207f15ed0b Remove unneeded GL state changes 2018-01-23 15:29:30 +01:00
Nedelosk c5178be225 Add missing fluid handler capability to the planter 2018-01-22 19:54:14 +01:00
Nedelosk cd7250604e Add missing farm logic localisation 2018-01-22 18:56:25 +01:00
Nedelosk 533c9d0b2a Clean Up API 2018-01-20 21:29:07 +01:00
Nedelosk c00fa15f0e Improve fertilizer config and Clean Up 2018-01-20 21:00:21 +01:00
Nedelosk ce3dea42e3 Pull from branch 'mc-1.12' 2018-01-20 19:28:34 +01:00
Nedelosk 287cb8cb87 Rebalance electron tubes and add ender farm 2018-01-20 18:05:31 +01:00
Nedelosk 10fec50457 Improve Farm Logic System and add ring farm layout 2018-01-20 02:35:33 +01:00
Nedelosk 43c61c18c0 Fix broken model baker uvs 2018-01-15 19:23:54 +01:00
Nedelosk dca593f7d8 Fix #1945 Database duping trees / bees 2018-01-15 19:18:59 +01:00
Nedelosk 4c874fcf7d Update Lang 2018-01-15 19:12:54 +01:00
Nedelosk e62a2f1199 Merge branch 'mc-1.12' of https://github.com/ForestryMC/ForestryMC into pipe-1.12 2018-01-15 19:05:11 +01:00
Nedelosk 8ab94e6741 Improve genetic filter implementation 2018-01-15 19:03:52 +01:00
Nedelosk 1278c09064 Move the filter logic to a separate interface 2018-01-15 19:03:51 +01:00
Nedelosk ed0b884bce Change default filter rule 2018-01-15 19:03:50 +01:00
Nedelosk 85f413f857 Improve Filter collision box 2018-01-15 19:03:49 +01:00
Nedelosk 3cc298b0f1 Remove unused texture 2018-01-15 19:03:49 +01:00
Nedelosk 8b0d54f3ec Add sorting block (Genetic Filter) 2018-01-15 19:03:48 +01:00
temp1011 40445462f1 Add more Dimension Config Blacklists for world generation (#1942) 2018-01-14 12:16:36 -08:00
temp1011 8eea336fdb Removing overworked bees mechanic, cap production modifier at 16x (#1946) 2018-01-14 12:15:45 -08:00
Nedelosk 521514f3d2 Remove Unused Files 2018-01-14 02:53:56 +01:00
Nedelosk cc50a05f43 Reintroduce the old-style farm 2018-01-14 02:35:12 +01:00
Nedelosk 1fc56c3b20 Merge pull request #1941 from phillipasmith1995/mc-1.12
Adds dimension blacklist for hive generation.
2018-01-08 17:17:18 +01:00
phillipasmith1995 9cee882788 Adds dimension blacklist for hive generation. 2018-01-08 09:24:17 -06:00
phillipasmith1995 9404f769bb Merge branch 'mc-1.12' of https://github.com/phillipasmith1995/ForestryMC into mc-1.12
# Conflicts:
#	src/main/java/forestry/apiculture/HiveConfig.java
2018-01-08 09:21:51 -06:00
phillipasmith1995 7b8b317ffe Adds dimension blacklist for hive generation. 2018-01-08 09:18:49 -06:00
phillipasmith1995 b40a6d4ec9 Adds dimension blacklist for hive generation. 2018-01-08 00:52:34 -06:00
Nedelosk 42865951a9 Move the worktable into a separate module 2018-01-07 02:18:11 +01:00
Nedelosk a058c3f8c9 Merge remote-tracking branch 'origin/mc-1.12' into 1.12 2018-01-07 00:21:00 +01:00
Nedelosk a83e428d29 Merge pull request #1938 from temp1011/analyzerpowerconfig
Add power config for Analyzer
2018-01-07 00:20:37 +01:00
temp1011 9c41566485 Should be all of them (hopefully) 2018-01-06 23:18:34 +00:00
temp1011 842b9c7199 Add power config for analyzer 2018-01-06 22:51:36 +00:00
Nedelosk cbb0c15783 Fix #1061 Squeezer is very "liberal" regarding oredict in Recipes 2018-01-06 23:23:46 +01:00
Nedelosk cbc6f9acff Update Lang Git-Module 2018-01-06 22:39:08 +01:00
Nedelosk 03ecce51cc Fix #1937 Backpacks do not hold previously defined items 2018-01-06 22:33:29 +01:00
Nedelosk 644145ac92 Fix #1399 Add Hive Generation Blacklist 2018-01-06 22:19:37 +01:00
Nedelosk 850a7e2919 Fix #1884 Tin can / wax capsule cannot pick up fluid blocks in world 2018-01-06 20:56:15 +01:00
Nedelosk 1f54359836 Fix Crate Registration 2018-01-06 17:14:08 +01:00
Nedelosk debde28aba Merge remote-tracking branch 'origin/mc-1.12' into 1.12 2018-01-06 16:51:38 +01:00
Nedelosk a2aa07c917 Fix #1916 Client Crash with new version 2018-01-06 16:51:13 +01:00
Nedelosk 3c9572eb83 Fix #1874 Crash when adding bee to BQM quest / chestloot 2018-01-06 16:21:47 +01:00
Nedelosk 03fd954781 Merge pull request #1930 from temp1011/mc-1.12
Some minor additions
2018-01-06 16:07:20 +01:00
Nedelosk 2002dff3c9 Fix #1920 Crate registration only on client side 2018-01-06 15:57:16 +01:00
temp1011 d9ade6dae0 No biome check 2018-01-06 14:34:20 +00:00
Nedelosk 3b547c1b87 Fix #1919 Butterfly Model throws NullPointerException 2018-01-06 14:39:43 +01:00
Nedelosk 05070982dc Improve Database Recipe 2018-01-06 13:20:35 +01:00
temp1011 9833dbb01f Merge branch 'mc-1.12' into mc-1.12 2018-01-05 18:10:22 +00:00
temp1011 e67ef8adec Merge branch 'mc-1.12' into mc-1.12 2018-01-05 16:56:54 +00:00
temp1011 b5b4ff2de6 Fix hive flammability
Hive placed in the overworld burned whereas hive placed in nether did not in my tests. Hopefully this works better.
2018-01-05 16:13:40 +00:00
Nedelosk f78e21e31a Merge remote-tracking branch 'origin/mc-1.12' into 1.12 2018-01-05 16:42:56 +01:00
Nedelosk 457962c716 Fix #1932 Client Tile Updates Depending On Apiculture Module 2018-01-05 16:36:00 +01:00
temp1011 7a0dde1140 Woops 2018-01-02 20:36:16 +00:00
temp1011 5f7f7fbed6 add damage option to hives based on config 2017-12-30 23:24:45 +00:00
temp1011 c107c75cbe update config in apiculture 2017-12-30 23:22:19 +00:00
temp1011 8ed4fa8d7b make non hellish hives flammable 2017-12-30 00:09:41 +00:00
mezz 5a10d8a0b2 Fix "Invalid property value detected" error logs from Buildcraft 2017-12-26 19:30:14 -08:00
Nedelosk 16c3fae45d Fix #1918 Fix #1912 packet handler issue with latest Forge (14.23.1.2574+) 2017-12-18 20:25:21 +01:00
Nedelosk b3be6a8f02 Fix Broken Sockets 2017-12-17 16:07:12 +01:00
Nedelosk aac4d730d6 Merge remote-tracking branch 'origin/mc-1.12' into 1.12 2017-12-17 15:45:32 +01:00
Nedelosk dacd2741a3 Fix #1907 Electric engine doesn't update configuration properly 2017-12-17 15:41:01 +01:00
Nedelosk 2f47114015 Fix #1901 Custom Backpack Model Registration 2017-12-17 15:26:43 +01:00
Nedelosk b7ae349314 Fix #1906 Willow leaves can be used to create an x-ray 2017-12-17 10:38:20 +01:00
Remy A fbea338462 Fix resurrected ender dragons having no AI (#1908) 2017-12-12 21:48:56 -08:00
mezz b07e5a1556 Revert "Slightly improve render performance of genetic items (bee, trees, etc)"
This reverts commit 3df3d9121e.
2017-11-29 22:00:21 -08:00
Nedelosk 13f49fc930 Merge remote-tracking branch 'origin/mc-1.12' into 1.12 2017-11-24 00:04:05 +01:00
Nedelosk 3c4b025c74 Fix #1893 False Module Container ID 2017-11-24 00:03:41 +01:00
mezz 3df3d9121e Slightly improve render performance of genetic items (bee, trees, etc) 2017-11-11 22:04:39 -08:00
mezz 58ab49d66e Stop viscous fluids from making water flowing sounds 2017-11-11 20:51:27 -08:00
Nedelosk 37893d8aca Fix #1890 NPE with Quark 2017-11-08 20:33:59 +01:00
Nedelosk 9814601ff2 Fix backward compatibility 2017-11-03 23:10:10 +01:00
Nedelosk 11e8a06a48 Clean Up Module System 2017-11-03 22:38:13 +01:00
Nedelosk 26f44a2862 Fix Module System 2017-11-03 21:34:21 +01:00
Nedelosk 3073473b0e Fix Api 2017-11-03 19:55:25 +01:00
Nedelosk 61af8ba6c9 Improve Module System 2017-11-03 18:40:44 +01:00
Nedelosk 3e60c43b30 Merge remote-tracking branch 'origin/mc-1.12' into mc-1.12 2017-11-03 17:01:50 +01:00
Nedelosk e9ae149ba2 Fix GreenhouseEventHandler 2017-11-03 16:58:31 +01:00
Nedelosk b62ec72422 Change the plugin system to a module system and split up modules
-Changed plugin system to a module
-Renamed forestry plugins to modules
-Mod integration plugins are still called plugins
-Moved the woodpile from the arboriculture module to the charcoal module
-Moved the backpacks from the storage module to the backpacks module
-Moved the crates from the storage module to the creates module
-Added the database module with a new storage block for individuals
-Added a species plugin interface to handle the database gui
-Added some alyzer methods to the species plugin to move the alyzer
integration later to it
2017-11-03 16:56:02 +01:00
Nedelosk 50ef3d8b2c Update Lang 2017-11-03 16:46:09 +01:00
Nedelosk a0e15f76ca Move some classes to the api and fix broken api classes 2017-11-03 16:09:17 +01:00
Nedelosk e7766d3ad9 Remove experimental code 2017-11-02 16:12:06 +01:00
Nedelosk 4e096e7338 Remove unused resources 2017-11-02 16:06:17 +01:00
Nedelosk 88fd031fb4 Change the plugin system to a module system and slit up modules
-Moved the woodpile from the arboriculture module to the charcoal module
-Moved the backpacks from the storage module to the backpacks module
-Moved the crates from the storage module to the creates module
-Added the database module with a new storage for individuals
-Added a gui element system to improve the alyzer api
-Added a species plugin interface to handle the database gui
-Added some alyzer methods to the species plugin to move the alyzer
integration later to it
2017-11-02 16:03:33 +01:00
Nedelosk ee272de168 Fix #1866 Block State Interaction Issues With Pokecube and Forestry 2017-10-12 11:55:06 +02:00
Nedelosk 1faaa6e297 Merge remote-tracking branch 'origin/mc-1.12' into mc-1.12 2017-10-07 14:44:34 +02:00
Nedelosk 6c86447891 Fix Mystical Agriculture Inferium Seeds and update Integration 2017-10-07 14:41:13 +02:00
Nedelosk 905e81c2b9 Fix #1860 Mystical Agriculture Integration (Could not find item) 2017-10-07 14:25:20 +02:00
Nedelosk 25bb682f7d Fix #1856 Non Glass Fluids in Thermionic Fabricator are not getting used up. 2017-10-07 14:15:38 +02:00
Nedelosk 18e10f617c Fix #1863 Bottler does not empty bottles 2017-10-07 14:08:30 +02:00
mezz e0a0ab5594 Add modId to alleles and use new Forge item.getCreatorModId feature 2017-10-03 00:03:46 -07:00
Nedelosk 29d96db1e8 Merge remote-tracking branch 'origin/mc-1.12' into mc-1.12 2017-09-30 16:16:12 +02:00
Nedelosk 3769ec42d2 Fix #1857 Couldn't find resource table forestry:chests/village_naturalist 2017-09-30 16:15:52 +02:00
mezz d0c1133304 Update for 1.12.2 2017-09-18 20:33:56 -07:00
Nedelosk c3ff59fbfb Remove expensive check 2017-09-18 15:26:03 +02:00
Nedelosk aa52b063b7 Fix two Greenhouse Crashes 2017-09-18 15:08:58 +02:00
Nedelosk a74b3c87c4 Fix #1854 Crash on load if the greenhouse plugin is disabled 2017-09-18 13:50:07 +02:00
Nedelosk 6c38a6a28e Fix Greenhouse Climatisers 2017-09-15 13:50:38 +02:00
Nedelosk db49d305f4 Add PreInit Event to the Api 2017-09-10 16:14:32 +02:00
1135 changed files with 53935 additions and 6696 deletions

No files matched your search

-1
View File
@@ -9,7 +9,6 @@
# files
!/.gitignore
!/.gitmodules
!/CLA.txt
!/CONTRIBUTING.md
!/LICENSE.txt
-3
View File
@@ -1,3 +0,0 @@
[submodule "lang"]
path = lang
url = https://github.com/ForestryMC/Forestry-Localization.git
+9 -4
View File
@@ -9,9 +9,9 @@ Forestry is a modification for the game Minecraft and known primarily for its fa
[Wiki](http://forestry.sengir.net/)
[Latest Builds for 1.11 / 1.11.2](http://jenkins.ic2.player.to/job/Forestry_1.11/)
[Latest Builds for 1.11.2/1.12](http://jenkins.ic2.player.to/job/Forestry_1.11/)
[IRC #forestry on esper.net](http://webchat.esper.net/?nick=ForestryGithub...&channels=forestry&prompt=1)
[![Discord](https://img.shields.io/discord/417745379258400778.svg?colorB=7289DA&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHYAAABWAgMAAABnZYq0AAAACVBMVEUAAB38%2FPz%2F%2F%2F%2Bm8P%2F9AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfhBxwQJhxy2iqrAAABoElEQVRIx7WWzdGEIAyGgcMeKMESrMJ6rILZCiiBg4eYKr%2Fd1ZAfgXFm98sJfAyGNwno3G9sLucgYGpQ4OGVRxQTREMDZjF7ILSWjoiHo1n%2BE03Aw8p7CNY5IhkYd%2F%2F6MtO3f8BNhR1QWnarCH4tr6myl0cWgUVNcfMcXACP1hKrGMt8wcAyxide7Ymcgqale7hN6846uJCkQxw6GG7h2MH4Czz3cLqD1zHu0VOXMfZjHLoYvsdd0Q7ZvsOkafJ1P4QXxrWFd14wMc60h8JKCbyQvImzlFjyGoZTKzohwWR2UzSONHhYXBQOaKKsySsahwGGDnb%2FiYPJw22sCqzirSULYy1qtHhXGbtgrM0oagBV4XiTJok3GoLoDNH8ooTmBm7ZMsbpFzi2bgPGoXWXME6XT%2BRJ4GLddxJ4PpQy7tmfoU2HPN6cKg%2BledKHBKlF8oNSt5w5g5o8eXhu1IOlpl5kGerDxIVT%2BztzKepulD8utXqpChamkzzuo7xYGk%2FkpSYuviLXun5bzdRf0Krejzqyz7Z3p0I1v2d6HmA07dofmS48njAiuMgAAAAASUVORK5CYII%3D)](https://discord.gg/49XNRJk)
For those interested in developement, you can also visit #forestry-dev.
@@ -21,9 +21,14 @@ The localization files reside in their own repository. It is pulled in automatic
You may want to adjust the "./gradle.properties" file to set your mc account as needed.
To setup, open a command line and run "gradlew setupDecompWorkspace" and "gradlew eclipse".
To setup, open a command line and run "gradlew setupDecompWorkspace". Then run the following depending on your IDE:
To package, open a command line and type "gradlew release".
Eclipse: "gradlew eclipse"
IntelliJ IDEA: "gradlew idea genIntellijRuns"
To package, open a command line and type "gradlew build".
For mod authors: the Forestry maven is located at http://maven.ic2.player.to/net/sengir/forestry/
### Notes
+18 -19
View File
@@ -21,11 +21,10 @@ version = version_major + '.' + version_minor + '.' + version_patch + '.' + getB
if (project.hasProperty('buildQualifier')) {
version = project.version + '-' + project.buildQualifier
}
group= "net.sengir.forestry" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
group = "net.sengir.forestry" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "forestry_" + mcversion
ext.dirDest = './build/dist'
ext.dirLang = "./lang"
// java version
sourceCompatibility = JavaVersion.VERSION_1_8
@@ -40,17 +39,9 @@ minecraft {
replace '@BUILD_NUMBER@', getBuildNumber()
}
sourceSets {
main {
resources {
srcDir project.dirLang
}
}
}
repositories {
maven {
url 'http://maven.epoxide.xyz'
url = 'http://maven.mcmoddev.com'
}
maven {
url "http://dvs1.progwml6.com/files/maven"
@@ -59,13 +50,22 @@ repositories {
name = "ic2"
url = "http://maven.ic2.player.to/"
}
maven {
name = "Modmuss50"
url = "http://maven.modmuss50.me"
}
maven {
url = 'https://mod-buildcraft.com/maven'
}
}
dependencies {
deobfCompile "net.darkhax.tesla:Tesla-${tesla_mcversion}:${tesla_version}"
deobfCompile "mezz.jei:jei_${jei_mcversion}:${jei_version}:api"
runtime "mezz.jei:jei_${jei_mcversion}:${jei_version}"
deobfCompile "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
deobfProvided "net.darkhax.tesla:Tesla-${tesla_mcversion}:${tesla_version}"
deobfProvided "mezz.jei:jei_${jei_mcversion}:${jei_version}:api"
runtimeOnly "mezz.jei:jei_${jei_mcversion}:${jei_version}"
deobfProvided "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
deobfProvided "TechReborn:TechReborn-${TR_mcversion}:${TR_version}:api"
deobfProvided "com.mod-buildcraft:buildcraft-api:${buildcraft_version}"
}
configurations {
@@ -84,7 +84,7 @@ processResources {
include 'mcmod.info'
// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version
expand 'version': project.version, 'mcversion': project.minecraft.version
}
// copy everything else, thats not the mcmod.info
@@ -134,7 +134,7 @@ uploadArchives {
repositories {
if (project.hasProperty('mavenDir')) {
mavenDeployer {
repository(url: "file://"+mavenDir)
repository(url: "file://" + mavenDir)
}
} else {
println 'Archives upload disabled, mavenDir in gradle.properties is missing.'
@@ -150,7 +150,7 @@ task makeChangelog(type: se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask) {
filePath = "changelog.html"
untaggedName = "Current release ${project.version}"
fromCommit = "5a3850c2642e535656d090d1473054d5fa8d3331"
toRef = "HEAD"
toRef = "HEAD"
templateContent = file('changelog.mustache').getText('UTF-8')
}
@@ -161,7 +161,6 @@ curseforge {
changelog = file('changelog.html')
changelogType = 'html'
releaseType = 'beta'
addGameVersion '1.12'
}
}
Executable → Regular
+11 -9
View File
@@ -1,14 +1,16 @@
mcversion=1.12.1
forgeversion=14.22.0.2474
mcp_mappings=snapshot_20170904
mcversion=1.12.2
forgeversion=14.23.4.2705
mcp_mappings=snapshot_20171003
curse_project_id=59751
tesla_version=1.0.60
tesla_mcversion=1.12
jei_version=4.7.8.92
jei_mcversion=1.12.1
ic2_version=2.8.24-ex112
jei_version=4.10.0.200
jei_mcversion=1.12.2
ic2_version=2.8.90-ex112
TR_mcversion=1.12.2
TR_version=2.13.2.561
buildcraft_version=7.99.17
version_major=5
version_minor=5
version_patch=5
version_minor=8
version_patch=1
Submodule lang deleted from c3244f4499.
+43 -18
View File
@@ -15,8 +15,16 @@ import com.google.common.base.Preconditions;
import javax.annotation.Nullable;
import java.io.File;
import forestry.plugins.ForestryCompatPlugins;
import forestry.plugins.PluginBuildCraftFuels;
import forestry.plugins.PluginIC2;
import forestry.plugins.PluginNatura;
import forestry.plugins.PluginTechReborn;
import net.minecraft.item.Item;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.common.Mod;
@@ -27,12 +35,15 @@ import net.minecraftforge.fml.common.event.FMLInterModComms.IMCEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.registry.GameRegistry;
import forestry.api.core.ForestryAPI;
import forestry.api.core.ForestryEvent;
import forestry.core.EventHandlerCore;
import forestry.core.advancements.AdvancementManager;
import forestry.core.climate.ClimateStates;
import forestry.core.config.Config;
import forestry.core.config.Constants;
@@ -43,10 +54,10 @@ import forestry.core.gui.GuiHandler;
import forestry.core.multiblock.MultiblockEventHandler;
import forestry.core.network.PacketHandler;
import forestry.core.proxy.Proxies;
import forestry.core.utils.MigrationHelper;
import forestry.core.worldgen.WorldGenerator;
import forestry.plugins.PluginManager;
import forestry.plugins.compat.PluginIC2;
import forestry.plugins.compat.PluginNatura;
import forestry.modules.ForestryModules;
import forestry.modules.ModuleManager;
/**
* Forestry Minecraft Mod
@@ -58,12 +69,14 @@ import forestry.plugins.compat.PluginNatura;
name = Constants.MOD_NAME,
version = Constants.VERSION,
guiFactory = "forestry.core.config.ForestryGuiConfigFactory",
acceptedMinecraftVersions = "[1.12, 1.12.1]",
dependencies = "required-after:forge@[14.21.1.2395,);"
acceptedMinecraftVersions = "[1.12.2,1.13.0)",
dependencies = "required-after:forge@[14.23.4.2705,);"
+ "after:jei@[4.7.8.91,);"
+ "after:" + PluginIC2.modId + ";"
+ "after:" + PluginNatura.modId + ";"
+ "after:toughasnails;")
+ "after:" + PluginIC2.MOD_ID + ";"
+ "after:" + PluginNatura.MOD_ID + ";"
+ "after:toughasnails;"
+ "after:" + PluginTechReborn.MOD_ID + ";"
+ "after:" + PluginBuildCraftFuels.MOD_ID + ";")
public class Forestry {
@SuppressWarnings("NullableProblems")
@@ -80,13 +93,16 @@ public class Forestry {
EnumErrorCode.init();
FluidRegistry.enableUniversalBucket();
MinecraftForge.EVENT_BUS.register(this);
ModuleManager moduleManager = ModuleManager.getInstance();
ForestryAPI.moduleManager = moduleManager;
moduleManager.registerContainers(new ForestryModules(), new ForestryCompatPlugins());
}
@Nullable
private static PacketHandler packetHandler;
public static PacketHandler getPacketHandler() {
Preconditions.checkState(packetHandler != null);
Preconditions.checkNotNull(packetHandler);
return packetHandler;
}
@@ -104,19 +120,27 @@ public class Forestry {
configFolder = new File(event.getModConfigurationDirectory(), Constants.MOD_ID);
Config.load(event.getSide());
PluginManager.runSetup(event);
MinecraftForge.EVENT_BUS.post(new ForestryEvent.PreInit(this, event));
ModuleManager.runSetup(event);
ModuleManager.getInternalHandler().runSetup();
String gameMode = Config.gameMode;
Preconditions.checkState(gameMode != null);
Preconditions.checkNotNull(gameMode);
ForestryAPI.activeMode = new GameMode(gameMode);
PluginManager.runPreInit(event.getSide());
MigrationHelper.registerFixable();
ModuleManager.getInternalHandler().runPreInit(event.getSide());
}
@SubscribeEvent(priority = EventPriority.LOWEST)
public void registerItems(RegistryEvent.Register<Item> event) {
ModuleManager.getInternalHandler().runRegisterBackpacksAndCrates();
}
@SubscribeEvent
public void registerModels(ModelRegistryEvent event) {
PluginManager.runRegisterBackpacksAndCrates();
Proxies.render.registerModels();
}
@@ -125,14 +149,15 @@ public class Forestry {
// Register gui handler
NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());
PluginManager.runInit();
ModuleManager.getInternalHandler().runInit();
Proxies.render.registerItemAndBlockColors();
AdvancementManager.registerTriggers();
}
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
PluginManager.runPostInit();
ModuleManager.getInternalHandler().runPostInit();
// Register world generator
WorldGenerator worldGenerator = new WorldGenerator();
@@ -142,12 +167,12 @@ public class Forestry {
Proxies.common.registerTickHandlers(worldGenerator);
// Handle IMC messages.
PluginManager.processIMCMessages(FMLInterModComms.fetchRuntimeMessages(ForestryAPI.instance));
ModuleManager.getInternalHandler().processIMCMessages(FMLInterModComms.fetchRuntimeMessages(ForestryAPI.instance));
}
@EventHandler
public void serverStarting(FMLServerStartingEvent event) {
PluginManager.serverStarting(event.getServer());
ModuleManager.serverStarting(event.getServer());
}
@Nullable
@@ -157,6 +182,6 @@ public class Forestry {
@EventHandler
public void processIMCMessages(IMCEvent event) {
PluginManager.processIMCMessages(event.getMessages());
ModuleManager.getInternalHandler().processIMCMessages(event.getMessages());
}
}
@@ -5,6 +5,7 @@
******************************************************************************/
package forestry.api.apiculture;
import javax.annotation.Nullable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -34,26 +35,41 @@ public class BeeManager {
/**
* Convenient access to AlleleManager.alleleRegistry.getSpeciesRoot("rootBees")
*
* @implNote Only null if the "apiculture" module is not enabled.
*/
@Nullable
public static IBeeRoot beeRoot;
/**
* Used to create new bees.
*
* @implNote Only null if the "apiculture" module is not enabled.
*/
@Nullable
public static IBeeFactory beeFactory;
/**
* Used to create new bee mutations.
*
* @implNote Only null if the "apiculture" module is not enabled.
*/
@Nullable
public static IBeeMutationFactory beeMutationFactory;
/**
* Used to get Forestry's jubilance implementations.
*
* @implNote Only null if the "apiculture" module is not enabled.
*/
@Nullable
public static IJubilanceFactory jubilanceFactory;
/**
* Used to check whether a player is wearing Apiarist Armor.
*
* @implNote Only null if the "apiculture" module is not enabled.
*/
@Nullable
public static IArmorApiaristHelper armorApiaristHelper;
}
@@ -14,6 +14,7 @@ public interface IBeeFactory {
* Automatically registered with AlleleManager.alleleRegistry.registerAllele()
* See IAlleleBeeSpeciesBuilder and IAlleleSpeciesBuilder for adding additional properties to the returned species.
*
* @param modId The modId of the mod that is creating the species
* @param uid Unique Identifier for this species
* @param dominant Whether this species is genetically dominant (false means it is recessive)
* @param authority Authority for the binomial name, e.g. "Sengir" on species of base Forestry.
@@ -24,8 +25,9 @@ public interface IBeeFactory {
* @param primaryColor The outline color of this species
* @param secondaryColor The body color of this species
* @return a new bee species allele.
* @since Forestry 5.6.0.
*/
IAlleleBeeSpeciesBuilder createSpecies(String uid, boolean dominant, String authority, String unlocalizedName, String unlocalizedDescription, IClassification branch, String binomial, int primaryColor, int secondaryColor);
IAlleleBeeSpeciesBuilder createSpecies(String modId, String uid, boolean dominant, String authority, String unlocalizedName, String unlocalizedDescription, IClassification branch, String binomial, int primaryColor, int secondaryColor);
/**
* Creates a new bee branch.
@@ -36,4 +38,10 @@ public interface IBeeFactory {
* @return a new bee branch
*/
IClassification createBranch(String uid, String scientific);
/**
* @deprecated since Forestry 5.6.0. use {@link #createSpecies(String, String, boolean, String, String, String, IClassification, String, int, int)}
*/
@Deprecated
IAlleleBeeSpeciesBuilder createSpecies(String uid, boolean dominant, String authority, String unlocalizedName, String unlocalizedDescription, IClassification branch, String binomial, int primaryColor, int secondaryColor);
}
@@ -37,10 +37,15 @@ public interface IBeekeepingMode {
*/
boolean isFatigued(IBee queen, IBeeHousing housing);
/**
* @return true if the queen is being overworked in the bee housing (with chance). will trigger a negative effect.
/**
* @return true if the queen is being overworked in the bee housing (with chance). will trigger a negative effect.
* @deprecated bees max out at 16x productivity instead of being overworked.
* TODO remove this method in 1.13
*/
boolean isOverworked(IBee queen, IBeeHousing housing);
@Deprecated
default boolean isOverworked(IBee queen, IBeeHousing housing) {
return false;
}
/**
* @return true if the genetic structure of the queen is breaking down during spawning of the offspring (with chance). will trigger a negative effect.
@@ -8,9 +8,10 @@ package forestry.api.apiculture.hives;
import java.util.List;
import java.util.Locale;
import forestry.api.apiculture.IHiveDrop;
import net.minecraft.util.IStringSerializable;
import forestry.api.apiculture.IHiveDrop;
public interface IHiveRegistry {
/* Forestry Hive Names */
@@ -5,9 +5,10 @@
******************************************************************************/
package forestry.api.arboriculture;
import net.minecraft.util.text.translation.I18n;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IFruitFamily;
import forestry.core.utils.Translator;
public enum EnumFruitFamily implements IFruitFamily {
PRUNES("prunes", "Prunus domestica"),
@@ -37,12 +38,12 @@ public enum EnumFruitFamily implements IFruitFamily {
@Override
public String getName() {
return Translator.translateToLocal("for.family." + uid);
return I18n.translateToLocal("for.family." + uid);
}
@Override
public String getDescription() {
return Translator.translateToLocal("for.family." + uid + ".description");
return I18n.translateToLocal("for.family." + uid + ".description");
}
}
@@ -19,6 +19,4 @@ public interface IAlleleFruit extends IAlleleProperty<IAlleleFruit> {
@Nullable
String getModelName();
String getModID();
}
@@ -7,15 +7,18 @@ package forestry.api.arboriculture;
import java.util.Collection;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.common.EnumPlantType;
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;
import forestry.api.genetics.IFruitFamily;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraftforge.common.EnumPlantType;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public interface IAlleleTreeSpecies extends IAlleleSpecies, IAlleleProperty<IAlleleTreeSpecies> {
@@ -36,11 +39,6 @@ public interface IAlleleTreeSpecies extends IAlleleSpecies, IAlleleProperty<IAll
* @return Tree generator for this species.
*/
ITreeGenerator getGenerator();
/**
* @return The modid from the mod of the species.
*/
String getModID();
/**
* @return Float between 0 and 1 representing the rarity of the species, will affect spawn rate. If it's 0, it will not spawn.
@@ -0,0 +1,42 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.arboriculture;
import java.util.Collection;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
/**
* Provides functions that are related to the forestry charcoal pile.
*/
public interface ICharcoalManager {
/**
* Registers the given block as a valid block for the charcoal pile wall and adds the given charcoal amount to it.
* <p>
* This method unlike {@link #registerWall(IBlockState, int)} ignores the metadata of the actual block and
* only compares the world block with the given block.
*/
void registerWall(Block block, int amount);
/**
* Registers the given block as a valid block for the charcoal pile wall and adds the given charcoal amount to it.
* <p>
* This method unlike {@link #registerWall(Block, int)} compares the world state with the given state and not
* only the block.
*/
void registerWall(IBlockState blockState, int amount);
/**
* Registers your implementation of the {@link ICharcoalPileWall} interface.
*/
void registerWall(ICharcoalPileWall wall);
/**
* @return A collection with all registered charcoal pile walls.
*/
Collection<ICharcoalPileWall> getWalls();
}
@@ -14,7 +14,12 @@ public interface ICharcoalPileWall {
int getCharcoalAmount();
boolean matches(IBlockState state);
NonNullList<ItemStack> getDisplyItems();
@Deprecated
default NonNullList<ItemStack> getDisplyItems(){
return getDisplayItems();
}
NonNullList<ItemStack> getDisplayItems();
}
@@ -5,32 +5,12 @@
******************************************************************************/
package forestry.api.arboriculture;
import javax.annotation.Nullable;
import java.awt.Color;
import forestry.api.genetics.IClassification;
public interface ITreeFactory {
/**
* Creates a new tree species.
* Automatically registered with AlleleManager.alleleRegistry.registerAllele()
* See IAlleleTreeSpeciesBuilder and IAlleleSpeciesBuilder for adding additional properties to the returned species.
*
* @param uid Unique Identifier for this species
* @param unlocalizedName Unlocalized name for this species
* @param authority Authority for the binomial name, e.g. "Sengir" on species of base Forestry.
* @param unlocalizedDescription Unlocalized description for this species
* @param dominant Whether this species is genetically dominant (false means it is recessive)
* @param branch Classification of this species
* @param binomial Binomial name of the species sans genus. "humboldti" will have the bee species flavour name be "Apis humboldti". Feel free to use fun names or null.
* @param modID The modID from the mod of the species
* @param leafSpriteProvider The leaf sprite provider for this species
* @param germlingModelProvider The germling model provider for this species
* @param woodProvider The wood texture provider. It is used to get wood textures for the charcoal pile.
* @param generator The tree generator
* @return a new tree species allele.
*/
IAlleleTreeSpeciesBuilder createSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean dominant, IClassification branch, String binomial, String modID, ILeafSpriteProvider leafSpriteProvider, IGermlingModelProvider germlingModelProvider, IWoodProvider woodProvider, ITreeGenerator generator);
/**
* Creates a new tree species.
* Automatically registered with AlleleManager.alleleRegistry.registerAllele()
@@ -48,10 +28,18 @@ public interface ITreeFactory {
* @param germlingModelProvider The germling model provider for this species
* @param woodProvider The wood texture provider. It is used to get wood textures for the charcoal pile.
* @param generator The tree generator
* @param leafProvider The leaf provider
* @return a new tree species allele.
*/
IAlleleTreeSpeciesBuilder createSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean dominant, IClassification branch, String binomial, String modID, ILeafSpriteProvider leafSpriteProvider, IGermlingModelProvider germlingModelProvider, IWoodProvider woodProvider, ITreeGenerator generator, ILeafProvider leafProvider);
IAlleleTreeSpeciesBuilder createSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean dominant, IClassification branch, String binomial, String modID, ILeafSpriteProvider leafSpriteProvider, IGermlingModelProvider germlingModelProvider, IWoodProvider woodProvider, ITreeGenerator generator, @Nullable ILeafProvider leafProvider);
/**
* @deprecated since Forestry 5.6.0. use {@link #createSpecies(String, String, String, String, boolean, IClassification, String, String, ILeafSpriteProvider, IGermlingModelProvider, IWoodProvider, ITreeGenerator, ILeafProvider)}
*/
@Deprecated
IAlleleTreeSpeciesBuilder createSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean dominant, IClassification branch, String binomial, String modID, ILeafSpriteProvider leafSpriteProvider, IGermlingModelProvider germlingModelProvider, IWoodProvider woodProvider, ITreeGenerator generator);
/**
* Get one of the built-in Forestry leaf types. Default type is deciduous.
*/
@@ -5,9 +5,10 @@
******************************************************************************/
package forestry.api.arboriculture;
import forestry.api.genetics.IGenome;
import net.minecraft.item.ItemStack;
import forestry.api.genetics.IGenome;
public interface ITreeGenome extends IGenome {
@Override
@@ -37,6 +38,8 @@ public interface ITreeGenome extends IGenome {
int getGirth();
boolean getFireproof();
IAlleleLeafEffect getEffect();
/**
@@ -5,13 +5,15 @@
******************************************************************************/
package forestry.api.arboriculture;
import forestry.api.core.ITextureManager;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.core.ITextureManager;
public interface IWoodProvider {
@SideOnly(Side.CLIENT)
void registerSprites(Item item, ITextureManager manager);
@@ -29,11 +31,15 @@ public interface IWoodProvider {
/**
* The amount of charcoal dropped from a charcoal pile of this wood.
* @deprecated Will be removed in 1.13
*/
@Deprecated
int getCarbonization();
/**
* The chance that a pile has to drop a extra charcoal
* @deprecated Will be removed in 1.13
*/
@Deprecated
float getCharcoalChance(int numberOfCharcoal);
}
@@ -5,6 +5,7 @@
******************************************************************************/
package forestry.api.arboriculture;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
@@ -12,7 +13,10 @@ public class TreeManager {
/**
* Convenient access to AlleleManager.alleleRegistry.getSpeciesRoot("rootTrees")
*
* @implNote Only null if the "arboriculture" module is not enabled.
*/
@Nullable
public static ITreeRoot treeRoot;
/**
@@ -22,13 +26,31 @@ public class TreeManager {
/**
* Used to create new trees.
*
* @implNote Only null if the "arboriculture" module is not enabled.
*/
@Nullable
public static ITreeFactory treeFactory;
/**
* Used to create new tree mutations.
*
* @implNote Only null if the "arboriculture" module is not enabled.
*/
@Nullable
public static ITreeMutationFactory treeMutationFactory;
/**
* Can be used to add new charcoal pile walls.
*
* @implNote Only null if the "charcoal" module is not enabled.
*/
@Nullable
public static ICharcoalManager charcoalManager;
/**
* @deprecated Please use {@link ICharcoalManager#registerWall}.
*/
@Deprecated
public static List<ICharcoalPileWall> pileWalls = new ArrayList<>();
}
@@ -5,10 +5,11 @@
******************************************************************************/
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@API(apiVersion = "4.2.1", owner = "ForestryAPI|core", provides = "ForestryAPI|arboriculture")
@API(apiVersion = "4.3.0", owner = "ForestryAPI|core", provides = "ForestryAPI|arboriculture")
package forestry.api.arboriculture;
import javax.annotation.ParametersAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraftforge.fml.common.API;
import mcp.MethodsReturnNonnullByDefault;
@@ -0,0 +1,54 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.book;
import javax.annotation.Nullable;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.gui.IElementGroup;
import forestry.api.gui.IGuiElement;
import forestry.api.gui.IGuiElementFactory;
/**
* The deserialized content data of a book page. It creates a gui element at the moment the entry gets opened.
*/
@SideOnly(Side.CLIENT)
public abstract class BookContent<D> {
public String type;
/**
* A data object that was deserialized from the json object of this content.
* Can be everything from an image to a crafting recipe.
*/
@Nullable
public D data = null;
/**
* The class of the data field. Used for the deserialization. If the result of this method is null the data field
* will be null too.
*/
@Nullable
public abstract Class<? extends D> getDataClass();
/**
* Called after the deserialization.
*/
public void onDeserialization() {
}
/**
* Adds the content to the page by adding a {@link IGuiElement} or at the content to the previous element.
*
* @param page The gui element that represents a book page
* @param previous The content of the previous element.
* @param previousElement The element that was previously added to the page.
* @param pageHeight The max height of the current page.
* @return True if you added an element.
*/
public abstract boolean addElements(IElementGroup page, IGuiElementFactory factory, @Nullable BookContent previous, @Nullable IGuiElement previousElement, int pageHeight);
}
@@ -0,0 +1,14 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.book;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BookManager {
@SideOnly(Side.CLIENT)
public static IBookLoader loader;
}
@@ -0,0 +1,84 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.book;
import javax.annotation.Nullable;
import java.util.Collection;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public interface IBookCategory {
/**
* @return the {@link ItemStack} that represents this category at the front page.
*/
ItemStack getStack();
IBookCategory setStack(ItemStack stack);
/**
* Adds an custom entry to the category.
*/
IBookCategory addEntry(IBookEntry entry);
/**
* Adds an entry with the given name and the given icon to the category.
*
* @param name A unique name for this entry.
* @param stack The stack that will be displayed next to the entry title at the category page.
*/
IBookCategory addEntry(String name, ItemStack stack);
/**
* Creates a entry builder with the given name.
* <p>
* At the end of your creation you have to call {@link IBookEntryBuilder#addToCategory()} to add the entry to this
* category.
*
* @param name A unique name for this entry.
*/
IBookEntryBuilder createEntry(String name);
/**
* Creates a entry builder with the given name and the given icon.
* <p>
* At the end of your creation you have to call {@link IBookEntryBuilder#addToCategory()} to add the entry to this
* category.
*
* @param name A unique name for this entry.
* @param stack The stack that will be displayed next to the entry title at the category page.
*/
IBookEntryBuilder createEntry(String name, ItemStack stack);
/**
* @return a collection that contains all entries of this category.
*/
Collection<IBookEntry> getEntries();
/**
* @return the entry with the given unique name.
*/
@Nullable
IBookEntry getEntry(String name);
/**
* @return the localized name of this category.
*/
String getLocalizedName();
/**
* Currently unused
*/
String getTooltip();
/**
* @return the unique name of this category
*/
String getName();
}
@@ -0,0 +1,30 @@
package forestry.api.book;
import javax.annotation.Nullable;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.gui.IElementGroup;
import forestry.api.gui.IGuiElement;
import forestry.api.gui.IGuiElementFactory;
@SideOnly(Side.CLIENT)
public interface IBookContent {
/**
* Called after the deserialization.
*/
default void onDeserialization() {
}
/**
* Adds the content to the page by adding a {@link IGuiElement} or at the content to the previous element.
*
* @param page The gui element that represents a book page
* @param previous The content of the previous element.
* @param previousElement The element that was previously added to the page.
* @param pageHeight The max height of the current page.
* @return True if you added an element.
*/
boolean addElements(IElementGroup page, IGuiElementFactory factory, @Nullable BookContent previous, @Nullable IGuiElement previousElement, int pageHeight);
}
@@ -0,0 +1,60 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.book;
import javax.annotation.Nullable;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
/**
* A entry in the {@link IForesterBook}.
* <p>
* Forestry crates them with the help of json file, but you can add you own custom ones with
* {@link IBookCategory#addEntry(IBookEntry)}.
*/
@SideOnly(Side.CLIENT)
public interface IBookEntry {
/**
* @return The stack that is displayed before the entry name.
*/
ItemStack getStack();
/**
* @return A unique string identifier for this entry.
*/
String getName();
/**
* @return the object that creates the book pages at the moment the bock opens.
*/
IBookPageFactory getPageFactory();
/**
* All sub entries of this entry are reachable over the buttons on the left side of the book.
*/
IBookEntry[] getSubEntries();
/**
* The parent of the entry if this entry is a sub entry. Null if the entry is no sub entry.
*/
@Nullable
IBookEntry getParent();
/**
* @return the localized title of this entry.
*/
String getTitle();
/**
* @return the content that was deserialized from the json file of this entry.
*/
BookContent[][] getContent();
}
@@ -0,0 +1,66 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.book;
import javax.annotation.Nullable;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public interface IBookEntryBuilder {
/**
* Sets the content of the entry.
*/
IBookEntryBuilder setContent(BookContent[][] content);
/**
* Sets the localized name of entry.
*/
IBookEntryBuilder setTitle(String title);
IBookEntryBuilder setStack(ItemStack stack);
IBookEntryBuilder setLoader(IBookPageFactory loader);
/**
* Creates a sub entry.
* <p>
* Important: You not have to call {@link #addToCategory()} at the end of the creation of the sub entry
*
* @param name The unique name of the sub entry.
* @return The entry builder of the sub entry.
*/
default IBookEntryBuilder createSubEntry(String name) {
return createSubEntry(name, ItemStack.EMPTY);
}
/**
* Creates a sub entry.
* <p>
* Important: You not have to call {@link #addToCategory()} at the end of the creation of the sub entry
*
* @param name The unique name of the sub entry.
* @param stack The stack that represents the sub entry.
* @return The entry builder of the sub entry.
*/
IBookEntryBuilder createSubEntry(String name, ItemStack stack);
IBookEntry build(@Nullable IBookEntry parent);
/**
* Builds a entry with the current information.
*/
IBookEntry build();
/**
* Builds the entry and adds it to the category.
*/
IBookCategory addToCategory();
}
@@ -0,0 +1,39 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.book;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public interface IBookLoader {
/**
* Adds a content type.
*
* @param name The name of the content type.
* @param contentClass The class for the deserialization of the content.
*/
void registerContentType(String name, Class<? extends BookContent> contentClass);
void registerPageFactory(String name, IBookPageFactory factory);
IBookPageFactory getPageFactory(String name);
/**
* Loads the book if it was not loaded already or if it was invalidated. Otherwise it returns the last loaded
* instance.
*
* @return The current instance of the forestry guide book.
*/
IForesterBook loadBook();
/**
* Invalidates the current instance of the book.
* The next time {@link #loadBook()} gets called a new instance of the book will be loaded.
*/
void invalidateBook();
}
@@ -0,0 +1,31 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.book;
import java.util.Collection;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.gui.IGuiElement;
/**
* A factory that creates book pages for a book entry.
*/
@SideOnly(Side.CLIENT)
public interface IBookPageFactory {
/**
* Usually called at the moment the player opens the given entry.
* Creates a collection of gui elements that represent a page of the book.
*
* @param entry The opened book entry.
* @param leftPageHeight The height of a page on the left side of the book.
* @param rightPageHeight The height of a page on the right side of the book.
* @param pageWidth The width of a book page.
* @return A collection where every member represent a page of the book.
*/
Collection<IGuiElement> load(IBookEntry entry, int leftPageHeight, int rightPageHeight, int pageWidth);
}
@@ -0,0 +1,56 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.book;
import javax.annotation.Nullable;
import java.util.Collection;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
/**
* IForesterBook is the interface that the forestry guide book class implements.
* <p>
* You can get the current instance of the guide book from {@link IBookLoader#loadBook()}.
*/
@SideOnly(Side.CLIENT)
public interface IForesterBook {
/**
* Creates a category, add it to this book and returns it.
*
* @param name A unique identifier for the category.
* @return The created category.
*/
IBookCategory addCategory(String name);
/**
* @return The category with the given unique name.
*/
@Nullable
IBookCategory getCategory(String name);
/**
* @return All categories of this book.
*/
Collection<IBookCategory> getCategories();
/**
* @return A collection that contains all unique names of the categories
*/
Collection<String> getCategoryNames();
/**
* @return A collection that contains all entries of the category with the given name.
*/
Collection<IBookEntry> getEntries(String category);
/**
* @return the entry with the given unique name.
*/
@Nullable
IBookEntry getEntry(String name);
}
@@ -0,0 +1,15 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@API(apiVersion = "5.8.1", owner = "ForestryAPI|core", provides = "ForestryAPI|book")
package forestry.api.book;
import javax.annotation.ParametersAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraftforge.fml.common.API;
@@ -7,11 +7,17 @@ package forestry.api.circuits;
import java.util.List;
import net.minecraft.util.text.translation.I18n;
public interface ICircuit {
String getUID();
String getUnlocalizedName();
default String getLocalizedName(){
return I18n.translateToLocal(getUnlocalizedName());
}
boolean isCircuitable(Object tile);
void onInsertion(int slot, Object tile);
@@ -18,6 +18,8 @@ public interface ICircuitRegistry {
void registerCircuit(ICircuit circuit);
void registerDeprecatedCircuitReplacement(String deprecatedCircuit, ICircuit replacement);
@Nullable
ICircuit getCircuit(String uid);
@@ -6,7 +6,7 @@
package forestry.api.climate;
/**
* @deprecated Use IClimateState
* @deprecated TODO: Remove in 1.13, Use IClimateState
*/
@Deprecated
public interface IClimateInfo {
@@ -11,7 +11,7 @@ import net.minecraft.world.World;
public interface IClimateManager {
/**
* @deprecated Use {@link IClimateStates#create(float, float)}
* @deprecated Use {@link IClimateStates#create(float, float, ClimateStateType)}
*/
@Deprecated
IClimateInfo createInfo(float temperature, float humidity);
@@ -12,7 +12,7 @@ import forestry.api.core.INbtWritable;
/**
* A {@link IClimateState} is used to store and handle temperature and humidity.
*
* The values are oriented on the values of {@link Biome#getTemperature()} and {@link Biome#getRainfall()}.
* The values are oriented on the values of {@link Biome#getDefaultTemperature()} and {@link Biome#getRainfall()}.
*/
public interface IClimateState extends INbtWritable {
@@ -67,7 +67,7 @@ public enum EnumTemperature {
if (BiomeHelper.isBiomeHellish(biome)) {
return HELLISH;
}
return getFromValue(biome.getTemperature());
return getFromValue(biome.getDefaultTemperature());
}
public static EnumTemperature getFromBiome(Biome biome, World world, BlockPos pos) {
@@ -7,14 +7,18 @@ package forestry.api.core;
import java.util.Set;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.climate.IClimateStates;
import forestry.greenhouse.api.climate.IClimateFactory;
import forestry.api.climate.IClimateManager;
import forestry.api.climate.IClimateStates;
import forestry.api.farming.IFarmRegistry;
import forestry.api.farming.IFarmable;
import forestry.api.farming.ISimpleFarmLogic;
import forestry.api.modules.IModuleContainer;
import forestry.api.modules.IModuleManager;
/**
* Forestry's API is divided into several subcategories to make it easier to understand.
@@ -22,7 +26,7 @@ import forestry.api.farming.ISimpleFarmLogic;
* If you need to distribute API files, try to only include the parts you are actually
* using to minimize conflicts due to API changes.
* <p>
* .core - Miscallenous base classes and interfaces as well as some basics for tools, armor, game modes and stuff needed by biome mods.
* .core - Miscellaneous base classes and interfaces as well as some basics for tools, armor, game modes and stuff needed by biome mods.
* .fuels - Managers and classes to facilitate adding fuels to various engines and machines.
* .recipes - Managers and helpers to facilitate adding new recipes to various machines.
* .storage - Managers, events and interfaces for defining new backpacks and handling backpack behaviour.
@@ -51,17 +55,20 @@ public class ForestryAPI {
public static IModelManager modelManager;
public static IClimateManager climateManager;
/**
* A factory to create climate related things.
* @since 5.3.4
*/
public static IClimateFactory climateFactory;
/**
* Instance of the module manager of forestry.
* This can be used to register {@link IModuleContainer}s in the constructor of your mod.
*/
public static IModuleManager moduleManager;
/**
*
*/
public static IClimateStates states;
/**
* A registry for register fertilizers, {@link IFarmabeles}s and {@link ISimpleFarmLogic}s
* A registry for register fertilizers, {@link IFarmable}s and {@link ISimpleFarmLogic}s
*/
public static IFarmRegistry farmRegistry;
@@ -76,10 +83,20 @@ public class ForestryAPI {
public static IForestryConstants forestryConstants;
/**
* The currently enabled Forestry plugins.
* The currently enabled Forestry modules.
* Can be used to check if certain features are available, for example:
* ForestryAPI.enabledPlugins.contains("APICULTURE")
* ForestryAPI.enabledModules.contains(new ResourceLocation("forestry", "apiculture"))
*/
public static Set<ResourceLocation> enabledModules;
/**
* The currently enabled Forestry modules.
* Can be used to check if certain features are available, for example:
* ForestryAPI.enabledPlugins.contains("forestry.apiculture")
*
* @deprecated Use {@link #enabledModules}
*/
@Deprecated
public static Set<String> enabledPlugins;
/**
@@ -5,13 +5,17 @@
******************************************************************************/
package forestry.api.core;
import net.minecraft.entity.player.EntityPlayer;
import com.mojang.authlib.GameProfile;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.Event;
import forestry.api.genetics.IAlleleSpecies;
import forestry.api.genetics.IBreedingTracker;
import forestry.api.genetics.IMutation;
import forestry.api.genetics.ISpeciesRoot;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.fml.common.eventhandler.Event;
public abstract class ForestryEvent extends Event {
@@ -53,6 +57,24 @@ public abstract class ForestryEvent extends Event {
this.tracker = tracker;
this.player = player;
}
}
/**
* Posted before forestry registers all items and blocks.
*
* @deprecated removed in 1.13
*/
@Deprecated
public static class PreInit extends ForestryEvent{
/**
* The main mod instance for Forestry.
*/
public Object instance;
public final FMLPreInitializationEvent event;
public PreInit(Object instance, FMLPreInitializationEvent event) {
this.instance = instance;
this.event = event;
}
}
}
@@ -5,6 +5,7 @@
******************************************************************************/
package forestry.api.core;
import javax.annotation.Nullable;
import java.util.Set;
public interface IErrorStateRegistry {
@@ -12,6 +13,7 @@ public interface IErrorStateRegistry {
void addAlias(IErrorState state, String name);
@Nullable
IErrorState getErrorState(short id);
IErrorState getErrorState(String name);
@@ -12,13 +12,17 @@ import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.common.model.IModelState;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
/**
* A model baker to make custom models
*
* @deprecated TODO Remove in 1.13: Not needed in the api
*/
@Deprecated
@SideOnly(Side.CLIENT)
public interface IModelBaker {
@@ -15,6 +15,10 @@ import net.minecraft.util.EnumFacing;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
/**
* @deprecated TODO Remove in 1.13: Not needed in the api
*/
@Deprecated
@SideOnly(Side.CLIENT)
public interface IModelBakerModel extends IBakedModel {
@@ -8,9 +8,14 @@ package forestry.api.core;
import net.minecraft.client.renderer.ItemMeshDefinition;
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;
/**
* @deprecated TODO Remove in 1.13: Not needed in the api
*/
@Deprecated
@SideOnly(Side.CLIENT)
public interface IModelManager {
@@ -8,6 +8,10 @@ package forestry.api.core;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
/**
* @deprecated TODO Remove in 1.13: Not needed in the api
*/
@Deprecated
public interface IStateMapperRegister {
@SideOnly(Side.CLIENT)
@@ -5,10 +5,11 @@
******************************************************************************/
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@API(apiVersion = "5.1.0", owner = "Forestry", provides = "ForestryAPI|core")
@API(apiVersion = "5.7.0", owner = "Forestry", provides = "ForestryAPI|core")
package forestry.api.core;
import javax.annotation.ParametersAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraftforge.fml.common.API;
import mcp.MethodsReturnNonnullByDefault;
@@ -5,14 +5,16 @@
******************************************************************************/
package forestry.api.farming;
import java.util.LinkedHashMap;
import java.util.Map;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import java.util.LinkedHashMap;
import java.util.Map;
import net.minecraft.item.ItemStack;
//TODO: Remove this class in 1.13
@Deprecated
public class Farmables {
/**
* Can be used to add IFarmables to some of the vanilla farm logics.
@@ -0,0 +1,8 @@
package forestry.api.farming;
import forestry.api.circuits.ICircuit;
public interface IFarmCircuit extends ICircuit {
IFarmLogic getFarmLogic();
}
@@ -5,12 +5,14 @@
******************************************************************************/
package forestry.api.farming;
import forestry.api.core.IErrorLogicSource;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3i;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
import forestry.api.core.IErrorLogicSource;
public interface IFarmHousing extends IErrorLogicSource {
BlockPos getCoords();
@@ -33,10 +35,36 @@ public interface IFarmHousing extends IErrorLogicSource {
* Will remove the appropriate germling from the farm's inventory.
* It's up to the logic to only call this on a valid location.
*
* @deprecated TODO remove this method in 1.13
*
* @return true if planting was successful, false otherwise.
*/
@Deprecated
boolean plantGermling(IFarmable farmable, World world, BlockPos pos);
/**
* Callback for {@link IFarmLogic}s to plant a sapling, seed, germling, stem.
* Will remove the appropriate germling from the farm's inventory.
* It's up to the logic to only call this on a valid location.
*
* @return true if planting was successful, false otherwise.
*/
default boolean plantGermling(IFarmable farmable, World world, BlockPos pos, FarmDirection direction){
return plantGermling(farmable, world, pos);
}
default boolean isValidPlatform(World world, BlockPos pos){
return false;
}
default boolean isSquare(){
return false;
}
default boolean canPlantSoil(boolean manual){
return !manual;
}
/* INTERACTION WITH HATCHES */
IFarmInventory getFarmInventory();
@@ -27,4 +27,6 @@ public interface IFarmInventory {
IInventory getResourcesInventory();
IInventory getFertilizerInventory();
}
@@ -8,39 +8,141 @@ package forestry.api.farming;
import java.util.Collection;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
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.ForestryAPI;
/**
* The IFarmLogic is used by farm blocks and multi-blocks to cultivate and harvest crops and plants.
*
* Every farm block has only ony one logic a multi-block farm has four, one for every direction.
*/
public interface IFarmLogic {
/**
* @return The amount of fertilizer that the {@link IFarmHousing} automatically removes after this logic cultivated
* a block or harvested a crop.
*/
int getFertilizerConsumption();
/**
* @param hydrationModifier A modifier that depends on the weather and the biome of the farm.
*
* @return The amount of water that the {@link IFarmHousing} automatically removes after this logic cultivated
* a block or harvested a crop.
*/
int getWaterConsumption(float hydrationModifier);
/**
* Checks if the given stack is a resource or a soil that this logic uses to grow plants on or to create other
* products like peat.
*/
boolean isAcceptedResource(ItemStack itemstack);
/**
* Checks if the given stack is a germling (plantable sapling, seed, etc.) for any {@link IFarmable} of this farm.
*/
boolean isAcceptedGermling(ItemStack itemstack);
/**
* Collects all items that are laying on the ground and are in the {@link IFarmHousing#getArea()} of the farm.
*
* @param world The world of the farm.
* @param farmHousing The farm that uses this logic.
*
* @return A collection that contains all items that were collected.
*/
NonNullList<ItemStack> collect(World world, IFarmHousing farmHousing);
/**
* Tries to cultivate one or more blocks at the given position and with the given extent.
*
* @param world The world of the farm.
* @param farmHousing The farm that uses this logic.
* @param pos The position at that the logic should start to cultivate.
* @param direction The direction of the extension.
* @param extent How many blocks this logic has to cultivate after it cultivated the block at the given position.
* The positions of the next blocks are having a offset in the given direction.
* @return True if the logic has cultivated any block.
*/
boolean cultivate(World world, IFarmHousing farmHousing, BlockPos pos, FarmDirection direction, int extent);
/**
* Tries to harvest one or more blocks at the given position and with the given extent.
*
* @param world The world of the farm.
* @param pos The position at that the logic should start to harvest.
* @param direction The direction of the extension.
* @param extent How many blocks this logic tries to harvest after it has tried to harvested the block at the given position.
* The positions of the next blocks are having a offset in the given direction.
* @return True if the logic has cultivated any block.
*/
Collection<ICrop> harvest(World world, BlockPos pos, FarmDirection direction, int extent);
IFarmLogic setManual(boolean manual);
/**
* Returns the {@link IFarmProperties} that created this logic.
*
* @since Forestry 5.8
*
* @return Returns the {@link IFarmProperties} that created this logic. Returns a fake instance from
* {@link IFarmRegistry#createFakeInstance(IFarmLogic)} if the logic is older that Forestry 5.8.
* TODO: Remove "default" from this method in 1.13
*/
default IFarmProperties getProperties(){
return ForestryAPI.farmRegistry.createFakeInstance(this);
}
void addSoil(ItemStack resource, IBlockState soilState, boolean hasMetaData);
@SideOnly(Side.CLIENT)
ResourceLocation getTextureMap();
default boolean isManual(){
return false;
}
/**
* @deprecated Since Forestry 5.8 logic instances are created at the constructor of the {@link IFarmProperties} and
* have a immutable manual state.
* TODO Remove this method in 1.13
*/
@Deprecated
default IFarmLogic setManual(boolean manual){
return this;
}
/**
* Use {@link IFarmRegistry#getProperties(String)} to get the {@link IFarmProperties} for the farm logic and register the soil
* with {@link IFarmProperties#registerSoil(ItemStack, IBlockState, boolean)}.
*/
@Deprecated
default void addSoil(ItemStack resource, IBlockState soilState, boolean hasMetaData){
//
}
default String getUnlocalizedName(){
return "";
}
/**
* @return Localized short, human-readable identifier used in the farm gui and in tooltips.
*/
String getName();
/* GUI ONLY */
/**
* @deprecated No longer needed because mc always uses the same map for blocks and items.
* TODO remove this method in 1.13
*/
@Deprecated
@SideOnly(Side.CLIENT)
default ResourceLocation getTextureMap(){
return TextureMap.LOCATION_BLOCKS_TEXTURE;
}
/**
* @return the itemStack that represents this farm logic. Used as an icon for the farm logic.
*/
@@ -0,0 +1,58 @@
package forestry.api.farming;
import java.util.Collection;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
/**
* @since Forestry 5.8
*/
public interface IFarmProperties {
/**
* Can be used to register a {@link IBlockState} as a valid soil.
*/
default void registerSoil(ItemStack resource, IBlockState soilState){
registerSoil(resource, soilState, false);
}
/**
* Can be used to register a {@link IBlockState} as a valid soil.
*/
void registerSoil(ItemStack resource, IBlockState soilState, boolean hasMetaData);
void addGermlings(ItemStack... germlings);
void addGermlings(Collection<ItemStack> germlings);
void addProducts(ItemStack... products);
void addProducts(Collection<ItemStack> products);
/**
* Adds the {@link IFarmable}s that where registered with the given identifier.
*/
void registerFarmables(String identifier);
/**
* @return true if the given block state is a valid soil state.
*/
boolean isAcceptedSoil(IBlockState blockState);
/**
* @return true if the given stack is the {@link ItemStack} of a soil.
*/
boolean isAcceptedResource(ItemStack itemStack);
Collection<ISoil> getSoils();
Collection<IFarmable> getFarmables();
Collection<IFarmableInfo> getFarmableInfo();
/**
* Returns the instance of the manual or managed {@link IFarmLogic}.
*/
IFarmLogic getLogic(boolean manuel);
}
@@ -7,6 +7,7 @@ package forestry.api.farming;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.function.BiFunction;
import net.minecraft.item.ItemStack;
@@ -14,38 +15,87 @@ public interface IFarmRegistry {
/**
* Registers farming logic in registry under given identifier
* @param identifier Valid identifiers: farmArboreal farmWheat farmGourd farmInfernal farmPoales farmSucculentes farmVegetables farmShroom
* @param identifier Valid identifiers: farmArboreal farmCrops farmGourd farmInfernal farmPoales farmSucculentes farmShroom
* @param logic corresponding instance of logic
*
* @deprecated Since Forestry 5.8. Use {@link #registerLogic(String, BiFunction, String...)} or
* {@link #registerLogic(String, IFarmProperties)}.
*/
void registerFarmLogic(String identifier, IFarmLogic logic);
@Deprecated
void registerLogic(String identifier, IFarmLogic logic);
/**
* Registers farming logic in registry
* @since Forestry 5.8
*/
IFarmProperties registerLogic(String identifier, IFarmProperties farmInstance);
/**
* Registers farming logic in registry under given identifier
*
* @param identifier Valid identifiers: farmArboreal farmCrops farmGourd farmInfernal farmPoales farmSucculentes farmShroom
* @param logicFactory factory that creates the corresponding instance of logic
* @param farmablesIdentifiers Identifiers: farmArboreal farmCrops farmGourd farmInfernal farmPoales farmSucculentes farmShroom
* @since Forestry 5.8
*/
IFarmProperties registerLogic(String identifier, BiFunction<IFarmProperties, Boolean, IFarmLogic> logicFactory, String... farmablesIdentifiers);
/**
* Can be used to add IFarmables to some of the vanilla farm logics.
* <p>
* Identifiers: farmArboreal farmWheat farmGourd farmInfernal farmPoales farmSucculentes farmVegetables farmShroom
* Identifiers: farmArboreal farmCrops farmGourd farmInfernal farmPoales farmSucculentes farmShroom
*/
void registerFarmables(String identifier, IFarmable... farmable);
Collection<IFarmable> getFarmables(String identifier);
IFarmableInfo getFarmableInfo(String identifier);
/**
* Can be used to create a simple version of a farm logic, like the vanilla vegetable or wheat farm logic.
*
* @return Null if the farming plugin is not active.
*
* @deprecated Since Forestry 5.8. Use {@link #createCropLogic(IFarmProperties, boolean, ISimpleFarmLogic)} instead.
*/
@Nullable
@Deprecated
default IFarmLogic createLogic(ISimpleFarmLogic simpleFarmLogic){
return null;
}
/**
* @param itemStack the fertilizer itemstack
* @param value The value of the fertilizer. The value of the forestry fertilizer is 500.
*/
void registerFertilizer(ItemStack itemStack, int value);
/**
* @return The value of the fertilizer
*/
int getFertilizeValue(ItemStack itemStack);
/**
* Returns a fake {@link IFarmProperties} that returns the given logic at {@link IFarmProperties#getLogic(boolean)}.
*
* @since Forestry 5.8
* @deprecated Only for backwards comparability.
*/
@Deprecated
IFarmProperties createFakeInstance(IFarmLogic logic);
/**
* Can be used to create a simple version of a farm logic, like the vanilla vegetable or wheat farm logic.
*
* @return Null if the farming plugin is not active.
*/
@Nullable
IFarmLogic createLogic(ISimpleFarmLogic simpleFarmLogic);
IFarmLogic createCropLogic(IFarmProperties instance, boolean isManual, ISimpleFarmLogic simpleFarmLogic);
/**
*
* @param itemStack
* @param value The value of the fertitlizer.The value of the forestry fertelizer is 500.
* @since Forestry 5.8
*/
void registerFertilizer(ItemStack itemStack, int value);
/**
* @return The value of the fertitlizer
*/
int getFertilizeValue(ItemStack itemStack);
@Nullable
IFarmProperties getProperties(String identifier);
}
@@ -20,8 +20,19 @@ public interface IFarmable {
/**
* @return true if the block at the given location is a "sapling" for this type, i.e. a non-harvestable immature version of the crop.
* @deprecated Since Forestry 5.8. Use the version below. TODO Remove this method in 1.13
*/
boolean isSaplingAt(World world, BlockPos pos);
@Deprecated
default boolean isSaplingAt(World world, BlockPos pos){
return false;
}
/**
* @return true if the block at the given location is a "sapling" for this type, i.e. a non-harvestable immature version of the crop.
*/
default boolean isSaplingAt(World world, BlockPos pos, IBlockState blockState){
return isSaplingAt(world, pos);
}
/**
* @return {@link ICrop} if the block at the given location is a harvestable and mature crop, null otherwise.
@@ -34,6 +45,9 @@ public interface IFarmable {
*/
boolean isGermling(ItemStack itemstack);
default void addInformation(IFarmableInfo info){
}
/**
* @return true if the item is something that can drop from this type without actually being harvested as a crop. (Apples or sapling from decaying leaves.)
*/
@@ -0,0 +1,40 @@
package forestry.api.farming;
import java.util.Arrays;
import java.util.Collection;
import net.minecraft.item.ItemStack;
/**
* IFarmableInfo describes the valid germlings and possible products of an IFarmable. This is mainly used by the jei farming
* category to display the valid germlings and possible products.
*/
public interface IFarmableInfo {
/***
* @return The identifier of the IFarmable.
*/
String getIdentifier();
default void addGermlings(ItemStack... germlings){
addGermlings(Arrays.asList(germlings));
}
void addGermlings(Collection<ItemStack> germlings);
/**
* @return a collection that contains all valid germlings of a farmable.
*/
Collection<ItemStack> getGermlings();
default void addProducts(ItemStack... products){
addProducts(Arrays.asList(products));
}
void addProducts(Collection<ItemStack> products);
/**
* @return a collection that contains all possible products of a farmable.
*/
Collection<ItemStack> getProducts();
}
@@ -8,7 +8,9 @@ package forestry.api.farming;
import net.minecraft.item.ItemStack;
/**
* A simple version of the IFarmLogic.
* A simple version of the IFarmLogic.
*
* @apiNote TODO Remove this in 1.13
*/
public interface ISimpleFarmLogic {
@@ -16,7 +18,11 @@ public interface ISimpleFarmLogic {
* @return the itemStack that represents this farm logic. Used as an icon for the farm logic.
*/
ItemStack getIconItemStack();
/**
* @deprecated Since 5.8
*/
@Deprecated
Iterable<IFarmable> getSeeds();
String getName();
@@ -0,0 +1,16 @@
package forestry.api.farming;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
/**
* @since Forestry 5.8
*/
public interface ISoil {
ItemStack getResource();
IBlockState getSoilState();
boolean hasMetaData();
}
@@ -5,10 +5,11 @@
******************************************************************************/
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@API(apiVersion = "2.2.0", owner = "ForestryAPI|core", provides = "ForestryAPI|farming")
@API(apiVersion = "5.8.0", owner = "ForestryAPI|core", provides = "ForestryAPI|farming")
package forestry.api.farming;
import javax.annotation.ParametersAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraftforge.fml.common.API;
@@ -26,7 +26,7 @@ public class FermenterFuel {
}
/**
* How much is fermeted per work cycle, i.e. how much biomass is produced per cycle.
* How much is fermented per work cycle, i.e. how much biomass is produced per cycle.
*/
public int getFermentPerCycle() {
return fermentPerCycle;
@@ -23,4 +23,10 @@ public class AlleleManager {
* Creates Forestry alleles.
*/
public static IAlleleFactory alleleFactory;
/**
* @since 5.8
*/
public static IFilterRegistry filterRegistry;
}
@@ -0,0 +1,7 @@
package forestry.api.genetics;
public enum DatabaseMode {
ACTIVE,
INACTIVE,
BOTH
}
@@ -0,0 +1,15 @@
package forestry.api.genetics;
/**
* Every instance of this enum represents a tab in the database.
*/
public enum EnumDatabaseTab {
//Used to display information about the active species of the individual.
ACTIVE_SPECIES,
//Used to display information about the inactive species of the individual.
INACTIVE_SPECIES,
//Used to display information about the products of the active species of the individual.
PRODUCTS,
//Used to display information about the mutations of the active species of the individual.
MUTATIONS
}
@@ -0,0 +1,17 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.genetics;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.CapabilityInject;
public class GeneticCapabilities {
/**
* Capability for {@link IFilterLogic}.
*/
@CapabilityInject(IFilterLogic.class)
public static Capability<IFilterLogic> FILTER_LOGIC;
}
@@ -21,6 +21,14 @@ public interface IAllele {
*/
String getUID();
/**
* @return modId of the mod that created this allele
* @since Forestry 5.6.0
*/
default String getModID() {
return "forestry";
}
/**
* @return true if the allele is dominant, false otherwise.
*/
@@ -9,10 +9,12 @@ import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Map;
import com.mojang.authlib.GameProfile;
import forestry.api.genetics.IClassification.EnumClassLevel;
import net.minecraft.item.ItemStack;
import com.mojang.authlib.GameProfile;
import forestry.api.genetics.IClassification.EnumClassLevel;
/**
* Manages {@link ISpeciesRoot}, {@link IAllele}s, {@link IFruitFamily}s, {@link IClassification}, the blacklist and allows creation of research notes.
*
@@ -10,6 +10,7 @@ import java.util.Map;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -24,7 +25,10 @@ public interface IAlyzerPlugin {
@SideOnly(Side.CLIENT)
void drawAnalyticsPage3(GuiScreen gui, ItemStack itemStack);
Map<String, ItemStack> getIconStacks();
/**
* The hints that will be shown in the alyzer gui.
*/
List<String> getHints();
Map<String, ItemStack> getIconStacks();
}
@@ -5,10 +5,14 @@
******************************************************************************/
package forestry.api.genetics;
import forestry.api.apiculture.IBeekeepingMode;
import java.util.Collection;
import java.util.Collections;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import forestry.api.apiculture.IBeekeepingMode;
/**
* Keeps track of who bred, discovered, and researched which species in a world.
*
@@ -67,6 +71,13 @@ public interface IBreedingTracker {
*/
boolean isDiscovered(IAlleleSpecies species);
/**
* @return A collection that contains the {@link IAllele#getUID()}s of all discovered species.
*/
default Collection<String> getDiscoveredSpecies(){
return Collections.emptyList();
}
/**
* Register a successfully researched mutation.
* Mutations are normally researched in the Escritoire.
@@ -33,20 +33,20 @@ public interface IClimateHelper {
/**
* Gets a collection of humidities which fit the given parameters.
*
* @param prefered Base humidity from which to measure.
* @param preferred Base humidity from which to measure.
* @param tolerance Tolerance to apply to the base humidity.
* @return A collection of humidities which fall within the given parameters.
*/
Collection<EnumHumidity> getToleratedHumidity(EnumHumidity prefered, EnumTolerance tolerance);
Collection<EnumHumidity> getToleratedHumidity(EnumHumidity preferred, EnumTolerance tolerance);
/**
* Gets a collection of temperatures which fit the given parameters.
*
* @param prefered Base temperature from which to measure.
* @param preferred Base temperature from which to measure.
* @param tolerance Tolerance to apply to the base temperatures.
* @return A collection of temperatures which fall within the given parameters.
*/
Collection<EnumTemperature> getToleratedTemperature(EnumTemperature prefered, EnumTolerance tolerance);
Collection<EnumTemperature> getToleratedTemperature(EnumTemperature preferred, EnumTolerance tolerance);
/**
* Gets a localized, human readable string for the given temperature.
@@ -0,0 +1,29 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.genetics;
import java.util.List;
import java.util.Map;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
/**
* An ISpeciesPlugin provides methods that are used in the alyzer and database to display information about an
* individual.
*/
@SideOnly(Side.CLIENT)
public interface IDatabasePlugin<I extends IIndividual> {
/* ALYZER */
List<String> getHints();
IDatabaseTab[] getTabs();
Map<String, ItemStack> getIndividualStacks();
}
@@ -0,0 +1,38 @@
package forestry.api.genetics;
import javax.annotation.Nullable;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.gui.IDatabaseElement;
/**
* A tab of the database screen that shows some information about a {@link IIndividual}.
*/
@SideOnly(Side.CLIENT)
public interface IDatabaseTab<I extends IIndividual> {
/**
* Creates the gui elements that are displayed if this tab is selected in the database.
*
* @param individual The individual that is currently in the database selected.
* @param container A helper to create the gui elements.
*/
void createElements(IDatabaseElement container, I individual, ItemStack itemStack);
ItemStack getIconStack();
/**
* Can be used to give the tab a custom tooltip.
*/
@Nullable
default String getTooltip(I individual){
return null;
}
default DatabaseMode getMode(){
return DatabaseMode.ACTIVE;
}
}
@@ -0,0 +1,27 @@
package forestry.api.genetics;
public interface IFilterData {
/**
* If the root is present, returns the root,
* otherwise throws {@code NoSuchElementException}.
*/
ISpeciesRoot getRoot();
/**
* If the individual is present, returns the individual,
* otherwise throws {@code NoSuchElementException}.
*/
IIndividual getIndividual();
/**
* If the type is present, returns the type,
* otherwise throws {@code NoSuchElementException}.
*/
ISpeciesType getType();
/**
* @return True if this data contains a root, individual and type.
*/
boolean isPresent();
}
@@ -0,0 +1,56 @@
package forestry.api.genetics;
import javax.annotation.Nullable;
import java.io.IOException;
import java.util.Collection;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.WorldServer;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.core.INbtReadable;
import forestry.api.core.INbtWritable;
public interface IFilterLogic extends INbtWritable, INbtReadable {
void writeGuiData(PacketBuffer data);
@SideOnly(Side.CLIENT)
void readGuiData(PacketBuffer data);
Collection<EnumFacing> getValidDirections(ItemStack itemStack, EnumFacing from);
boolean isValid(ItemStack itemStack, EnumFacing facing);
boolean isValid(EnumFacing facing, ItemStack itemStack, IFilterData filterData);
boolean isValidAllelePair(EnumFacing orientation, String activeUID, String inactiveUID);
IFilterRuleType getRule(EnumFacing facing);
boolean setRule(EnumFacing facing, IFilterRuleType rule);
@Nullable
IAllele getGenomeFilter(EnumFacing facing, int index, boolean active);
boolean setGenomeFilter(EnumFacing facing, int index, boolean active, @Nullable IAllele allele);
void sendToServer(EnumFacing facing, int index, boolean active, @Nullable IAllele allele);
void sendToServer(EnumFacing facing, IFilterRuleType rule);
INetworkHandler getNetworkHandler();
interface INetworkHandler{
/**
* Sends the data of the logic to the client of all players that have the gui currently open.
*
* @param player The player that changed the filter.
*/
void sendToPlayers(IFilterLogic logic, WorldServer server, EntityPlayer player);
}
}
@@ -0,0 +1,40 @@
package forestry.api.genetics;
import javax.annotation.Nullable;
import java.util.Collection;
import forestry.api.core.ILocatable;
/**
* @since 5.8
*/
public interface IFilterRegistry {
/**
* Registers a filter rule.
*/
void registerFilter(IFilterRuleType rule);
Collection<IFilterRuleType> getRules();
IFilterRuleType getDefaultRule();
@Nullable
IFilterRuleType getRule(String uid);
@Nullable
IFilterRuleType getRule(int id);
int getId(IFilterRuleType rule);
IFilterLogic createLogic(ILocatable locatable, IFilterLogic.INetworkHandler networkHandler);
default IFilterRuleType getRuleOrDefault(String uid){
IFilterRuleType rule = getRule(uid);
return rule != null ? rule : getDefaultRule();
}
default IFilterRuleType getRuleOrDefault(int id){
IFilterRuleType rule = getRule(id);
return rule != null ? rule : getDefaultRule();
}
}
@@ -0,0 +1,17 @@
package forestry.api.genetics;
import javax.annotation.Nullable;
import net.minecraft.item.ItemStack;
public interface IFilterRule {
boolean isValid(ItemStack itemStack, IFilterData data);
/**
* If a root with this uid is registered, the filter will only get stack with individuals from this root.
*/
@Nullable
default String getRootUID() {
return null;
}
}
@@ -0,0 +1,27 @@
package forestry.api.genetics;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public interface IFilterRuleType extends IFilterRule {
void addLogic(IFilterRule logic);
/**
* @return True if a other logic can be added to this type.
*/
boolean isContainer();
/**
* @return A unique identifier for the rule.
*/
String getUID();
@SideOnly(Side.CLIENT)
TextureAtlasSprite getSprite();
@SideOnly(Side.CLIENT)
ResourceLocation getTextureMap();
}
@@ -0,0 +1,43 @@
package forestry.api.genetics;
import net.minecraft.client.gui.GuiScreen;
import forestry.api.gui.IGuiElement;
public interface IGeneticAnalyzer extends IGuiElement {
IGeneticAnalyzerProvider getProvider();
/**
* @return True if the analyzer is currently visible.
*/
boolean isVisible();
void setVisible(boolean visible);
/**
* Called at the end of the constructor of the analyzer provider.
*/
void init();
/**
* Updates the displayed content of the analyzer.
*/
void update();
/**
* Draws the tooltip of the element that is under the mouse.
*/
void drawTooltip(GuiScreen gui, int mouseX, int mouseY);
/**
*
* @return
*/
IGuiElement getItemElement();
void updateSelected();
void setSelectedSlot(int selectedSlot);
int getSelected();
}
@@ -0,0 +1,18 @@
package forestry.api.genetics;
import net.minecraft.item.ItemStack;
public interface IGeneticAnalyzerProvider {
ItemStack getSpecimen(int index);
boolean onUpdateSelected();
void onSelection(int index, boolean changed);
int getSelectedSlot(int index);
int getSlotCount();
int getFirstSlot();
}
@@ -14,17 +14,38 @@ import forestry.api.core.INbtWritable;
*/
public interface IGenome extends INbtWritable {
/**
* @return The active species of this genome.
*/
IAlleleSpecies getPrimary();
/**
* @return The inactive species of this genome.
*/
IAlleleSpecies getSecondary();
/**
* @return A array with all chromosomes of this genome.
*/
IChromosome[] getChromosomes();
/**
* @return The active allele of this chromosome type.
*/
IAllele getActiveAllele(IChromosomeType chromosomeType);
/**
* @return The inactive allele of this chromosome type.
*/
IAllele getInactiveAllele(IChromosomeType chromosomeType);
/**
* @return true if the given other IGenome has the amount of chromosomes and their alleles are identical.
*/
boolean isGeneticEqual(IGenome other);
/**
* @return The root of this species and describes the class of species of this genome.
*/
ISpeciesRoot getSpeciesRoot();
}
@@ -12,6 +12,9 @@ import net.minecraft.util.math.BlockPos;
*/
public interface IHousing {
/**
* The coordinates of the housing.
*/
BlockPos getCoordinates();
}
@@ -16,10 +16,19 @@ import forestry.api.core.INbtWritable;
*/
public interface IIndividual extends INbtWritable {
/**
* @return The uid of the active species of this individual.
*/
String getIdent();
/**
* @return The display name of the active species of this individual.
*/
String getDisplayName();
/**
* Adds some information about the individual to the list.
*/
void addTooltip(List<String> list);
/**
@@ -29,12 +38,24 @@ public interface IIndividual extends INbtWritable {
*/
boolean analyze();
/**
* @return true if the IIndividual has been analyzed previously.
*/
boolean isAnalyzed();
/**
* @return true if the active species of this individual has a effect.
*/
boolean hasEffect();
/**
* @return true if the active species of this individual is secret.
*/
boolean isSecret();
/**
* @return The genetic data of this individual.
*/
IGenome getGenome();
/**
@@ -49,6 +70,9 @@ public interface IIndividual extends INbtWritable {
*/
IIndividual copy();
/**
* @return true if this individual has the same active and inactive species.
*/
boolean isPureBred(IChromosomeType chromosomeType);
}
@@ -0,0 +1,19 @@
package forestry.api.genetics;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public interface ISpeciesDisplayHelper<I extends IIndividual, S extends IAlleleSpecies> {
/**
* Retrieves a stack that can and should only be used on the client side in a gui.
*
* @return A empty stack, if the species was not registered before the creation of this handler or if the species is
* not a species of the {@link ISpeciesRoot}.
*/
ItemStack getDisplayStack(IAlleleSpecies species, ISpeciesType type);
ItemStack getDisplayStack(IAlleleSpecies species);
}
@@ -11,12 +11,15 @@ import java.util.List;
import java.util.Map;
import java.util.Random;
import com.mojang.authlib.GameProfile;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import com.mojang.authlib.GameProfile;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
/**
* Describes a class of species (i.e. bees, trees, butterflies), provides helper functions and access to common functionality.
*/
@@ -67,10 +70,13 @@ public interface ISpeciesRoot {
IIndividual getMember(NBTTagCompound compound);
<O extends Object, I extends IIndividual> void registerTranslator(Object translatorKey, IIndividualTranslator<I, O> translator);
<O, I extends IIndividual> void registerTranslator(Object translatorKey, IIndividualTranslator<I, O> translator);
@Nullable
<O extends Object, I extends IIndividual> IIndividualTranslator<I, O> getTranslator(Object translatorKey);
<O, I extends IIndividual> IIndividualTranslator<I, O> getTranslator(Object translatorKey);
@Nullable
<O, I extends IIndividual> I translateMember(O objectToTranslator);
@Nullable
ISpeciesType getType(ItemStack itemStack);
@@ -80,8 +86,20 @@ public interface ISpeciesRoot {
*/
ISpeciesType getIconType();
default ISpeciesType[] getTypes(){
return new ISpeciesType[0];
}
ItemStack getMemberStack(IIndividual individual, ISpeciesType type);
default ItemStack getMemberStack(IAlleleSpecies species, ISpeciesType type){
return getMemberStack(getTemplate(species), type);
}
default ItemStack getMemberStack(IAllele[] template, ISpeciesType type){
return getMemberStack(templateAsIndividual(template), type);
}
/* BREEDING TRACKER */
IBreedingTracker getBreedingTracker(World world, @Nullable GameProfile player);
@@ -142,6 +160,15 @@ public interface ISpeciesRoot {
List<? extends IIndividual> getIndividualTemplates();
/**
* The type of the species that will be used at the given position of the mutation recipe in the gui.
*
* @param position 0 = first parent, 1 = second parent, 2 = result
*/
default ISpeciesType getTypeForMutation(int position){
return getIconType();
}
/* MUTATIONS */
/**
@@ -160,6 +187,12 @@ public interface ISpeciesRoot {
*/
List<? extends IMutation> getCombinations(IAllele other);
/**
* @param other Allele to match mutations against.
* @return All registered mutations the give allele is resolute of.
*/
List<? extends IMutation> getResultantMutations(IAllele other);
/**
* @return all possible mutations that result from breeding two species
* @since Forestry 3.7
@@ -197,4 +230,14 @@ public interface ISpeciesRoot {
* Plugin to add information for the handheld genetic analyzer.
*/
IAlyzerPlugin getAlyzerPlugin();
/**
* Plugin to add information for the handheld genetic analyzer and the database.
* @since 5.7
*/
@Nullable
@SideOnly(Side.CLIENT)
default IDatabasePlugin getSpeciesPlugin(){
return null;
}
}
@@ -5,10 +5,11 @@
******************************************************************************/
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
@API(apiVersion = "4.7.1", owner = "ForestryAPI|core", provides = "ForestryAPI|genetics")
@API(apiVersion = "5.7.0", owner = "ForestryAPI|core", provides = "ForestryAPI|genetics")
package forestry.api.genetics;
import javax.annotation.ParametersAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraftforge.fml.common.API;
import mcp.MethodsReturnNonnullByDefault;
@@ -12,7 +12,7 @@ import forestry.api.core.IErrorLogicSource;
public interface IGreenhouseHousing extends IErrorLogicSource, IClimateHousing{
/**
* @return The current tempreture as an enum.
* @return The current temperature as an enum.
*/
EnumTemperature getTemperature();
@@ -22,7 +22,7 @@ public interface IGreenhouseHousing extends IErrorLogicSource, IClimateHousing{
EnumHumidity getHumidity();
/**
* @return The current tempreture as an float. Range: 0.0F ~ 2.0F
* @return The current temperature as an float. Range: 0.0F ~ 2.0F
*/
float getExactTemperature();
@@ -0,0 +1,14 @@
package forestry.api.gui;
import forestry.api.gui.style.ITextStyle;
import forestry.api.gui.style.ImmutableTextStyle;
import forestry.api.gui.style.TextStyleBuilder;
public class GuiConstants {
public static final ITextStyle DEFAULT_STYLE = new ImmutableTextStyle();
public static final ITextStyle BLACK_STYLE = new TextStyleBuilder().color(0x000000).build();
public static final ITextStyle UNICODE_STYLE = new TextStyleBuilder().unicode(true).build();
public static final ITextStyle UNDERLINED_STYLE = new TextStyleBuilder().underlined(true).build();
public static final ITextStyle BOLD_BLACK_STYLE = new TextStyleBuilder(BLACK_STYLE).bold(true).build();
public static final ITextStyle ITALIC_BLACK_STYLE = new TextStyleBuilder(BLACK_STYLE).italic(true).build();
}
@@ -0,0 +1,37 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.gui;
/**
* The alignment of the {@link IGuiElement} defines the position of the element relative to the position of its parent.
*/
public enum GuiElementAlignment {
TOP_LEFT(0.0f, 0.0f),
TOP_CENTER(0.5f, 0.0f),
TOP_RIGHT(1.0f, 0.0f),
MIDDLE_LEFT(0.0f, 0.5f),
MIDDLE_CENTER(0.5f, 0.5f),
MIDDLE_RIGHT(1.0f, 0.5f),
BOTTOM_LEFT(0.0f, 1.0f),
BOTTOM_CENTER(0.5f, 1.0f),
BOTTOM_RIGHT(1.0f, 1.0f);
private final float xOffset;
private final float yOffset;
GuiElementAlignment(float xOffset, float yOffset) {
this.xOffset = xOffset;
this.yOffset = yOffset;
}
public float getXOffset() {
return xOffset;
}
public float getYOffset() {
return yOffset;
}
}
@@ -0,0 +1,63 @@
package forestry.api.gui;
import javax.annotation.Nullable;
import java.util.function.BiFunction;
import java.util.function.Function;
import forestry.api.genetics.DatabaseMode;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IBreedingTracker;
import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IMutation;
import forestry.api.gui.style.ITextStyle;
public interface IDatabaseElement extends IElementLayout {
/**
* Adds the chromosomeName and the name of the active/not active allele, of the chromosome, with {@link #label}.
*/
void addLine(String chromosomeName, IChromosomeType chromosome);
/**
* Adds the chromosomeName and the result of toString with {@link #label}.
*/
<A extends IAllele> void addLine(String chromosomeName, BiFunction<A, Boolean, String> toText, IChromosomeType chromosome);
<A extends IAllele> void addLine(String chromosomeName, BiFunction<A, Boolean, String> toText, IChromosomeType chromosome, boolean dominant);
void addLine(String leftText, Function<Boolean, String> toText, IChromosomeType chromosome);
void addLine(String firstText, String secondText, ITextStyle firstStyle, ITextStyle secondStyle);
void addLine(String leftText, String rightText, boolean dominant);
void addLine(String leftText, Function<Boolean, String> toText, boolean dominant);
void addFertilityLine(String chromosomeName, IChromosomeType chromosome, int texOffset);
void addToleranceLine(IChromosomeType chromosome);
void addMutation(int x, int y, int width, int height, IMutation mutation, IAllele species, IBreedingTracker breedingTracker);
void addMutationResultant(int x, int y, int width, int height, IMutation mutation, IBreedingTracker breedingTracker);
//void addRow(String firstText, String secondText, String thirdText, ITextStyle firstStyle, ITextStyle secondStyle, ITextStyle thirdStyle);
//void addRow(String firstText, String secondText, String thirdText, boolean secondDominant, boolean thirdDominant);
//void addRow(String firstText, String secondText, String thirdText, IIndividual individual, IChromosomeType chromosome);
void addSpeciesLine(String firstText, @Nullable String secondText, IChromosomeType chromosome);
void init(DatabaseMode mode, IIndividual individual, int secondColumn, int thirdColumn);
@Nullable
IIndividual getIndividual();
IGenome getGenome();
//void addSpeciesLine(String firstText, @Nullable String secondText, @Nullable String thirdText, IIndividual individual, IChromosomeType chromosome);
}
@@ -0,0 +1,111 @@
package forestry.api.gui;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.gui.style.ITextStyle;
@SideOnly(Side.CLIENT)
public interface IElementGroup extends IGuiElement {
/**
* Adds a element to this layout.
*/
<E extends IGuiElement> E add(E element);
/**
* Removes a element from this layout.
*/
<E extends IGuiElement> E remove(E element);
default IElementGroup add(IGuiElement... elements) {
for (IGuiElement element : elements) {
add(element);
}
return this;
}
default IElementGroup remove(IGuiElement... elements) {
for (IGuiElement element : elements) {
remove(element);
}
return this;
}
default IElementGroup add(Collection<IGuiElement> elements) {
elements.forEach(this::add);
return this;
}
default IElementGroup remove(Collection<IGuiElement> elements) {
elements.forEach(this::remove);
return this;
}
void clear();
@Nullable
IGuiElement getLastElement();
/**
* @return All elements that this layout contains.
*/
List<IGuiElement> getElements();
IItemElement item(int xPos, int yPos, ItemStack itemStack);
default IItemElement item(ItemStack itemStack) {
return item(0, 0, itemStack);
}
/**
* Adds a single line of text.
*/
ILabelElement label(String text);
ILabelElement label(String text, ITextStyle style);
ILabelElement label(String text, GuiElementAlignment align);
ILabelElement label(String text, GuiElementAlignment align, ITextStyle textStyle);
ILabelElement label(String text, int width, int height, GuiElementAlignment align, ITextStyle textStyle);
ILabelElement label(String text, int x, int y, int width, int height, GuiElementAlignment align, ITextStyle textStyle);
/**
* Adds a text element that splits the text with wordwrap.
*/
ITextElement splitText(String text, int width);
ITextElement splitText(String text, int width, ITextStyle textStyle);
ITextElement splitText(String text, int width, GuiElementAlignment align, ITextStyle textStyle);
ITextElement splitText(String text, int x, int y, int width, GuiElementAlignment align, ITextStyle textStyle);
default IElementLayout vertical(int width) {
return vertical(0, 0, width);
}
IElementLayout vertical(int xPos, int yPos, int width);
IElementLayout horizontal(int xPos, int yPos, int height);
default IElementLayout horizontal(int height) {
return horizontal(0, 0, height);
}
IElementGroup pane(int xPos, int yPos, int width, int height);
default IElementGroup pane(int width, int height) {
return pane(0, 0, width, height);
}
IElementLayoutHelper layoutHelper(IElementLayoutHelper.LayoutFactory layoutFactory, int width, int height);
}
@@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.gui;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public interface IElementLayout extends IElementGroup {
/**
* @param distance
* @return
*/
IElementLayout setDistance(int distance);
/**
* @return The distance between the different elements of this layout.
*/
int getDistance();
int getSize();
}
@@ -0,0 +1,45 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.gui;
import java.util.Collection;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public interface IElementLayoutHelper {
/**
* @return Only false if the helper has no space to add this element.
*/
boolean add(IGuiElement element);
/**
* Removes all layouts and resets all variables of this helper.
*/
void clear();
/**
* Adds the layouts to the parent of the {@link IElementGroup}. And calls {@link #clear()}
*/
void finish(boolean centerX);
default void finish() {
finish(false);
}
/**
* @return All layouts that were created with the help of this helper since the last {@link #clear()} or {@link #finish()}.
*/
Collection<IElementLayout> layouts();
interface LayoutFactory {
/**
* A factory method to create new layouts if the last layout is full.
*/
IElementLayout createLayout(int xOffset, int yOffset);
}
}
@@ -0,0 +1,344 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.gui;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.List;
import java.util.function.Consumer;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.gui.events.GuiElementEvent;
import forestry.api.gui.events.GuiEventDestination;
import forestry.api.gui.events.GuiEventHandler;
import forestry.api.gui.events.GuiEventOrigin;
/**
* A <em>gui element</em> is an object having a graphical representation that can be displayed on the screen and that
* can interact with the user.
*
* The interface the most gui elements of forestry implement. You must place the element a containment hierarchy whose
* root is a top-level {@link IWindowElement}.
*/
@SideOnly(Side.CLIENT)
public interface IGuiElement {
/* Position and Size*/
/**
* @return the x position of this element relative to the position of its parent.
*/
int getX();
/**
* @return the y position of this element relative to the position of its parent.
*/
int getY();
/**
* Sets the alignment of this element.
*/
IGuiElement setAlign(GuiElementAlignment align);
/**
* The alignment of the {@link IGuiElement} defines the position of the element relative to the position of its
* parent.
*/
GuiElementAlignment getAlign();
/**
* The root of the containment hierarchy that this element is part of.
*/
IWindowElement getWindow();
/**
* @return the x position of this element relative to the gui.
*/
int getAbsoluteX();
/**
* @return the y position of this element relative to the gui.
*/
int getAbsoluteY();
/**
* @return the size of the element on the x-axis.
*/
int getWidth();
void setWidth(int width);
/**
* @return the size of the element on the y-axis.
*/
int getHeight();
void setHeight(int height);
/**
* Sets the dimensions of this element.
*
* @param width the size of the element on the x-axis.
* @param height the size of the element on the y-axis.
*/
IGuiElement setSize(int width, int height);
/**
* Sets the position of this element.
*
* @param xPos the x position of this element relative to the position of its parent.
* @param yPos the y position of this element relative to the position of its parent.
*/
IGuiElement setLocation(int xPos, int yPos);
IGuiElement setOffset(int xOffset, int yOffset);
/**
* Sets the dimensions and position of this element.
*
* @param xPos the x position of this element relative to the position of its parent.
* @param yPos the y position of this element relative to the position of its parent.
* @param width the size of the element on the x-axis.
* @param height the size of the element on the y-axis.
*/
IGuiElement setBounds(int xPos, int yPos, int width, int height);
/**
* Sets the x position of this element relative to the position of its parent.
*/
void setXPosition(int xPos);
/**
* Sets the y position of this element relative to the position of its parent.
*/
void setYPosition(int yPos);
/* CROPPED */
/**
* Sets the cropped zone of this element and the element the zone is relative to.
*
* @param cropElement The element the zone is relative to.
* @param cropX The x start coordinate of the zone.
* @param cropY The y start coordinate of the zone.
* @param cropWidth The width of the zone.
* @param cropHeight The height of the zone.
*/
void setCroppedZone(@Nullable IGuiElement cropElement, int cropX, int cropY, int cropWidth, int cropHeight);
/**
* @return The element the cropped zone is relative to.
*/
@Nullable
IGuiElement getCropElement();
/**
* @return The x start coordinate of the cropped zone.
*/
int getCropX();
/**
* @return The y start coordinate of the cropped zone.
*/
int getCropY();
/**
* @return The width of the cropped zone.
*/
int getCropWidth();
/**
* @return The height of the cropped zone.
*/
int getCropHeight();
/**
* @return True if {@link #setCroppedZone(IGuiElement, int, int, int, int)} was ever called on this element.
*/
boolean isCropped();
/* Parent */
/**
* The position of this element is relative to the position of its parent.
*
* @return the parent element of this element.
*/
@Nullable
IGuiElement getParent();
/**
* Sets the parent of this element.
*/
IGuiElement setParent(@Nullable IGuiElement parent);
/* Creation & Deletion */
/**
* Called at {@link IElementGroup#add(IGuiElement)} after the element was added to the group and
* {@link #setParent(IGuiElement)} was called at the element.
*
* Can be used to add other element to the element if the element is an {@link IElementGroup}.
*/
void onCreation();
/**
* Called at {@link IElementGroup#remove(IGuiElement...)} after the element was removed from the group.
*/
void onDeletion();
/* Rendering */
/**
* Draws the element and his children.
*
* @param mouseX The x position of the mouse relative to the parent of the element.
* @param mouseY The y position of the mouse relative to the parent of the element.
*/
void draw(int mouseX, int mouseY);
/**
* Draws the element itself at the current position.
*
* @param mouseX The x position of the mouse relative to the parent of the element.
* @param mouseY The y position of the mouse relative to the parent of the element.
*/
void drawElement(int mouseX, int mouseY);
/* Mouse Over */
/**
* @param mouseX The x position of the mouse relative to the parent of the element.
* @param mouseY The y position of the mouse relative to the parent of the element.
* @return True if the mouse is currently over the element.
*/
boolean isMouseOver(int mouseX, int mouseY);
/**
* @return True if the mouse is currently over the element.
*/
boolean isMouseOver();
default boolean canMouseOver(){
return false;
}
/* Updates */
/**
* Updates the element. Called at {@link GuiScreen#updateScreen()}.
*/
@SideOnly(Side.CLIENT)
void updateClient();
/* State */
/**
* @return True if this element can be focused and processes keys.
*/
default boolean canFocus(){
return false;
}
/**
* The element can be hided with {@link #hide()} and be made visible again with {@link #show()}.
*
* @return True of this element is currently visible.
*/
boolean isVisible();
/**
* Makes this element visible again.
*/
void show();
/**
* Hides this element.
*/
void hide();
/**
* The most elements are enabled by default. Only a few elements are disabled at a certain time like buttons.
*
* @return True if this element is enabled.
*/
boolean isEnabled();
/* Tooltip */
/**
* Adds an additional tooltip to the current tooltip of the element.
*/
IGuiElement addTooltip(String line);
/**
* Adds an additional tooltip to the current tooltip of the element.
*/
IGuiElement addTooltip(Collection<String> lines);
/**
* @return True if this element currently has a tooltip.
*/
boolean hasTooltip();
/**
* Clears the tooltips that were added with {@link #addTooltip(String)} and {@link #addTooltip(Collection)}.
* It does not remove default tooltips of an element like the fluid information of a tank or the item information
* of an slot element.
*/
void clearTooltip();
/**
* Returns the tooltip that this element provides at the given mouse position.
*
* @param mouseX The x position of the mouse relative to the parent of the element.
* @param mouseY The y position of the mouse relative to the parent of the element.
*/
List<String> getTooltip(int mouseX, int mouseY);
/**
* @return Returns the tooltips that were added with {@link #addTooltip(String)} and {@link #addTooltip(Collection)}.
*/
List<String> getTooltip();
/* Events */
/**
* Adds an event handler that handles events that this element receives with {@link #receiveEvent(GuiElementEvent)}.
*/
<E extends GuiElementEvent> void addEventHandler(Consumer<E> eventHandler);
/**
* Adds an event handler that handles events that this element receives with {@link #receiveEvent(GuiElementEvent)}.
*/
default <E extends GuiElementEvent> void addEventHandler(Class<? super E> eventClass, Consumer<E> eventHandler){
addEventHandler(new GuiEventHandler<>(eventClass, eventHandler));
}
/**
* Adds an event handler that handles events that this element receives with {@link #receiveEvent(GuiElementEvent)}.
*/
default <E extends GuiElementEvent> void addEventHandler(Class<? super E> eventClass, GuiEventOrigin origin, IGuiElement relative, Consumer<E> eventHandler){
addEventHandler(new GuiEventHandler<>(eventClass, origin, relative, eventHandler));
}
/**
* Adds an event handler that handles events that this element receives with {@link #receiveEvent(GuiElementEvent)}.
*/
default <E extends GuiElementEvent> void addSelfEventHandler(Class<? super E> eventClass, Consumer<E> eventHandler){
addEventHandler(new GuiEventHandler<>(eventClass, GuiEventOrigin.SELF, this, eventHandler));
}
/**
* Distributes the event to the elements that are defined by the {@link GuiEventDestination}.
*/
default void postEvent(GuiElementEvent event, GuiEventDestination destination){
destination.sendEvent(this, event);
}
default void postEvent(GuiElementEvent event){
postEvent(event, GuiEventDestination.SINGLE);
}
/**
* Receives an event and distributes them to the event handlers of this element.
*/
void receiveEvent(GuiElementEvent event);
}
@@ -0,0 +1,67 @@
/*******************************************************************************
* Copyright 2011-2014 SirSengir
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
******************************************************************************/
package forestry.api.gui;
import javax.annotation.Nullable;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleInteger;
import forestry.api.genetics.IAlleleSpecies;
import forestry.api.genetics.IAlleleTolerance;
import forestry.api.genetics.IBreedingTracker;
import forestry.api.genetics.IGeneticAnalyzer;
import forestry.api.genetics.IGeneticAnalyzerProvider;
import forestry.api.genetics.IMutation;
import forestry.api.gui.style.ITextStyle;
/**
* A helper interface to create gui elements.
*/
@SideOnly(Side.CLIENT)
public interface IGuiElementFactory {
IGeneticAnalyzer createAnalyzer(IWindowElement window, int xPos, int yPos, boolean rightBoarder, IGeneticAnalyzerProvider provider);
/* GENETIC*/
/**
* @param dominant True if you want the dominant color and false if you want the recessive color.
* @return The color code that forestry uses to show if a allele is dominant (true) or recessive (false).
*/
int getColorCoding(boolean dominant);
ITextStyle getStateStyle(boolean dominant);
ITextStyle getGuiStyle();
/**
* @return Null if the mutation is secret and undiscovered. {@link IMutation#isSecret()}
*/
@Nullable
IGuiElement createMutation(int x, int y, int width, int height, IMutation mutation, IAllele species, IBreedingTracker breedingTracker);
/**
* @return Null if the mutation is secret and undiscovered. {@link IMutation#isSecret()}
*/
@Nullable
IGuiElement createMutationResultant(int x, int y, int width, int height, IMutation mutation, IBreedingTracker breedingTracker);
IGuiElement createFertilityInfo(IAlleleInteger fertilityAllele, int texOffset);
IGuiElement createToleranceInfo(IAlleleTolerance toleranceAllele, IAlleleSpecies species, String text);
IGuiElement createToleranceInfo(IAlleleTolerance toleranceAllele);
/* LAYOUTS */
IElementLayout createHorizontal(int xPos, int yPos, int height);
IElementLayout createVertical(int xPos, int yPos, int width);
IElementGroup createPane(int xPos, int yPos, int width, int height);
}
@@ -0,0 +1,15 @@
package forestry.api.gui;
import net.minecraft.item.ItemStack;
/**
* A element that contains and displays a {@link ItemStack}.
*/
public interface IItemElement extends IGuiElement {
/**
* @return The contained {@link ItemStack}.
*/
ItemStack getStack();
IItemElement setStack(ItemStack stack);
}
@@ -0,0 +1,27 @@
package forestry.api.gui;
import forestry.api.gui.style.ITextStyle;
/**
* A label element that displays and contains one single line of text
*/
public interface ILabelElement extends ITextElement {
/**
* @return The style of the text.
*/
ITextStyle getStyle();
ILabelElement setStyle(ITextStyle style);
/**
* @return The current text of this element with its {@link net.minecraft.util.text.TextFormatting}s.
*/
String getText();
ILabelElement setText(String text);
/**
* The current text of this element without its {@link net.minecraft.util.text.TextFormatting}s.
*/
String getRawText();
}
@@ -0,0 +1,24 @@
package forestry.api.gui;
import java.util.Collection;
import java.util.Map;
import forestry.api.gui.style.ITextStyle;
/**
* A element that displays or contains one ore more lines of text.
*/
public interface ITextElement extends IGuiElement {
/**
* @return The text this element displays.
*/
Collection<String> getLines();
ITextElement setText(String text);
/**
* @return The raw text this element displays without any formations and their style.
*/
Map<ITextStyle, String> getRawLines();
}
@@ -0,0 +1,79 @@
package forestry.api.gui;
import javax.annotation.Nullable;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
/**
* The window element is the root element of the containment hierarchy. Its the only element the gui interacts with
* directly.
*/
@SideOnly(Side.CLIENT)
public interface IWindowElement extends IElementGroup {
/**
* Returns the mouse position.
*/
int getMouseX();
/**
* Returns the mouse position.
*/
int getMouseY();
/**
* Returns the mouse position relative to the given element.
*/
int getRelativeMouseX(@Nullable IGuiElement element);
/**
* Returns the mouse position relative to the given element.
*/
int getRelativeMouseY(@Nullable IGuiElement element);
/**
* Returns the current screen width.
*/
int getScreenWidth();
/**
* Returns the current screen height.
*/
int getScreenHeight();
/**
* Returns the current gui height.
*/
int getGuiHeight();
/**
* Returns the current gui width.
*/
int getGuiWidth();
int getGuiLeft();
int getGuiTop();
TextureManager getTextureManager();
FontRenderer getFontRenderer();
@Nullable
IGuiElement getMousedOverElement();
@Nullable
IGuiElement getDraggedElement();
@Nullable
IGuiElement getFocusedElement();
boolean isMouseOver(IGuiElement element);
boolean isDragged(IGuiElement element);
boolean isFocused(IGuiElement element);
}
@@ -0,0 +1,59 @@
package forestry.api.gui.events;
import forestry.api.gui.IGuiElement;
public class ElementEvent extends GuiElementEvent {
private ElementEvent(IGuiElement origin) {
super(origin);
}
public static class Deletion extends ElementEvent {
public Deletion(IGuiElement origin) {
super(origin);
}
}
public static class StartMouseOver extends ElementEvent {
public StartMouseOver(IGuiElement origin) {
super(origin);
}
}
public static class EndMouseOver extends ElementEvent {
public EndMouseOver(IGuiElement origin) {
super(origin);
}
}
public static class StartDrag extends ElementEvent {
private final int button;
public StartDrag(IGuiElement origin, int button) {
super(origin);
this.button = button;
}
public int getButton() {
return this.button;
}
}
public static class EndDrag extends ElementEvent {
public EndDrag(IGuiElement origin) {
super(origin);
}
}
public static class GainFocus extends ElementEvent {
public GainFocus(IGuiElement origin) {
super(origin);
}
}
public static class LoseFocus extends ElementEvent {
public LoseFocus(IGuiElement origin) {
super(origin);
}
}
}
@@ -0,0 +1,19 @@
package forestry.api.gui.events;
import forestry.api.gui.IGuiElement;
public abstract class GuiElementEvent {
private final IGuiElement origin;
public GuiElementEvent(IGuiElement origin) {
this.origin = origin;
}
public final IGuiElement getOrigin() {
return origin;
}
public final boolean isOrigin(IGuiElement element) {
return this.origin == element;
}
}
@@ -0,0 +1,104 @@
package forestry.api.gui.events;
import forestry.api.gui.IGuiElement;
public class GuiEvent extends GuiElementEvent {
private GuiEvent(IGuiElement origin) {
super(origin);
}
public static class KeyEvent extends GuiEvent {
private final char character;
private final int key;
public KeyEvent(IGuiElement origin, char character, int key) {
super(origin);
this.character = character;
this.key = key;
}
public char getCharacter() {
return this.character;
}
public int getKey() {
return this.key;
}
}
public static class ButtonEvent extends GuiEvent {
private final int x;
private final int y;
private final int button;
public ButtonEvent(IGuiElement origin, int x, int y, int button) {
super(origin);
this.x = x;
this.y = y;
this.button = button;
}
public int getX() {
return this.x;
}
public int getY() {
return this.y;
}
public int getButton() {
return this.button;
}
}
public static class DownEvent extends ButtonEvent {
public DownEvent(IGuiElement origin, int x, int y, int button) {
super(origin, x, y, button);
}
}
public static class UpEvent extends ButtonEvent {
public UpEvent(IGuiElement origin, int x, int y, int button) {
super(origin, x, y, button);
}
}
public static class MoveEvent extends GuiEvent {
private final float dx;
private final float dy;
public MoveEvent(IGuiElement origin, float dx, float dy) {
super(origin);
this.dx = dx;
this.dy = dy;
}
public float getDx() {
return this.dx;
}
public float getDy() {
return this.dy;
}
}
public static class DragEvent extends MoveEvent {
public DragEvent(IGuiElement draggedWidget, float dx, float dy) {
super(draggedWidget, dx, dy);
}
}
public static class WheelEvent extends GuiEvent {
private int dWheel;
public WheelEvent(IGuiElement origin, int dWheel) {
super(origin);
this.dWheel = 0;
this.dWheel = dWheel / 28;
}
public int getDWheel() {
return this.dWheel;
}
}
}
@@ -0,0 +1,69 @@
package forestry.api.gui.events;
import forestry.api.gui.IElementGroup;
import forestry.api.gui.IGuiElement;
public enum GuiEventDestination {
//Only the current element
SINGLE{
@Override
public void sendEvent(IGuiElement element, GuiElementEvent event) {
element.receiveEvent(event);
}
},
//Only the origin element
ORIGIN{
@Override
public void sendEvent(IGuiElement element, GuiElementEvent event) {
event.getOrigin().receiveEvent(event);
}
},
//All children elements of the element
CHILDREN{
@Override
public void sendEvent(IGuiElement element, GuiElementEvent event) {
if(!(element instanceof IElementGroup)){
return;
}
for(IGuiElement child : ((IElementGroup) element).getElements()){
child.receiveEvent(event);
}
}
},
//The parent element of the element
PARENT{
@Override
public void sendEvent(IGuiElement element, GuiElementEvent event) {
IGuiElement parent = element.getParent();
if(parent == null){
return;
}
parent.receiveEvent(event);
}
},
//The other children of the parent of the element
SIBLINGS{
@Override
public void sendEvent(IGuiElement element, GuiElementEvent event) {
IGuiElement parent = element.getParent();
if(parent == null){
return;
}
parent.postEvent(event, CHILDREN);
}
},
ALL{
@Override
public void sendEvent(IGuiElement element, GuiElementEvent event) {
element.receiveEvent(event);
if(!(element instanceof IElementGroup)){
return;
}
for(IGuiElement child : ((IElementGroup) element).getElements()){
child.postEvent(event, ALL);
}
}
};
public abstract void sendEvent(IGuiElement element, GuiElementEvent event);
}
@@ -0,0 +1,40 @@
package forestry.api.gui.events;
import javax.annotation.Nullable;
import java.util.function.Consumer;
import forestry.api.gui.IGuiElement;
public final class GuiEventHandler<E extends GuiElementEvent> implements Consumer<E> {
private final Consumer<E> handlerAction;
private final Class<? super E> eventClass;
private final GuiEventOrigin origin;
@Nullable
private final IGuiElement relative;
public GuiEventHandler(Class<? super E> eventClass, Consumer<E> handlerAction) {
this.origin = GuiEventOrigin.ANY;
this.relative = null;
this.eventClass = eventClass;
this.handlerAction = handlerAction;
}
public GuiEventHandler(Class<? super E> eventClass, GuiEventOrigin origin, IGuiElement relative, Consumer<E> handlerAction) {
this.origin = origin;
this.relative = relative;
this.eventClass = eventClass;
this.handlerAction = handlerAction;
}
private boolean canHandle(GuiElementEvent event) {
boolean instance = this.eventClass.isInstance(event);
return instance && this.origin.isOrigin(event.getOrigin(), this.relative);
}
@Override
public final void accept(E e) {
if(canHandle(e)) {
handlerAction.accept(e);
}
}
}
Loaded 100 of 1135 files, more files were not shown because too many files have changed in this diff. Show more