mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-19 03:49:07 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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
+20
-1
@@ -1,3 +1,6 @@
|
|||||||
|
# everything
|
||||||
|
/*
|
||||||
|
|
||||||
.gradle
|
.gradle
|
||||||
# IntelliJ
|
# IntelliJ
|
||||||
/build
|
/build
|
||||||
@@ -6,4 +9,20 @@
|
|||||||
.idea
|
.idea
|
||||||
*.iml
|
*.iml
|
||||||
*.ipr
|
*.ipr
|
||||||
*.iws
|
*.iws
|
||||||
|
classes/
|
||||||
|
|
||||||
|
|
||||||
|
# folders
|
||||||
|
!/gradle/wrapper
|
||||||
|
!/src
|
||||||
|
|
||||||
|
# files
|
||||||
|
!/.gitignore
|
||||||
|
!/LICENSE.txt
|
||||||
|
!/license-header.txt
|
||||||
|
!/README.md
|
||||||
|
!/gradle.properties
|
||||||
|
!/build.gradle
|
||||||
|
!/gradlew
|
||||||
|
!/gradlew.bat
|
||||||
+24
@@ -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,17 @@
|
|||||||
|
## Binnie mods
|
||||||
|
|
||||||
|
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 :)
|
||||||
+59
-35
@@ -1,53 +1,58 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
jcenter()
|
||||||
maven {
|
maven {
|
||||||
name = "forge"
|
name = "forge"
|
||||||
url = "http://files.minecraftforge.net/maven"
|
url = "http://files.minecraftforge.net/maven"
|
||||||
}
|
}
|
||||||
maven {
|
|
||||||
name = "sonatype"
|
|
||||||
url = "https://oss.sonatype.org/content/repositories/snapshots/"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
|
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'forge'
|
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||||
|
apply plugin: 'idea'
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
|
||||||
version = "1.0"
|
version = version_major + '.' + version_minor + '.' + version_patch
|
||||||
group= "binnie" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
if (System.getenv("BUILD_NUMBER") != null) {
|
||||||
archivesBaseName = "binnie"
|
version = version + "-" + System.getenv("BUILD_NUMBER")
|
||||||
|
}
|
||||||
|
group = "binnie" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
|
archivesBaseName = "binnie-mods-1.11.2"
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
version = "1.7.10-10.13.4.1558-1.7.10"
|
version = mcversion + "-" + forgeversion
|
||||||
if (file('../run').exists()){
|
mappings = mcp_mappings
|
||||||
assetDir = "../run/assets"
|
runDir = "run"
|
||||||
}else{
|
}
|
||||||
assetDir = "assets"
|
|
||||||
}
|
repositories {
|
||||||
|
maven {
|
||||||
|
name = "jei"
|
||||||
|
url "http://dvs1.progwml6.com/files/maven"
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
name = "ic2, forestry"
|
||||||
|
url = "http://maven.ic2.player.to/"
|
||||||
|
}
|
||||||
|
ivy {
|
||||||
|
name 'JEI Bees'
|
||||||
|
artifactPattern "http://addons-origin.cursecdn.com/files/${jeibees_cf}/[module]-[revision]-[classifier].[ext]"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// you may put jars on which you depend on in ./libs
|
deobfCompile "net.sengir.forestry:forestry_${mcversion}:${forestry_version}"
|
||||||
// or you may define them like so..
|
deobfCompile "mezz.jei:jei_${mcversion}:${jei_version}:api"
|
||||||
//compile "some.group:artifact:version:classifier"
|
runtime "mezz.jei:jei_${mcversion}:${jei_version}"
|
||||||
//compile "some.group:artifact:version"
|
deobfCompile name: 'jeibees', version: jeibees_version, ext: 'jar', classifier: "dev"
|
||||||
|
deobfCompile "net.industrial-craft:industrialcraft-2:${ic2_version}"
|
||||||
// real examples
|
|
||||||
//compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
|
|
||||||
//compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
|
|
||||||
|
|
||||||
// for more info...
|
|
||||||
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
|
|
||||||
// http://www.gradle.org/docs/current/userguide/dependency_management.html
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources
|
processResources {
|
||||||
{
|
|
||||||
// this will ensure that this task is redone when the versions change.
|
// this will ensure that this task is redone when the versions change.
|
||||||
inputs.property "version", project.version
|
inputs.property "version", project.version
|
||||||
inputs.property "mcversion", project.minecraft.version
|
inputs.property "mcversion", project.minecraft.version
|
||||||
@@ -55,13 +60,32 @@ processResources
|
|||||||
// replace stuff in mcmod.info, nothing else
|
// replace stuff in mcmod.info, nothing else
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
from(sourceSets.main.resources.srcDirs) {
|
||||||
include 'mcmod.info'
|
include 'mcmod.info'
|
||||||
|
expand 'version': project.version,
|
||||||
// replace version and mcversion
|
'mcversion': project.minecraft.version,
|
||||||
expand 'version':project.version, 'mcversion':project.minecraft.version
|
'modid': "binniemods"
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy everything else, thats not the mcmod.info
|
// copy everything else, thats not the mcmod.info
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
from(sourceSets.main.resources.srcDirs) {
|
||||||
exclude 'mcmod.info'
|
exclude 'mcmod.info'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// prevent java 8's strict doclint for javadocs from failing builds
|
||||||
|
allprojects {
|
||||||
|
tasks.withType(Javadoc) {
|
||||||
|
options.addStringOption('Xdoclint:none', '-quiet')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uploadArchives {
|
||||||
|
repositories {
|
||||||
|
if (project.hasProperty('mavenDir')) {
|
||||||
|
mavenDeployer {
|
||||||
|
repository(url: "file://" + mavenDir)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
println 'Archives upload disabled, mavenDir in gradle.properties is missing.'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
|
||||||
|
# This is required to provide enough memory for the Minecraft decompilation process.
|
||||||
|
org.gradle.jvmargs=-Xmx3G
|
||||||
|
|
||||||
|
mcversion=1.11.2
|
||||||
|
forgeversion=13.20.0.2315
|
||||||
|
mcp_mappings=snapshot_20161220
|
||||||
|
|
||||||
|
forestry_version=5.3.4.119
|
||||||
|
ic2_version=2.7.71-ex111
|
||||||
|
|
||||||
|
version_major=2
|
||||||
|
version_minor=0
|
||||||
|
version_patch=0
|
||||||
|
|
||||||
|
jei_version=4.5.0.287
|
||||||
|
jeibees_cf=2376/963
|
||||||
|
jeibees_version=0.9.0.4-mc1.11.2
|
||||||
Vendored
BIN
Binary file not shown.
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
#Wed Jul 02 15:54:47 CDT 2014
|
#Mon Sep 14 12:28:28 PDT 2015
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip
|
||||||
@@ -6,12 +6,30 @@
|
|||||||
##
|
##
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
# Attempt to set APP_HOME
|
||||||
DEFAULT_JVM_OPTS=""
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
APP_NAME="Gradle"
|
||||||
APP_BASE_NAME=`basename "$0"`
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS=""
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD="maximum"
|
MAX_FD="maximum"
|
||||||
|
|
||||||
@@ -30,6 +48,7 @@ die ( ) {
|
|||||||
cygwin=false
|
cygwin=false
|
||||||
msys=false
|
msys=false
|
||||||
darwin=false
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
case "`uname`" in
|
case "`uname`" in
|
||||||
CYGWIN* )
|
CYGWIN* )
|
||||||
cygwin=true
|
cygwin=true
|
||||||
@@ -40,31 +59,11 @@ case "`uname`" in
|
|||||||
MINGW* )
|
MINGW* )
|
||||||
msys=true
|
msys=true
|
||||||
;;
|
;;
|
||||||
|
NONSTOP* )
|
||||||
|
nonstop=true
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# For Cygwin, ensure paths are in UNIX format before anything is touched.
|
|
||||||
if $cygwin ; then
|
|
||||||
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Attempt to set APP_HOME
|
|
||||||
# Resolve links: $0 may be a link
|
|
||||||
PRG="$0"
|
|
||||||
# Need this for relative symlinks.
|
|
||||||
while [ -h "$PRG" ] ; do
|
|
||||||
ls=`ls -ld "$PRG"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
PRG="$link"
|
|
||||||
else
|
|
||||||
PRG=`dirname "$PRG"`"/$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
SAVED="`pwd`"
|
|
||||||
cd "`dirname \"$PRG\"`/" >&-
|
|
||||||
APP_HOME="`pwd -P`"
|
|
||||||
cd "$SAVED" >&-
|
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
@@ -90,7 +89,7 @@ location of your Java installation."
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||||
MAX_FD_LIMIT=`ulimit -H -n`
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
if [ $? -eq 0 ] ; then
|
if [ $? -eq 0 ] ; then
|
||||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
@@ -114,6 +113,7 @@ fi
|
|||||||
if $cygwin ; then
|
if $cygwin ; then
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
# We build the pattern for arguments to be converted via cygpath
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
|||||||
Vendored
+4
-4
@@ -8,14 +8,14 @@
|
|||||||
@rem Set local scope for the variables with windows NT shell
|
@rem Set local scope for the variables with windows NT shell
|
||||||
if "%OS%"=="Windows_NT" setlocal
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
||||||
set DEFAULT_JVM_OPTS=
|
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS=-d64 -Xmx2G
|
||||||
|
|
||||||
@rem Find java.exe
|
@rem Find java.exe
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ echo location of your Java installation.
|
|||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
:init
|
:init
|
||||||
@rem Get command-line arguments, handling Windowz variants
|
@rem Get command-line arguments, handling Windows variants
|
||||||
|
|
||||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,39 +1,20 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie;
|
package binnie;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import binnie.core.resource.ManagerResource;
|
|
||||||
import binnie.core.item.ManagerItem;
|
|
||||||
import binnie.core.machines.ManagerMachine;
|
|
||||||
import binnie.core.liquid.ManagerLiquid;
|
|
||||||
import binnie.core.mod.config.ManagerConfig;
|
|
||||||
import binnie.core.genetics.ManagerGenetics;
|
|
||||||
import binnie.core.language.ManagerLanguage;
|
|
||||||
import binnie.core.ManagerBase;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public final class Binnie
|
import binnie.core.ManagerBase;
|
||||||
{
|
import binnie.core.genetics.ManagerGenetics;
|
||||||
public static final List<ManagerBase> Managers;
|
import binnie.core.liquid.ManagerLiquid;
|
||||||
public static final ManagerLanguage Language;
|
import binnie.core.machines.ManagerMachine;
|
||||||
public static final ManagerGenetics Genetics;
|
import binnie.core.mod.config.ManagerConfig;
|
||||||
public static final ManagerConfig Configuration;
|
import binnie.core.resource.ManagerResource;
|
||||||
public static final ManagerLiquid Liquid;
|
|
||||||
public static final ManagerMachine Machine;
|
|
||||||
public static final ManagerItem Item;
|
|
||||||
public static final ManagerResource Resource;
|
|
||||||
|
|
||||||
static {
|
public final class Binnie {
|
||||||
Managers = new ArrayList<ManagerBase>();
|
public static final List<ManagerBase> MANAGERS = new ArrayList<>();
|
||||||
Language = new ManagerLanguage();
|
public static final ManagerGenetics GENETICS = new ManagerGenetics();
|
||||||
Genetics = new ManagerGenetics();
|
public static final ManagerConfig CONFIGURATION = new ManagerConfig();
|
||||||
Configuration = new ManagerConfig();
|
public static final ManagerLiquid LIQUID = new ManagerLiquid();
|
||||||
Liquid = new ManagerLiquid();
|
public static final ManagerMachine MACHINE = new ManagerMachine();
|
||||||
Machine = new ManagerMachine();
|
public static final ManagerResource RESOURCE = new ManagerResource();
|
||||||
Item = new ManagerItem();
|
|
||||||
Resource = new ManagerResource();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,15 +1,16 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie;
|
package binnie;
|
||||||
|
|
||||||
public final class Constants
|
public final class Constants {
|
||||||
{
|
|
||||||
public static final String LiquidJuice = "juice";
|
public static final String CORE_MOD_ID = "binniecore";
|
||||||
public static final String LiquidWater = "water";
|
public static final String BOTANY_MOD_ID = "botany";
|
||||||
public static final String LiquidSeedOil = "seedoil";
|
public static final String EXTRA_TREES_MOD_ID = "extratrees";
|
||||||
public static final String LiquidCreosote = "Creosote Oil";
|
public static final String GENETICS_MOD_ID = "genetics";
|
||||||
public static final String LiquidEthanol = "bioethanol";
|
|
||||||
public static final String LiquidHoney = "for.honey";
|
public static final String LIQUID_JUICE = "juice";
|
||||||
|
public static final String LIQUID_WATER = "water";
|
||||||
|
public static final String LIQUID_SEED_OIL = "seedoil";
|
||||||
|
public static final String LIQUID_CREOSOTE = "Creosote Oil";
|
||||||
|
public static final String LIQUID_BIO_ETHANOL = "bioethanol";
|
||||||
|
public static final String LIQUID_FOR_HONEY = "for.honey";
|
||||||
}
|
}
|
||||||
@@ -1,77 +1,82 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany;
|
package binnie.botany;
|
||||||
|
|
||||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
import javax.annotation.Nullable;
|
||||||
import cpw.mods.fml.common.eventhandler.Event;
|
|
||||||
import net.minecraftforge.event.entity.player.BonemealEvent;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import binnie.core.BinnieCore;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.event.world.BlockEvent;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import net.minecraftforge.event.entity.player.BonemealEvent;
|
||||||
|
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||||
|
import net.minecraftforge.event.world.BlockEvent;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.common.Mod;
|
||||||
|
import net.minecraftforge.fml.common.SidedProxy;
|
||||||
|
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||||
|
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||||
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
|
||||||
|
import binnie.Constants;
|
||||||
import binnie.botany.api.EnumAcidity;
|
import binnie.botany.api.EnumAcidity;
|
||||||
import binnie.botany.api.EnumSoilType;
|
import binnie.botany.api.EnumSoilType;
|
||||||
import binnie.botany.api.gardening.IBlockSoil;
|
import binnie.botany.api.IBlockSoil;
|
||||||
import binnie.botany.gardening.Gardening;
|
|
||||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import binnie.botany.api.IFlower;
|
import binnie.botany.api.IFlower;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import binnie.botany.api.IFlowerRoot;
|
||||||
import forestry.api.genetics.IIndividual;
|
import binnie.botany.api.IGardeningManager;
|
||||||
import binnie.botany.core.BotanyCore;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import binnie.botany.flower.TileEntityFlower;
|
|
||||||
import net.minecraft.init.Items;
|
|
||||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
|
||||||
import binnie.core.network.BinniePacketHandler;
|
|
||||||
import binnie.core.proxy.IProxyCore;
|
|
||||||
import binnie.botany.network.PacketID;
|
|
||||||
import binnie.core.network.IPacketID;
|
|
||||||
import binnie.botany.core.BotanyGUI;
|
|
||||||
import binnie.core.gui.IBinnieGUID;
|
|
||||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
|
||||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
|
||||||
import binnie.botany.gardening.ModuleGardening;
|
|
||||||
import binnie.botany.genetics.ModuleGenetics;
|
|
||||||
import binnie.botany.core.ModuleCore;
|
|
||||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
|
||||||
import binnie.botany.ceramic.BlockCeramicBrick;
|
|
||||||
import binnie.botany.ceramic.BlockStained;
|
|
||||||
import binnie.botany.ceramic.BlockCeramicPatterned;
|
|
||||||
import binnie.botany.ceramic.BlockCeramic;
|
import binnie.botany.ceramic.BlockCeramic;
|
||||||
|
import binnie.botany.ceramic.BlockCeramicPatterned;
|
||||||
|
import binnie.botany.ceramic.BlockStainedGlass;
|
||||||
|
import binnie.botany.ceramic.brick.BlockCeramicBrick;
|
||||||
|
import binnie.botany.core.BotanyCore;
|
||||||
|
import binnie.botany.core.BotanyGUI;
|
||||||
|
import binnie.botany.core.ModuleCore;
|
||||||
|
import binnie.botany.flower.BlockFlower;
|
||||||
|
import binnie.botany.flower.ItemBotany;
|
||||||
|
import binnie.botany.flower.ItemInsulatedTube;
|
||||||
|
import binnie.botany.flower.TileEntityFlower;
|
||||||
|
import binnie.botany.gardening.BlockPlant;
|
||||||
|
import binnie.botany.gardening.BlockSoil;
|
||||||
|
import binnie.botany.gardening.ItemSoilMeter;
|
||||||
|
import binnie.botany.gardening.ItemTrowel;
|
||||||
|
import binnie.botany.gardening.ModuleGardening;
|
||||||
|
import binnie.botany.genetics.ItemDictionary;
|
||||||
|
import binnie.botany.genetics.ModuleGenetics;
|
||||||
import binnie.botany.items.ItemClay;
|
import binnie.botany.items.ItemClay;
|
||||||
import binnie.botany.items.ItemPigment;
|
import binnie.botany.items.ItemPigment;
|
||||||
import binnie.botany.flower.ItemFlower;
|
import binnie.botany.network.PacketID;
|
||||||
import binnie.botany.genetics.ItemEncyclopedia;
|
|
||||||
import binnie.core.item.ItemMisc;
|
|
||||||
import binnie.botany.gardening.ItemSoilMeter;
|
|
||||||
import binnie.botany.flower.ItemInsulatedTube;
|
|
||||||
import binnie.botany.gardening.BlockSoil;
|
|
||||||
import binnie.botany.gardening.ItemTrowel;
|
|
||||||
import binnie.botany.gardening.BlockPlant;
|
|
||||||
import binnie.botany.genetics.ItemDictionary;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import binnie.botany.flower.BlockFlower;
|
|
||||||
import cpw.mods.fml.common.SidedProxy;
|
|
||||||
import binnie.botany.proxy.Proxy;
|
import binnie.botany.proxy.Proxy;
|
||||||
import cpw.mods.fml.common.Mod;
|
|
||||||
import binnie.core.AbstractMod;
|
import binnie.core.AbstractMod;
|
||||||
|
import binnie.core.BinnieCore;
|
||||||
|
import binnie.core.gui.IBinnieGUID;
|
||||||
|
import binnie.core.item.ItemMisc;
|
||||||
|
import binnie.core.network.BinniePacketHandler;
|
||||||
|
import binnie.core.network.IPacketID;
|
||||||
|
import binnie.core.proxy.IProxyCore;
|
||||||
|
|
||||||
@Mod(modid = "Botany", name = "Botany", useMetadata = true, dependencies = "after:BinnieCore")
|
@Mod(modid = Constants.BOTANY_MOD_ID, name = "Binnie's Botany", useMetadata = true, dependencies = "required-after:" + Constants.CORE_MOD_ID)
|
||||||
public class Botany extends AbstractMod
|
public class Botany extends AbstractMod {
|
||||||
{
|
|
||||||
public static final float AGE_CHANCE = 0.2f;
|
public static final float AGE_CHANCE = 0.2f;
|
||||||
@Mod.Instance("Botany")
|
|
||||||
|
@SuppressWarnings("NullableProblems")
|
||||||
|
@Mod.Instance(Constants.BOTANY_MOD_ID)
|
||||||
public static Botany instance;
|
public static Botany instance;
|
||||||
|
@SuppressWarnings("NullableProblems")
|
||||||
@SidedProxy(clientSide = "binnie.botany.proxy.ProxyClient", serverSide = "binnie.botany.proxy.ProxyServer")
|
@SidedProxy(clientSide = "binnie.botany.proxy.ProxyClient", serverSide = "binnie.botany.proxy.ProxyServer")
|
||||||
public static Proxy proxy;
|
public static Proxy proxy;
|
||||||
|
/* MODULE GENETIC */
|
||||||
public static BlockFlower flower;
|
public static BlockFlower flower;
|
||||||
public static Item seed;
|
public static ItemBotany flowerItem;
|
||||||
public static Item pollen;
|
public static ItemBotany seed;
|
||||||
|
public static ItemBotany pollen;
|
||||||
public static ItemDictionary database;
|
public static ItemDictionary database;
|
||||||
|
/* MODULE GARDENING */
|
||||||
public static BlockPlant plant;
|
public static BlockPlant plant;
|
||||||
public static ItemTrowel trowelWood;
|
public static ItemTrowel trowelWood;
|
||||||
public static ItemTrowel trowelStone;
|
public static ItemTrowel trowelStone;
|
||||||
@@ -87,21 +92,17 @@ public class Botany extends AbstractMod
|
|||||||
public static ItemInsulatedTube insulatedTube;
|
public static ItemInsulatedTube insulatedTube;
|
||||||
public static ItemSoilMeter soilMeter;
|
public static ItemSoilMeter soilMeter;
|
||||||
public static ItemMisc misc;
|
public static ItemMisc misc;
|
||||||
public static ItemEncyclopedia encyclopedia;
|
|
||||||
public static ItemEncyclopedia encyclopediaIron;
|
|
||||||
public static ItemFlower flowerItem;
|
|
||||||
public static ItemPigment pigment;
|
public static ItemPigment pigment;
|
||||||
public static ItemClay clay;
|
public static ItemClay clay;
|
||||||
public static BlockCeramic ceramic;
|
public static BlockCeramic ceramic;
|
||||||
public static BlockCeramicPatterned ceramicTile;
|
public static BlockCeramicPatterned ceramicTile;
|
||||||
public static BlockStained stained;
|
public static BlockStainedGlass stained;
|
||||||
public static BlockCeramicBrick ceramicBrick;
|
public static BlockCeramicBrick ceramicBrick;
|
||||||
|
@Nullable
|
||||||
|
public static Item botanistBackpack;
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void preInit(final FMLPreInitializationEvent evt) {
|
public void preInit(final FMLPreInitializationEvent evt) {
|
||||||
this.addModule(new ModuleCore());
|
|
||||||
this.addModule(new ModuleGenetics());
|
|
||||||
this.addModule(new ModuleGardening());
|
|
||||||
this.preInit();
|
this.preInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,8 +116,11 @@ public class Botany extends AbstractMod
|
|||||||
this.postInit();
|
this.postInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Botany() {
|
@Override
|
||||||
Botany.instance = this;
|
protected void registerModules() {
|
||||||
|
this.addModule(new ModuleCore());
|
||||||
|
this.addModule(new ModuleGenetics());
|
||||||
|
this.addModule(new ModuleGardening());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -146,7 +150,7 @@ public class Botany extends AbstractMod
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getModID() {
|
public String getModID() {
|
||||||
return "botany";
|
return Constants.BOTANY_MOD_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -154,128 +158,145 @@ public class Botany extends AbstractMod
|
|||||||
return PacketHandler.class;
|
return PacketHandler.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isActive() {
|
||||||
|
return BinnieCore.isBotanyActive();
|
||||||
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onShearFlower(final PlayerInteractEvent event) {
|
public void onShearFlower(final PlayerInteractEvent.RightClickBlock event) {
|
||||||
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
EntityPlayer player = event.getEntityPlayer();
|
||||||
|
if (player == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null && event.entityPlayer.getHeldItem().getItem() == Items.shears) {
|
|
||||||
final TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
ItemStack heldItem = player.getHeldItemMainhand();
|
||||||
if (tile instanceof TileEntityFlower) {
|
if (heldItem.isEmpty()) {
|
||||||
final TileEntityFlower flower = (TileEntityFlower) tile;
|
return;
|
||||||
flower.onShear();
|
|
||||||
event.entityPlayer.getHeldItem().damageItem(1, event.entityPlayer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null && event.entityPlayer.getHeldItem().getItem() == Botany.pollen) {
|
|
||||||
final TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
TileEntity tile = event.getWorld().getTileEntity(event.getPos());
|
||||||
if (tile instanceof TileEntityFlower) {
|
if (!(tile instanceof TileEntityFlower)) {
|
||||||
final TileEntityFlower flower = (TileEntityFlower) tile;
|
return;
|
||||||
final IFlower pollen = BotanyCore.getFlowerRoot().getMember(event.entityPlayer.getHeldItem());
|
}
|
||||||
if (pollen != null && flower.canMateWith(pollen)) {
|
|
||||||
flower.mateWith(pollen);
|
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||||
if (!event.entityPlayer.capabilities.isCreativeMode) {
|
if (heldItem.getItem() == Items.SHEARS) {
|
||||||
final ItemStack heldItem = event.entityPlayer.getHeldItem();
|
flower.onShear();
|
||||||
--heldItem.stackSize;
|
heldItem.damageItem(1, player);
|
||||||
}
|
} else if (heldItem.getItem() == Botany.pollen) {
|
||||||
|
IFlower pollen = BotanyCore.getFlowerRoot().getMember(heldItem);
|
||||||
|
if (pollen != null && flower.canMateWith(pollen)) {
|
||||||
|
flower.mateWith(pollen);
|
||||||
|
if (!player.capabilities.isCreativeMode) {
|
||||||
|
heldItem.shrink(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onFertiliseSoil(final PlayerInteractEvent event) {
|
public void onFertiliseSoil(final PlayerInteractEvent.RightClickBlock event) {
|
||||||
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
World world = event.getWorld();
|
||||||
|
if (world == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.world == null) {
|
|
||||||
|
BlockPos pos = event.getPos();
|
||||||
|
EntityPlayer player = event.getEntityPlayer();
|
||||||
|
if (player == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null) {
|
|
||||||
int y = event.y;
|
ItemStack heldItem = player.getHeldItemMainhand();
|
||||||
Block block = event.world.getBlock(event.x, y, event.z);
|
if (heldItem.isEmpty()) {
|
||||||
if (block == null || !Gardening.isSoil(block)) {
|
return;
|
||||||
block = event.world.getBlock(event.x, --y, event.z);
|
}
|
||||||
}
|
|
||||||
if (block == null) {
|
IGardeningManager gardening = BotanyCore.getGardening();
|
||||||
|
Block block = world.getBlockState(event.getPos()).getBlock();
|
||||||
|
if (!gardening.isSoil(block)) {
|
||||||
|
pos = pos.down();
|
||||||
|
block = world.getBlockState(pos).getBlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!gardening.isSoil(block)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IBlockSoil soil = (IBlockSoil) block;
|
||||||
|
int fertiliserStrength = gardening.getFertiliserStrength(heldItem);
|
||||||
|
if (gardening.isNutrientFertiliser(heldItem) && soil.getType(world, pos) != EnumSoilType.FLOWERBED) {
|
||||||
|
EnumSoilType type = soil.getType(world, pos);
|
||||||
|
int next = Math.min(type.ordinal() + fertiliserStrength, 2);
|
||||||
|
if (soil.fertilise(world, pos, EnumSoilType.values()[next]) && !player.capabilities.isCreativeMode) {
|
||||||
|
heldItem.shrink(1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Gardening.isSoil(block)) {
|
}
|
||||||
final IBlockSoil soil = (IBlockSoil) block;
|
|
||||||
if (Gardening.isNutrientFertiliser(event.entityPlayer.getHeldItem()) && soil.getType(event.world, event.x, y, event.z) != EnumSoilType.FLOWERBED) {
|
if (gardening.isAcidFertiliser(heldItem) && soil.getPH(world, pos) != EnumAcidity.ACID) {
|
||||||
final EnumSoilType type = soil.getType(event.world, event.x, y, event.z);
|
EnumAcidity pH = soil.getPH(world, pos);
|
||||||
final int next = Math.min(type.ordinal() + Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 2);
|
int next = Math.max(pH.ordinal() - fertiliserStrength, 0);
|
||||||
if (soil.fertilise(event.world, event.x, y, event.z, EnumSoilType.values()[next]) && !event.entityPlayer.capabilities.isCreativeMode) {
|
if (soil.setPH(world, pos, EnumAcidity.values()[next]) && !player.capabilities.isCreativeMode) {
|
||||||
final ItemStack heldItem = event.entityPlayer.getHeldItem();
|
heldItem.shrink(1);
|
||||||
--heldItem.stackSize;
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (Gardening.isAcidFertiliser(event.entityPlayer.getHeldItem()) && soil.getPH(event.world, event.x, y, event.z) != EnumAcidity.Acid) {
|
|
||||||
final EnumAcidity pH = soil.getPH(event.world, event.x, y, event.z);
|
|
||||||
final int next = Math.max(pH.ordinal() - Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 0);
|
|
||||||
if (soil.setPH(event.world, event.x, y, event.z, EnumAcidity.values()[next]) && !event.entityPlayer.capabilities.isCreativeMode) {
|
|
||||||
final ItemStack heldItem2 = event.entityPlayer.getHeldItem();
|
|
||||||
--heldItem2.stackSize;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (Gardening.isAlkalineFertiliser(event.entityPlayer.getHeldItem()) && soil.getPH(event.world, event.x, y, event.z) != EnumAcidity.Alkaline) {
|
|
||||||
final EnumAcidity pH = soil.getPH(event.world, event.x, y, event.z);
|
|
||||||
final int next = Math.min(pH.ordinal() + Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 2);
|
|
||||||
if (soil.setPH(event.world, event.x, y, event.z, EnumAcidity.values()[next]) && !event.entityPlayer.capabilities.isCreativeMode) {
|
|
||||||
final ItemStack heldItem3 = event.entityPlayer.getHeldItem();
|
|
||||||
--heldItem3.stackSize;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (Gardening.isWeedkiller(event.entityPlayer.getHeldItem()) && Gardening.addWeedKiller(event.world, event.x, y, event.z) && !event.entityPlayer.capabilities.isCreativeMode) {
|
|
||||||
final ItemStack heldItem4 = event.entityPlayer.getHeldItem();
|
|
||||||
--heldItem4.stackSize;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gardening.isAlkalineFertiliser(heldItem) && soil.getPH(world, pos) != EnumAcidity.ALKALINE) {
|
||||||
|
EnumAcidity pH = soil.getPH(world, pos);
|
||||||
|
int next = Math.min(pH.ordinal() + fertiliserStrength, 2);
|
||||||
|
if (soil.setPH(world, pos, EnumAcidity.values()[next]) && !player.capabilities.isCreativeMode) {
|
||||||
|
heldItem.shrink(1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gardening.isWeedkiller(heldItem) && gardening.addWeedKiller(world, pos) && !player.capabilities.isCreativeMode) {
|
||||||
|
heldItem.shrink(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void plantVanilla(final BlockEvent.PlaceEvent event) {
|
public void plantVanilla(final BlockEvent.PlaceEvent event) {
|
||||||
final World world = event.world;
|
World world = event.getWorld();
|
||||||
final int x = event.x;
|
BlockPos pos = event.getPos();
|
||||||
final int y = event.y;
|
Block block = world.getBlockState(pos.down()).getBlock();
|
||||||
final int z = event.z;
|
|
||||||
final Block block = world.getBlock(x, y - 1, z);
|
if (!BotanyCore.getGardening().isSoil(block)) {
|
||||||
if (!(block instanceof IBlockSoil)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final IFlower flower = BotanyCore.getFlowerRoot().getConversion(event.itemInHand);
|
EntityPlayer player = event.getPlayer();
|
||||||
|
ItemStack heldItem = player.getHeldItem(event.getHand());
|
||||||
|
IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot();
|
||||||
|
IFlower flower = flowerRoot.getConversion(heldItem);
|
||||||
if (flower != null) {
|
if (flower != null) {
|
||||||
Gardening.plant(world, x, y, z, flower, event.player.getGameProfile());
|
flowerRoot.plant(world, pos, flower, player.getGameProfile());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void onPlantVanilla(final PlayerInteractEvent event) {
|
public void onPlantVanilla(final PlayerInteractEvent.RightClickBlock event) {
|
||||||
if (!BinnieCore.proxy.isSimulating(event.world)) {
|
BlockPos pos = event.getPos();
|
||||||
|
World world = event.getWorld();
|
||||||
|
EntityPlayer player = event.getEntityPlayer();
|
||||||
|
ItemStack heldItem = player.getHeldItemMainhand();
|
||||||
|
if (!BinnieCore.getBinnieProxy().isSimulating(event.getWorld())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
|
||||||
return;
|
if (!heldItem.isEmpty()) {
|
||||||
}
|
Block block = world.getBlockState(pos).getBlock();
|
||||||
if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null) {
|
|
||||||
final World world = event.world;
|
|
||||||
final int x = event.x;
|
|
||||||
final int y = event.y;
|
|
||||||
final int z = event.z;
|
|
||||||
final Block block = world.getBlock(x, y, z);
|
|
||||||
int py = -1;
|
int py = -1;
|
||||||
if (block instanceof IBlockSoil && (world.isAirBlock(x, y + 1, z) || world.getBlock(x, y, z).isReplaceable(world, x, y, z))) {
|
if (block instanceof IBlockSoil && (world.isAirBlock(pos.up()) || block.isReplaceable(world, pos))) {
|
||||||
py = 1;
|
py = 1;
|
||||||
}
|
}
|
||||||
if (py >= 0) {
|
if (py >= 0) {
|
||||||
final IFlower flower = BotanyCore.getFlowerRoot().getConversion(event.entityPlayer.getHeldItem());
|
IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot();
|
||||||
if (flower != null && Gardening.plant(world, x, y + py, z, flower, event.entityPlayer.getGameProfile()) && !event.entityPlayer.capabilities.isCreativeMode) {
|
IFlower flower = flowerRoot.getConversion(heldItem);
|
||||||
final ItemStack heldItem = event.entityPlayer.getHeldItem();
|
if (flower != null && flowerRoot.plant(world, pos.add(0, py, 0), flower, player.getGameProfile()) && !player.capabilities.isCreativeMode) {
|
||||||
--heldItem.stackSize;
|
heldItem.shrink(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -283,50 +304,21 @@ public class Botany extends AbstractMod
|
|||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onBonemeal(final BonemealEvent event) {
|
public void onBonemeal(final BonemealEvent event) {
|
||||||
final Block block = event.world.getBlock(event.x, event.y, event.z);
|
BlockPos pos = event.getPos();
|
||||||
if (Gardening.isSoil(block)) {
|
Block block = event.getBlock().getBlock();
|
||||||
final IBlockSoil soil = (IBlockSoil) block;
|
if (BotanyCore.getGardening().isSoil(block)) {
|
||||||
if (soil.fertilise(event.world, event.x, event.y, event.z, EnumSoilType.LOAM)) {
|
IBlockSoil soil = (IBlockSoil) block;
|
||||||
|
if (soil.fertilise(event.getWorld(), pos, EnumSoilType.LOAM)) {
|
||||||
event.setResult(Event.Result.ALLOW);
|
event.setResult(Event.Result.ALLOW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
TileEntity tile = event.getWorld().getTileEntity(pos);
|
||||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).onBonemeal()) {
|
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).onBonemeal()) {
|
||||||
event.setResult(Event.Result.ALLOW);
|
event.setResult(Event.Result.ALLOW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public static class PacketHandler extends BinniePacketHandler {
|
||||||
public boolean isActive() {
|
|
||||||
return BinnieCore.isBotanyActive();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Mod.EventHandler
|
|
||||||
public void onIMC(final FMLInterModComms.IMCEvent event) {
|
|
||||||
for (final FMLInterModComms.IMCMessage message : event.getMessages()) {
|
|
||||||
if (message.key.equals("add-nutrient-fertiliser-1")) {
|
|
||||||
ModuleGardening.queuedNutrientFertilisers.put(message.getItemStackValue(), 1);
|
|
||||||
}
|
|
||||||
if (message.key.equals("add-nutrient-fertiliser-2")) {
|
|
||||||
ModuleGardening.queuedNutrientFertilisers.put(message.getItemStackValue(), 2);
|
|
||||||
}
|
|
||||||
if (message.key.equals("add-acid-fertiliser-1")) {
|
|
||||||
ModuleGardening.queuedAcidFertilisers.put(message.getItemStackValue(), 1);
|
|
||||||
}
|
|
||||||
if (message.key.equals("add-acid-fertiliser-2")) {
|
|
||||||
ModuleGardening.queuedAcidFertilisers.put(message.getItemStackValue(), 2);
|
|
||||||
}
|
|
||||||
if (message.key.equals("add-alkaline-fertiliser-1")) {
|
|
||||||
ModuleGardening.queuedAlkalineFertilisers.put(message.getItemStackValue(), 1);
|
|
||||||
}
|
|
||||||
if (message.key.equals("add-alkaline-fertiliser-2")) {
|
|
||||||
ModuleGardening.queuedAlkalineFertilisers.put(message.getItemStackValue(), 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class PacketHandler extends BinniePacketHandler
|
|
||||||
{
|
|
||||||
public PacketHandler() {
|
public PacketHandler() {
|
||||||
super(Botany.instance);
|
super(Botany.instance);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,31 +1,28 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany;
|
package binnie.botany;
|
||||||
|
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
|
|
||||||
public class CreativeTabBotany extends CreativeTabs
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
{
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
public static CreativeTabs instance;
|
|
||||||
|
|
||||||
@Override
|
import binnie.core.util.I18N;
|
||||||
public ItemStack getIconItemStack() {
|
|
||||||
return new ItemStack(Blocks.red_flower, 1, 5);
|
public class CreativeTabBotany extends CreativeTabs {
|
||||||
}
|
public static CreativeTabs instance = new CreativeTabBotany();
|
||||||
|
|
||||||
public CreativeTabBotany() {
|
public CreativeTabBotany() {
|
||||||
super("Botany");
|
super("Botany");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
public ItemStack getIconItemStack() {
|
||||||
|
return new ItemStack(Blocks.RED_FLOWER, 1, 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public String getTranslatedTabLabel() {
|
public String getTranslatedTabLabel() {
|
||||||
return this.getTabLabel();
|
return this.getTabLabel();
|
||||||
}
|
}
|
||||||
@@ -33,16 +30,12 @@ public class CreativeTabBotany extends CreativeTabs
|
|||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public String getTabLabel() {
|
public String getTabLabel() {
|
||||||
return Botany.proxy.localise("tab.botany");
|
return I18N.localise("botany.tab.botany");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public Item getTabIconItem() {
|
public ItemStack getTabIconItem() {
|
||||||
return Item.getItemFromBlock(Blocks.yellow_flower);
|
return new ItemStack(Blocks.YELLOW_FLOWER);
|
||||||
}
|
|
||||||
|
|
||||||
static {
|
|
||||||
CreativeTabBotany.instance = new CreativeTabBotany();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,33 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
public enum EnumAcidity
|
import javax.annotation.Nullable;
|
||||||
{
|
|
||||||
Acid,
|
|
||||||
Neutral,
|
|
||||||
Alkaline;
|
|
||||||
|
|
||||||
public String getID() {
|
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 this.name().toLowerCase();
|
return this.name().toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getLocalisedName(boolean withColor) {
|
||||||
|
String localisedName = I18n.translateToLocal("botany.ph." + getName());
|
||||||
|
if(withColor && color != null){
|
||||||
|
localisedName +=color;
|
||||||
|
}
|
||||||
|
return localisedName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,20 +1,17 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
import forestry.api.genetics.IAlleleFloat;
|
import java.util.Locale;
|
||||||
import forestry.api.genetics.IAlleleTolerance;
|
|
||||||
import forestry.api.genetics.IAlleleArea;
|
|
||||||
import forestry.api.genetics.IAlleleInteger;
|
|
||||||
import forestry.api.genetics.AlleleManager;
|
|
||||||
import forestry.api.genetics.ISpeciesRoot;
|
|
||||||
import forestry.api.genetics.IAllele;
|
|
||||||
import forestry.api.genetics.IChromosomeType;
|
|
||||||
|
|
||||||
public enum EnumFlowerChromosome implements IChromosomeType
|
import forestry.api.genetics.AlleleManager;
|
||||||
{
|
import forestry.api.genetics.IAllele;
|
||||||
|
import forestry.api.genetics.IAlleleArea;
|
||||||
|
import forestry.api.genetics.IAlleleFloat;
|
||||||
|
import forestry.api.genetics.IAlleleInteger;
|
||||||
|
import forestry.api.genetics.IAlleleTolerance;
|
||||||
|
import forestry.api.genetics.IChromosomeType;
|
||||||
|
import forestry.api.genetics.ISpeciesRoot;
|
||||||
|
|
||||||
|
public enum EnumFlowerChromosome implements IChromosomeType {
|
||||||
SPECIES(IAlleleFlowerSpecies.class),
|
SPECIES(IAlleleFlowerSpecies.class),
|
||||||
PRIMARY(IAlleleInteger.class),
|
PRIMARY(IAlleleInteger.class),
|
||||||
SECONDARY(IAlleleInteger.class),
|
SECONDARY(IAlleleInteger.class),
|
||||||
@@ -30,7 +27,7 @@ public enum EnumFlowerChromosome implements IChromosomeType
|
|||||||
|
|
||||||
private Class<? extends IAllele> cls;
|
private Class<? extends IAllele> cls;
|
||||||
|
|
||||||
private EnumFlowerChromosome(final Class<? extends IAllele> cls) {
|
EnumFlowerChromosome(final Class<? extends IAllele> cls) {
|
||||||
this.cls = cls;
|
this.cls = cls;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,7 +38,7 @@ public enum EnumFlowerChromosome implements IChromosomeType
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.toString().toLowerCase();
|
return this.toString().toLowerCase(Locale.ENGLISH);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,28 +1,31 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
public enum EnumFlowerStage
|
import forestry.api.genetics.ISpeciesType;
|
||||||
{
|
|
||||||
|
public enum EnumFlowerStage implements ISpeciesType {
|
||||||
FLOWER("Flower"),
|
FLOWER("Flower"),
|
||||||
SEED("Seed"),
|
SEED("Seed"),
|
||||||
POLLEN("Pollen"),
|
POLLEN("Pollen");
|
||||||
NONE("NONE");
|
|
||||||
|
|
||||||
public static final EnumFlowerStage[] VALUES;
|
public static final EnumFlowerStage[] VALUES = values();
|
||||||
String name;
|
String name;
|
||||||
|
|
||||||
private EnumFlowerStage(final String name) {
|
EnumFlowerStage(final String name) {
|
||||||
this.name = 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() {
|
public String getName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
|
||||||
VALUES = values();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,33 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
public enum EnumMoisture
|
import javax.annotation.Nullable;
|
||||||
{
|
|
||||||
Dry,
|
|
||||||
Normal,
|
|
||||||
Damp;
|
|
||||||
|
|
||||||
public String getID() {
|
import net.minecraft.util.IStringSerializable;
|
||||||
return this.name().toLowerCase();
|
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;
|
||||||
|
}
|
||||||
|
return localisedName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,30 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
public enum EnumSoilType
|
import javax.annotation.Nullable;
|
||||||
{
|
import java.util.Locale;
|
||||||
SOIL,
|
|
||||||
LOAM,
|
|
||||||
FLOWERBED;
|
|
||||||
|
|
||||||
public String getID() {
|
import net.minecraft.util.IStringSerializable;
|
||||||
return this.name().toLowerCase();
|
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);
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
final TextFormatting color;
|
||||||
|
|
||||||
|
EnumSoilType(@Nullable TextFormatting color) {
|
||||||
|
this.color = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return this.name().toLowerCase(Locale.ENGLISH);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTranslated(boolean withColor) {
|
||||||
|
return (withColor && color != null ? color : "") + I18n.translateToLocal("botany.soil." + getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package binnie.botany.api;
|
||||||
|
|
||||||
|
public class FlowerManager {
|
||||||
|
/**
|
||||||
|
* Convenient access to AlleleManager.alleleRegistry.getSpeciesRoot("rootFlowers")
|
||||||
|
*/
|
||||||
|
public static IFlowerRoot flowerRoot;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to create new flowers.
|
||||||
|
*/
|
||||||
|
public static IFlowerFactory flowerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to manager soil.
|
||||||
|
*/
|
||||||
|
public static IGardeningManager gardening;
|
||||||
|
}
|
||||||
@@ -1,14 +1,10 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import forestry.api.genetics.IEffectData;
|
|
||||||
import forestry.api.genetics.IAlleleEffect;
|
|
||||||
|
|
||||||
public interface IAlleleFlowerEffect extends IAlleleEffect
|
import forestry.api.genetics.IAlleleEffect;
|
||||||
{
|
import forestry.api.genetics.IEffectData;
|
||||||
|
|
||||||
|
public interface IAlleleFlowerEffect extends IAlleleEffect {
|
||||||
IEffectData doEffect(final IFlowerGenome p0, final IEffectData p1, final World p2, final int p3, final int p4, final int p5);
|
IEffectData doEffect(final IFlowerGenome p0, final IEffectData p1, final World p2, final int p3, final int p4, final int p5);
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,28 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import forestry.api.core.IModelManager;
|
||||||
|
import forestry.api.genetics.IAlleleProperty;
|
||||||
import forestry.api.genetics.IAlleleSpecies;
|
import forestry.api.genetics.IAlleleSpecies;
|
||||||
|
|
||||||
public interface IAlleleFlowerSpecies extends IAlleleSpecies
|
public interface IAlleleFlowerSpecies extends IAlleleSpecies, IAlleleProperty<IAlleleFlowerSpecies> {
|
||||||
{
|
|
||||||
IFlowerType getType();
|
IFlowerType getType();
|
||||||
|
|
||||||
EnumAcidity getPH();
|
EnumAcidity getPH();
|
||||||
|
|
||||||
EnumMoisture getMoisture();
|
EnumMoisture getMoisture();
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
int getFlowerColour(EnumFlowerStage type, int renderPass);
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
ModelResourceLocation getFlowerModel(EnumFlowerStage type, boolean flowered);
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
void registerModels(Item item, IModelManager manager, EnumFlowerStage type);
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package binnie.botany.api;
|
||||||
|
|
||||||
|
import forestry.api.genetics.IAlleleSpeciesBuilder;
|
||||||
|
|
||||||
|
public interface IAlleleFlowerSpeciesBuilder extends IAlleleSpeciesBuilder {
|
||||||
|
@Override
|
||||||
|
IAlleleFlowerSpecies build();
|
||||||
|
|
||||||
|
IAlleleFlowerSpeciesBuilder setPH(EnumAcidity acidity);
|
||||||
|
|
||||||
|
IAlleleFlowerSpeciesBuilder setMoisture(EnumMoisture moisture);
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package binnie.botany.api;
|
||||||
|
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public interface IBlockSoil {
|
||||||
|
EnumAcidity getPH(World world, BlockPos pos);
|
||||||
|
|
||||||
|
EnumMoisture getMoisture(World world, BlockPos pos);
|
||||||
|
|
||||||
|
EnumSoilType getType(World world, BlockPos pos);
|
||||||
|
|
||||||
|
boolean fertilise(World world, BlockPos pos, EnumSoilType soilType);
|
||||||
|
|
||||||
|
boolean degrade(World world, BlockPos pos, EnumSoilType soilType);
|
||||||
|
|
||||||
|
boolean setPH(World world, BlockPos pos, EnumAcidity acidity);
|
||||||
|
|
||||||
|
boolean setMoisture(World world, BlockPos pos, EnumMoisture moisture);
|
||||||
|
|
||||||
|
boolean resistsWeeds(World world, BlockPos pos);
|
||||||
|
}
|
||||||
@@ -1,11 +1,6 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
import forestry.api.genetics.IBreedingTracker;
|
import forestry.api.genetics.IBreedingTracker;
|
||||||
|
|
||||||
public interface IBotanistTracker extends IBreedingTracker
|
public interface IBotanistTracker extends IBreedingTracker {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,11 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
public interface IColourMix
|
public interface IColourMix {
|
||||||
{
|
IFlowerColour getColourFirst();
|
||||||
IFlowerColour getColour1();
|
|
||||||
|
|
||||||
IFlowerColour getColour2();
|
IFlowerColour getColourSecond();
|
||||||
|
|
||||||
boolean isMutation(final IFlowerColour p0, final IFlowerColour p1);
|
boolean isMutation(IFlowerColour colourFirst, IFlowerColour colourSecond);
|
||||||
|
|
||||||
int getChance();
|
int getChance();
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +1,28 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import forestry.api.genetics.IIndividual;
|
import forestry.api.genetics.IIndividual;
|
||||||
|
|
||||||
public interface IFlower extends IIndividual
|
public interface IFlower extends IIndividual {
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
IFlowerGenome getGenome();
|
IFlowerGenome getGenome();
|
||||||
|
|
||||||
|
@Nullable
|
||||||
IFlowerGenome getMate();
|
IFlowerGenome getMate();
|
||||||
|
|
||||||
void mate(final IFlower p0);
|
void mate(final IFlower flower);
|
||||||
|
|
||||||
int getAge();
|
int getAge();
|
||||||
|
|
||||||
|
void setAge(final int age);
|
||||||
|
|
||||||
void age();
|
void age();
|
||||||
|
|
||||||
void setAge(final int p0);
|
IFlower getOffspring(final World world, final BlockPos pos);
|
||||||
|
|
||||||
IFlower getOffspring(final World p0);
|
|
||||||
|
|
||||||
int getMaxAge();
|
int getMaxAge();
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,13 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
import forestry.api.genetics.IAlleleInteger;
|
import forestry.api.genetics.IAlleleInteger;
|
||||||
|
|
||||||
public interface IFlowerColour
|
public interface IFlowerColour {
|
||||||
{
|
|
||||||
int getColor(final boolean p0);
|
int getColor(final boolean p0);
|
||||||
|
|
||||||
IAlleleInteger getAllele();
|
IAlleleInteger getAllele();
|
||||||
|
|
||||||
int getID();
|
int getID();
|
||||||
|
|
||||||
String getName();
|
String getColourName();
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package binnie.botany.api;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
import forestry.core.genetics.IGeneticDefinition;
|
||||||
|
|
||||||
|
public interface IFlowerDefinition extends IGeneticDefinition {
|
||||||
|
@Override
|
||||||
|
IFlowerGenome getGenome();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
IFlower getIndividual();
|
||||||
|
|
||||||
|
ItemStack getMemberStack(EnumFlowerStage flowerStage);
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package binnie.botany.api;
|
||||||
|
|
||||||
|
import forestry.api.genetics.IAllele;
|
||||||
|
import forestry.api.genetics.IClassification;
|
||||||
|
|
||||||
|
public interface IFlowerFactory {
|
||||||
|
IAlleleFlowerSpeciesBuilder createSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean isDominant, IClassification branch, String binomial, IFlowerType flowerType);
|
||||||
|
|
||||||
|
IFlowerMutationBuilder createMutation(IAlleleFlowerSpecies parentFlower0, IAlleleFlowerSpecies parentFlower1, IAllele[] result, int chance);
|
||||||
|
}
|
||||||
@@ -1,15 +1,10 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
import forestry.api.core.EnumTemperature;
|
import forestry.api.core.EnumTemperature;
|
||||||
import forestry.api.genetics.EnumTolerance;
|
import forestry.api.genetics.EnumTolerance;
|
||||||
import forestry.api.genetics.IGenome;
|
import forestry.api.genetics.IGenome;
|
||||||
|
|
||||||
public interface IFlowerGenome extends IGenome
|
public interface IFlowerGenome extends IGenome {
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
IAlleleFlowerSpecies getPrimary();
|
IAlleleFlowerSpecies getPrimary();
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
import forestry.api.genetics.IGenome;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import forestry.api.genetics.IAllele;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import forestry.api.genetics.IMutation;
|
import forestry.api.genetics.IMutation;
|
||||||
|
|
||||||
public interface IFlowerMutation extends IMutation
|
public interface IFlowerMutation extends IMutation {
|
||||||
{
|
@Override
|
||||||
float getChance(final IAllele p0, final IAllele p1, final IGenome p2, final IGenome p3);
|
IFlowerRoot getRoot();
|
||||||
|
|
||||||
|
float getChance(final World world, final BlockPos pos, final IAlleleFlowerSpecies p0, final IAlleleFlowerSpecies p1, final IFlowerGenome p2, final IFlowerGenome p3);
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package binnie.botany.api;
|
||||||
|
|
||||||
|
import forestry.api.genetics.IMutationBuilder;
|
||||||
|
|
||||||
|
public interface IFlowerMutationBuilder extends IMutationBuilder {
|
||||||
|
}
|
||||||
@@ -1,48 +1,59 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import com.mojang.authlib.GameProfile;
|
import java.util.List;
|
||||||
import net.minecraft.world.World;
|
|
||||||
import forestry.api.genetics.IAllele;
|
|
||||||
import net.minecraft.item.ItemStack;
|
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;
|
import forestry.api.genetics.ISpeciesRoot;
|
||||||
|
|
||||||
public interface IFlowerRoot extends ISpeciesRoot
|
public interface IFlowerRoot extends ISpeciesRoot {
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
IFlower getMember(final ItemStack p0);
|
@Nullable
|
||||||
|
IFlower getMember(ItemStack memberStack);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
IFlower templateAsIndividual(final IAllele[] p0);
|
IFlower templateAsIndividual(IAllele[] template);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
IFlower templateAsIndividual(final IAllele[] p0, final IAllele[] p1);
|
IFlower templateAsIndividual(IAllele[] templateFirst, IAllele[] templateSecond);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
IFlowerGenome templateAsGenome(final IAllele[] p0);
|
IFlowerGenome templateAsGenome(IAllele[] template);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
IFlowerGenome templateAsGenome(final IAllele[] p0, final IAllele[] p1);
|
IFlowerGenome templateAsGenome(IAllele[] templateFrist, IAllele[] templateSecond);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
IBotanistTracker getBreedingTracker(final World p0, final GameProfile p1);
|
IBotanistTracker getBreedingTracker(World world, @Nullable GameProfile profile);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
Collection<IFlowerMutation> getMutations(final boolean p0);
|
List<? extends IFlowerMutation> getMutations(boolean shuffle);
|
||||||
|
|
||||||
EnumFlowerStage getStageType(final ItemStack p0);
|
@Override
|
||||||
|
@Nullable
|
||||||
|
EnumFlowerStage getType(ItemStack itemStack);
|
||||||
|
|
||||||
IFlower getFlower(final World p0, final IFlowerGenome p1);
|
IFlower getFlower(IFlowerGenome genome);
|
||||||
|
|
||||||
void addConversion(final ItemStack p0, final IAllele[] p1);
|
void addConversion(ItemStack memberStack, IAllele[] template);
|
||||||
|
|
||||||
IFlower getConversion(final ItemStack p0);
|
@Nullable
|
||||||
|
IFlower getConversion(ItemStack memberStack);
|
||||||
|
|
||||||
Collection<IColourMix> getColourMixes(final boolean p0);
|
Collection<IColourMix> getColourMixes(boolean p0);
|
||||||
|
|
||||||
void registerColourMix(final IColourMix p0);
|
void registerColourMix(IColourMix colourMix);
|
||||||
|
|
||||||
|
boolean plant(World world, BlockPos pos, IFlower flower, GameProfile owner);
|
||||||
|
|
||||||
|
void tryGrowSection(World world, BlockPos pos);
|
||||||
|
|
||||||
|
void onGrowFromSeed(World world, BlockPos pos);
|
||||||
}
|
}
|
||||||
@@ -1,18 +1,21 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
|
||||||
public interface IFlowerType
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
{
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
IIcon getStem(final EnumFlowerStage p0, final boolean p1, final int p2);
|
|
||||||
|
|
||||||
IIcon getPetalIcon(final EnumFlowerStage p0, final boolean p1, final int p2);
|
import forestry.api.core.IModelManager;
|
||||||
|
|
||||||
IIcon getVariantIcon(final EnumFlowerStage p0, final boolean p1, final int p2);
|
public interface IFlowerType<I extends IFlowerType<I>> extends Comparable<I> {
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
void registerModels(Item item, IModelManager manager, EnumFlowerStage type);
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
ModelResourceLocation getModel(EnumFlowerStage type, boolean flowered);
|
||||||
|
|
||||||
|
String getName();
|
||||||
|
|
||||||
int getID();
|
int getID();
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package binnie.botany.api;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import forestry.api.core.EnumTemperature;
|
||||||
|
|
||||||
|
public interface IGardeningManager {
|
||||||
|
default boolean isSoil(final Block block) {
|
||||||
|
return block instanceof IBlockSoil;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isSoil(Item item);
|
||||||
|
|
||||||
|
boolean isSoil(ItemStack item);
|
||||||
|
|
||||||
|
EnumMoisture getNaturalMoisture(World world, BlockPos pos);
|
||||||
|
|
||||||
|
EnumAcidity getNaturalPH(World world, BlockPos pos);
|
||||||
|
|
||||||
|
float getBiomeMoisture(World world, BlockPos pos);
|
||||||
|
|
||||||
|
float getBiomePH(World world, BlockPos pos);
|
||||||
|
|
||||||
|
void plantSoil(World world, BlockPos pos, EnumSoilType soil, EnumMoisture moisture, EnumAcidity acidity);
|
||||||
|
|
||||||
|
Collection<ItemStack> getAcidFertilisers();
|
||||||
|
|
||||||
|
Collection<ItemStack> getAlkalineFertilisers();
|
||||||
|
|
||||||
|
Collection<ItemStack> getNutrientFertilisers();
|
||||||
|
|
||||||
|
void registerAcidFertiliser(ItemStack stack, int strength);
|
||||||
|
|
||||||
|
void registerAlkalineFertiliser(ItemStack stack, int strength);
|
||||||
|
|
||||||
|
void registerNutrientFertiliser(ItemStack stack, int strength);
|
||||||
|
|
||||||
|
boolean isAcidFertiliser(ItemStack stack);
|
||||||
|
|
||||||
|
boolean isAlkalineFertiliser(ItemStack stack);
|
||||||
|
|
||||||
|
boolean isNutrientFertiliser(ItemStack stack);
|
||||||
|
|
||||||
|
int getFertiliserStrength(ItemStack stack);
|
||||||
|
|
||||||
|
boolean canTolerate(@Nullable IFlower flower, World world, BlockPos pos);
|
||||||
|
|
||||||
|
EnumSoilType getSoilType(World world, BlockPos pos);
|
||||||
|
|
||||||
|
default Block getSoilBlock(EnumSoilType type) {
|
||||||
|
return getSoilBlock(type, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
Block getSoilBlock(EnumSoilType type, boolean weedkill);
|
||||||
|
|
||||||
|
boolean canTolerate(IFlower flower, EnumAcidity ePH, EnumMoisture eMoisture, EnumTemperature eTemp);
|
||||||
|
|
||||||
|
boolean isWeedkiller(ItemStack heldItem);
|
||||||
|
|
||||||
|
boolean addWeedKiller(World world, BlockPos pos);
|
||||||
|
}
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.api.gardening;
|
|
||||||
|
|
||||||
import binnie.botany.api.EnumSoilType;
|
|
||||||
import binnie.botany.api.EnumMoisture;
|
|
||||||
import binnie.botany.api.EnumAcidity;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
public interface IBlockSoil
|
|
||||||
{
|
|
||||||
EnumAcidity getPH(final World p0, final int p1, final int p2, final int p3);
|
|
||||||
|
|
||||||
EnumMoisture getMoisture(final World p0, final int p1, final int p2, final int p3);
|
|
||||||
|
|
||||||
EnumSoilType getType(final World p0, final int p1, final int p2, final int p3);
|
|
||||||
|
|
||||||
boolean fertilise(final World p0, final int p1, final int p2, final int p3, final EnumSoilType p4);
|
|
||||||
|
|
||||||
boolean degrade(final World p0, final int p1, final int p2, final int p3, final EnumSoilType p4);
|
|
||||||
|
|
||||||
boolean setPH(final World p0, final int p1, final int p2, final int p3, final EnumAcidity p4);
|
|
||||||
|
|
||||||
boolean setMoisture(final World p0, final int p1, final int p2, final int p3, final EnumMoisture p4);
|
|
||||||
|
|
||||||
boolean resistsWeeds(final World p0, final int p1, final int p2, final int p3);
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
@ParametersAreNonnullByDefault
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
package binnie.botany.api;
|
||||||
|
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
|
import mcp.MethodsReturnNonnullByDefault;
|
||||||
@@ -1,147 +1,119 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.ceramic;
|
package binnie.botany.ceramic;
|
||||||
|
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
import javax.annotation.Nullable;
|
||||||
import binnie.botany.Botany;
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import java.util.List;
|
|
||||||
import binnie.botany.genetics.EnumFlowerColor;
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
import binnie.core.block.TileEntityMetadata;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import binnie.core.block.BlockMetadata;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import net.minecraft.world.World;
|
import java.util.Collections;
|
||||||
import binnie.botany.CreativeTabBotany;
|
import java.util.List;
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import binnie.core.block.IBlockMetadata;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
|
|
||||||
public class BlockCeramic extends Block implements IBlockMetadata
|
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.genetics.EnumFlowerColor;
|
||||||
|
import binnie.core.BinnieCore;
|
||||||
|
import binnie.core.util.TileUtil;
|
||||||
|
|
||||||
|
public class BlockCeramic extends Block implements IColoredBlock, IItemModelRegister {
|
||||||
public BlockCeramic() {
|
public BlockCeramic() {
|
||||||
super(Material.rock);
|
super(Material.ROCK);
|
||||||
this.setHardness(1.0f);
|
this.setHardness(1.0f);
|
||||||
this.setResistance(5.0f);
|
this.setResistance(5.0f);
|
||||||
this.setBlockName("ceramic");
|
this.setRegistryName("ceramic");
|
||||||
this.setCreativeTab(CreativeTabBotany.instance);
|
this.setCreativeTab(CreativeTabBotany.instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int blockMeta, final int fortune) {
|
@SideOnly(Side.CLIENT)
|
||||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
public void registerModel(Item item, IModelManager manager) {
|
||||||
|
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||||
|
manager.registerItemModel(item, c.ordinal());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean removedByPlayer(final World world, final EntityPlayer player, final int x, final int y, final int z) {
|
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(final World var1, final int i) {
|
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, @Nullable EntityPlayer player, boolean willHarvest) {
|
||||||
return new TileEntityMetadata();
|
List<ItemStack> drops = new ArrayList<>();
|
||||||
|
TileCeramic ceramic = TileUtil.getTile(world, pos, TileCeramic.class);
|
||||||
|
if (ceramic != null) {
|
||||||
|
drops = Collections.singletonList(ceramic.getStack());
|
||||||
|
}
|
||||||
|
boolean hasBeenBroken = world.setBlockToAir(pos);
|
||||||
|
if (hasBeenBroken && BinnieCore.getBinnieProxy().isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||||
|
for (ItemStack drop : drops) {
|
||||||
|
spawnAsEntity(world, pos, drop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return hasBeenBroken;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasTileEntity(final int meta) {
|
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||||
|
return new TileCeramic();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasTileEntity(IBlockState state) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onBlockEventReceived(final World par1World, final int par2, final int par3, final int par4, final int par5, final int par6) {
|
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
|
||||||
super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6);
|
TileCeramic ceramic = TileUtil.getTile(worldIn, pos, TileCeramic.class);
|
||||||
final TileEntity tileentity = par1World.getTileEntity(par2, par3, par4);
|
if (ceramic != null) {
|
||||||
return tileentity != null && tileentity.receiveClientEvent(par5, par6);
|
ceramic.setColor(EnumFlowerColor.VALUES[stack.getItemDamage()]);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getPlacedMeta(final ItemStack stack, final World world, final int x, final int y, final int z, final ForgeDirection clickedBlock) {
|
|
||||||
return TileEntityMetadata.getItemDamage(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getDroppedMeta(final int blockMeta, final int tileMeta) {
|
|
||||||
return tileMeta;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getBlockName(final ItemStack par1ItemStack) {
|
|
||||||
final int meta = TileEntityMetadata.getItemDamage(par1ItemStack);
|
|
||||||
return EnumFlowerColor.get(meta).getName() + " Ceramic Block";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void getBlockTooltip(final ItemStack par1ItemStack, final List par3List) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void dropAsStack(final World world, final int x, final int y, final int z, final ItemStack drop) {
|
|
||||||
this.dropBlockAsItem(world, x, y, z, drop);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List itemList) {
|
|
||||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
|
||||||
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) {
|
public void getSubBlocks(final Item item, final CreativeTabs tab, final NonNullList<ItemStack> itemList) {
|
||||||
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||||
if (tile != null) {
|
itemList.add(new ItemStack(item, 1, c.getFlowerColorAllele().getID()));
|
||||||
return this.getIcon(side, tile.getTileMetadata());
|
|
||||||
}
|
}
|
||||||
return super.getIcon(world, x, y, z, side);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getIcon(final int side, final int meta) {
|
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||||
return this.blockIcon;
|
TileCeramic ceramic = TileUtil.getTile(world, pos, TileCeramic.class);
|
||||||
}
|
if (ceramic != null) {
|
||||||
|
return ceramic.getStack();
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void registerBlockIcons(final IIconRegister register) {
|
|
||||||
this.blockIcon = Botany.proxy.getIcon(register, "ceramic");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public int colorMultiplier(final IBlockAccess world, final int x, final int y, final int z) {
|
|
||||||
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
|
||||||
if (tile != null) {
|
|
||||||
return this.getRenderColor(tile.getTileMetadata());
|
|
||||||
}
|
}
|
||||||
return 16777215;
|
return super.getPickBlock(state, target, world, pos, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void breakBlock(final World par1World, final int par2, final int par3, final int par4, final Block par5, final int par6) {
|
|
||||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
|
||||||
par1World.removeTileEntity(par2, par3, par4);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getPickBlock(final MovingObjectPosition target, final World world, final int x, final int y, final int z) {
|
|
||||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int getRenderColor(final int meta) {
|
@Override
|
||||||
return EnumFlowerColor.get(meta).getColor(false);
|
public int colorMultiplier(IBlockState state, @Nullable IBlockAccess world, @Nullable BlockPos pos, int tintIndex) {
|
||||||
|
if (world != null && pos != null) {
|
||||||
|
TileCeramic ceramic = TileUtil.getTile(world, pos, TileCeramic.class);
|
||||||
|
if (ceramic != null) {
|
||||||
|
return ceramic.getColor().getFlowerColorAllele().getColor(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return EnumFlowerColor.get(0).getFlowerColorAllele().getColor(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,529 +0,0 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.ceramic;
|
|
||||||
|
|
||||||
import binnie.botany.items.BotanyItems;
|
|
||||||
import binnie.core.BinnieCore;
|
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
|
||||||
import binnie.botany.Botany;
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import binnie.core.block.MultipassBlockRenderer;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import binnie.botany.genetics.EnumFlowerColor;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import java.util.List;
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
import binnie.core.block.TileEntityMetadata;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import binnie.core.block.BlockMetadata;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import binnie.botany.CreativeTabBotany;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import binnie.core.block.IMultipassBlock;
|
|
||||||
import binnie.core.block.IBlockMetadata;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
|
|
||||||
public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipassBlock
|
|
||||||
{
|
|
||||||
public BlockCeramicBrick() {
|
|
||||||
super(Material.rock);
|
|
||||||
this.setHardness(1.0f);
|
|
||||||
this.setResistance(5.0f);
|
|
||||||
this.setBlockName("ceramicBrick");
|
|
||||||
this.setCreativeTab(CreativeTabBotany.instance);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static BlockType getType(final int meta) {
|
|
||||||
return new BlockType(meta);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int blockMeta, final int fortune) {
|
|
||||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean removedByPlayer(final World world, final EntityPlayer player, final int x, final int y, final int z) {
|
|
||||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(final World var1, final int i) {
|
|
||||||
return new TileEntityMetadata();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasTileEntity(final int meta) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBlockEventReceived(final World par1World, final int par2, final int par3, final int par4, final int par5, final int par6) {
|
|
||||||
super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6);
|
|
||||||
final TileEntity tileentity = par1World.getTileEntity(par2, par3, par4);
|
|
||||||
return tileentity != null && tileentity.receiveClientEvent(par5, par6);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getPlacedMeta(final ItemStack stack, final World world, final int x, final int y, final int z, final ForgeDirection clickedBlock) {
|
|
||||||
return TileEntityMetadata.getItemDamage(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getDroppedMeta(final int blockMeta, final int tileMeta) {
|
|
||||||
return tileMeta;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getBlockName(final ItemStack par1ItemStack) {
|
|
||||||
final int meta = TileEntityMetadata.getItemDamage(par1ItemStack);
|
|
||||||
return getType(meta).getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void getBlockTooltip(final ItemStack par1ItemStack, final List par3List) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void dropAsStack(final World world, final int x, final int y, final int z, final ItemStack drop) {
|
|
||||||
this.dropBlockAsItem(world, x, y, z, drop);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List itemList) {
|
|
||||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
|
||||||
final BlockType type = new BlockType(c, c, TileType.Tile);
|
|
||||||
itemList.add(TileEntityMetadata.getItemStack(this, type.ordinal()));
|
|
||||||
}
|
|
||||||
for (final TileType type2 : TileType.values()) {
|
|
||||||
if (type2.canDouble()) {
|
|
||||||
itemList.add(new BlockType(EnumFlowerColor.Brown, EnumFlowerColor.Gold, type2).getStack(1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
itemList.add(new BlockType(EnumFlowerColor.Gold, EnumFlowerColor.Gold, TileType.Split).getStack(1));
|
|
||||||
itemList.add(new BlockType(EnumFlowerColor.Brown, EnumFlowerColor.Brown, TileType.Chequered).getStack(1));
|
|
||||||
itemList.add(new BlockType(EnumFlowerColor.Gold, EnumFlowerColor.Brown, TileType.LargeBrick).getStack(1));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) {
|
|
||||||
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
|
||||||
if (tile != null) {
|
|
||||||
return this.getIcon(side, tile.getTileMetadata());
|
|
||||||
}
|
|
||||||
return super.getIcon(world, x, y, z, side);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(final int side, final int meta) {
|
|
||||||
return getType(meta).getIcon(MultipassBlockRenderer.getLayer());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void registerBlockIcons(final IIconRegister register) {
|
|
||||||
for (final TileType type : TileType.values()) {
|
|
||||||
for (int i = 0; i < 3; ++i) {
|
|
||||||
type.icons[i] = Botany.proxy.getIcon(register, "ceramic." + type.id + "." + i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public int colorMultiplier(final IBlockAccess world, final int x, final int y, final int z) {
|
|
||||||
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
|
||||||
if (tile != null) {
|
|
||||||
return this.getRenderColor(tile.getTileMetadata());
|
|
||||||
}
|
|
||||||
return 16777215;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void breakBlock(final World par1World, final int par2, final int par3, final int par4, final Block par5, final int par6) {
|
|
||||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
|
||||||
par1World.removeTileEntity(par2, par3, par4);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getPickBlock(final MovingObjectPosition target, final World world, final int x, final int y, final int z) {
|
|
||||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public int getRenderColor(final int meta) {
|
|
||||||
return this.colorMultiplier(meta);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getNumberOfPasses() {
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int colorMultiplier(final int meta) {
|
|
||||||
final BlockType type = getType(meta);
|
|
||||||
if (MultipassBlockRenderer.getLayer() == 0) {
|
|
||||||
return 16777215;
|
|
||||||
}
|
|
||||||
if (MultipassBlockRenderer.getLayer() == 1) {
|
|
||||||
return type.color1.getColor(false);
|
|
||||||
}
|
|
||||||
return type.color2.getColor(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getRenderType() {
|
|
||||||
return BinnieCore.multipassRenderID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum TileType
|
|
||||||
{
|
|
||||||
Tile("tile", "Ceramic Tile"),
|
|
||||||
Brick("brick", "Ceramic Bricks"),
|
|
||||||
StripeBrick("brickstripe", "Striped Ceramic Bricks"),
|
|
||||||
LargeBrick("bricklarge", "Large Ceramic Bricks"),
|
|
||||||
Split("split", "Split Ceramic Tile"),
|
|
||||||
Chequered("cheque", "Chequered Ceramic Tile"),
|
|
||||||
Mixed("mixed", "Mixed Ceramic Tile"),
|
|
||||||
VerticalBrick("verticalbrick", "Vertical Ceramic Bricks"),
|
|
||||||
VerticalStripeBrick("verticalbrickstripe", "Vertical Striped Ceramic Bricks"),
|
|
||||||
VerticalLargeBrick("verticalbricklarge", "Large Vertical Ceramic Bricks");
|
|
||||||
|
|
||||||
String id;
|
|
||||||
String name;
|
|
||||||
IIcon[] icons;
|
|
||||||
|
|
||||||
private TileType(final String id, final String name) {
|
|
||||||
this.icons = new IIcon[3];
|
|
||||||
this.id = id;
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static TileType get(final int id) {
|
|
||||||
return values()[id % values().length];
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean canDouble() {
|
|
||||||
return this != TileType.Tile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack getRecipe(final List<ItemStack> stacks) {
|
|
||||||
switch (this) {
|
|
||||||
case Tile: {
|
|
||||||
if (stacks.size() != 4) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
int mortars = 0;
|
|
||||||
int blocks = 0;
|
|
||||||
int blockColor = -1;
|
|
||||||
for (final ItemStack stack : stacks) {
|
|
||||||
if (this.isMortar(stack)) {
|
|
||||||
++mortars;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (stack.getItem() != Item.getItemFromBlock(Botany.ceramic)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
++blocks;
|
|
||||||
final int color = TileEntityMetadata.getItemDamage(stack);
|
|
||||||
if (blockColor == -1) {
|
|
||||||
blockColor = color;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (blockColor != color) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mortars != 1) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
final EnumFlowerColor c = EnumFlowerColor.get(blockColor);
|
|
||||||
return new BlockType(c, c, TileType.Tile).getStack(3);
|
|
||||||
}
|
|
||||||
case Split: {
|
|
||||||
if (stacks.size() != 4) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
final int[] colors = { -1, -1 };
|
|
||||||
int altCounter = 0;
|
|
||||||
for (final ItemStack stack2 : stacks) {
|
|
||||||
final int alt = (altCounter != 0 && altCounter != 3) ? 1 : 0;
|
|
||||||
if (stack2.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
final BlockType type = new BlockType(stack2);
|
|
||||||
if (type.type != TileType.Tile) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
final int color2 = type.color1.ordinal();
|
|
||||||
if (colors[alt] == -1) {
|
|
||||||
colors[alt] = color2;
|
|
||||||
}
|
|
||||||
else if (colors[alt] != color2) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
++altCounter;
|
|
||||||
}
|
|
||||||
return new BlockType(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), TileType.Split).getStack(4);
|
|
||||||
}
|
|
||||||
case Chequered: {
|
|
||||||
if (stacks.size() != 4) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
final int[] colors = { -1, -1 };
|
|
||||||
for (final ItemStack stack2 : stacks) {
|
|
||||||
if (stack2.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
final BlockType type2 = new BlockType(stack2);
|
|
||||||
if (type2.type != TileType.Split) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
final int color3 = type2.color1.ordinal();
|
|
||||||
final int color4 = type2.color2.ordinal();
|
|
||||||
if (colors[0] == -1) {
|
|
||||||
colors[0] = color3;
|
|
||||||
colors[1] = color4;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (colors[0] != color3 || colors[1] != color4) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new BlockType(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), TileType.Chequered).getStack(4);
|
|
||||||
}
|
|
||||||
case Mixed: {
|
|
||||||
if (stacks.size() != 4) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
final int[] colors = { -1, -1 };
|
|
||||||
for (int index = 0; index < stacks.size(); ++index) {
|
|
||||||
final ItemStack stack2 = stacks.get(index);
|
|
||||||
if (stack2.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
final BlockType type2 = new BlockType(stack2);
|
|
||||||
if (type2.isTwoColors()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
final int color3 = type2.color1.ordinal();
|
|
||||||
if (type2.type == TileType.Split) {
|
|
||||||
if (colors[1] != -1) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
colors[1] = color3;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (type2.type != TileType.Chequered) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (colors[0] == -1) {
|
|
||||||
colors[0] = color3;
|
|
||||||
}
|
|
||||||
else if (colors[0] != color3) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
final int color4 = type2.color2.ordinal();
|
|
||||||
}
|
|
||||||
if (colors[0] == -1 || colors[1] == -1) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new BlockType(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), TileType.Mixed).getStack(4);
|
|
||||||
}
|
|
||||||
case LargeBrick: {
|
|
||||||
if (stacks.size() == 1) {
|
|
||||||
final ItemStack stack3 = stacks.get(0);
|
|
||||||
final BlockType type3 = new BlockType(stack3);
|
|
||||||
if (type3.type == TileType.VerticalLargeBrick) {
|
|
||||||
type3.type = this;
|
|
||||||
return type3.getStack(1);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (stacks.size() != 3) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
final int[] colors = { -1, -1 };
|
|
||||||
int a = 0;
|
|
||||||
int b = 0;
|
|
||||||
for (int index2 = 0; index2 < stacks.size(); ++index2) {
|
|
||||||
final ItemStack stack4 = stacks.get(index2);
|
|
||||||
if (stack4.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
final BlockType type4 = new BlockType(stack4);
|
|
||||||
if (type4.type != TileType.Tile) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
final int color5 = type4.color1.ordinal();
|
|
||||||
if (colors[0] == -1) {
|
|
||||||
colors[0] = color5;
|
|
||||||
++a;
|
|
||||||
}
|
|
||||||
else if (colors[0] == color5) {
|
|
||||||
++a;
|
|
||||||
}
|
|
||||||
else if (colors[1] == -1) {
|
|
||||||
colors[1] = color5;
|
|
||||||
++b;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (colors[1] != color5) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
++b;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (colors[1] == -1) {
|
|
||||||
colors[1] = colors[0];
|
|
||||||
}
|
|
||||||
return new BlockType(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), TileType.LargeBrick).getStack(3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case Brick:
|
|
||||||
case StripeBrick: {
|
|
||||||
if (stacks.size() == 1) {
|
|
||||||
final ItemStack stack5 = stacks.get(0);
|
|
||||||
final BlockType type = new BlockType(stack5);
|
|
||||||
if (type.type == TileType.VerticalBrick) {
|
|
||||||
type.type = this;
|
|
||||||
return type.getStack(1);
|
|
||||||
}
|
|
||||||
if (type.type == TileType.StripeBrick) {
|
|
||||||
type.type = this;
|
|
||||||
return type.getStack(1);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (stacks.size() != 4) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
final int[] colors = { -1, -1 };
|
|
||||||
for (int index2 = 0; index2 < stacks.size(); ++index2) {
|
|
||||||
final ItemStack stack4 = stacks.get(index2);
|
|
||||||
if (stack4.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
final BlockType type4 = new BlockType(stack4);
|
|
||||||
if (type4.type != TileType.LargeBrick) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
final int color5 = type4.color1.ordinal();
|
|
||||||
final int color6 = type4.color2.ordinal();
|
|
||||||
int alt2 = (index2 != 0 && index2 != 3) ? 1 : 0;
|
|
||||||
if (this == TileType.StripeBrick) {
|
|
||||||
alt2 = 0;
|
|
||||||
}
|
|
||||||
if (colors[alt2] == -1) {
|
|
||||||
colors[alt2] = color5;
|
|
||||||
colors[1 - alt2] = color6;
|
|
||||||
}
|
|
||||||
else if (colors[alt2] != color5 || colors[1 - alt2] != color6) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new BlockType(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), this).getStack(4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case VerticalLargeBrick:
|
|
||||||
case VerticalBrick:
|
|
||||||
case VerticalStripeBrick: {
|
|
||||||
if (stacks.size() != 1) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
final ItemStack stack5 = stacks.get(0);
|
|
||||||
final BlockType type = new BlockType(stack5);
|
|
||||||
if (type.type == TileType.LargeBrick) {
|
|
||||||
type.type = TileType.VerticalLargeBrick;
|
|
||||||
return type.getStack(1);
|
|
||||||
}
|
|
||||||
if (type.type == TileType.Brick) {
|
|
||||||
type.type = TileType.VerticalBrick;
|
|
||||||
return type.getStack(1);
|
|
||||||
}
|
|
||||||
if (type.type == TileType.StripeBrick) {
|
|
||||||
type.type = TileType.VerticalStripeBrick;
|
|
||||||
return type.getStack(1);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isMortar(final ItemStack stack) {
|
|
||||||
return stack.getItem() == Botany.misc && stack.getItemDamage() == BotanyItems.Mortar.ordinal();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class BlockType
|
|
||||||
{
|
|
||||||
EnumFlowerColor color1;
|
|
||||||
EnumFlowerColor color2;
|
|
||||||
TileType type;
|
|
||||||
|
|
||||||
private BlockType(final EnumFlowerColor color1, final EnumFlowerColor color2, final TileType type) {
|
|
||||||
this.color1 = color1;
|
|
||||||
this.color2 = color2;
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isTwoColors() {
|
|
||||||
return this.type.canDouble() && this.color2 != this.color1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BlockType(final ItemStack stack) {
|
|
||||||
this(TileEntityMetadata.getItemDamage(stack));
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack getStack(final int i) {
|
|
||||||
final ItemStack s = TileEntityMetadata.getItemStack(Botany.ceramicBrick, this.ordinal());
|
|
||||||
s.stackSize = i;
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BlockType(final int id) {
|
|
||||||
this.color1 = EnumFlowerColor.get(id & 0xFF);
|
|
||||||
this.color2 = EnumFlowerColor.get(id >> 8 & 0xFF);
|
|
||||||
this.type = TileType.get(id >> 16 & 0xFF);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
String name = this.color1.getName();
|
|
||||||
if (this.type.canDouble() && this.color2 != this.color1) {
|
|
||||||
name = name + " & " + this.color2.getName();
|
|
||||||
}
|
|
||||||
return name + " " + this.type.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int ordinal() {
|
|
||||||
return this.color1.ordinal() + this.color2.ordinal() * 256 + this.type.ordinal() * 256 * 256;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IIcon getIcon(final int layer) {
|
|
||||||
return this.type.icons[layer];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +1,22 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.ceramic;
|
package binnie.botany.ceramic;
|
||||||
|
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
import binnie.botany.CreativeTabBotany;
|
||||||
|
import binnie.botany.genetics.EnumFlowerColor;
|
||||||
|
import binnie.extratrees.api.IDesign;
|
||||||
|
import binnie.extratrees.carpentry.BlockDesign;
|
||||||
import binnie.extratrees.carpentry.DesignBlock;
|
import binnie.extratrees.carpentry.DesignBlock;
|
||||||
import binnie.extratrees.carpentry.ModuleCarpentry;
|
import binnie.extratrees.carpentry.ModuleCarpentry;
|
||||||
import binnie.botany.genetics.EnumFlowerColor;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import binnie.extratrees.api.IDesign;
|
|
||||||
import binnie.botany.CreativeTabBotany;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import binnie.extratrees.carpentry.BlockDesign;
|
|
||||||
|
|
||||||
public class BlockCeramicPatterned extends BlockDesign
|
public class BlockCeramicPatterned extends BlockDesign {
|
||||||
{
|
|
||||||
public BlockCeramicPatterned() {
|
public BlockCeramicPatterned() {
|
||||||
super(CeramicDesignSystem.instance, Material.rock);
|
super(CeramicDesignSystem.instance, Material.ROCK);
|
||||||
this.setHardness(1.0f);
|
this.setHardness(1.0f);
|
||||||
this.setResistance(5.0f);
|
this.setResistance(5.0f);
|
||||||
this.setCreativeTab(CreativeTabBotany.instance);
|
this.setCreativeTab(CreativeTabBotany.instance);
|
||||||
this.setBlockName("ceramicPattern");
|
this.setRegistryName("ceramicPattern");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,197 +0,0 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.ceramic;
|
|
||||||
|
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
|
||||||
import binnie.botany.Botany;
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import java.util.List;
|
|
||||||
import binnie.botany.genetics.EnumFlowerColor;
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
import binnie.core.block.TileEntityMetadata;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import binnie.core.block.BlockMetadata;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import binnie.extratrees.ExtraTrees;
|
|
||||||
import net.minecraft.util.Facing;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import java.util.Random;
|
|
||||||
import binnie.botany.CreativeTabBotany;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import binnie.core.block.IBlockMetadata;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
|
|
||||||
public class BlockStained extends Block implements IBlockMetadata
|
|
||||||
{
|
|
||||||
public BlockStained() {
|
|
||||||
super(Material.glass);
|
|
||||||
this.setCreativeTab(CreativeTabBotany.instance);
|
|
||||||
this.setBlockName("stained");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int quantityDropped(final Random p_149745_1_) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOpaqueCube() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean renderAsNormalBlock() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public int getRenderBlockPass() {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public boolean shouldSideBeRendered(final IBlockAccess p_149646_1_, final int p_149646_2_, final int p_149646_3_, final int p_149646_4_, final int p_149646_5_) {
|
|
||||||
final Block block2 = p_149646_1_.getBlock(p_149646_2_ - Facing.offsetsXForSide[p_149646_5_], p_149646_3_ - Facing.offsetsYForSide[p_149646_5_], p_149646_4_ - Facing.offsetsZForSide[p_149646_5_]);
|
|
||||||
final Block block3 = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_);
|
|
||||||
return block3 != this && block3 != ExtraTrees.blockStained && super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int blockMeta, final int fortune) {
|
|
||||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean removedByPlayer(final World world, final EntityPlayer player, final int x, final int y, final int z) {
|
|
||||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TileEntity createNewTileEntity(final World var1, final int i) {
|
|
||||||
return new TileEntityMetadata();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasTileEntity(final int meta) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBlockEventReceived(final World par1World, final int par2, final int par3, final int par4, final int par5, final int par6) {
|
|
||||||
super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6);
|
|
||||||
final TileEntity tileentity = par1World.getTileEntity(par2, par3, par4);
|
|
||||||
return tileentity != null && tileentity.receiveClientEvent(par5, par6);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getPlacedMeta(final ItemStack stack, final World world, final int x, final int y, final int z, final ForgeDirection clickedBlock) {
|
|
||||||
return TileEntityMetadata.getItemDamage(stack);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getDroppedMeta(final int blockMeta, final int tileMeta) {
|
|
||||||
return tileMeta;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getBlockName(final ItemStack par1ItemStack) {
|
|
||||||
final int meta = TileEntityMetadata.getItemDamage(par1ItemStack);
|
|
||||||
return EnumFlowerColor.get(meta).getName() + " Pigmented Glass";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void getBlockTooltip(final ItemStack par1ItemStack, final List par3List) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void dropAsStack(final World world, final int x, final int y, final int z, final ItemStack drop) {
|
|
||||||
this.dropBlockAsItem(world, x, y, z, drop);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List itemList) {
|
|
||||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
|
||||||
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) {
|
|
||||||
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
|
||||||
if (tile != null) {
|
|
||||||
return this.getIcon(side, tile.getTileMetadata());
|
|
||||||
}
|
|
||||||
return super.getIcon(world, x, y, z, side);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(final int side, final int meta) {
|
|
||||||
return this.blockIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void registerBlockIcons(final IIconRegister register) {
|
|
||||||
this.blockIcon = Botany.proxy.getIcon(register, "stained");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public int colorMultiplier(final IBlockAccess world, final int x, final int y, final int z) {
|
|
||||||
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
|
||||||
if (tile != null) {
|
|
||||||
return this.getRenderColor(tile.getTileMetadata());
|
|
||||||
}
|
|
||||||
return 16777215;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void breakBlock(final World par1World, final int par2, final int par3, final int par4, final Block par5, final int par6) {
|
|
||||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
|
||||||
par1World.removeTileEntity(par2, par3, par4);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isWood(final IBlockAccess world, final int x, final int y, final int z) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getFlammability(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
|
|
||||||
return 20;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFlammable(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getFireSpreadSpeed(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
|
|
||||||
return 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getPickBlock(final MovingObjectPosition target, final World world, final int x, final int y, final int z) {
|
|
||||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public int getRenderColor(final int meta) {
|
|
||||||
return EnumFlowerColor.get(meta).getColor(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,183 @@
|
|||||||
|
package binnie.botany.ceramic;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.SoundType;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.enchantment.EnchantmentHelper;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.init.Enchantments;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.stats.StatList;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.BlockRenderLayer;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import net.minecraftforge.event.ForgeEventFactory;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import forestry.api.core.IItemModelRegister;
|
||||||
|
import forestry.api.core.IModelManager;
|
||||||
|
import forestry.core.blocks.IColoredBlock;
|
||||||
|
|
||||||
|
import binnie.botany.CreativeTabBotany;
|
||||||
|
import binnie.botany.genetics.EnumFlowerColor;
|
||||||
|
import binnie.core.block.BlockMetadata;
|
||||||
|
import binnie.core.block.IBlockMetadata;
|
||||||
|
import binnie.core.block.TileEntityMetadata;
|
||||||
|
import binnie.core.util.I18N;
|
||||||
|
|
||||||
|
public class BlockStainedGlass extends Block implements IBlockMetadata, IColoredBlock, IItemModelRegister {
|
||||||
|
public BlockStainedGlass() {
|
||||||
|
super(Material.GLASS);
|
||||||
|
this.setCreativeTab(CreativeTabBotany.instance);
|
||||||
|
this.setRegistryName("stained");
|
||||||
|
this.setSoundType(SoundType.GLASS);
|
||||||
|
this.setHardness(0.3F);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int quantityDropped(final 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) {
|
||||||
|
java.util.List<ItemStack> items = new java.util.ArrayList<ItemStack>();
|
||||||
|
TileEntityMetadata tile = (TileEntityMetadata) te;
|
||||||
|
int damage = getDroppedMeta(state, tile.getTileMetadata());
|
||||||
|
ItemStack itemstack = TileEntityMetadata.getItemStack(this, damage);
|
||||||
|
|
||||||
|
if (!itemstack.isEmpty()) {
|
||||||
|
items.add(itemstack);
|
||||||
|
}
|
||||||
|
|
||||||
|
ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, state, 0, 1.0f, true, player);
|
||||||
|
for (ItemStack item : items) {
|
||||||
|
spawnAsEntity(worldIn, pos, item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TileEntity createNewTileEntity(final World var1, final 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(final ItemStack stack, final World world, final BlockPos pos, final EnumFacing clickedBlock) {
|
||||||
|
return TileEntityMetadata.getItemDamage(stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getDroppedMeta(IBlockState state, int tileMetadata) {
|
||||||
|
return tileMetadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDisplayName(final ItemStack itemStack) {
|
||||||
|
final int meta = TileEntityMetadata.getItemDamage(itemStack);
|
||||||
|
return EnumFlowerColor.get(meta).getFlowerColorAllele().getColourName() + " " + I18N.localise("tile.botany.pigmented.glass.name");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getSubBlocks(final Item itemIn, final CreativeTabs tab, final NonNullList<ItemStack> itemList) {
|
||||||
|
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||||
|
itemList.add(TileEntityMetadata.getItemStack(this, c.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;
|
||||||
|
}
|
||||||
|
return EnumFlowerColor.get(TileEntityMetadata.getTileMetadata(worldIn, pos)).getFlowerColorAllele().getColor(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,21 +1,25 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.ceramic;
|
package binnie.botany.ceramic;
|
||||||
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import binnie.core.block.TileEntityMetadata;
|
|
||||||
import binnie.botany.Botany;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
import binnie.botany.Botany;
|
||||||
import binnie.botany.genetics.EnumFlowerColor;
|
import binnie.botany.genetics.EnumFlowerColor;
|
||||||
|
import binnie.core.block.TileEntityMetadata;
|
||||||
import binnie.extratrees.api.IDesignMaterial;
|
import binnie.extratrees.api.IDesignMaterial;
|
||||||
|
|
||||||
public class CeramicColor implements IDesignMaterial
|
public class CeramicColor implements IDesignMaterial {
|
||||||
{
|
private final static Map<EnumFlowerColor, CeramicColor> map = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
static {
|
||||||
|
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||||
|
CeramicColor.map.put(c, new CeramicColor(c));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EnumFlowerColor color;
|
EnumFlowerColor color;
|
||||||
static Map<EnumFlowerColor, CeramicColor> map;
|
|
||||||
|
|
||||||
CeramicColor(final EnumFlowerColor color) {
|
CeramicColor(final EnumFlowerColor color) {
|
||||||
this.color = color;
|
this.color = color;
|
||||||
@@ -31,19 +35,17 @@ public class CeramicColor implements IDesignMaterial
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public ItemStack getStack(boolean fireproof) {
|
||||||
|
return getStack();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDesignMaterialName() {
|
||||||
return this.color.getName();
|
return this.color.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getColour() {
|
public int getColour() {
|
||||||
return this.color.getColor(false);
|
return this.color.getFlowerColorAllele().getColor(false);
|
||||||
}
|
|
||||||
|
|
||||||
static {
|
|
||||||
CeramicColor.map = new LinkedHashMap<EnumFlowerColor, CeramicColor>();
|
|
||||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
|
||||||
CeramicColor.map.put(c, new CeramicColor(c));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,36 +1,37 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.ceramic;
|
package binnie.botany.ceramic;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import javax.annotation.Nullable;
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import binnie.botany.items.BotanyItems;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import binnie.botany.Botany;
|
|
||||||
import binnie.core.AbstractMod;
|
|
||||||
import binnie.core.BinnieCore;
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import binnie.extratrees.carpentry.EnumPattern;
|
|
||||||
import binnie.extratrees.api.IPattern;
|
|
||||||
import binnie.botany.genetics.EnumFlowerColor;
|
|
||||||
import binnie.extratrees.api.IDesignMaterial;
|
|
||||||
import binnie.extratrees.carpentry.DesignerManager;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import binnie.extratrees.api.IDesignSystem;
|
|
||||||
|
|
||||||
public class CeramicDesignSystem implements IDesignSystem
|
import net.minecraft.client.Minecraft;
|
||||||
{
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
public static CeramicDesignSystem instance;
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
Map<Integer, IIcon> primary;
|
import net.minecraft.item.Item;
|
||||||
Map<Integer, IIcon> secondary;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import binnie.botany.Botany;
|
||||||
|
import binnie.botany.genetics.EnumFlowerColor;
|
||||||
|
import binnie.botany.items.BotanyItems;
|
||||||
|
import binnie.core.AbstractMod;
|
||||||
|
import binnie.extratrees.api.IDesignMaterial;
|
||||||
|
import binnie.extratrees.api.IDesignSystem;
|
||||||
|
import binnie.extratrees.api.IPattern;
|
||||||
|
import binnie.extratrees.carpentry.DesignerManager;
|
||||||
|
import binnie.extratrees.carpentry.EnumPattern;
|
||||||
|
|
||||||
|
public class CeramicDesignSystem implements IDesignSystem {
|
||||||
|
public static CeramicDesignSystem instance = new CeramicDesignSystem();
|
||||||
|
Map<Integer, TextureAtlasSprite> primary;
|
||||||
|
Map<Integer, TextureAtlasSprite> secondary;
|
||||||
|
|
||||||
CeramicDesignSystem() {
|
CeramicDesignSystem() {
|
||||||
this.primary = new HashMap<Integer, IIcon>();
|
this.primary = new HashMap<>();
|
||||||
this.secondary = new HashMap<Integer, IIcon>();
|
this.secondary = new HashMap<>();
|
||||||
DesignerManager.instance.registerDesignSystem(this);
|
DesignerManager.instance.registerDesignSystem(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,11 +56,13 @@ public class CeramicDesignSystem implements IDesignSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getTexturePath() {
|
public String getTexturePath() {
|
||||||
return "ceramic";
|
return "blocks/ceramic";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getPrimaryIcon(final IPattern pattern) {
|
@Nullable
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public TextureAtlasSprite getPrimarySprite(IPattern pattern) {
|
||||||
if (pattern instanceof EnumPattern) {
|
if (pattern instanceof EnumPattern) {
|
||||||
return this.primary.get(((EnumPattern) pattern).ordinal());
|
return this.primary.get(((EnumPattern) pattern).ordinal());
|
||||||
}
|
}
|
||||||
@@ -67,7 +70,9 @@ public class CeramicDesignSystem implements IDesignSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getSecondaryIcon(final IPattern pattern) {
|
@Nullable
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public TextureAtlasSprite getSecondarySprite(IPattern pattern) {
|
||||||
if (pattern instanceof EnumPattern) {
|
if (pattern instanceof EnumPattern) {
|
||||||
return this.secondary.get(((EnumPattern) pattern).ordinal());
|
return this.secondary.get(((EnumPattern) pattern).ordinal());
|
||||||
}
|
}
|
||||||
@@ -75,10 +80,14 @@ public class CeramicDesignSystem implements IDesignSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerIcons(final IIconRegister register) {
|
@SideOnly(Side.CLIENT)
|
||||||
for (final EnumPattern pattern : EnumPattern.values()) {
|
public void registerSprites() {
|
||||||
this.primary.put(pattern.ordinal(), BinnieCore.proxy.getIcon(register, this.getMod().getModID(), this.getTexturePath() + "/" + pattern.toString().toLowerCase() + ".0"));
|
TextureMap textureMap = Minecraft.getMinecraft().getTextureMapBlocks();
|
||||||
this.secondary.put(pattern.ordinal(), BinnieCore.proxy.getIcon(register, this.getMod().getModID(), this.getTexturePath() + "/" + pattern.toString().toLowerCase() + ".1"));
|
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");
|
||||||
|
this.primary.put(pattern.ordinal(), textureMap.registerSprite(primaryLocation));
|
||||||
|
this.secondary.put(pattern.ordinal(), textureMap.registerSprite(secondaryLocation));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,11 +101,8 @@ public class CeramicDesignSystem implements IDesignSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Nullable
|
||||||
public IDesignMaterial getMaterial(final ItemStack itemStack) {
|
public IDesignMaterial getMaterial(final ItemStack itemStack) {
|
||||||
return (itemStack.getItem() == Item.getItemFromBlock(Botany.ceramic)) ? this.getMaterial(itemStack.getItemDamage()) : null;
|
return (itemStack.getItem() == Item.getItemFromBlock(Botany.ceramic)) ? this.getMaterial(itemStack.getItemDamage()) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
|
||||||
CeramicDesignSystem.instance = new CeramicDesignSystem();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,27 +1,27 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.ceramic;
|
package binnie.botany.ceramic;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import net.minecraft.block.Block;
|
import java.util.List;
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import binnie.botany.Botany;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraft.inventory.InventoryCrafting;
|
import net.minecraft.inventory.InventoryCrafting;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class CeramicTileRecipe implements IRecipe
|
import net.minecraftforge.common.ForgeHooks;
|
||||||
{
|
|
||||||
ItemStack cached;
|
import binnie.botany.Botany;
|
||||||
|
import binnie.botany.ceramic.brick.CeramicBrickType;
|
||||||
|
|
||||||
|
public class CeramicTileRecipe implements IRecipe {
|
||||||
|
private ItemStack cached = ItemStack.EMPTY;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(final InventoryCrafting inv, final World world) {
|
public boolean matches(final InventoryCrafting inv, final World world) {
|
||||||
this.cached = this.getCraftingResult(inv);
|
this.cached = this.getCraftingResult(inv);
|
||||||
return this.cached != null;
|
return !this.cached.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -30,12 +30,12 @@ public class CeramicTileRecipe implements IRecipe
|
|||||||
final Item ceramicTile = Item.getItemFromBlock(Botany.ceramicTile);
|
final Item ceramicTile = Item.getItemFromBlock(Botany.ceramicTile);
|
||||||
final Item ceramicBrick = Item.getItemFromBlock(Botany.ceramicBrick);
|
final Item ceramicBrick = Item.getItemFromBlock(Botany.ceramicBrick);
|
||||||
final Item mortar = Botany.misc;
|
final Item mortar = Botany.misc;
|
||||||
final List<ItemStack> stacks = new ArrayList<ItemStack>();
|
final List<ItemStack> stacks = new ArrayList<>();
|
||||||
int ix = -1;
|
int ix = -1;
|
||||||
int iy = -1;
|
int iy = -1;
|
||||||
for (int i = 0; i < inv.getSizeInventory(); ++i) {
|
for (int i = 0; i < inv.getSizeInventory(); ++i) {
|
||||||
final ItemStack stack = inv.getStackInSlot(i);
|
final ItemStack stack = inv.getStackInSlot(i);
|
||||||
if (stack != null) {
|
if (!stack.isEmpty()) {
|
||||||
final int x = i / 3;
|
final int x = i / 3;
|
||||||
final int y = i % 3;
|
final int y = i % 3;
|
||||||
if (ix == -1) {
|
if (ix == -1) {
|
||||||
@@ -43,21 +43,21 @@ public class CeramicTileRecipe implements IRecipe
|
|||||||
iy = y;
|
iy = y;
|
||||||
}
|
}
|
||||||
if (x - ix >= 2 || y - iy >= 2 || y < iy || x < ix) {
|
if (x - ix >= 2 || y - iy >= 2 || y < iy || x < ix) {
|
||||||
return null;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
if (stack.getItem() != ceramicBlock && stack.getItem() != ceramicTile && stack.getItem() != ceramicBrick && stack.getItem() != mortar) {
|
if (stack.getItem() != ceramicBlock && stack.getItem() != ceramicTile && stack.getItem() != ceramicBrick && stack.getItem() != mortar) {
|
||||||
return null;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
stacks.add(stack);
|
stacks.add(stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (final BlockCeramicBrick.TileType type : BlockCeramicBrick.TileType.values()) {
|
for (CeramicBrickType type : CeramicBrickType.VALUES) {
|
||||||
final ItemStack stack2 = type.getRecipe(stacks);
|
ItemStack result = type.getRecipe(stacks);
|
||||||
if (stack2 != null) {
|
if (!result.isEmpty()) {
|
||||||
return stack2;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -69,4 +69,9 @@ public class CeramicTileRecipe implements IRecipe
|
|||||||
public ItemStack getRecipeOutput() {
|
public ItemStack getRecipeOutput() {
|
||||||
return this.cached;
|
return this.cached;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) {
|
||||||
|
return ForgeHooks.defaultRecipeGetRemainingItems(inv);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,24 +1,35 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.ceramic;
|
package binnie.botany.ceramic;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import net.minecraft.item.ItemBlock;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.util.text.translation.I18n;
|
||||||
import binnie.core.block.ItemMetadata;
|
|
||||||
|
|
||||||
public class ItemCeramic extends ItemMetadata
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
{
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
public ItemCeramic(final Block block) {
|
|
||||||
|
import forestry.core.items.IColoredItem;
|
||||||
|
|
||||||
|
import binnie.botany.genetics.EnumFlowerColor;
|
||||||
|
|
||||||
|
public class ItemCeramic extends ItemBlock implements IColoredItem {
|
||||||
|
public ItemCeramic(BlockCeramic block) {
|
||||||
super(block);
|
super(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
public int getMetadata(final int metadata) {
|
||||||
|
return metadata;
|
||||||
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int getColorFromItemStack(final ItemStack stack, final int p_82790_2_) {
|
@Override
|
||||||
return 16711935;
|
public int getColorFromItemstack(ItemStack stack, int tintIndex) {
|
||||||
|
return EnumFlowerColor.get(stack.getMetadata()).getFlowerColorAllele().getColor(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public String getItemStackDisplayName(ItemStack itemStack) {
|
||||||
|
return EnumFlowerColor.get(itemStack.getItemDamage()).getFlowerColorAllele().getColourName() + " " + I18n.translateToLocal("tile.botany.ceramic.name").trim();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package binnie.botany.ceramic;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import forestry.core.items.IColoredItem;
|
||||||
|
|
||||||
|
import binnie.botany.genetics.EnumFlowerColor;
|
||||||
|
import binnie.core.block.ItemMetadata;
|
||||||
|
import binnie.core.block.TileEntityMetadata;
|
||||||
|
|
||||||
|
public class ItemStainedGlass extends ItemMetadata implements IColoredItem {
|
||||||
|
public ItemStainedGlass(Block block) {
|
||||||
|
super(block);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
@Override
|
||||||
|
public int getColorFromItemstack(ItemStack stack, int tintIndex) {
|
||||||
|
return EnumFlowerColor.get(TileEntityMetadata.getItemDamage(stack)).getFlowerColorAllele().getColor(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,52 +1,41 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.ceramic;
|
package binnie.botany.ceramic;
|
||||||
|
|
||||||
import binnie.botany.api.IFlower;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import binnie.botany.Botany;
|
|
||||||
import binnie.Binnie;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraft.inventory.InventoryCrafting;
|
import net.minecraft.inventory.InventoryCrafting;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class PigmentRecipe implements IRecipe
|
import net.minecraftforge.common.ForgeHooks;
|
||||||
{
|
|
||||||
private final ItemStack unknown;
|
|
||||||
ItemStack cached;
|
|
||||||
|
|
||||||
public PigmentRecipe() {
|
import binnie.Binnie;
|
||||||
this.unknown = null;
|
import binnie.botany.Botany;
|
||||||
}
|
import binnie.botany.api.IFlower;
|
||||||
|
|
||||||
|
public class PigmentRecipe implements IRecipe {
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(final InventoryCrafting crafting, final World world) {
|
public boolean matches(final InventoryCrafting crafting, final World world) {
|
||||||
return this.getCraftingResult(crafting) != null;
|
return !this.getCraftingResult(crafting).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getRecipeOutput() {
|
public ItemStack getRecipeOutput() {
|
||||||
if (this.cached != null) {
|
return ItemStack.EMPTY;
|
||||||
return this.cached;
|
|
||||||
}
|
|
||||||
return this.unknown;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getCraftingResult(final InventoryCrafting crafting) {
|
public ItemStack getCraftingResult(final InventoryCrafting crafting) {
|
||||||
int n = 0;
|
int n = 0;
|
||||||
ItemStack stack = null;
|
ItemStack stack = ItemStack.EMPTY;
|
||||||
for (int i = 0; i < crafting.getSizeInventory(); ++i) {
|
for (int i = 0; i < crafting.getSizeInventory(); ++i) {
|
||||||
if (crafting.getStackInSlot(i) != null) {
|
ItemStack stackInSlot = crafting.getStackInSlot(i);
|
||||||
|
if (!stackInSlot.isEmpty()) {
|
||||||
if (++n > 1) {
|
if (++n > 1) {
|
||||||
return null;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
if (Binnie.Genetics.getFlowerRoot().isMember(crafting.getStackInSlot(i))) {
|
if (Binnie.GENETICS.getFlowerRoot().isMember(stackInSlot)) {
|
||||||
final IFlower flower = Binnie.Genetics.getFlowerRoot().getMember(crafting.getStackInSlot(i));
|
final IFlower flower = Binnie.GENETICS.getFlowerRoot().getMember(stackInSlot);
|
||||||
if (flower.getAge() >= 1) {
|
if (flower != null && flower.getAge() >= 1) {
|
||||||
stack = new ItemStack(Botany.pigment, 1, flower.getGenome().getPrimaryColor().getID());
|
stack = new ItemStack(Botany.pigment, 1, flower.getGenome().getPrimaryColor().getID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -59,4 +48,9 @@ public class PigmentRecipe implements IRecipe
|
|||||||
public int getRecipeSize() {
|
public int getRecipeSize() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) {
|
||||||
|
return ForgeHooks.defaultRecipeGetRemainingItems(inv);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package binnie.botany.ceramic;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
|
import binnie.botany.Botany;
|
||||||
|
import binnie.botany.genetics.EnumFlowerColor;
|
||||||
|
|
||||||
|
public class TileCeramic extends TileEntity {
|
||||||
|
protected EnumFlowerColor color = EnumFlowerColor.Black;
|
||||||
|
|
||||||
|
public EnumFlowerColor getColor() {
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColor(EnumFlowerColor color) {
|
||||||
|
this.color = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
|
||||||
|
compound.setInteger("Color", color.getFlowerColorAllele().getID());
|
||||||
|
return super.writeToNBT(compound);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readFromNBT(NBTTagCompound compound) {
|
||||||
|
super.readFromNBT(compound);
|
||||||
|
color = EnumFlowerColor.VALUES[compound.getInteger("Color")];
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack getStack() {
|
||||||
|
return getStack(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack getStack(int amount) {
|
||||||
|
int ID = 0;
|
||||||
|
if (color != null) {
|
||||||
|
ID = color.getFlowerColorAllele().getID();
|
||||||
|
}
|
||||||
|
return new ItemStack(Botany.ceramic, amount, ID);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,254 @@
|
|||||||
|
package binnie.botany.ceramic.brick;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.properties.IProperty;
|
||||||
|
import net.minecraft.block.properties.PropertyEnum;
|
||||||
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||||
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.BlockRenderLayer;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import net.minecraftforge.client.model.ModelLoader;
|
||||||
|
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||||
|
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||||
|
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import forestry.api.core.IItemModelRegister;
|
||||||
|
import forestry.api.core.IModelManager;
|
||||||
|
import forestry.api.core.ISpriteRegister;
|
||||||
|
import forestry.api.core.IStateMapperRegister;
|
||||||
|
import forestry.api.core.ITextureManager;
|
||||||
|
import forestry.core.blocks.IColoredBlock;
|
||||||
|
import forestry.core.blocks.properties.UnlistedBlockAccess;
|
||||||
|
import forestry.core.blocks.properties.UnlistedBlockPos;
|
||||||
|
import forestry.core.models.BlockModelEntry;
|
||||||
|
|
||||||
|
import binnie.Constants;
|
||||||
|
import binnie.botany.CreativeTabBotany;
|
||||||
|
import binnie.botany.ceramic.TileCeramic;
|
||||||
|
import binnie.botany.genetics.EnumFlowerColor;
|
||||||
|
import binnie.core.BinnieCore;
|
||||||
|
import binnie.core.block.IMultipassBlock;
|
||||||
|
import binnie.core.models.DefaultStateMapper;
|
||||||
|
import binnie.core.models.ModelManager;
|
||||||
|
import binnie.core.models.ModelMutlipass;
|
||||||
|
import binnie.core.util.TileUtil;
|
||||||
|
|
||||||
|
public class BlockCeramicBrick extends Block implements IMultipassBlock<CeramicBrickPair>, IColoredBlock, ISpriteRegister, IStateMapperRegister, IItemModelRegister {
|
||||||
|
private static final PropertyEnum<CeramicBrickType> TYPE = PropertyEnum.create("type", CeramicBrickType.class);
|
||||||
|
|
||||||
|
public BlockCeramicBrick() {
|
||||||
|
super(Material.ROCK);
|
||||||
|
this.setHardness(1.0f);
|
||||||
|
this.setResistance(5.0f);
|
||||||
|
this.setRegistryName("ceramicBrick");
|
||||||
|
this.setCreativeTab(CreativeTabBotany.instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, @Nullable EntityPlayer player, boolean willHarvest) {
|
||||||
|
List<ItemStack> drops = new ArrayList<>();
|
||||||
|
TileCeramic ceramic = TileUtil.getTile(world, pos, TileCeramic.class);
|
||||||
|
if (ceramic != null) {
|
||||||
|
drops = Collections.singletonList(ceramic.getStack());
|
||||||
|
}
|
||||||
|
boolean hasBeenBroken = world.setBlockToAir(pos);
|
||||||
|
if (hasBeenBroken && BinnieCore.getBinnieProxy().isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||||
|
for (ItemStack drop : drops) {
|
||||||
|
spawnAsEntity(world, pos, drop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return hasBeenBroken;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TileEntity createTileEntity(World world, IBlockState state) {
|
||||||
|
return new TileCeramicBrick();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasTileEntity(IBlockState state) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
@Override
|
||||||
|
public void getSubBlocks(Item item, final CreativeTabs tab, final NonNullList<ItemStack> itemList) {
|
||||||
|
for (final 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.LargeBrick).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) {
|
||||||
|
return getDefaultState().withProperty(TYPE, CeramicBrickType.get(meta >> 16 & 0xFF));
|
||||||
|
}
|
||||||
|
|
||||||
|
@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) {
|
||||||
|
int damage = stack.getItemDamage();
|
||||||
|
ceramic.setColors(EnumFlowerColor.get(damage & 0xFF), EnumFlowerColor.get(damage >> 8 & 0xFF));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@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 16777215;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
@Override
|
||||||
|
public BlockRenderLayer getBlockLayer() {
|
||||||
|
return BlockRenderLayer.CUTOUT;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int getRenderPasses() {
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public CeramicBrickPair getInventoryKey(ItemStack stack) {
|
||||||
|
return new CeramicBrickPair(stack);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public CeramicBrickPair getWorldKey(IBlockState state) {
|
||||||
|
IExtendedBlockState extendedState = (IExtendedBlockState) state;
|
||||||
|
IBlockAccess world = extendedState.getValue(UnlistedBlockAccess.BLOCKACCESS);
|
||||||
|
BlockPos pos = extendedState.getValue(UnlistedBlockPos.POS);
|
||||||
|
TileCeramicBrick ceramic = TileUtil.getTile(world, pos, TileCeramicBrick.class);
|
||||||
|
if (ceramic != null) {
|
||||||
|
return ceramic.pair();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public TextureAtlasSprite getSprite(CeramicBrickPair type, @Nullable EnumFacing facing, int pass) {
|
||||||
|
return type.getSprite(pass);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void registerSprites(ITextureManager manager) {
|
||||||
|
TextureMap textureMap = Minecraft.getMinecraft().getTextureMapBlocks();
|
||||||
|
for (CeramicBrickType type : CeramicBrickType.VALUES) {
|
||||||
|
type.sprites = new TextureAtlasSprite[3];
|
||||||
|
for (int i = 0; i < 3; ++i) {
|
||||||
|
type.sprites[i] = textureMap.registerSprite(new ResourceLocation(Constants.BOTANY_MOD_ID + ":blocks/ceramic." + type.id + "." + i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class CeramicBrickMeshDefinition implements ItemMeshDefinition {
|
||||||
|
@Override
|
||||||
|
public ModelResourceLocation getModelLocation(ItemStack stack) {
|
||||||
|
return new ModelResourceLocation(Constants.BOTANY_MOD_ID + ":ceramicBrick", "inventory");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
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.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import binnie.botany.Botany;
|
||||||
|
import binnie.botany.genetics.EnumFlowerColor;
|
||||||
|
import binnie.core.block.TileEntityMetadata;
|
||||||
|
|
||||||
|
public class CeramicBrickPair {
|
||||||
|
EnumFlowerColor colorFirst;
|
||||||
|
EnumFlowerColor colorSecond;
|
||||||
|
CeramicBrickType type;
|
||||||
|
int ordinal;
|
||||||
|
|
||||||
|
CeramicBrickPair(final EnumFlowerColor colorFirst, final EnumFlowerColor colorSecond, CeramicBrickType type) {
|
||||||
|
this.colorFirst = colorFirst;
|
||||||
|
this.colorSecond = colorSecond;
|
||||||
|
this.type = type;
|
||||||
|
this.ordinal = colorFirst.ordinal() + colorSecond.ordinal() * 256 + type.ordinal() * 256 * 256;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CeramicBrickPair(ItemStack stack) {
|
||||||
|
this(TileEntityMetadata.getItemDamage(stack));
|
||||||
|
}
|
||||||
|
|
||||||
|
public CeramicBrickPair(int id) {
|
||||||
|
this.colorFirst = EnumFlowerColor.get(id & 0xFF);
|
||||||
|
this.colorSecond = EnumFlowerColor.get(id >> 8 & 0xFF);
|
||||||
|
this.type = CeramicBrickType.get(id >> 16 & 0xFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isTwoColors() {
|
||||||
|
return this.type.canDouble() && this.colorSecond != this.colorFirst;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack getStack(int i) {
|
||||||
|
return new ItemStack(Botany.ceramicBrick, i, this.ordinal());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
String name = this.colorFirst.getFlowerColorAllele().getColourName();
|
||||||
|
if (this.type.canDouble() && this.colorSecond != this.colorFirst) {
|
||||||
|
name = name + " & " + this.colorSecond.getFlowerColorAllele().getColourName();
|
||||||
|
}
|
||||||
|
return name + " " + this.type.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int ordinal() {
|
||||||
|
return ordinal;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public TextureAtlasSprite getSprite(int pass) {
|
||||||
|
TextureAtlasSprite[] sprites = this.type.sprites;
|
||||||
|
Preconditions.checkState(sprites != null, "Sprites have not been registered.");
|
||||||
|
return sprites[pass];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Integer.hashCode(ordinal());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
return obj instanceof CeramicBrickPair
|
||||||
|
&& ((CeramicBrickPair) obj).ordinal() == ordinal();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,327 @@
|
|||||||
|
package binnie.botany.ceramic.brick;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.IStringSerializable;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import binnie.botany.Botany;
|
||||||
|
import binnie.botany.genetics.EnumFlowerColor;
|
||||||
|
import binnie.botany.items.BotanyItems;
|
||||||
|
import binnie.core.block.TileEntityMetadata;
|
||||||
|
|
||||||
|
public enum CeramicBrickType implements IStringSerializable {
|
||||||
|
Tile("tile", "Ceramic 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 (final ItemStack stack : stacks) {
|
||||||
|
if (this.isMortar(stack)) {
|
||||||
|
++mortars;
|
||||||
|
} else {
|
||||||
|
if (stack.getItem() != Item.getItemFromBlock(Botany.ceramic)) {
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
++blocks;
|
||||||
|
final int color = TileEntityMetadata.getItemDamage(stack);
|
||||||
|
if (blockColor == -1) {
|
||||||
|
blockColor = color;
|
||||||
|
} else {
|
||||||
|
if (blockColor != color) {
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mortars != 1) {
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
final EnumFlowerColor c = EnumFlowerColor.get(blockColor);
|
||||||
|
return new CeramicBrickPair(c, c, CeramicBrickType.Tile).getStack(3);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Brick("brick", "Ceramic Bricks") {
|
||||||
|
@Override
|
||||||
|
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||||
|
return getBrickRecipe(this, stacks);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
StripeBrick("brickstripe", "Striped Ceramic Bricks") {
|
||||||
|
@Override
|
||||||
|
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||||
|
return getBrickRecipe(this, stacks);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
LargeBrick("bricklarge", "Large Ceramic Bricks") {
|
||||||
|
@Override
|
||||||
|
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||||
|
if (stacks.size() == 1) {
|
||||||
|
final ItemStack stack3 = stacks.get(0);
|
||||||
|
final CeramicBrickPair type3 = new CeramicBrickPair(stack3);
|
||||||
|
if (type3.type == CeramicBrickType.VerticalLargeBrick) {
|
||||||
|
type3.type = this;
|
||||||
|
return type3.getStack(1);
|
||||||
|
}
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
} else {
|
||||||
|
if (stacks.size() != 3) {
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
final int[] colors = {-1, -1};
|
||||||
|
int a = 0;
|
||||||
|
int b = 0;
|
||||||
|
for (final ItemStack stack4 : stacks) {
|
||||||
|
if (stack4.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
final CeramicBrickPair type4 = new CeramicBrickPair(stack4);
|
||||||
|
if (type4.type != CeramicBrickType.Tile) {
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
final 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.LargeBrick).getStack(3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Split("split", "Split Ceramic Tile") {
|
||||||
|
@Override
|
||||||
|
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||||
|
if (stacks.size() != 4) {
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
final int[] colors = {-1, -1};
|
||||||
|
int altCounter = 0;
|
||||||
|
for (final ItemStack stack2 : stacks) {
|
||||||
|
final int alt = (altCounter != 0 && altCounter != 3) ? 1 : 0;
|
||||||
|
if (stack2.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
final CeramicBrickPair type = new CeramicBrickPair(stack2);
|
||||||
|
if (type.type != CeramicBrickType.Tile) {
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
final 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", "Chequered Ceramic Tile") {
|
||||||
|
@Override
|
||||||
|
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||||
|
if (stacks.size() != 4) {
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
final int[] colors = {-1, -1};
|
||||||
|
for (final ItemStack stack2 : stacks) {
|
||||||
|
if (stack2.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
final CeramicBrickPair type2 = new CeramicBrickPair(stack2);
|
||||||
|
if (type2.type != CeramicBrickType.Split) {
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
final int color3 = type2.colorFirst.ordinal();
|
||||||
|
final 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", "Mixed Ceramic Tile") {
|
||||||
|
@Override
|
||||||
|
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||||
|
if (stacks.size() != 4) {
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
final int[] colors = {-1, -1};
|
||||||
|
for (final ItemStack stack2 : stacks) {
|
||||||
|
if (stack2.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
final CeramicBrickPair type2 = new CeramicBrickPair(stack2);
|
||||||
|
if (type2.isTwoColors()) {
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
final 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final 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);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
VerticalBrick("verticalbrick", "Vertical Ceramic Bricks") {
|
||||||
|
@Override
|
||||||
|
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||||
|
return getVerticalBrickRecipe(stacks);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
VerticalStripeBrick("verticalbrickstripe", "Vertical Striped Ceramic Bricks") {
|
||||||
|
@Override
|
||||||
|
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||||
|
return getVerticalBrickRecipe(stacks);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
VerticalLargeBrick("verticalbricklarge", "Large Vertical Ceramic Bricks") {
|
||||||
|
@Override
|
||||||
|
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||||
|
return getVerticalBrickRecipe(stacks);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public static final CeramicBrickType[] VALUES = values();
|
||||||
|
|
||||||
|
String id;
|
||||||
|
String name;
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
@Nullable
|
||||||
|
TextureAtlasSprite[] sprites;
|
||||||
|
|
||||||
|
CeramicBrickType(final String id, final String name) {
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CeramicBrickType get(final 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;
|
||||||
|
}
|
||||||
|
final ItemStack stack5 = stacks.get(0);
|
||||||
|
final CeramicBrickPair type = new CeramicBrickPair(stack5);
|
||||||
|
if (type.type == CeramicBrickType.LargeBrick) {
|
||||||
|
type.type = CeramicBrickType.VerticalLargeBrick;
|
||||||
|
return type.getStack(1);
|
||||||
|
}
|
||||||
|
if (type.type == CeramicBrickType.Brick) {
|
||||||
|
type.type = CeramicBrickType.VerticalBrick;
|
||||||
|
return type.getStack(1);
|
||||||
|
}
|
||||||
|
if (type.type == CeramicBrickType.StripeBrick) {
|
||||||
|
type.type = CeramicBrickType.VerticalStripeBrick;
|
||||||
|
return type.getStack(1);
|
||||||
|
}
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ItemStack getBrickRecipe(CeramicBrickType ceramicType, List<ItemStack> stacks) {
|
||||||
|
if (stacks.size() == 1) {
|
||||||
|
final ItemStack stack5 = stacks.get(0);
|
||||||
|
final CeramicBrickPair type = new CeramicBrickPair(stack5);
|
||||||
|
if (type.type == CeramicBrickType.VerticalBrick) {
|
||||||
|
type.type = ceramicType;
|
||||||
|
return type.getStack(1);
|
||||||
|
}
|
||||||
|
if (type.type == CeramicBrickType.StripeBrick) {
|
||||||
|
type.type = ceramicType;
|
||||||
|
return type.getStack(1);
|
||||||
|
}
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
} else if (stacks.size() == 4) {
|
||||||
|
final int[] colors = {-1, -1};
|
||||||
|
for (int index2 = 0; index2 < stacks.size(); ++index2) {
|
||||||
|
final ItemStack stack4 = stacks.get(index2);
|
||||||
|
if (stack4.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
final CeramicBrickPair type4 = new CeramicBrickPair(stack4);
|
||||||
|
if (type4.type != CeramicBrickType.LargeBrick) {
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
final int color5 = type4.colorFirst.ordinal();
|
||||||
|
final int color6 = type4.colorSecond.ordinal();
|
||||||
|
int alt2 = (index2 != 0 && index2 != 3) ? 1 : 0;
|
||||||
|
if (ceramicType == CeramicBrickType.StripeBrick) {
|
||||||
|
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);
|
||||||
|
} else {
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isMortar(final ItemStack stack) {
|
||||||
|
return stack.getItem() == Botany.misc && stack.getItemDamage() == BotanyItems.Mortar.ordinal();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return name().toLowerCase(Locale.ENGLISH);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package binnie.botany.ceramic.brick;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemBlock;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import forestry.core.items.IColoredItem;
|
||||||
|
|
||||||
|
public class ItemCeramicBrick extends ItemBlock implements IColoredItem {
|
||||||
|
public ItemCeramicBrick(BlockCeramicBrick block) {
|
||||||
|
super(block);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMetadata(final int metadata) {
|
||||||
|
return metadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
@Override
|
||||||
|
public int getColorFromItemstack(ItemStack stack, int tintIndex) {
|
||||||
|
CeramicBrickPair ceramic = new CeramicBrickPair(stack.getItemDamage());
|
||||||
|
if (tintIndex == 1) {
|
||||||
|
return ceramic.colorFirst.getFlowerColorAllele().getColor(false);
|
||||||
|
} else if (tintIndex == 2) {
|
||||||
|
return ceramic.colorSecond.getFlowerColorAllele().getColor(false);
|
||||||
|
}
|
||||||
|
return 0xffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public String getItemStackDisplayName(ItemStack itemStack) {
|
||||||
|
return new CeramicBrickPair(itemStack.getItemDamage()).getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
package binnie.botany.ceramic.brick;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
|
import binnie.botany.Botany;
|
||||||
|
import binnie.botany.genetics.EnumFlowerColor;
|
||||||
|
import binnie.core.block.TileEntityMetadata;
|
||||||
|
|
||||||
|
public class TileCeramicBrick extends TileEntity {
|
||||||
|
private EnumFlowerColor colorFirst = EnumFlowerColor.Black;
|
||||||
|
private EnumFlowerColor colorSecond = EnumFlowerColor.White;
|
||||||
|
|
||||||
|
public void setColors(EnumFlowerColor colorFirst, EnumFlowerColor colorSecond) {
|
||||||
|
this.colorFirst = colorFirst;
|
||||||
|
this.colorSecond = colorSecond;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasTwoColors() {
|
||||||
|
return CeramicBrickType.VALUES[getBlockMetadata()].canDouble() && this.colorSecond != this.colorFirst;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack getStack(final int i) {
|
||||||
|
final ItemStack s = TileEntityMetadata.getItemStack(Botany.ceramicBrick, this.ordinal());
|
||||||
|
s.setCount(i);
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
CeramicBrickType type = CeramicBrickType.VALUES[getBlockMetadata()];
|
||||||
|
String name = this.colorFirst.getFlowerColorAllele().getColourName();
|
||||||
|
if (type.canDouble() && this.colorSecond != this.colorFirst) {
|
||||||
|
name = name + " & " + this.colorSecond.getFlowerColorAllele().getColourName();
|
||||||
|
}
|
||||||
|
return name + " " + type.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int ordinal() {
|
||||||
|
return this.colorFirst.ordinal() + this.colorSecond.ordinal() * 256 + getBlockMetadata() * 256 * 256;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CeramicBrickPair pair() {
|
||||||
|
return new CeramicBrickPair(colorFirst, colorSecond, CeramicBrickType.VALUES[getBlockMetadata()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnumFlowerColor getColorFirst() {
|
||||||
|
return colorFirst;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnumFlowerColor getColorSecond() {
|
||||||
|
return colorSecond;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
|
||||||
|
compound.setInteger("First", colorFirst.ordinal());
|
||||||
|
compound.setInteger("Second", colorSecond.ordinal());
|
||||||
|
return super.writeToNBT(compound);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NBTTagCompound getUpdateTag() {
|
||||||
|
return writeToNBT(new NBTTagCompound());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readFromNBT(NBTTagCompound compound) {
|
||||||
|
super.readFromNBT(compound);
|
||||||
|
if (compound.hasKey("First")) {
|
||||||
|
colorFirst = EnumFlowerColor.VALUES[compound.getInteger("First")];
|
||||||
|
}
|
||||||
|
if (compound.hasKey("Second")) {
|
||||||
|
colorSecond = EnumFlowerColor.VALUES[compound.getInteger("Second")];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
@ParametersAreNonnullByDefault
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@FieldsAreNonnullByDefault
|
||||||
|
package binnie.botany.ceramic.brick;
|
||||||
|
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
|
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||||
|
import mcp.MethodsReturnNonnullByDefault;
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
@ParametersAreNonnullByDefault
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@FieldsAreNonnullByDefault
|
||||||
|
package binnie.botany.ceramic;
|
||||||
|
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
|
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||||
|
import mcp.MethodsReturnNonnullByDefault;
|
||||||
@@ -1,22 +1,25 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.core;
|
package binnie.botany.core;
|
||||||
|
|
||||||
import binnie.botany.genetics.FlowerHelper;
|
import binnie.botany.api.FlowerManager;
|
||||||
import binnie.botany.api.IFlowerRoot;
|
import binnie.botany.api.IFlowerRoot;
|
||||||
|
import binnie.botany.api.IGardeningManager;
|
||||||
|
import binnie.botany.gardening.Gardening;
|
||||||
|
import binnie.botany.genetics.FlowerRoot;
|
||||||
|
|
||||||
public class BotanyCore
|
public class BotanyCore {
|
||||||
{
|
|
||||||
public static final int CHANCE_INTERPOLLINATION = 20;
|
public static final int CHANCE_INTERPOLLINATION = 20;
|
||||||
public static IFlowerRoot speciesRoot;
|
|
||||||
|
|
||||||
public static IFlowerRoot getFlowerRoot() {
|
public static IFlowerRoot getFlowerRoot() {
|
||||||
return BotanyCore.speciesRoot;
|
if (FlowerManager.flowerRoot == null) {
|
||||||
|
FlowerManager.flowerRoot = new FlowerRoot();
|
||||||
|
}
|
||||||
|
return FlowerManager.flowerRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
public static IGardeningManager getGardening(){
|
||||||
BotanyCore.speciesRoot = new FlowerHelper();
|
if (FlowerManager.gardening == null) {
|
||||||
|
FlowerManager.gardening = new Gardening();
|
||||||
|
}
|
||||||
|
return FlowerManager.gardening;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,37 +1,35 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.core;
|
package binnie.botany.core;
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import binnie.craftgui.botany.WindowBotanistDatabase;
|
|
||||||
import net.minecraft.inventory.IInventory;
|
|
||||||
import binnie.craftgui.minecraft.Window;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
|
||||||
|
import binnie.botany.craftgui.WindowBotanistDatabase;
|
||||||
|
import binnie.core.craftgui.minecraft.Window;
|
||||||
import binnie.core.gui.IBinnieGUID;
|
import binnie.core.gui.IBinnieGUID;
|
||||||
|
|
||||||
public enum BotanyGUI implements IBinnieGUID
|
public enum BotanyGUI implements IBinnieGUID {
|
||||||
{
|
|
||||||
Database,
|
Database,
|
||||||
DatabaseNEI;
|
DatabaseNEI;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Window getWindow(final EntityPlayer player, final World world, final int x, final int y, final int z, final Side side) {
|
public Window getWindow(final EntityPlayer player, final World world, final int x, final int y, final int z, final Side side) {
|
||||||
Window window = null;
|
Window window = null;
|
||||||
final TileEntity tileEntity = world.getTileEntity(x, y, z);
|
final TileEntity tileEntity = world.getTileEntity(new BlockPos(x, y, z));
|
||||||
IInventory object = null;
|
IInventory object = null;
|
||||||
if (tileEntity instanceof IInventory) {
|
if (tileEntity instanceof IInventory) {
|
||||||
object = (IInventory) tileEntity;
|
object = (IInventory) tileEntity;
|
||||||
}
|
}
|
||||||
switch (this) {
|
switch (this) {
|
||||||
case Database:
|
case Database:
|
||||||
case DatabaseNEI: {
|
case DatabaseNEI: {
|
||||||
window = WindowBotanistDatabase.create(player, side, this != BotanyGUI.Database);
|
window = WindowBotanistDatabase.create(player, side, this != BotanyGUI.Database);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,28 +1,36 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.core;
|
package binnie.botany.core;
|
||||||
|
|
||||||
import binnie.extrabees.ExtraBees;
|
import javax.annotation.Nullable;
|
||||||
import binnie.Binnie;
|
|
||||||
import binnie.core.resource.BinnieResource;
|
|
||||||
import binnie.core.resource.ResourceType;
|
|
||||||
import binnie.core.resource.IBinnieTexture;
|
|
||||||
|
|
||||||
public enum BotanyTexture implements IBinnieTexture
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
{
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import binnie.Binnie;
|
||||||
|
import binnie.botany.Botany;
|
||||||
|
import binnie.core.resource.BinnieResource;
|
||||||
|
import binnie.core.resource.IBinnieTexture;
|
||||||
|
import binnie.core.resource.ResourceType;
|
||||||
|
|
||||||
|
public enum BotanyTexture implements IBinnieTexture {
|
||||||
;
|
;
|
||||||
String texture;
|
String texture;
|
||||||
ResourceType type;
|
ResourceType type;
|
||||||
|
|
||||||
private BotanyTexture(final ResourceType base, final String texture) {
|
@SideOnly(Side.CLIENT)
|
||||||
|
@Nullable
|
||||||
|
private BinnieResource resource;
|
||||||
|
|
||||||
|
BotanyTexture(final ResourceType base, final String texture) {
|
||||||
this.texture = texture;
|
this.texture = texture;
|
||||||
this.type = base;
|
this.type = base;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
public BinnieResource getTexture() {
|
public BinnieResource getTexture() {
|
||||||
return Binnie.Resource.getPNG(ExtraBees.instance, this.type, this.texture);
|
if (resource == null) {
|
||||||
|
resource = Binnie.RESOURCE.getPNG(Botany.instance, this.type, this.texture);
|
||||||
|
}
|
||||||
|
return resource;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,29 +1,10 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.core;
|
package binnie.botany.core;
|
||||||
|
|
||||||
import binnie.botany.api.EnumSoilType;
|
|
||||||
import binnie.botany.api.EnumMoisture;
|
|
||||||
import binnie.botany.Botany;
|
|
||||||
import binnie.Binnie;
|
|
||||||
import binnie.botany.api.EnumAcidity;
|
|
||||||
import binnie.core.IInitializable;
|
import binnie.core.IInitializable;
|
||||||
|
|
||||||
public class ModuleCore implements IInitializable
|
public class ModuleCore implements IInitializable {
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public void preInit() {
|
public void preInit() {
|
||||||
for (final EnumAcidity pH : EnumAcidity.values()) {
|
|
||||||
Binnie.Language.addObjectName(pH, Binnie.Language.unlocalised(Botany.instance, "ph." + pH.getID()));
|
|
||||||
}
|
|
||||||
for (final EnumMoisture pH2 : EnumMoisture.values()) {
|
|
||||||
Binnie.Language.addObjectName(pH2, Binnie.Language.unlocalised(Botany.instance, "moisture." + pH2.getID()));
|
|
||||||
}
|
|
||||||
for (final EnumSoilType pH3 : EnumSoilType.values()) {
|
|
||||||
Binnie.Language.addObjectName(pH3, Binnie.Language.unlocalised(Botany.instance, "soil." + pH3.getID()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -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,46 @@
|
|||||||
|
package binnie.botany.craftgui;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import binnie.botany.api.IFlowerColour;
|
||||||
|
import binnie.core.craftgui.Attribute;
|
||||||
|
import binnie.core.craftgui.ITooltip;
|
||||||
|
import binnie.core.craftgui.IWidget;
|
||||||
|
import binnie.core.craftgui.Tooltip;
|
||||||
|
import binnie.core.craftgui.controls.core.Control;
|
||||||
|
import binnie.core.craftgui.controls.core.IControlValue;
|
||||||
|
import binnie.core.craftgui.renderer.RenderUtil;
|
||||||
|
|
||||||
|
public class ControlColourDisplay extends Control implements IControlValue<IFlowerColour>, ITooltip {
|
||||||
|
private IFlowerColour value;
|
||||||
|
|
||||||
|
public ControlColourDisplay(final IWidget parent, final int x, final int y, final IFlowerColour value) {
|
||||||
|
super(parent, x, y, 16, 16);
|
||||||
|
this.value = value;
|
||||||
|
this.addAttribute(Attribute.MouseOver);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IFlowerColour getValue() {
|
||||||
|
return this.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setValue(final IFlowerColour value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||||
|
RenderUtil.drawSolidRect(this.getArea(), -1);
|
||||||
|
RenderUtil.drawSolidRect(this.getArea().inset(1), -16777216 + this.getValue().getColor(false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getTooltip(final Tooltip tooltip) {
|
||||||
|
super.getTooltip(tooltip);
|
||||||
|
tooltip.add(this.value.getColourName());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package binnie.botany.craftgui;
|
||||||
|
|
||||||
|
import binnie.botany.api.IColourMix;
|
||||||
|
import binnie.core.craftgui.IWidget;
|
||||||
|
import binnie.core.craftgui.controls.listbox.ControlListBox;
|
||||||
|
|
||||||
|
public class ControlColourMixBox extends ControlListBox<IColourMix> {
|
||||||
|
private int index;
|
||||||
|
private Type type;
|
||||||
|
|
||||||
|
public ControlColourMixBox(final IWidget parent, final int x, final int y, final int width, final int height, final Type type) {
|
||||||
|
super(parent, x, y, width, height, 12);
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IWidget createOption(final IColourMix value, final int y) {
|
||||||
|
return new ControlColourMixItem(this.getContent(), value, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
enum Type {
|
||||||
|
Resultant,
|
||||||
|
Further,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package binnie.botany.craftgui;
|
||||||
|
|
||||||
|
import binnie.botany.api.IColourMix;
|
||||||
|
import binnie.core.craftgui.controls.listbox.ControlList;
|
||||||
|
import binnie.core.craftgui.controls.listbox.ControlOption;
|
||||||
|
|
||||||
|
public class ControlColourMixItem extends ControlOption<IColourMix> {
|
||||||
|
private final ControlColourDisplay itemWidget1;
|
||||||
|
private final ControlColourDisplay itemWidget2;
|
||||||
|
private final ControlColourDisplay itemWidget3;
|
||||||
|
private final ControlColourMixSymbol addSymbol;
|
||||||
|
private final ControlColourMixSymbol arrowSymbol;
|
||||||
|
|
||||||
|
public ControlColourMixItem(final ControlList<IColourMix> controlList, final IColourMix option, final int y) {
|
||||||
|
super(controlList, option, y);
|
||||||
|
IColourMix value = this.getValue();
|
||||||
|
this.itemWidget1 = new ControlColourDisplay(this, 4, 4, value.getColourFirst());
|
||||||
|
this.itemWidget2 = new ControlColourDisplay(this, 44, 4, value.getColourSecond());
|
||||||
|
this.itemWidget3 = new ControlColourDisplay(this, 104, 4, value.getResult());
|
||||||
|
this.addSymbol = new ControlColourMixSymbol(this, 24, 4, 0, value);
|
||||||
|
this.arrowSymbol = new ControlColourMixSymbol(this, 64, 4, 1, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package binnie.botany.craftgui;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import binnie.botany.api.IColourMix;
|
||||||
|
import binnie.core.craftgui.Attribute;
|
||||||
|
import binnie.core.craftgui.CraftGUI;
|
||||||
|
import binnie.core.craftgui.ITooltip;
|
||||||
|
import binnie.core.craftgui.IWidget;
|
||||||
|
import binnie.core.craftgui.Tooltip;
|
||||||
|
import binnie.core.craftgui.controls.core.Control;
|
||||||
|
import binnie.core.craftgui.geometry.Point;
|
||||||
|
import binnie.core.craftgui.resource.Texture;
|
||||||
|
import binnie.core.craftgui.resource.minecraft.CraftGUITextureSheet;
|
||||||
|
import binnie.core.craftgui.resource.minecraft.StandardTexture;
|
||||||
|
|
||||||
|
public class ControlColourMixSymbol extends Control implements ITooltip {
|
||||||
|
static Texture MutationPlus = new StandardTexture(2, 94, 16, 16, CraftGUITextureSheet.Controls2);
|
||||||
|
static Texture MutationArrow = new StandardTexture(20, 94, 32, 16, CraftGUITextureSheet.Controls2);
|
||||||
|
IColourMix value;
|
||||||
|
int type;
|
||||||
|
|
||||||
|
protected ControlColourMixSymbol(final IWidget parent, final int x, final int y, final int type, final IColourMix value) {
|
||||||
|
super(parent, x, y, 16 + type * 16, 16);
|
||||||
|
this.value = value;
|
||||||
|
this.type = type;
|
||||||
|
this.addAttribute(Attribute.MouseOver);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||||
|
super.onRenderBackground(guiWidth, guiHeight);
|
||||||
|
if (this.type == 0) {
|
||||||
|
CraftGUI.render.texture(ControlColourMixSymbol.MutationPlus, Point.ZERO);
|
||||||
|
} else {
|
||||||
|
CraftGUI.render.texture(ControlColourMixSymbol.MutationArrow, Point.ZERO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(final IColourMix value) {
|
||||||
|
this.value = value;
|
||||||
|
this.setColour(0xffffff);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getTooltip(final Tooltip tooltip) {
|
||||||
|
if (this.type == 1) {
|
||||||
|
final float chance = this.value.getChance();
|
||||||
|
tooltip.add("Current Chance - " + chance + "%");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package binnie.botany.craftgui;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import binnie.botany.api.IFlowerColour;
|
||||||
|
import binnie.core.craftgui.Attribute;
|
||||||
|
import binnie.core.craftgui.CraftGUI;
|
||||||
|
import binnie.core.craftgui.controls.listbox.ControlList;
|
||||||
|
import binnie.core.craftgui.controls.listbox.ControlTextOption;
|
||||||
|
import binnie.core.craftgui.geometry.CraftGUIUtil;
|
||||||
|
import binnie.core.craftgui.geometry.Point;
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public class ControlColourOption extends ControlTextOption<IFlowerColour> {
|
||||||
|
ControlColourDisplay controlBee;
|
||||||
|
Point boxPosition;
|
||||||
|
|
||||||
|
public ControlColourOption(final ControlList<IFlowerColour> controlList, final IFlowerColour option, final int y) {
|
||||||
|
super(controlList, option, option.getColourName(), y);
|
||||||
|
this.setSize(new Point(this.getSize().x(), 20));
|
||||||
|
this.controlBee = new ControlColourDisplay(this, 2, 2, option);
|
||||||
|
this.addAttribute(Attribute.MouseOver);
|
||||||
|
CraftGUIUtil.moveWidget(this.textWidget, new Point(22, 0));
|
||||||
|
this.textWidget.setSize(this.textWidget.getSize().sub(new Point(24, 0)));
|
||||||
|
final int th = CraftGUI.render.textHeight(this.textWidget.getValue(), this.textWidget.getSize().x());
|
||||||
|
final int height = Math.max(20, th + 6);
|
||||||
|
this.setSize(new Point(this.size().x(), height));
|
||||||
|
this.textWidget.setSize(new Point(this.textWidget.getSize().x(), height));
|
||||||
|
this.boxPosition = new Point(2, (height - 18) / 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
+15
-19
@@ -1,36 +1,32 @@
|
|||||||
//
|
package binnie.botany.craftgui;
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.craftgui.botany;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import binnie.botany.core.BotanyCore;
|
|
||||||
import binnie.botany.api.IColourMix;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import binnie.craftgui.controls.ControlTextCentered;
|
import java.util.List;
|
||||||
import binnie.craftgui.mod.database.DatabaseTab;
|
|
||||||
import binnie.craftgui.core.IWidget;
|
|
||||||
import binnie.craftgui.controls.ControlText;
|
|
||||||
import binnie.botany.api.IFlowerColour;
|
|
||||||
import binnie.craftgui.mod.database.PageAbstract;
|
|
||||||
|
|
||||||
public class PageColourMix extends PageAbstract<IFlowerColour>
|
import binnie.botany.api.IColourMix;
|
||||||
{
|
import binnie.botany.api.IFlowerColour;
|
||||||
|
import binnie.botany.core.BotanyCore;
|
||||||
|
import binnie.core.craftgui.IWidget;
|
||||||
|
import binnie.core.craftgui.controls.ControlText;
|
||||||
|
import binnie.core.craftgui.controls.ControlTextCentered;
|
||||||
|
import binnie.core.craftgui.database.DatabaseTab;
|
||||||
|
import binnie.core.craftgui.database.PageAbstract;
|
||||||
|
|
||||||
|
public class PageColourMix extends PageAbstract<IFlowerColour> {
|
||||||
ControlText pageSpeciesFurther_Title;
|
ControlText pageSpeciesFurther_Title;
|
||||||
ControlColourMixBox pageSpeciesFurther_List;
|
ControlColourMixBox pageSpeciesFurther_List;
|
||||||
|
|
||||||
public PageColourMix(final IWidget parent, final DatabaseTab tab) {
|
public PageColourMix(final IWidget parent, final DatabaseTab tab) {
|
||||||
super(parent, tab);
|
super(parent, tab);
|
||||||
this.pageSpeciesFurther_Title = new ControlTextCentered(this, 8.0f, "Further Mixes");
|
this.pageSpeciesFurther_Title = new ControlTextCentered(this, 8, "Further Mixes");
|
||||||
this.pageSpeciesFurther_List = new ControlColourMixBox(this, 4, 20, 136, 152, ControlColourMixBox.Type.Further);
|
this.pageSpeciesFurther_List = new ControlColourMixBox(this, 4, 20, 136, 152, ControlColourMixBox.Type.Further);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onValueChanged(final IFlowerColour colour) {
|
public void onValueChanged(final IFlowerColour colour) {
|
||||||
final List<IColourMix> mixes = new ArrayList<IColourMix>();
|
final List<IColourMix> mixes = new ArrayList<>();
|
||||||
for (final IColourMix mix : BotanyCore.getFlowerRoot().getColourMixes(false)) {
|
for (final IColourMix mix : BotanyCore.getFlowerRoot().getColourMixes(false)) {
|
||||||
if (mix.getColour1() == colour || mix.getColour2() == colour) {
|
if (mix.getColourFirst() == colour || mix.getColourSecond() == colour) {
|
||||||
mixes.add(mix);
|
mixes.add(mix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+14
-18
@@ -1,34 +1,30 @@
|
|||||||
//
|
package binnie.botany.craftgui;
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.craftgui.botany;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import binnie.botany.core.BotanyCore;
|
|
||||||
import binnie.botany.api.IColourMix;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import binnie.craftgui.controls.ControlTextCentered;
|
import java.util.List;
|
||||||
import binnie.craftgui.mod.database.DatabaseTab;
|
|
||||||
import binnie.craftgui.core.IWidget;
|
|
||||||
import binnie.craftgui.controls.ControlText;
|
|
||||||
import binnie.botany.api.IFlowerColour;
|
|
||||||
import binnie.craftgui.mod.database.PageAbstract;
|
|
||||||
|
|
||||||
public class PageColourMixResultant extends PageAbstract<IFlowerColour>
|
import binnie.botany.api.IColourMix;
|
||||||
{
|
import binnie.botany.api.IFlowerColour;
|
||||||
|
import binnie.botany.core.BotanyCore;
|
||||||
|
import binnie.core.craftgui.IWidget;
|
||||||
|
import binnie.core.craftgui.controls.ControlText;
|
||||||
|
import binnie.core.craftgui.controls.ControlTextCentered;
|
||||||
|
import binnie.core.craftgui.database.DatabaseTab;
|
||||||
|
import binnie.core.craftgui.database.PageAbstract;
|
||||||
|
|
||||||
|
public class PageColourMixResultant extends PageAbstract<IFlowerColour> {
|
||||||
ControlText pageSpeciesFurther_Title;
|
ControlText pageSpeciesFurther_Title;
|
||||||
ControlColourMixBox pageSpeciesFurther_List;
|
ControlColourMixBox pageSpeciesFurther_List;
|
||||||
|
|
||||||
public PageColourMixResultant(final IWidget parent, final DatabaseTab tab) {
|
public PageColourMixResultant(final IWidget parent, final DatabaseTab tab) {
|
||||||
super(parent, tab);
|
super(parent, tab);
|
||||||
this.pageSpeciesFurther_Title = new ControlTextCentered(this, 8.0f, "Resultant Mixes");
|
this.pageSpeciesFurther_Title = new ControlTextCentered(this, 8, "Resultant Mixes");
|
||||||
this.pageSpeciesFurther_List = new ControlColourMixBox(this, 4, 20, 136, 152, ControlColourMixBox.Type.Resultant);
|
this.pageSpeciesFurther_List = new ControlColourMixBox(this, 4, 20, 136, 152, ControlColourMixBox.Type.Resultant);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onValueChanged(final IFlowerColour colour) {
|
public void onValueChanged(final IFlowerColour colour) {
|
||||||
final List<IColourMix> mixes = new ArrayList<IColourMix>();
|
final List<IColourMix> mixes = new ArrayList<>();
|
||||||
for (final IColourMix mix : BotanyCore.getFlowerRoot().getColourMixes(false)) {
|
for (final IColourMix mix : BotanyCore.getFlowerRoot().getColourMixes(false)) {
|
||||||
if (mix.getResult() == colour) {
|
if (mix.getResult() == colour) {
|
||||||
mixes.add(mix);
|
mixes.add(mix);
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
package binnie.botany.craftgui;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
import forestry.api.genetics.IAllele;
|
||||||
|
import forestry.api.genetics.IAlleleSpecies;
|
||||||
|
import forestry.api.genetics.IIndividual;
|
||||||
|
|
||||||
|
import binnie.Binnie;
|
||||||
|
import binnie.botany.api.EnumFlowerChromosome;
|
||||||
|
import binnie.botany.api.EnumFlowerStage;
|
||||||
|
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||||
|
import binnie.botany.api.IFlower;
|
||||||
|
import binnie.botany.api.IFlowerGenome;
|
||||||
|
import binnie.botany.core.BotanyCore;
|
||||||
|
import binnie.core.craftgui.IWidget;
|
||||||
|
import binnie.core.craftgui.controls.ControlText;
|
||||||
|
import binnie.core.craftgui.controls.core.Control;
|
||||||
|
import binnie.core.craftgui.controls.scroll.ControlScrollableContent;
|
||||||
|
import binnie.core.craftgui.database.DatabaseTab;
|
||||||
|
import binnie.core.craftgui.database.PageSpecies;
|
||||||
|
import binnie.core.craftgui.geometry.Area;
|
||||||
|
import binnie.core.craftgui.geometry.Point;
|
||||||
|
import binnie.core.craftgui.geometry.TextJustification;
|
||||||
|
import binnie.core.craftgui.minecraft.control.ControlItemDisplay;
|
||||||
|
|
||||||
|
public class PageSpeciesFlowerGenome extends PageSpecies {
|
||||||
|
public PageSpeciesFlowerGenome(final IWidget parent, final DatabaseTab tab) {
|
||||||
|
super(parent, tab);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String tolerated(final boolean t) {
|
||||||
|
if (t) {
|
||||||
|
return "Tolerated";
|
||||||
|
}
|
||||||
|
return "Not Tolerated";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onValueChanged(final IAlleleSpecies species) {
|
||||||
|
this.deleteAllChildren();
|
||||||
|
final IAllele[] template = Binnie.GENETICS.getFlowerRoot().getTemplate(species.getUID());
|
||||||
|
if (template == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final IFlower tree = Binnie.GENETICS.getFlowerRoot().templateAsIndividual(template);
|
||||||
|
if (tree == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final IFlowerGenome genome = tree.getGenome();
|
||||||
|
final IAlleleFlowerSpecies treeSpecies = genome.getPrimary();
|
||||||
|
final int w = 144;
|
||||||
|
final int h = 176;
|
||||||
|
new ControlText(this, new Area(0, 4, w, 16), "Genome", TextJustification.MiddleCenter);
|
||||||
|
final ControlScrollableContent scrollable = new ControlScrollableContent(this, 4, 20, w - 8, h - 8 - 16, 12);
|
||||||
|
final Control contents = new Control(scrollable, 0, 0, w - 8 - 12, h - 8 - 16);
|
||||||
|
final int tw = w - 8 - 12;
|
||||||
|
final int w2 = 55;
|
||||||
|
final int w3 = tw - 50;
|
||||||
|
int y = 0;
|
||||||
|
final int th = 14;
|
||||||
|
final int th2 = 18;
|
||||||
|
new ControlText(contents, new Area(0, y, w2, th), "Temp. : ", TextJustification.MiddleRight);
|
||||||
|
new ControlText(contents, new Area(w2, y, w3, th), treeSpecies.getTemperature().getName(), TextJustification.MIDDLE_LEFTt);
|
||||||
|
y += th;
|
||||||
|
new ControlText(contents, new Area(0, y, w2, th), "Moist. : ", TextJustification.MiddleRight);
|
||||||
|
new ControlText(contents, new Area(w2, y, w3, th), treeSpecies.getMoisture().getLocalisedName(false), TextJustification.MIDDLE_LEFTt);
|
||||||
|
y += th;
|
||||||
|
new ControlText(contents, new Area(0, y, w2, th), "pH. : ", TextJustification.MiddleRight);
|
||||||
|
new ControlText(contents, new Area(w2, y, w3, th), treeSpecies.getPH().getLocalisedName(false), TextJustification.MIDDLE_LEFTt);
|
||||||
|
y += th;
|
||||||
|
new ControlText(contents, new Area(0, y, w2, th), "Fertility : ", TextJustification.MiddleRight);
|
||||||
|
new ControlText(contents, new Area(w2, y, w3, th), genome.getFertility() + "x", TextJustification.MIDDLE_LEFTt);
|
||||||
|
y += th;
|
||||||
|
final float lifespan = genome.getLifespan() * 68.27f / genome.getAgeChance() / 24000.0f;
|
||||||
|
new ControlText(contents, new Area(0, y, w2, th), "Lifespan : ", TextJustification.MiddleRight);
|
||||||
|
new ControlText(contents, new Area(w2, y, w3, th), "" + String.format("%.2f", lifespan) + " days", TextJustification.MIDDLE_LEFTt);
|
||||||
|
y += th;
|
||||||
|
new ControlText(contents, new Area(0, y, w2, th), "Nectar : ", TextJustification.MiddleRight);
|
||||||
|
new ControlText(contents, new Area(w2, y, w3, th), genome.getActiveAllele(EnumFlowerChromosome.SAPPINESS).getName(), TextJustification.MIDDLE_LEFTt);
|
||||||
|
y += th;
|
||||||
|
int x = w2;
|
||||||
|
int tot = 0;
|
||||||
|
for (final IIndividual vid : BotanyCore.getFlowerRoot().getIndividualTemplates()) {
|
||||||
|
if (vid.getGenome().getPrimary() == treeSpecies) {
|
||||||
|
if (tot > 0 && tot % 3 == 0) {
|
||||||
|
x -= 54;
|
||||||
|
y += 18;
|
||||||
|
}
|
||||||
|
final ItemStack stack = BotanyCore.getFlowerRoot().getMemberStack(vid, EnumFlowerStage.FLOWER);
|
||||||
|
final ControlItemDisplay display = new ControlItemDisplay(contents, x, y);
|
||||||
|
display.setItemStack(stack);
|
||||||
|
++tot;
|
||||||
|
x += 18;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final int numOfLines = 1 + (tot - 1) / 3;
|
||||||
|
new ControlText(contents, new Area(0, y - (numOfLines - 1) * 18, w2, 4 + 18 * numOfLines), "Varieties : ", TextJustification.MiddleRight);
|
||||||
|
y += th;
|
||||||
|
contents.setSize(new Point(contents.size().x(), y));
|
||||||
|
scrollable.setScrollableContent(contents);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
package binnie.botany.craftgui;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import binnie.Binnie;
|
||||||
|
import binnie.botany.Botany;
|
||||||
|
import binnie.botany.api.IFlowerColour;
|
||||||
|
import binnie.botany.genetics.EnumFlowerColor;
|
||||||
|
import binnie.core.AbstractMod;
|
||||||
|
import binnie.core.craftgui.IWidget;
|
||||||
|
import binnie.core.craftgui.controls.listbox.ControlListBox;
|
||||||
|
import binnie.core.craftgui.database.DatabaseTab;
|
||||||
|
import binnie.core.craftgui.database.IDatabaseMode;
|
||||||
|
import binnie.core.craftgui.database.PageBranchOverview;
|
||||||
|
import binnie.core.craftgui.database.PageBranchSpecies;
|
||||||
|
import binnie.core.craftgui.database.PageBreeder;
|
||||||
|
import binnie.core.craftgui.database.PageSpeciesClassification;
|
||||||
|
import binnie.core.craftgui.database.PageSpeciesMutations;
|
||||||
|
import binnie.core.craftgui.database.PageSpeciesOverview;
|
||||||
|
import binnie.core.craftgui.database.PageSpeciesResultant;
|
||||||
|
import binnie.core.craftgui.database.WindowAbstractDatabase;
|
||||||
|
import binnie.core.craftgui.geometry.Area;
|
||||||
|
import binnie.core.craftgui.minecraft.Window;
|
||||||
|
import binnie.core.util.I18N;
|
||||||
|
|
||||||
|
public class WindowBotanistDatabase extends WindowAbstractDatabase {
|
||||||
|
ControlListBox<EnumFlowerColor> selectionBoxColors;
|
||||||
|
|
||||||
|
public WindowBotanistDatabase(final EntityPlayer player, final Side side, final boolean nei) {
|
||||||
|
super(player, side, nei, Binnie.GENETICS.flowerBreedingSystem, 130);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Window create(final EntityPlayer player, final Side side, final boolean nei) {
|
||||||
|
return new WindowBotanistDatabase(player, side, nei);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
protected void addTabs() {
|
||||||
|
new PageSpeciesOverview(this.getInfoPages(Mode.SPECIES), new DatabaseTab(Botany.instance, "species.overview", 0));
|
||||||
|
new PageSpeciesFlowerGenome(this.getInfoPages(Mode.SPECIES), new DatabaseTab(Botany.instance, "species.genome", 0));
|
||||||
|
new PageSpeciesClassification(this.getInfoPages(Mode.SPECIES), new DatabaseTab(Botany.instance, "species.classification", 0));
|
||||||
|
new PageSpeciesResultant(this.getInfoPages(Mode.SPECIES), new DatabaseTab(Botany.instance, "species.resultant", 0));
|
||||||
|
new PageSpeciesMutations(this.getInfoPages(Mode.SPECIES), new DatabaseTab(Botany.instance, "species.further", 0));
|
||||||
|
new PageBranchOverview(this.getInfoPages(Mode.BRANCHES), new DatabaseTab(Botany.instance, "branches.overview", 0));
|
||||||
|
new PageBranchSpecies(this.getInfoPages(Mode.BRANCHES), new DatabaseTab(Botany.instance, "branches.species", 0));
|
||||||
|
this.createMode(FlowerMode.Colour, new FlowerColourModeWidgets());
|
||||||
|
new PageColourMixResultant(this.getInfoPages(FlowerMode.Colour), new DatabaseTab(Botany.instance, "colour.resultant", 0));
|
||||||
|
new PageColourMix(this.getInfoPages(FlowerMode.Colour), new DatabaseTab(Botany.instance, "colour.further", 0));
|
||||||
|
new PageBreeder(this.getInfoPages(Mode.BREEDER), this.getUsername(), new DatabaseTab(Botany.instance, "breeder", 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected AbstractMod getMod() {
|
||||||
|
return Botany.instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getBackgroundTextureName() {
|
||||||
|
return "FlowerDatabase";
|
||||||
|
}
|
||||||
|
|
||||||
|
enum FlowerMode implements IDatabaseMode {
|
||||||
|
Colour;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return I18N.localise("botany.gui.database.mode." + this.name().toLowerCase());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
private class FlowerColourModeWidgets extends ModeWidgets {
|
||||||
|
public FlowerColourModeWidgets() {
|
||||||
|
super(FlowerMode.Colour, WindowBotanistDatabase.this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createListBox(final Area area) {
|
||||||
|
this.listBox = new ControlListBox<IFlowerColour>(this.modePage, area.xPos(), area.yPos(), area.width(), area.height(), 12) {
|
||||||
|
@Override
|
||||||
|
public IWidget createOption(final IFlowerColour value, final int y) {
|
||||||
|
return new ControlColourOption(this.getContent(), value, y);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
final List<IFlowerColour> colors = Arrays.stream(EnumFlowerColor.values()).map( c -> c.getFlowerColorAllele()).collect(Collectors.toList());
|
||||||
|
this.listBox.setOptions(colors);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
@ParametersAreNonnullByDefault
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@FieldsAreNonnullByDefault
|
||||||
|
package binnie.botany.craftgui;
|
||||||
|
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
|
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||||
|
import mcp.MethodsReturnNonnullByDefault;
|
||||||
@@ -1,67 +1,75 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.farm;
|
package binnie.botany.farm;
|
||||||
|
|
||||||
|
import com.google.common.base.Preconditions;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
|
||||||
import forestry.api.circuits.ChipsetManager;
|
import forestry.api.circuits.ChipsetManager;
|
||||||
|
import forestry.api.circuits.ICircuitLayout;
|
||||||
import forestry.api.farming.FarmDirection;
|
import forestry.api.farming.FarmDirection;
|
||||||
import forestry.api.farming.IFarmHousing;
|
import forestry.api.farming.IFarmHousing;
|
||||||
import forestry.api.farming.IFarmLogic;
|
|
||||||
import binnie.Binnie;
|
|
||||||
import binnie.botany.api.EnumAcidity;
|
import binnie.botany.api.EnumAcidity;
|
||||||
import binnie.botany.api.EnumMoisture;
|
import binnie.botany.api.EnumMoisture;
|
||||||
import binnie.core.circuits.BinnieCircuit;
|
import binnie.core.circuits.BinnieCircuit;
|
||||||
|
import binnie.core.util.I18N;
|
||||||
|
|
||||||
public class CircuitGarden extends BinnieCircuit
|
public class CircuitGarden extends BinnieCircuit {
|
||||||
{
|
|
||||||
private Class<? extends FarmLogic> logicClass;
|
|
||||||
private boolean isManual;
|
private boolean isManual;
|
||||||
private boolean isFertilised;
|
private GardenLogic logic;
|
||||||
private ItemStack icon;
|
|
||||||
private EnumMoisture moisture;
|
|
||||||
private EnumAcidity acidity;
|
|
||||||
|
|
||||||
public CircuitGarden(final EnumMoisture moisture, final EnumAcidity ph, final boolean manual, final boolean fertilised, final ItemStack recipe, final ItemStack icon) {
|
public CircuitGarden(EnumMoisture moisture, @Nullable EnumAcidity ph, boolean manual, boolean fertilised, ItemStack recipe, ItemStack icon) {
|
||||||
super("garden." + moisture.getID() + ((ph != null) ? ("." + ph.getID()) : "") + (manual ? ".manual" : "") + (fertilised ? ".fert" : ""), 4, manual ? ChipsetManager.circuitRegistry.getLayout("forestry.farms.manual") : ChipsetManager.circuitRegistry.getLayout("forestry.farms.managed"), recipe);
|
super(getName(moisture, ph, manual, fertilised), 4, getLayout(manual), recipe);
|
||||||
this.isManual = false;
|
|
||||||
this.isFertilised = false;
|
|
||||||
this.isManual = manual;
|
this.isManual = manual;
|
||||||
this.isFertilised = fertilised;
|
this.logic = new GardenLogic(moisture, ph, this.isManual, fertilised, icon, I18N.localise(this.getUnlocalizedName()));
|
||||||
this.moisture = moisture;
|
StringBuilder info = new StringBuilder("Flowers (")
|
||||||
this.acidity = ph;
|
.append(TextFormatting.GRAY.toString())
|
||||||
this.icon = icon;
|
.append(I18N.localise("botany.moisture"))
|
||||||
String info = "";
|
.append(": ")
|
||||||
if (moisture == EnumMoisture.Dry) {
|
.append(moisture.getLocalisedName(true));
|
||||||
info += "§eDry§f";
|
|
||||||
|
if (ph != null) {
|
||||||
|
info.append(TextFormatting.GRAY.toString())
|
||||||
|
.append(", ")
|
||||||
|
.append(I18N.localise("botany.ph"))
|
||||||
|
.append(": ")
|
||||||
|
.append(ph.getLocalisedName(true));
|
||||||
}
|
}
|
||||||
if (moisture == EnumMoisture.Damp) {
|
String fertilizedKey = fertilised ? "for.binnie.circuit.garden.fertilized" : "for.binnie.circuit.garden.unfertilized";
|
||||||
info += "§9Damp§f";
|
info.append(TextFormatting.RESET.toString())
|
||||||
|
.append(" ")
|
||||||
|
.append(I18N.localise(fertilizedKey))
|
||||||
|
.append(")");
|
||||||
|
this.addTooltipString(info.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ICircuitLayout getLayout(boolean manual) {
|
||||||
|
String layoutUid = manual ? "forestry.farms.manual" : "forestry.farms.managed";
|
||||||
|
ICircuitLayout layout = ChipsetManager.circuitRegistry.getLayout(layoutUid);
|
||||||
|
Preconditions.checkState(layout != null, "Couldn't find Forestry circuit layout %s.", layoutUid);
|
||||||
|
return layout;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getName(EnumMoisture moisture, @Nullable EnumAcidity ph, boolean manual, boolean fertilised) {
|
||||||
|
String name = "garden." + moisture.getName();
|
||||||
|
if (ph != null) {
|
||||||
|
name += "." + ph.getName();
|
||||||
}
|
}
|
||||||
if (this.acidity == EnumAcidity.Acid) {
|
if (manual) {
|
||||||
if (info.length() > 0) {
|
name += ".manual";
|
||||||
info += ", ";
|
|
||||||
}
|
|
||||||
info += "§cAcidic§f";
|
|
||||||
}
|
}
|
||||||
if (this.acidity == EnumAcidity.Neutral) {
|
if (fertilised) {
|
||||||
if (info.length() > 0) {
|
name += ".fert";
|
||||||
info += ", ";
|
|
||||||
}
|
|
||||||
info += "§aNeutral§f";
|
|
||||||
}
|
}
|
||||||
if (this.acidity == EnumAcidity.Alkaline) {
|
return name;
|
||||||
if (info.length() > 0) {
|
}
|
||||||
info += ", ";
|
|
||||||
}
|
public CircuitGarden setManual() {
|
||||||
info += "§bAlkaline§f";
|
isManual = true;
|
||||||
}
|
return this;
|
||||||
if (info.length() > 0) {
|
|
||||||
info = " (" + info + "§f)";
|
|
||||||
}
|
|
||||||
this.addTooltipString("Flowers" + info);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -69,31 +77,42 @@ public class CircuitGarden extends BinnieCircuit
|
|||||||
return tile instanceof IFarmHousing;
|
return tile instanceof IFarmHousing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
private IFarmHousing getCircuitable(Object tile) {
|
||||||
|
if (!isCircuitable(tile)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return (IFarmHousing) tile;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInsertion(int slot, Object tile) {
|
public void onInsertion(int slot, Object tile) {
|
||||||
if (!this.isCircuitable(tile)) {
|
IFarmHousing housing = getCircuitable(tile);
|
||||||
|
if (housing == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final GardenLogic logic = new GardenLogic((IFarmHousing) tile);
|
|
||||||
logic.setData(this.moisture, this.acidity, this.isManual, this.isFertilised, this.icon, Binnie.Language.localise(this.getName()));
|
logic.setManual(isManual);
|
||||||
((IFarmHousing) tile).setFarmLogic(FarmDirection.values()[slot], logic);
|
|
||||||
|
housing.setFarmLogic(FarmDirection.values()[slot], logic);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoad(int slot, Object tile) {
|
public void onLoad(int slot, Object tile) {
|
||||||
this.onInsertion(slot, tile);
|
onInsertion(slot, tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRemoval(int slot, Object tile) {
|
public void onRemoval(int slot, Object tile) {
|
||||||
if (!this.isCircuitable(tile)) {
|
IFarmHousing farmHousing = getCircuitable(tile);
|
||||||
|
if (farmHousing == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
((IFarmHousing) tile).resetFarmLogic(FarmDirection.values()[slot]);
|
|
||||||
|
farmHousing.resetFarmLogic(FarmDirection.values()[slot]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTick(int arg0, Object arg1) {
|
public void onTick(int slot, Object tile) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,61 +1,49 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.farm;
|
package binnie.botany.farm;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import forestry.api.farming.FarmDirection;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import forestry.api.farming.IFarmHousing;
|
|
||||||
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import forestry.api.farming.IFarmLogic;
|
import forestry.api.farming.IFarmLogic;
|
||||||
|
|
||||||
public abstract class FarmLogic implements IFarmLogic
|
public abstract class FarmLogic implements IFarmLogic {
|
||||||
{
|
|
||||||
World world;
|
|
||||||
IFarmHousing housing;
|
|
||||||
boolean isManual;
|
boolean isManual;
|
||||||
|
|
||||||
public FarmLogic(final IFarmHousing housing) {
|
|
||||||
this.housing = housing;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFarmLogic setManual(final boolean flag) {
|
public IFarmLogic setManual(final boolean flag) {
|
||||||
this.isManual = flag;
|
this.isManual = flag;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final boolean isAirBlock(final Vect position) {
|
protected final boolean isAirBlock(World world, BlockPos pos) {
|
||||||
return this.world.isAirBlock(position.x, position.y, position.z);
|
return world.isAirBlock(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final boolean isWaterBlock(final Vect position) {
|
protected final IBlockState getBlockState(World world, BlockPos pos) {
|
||||||
return this.world.getBlock(position.x, position.y, position.z) == Blocks.water;
|
return world.getBlockState(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final Block getBlock(final Vect position) {
|
protected final Block getBlock(World world, BlockPos pos) {
|
||||||
return this.world.getBlock(position.x, position.y, position.z);
|
return getBlockState(world, pos).getBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final int getBlockMeta(final Vect position) {
|
protected final int getBlockMeta(World world, BlockPos pos) {
|
||||||
return this.world.getBlockMetadata(position.x, position.y, position.z);
|
IBlockState blockState = world.getBlockState(pos);
|
||||||
|
return blockState.getBlock().getMetaFromState(blockState);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final ItemStack getAsItemStack(final Vect position) {
|
protected final ItemStack getAsItemStack(World world, BlockPos position) {
|
||||||
return new ItemStack(this.getBlock(position), 1, this.getBlockMeta(position));
|
return new ItemStack(getBlock(world, position), 1, getBlockMeta(world, position));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final Vect translateWithOffset(final int x, final int y, final int z, final FarmDirection direction, final int step) {
|
protected final boolean isWaterBlock(World world, BlockPos pos) {
|
||||||
return new Vect(x + direction.getForgeDirection().offsetX * step, y + direction.getForgeDirection().offsetY * step, z + direction.getForgeDirection().offsetZ * step);
|
return getBlock(world, pos) == Blocks.WATER;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final void setBlock(final Vect position, final Block block, final int meta) {
|
protected final void setBlock(World world, BlockPos pos, final Block block, final int meta) {
|
||||||
this.world.setBlock(position.x, position.y, position.z, block, meta, 2);
|
world.setBlockState(pos, block.getStateFromMeta(meta), 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,35 +1,54 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.farm;
|
package binnie.botany.farm;
|
||||||
|
|
||||||
import binnie.botany.api.IFlower;
|
import javax.annotation.Nullable;
|
||||||
import binnie.botany.gardening.Gardening;
|
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import binnie.botany.api.EnumFlowerStage;
|
import net.minecraft.init.Blocks;
|
||||||
import binnie.botany.core.BotanyCore;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import forestry.api.farming.ICrop;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import binnie.botany.Botany;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import forestry.api.farming.ICrop;
|
||||||
import forestry.api.farming.IFarmable;
|
import forestry.api.farming.IFarmable;
|
||||||
|
|
||||||
public class FarmableFlower implements IFarmable
|
import binnie.botany.Botany;
|
||||||
{
|
import binnie.botany.api.EnumFlowerStage;
|
||||||
|
import binnie.botany.api.IFlower;
|
||||||
|
import binnie.botany.api.IFlowerRoot;
|
||||||
|
import binnie.botany.core.BotanyCore;
|
||||||
|
import binnie.botany.flower.TileEntityFlower;
|
||||||
|
|
||||||
|
public class FarmableFlower implements IFarmable {
|
||||||
@Override
|
@Override
|
||||||
public boolean isSaplingAt(final World world, final int x, final int y, final int z) {
|
public boolean isSaplingAt(final World world, final BlockPos pos) {
|
||||||
return world.getBlock(x, y, z) == Botany.flower;
|
return world.getBlockState(pos) == Botany.flower;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public ICrop getCropAt(final World world, final int x, final int y, final int z) {
|
public ICrop getCropAt(World world, BlockPos pos, IBlockState blockState) {
|
||||||
|
IFlower flower = null;
|
||||||
|
if (world.getTileEntity(pos) instanceof TileEntityFlower) {
|
||||||
|
flower = ((TileEntityFlower) world.getTileEntity(pos)).getFlower();
|
||||||
|
}
|
||||||
|
// Look at TileEntityFlower::onShear logic
|
||||||
|
if (flower != null && flower.getAge() > 1) {
|
||||||
|
IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot();
|
||||||
|
ItemStack mature = flowerRoot.getMemberStack(flower, EnumFlowerStage.FLOWER);
|
||||||
|
ItemStack seed = flowerRoot.getMemberStack(flower, EnumFlowerStage.SEED);
|
||||||
|
if (mature != null && seed != null) {
|
||||||
|
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
|
||||||
|
return new FlowerCrop(pos, mature, seed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isGermling(final ItemStack itemstack) {
|
public boolean isGermling(final ItemStack itemstack) {
|
||||||
final EnumFlowerStage stage = BotanyCore.speciesRoot.getStageType(itemstack);
|
final EnumFlowerStage stage = BotanyCore.getFlowerRoot().getType(itemstack);
|
||||||
return stage == EnumFlowerStage.FLOWER || stage == EnumFlowerStage.SEED;
|
return stage == EnumFlowerStage.FLOWER || stage == EnumFlowerStage.SEED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,9 +58,10 @@ public class FarmableFlower implements IFarmable
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean plantSaplingAt(final EntityPlayer player, final ItemStack germling, final World world, final int x, final int y, final int z) {
|
public boolean plantSaplingAt(final EntityPlayer player, final ItemStack germling, final World world, final BlockPos pos) {
|
||||||
final IFlower flower = BotanyCore.getFlowerRoot().getMember(germling);
|
IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot();
|
||||||
Gardening.plant(world, x, y, z, flower, player.getGameProfile());
|
IFlower flower = flowerRoot.getMember(germling);
|
||||||
|
flowerRoot.plant(world, pos, flower, player.getGameProfile());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,26 +1,24 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.farm;
|
package binnie.botany.farm;
|
||||||
|
|
||||||
import binnie.botany.api.IFlower;
|
|
||||||
import binnie.botany.gardening.Gardening;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import binnie.botany.core.BotanyCore;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class FarmableVanillaFlower extends FarmableFlower
|
import binnie.botany.api.IFlower;
|
||||||
{
|
import binnie.botany.api.IFlowerRoot;
|
||||||
|
import binnie.botany.core.BotanyCore;
|
||||||
|
|
||||||
|
public class FarmableVanillaFlower extends FarmableFlower {
|
||||||
@Override
|
@Override
|
||||||
public boolean isGermling(final ItemStack itemstack) {
|
public boolean isGermling(final ItemStack itemstack) {
|
||||||
return BotanyCore.getFlowerRoot().getConversion(itemstack) != null;
|
return BotanyCore.getFlowerRoot().getConversion(itemstack) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean plantSaplingAt(final EntityPlayer player, final ItemStack germling, final World world, final int x, final int y, final int z) {
|
public boolean plantSaplingAt(final EntityPlayer player, final ItemStack germling, final World world, final BlockPos pos) {
|
||||||
final IFlower flower = BotanyCore.getFlowerRoot().getConversion(germling);
|
IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot();
|
||||||
return Gardening.plant(world, x, y, z, flower, player.getGameProfile());
|
IFlower flower = flowerRoot.getConversion(germling);
|
||||||
|
return flowerRoot.plant(world, pos, flower, player.getGameProfile());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package binnie.botany.farm;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
|
import forestry.api.farming.ICrop;
|
||||||
|
|
||||||
|
public class FlowerCrop implements ICrop {
|
||||||
|
NonNullList<ItemStack> drops = NonNullList.create();
|
||||||
|
BlockPos position;
|
||||||
|
|
||||||
|
public FlowerCrop(BlockPos pos, ItemStack... drops) {
|
||||||
|
Arrays.stream(drops).forEach(drop -> this.drops.add(drop));
|
||||||
|
position = pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public NonNullList<ItemStack> harvest() {
|
||||||
|
return drops;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockPos getPosition() {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,73 +1,65 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.farm;
|
package binnie.botany.farm;
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.ArrayList;
|
||||||
import com.mojang.authlib.GameProfile;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import binnie.core.Mods;
|
import java.util.List;
|
||||||
import binnie.botany.flower.TileEntityFlower;
|
import java.util.Objects;
|
||||||
import forestry.core.access.IOwnable;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.renderer.texture.TextureMap;
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemBlock;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import net.minecraft.world.World;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
|
|
||||||
import forestry.api.farming.ICrop;
|
|
||||||
|
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
import binnie.Binnie;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemBlock;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
|
|
||||||
import binnie.botany.Botany;
|
|
||||||
import binnie.botany.api.EnumSoilType;
|
|
||||||
import binnie.botany.api.gardening.IBlockSoil;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
|
|
||||||
import binnie.botany.gardening.Gardening;
|
|
||||||
import forestry.api.farming.FarmDirection;
|
import forestry.api.farming.FarmDirection;
|
||||||
|
import forestry.api.farming.ICrop;
|
||||||
import forestry.api.farming.IFarmHousing;
|
import forestry.api.farming.IFarmHousing;
|
||||||
import forestry.api.farming.IFarmable;
|
import forestry.api.farming.IFarmable;
|
||||||
|
import forestry.core.owner.IOwnedTile;
|
||||||
|
import forestry.core.utils.BlockUtil;
|
||||||
|
|
||||||
import java.util.List;
|
import binnie.Binnie;
|
||||||
|
import binnie.botany.Botany;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import binnie.botany.api.EnumAcidity;
|
import binnie.botany.api.EnumAcidity;
|
||||||
import binnie.botany.api.EnumMoisture;
|
import binnie.botany.api.EnumMoisture;
|
||||||
|
import binnie.botany.api.EnumSoilType;
|
||||||
|
import binnie.botany.api.IBlockSoil;
|
||||||
|
import binnie.botany.api.IGardeningManager;
|
||||||
|
import binnie.botany.core.BotanyCore;
|
||||||
|
import binnie.botany.flower.TileEntityFlower;
|
||||||
|
import binnie.core.liquid.ManagerLiquid;
|
||||||
|
|
||||||
public class GardenLogic extends FarmLogic
|
public class GardenLogic extends FarmLogic {
|
||||||
{
|
|
||||||
EnumMoisture moisture;
|
|
||||||
EnumAcidity acidity;
|
|
||||||
boolean fertilised;
|
|
||||||
String name;
|
|
||||||
ArrayList<ItemStack> produce;
|
|
||||||
private ItemStack icon;
|
|
||||||
List<IFarmable> farmables;
|
List<IFarmable> farmables;
|
||||||
|
private EnumMoisture moisture;
|
||||||
|
@Nullable
|
||||||
|
private EnumAcidity acidity;
|
||||||
|
private boolean fertilised;
|
||||||
|
private String name;
|
||||||
|
private NonNullList<ItemStack> produce;
|
||||||
|
private ItemStack icon;
|
||||||
|
|
||||||
public GardenLogic(final IFarmHousing housing) {
|
public GardenLogic(EnumMoisture moisture2, @Nullable EnumAcidity acidity2, boolean isManual, boolean isFertilised, ItemStack icon2, String name2) {
|
||||||
super(housing);
|
this.produce = NonNullList.create();
|
||||||
this.produce = new ArrayList<ItemStack>();
|
(this.farmables = new ArrayList<>()).add(new FarmableFlower());
|
||||||
(this.farmables = new ArrayList<IFarmable>()).add(new FarmableFlower());
|
|
||||||
this.farmables.add(new FarmableVanillaFlower());
|
this.farmables.add(new FarmableVanillaFlower());
|
||||||
|
this.moisture = moisture2;
|
||||||
|
this.acidity = acidity2;
|
||||||
|
this.isManual = isManual;
|
||||||
|
this.fertilised = isFertilised;
|
||||||
|
this.icon = icon2;
|
||||||
|
this.name = name2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -82,85 +74,92 @@ public class GardenLogic extends FarmLogic
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAcceptedResource(final ItemStack itemstack) {
|
public boolean isAcceptedResource(final ItemStack itemstack) {
|
||||||
return Gardening.isSoil(itemstack.getItem()) || itemstack.getItem() == Item.getItemFromBlock(Blocks.sand) || itemstack.getItem() == Item.getItemFromBlock(Blocks.dirt) || Gardening.isAcidFertiliser(itemstack) || Gardening.isAlkalineFertiliser(itemstack);
|
IGardeningManager gardening = BotanyCore.getGardening();
|
||||||
|
return gardening.isSoil(itemstack.getItem()) ||
|
||||||
|
itemstack.getItem() == Item.getItemFromBlock(Blocks.SAND) ||
|
||||||
|
itemstack.getItem() == Item.getItemFromBlock(Blocks.DIRT) ||
|
||||||
|
gardening.isAcidFertiliser(itemstack) ||
|
||||||
|
gardening.isAlkalineFertiliser(itemstack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<ItemStack> collect() {
|
public NonNullList<ItemStack> collect(World world, IFarmHousing farmHousing) {
|
||||||
final Collection<ItemStack> products = this.produce;
|
final NonNullList<ItemStack> products = this.produce;
|
||||||
this.produce = new ArrayList<ItemStack>();
|
this.produce = NonNullList.create();
|
||||||
return products;
|
return products;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean cultivate(final int x, final int y, final int z, final FarmDirection direction, final int extent) {
|
public boolean cultivate(World world, IFarmHousing farmHousing, BlockPos pos, FarmDirection direction, int extent) {
|
||||||
this.world = this.housing.getWorld();
|
return this.maintainSoil(world, pos, direction, extent, farmHousing) ||
|
||||||
return this.maintainSoil(x, y, z, direction, extent) || (!this.isManual && this.maintainWater(x, y, z, direction, extent)) || this.maintainCrops(x, y + 1, z, direction, extent);
|
(!this.isManual && this.maintainWater(world, pos, direction, extent, farmHousing)) ||
|
||||||
|
this.maintainCrops(world, pos.up(), direction, extent, farmHousing);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isWaste(final ItemStack stack) {
|
private boolean isWaste(final ItemStack stack) {
|
||||||
return stack.getItem() == Item.getItemFromBlock(Blocks.dirt);
|
return stack.getItem() == Item.getItemFromBlock(Blocks.DIRT);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean maintainSoil(final int x2, final int y2, final int z2, final FarmDirection direction, final int extent) {
|
private boolean maintainSoil(World world, BlockPos pos, FarmDirection direction, int extent, IFarmHousing housing) {
|
||||||
|
IGardeningManager gardening = BotanyCore.getGardening();
|
||||||
for (int i = 0; i < extent; ++i) {
|
for (int i = 0; i < extent; ++i) {
|
||||||
final Vect position = this.translateWithOffset(x2, y2, z2, direction, i);
|
BlockPos position = pos.offset(direction.getFacing(), i);
|
||||||
if (this.fertilised && Gardening.isSoil(this.world.getBlock(position.x, position.y, position.z))) {
|
if (this.fertilised && gardening.isSoil(getBlock(world, position))) {
|
||||||
final IBlockSoil soil = (IBlockSoil) this.world.getBlock(position.x, position.y, position.z);
|
IBlockSoil soil = (IBlockSoil) getBlock(world, position);
|
||||||
if (soil.fertilise(this.world, position.x, position.y, position.z, EnumSoilType.FLOWERBED)) {
|
if (soil.fertilise(world, position, EnumSoilType.FLOWERBED)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.world.getBlock(position.x, position.y + 1, position.z) == Botany.plant) {
|
if (getBlock(world, position.up()) == Botany.plant) {
|
||||||
this.world.setBlockToAir(position.x, position.y + 1, position.z);
|
world.setBlockToAir(position.up());
|
||||||
}
|
} else {
|
||||||
else {
|
if (this.acidity != null && gardening.isSoil(getBlock(world, position))) {
|
||||||
if (this.acidity != null && Gardening.isSoil(this.world.getBlock(position.x, position.y, position.z))) {
|
IBlockSoil soil = (IBlockSoil) getBlock(world, position);
|
||||||
final IBlockSoil soil = (IBlockSoil) this.world.getBlock(position.x, position.y, position.z);
|
EnumAcidity pH = soil.getPH(world, position);
|
||||||
final EnumAcidity pH = soil.getPH(this.world, position.x, position.y, position.z);
|
|
||||||
if (pH.ordinal() < this.acidity.ordinal()) {
|
if (pH.ordinal() < this.acidity.ordinal()) {
|
||||||
final ItemStack stack = this.getAvailableAlkaline();
|
ItemStack stack = this.getAvailableAlkaline(housing);
|
||||||
if (stack != null && soil.setPH(this.world, position.x, position.y, position.z, EnumAcidity.values()[pH.ordinal() + 1])) {
|
if (!stack.isEmpty() && soil.setPH(world, position, EnumAcidity.values()[pH.ordinal() + 1])) {
|
||||||
this.housing.getFarmInventory().removeResources(new ItemStack[] { stack });
|
NonNullList<ItemStack> resources = NonNullList.create();
|
||||||
|
resources.add(stack);
|
||||||
|
housing.getFarmInventory().removeResources(resources);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pH.ordinal() > this.acidity.ordinal()) {
|
if (pH.ordinal() > this.acidity.ordinal()) {
|
||||||
final ItemStack stack = this.getAvailableAcid();
|
final ItemStack stack = this.getAvailableAcid(housing);
|
||||||
if (stack != null && soil.setPH(this.world, position.x, position.y, position.z, EnumAcidity.values()[pH.ordinal() - 1])) {
|
if (!stack.isEmpty() && soil.setPH(world, position, EnumAcidity.values()[pH.ordinal() - 1])) {
|
||||||
this.housing.getFarmInventory().removeResources(new ItemStack[] { stack });
|
NonNullList<ItemStack> resources = NonNullList.create();
|
||||||
|
resources.add(stack);
|
||||||
|
housing.getFarmInventory().removeResources(resources);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!this.isAirBlock(position) && !this.world.getBlock(position.x, position.y, position.z).isReplaceable(this.world, position.x, position.y, position.z)) {
|
if (!this.isAirBlock(world, position) && !BlockUtil.isReplaceableBlock(getBlockState(world, position), world, position)) {
|
||||||
final ItemStack block = this.getAsItemStack(position);
|
ItemStack block = this.getAsItemStack(world, position);
|
||||||
final ItemStack loam = this.getAvailableLoam();
|
ItemStack loam = this.getAvailableLoam(housing);
|
||||||
if (this.isWaste(block) && loam != null) {
|
if (this.isWaste(block) && !loam.isEmpty()) {
|
||||||
this.produce.addAll(Blocks.dirt.getDrops(this.world, position.x, position.y, position.z, block.getItemDamage(), 0));
|
this.produce.addAll(Blocks.DIRT.getDrops(world, position, Block.getBlockFromItem(block.getItem()).getStateFromMeta(block.getItemDamage()), 0));
|
||||||
this.setBlock(position, Blocks.air, 0);
|
this.setBlock(world, position, Blocks.AIR, 0);
|
||||||
return this.trySetSoil(position, loam);
|
return trySetSoil(world, position, loam, housing);
|
||||||
}
|
}
|
||||||
}
|
} else if (!this.isManual) {
|
||||||
else if (!this.isManual) {
|
if (!this.isWaterBlock(world, position)) {
|
||||||
if (!this.isWaterBlock(position)) {
|
|
||||||
if (i % 2 == 0) {
|
if (i % 2 == 0) {
|
||||||
return this.trySetSoil(position);
|
return trySetSoil(world, position, housing);
|
||||||
}
|
}
|
||||||
FarmDirection cclock = FarmDirection.EAST;
|
FarmDirection cclock = FarmDirection.EAST;
|
||||||
if (direction == FarmDirection.EAST) {
|
if (direction == FarmDirection.EAST) {
|
||||||
cclock = FarmDirection.SOUTH;
|
cclock = FarmDirection.SOUTH;
|
||||||
}
|
} else if (direction == FarmDirection.SOUTH) {
|
||||||
else if (direction == FarmDirection.SOUTH) {
|
|
||||||
cclock = FarmDirection.EAST;
|
cclock = FarmDirection.EAST;
|
||||||
}
|
} else if (direction == FarmDirection.WEST) {
|
||||||
else if (direction == FarmDirection.WEST) {
|
|
||||||
cclock = FarmDirection.SOUTH;
|
cclock = FarmDirection.SOUTH;
|
||||||
}
|
}
|
||||||
final Vect previous = this.translateWithOffset(position.x, position.y, position.z, cclock, 1);
|
BlockPos previous = position.offset(cclock.getFacing());
|
||||||
final ItemStack soil2 = this.getAsItemStack(previous);
|
final ItemStack soil2 = this.getAsItemStack(world, previous);
|
||||||
if (!Gardening.isSoil(soil2.getItem())) {
|
if (!gardening.isSoil(soil2.getItem())) {
|
||||||
this.trySetSoil(position);
|
this.trySetSoil(world, position, housing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -169,27 +168,24 @@ public class GardenLogic extends FarmLogic
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean maintainWater(final int x, final int y, final int z, final FarmDirection direction, final int extent) {
|
private boolean maintainWater(World world, BlockPos pos, FarmDirection direction, int extent, IFarmHousing housing) {
|
||||||
for (int i = 0; i < extent; ++i) {
|
for (int i = 0; i < extent; ++i) {
|
||||||
final Vect position = this.translateWithOffset(x, y, z, direction, i);
|
BlockPos position = pos.offset(direction.getFacing(), i);
|
||||||
if (this.isAirBlock(position) || this.world.getBlock(x, y, z).isReplaceable(this.world, position.x, position.y, position.z)) {
|
if (this.isAirBlock(world, position) || BlockUtil.isReplaceableBlock(getBlockState(world, position), world, position)) {
|
||||||
if (!this.isWaterBlock(position)) {
|
if (!this.isWaterBlock(world, position)) {
|
||||||
boolean isEnclosed = true;
|
boolean isEnclosed = true;
|
||||||
if (this.world.isAirBlock(position.x + 1, position.y, position.z)) {
|
if (world.isAirBlock(position.east())) {
|
||||||
|
isEnclosed = false;
|
||||||
|
} else if (world.isAirBlock(position.west())) {
|
||||||
|
isEnclosed = false;
|
||||||
|
} else if (world.isAirBlock(position.south())) {
|
||||||
|
isEnclosed = false;
|
||||||
|
} else if (world.isAirBlock(position.north())) {
|
||||||
isEnclosed = false;
|
isEnclosed = false;
|
||||||
}
|
}
|
||||||
else if (this.world.isAirBlock(position.x - 1, position.y, position.z)) {
|
isEnclosed = (isEnclosed || this.moisture != EnumMoisture.DAMP);
|
||||||
isEnclosed = false;
|
|
||||||
}
|
|
||||||
else if (this.world.isAirBlock(position.x, position.y, position.z + 1)) {
|
|
||||||
isEnclosed = false;
|
|
||||||
}
|
|
||||||
else if (this.world.isAirBlock(position.x, position.y, position.z - 1)) {
|
|
||||||
isEnclosed = false;
|
|
||||||
}
|
|
||||||
isEnclosed = (isEnclosed || this.moisture != EnumMoisture.Damp);
|
|
||||||
if (isEnclosed) {
|
if (isEnclosed) {
|
||||||
return this.trySetWater(position);
|
return this.trySetWater(world, position, housing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -197,72 +193,78 @@ public class GardenLogic extends FarmLogic
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ItemStack getAvailableLoam() {
|
private ItemStack getAvailableLoam(IFarmHousing housing) {
|
||||||
EnumMoisture[] moistures;
|
EnumMoisture[] moistures;
|
||||||
if (this.moisture == EnumMoisture.Damp) {
|
if (this.moisture == EnumMoisture.DAMP) {
|
||||||
moistures = new EnumMoisture[] { EnumMoisture.Damp, EnumMoisture.Normal, EnumMoisture.Dry };
|
moistures = new EnumMoisture[]{EnumMoisture.DAMP, EnumMoisture.NORMAL, EnumMoisture.DRY};
|
||||||
|
} else if (this.moisture == EnumMoisture.DRY) {
|
||||||
|
moistures = new EnumMoisture[]{EnumMoisture.DRY, EnumMoisture.DAMP, EnumMoisture.DRY};
|
||||||
|
} else {
|
||||||
|
moistures = new EnumMoisture[]{EnumMoisture.DRY, EnumMoisture.NORMAL, EnumMoisture.DAMP};
|
||||||
}
|
}
|
||||||
else if (this.moisture == EnumMoisture.Damp) {
|
final EnumAcidity[] acidities = {EnumAcidity.NEUTRAL, EnumAcidity.ACID, EnumAcidity.ALKALINE};
|
||||||
moistures = new EnumMoisture[] { EnumMoisture.Dry, EnumMoisture.Damp, EnumMoisture.Dry };
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
moistures = new EnumMoisture[] { EnumMoisture.Dry, EnumMoisture.Normal, EnumMoisture.Damp };
|
|
||||||
}
|
|
||||||
final EnumAcidity[] acidities = { EnumAcidity.Neutral, EnumAcidity.Acid, EnumAcidity.Alkaline };
|
|
||||||
for (final EnumMoisture moist : moistures) {
|
for (final EnumMoisture moist : moistures) {
|
||||||
for (final EnumAcidity acid : acidities) {
|
for (final EnumAcidity acid : acidities) {
|
||||||
for (final Block type : new Block[] { Botany.flowerbed, Botany.loam, Botany.soil }) {
|
for (final Block type : new Block[]{Botany.flowerbed, Botany.loam, Botany.soil}) {
|
||||||
final int meta = acid.ordinal() * 3 + moist.ordinal();
|
final int meta = acid.ordinal() * 3 + moist.ordinal();
|
||||||
final ItemStack[] resource = { new ItemStack(type, 1, meta) };
|
final NonNullList<ItemStack> resources = NonNullList.create();
|
||||||
if (this.housing.getFarmInventory().hasResources(resource)) {
|
ItemStack resourceStack = new ItemStack(type, 1, meta);
|
||||||
return resource[0];
|
resources.add(resourceStack);
|
||||||
|
if (housing.getFarmInventory().hasResources(resources)) {
|
||||||
|
return resourceStack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.housing.getFarmInventory().hasResources(new ItemStack[] { new ItemStack(Blocks.dirt) })) {
|
final NonNullList<ItemStack> resources = NonNullList.create();
|
||||||
return new ItemStack(Blocks.dirt);
|
ItemStack resourceStack = new ItemStack(Blocks.DIRT);
|
||||||
|
resources.add(resourceStack);
|
||||||
|
if (housing.getFarmInventory().hasResources(resources)) {
|
||||||
|
return new ItemStack(Blocks.DIRT);
|
||||||
}
|
}
|
||||||
return null;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean trySetSoil(final Vect position) {
|
private boolean trySetSoil(World world, BlockPos position, IFarmHousing housing) {
|
||||||
return this.trySetSoil(position, this.getAvailableLoam());
|
return this.trySetSoil(world, position, this.getAvailableLoam(housing), housing);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean trySetSoil(final Vect position, ItemStack loam) {
|
private boolean trySetSoil(World world, BlockPos position, ItemStack loam, IFarmHousing housing) {
|
||||||
ItemStack copy = loam;
|
ItemStack copy = loam;
|
||||||
if (loam != null) {
|
if (!loam.isEmpty()) {
|
||||||
if (loam.getItem() == Item.getItemFromBlock(Blocks.dirt)) {
|
if (loam.getItem() == Item.getItemFromBlock(Blocks.DIRT)) {
|
||||||
loam = new ItemStack(Botany.soil, 0, 4);
|
loam = new ItemStack(Botany.soil, 1, 4);
|
||||||
}
|
}
|
||||||
this.setBlock(position, ((ItemBlock) loam.getItem()).field_150939_a, loam.getItemDamage());
|
setBlock(world, position, ((ItemBlock) loam.getItem()).getBlock(), loam.getItemDamage());
|
||||||
this.housing.getFarmInventory().removeResources(new ItemStack[] { copy });
|
final NonNullList<ItemStack> resources = NonNullList.create();
|
||||||
|
resources.add(copy);
|
||||||
|
housing.getFarmInventory().removeResources(resources);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean trySetWater(final Vect position) {
|
private boolean trySetWater(World world, BlockPos position, IFarmHousing housing) {
|
||||||
final FluidStack water = Binnie.Liquid.getLiquidStack("water", 1000);
|
final FluidStack water = Binnie.LIQUID.getFluidStack(ManagerLiquid.WATER, 1000);
|
||||||
if (this.moisture == EnumMoisture.Damp) {
|
if (this.moisture == EnumMoisture.DAMP) {
|
||||||
if (!this.housing.hasLiquid(water)) {
|
if (water == null || !housing.hasLiquid(water)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.setBlock(position, Blocks.water, 0);
|
this.setBlock(world, position, Blocks.WATER, 0);
|
||||||
this.housing.removeLiquid(water);
|
housing.removeLiquid(water);
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else {
|
if (this.moisture != EnumMoisture.DRY) {
|
||||||
if (this.moisture != EnumMoisture.Dry) {
|
return trySetSoil(world, position, housing);
|
||||||
return this.trySetSoil(position);
|
|
||||||
}
|
}
|
||||||
final ItemStack[] sand = { new ItemStack(Blocks.sand, 1) };
|
final ItemStack sand = new ItemStack(Blocks.SAND, 1);
|
||||||
if (!this.housing.getFarmInventory().hasResources(sand)) {
|
final NonNullList<ItemStack> resources = NonNullList.create();
|
||||||
|
resources.add(sand);
|
||||||
|
if (!housing.getFarmInventory().hasResources(resources)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.setBlock(position, Blocks.sand, 0);
|
this.setBlock(world, position, Blocks.SAND, 0);
|
||||||
this.housing.getFarmInventory().removeResources(sand);
|
housing.getFarmInventory().removeResources(resources);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -282,19 +284,18 @@ public class GardenLogic extends FarmLogic
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<ICrop> harvest(final int x, final int y, final int z, final FarmDirection direction, final int extent) {
|
public Collection<ICrop> harvest(World world, BlockPos pos, FarmDirection direction, int extent) {
|
||||||
return null;
|
if (isManual) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
} else {
|
||||||
|
return farmables.stream().map(farmable -> farmable.getCropAt(world, pos.up(), world.getBlockState(pos.up())))
|
||||||
|
.filter(Objects::nonNull).collect(Collectors.toList());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
public ResourceLocation getTextureMap() {
|
||||||
public IIcon getIcon() {
|
return TextureMap.LOCATION_BLOCKS_TEXTURE;
|
||||||
return this.icon.getIconIndex();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getSpriteSheet() {
|
|
||||||
return TextureMap.locationBlocksTexture;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -302,36 +303,35 @@ public class GardenLogic extends FarmLogic
|
|||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean maintainCrops(final int x, final int y, final int z, final FarmDirection direction, final int extent) {
|
@Override
|
||||||
|
public ItemStack getIconItemStack() {
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean maintainCrops(World world, BlockPos pos, FarmDirection direction, int extent, IFarmHousing housing) {
|
||||||
|
IGardeningManager gardening = BotanyCore.getGardening();
|
||||||
for (int i = 0; i < extent; ++i) {
|
for (int i = 0; i < extent; ++i) {
|
||||||
final Vect position = this.translateWithOffset(x, y, z, direction, i);
|
BlockPos position = pos.offset(direction.getFacing(), i);
|
||||||
if (this.isAirBlock(position) || this.world.getBlock(x, y, z).isReplaceable(this.world, position.x, position.y, position.z)) {
|
if (this.isAirBlock(world, position) || BlockUtil.isReplaceableBlock(getBlockState(world, position), world, position)) {
|
||||||
final ItemStack below = this.getAsItemStack(position.add(new Vect(0, -1, 0)));
|
ItemStack below = this.getAsItemStack(world, position.down());
|
||||||
if (Gardening.isSoil(below.getItem())) {
|
if (gardening.isSoil(below.getItem())) {
|
||||||
return this.trySetCrop(position);
|
return trySetCrop(world, position, housing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean trySetCrop(final Vect position) {
|
private boolean trySetCrop(World world, BlockPos position, IFarmHousing housing) {
|
||||||
for (final IFarmable farmable : this.farmables) {
|
for (IFarmable farmable : this.farmables) {
|
||||||
final boolean success = this.housing.plantGermling(farmable, this.world, position.x, position.y, position.z);
|
if (housing.plantGermling(farmable, world, position)) {
|
||||||
if (success && this.housing instanceof IOwnable) {
|
if (housing instanceof IOwnedTile) {
|
||||||
final TileEntity tile = this.housing.getWorld().getTileEntity(position.x, position.y, position.z);
|
TileEntity tile = world.getTileEntity(position);
|
||||||
if (tile instanceof TileEntityFlower) {
|
if (tile instanceof TileEntityFlower) {
|
||||||
try {
|
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||||
final IOwnable housing2 = (IOwnable) this.housing;
|
IOwnedTile owned = (IOwnedTile) housing;
|
||||||
GameProfile prof = null;
|
|
||||||
if (Mods.Forestry.dev()) {
|
flower.setOwner(owned.getOwnerHandler().getOwner());
|
||||||
prof = (GameProfile) IOwnable.class.getMethod("getOwner", new Class[0]).invoke(housing2, new Object[0]);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
prof = (GameProfile) IOwnable.class.getMethod("getOwnerProfile", new Class[0]).invoke(housing2, new Object[0]);
|
|
||||||
}
|
|
||||||
((TileEntityFlower) tile).setOwner(prof);
|
|
||||||
} catch (Exception ex) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -340,31 +340,29 @@ public class GardenLogic extends FarmLogic
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getAvailableAcid() {
|
public ItemStack getAvailableAcid(IFarmHousing housing) {
|
||||||
for (final ItemStack stack : Gardening.getAcidFertilisers()) {
|
for (final ItemStack stack : BotanyCore.getGardening().getAcidFertilisers()) {
|
||||||
if (stack != null && stack.getItem() != null && this.housing.getFarmInventory().hasResources(new ItemStack[] { stack })) {
|
if (!stack.isEmpty()) {
|
||||||
return stack;
|
final NonNullList<ItemStack> resources = NonNullList.create();
|
||||||
|
resources.add(stack);
|
||||||
|
if (housing.getFarmInventory().hasResources(resources)) {
|
||||||
|
return stack;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getAvailableAlkaline() {
|
public ItemStack getAvailableAlkaline(IFarmHousing housing) {
|
||||||
for (final ItemStack stack : Gardening.getAlkalineFertilisers()) {
|
for (final ItemStack stack : BotanyCore.getGardening().getAlkalineFertilisers()) {
|
||||||
if (stack != null && stack.getItem() != null && this.housing.getFarmInventory().hasResources(new ItemStack[] { stack })) {
|
if (!stack.isEmpty()) {
|
||||||
return stack;
|
final NonNullList<ItemStack> resources = NonNullList.create();
|
||||||
|
resources.add(stack);
|
||||||
|
if (housing.getFarmInventory().hasResources(resources)) {
|
||||||
|
return stack;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setData(final EnumMoisture moisture2, final EnumAcidity acidity2, final boolean isManual, final boolean isFertilised, final ItemStack icon2, final String name2) {
|
|
||||||
this.moisture = moisture2;
|
|
||||||
this.acidity = acidity2;
|
|
||||||
this.isManual = isManual;
|
|
||||||
this.fertilised = isFertilised;
|
|
||||||
this.icon = icon2;
|
|
||||||
this.name = name2;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.farm;
|
|
||||||
|
|
||||||
public class Vect
|
|
||||||
{
|
|
||||||
public int x;
|
|
||||||
public int y;
|
|
||||||
public int z;
|
|
||||||
|
|
||||||
public Vect(final int[] dim) {
|
|
||||||
if (dim.length != 3) {
|
|
||||||
throw new RuntimeException("Cannot instantiate a vector with less or more than 3 points.");
|
|
||||||
}
|
|
||||||
this.x = dim[0];
|
|
||||||
this.y = dim[1];
|
|
||||||
this.z = dim[2];
|
|
||||||
}
|
|
||||||
|
|
||||||
public Vect(final int x, final int y, final int z) {
|
|
||||||
this.x = x;
|
|
||||||
this.y = y;
|
|
||||||
this.z = z;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Vect add(final Vect other) {
|
|
||||||
final Vect vect;
|
|
||||||
final Vect result = vect = new Vect(this.x, this.y, this.z);
|
|
||||||
vect.x += other.x;
|
|
||||||
final Vect vect2 = result;
|
|
||||||
vect2.y += other.y;
|
|
||||||
final Vect vect3 = result;
|
|
||||||
vect3.z += other.z;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Vect multiply(final float factor) {
|
|
||||||
final Vect vect;
|
|
||||||
final Vect result = vect = new Vect(this.x, this.y, this.z);
|
|
||||||
vect.x *= (int) factor;
|
|
||||||
final Vect vect2 = result;
|
|
||||||
vect2.y *= (int) factor;
|
|
||||||
final Vect vect3 = result;
|
|
||||||
vect3.z *= (int) factor;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return String.format("%sx%sx%s;", this.x, this.y, this.z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
final int prime = 31;
|
|
||||||
int result = 1;
|
|
||||||
result = 31 * result + this.x;
|
|
||||||
result = 31 * result + this.y;
|
|
||||||
result = 31 * result + this.z;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(final Object obj) {
|
|
||||||
if (this == obj) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (obj == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (this.getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final Vect other = (Vect) obj;
|
|
||||||
return this.x == other.x && this.y == other.y && this.z == other.z;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
@ParametersAreNonnullByDefault
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@FieldsAreNonnullByDefault
|
||||||
|
package binnie.botany.farm;
|
||||||
|
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
|
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||||
|
import mcp.MethodsReturnNonnullByDefault;
|
||||||
@@ -1,202 +1,313 @@
|
|||||||
//
|
package binnie.botany.flower;
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.List;
|
||||||
package binnie.botany.flower;
|
import java.util.Random;
|
||||||
|
|
||||||
import java.util.List;
|
import net.minecraft.block.Block;
|
||||||
import java.util.ArrayList;
|
import net.minecraft.block.BlockContainer;
|
||||||
import java.util.Random;
|
import net.minecraft.block.SoundType;
|
||||||
import binnie.botany.Botany;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.block.properties.PropertyBool;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.properties.PropertyInteger;
|
||||||
import binnie.botany.api.IFlowerType;
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
import binnie.botany.api.EnumFlowerStage;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import com.mojang.authlib.GameProfile;
|
import net.minecraft.init.Blocks;
|
||||||
import binnie.botany.api.IFlower;
|
import net.minecraft.item.ItemStack;
|
||||||
import binnie.botany.gardening.Gardening;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import binnie.botany.core.BotanyCore;
|
import net.minecraft.util.BlockRenderLayer;
|
||||||
import binnie.core.BinnieCore;
|
import net.minecraft.util.EnumBlockRenderType;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import net.minecraft.world.World;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import binnie.botany.genetics.EnumFlowerType;
|
import com.mojang.authlib.GameProfile;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraftforge.client.model.ModelLoader;
|
||||||
|
|
||||||
public class BlockFlower extends BlockContainer
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
{
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
@Override
|
|
||||||
public int getRenderType() {
|
import forestry.api.core.IStateMapperRegister;
|
||||||
return RendererBotany.renderID;
|
import forestry.core.blocks.IColoredBlock;
|
||||||
}
|
|
||||||
|
import binnie.botany.Botany;
|
||||||
@Override
|
import binnie.botany.api.IFlower;
|
||||||
@SideOnly(Side.CLIENT)
|
import binnie.botany.api.IFlowerGenome;
|
||||||
public void registerBlockIcons(final IIconRegister par1IconRegister) {
|
import binnie.botany.api.IFlowerRoot;
|
||||||
for (final EnumFlowerType type : EnumFlowerType.values()) {
|
import binnie.botany.api.IFlowerType;
|
||||||
type.registerIcons(par1IconRegister);
|
import binnie.botany.core.BotanyCore;
|
||||||
}
|
import binnie.botany.genetics.EnumFlowerType;
|
||||||
}
|
import binnie.botany.genetics.FlowerDefinition;
|
||||||
|
import binnie.botany.network.PacketID;
|
||||||
public BlockFlower() {
|
import binnie.core.BinnieCore;
|
||||||
super(Material.plants);
|
import binnie.core.network.packet.MessageNBT;
|
||||||
final float f = 0.2f;
|
import binnie.core.util.TileUtil;
|
||||||
this.setBlockBounds(0.5f - f, 0.0f, 0.5f - f, 0.5f + f, f * 3.0f, 0.5f + f);
|
|
||||||
this.setTickRandomly(true);
|
public class BlockFlower extends BlockContainer implements IColoredBlock, IStateMapperRegister {
|
||||||
this.setBlockName("flower");
|
public static final AxisAlignedBB FLOWER_BLOCK_AABB = new AxisAlignedBB(0.3D, 0.0D, 0.3D, 0.7D, 0.6D, 0.7D);
|
||||||
}
|
/* PROPERTYS */
|
||||||
|
public static final PropertyFlower FLOWER = new PropertyFlower("flower", IFlowerType.class);
|
||||||
@Override
|
public static final PropertyInteger SECTION = PropertyInteger.create("section", 0, EnumFlowerType.highestSection - 1);
|
||||||
public TileEntity createNewTileEntity(final World var1, final int i) {
|
public static final PropertyBool FLOWERED = PropertyBool.create("flowered");
|
||||||
return new TileEntityFlower();
|
public static final PropertyBool SEED = PropertyBool.create("seed");
|
||||||
}
|
|
||||||
|
public BlockFlower() {
|
||||||
@Override
|
super(Material.PLANTS);
|
||||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(final World par1World, final int par2, final int par3, final int par4) {
|
final float f = 0.2f;
|
||||||
return null;
|
this.setTickRandomly(true);
|
||||||
}
|
this.setRegistryName("flower");
|
||||||
|
this.setSoundType(SoundType.PLANT);
|
||||||
@Override
|
}
|
||||||
public boolean isOpaqueCube() {
|
|
||||||
return false;
|
@Override
|
||||||
}
|
public TileEntity createNewTileEntity(final World var1, final int i) {
|
||||||
|
return new TileEntityFlower();
|
||||||
@Override
|
}
|
||||||
public boolean renderAsNormalBlock() {
|
|
||||||
return false;
|
@Override
|
||||||
}
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void registerStateMapper() {
|
||||||
@Override
|
ModelLoader.setCustomStateMapper(this, new StateMapperFlower());
|
||||||
public void onBlockPlacedBy(final World world, final int x, final int y, final int z, final EntityLivingBase living, final ItemStack stack) {
|
}
|
||||||
super.onBlockPlacedBy(world, x, y, z, living, stack);
|
|
||||||
final TileEntity flower = world.getTileEntity(x, y, z);
|
@Override
|
||||||
if (!BinnieCore.proxy.isSimulating(world)) {
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||||
if (flower != null && flower instanceof TileEntityFlower) {
|
ItemStack heldItem = player.getHeldItemMainhand();
|
||||||
final IFlower f = BotanyCore.getFlowerRoot().getMember(stack);
|
if (!heldItem.isEmpty() && heldItem.getItem() == BinnieCore.getFieldKit() && player.isSneaking()) {
|
||||||
((TileEntityFlower) flower).setRender(new TileEntityFlower.RenderInfo(f, (TileEntityFlower) flower));
|
if (world.isRemote) {
|
||||||
}
|
return true;
|
||||||
return;
|
}
|
||||||
}
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
final TileEntity below = world.getTileEntity(x, y - 1, z);
|
if (tile instanceof TileEntityFlower) {
|
||||||
if (flower != null && flower instanceof TileEntityFlower) {
|
TileEntityFlower tileFlower = (TileEntityFlower) tile;
|
||||||
if (below instanceof TileEntityFlower) {
|
IFlower flower = tileFlower.getFlower();
|
||||||
((TileEntityFlower) flower).setSection(((TileEntityFlower) below).getSection());
|
if (flower != null) {
|
||||||
}
|
IFlowerGenome flowerGenome = flower.getGenome();
|
||||||
else {
|
NBTTagCompound info = new NBTTagCompound();
|
||||||
final GameProfile owner = (living instanceof EntityPlayer) ? ((EntityPlayer) living).getGameProfile() : null;
|
info.setString("Species", flowerGenome.getPrimary().getUID());
|
||||||
((TileEntityFlower) flower).create(stack, owner);
|
info.setString("Species2", flowerGenome.getSecondary().getUID());
|
||||||
}
|
info.setFloat("Age", flower.getAge() / flowerGenome.getLifespan());
|
||||||
}
|
info.setShort("Colour", (short) flowerGenome.getPrimaryColor().getID());
|
||||||
Gardening.tryGrowSection(world, x, y, z);
|
info.setShort("Colour2", (short) flowerGenome.getSecondaryColor().getID());
|
||||||
}
|
info.setBoolean("Wilting", flower.isWilted());
|
||||||
|
info.setBoolean("Flowered", flower.hasFlowered());
|
||||||
@Override
|
Botany.proxy.sendToPlayer(new MessageNBT(PacketID.FIELDKIT.ordinal(), info), player);
|
||||||
@SideOnly(Side.CLIENT)
|
heldItem.damageItem(1, player);
|
||||||
public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) {
|
}
|
||||||
final TileEntity tile = world.getTileEntity(x, y, z);
|
}
|
||||||
if (tile instanceof TileEntityFlower) {
|
return true;
|
||||||
final TileEntityFlower f = (TileEntityFlower) tile;
|
}
|
||||||
final EnumFlowerStage stage = (f.getAge() == 0) ? EnumFlowerStage.SEED : EnumFlowerStage.FLOWER;
|
return false;
|
||||||
final IFlowerType flower = f.getType();
|
}
|
||||||
final int section = f.getRenderSection();
|
|
||||||
final boolean flowered = f.isFlowered();
|
@Override
|
||||||
return (RendererBotany.pass == 0) ? flower.getStem(stage, flowered, section) : ((RendererBotany.pass == 1) ? flower.getPetalIcon(stage, flowered, section) : flower.getVariantIcon(stage, flowered, section));
|
@Nullable
|
||||||
}
|
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) {
|
||||||
return super.getIcon(world, x, y, z, side);
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
||||||
public int colorMultiplier(final IBlockAccess world, final int x, final int y, final int z) {
|
TileEntity tile = source.getTileEntity(pos);
|
||||||
final TileEntity tile = world.getTileEntity(x, y, z);
|
if (tile instanceof TileEntityFlower) {
|
||||||
if (tile instanceof TileEntityFlower) {
|
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||||
final TileEntityFlower f = (TileEntityFlower) tile;
|
if (flower.getType().getSections() > 1) {
|
||||||
return (RendererBotany.pass == 0) ? f.getStemColour() : ((RendererBotany.pass == 1) ? f.getPrimaryColour() : f.getSecondaryColour());
|
return FULL_BLOCK_AABB;
|
||||||
}
|
}
|
||||||
return 16777215;
|
}
|
||||||
}
|
return FLOWER_BLOCK_AABB;
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public boolean canPlaceBlockAt(final World world, final int x, final int y, final int z) {
|
@Override
|
||||||
return super.canPlaceBlockAt(world, x, y, z) && this.canBlockStay(world, x, y, z);
|
public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World world, BlockPos pos) {
|
||||||
}
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
|
if (tile instanceof TileEntityFlower) {
|
||||||
protected boolean canPlaceBlockOn(final Block block) {
|
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||||
return block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland || Gardening.isSoil(block);
|
if (flower.getType().getSections() > 1) {
|
||||||
}
|
return FULL_BLOCK_AABB.offset(pos);
|
||||||
|
}
|
||||||
@Override
|
}
|
||||||
public void onNeighborBlockChange(final World world, final int x, final int y, final int z, final Block block) {
|
return FLOWER_BLOCK_AABB.offset(pos);
|
||||||
super.onNeighborBlockChange(world, x, y, z, block);
|
}
|
||||||
this.checkAndDropBlock(world, x, y, z);
|
|
||||||
final TileEntity tile = world.getTileEntity(x, y, z);
|
@Override
|
||||||
if (tile instanceof TileEntityFlower) {
|
public boolean isOpaqueCube(IBlockState state) {
|
||||||
final TileEntityFlower flower = (TileEntityFlower) tile;
|
return false;
|
||||||
if (flower.getSection() == 0 && flower.getFlower() != null && flower.getFlower().getAge() > 0 && flower.getFlower().getGenome().getPrimary().getType().getSections() > 1 && world.getBlock(x, y + 1, z) != Botany.flower) {
|
}
|
||||||
this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
|
||||||
world.setBlockToAir(x, y, z);
|
@Override
|
||||||
}
|
public boolean isFullCube(IBlockState state) {
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateTick(final World world, final int x, final int y, final int z, final Random rand) {
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
|
||||||
final TileEntity tile = world.getTileEntity(x, y, z);
|
super.onBlockPlacedBy(world, pos, state, placer, stack);
|
||||||
if (tile instanceof TileEntityFlower) {
|
IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot();
|
||||||
((TileEntityFlower) tile).randomUpdate(rand);
|
final TileEntity flower = world.getTileEntity(pos);
|
||||||
this.checkAndDropBlock(world, x, y, z);
|
if (!BinnieCore.getBinnieProxy().isSimulating(world)) {
|
||||||
return;
|
if (flower != null && flower instanceof TileEntityFlower) {
|
||||||
}
|
final IFlower f = flowerRoot.getMember(stack);
|
||||||
world.setBlockToAir(x, y, z);
|
if (f != null) {
|
||||||
}
|
((TileEntityFlower) flower).setRender(new TileEntityFlower.RenderInfo(f, (TileEntityFlower) flower));
|
||||||
|
}
|
||||||
protected void checkAndDropBlock(final World world, final int x, final int y, final int z) {
|
}
|
||||||
if (!this.canBlockStay(world, x, y, z)) {
|
return;
|
||||||
this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
}
|
||||||
world.setBlockToAir(x, y, z);
|
final TileEntity below = world.getTileEntity(pos.down());
|
||||||
}
|
if (flower != null && flower instanceof TileEntityFlower) {
|
||||||
}
|
if (below instanceof TileEntityFlower) {
|
||||||
|
((TileEntityFlower) flower).setSection(((TileEntityFlower) below).getSection());
|
||||||
@Override
|
} else {
|
||||||
public boolean canBlockStay(final World world, final int x, final int y, final int z) {
|
final GameProfile owner = (placer instanceof EntityPlayer) ? ((EntityPlayer) placer).getGameProfile() : null;
|
||||||
final TileEntity tile = world.getTileEntity(x, y, z);
|
((TileEntityFlower) flower).create(stack, owner);
|
||||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() > 0) {
|
}
|
||||||
return world.getBlock(x, y - 1, z) == Botany.flower;
|
}
|
||||||
}
|
flowerRoot.tryGrowSection(world, pos);
|
||||||
return this.canPlaceBlockOn(world.getBlock(x, y - 1, z));
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
@Override
|
@SideOnly(Side.CLIENT)
|
||||||
public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int blockMeta, final int fortune) {
|
public int colorMultiplier(IBlockState state, @Nullable IBlockAccess world, @Nullable BlockPos pos, int tintIndex) {
|
||||||
final ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
|
if (world != null && pos != null) {
|
||||||
final TileEntity tile = world.getTileEntity(x, y, z);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() == 0) {
|
if (tile instanceof TileEntityFlower) {
|
||||||
final ItemStack flower = ((TileEntityFlower) tile).getItemStack();
|
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||||
if (flower != null) {
|
if (tintIndex == 0) {
|
||||||
drops.add(flower);
|
return flower.getStemColour();
|
||||||
}
|
} else if (tintIndex == 1) {
|
||||||
}
|
return flower.getPrimaryColour();
|
||||||
return drops;
|
} else {
|
||||||
}
|
return flower.getSecondaryColour();
|
||||||
|
}
|
||||||
@Override
|
}
|
||||||
public boolean removedByPlayer(final World world, final EntityPlayer player, final int x, final int y, final int z) {
|
}
|
||||||
final List<ItemStack> drops = this.getDrops(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
return 0xffffff;
|
||||||
final boolean hasBeenBroken = world.setBlockToAir(x, y, z);
|
}
|
||||||
if (hasBeenBroken && BinnieCore.proxy.isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
|
||||||
for (final ItemStack drop : drops) {
|
@Override
|
||||||
this.dropBlockAsItem(world, x, y, z, drop);
|
public boolean canPlaceBlockAt(World world, BlockPos pos) {
|
||||||
}
|
return super.canPlaceBlockAt(world, pos) && canBlockStay(world, pos);
|
||||||
}
|
}
|
||||||
return hasBeenBroken;
|
|
||||||
}
|
public boolean canBlockStay(World world, BlockPos pos) {
|
||||||
}
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
|
IBlockState downState = world.getBlockState(pos.down());
|
||||||
|
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() > 0) {
|
||||||
|
return downState.getBlock() == Botany.flower;
|
||||||
|
}
|
||||||
|
return this.canPlaceBlockOn(downState.getBlock());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean canPlaceBlockOn(final 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) {
|
||||||
|
this.checkAndDropBlock(worldIn, pos);
|
||||||
|
final TileEntity tile = worldIn.getTileEntity(pos);
|
||||||
|
if (tile instanceof TileEntityFlower) {
|
||||||
|
final TileEntityFlower flower = (TileEntityFlower) tile;
|
||||||
|
if (flower.getSection() == 0 && flower.getFlower() != null && flower.getFlower().getAge() > 0 && flower.getFlower().getGenome().getPrimary().getType().getSections() > 1 && worldIn.getBlockState(pos.up()).getBlock() != Botany.flower) {
|
||||||
|
this.dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0);
|
||||||
|
worldIn.setBlockToAir(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
|
||||||
|
final TileEntity tile = world.getTileEntity(pos);
|
||||||
|
if (tile instanceof TileEntityFlower) {
|
||||||
|
((TileEntityFlower) tile).randomUpdate(rand);
|
||||||
|
this.checkAndDropBlock(world, pos);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void checkAndDropBlock(final World world, final BlockPos pos) {
|
||||||
|
if (!this.canBlockStay(world, pos)) {
|
||||||
|
this.dropBlockAsItem(world, pos, world.getBlockState(pos), 0);
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NonNullList<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||||
|
NonNullList<ItemStack> drops = NonNullList.create();
|
||||||
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
|
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() == 0) {
|
||||||
|
ItemStack flower = ((TileEntityFlower) tile).getItemStack();
|
||||||
|
if (!flower.isEmpty()) {
|
||||||
|
drops.add(flower);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return drops;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
|
||||||
|
final List<ItemStack> drops = this.getDrops(world, pos, world.getBlockState(pos), 0);
|
||||||
|
final boolean hasBeenBroken = world.setBlockToAir(pos);
|
||||||
|
if (hasBeenBroken && BinnieCore.getBinnieProxy().isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||||
|
for (final ItemStack drop : drops) {
|
||||||
|
spawnAsEntity(world, pos, drop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return hasBeenBroken;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package binnie.botany.flower;
|
||||||
|
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
enum EnumTubeInsulate {
|
||||||
|
Clay(0xa1aacc, "Clay"),
|
||||||
|
Cobble(0x7b7b7b, "Cobblestone"),
|
||||||
|
Sand(0xefeab5, "Sand"),
|
||||||
|
HardenedClay(0x935c43, "Hardened Clay"),
|
||||||
|
Stone(0x6d6d6d, "Smooth Stone"),
|
||||||
|
Sandstone(0xc1b989, "Sandstone");
|
||||||
|
|
||||||
|
int color;
|
||||||
|
String name;
|
||||||
|
|
||||||
|
EnumTubeInsulate(final int color, final String name) {
|
||||||
|
this.color = color;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static EnumTubeInsulate get(final int i) {
|
||||||
|
return values()[i / 128 % values().length];
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getColor() {
|
||||||
|
return this.color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return this.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack getStack() {
|
||||||
|
switch (this) {
|
||||||
|
case Clay: {
|
||||||
|
return new ItemStack(Blocks.CLAY);
|
||||||
|
}
|
||||||
|
case Cobble: {
|
||||||
|
return new ItemStack(Blocks.COBBLESTONE);
|
||||||
|
}
|
||||||
|
case HardenedClay: {
|
||||||
|
return new ItemStack(Blocks.HARDENED_CLAY);
|
||||||
|
}
|
||||||
|
case Sand: {
|
||||||
|
return new ItemStack(Blocks.SAND);
|
||||||
|
}
|
||||||
|
case Sandstone: {
|
||||||
|
return new ItemStack(Blocks.SANDSTONE);
|
||||||
|
}
|
||||||
|
case Stone: {
|
||||||
|
return new ItemStack(Blocks.STONE);
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
throw new IllegalStateException("Unknown insulated tube type: " + this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package binnie.botany.flower;
|
||||||
|
|
||||||
|
enum EnumTubeMaterial {
|
||||||
|
Copper(0xe3b78e, "Copper"),
|
||||||
|
Tin(0xe1eef4, "Tin"),
|
||||||
|
Bronze(0xddc276, "Bronze"),
|
||||||
|
Iron(0xd8d8d8, "Iron");
|
||||||
|
|
||||||
|
int color;
|
||||||
|
String name;
|
||||||
|
|
||||||
|
EnumTubeMaterial(final int color, final String name) {
|
||||||
|
this.color = color;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static EnumTubeMaterial get(final int i) {
|
||||||
|
return values()[i % values().length];
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getColor() {
|
||||||
|
return this.color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return this.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
package binnie.botany.flower;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import binnie.Binnie;
|
||||||
|
import binnie.botany.Botany;
|
||||||
|
import binnie.botany.api.IFlowerType;
|
||||||
|
import binnie.core.resource.BinnieSprite;
|
||||||
|
|
||||||
|
public class FlowerSpriteManager {
|
||||||
|
private static final Map<IFlowerType, FlowerSprites> flowerSprites = new HashMap<>();
|
||||||
|
|
||||||
|
public static void initSprites(IFlowerType type) {
|
||||||
|
if (flowerSprites.containsKey(type)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
flowerSprites.put(type, new FlowerSprites(type));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public static TextureAtlasSprite getStem(IFlowerType type, int section, boolean flowered) {
|
||||||
|
FlowerSprites flower = flowerSprites.get(type);
|
||||||
|
if (flower == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return flower.getStem(type, section, flowered);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public static TextureAtlasSprite getPetal(IFlowerType type, int section, boolean flowered) {
|
||||||
|
FlowerSprites flower = flowerSprites.get(type);
|
||||||
|
if (flower == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return flower.getPetal(type, section, flowered);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public static TextureAtlasSprite getVariant(IFlowerType type, int section, boolean flowered) {
|
||||||
|
FlowerSprites flower = flowerSprites.get(type);
|
||||||
|
if (flower == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return flower.getVariant(type, section, flowered);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class FlowerSprites {
|
||||||
|
private BinnieSprite[] stem;
|
||||||
|
private BinnieSprite[] variant;
|
||||||
|
private BinnieSprite[] petal;
|
||||||
|
private BinnieSprite[] unflowered;
|
||||||
|
private int sections;
|
||||||
|
|
||||||
|
public FlowerSprites(IFlowerType type) {
|
||||||
|
this.sections = type.getSections();
|
||||||
|
this.stem = new BinnieSprite[sections];
|
||||||
|
this.petal = new BinnieSprite[sections];
|
||||||
|
this.variant = new BinnieSprite[sections];
|
||||||
|
this.unflowered = new BinnieSprite[sections];
|
||||||
|
for (int section = 0; section < sections; ++section) {
|
||||||
|
final String suf = (section == 0) ? "" : ("" + (section + 1));
|
||||||
|
final String pre = (sections == 1) ? "" : "double/";
|
||||||
|
this.stem[section] = Binnie.RESOURCE.getBlockSprite(Botany.instance, "flowers/" + pre + type.toString().toLowerCase() + suf + ".0");
|
||||||
|
this.petal[section] = Binnie.RESOURCE.getBlockSprite(Botany.instance, "flowers/" + pre + type.toString().toLowerCase() + suf + ".1");
|
||||||
|
this.variant[section] = Binnie.RESOURCE.getBlockSprite(Botany.instance, "flowers/" + pre + type.toString().toLowerCase() + suf + ".2");
|
||||||
|
this.unflowered[section] = Binnie.RESOURCE.getBlockSprite(Botany.instance, "flowers/" + pre + type.toString().toLowerCase() + suf + ".3");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public TextureAtlasSprite getStem(IFlowerType type, int section, boolean flowered) {
|
||||||
|
return stem[section % sections].getSprite();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public TextureAtlasSprite getPetal(IFlowerType type, int section, boolean flowered) {
|
||||||
|
return (flowered ? petal[section % this.sections] : this.unflowered[section % this.sections]).getSprite();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public TextureAtlasSprite getVariant(IFlowerType type, int section, boolean flowered) {
|
||||||
|
return flowered ? variant[section % this.sections].getSprite() : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,53 +1,66 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.flower;
|
package binnie.botany.flower;
|
||||||
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import com.google.common.base.Preconditions;
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import javax.annotation.Nullable;
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import binnie.botany.Botany;
|
|
||||||
import forestry.api.genetics.IPollinatable;
|
|
||||||
import binnie.Binnie;
|
|
||||||
import binnie.botany.api.EnumFlowerStage;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import binnie.botany.api.IFlowerType;
|
|
||||||
import binnie.botany.genetics.EnumFlowerType;
|
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
import forestry.core.config.Config;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
import binnie.botany.api.EnumFlowerChromosome;
|
|
||||||
import binnie.botany.core.BotanyCore;
|
|
||||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
|
||||||
import binnie.botany.genetics.Flower;
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import binnie.core.BinnieCore;
|
|
||||||
import binnie.botany.api.IFlower;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.SoundType;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
|
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||||
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import forestry.api.genetics.IIndividual;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import binnie.botany.CreativeTabBotany;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemBlock;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.EnumActionResult;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
|
import net.minecraft.util.SoundCategory;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public abstract class ItemBotany extends Item
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
{
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public int getSpriteNumber() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemBotany(final String name) {
|
import forestry.api.core.IItemModelRegister;
|
||||||
|
import forestry.api.core.IModelManager;
|
||||||
|
import forestry.api.genetics.IIndividual;
|
||||||
|
import forestry.api.genetics.IPollinatable;
|
||||||
|
import forestry.core.config.Config;
|
||||||
|
import forestry.core.items.IColoredItem;
|
||||||
|
|
||||||
|
import binnie.Binnie;
|
||||||
|
import binnie.botany.Botany;
|
||||||
|
import binnie.botany.CreativeTabBotany;
|
||||||
|
import binnie.botany.api.EnumFlowerChromosome;
|
||||||
|
import binnie.botany.api.EnumFlowerStage;
|
||||||
|
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||||
|
import binnie.botany.api.IFlower;
|
||||||
|
import binnie.botany.api.IFlowerGenome;
|
||||||
|
import binnie.botany.api.IFlowerType;
|
||||||
|
import binnie.botany.core.BotanyCore;
|
||||||
|
import binnie.botany.genetics.Flower;
|
||||||
|
import binnie.core.util.I18N;
|
||||||
|
|
||||||
|
public class ItemBotany extends Item implements IColoredItem, IItemModelRegister {
|
||||||
|
private EnumFlowerStage type;
|
||||||
|
private String tag;
|
||||||
|
|
||||||
|
public ItemBotany(final String name, EnumFlowerStage type, String tag) {
|
||||||
this.setCreativeTab(CreativeTabBotany.instance);
|
this.setCreativeTab(CreativeTabBotany.instance);
|
||||||
this.setUnlocalizedName(name);
|
this.setUnlocalizedName(name);
|
||||||
|
setRegistryName(name);
|
||||||
this.hasSubtypes = true;
|
this.hasSubtypes = true;
|
||||||
|
this.type = type;
|
||||||
|
this.tag = tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -71,46 +84,57 @@ public abstract class ItemBotany extends Item
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final IIndividual individual = this.getIndividual(itemstack);
|
final IIndividual individual = this.getIndividual(itemstack);
|
||||||
return individual != null && individual.getGenome() != null && individual.hasEffect();
|
return individual != null && individual.hasEffect();
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addInformation(final ItemStack itemstack, final EntityPlayer player, final List list, final boolean flag) {
|
|
||||||
if (!itemstack.hasTagCompound()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final IFlower individual = (IFlower) this.getIndividual(itemstack);
|
|
||||||
if (individual == null) {
|
|
||||||
list.add("This item is bugged. Destroy it!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
list.add("§e" + individual.getGenome().getPrimaryColor().getName() + ((individual.getGenome().getPrimaryColor() == individual.getGenome().getSecondaryColor()) ? "" : (" and " + individual.getGenome().getSecondaryColor().getName())) + ", " + individual.getGenome().getStemColor().getName() + " Stem");
|
|
||||||
if (individual.isAnalyzed()) {
|
|
||||||
if (BinnieCore.proxy.isShiftDown()) {
|
|
||||||
individual.addTooltip(list);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
list.add("§o<Hold shift for details>");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
list.add("<Unknown>");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerIcons(final IIconRegister par1IconRegister) {
|
public void addInformation(final ItemStack itemStack, final EntityPlayer player, final List<String> list, final boolean flag) {
|
||||||
|
if (!itemStack.hasTagCompound()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
IFlower individual = (IFlower) this.getIndividual(itemStack);
|
||||||
|
if (individual == null) {
|
||||||
|
list.add(TextFormatting.DARK_RED + I18N.localise("botany.flower.destroy"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
IFlowerGenome genome = individual.getGenome();
|
||||||
|
//Colors
|
||||||
|
String primaryColor = genome.getPrimaryColor().getColourName();
|
||||||
|
String secondaryColor = genome.getSecondaryColor().getColourName();
|
||||||
|
String stemColor = genome.getStemColor().getColourName();
|
||||||
|
String colorInfo;
|
||||||
|
if (!primaryColor.equals(secondaryColor)) {
|
||||||
|
colorInfo = I18N.localise("botany.grammar.flower.secondary");
|
||||||
|
} else {
|
||||||
|
colorInfo = I18N.localise("botany.grammar.flower");
|
||||||
|
}
|
||||||
|
list.add(TextFormatting.YELLOW + colorInfo.replaceAll("%PRIMARY", primaryColor).replaceAll("%SECONDARY", secondaryColor).replaceAll("%STEM", stemColor));
|
||||||
|
|
||||||
|
if (individual.isAnalyzed()) {
|
||||||
|
if (GuiScreen.isShiftKeyDown()) {
|
||||||
|
individual.addTooltip(list);
|
||||||
|
} else {
|
||||||
|
list.add(TextFormatting.ITALIC + "<" + I18N.localise("for.gui.tooltip.tmi") + ">");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
list.add("<" + I18N.localise("for.gui.unknown") + ">");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
protected IIndividual getIndividual(final ItemStack itemstack) {
|
protected IIndividual getIndividual(final ItemStack itemstack) {
|
||||||
return new Flower(itemstack.getTagCompound());
|
NBTTagCompound tagCompound = itemstack.getTagCompound();
|
||||||
|
if (tagCompound == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new Flower(tagCompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IAlleleFlowerSpecies getPrimarySpecies(final ItemStack itemstack) {
|
private IAlleleFlowerSpecies getPrimarySpecies(final ItemStack itemstack) {
|
||||||
final IFlower tree = BotanyCore.speciesRoot.getMember(itemstack);
|
final IFlower tree = BotanyCore.getFlowerRoot().getMember(itemstack);
|
||||||
if (tree == null) {
|
if (tree == null) {
|
||||||
return (IAlleleFlowerSpecies) BotanyCore.speciesRoot.getDefaultTemplate()[EnumFlowerChromosome.SPECIES.ordinal()];
|
return (IAlleleFlowerSpecies) BotanyCore.getFlowerRoot().getDefaultTemplate()[EnumFlowerChromosome.SPECIES.ordinal()];
|
||||||
}
|
}
|
||||||
return tree.getGenome().getPrimary();
|
return tree.getGenome().getPrimary();
|
||||||
}
|
}
|
||||||
@@ -118,171 +142,113 @@ public abstract class ItemBotany extends Item
|
|||||||
@Override
|
@Override
|
||||||
public String getItemStackDisplayName(final ItemStack itemstack) {
|
public String getItemStackDisplayName(final ItemStack itemstack) {
|
||||||
if (!itemstack.hasTagCompound()) {
|
if (!itemstack.hasTagCompound()) {
|
||||||
return "Unknown";
|
return I18N.localise("item.botany.flower.corrupted.name");
|
||||||
}
|
}
|
||||||
final IIndividual individual = this.getIndividual(itemstack);
|
IIndividual individual = this.getIndividual(itemstack);
|
||||||
return (individual != null && individual.getGenome() != null) ? (individual.getDisplayName() + this.getTag()) : "Corrupted Flower";
|
if (individual != null) {
|
||||||
|
return individual.getDisplayName() + (!tag.isEmpty() ? " " + I18N.localise("item.botany." + tag + ".name") : "");
|
||||||
|
}
|
||||||
|
return I18N.localise("item.botany.flower.corrupted.name");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubItems(final Item item, final CreativeTabs par2CreativeTabs, final List itemList) {
|
public void getSubItems(final Item item, final CreativeTabs tab, final NonNullList<ItemStack> itemList) {
|
||||||
this.addCreativeItems(itemList, true);
|
this.addCreativeItems(itemList, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addCreativeItems(final List itemList, final boolean hideSecrets) {
|
public void addCreativeItems(final NonNullList<ItemStack> itemList, final boolean hideSecrets) {
|
||||||
for (final IIndividual individual : BotanyCore.speciesRoot.getIndividualTemplates()) {
|
for (final IIndividual individual : BotanyCore.getFlowerRoot().getIndividualTemplates()) {
|
||||||
if (hideSecrets && individual.isSecret() && !Config.isDebug) {
|
if (hideSecrets && individual.isSecret() && !Config.isDebug) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
itemList.add(BotanyCore.speciesRoot.getMemberStack(individual.copy(), this.getStage().ordinal()));
|
itemList.add(BotanyCore.getFlowerRoot().getMemberStack(individual.copy(), type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getColorFromItemStack(final ItemStack itemstack, final int renderPass) {
|
public int getColorFromItemstack(ItemStack stack, int tintIndex) {
|
||||||
final IFlower flower = BotanyCore.speciesRoot.getMember(itemstack);
|
IFlower flower = BotanyCore.getFlowerRoot().getMember(stack);
|
||||||
if (flower == null || flower.getGenome() == null) {
|
if (flower == null) {
|
||||||
return 16777215;
|
return 16777215;
|
||||||
}
|
}
|
||||||
return (renderPass == 0) ? flower.getGenome().getStemColor().getColor(flower.isWilted()) : ((renderPass == 1) ? flower.getGenome().getPrimaryColor().getColor(flower.isWilted()) : flower.getGenome().getSecondaryColor().getColor(flower.isWilted()));
|
return (tintIndex == 0) ? flower.getGenome().getStemColor().getColor(flower.isWilted()) : ((tintIndex == 1) ? flower.getGenome().getPrimaryColor().getColor(flower.isWilted()) : flower.getGenome().getSecondaryColor().getColor(flower.isWilted()));
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean requiresMultipleRenderPasses() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getRenderPasses(final int metadata) {
|
|
||||||
return 3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(final ItemStack itemstack, final int renderPass) {
|
public void registerModel(Item item, IModelManager manager) {
|
||||||
final IFlower flower = BotanyCore.speciesRoot.getMember(itemstack);
|
for (IFlowerType flowerType : (List<IFlowerType>) BlockFlower.FLOWER.getAllowedValues()) {
|
||||||
if (flower == null || flower.getGenome() == null || flower.getGenome().getPrimary() == null) {
|
flowerType.registerModels(item, manager, type);
|
||||||
return EnumFlowerType.Allium.getBlank();
|
|
||||||
}
|
}
|
||||||
final IFlowerType type = flower.getGenome().getPrimary().getType();
|
manager.registerItemModel(item, new BotanyMeshDefinition());
|
||||||
if (renderPass == 0) {
|
|
||||||
return type.getStem(this.getStage(), flower.hasFlowered(), type.getSections() - 1);
|
|
||||||
}
|
|
||||||
if (renderPass == 1) {
|
|
||||||
return type.getPetalIcon(this.getStage(), flower.hasFlowered(), type.getSections() - 1);
|
|
||||||
}
|
|
||||||
return type.getVariantIcon(this.getStage(), flower.hasFlowered(), type.getSections() - 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemUse(final ItemStack itemstack, final EntityPlayer player, final World world, int x, int y, int z, int side, final float px, final float py, final float pz) {
|
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||||
if (this.getStage() == EnumFlowerStage.POLLEN) {
|
ItemStack stack = player.getHeldItem(hand);
|
||||||
final IFlower flower = Binnie.Genetics.getFlowerRoot().getMember(itemstack);
|
if (type == EnumFlowerStage.POLLEN) {
|
||||||
final TileEntity target = world.getTileEntity(x, y, z);
|
final IFlower flower = Binnie.GENETICS.getFlowerRoot().getMember(stack);
|
||||||
|
final TileEntity target = world.getTileEntity(pos);
|
||||||
if (!(target instanceof IPollinatable)) {
|
if (!(target instanceof IPollinatable)) {
|
||||||
return false;
|
return EnumActionResult.PASS;
|
||||||
}
|
}
|
||||||
final IPollinatable pollinatable = (IPollinatable) target;
|
final IPollinatable pollinatable = (IPollinatable) target;
|
||||||
if (!pollinatable.canMateWith(flower)) {
|
if (!pollinatable.canMateWith(flower)) {
|
||||||
return false;
|
return EnumActionResult.FAIL;
|
||||||
}
|
}
|
||||||
pollinatable.mateWith(flower);
|
pollinatable.mateWith(flower);
|
||||||
if (!player.capabilities.isCreativeMode) {
|
if (!player.capabilities.isCreativeMode) {
|
||||||
--itemstack.stackSize;
|
stack.shrink(1);
|
||||||
}
|
}
|
||||||
return true;
|
return EnumActionResult.SUCCESS;
|
||||||
}
|
} else {
|
||||||
else {
|
IBlockState iblockstate = world.getBlockState(pos);
|
||||||
final Block blockFlower = Botany.flower;
|
Block block = iblockstate.getBlock();
|
||||||
final Block blockAlreadyThere = world.getBlock(x, y, z);
|
|
||||||
if (blockAlreadyThere == Blocks.snow_layer && (world.getBlockMetadata(x, y, z) & 0x7) < 1) {
|
if (!block.isReplaceable(world, pos)) {
|
||||||
side = 1;
|
pos = pos.offset(facing);
|
||||||
}
|
}
|
||||||
else if (blockAlreadyThere != Blocks.vine && blockAlreadyThere != Blocks.tallgrass && blockAlreadyThere != Blocks.deadbush && !blockAlreadyThere.isReplaceable(world, x, y, z)) {
|
|
||||||
if (side == 0) {
|
if (stack.getCount() != 0 && player.canPlayerEdit(pos, facing, stack) && world.mayPlace(Botany.flower, pos, false, facing, null)) {
|
||||||
--y;
|
int i = this.getMetadata(stack.getMetadata());
|
||||||
}
|
IBlockState iblockstate1 = Botany.flower.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, i, player, hand);
|
||||||
if (side == 1) {
|
|
||||||
++y;
|
if (placeBlockAt(stack, player, world, pos, facing, hitX, hitY, hitZ, iblockstate1)) {
|
||||||
}
|
SoundType soundtype = world.getBlockState(pos).getBlock().getSoundType(world.getBlockState(pos), world, pos, player);
|
||||||
if (side == 2) {
|
world.playSound(player, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
|
||||||
--z;
|
stack.shrink(1);
|
||||||
}
|
|
||||||
if (side == 3) {
|
|
||||||
++z;
|
|
||||||
}
|
|
||||||
if (side == 4) {
|
|
||||||
--x;
|
|
||||||
}
|
|
||||||
if (side == 5) {
|
|
||||||
++x;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return EnumActionResult.SUCCESS;
|
||||||
|
} else {
|
||||||
|
return EnumActionResult.FAIL;
|
||||||
}
|
}
|
||||||
if (itemstack.stackSize == 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!player.canPlayerEdit(x, y, z, side, itemstack)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (y == 255 && blockFlower.getMaterial().isSolid()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (world.canPlaceEntityOnSide(blockFlower, x, y, z, false, side, player, itemstack)) {
|
|
||||||
final int i1 = this.getMetadata(itemstack.getItemDamage());
|
|
||||||
final int j1 = blockFlower.onBlockPlaced(world, x, y, z, side, px, py, pz, i1);
|
|
||||||
if (this.placeBlockAt(itemstack, player, world, x, y, z, side, px, py, pz, j1)) {
|
|
||||||
world.playSoundEffect(x + 0.5f, y + 0.5f, z + 0.5f, blockFlower.stepSound.func_150496_b(), (blockFlower.stepSound.getVolume() + 1.0f) / 2.0f, blockFlower.stepSound.getPitch() * 0.8f);
|
|
||||||
--itemstack.stackSize;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) {
|
||||||
public boolean func_150936_a(final World p_150936_1_, int p_150936_2_, int p_150936_3_, int p_150936_4_, int p_150936_5_, final EntityPlayer p_150936_6_, final ItemStack p_150936_7_) {
|
if (!world.setBlockState(pos, newState, 3)) {
|
||||||
final Block field_150939_a = Botany.flower;
|
|
||||||
final Block block = p_150936_1_.getBlock(p_150936_2_, p_150936_3_, p_150936_4_);
|
|
||||||
if (block == Blocks.snow_layer) {
|
|
||||||
p_150936_5_ = 1;
|
|
||||||
}
|
|
||||||
else if (block != Blocks.vine && block != Blocks.tallgrass && block != Blocks.deadbush && !block.isReplaceable(p_150936_1_, p_150936_2_, p_150936_3_, p_150936_4_)) {
|
|
||||||
if (p_150936_5_ == 0) {
|
|
||||||
--p_150936_3_;
|
|
||||||
}
|
|
||||||
if (p_150936_5_ == 1) {
|
|
||||||
++p_150936_3_;
|
|
||||||
}
|
|
||||||
if (p_150936_5_ == 2) {
|
|
||||||
--p_150936_4_;
|
|
||||||
}
|
|
||||||
if (p_150936_5_ == 3) {
|
|
||||||
++p_150936_4_;
|
|
||||||
}
|
|
||||||
if (p_150936_5_ == 4) {
|
|
||||||
--p_150936_2_;
|
|
||||||
}
|
|
||||||
if (p_150936_5_ == 5) {
|
|
||||||
++p_150936_2_;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return p_150936_1_.canPlaceEntityOnSide(field_150939_a, p_150936_2_, p_150936_3_, p_150936_4_, false, p_150936_5_, (Entity) null, p_150936_7_);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean placeBlockAt(final ItemStack stack, final EntityPlayer player, final World world, final int x, final int y, final int z, final int side, final float hitX, final float hitY, final float hitZ, final int metadata) {
|
|
||||||
final Block field_150939_a = Botany.flower;
|
|
||||||
if (!world.setBlock(x, y, z, field_150939_a, metadata, 3)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (world.getBlock(x, y, z) == field_150939_a) {
|
|
||||||
field_150939_a.onBlockPlacedBy(world, x, y, z, player, stack);
|
IBlockState state = world.getBlockState(pos);
|
||||||
field_150939_a.onPostBlockPlaced(world, x, y, z, metadata);
|
if (state.getBlock() == Botany.flower) {
|
||||||
|
ItemBlock.setTileEntityNBT(world, player, pos, stack);
|
||||||
|
Botany.flower.onBlockPlacedBy(world, pos, state, player, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract EnumFlowerStage getStage();
|
@SideOnly(Side.CLIENT)
|
||||||
|
private class BotanyMeshDefinition implements ItemMeshDefinition {
|
||||||
public abstract String getTag();
|
@Override
|
||||||
|
public ModelResourceLocation getModelLocation(ItemStack stack) {
|
||||||
|
IFlower flower = BotanyCore.getFlowerRoot().getMember(stack);
|
||||||
|
Preconditions.checkNotNull(flower);
|
||||||
|
IAlleleFlowerSpecies flowerSpecies = flower.getGenome().getPrimary();
|
||||||
|
IFlowerType flowerType = flowerSpecies.getType();
|
||||||
|
return flowerSpecies.getFlowerModel(type, flower.hasFlowered());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.flower;
|
|
||||||
|
|
||||||
import binnie.botany.api.EnumFlowerStage;
|
|
||||||
|
|
||||||
public class ItemFlower extends ItemBotany
|
|
||||||
{
|
|
||||||
public ItemFlower() {
|
|
||||||
super("itemFlower");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumFlowerStage getStage() {
|
|
||||||
return EnumFlowerStage.FLOWER;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTag() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,173 +1,116 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.flower;
|
package binnie.botany.flower;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import com.google.common.collect.ArrayListMultimap;
|
||||||
import net.minecraft.init.Blocks;
|
import com.google.common.collect.Multimap;
|
||||||
import binnie.botany.CreativeTabBotany;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import java.util.Collection;
|
||||||
import binnie.botany.Botany;
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
|
||||||
public class ItemInsulatedTube extends Item
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
{
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
IIcon[] icons;
|
|
||||||
|
|
||||||
@Override
|
import forestry.api.circuits.ChipsetManager;
|
||||||
@SideOnly(Side.CLIENT)
|
import forestry.api.circuits.ICircuit;
|
||||||
public void getSubItems(final Item p_150895_1_, final CreativeTabs p_150895_2_, final List p_150895_3_) {
|
import forestry.api.circuits.ICircuitLayout;
|
||||||
for (final Material mat : Material.values()) {
|
import forestry.api.core.IModelManager;
|
||||||
for (final Insulate ins : Insulate.values()) {
|
import forestry.core.circuits.SolderManager;
|
||||||
p_150895_3_.add(new ItemStack(this, 1, mat.ordinal() + ins.ordinal() * 128));
|
import forestry.core.items.IColoredItem;
|
||||||
}
|
import forestry.core.utils.Translator;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
import binnie.botany.CreativeTabBotany;
|
||||||
@SideOnly(Side.CLIENT)
|
import binnie.core.item.ItemCore;
|
||||||
public void registerIcons(final IIconRegister p_94581_1_) {
|
|
||||||
for (int i = 0; i < 3; ++i) {
|
|
||||||
this.icons[i] = Botany.proxy.getIcon(p_94581_1_, "insulatedTube." + i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public int getColorFromItemStack(final ItemStack stack, final int pass) {
|
|
||||||
return (pass == 0) ? 16777215 : ((pass == 1) ? Material.get(stack.getItemDamage()).getColor() : Insulate.get(stack.getItemDamage()).getColor());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void addInformation(final ItemStack p_77624_1_, final EntityPlayer p_77624_2_, final List p_77624_3_, final boolean p_77624_4_) {
|
|
||||||
super.addInformation(p_77624_1_, p_77624_2_, p_77624_3_, p_77624_4_);
|
|
||||||
p_77624_3_.add(Insulate.get(p_77624_1_.getItemDamage()).getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getItemStackDisplayName(final ItemStack p_77653_1_) {
|
|
||||||
return Material.get(p_77653_1_.getItemDamage()).getName() + " Insulated Tube";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getRenderPasses(final int metadata) {
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getIcon(final ItemStack stack, final int pass) {
|
|
||||||
return this.icons[pass % 3];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean requiresMultipleRenderPasses() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public class ItemInsulatedTube extends ItemCore implements IColoredItem {
|
||||||
public ItemInsulatedTube() {
|
public ItemInsulatedTube() {
|
||||||
this.icons = new IIcon[3];
|
super("insulated_tube");
|
||||||
this.setUnlocalizedName("insulatedTube");
|
setUnlocalizedName("insulated_tube");
|
||||||
this.setCreativeTab(CreativeTabBotany.instance);
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
|
setHasSubtypes(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getInsulate(final ItemStack stack) {
|
private static Multimap<ICircuitLayout, ICircuit> getCircuits(ItemStack itemStack) {
|
||||||
return Insulate.get(stack.getItemDamage()).getName();
|
Multimap<ICircuitLayout, ICircuit> circuits = ArrayListMultimap.create();
|
||||||
|
Collection<ICircuitLayout> allLayouts = ChipsetManager.circuitRegistry.getRegisteredLayouts().values();
|
||||||
|
for (ICircuitLayout circuitLayout : allLayouts) {
|
||||||
|
ICircuit circuit = SolderManager.getCircuit(circuitLayout, itemStack);
|
||||||
|
if (circuit != null) {
|
||||||
|
circuits.put(circuitLayout, circuit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return circuits;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack getInsulateStack(final ItemStack stack) {
|
public static String getInsulate(ItemStack stack) {
|
||||||
return Insulate.get(stack.getItemDamage()).getStack();
|
return EnumTubeInsulate.get(stack.getItemDamage()).getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Material
|
public static ItemStack getInsulateStack(ItemStack stack) {
|
||||||
{
|
return EnumTubeInsulate.get(stack.getItemDamage()).getStack();
|
||||||
Copper(14923662, "Copper"),
|
}
|
||||||
Tin(14806772, "Tin"),
|
|
||||||
Bronze(14533238, "Bronze"),
|
|
||||||
Iron(14211288, "Iron");
|
|
||||||
|
|
||||||
int color;
|
@Override
|
||||||
String name;
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void getSubItems(Item item, CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||||
public int getColor() {
|
for (EnumTubeMaterial mat : EnumTubeMaterial.values()) {
|
||||||
return this.color;
|
for (EnumTubeInsulate ins : EnumTubeInsulate.values()) {
|
||||||
}
|
subItems.add(new ItemStack(this, 1, mat.ordinal() + ins.ordinal() * 128));
|
||||||
|
}
|
||||||
public String getName() {
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Material(final int color, final String name) {
|
|
||||||
this.color = color;
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Material get(final int i) {
|
|
||||||
return values()[i % values().length];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Insulate
|
@SideOnly(Side.CLIENT)
|
||||||
{
|
@Override
|
||||||
Clay(10595020, "Clay"),
|
public void registerModel(Item item, IModelManager manager) {
|
||||||
Cobble(8092539, "Cobblestone"),
|
for (EnumTubeMaterial mat : EnumTubeMaterial.values()) {
|
||||||
Sand(15723189, "Sand"),
|
for (EnumTubeInsulate ins : EnumTubeInsulate.values()) {
|
||||||
HardenedClay(9657411, "Hardened Clay"),
|
manager.registerItemModel(item, mat.ordinal() + ins.ordinal() * 128);
|
||||||
Stone(7171437, "Smooth Stone"),
|
|
||||||
Sandstone(12695945, "Sandstone");
|
|
||||||
|
|
||||||
int color;
|
|
||||||
String name;
|
|
||||||
|
|
||||||
public int getColor() {
|
|
||||||
return this.color;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Insulate(final int color, final String name) {
|
|
||||||
this.color = color;
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Insulate get(final int i) {
|
|
||||||
return values()[i / 128 % values().length];
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack getStack() {
|
|
||||||
switch (this) {
|
|
||||||
case Clay: {
|
|
||||||
return new ItemStack(Blocks.clay);
|
|
||||||
}
|
|
||||||
case Cobble: {
|
|
||||||
return new ItemStack(Blocks.cobblestone);
|
|
||||||
}
|
|
||||||
case HardenedClay: {
|
|
||||||
return new ItemStack(Blocks.hardened_clay);
|
|
||||||
}
|
|
||||||
case Sand: {
|
|
||||||
return new ItemStack(Blocks.sand);
|
|
||||||
}
|
|
||||||
case Sandstone: {
|
|
||||||
return new ItemStack(Blocks.sandstone);
|
|
||||||
}
|
|
||||||
case Stone: {
|
|
||||||
return new ItemStack(Blocks.stone);
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getColorFromItemstack(ItemStack stack, int tintIndex) {
|
||||||
|
if (tintIndex == 0) {
|
||||||
|
return 0xffffff;
|
||||||
|
} else if (tintIndex == 1) {
|
||||||
|
return EnumTubeMaterial.get(stack.getItemDamage()).getColor();
|
||||||
|
}
|
||||||
|
return EnumTubeInsulate.get(stack.getItemDamage()).getColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void addInformation(ItemStack itemstack, EntityPlayer player, List<String> list, boolean flag) {
|
||||||
|
super.addInformation(itemstack, player, list, flag);
|
||||||
|
Multimap<ICircuitLayout, ICircuit> circuits = getCircuits(itemstack);
|
||||||
|
if (!circuits.isEmpty()) {
|
||||||
|
if (GuiScreen.isShiftKeyDown()) {
|
||||||
|
for (ICircuitLayout circuitLayout : circuits.keys()) {
|
||||||
|
String circuitLayoutName = circuitLayout.getUsage();
|
||||||
|
list.add(TextFormatting.WHITE.toString() + TextFormatting.UNDERLINE + circuitLayoutName);
|
||||||
|
for (ICircuit circuit : circuits.get(circuitLayout)) {
|
||||||
|
circuit.addTooltip(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
list.add(TextFormatting.ITALIC + "<" + Translator.translateToLocal("for.gui.tooltip.tmi") + ">");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
list.add("<" + Translator.translateToLocal("for.gui.noeffect") + ">");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getItemStackDisplayName(ItemStack itemStack) {
|
||||||
|
int meta = itemStack.getMetadata();
|
||||||
|
return EnumTubeMaterial.get(meta).getName() + " " + EnumTubeInsulate.get(meta).getName() + " " + super.getItemStackDisplayName(itemStack);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.flower;
|
|
||||||
|
|
||||||
import binnie.botany.api.EnumFlowerStage;
|
|
||||||
|
|
||||||
public class ItemPollen extends ItemBotany
|
|
||||||
{
|
|
||||||
public ItemPollen() {
|
|
||||||
super("pollen");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumFlowerStage getStage() {
|
|
||||||
return EnumFlowerStage.POLLEN;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTag() {
|
|
||||||
return " Pollen";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.flower;
|
|
||||||
|
|
||||||
import binnie.botany.api.EnumFlowerStage;
|
|
||||||
|
|
||||||
public class ItemSeed extends ItemBotany
|
|
||||||
{
|
|
||||||
public ItemSeed() {
|
|
||||||
super("seed");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumFlowerStage getStage() {
|
|
||||||
return EnumFlowerStage.SEED;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTag() {
|
|
||||||
return " Germling";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package binnie.botany.flower;
|
||||||
|
|
||||||
|
import com.google.common.base.Optional;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import net.minecraft.block.properties.PropertyHelper;
|
||||||
|
|
||||||
|
import forestry.api.genetics.AlleleManager;
|
||||||
|
import forestry.api.genetics.IAllele;
|
||||||
|
|
||||||
|
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||||
|
import binnie.botany.api.IFlowerType;
|
||||||
|
|
||||||
|
public class PropertyFlower<I extends IFlowerType<I>> extends PropertyHelper<I> {
|
||||||
|
public PropertyFlower(String name, Class<I> flowerTypeClass) {
|
||||||
|
super(name, flowerTypeClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<I> getAllowedValues() {
|
||||||
|
List<I> flowerTypes = new ArrayList<>();
|
||||||
|
for (IAllele allele : AlleleManager.alleleRegistry.getRegisteredAlleles().values()) {
|
||||||
|
if (allele instanceof IAlleleFlowerSpecies) {
|
||||||
|
IFlowerType flowerType = ((IAlleleFlowerSpecies) allele).getType();
|
||||||
|
if (!flowerTypes.contains(flowerType)) {
|
||||||
|
flowerTypes.add((I) flowerType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return flowerTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the name for the given value.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getName(IFlowerType value) {
|
||||||
|
return value.getName().toLowerCase(Locale.ENGLISH);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Optional<I> parseValue(String value) {
|
||||||
|
IAllele allele = AlleleManager.alleleRegistry.getAllele(value);
|
||||||
|
if (IAlleleFlowerSpecies.class.isInstance(allele)) {
|
||||||
|
IAlleleFlowerSpecies alleleValue = IAlleleFlowerSpecies.class.cast(allele);
|
||||||
|
return Optional.of((I) alleleValue.getType());
|
||||||
|
}
|
||||||
|
return Optional.absent();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.flower;
|
|
||||||
|
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
import net.minecraft.client.renderer.EntityRenderer;
|
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.client.renderer.RenderBlocks;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
|
||||||
|
|
||||||
public class RendererBotany implements ISimpleBlockRenderingHandler
|
|
||||||
{
|
|
||||||
public static int renderID;
|
|
||||||
public static int pass;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void renderInventoryBlock(final Block block, final int metadata, final int modelID, final RenderBlocks renderer) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean renderWorldBlock(final IBlockAccess world, final int x, final int y, final int z, final Block block, final int modelId, final RenderBlocks renderer) {
|
|
||||||
final Tessellator tessellator = Tessellator.instance;
|
|
||||||
tessellator.setBrightness(block.getMixedBrightnessForBlock(renderer.blockAccess, x, y, z));
|
|
||||||
double d1 = x;
|
|
||||||
final double d2 = y;
|
|
||||||
double d3 = z;
|
|
||||||
long i1 = x * 3129871 ^ z * 116129781L;
|
|
||||||
i1 = i1 * i1 * 42317861L + i1 * 11L;
|
|
||||||
d1 += ((i1 >> 16 & 0xFL) / 15.0f - 0.5) * 0.3;
|
|
||||||
d3 += ((i1 >> 24 & 0xFL) / 15.0f - 0.5) * 0.3;
|
|
||||||
final int rot = (int) (i1 % 4L);
|
|
||||||
for (int j = 0; j < 3; ++j) {
|
|
||||||
RendererBotany.pass = j;
|
|
||||||
final int l = block.colorMultiplier(renderer.blockAccess, x, y, z);
|
|
||||||
float f = (l >> 16 & 0xFF) / 255.0f;
|
|
||||||
float f2 = (l >> 8 & 0xFF) / 255.0f;
|
|
||||||
float f3 = (l & 0xFF) / 255.0f;
|
|
||||||
if (EntityRenderer.anaglyphEnable) {
|
|
||||||
final float f4 = (f * 30.0f + f2 * 59.0f + f3 * 11.0f) / 100.0f;
|
|
||||||
final float f5 = (f * 30.0f + f2 * 70.0f) / 100.0f;
|
|
||||||
final float f6 = (f * 30.0f + f3 * 70.0f) / 100.0f;
|
|
||||||
f = f4;
|
|
||||||
f2 = f5;
|
|
||||||
f3 = f6;
|
|
||||||
}
|
|
||||||
tessellator.setColorOpaque_F(f, f2, f3);
|
|
||||||
final IIcon iicon = block.getIcon(world, x, y, z, 0);
|
|
||||||
renderer.drawCrossedSquares(iicon, d1, d2, d3, 1.0f);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldRender3DInInventory(final int i) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getRenderId() {
|
|
||||||
return RendererBotany.renderID;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package binnie.botany.flower;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import net.minecraft.block.properties.IProperty;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
|
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import binnie.Constants;
|
||||||
|
import binnie.botany.api.IFlowerType;
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public class StateMapperFlower extends StateMapperBase {
|
||||||
|
@Override
|
||||||
|
protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
|
||||||
|
final Map<IProperty<?>, Comparable<?>> properties = Maps.newLinkedHashMap(state.getProperties());
|
||||||
|
IFlowerType flowerType = (IFlowerType) state.getValue(BlockFlower.FLOWER);
|
||||||
|
if (flowerType.getSections() < 2) {
|
||||||
|
properties.remove(BlockFlower.SECTION);
|
||||||
|
} else if (flowerType.getSections() <= state.getValue(BlockFlower.SECTION)) {
|
||||||
|
properties.put(BlockFlower.SECTION, flowerType.getSections() - 1);
|
||||||
|
}
|
||||||
|
if (state.getValue(BlockFlower.SEED)) {
|
||||||
|
properties.remove(BlockFlower.SECTION);
|
||||||
|
properties.remove(BlockFlower.FLOWER);
|
||||||
|
properties.remove(BlockFlower.FLOWERED);
|
||||||
|
} else {
|
||||||
|
properties.remove(BlockFlower.SEED);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ModelResourceLocation(Constants.BOTANY_MOD_ID + ":flower", getPropertyString(properties));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,90 +1,62 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.flower;
|
package binnie.botany.flower;
|
||||||
|
|
||||||
import binnie.botany.api.IFlowerColour;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Random;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import forestry.api.core.IErrorState;
|
|
||||||
|
|
||||||
import net.minecraft.world.biome.BiomeGenBase;
|
|
||||||
|
|
||||||
import binnie.botany.genetics.EnumFlowerType;
|
|
||||||
import binnie.botany.api.IFlowerType;
|
|
||||||
import binnie.botany.genetics.EnumFlowerColor;
|
|
||||||
import forestry.api.core.EnumHumidity;
|
|
||||||
import forestry.api.core.EnumTemperature;
|
|
||||||
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
import forestry.lepidopterology.entities.EntityButterfly;
|
|
||||||
import binnie.botany.gardening.BlockPlant;
|
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.entity.item.EntityItem;
|
|
||||||
|
|
||||||
import binnie.botany.api.EnumFlowerStage;
|
|
||||||
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
|
||||||
|
|
||||||
import binnie.botany.network.MessageFlowerUpdate;
|
|
||||||
|
|
||||||
import net.minecraft.network.Packet;
|
|
||||||
|
|
||||||
import binnie.botany.api.IFlowerGenome;
|
|
||||||
import binnie.botany.api.EnumSoilType;
|
|
||||||
|
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
|
|
||||||
import binnie.botany.Botany;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import binnie.botany.gardening.Gardening;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
|
||||||
import forestry.api.genetics.IIndividual;
|
|
||||||
|
|
||||||
import net.minecraftforge.common.EnumPlantType;
|
|
||||||
|
|
||||||
import java.util.EnumSet;
|
|
||||||
|
|
||||||
import binnie.botany.core.BotanyCore;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTBase;
|
|
||||||
|
|
||||||
import binnie.Binnie;
|
|
||||||
import binnie.core.BinnieCore;
|
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTUtil;
|
|
||||||
|
|
||||||
import binnie.botany.genetics.Flower;
|
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.nbt.NBTUtil;
|
||||||
import forestry.api.lepidopterology.IButterfly;
|
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.World;
|
||||||
|
import net.minecraft.world.biome.Biome;
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
|
|
||||||
import binnie.botany.api.IFlower;
|
import net.minecraftforge.common.EnumPlantType;
|
||||||
import forestry.api.lepidopterology.IButterflyNursery;
|
|
||||||
|
import forestry.api.core.EnumHumidity;
|
||||||
|
import forestry.api.core.EnumTemperature;
|
||||||
|
import forestry.api.core.IErrorState;
|
||||||
|
import forestry.api.genetics.IIndividual;
|
||||||
import forestry.api.genetics.IPollinatable;
|
import forestry.api.genetics.IPollinatable;
|
||||||
|
import forestry.api.lepidopterology.IButterfly;
|
||||||
|
import forestry.api.lepidopterology.IButterflyNursery;
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import binnie.Binnie;
|
||||||
import net.minecraft.util.ChunkCoordinates;
|
import binnie.botany.Botany;
|
||||||
|
import binnie.botany.api.EnumFlowerStage;
|
||||||
|
import binnie.botany.api.EnumSoilType;
|
||||||
|
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||||
|
import binnie.botany.api.IFlower;
|
||||||
|
import binnie.botany.api.IFlowerColour;
|
||||||
|
import binnie.botany.api.IFlowerGenome;
|
||||||
|
import binnie.botany.api.IFlowerRoot;
|
||||||
|
import binnie.botany.api.IFlowerType;
|
||||||
|
import binnie.botany.api.IGardeningManager;
|
||||||
|
import binnie.botany.core.BotanyCore;
|
||||||
|
import binnie.botany.gardening.BlockPlant;
|
||||||
|
import binnie.botany.genetics.EnumFlowerColor;
|
||||||
|
import binnie.botany.genetics.EnumFlowerType;
|
||||||
|
import binnie.botany.genetics.Flower;
|
||||||
|
import binnie.core.BinnieCore;
|
||||||
|
|
||||||
public class TileEntityFlower extends TileEntity implements IPollinatable, IButterflyNursery
|
public class TileEntityFlower extends TileEntity implements IPollinatable, IButterflyNursery {
|
||||||
{
|
@Nullable
|
||||||
IFlower flower;
|
IFlower flower;
|
||||||
|
@Nullable
|
||||||
GameProfile owner;
|
GameProfile owner;
|
||||||
int section;
|
int section;
|
||||||
|
@Nullable
|
||||||
RenderInfo renderInfo;
|
RenderInfo renderInfo;
|
||||||
|
@Nullable
|
||||||
IButterfly caterpillar;
|
IButterfly caterpillar;
|
||||||
int matureTime;
|
int matureTime;
|
||||||
|
|
||||||
@@ -96,46 +68,54 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(final NBTTagCompound nbttagcompound) {
|
public void readFromNBT(final NBTTagCompound nbtCompound) {
|
||||||
this.flower = new Flower(nbttagcompound);
|
if (nbtCompound.hasKey("Flower")) {
|
||||||
this.section = nbttagcompound.getByte("section");
|
this.flower = new Flower(nbtCompound.getCompoundTag("Flower"));
|
||||||
if (this.flower.getAge() == 0) {
|
if (flower.getAge() == 0) {
|
||||||
this.flower.setFlowered(false);
|
flower.setFlowered(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.owner = NBTUtil.func_152459_a(nbttagcompound.getCompoundTag("owner"));
|
if (nbtCompound.hasKey("section")) {
|
||||||
if (nbttagcompound.hasKey("CATER") && BinnieCore.isLepidopteryActive()) {
|
this.section = nbtCompound.getByte("section");
|
||||||
this.matureTime = nbttagcompound.getInteger("caterTime");
|
|
||||||
this.caterpillar = Binnie.Genetics.getButterflyRoot().getMember(nbttagcompound.getCompoundTag("cater"));
|
|
||||||
}
|
}
|
||||||
super.readFromNBT(nbttagcompound);
|
if (nbtCompound.hasKey("owner")) {
|
||||||
|
this.owner = NBTUtil.readGameProfileFromNBT(nbtCompound.getCompoundTag("owner"));
|
||||||
|
}
|
||||||
|
if (nbtCompound.hasKey("CATER") && BinnieCore.isLepidopteryActive()) {
|
||||||
|
this.matureTime = nbtCompound.getInteger("caterTime");
|
||||||
|
this.caterpillar = Binnie.GENETICS.getButterflyRoot().getMember(nbtCompound.getCompoundTag("cater"));
|
||||||
|
}
|
||||||
|
readRenderInfo(nbtCompound);
|
||||||
|
super.readFromNBT(nbtCompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToNBT(final NBTTagCompound nbttagcompound) {
|
public NBTTagCompound writeToNBT(final NBTTagCompound nbtCompound) {
|
||||||
if (this.flower != null) {
|
if (this.flower != null) {
|
||||||
this.flower.writeToNBT(nbttagcompound);
|
nbtCompound.setTag("Flower", flower.writeToNBT(new NBTTagCompound()));
|
||||||
}
|
}
|
||||||
if (this.owner != null) {
|
if (this.owner != null) {
|
||||||
final NBTTagCompound nbt = new NBTTagCompound();
|
final NBTTagCompound nbt = new NBTTagCompound();
|
||||||
NBTUtil.func_152460_a(nbt, this.owner);
|
NBTUtil.writeGameProfile(nbt, this.owner);
|
||||||
nbttagcompound.setTag("owner", nbt);
|
nbtCompound.setTag("owner", nbt);
|
||||||
}
|
}
|
||||||
if (this.caterpillar != null) {
|
if (this.caterpillar != null) {
|
||||||
nbttagcompound.setInteger("caterTime", this.matureTime);
|
nbtCompound.setInteger("caterTime", this.matureTime);
|
||||||
final NBTTagCompound subcompound = new NBTTagCompound();
|
final NBTTagCompound subcompound = new NBTTagCompound();
|
||||||
this.caterpillar.writeToNBT(subcompound);
|
this.caterpillar.writeToNBT(subcompound);
|
||||||
nbttagcompound.setTag("cater", subcompound);
|
nbtCompound.setTag("cater", subcompound);
|
||||||
}
|
}
|
||||||
nbttagcompound.setByte("section", (byte) this.getSection());
|
nbtCompound.setByte("section", (byte) getSection());
|
||||||
super.writeToNBT(nbttagcompound);
|
return super.writeToNBT(nbtCompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void create(final ItemStack stack, final GameProfile owner) {
|
public void create(final ItemStack stack, @Nullable final GameProfile owner) {
|
||||||
this.create(BotanyCore.getFlowerRoot().getMember(stack), owner);
|
IFlower flower = BotanyCore.getFlowerRoot().getMember(stack);
|
||||||
|
this.create(flower, owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void create(final IFlower stack, final GameProfile owner) {
|
public void create(final IFlower flower, @Nullable final GameProfile owner) {
|
||||||
this.flower = stack;
|
this.flower = flower;
|
||||||
if (this.flower.getAge() == 0) {
|
if (this.flower.getAge() == 0) {
|
||||||
this.flower.setFlowered(false);
|
this.flower.setFlowered(false);
|
||||||
}
|
}
|
||||||
@@ -144,11 +124,12 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumSet<EnumPlantType> getPlantType() {
|
public EnumPlantType getPlantType() {
|
||||||
return EnumSet.of(EnumPlantType.Plains);
|
return EnumPlantType.Plains;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Nullable
|
||||||
public IIndividual getPollen() {
|
public IIndividual getPollen() {
|
||||||
return this.getFlower();
|
return this.getFlower();
|
||||||
}
|
}
|
||||||
@@ -165,17 +146,18 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
|||||||
}
|
}
|
||||||
final IAlleleFlowerSpecies primary = (IAlleleFlowerSpecies) individual.getGenome().getPrimary();
|
final IAlleleFlowerSpecies primary = (IAlleleFlowerSpecies) individual.getGenome().getPrimary();
|
||||||
final IAlleleFlowerSpecies primary2 = this.getFlower().getGenome().getPrimary();
|
final IAlleleFlowerSpecies primary2 = this.getFlower().getGenome().getPrimary();
|
||||||
if (primary == primary2 || this.worldObj.rand.nextInt(4) == 0) {
|
if (primary == primary2 || this.world.rand.nextInt(4) == 0) {
|
||||||
this.getFlower().mate((IFlower) individual);
|
this.getFlower().mate((IFlower) individual);
|
||||||
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
world.markBlockRangeForRenderUpdate(pos, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public IFlower getFlower() {
|
public IFlower getFlower() {
|
||||||
if (this.getSection() <= 0) {
|
if (this.getSection() <= 0) {
|
||||||
return this.flower;
|
return this.flower;
|
||||||
}
|
}
|
||||||
final TileEntity tile = this.worldObj.getTileEntity(this.xCoord, this.yCoord - this.getSection(), this.zCoord);
|
TileEntity tile = this.world.getTileEntity(pos.down(getSection()));
|
||||||
if (tile instanceof TileEntityFlower) {
|
if (tile instanceof TileEntityFlower) {
|
||||||
return ((TileEntityFlower) tile).getFlower();
|
return ((TileEntityFlower) tile).getFlower();
|
||||||
}
|
}
|
||||||
@@ -183,12 +165,12 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBreeding() {
|
public boolean isBreeding() {
|
||||||
final Block roots = this.getWorldObj().getBlock(this.xCoord, this.yCoord - 1, this.zCoord);
|
final Block roots = this.getWorld().getBlockState(getPos().down()).getBlock();
|
||||||
return Gardening.isSoil(roots);
|
return BotanyCore.getGardening().isSoil(roots);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void randomUpdate(final Random rand) {
|
public void randomUpdate(final Random rand) {
|
||||||
if (this.worldObj.getBlock(this.xCoord, this.yCoord, this.zCoord) != Botany.flower) {
|
if (this.world.getBlockState(pos).getBlock() != Botany.flower) {
|
||||||
this.invalidate();
|
this.invalidate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -205,23 +187,23 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
|||||||
if (!this.isBreeding()) {
|
if (!this.isBreeding()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
float light = this.worldObj.getBlockLightValue(this.xCoord, this.yCoord, this.zCoord);
|
float light = this.world.getLight(pos);
|
||||||
if (light < 6.0f) {
|
if (light < 6.0f) {
|
||||||
for (int dx = -2; dx <= 2; ++dx) {
|
for (int dx = -2; dx <= 2; ++dx) {
|
||||||
for (int dy = -2; dy <= 2; ++dy) {
|
for (int dy = -2; dy <= 2; ++dy) {
|
||||||
light -= (this.worldObj.canBlockSeeTheSky(this.xCoord, this.yCoord, this.zCoord) ? 0.0f : 0.5f);
|
light -= (this.world.canBlockSeeSky(pos) ? 0.0f : 0.5f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final boolean canTolerate = Gardening.canTolerate(this.getFlower(), this.worldObj, this.xCoord, this.yCoord, this.zCoord);
|
IGardeningManager gardening = BotanyCore.getGardening();
|
||||||
final EnumSoilType soil = Gardening.getSoilType(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
|
final boolean canTolerate = gardening.canTolerate(this.getFlower(), this.world, pos);
|
||||||
|
final EnumSoilType soil = gardening.getSoilType(this.world, pos.down());
|
||||||
if (rand.nextFloat() < this.getFlower().getGenome().getAgeChance()) {
|
if (rand.nextFloat() < this.getFlower().getGenome().getAgeChance()) {
|
||||||
if (this.flower.getAge() < 1) {
|
if (this.flower.getAge() < 1) {
|
||||||
if (canTolerate && light > 6.0f) {
|
if (canTolerate && light > 6.0f) {
|
||||||
this.doFlowerAge();
|
this.doFlowerAge();
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
this.doFlowerAge();
|
this.doFlowerAge();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -238,8 +220,7 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
|||||||
}
|
}
|
||||||
if (!canTolerate || light < 1.0f) {
|
if (!canTolerate || light < 1.0f) {
|
||||||
this.flower.setWilted(true);
|
this.flower.setWilted(true);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
this.flower.setWilted(false);
|
this.flower.setWilted(false);
|
||||||
}
|
}
|
||||||
float CHANCE_DISPERSAL = 0.8f;
|
float CHANCE_DISPERSAL = 0.8f;
|
||||||
@@ -249,7 +230,7 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
|||||||
CHANCE_POLLINATE += 0.25f * this.flower.getGenome().getFertility();
|
CHANCE_POLLINATE += 0.25f * this.flower.getGenome().getFertility();
|
||||||
CHANCE_POLLINATE *= 1.0f + soil.ordinal() * 0.5f;
|
CHANCE_POLLINATE *= 1.0f + soil.ordinal() * 0.5f;
|
||||||
final float CHANCE_SELFPOLLINATE = 0.2f * CHANCE_POLLINATE;
|
final float CHANCE_SELFPOLLINATE = 0.2f * CHANCE_POLLINATE;
|
||||||
if (this.worldObj.rand.nextFloat() < CHANCE_DISPERSAL && this.flower.hasFlowered() && !this.flower.isWilted()) {
|
if (this.world.rand.nextFloat() < CHANCE_DISPERSAL && this.flower.hasFlowered() && !this.flower.isWilted()) {
|
||||||
final IFlowerGenome mate = this.flower.getMate();
|
final IFlowerGenome mate = this.flower.getMate();
|
||||||
if (mate != null) {
|
if (mate != null) {
|
||||||
boolean dispersed = false;
|
boolean dispersed = false;
|
||||||
@@ -258,12 +239,12 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
|||||||
int dz;
|
int dz;
|
||||||
for (dx2 = 0, dz = 0; dx2 == 0 && dz == 0; dx2 = rand.nextInt(3) - 1, dz = rand.nextInt(3) - 1) {
|
for (dx2 = 0, dz = 0; dx2 == 0 && dz == 0; dx2 = rand.nextInt(3) - 1, dz = rand.nextInt(3) - 1) {
|
||||||
}
|
}
|
||||||
final Block b = this.getWorldObj().getBlock(this.xCoord + dx2, this.yCoord, this.zCoord + dz);
|
|
||||||
final Block b2 = this.getWorldObj().getBlock(this.xCoord + dx2, this.yCoord - 1, this.zCoord + dz);
|
final Block b2 = world.getBlockState(pos.add(dx2, -1, dz)).getBlock();
|
||||||
if (b == Blocks.air && Gardening.isSoil(b2)) {
|
if (world.isAirBlock(pos.add(dx2, 0, dz)) && BotanyCore.getGardening().isSoil(b2)) {
|
||||||
final IFlower offspring = this.flower.getOffspring(this.getWorldObj());
|
final IFlower offspring = this.flower.getOffspring(world, pos);
|
||||||
if (offspring != null) {
|
if (offspring != null) {
|
||||||
Gardening.plant(this.getWorldObj(), this.xCoord + dx2, this.yCoord, this.zCoord + dz, offspring, this.getOwner());
|
BotanyCore.getFlowerRoot().plant(world, pos.add(dx2, 0, dz), offspring, this.getOwner());
|
||||||
this.flower.removeMate();
|
this.flower.removeMate();
|
||||||
dispersed = true;
|
dispersed = true;
|
||||||
}
|
}
|
||||||
@@ -271,19 +252,19 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.worldObj.rand.nextFloat() < CHANCE_POLLINATE && this.flower.hasFlowered() && !this.flower.isWilted()) {
|
if (this.world.rand.nextFloat() < CHANCE_POLLINATE && this.flower.hasFlowered() && !this.flower.isWilted()) {
|
||||||
for (int a2 = 0; a2 < 4; ++a2) {
|
for (int a2 = 0; a2 < 4; ++a2) {
|
||||||
int dx3;
|
int dx3;
|
||||||
int dz2;
|
int dz2;
|
||||||
for (dx3 = 0, dz2 = 0; dx3 == 0 && dz2 == 0; dx3 = rand.nextInt(5) - 2, dz2 = rand.nextInt(5) - 2) {
|
for (dx3 = 0, dz2 = 0; dx3 == 0 && dz2 == 0; dx3 = rand.nextInt(5) - 2, dz2 = rand.nextInt(5) - 2) {
|
||||||
}
|
}
|
||||||
final TileEntity tile = this.getWorldObj().getTileEntity(this.xCoord + dx3, this.yCoord, this.zCoord + dz2);
|
final TileEntity tile = world.getTileEntity(pos.add(dx3, 0, dz2));
|
||||||
if (tile instanceof IPollinatable && ((IPollinatable) tile).canMateWith(this.getFlower())) {
|
if (tile instanceof IPollinatable && ((IPollinatable) tile).canMateWith(this.getFlower())) {
|
||||||
((IPollinatable) tile).mateWith(this.getFlower());
|
((IPollinatable) tile).mateWith(this.getFlower());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.worldObj.rand.nextFloat() < CHANCE_SELFPOLLINATE && this.flower.hasFlowered() && this.flower.getMate() == null) {
|
if (this.world.rand.nextFloat() < CHANCE_SELFPOLLINATE && this.flower.hasFlowered() && this.flower.getMate() == null) {
|
||||||
this.mateWith(this.getFlower());
|
this.mateWith(this.getFlower());
|
||||||
}
|
}
|
||||||
this.spawnButterflies();
|
this.spawnButterflies();
|
||||||
@@ -295,19 +276,64 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
|||||||
private void doFlowerAge() {
|
private void doFlowerAge() {
|
||||||
this.getFlower().age();
|
this.getFlower().age();
|
||||||
if (this.getFlower().getAge() == 1) {
|
if (this.getFlower().getAge() == 1) {
|
||||||
Gardening.onGrowFromSeed(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
|
IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot();
|
||||||
|
flowerRoot.onGrowFromSeed(this.world, pos);
|
||||||
if (this.getOwner() != null && this.getFlower() != null) {
|
if (this.getOwner() != null && this.getFlower() != null) {
|
||||||
BotanyCore.getFlowerRoot().getBreedingTracker(this.getWorldObj(), this.getOwner()).registerBirth(this.getFlower());
|
flowerRoot.getBreedingTracker(world, this.getOwner()).registerBirth(this.getFlower());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private NBTTagCompound writeRenderInfo(NBTTagCompound tag){
|
||||||
|
if(renderInfo!=null){
|
||||||
|
NBTTagCompound nbtRenderInfo = new NBTTagCompound();
|
||||||
|
nbtRenderInfo.setByte("primary",(byte)this.renderInfo.primary.getID());
|
||||||
|
nbtRenderInfo.setByte("secondary",(byte)this.renderInfo.secondary.getID());
|
||||||
|
nbtRenderInfo.setByte("stem",(byte)this.renderInfo.stem.getID());
|
||||||
|
nbtRenderInfo.setByte("type",(byte)this.renderInfo.type.ordinal());
|
||||||
|
nbtRenderInfo.setByte("age",this.renderInfo.age);
|
||||||
|
nbtRenderInfo.setByte("section",this.renderInfo.section);
|
||||||
|
nbtRenderInfo.setBoolean("wilted",this.renderInfo.wilted);
|
||||||
|
nbtRenderInfo.setBoolean("flowered",this.renderInfo.flowered);
|
||||||
|
tag.setTag("renderinfo", nbtRenderInfo);
|
||||||
|
}
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void readRenderInfo(NBTTagCompound tag){
|
||||||
|
if(tag.hasKey("renderinfo")){
|
||||||
|
NBTTagCompound infotag = tag.getCompoundTag("renderinfo");
|
||||||
|
RenderInfo info = new RenderInfo();
|
||||||
|
info.primary = EnumFlowerColor.values()[infotag.getByte("primary")].getFlowerColorAllele();
|
||||||
|
info.secondary = EnumFlowerColor.values()[infotag.getByte("secondary")].getFlowerColorAllele();
|
||||||
|
info.stem = EnumFlowerColor.values()[infotag.getByte("stem")].getFlowerColorAllele();
|
||||||
|
info.type = EnumFlowerType.values()[infotag.getByte("type")];
|
||||||
|
info.age = infotag.getByte("age");
|
||||||
|
info.section = infotag.getByte("section");
|
||||||
|
info.wilted = infotag.getBoolean("wilted");
|
||||||
|
info.flowered = infotag.getBoolean("flowered");
|
||||||
|
setRender(info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Packet getDescriptionPacket() {
|
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) {
|
||||||
|
super.onDataPacket(net, pkt);
|
||||||
|
readRenderInfo(pkt.getNbtCompound());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NBTTagCompound getUpdateTag() {
|
||||||
|
updateRender(true);
|
||||||
|
return writeRenderInfo(super.getUpdateTag());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SPacketUpdateTileEntity getUpdatePacket() {
|
||||||
if (this.renderInfo == null && this.getFlower() != null && this.getFlower().getGenome() != null) {
|
if (this.renderInfo == null && this.getFlower() != null && this.getFlower().getGenome() != null) {
|
||||||
this.renderInfo = new RenderInfo(this.getFlower(), this);
|
this.renderInfo = new RenderInfo(this.getFlower(), this);
|
||||||
}
|
}
|
||||||
return (this.renderInfo != null) ? Botany.instance.getNetworkWrapper().getPacketFrom(new MessageFlowerUpdate(this.xCoord, this.yCoord, this.zCoord, this.renderInfo).GetMessage()) : null;
|
return (this.renderInfo != null) ? new SPacketUpdateTileEntity(pos, 0, getUpdateTag()) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateRender(final boolean update) {
|
public void updateRender(final boolean update) {
|
||||||
@@ -317,7 +343,7 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
|||||||
this.setRender(newInfo);
|
this.setRender(newInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final TileEntity above = this.worldObj.getTileEntity(this.xCoord, this.yCoord + 1, this.zCoord);
|
final TileEntity above = this.world.getTileEntity(pos.up());
|
||||||
if (above instanceof TileEntityFlower) {
|
if (above instanceof TileEntityFlower) {
|
||||||
((TileEntityFlower) above).updateRender(true);
|
((TileEntityFlower) above).updateRender(true);
|
||||||
}
|
}
|
||||||
@@ -329,23 +355,25 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
|||||||
|
|
||||||
public void setSection(final int i) {
|
public void setSection(final int i) {
|
||||||
this.section = i;
|
this.section = i;
|
||||||
if (BinnieCore.proxy.isSimulating(this.worldObj)) {
|
if (BinnieCore.getBinnieProxy().isSimulating(this.world)) {
|
||||||
this.updateRender(true);
|
this.updateRender(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getItemStack() {
|
public ItemStack getItemStack() {
|
||||||
if (this.flower == null) {
|
IFlower flower = this.getFlower();
|
||||||
return null;
|
if (flower == null) {
|
||||||
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
return Binnie.Genetics.getFlowerRoot().getMemberStack(this.getFlower(), (this.flower.getAge() == 0) ? EnumFlowerStage.SEED.ordinal() : EnumFlowerStage.FLOWER.ordinal());
|
return Binnie.GENETICS.getFlowerRoot().getMemberStack(flower, EnumFlowerStage.getStage(flower));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
private TileEntityFlower getRoot() {
|
private TileEntityFlower getRoot() {
|
||||||
if (this.getSection() == 0) {
|
if (this.getSection() == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final TileEntity tile = this.worldObj.getTileEntity(this.xCoord, this.yCoord - this.getSection(), this.zCoord);
|
final TileEntity tile = this.world.getTileEntity(pos.down(getSection()));
|
||||||
return (tile instanceof TileEntityFlower) ? ((TileEntityFlower) tile) : null;
|
return (tile instanceof TileEntityFlower) ? ((TileEntityFlower) tile) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -357,14 +385,14 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
|||||||
final Random rand = new Random();
|
final Random rand = new Random();
|
||||||
final IFlower cutting = (IFlower) this.getFlower().copy();
|
final IFlower cutting = (IFlower) this.getFlower().copy();
|
||||||
cutting.setAge(0);
|
cutting.setAge(0);
|
||||||
final ItemStack cuttingStack = BotanyCore.getFlowerRoot().getMemberStack(cutting, EnumFlowerStage.SEED.ordinal());
|
final ItemStack cuttingStack = BotanyCore.getFlowerRoot().getMemberStack(cutting, EnumFlowerStage.SEED);
|
||||||
final float f = 0.7f;
|
final float f = 0.7f;
|
||||||
final double d = rand.nextFloat() * f + (1.0f - f) * 0.5;
|
final double d = rand.nextFloat() * f + (1.0f - f) * 0.5;
|
||||||
final double d2 = rand.nextFloat() * f + (1.0f - f) * 0.5;
|
final double d2 = rand.nextFloat() * f + (1.0f - f) * 0.5;
|
||||||
final double d3 = rand.nextFloat() * f + (1.0f - f) * 0.5;
|
final double d3 = rand.nextFloat() * f + (1.0f - f) * 0.5;
|
||||||
final EntityItem entityitem = new EntityItem(this.worldObj, this.xCoord + d, this.yCoord + d2, this.zCoord + d3, cuttingStack);
|
final EntityItem entityitem = new EntityItem(this.world, pos.getX() + d, pos.getY() + d2, pos.getZ() + d3, cuttingStack);
|
||||||
entityitem.delayBeforeCanPickup = 10;
|
entityitem.setPickupDelay(10);
|
||||||
this.worldObj.spawnEntityInWorld(entityitem);
|
this.world.spawnEntity(entityitem);
|
||||||
for (int maxAge = this.getFlower().getMaxAge(), i = 0; i < maxAge; ++i) {
|
for (int maxAge = this.getFlower().getMaxAge(), i = 0; i < maxAge; ++i) {
|
||||||
if (rand.nextBoolean()) {
|
if (rand.nextBoolean()) {
|
||||||
this.getFlower().age();
|
this.getFlower().age();
|
||||||
@@ -380,19 +408,18 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
|||||||
if (this.getSection() != 0) {
|
if (this.getSection() != 0) {
|
||||||
return this.getRoot().checkIfDead(wasCut);
|
return this.getRoot().checkIfDead(wasCut);
|
||||||
}
|
}
|
||||||
final EnumSoilType soil = Gardening.getSoilType(this.worldObj, this.xCoord, this.yCoord, this.zCoord);
|
final EnumSoilType soil = BotanyCore.getGardening().getSoilType(this.world, pos);
|
||||||
final int maxAge = (int) (this.flower.getMaxAge() * (1.0f + soil.ordinal() * 0.25f));
|
final int maxAge = (int) (this.flower.getMaxAge() * (1.0f + soil.ordinal() * 0.25f));
|
||||||
if (this.flower.getAge() > maxAge) {
|
if (this.flower.getAge() > maxAge) {
|
||||||
if (!wasCut && this.flower.getMate() != null) {
|
if (!wasCut && this.flower.getMate() != null) {
|
||||||
this.worldObj.setBlockToAir(this.xCoord, this.yCoord, this.zCoord);
|
this.world.setBlockToAir(pos);
|
||||||
final IFlower offspring = this.flower.getOffspring(this.getWorldObj());
|
final IFlower offspring = this.flower.getOffspring(this.world, pos.down());
|
||||||
final TileEntity above = this.worldObj.getTileEntity(this.xCoord, this.yCoord + 1, this.zCoord);
|
final TileEntity above = this.world.getTileEntity(pos.up());
|
||||||
if (above instanceof TileEntityFlower) {
|
if (above instanceof TileEntityFlower) {
|
||||||
this.worldObj.setBlockToAir(this.xCoord, this.yCoord + 1, this.zCoord);
|
this.world.setBlockToAir(pos.up());
|
||||||
}
|
}
|
||||||
Gardening.plant(this.worldObj, this.xCoord, this.yCoord, this.zCoord, offspring, this.getOwner());
|
BotanyCore.getFlowerRoot().plant(this.world, pos, offspring, this.getOwner());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
this.kill();
|
this.kill();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -402,13 +429,12 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
|||||||
|
|
||||||
public void kill() {
|
public void kill() {
|
||||||
if (this.flower.getAge() > 0) {
|
if (this.flower.getAge() > 0) {
|
||||||
this.worldObj.setBlock(this.xCoord, this.yCoord, this.zCoord, Botany.plant, BlockPlant.Type.DeadFlower.ordinal(), 2);
|
this.world.setBlockState(pos, Botany.plant.getStateFromMeta(BlockPlant.Type.DeadFlower.ordinal()), 2);
|
||||||
|
} else {
|
||||||
|
this.world.setBlockToAir(pos);
|
||||||
}
|
}
|
||||||
else {
|
for (int i = 1; this.world.getTileEntity(pos.up(i)) instanceof TileEntityFlower; ++i) {
|
||||||
this.worldObj.setBlockToAir(this.xCoord, this.yCoord, this.zCoord);
|
this.world.setBlockToAir(pos.up(i));
|
||||||
}
|
|
||||||
for (int i = 1; this.worldObj.getTileEntity(this.xCoord, this.yCoord + i, this.zCoord) instanceof TileEntityFlower; ++i) {
|
|
||||||
this.worldObj.setBlockToAir(this.xCoord, this.yCoord + i, this.zCoord);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -422,7 +448,7 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
|||||||
if (this.getFlower().isWilted()) {
|
if (this.getFlower().isWilted()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.doFlowerAge();
|
//this.doFlowerAge();
|
||||||
if (this.getFlower().getAge() > 1 && !this.getFlower().hasFlowered()) {
|
if (this.getFlower().getAge() > 1 && !this.getFlower().hasFlowered()) {
|
||||||
this.getFlower().setFlowered(true);
|
this.getFlower().setFlowered(true);
|
||||||
}
|
}
|
||||||
@@ -431,6 +457,7 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public GameProfile getOwner() {
|
public GameProfile getOwner() {
|
||||||
return this.owner;
|
return this.owner;
|
||||||
}
|
}
|
||||||
@@ -440,7 +467,7 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void spawnButterflies() {
|
public void spawnButterflies() {
|
||||||
if (!BinnieCore.isLepidopteryActive()) {
|
/*if (!BinnieCore.isLepidopteryActive()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final int x = this.xCoord;
|
final int x = this.xCoord;
|
||||||
@@ -480,12 +507,12 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
|||||||
}
|
}
|
||||||
else if (world.isAirBlock(x, y, z + 1)) {
|
else if (world.isAirBlock(x, y, z + 1)) {
|
||||||
this.attemptButterflySpawn(world, spawn, x, y, z + 1);
|
this.attemptButterflySpawn(world, spawn, x, y, z + 1);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private void attemptButterflySpawn(final World world, final IButterfly butterfly, final double x, final double y, final double z) {
|
private void attemptButterflySpawn(final World world, final IButterfly butterfly, final double x, final double y, final double z) {
|
||||||
if (BinnieCore.isLepidopteryActive()) {
|
if (BinnieCore.isLepidopteryActive()) {
|
||||||
Binnie.Genetics.getButterflyRoot().spawnButterflyInWorld(world, butterfly.copy(), x, y + 0.10000000149011612, z);
|
Binnie.GENETICS.getButterflyRoot().spawnButterflyInWorld(world, butterfly.copy(), x, y + 0.10000000149011612, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -493,32 +520,14 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
|||||||
return this.getOwner();
|
return this.getOwner();
|
||||||
}
|
}
|
||||||
|
|
||||||
public World getWorld() {
|
@Override
|
||||||
return this.getWorldObj();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getXCoord() {
|
|
||||||
return this.xCoord;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getYCoord() {
|
|
||||||
return this.yCoord;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getZCoord() {
|
|
||||||
return this.zCoord;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getBiomeId() {
|
|
||||||
return this.worldObj.getBiomeGenForCoords(this.xCoord, this.zCoord).biomeID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public EnumTemperature getTemperature() {
|
public EnumTemperature getTemperature() {
|
||||||
return EnumTemperature.getFromValue(this.worldObj.getBiomeGenForCoords(this.xCoord, this.zCoord).temperature);
|
return EnumTemperature.getFromValue(this.world.getBiome(getPos()).getTemperature());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EnumHumidity getHumidity() {
|
public EnumHumidity getHumidity() {
|
||||||
return EnumHumidity.getFromValue(this.worldObj.getBiomeGenForCoords(this.xCoord, this.zCoord).rainfall);
|
return EnumHumidity.getFromValue(this.world.getBiome(getPos()).getRainfall());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setErrorState(final int state) {
|
public void setErrorState(final int state) {
|
||||||
@@ -533,31 +542,33 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Nullable
|
||||||
public IButterfly getCaterpillar() {
|
public IButterfly getCaterpillar() {
|
||||||
return this.caterpillar;
|
return this.caterpillar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCaterpillar(@Nullable final IButterfly butterfly) {
|
||||||
|
this.caterpillar = butterfly;
|
||||||
|
this.matureTime = 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIndividual getNanny() {
|
public IIndividual getNanny() {
|
||||||
return this.getFlower();
|
return this.getFlower();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setCaterpillar(final IButterfly butterfly) {
|
|
||||||
this.caterpillar = butterfly;
|
|
||||||
this.matureTime = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canNurse(final IButterfly butterfly) {
|
public boolean canNurse(final IButterfly butterfly) {
|
||||||
return this.getFlower() != null && !this.getFlower().isWilted() && this.getFlower().getAge() > 1;
|
return this.getFlower() != null && !this.getFlower().isWilted() && this.getFlower().getAge() > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void matureCaterpillar() {
|
private void matureCaterpillar() {
|
||||||
if (this.getCaterpillar() == null) {
|
//TODO Spawn the caterpillar in a cocon on the next Tree or other thing
|
||||||
|
/*if (this.getCaterpillar() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
++this.matureTime;
|
++this.matureTime;
|
||||||
if (this.matureTime >= this.caterpillar.getGenome().getLifespan() / (this.caterpillar.getGenome().getFertility() * 2) && this.caterpillar.canTakeFlight(this.worldObj, this.xCoord, this.yCoord, this.zCoord)) {
|
if (this.matureTime >= this.caterpillar.getGenome().getLifespan() / (this.caterpillar.getGenome().getFertility() * 2) && this.caterpillar.canTakeFlight(this.worldObj, this.xCoord, this.yCoord, this.zCoord)) {
|
||||||
if (this.worldObj.isAirBlock(this.xCoord, this.yCoord + 1, this.zCoord)) {
|
if (this.worldObj.isAirBlock(this.xCoord, this.yCoord + 1, this.zCoord)) {
|
||||||
this.attemptButterflySpawn(this.worldObj, this.caterpillar, this.xCoord, this.yCoord + 1, this.zCoord);
|
this.attemptButterflySpawn(this.worldObj, this.caterpillar, this.xCoord, this.yCoord + 1, this.zCoord);
|
||||||
@@ -575,13 +586,18 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
|||||||
this.attemptButterflySpawn(this.worldObj, this.caterpillar, this.xCoord, this.yCoord, this.zCoord + 1);
|
this.attemptButterflySpawn(this.worldObj, this.caterpillar, this.xCoord, this.yCoord, this.zCoord + 1);
|
||||||
}
|
}
|
||||||
this.setCaterpillar(null);
|
this.setCaterpillar(null);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRender(final RenderInfo render) {
|
public void setRender(final RenderInfo render) {
|
||||||
this.renderInfo = render;
|
this.renderInfo = render;
|
||||||
this.section = this.renderInfo.section;
|
this.section = this.renderInfo.section;
|
||||||
this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
|
if (!world.isRemote) {
|
||||||
|
IBlockState blockState = world.getBlockState(pos);
|
||||||
|
world.notifyBlockUpdate(pos, blockState, blockState, 0);
|
||||||
|
} else {
|
||||||
|
world.markBlockRangeForRenderUpdate(pos, pos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getAge() {
|
public int getAge() {
|
||||||
@@ -601,42 +617,58 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getPrimaryColour() {
|
public int getPrimaryColour() {
|
||||||
return (this.renderInfo == null) ? EnumFlowerColor.Red.getColor(false) : this.renderInfo.primary.getColor(this.isWilted());
|
return (this.renderInfo == null) ? EnumFlowerColor.Red.getFlowerColorAllele().getColor(false) : this.renderInfo.primary.getColor(this.isWilted());
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSecondaryColour() {
|
public int getSecondaryColour() {
|
||||||
return (this.renderInfo == null) ? EnumFlowerColor.Red.getColor(false) : this.renderInfo.secondary.getColor(this.isWilted());
|
return (this.renderInfo == null) ? EnumFlowerColor.Red.getFlowerColorAllele().getColor(false) : this.renderInfo.secondary.getColor(this.isWilted());
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getStemColour() {
|
public int getStemColour() {
|
||||||
return (this.renderInfo == null) ? EnumFlowerColor.Green.getColor(false) : this.renderInfo.stem.getColor(this.isWilted());
|
return (this.renderInfo == null) ? EnumFlowerColor.Green.getFlowerColorAllele().getColor(false) : this.renderInfo.stem.getColor(this.isWilted());
|
||||||
}
|
}
|
||||||
|
|
||||||
public IFlowerType getType() {
|
public IFlowerType getType() {
|
||||||
return (this.renderInfo == null) ? EnumFlowerType.Poppy : this.renderInfo.type;
|
return (this.renderInfo == null) ? EnumFlowerType.Poppy : this.renderInfo.type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BiomeGenBase getBiome() {
|
@Override
|
||||||
return this.getWorld().getBiomeGenForCoords(this.xCoord, this.zCoord);
|
public Biome getBiome() {
|
||||||
|
return this.getWorld().getBiome(getPos());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public IErrorState getErrorState() {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setErrorState(final IErrorState state) {
|
public void setErrorState(final IErrorState state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IErrorState getErrorState() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean setErrorCondition(final boolean condition, final IErrorState errorState) {
|
public boolean setErrorCondition(final boolean condition, final IErrorState errorState) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<IErrorState> getErrorStates() {
|
public Set<IErrorState> getErrorStates() {
|
||||||
return new HashSet<IErrorState>();
|
return new HashSet<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class RenderInfo
|
@Override
|
||||||
{
|
public BlockPos getCoordinates() {
|
||||||
|
return getPos();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isPollinated() {
|
||||||
|
return isBreeding();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public World getWorldObj() {
|
||||||
|
return world;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class RenderInfo {
|
||||||
public IFlowerColour primary;
|
public IFlowerColour primary;
|
||||||
public IFlowerColour secondary;
|
public IFlowerColour secondary;
|
||||||
public IFlowerColour stem;
|
public IFlowerColour stem;
|
||||||
@@ -646,15 +678,6 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
|||||||
public boolean flowered;
|
public boolean flowered;
|
||||||
public byte section;
|
public byte section;
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(final Object obj) {
|
|
||||||
if (obj instanceof RenderInfo) {
|
|
||||||
final RenderInfo o = (RenderInfo) obj;
|
|
||||||
return o.age == this.age && o.wilted == this.wilted && o.flowered == this.flowered && o.primary == this.primary && o.secondary == this.secondary && o.stem == this.stem && o.type == this.type;
|
|
||||||
}
|
|
||||||
return super.equals(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
public RenderInfo() {
|
public RenderInfo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -668,17 +691,14 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
|||||||
this.flowered = flower.hasFlowered();
|
this.flowered = flower.hasFlowered();
|
||||||
this.type = flower.getGenome().getType();
|
this.type = flower.getGenome().getType();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChunkCoordinates getCoordinates() {
|
public boolean equals(final Object obj) {
|
||||||
return new ChunkCoordinates(xCoord, yCoord, zCoord);
|
if (obj instanceof RenderInfo) {
|
||||||
|
final RenderInfo o = (RenderInfo) obj;
|
||||||
|
return o.age == this.age && o.wilted == this.wilted && o.flowered == this.flowered && o.primary == this.primary && o.secondary == this.secondary && o.stem == this.stem && o.type == this.type;
|
||||||
|
}
|
||||||
|
return super.equals(obj);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO ??
|
|
||||||
@Override
|
|
||||||
public boolean isPollinated() {
|
|
||||||
return isBreeding();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
@ParametersAreNonnullByDefault
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@FieldsAreNonnullByDefault
|
||||||
|
package binnie.botany.flower;
|
||||||
|
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
|
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||||
|
import mcp.MethodsReturnNonnullByDefault;
|
||||||
@@ -1,156 +1,187 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.gardening;
|
package binnie.botany.gardening;
|
||||||
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
import java.util.ArrayList;
|
||||||
import binnie.botany.api.EnumSoilType;
|
|
||||||
import binnie.botany.api.gardening.IBlockSoil;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockBush;
|
||||||
|
import net.minecraft.block.SoundType;
|
||||||
|
import net.minecraft.block.properties.PropertyEnum;
|
||||||
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import binnie.botany.CreativeTabBotany;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import binnie.botany.Botany;
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import java.util.ArrayList;
|
import net.minecraft.util.IStringSerializable;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.block.BlockBush;
|
|
||||||
|
|
||||||
public class BlockPlant extends BlockBush
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
{
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
@Override
|
|
||||||
public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int metadata, final int fortune) {
|
|
||||||
return new ArrayList<ItemStack>();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
import forestry.api.core.IItemModelRegister;
|
||||||
@SideOnly(Side.CLIENT)
|
import forestry.api.core.IModelManager;
|
||||||
public void registerBlockIcons(final IIconRegister p_149651_1_) {
|
|
||||||
for (final Type t : Type.values()) {
|
import binnie.botany.Botany;
|
||||||
t.icon = Botany.proxy.getIcon(p_149651_1_, t.name().toLowerCase());
|
import binnie.botany.CreativeTabBotany;
|
||||||
}
|
import binnie.botany.api.EnumSoilType;
|
||||||
}
|
import binnie.botany.api.IBlockSoil;
|
||||||
|
import binnie.botany.core.BotanyCore;
|
||||||
|
|
||||||
|
public class BlockPlant extends BlockBush implements IItemModelRegister {
|
||||||
|
public static final PropertyEnum<Type> PLANT_TYPE = PropertyEnum.create("plant_type", Type.class);
|
||||||
|
|
||||||
public BlockPlant() {
|
public BlockPlant() {
|
||||||
this.setBlockName("plant");
|
this.setRegistryName("plant");
|
||||||
this.setCreativeTab(CreativeTabBotany.instance);
|
this.setCreativeTab(CreativeTabBotany.instance);
|
||||||
this.setTickRandomly(true);
|
this.setTickRandomly(true);
|
||||||
|
this.setSoundType(SoundType.PLANT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public static boolean isWeed(IBlockAccess world, BlockPos pos) {
|
||||||
protected boolean canPlaceBlockOn(final Block p_149854_1_) {
|
IBlockState blockState = world.getBlockState(pos);
|
||||||
return super.canPlaceBlockOn(p_149854_1_) || Gardening.isSoil(p_149854_1_);
|
if (!(blockState.getBlock() instanceof BlockPlant)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Type type = blockState.getValue(PLANT_TYPE);
|
||||||
|
return type.isWeed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(final int side, final int meta) {
|
public void registerModel(Item item, IModelManager manager) {
|
||||||
return Type.values()[meta % Type.values().length].icon;
|
int index = 0;
|
||||||
}
|
for (Type type : Type.values()) {
|
||||||
|
manager.registerItemModel(item, index, type.getName());
|
||||||
@Override
|
index++;
|
||||||
public int damageDropped(final int p_149692_1_) {
|
|
||||||
return p_149692_1_;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void getSubBlocks(final Item p_149666_1_, final CreativeTabs p_149666_2_, final List p_149666_3_) {
|
|
||||||
for (final Type type : Type.values()) {
|
|
||||||
p_149666_3_.add(type.get());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateTick(final World world, final int x, final int y, final int z, final Random random) {
|
protected BlockStateContainer createBlockState() {
|
||||||
final Type type = Type.get(world.getBlockMetadata(x, y, z));
|
return new BlockStateContainer(this, PLANT_TYPE);
|
||||||
if (random.nextInt(4) == 0) {
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMetaFromState(IBlockState state) {
|
||||||
|
return state.getValue(PLANT_TYPE).ordinal();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
|
return getDefaultState().withProperty(PLANT_TYPE, Type.values()[meta]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canPlaceBlockAt(World worldIn, BlockPos pos) {
|
||||||
|
return super.canPlaceBlockAt(worldIn, pos) || BotanyCore.getGardening().isSoil(worldIn.getBlockState(pos).getBlock());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int damageDropped(IBlockState state) {
|
||||||
|
return getMetaFromState(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void getSubBlocks(final Item p_149666_1_, final CreativeTabs p_149666_2_, final NonNullList<ItemStack> subBlocks) {
|
||||||
|
for (final Type type : Type.values()) {
|
||||||
|
subBlocks.add(type.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
|
||||||
|
final Type type = state.getValue(PLANT_TYPE);
|
||||||
|
if (rand.nextInt(4) == 0) {
|
||||||
if (type == Type.Weeds) {
|
if (type == Type.Weeds) {
|
||||||
world.setBlockMetadataWithNotify(x, y, z, Type.WeedsLong.ordinal(), 2);
|
world.setBlockState(pos, state.withProperty(PLANT_TYPE, Type.WeedsLong), 2);
|
||||||
}
|
} else if (type == Type.WeedsLong) {
|
||||||
else if (type == Type.WeedsLong) {
|
world.setBlockState(pos, state.withProperty(PLANT_TYPE, Type.WeedsVeryLong), 2);
|
||||||
world.setBlockMetadataWithNotify(x, y, z, Type.WeedsVeryLong.ordinal(), 2);
|
} else if (type == Type.DeadFlower) {
|
||||||
}
|
world.setBlockState(pos, state.withProperty(PLANT_TYPE, Type.DecayingFlower), 2);
|
||||||
else if (type == Type.DeadFlower) {
|
} else if (type == Type.DecayingFlower) {
|
||||||
world.setBlockMetadataWithNotify(x, y, z, Type.DecayingFlower.ordinal(), 2);
|
world.setBlockToAir(pos);
|
||||||
}
|
|
||||||
else if (type == Type.DecayingFlower) {
|
|
||||||
world.setBlockToAir(x, y, z);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (random.nextInt(6) == 0) {
|
if (rand.nextInt(6) == 0) {
|
||||||
if (type == Type.Weeds) {
|
if (type == Type.Weeds) {
|
||||||
world.setBlockToAir(x, y, z);
|
world.setBlockToAir(pos);
|
||||||
}
|
} else if (type == Type.WeedsLong) {
|
||||||
else if (type == Type.WeedsLong) {
|
world.setBlockState(pos, state.withProperty(PLANT_TYPE, Type.Weeds), 2);
|
||||||
world.setBlockMetadataWithNotify(x, y, z, Type.Weeds.ordinal(), 2);
|
} else if (type == Type.WeedsVeryLong) {
|
||||||
}
|
world.setBlockState(pos, state.withProperty(PLANT_TYPE, Type.WeedsLong), 2);
|
||||||
else if (type == Type.WeedsVeryLong) {
|
|
||||||
world.setBlockMetadataWithNotify(x, y, z, Type.WeedsLong.ordinal(), 2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final Block below = world.getBlock(x, y - 1, z);
|
Block below = world.getBlockState(pos.down()).getBlock();
|
||||||
if (Gardening.isSoil(below)) {
|
if (BotanyCore.getGardening().isSoil(below)) {
|
||||||
final IBlockSoil soil = (IBlockSoil) below;
|
IBlockSoil soil = (IBlockSoil) below;
|
||||||
if (random.nextInt(3) == 0) {
|
if(rand.nextInt(3) != 0){
|
||||||
if (type == Type.Weeds || type == Type.WeedsLong || type == Type.WeedsVeryLong) {
|
return;
|
||||||
if (!soil.degrade(world, x, y - 1, z, EnumSoilType.LOAM)) {
|
}
|
||||||
soil.degrade(world, x, y - 1, z, EnumSoilType.SOIL);
|
if (type.isWeed()) {
|
||||||
}
|
if (!soil.degrade(world, pos.down(), EnumSoilType.LOAM)) {
|
||||||
}
|
soil.degrade(world, pos.down(), EnumSoilType.SOIL);
|
||||||
else if (type == Type.DecayingFlower && !soil.fertilise(world, x, y - 1, z, EnumSoilType.LOAM)) {
|
|
||||||
soil.fertilise(world, x, y - 1, z, EnumSoilType.FLOWERBED);
|
|
||||||
}
|
}
|
||||||
|
} else if (type == Type.DecayingFlower && !soil.fertilise(world, pos.down(), EnumSoilType.LOAM)) {
|
||||||
|
soil.fertilise(world, pos.down(), EnumSoilType.FLOWERBED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isReplaceable(final IBlockAccess world, final int x, final int y, final int z) {
|
public boolean isReplaceable(IBlockAccess worldIn, BlockPos pos) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isWeed(final IBlockAccess world, final int x, final int y, final int z) {
|
@Override
|
||||||
if (!(world.getBlock(x, y, z) instanceof BlockPlant)) {
|
public EnumOffsetType getOffsetType() {
|
||||||
return false;
|
return EnumOffsetType.XZ;
|
||||||
}
|
|
||||||
final Type type = Type.get(world.getBlockMetadata(x, y, z));
|
|
||||||
return type == Type.Weeds || type == Type.WeedsLong || type == Type.WeedsVeryLong;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Type
|
public enum Type implements IStringSerializable {
|
||||||
{
|
Weeds("weeds", true),
|
||||||
Weeds("Weeds"),
|
WeedsLong("weeds_long", true),
|
||||||
WeedsLong("Long Weeds"),
|
WeedsVeryLong("weeds_very_long", true),
|
||||||
WeedsVeryLong("Very Long Weeds"),
|
DeadFlower("dead_flower"),
|
||||||
DeadFlower("Dead Flower"),
|
DecayingFlower("decaying_flower");
|
||||||
DecayingFlower("Decaying Flower");
|
|
||||||
|
|
||||||
public IIcon icon;
|
|
||||||
String name;
|
String name;
|
||||||
|
boolean isWeed;
|
||||||
private Type(final String name) {
|
|
||||||
|
Type(String name) {
|
||||||
|
this(name, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
Type(String name, boolean isWeed) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
this.isWeed = isWeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Type get(int id) {
|
||||||
|
return values()[id % values().length];
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack get() {
|
public ItemStack get() {
|
||||||
return new ItemStack(Botany.plant, 1, this.ordinal());
|
return new ItemStack(Botany.plant, 1, this.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Type get(final int id) {
|
public boolean isWeed(){
|
||||||
return values()[id % values().length];
|
return isWeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.name;
|
return name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,220 +1,310 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.gardening;
|
package binnie.botany.gardening;
|
||||||
|
|
||||||
import net.minecraftforge.common.IPlantable;
|
import javax.annotation.Nullable;
|
||||||
import binnie.Binnie;
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import net.minecraft.world.World;
|
|
||||||
import binnie.botany.CreativeTabBotany;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import binnie.botany.Botany;
|
import net.minecraft.block.properties.PropertyEnum;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
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.init.Blocks;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import net.minecraftforge.common.IPlantable;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import forestry.api.core.IItemModelRegister;
|
||||||
|
import forestry.api.core.IModelManager;
|
||||||
|
|
||||||
|
import binnie.botany.Botany;
|
||||||
|
import binnie.botany.CreativeTabBotany;
|
||||||
import binnie.botany.api.EnumAcidity;
|
import binnie.botany.api.EnumAcidity;
|
||||||
import binnie.botany.api.EnumMoisture;
|
import binnie.botany.api.EnumMoisture;
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import java.util.List;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import binnie.botany.api.EnumSoilType;
|
import binnie.botany.api.EnumSoilType;
|
||||||
import net.minecraft.util.IIcon;
|
import binnie.botany.api.IBlockSoil;
|
||||||
import binnie.botany.api.gardening.IBlockSoil;
|
import binnie.botany.core.BotanyCore;
|
||||||
import net.minecraft.block.Block;
|
import binnie.core.util.I18N;
|
||||||
|
|
||||||
public class BlockSoil extends Block implements IBlockSoil
|
public class BlockSoil extends Block implements IBlockSoil, IItemModelRegister {
|
||||||
{
|
public static final PropertyEnum<EnumMoisture> MOISTURE = PropertyEnum.create("moisture", EnumMoisture.class);
|
||||||
boolean weedKilled;
|
public static final PropertyEnum<EnumAcidity> ACIDITY = PropertyEnum.create("acidity", EnumAcidity.class);
|
||||||
IIcon[] iconsTop;
|
public static final AxisAlignedBB SOIL_BLOCK_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.9375D, 1.0D);
|
||||||
IIcon[] iconsSide;
|
private final boolean weedKilled;
|
||||||
IIcon[] iconsNoWeed;
|
private final EnumSoilType type;
|
||||||
EnumSoilType type;
|
|
||||||
|
|
||||||
@Override
|
public BlockSoil(EnumSoilType type, String blockName, boolean weedKilled) {
|
||||||
@SideOnly(Side.CLIENT)
|
super(Material.GROUND);
|
||||||
public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List par3List) {
|
|
||||||
for (int i = 0; i < 9; ++i) {
|
|
||||||
par3List.add(new ItemStack(this, 1, i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) {
|
|
||||||
return this.getIcon(side, world.getBlockMetadata(x, y, z));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public IIcon getIcon(final int side, int meta) {
|
|
||||||
meta = ((meta >= 9) ? 8 : meta);
|
|
||||||
final EnumMoisture moisture = EnumMoisture.values()[meta % 3];
|
|
||||||
final EnumAcidity acidity = EnumAcidity.values()[meta / 3];
|
|
||||||
return (side == 1) ? (this.weedKilled ? this.iconsNoWeed[meta] : this.iconsTop[meta]) : ((side == 0) ? Blocks.dirt.getIcon(side, 0) : this.iconsSide[meta]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void registerBlockIcons(final IIconRegister register) {
|
|
||||||
for (final EnumMoisture moisture : EnumMoisture.values()) {
|
|
||||||
for (final EnumAcidity pH : EnumAcidity.values()) {
|
|
||||||
this.iconsTop[moisture.ordinal() + pH.ordinal() * 3] = Botany.proxy.getIcon(register, "soil/" + this.getType().getID() + "." + pH.getID() + "." + moisture.getID() + ".0");
|
|
||||||
this.iconsSide[moisture.ordinal() + pH.ordinal() * 3] = Botany.proxy.getIcon(register, "soil/" + this.getType().getID() + "." + pH.getID() + "." + moisture.getID() + ".1");
|
|
||||||
this.iconsNoWeed[moisture.ordinal() + pH.ordinal() * 3] = Botany.proxy.getIcon(register, "soil/" + this.getType().getID() + "." + pH.getID() + "." + moisture.getID() + ".2");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public EnumSoilType getType() {
|
|
||||||
return this.type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BlockSoil(final EnumSoilType type, final String blockName, final boolean weedKilled) {
|
|
||||||
super(Material.ground);
|
|
||||||
this.weedKilled = false;
|
|
||||||
this.iconsTop = new IIcon[9];
|
|
||||||
this.iconsSide = new IIcon[9];
|
|
||||||
this.iconsNoWeed = new IIcon[9];
|
|
||||||
this.weedKilled = weedKilled;
|
this.weedKilled = weedKilled;
|
||||||
|
setUnlocalizedName("botany.soil." + type.getName());
|
||||||
this.setCreativeTab(CreativeTabBotany.instance);
|
this.setCreativeTab(CreativeTabBotany.instance);
|
||||||
this.setBlockName(blockName);
|
this.setRegistryName(blockName);
|
||||||
this.setTickRandomly(true);
|
this.setTickRandomly(true);
|
||||||
this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 0.9375f, 1.0f);
|
|
||||||
this.setLightOpacity(255);
|
this.setLightOpacity(255);
|
||||||
this.setHardness(0.5f);
|
this.setHardness(0.5f);
|
||||||
this.setStepSound(Block.soundTypeGravel);
|
this.setSoundType(SoundType.GROUND);
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int damageDropped(final int p_149692_1_) {
|
|
||||||
return p_149692_1_;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateTick(final World world, final int x, final int y, final int z, final Random random) {
|
|
||||||
final int meta = world.getBlockMetadata(x, y, z);
|
|
||||||
EnumMoisture moisture = EnumMoisture.values()[meta % 3];
|
|
||||||
final EnumAcidity acidity = EnumAcidity.values()[meta / 3];
|
|
||||||
final EnumMoisture desiredMoisture = Gardening.getNaturalMoisture(world, x, y, z);
|
|
||||||
if (desiredMoisture.ordinal() > moisture.ordinal()) {
|
|
||||||
moisture = ((moisture == EnumMoisture.Dry) ? EnumMoisture.Normal : EnumMoisture.Damp);
|
|
||||||
}
|
|
||||||
if (desiredMoisture.ordinal() < moisture.ordinal()) {
|
|
||||||
moisture = ((moisture == EnumMoisture.Damp) ? EnumMoisture.Normal : EnumMoisture.Dry);
|
|
||||||
}
|
|
||||||
final int meta2 = getMeta(acidity, moisture);
|
|
||||||
if (meta != meta2) {
|
|
||||||
world.setBlockMetadataWithNotify(x, y, z, meta2, 2);
|
|
||||||
}
|
|
||||||
if (!this.weedKilled && random.nextInt(5 - this.getType(world, x, y, z).ordinal()) == 0 && world.getBlock(x, y + 1, z) == Blocks.air) {
|
|
||||||
world.setBlock(x, y + 1, z, Botany.plant, BlockPlant.Type.Weeds.ordinal(), 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(final World p_149668_1_, final int p_149668_2_, final int p_149668_3_, final int p_149668_4_) {
|
|
||||||
return AxisAlignedBB.getBoundingBox(p_149668_2_ + 0, p_149668_3_ + 0, p_149668_4_ + 0, p_149668_2_ + 1, p_149668_3_ + 1, p_149668_4_ + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isOpaqueCube() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean renderAsNormalBlock() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumAcidity getPH(final World world, final int x, final int y, final int z) {
|
|
||||||
return EnumAcidity.values()[world.getBlockMetadata(x, y, z) / 3];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumMoisture getMoisture(final World world, final int x, final int y, final int z) {
|
|
||||||
return EnumMoisture.values()[world.getBlockMetadata(x, y, z) % 3];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumSoilType getType(final World world, final int x, final int y, final int z) {
|
|
||||||
return this.type;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean fertilise(final World world, final int x, final int y, final int z, final EnumSoilType maxLevel) {
|
|
||||||
final EnumSoilType type = this.getType(world, x, y, z);
|
|
||||||
if (type.ordinal() >= maxLevel.ordinal()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final int meta = world.getBlockMetadata(x, y, z);
|
|
||||||
return world.setBlock(x, y, z, Gardening.getSoilBlock(maxLevel, this.weedKilled), meta, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean degrade(final World world, final int x, final int y, final int z, final EnumSoilType minLevel) {
|
|
||||||
final EnumSoilType type = this.getType(world, x, y, z);
|
|
||||||
if (type.ordinal() <= minLevel.ordinal()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final int meta = world.getBlockMetadata(x, y, z);
|
|
||||||
return world.setBlock(x, y, z, Gardening.getSoilBlock(minLevel, this.weedKilled), meta, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean setPH(final World world, final int x, final int y, final int z, final EnumAcidity pH) {
|
|
||||||
final int meta = getMeta(pH, this.getMoisture(world, x, y, z));
|
|
||||||
return world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean setMoisture(final World world, final int x, final int y, final int z, final EnumMoisture moisture) {
|
|
||||||
final int meta = getMeta(this.getPH(world, x, y, z), moisture);
|
|
||||||
return world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getMeta(final EnumAcidity acid, final EnumMoisture moisture) {
|
public static int getMeta(final EnumAcidity acid, final EnumMoisture moisture) {
|
||||||
return acid.ordinal() * 3 + moisture.ordinal();
|
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
|
@Override
|
||||||
public void onNeighborBlockChange(final World world, final int x, final int y, final int z, final Block p_149695_5_) {
|
@SideOnly(Side.CLIENT)
|
||||||
super.onNeighborBlockChange(world, x, y, z, p_149695_5_);
|
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) {
|
||||||
if (world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN, false)) {
|
switch (side) {
|
||||||
world.setBlock(x, y, z, Blocks.dirt, 0, 2);
|
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;
|
||||||
|
default:
|
||||||
|
return super.shouldSideBeRendered(blockState, blockAccess, pos, side);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getPH(final ItemStack stack) {
|
/**
|
||||||
return Binnie.Language.localise(EnumAcidity.values()[stack.getItemDamage() / 3]);
|
* Used to determine ambient occlusion and culling when rebuilding chunks for render
|
||||||
}
|
*/
|
||||||
|
@Override
|
||||||
public static String getMoisture(final ItemStack stack) {
|
public boolean isOpaqueCube(IBlockState state) {
|
||||||
return Binnie.Language.localise(EnumMoisture.values()[stack.getItemDamage() % 3]);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canSustainPlant(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection direction, final IPlantable plantable) {
|
public boolean isFullCube(IBlockState state) {
|
||||||
final Block plant = plantable.getPlant(world, x, y + 1, z);
|
return false;
|
||||||
if (plant == Botany.flower) {
|
}
|
||||||
|
|
||||||
|
@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
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void getSubBlocks(final Item itemIn, final CreativeTabs tab, final 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";
|
||||||
|
}
|
||||||
|
final 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) {
|
||||||
|
final EnumMoisture moisture = EnumMoisture.values()[meta % 3];
|
||||||
|
final EnumAcidity acidity = EnumAcidity.values()[meta / 3];
|
||||||
|
return getDefaultState().withProperty(MOISTURE, moisture).withProperty(ACIDITY, acidity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnumSoilType getType() {
|
||||||
|
return this.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);
|
||||||
|
}
|
||||||
|
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, Botany.plant.getStateFromMeta(BlockPlant.Type.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(final World world, final BlockPos pos) {
|
||||||
|
return world.getBlockState(pos).getValue(ACIDITY);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnumMoisture getMoisture(final World world, final BlockPos pos) {
|
||||||
|
return world.getBlockState(pos).getValue(MOISTURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnumSoilType getType(final World world, final BlockPos pos) {
|
||||||
|
return this.type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean fertilise(final World world, final BlockPos pos, final EnumSoilType maxLevel) {
|
||||||
|
final EnumSoilType type = this.getType(world, pos);
|
||||||
|
if (type.ordinal() >= maxLevel.ordinal()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final IBlockState old = world.getBlockState(pos);
|
||||||
|
return world.setBlockState(pos, BotanyCore.getGardening().getSoilBlock(maxLevel, this.weedKilled).getDefaultState().withProperty(ACIDITY, old.getValue(ACIDITY)).withProperty(MOISTURE, old.getValue(MOISTURE)), 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean degrade(final World world, final BlockPos pos, final EnumSoilType minLevel) {
|
||||||
|
final EnumSoilType type = this.getType(world, pos);
|
||||||
|
if (type.ordinal() <= minLevel.ordinal()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final IBlockState old = world.getBlockState(pos);
|
||||||
|
return world.setBlockState(pos, BotanyCore.getGardening().getSoilBlock(minLevel, this.weedKilled).getDefaultState().withProperty(ACIDITY, old.getValue(ACIDITY)).withProperty(MOISTURE, old.getValue(MOISTURE)), 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setPH(final World world, final BlockPos pos, final EnumAcidity pH) {
|
||||||
|
IBlockState blockState = world.getBlockState(pos);
|
||||||
|
return world.setBlockState(pos, blockState.withProperty(ACIDITY, pH));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setMoisture(final World world, final BlockPos pos, final 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 (plant.getBlock() == Botany.flower) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (plant == Botany.plant) {
|
if (plant.getBlock() == Botany.plant) {
|
||||||
return !this.weedKilled || !BlockPlant.isWeed(world, x, y, z);
|
return !this.weedKilled || !BlockPlant.isWeed(world, pos);
|
||||||
}
|
}
|
||||||
return world instanceof World && Blocks.dirt.canSustainPlant(world, x, y, z, direction, plantable);
|
return world instanceof World && Blocks.DIRT.canSustainPlant(state, world, pos, direction, plantable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean resistsWeeds(final World world, final int x, final int y, final int z) {
|
public boolean resistsWeeds(final World world, final BlockPos pos) {
|
||||||
return this.weedKilled;
|
return this.weedKilled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isWeedKilled() {
|
||||||
|
return weedKilled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,264 +1,261 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.gardening;
|
package binnie.botany.gardening;
|
||||||
|
|
||||||
import java.util.LinkedHashMap;
|
import javax.annotation.Nullable;
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import binnie.botany.items.BotanyItems;
|
|
||||||
import forestry.api.core.EnumTemperature;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import binnie.core.BinnieCore;
|
import java.util.Collections;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import java.util.LinkedHashMap;
|
||||||
import binnie.botany.flower.TileEntityFlower;
|
|
||||||
import binnie.botany.Botany;
|
|
||||||
import com.mojang.authlib.GameProfile;
|
|
||||||
import binnie.botany.api.IFlower;
|
|
||||||
import binnie.botany.api.EnumSoilType;
|
|
||||||
import net.minecraft.world.biome.BiomeGenBase;
|
|
||||||
import binnie.botany.api.EnumAcidity;
|
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import binnie.botany.api.EnumMoisture;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraft.item.ItemBlock;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import binnie.botany.api.gardening.IBlockSoil;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class Gardening
|
import net.minecraft.block.Block;
|
||||||
{
|
import net.minecraft.block.state.IBlockState;
|
||||||
public static Map<ItemStack, Integer> fertiliserAcid;
|
import net.minecraft.init.Blocks;
|
||||||
public static Map<ItemStack, Integer> fertiliserAlkaline;
|
import net.minecraft.item.Item;
|
||||||
public static Map<ItemStack, Integer> fertiliserNutrient;
|
import net.minecraft.item.ItemBlock;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.biome.Biome;
|
||||||
|
|
||||||
public static boolean isSoil(final Block block) {
|
import forestry.api.climate.IClimateInfo;
|
||||||
|
import forestry.api.core.EnumTemperature;
|
||||||
|
import forestry.api.core.ForestryAPI;
|
||||||
|
|
||||||
|
import binnie.botany.Botany;
|
||||||
|
import binnie.botany.api.EnumAcidity;
|
||||||
|
import binnie.botany.api.EnumMoisture;
|
||||||
|
import binnie.botany.api.EnumSoilType;
|
||||||
|
import binnie.botany.api.IBlockSoil;
|
||||||
|
import binnie.botany.api.IFlower;
|
||||||
|
import binnie.botany.api.IGardeningManager;
|
||||||
|
import binnie.botany.items.BotanyItems;
|
||||||
|
|
||||||
|
public class Gardening implements IGardeningManager {
|
||||||
|
private final Map<ItemStack, Integer> fertiliserAcid = new LinkedHashMap<>();
|
||||||
|
private final Map<ItemStack, Integer> fertiliserAlkaline = new LinkedHashMap<>();
|
||||||
|
private final Map<ItemStack, Integer> fertiliserNutrient = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
public Gardening() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSoil(final Block block) {
|
||||||
return block instanceof IBlockSoil;
|
return block instanceof IBlockSoil;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isSoil(final Item item) {
|
@Override
|
||||||
return item instanceof ItemBlock && isSoil(((ItemBlock) item).field_150939_a);
|
public boolean isSoil(final Item item) {
|
||||||
|
return item instanceof ItemBlock && isSoil(((ItemBlock) item).getBlock());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isSoil(final ItemStack item) {
|
@Override
|
||||||
|
public boolean isSoil(final ItemStack item) {
|
||||||
return isSoil(item.getItem());
|
return isSoil(item.getItem());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EnumMoisture getNaturalMoisture(final World world, final int x, final int y, final int z) {
|
@Override
|
||||||
float bias = getBiomeMoisture(world.getBiomeGenForCoords(x, z), y);
|
public EnumMoisture getNaturalMoisture(World world, BlockPos pos) {
|
||||||
|
float bias = getBiomeMoisture(world, pos);
|
||||||
for (int dx = -1; dx < 2; ++dx) {
|
for (int dx = -1; dx < 2; ++dx) {
|
||||||
for (int dz = -1; dz < 2; ++dz) {
|
for (int dz = -1; dz < 2; ++dz) {
|
||||||
if (dx != 0 || dz != 0) {
|
if (dx != 0 || dz != 0) {
|
||||||
if (world.getBlock(x + dx, y, z + dz) == Blocks.sand) {
|
if (world.getBlockState(pos.add(dx, 0, dz)) == Blocks.SAND) {
|
||||||
bias -= 1.5;
|
bias -= 1.5;
|
||||||
}
|
} else if (world.getBlockState(pos.add(dx, 0, dz)) == Blocks.WATER) {
|
||||||
else if (world.getBlock(x + dx, y, z + dz) == Blocks.water) {
|
|
||||||
bias += 1.5;
|
bias += 1.5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (world.isRaining() && world.canBlockSeeTheSky(x, y + 1, z) && world.getPrecipitationHeight(x, z) <= y + 1) {
|
if (world.isRaining() && world.canBlockSeeSky(pos.up()) && world.getPrecipitationHeight(pos).getY() <= pos.getY() + 1) {
|
||||||
bias += 1.5;
|
bias += 1.5;
|
||||||
}
|
}
|
||||||
for (int dx = -1; dx < 2; ++dx) {
|
for (int dx = -1; dx < 2; ++dx) {
|
||||||
for (int dz = -1; dz < 2; ++dz) {
|
for (int dz = -1; dz < 2; ++dz) {
|
||||||
if (dx != 0 || dz != 0) {
|
if (dx != 0 || dz != 0) {
|
||||||
if (world.getBlock(x + dx, y, z + dz) == Blocks.gravel && bias > 0.0f) {
|
if (world.getBlockState(pos.add(dx, 0, dz)).getBlock() == Blocks.GRAVEL && bias > 0.0f) {
|
||||||
bias *= 0.4f;
|
bias *= 0.4f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (bias <= -1.0f) ? EnumMoisture.Dry : ((bias >= 1.0f) ? EnumMoisture.Damp : EnumMoisture.Normal);
|
return (bias <= -1.0f) ? EnumMoisture.DRY : ((bias >= 1.0f) ? EnumMoisture.DAMP : EnumMoisture.NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EnumAcidity getNaturalPH(final World world, final int x, final int y, final int z) {
|
@Override
|
||||||
final float bias = getBiomePH(world.getBiomeGenForCoords(x, z), y);
|
public EnumAcidity getNaturalPH(World world, BlockPos pos) {
|
||||||
return (bias <= -1.0f) ? EnumAcidity.Acid : ((bias >= 1.0f) ? EnumAcidity.Alkaline : EnumAcidity.Neutral);
|
final float bias = getBiomePH(world, pos);
|
||||||
|
return (bias <= -1.0f) ? EnumAcidity.ACID : ((bias >= 1.0f) ? EnumAcidity.ALKALINE : EnumAcidity.NEUTRAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float getBiomeMoisture(final BiomeGenBase biome, final int H) {
|
@Override
|
||||||
final double R = biome.rainfall;
|
public float getBiomeMoisture(World world, BlockPos pos) {
|
||||||
final double T = biome.temperature;
|
IClimateInfo info = ForestryAPI.climateManager.getInfo(world, pos);
|
||||||
final double m = 3.2 * (R - 0.5) - 0.4 * (1.0 + T + 0.5 * T * T) + 1.1 - 1.6 * (T - 0.9) * (T - 0.9) - 0.002 * (H - 64);
|
double humidity = info.getHumidity();
|
||||||
|
double temperature = info.getTemperature();
|
||||||
|
double m = 3.2 * (humidity - 0.5) - 0.4 * (1.0 + temperature + 0.5 * temperature * temperature) + 1.1 - 1.6 * (temperature - 0.9) * (temperature - 0.9) - 0.002 * (pos.getY() - 64);
|
||||||
return (float) ((m == 0.0) ? m : ((m < 0.0) ? (-Math.sqrt(m * m)) : Math.sqrt(m * m)));
|
return (float) ((m == 0.0) ? m : ((m < 0.0) ? (-Math.sqrt(m * m)) : Math.sqrt(m * m)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float getBiomePH(final BiomeGenBase biome, final int H) {
|
@Override
|
||||||
final double R = biome.rainfall;
|
public float getBiomePH(World world, BlockPos pos) {
|
||||||
final double T = biome.temperature;
|
IClimateInfo info = ForestryAPI.climateManager.getInfo(world, pos);
|
||||||
return (float) (-3.0 * (R - 0.5) + 0.5 * (T - 0.699999988079071) * (T - 0.699999988079071) + 0.02f * (H - 64) - 0.15000000596046448);
|
double humidity = info.getHumidity();
|
||||||
|
double temperature = info.getTemperature();
|
||||||
|
return (float) (-3.0 * (humidity - 0.5) + 0.5 * (temperature - 0.699999988079071) * (temperature - 0.699999988079071) + 0.02f * (pos.getY() - 64) - 0.15000000596046448);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void createSoil(final World world, final int x, final int y, final int z, final EnumSoilType soil, final EnumMoisture moisture, final EnumAcidity acidity) {
|
@Override
|
||||||
|
public void plantSoil(final World world, final BlockPos pos, final EnumSoilType soil, final EnumMoisture moisture, final EnumAcidity acidity) {
|
||||||
final int meta = moisture.ordinal() + acidity.ordinal() * 3;
|
final int meta = moisture.ordinal() + acidity.ordinal() * 3;
|
||||||
world.setBlock(x, y, z, getSoilBlock(soil), meta, 2);
|
world.setBlockState(pos, getSoilBlock(soil).getStateFromMeta(meta), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean plant(final World world, final int x, final int y, final int z, final IFlower flower, final GameProfile owner) {
|
@Override
|
||||||
final boolean set = world.setBlock(x, y, z, Botany.flower, 0, 2);
|
public Collection<ItemStack> getAcidFertilisers() {
|
||||||
if (!set) {
|
return Collections.unmodifiableSet(fertiliserAcid.keySet());
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final TileEntity tileFlower = world.getTileEntity(x, y, z);
|
|
||||||
final TileEntity below = world.getTileEntity(x, y - 1, z);
|
|
||||||
if (tileFlower != null && tileFlower instanceof TileEntityFlower) {
|
|
||||||
if (below instanceof TileEntityFlower) {
|
|
||||||
((TileEntityFlower) tileFlower).setSection(((TileEntityFlower) below).getSection());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
((TileEntityFlower) tileFlower).create(flower, owner);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tryGrowSection(world, x, y, z);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void tryGrowSection(final World world, final int x, final int y, final int z) {
|
@Override
|
||||||
if (!BinnieCore.proxy.isSimulating(world)) {
|
public Collection<ItemStack> getAlkalineFertilisers() {
|
||||||
return;
|
return Collections.unmodifiableSet(fertiliserAlkaline.keySet());
|
||||||
}
|
|
||||||
final TileEntity flower = world.getTileEntity(x, y, z);
|
|
||||||
if (flower != null && flower instanceof TileEntityFlower) {
|
|
||||||
final IFlower iflower = ((TileEntityFlower) flower).getFlower();
|
|
||||||
final int section = ((TileEntityFlower) flower).getSection();
|
|
||||||
if (iflower != null && section < iflower.getGenome().getPrimary().getType().getSections() - 1 && iflower.getAge() > 0) {
|
|
||||||
world.setBlock(x, y + 1, z, Botany.flower, 0, 2);
|
|
||||||
final TileEntity tileFlower = world.getTileEntity(x, y + 1, z);
|
|
||||||
if (tileFlower != null && tileFlower instanceof TileEntityFlower) {
|
|
||||||
((TileEntityFlower) tileFlower).setSection(section + 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onGrowFromSeed(final World world, final int x, final int y, final int z) {
|
@Override
|
||||||
tryGrowSection(world, x, y, z);
|
public Collection<ItemStack> getNutrientFertilisers() {
|
||||||
|
return Collections.unmodifiableSet(fertiliserNutrient.keySet());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Collection<ItemStack> getAcidFertilisers() {
|
@Override
|
||||||
return Gardening.fertiliserAcid.keySet();
|
public void registerAcidFertiliser(ItemStack stack, int strength) {
|
||||||
|
ModuleGardening.queuedAcidFertilisers.put(stack, strength);
|
||||||
|
fertiliserAcid.put(stack, strength);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Collection<ItemStack> getAlkalineFertilisers() {
|
@Override
|
||||||
return Gardening.fertiliserAlkaline.keySet();
|
public void registerAlkalineFertiliser(ItemStack stack, int strength) {
|
||||||
|
ModuleGardening.queuedAlkalineFertilisers.put(stack, strength);
|
||||||
|
fertiliserAlkaline.put(stack, strength);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Collection<ItemStack> getNutrientFertilisers() {
|
@Override
|
||||||
return Gardening.fertiliserNutrient.keySet();
|
public void registerNutrientFertiliser(ItemStack stack, int strength) {
|
||||||
|
ModuleGardening.queuedNutrientFertilisers.put(stack, strength);
|
||||||
|
fertiliserNutrient.put(stack, strength);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAcidFertiliser(final ItemStack itemstack) {
|
@Override
|
||||||
|
public boolean isAcidFertiliser(final ItemStack itemstack) {
|
||||||
for (final ItemStack stack : getAcidFertilisers()) {
|
for (final ItemStack stack : getAcidFertilisers()) {
|
||||||
if (stack != null && stack.isItemEqual(itemstack)) {
|
if (!stack.isEmpty() && stack.isItemEqual(itemstack)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAlkalineFertiliser(final ItemStack itemstack) {
|
@Override
|
||||||
|
public boolean isAlkalineFertiliser(final ItemStack itemstack) {
|
||||||
for (final ItemStack stack : getAlkalineFertilisers()) {
|
for (final ItemStack stack : getAlkalineFertilisers()) {
|
||||||
if (stack != null && stack.isItemEqual(itemstack)) {
|
if (!stack.isEmpty() && stack.isItemEqual(itemstack)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isNutrientFertiliser(final ItemStack itemstack) {
|
@Override
|
||||||
|
public boolean isNutrientFertiliser(final ItemStack itemstack) {
|
||||||
for (final ItemStack stack : getNutrientFertilisers()) {
|
for (final ItemStack stack : getNutrientFertilisers()) {
|
||||||
if (stack != null && stack.isItemEqual(itemstack)) {
|
if (!stack.isEmpty() && stack.isItemEqual(itemstack)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getFertiliserStrength(final ItemStack stack) {
|
@Override
|
||||||
if (stack == null) {
|
public int getFertiliserStrength(final ItemStack stack) {
|
||||||
return 1;
|
for (final Map.Entry<ItemStack, Integer> entry : fertiliserAcid.entrySet()) {
|
||||||
}
|
|
||||||
for (final Map.Entry<ItemStack, Integer> entry : Gardening.fertiliserAcid.entrySet()) {
|
|
||||||
if (entry.getKey().isItemEqual(stack)) {
|
if (entry.getKey().isItemEqual(stack)) {
|
||||||
return entry.getValue();
|
return entry.getValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (final Map.Entry<ItemStack, Integer> entry : Gardening.fertiliserAlkaline.entrySet()) {
|
for (final Map.Entry<ItemStack, Integer> entry : fertiliserAlkaline.entrySet()) {
|
||||||
if (entry.getKey().isItemEqual(stack)) {
|
if (entry.getKey().isItemEqual(stack)) {
|
||||||
return entry.getValue();
|
return entry.getValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (final Map.Entry<ItemStack, Integer> entry : Gardening.fertiliserNutrient.entrySet()) {
|
for (final Map.Entry<ItemStack, Integer> entry : fertiliserNutrient.entrySet()) {
|
||||||
if (entry.getKey().isItemEqual(stack)) {
|
if (entry.getKey().isItemEqual(stack)) {
|
||||||
return entry.getValue();
|
return entry.getValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean canTolerate(final IFlower flower, final World world, final int x, final int y, final int z) {
|
@Override
|
||||||
if (flower == null || flower.getGenome() == null) {
|
public boolean canTolerate(@Nullable final IFlower flower, final World world, final BlockPos pos) {
|
||||||
|
if (flower == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Block soil = world.getBlock(x, y - 1, z);
|
IBlockState soil = world.getBlockState(pos.down());
|
||||||
final int soilMeta = world.getBlockMetadata(x, y - 1, z);
|
final Block soilBlock = soil.getBlock();
|
||||||
final BiomeGenBase biome = world.getBiomeGenForCoords(x, z);
|
final int soilMeta = soilBlock.getMetaFromState(soil);
|
||||||
return canTolerate(flower, EnumAcidity.values()[soilMeta / 3 % 3], EnumMoisture.values()[soilMeta % 3], EnumTemperature.getFromValue(biome.temperature));
|
final Biome biome = world.getBiome(pos);
|
||||||
|
return canTolerate(flower, EnumAcidity.values()[soilMeta / 3 % 3], EnumMoisture.values()[soilMeta % 3], EnumTemperature.getFromValue(biome.getTemperature()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EnumSoilType getSoilType(final World world, final int x, final int y, final int z) {
|
@Override
|
||||||
if (world.getBlock(x, y, z) instanceof IBlockSoil) {
|
public EnumSoilType getSoilType(final World world, final BlockPos pos) {
|
||||||
return ((IBlockSoil) world.getBlock(x, y, z)).getType(world, x, y, z);
|
if (world.getBlockState(pos).getBlock() instanceof IBlockSoil) {
|
||||||
|
return ((IBlockSoil) world.getBlockState(pos).getBlock()).getType(world, pos);
|
||||||
}
|
}
|
||||||
return EnumSoilType.SOIL;
|
return EnumSoilType.SOIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Block getSoilBlock(final EnumSoilType type) {
|
@Override
|
||||||
|
public Block getSoilBlock(final EnumSoilType type) {
|
||||||
return getSoilBlock(type, false);
|
return getSoilBlock(type, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Block getSoilBlock(final EnumSoilType type, final boolean weedkill) {
|
@Override
|
||||||
|
public Block getSoilBlock(final EnumSoilType type, final boolean weedkill) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case FLOWERBED: {
|
case FLOWERBED: {
|
||||||
return weedkill ? Botany.flowerbedNoWeed : Botany.flowerbed;
|
return weedkill ? Botany.flowerbedNoWeed : Botany.flowerbed;
|
||||||
}
|
}
|
||||||
case LOAM: {
|
case LOAM: {
|
||||||
return weedkill ? Botany.loamNoWeed : Botany.loam;
|
return weedkill ? Botany.loamNoWeed : Botany.loam;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
return weedkill ? Botany.soilNoWeed : Botany.soil;
|
return weedkill ? Botany.soilNoWeed : Botany.soil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean canTolerate(final IFlower flower, final EnumAcidity ePH, final EnumMoisture eMoisture, final EnumTemperature eTemp) {
|
@Override
|
||||||
|
public boolean canTolerate(IFlower flower, EnumAcidity ePH, EnumMoisture eMoisture, EnumTemperature eTemp) {
|
||||||
return flower.getGenome().canTolerate(ePH) && flower.getGenome().canTolerate(eMoisture) && flower.getGenome().canTolerate(eTemp);
|
return flower.getGenome().canTolerate(ePH) && flower.getGenome().canTolerate(eMoisture) && flower.getGenome().canTolerate(eTemp);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isWeedkiller(final ItemStack heldItem) {
|
@Override
|
||||||
return heldItem != null && heldItem.isItemEqual(BotanyItems.Weedkiller.get(1));
|
public boolean isWeedkiller(ItemStack heldItem) {
|
||||||
|
return heldItem.isItemEqual(BotanyItems.Weedkiller.get(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean addWeedKiller(final World world, final int x, final int y, final int z) {
|
@Override
|
||||||
if (!(world.getBlock(x, y, z) instanceof IBlockSoil)) {
|
public boolean addWeedKiller(World world, BlockPos pos) {
|
||||||
|
if (!(world.getBlockState(pos).getBlock() instanceof IBlockSoil)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final EnumSoilType type = getSoilType(world, x, y, z);
|
EnumSoilType type = getSoilType(world, pos);
|
||||||
final Block block = getSoilBlock(type, true);
|
Block block = getSoilBlock(type, true);
|
||||||
final boolean done = world.setBlock(x, y, z, block, world.getBlockMetadata(x, y, z), 2);
|
IBlockState oldState = world.getBlockState(pos);
|
||||||
if (done && BlockPlant.isWeed(world, x, y + 1, z)) {
|
IBlockState newState = block.getStateFromMeta(oldState.getBlock().getMetaFromState(oldState));
|
||||||
world.setBlockToAir(x, y + 1, z);
|
boolean done = world.setBlockState(pos, newState, 2);
|
||||||
|
if (done && BlockPlant.isWeed(world, pos.up())) {
|
||||||
|
world.setBlockToAir(pos.up());
|
||||||
}
|
}
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
|
||||||
Gardening.fertiliserAcid = new LinkedHashMap<ItemStack, Integer>();
|
|
||||||
Gardening.fertiliserAlkaline = new LinkedHashMap<ItemStack, Integer>();
|
|
||||||
Gardening.fertiliserNutrient = new LinkedHashMap<ItemStack, Integer>();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,72 +1,53 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.gardening;
|
package binnie.botany.gardening;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import binnie.botany.api.EnumAcidity;
|
|
||||||
import binnie.botany.api.EnumMoisture;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import binnie.botany.api.EnumSoilType;
|
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
|
||||||
public class ItemSoil extends ItemBlock
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
{
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
EnumSoilType type;
|
|
||||||
private boolean noWeed;
|
|
||||||
|
|
||||||
@Override
|
import binnie.botany.api.EnumSoilType;
|
||||||
@SideOnly(Side.CLIENT)
|
import binnie.core.util.I18N;
|
||||||
public void addInformation(final ItemStack stack, final EntityPlayer p_77624_2_, final List p_77624_3_, final boolean p_77624_4_) {
|
|
||||||
super.addInformation(stack, p_77624_2_, p_77624_3_, p_77624_4_);
|
|
||||||
final EnumMoisture moisture = EnumMoisture.values()[stack.getItemDamage() % 3];
|
|
||||||
final EnumAcidity acidity = EnumAcidity.values()[stack.getItemDamage() / 3];
|
|
||||||
String info = "";
|
|
||||||
if (moisture == EnumMoisture.Dry) {
|
|
||||||
info += "§eDry§f";
|
|
||||||
}
|
|
||||||
if (moisture == EnumMoisture.Damp) {
|
|
||||||
info += "§9Damp§f";
|
|
||||||
}
|
|
||||||
if (acidity == EnumAcidity.Acid) {
|
|
||||||
if (info.length() > 0) {
|
|
||||||
info += ", ";
|
|
||||||
}
|
|
||||||
info += "§cAcidic§f";
|
|
||||||
}
|
|
||||||
if (acidity == EnumAcidity.Alkaline) {
|
|
||||||
if (info.length() > 0) {
|
|
||||||
info += ", ";
|
|
||||||
}
|
|
||||||
info += "§bAlkaline§f";
|
|
||||||
}
|
|
||||||
if (info.length() > 0) {
|
|
||||||
p_77624_3_.add(info);
|
|
||||||
}
|
|
||||||
if (this.noWeed) {
|
|
||||||
p_77624_3_.add("Weedkiller");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemSoil(final Block p_i45328_1_) {
|
public class ItemSoil extends ItemBlock {
|
||||||
super(p_i45328_1_);
|
private final EnumSoilType type;
|
||||||
this.type = ((BlockSoil) this.field_150939_a).getType();
|
private final boolean noWeed;
|
||||||
this.noWeed = ((BlockSoil) this.field_150939_a).weedKilled;
|
|
||||||
|
public ItemSoil(BlockSoil block) {
|
||||||
|
super(block);
|
||||||
|
this.type = block.getType();
|
||||||
|
this.noWeed = block.isWeedKilled();
|
||||||
this.hasSubtypes = true;
|
this.hasSubtypes = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getItemStackDisplayName(final ItemStack stack) {
|
@SideOnly(Side.CLIENT)
|
||||||
return this.type.name().substring(0, 1) + this.type.name().toLowerCase().substring(1);
|
public void addInformation(final ItemStack stack, final EntityPlayer playerIn, final List<String> tooltip, final boolean advanced) {
|
||||||
|
String info = "";
|
||||||
|
info += BlockSoil.getMoisture(stack, true, true);
|
||||||
|
if (info.length() > 0) {
|
||||||
|
info += ", ";
|
||||||
|
}
|
||||||
|
info += BlockSoil.getPH(stack, true, true);
|
||||||
|
if (info.length() > 0) {
|
||||||
|
tooltip.add(info);
|
||||||
|
}
|
||||||
|
if (this.noWeed) {
|
||||||
|
tooltip.add(TextFormatting.GREEN + I18N.localise("botany.soil.weedkiller"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetadata(final int p_77647_1_) {
|
public String getItemStackDisplayName(ItemStack stack) {
|
||||||
return p_77647_1_;
|
return this.getUnlocalizedNameInefficiently(stack).trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMetadata(final int damage) {
|
||||||
|
return damage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loaded 100 of 2571 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user