mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-14 01:14:21 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ad9c979d6 | ||
|
|
cd82361a39 | ||
|
|
a502020e47 | ||
|
|
a9a2db67f4 | ||
|
|
5b1250ce8a | ||
|
|
6668392bd7 | ||
|
|
d3a93abb25 | ||
|
|
8a2f686264 | ||
|
|
2eca542f87 | ||
|
|
4421d2ce44 | ||
|
|
78b98f07db | ||
|
|
ad20fa2ffc | ||
|
|
b18c195aa9 | ||
|
|
e2a49158f3 | ||
|
|
235dfca751 | ||
|
|
cb81d0ead4 | ||
|
|
21728bcab1 | ||
|
|
dbdb5478c2 | ||
|
|
46c5b95d82 | ||
|
|
e6547caacc | ||
|
|
f7b1805e95 | ||
|
|
123b47f038 | ||
|
|
c96ab68f19 | ||
|
|
35d6304a96 | ||
|
|
8f69af62f8 | ||
|
|
d2b14b6320 | ||
|
|
65431e73d4 | ||
|
|
fa4a5b0a17 | ||
|
|
714ba830d7 | ||
|
|
ed3cfe12a1 | ||
|
|
d2a9e62cb2 | ||
|
|
cbfb25647a | ||
|
|
6587200dd3 | ||
|
|
b488570a5f | ||
|
|
40a1c94a86 | ||
|
|
79c303b12d | ||
|
|
065d795622 | ||
|
|
2b54db9342 | ||
|
|
8f8e497f58 | ||
|
|
34fda5ddd1 | ||
|
|
ab1a2eeb89 | ||
|
|
5c40de2eba | ||
|
|
b0503fe523 | ||
|
|
3e3c9c30a4 | ||
|
|
1b338efca9 | ||
|
|
ddc9764a23 | ||
|
|
f23e28deaf | ||
|
|
afb9a62686 | ||
|
|
79a49341e9 | ||
|
|
5a93a3d0a9 | ||
|
|
2afb3c52f3 | ||
|
|
cbe86e814f | ||
|
|
c5f2368e1d | ||
|
|
7e4e518d7b | ||
|
|
21aa0c43a6 | ||
|
|
724c3d1fbd | ||
|
|
6c3d7d3bb0 | ||
|
|
afb9460ff9 | ||
|
|
687c440c69 | ||
|
|
1b722df37a | ||
|
|
dcdf4b1cac | ||
|
|
705581b9ac | ||
|
|
2a451bc72e | ||
|
|
faf2b88ed8 | ||
|
|
fcef87b3da | ||
|
|
fcbbd06c63 | ||
|
|
1b3b452900 | ||
|
|
0726954433 | ||
|
|
6ff11f4eea | ||
|
|
03eaa2510c | ||
|
|
a3103bce5e | ||
|
|
a9030ef60b | ||
|
|
4062adee6c | ||
|
|
2ca2cef6a2 | ||
|
|
95dca83465 | ||
|
|
f977a29ad6 | ||
|
|
68ed8a1511 | ||
|
|
c9d3001b47 | ||
|
|
75c875868a | ||
|
|
c51a9273f9 | ||
|
|
4edd2e9d5d | ||
|
|
bc310023df | ||
|
|
703e99e916 | ||
|
|
f73667c173 | ||
|
|
0101eae8f8 | ||
|
|
5be32a2a3a | ||
|
|
3ff4957a10 | ||
|
|
9e1ec59b86 | ||
|
|
0aa9853da2 | ||
|
|
96fe27e834 | ||
|
|
934bb3b8f9 | ||
|
|
83d9da7797 | ||
|
|
1e0d11b1ac | ||
|
|
808b04c3b8 | ||
|
|
2425ae959e | ||
|
|
3679551882 | ||
|
|
83fd00cad5 | ||
|
|
f3d93b47b9 | ||
|
|
62fc457808 | ||
|
|
2811aabc2e | ||
|
|
8573f087eb | ||
|
|
d0215ce0aa | ||
|
|
b6d5901f07 | ||
|
|
18f30c8c0d | ||
|
|
cf8634546c | ||
|
|
864e5e0dfc | ||
|
|
6df4570bca | ||
|
|
e0d23ada41 | ||
|
|
b7b663640d | ||
|
|
9989eef753 | ||
|
|
941c377c58 | ||
|
|
be827a17a7 | ||
|
|
beb1ba9ae1 | ||
|
|
709d80adc6 | ||
|
|
552a907d58 | ||
|
|
e0409c17ba | ||
|
|
b1de19e1f1 | ||
|
|
09754111f0 | ||
|
|
a7da3c5297 | ||
|
|
866e8d0711 | ||
|
|
bbc87beb38 | ||
|
|
d0cb769a2b | ||
|
|
d678903d68 | ||
|
|
140df9ce4e | ||
|
|
db2f4b7360 | ||
|
|
b9dfb8ee31 | ||
|
|
a408df86ed | ||
|
|
564f586c58 | ||
|
|
05308e82c8 | ||
|
|
e9d5c638c7 | ||
|
|
a51bfd196c | ||
|
|
81f632168b | ||
|
|
6ec7808b25 | ||
|
|
f3770bf545 | ||
|
|
2a873e8bfb | ||
|
|
6968ebed3f | ||
|
|
88c7daf024 | ||
|
|
e72bda24e3 | ||
|
|
b3e514355b | ||
|
|
c530745d8e | ||
|
|
c30629eac4 | ||
|
|
10e641506e | ||
|
|
f1df70aeec | ||
|
|
0d35e58106 | ||
|
|
ae1168ea60 | ||
|
|
a91c578829 | ||
|
|
7ac50de818 | ||
|
|
a61b6c9397 | ||
|
|
8ccb633925 | ||
|
|
96a747518e | ||
|
|
31d0a03d3f | ||
|
|
21752a8b28 | ||
|
|
ef371173c9 | ||
|
|
d460bcab77 | ||
|
|
c5d0520299 | ||
|
|
bf40504ddf | ||
|
|
e0ab7a89cc | ||
|
|
24fd7e89d3 | ||
|
|
287b1a5b10 | ||
|
|
81a2268e1d | ||
|
|
7ddd7d976e | ||
|
|
d43d770024 | ||
|
|
876b214a97 | ||
|
|
57eea26c1a | ||
|
|
a5019da906 | ||
|
|
0b3dbe6ef5 | ||
|
|
c4db4fa664 | ||
|
|
99cef245d0 | ||
|
|
97a2b939cf | ||
|
|
3ebb628a56 | ||
|
|
0c64d703d8 | ||
|
|
852c9a9a3e | ||
|
|
87ac2c18a3 | ||
|
|
3aa8fb19c7 | ||
|
|
ab03f3f734 | ||
|
|
9fb03893b2 | ||
|
|
e6b087319c | ||
|
|
aa567e190e | ||
|
|
6907f4159e | ||
|
|
dc2c63c856 | ||
|
|
dde90817d7 | ||
|
|
559ab4176d | ||
|
|
5f234cc94e | ||
|
|
3936c0d377 | ||
|
|
9fae7c1866 | ||
|
|
814b717aaf | ||
|
|
314e632e47 | ||
|
|
e1fbb78c8a | ||
|
|
f85e312c1a | ||
|
|
f4903fc1bc | ||
|
|
248a07e311 | ||
|
|
8f0bdf698a | ||
|
|
218e1c6f8c | ||
|
|
14bedffe0e | ||
|
|
b772f7c305 | ||
|
|
c8be69796f | ||
|
|
41bf3bfdbb | ||
|
|
7a8dfc3012 | ||
|
|
04706d12c8 | ||
|
|
34d57cda35 | ||
|
|
6c3eaca546 | ||
|
|
05648ce05a | ||
|
|
b59f541a10 | ||
|
|
966f4e0693 | ||
|
|
c3809fbc27 | ||
|
|
886c36a308 | ||
|
|
0630d0e0f1 | ||
|
|
2dac035df0 | ||
|
|
b7da877963 | ||
|
|
34a9a90ab3 | ||
|
|
a5e27bfd47 | ||
|
|
60607354dd | ||
|
|
2c45413a6b | ||
|
|
1828ad9f3b | ||
|
|
a1aa3661d5 | ||
|
|
b12d19c9ea | ||
|
|
ac05f9013a | ||
|
|
601e20fe99 | ||
|
|
9e47e018cf | ||
|
|
a97f5a2baa | ||
|
|
14c107ab71 | ||
|
|
3bb678258f | ||
|
|
cc20e2d339 | ||
|
|
f5e52163b4 | ||
|
|
d3b2c99c60 | ||
|
|
fd0783afee | ||
|
|
319bf4ea2c | ||
|
|
d1306b174c | ||
|
|
aa1e797cf7 | ||
|
|
8ba9d8609b | ||
|
|
7964e56c77 | ||
|
|
6d54f6a8a8 | ||
|
|
498fe87e49 | ||
|
|
9fe3d8bbf1 | ||
|
|
4202534e1f | ||
|
|
c5c76f4009 | ||
|
|
3124c00152 | ||
|
|
bb9427367d | ||
|
|
36c0409e5a | ||
|
|
f1640ff21b | ||
|
|
c949131976 | ||
|
|
fa67089c77 | ||
|
|
a17d9015c1 | ||
|
|
892dee2eb0 | ||
|
|
c980cf68b1 | ||
|
|
b84e29a3f0 | ||
|
|
12ade3a559 | ||
|
|
2faa08c1b6 | ||
|
|
11b8fce668 | ||
|
|
1626b6ec03 | ||
|
|
1cbf2ad892 | ||
|
|
c90b134ded | ||
|
|
72567d3706 | ||
|
|
3919edcc3e | ||
|
|
11c40fa158 | ||
|
|
b044244dc6 | ||
|
|
1ea33829b3 | ||
|
|
79af0241e8 | ||
|
|
c6ee1184ff | ||
|
|
2c277cc311 | ||
|
|
d3dd0467d9 | ||
|
|
a0843d9523 | ||
|
|
475f4b63da | ||
|
|
044a8a1984 | ||
|
|
e88822fb3d | ||
|
|
14deee0df7 | ||
|
|
8f77efae6e | ||
|
|
c93a79887f | ||
|
|
490feb915f | ||
|
|
4825f402fc | ||
|
|
cce3b7b901 | ||
|
|
5816af57bc | ||
|
|
bdcefcb5be | ||
|
|
5ecfb694c5 | ||
|
|
e851fb5bc8 | ||
|
|
8654b9d054 | ||
|
|
93419395c3 | ||
|
|
4936316ef3 | ||
|
|
fef0b7ede9 | ||
|
|
2423adae4c | ||
|
|
b8acba968e | ||
|
|
f660f213f6 | ||
|
|
424fdaaf48 | ||
|
|
5310003659 | ||
|
|
e38b8531da | ||
|
|
a5daa93bf1 | ||
|
|
da8a833485 | ||
|
|
16b955b443 | ||
|
|
4140ba7d7f | ||
|
|
23ed2dcaea | ||
|
|
ac9344cbda | ||
|
|
ce5232841a | ||
|
|
f35f247cb4 | ||
|
|
923d3791cd | ||
|
|
cdea827464 | ||
|
|
58c36b3c92 | ||
|
|
49d80c847e | ||
|
|
fff40b966d | ||
|
|
6f42dfdef9 | ||
|
|
f9dc27a063 | ||
|
|
fd77975c6e | ||
|
|
460a7db190 | ||
|
|
9c4b081f6d | ||
|
|
31a305ffc2 | ||
|
|
17f036522e | ||
|
|
1a3b8fae21 | ||
|
|
172afd0574 | ||
|
|
7666e96542 | ||
|
|
1276bd4b18 | ||
|
|
7c048de845 | ||
|
|
163abc377e | ||
|
|
89edfaa7c7 | ||
|
|
159dc804a2 | ||
|
|
d0dffe7edd | ||
|
|
2d459dd953 | ||
|
|
aede7bf7ec | ||
|
|
9fcdc34b5a | ||
|
|
9ba257dec5 | ||
|
|
87cf7386c6 | ||
|
|
b79b279a17 | ||
|
|
1d96c9d349 | ||
|
|
e5f01e82a2 | ||
|
|
25a2752907 | ||
|
|
c195cfaa19 | ||
|
|
427f030110 | ||
|
|
f0d8d6b89d | ||
|
|
192943cb3e | ||
|
|
31d7d6e76e | ||
|
|
b6f91fe870 | ||
|
|
88ad994a8c | ||
|
|
aa8ff6556b | ||
|
|
0f716a0a16 | ||
|
|
3530a0e9df | ||
|
|
a990ce3dc9 | ||
|
|
3ed915f9d5 | ||
|
|
de2dc3dabb | ||
|
|
3059231363 | ||
|
|
154839594d | ||
|
|
c7635db7e8 | ||
|
|
41e847b944 | ||
|
|
125cd54b66 | ||
|
|
56f2be5817 | ||
|
|
e93934fdf8 | ||
|
|
1ad0dcc0ae | ||
|
|
cee31027e6 | ||
|
|
38c1aa5b4b | ||
|
|
bebb663768 | ||
|
|
f288984833 | ||
|
|
9e68539431 | ||
|
|
a903d57103 | ||
|
|
8c9cd7c202 | ||
|
|
8e14eb81a1 | ||
|
|
4b6e3e5424 | ||
|
|
61f7878acc | ||
|
|
307374ca2b | ||
|
|
975309598a | ||
|
|
697ccabf53 | ||
|
|
775b4109a9 | ||
|
|
977d295680 | ||
|
|
21db702ee7 | ||
|
|
cef5f4963f | ||
|
|
1cd3dc1ac8 | ||
|
|
ef722ec0d0 | ||
|
|
c40cdb281f | ||
|
|
7c37c3f126 | ||
|
|
f082500fc0 | ||
|
|
b6191ab4b0 | ||
|
|
91933a738b | ||
|
|
d77daf41d0 | ||
|
|
489ce3dece | ||
|
|
154207f60f | ||
|
|
84d8ad9144 | ||
|
|
6b7b6480c0 | ||
|
|
3bf37f8838 | ||
|
|
5bb4b5d9a5 | ||
|
|
25be7fd254 | ||
|
|
49542b0851 | ||
|
|
09fa488cff | ||
|
|
c201768ffa | ||
|
|
c91a0c601f | ||
|
|
ccb718b84d | ||
|
|
5b4d490e94 | ||
|
|
1982cbc615 | ||
|
|
b356c65a73 | ||
|
|
d7b5954d42 | ||
|
|
fe1c8b77c9 | ||
|
|
8a103a72cc | ||
|
|
5927258a90 | ||
|
|
a300bc0a11 | ||
|
|
7e9a87f08b | ||
|
|
2c8285651f | ||
|
|
df17dccad7 | ||
|
|
fb732b9398 | ||
|
|
2a23e60cdb | ||
|
|
5a64454906 | ||
|
|
d706224e56 | ||
|
|
f993d0571d | ||
|
|
7dba116937 | ||
|
|
0f67d73b30 | ||
|
|
bedfd6e402 | ||
|
|
d4519ffee6 | ||
|
|
5171e33764 | ||
|
|
e00101e0c0 | ||
|
|
9e31a19f34 | ||
|
|
7ce53b0c23 | ||
|
|
62a4efaa53 | ||
|
|
6801529ca5 | ||
|
|
f814808f20 | ||
|
|
9884a13c6e | ||
|
|
57494b1f81 | ||
|
|
3a0c551668 | ||
|
|
9d5144ddea | ||
|
|
eacfa331e3 | ||
|
|
43efa66c20 | ||
|
|
9f04dc7ed0 | ||
|
|
7de922264a | ||
|
|
7e1e92ae2c | ||
|
|
2ed7e79478 | ||
|
|
0caaa095a2 | ||
|
|
0806d2ac38 | ||
|
|
8b1bce6963 | ||
|
|
fd7c73c354 | ||
|
|
4cca08af79 | ||
|
|
59e21d05ef | ||
|
|
ff41a6e83b | ||
|
|
86bde197ec | ||
|
|
8c61cacb57 | ||
|
|
ef6cbb1090 | ||
|
|
2adc2e3562 | ||
|
|
ce2629a9f4 | ||
|
|
a7af5980a1 | ||
|
|
8a2fc188ae | ||
|
|
f27454a73d | ||
|
|
827c260442 | ||
|
|
a4cd13282a | ||
|
|
100784b51b | ||
|
|
b2963069fc | ||
|
|
ca1b4b03b1 | ||
|
|
4e3fb7e0bd | ||
|
|
0806b3b562 | ||
|
|
fc47c969f1 | ||
|
|
3178aa890d | ||
|
|
c6783e573c | ||
|
|
57930991ec | ||
|
|
f96bf5ba5f | ||
|
|
7a90a5cbbf | ||
|
|
dac491c788 | ||
|
|
d06b1d6304 | ||
|
|
507b8fa2d6 | ||
|
|
55c58cf5d9 | ||
|
|
9812ddc4ce | ||
|
|
61d2d5ce30 | ||
|
|
d4cb398ac1 | ||
|
|
885ee83ede | ||
|
|
edf9f0a9d0 | ||
|
|
6a7c4bf67d |
No files matched your search
+9
-6
@@ -1,9 +1,12 @@
|
||||
.gradle
|
||||
# IntelliJ
|
||||
/build
|
||||
/run
|
||||
/out
|
||||
.idea
|
||||
.idea/
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
*.iws
|
||||
|
||||
# folders
|
||||
.gradle/
|
||||
classes/
|
||||
build/
|
||||
run/
|
||||
out/
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
sudo: required
|
||||
dist: trusty
|
||||
|
||||
language: java
|
||||
jdk: oraclejdk8
|
||||
|
||||
before_cache:
|
||||
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
|
||||
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
|
||||
- rm -f $HOME/.gradle/caches/minecraft/deobfedDeps/providedDummy.jar
|
||||
- rm -f $HOME/.gradle/caches/minecraft/deobfedDeps/compileDummy.jar
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.gradle/caches/
|
||||
- $HOME/.gradle/wrapper/
|
||||
|
||||
before_install: chmod +x gradlew
|
||||
install:
|
||||
- ./gradlew setupCIWorkspace -S
|
||||
script:
|
||||
- ./gradlew build
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
@@ -0,0 +1,56 @@
|
||||
[Binnie mods](https://minecraft.curseforge.com/projects/binnies-mods/files)
|
||||
====================================
|
||||
|
||||
### What is it?
|
||||
Binnie’s Mods is a suite of mods designed to expand the [Forestry](https://github.com/ForestryMC/ForestryMC) mod.
|
||||
It both extends the bee and tree breeding aspect by adding many new species with varied products,
|
||||
along with new features such as fully breedable flowers and genetic manipulation.
|
||||
|
||||
### Homepage
|
||||
|
||||
[Wiki](https://binnie.mods.wiki/wiki/Main_Page)
|
||||
|
||||
[Latest Builds for 1.11 / 1.11.2](http://jenkins.ic2.player.to/job/Binnie's%201.11.2/)
|
||||
|
||||
### Mods
|
||||
|
||||
[](https://binnie.mods.wiki/wiki/Extra_Bees)
|
||||
|
||||
Extra Bees expands upon the bee breeding of Forestry by adding 107 new bee species to forestry. These bees cover a large spectrum of different effects and products, giving you the ability to produce everything from dyes to rare metal dusts purely from bees. It also adds the Apiarist Database, a tool to keep track of discovered species, mutations and traits. There are also new alveary components which help improve and streamline bee production.
|
||||
|
||||
|
||||
[](https://binnie.mods.wiki/wiki/Extra_Trees)
|
||||
|
||||
Extra Trees both increases the number of tree species and adds many new aesthetic uses. There are 96 new tree species, such as Banana, Brazil nut and Douglas-fir. This comes with many new fruits as well as 35 new wooden planks. Extra Trees allows these, as well as Forestry and vanilla planks, to be combined to give doors, gates and various designs of fences. The woodworker allows planks to be combined to give patterned tiles, allowing you to build beautiful wooden floors, and the same can be done with stained glass. A group of machines such as the brewery and distillery allow you to use the fruits you grow to make a variety of wines, ciders and spirits.
|
||||
|
||||
|
||||
[](https://binnie.mods.wiki/wiki/Botany)
|
||||
|
||||
Botany adds an entirely new breeding system to Forestry: flowers. There are 46 different species that can be bred, including both vanilla flowers and new ones such as Fuschia and Lilies. The colour of the flowers can be transferred and selectively bred, meaning that each flower can be one of a possible 80 different colours. These new flowers can be bred manually in small gardens using a trowel and fertiliser, with careful care taken to maintain the desired pH or moisture, or grown on the large scale in Forestry farms.
|
||||
|
||||
[](https://binnie.mods.wiki/wiki/Genetics)
|
||||
|
||||
Genetics is for those who want to eschew conventional breeding, and want to enter the realm of genetic manipulation. Here, genes can be isolated, sequenced and then inoculated back into different species, making it easier to obtain the perfect genome. Bees, trees, butterflies and flowers can all be manipulated in this way. They can also be acclimatised to different environments to build tolerance to hostile climates.
|
||||
|
||||
[](https://binnie.mods.wiki/wiki/Binnie_Core)
|
||||
|
||||
Binnie Core is a mod which contains a lot of the core functionality such as networking and GUI's for the other mods. The only in game features it currently contains are the Compartments
|
||||
|
||||
|
||||
### Building
|
||||
|
||||
The master branch will always contain the latest released version with possibly some bug fixes for that version that will eventually be released.
|
||||
New versions will be created in branched named like {mc_version}-{mod_version}
|
||||
|
||||
#### IntelliJ IDEA
|
||||
|
||||
1. Execute the following gradle command to setup your workspace and create the necessary idea project files:
|
||||
|
||||
```
|
||||
./gradlew setupDecompWorkspace idea genIntellijRuns
|
||||
```
|
||||
|
||||
2. Open the `Binnie*.ipr` project file using IntelliJ IDEA
|
||||
|
||||
3. Select `Minecraft Client` from _Run configurations_ and press the green play button.
|
||||
Minecraft should now launch with Binnie and all of its dependencies loaded :)
|
||||
@@ -0,0 +1,10 @@
|
||||
archivesBaseName = 'all-' + mcversion
|
||||
|
||||
dependencies {
|
||||
compile project(":api")
|
||||
compile project(":botany")
|
||||
compile project(":core")
|
||||
compile project(":extrabees")
|
||||
compile project(":extratrees")
|
||||
compile project(":genetics")
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
archivesBaseName = 'api-' + mcversion
|
||||
@@ -0,0 +1,22 @@
|
||||
package binnie.botany.api;
|
||||
|
||||
import binnie.botany.api.gardening.IGardeningManager;
|
||||
import binnie.botany.api.genetics.IFlowerFactory;
|
||||
import binnie.botany.api.genetics.IFlowerRoot;
|
||||
|
||||
public class BotanyAPI {
|
||||
/**
|
||||
* Convenient access to AlleleManager.alleleRegistry.getSpeciesRoot("rootFlowers")
|
||||
*/
|
||||
public static IFlowerRoot flowerRoot;
|
||||
|
||||
/**
|
||||
* Used to create new flowers.
|
||||
*/
|
||||
public static IFlowerFactory flowerFactory;
|
||||
|
||||
/**
|
||||
* Used to manager soil.
|
||||
*/
|
||||
public static IGardeningManager gardening;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package binnie.botany.api.gardening;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
|
||||
public enum EnumAcidity implements IStringSerializable {
|
||||
ACID(TextFormatting.RED),
|
||||
NEUTRAL(null),
|
||||
ALKALINE(TextFormatting.AQUA);
|
||||
|
||||
@Nullable
|
||||
TextFormatting color;
|
||||
|
||||
EnumAcidity(@Nullable TextFormatting color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase();
|
||||
}
|
||||
|
||||
public String getLocalisedName(boolean withColor) {
|
||||
String localisedName = I18n.translateToLocal("botany.ph." + getName());
|
||||
if (withColor && color != null) {
|
||||
localisedName = color + localisedName;
|
||||
}
|
||||
return localisedName;
|
||||
}
|
||||
|
||||
public static EnumAcidity getFromValue(float rawAcidity) {
|
||||
if(rawAcidity <= -1.0f){
|
||||
return EnumAcidity.ACID;
|
||||
}else if(rawAcidity >= 1.0f){
|
||||
return EnumAcidity.ALKALINE;
|
||||
}else{
|
||||
return EnumAcidity.NEUTRAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package binnie.botany.api.gardening;
|
||||
|
||||
public enum EnumFertiliserType {
|
||||
ACID, ALKALINE, NUTRIENT
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package binnie.botany.api.gardening;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
|
||||
public enum EnumMoisture implements IStringSerializable {
|
||||
DRY(TextFormatting.YELLOW),
|
||||
NORMAL(null),
|
||||
DAMP(TextFormatting.DARK_BLUE);
|
||||
|
||||
@Nullable
|
||||
final TextFormatting color;
|
||||
|
||||
EnumMoisture(@Nullable TextFormatting color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase();
|
||||
}
|
||||
|
||||
public String getLocalisedName(boolean withColor) {
|
||||
String localisedName = I18n.translateToLocal("botany.moisture." + getName());
|
||||
if (withColor && color != null) {
|
||||
localisedName = color + localisedName + TextFormatting.GRAY;
|
||||
}
|
||||
return localisedName;
|
||||
}
|
||||
|
||||
public static EnumMoisture getFromValue(float rawMoisture) {
|
||||
if(rawMoisture <= -1.0f){
|
||||
return EnumMoisture.DRY;
|
||||
}else if(rawMoisture >= 1.0f){
|
||||
return EnumMoisture.DAMP;
|
||||
}else{
|
||||
return EnumMoisture.NORMAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package binnie.botany.api.gardening;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
|
||||
public enum EnumSoilType implements IStringSerializable {
|
||||
SOIL(TextFormatting.DARK_GRAY),
|
||||
LOAM(TextFormatting.GOLD),
|
||||
FLOWERBED(TextFormatting.LIGHT_PURPLE);
|
||||
|
||||
private final TextFormatting color;
|
||||
|
||||
EnumSoilType(TextFormatting color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
public String getTranslated() {
|
||||
return color + I18n.translateToLocal("botany.soil." + getName());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package binnie.botany.api.gardening;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IBlockSoil {
|
||||
EnumAcidity getPH(World world, BlockPos pos);
|
||||
|
||||
EnumMoisture getMoisture(World world, BlockPos pos);
|
||||
|
||||
EnumSoilType getType(World world, BlockPos pos);
|
||||
|
||||
boolean fertilise(World world, BlockPos pos, EnumSoilType soilType);
|
||||
|
||||
boolean degrade(World world, BlockPos pos, EnumSoilType soilType);
|
||||
|
||||
boolean setPH(World world, BlockPos pos, EnumAcidity acidity);
|
||||
|
||||
boolean setMoisture(World world, BlockPos pos, EnumMoisture moisture);
|
||||
|
||||
boolean resistsWeeds(World world, BlockPos pos);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package binnie.botany.api.gardening;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.core.EnumTemperature;
|
||||
|
||||
import binnie.botany.api.genetics.IFlower;
|
||||
|
||||
public interface IGardeningManager {
|
||||
default boolean isSoil(Block block) {
|
||||
return block instanceof IBlockSoil;
|
||||
}
|
||||
|
||||
boolean isSoil(Item item);
|
||||
|
||||
boolean isSoil(ItemStack item);
|
||||
|
||||
EnumMoisture getNaturalMoisture(World world, BlockPos pos);
|
||||
|
||||
EnumAcidity getNaturalPH(World world, BlockPos pos);
|
||||
|
||||
float getBiomeMoisture(World world, BlockPos pos);
|
||||
|
||||
float getBiomePH(World world, BlockPos pos);
|
||||
|
||||
IBlockState getSoil(EnumSoilType soil, boolean weedKill, EnumMoisture moisture, EnumAcidity acidity);
|
||||
|
||||
void plantSoil(World world, BlockPos pos, EnumSoilType soil, EnumMoisture moisture, EnumAcidity acidity);
|
||||
|
||||
Collection<ItemStack> getFertilisers(EnumFertiliserType type);
|
||||
|
||||
Map<EnumFertiliserType, Map<ItemStack, Integer>> getFertilisers();
|
||||
|
||||
void registerFertiliser(EnumFertiliserType type, ItemStack stack, int strength);
|
||||
|
||||
boolean isFertiliser(EnumFertiliserType type, ItemStack stack);
|
||||
|
||||
int getFertiliserStrength(ItemStack stack);
|
||||
|
||||
boolean canTolerate(@Nullable IFlower flower, World world, BlockPos pos);
|
||||
|
||||
EnumSoilType getSoilType(World world, BlockPos pos);
|
||||
|
||||
default Block getSoilBlock(EnumSoilType type) {
|
||||
return getSoilBlock(type, false);
|
||||
}
|
||||
|
||||
Block getSoilBlock(EnumSoilType type, boolean weedKill);
|
||||
|
||||
boolean canTolerate(IFlower flower, EnumAcidity acidity, EnumMoisture moisture, EnumTemperature temperature);
|
||||
|
||||
boolean isWeedkiller(ItemStack heldItem);
|
||||
|
||||
boolean addWeedKiller(World world, BlockPos pos);
|
||||
|
||||
boolean onFertiliseSoil(ItemStack heldItem, IBlockSoil soil, World world, BlockPos pos, EntityPlayer player);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package binnie.botany.api.gardening;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -0,0 +1,75 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
|
||||
// TODO: move out of API
|
||||
public class AlleleFlowerColor implements IAlleleFlowerColor {
|
||||
private int color;
|
||||
private String uid;
|
||||
private boolean isDominant;
|
||||
private String name;
|
||||
private String unlocalizedName;
|
||||
private int colorDis;
|
||||
private int id;
|
||||
|
||||
public AlleleFlowerColor(String uid, int id, int color, int colorDis, String name, String unlocalizedName, boolean isDominant) {
|
||||
this.color = color;
|
||||
this.uid = uid;
|
||||
this.isDominant = isDominant;
|
||||
this.name = name;
|
||||
this.unlocalizedName = unlocalizedName;
|
||||
this.colorDis = colorDis;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getValue() {
|
||||
return color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUID() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDominant() {
|
||||
return isDominant;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAlleleName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return unlocalizedName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor(boolean dis) {
|
||||
return dis ? colorDis : color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAlleleInteger getAllele() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColorName() {
|
||||
return I18n.translateToLocal("botany.color." + getAlleleName());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
public final class ColorMix implements IColorMix {
|
||||
private final IFlowerColor colorFirst;
|
||||
private final IFlowerColor colorSecond;
|
||||
private final IFlowerColor result;
|
||||
private final int chance;
|
||||
|
||||
public ColorMix(IFlowerColor colorFirst, IFlowerColor colorSecond, IFlowerColor result, int chance) {
|
||||
this.colorFirst = colorFirst;
|
||||
this.colorSecond = colorSecond;
|
||||
this.result = result;
|
||||
this.chance = chance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerColor getColorFirst() {
|
||||
return colorFirst;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerColor getColorSecond() {
|
||||
return colorSecond;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMutation(IFlowerColor colorFirst, IFlowerColor colorSecond) {
|
||||
return (colorFirst == this.colorFirst && colorSecond == this.colorSecond) || (colorFirst == this.colorSecond && colorSecond == this.colorFirst);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChance() {
|
||||
return chance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFlowerColor getResult() {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
+11
-14
@@ -1,20 +1,17 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
package binnie.botany.api;
|
||||
import java.util.Locale;
|
||||
|
||||
import forestry.api.genetics.IAlleleFloat;
|
||||
import forestry.api.genetics.IAlleleTolerance;
|
||||
import forestry.api.genetics.IAlleleArea;
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleArea;
|
||||
import forestry.api.genetics.IAlleleFloat;
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
import forestry.api.genetics.IAlleleTolerance;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
public enum EnumFlowerChromosome implements IChromosomeType
|
||||
{
|
||||
public enum EnumFlowerChromosome implements IChromosomeType {
|
||||
SPECIES(IAlleleFlowerSpecies.class),
|
||||
PRIMARY(IAlleleInteger.class),
|
||||
SECONDARY(IAlleleInteger.class),
|
||||
@@ -30,18 +27,18 @@ public enum EnumFlowerChromosome implements IChromosomeType
|
||||
|
||||
private Class<? extends IAllele> cls;
|
||||
|
||||
private EnumFlowerChromosome(final Class<? extends IAllele> cls) {
|
||||
EnumFlowerChromosome(Class<? extends IAllele> cls) {
|
||||
this.cls = cls;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IAllele> getAlleleClass() {
|
||||
return this.cls;
|
||||
return cls;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.toString().toLowerCase();
|
||||
return toString().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
@Override
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,29 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.genetics.ISpeciesType;
|
||||
|
||||
public enum EnumFlowerStage implements ISpeciesType {
|
||||
FLOWER("Flower"),
|
||||
SEED("Seed"),
|
||||
POLLEN("Pollen");
|
||||
|
||||
public static final EnumFlowerStage[] VALUES = values();
|
||||
String name;
|
||||
|
||||
EnumFlowerStage(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static EnumFlowerStage getStage(IFlower flower) {
|
||||
return getStage(flower.getAge());
|
||||
}
|
||||
|
||||
public static EnumFlowerStage getStage(int age) {
|
||||
return age == 0 ? EnumFlowerStage.SEED : EnumFlowerStage.FLOWER;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
|
||||
public interface IAlleleFlowerColor extends IFlowerColor, IAlleleInteger {
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.genetics.IAlleleEffect;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
|
||||
public interface IAlleleFlowerEffect extends IAlleleEffect {
|
||||
IEffectData doEffect(IFlowerGenome genome, IEffectData effect, World world, int x, int y, int z);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.genetics.IAlleleProperty;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
|
||||
import binnie.botany.api.gardening.EnumAcidity;
|
||||
import binnie.botany.api.gardening.EnumMoisture;
|
||||
|
||||
public interface IAlleleFlowerSpecies extends IAlleleSpecies, IAlleleProperty<IAlleleFlowerSpecies> {
|
||||
IFlowerType getType();
|
||||
|
||||
EnumAcidity getPH();
|
||||
|
||||
EnumMoisture getMoisture();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
int getFlowerColor(EnumFlowerStage type, int renderPass);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
ModelResourceLocation getFlowerModel(EnumFlowerStage type, boolean flowered);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void registerModels(Item item, IModelManager manager, EnumFlowerStage type);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.genetics.IAlleleSpeciesBuilder;
|
||||
|
||||
import binnie.botany.api.gardening.EnumAcidity;
|
||||
import binnie.botany.api.gardening.EnumMoisture;
|
||||
|
||||
public interface IAlleleFlowerSpeciesBuilder extends IAlleleSpeciesBuilder {
|
||||
@Override
|
||||
IAlleleFlowerSpecies build();
|
||||
|
||||
IAlleleFlowerSpeciesBuilder setPH(EnumAcidity acidity);
|
||||
|
||||
IAlleleFlowerSpeciesBuilder setMoisture(EnumMoisture moisture);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
|
||||
public interface IBotanistTracker extends IBreedingTracker {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
public interface IColorMix {
|
||||
IFlowerColor getColorFirst();
|
||||
|
||||
IFlowerColor getColorSecond();
|
||||
|
||||
boolean isMutation(IFlowerColor colorFirst, IFlowerColor colorSecond);
|
||||
|
||||
int getChance();
|
||||
|
||||
IFlowerColor getResult();
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.genetics.IIndividual;
|
||||
|
||||
public interface IFlower extends IIndividual {
|
||||
/**
|
||||
* @return Flowers's genetic information.
|
||||
*/
|
||||
@Override
|
||||
IFlowerGenome getGenome();
|
||||
|
||||
/**
|
||||
* @return Genetic information of the flower's mate, null if unmated.
|
||||
*/
|
||||
@Nullable
|
||||
IFlowerGenome getMate();
|
||||
|
||||
/**
|
||||
* Mate with the given flower.
|
||||
*
|
||||
* @param flower the {@link IFlower} to mate this one with.
|
||||
*/
|
||||
void mate(IFlower flower);
|
||||
|
||||
/**
|
||||
* Remove the mate of the flower.
|
||||
*/
|
||||
void removeMate();
|
||||
|
||||
IFlower getOffspring(World world, BlockPos pos);
|
||||
|
||||
/**
|
||||
* @return The current age of the flower.
|
||||
*/
|
||||
int getAge();
|
||||
|
||||
/**
|
||||
* Set the current age of the flower.
|
||||
*/
|
||||
void setAge(int age);
|
||||
|
||||
/**
|
||||
* Age the flower.
|
||||
*/
|
||||
void age();
|
||||
|
||||
/**
|
||||
* @return Maximum age of the flower.
|
||||
*/
|
||||
int getMaxAge();
|
||||
|
||||
/**
|
||||
* @return true if the flower is wilted.
|
||||
*/
|
||||
boolean isWilted();
|
||||
|
||||
/**
|
||||
* Set that the flower is wilted.
|
||||
*/
|
||||
void setWilted(boolean wilted);
|
||||
|
||||
/**
|
||||
* @return true if the flower has flowered.
|
||||
*/
|
||||
boolean hasFlowered();
|
||||
|
||||
/**
|
||||
* Set that the flower has flowered.
|
||||
*/
|
||||
void setFlowered(boolean flowered);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
|
||||
public interface IFlowerColor {
|
||||
int getColor(boolean dis);
|
||||
|
||||
IAlleleInteger getAllele();
|
||||
|
||||
int getID();
|
||||
|
||||
String getColorName();
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.core.genetics.IGeneticDefinition;
|
||||
|
||||
public interface IFlowerDefinition extends IGeneticDefinition {
|
||||
@Override
|
||||
IFlowerGenome getGenome();
|
||||
|
||||
@Override
|
||||
IFlower getIndividual();
|
||||
|
||||
ItemStack getMemberStack(EnumFlowerStage flowerStage);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IClassification;
|
||||
|
||||
public interface IFlowerFactory {
|
||||
IAlleleFlowerSpeciesBuilder createSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean isDominant, IClassification branch, String binomial, IFlowerType flowerType);
|
||||
|
||||
IFlowerMutationBuilder createMutation(IAlleleFlowerSpecies allele0, IAlleleFlowerSpecies allele1, IAllele[] result, int chance);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
import forestry.api.genetics.IGenome;
|
||||
|
||||
import binnie.botany.api.gardening.EnumAcidity;
|
||||
import binnie.botany.api.gardening.EnumMoisture;
|
||||
|
||||
public interface IFlowerGenome extends IGenome {
|
||||
@Override
|
||||
IAlleleFlowerSpecies getPrimary();
|
||||
|
||||
@Override
|
||||
IAlleleFlowerSpecies getSecondary();
|
||||
|
||||
IFlowerColor getPrimaryColor();
|
||||
|
||||
IFlowerColor getSecondaryColor();
|
||||
|
||||
IFlowerColor getStemColor();
|
||||
|
||||
int getFertility();
|
||||
|
||||
int getLifespan();
|
||||
|
||||
IFlowerType getType();
|
||||
|
||||
EnumTolerance getToleranceTemperature();
|
||||
|
||||
EnumTolerance getToleranceMoisture();
|
||||
|
||||
EnumTolerance getTolerancePH();
|
||||
|
||||
float getAgeChance();
|
||||
|
||||
float getSappiness();
|
||||
|
||||
boolean canTolerate(EnumAcidity acidity);
|
||||
|
||||
boolean canTolerate(EnumMoisture moisture);
|
||||
|
||||
boolean canTolerate(EnumTemperature temperature);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.genetics.IMutation;
|
||||
|
||||
public interface IFlowerMutation extends IMutation {
|
||||
@Override
|
||||
IFlowerRoot getRoot();
|
||||
|
||||
float getChance(World world, BlockPos pos, IAlleleFlowerSpecies allele0, IAlleleFlowerSpecies allele1, IFlowerGenome genome0, IFlowerGenome genome1);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import forestry.api.genetics.IMutationBuilder;
|
||||
|
||||
public interface IFlowerMutationBuilder extends IMutationBuilder {
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
public interface IFlowerRoot extends ISpeciesRoot {
|
||||
@Override
|
||||
@Nullable
|
||||
IFlower getMember(ItemStack memberStack);
|
||||
|
||||
@Override
|
||||
IFlower templateAsIndividual(IAllele[] template);
|
||||
|
||||
@Override
|
||||
IFlower templateAsIndividual(IAllele[] templateFirst, IAllele[] templateSecond);
|
||||
|
||||
@Override
|
||||
IFlowerGenome templateAsGenome(IAllele[] template);
|
||||
|
||||
@Override
|
||||
IFlowerGenome templateAsGenome(IAllele[] templateActive, IAllele[] templateInactive);
|
||||
|
||||
@Override
|
||||
IBotanistTracker getBreedingTracker(World world, @Nullable GameProfile profile);
|
||||
|
||||
@Override
|
||||
List<? extends IFlowerMutation> getMutations(boolean shuffle);
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
EnumFlowerStage getType(ItemStack itemStack);
|
||||
|
||||
IFlower getFlower(IFlowerGenome genome);
|
||||
|
||||
void addConversion(ItemStack memberStack, IAllele[] template);
|
||||
|
||||
@Nullable
|
||||
IFlower getConversion(ItemStack memberStack);
|
||||
|
||||
Collection<IColorMix> getColorMixes(boolean shuffle);
|
||||
|
||||
void registerColourMix(IColorMix colorMix);
|
||||
|
||||
boolean plant(World world, BlockPos pos, IFlower flower, GameProfile owner);
|
||||
|
||||
void tryGrowSection(World world, BlockPos pos);
|
||||
|
||||
void onGrowFromSeed(World world, BlockPos pos);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IModelManager;
|
||||
|
||||
public interface IFlowerType<I extends IFlowerType<I>> extends Comparable<I> {
|
||||
@SideOnly(Side.CLIENT)
|
||||
void registerModels(Item item, IModelManager manager, EnumFlowerStage type);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
ModelResourceLocation getModel(EnumFlowerStage type, boolean flowered);
|
||||
|
||||
String getName();
|
||||
|
||||
int getSections();
|
||||
|
||||
int ordinal();
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package binnie.botany.api.genetics;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -0,0 +1,7 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package binnie.botany.api;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -0,0 +1,10 @@
|
||||
package binnie.core.api;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public interface IBinnieRecipe {
|
||||
|
||||
Collection<Object> getInputs();
|
||||
|
||||
Collection<Object> getOutputs();
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package binnie.core.api;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public interface ICraftingManager<T extends IBinnieRecipe> {
|
||||
/**
|
||||
* Add a new recipe to the crafting provider.
|
||||
*
|
||||
* @return <tt>true</tt> if this collection changed as a result of the call
|
||||
*/
|
||||
boolean addRecipe(T recipe);
|
||||
|
||||
/**
|
||||
* Remove a specific recipe from the crafting provider.
|
||||
*
|
||||
* @return <tt>true</tt> if an element was removed as a result of this call
|
||||
*/
|
||||
boolean removeRecipe(T recipe);
|
||||
|
||||
/**
|
||||
* @return an unmodifiable collection of all recipes registered to the crafting provider.
|
||||
*/
|
||||
Collection<T> recipes();
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package binnie.core.api.block;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
// TODO: move out of API
|
||||
public class BlockMetadata extends BlockContainer implements IBlockMetadata {
|
||||
public BlockMetadata(final Material material) {
|
||||
super(material);
|
||||
}
|
||||
|
||||
public static ItemStack getBlockDropped(IBlockMetadata block, IBlockAccess world, BlockPos pos) {
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, pos);
|
||||
if (tile != null && !tile.hasDroppedBlock()) {
|
||||
int meta = block.getDroppedMeta(world.getBlockState(pos), tile.getTileMetadata());
|
||||
return TileEntityMetadata.getItemStack((Block) block, meta);
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
public static void getDrops(NonNullList<ItemStack> drops, IBlockMetadata block, IBlockAccess world, BlockPos pos) {
|
||||
ItemStack drop = getBlockDropped(block, world, pos);
|
||||
if (!drop.isEmpty()) {
|
||||
drops.add(drop);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean breakBlock(IBlockMetadata blockMetadata, @Nullable EntityPlayer player, World world, BlockPos pos) {
|
||||
List<ItemStack> drops = new ArrayList<>();
|
||||
Block block = (Block) blockMetadata;
|
||||
TileEntityMetadata tile = TileEntityMetadata.getTile(world, pos);
|
||||
if (tile != null && !tile.hasDroppedBlock()) {
|
||||
drops = block.getDrops(world, pos, world.getBlockState(pos), 0);
|
||||
}
|
||||
boolean hasBeenBroken = world.setBlockToAir(pos);
|
||||
if (hasBeenBroken && !world.isRemote && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
for (ItemStack drop : drops) {
|
||||
spawnAsEntity(world, pos, drop);
|
||||
}
|
||||
if (tile != null) {
|
||||
tile.dropBlock();
|
||||
}
|
||||
}
|
||||
return hasBeenBroken;
|
||||
}
|
||||
|
||||
public static ItemStack getPickBlock(World world, BlockPos pos) {
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
return getBlockDropped((IBlockMetadata) block, world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
getDrops(drops, this, world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
|
||||
return breakBlock(this, player, world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(final World var1, final int i) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||
return getPickBlock(world, pos);
|
||||
}
|
||||
|
||||
/* IBLOCKMETADATA */
|
||||
@Override
|
||||
public String getDisplayName(final ItemStack itemStack) {
|
||||
return this.getLocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlacedMeta(final ItemStack item, final World world, final BlockPos pos, final EnumFacing clickedBlock) {
|
||||
return TileEntityMetadata.getItemDamage(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDroppedMeta(IBlockState state, int tileMetadata) {
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package binnie.core.api.block;
|
||||
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
// TODO: move out of API
|
||||
public interface IBlockMetadata extends ITileEntityProvider {
|
||||
int getPlacedMeta(ItemStack itemStack, World world, BlockPos pos, EnumFacing facing);
|
||||
|
||||
int getDroppedMeta(IBlockState state, int tileMetadata);
|
||||
|
||||
String getDisplayName(ItemStack itemStack);
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package binnie.core.api.block;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
// TODO: move out of API
|
||||
public class TileEntityMetadata extends TileEntity {
|
||||
private int meta;
|
||||
private boolean droppedBlock;
|
||||
|
||||
public TileEntityMetadata() {
|
||||
this.droppedBlock = false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static TileEntityMetadata getTile(final IBlockAccess world, final BlockPos pos) {
|
||||
final TileEntity tile = world.getTileEntity(pos);
|
||||
if (!(tile instanceof TileEntityMetadata)) {
|
||||
return null;
|
||||
}
|
||||
return (TileEntityMetadata) tile;
|
||||
}
|
||||
|
||||
public static ItemStack getItemStack(final Block block, final int damage) {
|
||||
final Item item = Item.getItemFromBlock(block);
|
||||
Preconditions.checkNotNull(item, "Could not get item for block %s", block);
|
||||
final ItemStack itemStack = new ItemStack(item, 1, 0);
|
||||
setItemDamage(itemStack, damage);
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public static void setItemDamage(final ItemStack item, final int i) {
|
||||
item.setItemDamage((i < 16387) ? i : 16387);
|
||||
final NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setInteger("meta", i);
|
||||
item.setTagCompound(tag);
|
||||
}
|
||||
|
||||
public static int getItemDamage(final ItemStack item) {
|
||||
if (item.hasTagCompound() && item.getTagCompound().hasKey("meta")) {
|
||||
return item.getTagCompound().getInteger("meta");
|
||||
}
|
||||
return item.getItemDamage();
|
||||
}
|
||||
|
||||
public static int getTileMetadata(final IBlockAccess world, final BlockPos pos) {
|
||||
final TileEntityMetadata tile = getTile(world, pos);
|
||||
return (tile == null) ? 0 : tile.getTileMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean receiveClientEvent(final int id, final int type) {
|
||||
if (id == 42) {
|
||||
this.meta = type;
|
||||
markDirty();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getUpdateTag() {
|
||||
return writeToNBT(new NBTTagCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
if(world!=null)
|
||||
setTileMetadata(nbt.getInteger("meta"), world.isRemote);
|
||||
else
|
||||
this.meta = nbt.getInteger("meta");
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(final NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setInteger("meta", this.meta);
|
||||
return nbt;
|
||||
}
|
||||
|
||||
public int getTileMetadata() {
|
||||
return this.meta;
|
||||
}
|
||||
|
||||
public void setTileMetadata(final int meta, final boolean notify) {
|
||||
if (this.meta != meta) {
|
||||
this.meta = meta;
|
||||
if (notify) {
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
world.notifyBlockUpdate(pos, state, state, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) {
|
||||
super.onDataPacket(net, pkt);
|
||||
readFromNBT(pkt.getNbtCompound());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SPacketUpdateTileEntity getUpdatePacket() {
|
||||
return new SPacketUpdateTileEntity(pos, 0, getUpdateTag());
|
||||
}
|
||||
|
||||
public boolean hasDroppedBlock() {
|
||||
return this.droppedBlock;
|
||||
}
|
||||
|
||||
public void dropBlock() {
|
||||
this.droppedBlock = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
package binnie.core.api.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.core.ForestryEvent;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.IClassification;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.genetics.ISpeciesType;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public interface IBreedingSystem {
|
||||
ISpeciesRoot getSpeciesRoot();
|
||||
|
||||
Collection<IAlleleSpecies> getAllSpecies();
|
||||
|
||||
Collection<IAlleleSpecies> getDiscoveredSpecies(World world, GameProfile player);
|
||||
|
||||
List<IClassification> getAllBranches();
|
||||
|
||||
Collection<IClassification> getDiscoveredBranches(World world, GameProfile player);
|
||||
|
||||
List<IMutation> getDiscoveredMutations(World world, GameProfile player);
|
||||
|
||||
List<IMutation> getResultantMutations(final IAlleleSpecies species);
|
||||
|
||||
List<IMutation> getFurtherMutations(final IAlleleSpecies species);
|
||||
|
||||
boolean isMutationDiscovered(IMutation mutation, World world, GameProfile name);
|
||||
|
||||
float getChance(IMutation mutation, EntityPlayer player, IAlleleSpecies firstSpecies, IAlleleSpecies secondSpecies);
|
||||
|
||||
String getAlleleName(final IChromosomeType chromosome, final IAllele allele);
|
||||
|
||||
String getChromosomeName(final IChromosomeType chromo);
|
||||
|
||||
String getChromosomeShortName(final IChromosomeType chromo);
|
||||
|
||||
@Nullable
|
||||
IIndividual getConversion(final ItemStack stack);
|
||||
|
||||
ItemStack getConversionStack(final ItemStack stack);
|
||||
|
||||
@Nullable
|
||||
IIndividual getIndividual(String uid);
|
||||
|
||||
void calculateArrays();
|
||||
|
||||
void addExtraAlleles(final IChromosomeType p0, final TreeSet<IAllele> p1);
|
||||
|
||||
String getDescriptor();
|
||||
|
||||
String getIdent();
|
||||
|
||||
ItemStack getItemStackRepresentitive();
|
||||
|
||||
int getColour();
|
||||
|
||||
int getDiscoveredSpeciesCount();
|
||||
|
||||
int getTotalSpeciesCount();
|
||||
|
||||
float getDiscoveredSpeciesPercentage();
|
||||
|
||||
int getTotalSecretCount();
|
||||
|
||||
int getDiscoveredSecretCount();
|
||||
|
||||
float getDiscoveredBranchPercentage();
|
||||
|
||||
int getTotalBranchCount();
|
||||
|
||||
int getDiscoveredBranchCount();
|
||||
|
||||
String getEpitome();
|
||||
|
||||
String getEpitome(float discoveredPercentage);
|
||||
|
||||
Collection<IMutation> getAllMutations();
|
||||
|
||||
void calculateAlleles(ISpeciesRoot speciesRoot);
|
||||
|
||||
void calculateBranches(ISpeciesRoot speciesRoot);
|
||||
|
||||
void calculateMutations(ISpeciesRoot speciesRoot);
|
||||
|
||||
boolean isBlacklisted(IAllele allele);
|
||||
|
||||
boolean isMutationDiscovered(IMutation mutation, IBreedingTracker tracker);
|
||||
|
||||
boolean isSpeciesDiscovered(IAlleleSpecies species, World world, GameProfile name);
|
||||
|
||||
boolean isSpeciesDiscovered(IAlleleSpecies species, IBreedingTracker tracker);
|
||||
|
||||
boolean isSecret(IAlleleSpecies species);
|
||||
|
||||
boolean isSecret(IClassification branch);
|
||||
|
||||
Collection<IClassification> getDiscoveredBranches(IBreedingTracker tracker);
|
||||
|
||||
Collection<IAlleleSpecies> getDiscoveredSpecies(IBreedingTracker tracker);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
TextureAtlasSprite getUndiscoveredIcon();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
TextureAtlasSprite getDiscoveredIcon();
|
||||
|
||||
Class<? extends IBreedingTracker> getTrackerClass();
|
||||
|
||||
@SubscribeEvent
|
||||
void onSyncBreedingTracker(ForestryEvent.SyncedBreedingTracker event);
|
||||
|
||||
void syncTracker(IBreedingTracker tracker);
|
||||
|
||||
void onSyncBreedingTracker(IBreedingTracker tracker);
|
||||
|
||||
String getName();
|
||||
|
||||
boolean isDNAManipulable(ItemStack stack);
|
||||
|
||||
boolean isDNAManipulable(ISpeciesType type);
|
||||
|
||||
IIndividual getDefaultIndividual();
|
||||
|
||||
ISpeciesType getDefaultType();
|
||||
|
||||
ISpeciesType[] getActiveTypes();
|
||||
|
||||
Collection<IChromosomeType> getActiveKaryotype();
|
||||
|
||||
ItemStack getDefaultMember(String uid);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package binnie.core.api;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -0,0 +1,7 @@
|
||||
package binnie.extrabees.api;
|
||||
|
||||
import binnie.core.api.genetics.IBreedingSystem;
|
||||
|
||||
public class ExtraBeesAPI {
|
||||
public static IBreedingSystem beeBreedingSystem;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package binnie.extratrees.api;
|
||||
|
||||
public class CarpentryManager {
|
||||
public static ICarpentryInterface carpentryInterface;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package binnie.extratrees.api;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface ICarpentryInterface {
|
||||
boolean registerCarpentryWood(final int index, final IDesignMaterial material);
|
||||
|
||||
int getCarpentryWoodIndex(final IDesignMaterial material);
|
||||
|
||||
IDesignMaterial getWoodMaterial(final int p0);
|
||||
|
||||
boolean registerDesign(final int p0, final IDesign p1);
|
||||
|
||||
int getDesignIndex(final IDesign p0);
|
||||
|
||||
IDesign getDesign(final int p0);
|
||||
|
||||
@Nullable
|
||||
IDesignMaterial getWoodMaterial(final ItemStack stack);
|
||||
|
||||
boolean registerDesignCategory(final IDesignCategory p0);
|
||||
|
||||
Collection<IDesignCategory> getAllDesignCategories();
|
||||
|
||||
List<IDesign> getSortedDesigns();
|
||||
}
|
||||
+1
-6
@@ -1,11 +1,6 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extratrees.api;
|
||||
|
||||
public interface IDesign
|
||||
{
|
||||
public interface IDesign {
|
||||
String getName();
|
||||
|
||||
ILayout getTopPattern();
|
||||
@@ -0,0 +1,13 @@
|
||||
package binnie.extratrees.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IDesignCategory {
|
||||
String getName();
|
||||
|
||||
List<IDesign> getDesigns();
|
||||
|
||||
void addDesign(final IDesign p0);
|
||||
|
||||
String getId();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package binnie.extratrees.api;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IDesignMaterial {
|
||||
ItemStack getStack();
|
||||
|
||||
ItemStack getStack(boolean fireproof);
|
||||
|
||||
String getDesignMaterialName();
|
||||
|
||||
int getColour();
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package binnie.extratrees.api;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public interface IDesignSystem {
|
||||
@Nullable
|
||||
@SideOnly(Side.CLIENT)
|
||||
TextureAtlasSprite getPrimarySprite(final IPattern pattern);
|
||||
|
||||
@Nullable
|
||||
@SideOnly(Side.CLIENT)
|
||||
TextureAtlasSprite getSecondarySprite(final IPattern pattern);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void registerSprites();
|
||||
|
||||
IDesignMaterial getDefaultMaterial();
|
||||
|
||||
@Nullable
|
||||
IDesignMaterial getMaterial(final int p0);
|
||||
|
||||
int getMaterialIndex(final IDesignMaterial p0);
|
||||
|
||||
IDesignMaterial getDefaultMaterial2();
|
||||
|
||||
ItemStack getAdhesive();
|
||||
|
||||
@Nullable
|
||||
IDesignMaterial getMaterial(final ItemStack p0);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package binnie.extratrees.api;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public interface ILayout {
|
||||
IPattern getPattern();
|
||||
|
||||
boolean isInverted();
|
||||
|
||||
ILayout rotateRight();
|
||||
|
||||
ILayout rotateLeft();
|
||||
|
||||
ILayout flipHorizontal();
|
||||
|
||||
ILayout flipVertical();
|
||||
|
||||
ILayout invert();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
TextureAtlasSprite getPrimarySprite(IDesignSystem system);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
TextureAtlasSprite getSecondarySprite(IDesignSystem system);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package binnie.extratrees.api;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.ISpriteRegister;
|
||||
|
||||
public interface IPattern extends ISpriteRegister {
|
||||
@SideOnly(Side.CLIENT)
|
||||
TextureAtlasSprite getPrimarySprite(IDesignSystem system);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
TextureAtlasSprite getSecondarySprite(IDesignSystem system);
|
||||
|
||||
ILayout getRotation();
|
||||
|
||||
ILayout getHorizontalFlip();
|
||||
|
||||
int getIndex();
|
||||
}
|
||||
+1
-6
@@ -1,14 +1,9 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extratrees.api;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IToolHammer
|
||||
{
|
||||
public interface IToolHammer {
|
||||
boolean isActive(final ItemStack p0);
|
||||
|
||||
void onHammerUsed(final ItemStack p0, final EntityPlayer p1);
|
||||
@@ -0,0 +1,29 @@
|
||||
package binnie.extratrees.api.carpentry;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
|
||||
public final class DesignerManager {
|
||||
public static DesignerManager instance = new DesignerManager();
|
||||
|
||||
private final List<IDesignSystem> systems;
|
||||
|
||||
private DesignerManager() {
|
||||
this.systems = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void registerDesignSystem(final IDesignSystem system) {
|
||||
this.systems.add(system);
|
||||
}
|
||||
|
||||
public Collection<IDesignSystem> getDesignSystems() {
|
||||
return this.systems;
|
||||
}
|
||||
|
||||
public void addDesignSystem(final IDesignSystem system) {
|
||||
this.systems.add(system);
|
||||
}
|
||||
}
|
||||
+88
-80
@@ -1,17 +1,18 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
package binnie.extratrees.api.carpentry;
|
||||
|
||||
package binnie.extratrees.carpentry;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.ITextureManager;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
import binnie.extratrees.api.ILayout;
|
||||
import binnie.extratrees.api.IPattern;
|
||||
|
||||
public enum EnumPattern implements IPattern
|
||||
{
|
||||
// TODO: move out of API
|
||||
public enum EnumPattern implements IPattern {
|
||||
Blank,
|
||||
Octagon,
|
||||
Diamond,
|
||||
@@ -226,10 +227,73 @@ public enum EnumPattern implements IPattern
|
||||
OverlappedBarred,
|
||||
OverlappedBarred2;
|
||||
|
||||
static {
|
||||
setupStripedPattern(EnumPattern.ThinStriped, EnumPattern.ThinStriped2);
|
||||
setupStripedPattern(EnumPattern.Striped, EnumPattern.Striped2);
|
||||
setupStripedPattern(EnumPattern.Halved, EnumPattern.Halved2);
|
||||
setupChequeredPattern(EnumPattern.Chequered);
|
||||
setupChequeredPattern(EnumPattern.Tiled);
|
||||
setupCornerPattern(EnumPattern.VeryThinCorner, EnumPattern.VeryThinCorner2, EnumPattern.VeryThinCorner3, EnumPattern.VeryThinCorner4);
|
||||
setupCornerPattern(EnumPattern.ThinCorner, EnumPattern.ThinCorner2, EnumPattern.ThinCorner3, EnumPattern.ThinCorner4);
|
||||
setupCornerPattern(EnumPattern.Corner, EnumPattern.Corner2, EnumPattern.Corner3, EnumPattern.Corner4);
|
||||
setupCornerPattern(EnumPattern.ThickCorner, EnumPattern.ThickCorner2, EnumPattern.ThickCorner3, EnumPattern.ThickCorner4);
|
||||
setupCornerPattern(EnumPattern.ThinCurvedCorner, EnumPattern.ThinCurvedCorner2, EnumPattern.ThinCurvedCorner3, EnumPattern.ThinCurvedCorner4);
|
||||
setupCornerPattern(EnumPattern.CurvedCorner, EnumPattern.CurvedCorner2, EnumPattern.CurvedCorner3, EnumPattern.CurvedCorner4);
|
||||
setupBarredPattern(EnumPattern.BarredEnd, EnumPattern.BarredEnd2, EnumPattern.BarredEnd3, EnumPattern.BarredEnd4);
|
||||
setupEdgedPattern(EnumPattern.ThinEdged, EnumPattern.ThinEdged2, EnumPattern.ThinEdged3, EnumPattern.ThinEdged4);
|
||||
setupEdgedPattern(EnumPattern.Edged, EnumPattern.Edged2, EnumPattern.Edged3, EnumPattern.Edged4);
|
||||
setupBarredPattern(EnumPattern.ThinBarred, EnumPattern.ThinBarred2);
|
||||
setupBarredPattern(EnumPattern.Barred, EnumPattern.Barred2);
|
||||
setupBarredPattern(EnumPattern.ThickBarred, EnumPattern.ThickBarred2);
|
||||
setupDiagonalPattern(EnumPattern.Diagonal, EnumPattern.Diagonal2);
|
||||
setupDiagonalPattern(EnumPattern.ThickDiagonal, EnumPattern.ThickDiagonal2);
|
||||
setupTSectionPattern(EnumPattern.ThinTSection, EnumPattern.ThinTSection2, EnumPattern.ThinTSection3, EnumPattern.ThinTSection4);
|
||||
setupTSectionPattern(EnumPattern.TSection, EnumPattern.TSection2, EnumPattern.TSection3, EnumPattern.TSection4);
|
||||
setupTSectionPattern(EnumPattern.ThickTSection, EnumPattern.ThickTSection2, EnumPattern.ThickTSection3, EnumPattern.ThickTSection4);
|
||||
setupTSectionPattern(EnumPattern.ThinCurvedTSection, EnumPattern.ThinCurvedTSection2, EnumPattern.ThinCurvedTSection3, EnumPattern.ThinCurvedTSection4);
|
||||
setupTSectionPattern(EnumPattern.CurvedTSection, EnumPattern.CurvedTSection2, EnumPattern.CurvedTSection3, EnumPattern.CurvedTSection4);
|
||||
setupCornerPattern(EnumPattern.ThinBarredCorner, EnumPattern.ThinBarredCorner2, EnumPattern.ThinBarredCorner3, EnumPattern.ThinBarredCorner4);
|
||||
setupCornerPattern(EnumPattern.BarredCorner, EnumPattern.BarredCorner2, EnumPattern.BarredCorner3, EnumPattern.BarredCorner4);
|
||||
setupCornerPattern(EnumPattern.ThickBarredCorner, EnumPattern.ThickBarredCorner2, EnumPattern.ThickBarredCorner3, EnumPattern.ThickBarredCorner4);
|
||||
setupCornerPattern(EnumPattern.ThinCurvedBarredCorner, EnumPattern.ThinCurvedBarredCorner2, EnumPattern.ThinCurvedBarredCorner3, EnumPattern.ThinCurvedBarredCorner4);
|
||||
setupCornerPattern(EnumPattern.BarredCurvedCorner, EnumPattern.BarredCurvedCorner2, EnumPattern.BarredCurvedCorner3, EnumPattern.BarredCurvedCorner4);
|
||||
setupCornerPattern(EnumPattern.ThinStripedCorner, EnumPattern.ThinStripedCorner2, EnumPattern.ThinStripedCorner3, EnumPattern.ThinStripedCorner4);
|
||||
setupCornerPattern(EnumPattern.StripedCorner, EnumPattern.StripedCorner2, EnumPattern.StripedCorner3, EnumPattern.StripedCorner4);
|
||||
setupCornerPattern(EnumPattern.OrnateStripedCorner, EnumPattern.OrnateStripedCorner2, EnumPattern.OrnateStripedCorner3, EnumPattern.OrnateStripedCorner4);
|
||||
setupRotation(EnumPattern.LetterA, EnumPattern.LetterA2, EnumPattern.LetterA3, EnumPattern.LetterA4);
|
||||
setupRotation(EnumPattern.LetterB, EnumPattern.LetterB2, EnumPattern.LetterB3, EnumPattern.LetterB4);
|
||||
setupRotation(EnumPattern.LetterF, EnumPattern.LetterF2, EnumPattern.LetterF3, EnumPattern.LetterF4);
|
||||
setupRotation(EnumPattern.LetterS, EnumPattern.LetterS2, EnumPattern.LetterS3, EnumPattern.LetterS4);
|
||||
setupRotation(EnumPattern.LetterT, EnumPattern.LetterT2, EnumPattern.LetterT3, EnumPattern.LetterT4);
|
||||
setupEdgedPattern(EnumPattern.DiagonalCorner, EnumPattern.DiagonalCorner2, EnumPattern.DiagonalCorner3, EnumPattern.DiagonalCorner4);
|
||||
setupCornerPattern(EnumPattern.DiagonalTSection, EnumPattern.DiagonalTSection2, EnumPattern.DiagonalTSection3, EnumPattern.DiagonalTSection4);
|
||||
setupEdgedPattern(EnumPattern.DiagonalCurvedCorner, EnumPattern.DiagonalCurvedCorner2, EnumPattern.DiagonalCurvedCorner3, EnumPattern.DiagonalCurvedCorner4);
|
||||
setupCornerPattern(EnumPattern.DiagonalCurvedTSection, EnumPattern.DiagonalCurvedTSection2, EnumPattern.DiagonalCurvedTSection3, EnumPattern.DiagonalCurvedTSection4);
|
||||
setupBarredPattern(EnumPattern.OrnateBarred, EnumPattern.OrnateBarred2);
|
||||
setupBarredPattern(EnumPattern.OrnateThinBarred, EnumPattern.OrnateThinBarred2);
|
||||
setupBarredPattern(EnumPattern.SplitBarred, EnumPattern.SplitBarred2);
|
||||
setupCornerPattern(EnumPattern.SplitBarredCorner, EnumPattern.SplitBarredCorner2, EnumPattern.SplitBarredCorner3, EnumPattern.SplitBarredCorner4);
|
||||
setupTSectionPattern(EnumPattern.SplitBarredTSection, EnumPattern.SplitBarredTSection2, EnumPattern.SplitBarredTSection3, EnumPattern.SplitBarredTSection4);
|
||||
setupBarredPattern(EnumPattern.SplitBarredEnd, EnumPattern.SplitBarredEnd2, EnumPattern.SplitBarredEnd3, EnumPattern.SplitBarredEnd4);
|
||||
setupRotation(EnumPattern.Creeper, EnumPattern.Creeper2, EnumPattern.Creeper3, EnumPattern.Creeper4);
|
||||
setupDiagonalPattern(EnumPattern.DiagonalStriped, EnumPattern.DiagonalStriped2);
|
||||
setupDiagonalPattern(EnumPattern.ThinDiagonalStriped, EnumPattern.ThinDiagonalStriped2);
|
||||
setupCornerPattern(EnumPattern.Diagonal1Edged, EnumPattern.Diagonal1Edged2, EnumPattern.Diagonal1Edged3, EnumPattern.Diagonal1Edged4);
|
||||
setupCornerPattern(EnumPattern.ThickDiagonal1Edged, EnumPattern.ThickDiagonal1Edged2, EnumPattern.ThickDiagonal1Edged3, EnumPattern.ThickDiagonal1Edged4);
|
||||
setupInvert2Rot(EnumPattern.DiagonalHalved, EnumPattern.DiagonalHalved2);
|
||||
set2Rotation(EnumPattern.Diagonal2Edged, EnumPattern.Diagonal2Edged2);
|
||||
setupBarredPattern(EnumPattern.ThinBarredEnd, EnumPattern.ThinBarredEnd2, EnumPattern.ThinBarredEnd3, EnumPattern.ThinBarredEnd4);
|
||||
setupBarredPattern(EnumPattern.ThickBarredEnd, EnumPattern.ThickBarredEnd2, EnumPattern.ThickBarredEnd3, EnumPattern.ThickBarredEnd4);
|
||||
EnumPattern.OverlappedBarred.setLeftRotation(EnumPattern.OverlappedBarred2, false);
|
||||
EnumPattern.OverlappedBarred2.setLeftRotation(EnumPattern.OverlappedBarred, false);
|
||||
EnumPattern.OverlappedSplitBarred.setLeftRotation(EnumPattern.OverlappedSplitBarred2, false);
|
||||
EnumPattern.OverlappedSplitBarred2.setLeftRotation(EnumPattern.OverlappedSplitBarred, false);
|
||||
}
|
||||
|
||||
ILayout leftRotation;
|
||||
ILayout horizontalFlip;
|
||||
|
||||
private EnumPattern() {
|
||||
EnumPattern() {
|
||||
this.leftRotation = Layout.get(this, false);
|
||||
this.horizontalFlip = Layout.get(this, false);
|
||||
}
|
||||
@@ -297,23 +361,25 @@ public enum EnumPattern implements IPattern
|
||||
setupEdgedPattern(l, t, r, b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getPrimaryIcon(final IDesignSystem system) {
|
||||
return system.getPrimaryIcon(this);
|
||||
}
|
||||
|
||||
private static void setupRotation(final EnumPattern t, final EnumPattern r, final EnumPattern b, final EnumPattern l) {
|
||||
setupEdgedPattern(l, t, r, b);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public TextureAtlasSprite getPrimarySprite(IDesignSystem system) {
|
||||
return system.getPrimarySprite(this);
|
||||
}
|
||||
|
||||
private void setHorizontalFlip(final EnumPattern pattern, final boolean inverted) {
|
||||
this.horizontalFlip = Layout.get(pattern, inverted);
|
||||
pattern.horizontalFlip = Layout.get(this, inverted);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getSecondaryIcon(final IDesignSystem system) {
|
||||
return system.getSecondaryIcon(this);
|
||||
public TextureAtlasSprite getSecondarySprite(IDesignSystem system) {
|
||||
return system.getSecondarySprite(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -326,12 +392,17 @@ public enum EnumPattern implements IPattern
|
||||
return this.horizontalFlip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIndex() {
|
||||
return ordinal();
|
||||
}
|
||||
|
||||
protected void setLeftRotation(final EnumPattern pattern, final boolean inverted) {
|
||||
this.leftRotation = Layout.get(pattern, inverted);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(final IIconRegister register) {
|
||||
public void registerSprites(ITextureManager manager) {
|
||||
}
|
||||
|
||||
public ILayout layout() {
|
||||
@@ -341,67 +412,4 @@ public enum EnumPattern implements IPattern
|
||||
public ILayout layout(final boolean invert) {
|
||||
return Layout.get(this, invert);
|
||||
}
|
||||
|
||||
static {
|
||||
setupStripedPattern(EnumPattern.ThinStriped, EnumPattern.ThinStriped2);
|
||||
setupStripedPattern(EnumPattern.Striped, EnumPattern.Striped2);
|
||||
setupStripedPattern(EnumPattern.Halved, EnumPattern.Halved2);
|
||||
setupChequeredPattern(EnumPattern.Chequered);
|
||||
setupChequeredPattern(EnumPattern.Tiled);
|
||||
setupCornerPattern(EnumPattern.VeryThinCorner, EnumPattern.VeryThinCorner2, EnumPattern.VeryThinCorner3, EnumPattern.VeryThinCorner4);
|
||||
setupCornerPattern(EnumPattern.ThinCorner, EnumPattern.ThinCorner2, EnumPattern.ThinCorner3, EnumPattern.ThinCorner4);
|
||||
setupCornerPattern(EnumPattern.Corner, EnumPattern.Corner2, EnumPattern.Corner3, EnumPattern.Corner4);
|
||||
setupCornerPattern(EnumPattern.ThickCorner, EnumPattern.ThickCorner2, EnumPattern.ThickCorner3, EnumPattern.ThickCorner4);
|
||||
setupCornerPattern(EnumPattern.ThinCurvedCorner, EnumPattern.ThinCurvedCorner2, EnumPattern.ThinCurvedCorner3, EnumPattern.ThinCurvedCorner4);
|
||||
setupCornerPattern(EnumPattern.CurvedCorner, EnumPattern.CurvedCorner2, EnumPattern.CurvedCorner3, EnumPattern.CurvedCorner4);
|
||||
setupBarredPattern(EnumPattern.BarredEnd, EnumPattern.BarredEnd2, EnumPattern.BarredEnd3, EnumPattern.BarredEnd4);
|
||||
setupEdgedPattern(EnumPattern.ThinEdged, EnumPattern.ThinEdged2, EnumPattern.ThinEdged3, EnumPattern.ThinEdged4);
|
||||
setupEdgedPattern(EnumPattern.Edged, EnumPattern.Edged2, EnumPattern.Edged3, EnumPattern.Edged4);
|
||||
setupBarredPattern(EnumPattern.ThinBarred, EnumPattern.ThinBarred2);
|
||||
setupBarredPattern(EnumPattern.Barred, EnumPattern.Barred2);
|
||||
setupBarredPattern(EnumPattern.ThickBarred, EnumPattern.ThickBarred2);
|
||||
setupDiagonalPattern(EnumPattern.Diagonal, EnumPattern.Diagonal2);
|
||||
setupDiagonalPattern(EnumPattern.ThickDiagonal, EnumPattern.ThickDiagonal2);
|
||||
setupTSectionPattern(EnumPattern.ThinTSection, EnumPattern.ThinTSection2, EnumPattern.ThinTSection3, EnumPattern.ThinTSection4);
|
||||
setupTSectionPattern(EnumPattern.TSection, EnumPattern.TSection2, EnumPattern.TSection3, EnumPattern.TSection4);
|
||||
setupTSectionPattern(EnumPattern.ThickTSection, EnumPattern.ThickTSection2, EnumPattern.ThickTSection3, EnumPattern.ThickTSection4);
|
||||
setupTSectionPattern(EnumPattern.ThinCurvedTSection, EnumPattern.ThinCurvedTSection2, EnumPattern.ThinCurvedTSection3, EnumPattern.ThinCurvedTSection4);
|
||||
setupTSectionPattern(EnumPattern.CurvedTSection, EnumPattern.CurvedTSection2, EnumPattern.CurvedTSection3, EnumPattern.CurvedTSection4);
|
||||
setupCornerPattern(EnumPattern.ThinBarredCorner, EnumPattern.ThinBarredCorner2, EnumPattern.ThinBarredCorner3, EnumPattern.ThinBarredCorner4);
|
||||
setupCornerPattern(EnumPattern.BarredCorner, EnumPattern.BarredCorner2, EnumPattern.BarredCorner3, EnumPattern.BarredCorner4);
|
||||
setupCornerPattern(EnumPattern.ThickBarredCorner, EnumPattern.ThickBarredCorner2, EnumPattern.ThickBarredCorner3, EnumPattern.ThickBarredCorner4);
|
||||
setupCornerPattern(EnumPattern.ThinCurvedBarredCorner, EnumPattern.ThinCurvedBarredCorner2, EnumPattern.ThinCurvedBarredCorner3, EnumPattern.ThinCurvedBarredCorner4);
|
||||
setupCornerPattern(EnumPattern.BarredCurvedCorner, EnumPattern.BarredCurvedCorner2, EnumPattern.BarredCurvedCorner3, EnumPattern.BarredCurvedCorner4);
|
||||
setupCornerPattern(EnumPattern.ThinStripedCorner, EnumPattern.ThinStripedCorner2, EnumPattern.ThinStripedCorner3, EnumPattern.ThinStripedCorner4);
|
||||
setupCornerPattern(EnumPattern.StripedCorner, EnumPattern.StripedCorner2, EnumPattern.StripedCorner3, EnumPattern.StripedCorner4);
|
||||
setupCornerPattern(EnumPattern.OrnateStripedCorner, EnumPattern.OrnateStripedCorner2, EnumPattern.OrnateStripedCorner3, EnumPattern.OrnateStripedCorner4);
|
||||
setupRotation(EnumPattern.LetterA, EnumPattern.LetterA2, EnumPattern.LetterA3, EnumPattern.LetterA4);
|
||||
setupRotation(EnumPattern.LetterB, EnumPattern.LetterB2, EnumPattern.LetterB3, EnumPattern.LetterB4);
|
||||
setupRotation(EnumPattern.LetterF, EnumPattern.LetterF2, EnumPattern.LetterF3, EnumPattern.LetterF4);
|
||||
setupRotation(EnumPattern.LetterS, EnumPattern.LetterS2, EnumPattern.LetterS3, EnumPattern.LetterS4);
|
||||
setupRotation(EnumPattern.LetterT, EnumPattern.LetterT2, EnumPattern.LetterT3, EnumPattern.LetterT4);
|
||||
setupEdgedPattern(EnumPattern.DiagonalCorner, EnumPattern.DiagonalCorner2, EnumPattern.DiagonalCorner3, EnumPattern.DiagonalCorner4);
|
||||
setupCornerPattern(EnumPattern.DiagonalTSection, EnumPattern.DiagonalTSection2, EnumPattern.DiagonalTSection3, EnumPattern.DiagonalTSection4);
|
||||
setupEdgedPattern(EnumPattern.DiagonalCurvedCorner, EnumPattern.DiagonalCurvedCorner2, EnumPattern.DiagonalCurvedCorner3, EnumPattern.DiagonalCurvedCorner4);
|
||||
setupCornerPattern(EnumPattern.DiagonalCurvedTSection, EnumPattern.DiagonalCurvedTSection2, EnumPattern.DiagonalCurvedTSection3, EnumPattern.DiagonalCurvedTSection4);
|
||||
setupBarredPattern(EnumPattern.OrnateBarred, EnumPattern.OrnateBarred2);
|
||||
setupBarredPattern(EnumPattern.OrnateThinBarred, EnumPattern.OrnateThinBarred2);
|
||||
setupBarredPattern(EnumPattern.SplitBarred, EnumPattern.SplitBarred2);
|
||||
setupCornerPattern(EnumPattern.SplitBarredCorner, EnumPattern.SplitBarredCorner2, EnumPattern.SplitBarredCorner3, EnumPattern.SplitBarredCorner4);
|
||||
setupTSectionPattern(EnumPattern.SplitBarredTSection, EnumPattern.SplitBarredTSection2, EnumPattern.SplitBarredTSection3, EnumPattern.SplitBarredTSection4);
|
||||
setupBarredPattern(EnumPattern.SplitBarredEnd, EnumPattern.SplitBarredEnd2, EnumPattern.SplitBarredEnd3, EnumPattern.SplitBarredEnd4);
|
||||
setupRotation(EnumPattern.Creeper, EnumPattern.Creeper2, EnumPattern.Creeper3, EnumPattern.Creeper4);
|
||||
setupDiagonalPattern(EnumPattern.DiagonalStriped, EnumPattern.DiagonalStriped2);
|
||||
setupDiagonalPattern(EnumPattern.ThinDiagonalStriped, EnumPattern.ThinDiagonalStriped2);
|
||||
setupCornerPattern(EnumPattern.Diagonal1Edged, EnumPattern.Diagonal1Edged2, EnumPattern.Diagonal1Edged3, EnumPattern.Diagonal1Edged4);
|
||||
setupCornerPattern(EnumPattern.ThickDiagonal1Edged, EnumPattern.ThickDiagonal1Edged2, EnumPattern.ThickDiagonal1Edged3, EnumPattern.ThickDiagonal1Edged4);
|
||||
setupInvert2Rot(EnumPattern.DiagonalHalved, EnumPattern.DiagonalHalved2);
|
||||
set2Rotation(EnumPattern.Diagonal2Edged, EnumPattern.Diagonal2Edged2);
|
||||
setupBarredPattern(EnumPattern.ThinBarredEnd, EnumPattern.ThinBarredEnd2, EnumPattern.ThinBarredEnd3, EnumPattern.ThinBarredEnd4);
|
||||
setupBarredPattern(EnumPattern.ThickBarredEnd, EnumPattern.ThickBarredEnd2, EnumPattern.ThickBarredEnd3, EnumPattern.ThickBarredEnd4);
|
||||
EnumPattern.OverlappedBarred.setLeftRotation(EnumPattern.OverlappedBarred2, false);
|
||||
EnumPattern.OverlappedBarred2.setLeftRotation(EnumPattern.OverlappedBarred, false);
|
||||
EnumPattern.OverlappedSplitBarred.setLeftRotation(EnumPattern.OverlappedSplitBarred2, false);
|
||||
EnumPattern.OverlappedSplitBarred2.setLeftRotation(EnumPattern.OverlappedSplitBarred, false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package binnie.extratrees.api.carpentry;
|
||||
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
|
||||
public interface IBlockDesign {
|
||||
IDesignSystem getDesignSystem();
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package binnie.extratrees.api.carpentry;
|
||||
|
||||
public interface IBlockDesignProperties {
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package binnie.extratrees.api.carpentry;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
import binnie.extratrees.api.ILayout;
|
||||
import binnie.extratrees.api.IPattern;
|
||||
|
||||
public class Layout implements ILayout {
|
||||
IPattern pattern;
|
||||
boolean inverted;
|
||||
|
||||
private Layout(final IPattern pattern, final boolean inverted) {
|
||||
this.pattern = pattern;
|
||||
this.inverted = inverted;
|
||||
}
|
||||
|
||||
public static ILayout get(final IPattern pattern, final boolean inverted) {
|
||||
return new Layout(pattern, inverted);
|
||||
}
|
||||
|
||||
public static ILayout get(final IPattern pattern) {
|
||||
return new Layout(pattern, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPattern getPattern() {
|
||||
return this.pattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInverted() {
|
||||
return this.inverted;
|
||||
}
|
||||
|
||||
ILayout newLayout(final ILayout newLayout) {
|
||||
return new Layout(newLayout.getPattern(), this.inverted ^ newLayout.isInverted());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout rotateRight() {
|
||||
return this.rotateLeft().rotateLeft().rotateLeft();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout rotateLeft() {
|
||||
return this.newLayout(this.pattern.getRotation());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout flipHorizontal() {
|
||||
return this.newLayout(this.pattern.getHorizontalFlip());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout flipVertical() {
|
||||
return this.newLayout(this.pattern.getHorizontalFlip().rotateLeft().rotateLeft());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public TextureAtlasSprite getPrimarySprite(IDesignSystem system) {
|
||||
return this.inverted ? this.pattern.getSecondarySprite(system) : this.pattern.getPrimarySprite(system);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public TextureAtlasSprite getSecondarySprite(IDesignSystem system) {
|
||||
return this.inverted ? this.pattern.getPrimarySprite(system) : this.pattern.getSecondarySprite(system);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout invert() {
|
||||
return new Layout(this.pattern, !this.inverted);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package binnie.extratrees.api;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -0,0 +1,15 @@
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ExtraTreesRecipeManager {
|
||||
|
||||
@Nullable
|
||||
public static IBreweryManager breweryManager;
|
||||
@Nullable
|
||||
public static ILumbermillManager lumbermillManager;
|
||||
@Nullable
|
||||
public static IFruitPressManager fruitPressManager;
|
||||
@Nullable
|
||||
public static IDistilleryManager distilleryManager;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
public interface IBreweryCrafting {
|
||||
|
||||
@Nullable
|
||||
FluidStack getInputFluid();
|
||||
|
||||
@Nullable
|
||||
ItemStack[] getInputGrains();
|
||||
|
||||
ItemStack getIngredient();
|
||||
|
||||
ItemStack getYeast();
|
||||
|
||||
boolean hasInputGrainsEmpty();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import binnie.core.api.ICraftingManager;
|
||||
|
||||
public interface IBreweryManager extends ICraftingManager<IBreweryRecipe> {
|
||||
|
||||
void addRecipe(FluidStack input, FluidStack output);
|
||||
|
||||
void addRecipe(FluidStack input, FluidStack output, ItemStack yeast);
|
||||
|
||||
void addGrainRecipe(String grainOreName, FluidStack output);
|
||||
|
||||
void addGrainRecipe(String grainOreName, FluidStack output, String ingredientOreName);
|
||||
|
||||
void addGrainRecipe(String grainOreName, FluidStack output, @Nullable String ingredientOreName, ItemStack yeast);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import binnie.core.api.IBinnieRecipe;
|
||||
|
||||
public interface IBreweryRecipe extends IBinnieRecipe {
|
||||
@Nullable
|
||||
FluidStack getOutput(IBreweryCrafting crafting);
|
||||
|
||||
FluidStack getInput();
|
||||
|
||||
FluidStack getOutput();
|
||||
|
||||
boolean isIngredient(ItemStack itemStack);
|
||||
|
||||
List<ItemStack> getIngredients();
|
||||
|
||||
boolean isGrain(ItemStack itemStack);
|
||||
|
||||
List<ItemStack> getGrains();
|
||||
|
||||
ItemStack getYeast();
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import binnie.core.api.ICraftingManager;
|
||||
|
||||
public interface IDistilleryManager extends ICraftingManager<IDistilleryRecipe> {
|
||||
|
||||
void addRecipe(FluidStack input, FluidStack output, int level);
|
||||
|
||||
Collection<IDistilleryRecipe> recipes(int level);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import binnie.core.api.IBinnieRecipe;
|
||||
|
||||
public interface IDistilleryRecipe extends IBinnieRecipe {
|
||||
|
||||
FluidStack getInput();
|
||||
|
||||
FluidStack getOutput();
|
||||
|
||||
int getLevel();
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import binnie.core.api.ICraftingManager;
|
||||
|
||||
public interface IFruitPressManager extends ICraftingManager<IFruitPressRecipe> {
|
||||
|
||||
void addRecipe(ItemStack input, FluidStack output);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import binnie.core.api.IBinnieRecipe;
|
||||
|
||||
public interface IFruitPressRecipe extends IBinnieRecipe {
|
||||
|
||||
ItemStack getInput();
|
||||
|
||||
FluidStack getOutput();
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import binnie.core.api.ICraftingManager;
|
||||
|
||||
public interface ILumbermillManager extends ICraftingManager<ILumbermillRecipe> {
|
||||
|
||||
void addRecipe(ItemStack input, ItemStack output);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import binnie.core.api.IBinnieRecipe;
|
||||
|
||||
public interface ILumbermillRecipe extends IBinnieRecipe {
|
||||
|
||||
ItemStack getOutput();
|
||||
|
||||
ItemStack getInput();
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package binnie.extratrees.api.recipes;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -0,0 +1,21 @@
|
||||
package binnie.genetics.api;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import forestry.api.core.INbtReadable;
|
||||
import forestry.api.core.INbtWritable;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
public interface IGene extends INbtReadable, INbtWritable {
|
||||
IChromosomeType getChromosome();
|
||||
|
||||
String getName();
|
||||
|
||||
ISpeciesRoot getSpeciesRoot();
|
||||
|
||||
IAllele getAllele();
|
||||
|
||||
NBTTagCompound getNBTTagCompound();
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package binnie.genetics.api;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IItemAnalysable {
|
||||
boolean isAnalysed(ItemStack stack);
|
||||
|
||||
ItemStack analyse(ItemStack stack);
|
||||
|
||||
@Deprecated
|
||||
float getAnalyseTimeMult(ItemStack stack);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package binnie.genetics.api;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
public interface IItemChargeable {
|
||||
int getCharges(ItemStack stack);
|
||||
|
||||
int getMaxCharges(ItemStack stack);
|
||||
|
||||
@Nullable
|
||||
ISpeciesRoot getSpeciesRoot(ItemStack stack);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package binnie.genetics.api;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IItemSerum extends IItemChargeable {
|
||||
IGene[] getGenes(ItemStack stack);
|
||||
|
||||
@Nullable
|
||||
IGene getGene(ItemStack stack, int chromosome);
|
||||
|
||||
ItemStack addGene(ItemStack stack, IGene gene);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package binnie.genetics.api;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -0,0 +1,9 @@
|
||||
archivesBaseName = 'botany-' + mcversion
|
||||
|
||||
dependencies {
|
||||
compile project(":api")
|
||||
compile project(":core")
|
||||
|
||||
// TODO: remove
|
||||
compile project(":extratrees")
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package binnie.botany;
|
||||
|
||||
import binnie.botany.genetics.FlowerBreedingSystem;
|
||||
import binnie.core.Binnie;
|
||||
import binnie.core.api.genetics.IBreedingSystem;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
|
||||
import binnie.core.Constants;
|
||||
import binnie.botany.gui.BotanyGUI;
|
||||
import binnie.botany.network.PacketID;
|
||||
import binnie.botany.proxy.Proxy;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.gui.IBinnieGUID;
|
||||
import binnie.core.network.BinniePacketHandler;
|
||||
import binnie.core.network.IPacketID;
|
||||
import binnie.core.proxy.IProxyCore;
|
||||
import binnie.core.modules.BlankModuleContainer;
|
||||
|
||||
@Mod(
|
||||
modid = Constants.BOTANY_MOD_ID,
|
||||
name = "Binnie's Botany",
|
||||
dependencies = "required-after:" + Constants.CORE_MOD_ID
|
||||
)
|
||||
public class Botany extends BlankModuleContainer {
|
||||
public static final float AGE_CHANCE = 0.2f;
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@Mod.Instance(Constants.BOTANY_MOD_ID)
|
||||
public static Botany instance;
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@SidedProxy(clientSide = "binnie.botany.proxy.ProxyClient", serverSide = "binnie.botany.proxy.ProxyServer")
|
||||
public static Proxy proxy;
|
||||
public static IBreedingSystem flowerBreedingSystem;
|
||||
|
||||
@Mod.EventHandler
|
||||
public void preInit(FMLPreInitializationEvent evt) {
|
||||
super.preInit(evt);
|
||||
flowerBreedingSystem = new FlowerBreedingSystem();
|
||||
Binnie.GENETICS.registerBreedingSystem(flowerBreedingSystem);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void init(FMLInitializationEvent evt) {
|
||||
super.init(evt);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void postInit(FMLPostInitializationEvent evt) {
|
||||
super.postInit(evt);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerModules() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinnieGUID[] getGUIDs() {
|
||||
return BotanyGUI.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?>[] getConfigs() {
|
||||
return new Class[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPacketID[] getPacketIDs() {
|
||||
return PacketID.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IProxyCore getProxy() {
|
||||
return Botany.proxy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getChannel() {
|
||||
return "BOT";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModID() {
|
||||
return Constants.BOTANY_MOD_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends BinniePacketHandler> getPacketHandler() {
|
||||
return PacketHandler.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return BinnieCore.isBotanyActive();
|
||||
}
|
||||
|
||||
public static class PacketHandler extends BinniePacketHandler {
|
||||
public PacketHandler() {
|
||||
super(Botany.instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package binnie.botany;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class CreativeTabBotany extends CreativeTabs {
|
||||
public static CreativeTabs instance = new CreativeTabBotany();
|
||||
|
||||
public CreativeTabBotany() {
|
||||
super("Botany");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getTranslatedTabLabel() {
|
||||
return getTabLabel();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getTabLabel() {
|
||||
return I18N.localise("botany.tab.botany");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ItemStack getTabIconItem() {
|
||||
return new ItemStack(Blocks.RED_FLOWER, 1, 5);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,274 @@
|
||||
package binnie.botany;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
import forestry.api.climate.IClimateInfo;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
|
||||
import binnie.botany.api.gardening.EnumAcidity;
|
||||
import binnie.botany.api.gardening.EnumFertiliserType;
|
||||
import binnie.botany.api.gardening.EnumMoisture;
|
||||
import binnie.botany.api.gardening.EnumSoilType;
|
||||
import binnie.botany.api.gardening.IBlockSoil;
|
||||
import binnie.botany.api.gardening.IGardeningManager;
|
||||
import binnie.botany.api.genetics.IFlower;
|
||||
import binnie.botany.api.genetics.IFlowerGenome;
|
||||
import binnie.botany.blocks.BlockPlant;
|
||||
import binnie.botany.blocks.BlockSoil;
|
||||
import binnie.botany.modules.ModuleGardening;
|
||||
import binnie.core.util.OreDictionaryUtil;
|
||||
|
||||
public class GardeningManager implements IGardeningManager {
|
||||
private final Map<EnumFertiliserType, Map<ItemStack, Integer>> fertilisers = new LinkedHashMap<>();
|
||||
|
||||
public GardeningManager() {
|
||||
for(EnumFertiliserType type : EnumFertiliserType.values()){
|
||||
fertilisers.put(type, new LinkedHashMap<>());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSoil(Block block) {
|
||||
return block instanceof IBlockSoil;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSoil(Item item) {
|
||||
return item instanceof ItemBlock && isSoil(((ItemBlock) item).getBlock());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSoil(ItemStack item) {
|
||||
return isSoil(item.getItem());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumMoisture getNaturalMoisture(World world, BlockPos pos) {
|
||||
float moisture = getBiomeMoisture(world, pos);
|
||||
|
||||
for (int offsetX = -1; offsetX < 2; ++offsetX) {
|
||||
for (int offsetY = -1; offsetY < 2; ++offsetY) {
|
||||
if (offsetX != 0 || offsetY != 0) {
|
||||
Block block = world.getBlockState(pos.add(offsetX, 0, offsetY)).getBlock();
|
||||
if (block == Blocks.SAND) {
|
||||
moisture -= 1.5;
|
||||
} else if (block == Blocks.WATER) {
|
||||
moisture += 1.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (world.isRainingAt(pos.up())) {
|
||||
moisture += 1.5;
|
||||
}
|
||||
|
||||
for (int offsetX = -1; offsetX < 2; ++offsetX) {
|
||||
for (int offsetY = -1; offsetY < 2; ++offsetY) {
|
||||
if (offsetX != 0 || offsetY != 0) {
|
||||
Block block = world.getBlockState(pos.add(offsetX, 0, offsetY)).getBlock();
|
||||
if (block == Blocks.GRAVEL && moisture > 0.0f) {
|
||||
moisture *= 0.4f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return EnumMoisture.getFromValue(moisture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAcidity getNaturalPH(World world, BlockPos pos) {
|
||||
float acidity = getBiomePH(world, pos);
|
||||
return EnumAcidity.getFromValue(acidity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBiomeMoisture(World world, BlockPos pos) {
|
||||
IClimateInfo info = ForestryAPI.climateManager.getInfo(world, pos);
|
||||
double humidity = info.getHumidity();
|
||||
double temperature = info.getTemperature();
|
||||
double moisture = 3.2 * (humidity - 0.5) - 0.4 * (1.0 + temperature + 0.5 * temperature * temperature) + 1.1 - 1.6 * (temperature - 0.9) * (temperature - 0.9) - 0.002 * (pos.getY() - 64);
|
||||
return (float) ((moisture == 0.0) ? moisture : ((moisture < 0.0) ? (-Math.sqrt(moisture * moisture)) : Math.sqrt(moisture * moisture)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBiomePH(World world, BlockPos pos) {
|
||||
IClimateInfo info = ForestryAPI.climateManager.getInfo(world, pos);
|
||||
double humidity = info.getHumidity();
|
||||
double temperature = info.getTemperature();
|
||||
return (float) (-3.0 * (humidity - 0.5) + 0.5 * (temperature - 0.699999988079071) * (temperature - 0.699999988079071) + 0.02f * (pos.getY() - 64) - 0.15000000596046448);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getSoil(EnumSoilType soil, boolean weedKill, EnumMoisture moisture, EnumAcidity acidity) {
|
||||
IBlockState blockState = getSoilBlock(soil, weedKill).getDefaultState();
|
||||
return blockState.withProperty(BlockSoil.MOISTURE, moisture).withProperty(BlockSoil.ACIDITY, acidity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void plantSoil(World world, BlockPos pos, EnumSoilType soil, EnumMoisture moisture, EnumAcidity acidity) {
|
||||
IBlockState blockState = getSoil(soil, false, moisture, acidity);
|
||||
world.setBlockState(pos, blockState, 2);
|
||||
}
|
||||
|
||||
public Map<EnumFertiliserType, Map<ItemStack, Integer>> getFertilisers() {
|
||||
return fertilisers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ItemStack> getFertilisers(EnumFertiliserType type) {
|
||||
Set<ItemStack> items = fertilisers.get(type).keySet();
|
||||
return Collections.unmodifiableSet(items);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFertiliser(EnumFertiliserType type, ItemStack stack) {
|
||||
Collection<ItemStack> fertilisers = getFertilisers(type);
|
||||
for (ItemStack fertiliser : fertilisers) {
|
||||
if (!fertiliser.isEmpty() && fertiliser.isItemEqual(stack)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerFertiliser(EnumFertiliserType type, ItemStack stack, int strength) {
|
||||
fertilisers.get(type).put(stack, strength);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFertiliserStrength(ItemStack stack) {
|
||||
for(EnumFertiliserType type : EnumFertiliserType.values()) {
|
||||
for (Map.Entry<ItemStack, Integer> entry : fertilisers.get(type).entrySet()) {
|
||||
if (entry.getKey().isItemEqual(stack)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onFertiliseSoil(ItemStack heldItem, IBlockSoil soil, World world, BlockPos pos, EntityPlayer player) {
|
||||
int fertiliserStrength = getFertiliserStrength(heldItem);
|
||||
if (isFertiliser(EnumFertiliserType.NUTRIENT, heldItem) && soil.getType(world, pos) != EnumSoilType.FLOWERBED) {
|
||||
EnumSoilType type = soil.getType(world, pos);
|
||||
int next = Math.min(type.ordinal() + fertiliserStrength, 2);
|
||||
if (soil.fertilise(world, pos, EnumSoilType.values()[next])) {
|
||||
if(!player.capabilities.isCreativeMode) {
|
||||
heldItem.shrink(1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isFertiliser(EnumFertiliserType.ACID, heldItem) && soil.getPH(world, pos) != EnumAcidity.ACID) {
|
||||
EnumAcidity pH = soil.getPH(world, pos);
|
||||
int next = Math.max(pH.ordinal() - fertiliserStrength, 0);
|
||||
if (soil.setPH(world, pos, EnumAcidity.values()[next])) {
|
||||
if(!player.capabilities.isCreativeMode) {
|
||||
heldItem.shrink(1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isFertiliser(EnumFertiliserType.ALKALINE, heldItem) && soil.getPH(world, pos) != EnumAcidity.ALKALINE) {
|
||||
EnumAcidity pH = soil.getPH(world, pos);
|
||||
int next = Math.min(pH.ordinal() + fertiliserStrength, 2);
|
||||
if (soil.setPH(world, pos, EnumAcidity.values()[next])) {
|
||||
if(!player.capabilities.isCreativeMode) {
|
||||
heldItem.shrink(1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTolerate(@Nullable IFlower flower, World world, BlockPos pos) {
|
||||
if (flower == null) {
|
||||
return false;
|
||||
}
|
||||
IBlockState soil = world.getBlockState(pos.down());
|
||||
Biome biome = world.getBiome(pos);
|
||||
EnumAcidity acidity = soil.getValue(BlockSoil.ACIDITY);
|
||||
EnumMoisture moisture = soil.getValue(BlockSoil.MOISTURE);
|
||||
EnumTemperature temperature = EnumTemperature.getFromValue(biome.getTemperature());
|
||||
return canTolerate(flower, acidity, moisture, temperature);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSoilType getSoilType(World world, BlockPos pos) {
|
||||
IBlockState blockState = world.getBlockState(pos);
|
||||
if (blockState.getBlock() instanceof IBlockSoil) {
|
||||
IBlockSoil soil = ((IBlockSoil) blockState.getBlock());
|
||||
return soil.getType(world, pos);
|
||||
}
|
||||
return EnumSoilType.SOIL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getSoilBlock(EnumSoilType type) {
|
||||
return getSoilBlock(type, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block getSoilBlock(EnumSoilType type, boolean weedKill) {
|
||||
switch (type) {
|
||||
case FLOWERBED:
|
||||
return weedKill ? ModuleGardening.flowerbedNoWeed : ModuleGardening.flowerbed;
|
||||
|
||||
case LOAM:
|
||||
return weedKill ? ModuleGardening.loamNoWeed : ModuleGardening.loam;
|
||||
default:
|
||||
return weedKill ? ModuleGardening.soilNoWeed : ModuleGardening.soil;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTolerate(IFlower flower, EnumAcidity acidity, EnumMoisture moisture, EnumTemperature temperature) {
|
||||
IFlowerGenome genome = flower.getGenome();
|
||||
return genome.canTolerate(acidity) && genome.canTolerate(moisture) && genome.canTolerate(temperature);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWeedkiller(ItemStack heldItem) {
|
||||
return OreDictionaryUtil.hasOreName(heldItem, "weedkiller");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addWeedKiller(World world, BlockPos pos) {
|
||||
IBlockState oldState = world.getBlockState(pos);
|
||||
if (!(oldState.getBlock() instanceof IBlockSoil)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
EnumSoilType type = getSoilType(world, pos);
|
||||
IBlockState newState = getSoil(type, true, oldState.getValue(BlockSoil.MOISTURE), oldState.getValue(BlockSoil.ACIDITY));
|
||||
boolean done = world.setBlockState(pos, newState, 2);
|
||||
if (done && BlockPlant.isWeed(world, pos.up())) {
|
||||
world.setBlockToAir(pos.up());
|
||||
}
|
||||
return done;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package binnie.botany.blocks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.core.blocks.IColoredBlock;
|
||||
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.api.genetics.EnumFlowerColor;
|
||||
import binnie.botany.tile.TileCeramic;
|
||||
import binnie.core.util.TileUtil;
|
||||
|
||||
public class BlockCeramic extends Block implements IColoredBlock, IItemModelRegister {
|
||||
public BlockCeramic() {
|
||||
super(Material.ROCK);
|
||||
setHardness(1.0f);
|
||||
setResistance(5.0f);
|
||||
setRegistryName("ceramic");
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
manager.registerItemModel(item, c.ordinal());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, @Nullable EntityPlayer player, boolean willHarvest) {
|
||||
List<ItemStack> drops = new ArrayList<>();
|
||||
TileCeramic ceramic = TileUtil.getTile(world, pos, TileCeramic.class);
|
||||
if (ceramic != null) {
|
||||
drops = Collections.singletonList(ceramic.getStack());
|
||||
}
|
||||
boolean hasBeenBroken = world.setBlockToAir(pos);
|
||||
if (hasBeenBroken && !world.isRemote && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
for (ItemStack drop : drops) {
|
||||
spawnAsEntity(world, pos, drop);
|
||||
}
|
||||
}
|
||||
return hasBeenBroken;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||
return new TileCeramic();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
|
||||
TileCeramic ceramic = TileUtil.getTile(worldIn, pos, TileCeramic.class);
|
||||
if (ceramic != null) {
|
||||
ceramic.setColor(EnumFlowerColor.VALUES[stack.getItemDamage()]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> itemList) {
|
||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
itemList.add(new ItemStack(this, 1, c.getFlowerColorAllele().getID()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||
TileCeramic ceramic = TileUtil.getTile(world, pos, TileCeramic.class);
|
||||
if (ceramic != null) {
|
||||
return ceramic.getStack();
|
||||
}
|
||||
return super.getPickBlock(state, target, world, pos, player);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int colorMultiplier(IBlockState state, @Nullable IBlockAccess world, @Nullable BlockPos pos, int tintIndex) {
|
||||
if (world != null && pos != null) {
|
||||
TileCeramic ceramic = TileUtil.getTile(world, pos, TileCeramic.class);
|
||||
if (ceramic != null) {
|
||||
return ceramic.getColor().getFlowerColorAllele().getColor(false);
|
||||
}
|
||||
}
|
||||
return EnumFlowerColor.get(0).getFlowerColorAllele().getColor(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,265 @@
|
||||
package binnie.botany.blocks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.core.ISpriteRegister;
|
||||
import forestry.api.core.IStateMapperRegister;
|
||||
import forestry.api.core.ITextureManager;
|
||||
import forestry.core.blocks.IColoredBlock;
|
||||
import forestry.core.blocks.properties.UnlistedBlockAccess;
|
||||
import forestry.core.blocks.properties.UnlistedBlockPos;
|
||||
import forestry.core.models.BlockModelEntry;
|
||||
|
||||
import binnie.core.Constants;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.ceramic.brick.CeramicBrickPair;
|
||||
import binnie.botany.ceramic.brick.CeramicBrickType;
|
||||
import binnie.botany.api.genetics.EnumFlowerColor;
|
||||
import binnie.botany.tile.TileCeramic;
|
||||
import binnie.botany.tile.TileCeramicBrick;
|
||||
import binnie.core.block.IMultipassBlock;
|
||||
import binnie.core.models.DefaultStateMapper;
|
||||
import binnie.core.models.ModelManager;
|
||||
import binnie.core.models.ModelMutlipass;
|
||||
import binnie.core.util.TileUtil;
|
||||
|
||||
public class BlockCeramicBrick extends Block implements IMultipassBlock<CeramicBrickPair>, IColoredBlock, ISpriteRegister, IStateMapperRegister, IItemModelRegister {
|
||||
private static final PropertyEnum<CeramicBrickType> TYPE = PropertyEnum.create("type", CeramicBrickType.class);
|
||||
|
||||
public BlockCeramicBrick() {
|
||||
super(Material.ROCK);
|
||||
setHardness(1.0f);
|
||||
setResistance(5.0f);
|
||||
setRegistryName("ceramicBrick");
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, @Nullable EntityPlayer player, boolean willHarvest) {
|
||||
List<ItemStack> drops = new ArrayList<>();
|
||||
TileCeramic ceramic = TileUtil.getTile(world, pos, TileCeramic.class);
|
||||
if (ceramic != null) {
|
||||
drops = Collections.singletonList(ceramic.getStack());
|
||||
}
|
||||
boolean hasBeenBroken = world.setBlockToAir(pos);
|
||||
if (hasBeenBroken && !world.isRemote && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
for (ItemStack drop : drops) {
|
||||
spawnAsEntity(world, pos, drop);
|
||||
}
|
||||
}
|
||||
return hasBeenBroken;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||
return new TileCeramicBrick();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> itemList) {
|
||||
for (EnumFlowerColor color : EnumFlowerColor.values()) {
|
||||
itemList.add(new CeramicBrickPair(color, color, CeramicBrickType.TILE).getStack(1));
|
||||
}
|
||||
for (CeramicBrickType type : CeramicBrickType.VALUES) {
|
||||
if (type.canDouble()) {
|
||||
itemList.add(new CeramicBrickPair(EnumFlowerColor.Brown, EnumFlowerColor.Gold, type).getStack(1));
|
||||
}
|
||||
}
|
||||
itemList.add(new CeramicBrickPair(EnumFlowerColor.Gold, EnumFlowerColor.Gold, CeramicBrickType.SPLIT).getStack(1));
|
||||
itemList.add(new CeramicBrickPair(EnumFlowerColor.Brown, EnumFlowerColor.Brown, CeramicBrickType.CHEQUERED).getStack(1));
|
||||
itemList.add(new CeramicBrickPair(EnumFlowerColor.Gold, EnumFlowerColor.Brown, CeramicBrickType.LARGE_BRICK).getStack(1));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerStateMapper() {
|
||||
ResourceLocation resourceLocation = new ResourceLocation(Constants.BOTANY_MOD_ID, "ceramicBrick");
|
||||
ModelLoader.setCustomStateMapper(this, new DefaultStateMapper(resourceLocation));
|
||||
ModelManager.registerCustomBlockModel(new BlockModelEntry(
|
||||
new ModelResourceLocation(resourceLocation, "normal"),
|
||||
new ModelResourceLocation(resourceLocation, "inventory"),
|
||||
new ModelMutlipass<>(BlockCeramicBrick.class),
|
||||
this
|
||||
));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
manager.registerItemModel(item, new CeramicBrickMeshDefinition());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new ExtendedBlockState(
|
||||
this,
|
||||
new IProperty[]{TYPE},
|
||||
new IUnlistedProperty[]{
|
||||
UnlistedBlockPos.POS,
|
||||
UnlistedBlockAccess.BLOCKACCESS
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return getDefaultState().withProperty(TYPE, CeramicBrickType.VALUES[meta]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(TYPE).ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
return ((IExtendedBlockState) super.getExtendedState(state, world, pos)).withProperty(UnlistedBlockPos.POS, pos).withProperty(UnlistedBlockAccess.BLOCKACCESS, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) {
|
||||
ItemStack stack = placer.getHeldItem(hand);
|
||||
CeramicBrickPair pair = new CeramicBrickPair(stack);
|
||||
return getDefaultState().withProperty(TYPE, pair.type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
|
||||
TileCeramicBrick ceramic = TileUtil.getTile(worldIn, pos, TileCeramicBrick.class);
|
||||
if (ceramic != null) {
|
||||
CeramicBrickPair pair = new CeramicBrickPair(stack);
|
||||
ceramic.setColors(pair.colorFirst, pair.colorSecond);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||
TileCeramicBrick ceramic = TileUtil.getTile(world, pos, TileCeramicBrick.class);
|
||||
if (ceramic != null) {
|
||||
return ceramic.pair().getStack(0);
|
||||
}
|
||||
return super.getPickBlock(state, target, world, pos, player);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int colorMultiplier(IBlockState state, @Nullable IBlockAccess world, @Nullable BlockPos pos, int tintIndex) {
|
||||
if (world != null && pos != null) {
|
||||
TileCeramicBrick ceramic = TileUtil.getTile(world, pos, TileCeramicBrick.class);
|
||||
if (ceramic != null) {
|
||||
if (tintIndex == 1) {
|
||||
return ceramic.getColorFirst().getFlowerColorAllele().getColor(false);
|
||||
} else if (tintIndex == 2) {
|
||||
return ceramic.getColorSecond().getFlowerColorAllele().getColor(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderPasses() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public CeramicBrickPair getInventoryKey(ItemStack stack) {
|
||||
return new CeramicBrickPair(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public CeramicBrickPair getWorldKey(IBlockState state) {
|
||||
IExtendedBlockState extendedState = (IExtendedBlockState) state;
|
||||
IBlockAccess world = extendedState.getValue(UnlistedBlockAccess.BLOCKACCESS);
|
||||
BlockPos pos = extendedState.getValue(UnlistedBlockPos.POS);
|
||||
TileCeramicBrick ceramic = TileUtil.getTile(world, pos, TileCeramicBrick.class);
|
||||
if (ceramic != null) {
|
||||
return ceramic.pair();
|
||||
}
|
||||
return CeramicBrickPair.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public TextureAtlasSprite getSprite(CeramicBrickPair type, @Nullable EnumFacing facing, int pass) {
|
||||
return type.getSprite(pass);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerSprites(ITextureManager manager) {
|
||||
TextureMap textureMap = Minecraft.getMinecraft().getTextureMapBlocks();
|
||||
for (CeramicBrickType type : CeramicBrickType.VALUES) {
|
||||
type.sprites = new TextureAtlasSprite[3];
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
type.sprites[i] = textureMap.registerSprite(new ResourceLocation(Constants.BOTANY_MOD_ID + ":blocks/ceramic." + type.id + "." + i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class CeramicBrickMeshDefinition implements ItemMeshDefinition {
|
||||
@Override
|
||||
public ModelResourceLocation getModelLocation(ItemStack stack) {
|
||||
return new ModelResourceLocation(Constants.BOTANY_MOD_ID + ":ceramicBrick", "inventory");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package binnie.botany.blocks;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import binnie.botany.ceramic.CeramicColor;
|
||||
import binnie.botany.ceramic.CeramicDesignSystem;
|
||||
import binnie.botany.api.genetics.EnumFlowerColor;
|
||||
import binnie.core.util.I18N;
|
||||
import binnie.extratrees.api.IDesign;
|
||||
import binnie.extratrees.carpentry.BlockDesign;
|
||||
import binnie.extratrees.carpentry.DesignBlock;
|
||||
import binnie.extratrees.carpentry.ModuleCarpentry;
|
||||
|
||||
public class BlockCeramicPatterned extends BlockDesign {
|
||||
public BlockCeramicPatterned() {
|
||||
super(CeramicDesignSystem.instance, Material.ROCK);
|
||||
setHardness(1.0f);
|
||||
setResistance(5.0f);
|
||||
setRegistryName("ceramicPattern");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCreativeStack(IDesign design) {
|
||||
return ModuleCarpentry.getItemStack(this, CeramicColor.get(EnumFlowerColor.White), CeramicColor.get(EnumFlowerColor.Black), design);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBlockName(DesignBlock design) {
|
||||
return I18N.localise("botany.ceramic.block.name", design.getDesign().getName());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,310 @@
|
||||
package binnie.botany.blocks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IStateMapperRegister;
|
||||
import forestry.core.blocks.IColoredBlock;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.api.genetics.IFlower;
|
||||
import binnie.botany.api.genetics.IFlowerGenome;
|
||||
import binnie.botany.api.genetics.IFlowerRoot;
|
||||
import binnie.botany.api.genetics.IFlowerType;
|
||||
import binnie.botany.blocks.properties.PropertyFlower;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.botany.genetics.EnumFlowerType;
|
||||
import binnie.botany.genetics.FlowerDefinition;
|
||||
import binnie.botany.models.StateMapperFlower;
|
||||
import binnie.botany.modules.ModuleFlowers;
|
||||
import binnie.botany.network.PacketID;
|
||||
import binnie.botany.tile.TileEntityFlower;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.network.packet.MessageNBT;
|
||||
import binnie.core.util.TileUtil;
|
||||
|
||||
public class BlockFlower extends BlockContainer implements IColoredBlock, IStateMapperRegister {
|
||||
public static final AxisAlignedBB FLOWER_BLOCK_AABB = new AxisAlignedBB(0.3D, 0.0D, 0.3D, 0.7D, 0.6D, 0.7D);
|
||||
/* PROPERTIES */
|
||||
public static final PropertyFlower FLOWER = new PropertyFlower("flower", IFlowerType.class);
|
||||
public static final PropertyInteger SECTION = PropertyInteger.create("section", 0, EnumFlowerType.highestSection - 1);
|
||||
public static final PropertyBool FLOWERED = PropertyBool.create("flowered");
|
||||
public static final PropertyBool SEED = PropertyBool.create("seed");
|
||||
|
||||
public BlockFlower() {
|
||||
super(Material.PLANTS);
|
||||
setTickRandomly(true);
|
||||
setRegistryName("flower");
|
||||
setSoundType(SoundType.PLANT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityFlower();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerStateMapper() {
|
||||
ModelLoader.setCustomStateMapper(this, new StateMapperFlower());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
ItemStack heldItem = player.getHeldItemMainhand();
|
||||
if (heldItem.isEmpty() || heldItem.getItem() != BinnieCore.getFieldKit() || !player.isSneaking()) {
|
||||
return false;
|
||||
}
|
||||
if (world.isRemote) {
|
||||
return true;
|
||||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (!(tile instanceof TileEntityFlower)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
TileEntityFlower tileFlower = (TileEntityFlower) tile;
|
||||
IFlower flower = tileFlower.getFlower();
|
||||
if (flower == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
IFlowerGenome flowerGenome = flower.getGenome();
|
||||
NBTTagCompound info = new NBTTagCompound();
|
||||
info.setString("Species", flowerGenome.getPrimary().getUID());
|
||||
info.setString("Species2", flowerGenome.getSecondary().getUID());
|
||||
info.setFloat("Age", flower.getAge() / flowerGenome.getLifespan());
|
||||
info.setShort("Colour", (short) flowerGenome.getPrimaryColor().getID());
|
||||
info.setShort("Colour2", (short) flowerGenome.getSecondaryColor().getID());
|
||||
info.setBoolean("Wilting", flower.isWilted());
|
||||
info.setBoolean("Flowered", flower.hasFlowered());
|
||||
Botany.proxy.sendToPlayer(new MessageNBT(PacketID.FIELDKIT.ordinal(), info), player);
|
||||
heldItem.damageItem(1, player);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
TileEntity tile = source.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
if (flower.getType().getSections() > 1) {
|
||||
return FULL_BLOCK_AABB;
|
||||
}
|
||||
}
|
||||
return FLOWER_BLOCK_AABB.offset(getOffset(state, source, pos));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
|
||||
super.onBlockPlacedBy(world, pos, state, placer, stack);
|
||||
IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot();
|
||||
TileEntity flower = world.getTileEntity(pos);
|
||||
if (!!world.isRemote) {
|
||||
if (flower != null && flower instanceof TileEntityFlower) {
|
||||
IFlower f = flowerRoot.getMember(stack);
|
||||
if (f != null) {
|
||||
((TileEntityFlower) flower).setRender(new TileEntityFlower.RenderInfo(f, (TileEntityFlower) flower));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntity below = world.getTileEntity(pos.down());
|
||||
if (flower != null && flower instanceof TileEntityFlower) {
|
||||
if (below instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) flower).setSection(((TileEntityFlower) below).getSection());
|
||||
} else {
|
||||
GameProfile owner = (placer instanceof EntityPlayer) ? ((EntityPlayer) placer).getGameProfile() : null;
|
||||
((TileEntityFlower) flower).create(stack, owner);
|
||||
}
|
||||
}
|
||||
flowerRoot.tryGrowSection(world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier(IBlockState state, @Nullable IBlockAccess world, @Nullable BlockPos pos, int tintIndex) {
|
||||
if (world != null && pos != null) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
if (tintIndex == 0) {
|
||||
return flower.getStemColour();
|
||||
} else if (tintIndex == 1) {
|
||||
return flower.getPrimaryColour();
|
||||
}
|
||||
return flower.getSecondaryColour();
|
||||
}
|
||||
}
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockAt(World world, BlockPos pos) {
|
||||
return super.canPlaceBlockAt(world, pos) && canBlockStay(world, pos);
|
||||
}
|
||||
|
||||
public boolean canBlockStay(World world, BlockPos pos) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
IBlockState downState = world.getBlockState(pos.down());
|
||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() > 0) {
|
||||
return downState.getBlock() == ModuleFlowers.flower;
|
||||
}
|
||||
return canPlaceBlockOn(downState.getBlock());
|
||||
}
|
||||
|
||||
protected boolean canPlaceBlockOn(Block block) {
|
||||
return block == Blocks.GRASS
|
||||
|| block == Blocks.DIRT
|
||||
|| block == Blocks.FARMLAND
|
||||
|| BotanyCore.getGardening().isSoil(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public EnumBlockRenderType getRenderType(IBlockState state) {
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public EnumOffsetType getOffsetType() {
|
||||
return EnumOffsetType.XZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
TileEntityFlower flower = TileUtil.getTile(world, pos, TileEntityFlower.class);
|
||||
if (flower != null && flower.getType() != null) {
|
||||
state = state.withProperty(FLOWER, flower.getType());
|
||||
state = state.withProperty(FLOWERED, flower.isFlowered());
|
||||
state = state.withProperty(SECTION, flower.getRenderSection());
|
||||
state = state.withProperty(SEED, flower.getAge() == 0);
|
||||
} else {
|
||||
state = state.withProperty(FLOWER, FlowerDefinition.Dandelion.getSpecies().getType());
|
||||
state = state.withProperty(FLOWERED, false);
|
||||
state = state.withProperty(SEED, false);
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, FLOWER, FLOWERED, SECTION, SEED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
||||
checkAndDropBlock(worldIn, pos);
|
||||
TileEntity tile = worldIn.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||
if (flower.getSection() == 0 && flower.getFlower() != null && flower.getFlower().getAge() > 0 && flower.getFlower().getGenome().getPrimary().getType().getSections() > 1 && worldIn.getBlockState(pos.up()).getBlock() != ModuleFlowers.flower) {
|
||||
dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0);
|
||||
worldIn.setBlockToAir(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFlower) {
|
||||
((TileEntityFlower) tile).randomUpdate(rand);
|
||||
checkAndDropBlock(world, pos);
|
||||
return;
|
||||
}
|
||||
world.setBlockToAir(pos);
|
||||
}
|
||||
|
||||
protected void checkAndDropBlock(World world, BlockPos pos) {
|
||||
if (!canBlockStay(world, pos)) {
|
||||
dropBlockAsItem(world, pos, world.getBlockState(pos), 0);
|
||||
world.setBlockToAir(pos);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() == 0) {
|
||||
ItemStack flower = ((TileEntityFlower) tile).getItemStack();
|
||||
if (!flower.isEmpty()) {
|
||||
drops.add(flower);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
|
||||
List<ItemStack> drops = getDrops(world, pos, world.getBlockState(pos), 0);
|
||||
boolean hasBeenBroken = world.setBlockToAir(pos);
|
||||
if (hasBeenBroken && !world.isRemote && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||
for (ItemStack drop : drops) {
|
||||
spawnAsEntity(world, pos, drop);
|
||||
}
|
||||
}
|
||||
return hasBeenBroken;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
package binnie.botany.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockBush;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.api.gardening.EnumSoilType;
|
||||
import binnie.botany.api.gardening.IBlockSoil;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
|
||||
public class BlockPlant extends BlockBush implements IItemModelRegister {
|
||||
public static final PropertyEnum<PlantType> PLANT_TYPE = PropertyEnum.create("plant_type", PlantType.class);
|
||||
|
||||
public BlockPlant() {
|
||||
setRegistryName("plant");
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setTickRandomly(true);
|
||||
setSoundType(SoundType.PLANT);
|
||||
}
|
||||
|
||||
public static boolean isWeed(IBlockAccess world, BlockPos pos) {
|
||||
IBlockState blockState = world.getBlockState(pos);
|
||||
if (!(blockState.getBlock() instanceof BlockPlant)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
PlantType type = blockState.getValue(PLANT_TYPE);
|
||||
return type.isWeed();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
for (int i = 0;i < PlantType.values().length;i++) {
|
||||
PlantType type = PlantType.getType(i);
|
||||
manager.registerItemModel(item, i, type.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, PLANT_TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(PLANT_TYPE).ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return getDefaultState().withProperty(PLANT_TYPE, PlantType.getType(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockAt(World worldIn, BlockPos pos) {
|
||||
return super.canPlaceBlockAt(worldIn, pos) || BotanyCore.getGardening().isSoil(worldIn.getBlockState(pos).getBlock());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(CreativeTabs p_149666_2_, NonNullList<ItemStack> subBlocks) {
|
||||
for (PlantType type : PlantType.values()) {
|
||||
subBlocks.add(type.get());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
|
||||
PlantType type = state.getValue(PLANT_TYPE);
|
||||
if (rand.nextInt(4) == 0) {
|
||||
if (type == PlantType.WEEDS) {
|
||||
world.setBlockState(pos, state.withProperty(PLANT_TYPE, PlantType.WEEDS_LONG), 2);
|
||||
} else if (type == PlantType.WEEDS_LONG) {
|
||||
world.setBlockState(pos, state.withProperty(PLANT_TYPE, PlantType.WEEDS_VERY_LONG), 2);
|
||||
} else if (type == PlantType.DEAD_FLOWER) {
|
||||
world.setBlockState(pos, state.withProperty(PLANT_TYPE, PlantType.DECAYING_FLOWER), 2);
|
||||
} else if (type == PlantType.DECAYING_FLOWER) {
|
||||
world.setBlockToAir(pos);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (rand.nextInt(6) == 0) {
|
||||
if (type == PlantType.WEEDS) {
|
||||
world.setBlockToAir(pos);
|
||||
} else if (type == PlantType.WEEDS_LONG) {
|
||||
world.setBlockState(pos, state.withProperty(PLANT_TYPE, PlantType.WEEDS), 2);
|
||||
} else if (type == PlantType.WEEDS_VERY_LONG) {
|
||||
world.setBlockState(pos, state.withProperty(PLANT_TYPE, PlantType.WEEDS_LONG), 2);
|
||||
}
|
||||
}
|
||||
|
||||
Block below = world.getBlockState(pos.down()).getBlock();
|
||||
if (!BotanyCore.getGardening().isSoil(below)) {
|
||||
return;
|
||||
}
|
||||
|
||||
IBlockSoil soil = (IBlockSoil) below;
|
||||
if (rand.nextInt(3) != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (type.isWeed()) {
|
||||
if (!soil.degrade(world, pos.down(), EnumSoilType.LOAM)) {
|
||||
soil.degrade(world, pos.down(), EnumSoilType.SOIL);
|
||||
}
|
||||
} else if (type == PlantType.DECAYING_FLOWER && !soil.fertilise(world, pos.down(), EnumSoilType.LOAM)) {
|
||||
soil.fertilise(world, pos.down(), EnumSoilType.FLOWERBED);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReplaceable(IBlockAccess worldIn, BlockPos pos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumOffsetType getOffsetType() {
|
||||
return EnumOffsetType.XZ;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,322 @@
|
||||
package binnie.botany.blocks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
|
||||
import binnie.core.Constants;
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.api.gardening.EnumAcidity;
|
||||
import binnie.botany.api.gardening.EnumMoisture;
|
||||
import binnie.botany.api.gardening.EnumSoilType;
|
||||
import binnie.botany.api.gardening.IBlockSoil;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.core.modules.BotanyModuleUIDs;
|
||||
import binnie.botany.modules.ModuleFlowers;
|
||||
import binnie.botany.modules.ModuleGardening;
|
||||
import binnie.core.util.I18N;
|
||||
import binnie.core.modules.ModuleManager;
|
||||
|
||||
public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister {
|
||||
public static final PropertyEnum<EnumMoisture> MOISTURE = PropertyEnum.create("moisture", EnumMoisture.class);
|
||||
public static final PropertyEnum<EnumAcidity> ACIDITY = PropertyEnum.create("acidity", EnumAcidity.class);
|
||||
public static final AxisAlignedBB SOIL_BLOCK_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.9375D, 1.0D);
|
||||
private final boolean weedKilled;
|
||||
private final EnumSoilType type;
|
||||
|
||||
public BlockSoil(EnumSoilType type, String blockName, boolean weedKilled) {
|
||||
super(Material.GROUND);
|
||||
this.type = type;
|
||||
this.weedKilled = weedKilled;
|
||||
setUnlocalizedName("botany.soil." + type.getName());
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setRegistryName(blockName);
|
||||
setTickRandomly(true);
|
||||
setLightOpacity(255);
|
||||
setHardness(0.5f);
|
||||
setSoundType(SoundType.GROUND);
|
||||
}
|
||||
|
||||
public static int getMeta(EnumAcidity acid, EnumMoisture moisture) {
|
||||
return acid.ordinal() * 3 + moisture.ordinal();
|
||||
}
|
||||
|
||||
public static String getPH(ItemStack stack, boolean withColor, boolean byNeutralNone) {
|
||||
EnumAcidity ph = EnumAcidity.values()[stack.getItemDamage() / 3];
|
||||
if (byNeutralNone) {
|
||||
if (ph == EnumAcidity.NEUTRAL) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
return TextFormatting.GRAY + I18N.localise("botany.ph") + ": " + ph.getLocalisedName(withColor);
|
||||
}
|
||||
|
||||
public static String getMoisture(ItemStack stack, boolean withColor, boolean byNormalNone) {
|
||||
EnumMoisture moisure = EnumMoisture.values()[stack.getItemDamage() % 3];
|
||||
if (byNormalNone) {
|
||||
if (moisure == EnumMoisture.NORMAL) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
return TextFormatting.GRAY + I18N.localise("botany.moisture") + ": " + moisure.getLocalisedName(withColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
|
||||
switch (side) {
|
||||
case UP:
|
||||
return true;
|
||||
|
||||
case NORTH:
|
||||
case SOUTH:
|
||||
case WEST:
|
||||
case EAST:
|
||||
IBlockState iblockstate = blockAccess.getBlockState(pos.offset(side));
|
||||
Block block = iblockstate.getBlock();
|
||||
return !iblockstate.isOpaqueCube() && block != Blocks.FARMLAND && block != Blocks.GRASS_PATH && block != this;
|
||||
}
|
||||
return super.shouldSideBeRendered(blockState, blockAccess, pos, side);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to determine ambient occlusion and culling when rebuilding chunks for render
|
||||
*/
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName() {
|
||||
return super.getUnlocalizedName().replaceFirst("tile.", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||
return SOIL_BLOCK_AABB;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) {
|
||||
return SOIL_BLOCK_AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World worldIn, BlockPos pos) {
|
||||
return SOIL_BLOCK_AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
list.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
for (EnumAcidity acidity : EnumAcidity.values()) {
|
||||
for (EnumMoisture moisture : EnumMoisture.values()) {
|
||||
String modelName = "";
|
||||
if (acidity != EnumAcidity.NEUTRAL) {
|
||||
modelName += acidity.getName();
|
||||
}
|
||||
|
||||
if (moisture != EnumMoisture.NORMAL) {
|
||||
if (!modelName.isEmpty()) {
|
||||
modelName += "_";
|
||||
}
|
||||
modelName += moisture.getName();
|
||||
}
|
||||
|
||||
if (modelName.isEmpty()) {
|
||||
modelName = "normal";
|
||||
}
|
||||
|
||||
String identifier;
|
||||
if (weedKilled) {
|
||||
identifier = type.getName() + "_no_weed/" + modelName;
|
||||
} else {
|
||||
identifier = type.getName() + "/" + modelName;
|
||||
}
|
||||
manager.registerItemModel(item, moisture.ordinal() + acidity.ordinal() * 3, identifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
return new BlockStateContainer(this, MOISTURE, ACIDITY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return getMeta(state.getValue(ACIDITY), state.getValue(MOISTURE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
EnumMoisture moisture = EnumMoisture.values()[meta % 3];
|
||||
EnumAcidity acidity = EnumAcidity.values()[meta / 3];
|
||||
return getDefaultState().withProperty(MOISTURE, moisture).withProperty(ACIDITY, acidity);
|
||||
}
|
||||
|
||||
public EnumSoilType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(IBlockState state) {
|
||||
return getMetaFromState(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
|
||||
EnumMoisture moisture = state.getValue(MOISTURE);
|
||||
EnumMoisture desiredMoisture = BotanyCore.getGardening().getNaturalMoisture(world, pos);
|
||||
if (desiredMoisture.ordinal() > moisture.ordinal()) {
|
||||
moisture = ((moisture == EnumMoisture.DRY) ? EnumMoisture.NORMAL : EnumMoisture.DAMP);
|
||||
} else if (desiredMoisture.ordinal() < moisture.ordinal()) {
|
||||
moisture = ((moisture == EnumMoisture.DAMP) ? EnumMoisture.NORMAL : EnumMoisture.DRY);
|
||||
}
|
||||
|
||||
IBlockState blockState = state.withProperty(MOISTURE, moisture);
|
||||
if (state != blockState) {
|
||||
world.setBlockState(pos, blockState, 2);
|
||||
}
|
||||
|
||||
if (!weedKilled) {
|
||||
if (rand.nextInt(5 - getType(world, pos).ordinal()) != 0) {
|
||||
return;
|
||||
}
|
||||
pos = pos.up();
|
||||
if (!world.isAirBlock(pos)) {
|
||||
return;
|
||||
}
|
||||
world.setBlockState(pos, ModuleGardening.plant.getStateFromMeta(PlantType.WEEDS.ordinal()), 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) {
|
||||
super.neighborChanged(state, worldIn, pos, blockIn, fromPos);
|
||||
|
||||
if (worldIn.getBlockState(pos.up()).getMaterial().isSolid()) {
|
||||
worldIn.setBlockState(pos, Blocks.DIRT.getDefaultState());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAcidity getPH(World world, BlockPos pos) {
|
||||
return world.getBlockState(pos).getValue(ACIDITY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumMoisture getMoisture(World world, BlockPos pos) {
|
||||
return world.getBlockState(pos).getValue(MOISTURE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumSoilType getType(World world, BlockPos pos) {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean fertilise(World world, BlockPos pos, EnumSoilType maxLevel) {
|
||||
EnumSoilType type = getType(world, pos);
|
||||
if (type.ordinal() >= maxLevel.ordinal()) {
|
||||
return false;
|
||||
}
|
||||
IBlockState old = world.getBlockState(pos);
|
||||
IBlockState newState = BotanyCore.getGardening().getSoil(maxLevel, weedKilled, old.getValue(MOISTURE), old.getValue(ACIDITY));
|
||||
return world.setBlockState(pos, newState, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean degrade(World world, BlockPos pos, EnumSoilType minLevel) {
|
||||
EnumSoilType type = getType(world, pos);
|
||||
if (type.ordinal() <= minLevel.ordinal()) {
|
||||
return false;
|
||||
}
|
||||
IBlockState old = world.getBlockState(pos);
|
||||
IBlockState newState = BotanyCore.getGardening().getSoil(minLevel, weedKilled, old.getValue(MOISTURE), old.getValue(ACIDITY));
|
||||
return world.setBlockState(pos, newState, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setPH(World world, BlockPos pos, EnumAcidity pH) {
|
||||
IBlockState blockState = world.getBlockState(pos);
|
||||
return world.setBlockState(pos, blockState.withProperty(ACIDITY, pH));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setMoisture(World world, BlockPos pos, EnumMoisture moisture) {
|
||||
IBlockState blockState = world.getBlockState(pos);
|
||||
return world.setBlockState(pos, blockState.withProperty(MOISTURE, moisture));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor) {
|
||||
super.onNeighborChange(world, pos, neighbor);
|
||||
if (world.isSideSolid(pos.up(), EnumFacing.DOWN, false)) {
|
||||
((World) world).setBlockState(pos, Blocks.DIRT.getDefaultState(), 2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable) {
|
||||
IBlockState plant = plantable.getPlant(world, pos.up());
|
||||
if(ModuleManager.isModuleEnabled(Constants.BOTANY_MOD_ID, BotanyModuleUIDs.FLOWERS)) {
|
||||
if (plant.getBlock() == ModuleFlowers.flower) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (plant.getBlock() == ModuleGardening.plant) {
|
||||
return !weedKilled || !BlockPlant.isWeed(world, pos);
|
||||
}
|
||||
return world instanceof World && Blocks.DIRT.canSustainPlant(state, world, pos, direction, plantable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean resistsWeeds(World world, BlockPos pos) {
|
||||
return weedKilled;
|
||||
}
|
||||
|
||||
public boolean isWeedKilled() {
|
||||
return weedKilled;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
package binnie.botany.blocks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Enchantments;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.StatList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.IItemModelRegister;
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.core.blocks.IColoredBlock;
|
||||
|
||||
import binnie.botany.CreativeTabBotany;
|
||||
import binnie.botany.api.genetics.EnumFlowerColor;
|
||||
import binnie.core.api.block.BlockMetadata;
|
||||
import binnie.core.api.block.IBlockMetadata;
|
||||
import binnie.core.api.block.TileEntityMetadata;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class BlockStainedGlass extends Block implements IBlockMetadata, IColoredBlock, IItemModelRegister {
|
||||
public BlockStainedGlass() {
|
||||
super(Material.GLASS);
|
||||
setCreativeTab(CreativeTabBotany.instance);
|
||||
setRegistryName("stained");
|
||||
setSoundType(SoundType.GLASS);
|
||||
setHardness(0.3F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped(Random rand) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer() {
|
||||
return BlockRenderLayer.TRANSLUCENT;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
for (EnumFlowerColor color : EnumFlowerColor.values()) {
|
||||
manager.registerItemModel(item, color.getFlowerColorAllele().getID());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
|
||||
IBlockState iblockstate = blockAccess.getBlockState(pos.offset(side));
|
||||
Block block = iblockstate.getBlock();
|
||||
return block != this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, ItemStack stack) {
|
||||
player.addStat(StatList.getBlockStats(this));
|
||||
player.addExhaustion(0.005F);
|
||||
|
||||
if (EnchantmentHelper.getEnchantmentLevel(Enchantments.SILK_TOUCH, stack) > 0 && te instanceof TileEntityMetadata) {
|
||||
List<ItemStack> items = new ArrayList<>();
|
||||
TileEntityMetadata tile = (TileEntityMetadata) te;
|
||||
int damage = getDroppedMeta(state, tile.getTileMetadata());
|
||||
ItemStack itemstack = TileEntityMetadata.getItemStack(this, damage);
|
||||
|
||||
if (!itemstack.isEmpty()) {
|
||||
items.add(itemstack);
|
||||
}
|
||||
|
||||
ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, state, 0, 1.0f, true, player);
|
||||
for (ItemStack item : items) {
|
||||
spawnAsEntity(worldIn, pos, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int i) {
|
||||
return new TileEntityMetadata();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(IBlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eventReceived(IBlockState state, World worldIn, BlockPos pos, int id, int param) {
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
return tileentity != null && tileentity.receiveClientEvent(id, param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlacedMeta(ItemStack stack, World world, BlockPos pos, EnumFacing clickedBlock) {
|
||||
return TileEntityMetadata.getItemDamage(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDroppedMeta(IBlockState state, int tileMetadata) {
|
||||
return tileMetadata;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName(ItemStack itemStack) {
|
||||
EnumFlowerColor color = EnumFlowerColor.get(TileEntityMetadata.getItemDamage(itemStack));
|
||||
return I18N.localise("botany.pigmented.glass.name", color.getDisplayName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> itemList) {
|
||||
for (EnumFlowerColor color : EnumFlowerColor.values()) {
|
||||
itemList.add(TileEntityMetadata.getItemStack(this, color.ordinal()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWood(IBlockAccess world, BlockPos pos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face) {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFlammable(IBlockAccess world, BlockPos pos, EnumFacing face) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||
return BlockMetadata.getPickBlock(world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int colorMultiplier(IBlockState state, @Nullable IBlockAccess worldIn, @Nullable BlockPos pos, int tintIndex) {
|
||||
if (worldIn == null || pos == null) {
|
||||
return 0;
|
||||
}
|
||||
EnumFlowerColor color = EnumFlowerColor.get(TileEntityMetadata.getTileMetadata(worldIn, pos));
|
||||
return color.getFlowerColorAllele().getColor(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package binnie.botany.blocks;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
import binnie.botany.modules.ModuleGardening;
|
||||
|
||||
public enum PlantType implements IStringSerializable {
|
||||
WEEDS("weeds", true),
|
||||
WEEDS_LONG("weeds_long", true),
|
||||
WEEDS_VERY_LONG("weeds_very_long", true),
|
||||
DEAD_FLOWER("dead_flower"),
|
||||
DECAYING_FLOWER("decaying_flower");
|
||||
|
||||
String name;
|
||||
boolean isWeed;
|
||||
|
||||
PlantType(String name) {
|
||||
this(name, false);
|
||||
}
|
||||
|
||||
PlantType(String name, boolean isWeed) {
|
||||
this.name = name;
|
||||
this.isWeed = isWeed;
|
||||
}
|
||||
|
||||
public static PlantType getType(int meta){
|
||||
if(meta >= values().length){
|
||||
meta = values().length-1;
|
||||
}
|
||||
return values()[meta];
|
||||
}
|
||||
|
||||
public ItemStack get() {
|
||||
return new ItemStack(ModuleGardening.plant, 1, ordinal());
|
||||
}
|
||||
|
||||
public boolean isWeed() {
|
||||
return isWeed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.botany.blocks;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -0,0 +1,53 @@
|
||||
package binnie.botany.blocks.properties;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.block.properties.PropertyHelper;
|
||||
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
|
||||
import binnie.botany.api.genetics.IAlleleFlowerSpecies;
|
||||
import binnie.botany.api.genetics.IFlowerType;
|
||||
|
||||
public class PropertyFlower<I extends IFlowerType<I>> extends PropertyHelper<I> {
|
||||
public PropertyFlower(String name, Class<I> flowerTypeClass) {
|
||||
super(name, flowerTypeClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<I> getAllowedValues() {
|
||||
List<I> flowerTypes = new ArrayList<>();
|
||||
for (IAllele allele : AlleleManager.alleleRegistry.getRegisteredAlleles().values()) {
|
||||
if (allele instanceof IAlleleFlowerSpecies) {
|
||||
IFlowerType flowerType = ((IAlleleFlowerSpecies) allele).getType();
|
||||
if (!flowerTypes.contains(flowerType)) {
|
||||
flowerTypes.add((I) flowerType);
|
||||
}
|
||||
}
|
||||
}
|
||||
return flowerTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name for the given value.
|
||||
*/
|
||||
@Override
|
||||
public String getName(IFlowerType value) {
|
||||
return value.getName().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<I> parseValue(String value) {
|
||||
IAllele allele = AlleleManager.alleleRegistry.getAllele(value);
|
||||
if (IAlleleFlowerSpecies.class.isInstance(allele)) {
|
||||
IAlleleFlowerSpecies alleleValue = IAlleleFlowerSpecies.class.cast(allele);
|
||||
return Optional.of((I) alleleValue.getType());
|
||||
}
|
||||
return Optional.absent();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.botany.blocks.properties;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -0,0 +1,51 @@
|
||||
package binnie.botany.ceramic;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import binnie.botany.api.genetics.EnumFlowerColor;
|
||||
import binnie.botany.modules.ModuleCeramic;
|
||||
import binnie.core.api.block.TileEntityMetadata;
|
||||
import binnie.extratrees.api.IDesignMaterial;
|
||||
|
||||
public class CeramicColor implements IDesignMaterial {
|
||||
private final static Map<EnumFlowerColor, CeramicColor> map = new LinkedHashMap<>();
|
||||
|
||||
static {
|
||||
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||
CeramicColor.map.put(c, new CeramicColor(c));
|
||||
}
|
||||
}
|
||||
|
||||
EnumFlowerColor color;
|
||||
|
||||
CeramicColor(EnumFlowerColor color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public static CeramicColor get(EnumFlowerColor c) {
|
||||
return CeramicColor.map.get(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStack() {
|
||||
return TileEntityMetadata.getItemStack(ModuleCeramic.ceramic, color.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStack(boolean fireproof) {
|
||||
return getStack();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDesignMaterialName() {
|
||||
return color.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColour() {
|
||||
return color.getFlowerColorAllele().getColor(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package binnie.botany.ceramic;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import binnie.extratrees.api.carpentry.DesignerManager;
|
||||
import binnie.extratrees.api.carpentry.EnumPattern;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import binnie.botany.Botany;
|
||||
import binnie.botany.api.genetics.EnumFlowerColor;
|
||||
import binnie.botany.items.CeramicItems;
|
||||
import binnie.botany.modules.ModuleCeramic;
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.extratrees.api.IDesignMaterial;
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
import binnie.extratrees.api.IPattern;
|
||||
|
||||
public class CeramicDesignSystem implements IDesignSystem {
|
||||
public static CeramicDesignSystem instance = new CeramicDesignSystem();
|
||||
Map<Integer, TextureAtlasSprite> primary;
|
||||
Map<Integer, TextureAtlasSprite> secondary;
|
||||
|
||||
CeramicDesignSystem() {
|
||||
primary = new HashMap<>();
|
||||
secondary = new HashMap<>();
|
||||
DesignerManager.instance.registerDesignSystem(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDesignMaterial getDefaultMaterial() {
|
||||
return CeramicColor.get(EnumFlowerColor.White);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDesignMaterial getDefaultMaterial2() {
|
||||
return CeramicColor.get(EnumFlowerColor.Black);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDesignMaterial getMaterial(int id) {
|
||||
return CeramicColor.get(EnumFlowerColor.get(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaterialIndex(IDesignMaterial id) {
|
||||
return ((CeramicColor) id).color.ordinal();
|
||||
}
|
||||
|
||||
public String getTexturePath() {
|
||||
return "blocks/ceramic";
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
@SideOnly(Side.CLIENT)
|
||||
public TextureAtlasSprite getPrimarySprite(IPattern pattern) {
|
||||
int index = pattern.getIndex();
|
||||
if (index > 0 && index < primary.size()) {
|
||||
return primary.get(index);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
@SideOnly(Side.CLIENT)
|
||||
public TextureAtlasSprite getSecondarySprite(IPattern pattern) {
|
||||
int index = pattern.getIndex();
|
||||
if (index > 0 && index < secondary.size()) {
|
||||
return secondary.get(index);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerSprites() {
|
||||
TextureMap textureMap = Minecraft.getMinecraft().getTextureMapBlocks();
|
||||
for (EnumPattern pattern : EnumPattern.values()) {
|
||||
ResourceLocation primaryLocation = new ResourceLocation(getMod().getModID(), getTexturePath() + "/" + pattern.toString().toLowerCase() + ".0");
|
||||
ResourceLocation secondaryLocation = new ResourceLocation(getMod().getModID(), getTexturePath() + "/" + pattern.toString().toLowerCase() + ".1");
|
||||
primary.put(pattern.getIndex(), textureMap.registerSprite(primaryLocation));
|
||||
secondary.put(pattern.getIndex(), textureMap.registerSprite(secondaryLocation));
|
||||
}
|
||||
}
|
||||
|
||||
public AbstractMod getMod() {
|
||||
return Botany.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getAdhesive() {
|
||||
return CeramicItems.MORTAR.get(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public IDesignMaterial getMaterial(ItemStack itemStack) {
|
||||
return (itemStack.getItem() == Item.getItemFromBlock(ModuleCeramic.ceramic))
|
||||
? getMaterial(itemStack.getItemDamage())
|
||||
: null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package binnie.botany.ceramic.brick;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagInt;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import binnie.botany.api.genetics.EnumFlowerColor;
|
||||
import binnie.botany.modules.ModuleCeramic;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class CeramicBrickPair {
|
||||
public static final CeramicBrickPair EMPTY = new CeramicBrickPair(EnumFlowerColor.DarkSeaGreen, EnumFlowerColor.DarkSeaGreen, CeramicBrickType.TILE);
|
||||
|
||||
public final EnumFlowerColor colorFirst;
|
||||
public final EnumFlowerColor colorSecond;
|
||||
|
||||
public CeramicBrickType type;
|
||||
public int ordinal;
|
||||
|
||||
public CeramicBrickPair(EnumFlowerColor colorFirst, EnumFlowerColor colorSecond, CeramicBrickType type) {
|
||||
this.colorFirst = colorFirst;
|
||||
this.colorSecond = colorSecond;
|
||||
this.type = type;
|
||||
ordinal = colorFirst.ordinal() + colorSecond.ordinal() * 256 + type.ordinal() * 256 * 256;
|
||||
}
|
||||
|
||||
public CeramicBrickPair(ItemStack stack) {
|
||||
this(getId(stack));
|
||||
}
|
||||
|
||||
public CeramicBrickPair(int id) {
|
||||
colorFirst = EnumFlowerColor.get(id & 0xFF);
|
||||
colorSecond = EnumFlowerColor.get(id >> 8 & 0xFF);
|
||||
type = CeramicBrickType.get(id >> 16 & 0xFF);
|
||||
}
|
||||
|
||||
public boolean isTwoColors() {
|
||||
return type.canDouble() && colorSecond != colorFirst;
|
||||
}
|
||||
|
||||
public static int getId(ItemStack stack){
|
||||
if(!stack.hasTagCompound()){
|
||||
return EMPTY.ordinal();
|
||||
}
|
||||
NBTTagCompound nbtTagCompound = stack.getTagCompound();
|
||||
return nbtTagCompound.getInteger("id");
|
||||
}
|
||||
|
||||
public ItemStack getStack(int i) {
|
||||
ItemStack stack = new ItemStack(ModuleCeramic.ceramicBrick, i);
|
||||
stack.setTagInfo("id", new NBTTagInt(ordinal()));
|
||||
return stack;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
String name = colorFirst.getFlowerColorAllele().getColorName();
|
||||
if (type.canDouble() && colorSecond != colorFirst) {
|
||||
name = name + " & " + colorSecond.getFlowerColorAllele().getColorName();
|
||||
}
|
||||
return I18N.localise("botany.ceramic.type." + type.id + ".name", name);
|
||||
}
|
||||
|
||||
public int ordinal() {
|
||||
return ordinal;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public TextureAtlasSprite getSprite(int pass) {
|
||||
TextureAtlasSprite[] sprites = type.sprites;
|
||||
Preconditions.checkState(sprites != null, "Sprites have not been registered.");
|
||||
return sprites[pass];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Integer.hashCode(type.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof CeramicBrickPair
|
||||
&& ((CeramicBrickPair) obj).type == type;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,329 @@
|
||||
package binnie.botany.ceramic.brick;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import binnie.botany.api.genetics.EnumFlowerColor;
|
||||
import binnie.botany.items.CeramicItems;
|
||||
import binnie.botany.modules.ModuleCeramic;
|
||||
import binnie.core.api.block.TileEntityMetadata;
|
||||
|
||||
public enum CeramicBrickType implements IStringSerializable {
|
||||
TILE("tile") {
|
||||
@Override
|
||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||
if (stacks.size() != 4) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
int mortars = 0;
|
||||
int blocks = 0;
|
||||
int blockColor = -1;
|
||||
for (ItemStack stack : stacks) {
|
||||
if (isMortar(stack)) {
|
||||
++mortars;
|
||||
} else {
|
||||
if (stack.getItem() != Item.getItemFromBlock(ModuleCeramic.ceramic)) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
++blocks;
|
||||
int color = TileEntityMetadata.getItemDamage(stack);
|
||||
if (blockColor == -1) {
|
||||
blockColor = color;
|
||||
} else {
|
||||
if (blockColor != color) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mortars != 1) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
EnumFlowerColor c = EnumFlowerColor.get(blockColor);
|
||||
return new CeramicBrickPair(c, c, CeramicBrickType.TILE).getStack(3);
|
||||
}
|
||||
},
|
||||
BRICK("brick") {
|
||||
@Override
|
||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||
return getBrickRecipe(this, stacks);
|
||||
}
|
||||
},
|
||||
STRIPE_BRICK("brickstripe") {
|
||||
@Override
|
||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||
return getBrickRecipe(this, stacks);
|
||||
}
|
||||
},
|
||||
LARGE_BRICK("bricklarge") {
|
||||
@Override
|
||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||
if (stacks.size() == 1) {
|
||||
ItemStack stack3 = stacks.get(0);
|
||||
CeramicBrickPair type3 = new CeramicBrickPair(stack3);
|
||||
if (type3.type == CeramicBrickType.VERTICAL_LARGE_BRICK) {
|
||||
type3.type = this;
|
||||
return type3.getStack(1);
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
} else {
|
||||
if (stacks.size() != 3) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
int[] colors = {-1, -1};
|
||||
int a = 0;
|
||||
int b = 0;
|
||||
for (ItemStack stack4 : stacks) {
|
||||
if (stack4.getItem() != Item.getItemFromBlock(ModuleCeramic.ceramicBrick)) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
CeramicBrickPair type4 = new CeramicBrickPair(stack4);
|
||||
if (type4.type != CeramicBrickType.TILE) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
int color5 = type4.colorFirst.ordinal();
|
||||
if (colors[0] == -1) {
|
||||
colors[0] = color5;
|
||||
a++;
|
||||
} else if (colors[0] == color5) {
|
||||
a++;
|
||||
} else if (colors[1] == -1) {
|
||||
colors[1] = color5;
|
||||
b++;
|
||||
} else {
|
||||
if (colors[1] != color5) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
b++;
|
||||
}
|
||||
}
|
||||
if (colors[1] == -1) {
|
||||
colors[1] = colors[0];
|
||||
}
|
||||
return new CeramicBrickPair(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), CeramicBrickType.LARGE_BRICK).getStack(3);
|
||||
}
|
||||
}
|
||||
},
|
||||
SPLIT("split") {
|
||||
@Override
|
||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||
if (stacks.size() != 4) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
int[] colors = {-1, -1};
|
||||
int altCounter = 0;
|
||||
for (ItemStack stack2 : stacks) {
|
||||
int alt = (altCounter != 0 && altCounter != 3) ? 1 : 0;
|
||||
if (stack2.getItem() != Item.getItemFromBlock(ModuleCeramic.ceramicBrick)) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
CeramicBrickPair type = new CeramicBrickPair(stack2);
|
||||
if (type.type != CeramicBrickType.TILE) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
int color2 = type.colorFirst.ordinal();
|
||||
if (colors[alt] == -1) {
|
||||
colors[alt] = color2;
|
||||
} else if (colors[alt] != color2) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
++altCounter;
|
||||
}
|
||||
return new CeramicBrickPair(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), CeramicBrickType.SPLIT).getStack(4);
|
||||
}
|
||||
},
|
||||
CHEQUERED("cheque") {
|
||||
@Override
|
||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||
if (stacks.size() != 4) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
int[] colors = {-1, -1};
|
||||
for (ItemStack stack2 : stacks) {
|
||||
if (stack2.getItem() != Item.getItemFromBlock(ModuleCeramic.ceramicBrick)) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
CeramicBrickPair type2 = new CeramicBrickPair(stack2);
|
||||
if (type2.type != CeramicBrickType.SPLIT) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
int color3 = type2.colorFirst.ordinal();
|
||||
int color4 = type2.colorSecond.ordinal();
|
||||
if (colors[0] == -1) {
|
||||
colors[0] = color3;
|
||||
colors[1] = color4;
|
||||
} else {
|
||||
if (colors[0] != color3 || colors[1] != color4) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
}
|
||||
return new CeramicBrickPair(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), CeramicBrickType.CHEQUERED).getStack(4);
|
||||
}
|
||||
},
|
||||
MIXED("mixed") {
|
||||
@Override
|
||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||
if (stacks.size() != 4) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
int[] colors = {-1, -1};
|
||||
for (ItemStack stack2 : stacks) {
|
||||
if (stack2.getItem() != Item.getItemFromBlock(ModuleCeramic.ceramicBrick)) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
CeramicBrickPair type2 = new CeramicBrickPair(stack2);
|
||||
if (type2.isTwoColors()) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
int color3 = type2.colorFirst.ordinal();
|
||||
if (type2.type == CeramicBrickType.SPLIT) {
|
||||
if (colors[1] != -1) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
colors[1] = color3;
|
||||
} else {
|
||||
if (type2.type != CeramicBrickType.CHEQUERED) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
if (colors[0] == -1) {
|
||||
colors[0] = color3;
|
||||
} else if (colors[0] != color3) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
int color4 = type2.colorSecond.ordinal();
|
||||
}
|
||||
if (colors[0] == -1 || colors[1] == -1) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
return new CeramicBrickPair(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), CeramicBrickType.MIXED).getStack(4);
|
||||
}
|
||||
},
|
||||
VERTICAL_BRICK("verticalbrick") {
|
||||
@Override
|
||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||
return getVerticalBrickRecipe(stacks);
|
||||
}
|
||||
},
|
||||
VERTICAL_STRIPE_BRICK("verticalbrickstripe") {
|
||||
@Override
|
||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||
return getVerticalBrickRecipe(stacks);
|
||||
}
|
||||
},
|
||||
VERTICAL_LARGE_BRICK("verticalbricklarge") {
|
||||
@Override
|
||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||
return getVerticalBrickRecipe(stacks);
|
||||
}
|
||||
};
|
||||
|
||||
public static final CeramicBrickType[] VALUES = values();
|
||||
|
||||
public String id;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Nullable
|
||||
public TextureAtlasSprite[] sprites;
|
||||
|
||||
CeramicBrickType(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public static CeramicBrickType get(int id) {
|
||||
return VALUES[id % VALUES.length];
|
||||
}
|
||||
|
||||
public boolean canDouble() {
|
||||
return this != CeramicBrickType.TILE;
|
||||
}
|
||||
|
||||
public abstract ItemStack getRecipe(List<ItemStack> stacks);
|
||||
|
||||
protected ItemStack getVerticalBrickRecipe(List<ItemStack> stacks) {
|
||||
if (stacks.size() != 1) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
ItemStack stack5 = stacks.get(0);
|
||||
CeramicBrickPair type = new CeramicBrickPair(stack5);
|
||||
if (type.type == CeramicBrickType.LARGE_BRICK) {
|
||||
type.type = CeramicBrickType.VERTICAL_LARGE_BRICK;
|
||||
return type.getStack(1);
|
||||
}
|
||||
|
||||
if (type.type == CeramicBrickType.BRICK) {
|
||||
type.type = CeramicBrickType.VERTICAL_BRICK;
|
||||
return type.getStack(1);
|
||||
}
|
||||
|
||||
if (type.type == CeramicBrickType.STRIPE_BRICK) {
|
||||
type.type = CeramicBrickType.VERTICAL_STRIPE_BRICK;
|
||||
return type.getStack(1);
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
protected ItemStack getBrickRecipe(CeramicBrickType ceramicType, List<ItemStack> stacks) {
|
||||
if (stacks.size() == 1) {
|
||||
ItemStack stack5 = stacks.get(0);
|
||||
CeramicBrickPair type = new CeramicBrickPair(stack5);
|
||||
if (type.type == CeramicBrickType.VERTICAL_BRICK) {
|
||||
type.type = ceramicType;
|
||||
return type.getStack(1);
|
||||
}
|
||||
|
||||
if (type.type == CeramicBrickType.STRIPE_BRICK) {
|
||||
type.type = ceramicType;
|
||||
return type.getStack(1);
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
} else if (stacks.size() == 4) {
|
||||
int[] colors = {-1, -1};
|
||||
for (int index2 = 0; index2 < stacks.size(); ++index2) {
|
||||
ItemStack stack4 = stacks.get(index2);
|
||||
if (stack4.getItem() != Item.getItemFromBlock(ModuleCeramic.ceramicBrick)) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
CeramicBrickPair type4 = new CeramicBrickPair(stack4);
|
||||
if (type4.type != CeramicBrickType.LARGE_BRICK) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
int color5 = type4.colorFirst.ordinal();
|
||||
int color6 = type4.colorSecond.ordinal();
|
||||
int alt2 = (index2 != 0 && index2 != 3) ? 1 : 0;
|
||||
if (ceramicType == CeramicBrickType.STRIPE_BRICK) {
|
||||
alt2 = 0;
|
||||
}
|
||||
|
||||
if (colors[alt2] == -1) {
|
||||
colors[alt2] = color5;
|
||||
colors[1 - alt2] = color6;
|
||||
} else if (colors[alt2] != color5 || colors[1 - alt2] != color6) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
return new CeramicBrickPair(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), ceramicType).getStack(4);
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
protected boolean isMortar(ItemStack stack) {
|
||||
return stack.getItem() == ModuleCeramic.misc && stack.getItemDamage() == CeramicItems.MORTAR.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.botany.ceramic.brick;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.botany.ceramic;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -0,0 +1,25 @@
|
||||
package binnie.botany.core;
|
||||
|
||||
import binnie.botany.GardeningManager;
|
||||
import binnie.botany.api.BotanyAPI;
|
||||
import binnie.botany.api.gardening.IGardeningManager;
|
||||
import binnie.botany.api.genetics.IFlowerRoot;
|
||||
import binnie.botany.genetics.FlowerRoot;
|
||||
|
||||
public class BotanyCore {
|
||||
public static final int CHANCE_INTERPOLLINATION = 20;
|
||||
|
||||
public static IFlowerRoot getFlowerRoot() {
|
||||
if (BotanyAPI.flowerRoot == null) {
|
||||
BotanyAPI.flowerRoot = new FlowerRoot();
|
||||
}
|
||||
return BotanyAPI.flowerRoot;
|
||||
}
|
||||
|
||||
public static IGardeningManager getGardening() {
|
||||
if (BotanyAPI.gardening == null) {
|
||||
BotanyAPI.gardening = new GardeningManager();
|
||||
}
|
||||
return BotanyAPI.gardening;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.botany.core;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -0,0 +1,107 @@
|
||||
package binnie.botany.farming;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.circuits.ICircuitLayout;
|
||||
import forestry.api.farming.FarmDirection;
|
||||
import forestry.api.farming.IFarmHousing;
|
||||
|
||||
import binnie.botany.api.gardening.EnumAcidity;
|
||||
import binnie.botany.api.gardening.EnumMoisture;
|
||||
import binnie.core.circuits.BinnieCircuit;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class CircuitGarden extends BinnieCircuit {
|
||||
private boolean isManual;
|
||||
private GardenLogic logic;
|
||||
|
||||
public CircuitGarden(EnumMoisture moisture, @Nullable EnumAcidity ph, boolean manual, boolean fertilised, ItemStack recipe, ItemStack icon) {
|
||||
super(getName(moisture, ph, manual, fertilised), 4, getLayout(manual), recipe);
|
||||
isManual = manual;
|
||||
logic = new GardenLogic(moisture, ph, isManual, fertilised, icon, I18N.localise(getUnlocalizedName()));
|
||||
String info = I18N.localise("botany.moisture") + ": " + moisture.getLocalisedName(true) + TextFormatting.GRAY + ", ";
|
||||
if (ph != null) {
|
||||
info += I18N.localise("botany.ph") + ": " + ph.getLocalisedName(true) + TextFormatting.GRAY + ", ";
|
||||
}
|
||||
String fertilizedKey = fertilised ? "for.binnie.circuit.garden.fertilized" : "for.binnie.circuit.garden.unfertilized";
|
||||
info += (fertilised ? TextFormatting.GREEN : TextFormatting.RED) + I18N.localise(fertilizedKey) + TextFormatting.GRAY;
|
||||
addTooltipString(I18N.localise("for.binnie.circuit.garden.info", info));
|
||||
}
|
||||
|
||||
private static ICircuitLayout getLayout(boolean manual) {
|
||||
String layoutUid = manual ? "forestry.farms.manual" : "forestry.farms.managed";
|
||||
ICircuitLayout layout = ChipsetManager.circuitRegistry.getLayout(layoutUid);
|
||||
Preconditions.checkState(layout != null, "Couldn't find Forestry circuit layout %s.", layoutUid);
|
||||
return layout;
|
||||
}
|
||||
|
||||
private static String getName(EnumMoisture moisture, @Nullable EnumAcidity ph, boolean manual, boolean fertilised) {
|
||||
String name = "garden." + moisture.getName();
|
||||
if (ph != null) {
|
||||
name += "." + ph.getName();
|
||||
}
|
||||
if (manual) {
|
||||
name += ".manual";
|
||||
}
|
||||
if (fertilised) {
|
||||
name += ".fert";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
public CircuitGarden setManual() {
|
||||
isManual = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCircuitable(Object tile) {
|
||||
return tile instanceof IFarmHousing;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private IFarmHousing getCircuitable(Object tile) {
|
||||
if (!isCircuitable(tile)) {
|
||||
return null;
|
||||
}
|
||||
return (IFarmHousing) tile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInsertion(int slot, Object tile) {
|
||||
IFarmHousing housing = getCircuitable(tile);
|
||||
if (housing == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
logic.setManual(isManual);
|
||||
|
||||
housing.setFarmLogic(FarmDirection.values()[slot], logic);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad(int slot, Object tile) {
|
||||
onInsertion(slot, tile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoval(int slot, Object tile) {
|
||||
IFarmHousing farmHousing = getCircuitable(tile);
|
||||
if (farmHousing == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
farmHousing.resetFarmLogic(FarmDirection.values()[slot]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(int slot, Object tile) {
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package binnie.botany.farming;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.farming.IFarmLogic;
|
||||
|
||||
public abstract class FarmLogic implements IFarmLogic {
|
||||
boolean isManual;
|
||||
|
||||
@Override
|
||||
public IFarmLogic setManual(boolean flag) {
|
||||
isManual = flag;
|
||||
return this;
|
||||
}
|
||||
|
||||
protected final boolean isAirBlock(World world, BlockPos pos) {
|
||||
return world.isAirBlock(pos);
|
||||
}
|
||||
|
||||
protected final IBlockState getBlockState(World world, BlockPos pos) {
|
||||
return world.getBlockState(pos);
|
||||
}
|
||||
|
||||
protected final Block getBlock(World world, BlockPos pos) {
|
||||
return getBlockState(world, pos).getBlock();
|
||||
}
|
||||
|
||||
protected final int getBlockMeta(World world, BlockPos pos) {
|
||||
IBlockState blockState = world.getBlockState(pos);
|
||||
return blockState.getBlock().getMetaFromState(blockState);
|
||||
}
|
||||
|
||||
protected final ItemStack getAsItemStack(World world, BlockPos position) {
|
||||
return new ItemStack(getBlock(world, position), 1, getBlockMeta(world, position));
|
||||
}
|
||||
|
||||
protected final boolean isWaterBlock(World world, BlockPos pos) {
|
||||
return getBlock(world, pos) == Blocks.WATER;
|
||||
}
|
||||
|
||||
protected final void setBlock(World world, BlockPos pos, Block block, int meta) {
|
||||
world.setBlockState(pos, block.getStateFromMeta(meta), 2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package binnie.botany.farming;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.farming.ICrop;
|
||||
import forestry.api.farming.IFarmable;
|
||||
|
||||
import binnie.botany.api.genetics.EnumFlowerStage;
|
||||
import binnie.botany.api.genetics.IFlower;
|
||||
import binnie.botany.api.genetics.IFlowerRoot;
|
||||
import binnie.botany.core.BotanyCore;
|
||||
import binnie.botany.modules.ModuleFlowers;
|
||||
import binnie.botany.tile.TileEntityFlower;
|
||||
|
||||
public class FarmableFlower implements IFarmable {
|
||||
@Override
|
||||
public boolean isSaplingAt(World world, BlockPos pos) {
|
||||
return world.getBlockState(pos) == ModuleFlowers.flower;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ICrop getCropAt(World world, BlockPos pos, IBlockState blockState) {
|
||||
IFlower flower = null;
|
||||
if (world.getTileEntity(pos) instanceof TileEntityFlower) {
|
||||
flower = ((TileEntityFlower) world.getTileEntity(pos)).getFlower();
|
||||
}
|
||||
|
||||
// TODO Look at TileEntityFlower::onShear logic
|
||||
if (flower != null && flower.getAge() > 1) {
|
||||
IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot();
|
||||
ItemStack mature = flowerRoot.getMemberStack(flower, EnumFlowerStage.FLOWER);
|
||||
ItemStack seed = flowerRoot.getMemberStack(flower, EnumFlowerStage.SEED);
|
||||
if (!mature.isEmpty() && !seed.isEmpty()) {
|
||||
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
|
||||
return new FlowerCrop(pos, mature, seed);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGermling(ItemStack itemstack) {
|
||||
EnumFlowerStage stage = BotanyCore.getFlowerRoot().getType(itemstack);
|
||||
return stage == EnumFlowerStage.FLOWER || stage == EnumFlowerStage.SEED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWindfall(ItemStack itemstack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean plantSaplingAt(EntityPlayer player, ItemStack germling, World world, BlockPos pos) {
|
||||
IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot();
|
||||
IFlower flower = flowerRoot.getMember(germling);
|
||||
flowerRoot.plant(world, pos, flower, player.getGameProfile());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Loaded 100 of 5410 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user