mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-27 23:46:05 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bce6c26704 | ||
|
|
a9eb396b7e | ||
|
|
92211ddbf4 | ||
|
|
3c6ab0e052 | ||
|
|
16793c2385 | ||
|
|
9c820bd038 | ||
|
|
f12a75a356 | ||
|
|
74d8810684 | ||
|
|
87ccfb36c4 | ||
|
|
765dade9bd | ||
|
|
b535a7ca46 | ||
|
|
0ff171ba5e | ||
|
|
7946203545 | ||
|
|
a2366fee20 | ||
|
|
aeb03873d8 | ||
|
|
25241cb7e9 | ||
|
|
97e808394f | ||
|
|
3de24b0647 | ||
|
|
cf518d19fb | ||
|
|
7a3ef5ecb2 | ||
|
|
14459ad991 | ||
|
|
2c6273c2d9 | ||
|
|
186a136d9d | ||
|
|
05b0532c05 | ||
|
|
045b228020 | ||
|
|
0a08927302 | ||
|
|
ab0122dda2 | ||
|
|
c0bba17d08 | ||
|
|
28869a08df | ||
|
|
ec2bb33ea0 | ||
|
|
008d290136 | ||
|
|
08404a3dd2 | ||
|
|
5378ff34bf | ||
|
|
33573ba463 | ||
|
|
84b120e89d | ||
|
|
add9f4685d | ||
|
|
75d745b7a0 | ||
|
|
e5bf29dd95 | ||
|
|
de5d902139 | ||
|
|
f3c4551f8a | ||
|
|
00dfeac8cb | ||
|
|
e443efcc5a | ||
|
|
f3c067f503 | ||
|
|
46567817e8 | ||
|
|
23742eab03 | ||
|
|
958a76247d | ||
|
|
31803aa092 | ||
|
|
766c0d5fd3 | ||
|
|
6a411bb607 | ||
|
|
0aa95b495a | ||
|
|
86274906eb | ||
|
|
fc7dc2c14d | ||
|
|
807a8e24ed | ||
|
|
2e74ed4645 | ||
|
|
ebdb282c6b | ||
|
|
d60f070e75 | ||
|
|
0b2e47d88d | ||
|
|
6be0719a9f | ||
|
|
e9ad1bda8e | ||
|
|
a15d297f8a | ||
|
|
2883900b1e | ||
|
|
0444201f7a | ||
|
|
3e9965b750 | ||
|
|
e8d843eb89 | ||
|
|
555f44889d | ||
|
|
4bca0f042d | ||
|
|
dc288141ac | ||
|
|
d26f4816e1 | ||
|
|
79b8e3e6a4 | ||
|
|
5e21a29d3f | ||
|
|
f6e2eec09c | ||
|
|
031b077a4b | ||
|
|
49f4c84b5d | ||
|
|
09b4d5a207 | ||
|
|
68f226e07e | ||
|
|
da6ea7048a | ||
|
|
d721a7e98f | ||
|
|
ce050eaa63 | ||
|
|
0133d143f8 | ||
|
|
7cc917ae76 | ||
|
|
6f1d00e4f5 | ||
|
|
2aa0b9bb8c | ||
|
|
d5d8885850 | ||
|
|
cb6cb3a01f | ||
|
|
cd5c2b3406 | ||
|
|
b1b06753ad | ||
|
|
5846f59d64 | ||
|
|
ec790c9333 | ||
|
|
784fa0ad30 | ||
|
|
3bd8c53273 | ||
|
|
bc10e65feb | ||
|
|
3eaf99a4d1 | ||
|
|
7910cff956 | ||
|
|
4ef9cd6a28 | ||
|
|
60b881810d | ||
|
|
c854f9b489 | ||
|
|
4e9624daab | ||
|
|
fac2008f14 | ||
|
|
2475710a6a | ||
|
|
e83d0e3fa6 | ||
|
|
052997cb09 | ||
|
|
ef372d4f84 | ||
|
|
f215990d8a | ||
|
|
f5a83016f5 | ||
|
|
eab09635e9 | ||
|
|
767ec08795 | ||
|
|
5928473316 | ||
|
|
b5989356ce | ||
|
|
4d1d3d1cca | ||
|
|
0b9b0c0068 | ||
|
|
dccaf6d7d4 | ||
|
|
73edb413f5 | ||
|
|
303c98e443 | ||
|
|
868ef735b0 | ||
|
|
1d4b5f791d | ||
|
|
46140e2e66 | ||
|
|
c2481365b9 | ||
|
|
cc76acbf3d | ||
|
|
8fabf206d9 | ||
|
|
dcd08c4d37 | ||
|
|
7d269684da | ||
|
|
81210e67df | ||
|
|
a66ca598af | ||
|
|
a6faf817f9 | ||
|
|
1992d6e333 | ||
|
|
f4c6c5612a | ||
|
|
8edd40ec8f | ||
|
|
fe56638f16 | ||
|
|
31caf3c4c3 | ||
|
|
bd1e357e40 | ||
|
|
bdd1bbd530 | ||
|
|
51701fd4c3 | ||
|
|
ee467ae88b | ||
|
|
5b12eecc88 | ||
|
|
eaeb6a4db1 | ||
|
|
a7fe4d9579 | ||
|
|
3e19efda01 | ||
|
|
9d84da49fd | ||
|
|
dff9c2f81c | ||
|
|
d30f682523 | ||
|
|
c005bc02b5 | ||
|
|
ce19751ca2 | ||
|
|
5b0f57fa7b | ||
|
|
9569559ec2 | ||
|
|
b1bd4a30f7 | ||
|
|
6fa547c9c3 | ||
|
|
f07ceb948c | ||
|
|
b75a8bbffd | ||
|
|
409061c589 | ||
|
|
445db14b96 | ||
|
|
0e796ab351 | ||
|
|
7146b73a5c | ||
|
|
4bdab6876d | ||
|
|
0441379c1c | ||
|
|
82fab2c1cb | ||
|
|
005d284ddb | ||
|
|
404ba9ce5c | ||
|
|
75df80ae3c | ||
|
|
43211303bb | ||
|
|
42ee61bd72 | ||
|
|
493ef4fdf9 | ||
|
|
1d3b4b7572 | ||
|
|
1f6e6626b1 | ||
|
|
79d46e5cc9 | ||
|
|
25f064df81 | ||
|
|
7a4575e6f8 | ||
|
|
a993d70687 | ||
|
|
3a21b1895e | ||
|
|
32028dc85e | ||
|
|
7d1a0d84d0 | ||
|
|
99998bcfbd | ||
|
|
d8dfb3882b | ||
|
|
bd0dbc3e14 | ||
|
|
1ffaad9fcd | ||
|
|
81301c3bd2 | ||
|
|
e2e6bdc3e0 | ||
|
|
0f9dbfd61b | ||
|
|
a806db3168 | ||
|
|
f564403a98 | ||
|
|
b91615a9a7 | ||
|
|
b244267989 | ||
|
|
83b3016306 | ||
|
|
286137a4d3 | ||
|
|
895dd048f1 | ||
|
|
5cfe0a7d0d | ||
|
|
8a94064606 | ||
|
|
6a8085603b | ||
|
|
68e9fb7c99 | ||
|
|
57088f03d7 | ||
|
|
2f683650c0 | ||
|
|
0c15ee9943 | ||
|
|
b5a6919f7f | ||
|
|
618b291015 | ||
|
|
1ea7b62e5f | ||
|
|
68bbe7710c | ||
|
|
3a389dee6d | ||
|
|
1c53f13250 | ||
|
|
3377ff8382 | ||
|
|
a877002667 | ||
|
|
4ef41b6f62 | ||
|
|
a12ad2eae3 | ||
|
|
338010ffe8 | ||
|
|
47cca224df | ||
|
|
0d8c5b9230 | ||
|
|
c9bc65bde2 | ||
|
|
1ed37f9b8d | ||
|
|
5e35e3c803 | ||
|
|
89f0b94f65 | ||
|
|
263a4f3bfc | ||
|
|
542dbb15b0 | ||
|
|
4337f5521d | ||
|
|
3bafd5974d | ||
|
|
bddd3e69a3 | ||
|
|
5052920d73 | ||
|
|
186cbda444 | ||
|
|
1ffe80b8c9 | ||
|
|
c3d0da2d0a | ||
|
|
8986256b12 | ||
|
|
e896b041f2 | ||
|
|
5e4d271f37 | ||
|
|
7fe97e9323 | ||
|
|
e8802c66d3 | ||
|
|
f6186d3cf3 | ||
|
|
64259e06da | ||
|
|
909ac40320 | ||
|
|
b32ba93404 | ||
|
|
77322d7c45 | ||
|
|
f1fd19df99 | ||
|
|
ecbb1cb8e4 | ||
|
|
9c27918e92 | ||
|
|
e896a31586 | ||
|
|
145e727c38 | ||
|
|
0de5877c0f | ||
|
|
4080dfd9f2 | ||
|
|
4c58bd361d | ||
|
|
96e4814ae3 | ||
|
|
adccdd181a | ||
|
|
c09ad04284 | ||
|
|
b609d6688f | ||
|
|
e05bf8bb7b | ||
|
|
730043ba9c | ||
|
|
856f08b752 | ||
|
|
f402cb155f | ||
|
|
a3c2360ba6 | ||
|
|
c392c3b295 | ||
|
|
d251d83105 | ||
|
|
a610833a24 | ||
|
|
740cea5916 | ||
|
|
765db4853c | ||
|
|
663c41fa40 | ||
|
|
cdda249d31 | ||
|
|
40a2d4b86d | ||
|
|
8f319fa931 |
No files matched your search
+12
-1
@@ -2,8 +2,19 @@
|
|||||||
# IntelliJ
|
# IntelliJ
|
||||||
/build
|
/build
|
||||||
/run
|
/run
|
||||||
|
/eclipse
|
||||||
/out
|
/out
|
||||||
|
/classes
|
||||||
.idea
|
.idea
|
||||||
*.iml
|
*.iml
|
||||||
*.ipr
|
*.ipr
|
||||||
*.iws
|
*.iws
|
||||||
|
# minecraft
|
||||||
|
/config
|
||||||
|
/logs
|
||||||
|
/saves
|
||||||
|
/options.txt
|
||||||
|
/usernamecache.json
|
||||||
|
|
||||||
|
changelog.html
|
||||||
|
*.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,59 @@
|
|||||||
|
[Binnie mods](https://minecraft.curseforge.com/projects/binnies-mods/files)
|
||||||
|
====================================
|
||||||
|
|
||||||
|
### What is it?
|
||||||
|
Binnie’s Mods is a suite of mods designed to expand the [Forestry](https://github.com/ForestryMC/ForestryMC) mod.
|
||||||
|
It both extends the bee and tree breeding aspect by adding many new species with varied products,
|
||||||
|
along with new features such as fully breedable flowers and genetic manipulation.
|
||||||
|
|
||||||
|
### Homepage
|
||||||
|
|
||||||
|
[Wiki](https://binnie.mods.wiki/wiki/Main_Page)
|
||||||
|
|
||||||
|
[Latest Builds for 1.7.10](https://ci.bymarcin.com/job/Binnie-Mods-MC1.7.10/)
|
||||||
|
|
||||||
|
### Mods
|
||||||
|
|
||||||
|
[](https://binnie.mods.wiki/wiki/Extra_Bees)
|
||||||
|
|
||||||
|
Extra Bees expands upon the bee breeding of Forestry by adding 107 new bee species to forestry. These bees cover a large spectrum of different effects and products, giving you the ability to produce everything from dyes to rare metal dusts purely from bees. It also adds the Apiarist Database, a tool to keep track of discovered species, mutations and traits. There are also new alveary components which help improve and streamline bee production.
|
||||||
|
|
||||||
|
|
||||||
|
[](https://binnie.mods.wiki/wiki/Extra_Trees)
|
||||||
|
|
||||||
|
Extra Trees both increases the number of tree species and adds many new aesthetic uses. There are 96 new tree species, such as Banana, Brazil nut and Douglas-fir. This comes with many new fruits as well as 35 new wooden planks. Extra Trees allows these, as well as Forestry and vanilla planks, to be combined to give doors, gates and various designs of fences. The woodworker allows planks to be combined to give patterned tiles, allowing you to build beautiful wooden floors, and the same can be done with stained glass. A group of machines such as the brewery and distillery allow you to use the fruits you grow to make a variety of wines, ciders and spirits.
|
||||||
|
|
||||||
|
|
||||||
|
[](https://binnie.mods.wiki/wiki/Botany)
|
||||||
|
|
||||||
|
Botany adds an entirely new breeding system to Forestry: flowers. There are 46 different species that can be bred, including both vanilla flowers and new ones such as Fuschia and Lilies. The colour of the flowers can be transferred and selectively bred, meaning that each flower can be one of a possible 80 different colours. These new flowers can be bred manually in small gardens using a trowel and fertiliser, with careful care taken to maintain the desired pH or moisture, or grown on the large scale in Forestry farms.
|
||||||
|
|
||||||
|
[](https://binnie.mods.wiki/wiki/Genetics)
|
||||||
|
|
||||||
|
Genetics is for those who want to eschew conventional breeding, and want to enter the realm of genetic manipulation. Here, genes can be isolated, sequenced and then inoculated back into different species, making it easier to obtain the perfect genome. Bees, trees, butterflies and flowers can all be manipulated in this way. They can also be acclimatised to different environments to build tolerance to hostile climates.
|
||||||
|
|
||||||
|
[](https://binnie.mods.wiki/wiki/Binnie_Core)
|
||||||
|
|
||||||
|
Binnie Core is a mod which contains a lot of the core functionality such as networking and GUI's for the other mods. The only in game features it currently contains are the Compartments
|
||||||
|
|
||||||
|
### Warning
|
||||||
|
|
||||||
|
Removed unused (unfinished) items and blocks: Honey Crystal, Alcohol, etc.
|
||||||
|
|
||||||
|
### Building
|
||||||
|
|
||||||
|
The master branch will always contain the latest released version with possibly some bug fixes for that version that will eventually be released.
|
||||||
|
New versions will be created in branched named like {mc_version}-{mod_version}
|
||||||
|
|
||||||
|
#### IntelliJ IDEA
|
||||||
|
|
||||||
|
1. Execute the following gradle command to setup your workspace and create the necessary idea project files:
|
||||||
|
|
||||||
|
```
|
||||||
|
./gradlew setupDecompWorkspace idea genIntellijRuns
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Open the `Binnie*.ipr` project file using IntelliJ IDEA
|
||||||
|
|
||||||
|
3. Select `Minecraft Client` from _Run configurations_ and press the green play button.
|
||||||
|
Minecraft should now launch with Binnie and all of its dependencies loaded :)
|
||||||
+58
-34
@@ -3,65 +3,89 @@ buildscript {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven {
|
maven {
|
||||||
name = "forge"
|
name = "forge"
|
||||||
url = "http://files.minecraftforge.net/maven"
|
url = "https://files.minecraftforge.net/maven"
|
||||||
}
|
}
|
||||||
maven {
|
maven {
|
||||||
name = "sonatype"
|
name = "sonatype"
|
||||||
url = "https://oss.sonatype.org/content/repositories/snapshots/"
|
url = "https://oss.sonatype.org/content/repositories/snapshots/"
|
||||||
}
|
}
|
||||||
|
maven {
|
||||||
|
url "https://plugins.gradle.org/m2/"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
|
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
|
||||||
|
classpath "gradle.plugin.se.bjurr.gitchangelog:git-changelog-gradle-plugin:1.47"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id "com.matthewprenger.cursegradle" version "1.0.6"
|
||||||
|
}
|
||||||
|
apply plugin: "se.bjurr.gitchangelog.git-changelog-gradle-plugin"
|
||||||
apply plugin: 'forge'
|
apply plugin: 'forge'
|
||||||
|
|
||||||
version = "1.0"
|
version = "2.0.26"
|
||||||
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.7.10-gtnh"
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
|
||||||
|
// uncomment this hack if you use old IDEA
|
||||||
|
/*sourceSets {
|
||||||
|
main {
|
||||||
|
output.resourcesDir = output.classesDir
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
version = "1.7.10-10.13.4.1558-1.7.10"
|
version = "1.7.10-10.13.4.1614-1.7.10"
|
||||||
if (file('../run').exists()){
|
runDir = "eclipse"
|
||||||
assetDir = "../run/assets"
|
|
||||||
}else{
|
|
||||||
assetDir = "assets"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
processResources {
|
||||||
// you may put jars on which you depend on in ./libs
|
|
||||||
// or you may define them like so..
|
|
||||||
//compile "some.group:artifact:version:classifier"
|
|
||||||
//compile "some.group:artifact:version"
|
|
||||||
|
|
||||||
// real examples
|
|
||||||
//compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
|
|
||||||
//compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
|
|
||||||
|
|
||||||
// for more info...
|
|
||||||
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
|
|
||||||
// http://www.gradle.org/docs/current/userguide/dependency_management.html
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
processResources
|
|
||||||
{
|
|
||||||
// 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
|
||||||
|
|
||||||
// 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
|
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
from(sourceSets.main.resources.srcDirs) {
|
||||||
exclude 'mcmod.info'
|
exclude 'mcmod.info'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task gitChangelogTask(type: se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask) {
|
||||||
|
filePath = "changelog.html"
|
||||||
|
untaggedName = "Current release ${project.version}"
|
||||||
|
fromCommit = "dbc5c1a564c39e4a9c042411d1bdbe450985ce2c"
|
||||||
|
toRef = "HEAD"
|
||||||
|
templateContent = file('changelog.mustache').getText('UTF-8')
|
||||||
|
}
|
||||||
|
|
||||||
|
curseforge {
|
||||||
|
apiKey = project.hasProperty('curseforge_apikey') ? project.curseforge_apikey : '0'
|
||||||
|
project {
|
||||||
|
id = '223525'
|
||||||
|
changelog = file('changelog.html')
|
||||||
|
changelogType = 'html'
|
||||||
|
releaseType = 'release'
|
||||||
|
relations {
|
||||||
|
requiredLibrary 'forestry'
|
||||||
|
incompatible 'binnie-fix'
|
||||||
|
incompatible 'binniepatcher'
|
||||||
|
incompatible 'more-binnie-fixes'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
afterEvaluate {
|
||||||
|
tasks.curseforge223525.dependsOn.add(gitChangelogTask)
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{{#tags}}
|
||||||
|
<h3>{{name}}</h3>
|
||||||
|
<ul>
|
||||||
|
{{#commits}}
|
||||||
|
<li>{{{message}}} - {{authorName}}</li>
|
||||||
|
{{/commits}}
|
||||||
|
</ul>
|
||||||
|
{{/tags}}
|
||||||
Vendored
BIN
Binary file not shown.
+1
-2
@@ -1,6 +1,5 @@
|
|||||||
#Wed Jul 02 15:54:47 CDT 2014
|
|
||||||
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-4.4.1-bin.zip
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
##
|
||||||
@@ -6,47 +6,6 @@
|
|||||||
##
|
##
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
|
||||||
DEFAULT_JVM_OPTS=""
|
|
||||||
|
|
||||||
APP_NAME="Gradle"
|
|
||||||
APP_BASE_NAME=`basename "$0"`
|
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
|
||||||
MAX_FD="maximum"
|
|
||||||
|
|
||||||
warn ( ) {
|
|
||||||
echo "$*"
|
|
||||||
}
|
|
||||||
|
|
||||||
die ( ) {
|
|
||||||
echo
|
|
||||||
echo "$*"
|
|
||||||
echo
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# OS specific support (must be 'true' or 'false').
|
|
||||||
cygwin=false
|
|
||||||
msys=false
|
|
||||||
darwin=false
|
|
||||||
case "`uname`" in
|
|
||||||
CYGWIN* )
|
|
||||||
cygwin=true
|
|
||||||
;;
|
|
||||||
Darwin* )
|
|
||||||
darwin=true
|
|
||||||
;;
|
|
||||||
MINGW* )
|
|
||||||
msys=true
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# For Cygwin, ensure paths are in UNIX format before anything is touched.
|
|
||||||
if $cygwin ; then
|
|
||||||
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Attempt to set APP_HOME
|
# Attempt to set APP_HOME
|
||||||
# Resolve links: $0 may be a link
|
# Resolve links: $0 may be a link
|
||||||
PRG="$0"
|
PRG="$0"
|
||||||
@@ -61,9 +20,49 @@ while [ -h "$PRG" ] ; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
SAVED="`pwd`"
|
SAVED="`pwd`"
|
||||||
cd "`dirname \"$PRG\"`/" >&-
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
APP_HOME="`pwd -P`"
|
APP_HOME="`pwd -P`"
|
||||||
cd "$SAVED" >&-
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS=""
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
NONSTOP* )
|
||||||
|
nonstop=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
@@ -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`
|
||||||
@@ -154,11 +154,19 @@ if $cygwin ; then
|
|||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
# Escape application args
|
||||||
function splitJvmOpts() {
|
save () {
|
||||||
JVM_OPTS=("$@")
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
|
echo " "
|
||||||
}
|
}
|
||||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
APP_ARGS=$(save "$@")
|
||||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
|
||||||
|
|
||||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
|
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||||
|
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
||||||
Vendored
+84
-90
@@ -1,90 +1,84 @@
|
|||||||
@if "%DEBUG%" == "" @echo off
|
@if "%DEBUG%" == "" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem Gradle startup script for Windows
|
||||||
@rem
|
@rem
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
|
|
||||||
@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 DIRNAME=%~dp0
|
||||||
set DEFAULT_JVM_OPTS=
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
set DIRNAME=%~dp0
|
set APP_HOME=%DIRNAME%
|
||||||
if "%DIRNAME%" == "" set DIRNAME=.
|
|
||||||
set APP_BASE_NAME=%~n0
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
set APP_HOME=%DIRNAME%
|
set DEFAULT_JVM_OPTS=
|
||||||
|
|
||||||
@rem Find java.exe
|
@rem Find java.exe
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto init
|
if "%ERRORLEVEL%" == "0" goto init
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
echo.
|
echo.
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
echo location of your Java installation.
|
echo location of your Java installation.
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
:findJavaFromJavaHome
|
:findJavaFromJavaHome
|
||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
if exist "%JAVA_EXE%" goto init
|
if exist "%JAVA_EXE%" goto init
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
echo.
|
echo.
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
echo location of your Java installation.
|
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
|
|
||||||
|
:win9xME_args
|
||||||
:win9xME_args
|
@rem Slurp the command line arguments.
|
||||||
@rem Slurp the command line arguments.
|
set CMD_LINE_ARGS=
|
||||||
set CMD_LINE_ARGS=
|
set _SKIP=2
|
||||||
set _SKIP=2
|
|
||||||
|
:win9xME_args_slurp
|
||||||
:win9xME_args_slurp
|
if "x%~1" == "x" goto execute
|
||||||
if "x%~1" == "x" goto execute
|
|
||||||
|
set CMD_LINE_ARGS=%*
|
||||||
set CMD_LINE_ARGS=%*
|
|
||||||
goto execute
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
:4NT_args
|
|
||||||
@rem Get arguments from the 4NT Shell from JP Software
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
set CMD_LINE_ARGS=%$
|
|
||||||
|
@rem Execute Gradle
|
||||||
:execute
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||||
@rem Setup the command line
|
|
||||||
|
:end
|
||||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
@rem Execute Gradle
|
|
||||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
:end
|
rem the _cmd.exe /c_ return code!
|
||||||
@rem End local scope for the variables with windows NT shell
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
exit /b 1
|
||||||
|
|
||||||
:fail
|
:mainEnd
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
rem the _cmd.exe /c_ return code!
|
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
:omega
|
||||||
exit /b 1
|
|
||||||
|
|
||||||
:mainEnd
|
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
|
||||||
|
|
||||||
:omega
|
|
||||||
Binary file not shown.
BIN
Binary file not shown.
@@ -1,39 +1,22 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie;
|
package binnie;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import binnie.core.resource.ManagerResource;
|
|
||||||
import binnie.core.item.ManagerItem;
|
|
||||||
import binnie.core.machines.ManagerMachine;
|
|
||||||
import binnie.core.liquid.ManagerLiquid;
|
|
||||||
import binnie.core.mod.config.ManagerConfig;
|
|
||||||
import binnie.core.genetics.ManagerGenetics;
|
|
||||||
import binnie.core.language.ManagerLanguage;
|
|
||||||
import binnie.core.ManagerBase;
|
import binnie.core.ManagerBase;
|
||||||
|
import binnie.core.genetics.ManagerGenetics;
|
||||||
|
import binnie.core.item.ManagerItem;
|
||||||
|
import binnie.core.liquid.ManagerLiquid;
|
||||||
|
import binnie.core.machines.ManagerMachine;
|
||||||
|
import binnie.core.mod.config.ManagerConfig;
|
||||||
|
import binnie.core.resource.ManagerResource;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public final class Binnie
|
public final class Binnie {
|
||||||
{
|
public static List<ManagerBase> Managers = new ArrayList<>();
|
||||||
public static final List<ManagerBase> Managers;
|
public static ManagerGenetics Genetics = new ManagerGenetics();
|
||||||
public static final ManagerLanguage Language;
|
public static ManagerConfig Configuration = new ManagerConfig();
|
||||||
public static final ManagerGenetics Genetics;
|
public static ManagerLiquid Liquid = new ManagerLiquid();
|
||||||
public static final ManagerConfig Configuration;
|
public static ManagerMachine Machine = new ManagerMachine();
|
||||||
public static final ManagerLiquid Liquid;
|
public static ManagerItem Item = new ManagerItem();
|
||||||
public static final ManagerMachine Machine;
|
public static ManagerResource Resource = new ManagerResource();
|
||||||
public static final ManagerItem Item;
|
|
||||||
public static final ManagerResource Resource;
|
|
||||||
|
|
||||||
static {
|
|
||||||
Managers = new ArrayList<ManagerBase>();
|
|
||||||
Language = new ManagerLanguage();
|
|
||||||
Genetics = new ManagerGenetics();
|
|
||||||
Configuration = new ManagerConfig();
|
|
||||||
Liquid = new ManagerLiquid();
|
|
||||||
Machine = new ManagerMachine();
|
|
||||||
Item = new ManagerItem();
|
|
||||||
Resource = new ManagerResource();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie;
|
|
||||||
|
|
||||||
public final class Constants
|
|
||||||
{
|
|
||||||
public static final String LiquidJuice = "juice";
|
|
||||||
public static final String LiquidWater = "water";
|
|
||||||
public static final String LiquidSeedOil = "seedoil";
|
|
||||||
public static final String LiquidCreosote = "Creosote Oil";
|
|
||||||
public static final String LiquidEthanol = "bioethanol";
|
|
||||||
public static final String LiquidHoney = "for.honey";
|
|
||||||
}
|
|
||||||
@@ -1,73 +1,73 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany;
|
package binnie.botany;
|
||||||
|
|
||||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
|
||||||
import cpw.mods.fml.common.eventhandler.Event;
|
|
||||||
import net.minecraftforge.event.entity.player.BonemealEvent;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import binnie.core.BinnieCore;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.event.world.BlockEvent;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
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.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.gardening.IBlockSoil;
|
||||||
import forestry.api.genetics.IIndividual;
|
|
||||||
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.BlockCeramicBrick;
|
||||||
|
import binnie.botany.ceramic.BlockCeramicPatterned;
|
||||||
|
import binnie.botany.ceramic.BlockStained;
|
||||||
|
import binnie.botany.core.BotanyCore;
|
||||||
|
import binnie.botany.core.BotanyGUI;
|
||||||
|
import binnie.botany.core.ModuleCore;
|
||||||
|
import binnie.botany.flower.BlockFlower;
|
||||||
|
import binnie.botany.flower.ItemFlower;
|
||||||
|
import binnie.botany.flower.ItemInsulatedTube;
|
||||||
|
import binnie.botany.flower.TileEntityFlower;
|
||||||
|
import binnie.botany.gardening.BlockPlant;
|
||||||
|
import binnie.botany.gardening.BlockSoil;
|
||||||
|
import binnie.botany.gardening.Gardening;
|
||||||
|
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;
|
||||||
|
import cpw.mods.fml.common.Mod;
|
||||||
|
import cpw.mods.fml.common.SidedProxy;
|
||||||
|
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||||
|
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||||
|
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||||
|
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
import cpw.mods.fml.common.eventhandler.Event;
|
||||||
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
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;
|
||||||
|
|
||||||
@Mod(modid = "Botany", name = "Botany", useMetadata = true, dependencies = "after:BinnieCore")
|
@Mod(
|
||||||
public class Botany extends AbstractMod
|
modid = "Botany",
|
||||||
{
|
name = "Botany",
|
||||||
public static final float AGE_CHANCE = 0.2f;
|
useMetadata = true,
|
||||||
|
dependencies = "after:BinnieCore"
|
||||||
|
)
|
||||||
|
public class Botany extends AbstractMod {
|
||||||
@Mod.Instance("Botany")
|
@Mod.Instance("Botany")
|
||||||
public static Botany instance;
|
public static Botany instance;
|
||||||
@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;
|
||||||
|
|
||||||
public static BlockFlower flower;
|
public static BlockFlower flower;
|
||||||
public static Item seed;
|
public static Item seed;
|
||||||
public static Item pollen;
|
public static Item pollen;
|
||||||
@@ -87,8 +87,6 @@ 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 ItemFlower flowerItem;
|
||||||
public static ItemPigment pigment;
|
public static ItemPigment pigment;
|
||||||
public static ItemClay clay;
|
public static ItemClay clay;
|
||||||
@@ -97,28 +95,28 @@ public class Botany extends AbstractMod
|
|||||||
public static BlockStained stained;
|
public static BlockStained stained;
|
||||||
public static BlockCeramicBrick ceramicBrick;
|
public static BlockCeramicBrick ceramicBrick;
|
||||||
|
|
||||||
@Mod.EventHandler
|
|
||||||
public void preInit(final FMLPreInitializationEvent evt) {
|
|
||||||
this.addModule(new ModuleCore());
|
|
||||||
this.addModule(new ModuleGenetics());
|
|
||||||
this.addModule(new ModuleGardening());
|
|
||||||
this.preInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Mod.EventHandler
|
|
||||||
public void init(final FMLInitializationEvent evt) {
|
|
||||||
this.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Mod.EventHandler
|
|
||||||
public void postInit(final FMLPostInitializationEvent evt) {
|
|
||||||
this.postInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Botany() {
|
public Botany() {
|
||||||
Botany.instance = this;
|
Botany.instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Mod.EventHandler
|
||||||
|
public void preInit(FMLPreInitializationEvent event) {
|
||||||
|
addModule(new ModuleCore());
|
||||||
|
addModule(new ModuleGenetics());
|
||||||
|
addModule(new ModuleGardening());
|
||||||
|
preInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Mod.EventHandler
|
||||||
|
public void init(FMLInitializationEvent event) {
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Mod.EventHandler
|
||||||
|
public void postInit(FMLPostInitializationEvent event) {
|
||||||
|
postInit();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBinnieGUID[] getGUIDs() {
|
public IBinnieGUID[] getGUIDs() {
|
||||||
return BotanyGUI.values();
|
return BotanyGUI.values();
|
||||||
@@ -155,28 +153,30 @@ public class Botany extends AbstractMod
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onShearFlower(final PlayerInteractEvent event) {
|
public void onShearFlower(PlayerInteractEvent event) {
|
||||||
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null && event.entityPlayer.getHeldItem().getItem() == Items.shears) {
|
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);
|
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
|
||||||
if (tile instanceof TileEntityFlower) {
|
if (tile instanceof TileEntityFlower) {
|
||||||
final TileEntityFlower flower = (TileEntityFlower) tile;
|
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||||
flower.onShear();
|
flower.onShear();
|
||||||
event.entityPlayer.getHeldItem().damageItem(1, event.entityPlayer);
|
event.entityPlayer.getHeldItem().damageItem(1, event.entityPlayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null && event.entityPlayer.getHeldItem().getItem() == Botany.pollen) {
|
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.world.getTileEntity(event.x, event.y, event.z);
|
||||||
if (tile instanceof TileEntityFlower) {
|
if (tile instanceof TileEntityFlower) {
|
||||||
final TileEntityFlower flower = (TileEntityFlower) tile;
|
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||||
final IFlower pollen = BotanyCore.getFlowerRoot().getMember(event.entityPlayer.getHeldItem());
|
IFlower pollen = BotanyCore.getFlowerRoot().getMember(event.entityPlayer.getHeldItem());
|
||||||
if (pollen != null && flower.canMateWith(pollen)) {
|
if (pollen != null && flower.canMateWith(pollen)) {
|
||||||
flower.mateWith(pollen);
|
flower.mateWith(pollen);
|
||||||
if (!event.entityPlayer.capabilities.isCreativeMode) {
|
if (!event.entityPlayer.capabilities.isCreativeMode) {
|
||||||
final ItemStack heldItem = event.entityPlayer.getHeldItem();
|
ItemStack heldItem = event.entityPlayer.getHeldItem();
|
||||||
--heldItem.stackSize;
|
heldItem.stackSize--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -184,113 +184,119 @@ public class Botany extends AbstractMod
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onFertiliseSoil(final PlayerInteractEvent event) {
|
public void onFertiliseSoil(PlayerInteractEvent event) {
|
||||||
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK || event.world == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.world == null) {
|
|
||||||
|
if (event.entityPlayer == null || event.entityPlayer.getHeldItem() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null) {
|
|
||||||
int y = event.y;
|
int y = event.y;
|
||||||
Block block = event.world.getBlock(event.x, y, event.z);
|
Block block = event.world.getBlock(event.x, y, event.z);
|
||||||
if (block == null || !Gardening.isSoil(block)) {
|
if (block == null || !Gardening.isSoil(block)) {
|
||||||
block = event.world.getBlock(event.x, --y, event.z);
|
block = event.world.getBlock(event.x, --y, event.z);
|
||||||
}
|
}
|
||||||
if (block == null) {
|
if (block == null || !Gardening.isSoil(block)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IBlockSoil soil = (IBlockSoil) block;
|
||||||
|
if (Gardening.isNutrientFertiliser(event.entityPlayer.getHeldItem()) && soil.getType(event.world, event.x, y, event.z) != EnumSoilType.FLOWERBED) {
|
||||||
|
EnumSoilType type = soil.getType(event.world, event.x, y, event.z);
|
||||||
|
int next = Math.min(type.ordinal() + Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 2);
|
||||||
|
if (soil.fertilise(event.world, event.x, y, event.z, EnumSoilType.values()[next]) && !event.entityPlayer.capabilities.isCreativeMode) {
|
||||||
|
ItemStack heldItem = event.entityPlayer.getHeldItem();
|
||||||
|
heldItem.stackSize--;
|
||||||
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(event.entityPlayer.getHeldItem()) && soil.getPH(event.world, event.x, y, event.z) != EnumAcidity.ACID) {
|
||||||
final EnumSoilType type = soil.getType(event.world, event.x, y, event.z);
|
EnumAcidity pH = soil.getPH(event.world, event.x, y, event.z);
|
||||||
final int next = Math.min(type.ordinal() + Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 2);
|
int next = Math.max(pH.ordinal() - Gardening.getFertiliserStrength(event.entityPlayer.getHeldItem()), 0);
|
||||||
if (soil.fertilise(event.world, event.x, y, event.z, EnumSoilType.values()[next]) && !event.entityPlayer.capabilities.isCreativeMode) {
|
if (soil.setPH(event.world, event.x, y, event.z, EnumAcidity.values()[next]) && !event.entityPlayer.capabilities.isCreativeMode) {
|
||||||
final ItemStack heldItem = event.entityPlayer.getHeldItem();
|
ItemStack heldItem2 = event.entityPlayer.getHeldItem();
|
||||||
--heldItem.stackSize;
|
heldItem2.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(event.entityPlayer.getHeldItem()) && soil.getPH(event.world, event.x, y, event.z) != EnumAcidity.ALKALINE) {
|
||||||
|
EnumAcidity pH = soil.getPH(event.world, event.x, y, event.z);
|
||||||
|
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) {
|
||||||
|
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) {
|
||||||
|
ItemStack heldItem4 = event.entityPlayer.getHeldItem();
|
||||||
|
heldItem4.stackSize--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void plantVanilla(final BlockEvent.PlaceEvent event) {
|
public void plantVanilla(BlockEvent.PlaceEvent event) {
|
||||||
final World world = event.world;
|
World world = event.world;
|
||||||
final int x = event.x;
|
int x = event.x;
|
||||||
final int y = event.y;
|
int y = event.y;
|
||||||
final int z = event.z;
|
int z = event.z;
|
||||||
final Block block = world.getBlock(x, y - 1, z);
|
Block block = world.getBlock(x, y - 1, z);
|
||||||
if (!(block instanceof IBlockSoil)) {
|
if (!(block instanceof IBlockSoil)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final IFlower flower = BotanyCore.getFlowerRoot().getConversion(event.itemInHand);
|
|
||||||
|
IFlower flower = BotanyCore.getFlowerRoot().getConversion(event.itemInHand);
|
||||||
if (flower != null) {
|
if (flower != null) {
|
||||||
Gardening.plant(world, x, y, z, flower, event.player.getGameProfile());
|
Gardening.plant(world, x, y, z, flower, event.player.getGameProfile());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void onPlantVanilla(final PlayerInteractEvent event) {
|
public void onPlantVanilla(PlayerInteractEvent event) {
|
||||||
if (!BinnieCore.proxy.isSimulating(event.world)) {
|
if (!BinnieCore.proxy.isSimulating(event.world) || event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
if (event.entityPlayer == null || event.entityPlayer.getHeldItem() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null) {
|
|
||||||
final World world = event.world;
|
World world = event.world;
|
||||||
final int x = event.x;
|
int x = event.x;
|
||||||
final int y = event.y;
|
int y = event.y;
|
||||||
final int z = event.z;
|
int z = event.z;
|
||||||
final Block block = world.getBlock(x, y, z);
|
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(x, y + 1, z) || world.getBlock(x, y, z).isReplaceable(world, x, y, z))) {
|
||||||
py = 1;
|
py = 1;
|
||||||
}
|
}
|
||||||
if (py >= 0) {
|
|
||||||
final IFlower flower = BotanyCore.getFlowerRoot().getConversion(event.entityPlayer.getHeldItem());
|
if (py < 0) {
|
||||||
if (flower != null && Gardening.plant(world, x, y + py, z, flower, event.entityPlayer.getGameProfile()) && !event.entityPlayer.capabilities.isCreativeMode) {
|
return;
|
||||||
final ItemStack heldItem = event.entityPlayer.getHeldItem();
|
}
|
||||||
--heldItem.stackSize;
|
|
||||||
}
|
IFlower flower = BotanyCore.getFlowerRoot().getConversion(event.entityPlayer.getHeldItem());
|
||||||
}
|
if (flower != null && Gardening.plant(world, x, y + py, z, flower, event.entityPlayer.getGameProfile()) && !event.entityPlayer.capabilities.isCreativeMode) {
|
||||||
|
ItemStack heldItem = event.entityPlayer.getHeldItem();
|
||||||
|
heldItem.stackSize--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onBonemeal(final BonemealEvent event) {
|
public void onBonemeal(BonemealEvent event) {
|
||||||
final Block block = event.world.getBlock(event.x, event.y, event.z);
|
Block block = event.world.getBlock(event.x, event.y, event.z);
|
||||||
if (Gardening.isSoil(block)) {
|
if (Gardening.isSoil(block)) {
|
||||||
final IBlockSoil soil = (IBlockSoil) block;
|
IBlockSoil soil = (IBlockSoil) block;
|
||||||
if (soil.fertilise(event.world, event.x, event.y, event.z, EnumSoilType.LOAM)) {
|
if (soil.fertilise(event.world, event.x, event.y, event.z, 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.world.getTileEntity(event.x, event.y, event.z);
|
||||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).onBonemeal()) {
|
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).onBonemeal()) {
|
||||||
event.setResult(Event.Result.ALLOW);
|
event.setResult(Event.Result.ALLOW);
|
||||||
}
|
}
|
||||||
@@ -302,8 +308,8 @@ public class Botany extends AbstractMod
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void onIMC(final FMLInterModComms.IMCEvent event) {
|
public void onIMC(FMLInterModComms.IMCEvent event) {
|
||||||
for (final FMLInterModComms.IMCMessage message : event.getMessages()) {
|
for (FMLInterModComms.IMCMessage message : event.getMessages()) {
|
||||||
if (message.key.equals("add-nutrient-fertiliser-1")) {
|
if (message.key.equals("add-nutrient-fertiliser-1")) {
|
||||||
ModuleGardening.queuedNutrientFertilisers.put(message.getItemStackValue(), 1);
|
ModuleGardening.queuedNutrientFertilisers.put(message.getItemStackValue(), 1);
|
||||||
}
|
}
|
||||||
@@ -325,8 +331,7 @@ public class Botany extends AbstractMod
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class PacketHandler extends BinniePacketHandler
|
public static class PacketHandler extends BinniePacketHandler {
|
||||||
{
|
|
||||||
public PacketHandler() {
|
public PacketHandler() {
|
||||||
super(Botany.instance);
|
super(Botany.instance);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,39 +1,34 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany;
|
package binnie.botany;
|
||||||
|
|
||||||
import net.minecraft.item.Item;
|
import binnie.core.util.I18N;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class CreativeTabBotany extends CreativeTabs
|
public class CreativeTabBotany extends CreativeTabs {
|
||||||
{
|
public static CreativeTabs instance = new CreativeTabBotany();
|
||||||
public static CreativeTabs instance;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getIconItemStack() {
|
|
||||||
return new ItemStack(Blocks.red_flower, 1, 5);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CreativeTabBotany() {
|
public CreativeTabBotany() {
|
||||||
super("Botany");
|
super("Botany");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getIconItemStack() {
|
||||||
|
return new ItemStack(Blocks.red_flower, 1, 5);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTranslatedTabLabel() {
|
public String getTranslatedTabLabel() {
|
||||||
return this.getTabLabel();
|
return getTabLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@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
|
||||||
@@ -41,8 +36,4 @@ public class CreativeTabBotany extends CreativeTabs
|
|||||||
public Item getTabIconItem() {
|
public Item getTabIconItem() {
|
||||||
return Item.getItemFromBlock(Blocks.yellow_flower);
|
return Item.getItemFromBlock(Blocks.yellow_flower);
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
|
||||||
CreativeTabBotany.instance = new CreativeTabBotany();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,11 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
public enum EnumAcidity
|
public enum EnumAcidity {
|
||||||
{
|
ACID,
|
||||||
Acid,
|
NEUTRAL,
|
||||||
Neutral,
|
ALKALINE;
|
||||||
Alkaline;
|
|
||||||
|
|
||||||
public String getID() {
|
public String getID() {
|
||||||
return this.name().toLowerCase();
|
return name().toLowerCase();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,20 +1,15 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
import forestry.api.genetics.IAlleleFloat;
|
|
||||||
import forestry.api.genetics.IAlleleTolerance;
|
|
||||||
import forestry.api.genetics.IAlleleArea;
|
|
||||||
import forestry.api.genetics.IAlleleInteger;
|
|
||||||
import forestry.api.genetics.AlleleManager;
|
import forestry.api.genetics.AlleleManager;
|
||||||
import forestry.api.genetics.ISpeciesRoot;
|
|
||||||
import forestry.api.genetics.IAllele;
|
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.IChromosomeType;
|
||||||
|
import forestry.api.genetics.ISpeciesRoot;
|
||||||
|
|
||||||
public enum EnumFlowerChromosome implements IChromosomeType
|
public enum EnumFlowerChromosome implements IChromosomeType {
|
||||||
{
|
|
||||||
SPECIES(IAlleleFlowerSpecies.class),
|
SPECIES(IAlleleFlowerSpecies.class),
|
||||||
PRIMARY(IAlleleInteger.class),
|
PRIMARY(IAlleleInteger.class),
|
||||||
SECONDARY(IAlleleInteger.class),
|
SECONDARY(IAlleleInteger.class),
|
||||||
@@ -30,18 +25,18 @@ public enum EnumFlowerChromosome implements IChromosomeType
|
|||||||
|
|
||||||
private Class<? extends IAllele> cls;
|
private Class<? extends IAllele> cls;
|
||||||
|
|
||||||
private EnumFlowerChromosome(final Class<? extends IAllele> cls) {
|
EnumFlowerChromosome(Class<? extends IAllele> cls) {
|
||||||
this.cls = cls;
|
this.cls = cls;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends IAllele> getAlleleClass() {
|
public Class<? extends IAllele> getAlleleClass() {
|
||||||
return this.cls;
|
return cls;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.toString().toLowerCase();
|
return toString().toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,28 +1,18 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
public enum EnumFlowerStage
|
public enum EnumFlowerStage {
|
||||||
{
|
|
||||||
FLOWER("Flower"),
|
FLOWER("Flower"),
|
||||||
SEED("Seed"),
|
SEED("Seed"),
|
||||||
POLLEN("Pollen"),
|
POLLEN("Pollen"),
|
||||||
NONE("NONE");
|
NONE("NONE");
|
||||||
|
|
||||||
public static final EnumFlowerStage[] VALUES;
|
protected String name;
|
||||||
String name;
|
|
||||||
|
|
||||||
private EnumFlowerStage(final String name) {
|
EnumFlowerStage(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.name;
|
return name;
|
||||||
}
|
|
||||||
|
|
||||||
static {
|
|
||||||
VALUES = values();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,11 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
public enum EnumMoisture
|
public enum EnumMoisture {
|
||||||
{
|
DRY,
|
||||||
Dry,
|
NORMAL,
|
||||||
Normal,
|
DAMP;
|
||||||
Damp;
|
|
||||||
|
|
||||||
public String getID() {
|
public String getID() {
|
||||||
return this.name().toLowerCase();
|
return name().toLowerCase();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,11 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
public enum EnumSoilType
|
public enum EnumSoilType {
|
||||||
{
|
|
||||||
SOIL,
|
SOIL,
|
||||||
LOAM,
|
LOAM,
|
||||||
FLOWERBED;
|
FLOWERBED;
|
||||||
|
|
||||||
public String getID() {
|
public String getID() {
|
||||||
return this.name().toLowerCase();
|
return name().toLowerCase();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,9 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import forestry.api.genetics.IEffectData;
|
|
||||||
import forestry.api.genetics.IAlleleEffect;
|
import forestry.api.genetics.IAlleleEffect;
|
||||||
|
import forestry.api.genetics.IEffectData;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public interface IAlleleFlowerEffect extends IAlleleEffect
|
public interface IAlleleFlowerEffect extends IAlleleEffect {
|
||||||
{
|
IEffectData doEffect(IFlowerGenome genome, IEffectData storedData, World world, int x, int y, int z);
|
||||||
IEffectData doEffect(final IFlowerGenome p0, final IEffectData p1, final World p2, final int p3, final int p4, final int p5);
|
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,8 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
import forestry.api.genetics.IAlleleSpecies;
|
import forestry.api.genetics.IAlleleSpecies;
|
||||||
|
|
||||||
public interface IAlleleFlowerSpecies extends IAlleleSpecies
|
public interface IAlleleFlowerSpecies extends IAlleleSpecies {
|
||||||
{
|
|
||||||
IFlowerType getType();
|
IFlowerType getType();
|
||||||
|
|
||||||
EnumAcidity getPH();
|
EnumAcidity getPH();
|
||||||
|
|||||||
@@ -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,18 +1,13 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
public interface IColourMix
|
public interface IColourMix {
|
||||||
{
|
IFlowerColor getColor1();
|
||||||
IFlowerColour getColour1();
|
|
||||||
|
|
||||||
IFlowerColour getColour2();
|
IFlowerColor getColor2();
|
||||||
|
|
||||||
boolean isMutation(final IFlowerColour p0, final IFlowerColour p1);
|
boolean isMutation(IFlowerColor color1, IFlowerColor color2);
|
||||||
|
|
||||||
int getChance();
|
int getChance();
|
||||||
|
|
||||||
IFlowerColour getResult();
|
IFlowerColor getResult();
|
||||||
}
|
}
|
||||||
@@ -1,38 +1,33 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import forestry.api.genetics.IIndividual;
|
import forestry.api.genetics.IIndividual;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public interface IFlower extends IIndividual
|
public interface IFlower extends IIndividual {
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
IFlowerGenome getGenome();
|
IFlowerGenome getGenome();
|
||||||
|
|
||||||
IFlowerGenome getMate();
|
IFlowerGenome getMate();
|
||||||
|
|
||||||
void mate(final IFlower p0);
|
void mate(IFlower other);
|
||||||
|
|
||||||
int getAge();
|
int getAge();
|
||||||
|
|
||||||
|
void setAge(int age);
|
||||||
|
|
||||||
void age();
|
void age();
|
||||||
|
|
||||||
void setAge(final int p0);
|
IFlower getOffspring(World world);
|
||||||
|
|
||||||
IFlower getOffspring(final World p0);
|
|
||||||
|
|
||||||
int getMaxAge();
|
int getMaxAge();
|
||||||
|
|
||||||
boolean isWilted();
|
boolean isWilted();
|
||||||
|
|
||||||
void setWilted(final boolean p0);
|
void setWilted(boolean value);
|
||||||
|
|
||||||
boolean hasFlowered();
|
boolean hasFlowered();
|
||||||
|
|
||||||
void setFlowered(final boolean p0);
|
void setFlowered(boolean value);
|
||||||
|
|
||||||
void removeMate();
|
void removeMate();
|
||||||
}
|
}
|
||||||
+2
-7
@@ -1,14 +1,9 @@
|
|||||||
//
|
|
||||||
// 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 IFlowerColor {
|
||||||
{
|
int getColor(boolean dis);
|
||||||
int getColor(final boolean p0);
|
|
||||||
|
|
||||||
IAlleleInteger getAllele();
|
IAlleleInteger getAllele();
|
||||||
|
|
||||||
@@ -1,26 +1,21 @@
|
|||||||
//
|
|
||||||
// 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();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
IAlleleFlowerSpecies getSecondary();
|
IAlleleFlowerSpecies getSecondary();
|
||||||
|
|
||||||
IFlowerColour getPrimaryColor();
|
IFlowerColor getPrimaryColor();
|
||||||
|
|
||||||
IFlowerColour getSecondaryColor();
|
IFlowerColor getSecondaryColor();
|
||||||
|
|
||||||
IFlowerColour getStemColor();
|
IFlowerColor getStemColor();
|
||||||
|
|
||||||
int getFertility();
|
int getFertility();
|
||||||
|
|
||||||
@@ -38,9 +33,9 @@ public interface IFlowerGenome extends IGenome
|
|||||||
|
|
||||||
float getSappiness();
|
float getSappiness();
|
||||||
|
|
||||||
boolean canTolerate(final EnumAcidity p0);
|
boolean canTolerate(EnumAcidity pH);
|
||||||
|
|
||||||
boolean canTolerate(final EnumMoisture p0);
|
boolean canTolerate(EnumMoisture moisture);
|
||||||
|
|
||||||
boolean canTolerate(final EnumTemperature p0);
|
boolean canTolerate(EnumTemperature temp);
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,9 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
import forestry.api.genetics.IGenome;
|
|
||||||
import forestry.api.genetics.IAllele;
|
import forestry.api.genetics.IAllele;
|
||||||
|
import forestry.api.genetics.IGenome;
|
||||||
import forestry.api.genetics.IMutation;
|
import forestry.api.genetics.IMutation;
|
||||||
|
|
||||||
public interface IFlowerMutation extends IMutation
|
public interface IFlowerMutation extends IMutation {
|
||||||
{
|
float getChance(IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1);
|
||||||
float getChance(final IAllele p0, final IAllele p1, final IGenome p2, final IGenome p3);
|
|
||||||
}
|
}
|
||||||
@@ -1,48 +1,44 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import net.minecraft.world.World;
|
|
||||||
import forestry.api.genetics.IAllele;
|
import forestry.api.genetics.IAllele;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import forestry.api.genetics.ISpeciesRoot;
|
import forestry.api.genetics.ISpeciesRoot;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public interface IFlowerRoot extends ISpeciesRoot
|
import java.util.Collection;
|
||||||
{
|
|
||||||
|
public interface IFlowerRoot extends ISpeciesRoot {
|
||||||
@Override
|
@Override
|
||||||
IFlower getMember(final ItemStack p0);
|
IFlower getMember(ItemStack stack);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
IFlower templateAsIndividual(final IAllele[] p0);
|
IFlower templateAsIndividual(IAllele[] template);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
IFlower templateAsIndividual(final IAllele[] p0, final IAllele[] p1);
|
IFlower templateAsIndividual(IAllele[] templateActive, IAllele[] templateInactive);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
IFlowerGenome templateAsGenome(final IAllele[] p0);
|
IFlowerGenome templateAsGenome(IAllele[] template);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
IFlowerGenome templateAsGenome(final IAllele[] p0, final IAllele[] p1);
|
IFlowerGenome templateAsGenome(IAllele[] templateActive, IAllele[] templateInactive);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
IBotanistTracker getBreedingTracker(final World p0, final GameProfile p1);
|
IBotanistTracker getBreedingTracker(World world, GameProfile player);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
Collection<IFlowerMutation> getMutations(final boolean p0);
|
Collection<IFlowerMutation> getMutations(boolean shuffle);
|
||||||
|
|
||||||
EnumFlowerStage getStageType(final ItemStack p0);
|
EnumFlowerStage getStageType(ItemStack stack);
|
||||||
|
|
||||||
IFlower getFlower(final World p0, final IFlowerGenome p1);
|
IFlower getFlower(World world, IFlowerGenome genome);
|
||||||
|
|
||||||
void addConversion(final ItemStack p0, final IAllele[] p1);
|
void addConversion(ItemStack stack, IAllele[] template);
|
||||||
|
|
||||||
IFlower getConversion(final ItemStack p0);
|
IFlower getConversion(ItemStack stack);
|
||||||
|
|
||||||
Collection<IColourMix> getColourMixes(final boolean p0);
|
Collection<IColourMix> getColourMixes(boolean shuffle);
|
||||||
|
|
||||||
void registerColourMix(final IColourMix p0);
|
void registerColourMix(IColourMix colorMix);
|
||||||
}
|
}
|
||||||
@@ -1,18 +1,13 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.api;
|
package binnie.botany.api;
|
||||||
|
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
|
|
||||||
public interface IFlowerType
|
public interface IFlowerType {
|
||||||
{
|
IIcon getStem(EnumFlowerStage stage, boolean flowered, int section);
|
||||||
IIcon getStem(final EnumFlowerStage p0, final boolean p1, final int p2);
|
|
||||||
|
|
||||||
IIcon getPetalIcon(final EnumFlowerStage p0, final boolean p1, final int p2);
|
IIcon getPetalIcon(EnumFlowerStage stage, boolean flowered, int section);
|
||||||
|
|
||||||
IIcon getVariantIcon(final EnumFlowerStage p0, final boolean p1, final int p2);
|
IIcon getVariantIcon(EnumFlowerStage stage, boolean flowered, int section);
|
||||||
|
|
||||||
int getID();
|
int getID();
|
||||||
|
|
||||||
|
|||||||
@@ -1,29 +1,24 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.api.gardening;
|
package binnie.botany.api.gardening;
|
||||||
|
|
||||||
import binnie.botany.api.EnumSoilType;
|
|
||||||
import binnie.botany.api.EnumMoisture;
|
|
||||||
import binnie.botany.api.EnumAcidity;
|
import binnie.botany.api.EnumAcidity;
|
||||||
|
import binnie.botany.api.EnumMoisture;
|
||||||
|
import binnie.botany.api.EnumSoilType;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public interface IBlockSoil
|
public interface IBlockSoil {
|
||||||
{
|
EnumAcidity getPH(World world, int x, int y, int z);
|
||||||
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);
|
EnumMoisture getMoisture(World world, int x, int y, int z);
|
||||||
|
|
||||||
EnumSoilType getType(final World p0, final int p1, final int p2, final int p3);
|
EnumSoilType getType(World world, int x, int y, int z);
|
||||||
|
|
||||||
boolean fertilise(final World p0, final int p1, final int p2, final int p3, final EnumSoilType p4);
|
boolean fertilise(World world, int x, int y, int z, EnumSoilType maxLevel);
|
||||||
|
|
||||||
boolean degrade(final World p0, final int p1, final int p2, final int p3, final EnumSoilType p4);
|
boolean degrade(World world, int x, int y, int z, EnumSoilType minLevel);
|
||||||
|
|
||||||
boolean setPH(final World p0, final int p1, final int p2, final int p3, final EnumAcidity p4);
|
boolean setPH(World world, int x, int y, int z, EnumAcidity pH);
|
||||||
|
|
||||||
boolean setMoisture(final World p0, final int p1, final int p2, final int p3, final EnumMoisture p4);
|
boolean setMoisture(World world, int x, int y, int z, EnumMoisture p4);
|
||||||
|
|
||||||
boolean resistsWeeds(final World p0, final int p1, final int p2, final int p3);
|
boolean resistsWeeds(World world, int x, int y, int z);
|
||||||
}
|
}
|
||||||
@@ -1,147 +1,146 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.ceramic;
|
package binnie.botany.ceramic;
|
||||||
|
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
|
||||||
import binnie.botany.Botany;
|
import binnie.botany.Botany;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
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;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
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 net.minecraft.world.World;
|
|
||||||
import binnie.botany.CreativeTabBotany;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import binnie.core.block.IBlockMetadata;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
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.EnumChatFormatting;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class BlockCeramic extends Block implements IBlockMetadata
|
import java.util.ArrayList;
|
||||||
{
|
import java.util.List;
|
||||||
|
|
||||||
|
public class BlockCeramic extends Block implements IBlockMetadata {
|
||||||
public BlockCeramic() {
|
public BlockCeramic() {
|
||||||
super(Material.rock);
|
super(Material.rock);
|
||||||
this.setHardness(1.0f);
|
setHardness(1.0f);
|
||||||
this.setResistance(5.0f);
|
setResistance(5.0f);
|
||||||
this.setBlockName("ceramic");
|
setBlockName("ceramic");
|
||||||
this.setCreativeTab(CreativeTabBotany.instance);
|
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) {
|
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
||||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean removedByPlayer(final World world, final EntityPlayer player, final int x, final int y, final int z) {
|
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(final World var1, final int i) {
|
public TileEntity createNewTileEntity(World var1, int i) {
|
||||||
return new TileEntityMetadata();
|
return new TileEntityMetadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasTileEntity(final int meta) {
|
public boolean hasTileEntity(int meta) {
|
||||||
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 boolean onBlockEventReceived(World world, int x, int y, int z, int eventId, int eventType) {
|
||||||
super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6);
|
super.onBlockEventReceived(world, x, y, z, eventId, eventType);
|
||||||
final TileEntity tileentity = par1World.getTileEntity(par2, par3, par4);
|
TileEntity tileentity = world.getTileEntity(x, y, z);
|
||||||
return tileentity != null && tileentity.receiveClientEvent(par5, par6);
|
return tileentity != null && tileentity.receiveClientEvent(eventId, eventType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getPlacedMeta(final ItemStack stack, final World world, final int x, final int y, final int z, final ForgeDirection clickedBlock) {
|
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
|
||||||
return TileEntityMetadata.getItemDamage(stack);
|
return TileEntityMetadata.getItemDamage(itemStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDroppedMeta(final int blockMeta, final int tileMeta) {
|
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
||||||
return tileMeta;
|
return tileMeta;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getBlockName(final ItemStack par1ItemStack) {
|
public String getBlockName(ItemStack itemStack) {
|
||||||
final int meta = TileEntityMetadata.getItemDamage(par1ItemStack);
|
return I18N.localise("botany.ceramicBlock");
|
||||||
return EnumFlowerColor.get(meta).getName() + " Ceramic Block";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getBlockTooltip(final ItemStack par1ItemStack, final List par3List) {
|
public void addBlockTooltip(ItemStack stack, List tooltip) {
|
||||||
|
int meta = TileEntityMetadata.getItemDamage(stack);
|
||||||
|
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(meta).getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dropAsStack(final World world, final int x, final int y, final int z, final ItemStack drop) {
|
public void dropAsStack(World world, int x, int y, int z, ItemStack itemStack) {
|
||||||
this.dropBlockAsItem(world, x, y, z, drop);
|
dropBlockAsItem(world, x, y, z, itemStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List itemList) {
|
public void getSubBlocks(Item item, CreativeTabs tabs, List itemList) {
|
||||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||||
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
|
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 IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||||
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||||
if (tile != null) {
|
if (tile != null) {
|
||||||
return this.getIcon(side, tile.getTileMetadata());
|
return getIcon(side, tile.getTileMetadata());
|
||||||
}
|
}
|
||||||
return super.getIcon(world, x, y, z, side);
|
return super.getIcon(world, x, y, z, side);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getIcon(final int side, final int meta) {
|
public IIcon getIcon(int side, int meta) {
|
||||||
return this.blockIcon;
|
return blockIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(final IIconRegister register) {
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
this.blockIcon = Botany.proxy.getIcon(register, "ceramic");
|
blockIcon = Botany.proxy.getIcon(register, "ceramic");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int colorMultiplier(final IBlockAccess world, final int x, final int y, final int z) {
|
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
||||||
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||||
if (tile != null) {
|
if (tile != null) {
|
||||||
return this.getRenderColor(tile.getTileMetadata());
|
return getRenderColor(tile.getTileMetadata());
|
||||||
}
|
}
|
||||||
return 16777215;
|
return 0xffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(final World par1World, final int par2, final int par3, final int par4, final Block par5, final int par6) {
|
public void breakBlock(World world, int x, int y, int z, Block block, int side) {
|
||||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
super.breakBlock(world, x, y, z, block, side);
|
||||||
par1World.removeTileEntity(par2, par3, par4);
|
world.removeTileEntity(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getPickBlock(final MovingObjectPosition target, final World world, final int x, final int y, final int z) {
|
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int getRenderColor(final int meta) {
|
public int getRenderColor(int meta) {
|
||||||
return EnumFlowerColor.get(meta).getColor(false);
|
return EnumFlowerColor.get(meta).getColor(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,138 +1,140 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.ceramic;
|
package binnie.botany.ceramic;
|
||||||
|
|
||||||
|
import binnie.botany.Botany;
|
||||||
|
import binnie.botany.CreativeTabBotany;
|
||||||
|
import binnie.botany.genetics.EnumFlowerColor;
|
||||||
import binnie.botany.items.BotanyItems;
|
import binnie.botany.items.BotanyItems;
|
||||||
import binnie.core.BinnieCore;
|
import binnie.core.BinnieCore;
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
import binnie.core.block.BlockMetadata;
|
||||||
import binnie.botany.Botany;
|
import binnie.core.block.IBlockMetadata;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import binnie.core.block.IMultipassBlock;
|
||||||
import binnie.core.block.MultipassBlockRenderer;
|
import binnie.core.block.MultipassBlockRenderer;
|
||||||
|
import binnie.core.block.TileEntityMetadata;
|
||||||
|
import binnie.core.util.I18N;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
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;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
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.EnumChatFormatting;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipassBlock
|
import java.util.ArrayList;
|
||||||
{
|
import java.util.List;
|
||||||
|
|
||||||
|
public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipassBlock {
|
||||||
public BlockCeramicBrick() {
|
public BlockCeramicBrick() {
|
||||||
super(Material.rock);
|
super(Material.rock);
|
||||||
this.setHardness(1.0f);
|
setHardness(1.0f);
|
||||||
this.setResistance(5.0f);
|
setResistance(5.0f);
|
||||||
this.setBlockName("ceramicBrick");
|
setBlockName("ceramicBrick");
|
||||||
this.setCreativeTab(CreativeTabBotany.instance);
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BlockType getType(final int meta) {
|
private static BlockType getType(int meta) {
|
||||||
return new BlockType(meta);
|
return new BlockType(meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int blockMeta, final int fortune) {
|
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
||||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean removedByPlayer(final World world, final EntityPlayer player, final int x, final int y, final int z) {
|
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) {
|
||||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(final World var1, final int i) {
|
public TileEntity createNewTileEntity(World var1, int i) {
|
||||||
return new TileEntityMetadata();
|
return new TileEntityMetadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasTileEntity(final int meta) {
|
public boolean hasTileEntity(int meta) {
|
||||||
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 boolean onBlockEventReceived(World world, int x, int y, int z, int eventId, int eventType) {
|
||||||
super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6);
|
super.onBlockEventReceived(world, x, y, z, eventId, eventType);
|
||||||
final TileEntity tileentity = par1World.getTileEntity(par2, par3, par4);
|
TileEntity tileentity = world.getTileEntity(x, y, z);
|
||||||
return tileentity != null && tileentity.receiveClientEvent(par5, par6);
|
return tileentity != null && tileentity.receiveClientEvent(eventId, eventType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getPlacedMeta(final ItemStack stack, final World world, final int x, final int y, final int z, final ForgeDirection clickedBlock) {
|
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
|
||||||
return TileEntityMetadata.getItemDamage(stack);
|
return TileEntityMetadata.getItemDamage(itemStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDroppedMeta(final int blockMeta, final int tileMeta) {
|
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
||||||
return tileMeta;
|
return tileMeta;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getBlockName(final ItemStack par1ItemStack) {
|
public String getBlockName(ItemStack itemStack) {
|
||||||
final int meta = TileEntityMetadata.getItemDamage(par1ItemStack);
|
int meta = TileEntityMetadata.getItemDamage(itemStack);
|
||||||
return getType(meta).getName();
|
return getType(meta).getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getBlockTooltip(final ItemStack par1ItemStack, final List par3List) {
|
public void addBlockTooltip(ItemStack itemStack, List tooltip) {
|
||||||
|
int meta = TileEntityMetadata.getItemDamage(itemStack);
|
||||||
|
getType(meta).addTooltip(tooltip);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dropAsStack(final World world, final int x, final int y, final int z, final ItemStack drop) {
|
public void dropAsStack(World world, int x, int y, int z, ItemStack itemStack) {
|
||||||
this.dropBlockAsItem(world, x, y, z, drop);
|
dropBlockAsItem(world, x, y, z, itemStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List itemList) {
|
public void getSubBlocks(Item item, CreativeTabs tab, List itemList) {
|
||||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||||
final BlockType type = new BlockType(c, c, TileType.Tile);
|
BlockType type = new BlockType(c, c, TileType.Tile);
|
||||||
itemList.add(TileEntityMetadata.getItemStack(this, type.ordinal()));
|
itemList.add(TileEntityMetadata.getItemStack(this, type.ordinal()));
|
||||||
}
|
}
|
||||||
for (final TileType type2 : TileType.values()) {
|
|
||||||
|
for (TileType type2 : TileType.values()) {
|
||||||
if (type2.canDouble()) {
|
if (type2.canDouble()) {
|
||||||
itemList.add(new BlockType(EnumFlowerColor.Brown, EnumFlowerColor.Gold, type2).getStack(1));
|
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.GOLD, TileType.Split).getStack(1));
|
||||||
itemList.add(new BlockType(EnumFlowerColor.Gold, EnumFlowerColor.Brown, TileType.LargeBrick).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
|
@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 IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||||
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||||
if (tile != null) {
|
if (tile != null) {
|
||||||
return this.getIcon(side, tile.getTileMetadata());
|
return getIcon(side, tile.getTileMetadata());
|
||||||
}
|
}
|
||||||
return super.getIcon(world, x, y, z, side);
|
return super.getIcon(world, x, y, z, side);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getIcon(final int side, final int meta) {
|
public IIcon getIcon(int side, int meta) {
|
||||||
return getType(meta).getIcon(MultipassBlockRenderer.getLayer());
|
return getType(meta).getIcon(MultipassBlockRenderer.getLayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(final IIconRegister register) {
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
for (final TileType type : TileType.values()) {
|
for (TileType type : TileType.values()) {
|
||||||
for (int i = 0; i < 3; ++i) {
|
for (int i = 0; i < 3; ++i) {
|
||||||
type.icons[i] = Botany.proxy.getIcon(register, "ceramic." + type.id + "." + i);
|
type.icons[i] = Botany.proxy.getIcon(register, "ceramic." + type.id + "." + i);
|
||||||
}
|
}
|
||||||
@@ -141,29 +143,29 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int colorMultiplier(final IBlockAccess world, final int x, final int y, final int z) {
|
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
||||||
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||||
if (tile != null) {
|
if (tile != null) {
|
||||||
return this.getRenderColor(tile.getTileMetadata());
|
return getRenderColor(tile.getTileMetadata());
|
||||||
}
|
}
|
||||||
return 16777215;
|
return 0xffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(final World par1World, final int par2, final int par3, final int par4, final Block par5, final int par6) {
|
public void breakBlock(World world, int x, int y, int z, Block block, int side) {
|
||||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
super.breakBlock(world, x, y, z, block, side);
|
||||||
par1World.removeTileEntity(par2, par3, par4);
|
world.removeTileEntity(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getPickBlock(final MovingObjectPosition target, final World world, final int x, final int y, final int z) {
|
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int getRenderColor(final int meta) {
|
public int getRenderColor(int meta) {
|
||||||
return this.colorMultiplier(meta);
|
return colorMultiplier(meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -172,10 +174,10 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int colorMultiplier(final int meta) {
|
public int colorMultiplier(int meta) {
|
||||||
final BlockType type = getType(meta);
|
BlockType type = getType(meta);
|
||||||
if (MultipassBlockRenderer.getLayer() == 0) {
|
if (MultipassBlockRenderer.getLayer() == 0) {
|
||||||
return 16777215;
|
return 0xffffff;
|
||||||
}
|
}
|
||||||
if (MultipassBlockRenderer.getLayer() == 1) {
|
if (MultipassBlockRenderer.getLayer() == 1) {
|
||||||
return type.color1.getColor(false);
|
return type.color1.getColor(false);
|
||||||
@@ -188,30 +190,29 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
|||||||
return BinnieCore.multipassRenderID;
|
return BinnieCore.multipassRenderID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum TileType
|
public enum TileType {
|
||||||
{
|
Tile("tile", "ceramicTile"),
|
||||||
Tile("tile", "Ceramic Tile"),
|
Brick("brick", "ceramicBricks"),
|
||||||
Brick("brick", "Ceramic Bricks"),
|
StripeBrick("brickstripe", "strippedCeramicBricks"),
|
||||||
StripeBrick("brickstripe", "Striped Ceramic Bricks"),
|
LargeBrick("bricklarge", "largeCeramicBricks"),
|
||||||
LargeBrick("bricklarge", "Large Ceramic Bricks"),
|
Split("split", "splitCeramicTile"),
|
||||||
Split("split", "Split Ceramic Tile"),
|
Chequered("cheque", "chequeredCeramicTile"),
|
||||||
Chequered("cheque", "Chequered Ceramic Tile"),
|
Mixed("mixed", "mixedCeramicTile"),
|
||||||
Mixed("mixed", "Mixed Ceramic Tile"),
|
VerticalBrick("verticalbrick", "verticalCeramicBricks"),
|
||||||
VerticalBrick("verticalbrick", "Vertical Ceramic Bricks"),
|
VerticalStripeBrick("verticalbrickstripe", "verticalStripedCeramicBricks"),
|
||||||
VerticalStripeBrick("verticalbrickstripe", "Vertical Striped Ceramic Bricks"),
|
VerticalLargeBrick("verticalbricklarge", "largeVerticalCeramicBricks");
|
||||||
VerticalLargeBrick("verticalbricklarge", "Large Vertical Ceramic Bricks");
|
|
||||||
|
|
||||||
String id;
|
protected String id;
|
||||||
String name;
|
protected String name;
|
||||||
IIcon[] icons;
|
protected IIcon[] icons;
|
||||||
|
|
||||||
private TileType(final String id, final String name) {
|
TileType(String id, String name) {
|
||||||
this.icons = new IIcon[3];
|
icons = new IIcon[3];
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TileType get(final int id) {
|
public static TileType get(int id) {
|
||||||
return values()[id % values().length];
|
return values()[id % values().length];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,311 +220,334 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
|||||||
return this != TileType.Tile;
|
return this != TileType.Tile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getRecipe(final List<ItemStack> stacks) {
|
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||||
switch (this) {
|
switch (this) {
|
||||||
case Tile: {
|
case Tile:
|
||||||
if (stacks.size() != 4) {
|
return getTileRecipe(stacks);
|
||||||
return null;
|
|
||||||
}
|
case Split:
|
||||||
int mortars = 0;
|
return getSplitRecipe(stacks);
|
||||||
int blocks = 0;
|
|
||||||
int blockColor = -1;
|
case Chequered:
|
||||||
for (final ItemStack stack : stacks) {
|
return getChequeredRecipe(stacks);
|
||||||
if (this.isMortar(stack)) {
|
|
||||||
++mortars;
|
case Mixed:
|
||||||
}
|
return getMixedRecipe(stacks);
|
||||||
else {
|
|
||||||
if (stack.getItem() != Item.getItemFromBlock(Botany.ceramic)) {
|
case LargeBrick:
|
||||||
return null;
|
return getLargeBrickRecipe(stacks);
|
||||||
}
|
|
||||||
++blocks;
|
case Brick:
|
||||||
final int color = TileEntityMetadata.getItemDamage(stack);
|
case StripeBrick:
|
||||||
if (blockColor == -1) {
|
return getBrickRecipe(stacks);
|
||||||
blockColor = color;
|
|
||||||
}
|
case VerticalLargeBrick:
|
||||||
else {
|
case VerticalBrick:
|
||||||
if (blockColor != color) {
|
case VerticalStripeBrick:
|
||||||
return null;
|
return getVerticalBrickRecipe(stacks);
|
||||||
}
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isMortar(final ItemStack stack) {
|
private ItemStack getTileRecipe(List<ItemStack> stacks) {
|
||||||
return stack.getItem() == Botany.misc && stack.getItemDamage() == BotanyItems.Mortar.ordinal();
|
if (stacks.size() != 4) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
int mortars = 0;
|
||||||
|
int blockColor = -1;
|
||||||
|
for (ItemStack stack : stacks) {
|
||||||
|
if (isMortar(stack)) {
|
||||||
|
mortars++;
|
||||||
|
} else {
|
||||||
|
if (stack.getItem() != Item.getItemFromBlock(Botany.ceramic)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
int color = TileEntityMetadata.getItemDamage(stack);
|
||||||
|
if (blockColor == -1) {
|
||||||
|
blockColor = color;
|
||||||
|
} else if (blockColor != color) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mortars != 1) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
EnumFlowerColor c = EnumFlowerColor.get(blockColor);
|
||||||
|
return new BlockType(c, c, TileType.Tile).getStack(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ItemStack getSplitRecipe(List<ItemStack> stacks) {
|
||||||
|
if (stacks.size() != 4) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
int[] colors = {-1, -1};
|
||||||
|
int altCounter = 0;
|
||||||
|
for (ItemStack stack : stacks) {
|
||||||
|
int alt = (altCounter != 0 && altCounter != 3) ? 1 : 0;
|
||||||
|
if (stack.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
BlockType type = new BlockType(stack);
|
||||||
|
if (type.type != TileType.Tile) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ItemStack getChequeredRecipe(List<ItemStack> stacks) {
|
||||||
|
if (stacks.size() != 4) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
int[] colors = {-1, -1};
|
||||||
|
for (ItemStack stack : stacks) {
|
||||||
|
if (stack.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
BlockType type2 = new BlockType(stack);
|
||||||
|
if (type2.type != TileType.Split) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
int color1 = type2.color1.ordinal();
|
||||||
|
int color2 = type2.color2.ordinal();
|
||||||
|
if (colors[0] == -1) {
|
||||||
|
colors[0] = color1;
|
||||||
|
colors[1] = color2;
|
||||||
|
} else if (colors[0] != color1 || colors[1] != color2) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new BlockType(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), TileType.Chequered).getStack(4);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ItemStack getMixedRecipe(List<ItemStack> stacks) {
|
||||||
|
if (stacks.size() != 4) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
int[] colors = {-1, -1};
|
||||||
|
for (ItemStack stack : stacks) {
|
||||||
|
if (stack.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
BlockType type2 = new BlockType(stack);
|
||||||
|
if (type2.isTwoColors()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (colors[0] == -1 || colors[1] == -1) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new BlockType(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), TileType.Mixed).getStack(4);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ItemStack getLargeBrickRecipe(List<ItemStack> stacks) {
|
||||||
|
if (stacks.size() == 1) {
|
||||||
|
ItemStack stack3 = stacks.get(0);
|
||||||
|
BlockType type3 = new BlockType(stack3);
|
||||||
|
if (type3.type == TileType.VerticalLargeBrick) {
|
||||||
|
type3.type = this;
|
||||||
|
return type3.getStack(1);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stacks.size() != 3) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
int[] colors = {-1, -1};
|
||||||
|
for (ItemStack stack4 : stacks) {
|
||||||
|
if (stack4.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
BlockType type4 = new BlockType(stack4);
|
||||||
|
if (type4.type != TileType.Tile) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
int color5 = type4.color1.ordinal();
|
||||||
|
if (colors[0] == -1) {
|
||||||
|
colors[0] = color5;
|
||||||
|
} else if (colors[1] == -1) {
|
||||||
|
colors[1] = color5;
|
||||||
|
} else if (colors[1] != color5) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (colors[1] == -1) {
|
||||||
|
colors[1] = colors[0];
|
||||||
|
}
|
||||||
|
return new BlockType(EnumFlowerColor.get(colors[0]), EnumFlowerColor.get(colors[1]), TileType.LargeBrick).getStack(3);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ItemStack getBrickRecipe(List<ItemStack> stacks) {
|
||||||
|
if (stacks.size() == 1) {
|
||||||
|
ItemStack stack = stacks.get(0);
|
||||||
|
BlockType type = new BlockType(stack);
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stacks.size() != 4) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
int[] colors = {-1, -1};
|
||||||
|
for (int index2 = 0; index2 < stacks.size(); ++index2) {
|
||||||
|
ItemStack stack = stacks.get(index2);
|
||||||
|
if (stack.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
BlockType type = new BlockType(stack);
|
||||||
|
if (type.type != TileType.LargeBrick) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
int color5 = type.color1.ordinal();
|
||||||
|
int color6 = type.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);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ItemStack getVerticalBrickRecipe(List<ItemStack> stacks) {
|
||||||
|
if (stacks.size() != 1) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemStack stack5 = stacks.get(0);
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isMortar(ItemStack stack) {
|
||||||
|
return stack.getItem() == Botany.misc
|
||||||
|
&& stack.getItemDamage() == BotanyItems.Mortar.ordinal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class BlockType
|
public static class BlockType {
|
||||||
{
|
protected EnumFlowerColor color1;
|
||||||
EnumFlowerColor color1;
|
protected EnumFlowerColor color2;
|
||||||
EnumFlowerColor color2;
|
protected TileType type;
|
||||||
TileType type;
|
|
||||||
|
|
||||||
private BlockType(final EnumFlowerColor color1, final EnumFlowerColor color2, final TileType type) {
|
private BlockType(EnumFlowerColor color1, EnumFlowerColor color2, TileType type) {
|
||||||
this.color1 = color1;
|
this.color1 = color1;
|
||||||
this.color2 = color2;
|
this.color2 = color2;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isTwoColors() {
|
public boolean isTwoColors() {
|
||||||
return this.type.canDouble() && this.color2 != this.color1;
|
return type.canDouble() && color2 != color1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockType(final ItemStack stack) {
|
public BlockType(ItemStack stack) {
|
||||||
this(TileEntityMetadata.getItemDamage(stack));
|
this(TileEntityMetadata.getItemDamage(stack));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getStack(final int i) {
|
public ItemStack getStack(int stackSize) {
|
||||||
final ItemStack s = TileEntityMetadata.getItemStack(Botany.ceramicBrick, this.ordinal());
|
ItemStack stack = TileEntityMetadata.getItemStack(Botany.ceramicBrick, ordinal());
|
||||||
s.stackSize = i;
|
stack.stackSize = stackSize;
|
||||||
return s;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockType(final int id) {
|
public BlockType(int id) {
|
||||||
this.color1 = EnumFlowerColor.get(id & 0xFF);
|
color1 = EnumFlowerColor.get(id & 0xFF);
|
||||||
this.color2 = EnumFlowerColor.get(id >> 8 & 0xFF);
|
color2 = EnumFlowerColor.get(id >> 8 & 0xFF);
|
||||||
this.type = TileType.get(id >> 16 & 0xFF);
|
type = TileType.get(id >> 16 & 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
String name = this.color1.getName();
|
return I18N.localise("botany." + type.name);
|
||||||
if (this.type.canDouble() && this.color2 != this.color1) {
|
}
|
||||||
name = name + " & " + this.color2.getName();
|
|
||||||
|
public void addTooltip(List tooltip) {
|
||||||
|
String name = color1.getName();
|
||||||
|
if (type.canDouble() && color2 != color1) {
|
||||||
|
name = I18N.localise("botany.colour.double", name, color2.getName());
|
||||||
}
|
}
|
||||||
return name + " " + this.type.name;
|
tooltip.add(EnumChatFormatting.GRAY + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int ordinal() {
|
public int ordinal() {
|
||||||
return this.color1.ordinal() + this.color2.ordinal() * 256 + this.type.ordinal() * 256 * 256;
|
return color1.ordinal() + color2.ordinal() * 256 + type.ordinal() * 65536;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IIcon getIcon(final int layer) {
|
public IIcon getIcon(int layer) {
|
||||||
return this.type.icons[layer];
|
return type.icons[layer];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,35 +1,42 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.ceramic;
|
package binnie.botany.ceramic;
|
||||||
|
|
||||||
|
import binnie.botany.CreativeTabBotany;
|
||||||
|
import binnie.botany.genetics.EnumFlowerColor;
|
||||||
|
import binnie.core.block.TileEntityMetadata;
|
||||||
|
import binnie.core.util.I18N;
|
||||||
|
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 net.minecraft.block.material.Material;
|
||||||
import binnie.extratrees.carpentry.BlockDesign;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
|
|
||||||
public class BlockCeramicPatterned extends BlockDesign
|
import java.util.List;
|
||||||
{
|
|
||||||
|
public class BlockCeramicPatterned extends BlockDesign {
|
||||||
public BlockCeramicPatterned() {
|
public BlockCeramicPatterned() {
|
||||||
super(CeramicDesignSystem.instance, Material.rock);
|
super(CeramicDesignSystem.instance, Material.rock);
|
||||||
this.setHardness(1.0f);
|
setHardness(1.0f);
|
||||||
this.setResistance(5.0f);
|
setResistance(5.0f);
|
||||||
this.setCreativeTab(CreativeTabBotany.instance);
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
this.setBlockName("ceramicPattern");
|
setBlockName("ceramicPattern");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getCreativeStack(final IDesign design) {
|
public ItemStack getCreativeStack(IDesign design) {
|
||||||
return ModuleCarpentry.getItemStack(this, CeramicColor.get(EnumFlowerColor.White), CeramicColor.get(EnumFlowerColor.Black), design);
|
return ModuleCarpentry.getItemStack(this, CeramicColor.get(EnumFlowerColor.WHITE), CeramicColor.get(EnumFlowerColor.BLACK), design);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getBlockName(final DesignBlock design) {
|
public String getBlockName(DesignBlock design) {
|
||||||
return design.getDesign().getName() + " Ceramic Block";
|
return I18N.localise("botany.ceramicBlock");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addBlockTooltip(ItemStack stack, List tooltip) {
|
||||||
|
super.addBlockTooltip(stack, tooltip);
|
||||||
|
DesignBlock block = ModuleCarpentry.getDesignBlock(getDesignSystem(), TileEntityMetadata.getItemDamage(stack));
|
||||||
|
tooltip.add(EnumChatFormatting.GRAY + block.getDesign().getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,46 +1,43 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.ceramic;
|
package binnie.botany.ceramic;
|
||||||
|
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
|
||||||
import binnie.botany.Botany;
|
import binnie.botany.Botany;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import binnie.botany.CreativeTabBotany;
|
||||||
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 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 binnie.core.block.BlockMetadata;
|
||||||
import net.minecraft.item.ItemStack;
|
import binnie.core.block.IBlockMetadata;
|
||||||
import java.util.ArrayList;
|
import binnie.core.block.TileEntityMetadata;
|
||||||
import net.minecraft.world.World;
|
import binnie.core.util.I18N;
|
||||||
import binnie.extratrees.ExtraTrees;
|
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.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
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;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
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.EnumChatFormatting;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
import net.minecraft.util.MovingObjectPosition;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class BlockStained extends Block implements IBlockMetadata
|
import java.util.ArrayList;
|
||||||
{
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
public class BlockStained extends Block implements IBlockMetadata {
|
||||||
public BlockStained() {
|
public BlockStained() {
|
||||||
super(Material.glass);
|
super(Material.glass);
|
||||||
this.setCreativeTab(CreativeTabBotany.instance);
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
this.setBlockName("stained");
|
setBlockName("stained");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int quantityDropped(final Random p_149745_1_) {
|
public int quantityDropped(Random rand) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,136 +59,139 @@ public class BlockStained extends Block implements IBlockMetadata
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@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_) {
|
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
||||||
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_]);
|
// Block block2 = world.getBlock(x - Facing.offsetsXForSide[side], y - Facing.offsetsYForSide[side], z - Facing.offsetsZForSide[side]);
|
||||||
final Block block3 = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_);
|
Block block = world.getBlock(x, y, z);
|
||||||
return block3 != this && block3 != ExtraTrees.blockStained && super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_);
|
return block != this
|
||||||
|
&& block != ExtraTrees.blockStained
|
||||||
|
&& super.shouldSideBeRendered(world, x, y, z, side);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int blockMeta, final int fortune) {
|
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
||||||
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
return BlockMetadata.getBlockDropped(this, world, x, y, z, blockMeta);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean removedByPlayer(final World world, final EntityPlayer player, final int x, final int y, final int z) {
|
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||||
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
return BlockMetadata.breakBlock(this, player, world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(final World var1, final int i) {
|
public TileEntity createNewTileEntity(World var1, int i) {
|
||||||
return new TileEntityMetadata();
|
return new TileEntityMetadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasTileEntity(final int meta) {
|
public boolean hasTileEntity(int meta) {
|
||||||
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 boolean onBlockEventReceived(World world, int x, int y, int z, int eventId, int eventType) {
|
||||||
super.onBlockEventReceived(par1World, par2, par3, par4, par5, par6);
|
super.onBlockEventReceived(world, x, y, z, eventId, eventType);
|
||||||
final TileEntity tileentity = par1World.getTileEntity(par2, par3, par4);
|
TileEntity tileentity = world.getTileEntity(x, y, z);
|
||||||
return tileentity != null && tileentity.receiveClientEvent(par5, par6);
|
return tileentity != null && tileentity.receiveClientEvent(eventId, eventType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getPlacedMeta(final ItemStack stack, final World world, final int x, final int y, final int z, final ForgeDirection clickedBlock) {
|
public int getPlacedMeta(ItemStack itemStack, World world, int x, int y, int z, ForgeDirection direction) {
|
||||||
return TileEntityMetadata.getItemDamage(stack);
|
return TileEntityMetadata.getItemDamage(itemStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDroppedMeta(final int blockMeta, final int tileMeta) {
|
public int getDroppedMeta(int blockMeta, int tileMeta) {
|
||||||
return tileMeta;
|
return tileMeta;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getBlockName(final ItemStack par1ItemStack) {
|
public String getBlockName(ItemStack itemStack) {
|
||||||
final int meta = TileEntityMetadata.getItemDamage(par1ItemStack);
|
return I18N.localise("botany.pigmentedGlass");
|
||||||
return EnumFlowerColor.get(meta).getName() + " Pigmented Glass";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getBlockTooltip(final ItemStack par1ItemStack, final List par3List) {
|
public void addBlockTooltip(ItemStack itemStack, List tooltip) {
|
||||||
|
int meta = TileEntityMetadata.getItemDamage(itemStack);
|
||||||
|
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(meta).getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dropAsStack(final World world, final int x, final int y, final int z, final ItemStack drop) {
|
public void dropAsStack(World world, int x, int y, int z, ItemStack stack) {
|
||||||
this.dropBlockAsItem(world, x, y, z, drop);
|
dropBlockAsItem(world, x, y, z, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List itemList) {
|
public void getSubBlocks(Item item, CreativeTabs tab, List itemList) {
|
||||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||||
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
|
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 IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||||
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||||
if (tile != null) {
|
if (tile != null) {
|
||||||
return this.getIcon(side, tile.getTileMetadata());
|
return getIcon(side, tile.getTileMetadata());
|
||||||
}
|
}
|
||||||
return super.getIcon(world, x, y, z, side);
|
return super.getIcon(world, x, y, z, side);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getIcon(final int side, final int meta) {
|
public IIcon getIcon(int side, int meta) {
|
||||||
return this.blockIcon;
|
return blockIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(final IIconRegister register) {
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
this.blockIcon = Botany.proxy.getIcon(register, "stained");
|
blockIcon = Botany.proxy.getIcon(register, "stained");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int colorMultiplier(final IBlockAccess world, final int x, final int y, final int z) {
|
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
||||||
final TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
TileEntityMetadata tile = TileEntityMetadata.getTile(world, x, y, z);
|
||||||
if (tile != null) {
|
if (tile != null) {
|
||||||
return this.getRenderColor(tile.getTileMetadata());
|
return getRenderColor(tile.getTileMetadata());
|
||||||
}
|
}
|
||||||
return 16777215;
|
return 0xffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(final World par1World, final int par2, final int par3, final int par4, final Block par5, final int par6) {
|
public void breakBlock(World world, int x, int y, int z, Block block, int side) {
|
||||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
super.breakBlock(world, x, y, z, block, side);
|
||||||
par1World.removeTileEntity(par2, par3, par4);
|
world.removeTileEntity(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isWood(final IBlockAccess world, final int x, final int y, final int z) {
|
public boolean isWood(IBlockAccess world, int x, int y, int z) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFlammability(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
|
public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||||
return 20;
|
return 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFlammable(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
|
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFireSpreadSpeed(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection face) {
|
public int getFireSpreadSpeed(IBlockAccess world, int x, int y, int z, ForgeDirection face) {
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getPickBlock(final MovingObjectPosition target, final World world, final int x, final int y, final int z) {
|
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||||
return BlockMetadata.getPickBlock(world, x, y, z);
|
return BlockMetadata.getPickBlock(world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int getRenderColor(final int meta) {
|
public int getRenderColor(int meta) {
|
||||||
return EnumFlowerColor.get(meta).getColor(false);
|
return EnumFlowerColor.get(meta).getColor(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,49 +1,46 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.ceramic;
|
package binnie.botany.ceramic;
|
||||||
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import binnie.core.block.TileEntityMetadata;
|
|
||||||
import binnie.botany.Botany;
|
import binnie.botany.Botany;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import java.util.Map;
|
|
||||||
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;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class CeramicColor implements IDesignMaterial
|
import java.util.LinkedHashMap;
|
||||||
{
|
import java.util.Map;
|
||||||
EnumFlowerColor color;
|
|
||||||
static Map<EnumFlowerColor, CeramicColor> map;
|
|
||||||
|
|
||||||
CeramicColor(final EnumFlowerColor color) {
|
public class CeramicColor implements IDesignMaterial {
|
||||||
|
private static Map<EnumFlowerColor, CeramicColor> map;
|
||||||
|
|
||||||
|
static {
|
||||||
|
CeramicColor.map = new LinkedHashMap<>();
|
||||||
|
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||||
|
CeramicColor.map.put(c, new CeramicColor(c));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected EnumFlowerColor color;
|
||||||
|
|
||||||
|
CeramicColor(EnumFlowerColor color) {
|
||||||
this.color = color;
|
this.color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CeramicColor get(final EnumFlowerColor c) {
|
public static CeramicColor get(EnumFlowerColor c) {
|
||||||
return CeramicColor.map.get(c);
|
return CeramicColor.map.get(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getStack() {
|
public ItemStack getStack() {
|
||||||
return TileEntityMetadata.getItemStack(Botany.ceramic, this.color.ordinal());
|
return TileEntityMetadata.getItemStack(Botany.ceramic, color.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.color.getName();
|
return color.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getColour() {
|
public int getColor() {
|
||||||
return this.color.getColor(false);
|
return color.getColor(false);
|
||||||
}
|
|
||||||
|
|
||||||
static {
|
|
||||||
CeramicColor.map = new LinkedHashMap<EnumFlowerColor, CeramicColor>();
|
|
||||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
|
||||||
CeramicColor.map.put(c, new CeramicColor(c));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,56 +1,52 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.ceramic;
|
package binnie.botany.ceramic;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import binnie.botany.items.BotanyItems;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import binnie.botany.Botany;
|
import binnie.botany.Botany;
|
||||||
|
import binnie.botany.genetics.EnumFlowerColor;
|
||||||
|
import binnie.botany.items.BotanyItems;
|
||||||
import binnie.core.AbstractMod;
|
import binnie.core.AbstractMod;
|
||||||
import binnie.core.BinnieCore;
|
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.api.IDesignMaterial;
|
||||||
import binnie.extratrees.carpentry.DesignerManager;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
import java.util.Map;
|
|
||||||
import binnie.extratrees.api.IDesignSystem;
|
import binnie.extratrees.api.IDesignSystem;
|
||||||
|
import binnie.extratrees.api.IPattern;
|
||||||
|
import binnie.extratrees.carpentry.DesignerManager;
|
||||||
|
import binnie.extratrees.carpentry.EnumPattern;
|
||||||
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
|
||||||
public class CeramicDesignSystem implements IDesignSystem
|
import java.util.HashMap;
|
||||||
{
|
import java.util.Map;
|
||||||
public static CeramicDesignSystem instance;
|
|
||||||
Map<Integer, IIcon> primary;
|
public class CeramicDesignSystem implements IDesignSystem {
|
||||||
Map<Integer, IIcon> secondary;
|
public static CeramicDesignSystem instance = new CeramicDesignSystem();
|
||||||
|
|
||||||
|
protected Map<Integer, IIcon> primary;
|
||||||
|
protected Map<Integer, IIcon> secondary;
|
||||||
|
|
||||||
CeramicDesignSystem() {
|
CeramicDesignSystem() {
|
||||||
this.primary = new HashMap<Integer, IIcon>();
|
primary = new HashMap<>();
|
||||||
this.secondary = new HashMap<Integer, IIcon>();
|
secondary = new HashMap<>();
|
||||||
DesignerManager.instance.registerDesignSystem(this);
|
DesignerManager.instance.registerDesignSystem(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IDesignMaterial getDefaultMaterial() {
|
public IDesignMaterial getDefaultMaterial() {
|
||||||
return CeramicColor.get(EnumFlowerColor.White);
|
return CeramicColor.get(EnumFlowerColor.WHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IDesignMaterial getDefaultMaterial2() {
|
public IDesignMaterial getDefaultMaterial2() {
|
||||||
return CeramicColor.get(EnumFlowerColor.Black);
|
return CeramicColor.get(EnumFlowerColor.BLACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IDesignMaterial getMaterial(final int id) {
|
public IDesignMaterial getMaterial(int id) {
|
||||||
return CeramicColor.get(EnumFlowerColor.get(id));
|
return CeramicColor.get(EnumFlowerColor.get(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaterialIndex(final IDesignMaterial id) {
|
public int getMaterialIndex(IDesignMaterial id) {
|
||||||
return ((CeramicColor) id).color.ordinal();
|
return ((CeramicColor) id).color.ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,26 +55,26 @@ public class CeramicDesignSystem implements IDesignSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getPrimaryIcon(final IPattern pattern) {
|
public IIcon getPrimaryIcon(IPattern pattern) {
|
||||||
if (pattern instanceof EnumPattern) {
|
if (pattern instanceof EnumPattern) {
|
||||||
return this.primary.get(((EnumPattern) pattern).ordinal());
|
return primary.get(((EnumPattern) pattern).ordinal());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getSecondaryIcon(final IPattern pattern) {
|
public IIcon getSecondaryIcon(IPattern pattern) {
|
||||||
if (pattern instanceof EnumPattern) {
|
if (pattern instanceof EnumPattern) {
|
||||||
return this.secondary.get(((EnumPattern) pattern).ordinal());
|
return secondary.get(((EnumPattern) pattern).ordinal());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerIcons(final IIconRegister register) {
|
public void registerIcons(IIconRegister register) {
|
||||||
for (final EnumPattern pattern : EnumPattern.values()) {
|
for (EnumPattern pattern : EnumPattern.values()) {
|
||||||
this.primary.put(pattern.ordinal(), BinnieCore.proxy.getIcon(register, this.getMod().getModID(), this.getTexturePath() + "/" + pattern.toString().toLowerCase() + ".0"));
|
primary.put(pattern.ordinal(), BinnieCore.proxy.getIcon(register, getMod().getModID(), getTexturePath() + "/" + pattern.toString().toLowerCase() + ".0"));
|
||||||
this.secondary.put(pattern.ordinal(), BinnieCore.proxy.getIcon(register, this.getMod().getModID(), this.getTexturePath() + "/" + pattern.toString().toLowerCase() + ".1"));
|
secondary.put(pattern.ordinal(), BinnieCore.proxy.getIcon(register, getMod().getModID(), getTexturePath() + "/" + pattern.toString().toLowerCase() + ".1"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,11 +88,7 @@ public class CeramicDesignSystem implements IDesignSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IDesignMaterial getMaterial(final ItemStack itemStack) {
|
public IDesignMaterial getMaterial(ItemStack stack) {
|
||||||
return (itemStack.getItem() == Item.getItemFromBlock(Botany.ceramic)) ? this.getMaterial(itemStack.getItemDamage()) : null;
|
return (stack.getItem() == Item.getItemFromBlock(Botany.ceramic)) ? getMaterial(stack.getItemDamage()) : null;
|
||||||
}
|
|
||||||
|
|
||||||
static {
|
|
||||||
CeramicDesignSystem.instance = new CeramicDesignSystem();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,43 +1,39 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.ceramic;
|
package binnie.botany.ceramic;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import binnie.botany.Botany;
|
import 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.world.World;
|
||||||
|
|
||||||
public class CeramicTileRecipe implements IRecipe
|
import java.util.ArrayList;
|
||||||
{
|
import java.util.List;
|
||||||
ItemStack cached;
|
|
||||||
|
public class CeramicTileRecipe implements IRecipe {
|
||||||
|
protected ItemStack cached;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(final InventoryCrafting inv, final World world) {
|
public boolean matches(InventoryCrafting crafting, World world) {
|
||||||
this.cached = this.getCraftingResult(inv);
|
cached = getCraftingResult(crafting);
|
||||||
return this.cached != null;
|
return cached != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getCraftingResult(final InventoryCrafting inv) {
|
public ItemStack getCraftingResult(InventoryCrafting inv) {
|
||||||
final Item ceramicBlock = Item.getItemFromBlock(Botany.ceramic);
|
Item ceramicBlock = Item.getItemFromBlock(Botany.ceramic);
|
||||||
final Item ceramicTile = Item.getItemFromBlock(Botany.ceramicTile);
|
Item ceramicTile = Item.getItemFromBlock(Botany.ceramicTile);
|
||||||
final Item ceramicBrick = Item.getItemFromBlock(Botany.ceramicBrick);
|
Item ceramicBrick = Item.getItemFromBlock(Botany.ceramicBrick);
|
||||||
final Item mortar = Botany.misc;
|
Item mortar = Botany.misc;
|
||||||
final List<ItemStack> stacks = new ArrayList<ItemStack>();
|
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);
|
ItemStack stack = inv.getStackInSlot(i);
|
||||||
if (stack != null) {
|
if (stack != null) {
|
||||||
final int x = i / 3;
|
int x = i / 3;
|
||||||
final int y = i % 3;
|
int y = i % 3;
|
||||||
if (ix == -1) {
|
if (ix == -1) {
|
||||||
ix = x;
|
ix = x;
|
||||||
iy = y;
|
iy = y;
|
||||||
@@ -45,14 +41,17 @@ public class CeramicTileRecipe implements IRecipe
|
|||||||
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 null;
|
||||||
}
|
}
|
||||||
if (stack.getItem() != ceramicBlock && stack.getItem() != ceramicTile && stack.getItem() != ceramicBrick && stack.getItem() != mortar) {
|
|
||||||
|
Item item = stack.getItem();
|
||||||
|
if (item != ceramicBlock && item != ceramicTile && item != ceramicBrick && item != mortar) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
stacks.add(stack);
|
stacks.add(stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (final BlockCeramicBrick.TileType type : BlockCeramicBrick.TileType.values()) {
|
|
||||||
final ItemStack stack2 = type.getRecipe(stacks);
|
for (BlockCeramicBrick.TileType type : BlockCeramicBrick.TileType.values()) {
|
||||||
|
ItemStack stack2 = type.getRecipe(stacks);
|
||||||
if (stack2 != null) {
|
if (stack2 != null) {
|
||||||
return stack2;
|
return stack2;
|
||||||
}
|
}
|
||||||
@@ -67,6 +66,6 @@ public class CeramicTileRecipe implements IRecipe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getRecipeOutput() {
|
public ItemStack getRecipeOutput() {
|
||||||
return this.cached;
|
return cached;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.ceramic;
|
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import binnie.core.block.ItemMetadata;
|
|
||||||
|
|
||||||
public class ItemCeramic extends ItemMetadata
|
|
||||||
{
|
|
||||||
public ItemCeramic(final Block block) {
|
|
||||||
super(block);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public int getColorFromItemStack(final ItemStack stack, final int p_82790_2_) {
|
|
||||||
return 16711935;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,42 +1,37 @@
|
|||||||
//
|
|
||||||
// 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 binnie.Binnie;
|
||||||
import net.minecraft.world.World;
|
import binnie.botany.Botany;
|
||||||
|
import binnie.botany.api.IFlower;
|
||||||
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.world.World;
|
||||||
|
|
||||||
public class PigmentRecipe implements IRecipe
|
public class PigmentRecipe implements IRecipe {
|
||||||
{
|
protected ItemStack cached;
|
||||||
private final ItemStack unknown;
|
|
||||||
ItemStack cached;
|
private ItemStack unknown;
|
||||||
|
|
||||||
public PigmentRecipe() {
|
public PigmentRecipe() {
|
||||||
this.unknown = null;
|
unknown = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(final InventoryCrafting crafting, final World world) {
|
public boolean matches(InventoryCrafting crafting, World world) {
|
||||||
return this.getCraftingResult(crafting) != null;
|
return getCraftingResult(crafting) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getRecipeOutput() {
|
public ItemStack getRecipeOutput() {
|
||||||
if (this.cached != null) {
|
if (cached != null) {
|
||||||
return this.cached;
|
return cached;
|
||||||
}
|
}
|
||||||
return this.unknown;
|
return unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getCraftingResult(final InventoryCrafting crafting) {
|
public ItemStack getCraftingResult(InventoryCrafting crafting) {
|
||||||
int n = 0;
|
int n = 0;
|
||||||
ItemStack stack = null;
|
ItemStack stack = null;
|
||||||
for (int i = 0; i < crafting.getSizeInventory(); ++i) {
|
for (int i = 0; i < crafting.getSizeInventory(); ++i) {
|
||||||
@@ -44,11 +39,13 @@ public class PigmentRecipe implements IRecipe
|
|||||||
if (++n > 1) {
|
if (++n > 1) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (Binnie.Genetics.getFlowerRoot().isMember(crafting.getStackInSlot(i))) {
|
if (!Binnie.Genetics.getFlowerRoot().isMember(crafting.getStackInSlot(i))) {
|
||||||
final IFlower flower = Binnie.Genetics.getFlowerRoot().getMember(crafting.getStackInSlot(i));
|
continue;
|
||||||
if (flower.getAge() >= 1) {
|
}
|
||||||
stack = new ItemStack(Botany.pigment, 1, flower.getGenome().getPrimaryColor().getID());
|
|
||||||
}
|
IFlower flower = Binnie.Genetics.getFlowerRoot().getMember(crafting.getStackInSlot(i));
|
||||||
|
if (flower.getAge() >= 1) {
|
||||||
|
stack = new ItemStack(Botany.pigment, 1, flower.getGenome().getPrimaryColor().getID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,12 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.core;
|
package binnie.botany.core;
|
||||||
|
|
||||||
import binnie.botany.genetics.FlowerHelper;
|
|
||||||
import binnie.botany.api.IFlowerRoot;
|
import binnie.botany.api.IFlowerRoot;
|
||||||
|
import binnie.botany.genetics.FlowerHelper;
|
||||||
|
|
||||||
public class BotanyCore
|
public class BotanyCore {
|
||||||
{
|
public static IFlowerRoot speciesRoot = new FlowerHelper();
|
||||||
public static final int CHANCE_INTERPOLLINATION = 20;
|
|
||||||
public static IFlowerRoot speciesRoot;
|
|
||||||
|
|
||||||
public static IFlowerRoot getFlowerRoot() {
|
public static IFlowerRoot getFlowerRoot() {
|
||||||
return BotanyCore.speciesRoot;
|
return BotanyCore.speciesRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
|
||||||
BotanyCore.speciesRoot = new FlowerHelper();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,37 +1,25 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.core;
|
package binnie.botany.core;
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import binnie.botany.craftgui.WindowBotanistDatabase;
|
||||||
import binnie.craftgui.botany.WindowBotanistDatabase;
|
import binnie.core.craftgui.minecraft.Window;
|
||||||
import net.minecraft.inventory.IInventory;
|
|
||||||
import binnie.craftgui.minecraft.Window;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import binnie.core.gui.IBinnieGUID;
|
import binnie.core.gui.IBinnieGUID;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
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(EntityPlayer player, World world, int x, int y, int z, Side side) {
|
||||||
Window window = null;
|
Window window = null;
|
||||||
final TileEntity tileEntity = world.getTileEntity(x, y, z);
|
|
||||||
IInventory object = null;
|
|
||||||
if (tileEntity instanceof IInventory) {
|
|
||||||
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 +0,0 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.core;
|
|
||||||
|
|
||||||
import binnie.extrabees.ExtraBees;
|
|
||||||
import binnie.Binnie;
|
|
||||||
import binnie.core.resource.BinnieResource;
|
|
||||||
import binnie.core.resource.ResourceType;
|
|
||||||
import binnie.core.resource.IBinnieTexture;
|
|
||||||
|
|
||||||
public enum BotanyTexture implements IBinnieTexture
|
|
||||||
{
|
|
||||||
;
|
|
||||||
String texture;
|
|
||||||
ResourceType type;
|
|
||||||
|
|
||||||
private BotanyTexture(final ResourceType base, final String texture) {
|
|
||||||
this.texture = texture;
|
|
||||||
this.type = base;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BinnieResource getTexture() {
|
|
||||||
return Binnie.Resource.getPNG(ExtraBees.instance, this.type, this.texture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,36 +1,20 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.core;
|
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()) {
|
// ignored
|
||||||
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
|
||||||
public void init() {
|
public void init() {
|
||||||
|
// ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postInit() {
|
public void postInit() {
|
||||||
|
// ignored
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package binnie.botany.craftgui;
|
||||||
|
|
||||||
|
import binnie.botany.api.IFlowerColor;
|
||||||
|
import binnie.core.craftgui.CraftGUI;
|
||||||
|
import binnie.core.craftgui.ITooltip;
|
||||||
|
import binnie.core.craftgui.IWidget;
|
||||||
|
import binnie.core.craftgui.Tooltip;
|
||||||
|
import binnie.core.craftgui.WidgetAttribute;
|
||||||
|
import binnie.core.craftgui.controls.core.Control;
|
||||||
|
import binnie.core.craftgui.controls.core.IControlValue;
|
||||||
|
import binnie.core.craftgui.geometry.IArea;
|
||||||
|
|
||||||
|
public class ControlColorDisplay extends Control implements IControlValue<IFlowerColor>, ITooltip {
|
||||||
|
private IFlowerColor value;
|
||||||
|
|
||||||
|
public ControlColorDisplay(IWidget parent, float x, float y) {
|
||||||
|
super(parent, x, y, 16.0f, 16.0f);
|
||||||
|
addAttribute(WidgetAttribute.MOUSE_OVER);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IFlowerColor getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setValue(IFlowerColor value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRenderBackground() {
|
||||||
|
IArea area = getArea();
|
||||||
|
CraftGUI.render.solid(area, -1);
|
||||||
|
CraftGUI.render.solid(area.inset(1), 0xff000000 + getValue().getColor(false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getTooltip(Tooltip tooltip) {
|
||||||
|
super.getTooltip(tooltip);
|
||||||
|
tooltip.add(value.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package binnie.botany.craftgui;
|
||||||
|
|
||||||
|
import binnie.botany.api.IColourMix;
|
||||||
|
import binnie.core.craftgui.IWidget;
|
||||||
|
import binnie.core.craftgui.controls.listbox.ControlListBox;
|
||||||
|
|
||||||
|
public class ControlColorMixBox extends ControlListBox<IColourMix> {
|
||||||
|
private Type type;
|
||||||
|
|
||||||
|
public ControlColorMixBox(IWidget parent, int x, int y, int width, int height, Type type) {
|
||||||
|
super(parent, x, y, width, height, 12.0f);
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IWidget createOption(IColourMix value, int y) {
|
||||||
|
return new ControlColorMixItem(getContent(), value, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
enum Type {
|
||||||
|
Resultant,
|
||||||
|
Further
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
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 ControlColorMixItem extends ControlOption<IColourMix> {
|
||||||
|
protected ControlColorDisplay itemWidget1;
|
||||||
|
protected ControlColorDisplay itemWidget2;
|
||||||
|
protected ControlColorDisplay itemWidget3;
|
||||||
|
protected ControlColourMixSymbol addSymbol;
|
||||||
|
protected ControlColourMixSymbol arrowSymbol;
|
||||||
|
|
||||||
|
public ControlColorMixItem(ControlList<IColourMix> controlList, IColourMix option, int y) {
|
||||||
|
super(controlList, option, y);
|
||||||
|
itemWidget1 = new ControlColorDisplay(this, 4.0f, 4.0f);
|
||||||
|
itemWidget2 = new ControlColorDisplay(this, 44.0f, 4.0f);
|
||||||
|
itemWidget3 = new ControlColorDisplay(this, 104.0f, 4.0f);
|
||||||
|
addSymbol = new ControlColourMixSymbol(this, 24, 4, 0);
|
||||||
|
arrowSymbol = new ControlColourMixSymbol(this, 64, 4, 1);
|
||||||
|
|
||||||
|
if (getValue() != null) {
|
||||||
|
itemWidget1.setValue(getValue().getColor1());
|
||||||
|
itemWidget2.setValue(getValue().getColor2());
|
||||||
|
itemWidget3.setValue(getValue().getResult());
|
||||||
|
addSymbol.setValue(getValue());
|
||||||
|
arrowSymbol.setValue(getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package binnie.botany.craftgui;
|
||||||
|
|
||||||
|
import binnie.botany.api.IFlowerColor;
|
||||||
|
import binnie.core.craftgui.CraftGUI;
|
||||||
|
import binnie.core.craftgui.WidgetAttribute;
|
||||||
|
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.IPoint;
|
||||||
|
|
||||||
|
public class ControlColorOption extends ControlTextOption<IFlowerColor> {
|
||||||
|
protected ControlColorDisplay controlBee;
|
||||||
|
protected IPoint boxPosition;
|
||||||
|
|
||||||
|
public ControlColorOption(ControlList<IFlowerColor> controlList, IFlowerColor option, int y) {
|
||||||
|
super(controlList, option, option.getName(), y);
|
||||||
|
setSize(new IPoint(getSize().x(), 20.0f));
|
||||||
|
(controlBee = new ControlColorDisplay(this, 2.0f, 2.0f)).setValue(option);
|
||||||
|
addAttribute(WidgetAttribute.MOUSE_OVER);
|
||||||
|
CraftGUIUtil.moveWidget(textWidget, new IPoint(22.0f, 0.0f));
|
||||||
|
textWidget.setSize(textWidget.getSize().sub(new IPoint(24.0f, 0.0f)));
|
||||||
|
int th = (int) CraftGUI.render.textHeight(textWidget.getValue(), textWidget.getSize().x());
|
||||||
|
int height = Math.max(20, th + 6);
|
||||||
|
setSize(new IPoint(size().x(), height));
|
||||||
|
textWidget.setSize(new IPoint(textWidget.getSize().x(), height));
|
||||||
|
boxPosition = new IPoint(2.0f, (height - 18) / 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package binnie.botany.craftgui;
|
||||||
|
|
||||||
|
import binnie.botany.api.IColourMix;
|
||||||
|
import binnie.core.craftgui.CraftGUI;
|
||||||
|
import binnie.core.craftgui.ITooltip;
|
||||||
|
import binnie.core.craftgui.IWidget;
|
||||||
|
import binnie.core.craftgui.Tooltip;
|
||||||
|
import binnie.core.craftgui.WidgetAttribute;
|
||||||
|
import binnie.core.craftgui.controls.core.Control;
|
||||||
|
import binnie.core.craftgui.geometry.IPoint;
|
||||||
|
import binnie.core.craftgui.resource.Texture;
|
||||||
|
import binnie.core.craftgui.resource.minecraft.CraftGUITextureSheet;
|
||||||
|
import binnie.core.craftgui.resource.minecraft.StandardTexture;
|
||||||
|
import binnie.core.util.I18N;
|
||||||
|
|
||||||
|
public class ControlColourMixSymbol extends Control implements ITooltip {
|
||||||
|
protected static Texture MutationPlus = new StandardTexture(2, 94, 16, 16, CraftGUITextureSheet.Controls2);
|
||||||
|
protected static Texture MutationArrow = new StandardTexture(20, 94, 32, 16, CraftGUITextureSheet.Controls2);
|
||||||
|
|
||||||
|
protected IColourMix value;
|
||||||
|
protected int type;
|
||||||
|
|
||||||
|
protected ControlColourMixSymbol(IWidget parent, int x, int y, int type) {
|
||||||
|
super(parent, x, y, 16 + type * 16, 16.0f);
|
||||||
|
this.type = type;
|
||||||
|
value = null;
|
||||||
|
addAttribute(WidgetAttribute.MOUSE_OVER);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRenderBackground() {
|
||||||
|
super.onRenderBackground();
|
||||||
|
if (type == 0) {
|
||||||
|
CraftGUI.render.texture(ControlColourMixSymbol.MutationPlus, IPoint.ZERO);
|
||||||
|
} else {
|
||||||
|
CraftGUI.render.texture(ControlColourMixSymbol.MutationArrow, IPoint.ZERO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(IColourMix value) {
|
||||||
|
this.value = value;
|
||||||
|
setColor(0xffffff);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getTooltip(Tooltip tooltip) {
|
||||||
|
if (type == 1) {
|
||||||
|
float chance = value.getChance();
|
||||||
|
tooltip.add(I18N.localise("botany.gui.controls.colorMixSymbol.chance", chance));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package binnie.botany.craftgui;
|
||||||
|
|
||||||
|
import binnie.botany.api.IColourMix;
|
||||||
|
import binnie.botany.api.IFlowerColor;
|
||||||
|
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;
|
||||||
|
import binnie.core.util.I18N;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class PageColorMix extends PageAbstract<IFlowerColor> {
|
||||||
|
ControlText title;
|
||||||
|
ControlColorMixBox list;
|
||||||
|
|
||||||
|
public PageColorMix(IWidget parent, DatabaseTab tab) {
|
||||||
|
super(parent, tab);
|
||||||
|
title = new ControlTextCentered(this, 8.0f, I18N.localise("botany.gui.controls.pageColorFurtherTitle"));
|
||||||
|
list = new ControlColorMixBox(this, 4, 20, 136, 152, ControlColorMixBox.Type.Further);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onValueChanged(IFlowerColor colour) {
|
||||||
|
List<IColourMix> mixes = new ArrayList<>();
|
||||||
|
for (IColourMix mix : BotanyCore.getFlowerRoot().getColourMixes(false)) {
|
||||||
|
if (mix.getColor1() == colour || mix.getColor2() == colour) {
|
||||||
|
mixes.add(mix);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list.setOptions(mixes);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package binnie.botany.craftgui;
|
||||||
|
|
||||||
|
import binnie.botany.api.IColourMix;
|
||||||
|
import binnie.botany.api.IFlowerColor;
|
||||||
|
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;
|
||||||
|
import binnie.core.util.I18N;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class PageColorMixResultant extends PageAbstract<IFlowerColor> {
|
||||||
|
protected ControlText title;
|
||||||
|
protected ControlColorMixBox list;
|
||||||
|
|
||||||
|
public PageColorMixResultant(IWidget parent, DatabaseTab tab) {
|
||||||
|
super(parent, tab);
|
||||||
|
title = new ControlTextCentered(this, 8.0f, I18N.localise("botany.gui.controls.pageSpeciesFurtherTitle"));
|
||||||
|
list = new ControlColorMixBox(this, 4, 20, 136, 152, ControlColorMixBox.Type.Resultant);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onValueChanged(IFlowerColor color) {
|
||||||
|
List<IColourMix> mixes = new ArrayList<>();
|
||||||
|
for (IColourMix mix : BotanyCore.getFlowerRoot().getColourMixes(false)) {
|
||||||
|
if (mix.getResult() == color) {
|
||||||
|
mixes.add(mix);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list.setOptions(mixes);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
package binnie.botany.craftgui;
|
||||||
|
|
||||||
|
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.IArea;
|
||||||
|
import binnie.core.craftgui.geometry.IPoint;
|
||||||
|
import binnie.core.craftgui.geometry.TextJustification;
|
||||||
|
import binnie.core.craftgui.minecraft.control.ControlItemDisplay;
|
||||||
|
import binnie.core.util.I18N;
|
||||||
|
import binnie.genetics.genetics.AlleleHelper;
|
||||||
|
import forestry.api.genetics.IAllele;
|
||||||
|
import forestry.api.genetics.IAlleleSpecies;
|
||||||
|
import forestry.api.genetics.IIndividual;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
public class PageSpeciesFlowerGenome extends PageSpecies {
|
||||||
|
public PageSpeciesFlowerGenome(IWidget parent, DatabaseTab tab) {
|
||||||
|
super(parent, tab);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onValueChanged(IAlleleSpecies species) {
|
||||||
|
deleteAllChildren();
|
||||||
|
IAllele[] template = Binnie.Genetics.getFlowerRoot().getTemplate(species.getUID());
|
||||||
|
if (template == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IFlower tree = Binnie.Genetics.getFlowerRoot().templateAsIndividual(template);
|
||||||
|
if (tree == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
IFlowerGenome genome = tree.getGenome();
|
||||||
|
IAlleleFlowerSpecies treeSpecies = genome.getPrimary();
|
||||||
|
int w = 144;
|
||||||
|
int h = 176;
|
||||||
|
|
||||||
|
new ControlText(this, new IArea(0.0f, 4.0f, w, 16.0f), I18N.localise("botany.gui.database.tab.genome"), TextJustification.MIDDLE_CENTER);
|
||||||
|
ControlScrollableContent scrollable = new ControlScrollableContent(this, 4.0f, 20.0f, w - 8, h - 8 - 16, 12.0f);
|
||||||
|
Control contents = new Control(scrollable, 0.0f, 0.0f, w - 8 - 12, h - 8 - 16);
|
||||||
|
|
||||||
|
int tw = w - 8 - 12;
|
||||||
|
int w2 = 55;
|
||||||
|
int w3 = tw - 50;
|
||||||
|
int y = 0;
|
||||||
|
int th = 14;
|
||||||
|
int valueX = w2 + 4;
|
||||||
|
new ControlText(contents, new IArea(0.0f, y, w2, th), I18N.localise("botany.gui.database.tab.genome.temp"), TextJustification.MIDDLE_RIGHT);
|
||||||
|
new ControlText(contents, new IArea(valueX, y, w3, th), AlleleHelper.toDisplay(treeSpecies.getTemperature()), TextJustification.MIDDLE_LEFT);
|
||||||
|
y += th;
|
||||||
|
|
||||||
|
new ControlText(contents, new IArea(0.0f, y, w2, th), I18N.localise("botany.gui.database.tab.genome.moist"), TextJustification.MIDDLE_RIGHT);
|
||||||
|
new ControlText(contents, new IArea(valueX, y, w3, th), AlleleHelper.toDisplay(treeSpecies.getMoisture()), TextJustification.MIDDLE_LEFT);
|
||||||
|
y += th;
|
||||||
|
|
||||||
|
new ControlText(contents, new IArea(0.0f, y, w2, th), I18N.localise("botany.gui.database.tab.genome.ph"), TextJustification.MIDDLE_RIGHT);
|
||||||
|
new ControlText(contents, new IArea(valueX, y, w3, th), AlleleHelper.toDisplay(treeSpecies.getPH()), TextJustification.MIDDLE_LEFT);
|
||||||
|
y += th;
|
||||||
|
|
||||||
|
new ControlText(contents, new IArea(0.0f, y, w2, th), I18N.localise("botany.gui.database.tab.genome.fertility"), TextJustification.MIDDLE_RIGHT);
|
||||||
|
new ControlText(contents, new IArea(valueX, y, w3, th), genome.getFertility() + "x", TextJustification.MIDDLE_LEFT);
|
||||||
|
y += th;
|
||||||
|
|
||||||
|
float lifespan = genome.getLifespan() * 68.27f / genome.getAgeChance() / 24000.0f;
|
||||||
|
String lifespanValue = String.format("%.2f", lifespan);
|
||||||
|
new ControlText(contents, new IArea(0.0f, y, w2, th), I18N.localise("botany.gui.database.tab.genome.lifespan"), TextJustification.MIDDLE_RIGHT);
|
||||||
|
new ControlText(contents, new IArea(valueX, y, w3, th), I18N.localise("botany.gui.database.tab.genome.lifespan.value", lifespanValue), TextJustification.MIDDLE_LEFT);
|
||||||
|
y += th;
|
||||||
|
|
||||||
|
new ControlText(contents, new IArea(0.0f, y, w2, th), I18N.localise("botany.gui.database.tab.genome.nectar"), TextJustification.MIDDLE_RIGHT);
|
||||||
|
new ControlText(contents, new IArea(valueX, y, w3, th), genome.getActiveAllele(EnumFlowerChromosome.SAPPINESS).getName(), TextJustification.MIDDLE_LEFT);
|
||||||
|
y += th;
|
||||||
|
|
||||||
|
int x = w2;
|
||||||
|
int tot = 0;
|
||||||
|
for (IIndividual vid : BotanyCore.getFlowerRoot().getIndividualTemplates()) {
|
||||||
|
if (vid.getGenome().getPrimary() == treeSpecies) {
|
||||||
|
if (tot > 0 && tot % 3 == 0) {
|
||||||
|
x -= 54;
|
||||||
|
y += 18;
|
||||||
|
}
|
||||||
|
ItemStack stack = BotanyCore.getFlowerRoot().getMemberStack(vid, EnumFlowerStage.FLOWER.ordinal());
|
||||||
|
ControlItemDisplay display = new ControlItemDisplay(contents, x, y);
|
||||||
|
display.setItemStack(stack);
|
||||||
|
tot++;
|
||||||
|
x += 18;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int numOfLines = 1 + (tot - 1) / 3;
|
||||||
|
new ControlText(contents, new IArea(0.0f, y - (numOfLines - 1) * 18, w2, 4 + 18 * numOfLines), I18N.localise("botany.gui.database.tab.genome.varieties"), TextJustification.MIDDLE_RIGHT);
|
||||||
|
y += th;
|
||||||
|
contents.setSize(new IPoint(contents.size().x(), y));
|
||||||
|
scrollable.setScrollableContent(contents);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
package binnie.botany.craftgui;
|
||||||
|
|
||||||
|
import binnie.Binnie;
|
||||||
|
import binnie.botany.Botany;
|
||||||
|
import binnie.botany.api.IFlowerColor;
|
||||||
|
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.IArea;
|
||||||
|
import binnie.core.craftgui.minecraft.Window;
|
||||||
|
import binnie.core.util.I18N;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class WindowBotanistDatabase extends WindowAbstractDatabase {
|
||||||
|
public WindowBotanistDatabase(EntityPlayer player, Side side, boolean nei) {
|
||||||
|
super(player, side, nei, Binnie.Genetics.flowerBreedingSystem, 130.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Window create(EntityPlayer player, Side side, boolean nei) {
|
||||||
|
return new WindowBotanistDatabase(player, side, nei);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void addTabs() {
|
||||||
|
new PageSpeciesOverview(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.overview"));
|
||||||
|
new PageSpeciesFlowerGenome(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "genome"));
|
||||||
|
new PageSpeciesClassification(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.classification"));
|
||||||
|
new PageSpeciesResultant(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.resultant"));
|
||||||
|
new PageSpeciesMutations(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.further"));
|
||||||
|
new PageBranchOverview(getInfoPages(Mode.Branches), new DatabaseTab(Botany.instance, "branches.overview"));
|
||||||
|
new PageBranchSpecies(getInfoPages(Mode.Branches), new DatabaseTab(Botany.instance, "branches.species"));
|
||||||
|
createMode(FlowerMode.COLOR, new ColorModeWidget());
|
||||||
|
new PageColorMixResultant(getInfoPages(FlowerMode.COLOR), new DatabaseTab(Botany.instance, "colour.resultant"));
|
||||||
|
new PageColorMix(getInfoPages(FlowerMode.COLOR), new DatabaseTab(Botany.instance, "colour.further"));
|
||||||
|
new PageBreeder(getInfoPages(Mode.Breeder), getUsername(), new DatabaseTab(Botany.instance, "breeder"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected AbstractMod getMod() {
|
||||||
|
return Botany.instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getName() {
|
||||||
|
return I18N.localise("botany.gui.database.name");
|
||||||
|
}
|
||||||
|
|
||||||
|
enum FlowerMode implements IDatabaseMode {
|
||||||
|
COLOR;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return I18N.localise("botany.gui.database.tab." + name().toLowerCase());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ColorModeWidget extends ModeWidgets {
|
||||||
|
public ColorModeWidget() {
|
||||||
|
super(FlowerMode.COLOR, WindowBotanistDatabase.this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createListBox(IArea area) {
|
||||||
|
listBox = new ControlListBox<IFlowerColor>(modePage, area.x(), area.y(), area.w(), area.h(), 12.0f) {
|
||||||
|
@Override
|
||||||
|
public IWidget createOption(IFlowerColor value, int y) {
|
||||||
|
return new ControlColorOption(getContent(), value, y);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
List<IFlowerColor> colors = new ArrayList<>();
|
||||||
|
Collections.addAll(colors, EnumFlowerColor.values());
|
||||||
|
listBox.setOptions(colors);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,67 +1,74 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.farm;
|
package binnie.botany.farm;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
import forestry.api.circuits.ChipsetManager;
|
|
||||||
import forestry.api.farming.FarmDirection;
|
|
||||||
import forestry.api.farming.IFarmHousing;
|
|
||||||
import forestry.api.farming.IFarmLogic;
|
|
||||||
import binnie.Binnie;
|
|
||||||
import binnie.botany.api.EnumAcidity;
|
import binnie.botany.api.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;
|
||||||
|
import forestry.api.circuits.ChipsetManager;
|
||||||
|
import forestry.api.farming.FarmDirection;
|
||||||
|
import forestry.api.farming.IFarmHousing;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
|
|
||||||
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 boolean isFertilised;
|
||||||
private ItemStack icon;
|
private ItemStack icon;
|
||||||
private EnumMoisture moisture;
|
private EnumMoisture moisture;
|
||||||
private EnumAcidity acidity;
|
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, 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("garden." + moisture.getID() + ((ph != null) ? ("." + ph.getID()) : "") + (manual ? ".manual" : "") + (fertilised ? ".fert" : ""), 4, manual ? ChipsetManager.circuitRegistry.getLayout("forestry.farms.manual") : ChipsetManager.circuitRegistry.getLayout("forestry.farms.managed"), recipe);
|
||||||
this.isManual = false;
|
|
||||||
this.isFertilised = false;
|
|
||||||
this.isManual = manual;
|
|
||||||
this.isFertilised = fertilised;
|
|
||||||
this.moisture = moisture;
|
this.moisture = moisture;
|
||||||
this.acidity = ph;
|
|
||||||
this.icon = icon;
|
this.icon = icon;
|
||||||
|
isManual = manual;
|
||||||
|
isFertilised = fertilised;
|
||||||
|
acidity = ph;
|
||||||
String info = "";
|
String info = "";
|
||||||
if (moisture == EnumMoisture.Dry) {
|
|
||||||
info += "§eDry§f";
|
if (moisture == EnumMoisture.DRY) {
|
||||||
|
info += EnumChatFormatting.YELLOW
|
||||||
|
+ I18N.localise("botany.moisture.dry")
|
||||||
|
+ EnumChatFormatting.RESET;
|
||||||
}
|
}
|
||||||
if (moisture == EnumMoisture.Damp) {
|
|
||||||
info += "§9Damp§f";
|
if (moisture == EnumMoisture.DAMP) {
|
||||||
|
info += EnumChatFormatting.YELLOW
|
||||||
|
+ I18N.localise("botany.moisture.damp")
|
||||||
|
+ EnumChatFormatting.RESET;
|
||||||
}
|
}
|
||||||
if (this.acidity == EnumAcidity.Acid) {
|
|
||||||
|
if (acidity == EnumAcidity.ACID) {
|
||||||
if (info.length() > 0) {
|
if (info.length() > 0) {
|
||||||
info += ", ";
|
info += ", ";
|
||||||
}
|
}
|
||||||
info += "§cAcidic§f";
|
info += EnumChatFormatting.RED
|
||||||
|
+ I18N.localise("botany.ph.acid")
|
||||||
|
+ EnumChatFormatting.RESET;
|
||||||
}
|
}
|
||||||
if (this.acidity == EnumAcidity.Neutral) {
|
|
||||||
|
if (acidity == EnumAcidity.NEUTRAL) {
|
||||||
if (info.length() > 0) {
|
if (info.length() > 0) {
|
||||||
info += ", ";
|
info += ", ";
|
||||||
}
|
}
|
||||||
info += "§aNeutral§f";
|
info += EnumChatFormatting.GREEN
|
||||||
|
+ I18N.localise("botany.ph.neutral")
|
||||||
|
+ EnumChatFormatting.RESET;
|
||||||
}
|
}
|
||||||
if (this.acidity == EnumAcidity.Alkaline) {
|
|
||||||
|
if (acidity == EnumAcidity.ALKALINE) {
|
||||||
if (info.length() > 0) {
|
if (info.length() > 0) {
|
||||||
info += ", ";
|
info += ", ";
|
||||||
}
|
}
|
||||||
info += "§bAlkaline§f";
|
info += EnumChatFormatting.AQUA
|
||||||
|
+ I18N.localise("botany.ph.alkaline")
|
||||||
|
+ EnumChatFormatting.RESET;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.length() > 0) {
|
if (info.length() > 0) {
|
||||||
info = " (" + info + "§f)";
|
info = " (" + info + EnumChatFormatting.RESET + ")";
|
||||||
}
|
}
|
||||||
this.addTooltipString("Flowers" + info);
|
addTooltipString(I18N.localise("botany.circuit.flowers") + info);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -71,22 +78,23 @@ public class CircuitGarden extends BinnieCircuit
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInsertion(int slot, Object tile) {
|
public void onInsertion(int slot, Object tile) {
|
||||||
if (!this.isCircuitable(tile)) {
|
if (!isCircuitable(tile)) {
|
||||||
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()));
|
GardenLogic logic = new GardenLogic((IFarmHousing) tile);
|
||||||
|
logic.setData(moisture, acidity, isManual, isFertilised, icon, I18N.localise(getName()));
|
||||||
((IFarmHousing) tile).setFarmLogic(FarmDirection.values()[slot], logic);
|
((IFarmHousing) tile).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)) {
|
if (!isCircuitable(tile)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
((IFarmHousing) tile).resetFarmLogic(FarmDirection.values()[slot]);
|
((IFarmHousing) tile).resetFarmLogic(FarmDirection.values()[slot]);
|
||||||
@@ -94,6 +102,6 @@ public class CircuitGarden extends BinnieCircuit
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTick(int arg0, Object arg1) {
|
public void onTick(int arg0, Object arg1) {
|
||||||
|
// ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,61 +1,58 @@
|
|||||||
//
|
|
||||||
// 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.init.Blocks;
|
|
||||||
|
|
||||||
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 forestry.core.utils.vect.Vect;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import forestry.api.farming.IFarmLogic;
|
public abstract class FarmLogic implements IFarmLogic {
|
||||||
|
protected World world;
|
||||||
|
protected IFarmHousing housing;
|
||||||
|
protected boolean isManual;
|
||||||
|
|
||||||
public abstract class FarmLogic implements IFarmLogic
|
public FarmLogic(IFarmHousing housing) {
|
||||||
{
|
|
||||||
World world;
|
|
||||||
IFarmHousing housing;
|
|
||||||
boolean isManual;
|
|
||||||
|
|
||||||
public FarmLogic(final IFarmHousing housing) {
|
|
||||||
this.housing = housing;
|
this.housing = housing;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFarmLogic setManual(final boolean flag) {
|
public IFarmLogic setManual(boolean flag) {
|
||||||
this.isManual = flag;
|
isManual = flag;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final boolean isAirBlock(final Vect position) {
|
protected boolean isAirBlock(Vect position) {
|
||||||
return this.world.isAirBlock(position.x, position.y, position.z);
|
return world.isAirBlock(position.x, position.y, position.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final boolean isWaterBlock(final Vect position) {
|
protected boolean isWaterBlock(Vect position) {
|
||||||
return this.world.getBlock(position.x, position.y, position.z) == Blocks.water;
|
return world.getBlock(position.x, position.y, position.z) == Blocks.water;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final Block getBlock(final Vect position) {
|
protected Block getBlock(Vect position) {
|
||||||
return this.world.getBlock(position.x, position.y, position.z);
|
return world.getBlock(position.x, position.y, position.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final int getBlockMeta(final Vect position) {
|
protected int getBlockMeta(Vect position) {
|
||||||
return this.world.getBlockMetadata(position.x, position.y, position.z);
|
return world.getBlockMetadata(position.x, position.y, position.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final ItemStack getAsItemStack(final Vect position) {
|
protected ItemStack getAsItemStack(Vect position) {
|
||||||
return new ItemStack(this.getBlock(position), 1, this.getBlockMeta(position));
|
return new ItemStack(getBlock(position), 1, getBlockMeta(position));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final Vect translateWithOffset(final int x, final int y, final int z, final FarmDirection direction, final int step) {
|
protected Vect translateWithOffset(int x, int y, int z, FarmDirection direction, int step) {
|
||||||
return new Vect(x + direction.getForgeDirection().offsetX * step, y + direction.getForgeDirection().offsetY * step, z + direction.getForgeDirection().offsetZ * step);
|
return new Vect(
|
||||||
|
x + direction.getForgeDirection().offsetX * step,
|
||||||
|
y + direction.getForgeDirection().offsetY * step,
|
||||||
|
z + direction.getForgeDirection().offsetZ * step
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final void setBlock(final Vect position, final Block block, final int meta) {
|
protected void setBlock(Vect position, Block block, int meta) {
|
||||||
this.world.setBlock(position.x, position.y, position.z, block, meta, 2);
|
world.setBlock(position.x, position.y, position.z, block, meta, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,46 +1,41 @@
|
|||||||
//
|
|
||||||
// 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.entity.player.EntityPlayer;
|
|
||||||
import binnie.botany.api.EnumFlowerStage;
|
|
||||||
import binnie.botany.core.BotanyCore;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import forestry.api.farming.ICrop;
|
|
||||||
import binnie.botany.Botany;
|
import binnie.botany.Botany;
|
||||||
import net.minecraft.world.World;
|
import binnie.botany.api.EnumFlowerStage;
|
||||||
|
import binnie.botany.api.IFlower;
|
||||||
|
import binnie.botany.core.BotanyCore;
|
||||||
|
import binnie.botany.gardening.Gardening;
|
||||||
|
import forestry.api.farming.ICrop;
|
||||||
import forestry.api.farming.IFarmable;
|
import forestry.api.farming.IFarmable;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class FarmableFlower implements IFarmable
|
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(World world, int x, int y, int z) {
|
||||||
return world.getBlock(x, y, z) == Botany.flower;
|
return world.getBlock(x, y, z) == Botany.flower;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICrop getCropAt(final World world, final int x, final int y, final int z) {
|
public ICrop getCropAt(World world, int x, int y, int z) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isGermling(final ItemStack itemstack) {
|
public boolean isGermling(ItemStack itemstack) {
|
||||||
final EnumFlowerStage stage = BotanyCore.speciesRoot.getStageType(itemstack);
|
EnumFlowerStage stage = BotanyCore.speciesRoot.getStageType(itemstack);
|
||||||
return stage == EnumFlowerStage.FLOWER || stage == EnumFlowerStage.SEED;
|
return stage == EnumFlowerStage.FLOWER || stage == EnumFlowerStage.SEED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isWindfall(final ItemStack itemstack) {
|
public boolean isWindfall(ItemStack itemstack) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@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(EntityPlayer player, ItemStack germling, World world, int x, int y, int z) {
|
||||||
final IFlower flower = BotanyCore.getFlowerRoot().getMember(germling);
|
IFlower flower = BotanyCore.getFlowerRoot().getMember(germling);
|
||||||
Gardening.plant(world, x, y, z, flower, player.getGameProfile());
|
Gardening.plant(world, x, y, z, flower, player.getGameProfile());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,21 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.farm;
|
package binnie.botany.farm;
|
||||||
|
|
||||||
import binnie.botany.api.IFlower;
|
import binnie.botany.api.IFlower;
|
||||||
import binnie.botany.gardening.Gardening;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import binnie.botany.core.BotanyCore;
|
import binnie.botany.core.BotanyCore;
|
||||||
|
import binnie.botany.gardening.Gardening;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class FarmableVanillaFlower extends FarmableFlower
|
public class FarmableVanillaFlower extends FarmableFlower {
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isGermling(final ItemStack itemstack) {
|
public boolean isGermling(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(EntityPlayer player, ItemStack germling, World world, int x, int y, int z) {
|
||||||
final IFlower flower = BotanyCore.getFlowerRoot().getConversion(germling);
|
IFlower flower = BotanyCore.getFlowerRoot().getConversion(germling);
|
||||||
return Gardening.plant(world, x, y, z, flower, player.getGameProfile());
|
return Gardening.plant(world, x, y, z, flower, player.getGameProfile());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,167 +1,174 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.farm;
|
package binnie.botany.farm;
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
|
||||||
|
|
||||||
import binnie.core.Mods;
|
|
||||||
import binnie.botany.flower.TileEntityFlower;
|
|
||||||
import forestry.core.access.IOwnable;
|
|
||||||
|
|
||||||
import net.minecraft.client.renderer.texture.TextureMap;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
|
|
||||||
import forestry.api.farming.ICrop;
|
|
||||||
|
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
|
||||||
|
|
||||||
import binnie.Binnie;
|
import binnie.Binnie;
|
||||||
|
|
||||||
import net.minecraft.item.ItemBlock;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
|
|
||||||
import binnie.botany.Botany;
|
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.IFarmHousing;
|
|
||||||
import forestry.api.farming.IFarmable;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
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.gardening.IBlockSoil;
|
||||||
|
import binnie.botany.flower.TileEntityFlower;
|
||||||
|
import binnie.botany.gardening.Gardening;
|
||||||
|
import com.mojang.authlib.GameProfile;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import forestry.api.farming.FarmDirection;
|
||||||
|
import forestry.api.farming.ICrop;
|
||||||
|
import forestry.api.farming.IFarmHousing;
|
||||||
|
import forestry.api.farming.IFarmable;
|
||||||
|
import forestry.core.access.IOwnable;
|
||||||
|
import forestry.core.utils.vect.Vect;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemBlock;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class GardenLogic extends FarmLogic {
|
||||||
|
protected EnumMoisture moisture;
|
||||||
|
protected EnumAcidity acidity;
|
||||||
|
protected boolean fertilised;
|
||||||
|
protected String name;
|
||||||
|
protected ArrayList<ItemStack> produce;
|
||||||
|
protected List<IFarmable> farmables;
|
||||||
|
|
||||||
public class GardenLogic extends FarmLogic
|
|
||||||
{
|
|
||||||
EnumMoisture moisture;
|
|
||||||
EnumAcidity acidity;
|
|
||||||
boolean fertilised;
|
|
||||||
String name;
|
|
||||||
ArrayList<ItemStack> produce;
|
|
||||||
private ItemStack icon;
|
private ItemStack icon;
|
||||||
List<IFarmable> farmables;
|
|
||||||
|
|
||||||
public GardenLogic(final IFarmHousing housing) {
|
public GardenLogic(IFarmHousing housing) {
|
||||||
super(housing);
|
super(housing);
|
||||||
this.produce = new ArrayList<ItemStack>();
|
produce = new ArrayList<>();
|
||||||
(this.farmables = new ArrayList<IFarmable>()).add(new FarmableFlower());
|
farmables = new ArrayList<>();
|
||||||
this.farmables.add(new FarmableVanillaFlower());
|
farmables.add(new FarmableFlower());
|
||||||
|
farmables.add(new FarmableVanillaFlower());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFertilizerConsumption() {
|
public int getFertilizerConsumption() {
|
||||||
return this.fertilised ? 8 : 2;
|
return fertilised ? 8 : 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getWaterConsumption(final float hydrationModifier) {
|
public int getWaterConsumption(float hydrationModifier) {
|
||||||
return (int) (this.moisture.ordinal() * 40 * hydrationModifier);
|
return (int) (moisture.ordinal() * 40 * hydrationModifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAcceptedResource(final ItemStack itemstack) {
|
public boolean isAcceptedResource(ItemStack stack) {
|
||||||
return Gardening.isSoil(itemstack.getItem()) || itemstack.getItem() == Item.getItemFromBlock(Blocks.sand) || itemstack.getItem() == Item.getItemFromBlock(Blocks.dirt) || Gardening.isAcidFertiliser(itemstack) || Gardening.isAlkalineFertiliser(itemstack);
|
Item item = stack.getItem();
|
||||||
|
return Gardening.isSoil(item)
|
||||||
|
|| item == Item.getItemFromBlock(Blocks.sand)
|
||||||
|
|| item == Item.getItemFromBlock(Blocks.dirt)
|
||||||
|
|| Gardening.isAcidFertiliser(stack)
|
||||||
|
|| Gardening.isAlkalineFertiliser(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<ItemStack> collect() {
|
public Collection<ItemStack> collect() {
|
||||||
final Collection<ItemStack> products = this.produce;
|
Collection<ItemStack> products = produce;
|
||||||
this.produce = new ArrayList<ItemStack>();
|
produce = new ArrayList<>();
|
||||||
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(int x, int y, int z, FarmDirection direction, int extent) {
|
||||||
this.world = this.housing.getWorld();
|
world = housing.getWorld();
|
||||||
return this.maintainSoil(x, y, z, direction, extent) || (!this.isManual && this.maintainWater(x, y, z, direction, extent)) || this.maintainCrops(x, y + 1, z, direction, extent);
|
return maintainSoil(x, y, z, direction, extent)
|
||||||
|
|| !isManual && maintainWater(x, y, z, direction, extent)
|
||||||
|
|| maintainCrops(x, y + 1, z, direction, extent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isWaste(final ItemStack stack) {
|
private boolean isWaste(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(int x, int y, int z, FarmDirection direction, int extent) {
|
||||||
for (int i = 0; i < extent; ++i) {
|
for (int i = 0; i < extent; ++i) {
|
||||||
final Vect position = this.translateWithOffset(x2, y2, z2, direction, i);
|
Vect position = translateWithOffset(x, y, z, direction, i);
|
||||||
if (this.fertilised && Gardening.isSoil(this.world.getBlock(position.x, position.y, position.z))) {
|
boolean isSoil = Gardening.isSoil(world.getBlock(position.x, position.y, position.z));
|
||||||
final IBlockSoil soil = (IBlockSoil) this.world.getBlock(position.x, position.y, position.z);
|
|
||||||
if (soil.fertilise(this.world, position.x, position.y, position.z, EnumSoilType.FLOWERBED)) {
|
// remove unnecessary blocks
|
||||||
|
if (!isManual && !isSoil && !isAirBlock(position)) {
|
||||||
|
Block block = world.getBlock(position.x, position.y, position.z);
|
||||||
|
if (moisture == EnumMoisture.DAMP) {
|
||||||
|
if (block != Blocks.water) {
|
||||||
|
dropBlockAsProduction(position);
|
||||||
|
}
|
||||||
|
} else if (moisture == EnumMoisture.DRY) {
|
||||||
|
if (block != Blocks.sand) {
|
||||||
|
dropBlockAsProduction(position);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dropBlockAsProduction(position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fertilised && isSoil) {
|
||||||
|
IBlockSoil soil = (IBlockSoil) world.getBlock(position.x, position.y, position.z);
|
||||||
|
if (soil.fertilise(world, position.x, position.y, position.z, EnumSoilType.FLOWERBED)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.world.getBlock(position.x, position.y + 1, position.z) == Botany.plant) {
|
|
||||||
this.world.setBlockToAir(position.x, position.y + 1, position.z);
|
if (world.getBlock(position.x, position.y + 1, position.z) == Botany.plant) {
|
||||||
|
world.setBlockToAir(position.x, position.y + 1, position.z);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
if (this.acidity != null && Gardening.isSoil(this.world.getBlock(position.x, position.y, position.z))) {
|
if (acidity != null && isSoil) {
|
||||||
final IBlockSoil soil = (IBlockSoil) this.world.getBlock(position.x, position.y, position.z);
|
IBlockSoil soil = (IBlockSoil) world.getBlock(position.x, position.y, position.z);
|
||||||
final EnumAcidity pH = soil.getPH(this.world, position.x, position.y, position.z);
|
EnumAcidity pH = soil.getPH(world, position.x, position.y, position.z);
|
||||||
if (pH.ordinal() < this.acidity.ordinal()) {
|
if (pH.ordinal() < acidity.ordinal()) {
|
||||||
final ItemStack stack = this.getAvailableAlkaline();
|
ItemStack stack = getAvailableAlkaline();
|
||||||
if (stack != null && soil.setPH(this.world, position.x, position.y, position.z, EnumAcidity.values()[pH.ordinal() + 1])) {
|
if (stack != null && soil.setPH(world, position.x, position.y, position.z, EnumAcidity.values()[pH.ordinal() + 1])) {
|
||||||
this.housing.getFarmInventory().removeResources(new ItemStack[] { stack });
|
housing.getFarmInventory().removeResources(new ItemStack[]{stack});
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
}
|
|
||||||
if (pH.ordinal() > this.acidity.ordinal()) {
|
|
||||||
final ItemStack stack = this.getAvailableAcid();
|
|
||||||
if (stack != null && soil.setPH(this.world, position.x, position.y, position.z, EnumAcidity.values()[pH.ordinal() - 1])) {
|
|
||||||
this.housing.getFarmInventory().removeResources(new ItemStack[] { stack });
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!this.isAirBlock(position) && !this.world.getBlock(position.x, position.y, position.z).isReplaceable(this.world, position.x, position.y, position.z)) {
|
|
||||||
final ItemStack block = this.getAsItemStack(position);
|
if (pH.ordinal() > acidity.ordinal()) {
|
||||||
final ItemStack loam = this.getAvailableLoam();
|
ItemStack stack = getAvailableAcid();
|
||||||
if (this.isWaste(block) && loam != null) {
|
if (stack != null && soil.setPH(world, position.x, position.y, position.z, EnumAcidity.values()[pH.ordinal() - 1])) {
|
||||||
this.produce.addAll(Blocks.dirt.getDrops(this.world, position.x, position.y, position.z, block.getItemDamage(), 0));
|
housing.getFarmInventory().removeResources(new ItemStack[]{stack});
|
||||||
this.setBlock(position, Blocks.air, 0);
|
continue;
|
||||||
return this.trySetSoil(position, loam);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!this.isManual) {
|
}
|
||||||
if (!this.isWaterBlock(position)) {
|
|
||||||
if (i % 2 == 0) {
|
if (!isAirBlock(position) && !world.getBlock(position.x, position.y, position.z).isReplaceable(world, position.x, position.y, position.z)) {
|
||||||
return this.trySetSoil(position);
|
ItemStack block = getAsItemStack(position);
|
||||||
}
|
ItemStack loam = getAvailableLoam();
|
||||||
FarmDirection cclock = FarmDirection.EAST;
|
if (isWaste(block) && loam != null) {
|
||||||
if (direction == FarmDirection.EAST) {
|
produce.addAll(Blocks.dirt.getDrops(world, position.x, position.y, position.z, block.getItemDamage(), 0));
|
||||||
cclock = FarmDirection.SOUTH;
|
setBlock(position, Blocks.air, 0);
|
||||||
}
|
return trySetSoil(position, loam);
|
||||||
else if (direction == FarmDirection.SOUTH) {
|
}
|
||||||
cclock = FarmDirection.EAST;
|
} else if (!isManual) {
|
||||||
}
|
if (!isWaterBlock(position)) {
|
||||||
else if (direction == FarmDirection.WEST) {
|
if (i % 2 == 0) {
|
||||||
cclock = FarmDirection.SOUTH;
|
return trySetSoil(position);
|
||||||
}
|
}
|
||||||
final Vect previous = this.translateWithOffset(position.x, position.y, position.z, cclock, 1);
|
|
||||||
final ItemStack soil2 = this.getAsItemStack(previous);
|
FarmDirection cclock = FarmDirection.EAST;
|
||||||
if (!Gardening.isSoil(soil2.getItem())) {
|
if (direction == FarmDirection.EAST) {
|
||||||
this.trySetSoil(position);
|
cclock = FarmDirection.SOUTH;
|
||||||
}
|
} else if (direction == FarmDirection.SOUTH) {
|
||||||
|
cclock = FarmDirection.EAST;
|
||||||
|
} else if (direction == FarmDirection.WEST) {
|
||||||
|
cclock = FarmDirection.SOUTH;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vect previous = translateWithOffset(position.x, position.y, position.z, cclock, 1);
|
||||||
|
ItemStack soil2 = getAsItemStack(previous);
|
||||||
|
if (!Gardening.isSoil(soil2.getItem())) {
|
||||||
|
trySetSoil(position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -169,29 +176,31 @@ 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(int x, int y, int z, FarmDirection direction, int extent) {
|
||||||
for (int i = 0; i < extent; ++i) {
|
for (int i = 0; i < extent; ++i) {
|
||||||
final Vect position = this.translateWithOffset(x, y, z, direction, i);
|
Vect position = translateWithOffset(x, y, z, direction, i);
|
||||||
if (this.isAirBlock(position) || this.world.getBlock(x, y, z).isReplaceable(this.world, position.x, position.y, position.z)) {
|
if (!isAirBlock(position) && !world.getBlock(x, y, z).isReplaceable(world, position.x, position.y, position.z)) {
|
||||||
if (!this.isWaterBlock(position)) {
|
continue;
|
||||||
boolean isEnclosed = true;
|
}
|
||||||
if (this.world.isAirBlock(position.x + 1, position.y, position.z)) {
|
|
||||||
isEnclosed = false;
|
if (isWaterBlock(position)) {
|
||||||
}
|
continue;
|
||||||
else if (this.world.isAirBlock(position.x - 1, position.y, position.z)) {
|
}
|
||||||
isEnclosed = false;
|
|
||||||
}
|
boolean isEnclosed = true;
|
||||||
else if (this.world.isAirBlock(position.x, position.y, position.z + 1)) {
|
if (world.isAirBlock(position.x + 1, position.y, position.z)) {
|
||||||
isEnclosed = false;
|
isEnclosed = false;
|
||||||
}
|
} else if (world.isAirBlock(position.x - 1, position.y, position.z)) {
|
||||||
else if (this.world.isAirBlock(position.x, position.y, position.z - 1)) {
|
isEnclosed = false;
|
||||||
isEnclosed = false;
|
} else if (world.isAirBlock(position.x, position.y, position.z + 1)) {
|
||||||
}
|
isEnclosed = false;
|
||||||
isEnclosed = (isEnclosed || this.moisture != EnumMoisture.Damp);
|
} else if (world.isAirBlock(position.x, position.y, position.z - 1)) {
|
||||||
if (isEnclosed) {
|
isEnclosed = false;
|
||||||
return this.trySetWater(position);
|
}
|
||||||
}
|
|
||||||
}
|
isEnclosed = (isEnclosed || moisture != EnumMoisture.DAMP);
|
||||||
|
if (isEnclosed) {
|
||||||
|
return trySetWater(position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -199,82 +208,108 @@ public class GardenLogic extends FarmLogic
|
|||||||
|
|
||||||
private ItemStack getAvailableLoam() {
|
private ItemStack getAvailableLoam() {
|
||||||
EnumMoisture[] moistures;
|
EnumMoisture[] moistures;
|
||||||
if (this.moisture == EnumMoisture.Damp) {
|
if (moisture == EnumMoisture.DAMP) {
|
||||||
moistures = new EnumMoisture[] { EnumMoisture.Damp, EnumMoisture.Normal, EnumMoisture.Dry };
|
moistures = new EnumMoisture[]{
|
||||||
|
EnumMoisture.DAMP,
|
||||||
|
EnumMoisture.NORMAL,
|
||||||
|
EnumMoisture.DRY
|
||||||
|
};
|
||||||
|
} else if (moisture == EnumMoisture.DRY) {
|
||||||
|
moistures = new EnumMoisture[]{
|
||||||
|
EnumMoisture.DRY,
|
||||||
|
EnumMoisture.DAMP,
|
||||||
|
EnumMoisture.DRY
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
moistures = new EnumMoisture[]{
|
||||||
|
EnumMoisture.DRY,
|
||||||
|
EnumMoisture.NORMAL,
|
||||||
|
EnumMoisture.DAMP
|
||||||
|
};
|
||||||
}
|
}
|
||||||
else if (this.moisture == EnumMoisture.Damp) {
|
|
||||||
moistures = new EnumMoisture[] { EnumMoisture.Dry, EnumMoisture.Damp, EnumMoisture.Dry };
|
EnumAcidity[] acidities = {
|
||||||
}
|
EnumAcidity.NEUTRAL,
|
||||||
else {
|
EnumAcidity.ACID,
|
||||||
moistures = new EnumMoisture[] { EnumMoisture.Dry, EnumMoisture.Normal, EnumMoisture.Damp };
|
EnumAcidity.ALKALINE
|
||||||
}
|
};
|
||||||
final EnumAcidity[] acidities = { EnumAcidity.Neutral, EnumAcidity.Acid, EnumAcidity.Alkaline };
|
|
||||||
for (final EnumMoisture moist : moistures) {
|
for (EnumMoisture moist : moistures) {
|
||||||
for (final EnumAcidity acid : acidities) {
|
for (EnumAcidity acid : acidities) {
|
||||||
for (final Block type : new Block[] { Botany.flowerbed, Botany.loam, Botany.soil }) {
|
for (Block type : new Block[]{Botany.flowerbed, Botany.loam, Botany.soil}) {
|
||||||
final int meta = acid.ordinal() * 3 + moist.ordinal();
|
int meta = acid.ordinal() * 3 + moist.ordinal();
|
||||||
final ItemStack[] resource = { new ItemStack(type, 1, meta) };
|
ItemStack[] resource = {new ItemStack(type, 1, meta)};
|
||||||
if (this.housing.getFarmInventory().hasResources(resource)) {
|
if (housing.getFarmInventory().hasResources(resource)) {
|
||||||
return resource[0];
|
return resource[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.housing.getFarmInventory().hasResources(new ItemStack[] { new ItemStack(Blocks.dirt) })) {
|
|
||||||
|
if (housing.getFarmInventory().hasResources(new ItemStack[]{new ItemStack(Blocks.dirt)})) {
|
||||||
return new ItemStack(Blocks.dirt);
|
return new ItemStack(Blocks.dirt);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean trySetSoil(final Vect position) {
|
private boolean trySetSoil(Vect position) {
|
||||||
return this.trySetSoil(position, this.getAvailableLoam());
|
return trySetSoil(position, getAvailableLoam());
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean trySetSoil(final Vect position, ItemStack loam) {
|
private boolean trySetSoil(Vect position, ItemStack loam) {
|
||||||
ItemStack copy = loam;
|
ItemStack copy = loam;
|
||||||
if (loam != null) {
|
if (loam == null) {
|
||||||
if (loam.getItem() == Item.getItemFromBlock(Blocks.dirt)) {
|
return false;
|
||||||
loam = new ItemStack(Botany.soil, 0, 4);
|
|
||||||
}
|
|
||||||
this.setBlock(position, ((ItemBlock) loam.getItem()).field_150939_a, loam.getItemDamage());
|
|
||||||
this.housing.getFarmInventory().removeResources(new ItemStack[] { copy });
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
|
if (loam.getItem() == Item.getItemFromBlock(Blocks.dirt)) {
|
||||||
|
loam = new ItemStack(Botany.soil, 0, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
setBlock(position, ((ItemBlock) loam.getItem()).field_150939_a, loam.getItemDamage());
|
||||||
|
housing.getFarmInventory().removeResources(new ItemStack[]{copy});
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean trySetWater(final Vect position) {
|
private boolean trySetWater(Vect position) {
|
||||||
final FluidStack water = Binnie.Liquid.getLiquidStack("water", 1000);
|
FluidStack water = Binnie.Liquid.getLiquidStack("water", 1000);
|
||||||
if (this.moisture == EnumMoisture.Damp) {
|
if (moisture == EnumMoisture.DAMP) {
|
||||||
if (!this.housing.hasLiquid(water)) {
|
if (!housing.hasLiquid(water)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.setBlock(position, Blocks.water, 0);
|
|
||||||
this.housing.removeLiquid(water);
|
setBlock(position, Blocks.water, 0);
|
||||||
|
housing.removeLiquid(water);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
if (this.moisture != EnumMoisture.Dry) {
|
if (moisture != EnumMoisture.DRY) {
|
||||||
return this.trySetSoil(position);
|
return trySetSoil(position);
|
||||||
}
|
|
||||||
final ItemStack[] sand = { new ItemStack(Blocks.sand, 1) };
|
|
||||||
if (!this.housing.getFarmInventory().hasResources(sand)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
this.setBlock(position, Blocks.sand, 0);
|
|
||||||
this.housing.getFarmInventory().removeResources(sand);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ItemStack[] sand = {new ItemStack(Blocks.sand, 1)};
|
||||||
|
if (!housing.getFarmInventory().hasResources(sand)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
setBlock(position, Blocks.sand, 0);
|
||||||
|
housing.getFarmInventory().removeResources(sand);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIcon(final ItemStack icon) {
|
private void dropBlockAsProduction(Vect position) {
|
||||||
this.icon = icon;
|
ItemStack stack = new ItemStack(world.getBlock(position.x, position.y, position.z));
|
||||||
|
if (stack.getItem() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
produce.add(stack);
|
||||||
|
world.setBlockToAir(position.x, position.y, position.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAcceptedGermling(final ItemStack itemstack) {
|
public boolean isAcceptedGermling(ItemStack stack) {
|
||||||
for (final IFarmable farmable : this.farmables) {
|
for (IFarmable farmable : farmables) {
|
||||||
if (farmable.isGermling(itemstack)) {
|
if (farmable.isGermling(stack)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -282,14 +317,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(int x, int y, int z, FarmDirection direction, int extent) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon() {
|
public IIcon getIcon() {
|
||||||
return this.icon.getIconIndex();
|
return icon.getIconIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIcon(ItemStack icon) {
|
||||||
|
this.icon = icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -299,50 +338,49 @@ public class GardenLogic extends FarmLogic
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean maintainCrops(final int x, final int y, final int z, final FarmDirection direction, final int extent) {
|
protected boolean maintainCrops(int x, int y, int z, FarmDirection direction, int extent) {
|
||||||
for (int i = 0; i < extent; ++i) {
|
for (int i = 0; i < extent; ++i) {
|
||||||
final Vect position = this.translateWithOffset(x, y, z, direction, i);
|
Vect position = translateWithOffset(x, y, z, direction, i);
|
||||||
if (this.isAirBlock(position) || this.world.getBlock(x, y, z).isReplaceable(this.world, position.x, position.y, position.z)) {
|
if (isAirBlock(position) || world.getBlock(x, y, z).isReplaceable(world, position.x, position.y, position.z)) {
|
||||||
final ItemStack below = this.getAsItemStack(position.add(new Vect(0, -1, 0)));
|
ItemStack below = getAsItemStack(position.add(new Vect(0, -1, 0)));
|
||||||
if (Gardening.isSoil(below.getItem())) {
|
if (Gardening.isSoil(below.getItem())) {
|
||||||
return this.trySetCrop(position);
|
return trySetCrop(position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean trySetCrop(final Vect position) {
|
private boolean trySetCrop(Vect position) {
|
||||||
for (final IFarmable farmable : this.farmables) {
|
for (IFarmable farmable : farmables) {
|
||||||
final boolean success = this.housing.plantGermling(farmable, this.world, position.x, position.y, position.z);
|
boolean success = housing.plantGermling(farmable, world, position.x, position.y, position.z);
|
||||||
if (success && this.housing instanceof IOwnable) {
|
if (!success || !(housing instanceof IOwnable)) {
|
||||||
final TileEntity tile = this.housing.getWorld().getTileEntity(position.x, position.y, position.z);
|
continue;
|
||||||
if (tile instanceof TileEntityFlower) {
|
}
|
||||||
try {
|
|
||||||
final IOwnable housing2 = (IOwnable) this.housing;
|
TileEntity tile = housing.getWorld().getTileEntity(position.x, position.y, position.z);
|
||||||
GameProfile prof = null;
|
if (!(tile instanceof TileEntityFlower)) {
|
||||||
if (Mods.Forestry.dev()) {
|
|
||||||
prof = (GameProfile) IOwnable.class.getMethod("getOwner", new Class[0]).invoke(housing2, new Object[0]);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
prof = (GameProfile) IOwnable.class.getMethod("getOwnerProfile", new Class[0]).invoke(housing2, new Object[0]);
|
|
||||||
}
|
|
||||||
((TileEntityFlower) tile).setOwner(prof);
|
|
||||||
} catch (Exception ex) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
IOwnable housing2 = (IOwnable) housing;
|
||||||
|
GameProfile prof = (GameProfile) IOwnable.class.getMethod("getOwnerProfile", new Class[0]).invoke(housing2);
|
||||||
|
((TileEntityFlower) tile).setOwner(prof);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getAvailableAcid() {
|
public ItemStack getAvailableAcid() {
|
||||||
for (final ItemStack stack : Gardening.getAcidFertilisers()) {
|
for (ItemStack stack : Gardening.getAcidFertilisers()) {
|
||||||
if (stack != null && stack.getItem() != null && this.housing.getFarmInventory().hasResources(new ItemStack[] { stack })) {
|
if (stack != null && stack.getItem() != null && housing.getFarmInventory().hasResources(new ItemStack[]{stack})) {
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -350,21 +388,20 @@ public class GardenLogic extends FarmLogic
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getAvailableAlkaline() {
|
public ItemStack getAvailableAlkaline() {
|
||||||
for (final ItemStack stack : Gardening.getAlkalineFertilisers()) {
|
for (ItemStack stack : Gardening.getAlkalineFertilisers()) {
|
||||||
if (stack != null && stack.getItem() != null && this.housing.getFarmInventory().hasResources(new ItemStack[] { stack })) {
|
if (stack != null && stack.getItem() != null && housing.getFarmInventory().hasResources(new ItemStack[]{stack})) {
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setData(final EnumMoisture moisture2, final EnumAcidity acidity2, final boolean isManual, final boolean isFertilised, final ItemStack icon2, final String name2) {
|
public void setData(EnumMoisture moisture, EnumAcidity acidity, boolean isManual, boolean fertilised, ItemStack icon, String name) {
|
||||||
this.moisture = moisture2;
|
this.moisture = moisture;
|
||||||
this.acidity = acidity2;
|
this.acidity = acidity;
|
||||||
this.isManual = isManual;
|
this.isManual = isManual;
|
||||||
this.fertilised = isFertilised;
|
this.fertilised = fertilised;
|
||||||
this.icon = icon2;
|
this.icon = icon;
|
||||||
this.name = name2;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,39 +1,49 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.flower;
|
package binnie.botany.flower;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Random;
|
|
||||||
import binnie.botany.Botany;
|
import binnie.botany.Botany;
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import binnie.botany.api.IFlowerType;
|
|
||||||
import binnie.botany.api.EnumFlowerStage;
|
import binnie.botany.api.EnumFlowerStage;
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import com.mojang.authlib.GameProfile;
|
|
||||||
import binnie.botany.api.IFlower;
|
import binnie.botany.api.IFlower;
|
||||||
import binnie.botany.gardening.Gardening;
|
import binnie.botany.api.IFlowerType;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import binnie.botany.core.BotanyCore;
|
import binnie.botany.core.BotanyCore;
|
||||||
|
import binnie.botany.gardening.Gardening;
|
||||||
|
import binnie.botany.genetics.EnumFlowerType;
|
||||||
import binnie.core.BinnieCore;
|
import binnie.core.BinnieCore;
|
||||||
import net.minecraft.item.ItemStack;
|
import com.mojang.authlib.GameProfile;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import binnie.botany.genetics.EnumFlowerType;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
public class BlockFlower extends BlockContainer {
|
||||||
|
public BlockFlower() {
|
||||||
|
super(Material.plants);
|
||||||
|
float f = 0.2f;
|
||||||
|
setBlockBounds(0.5f - f, 0.0f, 0.5f - f, 0.5f + f, f * 3.0f, 0.5f + f);
|
||||||
|
setTickRandomly(true);
|
||||||
|
setBlockName("flower");
|
||||||
|
setStepSound(Block.soundTypeGrass);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUnlocalizedName() {
|
||||||
|
return "botany.flower";
|
||||||
|
}
|
||||||
|
|
||||||
public class BlockFlower extends BlockContainer
|
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType() {
|
public int getRenderType() {
|
||||||
return RendererBotany.renderID;
|
return RendererBotany.renderID;
|
||||||
@@ -41,27 +51,19 @@ public class BlockFlower extends BlockContainer
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(final IIconRegister par1IconRegister) {
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
for (final EnumFlowerType type : EnumFlowerType.values()) {
|
for (EnumFlowerType type : EnumFlowerType.values()) {
|
||||||
type.registerIcons(par1IconRegister);
|
type.registerIcons(register);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockFlower() {
|
|
||||||
super(Material.plants);
|
|
||||||
final float f = 0.2f;
|
|
||||||
this.setBlockBounds(0.5f - f, 0.0f, 0.5f - f, 0.5f + f, f * 3.0f, 0.5f + f);
|
|
||||||
this.setTickRandomly(true);
|
|
||||||
this.setBlockName("flower");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(final World var1, final int i) {
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
return new TileEntityFlower();
|
return new TileEntityFlower();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(final World par1World, final int par2, final int par3, final int par4) {
|
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,23 +78,23 @@ public class BlockFlower extends BlockContainer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(final World world, final int x, final int y, final int z, final EntityLivingBase living, final ItemStack stack) {
|
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
|
||||||
super.onBlockPlacedBy(world, x, y, z, living, stack);
|
super.onBlockPlacedBy(world, x, y, z, entity, stack);
|
||||||
final TileEntity flower = world.getTileEntity(x, y, z);
|
TileEntity flower = world.getTileEntity(x, y, z);
|
||||||
if (!BinnieCore.proxy.isSimulating(world)) {
|
if (!BinnieCore.proxy.isSimulating(world)) {
|
||||||
if (flower != null && flower instanceof TileEntityFlower) {
|
if (flower != null && flower instanceof TileEntityFlower) {
|
||||||
final IFlower f = BotanyCore.getFlowerRoot().getMember(stack);
|
IFlower f = BotanyCore.getFlowerRoot().getMember(stack);
|
||||||
((TileEntityFlower) flower).setRender(new TileEntityFlower.RenderInfo(f, (TileEntityFlower) flower));
|
((TileEntityFlower) flower).setRender(new TileEntityFlower.RenderInfo(f, (TileEntityFlower) flower));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final TileEntity below = world.getTileEntity(x, y - 1, z);
|
|
||||||
|
TileEntity below = world.getTileEntity(x, y - 1, z);
|
||||||
if (flower != null && flower instanceof TileEntityFlower) {
|
if (flower != null && flower instanceof TileEntityFlower) {
|
||||||
if (below instanceof TileEntityFlower) {
|
if (below instanceof TileEntityFlower) {
|
||||||
((TileEntityFlower) flower).setSection(((TileEntityFlower) below).getSection());
|
((TileEntityFlower) flower).setSection(((TileEntityFlower) below).getSection());
|
||||||
}
|
} else {
|
||||||
else {
|
GameProfile owner = (entity instanceof EntityPlayer) ? ((EntityPlayer) entity).getGameProfile() : null;
|
||||||
final GameProfile owner = (living instanceof EntityPlayer) ? ((EntityPlayer) living).getGameProfile() : null;
|
|
||||||
((TileEntityFlower) flower).create(stack, owner);
|
((TileEntityFlower) flower).create(stack, owner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -101,86 +103,108 @@ public class BlockFlower extends BlockContainer
|
|||||||
|
|
||||||
@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 IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||||
final TileEntity tile = world.getTileEntity(x, y, z);
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
if (tile instanceof TileEntityFlower) {
|
if (!(tile instanceof TileEntityFlower)) {
|
||||||
final TileEntityFlower f = (TileEntityFlower) tile;
|
return super.getIcon(world, x, y, z, side);
|
||||||
final EnumFlowerStage stage = (f.getAge() == 0) ? EnumFlowerStage.SEED : EnumFlowerStage.FLOWER;
|
|
||||||
final IFlowerType flower = f.getType();
|
|
||||||
final int section = f.getRenderSection();
|
|
||||||
final boolean flowered = f.isFlowered();
|
|
||||||
return (RendererBotany.pass == 0) ? flower.getStem(stage, flowered, section) : ((RendererBotany.pass == 1) ? flower.getPetalIcon(stage, flowered, section) : flower.getVariantIcon(stage, flowered, section));
|
|
||||||
}
|
}
|
||||||
return super.getIcon(world, x, y, z, side);
|
|
||||||
|
TileEntityFlower f = (TileEntityFlower) tile;
|
||||||
|
EnumFlowerStage stage = (f.getAge() == 0) ? EnumFlowerStage.SEED : EnumFlowerStage.FLOWER;
|
||||||
|
IFlowerType flower = f.getType();
|
||||||
|
int section = f.getRenderSection();
|
||||||
|
boolean flowered = f.isFlowered();
|
||||||
|
if (RendererBotany.pass == 0) {
|
||||||
|
return flower.getStem(stage, flowered, section);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (RendererBotany.pass == 1) ?
|
||||||
|
flower.getPetalIcon(stage, flowered, section) :
|
||||||
|
flower.getVariantIcon(stage, flowered, section);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int colorMultiplier(final IBlockAccess world, final int x, final int y, final int z) {
|
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
||||||
final TileEntity tile = world.getTileEntity(x, y, z);
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
if (tile instanceof TileEntityFlower) {
|
if (tile instanceof TileEntityFlower) {
|
||||||
final TileEntityFlower f = (TileEntityFlower) tile;
|
TileEntityFlower f = (TileEntityFlower) tile;
|
||||||
return (RendererBotany.pass == 0) ? f.getStemColour() : ((RendererBotany.pass == 1) ? f.getPrimaryColour() : f.getSecondaryColour());
|
if (RendererBotany.pass == 0) {
|
||||||
}
|
return f.getStemColour();
|
||||||
return 16777215;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canPlaceBlockAt(final World world, final int x, final int y, final int z) {
|
|
||||||
return super.canPlaceBlockAt(world, x, y, z) && this.canBlockStay(world, x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean canPlaceBlockOn(final Block block) {
|
|
||||||
return block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland || Gardening.isSoil(block);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onNeighborBlockChange(final World world, final int x, final int y, final int z, final Block block) {
|
|
||||||
super.onNeighborBlockChange(world, x, y, z, block);
|
|
||||||
this.checkAndDropBlock(world, x, y, z);
|
|
||||||
final TileEntity tile = world.getTileEntity(x, y, z);
|
|
||||||
if (tile instanceof TileEntityFlower) {
|
|
||||||
final TileEntityFlower flower = (TileEntityFlower) tile;
|
|
||||||
if (flower.getSection() == 0 && flower.getFlower() != null && flower.getFlower().getAge() > 0 && flower.getFlower().getGenome().getPrimary().getType().getSections() > 1 && world.getBlock(x, y + 1, z) != Botany.flower) {
|
|
||||||
this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
|
||||||
world.setBlockToAir(x, y, z);
|
|
||||||
}
|
}
|
||||||
|
return (RendererBotany.pass == 1) ?
|
||||||
|
f.getPrimaryColor() :
|
||||||
|
f.getSecondaryColor();
|
||||||
}
|
}
|
||||||
|
return 0xffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateTick(final World world, final int x, final int y, final int z, final Random rand) {
|
public boolean canPlaceBlockAt(World world, int x, int y, int z) {
|
||||||
final TileEntity tile = world.getTileEntity(x, y, z);
|
return super.canPlaceBlockAt(world, x, y, z)
|
||||||
if (tile instanceof TileEntityFlower) {
|
&& canBlockStay(world, x, y, z);
|
||||||
((TileEntityFlower) tile).randomUpdate(rand);
|
}
|
||||||
this.checkAndDropBlock(world, x, y, z);
|
|
||||||
|
protected boolean canPlaceBlockOn(Block block) {
|
||||||
|
return block == Blocks.grass
|
||||||
|
|| block == Blocks.dirt
|
||||||
|
|| block == Blocks.farmland
|
||||||
|
|| Gardening.isSoil(block);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||||
|
super.onNeighborBlockChange(world, x, y, z, block);
|
||||||
|
checkAndDropBlock(world, x, y, z);
|
||||||
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
|
if (!(tile instanceof TileEntityFlower)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
world.setBlockToAir(x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void checkAndDropBlock(final World world, final int x, final int y, final int z) {
|
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||||
if (!this.canBlockStay(world, x, y, z)) {
|
if (flower.getSection() == 0
|
||||||
this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
&& flower.getFlower() != null
|
||||||
|
&& flower.getFlower().getAge() > 0
|
||||||
|
&& flower.getFlower().getGenome().getPrimary().getType().getSections() > 1
|
||||||
|
&& world.getBlock(x, y + 1, z) != Botany.flower) {
|
||||||
|
dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||||
world.setBlockToAir(x, y, z);
|
world.setBlockToAir(x, y, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canBlockStay(final World world, final int x, final int y, final int z) {
|
public void updateTick(World world, int x, int y, int z, Random rand) {
|
||||||
final TileEntity tile = world.getTileEntity(x, y, z);
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() > 0) {
|
if (tile instanceof TileEntityFlower) {
|
||||||
return world.getBlock(x, y - 1, z) == Botany.flower;
|
((TileEntityFlower) tile).randomUpdate(rand);
|
||||||
|
checkAndDropBlock(world, x, y, z);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
world.setBlockToAir(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void checkAndDropBlock(World world, int x, int y, int z) {
|
||||||
|
if (!canBlockStay(world, x, y, z)) {
|
||||||
|
dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||||
|
world.setBlockToAir(x, y, z);
|
||||||
}
|
}
|
||||||
return this.canPlaceBlockOn(world.getBlock(x, y - 1, z));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int blockMeta, final int fortune) {
|
public boolean canBlockStay(World world, int x, int y, int z) {
|
||||||
final ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
final TileEntity tile = world.getTileEntity(x, y, z);
|
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() > 0) {
|
||||||
|
return world.getBlock(x, y - 1, z) == Botany.flower;
|
||||||
|
}
|
||||||
|
return canPlaceBlockOn(world.getBlock(x, y - 1, z));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int blockMeta, int fortune) {
|
||||||
|
ArrayList<ItemStack> drops = new ArrayList<>();
|
||||||
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() == 0) {
|
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).getSection() == 0) {
|
||||||
final ItemStack flower = ((TileEntityFlower) tile).getItemStack();
|
ItemStack flower = ((TileEntityFlower) tile).getItemStack();
|
||||||
if (flower != null) {
|
if (flower != null) {
|
||||||
drops.add(flower);
|
drops.add(flower);
|
||||||
}
|
}
|
||||||
@@ -189,14 +213,20 @@ public class BlockFlower extends BlockContainer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean removedByPlayer(final World world, final EntityPlayer player, final int x, final int y, final int z) {
|
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
|
||||||
final List<ItemStack> drops = this.getDrops(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
List<ItemStack> drops = getDrops(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||||
final boolean hasBeenBroken = world.setBlockToAir(x, y, z);
|
boolean hasBeenBroken = world.setBlockToAir(x, y, z);
|
||||||
if (hasBeenBroken && BinnieCore.proxy.isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
if (hasBeenBroken && BinnieCore.proxy.isSimulating(world) && drops.size() > 0 && (player == null || !player.capabilities.isCreativeMode)) {
|
||||||
for (final ItemStack drop : drops) {
|
for (ItemStack drop : drops) {
|
||||||
this.dropBlockAsItem(world, x, y, z, drop);
|
dropBlockAsItem(world, x, y, z, drop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return hasBeenBroken;
|
return hasBeenBroken;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public IIcon getIcon(int meta, int side) {
|
||||||
|
return Blocks.yellow_flower.getIcon(0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,55 +1,50 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.flower;
|
package binnie.botany.flower;
|
||||||
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import binnie.botany.Botany;
|
|
||||||
import forestry.api.genetics.IPollinatable;
|
|
||||||
import binnie.Binnie;
|
import binnie.Binnie;
|
||||||
import binnie.botany.api.EnumFlowerStage;
|
import binnie.botany.Botany;
|
||||||
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 net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import forestry.api.genetics.IIndividual;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import binnie.botany.CreativeTabBotany;
|
import binnie.botany.CreativeTabBotany;
|
||||||
|
import binnie.botany.api.EnumFlowerStage;
|
||||||
|
import binnie.botany.api.IFlower;
|
||||||
|
import binnie.botany.api.IFlowerColor;
|
||||||
|
import binnie.botany.api.IFlowerGenome;
|
||||||
|
import binnie.botany.api.IFlowerType;
|
||||||
|
import binnie.botany.core.BotanyCore;
|
||||||
|
import binnie.botany.genetics.EnumFlowerType;
|
||||||
|
import binnie.botany.genetics.Flower;
|
||||||
|
import binnie.core.BinnieCore;
|
||||||
|
import binnie.core.util.I18N;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import forestry.api.genetics.IIndividual;
|
||||||
|
import forestry.api.genetics.IPollinatable;
|
||||||
|
import forestry.core.config.Config;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public abstract class ItemBotany extends Item {
|
||||||
|
public ItemBotany(String name) {
|
||||||
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
|
setUnlocalizedName(name);
|
||||||
|
hasSubtypes = true;
|
||||||
|
}
|
||||||
|
|
||||||
public abstract class ItemBotany extends Item
|
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int getSpriteNumber() {
|
public int getSpriteNumber() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemBotany(final String name) {
|
|
||||||
this.setCreativeTab(CreativeTabBotany.instance);
|
|
||||||
this.setUnlocalizedName(name);
|
|
||||||
this.hasSubtypes = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDamageable() {
|
public boolean isDamageable() {
|
||||||
return false;
|
return false;
|
||||||
@@ -66,85 +61,103 @@ public abstract class ItemBotany extends Item
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasEffect(final ItemStack itemstack) {
|
public boolean hasEffect(ItemStack stack, int pass) {
|
||||||
if (!itemstack.hasTagCompound()) {
|
if (!stack.hasTagCompound()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final IIndividual individual = this.getIndividual(itemstack);
|
|
||||||
return individual != null && individual.getGenome() != null && individual.hasEffect();
|
IIndividual individual = getIndividual(stack);
|
||||||
|
return individual != null
|
||||||
|
&& individual.getGenome() != null
|
||||||
|
&& individual.hasEffect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(final ItemStack itemstack, final EntityPlayer player, final List list, final boolean flag) {
|
public void addInformation(ItemStack itemstack, EntityPlayer player, List tooltip, boolean flag) {
|
||||||
if (!itemstack.hasTagCompound()) {
|
if (!itemstack.hasTagCompound()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final IFlower individual = (IFlower) this.getIndividual(itemstack);
|
IFlower individual = (IFlower) getIndividual(itemstack);
|
||||||
if (individual == null) {
|
if (individual == null) {
|
||||||
list.add("This item is bugged. Destroy it!");
|
tooltip.add(I18N.localise("botany.item.tooltip.bugged"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
list.add("§e" + individual.getGenome().getPrimaryColor().getName() + ((individual.getGenome().getPrimaryColor() == individual.getGenome().getSecondaryColor()) ? "" : (" and " + individual.getGenome().getSecondaryColor().getName())) + ", " + individual.getGenome().getStemColor().getName() + " Stem");
|
|
||||||
|
IFlowerGenome genome = individual.getGenome();
|
||||||
|
IFlowerColor primaryColor = genome.getPrimaryColor();
|
||||||
|
IFlowerColor secondColor = genome.getSecondaryColor();
|
||||||
|
IFlowerColor stemColor = genome.getStemColor();
|
||||||
|
|
||||||
|
if (primaryColor == secondColor) {
|
||||||
|
tooltip.add(EnumChatFormatting.YELLOW + I18N.localise("botany.item.tooltip.flowerColor1", primaryColor.getName(), stemColor.getName()));
|
||||||
|
} else {
|
||||||
|
tooltip.add(EnumChatFormatting.YELLOW + I18N.localise("botany.item.tooltip.flowerColor2", primaryColor.getName(), secondColor.getName(), stemColor.getName()));
|
||||||
|
}
|
||||||
|
|
||||||
if (individual.isAnalyzed()) {
|
if (individual.isAnalyzed()) {
|
||||||
if (BinnieCore.proxy.isShiftDown()) {
|
if (BinnieCore.proxy.isShiftDown()) {
|
||||||
individual.addTooltip(list);
|
individual.addTooltip(tooltip);
|
||||||
|
} else {
|
||||||
|
tooltip.add(EnumChatFormatting.GRAY + I18N.localise("botany.item.tooltip.holdMore"));
|
||||||
}
|
}
|
||||||
else {
|
} else {
|
||||||
list.add("§o<Hold shift for details>");
|
tooltip.add(I18N.localise("botany.item.tooltip.unknownGenome"));
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
list.add("<Unknown>");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerIcons(final IIconRegister par1IconRegister) {
|
public void registerIcons(IIconRegister par1IconRegister) {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IIndividual getIndividual(final ItemStack itemstack) {
|
protected IIndividual getIndividual(ItemStack itemstack) {
|
||||||
return new Flower(itemstack.getTagCompound());
|
return new Flower(itemstack.getTagCompound());
|
||||||
}
|
}
|
||||||
|
|
||||||
private IAlleleFlowerSpecies getPrimarySpecies(final ItemStack itemstack) {
|
|
||||||
final IFlower tree = BotanyCore.speciesRoot.getMember(itemstack);
|
|
||||||
if (tree == null) {
|
|
||||||
return (IAlleleFlowerSpecies) BotanyCore.speciesRoot.getDefaultTemplate()[EnumFlowerChromosome.SPECIES.ordinal()];
|
|
||||||
}
|
|
||||||
return tree.getGenome().getPrimary();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getItemStackDisplayName(final ItemStack itemstack) {
|
public String getItemStackDisplayName(ItemStack itemstack) {
|
||||||
if (!itemstack.hasTagCompound()) {
|
if (!itemstack.hasTagCompound()) {
|
||||||
return "Unknown";
|
return I18N.localise("botany.item.tooltip.unknown");
|
||||||
}
|
}
|
||||||
final IIndividual individual = this.getIndividual(itemstack);
|
|
||||||
return (individual != null && individual.getGenome() != null) ? (individual.getDisplayName() + this.getTag()) : "Corrupted Flower";
|
IIndividual individual = getIndividual(itemstack);
|
||||||
|
if (individual != null && individual.getGenome() != null) {
|
||||||
|
String tag = getTag();
|
||||||
|
if (tag == null || tag.isEmpty()) {
|
||||||
|
return individual.getDisplayName();
|
||||||
|
}
|
||||||
|
return I18N.localise("botany.item.botany.name", individual.getDisplayName(), tag);
|
||||||
|
}
|
||||||
|
return I18N.localise("botany.item.flowerCorrupted.name");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubItems(final Item item, final CreativeTabs par2CreativeTabs, final List itemList) {
|
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
||||||
this.addCreativeItems(itemList, true);
|
addCreativeItems(itemList, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addCreativeItems(final List itemList, final boolean hideSecrets) {
|
public void addCreativeItems(List itemList, boolean hideSecrets) {
|
||||||
for (final IIndividual individual : BotanyCore.speciesRoot.getIndividualTemplates()) {
|
for (IIndividual individual : BotanyCore.speciesRoot.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.speciesRoot.getMemberStack(individual.copy(), getStage().ordinal()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getColorFromItemStack(final ItemStack itemstack, final int renderPass) {
|
public int getColorFromItemStack(ItemStack itemstack, int renderPass) {
|
||||||
final IFlower flower = BotanyCore.speciesRoot.getMember(itemstack);
|
IFlower flower = BotanyCore.speciesRoot.getMember(itemstack);
|
||||||
if (flower == null || flower.getGenome() == null) {
|
if (flower == null || flower.getGenome() == null) {
|
||||||
return 16777215;
|
return 0xffffff;
|
||||||
}
|
}
|
||||||
return (renderPass == 0) ? flower.getGenome().getStemColor().getColor(flower.isWilted()) : ((renderPass == 1) ? flower.getGenome().getPrimaryColor().getColor(flower.isWilted()) : flower.getGenome().getSecondaryColor().getColor(flower.isWilted()));
|
|
||||||
|
if (renderPass == 0) {
|
||||||
|
return flower.getGenome().getStemColor().getColor(flower.isWilted());
|
||||||
|
}
|
||||||
|
return (renderPass == 1) ?
|
||||||
|
flower.getGenome().getPrimaryColor().getColor(flower.isWilted()) :
|
||||||
|
flower.getGenome().getSecondaryColor().getColor(flower.isWilted());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -153,131 +166,119 @@ public abstract class ItemBotany extends Item
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderPasses(final int metadata) {
|
public int getRenderPasses(int metadata) {
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(final ItemStack itemstack, final int renderPass) {
|
public IIcon getIcon(ItemStack itemstack, int renderPass) {
|
||||||
final IFlower flower = BotanyCore.speciesRoot.getMember(itemstack);
|
IFlower flower = BotanyCore.speciesRoot.getMember(itemstack);
|
||||||
if (flower == null || flower.getGenome() == null || flower.getGenome().getPrimary() == null) {
|
if (flower == null || flower.getGenome() == null || flower.getGenome().getPrimary() == null) {
|
||||||
return EnumFlowerType.Allium.getBlank();
|
return EnumFlowerType.ALLIUM.getBlank();
|
||||||
}
|
}
|
||||||
final IFlowerType type = flower.getGenome().getPrimary().getType();
|
|
||||||
|
IFlowerType type = flower.getGenome().getPrimary().getType();
|
||||||
if (renderPass == 0) {
|
if (renderPass == 0) {
|
||||||
return type.getStem(this.getStage(), flower.hasFlowered(), type.getSections() - 1);
|
return type.getStem(getStage(), flower.hasFlowered(), type.getSections() - 1);
|
||||||
}
|
}
|
||||||
if (renderPass == 1) {
|
if (renderPass == 1) {
|
||||||
return type.getPetalIcon(this.getStage(), flower.hasFlowered(), type.getSections() - 1);
|
return type.getPetalIcon(getStage(), flower.hasFlowered(), type.getSections() - 1);
|
||||||
}
|
}
|
||||||
return type.getVariantIcon(this.getStage(), flower.hasFlowered(), type.getSections() - 1);
|
return type.getVariantIcon(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 boolean onItemUse(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int side, float px, float py, float pz) {
|
||||||
if (this.getStage() == EnumFlowerStage.POLLEN) {
|
if (getStage() == EnumFlowerStage.POLLEN) {
|
||||||
final IFlower flower = Binnie.Genetics.getFlowerRoot().getMember(itemstack);
|
IFlower flower = Binnie.Genetics.getFlowerRoot().getMember(itemstack);
|
||||||
final TileEntity target = world.getTileEntity(x, y, z);
|
TileEntity target = world.getTileEntity(x, y, z);
|
||||||
if (!(target instanceof IPollinatable)) {
|
if (!(target instanceof IPollinatable)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final IPollinatable pollinatable = (IPollinatable) target;
|
IPollinatable pollinatable = (IPollinatable) target;
|
||||||
if (!pollinatable.canMateWith(flower)) {
|
if (!pollinatable.canMateWith(flower)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
pollinatable.mateWith(flower);
|
pollinatable.mateWith(flower);
|
||||||
if (!player.capabilities.isCreativeMode) {
|
if (!player.capabilities.isCreativeMode) {
|
||||||
--itemstack.stackSize;
|
itemstack.stackSize--;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
final Block blockFlower = Botany.flower;
|
Block blockFlower = Botany.flower;
|
||||||
final Block blockAlreadyThere = world.getBlock(x, y, z);
|
Block blockAlreadyThere = world.getBlock(x, y, z);
|
||||||
if (blockAlreadyThere == Blocks.snow_layer && (world.getBlockMetadata(x, y, z) & 0x7) < 1) {
|
if (blockAlreadyThere == Blocks.snow_layer && (world.getBlockMetadata(x, y, z) & 0x7) < 1) {
|
||||||
side = 1;
|
side = 1;
|
||||||
}
|
} else if (blockAlreadyThere != Blocks.vine && blockAlreadyThere != Blocks.tallgrass && blockAlreadyThere != Blocks.deadbush && !blockAlreadyThere.isReplaceable(world, x, y, z)) {
|
||||||
else if (blockAlreadyThere != Blocks.vine && blockAlreadyThere != Blocks.tallgrass && blockAlreadyThere != Blocks.deadbush && !blockAlreadyThere.isReplaceable(world, x, y, z)) {
|
if (side == 0) {
|
||||||
if (side == 0) {
|
y--;
|
||||||
--y;
|
} else if (side == 1) {
|
||||||
}
|
y++;
|
||||||
if (side == 1) {
|
} else if (side == 2) {
|
||||||
++y;
|
z--;
|
||||||
}
|
} else if (side == 3) {
|
||||||
if (side == 2) {
|
z++;
|
||||||
--z;
|
} else if (side == 4) {
|
||||||
}
|
x--;
|
||||||
if (side == 3) {
|
} else if (side == 5) {
|
||||||
++z;
|
x++;
|
||||||
}
|
|
||||||
if (side == 4) {
|
|
||||||
--x;
|
|
||||||
}
|
|
||||||
if (side == 5) {
|
|
||||||
++x;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (itemstack.stackSize == 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!player.canPlayerEdit(x, y, z, side, itemstack)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (y == 255 && blockFlower.getMaterial().isSolid()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (world.canPlaceEntityOnSide(blockFlower, x, y, z, false, side, player, itemstack)) {
|
|
||||||
final int i1 = this.getMetadata(itemstack.getItemDamage());
|
|
||||||
final int j1 = blockFlower.onBlockPlaced(world, x, y, z, side, px, py, pz, i1);
|
|
||||||
if (this.placeBlockAt(itemstack, player, world, x, y, z, side, px, py, pz, j1)) {
|
|
||||||
world.playSoundEffect(x + 0.5f, y + 0.5f, z + 0.5f, blockFlower.stepSound.func_150496_b(), (blockFlower.stepSound.getVolume() + 1.0f) / 2.0f, blockFlower.stepSound.getPitch() * 0.8f);
|
|
||||||
--itemstack.stackSize;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (itemstack.stackSize == 0 || !player.canPlayerEdit(x, y, z, side, itemstack)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (y == 255 && blockFlower.getMaterial().isSolid()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (world.canPlaceEntityOnSide(blockFlower, x, y, z, false, side, player, itemstack)) {
|
||||||
|
int i1 = getMetadata(itemstack.getItemDamage());
|
||||||
|
int j1 = blockFlower.onBlockPlaced(world, x, y, z, side, px, py, pz, i1);
|
||||||
|
if (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)
|
@SideOnly(Side.CLIENT)
|
||||||
public boolean func_150936_a(final World p_150936_1_, int p_150936_2_, int p_150936_3_, int p_150936_4_, int p_150936_5_, final EntityPlayer p_150936_6_, final ItemStack p_150936_7_) {
|
public boolean func_150936_a(World world, int x, int y, int z, int side, EntityPlayer player, ItemStack stack) {
|
||||||
final Block field_150939_a = Botany.flower;
|
Block field_150939_a = Botany.flower;
|
||||||
final Block block = p_150936_1_.getBlock(p_150936_2_, p_150936_3_, p_150936_4_);
|
Block block = world.getBlock(x, y, z);
|
||||||
if (block == Blocks.snow_layer) {
|
if (block == Blocks.snow_layer) {
|
||||||
p_150936_5_ = 1;
|
side = 1;
|
||||||
}
|
} else if (block != Blocks.vine && block != Blocks.tallgrass && block != Blocks.deadbush && !block.isReplaceable(world, x, y, z)) {
|
||||||
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 (side == 0) {
|
||||||
if (p_150936_5_ == 0) {
|
y--;
|
||||||
--p_150936_3_;
|
} else if (side == 1) {
|
||||||
}
|
y++;
|
||||||
if (p_150936_5_ == 1) {
|
} else if (side == 2) {
|
||||||
++p_150936_3_;
|
z--;
|
||||||
}
|
} else if (side == 3) {
|
||||||
if (p_150936_5_ == 2) {
|
z++;
|
||||||
--p_150936_4_;
|
} else if (side == 4) {
|
||||||
}
|
x--;
|
||||||
if (p_150936_5_ == 3) {
|
} else if (side == 5) {
|
||||||
++p_150936_4_;
|
x++;
|
||||||
}
|
|
||||||
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_);
|
return world.canPlaceEntityOnSide(field_150939_a, x, y, z, false, side, null, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) {
|
||||||
final Block field_150939_a = Botany.flower;
|
Block block = Botany.flower;
|
||||||
if (!world.setBlock(x, y, z, field_150939_a, metadata, 3)) {
|
if (!world.setBlock(x, y, z, block, 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);
|
if (world.getBlock(x, y, z) == block) {
|
||||||
field_150939_a.onPostBlockPlaced(world, x, y, z, metadata);
|
block.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||||
|
block.onPostBlockPlaced(world, x, y, z, metadata);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,8 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.flower;
|
package binnie.botany.flower;
|
||||||
|
|
||||||
import binnie.botany.api.EnumFlowerStage;
|
import binnie.botany.api.EnumFlowerStage;
|
||||||
|
|
||||||
public class ItemFlower extends ItemBotany
|
public class ItemFlower extends ItemBotany {
|
||||||
{
|
|
||||||
public ItemFlower() {
|
public ItemFlower() {
|
||||||
super("itemFlower");
|
super("itemFlower");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,71 +1,84 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.flower;
|
package binnie.botany.flower;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import binnie.botany.CreativeTabBotany;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import binnie.botany.Botany;
|
import binnie.botany.Botany;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import binnie.botany.CreativeTabBotany;
|
||||||
|
import binnie.core.util.I18N;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import java.util.List;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
|
||||||
public class ItemInsulatedTube extends Item
|
import java.util.List;
|
||||||
{
|
|
||||||
|
public class ItemInsulatedTube extends Item {
|
||||||
IIcon[] icons;
|
IIcon[] icons;
|
||||||
|
|
||||||
|
public ItemInsulatedTube() {
|
||||||
|
icons = new IIcon[3];
|
||||||
|
setUnlocalizedName("insulatedTube");
|
||||||
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
|
setHasSubtypes(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemStack getInsulateStack(ItemStack stack) {
|
||||||
|
return Insulate.get(stack.getItemDamage()).getStack();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubItems(final Item p_150895_1_, final CreativeTabs p_150895_2_, final List p_150895_3_) {
|
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||||
for (final Material mat : Material.values()) {
|
for (Material mat : Material.values()) {
|
||||||
for (final Insulate ins : Insulate.values()) {
|
for (Insulate ins : Insulate.values()) {
|
||||||
p_150895_3_.add(new ItemStack(this, 1, mat.ordinal() + ins.ordinal() * 128));
|
list.add(new ItemStack(this, 1, mat.ordinal() + ins.ordinal() * 128));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerIcons(final IIconRegister p_94581_1_) {
|
public void registerIcons(IIconRegister register) {
|
||||||
for (int i = 0; i < 3; ++i) {
|
for (int i = 0; i < 3; ++i) {
|
||||||
this.icons[i] = Botany.proxy.getIcon(p_94581_1_, "insulatedTube." + i);
|
icons[i] = Botany.proxy.getIcon(register, "insulatedTube." + i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int getColorFromItemStack(final ItemStack stack, final int pass) {
|
public int getColorFromItemStack(ItemStack stack, int pass) {
|
||||||
return (pass == 0) ? 16777215 : ((pass == 1) ? Material.get(stack.getItemDamage()).getColor() : Insulate.get(stack.getItemDamage()).getColor());
|
if (pass == 0) {
|
||||||
|
return 0xffffff;
|
||||||
|
}
|
||||||
|
return (pass == 1)
|
||||||
|
? Material.get(stack.getItemDamage()).getColor()
|
||||||
|
: Insulate.get(stack.getItemDamage()).getColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@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_) {
|
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||||
super.addInformation(p_77624_1_, p_77624_2_, p_77624_3_, p_77624_4_);
|
super.addInformation(stack, player, tooltip, advanced);
|
||||||
p_77624_3_.add(Insulate.get(p_77624_1_.getItemDamage()).getName());
|
tooltip.add(Insulate.get(stack.getItemDamage()).getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getItemStackDisplayName(final ItemStack p_77653_1_) {
|
public String getItemStackDisplayName(ItemStack stack) {
|
||||||
return Material.get(p_77653_1_.getItemDamage()).getName() + " Insulated Tube";
|
return Material.get(stack.getItemDamage()).getName() + " "
|
||||||
|
+ I18N.localise("botany.tube.name");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderPasses(final int metadata) {
|
public int getRenderPasses(int metadata) {
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getIcon(final ItemStack stack, final int pass) {
|
public IIcon getIcon(ItemStack stack, int pass) {
|
||||||
return this.icons[pass % 3];
|
return icons[pass % 3];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -73,101 +86,82 @@ public class ItemInsulatedTube extends Item
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemInsulatedTube() {
|
enum Material {
|
||||||
this.icons = new IIcon[3];
|
Copper(0xe3b78e, "cooper"),
|
||||||
this.setUnlocalizedName("insulatedTube");
|
Tin(0xe1eef4, "tin"),
|
||||||
this.setCreativeTab(CreativeTabBotany.instance);
|
Bronze(0xddc276, "bronze"),
|
||||||
}
|
Iron(0xd8d8d8, "iron");
|
||||||
|
|
||||||
public static String getInsulate(final ItemStack stack) {
|
protected int color;
|
||||||
return Insulate.get(stack.getItemDamage()).getName();
|
protected String name;
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemStack getInsulateStack(final ItemStack stack) {
|
Material(int color, String name) {
|
||||||
return Insulate.get(stack.getItemDamage()).getStack();
|
|
||||||
}
|
|
||||||
|
|
||||||
enum Material
|
|
||||||
{
|
|
||||||
Copper(14923662, "Copper"),
|
|
||||||
Tin(14806772, "Tin"),
|
|
||||||
Bronze(14533238, "Bronze"),
|
|
||||||
Iron(14211288, "Iron");
|
|
||||||
|
|
||||||
int color;
|
|
||||||
String name;
|
|
||||||
|
|
||||||
public int getColor() {
|
|
||||||
return this.color;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Material(final int color, final String name) {
|
|
||||||
this.color = color;
|
this.color = color;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Material get(final int i) {
|
public static Material get(int i) {
|
||||||
return values()[i % values().length];
|
return values()[i % values().length];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
enum Insulate
|
|
||||||
{
|
|
||||||
Clay(10595020, "Clay"),
|
|
||||||
Cobble(8092539, "Cobblestone"),
|
|
||||||
Sand(15723189, "Sand"),
|
|
||||||
HardenedClay(9657411, "Hardened Clay"),
|
|
||||||
Stone(7171437, "Smooth Stone"),
|
|
||||||
Sandstone(12695945, "Sandstone");
|
|
||||||
|
|
||||||
int color;
|
|
||||||
String name;
|
|
||||||
|
|
||||||
public int getColor() {
|
public int getColor() {
|
||||||
return this.color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.name;
|
return I18N.localise("botany.tube." + name);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Insulate(final int color, final String name) {
|
enum Insulate {
|
||||||
|
Clay(0xa1aacc, "clay"),
|
||||||
|
Cobble(0x7b7b7b, "cobblestone"),
|
||||||
|
Sand(0xefeab5, "sand"),
|
||||||
|
HardenedClay(0x935c43, "hardenedClay"),
|
||||||
|
Stone(0x6d6d6d, "smoothStone"),
|
||||||
|
Sandstone(0xc1b989, "sandstone");
|
||||||
|
|
||||||
|
protected int color;
|
||||||
|
protected String name;
|
||||||
|
|
||||||
|
Insulate(int color, String name) {
|
||||||
this.color = color;
|
this.color = color;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Insulate get(final int i) {
|
public static Insulate get(int i) {
|
||||||
return values()[i / 128 % values().length];
|
return values()[i / 128 % values().length];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getColor() {
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return I18N.localise("botany.tube.insulate." + name);
|
||||||
|
}
|
||||||
|
|
||||||
public ItemStack getStack() {
|
public ItemStack getStack() {
|
||||||
switch (this) {
|
switch (this) {
|
||||||
case Clay: {
|
case Clay:
|
||||||
return new ItemStack(Blocks.clay);
|
return new ItemStack(Blocks.clay);
|
||||||
}
|
|
||||||
case Cobble: {
|
case Cobble:
|
||||||
return new ItemStack(Blocks.cobblestone);
|
return new ItemStack(Blocks.cobblestone);
|
||||||
}
|
|
||||||
case HardenedClay: {
|
case HardenedClay:
|
||||||
return new ItemStack(Blocks.hardened_clay);
|
return new ItemStack(Blocks.hardened_clay);
|
||||||
}
|
|
||||||
case Sand: {
|
case Sand:
|
||||||
return new ItemStack(Blocks.sand);
|
return new ItemStack(Blocks.sand);
|
||||||
}
|
|
||||||
case Sandstone: {
|
case Sandstone:
|
||||||
return new ItemStack(Blocks.sandstone);
|
return new ItemStack(Blocks.sandstone);
|
||||||
}
|
|
||||||
case Stone: {
|
case Stone:
|
||||||
return new ItemStack(Blocks.stone);
|
return new ItemStack(Blocks.stone);
|
||||||
}
|
|
||||||
default: {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,9 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.flower;
|
package binnie.botany.flower;
|
||||||
|
|
||||||
import binnie.botany.api.EnumFlowerStage;
|
import binnie.botany.api.EnumFlowerStage;
|
||||||
|
import binnie.core.util.I18N;
|
||||||
|
|
||||||
public class ItemPollen extends ItemBotany
|
public class ItemPollen extends ItemBotany {
|
||||||
{
|
|
||||||
public ItemPollen() {
|
public ItemPollen() {
|
||||||
super("pollen");
|
super("pollen");
|
||||||
}
|
}
|
||||||
@@ -19,6 +15,6 @@ public class ItemPollen extends ItemBotany
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTag() {
|
public String getTag() {
|
||||||
return " Pollen";
|
return I18N.localise("botany.item.pollen.tag.name");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,9 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.flower;
|
package binnie.botany.flower;
|
||||||
|
|
||||||
import binnie.botany.api.EnumFlowerStage;
|
import binnie.botany.api.EnumFlowerStage;
|
||||||
|
import binnie.core.util.I18N;
|
||||||
|
|
||||||
public class ItemSeed extends ItemBotany
|
public class ItemSeed extends ItemBotany {
|
||||||
{
|
|
||||||
public ItemSeed() {
|
public ItemSeed() {
|
||||||
super("seed");
|
super("seed");
|
||||||
}
|
}
|
||||||
@@ -19,6 +15,6 @@ public class ItemSeed extends ItemBotany
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTag() {
|
public String getTag() {
|
||||||
return " Germling";
|
return I18N.localise("botany.item.germling.tag.name");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,61 +1,55 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.flower;
|
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;
|
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.renderer.EntityRenderer;
|
||||||
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
|
||||||
public class RendererBotany implements ISimpleBlockRenderingHandler
|
public class RendererBotany implements ISimpleBlockRenderingHandler {
|
||||||
{
|
|
||||||
public static int renderID;
|
public static int renderID;
|
||||||
public static int pass;
|
public static int pass;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderInventoryBlock(final Block block, final int metadata, final int modelID, final RenderBlocks renderer) {
|
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||||
|
// ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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) {
|
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
|
||||||
final Tessellator tessellator = Tessellator.instance;
|
Tessellator tessellator = Tessellator.instance;
|
||||||
tessellator.setBrightness(block.getMixedBrightnessForBlock(renderer.blockAccess, x, y, z));
|
tessellator.setBrightness(block.getMixedBrightnessForBlock(renderer.blockAccess, x, y, z));
|
||||||
double d1 = x;
|
double d1 = x;
|
||||||
final double d2 = y;
|
double d2 = y;
|
||||||
double d3 = z;
|
double d3 = z;
|
||||||
long i1 = x * 3129871 ^ z * 116129781L;
|
long i1 = x * 3129871 ^ z * 116129781L;
|
||||||
i1 = i1 * i1 * 42317861L + i1 * 11L;
|
i1 = i1 * i1 * 42317861L + i1 * 11L;
|
||||||
d1 += ((i1 >> 16 & 0xFL) / 15.0f - 0.5) * 0.3;
|
d1 += ((i1 >> 16 & 0xFL) / 15.0f - 0.5) * 0.3;
|
||||||
d3 += ((i1 >> 24 & 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) {
|
for (int j = 0; j < 3; ++j) {
|
||||||
RendererBotany.pass = j;
|
RendererBotany.pass = j;
|
||||||
final int l = block.colorMultiplier(renderer.blockAccess, x, y, z);
|
int l = block.colorMultiplier(renderer.blockAccess, x, y, z);
|
||||||
float f = (l >> 16 & 0xFF) / 255.0f;
|
float f = (l >> 16 & 0xFF) / 255.0f;
|
||||||
float f2 = (l >> 8 & 0xFF) / 255.0f;
|
float f2 = (l >> 8 & 0xFF) / 255.0f;
|
||||||
float f3 = (l & 0xFF) / 255.0f;
|
float f3 = (l & 0xFF) / 255.0f;
|
||||||
|
|
||||||
if (EntityRenderer.anaglyphEnable) {
|
if (EntityRenderer.anaglyphEnable) {
|
||||||
final float f4 = (f * 30.0f + f2 * 59.0f + f3 * 11.0f) / 100.0f;
|
f = (f * 30.0f + f2 * 59.0f + f3 * 11.0f) / 100.0f;
|
||||||
final float f5 = (f * 30.0f + f2 * 70.0f) / 100.0f;
|
f2 = (f * 30.0f + f2 * 70.0f) / 100.0f;
|
||||||
final float f6 = (f * 30.0f + f3 * 70.0f) / 100.0f;
|
f3 = (f * 30.0f + f3 * 70.0f) / 100.0f;
|
||||||
f = f4;
|
|
||||||
f2 = f5;
|
|
||||||
f3 = f6;
|
|
||||||
}
|
}
|
||||||
tessellator.setColorOpaque_F(f, f2, f3);
|
tessellator.setColorOpaque_F(f, f2, f3);
|
||||||
final IIcon iicon = block.getIcon(world, x, y, z, 0);
|
IIcon iicon = block.getIcon(world, x, y, z, 0);
|
||||||
renderer.drawCrossedSquares(iicon, d1, d2, d3, 1.0f);
|
renderer.drawCrossedSquares(iicon, d1, d2, d3, 1.0f);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldRender3DInInventory(final int i) {
|
public boolean shouldRender3DInInventory(int i) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
@@ -1,156 +1,157 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.gardening;
|
package binnie.botany.gardening;
|
||||||
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
import binnie.botany.Botany;
|
||||||
|
import binnie.botany.CreativeTabBotany;
|
||||||
import binnie.botany.api.EnumSoilType;
|
import binnie.botany.api.EnumSoilType;
|
||||||
import binnie.botany.api.gardening.IBlockSoil;
|
import binnie.botany.api.gardening.IBlockSoil;
|
||||||
import java.util.Random;
|
import binnie.core.util.I18N;
|
||||||
import java.util.List;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import binnie.botany.CreativeTabBotany;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import binnie.botany.Botany;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraft.block.BlockBush;
|
import net.minecraft.block.BlockBush;
|
||||||
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
public class BlockPlant extends BlockBush {
|
||||||
|
public BlockPlant() {
|
||||||
|
setBlockName("plant");
|
||||||
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
|
setTickRandomly(true);
|
||||||
|
setStepSound(Block.soundTypeGrass);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isWeed(IBlockAccess world, int x, int y, int z) {
|
||||||
|
if (!(world.getBlock(x, y, z) instanceof BlockPlant)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Type type = Type.get(world.getBlockMetadata(x, y, z));
|
||||||
|
return type == Type.Weeds
|
||||||
|
|| type == Type.WeedsLong
|
||||||
|
|| type == Type.WeedsVeryLong;
|
||||||
|
}
|
||||||
|
|
||||||
public class BlockPlant extends BlockBush
|
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int metadata, final int fortune) {
|
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||||
return new ArrayList<ItemStack>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(final IIconRegister p_149651_1_) {
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
for (final Type t : Type.values()) {
|
for (Type t : Type.values()) {
|
||||||
t.icon = Botany.proxy.getIcon(p_149651_1_, t.name().toLowerCase());
|
t.icon = Botany.proxy.getIcon(register, t.name().toLowerCase());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockPlant() {
|
|
||||||
this.setBlockName("plant");
|
|
||||||
this.setCreativeTab(CreativeTabBotany.instance);
|
|
||||||
this.setTickRandomly(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean canPlaceBlockOn(final Block p_149854_1_) {
|
protected boolean canPlaceBlockOn(Block block) {
|
||||||
return super.canPlaceBlockOn(p_149854_1_) || Gardening.isSoil(p_149854_1_);
|
return super.canPlaceBlockOn(block) || Gardening.isSoil(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(final int side, final int meta) {
|
public IIcon getIcon(int side, int meta) {
|
||||||
return Type.values()[meta % Type.values().length].icon;
|
return Type.values()[meta % Type.values().length].icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(final int p_149692_1_) {
|
public int damageDropped(int damage) {
|
||||||
return p_149692_1_;
|
return damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubBlocks(final Item p_149666_1_, final CreativeTabs p_149666_2_, final List p_149666_3_) {
|
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||||
for (final Type type : Type.values()) {
|
for (Type type : Type.values()) {
|
||||||
p_149666_3_.add(type.get());
|
list.add(type.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateTick(final World world, final int x, final int y, final int z, final Random random) {
|
public void updateTick(World world, int x, int y, int z, Random random) {
|
||||||
final Type type = Type.get(world.getBlockMetadata(x, y, z));
|
Type type = Type.get(world.getBlockMetadata(x, y, z));
|
||||||
if (random.nextInt(4) == 0) {
|
if (random.nextInt(4) == 0) {
|
||||||
if (type == Type.Weeds) {
|
if (type == Type.Weeds) {
|
||||||
world.setBlockMetadataWithNotify(x, y, z, Type.WeedsLong.ordinal(), 2);
|
world.setBlockMetadataWithNotify(x, y, z, Type.WeedsLong.ordinal(), 2);
|
||||||
}
|
} else if (type == Type.WeedsLong) {
|
||||||
else if (type == Type.WeedsLong) {
|
|
||||||
world.setBlockMetadataWithNotify(x, y, z, Type.WeedsVeryLong.ordinal(), 2);
|
world.setBlockMetadataWithNotify(x, y, z, Type.WeedsVeryLong.ordinal(), 2);
|
||||||
}
|
} else if (type == Type.DeadFlower) {
|
||||||
else if (type == Type.DeadFlower) {
|
|
||||||
world.setBlockMetadataWithNotify(x, y, z, Type.DecayingFlower.ordinal(), 2);
|
world.setBlockMetadataWithNotify(x, y, z, Type.DecayingFlower.ordinal(), 2);
|
||||||
}
|
} else if (type == Type.DecayingFlower) {
|
||||||
else if (type == Type.DecayingFlower) {
|
|
||||||
world.setBlockToAir(x, y, z);
|
world.setBlockToAir(x, y, z);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (random.nextInt(6) == 0) {
|
if (random.nextInt(6) == 0) {
|
||||||
if (type == Type.Weeds) {
|
if (type == Type.Weeds) {
|
||||||
world.setBlockToAir(x, y, z);
|
world.setBlockToAir(x, y, z);
|
||||||
}
|
} else if (type == Type.WeedsLong) {
|
||||||
else if (type == Type.WeedsLong) {
|
|
||||||
world.setBlockMetadataWithNotify(x, y, z, Type.Weeds.ordinal(), 2);
|
world.setBlockMetadataWithNotify(x, y, z, Type.Weeds.ordinal(), 2);
|
||||||
}
|
} else if (type == Type.WeedsVeryLong) {
|
||||||
else if (type == Type.WeedsVeryLong) {
|
|
||||||
world.setBlockMetadataWithNotify(x, y, z, Type.WeedsLong.ordinal(), 2);
|
world.setBlockMetadataWithNotify(x, y, z, Type.WeedsLong.ordinal(), 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final Block below = world.getBlock(x, y - 1, z);
|
|
||||||
if (Gardening.isSoil(below)) {
|
Block below = world.getBlock(x, y - 1, z);
|
||||||
final IBlockSoil soil = (IBlockSoil) below;
|
if (!Gardening.isSoil(below)) {
|
||||||
if (random.nextInt(3) == 0) {
|
return;
|
||||||
if (type == Type.Weeds || type == Type.WeedsLong || type == Type.WeedsVeryLong) {
|
}
|
||||||
if (!soil.degrade(world, x, y - 1, z, EnumSoilType.LOAM)) {
|
|
||||||
soil.degrade(world, x, y - 1, z, EnumSoilType.SOIL);
|
IBlockSoil soil = (IBlockSoil) below;
|
||||||
}
|
if (random.nextInt(3) != 0) {
|
||||||
}
|
return;
|
||||||
else if (type == Type.DecayingFlower && !soil.fertilise(world, x, y - 1, z, EnumSoilType.LOAM)) {
|
}
|
||||||
soil.fertilise(world, x, y - 1, z, EnumSoilType.FLOWERBED);
|
|
||||||
}
|
if (type == Type.Weeds || type == Type.WeedsLong || type == Type.WeedsVeryLong) {
|
||||||
|
if (!soil.degrade(world, x, y - 1, z, EnumSoilType.LOAM)) {
|
||||||
|
soil.degrade(world, x, y - 1, z, EnumSoilType.SOIL);
|
||||||
}
|
}
|
||||||
|
} else if (type == Type.DecayingFlower && !soil.fertilise(world, x, y - 1, z, EnumSoilType.LOAM)) {
|
||||||
|
soil.fertilise(world, x, y - 1, z, EnumSoilType.FLOWERBED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isReplaceable(final IBlockAccess world, final int x, final int y, final int z) {
|
public boolean isReplaceable(IBlockAccess world, int x, int y, int z) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isWeed(final IBlockAccess world, final int x, final int y, final int z) {
|
public enum Type {
|
||||||
if (!(world.getBlock(x, y, z) instanceof BlockPlant)) {
|
Weeds("weeds"),
|
||||||
return false;
|
WeedsLong("longWeeds"),
|
||||||
}
|
WeedsVeryLong("veryLongWeeds"),
|
||||||
final Type type = Type.get(world.getBlockMetadata(x, y, z));
|
DeadFlower("deadFlower"),
|
||||||
return type == Type.Weeds || type == Type.WeedsLong || type == Type.WeedsVeryLong;
|
DecayingFlower("decayingFlower");
|
||||||
}
|
|
||||||
|
|
||||||
public enum Type
|
|
||||||
{
|
|
||||||
Weeds("Weeds"),
|
|
||||||
WeedsLong("Long Weeds"),
|
|
||||||
WeedsVeryLong("Very Long Weeds"),
|
|
||||||
DeadFlower("Dead Flower"),
|
|
||||||
DecayingFlower("Decaying Flower");
|
|
||||||
|
|
||||||
public IIcon icon;
|
public IIcon icon;
|
||||||
String name;
|
|
||||||
|
|
||||||
private Type(final String name) {
|
protected String name;
|
||||||
|
|
||||||
|
Type(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack get() {
|
public static Type get(int id) {
|
||||||
return new ItemStack(Botany.plant, 1, this.ordinal());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Type get(final int id) {
|
|
||||||
return values()[id % values().length];
|
return values()[id % values().length];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ItemStack get() {
|
||||||
|
return new ItemStack(Botany.plant, 1, ordinal());
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.name;
|
return I18N.localise("botany.plant." + name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,127 +1,129 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.gardening;
|
package binnie.botany.gardening;
|
||||||
|
|
||||||
import net.minecraftforge.common.IPlantable;
|
|
||||||
import binnie.Binnie;
|
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
|
||||||
import java.util.Random;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import binnie.botany.CreativeTabBotany;
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import binnie.botany.Botany;
|
import binnie.botany.Botany;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import binnie.botany.CreativeTabBotany;
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
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 binnie.botany.api.EnumSoilType;
|
||||||
|
import binnie.botany.api.gardening.IBlockSoil;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import java.util.List;
|
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import binnie.botany.api.EnumSoilType;
|
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
import binnie.botany.api.gardening.IBlockSoil;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.IPlantable;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class BlockSoil extends Block implements IBlockSoil
|
import java.util.List;
|
||||||
{
|
import java.util.Random;
|
||||||
boolean weedKilled;
|
|
||||||
IIcon[] iconsTop;
|
public class BlockSoil extends Block implements IBlockSoil {
|
||||||
IIcon[] iconsSide;
|
protected boolean weedKilled;
|
||||||
IIcon[] iconsNoWeed;
|
protected IIcon[] iconsTop;
|
||||||
EnumSoilType type;
|
protected IIcon[] iconsSide;
|
||||||
|
protected IIcon[] iconsNoWeed;
|
||||||
|
protected EnumSoilType type;
|
||||||
|
|
||||||
|
public BlockSoil(EnumSoilType type, String blockName, boolean weedKilled) {
|
||||||
|
super(Material.ground);
|
||||||
|
this.type = type;
|
||||||
|
this.weedKilled = weedKilled;
|
||||||
|
iconsTop = new IIcon[9];
|
||||||
|
iconsSide = new IIcon[9];
|
||||||
|
iconsNoWeed = new IIcon[9];
|
||||||
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
|
setBlockName(blockName);
|
||||||
|
setTickRandomly(true);
|
||||||
|
setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 0.9375f, 1.0f);
|
||||||
|
setLightOpacity(255);
|
||||||
|
setHardness(0.5f);
|
||||||
|
setStepSound(Block.soundTypeGravel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getMeta(EnumAcidity acid, EnumMoisture moisture) {
|
||||||
|
return acid.ordinal() * 3 + moisture.ordinal();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubBlocks(final Item par1, final CreativeTabs par2CreativeTabs, final List par3List) {
|
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||||
for (int i = 0; i < 9; ++i) {
|
for (int i = 0; i < 9; ++i) {
|
||||||
par3List.add(new ItemStack(this, 1, i));
|
list.add(new ItemStack(this, 1, i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@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 IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||||
return this.getIcon(side, world.getBlockMetadata(x, y, z));
|
return getIcon(side, world.getBlockMetadata(x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(final int side, int meta) {
|
public IIcon getIcon(int side, int meta) {
|
||||||
meta = ((meta >= 9) ? 8 : meta);
|
meta = ((meta >= 9) ? 8 : meta);
|
||||||
final EnumMoisture moisture = EnumMoisture.values()[meta % 3];
|
if (side == 1) {
|
||||||
final EnumAcidity acidity = EnumAcidity.values()[meta / 3];
|
return weedKilled ? iconsNoWeed[meta] : iconsTop[meta];
|
||||||
return (side == 1) ? (this.weedKilled ? this.iconsNoWeed[meta] : this.iconsTop[meta]) : ((side == 0) ? Blocks.dirt.getIcon(side, 0) : this.iconsSide[meta]);
|
}
|
||||||
|
return (side == 0) ? Blocks.dirt.getIcon(side, 0) : iconsSide[meta];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(final IIconRegister register) {
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
for (final EnumMoisture moisture : EnumMoisture.values()) {
|
for (EnumMoisture moisture : EnumMoisture.values()) {
|
||||||
for (final EnumAcidity pH : EnumAcidity.values()) {
|
for (EnumAcidity pH : EnumAcidity.values()) {
|
||||||
this.iconsTop[moisture.ordinal() + pH.ordinal() * 3] = Botany.proxy.getIcon(register, "soil/" + this.getType().getID() + "." + pH.getID() + "." + moisture.getID() + ".0");
|
int index = moisture.ordinal() + pH.ordinal() * 3;
|
||||||
this.iconsSide[moisture.ordinal() + pH.ordinal() * 3] = Botany.proxy.getIcon(register, "soil/" + this.getType().getID() + "." + pH.getID() + "." + moisture.getID() + ".1");
|
String id = "soil/" + getType().getID() + "." + pH.getID() + "." + moisture.getID();
|
||||||
this.iconsNoWeed[moisture.ordinal() + pH.ordinal() * 3] = Botany.proxy.getIcon(register, "soil/" + this.getType().getID() + "." + pH.getID() + "." + moisture.getID() + ".2");
|
iconsTop[index] = Botany.proxy.getIcon(register, id + ".0");
|
||||||
|
iconsSide[index] = Botany.proxy.getIcon(register, id + ".1");
|
||||||
|
iconsNoWeed[index] = Botany.proxy.getIcon(register, id + ".2");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public EnumSoilType getType() {
|
public EnumSoilType getType() {
|
||||||
return this.type;
|
return type;
|
||||||
}
|
|
||||||
|
|
||||||
public BlockSoil(final EnumSoilType type, final String blockName, final boolean weedKilled) {
|
|
||||||
super(Material.ground);
|
|
||||||
this.weedKilled = false;
|
|
||||||
this.iconsTop = new IIcon[9];
|
|
||||||
this.iconsSide = new IIcon[9];
|
|
||||||
this.iconsNoWeed = new IIcon[9];
|
|
||||||
this.weedKilled = weedKilled;
|
|
||||||
this.setCreativeTab(CreativeTabBotany.instance);
|
|
||||||
this.setBlockName(blockName);
|
|
||||||
this.setTickRandomly(true);
|
|
||||||
this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 0.9375f, 1.0f);
|
|
||||||
this.setLightOpacity(255);
|
|
||||||
this.setHardness(0.5f);
|
|
||||||
this.setStepSound(Block.soundTypeGravel);
|
|
||||||
this.type = type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(final int p_149692_1_) {
|
public int damageDropped(int damage) {
|
||||||
return p_149692_1_;
|
return damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateTick(final World world, final int x, final int y, final int z, final Random random) {
|
public void updateTick(World world, int x, int y, int z, Random random) {
|
||||||
final int meta = world.getBlockMetadata(x, y, z);
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
EnumMoisture moisture = EnumMoisture.values()[meta % 3];
|
EnumMoisture moisture = EnumMoisture.values()[meta % 3];
|
||||||
final EnumAcidity acidity = EnumAcidity.values()[meta / 3];
|
EnumAcidity acidity = EnumAcidity.values()[meta / 3];
|
||||||
final EnumMoisture desiredMoisture = Gardening.getNaturalMoisture(world, x, y, z);
|
EnumMoisture desiredMoisture = Gardening.getNaturalMoisture(world, x, y, z);
|
||||||
if (desiredMoisture.ordinal() > moisture.ordinal()) {
|
if (desiredMoisture.ordinal() > moisture.ordinal()) {
|
||||||
moisture = ((moisture == EnumMoisture.Dry) ? EnumMoisture.Normal : EnumMoisture.Damp);
|
moisture = ((moisture == EnumMoisture.DRY) ? EnumMoisture.NORMAL : EnumMoisture.DAMP);
|
||||||
}
|
}
|
||||||
if (desiredMoisture.ordinal() < moisture.ordinal()) {
|
if (desiredMoisture.ordinal() < moisture.ordinal()) {
|
||||||
moisture = ((moisture == EnumMoisture.Damp) ? EnumMoisture.Normal : EnumMoisture.Dry);
|
moisture = ((moisture == EnumMoisture.DAMP) ? EnumMoisture.NORMAL : EnumMoisture.DRY);
|
||||||
}
|
}
|
||||||
final int meta2 = getMeta(acidity, moisture);
|
|
||||||
|
int meta2 = getMeta(acidity, moisture);
|
||||||
if (meta != meta2) {
|
if (meta != meta2) {
|
||||||
world.setBlockMetadataWithNotify(x, y, z, meta2, 2);
|
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) {
|
if (!weedKilled && random.nextInt(5 - 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);
|
world.setBlock(x, y + 1, z, Botany.plant, BlockPlant.Type.Weeds.ordinal(), 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(final World p_149668_1_, final int p_149668_2_, final int p_149668_3_, final int p_149668_4_) {
|
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||||
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);
|
return AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -135,86 +137,78 @@ public class BlockSoil extends Block implements IBlockSoil
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumAcidity getPH(final World world, final int x, final int y, final int z) {
|
public EnumAcidity getPH(World world, int x, int y, int z) {
|
||||||
return EnumAcidity.values()[world.getBlockMetadata(x, y, z) / 3];
|
return EnumAcidity.values()[world.getBlockMetadata(x, y, z) / 3];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumMoisture getMoisture(final World world, final int x, final int y, final int z) {
|
public EnumMoisture getMoisture(World world, int x, int y, int z) {
|
||||||
return EnumMoisture.values()[world.getBlockMetadata(x, y, z) % 3];
|
return EnumMoisture.values()[world.getBlockMetadata(x, y, z) % 3];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumSoilType getType(final World world, final int x, final int y, final int z) {
|
public EnumSoilType getType(World world, int x, int y, int z) {
|
||||||
return this.type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean fertilise(final World world, final int x, final int y, final int z, final EnumSoilType maxLevel) {
|
public boolean fertilise(World world, int x, int y, int z, EnumSoilType maxLevel) {
|
||||||
final EnumSoilType type = this.getType(world, x, y, z);
|
EnumSoilType type = getType(world, x, y, z);
|
||||||
if (type.ordinal() >= maxLevel.ordinal()) {
|
if (type.ordinal() >= maxLevel.ordinal()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final int meta = world.getBlockMetadata(x, y, z);
|
|
||||||
return world.setBlock(x, y, z, Gardening.getSoilBlock(maxLevel, this.weedKilled), meta, 2);
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
|
return world.setBlock(x, y, z, Gardening.getSoilBlock(maxLevel, weedKilled), meta, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean degrade(final World world, final int x, final int y, final int z, final EnumSoilType minLevel) {
|
public boolean degrade(World world, int x, int y, int z, EnumSoilType minLevel) {
|
||||||
final EnumSoilType type = this.getType(world, x, y, z);
|
EnumSoilType type = getType(world, x, y, z);
|
||||||
if (type.ordinal() <= minLevel.ordinal()) {
|
if (type.ordinal() <= minLevel.ordinal()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final int meta = world.getBlockMetadata(x, y, z);
|
|
||||||
return world.setBlock(x, y, z, Gardening.getSoilBlock(minLevel, this.weedKilled), meta, 2);
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
|
return world.setBlock(x, y, z, Gardening.getSoilBlock(minLevel, weedKilled), meta, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setPH(final World world, final int x, final int y, final int z, final EnumAcidity pH) {
|
public boolean setPH(World world, int x, int y, int z, EnumAcidity pH) {
|
||||||
final int meta = getMeta(pH, this.getMoisture(world, x, y, z));
|
int meta = getMeta(pH, getMoisture(world, x, y, z));
|
||||||
return world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
return world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setMoisture(final World world, final int x, final int y, final int z, final EnumMoisture moisture) {
|
public boolean setMoisture(World world, int x, int y, int z, EnumMoisture moisture) {
|
||||||
final int meta = getMeta(this.getPH(world, x, y, z), moisture);
|
int meta = getMeta(getPH(world, x, y, z), moisture);
|
||||||
return world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
return world.setBlockMetadataWithNotify(x, y, z, meta, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getMeta(final EnumAcidity acid, final EnumMoisture moisture) {
|
|
||||||
return acid.ordinal() * 3 + moisture.ordinal();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNeighborBlockChange(final World world, final int x, final int y, final int z, final Block p_149695_5_) {
|
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||||
super.onNeighborBlockChange(world, x, y, z, p_149695_5_);
|
super.onNeighborBlockChange(world, x, y, z, block);
|
||||||
if (world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN, false)) {
|
if (world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN, false)) {
|
||||||
world.setBlock(x, y, z, Blocks.dirt, 0, 2);
|
world.setBlock(x, y, z, Blocks.dirt, 0, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getPH(final ItemStack stack) {
|
|
||||||
return Binnie.Language.localise(EnumAcidity.values()[stack.getItemDamage() / 3]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getMoisture(final ItemStack stack) {
|
|
||||||
return Binnie.Language.localise(EnumMoisture.values()[stack.getItemDamage() % 3]);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canSustainPlant(final IBlockAccess world, final int x, final int y, final int z, final ForgeDirection direction, final IPlantable plantable) {
|
public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) {
|
||||||
final Block plant = plantable.getPlant(world, x, y + 1, z);
|
Block plant = plantable.getPlant(world, x, y + 1, z);
|
||||||
if (plant == Botany.flower) {
|
if (plant == Botany.flower) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plant == Botany.plant) {
|
if (plant == Botany.plant) {
|
||||||
return !this.weedKilled || !BlockPlant.isWeed(world, x, y, z);
|
return !weedKilled || !BlockPlant.isWeed(world, x, y, z);
|
||||||
}
|
}
|
||||||
return world instanceof World && Blocks.dirt.canSustainPlant(world, x, y, z, direction, plantable);
|
return world instanceof World
|
||||||
|
&& Blocks.dirt.canSustainPlant(world, x, y, z, direction, plantable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean resistsWeeds(final World world, final int x, final int y, final int z) {
|
public boolean resistsWeeds(World world, int x, int y, int z) {
|
||||||
return this.weedKilled;
|
return weedKilled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,68 +1,61 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.gardening;
|
package binnie.botany.gardening;
|
||||||
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import binnie.botany.items.BotanyItems;
|
|
||||||
import forestry.api.core.EnumTemperature;
|
|
||||||
import java.util.Collection;
|
|
||||||
import binnie.core.BinnieCore;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import binnie.botany.flower.TileEntityFlower;
|
|
||||||
import binnie.botany.Botany;
|
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 binnie.botany.api.EnumAcidity;
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import binnie.botany.api.EnumMoisture;
|
import binnie.botany.api.EnumMoisture;
|
||||||
import net.minecraft.world.World;
|
import binnie.botany.api.EnumSoilType;
|
||||||
import net.minecraft.item.ItemBlock;
|
import binnie.botany.api.IFlower;
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import binnie.botany.api.gardening.IBlockSoil;
|
import binnie.botany.api.gardening.IBlockSoil;
|
||||||
|
import binnie.botany.flower.TileEntityFlower;
|
||||||
|
import binnie.botany.items.BotanyItems;
|
||||||
|
import binnie.core.BinnieCore;
|
||||||
|
import com.mojang.authlib.GameProfile;
|
||||||
|
import forestry.api.core.EnumTemperature;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class Gardening
|
public class Gardening {
|
||||||
{
|
public static Map<ItemStack, Integer> fertiliserAcid = new LinkedHashMap<>();
|
||||||
public static Map<ItemStack, Integer> fertiliserAcid;
|
public static Map<ItemStack, Integer> fertiliserAlkaline = new LinkedHashMap<>();
|
||||||
public static Map<ItemStack, Integer> fertiliserAlkaline;
|
public static Map<ItemStack, Integer> fertiliserNutrient = new LinkedHashMap<>();
|
||||||
public static Map<ItemStack, Integer> fertiliserNutrient;
|
|
||||||
|
|
||||||
public static boolean isSoil(final Block block) {
|
public static boolean isSoil(Block block) {
|
||||||
return block instanceof IBlockSoil;
|
return block instanceof IBlockSoil;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isSoil(final Item item) {
|
public static boolean isSoil(Item item) {
|
||||||
return item instanceof ItemBlock && isSoil(((ItemBlock) item).field_150939_a);
|
return item instanceof ItemBlock
|
||||||
|
&& isSoil(((ItemBlock) item).field_150939_a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isSoil(final ItemStack item) {
|
public static EnumMoisture getNaturalMoisture(World world, int x, int y, int z) {
|
||||||
return isSoil(item.getItem());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static EnumMoisture getNaturalMoisture(final World world, final int x, final int y, final int z) {
|
|
||||||
float bias = getBiomeMoisture(world.getBiomeGenForCoords(x, z), y);
|
float bias = getBiomeMoisture(world.getBiomeGenForCoords(x, z), y);
|
||||||
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.getBlock(x + dx, y, z + dz) == Blocks.sand) {
|
||||||
bias -= 1.5;
|
bias -= 1.5;
|
||||||
}
|
} else if (world.getBlock(x + dx, y, z + 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.canBlockSeeTheSky(x, y + 1, z) && world.getPrecipitationHeight(x, z) <= y + 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) {
|
||||||
@@ -72,70 +65,89 @@ public class Gardening
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (bias <= -1.0f) ? EnumMoisture.Dry : ((bias >= 1.0f) ? EnumMoisture.Damp : EnumMoisture.Normal);
|
|
||||||
|
if (bias <= -1.0f) {
|
||||||
|
return EnumMoisture.DRY;
|
||||||
|
}
|
||||||
|
return (bias >= 1.0f) ? EnumMoisture.DAMP : EnumMoisture.NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EnumAcidity getNaturalPH(final World world, final int x, final int y, final int z) {
|
public static EnumAcidity getNaturalPH(World world, int x, int y, int z) {
|
||||||
final float bias = getBiomePH(world.getBiomeGenForCoords(x, z), y);
|
float bias = getBiomePH(world.getBiomeGenForCoords(x, z), y);
|
||||||
return (bias <= -1.0f) ? EnumAcidity.Acid : ((bias >= 1.0f) ? EnumAcidity.Alkaline : EnumAcidity.Neutral);
|
if (bias <= -1.0f) {
|
||||||
|
return EnumAcidity.ACID;
|
||||||
|
}
|
||||||
|
return (bias >= 1.0f) ? EnumAcidity.ALKALINE : EnumAcidity.NEUTRAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float getBiomeMoisture(final BiomeGenBase biome, final int H) {
|
public static float getBiomeMoisture(BiomeGenBase biome, int H) {
|
||||||
final double R = biome.rainfall;
|
double R = biome.rainfall;
|
||||||
final double T = biome.temperature;
|
double T = biome.temperature;
|
||||||
final double m = 3.2 * (R - 0.5) - 0.4 * (1.0 + T + 0.5 * T * T) + 1.1 - 1.6 * (T - 0.9) * (T - 0.9) - 0.002 * (H - 64);
|
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);
|
||||||
return (float) ((m == 0.0) ? m : ((m < 0.0) ? (-Math.sqrt(m * m)) : Math.sqrt(m * m)));
|
if (m == 0.0) {
|
||||||
|
return (float) m;
|
||||||
|
}
|
||||||
|
if (m < 0.0){
|
||||||
|
return (float) -Math.sqrt(m * m);
|
||||||
|
}
|
||||||
|
return (float) Math.sqrt(m * m);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float getBiomePH(final BiomeGenBase biome, final int H) {
|
public static float getBiomePH(BiomeGenBase biome, int H) {
|
||||||
final double R = biome.rainfall;
|
double R = biome.rainfall;
|
||||||
final double T = biome.temperature;
|
double T = biome.temperature;
|
||||||
return (float) (-3.0 * (R - 0.5) + 0.5 * (T - 0.699999988079071) * (T - 0.699999988079071) + 0.02f * (H - 64) - 0.15000000596046448);
|
return (float) (-3.0 * (R - 0.5) + 0.5 * (T - 0.699999988079071) * (T - 0.699999988079071) + 0.02f * (H - 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) {
|
public static void createSoil(World world, int x, int y, int z, EnumSoilType soil, EnumMoisture moisture, EnumAcidity acidity) {
|
||||||
final int meta = moisture.ordinal() + acidity.ordinal() * 3;
|
int meta = moisture.ordinal() + acidity.ordinal() * 3;
|
||||||
world.setBlock(x, y, z, getSoilBlock(soil), meta, 2);
|
world.setBlock(x, y, z, getSoilBlock(soil), meta, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean plant(final World world, final int x, final int y, final int z, final IFlower flower, final GameProfile owner) {
|
public static boolean plant(World world, int x, int y, int z, IFlower flower, GameProfile owner) {
|
||||||
final boolean set = world.setBlock(x, y, z, Botany.flower, 0, 2);
|
boolean set = world.setBlock(x, y, z, Botany.flower, 0, 2);
|
||||||
if (!set) {
|
if (!set) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final TileEntity tileFlower = world.getTileEntity(x, y, z);
|
|
||||||
final TileEntity below = world.getTileEntity(x, y - 1, z);
|
TileEntity tileFlower = world.getTileEntity(x, y, z);
|
||||||
|
TileEntity below = world.getTileEntity(x, y - 1, z);
|
||||||
if (tileFlower != null && tileFlower instanceof TileEntityFlower) {
|
if (tileFlower != null && tileFlower instanceof TileEntityFlower) {
|
||||||
if (below instanceof TileEntityFlower) {
|
if (below instanceof TileEntityFlower) {
|
||||||
((TileEntityFlower) tileFlower).setSection(((TileEntityFlower) below).getSection());
|
((TileEntityFlower) tileFlower).setSection(((TileEntityFlower) below).getSection());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
((TileEntityFlower) tileFlower).create(flower, owner);
|
((TileEntityFlower) tileFlower).create(flower, owner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tryGrowSection(world, x, y, z);
|
tryGrowSection(world, x, y, z);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void tryGrowSection(final World world, final int x, final int y, final int z) {
|
public static void tryGrowSection(World world, int x, int y, int z) {
|
||||||
if (!BinnieCore.proxy.isSimulating(world)) {
|
if (!BinnieCore.proxy.isSimulating(world)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final TileEntity flower = world.getTileEntity(x, y, z);
|
|
||||||
if (flower != null && flower instanceof TileEntityFlower) {
|
TileEntity flower = world.getTileEntity(x, y, z);
|
||||||
final IFlower iflower = ((TileEntityFlower) flower).getFlower();
|
if (flower == null || !(flower instanceof TileEntityFlower)) {
|
||||||
final int section = ((TileEntityFlower) flower).getSection();
|
return;
|
||||||
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);
|
IFlower iflower = ((TileEntityFlower) flower).getFlower();
|
||||||
if (tileFlower != null && tileFlower instanceof TileEntityFlower) {
|
int section = ((TileEntityFlower) flower).getSection();
|
||||||
((TileEntityFlower) tileFlower).setSection(section + 1);
|
if (iflower == null || section >= iflower.getGenome().getPrimary().getType().getSections() - 1 || iflower.getAge() <= 0) {
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
world.setBlock(x, y + 1, z, Botany.flower, 0, 2);
|
||||||
|
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) {
|
public static void onGrowFromSeed(World world, int x, int y, int z) {
|
||||||
tryGrowSection(world, x, y, z);
|
tryGrowSection(world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,8 +163,8 @@ public class Gardening
|
|||||||
return Gardening.fertiliserNutrient.keySet();
|
return Gardening.fertiliserNutrient.keySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAcidFertiliser(final ItemStack itemstack) {
|
public static boolean isAcidFertiliser(ItemStack itemstack) {
|
||||||
for (final ItemStack stack : getAcidFertilisers()) {
|
for (ItemStack stack : getAcidFertilisers()) {
|
||||||
if (stack != null && stack.isItemEqual(itemstack)) {
|
if (stack != null && stack.isItemEqual(itemstack)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -160,8 +172,8 @@ public class Gardening
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAlkalineFertiliser(final ItemStack itemstack) {
|
public static boolean isAlkalineFertiliser(ItemStack itemstack) {
|
||||||
for (final ItemStack stack : getAlkalineFertilisers()) {
|
for (ItemStack stack : getAlkalineFertilisers()) {
|
||||||
if (stack != null && stack.isItemEqual(itemstack)) {
|
if (stack != null && stack.isItemEqual(itemstack)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -169,8 +181,8 @@ public class Gardening
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isNutrientFertiliser(final ItemStack itemstack) {
|
public static boolean isNutrientFertiliser(ItemStack itemstack) {
|
||||||
for (final ItemStack stack : getNutrientFertilisers()) {
|
for (ItemStack stack : getNutrientFertilisers()) {
|
||||||
if (stack != null && stack.isItemEqual(itemstack)) {
|
if (stack != null && stack.isItemEqual(itemstack)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -178,21 +190,24 @@ public class Gardening
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getFertiliserStrength(final ItemStack stack) {
|
public static int getFertiliserStrength(ItemStack stack) {
|
||||||
if (stack == null) {
|
if (stack == null) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
for (final Map.Entry<ItemStack, Integer> entry : Gardening.fertiliserAcid.entrySet()) {
|
|
||||||
|
for (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 (Map.Entry<ItemStack, Integer> entry : Gardening.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 (Map.Entry<ItemStack, Integer> entry : Gardening.fertiliserNutrient.entrySet()) {
|
||||||
if (entry.getKey().isItemEqual(stack)) {
|
if (entry.getKey().isItemEqual(stack)) {
|
||||||
return entry.getValue();
|
return entry.getValue();
|
||||||
}
|
}
|
||||||
@@ -200,65 +215,60 @@ public class Gardening
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean canTolerate(final IFlower flower, final World world, final int x, final int y, final int z) {
|
public static boolean canTolerate(IFlower flower, World world, int x, int y, int z) {
|
||||||
if (flower == null || flower.getGenome() == null) {
|
if (flower == null || flower.getGenome() == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Block soil = world.getBlock(x, y - 1, z);
|
|
||||||
final int soilMeta = world.getBlockMetadata(x, y - 1, z);
|
int soilMeta = world.getBlockMetadata(x, y - 1, z);
|
||||||
final BiomeGenBase biome = world.getBiomeGenForCoords(x, z);
|
BiomeGenBase biome = world.getBiomeGenForCoords(x, z);
|
||||||
return canTolerate(flower, EnumAcidity.values()[soilMeta / 3 % 3], EnumMoisture.values()[soilMeta % 3], EnumTemperature.getFromValue(biome.temperature));
|
return canTolerate(flower, EnumAcidity.values()[soilMeta / 3 % 3], EnumMoisture.values()[soilMeta % 3], EnumTemperature.getFromValue(biome.temperature));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EnumSoilType getSoilType(final World world, final int x, final int y, final int z) {
|
public static EnumSoilType getSoilType(World world, int x, int y, int z) {
|
||||||
if (world.getBlock(x, y, z) instanceof IBlockSoil) {
|
if (world.getBlock(x, y, z) instanceof IBlockSoil) {
|
||||||
return ((IBlockSoil) world.getBlock(x, y, z)).getType(world, x, y, z);
|
return ((IBlockSoil) world.getBlock(x, y, z)).getType(world, x, y, z);
|
||||||
}
|
}
|
||||||
return EnumSoilType.SOIL;
|
return EnumSoilType.SOIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Block getSoilBlock(final EnumSoilType type) {
|
public static Block getSoilBlock(EnumSoilType type) {
|
||||||
return getSoilBlock(type, false);
|
return getSoilBlock(type, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Block getSoilBlock(final EnumSoilType type, final boolean weedkill) {
|
public static Block getSoilBlock(EnumSoilType type, 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: {
|
|
||||||
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) {
|
public static 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) {
|
public static boolean isWeedkiller(ItemStack heldItem) {
|
||||||
return heldItem != null && heldItem.isItemEqual(BotanyItems.Weedkiller.get(1));
|
return heldItem != null
|
||||||
|
&& heldItem.isItemEqual(BotanyItems.Weedkiller.get(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean addWeedKiller(final World world, final int x, final int y, final int z) {
|
public static boolean addWeedKiller(World world, int x, int y, int z) {
|
||||||
if (!(world.getBlock(x, y, z) instanceof IBlockSoil)) {
|
if (!(world.getBlock(x, y, z) instanceof IBlockSoil)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final EnumSoilType type = getSoilType(world, x, y, z);
|
|
||||||
final Block block = getSoilBlock(type, true);
|
EnumSoilType type = getSoilType(world, x, y, z);
|
||||||
final boolean done = world.setBlock(x, y, z, block, world.getBlockMetadata(x, y, z), 2);
|
Block block = getSoilBlock(type, true);
|
||||||
|
boolean done = world.setBlock(x, y, z, block, world.getBlockMetadata(x, y, z), 2);
|
||||||
if (done && BlockPlant.isWeed(world, x, y + 1, z)) {
|
if (done && BlockPlant.isWeed(world, x, y + 1, z)) {
|
||||||
world.setBlockToAir(x, y + 1, z);
|
world.setBlockToAir(x, y + 1, z);
|
||||||
}
|
}
|
||||||
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,86 @@
|
|||||||
//
|
|
||||||
// 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.EnumAcidity;
|
||||||
import binnie.botany.api.EnumMoisture;
|
import binnie.botany.api.EnumMoisture;
|
||||||
import java.util.List;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import binnie.botany.api.EnumSoilType;
|
import binnie.botany.api.EnumSoilType;
|
||||||
|
import binnie.core.util.I18N;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
public class ItemSoil extends ItemBlock {
|
||||||
|
protected EnumSoilType type;
|
||||||
|
|
||||||
public class ItemSoil extends ItemBlock
|
|
||||||
{
|
|
||||||
EnumSoilType type;
|
|
||||||
private boolean noWeed;
|
private boolean noWeed;
|
||||||
|
|
||||||
|
public ItemSoil(Block block) {
|
||||||
|
super(block);
|
||||||
|
type = ((BlockSoil) field_150939_a).getType();
|
||||||
|
noWeed = ((BlockSoil) field_150939_a).weedKilled;
|
||||||
|
hasSubtypes = true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void addInformation(final ItemStack stack, final EntityPlayer p_77624_2_, final List p_77624_3_, final boolean p_77624_4_) {
|
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||||
super.addInformation(stack, p_77624_2_, p_77624_3_, p_77624_4_);
|
super.addInformation(stack, player, tooltip, advanced);
|
||||||
final EnumMoisture moisture = EnumMoisture.values()[stack.getItemDamage() % 3];
|
EnumMoisture moisture = EnumMoisture.values()[stack.getItemDamage() % 3];
|
||||||
final EnumAcidity acidity = EnumAcidity.values()[stack.getItemDamage() / 3];
|
EnumAcidity acidity = EnumAcidity.values()[stack.getItemDamage() / 3];
|
||||||
String info = "";
|
String info = "";
|
||||||
if (moisture == EnumMoisture.Dry) {
|
|
||||||
info += "§eDry§f";
|
if (moisture == EnumMoisture.DRY) {
|
||||||
|
info += EnumChatFormatting.YELLOW
|
||||||
|
+ I18N.localise("botany.moisture.dry")
|
||||||
|
+ EnumChatFormatting.RESET;
|
||||||
}
|
}
|
||||||
if (moisture == EnumMoisture.Damp) {
|
if (moisture == EnumMoisture.DAMP) {
|
||||||
info += "§9Damp§f";
|
info += EnumChatFormatting.YELLOW
|
||||||
|
+ I18N.localise("botany.moisture.damp")
|
||||||
|
+ EnumChatFormatting.RESET;
|
||||||
}
|
}
|
||||||
if (acidity == EnumAcidity.Acid) {
|
|
||||||
|
if (acidity == EnumAcidity.ACID) {
|
||||||
if (info.length() > 0) {
|
if (info.length() > 0) {
|
||||||
info += ", ";
|
info += ", ";
|
||||||
}
|
}
|
||||||
info += "§cAcidic§f";
|
info += EnumChatFormatting.YELLOW
|
||||||
|
+ I18N.localise("botany.ph.acid")
|
||||||
|
+ EnumChatFormatting.RESET;
|
||||||
}
|
}
|
||||||
if (acidity == EnumAcidity.Alkaline) {
|
|
||||||
|
if (acidity == EnumAcidity.ALKALINE) {
|
||||||
if (info.length() > 0) {
|
if (info.length() > 0) {
|
||||||
info += ", ";
|
info += ", ";
|
||||||
}
|
}
|
||||||
info += "§bAlkaline§f";
|
info += EnumChatFormatting.YELLOW
|
||||||
|
+ I18N.localise("botany.ph.alkaline")
|
||||||
|
+ EnumChatFormatting.RESET;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.length() > 0) {
|
if (info.length() > 0) {
|
||||||
p_77624_3_.add(info);
|
tooltip.add(info);
|
||||||
}
|
}
|
||||||
if (this.noWeed) {
|
|
||||||
p_77624_3_.add("Weedkiller");
|
if (noWeed) {
|
||||||
|
tooltip.add(I18N.localise("botany.soil.weedkiller"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemSoil(final Block p_i45328_1_) {
|
@Override
|
||||||
super(p_i45328_1_);
|
public String getItemStackDisplayName(ItemStack stack) {
|
||||||
this.type = ((BlockSoil) this.field_150939_a).getType();
|
String soilName = type.name().toLowerCase(Locale.ENGLISH);
|
||||||
this.noWeed = ((BlockSoil) this.field_150939_a).weedKilled;
|
return I18N.localise("botany.soil." + soilName);
|
||||||
this.hasSubtypes = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getItemStackDisplayName(final ItemStack stack) {
|
public int getMetadata(int meta) {
|
||||||
return this.type.name().substring(0, 1) + this.type.name().toLowerCase().substring(1);
|
return meta;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetadata(final int p_77647_1_) {
|
|
||||||
return p_77647_1_;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,68 +1,84 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.gardening;
|
package binnie.botany.gardening;
|
||||||
|
|
||||||
import binnie.botany.CreativeTabBotany;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import binnie.botany.Botany;
|
import binnie.botany.Botany;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import binnie.botany.CreativeTabBotany;
|
||||||
import net.minecraft.util.IChatComponent;
|
|
||||||
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.EnumSoilType;
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.util.ChatComponentText;
|
|
||||||
import binnie.Binnie;
|
|
||||||
import binnie.botany.api.gardening.IBlockSoil;
|
import binnie.botany.api.gardening.IBlockSoil;
|
||||||
import binnie.core.BinnieCore;
|
import binnie.core.BinnieCore;
|
||||||
import net.minecraft.world.World;
|
import binnie.core.util.I18N;
|
||||||
|
import binnie.genetics.genetics.AlleleHelper;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.ChatComponentText;
|
||||||
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
|
import net.minecraft.util.IChatComponent;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class ItemSoilMeter extends Item {
|
||||||
|
public ItemSoilMeter() {
|
||||||
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
|
setUnlocalizedName("soilMeter");
|
||||||
|
setMaxStackSize(1);
|
||||||
|
}
|
||||||
|
|
||||||
public class ItemSoilMeter extends Item
|
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemUse(final ItemStack stack, final EntityPlayer player, final World world, final int x, int y, final int z, final int p_77648_7_, final float p_77648_8_, final float p_77648_9_, final float p_77648_10_) {
|
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float blockX, float blockY, float blockZ) {
|
||||||
Block block = world.getBlock(x, y, z);
|
Block block = world.getBlock(x, y, z);
|
||||||
if (!Gardening.isSoil(block)) {
|
if (!Gardening.isSoil(block)) {
|
||||||
--y;
|
y--;
|
||||||
block = world.getBlock(x, y, z);
|
block = world.getBlock(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Gardening.isSoil(block) && !BinnieCore.proxy.isSimulating(world)) {
|
if (Gardening.isSoil(block) && !BinnieCore.proxy.isSimulating(world)) {
|
||||||
final IBlockSoil soil = (IBlockSoil) block;
|
IBlockSoil soil = (IBlockSoil) block;
|
||||||
final EnumSoilType type = soil.getType(world, x, y, z);
|
EnumSoilType type = soil.getType(world, x, y, z);
|
||||||
final EnumMoisture moisture = soil.getMoisture(world, x, y, z);
|
EnumMoisture moisture = soil.getMoisture(world, x, y, z);
|
||||||
final EnumAcidity pH = soil.getPH(world, x, y, z);
|
EnumAcidity pH = soil.getPH(world, x, y, z);
|
||||||
String info = "Type: ";
|
|
||||||
info = info + "§" + (new char[] { '8', '6', 'd' })[type.ordinal()] + Binnie.Language.localise(type) + "§f";
|
EnumChatFormatting[] colors = new EnumChatFormatting[]{
|
||||||
info += ", Moisture: ";
|
EnumChatFormatting.DARK_GRAY,
|
||||||
info = info + "§" + (new char[] { 'e', '7', '9' })[moisture.ordinal()] + Binnie.Language.localise(moisture) + "§f";
|
EnumChatFormatting.GOLD,
|
||||||
info += ", pH: ";
|
EnumChatFormatting.LIGHT_PURPLE,
|
||||||
info = info + "§" + (new char[] { 'c', 'a', 'b' })[pH.ordinal()] + Binnie.Language.localise(pH) + "§f";
|
};
|
||||||
final IChatComponent chat = new ChatComponentText(info);
|
String info = I18N.localise("botany.soil.tooltip.type") + " ";
|
||||||
|
info += colors[type.ordinal()] + AlleleHelper.toDisplay(type) + EnumChatFormatting.RESET;
|
||||||
|
|
||||||
|
colors = new EnumChatFormatting[]{
|
||||||
|
EnumChatFormatting.YELLOW,
|
||||||
|
EnumChatFormatting.GRAY,
|
||||||
|
EnumChatFormatting.BLUE,
|
||||||
|
};
|
||||||
|
info += ", " + I18N.localise("botany.soil.tooltip.moisture") + " ";
|
||||||
|
info += colors[moisture.ordinal()] + AlleleHelper.toDisplay(moisture) + EnumChatFormatting.RESET;
|
||||||
|
|
||||||
|
colors = new EnumChatFormatting[]{
|
||||||
|
EnumChatFormatting.RED,
|
||||||
|
EnumChatFormatting.GREEN,
|
||||||
|
EnumChatFormatting.AQUA,
|
||||||
|
};
|
||||||
|
info += ", " + I18N.localise("botany.soil.tooltip.pH") + " ";
|
||||||
|
info += colors[pH.ordinal()] + AlleleHelper.toDisplay(pH) + EnumChatFormatting.RESET;
|
||||||
|
IChatComponent chat = new ChatComponentText(info);
|
||||||
player.addChatMessage(chat);
|
player.addChatMessage(chat);
|
||||||
}
|
}
|
||||||
return super.onItemUse(stack, player, world, x, y, z, p_77648_7_, p_77648_8_, p_77648_9_, p_77648_10_);
|
return super.onItemUse(stack, player, world, x, y, z, side, blockX, blockY, blockZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerIcons(final IIconRegister register) {
|
public void registerIcons(IIconRegister register) {
|
||||||
this.itemIcon = Botany.proxy.getIcon(register, "soilMeter");
|
itemIcon = Botany.proxy.getIcon(register, "soilMeter");
|
||||||
}
|
|
||||||
|
|
||||||
public ItemSoilMeter() {
|
|
||||||
this.setCreativeTab(CreativeTabBotany.instance);
|
|
||||||
this.setUnlocalizedName("soilMeter");
|
|
||||||
this.setMaxStackSize(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getItemStackDisplayName(final ItemStack i) {
|
public String getItemStackDisplayName(ItemStack stack) {
|
||||||
return "Soil Meter";
|
return I18N.localise("botany.item.soilMeter.name");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,62 +1,59 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.gardening;
|
package binnie.botany.gardening;
|
||||||
|
|
||||||
|
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.block.Block;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import binnie.botany.api.EnumSoilType;
|
import binnie.botany.api.EnumSoilType;
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import net.minecraft.world.IBlockAccess;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import binnie.botany.Botany;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import binnie.botany.CreativeTabBotany;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class ItemTrowel extends Item
|
public class ItemTrowel extends Item {
|
||||||
{
|
|
||||||
protected Item.ToolMaterial theToolMaterial;
|
protected Item.ToolMaterial theToolMaterial;
|
||||||
String locName;
|
String locName;
|
||||||
|
|
||||||
public ItemTrowel(final Item.ToolMaterial p_i45343_1_, final String material) {
|
public ItemTrowel(Item.ToolMaterial toolMaterial, String material) {
|
||||||
this.theToolMaterial = p_i45343_1_;
|
theToolMaterial = toolMaterial;
|
||||||
this.maxStackSize = 1;
|
maxStackSize = 1;
|
||||||
this.setMaxDamage(p_i45343_1_.getMaxUses());
|
setMaxDamage(toolMaterial.getMaxUses());
|
||||||
this.setCreativeTab(CreativeTabBotany.instance);
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
this.setUnlocalizedName("trowel" + material);
|
setUnlocalizedName("trowel" + material);
|
||||||
this.locName = "trowel" + material;
|
locName = "trowel" + material;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerIcons(final IIconRegister p_94581_1_) {
|
public void registerIcons(IIconRegister register) {
|
||||||
this.itemIcon = Botany.proxy.getIcon(p_94581_1_, "tools/" + this.locName);
|
itemIcon = Botany.proxy.getIcon(register, "tools/" + locName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemUse(final ItemStack stack, final EntityPlayer player, final World world, final int x, final int y, final int z, final int p_77648_7_, final float p_77648_8_, final float p_77648_9_, final float p_77648_10_) {
|
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float blockX, float blockY, float blockZ) {
|
||||||
if (!player.canPlayerEdit(x, y, z, p_77648_7_, stack)) {
|
if (!player.canPlayerEdit(x, y, z, side, stack)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Block block = world.getBlock(x, y, z);
|
Block block = world.getBlock(x, y, z);
|
||||||
if (p_77648_7_ == 0 || (!world.getBlock(x, y + 1, z).isAir(world, x, y + 1, z) && world.getBlock(x, y + 1, z) != Botany.flower) || (block != Blocks.grass && block != Blocks.dirt)) {
|
if (side == 0 ||
|
||||||
|
(!world.getBlock(x, y + 1, z).isAir(world, x, y + 1, z) && world.getBlock(x, y + 1, z) != Botany.flower) ||
|
||||||
|
(block != Blocks.grass && block != Blocks.dirt)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Block block2 = Botany.soil;
|
|
||||||
|
Block block2 = Botany.soil;
|
||||||
world.playSoundEffect(x + 0.5f, y + 0.5f, z + 0.5f, block2.stepSound.getStepResourcePath(), (block2.stepSound.getVolume() + 1.0f) / 2.0f, block2.stepSound.getPitch() * 0.8f);
|
world.playSoundEffect(x + 0.5f, y + 0.5f, z + 0.5f, block2.stepSound.getStepResourcePath(), (block2.stepSound.getVolume() + 1.0f) / 2.0f, block2.stepSound.getPitch() * 0.8f);
|
||||||
if (world.isRemote) {
|
if (world.isRemote) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
final EnumMoisture moisture = Gardening.getNaturalMoisture(world, x, y, z);
|
|
||||||
final EnumAcidity acidity = Gardening.getNaturalPH(world, x, y, z);
|
EnumMoisture moisture = Gardening.getNaturalMoisture(world, x, y, z);
|
||||||
|
EnumAcidity acidity = Gardening.getNaturalPH(world, x, y, z);
|
||||||
Gardening.createSoil(world, x, y, z, EnumSoilType.SOIL, moisture, acidity);
|
Gardening.createSoil(world, x, y, z, EnumSoilType.SOIL, moisture, acidity);
|
||||||
stack.damageItem(1, player);
|
stack.damageItem(1, player);
|
||||||
return true;
|
return true;
|
||||||
@@ -67,8 +64,4 @@ public class ItemTrowel extends Item
|
|||||||
public boolean isFull3D() {
|
public boolean isFull3D() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getToolMaterialName() {
|
|
||||||
return this.theToolMaterial.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,37 +1,32 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.gardening;
|
package binnie.botany.gardening;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
|
||||||
public class ItemWeed extends ItemBlock
|
public class ItemWeed extends ItemBlock {
|
||||||
{
|
public ItemWeed(Block block) {
|
||||||
public ItemWeed(final Block p_i45328_1_) {
|
super(block);
|
||||||
super(p_i45328_1_);
|
setHasSubtypes(true);
|
||||||
this.setHasSubtypes(true);
|
hasSubtypes = true;
|
||||||
this.hasSubtypes = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getItemStackDisplayName(final ItemStack stack) {
|
public String getItemStackDisplayName(ItemStack stack) {
|
||||||
return BlockPlant.Type.values()[stack.getItemDamage()].getName();
|
return BlockPlant.Type.values()[stack.getItemDamage()].getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetadata(final int p_77647_1_) {
|
public int getMetadata(int meta) {
|
||||||
return p_77647_1_;
|
return meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIconFromDamage(final int p_77617_1_) {
|
public IIcon getIconFromDamage(int damage) {
|
||||||
return this.field_150939_a.getIcon(2, p_77617_1_);
|
return field_150939_a.getIcon(2, damage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,70 +1,71 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.gardening;
|
package binnie.botany.gardening;
|
||||||
|
|
||||||
import binnie.core.block.TileEntityMetadata;
|
import binnie.Binnie;
|
||||||
import java.util.Map;
|
import binnie.botany.Botany;
|
||||||
import binnie.botany.genetics.EnumFlowerColor;
|
import binnie.botany.CreativeTabBotany;
|
||||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
|
||||||
import net.minecraft.init.Items;
|
|
||||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
|
||||||
import binnie.core.Mods;
|
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
|
||||||
import binnie.botany.api.EnumAcidity;
|
import binnie.botany.api.EnumAcidity;
|
||||||
import binnie.botany.farm.CircuitGarden;
|
|
||||||
import binnie.botany.api.EnumMoisture;
|
import binnie.botany.api.EnumMoisture;
|
||||||
import net.minecraft.init.Blocks;
|
import binnie.botany.api.EnumSoilType;
|
||||||
import binnie.botany.ceramic.PigmentRecipe;
|
import binnie.botany.ceramic.BlockCeramic;
|
||||||
import net.minecraftforge.oredict.RecipeSorter;
|
|
||||||
import binnie.botany.ceramic.CeramicTileRecipe;
|
|
||||||
import binnie.core.block.MultipassItemRenderer;
|
|
||||||
import binnie.botany.ceramic.BlockCeramicBrick;
|
import binnie.botany.ceramic.BlockCeramicBrick;
|
||||||
import binnie.botany.ceramic.BlockCeramicPatterned;
|
import binnie.botany.ceramic.BlockCeramicPatterned;
|
||||||
import net.minecraftforge.client.IItemRenderer;
|
|
||||||
import binnie.core.block.ItemMetadataRenderer;
|
|
||||||
import binnie.core.BinnieCore;
|
|
||||||
import binnie.core.block.ItemMetadata;
|
|
||||||
import binnie.botany.ceramic.BlockStained;
|
import binnie.botany.ceramic.BlockStained;
|
||||||
import binnie.botany.ceramic.BlockCeramic;
|
import binnie.botany.ceramic.CeramicTileRecipe;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import binnie.botany.ceramic.PigmentRecipe;
|
||||||
|
import binnie.botany.farm.CircuitGarden;
|
||||||
|
import binnie.botany.flower.ItemInsulatedTube;
|
||||||
|
import binnie.botany.genetics.EnumFlowerColor;
|
||||||
|
import binnie.botany.items.BotanyItems;
|
||||||
import binnie.botany.items.ItemClay;
|
import binnie.botany.items.ItemClay;
|
||||||
import binnie.botany.items.ItemPigment;
|
import binnie.botany.items.ItemPigment;
|
||||||
import binnie.botany.CreativeTabBotany;
|
import binnie.core.BinnieCore;
|
||||||
import binnie.botany.items.BotanyItems;
|
|
||||||
import binnie.Binnie;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import binnie.botany.flower.ItemInsulatedTube;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
|
||||||
import binnie.botany.Botany;
|
|
||||||
import binnie.botany.api.EnumSoilType;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import binnie.core.IInitializable;
|
import binnie.core.IInitializable;
|
||||||
|
import binnie.core.Mods;
|
||||||
|
import binnie.core.block.ItemMetadata;
|
||||||
|
import binnie.core.block.ItemMetadataRenderer;
|
||||||
|
import binnie.core.block.MultipassItemRenderer;
|
||||||
|
import binnie.core.block.TileEntityMetadata;
|
||||||
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
import net.minecraftforge.oredict.RecipeSorter;
|
||||||
|
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||||
|
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||||
|
|
||||||
public class ModuleGardening implements IInitializable
|
import java.util.HashMap;
|
||||||
{
|
import java.util.Map;
|
||||||
public static HashMap<ItemStack, Integer> queuedAcidFertilisers;
|
|
||||||
public static HashMap<ItemStack, Integer> queuedAlkalineFertilisers;
|
public class ModuleGardening implements IInitializable {
|
||||||
public static HashMap<ItemStack, Integer> queuedNutrientFertilisers;
|
public static HashMap<ItemStack, Integer> queuedAcidFertilisers = new HashMap<>();
|
||||||
|
public static HashMap<ItemStack, Integer> queuedAlkalineFertilisers = new HashMap<>();
|
||||||
|
public static HashMap<ItemStack, Integer> queuedNutrientFertilisers = new HashMap<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preInit() {
|
public void preInit() {
|
||||||
|
Botany.plant = new BlockPlant();
|
||||||
|
GameRegistry.registerBlock(Botany.plant, ItemWeed.class, "plant");
|
||||||
|
|
||||||
Botany.soil = new BlockSoil(EnumSoilType.SOIL, "soil", false);
|
Botany.soil = new BlockSoil(EnumSoilType.SOIL, "soil", false);
|
||||||
Botany.loam = new BlockSoil(EnumSoilType.LOAM, "loam", false);
|
|
||||||
Botany.flowerbed = new BlockSoil(EnumSoilType.FLOWERBED, "flowerbed", false);
|
|
||||||
Botany.soilNoWeed = new BlockSoil(EnumSoilType.SOIL, "soilNoWeed", true);
|
|
||||||
Botany.loamNoWeed = new BlockSoil(EnumSoilType.LOAM, "loamNoWeed", true);
|
|
||||||
Botany.flowerbedNoWeed = new BlockSoil(EnumSoilType.FLOWERBED, "flowerbedNoWeed", true);
|
|
||||||
GameRegistry.registerBlock(Botany.plant = new BlockPlant(), ItemWeed.class, "plant");
|
|
||||||
GameRegistry.registerBlock(Botany.soil, ItemSoil.class, "soil");
|
GameRegistry.registerBlock(Botany.soil, ItemSoil.class, "soil");
|
||||||
|
|
||||||
|
Botany.loam = new BlockSoil(EnumSoilType.LOAM, "loam", false);
|
||||||
GameRegistry.registerBlock(Botany.loam, ItemSoil.class, "loam");
|
GameRegistry.registerBlock(Botany.loam, ItemSoil.class, "loam");
|
||||||
|
|
||||||
|
Botany.flowerbed = new BlockSoil(EnumSoilType.FLOWERBED, "flowerbed", false);
|
||||||
GameRegistry.registerBlock(Botany.flowerbed, ItemSoil.class, "flowerbed");
|
GameRegistry.registerBlock(Botany.flowerbed, ItemSoil.class, "flowerbed");
|
||||||
|
|
||||||
|
Botany.soilNoWeed = new BlockSoil(EnumSoilType.SOIL, "soilNoWeed", true);
|
||||||
GameRegistry.registerBlock(Botany.soilNoWeed, ItemSoil.class, "soilNoWeed");
|
GameRegistry.registerBlock(Botany.soilNoWeed, ItemSoil.class, "soilNoWeed");
|
||||||
|
|
||||||
|
Botany.loamNoWeed = new BlockSoil(EnumSoilType.LOAM, "loamNoWeed", true);
|
||||||
GameRegistry.registerBlock(Botany.loamNoWeed, ItemSoil.class, "loamNoWeed");
|
GameRegistry.registerBlock(Botany.loamNoWeed, ItemSoil.class, "loamNoWeed");
|
||||||
|
|
||||||
|
Botany.flowerbedNoWeed = new BlockSoil(EnumSoilType.FLOWERBED, "flowerbedNoWeed", true);
|
||||||
GameRegistry.registerBlock(Botany.flowerbedNoWeed, ItemSoil.class, "flowerbedNoWeed");
|
GameRegistry.registerBlock(Botany.flowerbedNoWeed, ItemSoil.class, "flowerbedNoWeed");
|
||||||
|
|
||||||
Botany.soilMeter = new ItemSoilMeter();
|
Botany.soilMeter = new ItemSoilMeter();
|
||||||
Botany.insulatedTube = new ItemInsulatedTube();
|
Botany.insulatedTube = new ItemInsulatedTube();
|
||||||
Botany.trowelWood = new ItemTrowel(Item.ToolMaterial.WOOD, "Wood");
|
Botany.trowelWood = new ItemTrowel(Item.ToolMaterial.WOOD, "Wood");
|
||||||
@@ -75,17 +76,21 @@ public class ModuleGardening implements IInitializable
|
|||||||
Botany.misc = Binnie.Item.registerMiscItems(BotanyItems.values(), CreativeTabBotany.instance);
|
Botany.misc = Binnie.Item.registerMiscItems(BotanyItems.values(), CreativeTabBotany.instance);
|
||||||
Botany.pigment = new ItemPigment();
|
Botany.pigment = new ItemPigment();
|
||||||
Botany.clay = new ItemClay();
|
Botany.clay = new ItemClay();
|
||||||
|
|
||||||
Botany.ceramic = new BlockCeramic();
|
Botany.ceramic = new BlockCeramic();
|
||||||
Botany.stained = new BlockStained();
|
|
||||||
GameRegistry.registerBlock(Botany.ceramic, ItemMetadata.class, "ceramic");
|
GameRegistry.registerBlock(Botany.ceramic, ItemMetadata.class, "ceramic");
|
||||||
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramic), new ItemMetadataRenderer());
|
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramic), new ItemMetadataRenderer());
|
||||||
|
|
||||||
|
Botany.stained = new BlockStained();
|
||||||
GameRegistry.registerBlock(Botany.stained, ItemMetadata.class, "stained");
|
GameRegistry.registerBlock(Botany.stained, ItemMetadata.class, "stained");
|
||||||
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.stained), new ItemMetadataRenderer());
|
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.stained), new ItemMetadataRenderer());
|
||||||
|
|
||||||
Botany.ceramicTile = new BlockCeramicPatterned();
|
Botany.ceramicTile = new BlockCeramicPatterned();
|
||||||
Botany.ceramicBrick = new BlockCeramicBrick();
|
|
||||||
GameRegistry.registerBlock(Botany.ceramicTile, ItemMetadata.class, "ceramicPattern");
|
GameRegistry.registerBlock(Botany.ceramicTile, ItemMetadata.class, "ceramicPattern");
|
||||||
GameRegistry.registerBlock(Botany.ceramicBrick, ItemMetadata.class, "ceramicBrick");
|
|
||||||
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramicTile), new MultipassItemRenderer());
|
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramicTile), new MultipassItemRenderer());
|
||||||
|
|
||||||
|
Botany.ceramicBrick = new BlockCeramicBrick();
|
||||||
|
GameRegistry.registerBlock(Botany.ceramicBrick, ItemMetadata.class, "ceramicBrick");
|
||||||
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramicBrick), new MultipassItemRenderer());
|
BinnieCore.proxy.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramicBrick), new MultipassItemRenderer());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,21 +99,22 @@ public class ModuleGardening implements IInitializable
|
|||||||
OreDictionary.registerOre("pigment", Botany.pigment);
|
OreDictionary.registerOre("pigment", Botany.pigment);
|
||||||
RecipeSorter.register("botany:ceramictile", CeramicTileRecipe.class, RecipeSorter.Category.SHAPED, "");
|
RecipeSorter.register("botany:ceramictile", CeramicTileRecipe.class, RecipeSorter.Category.SHAPED, "");
|
||||||
RecipeSorter.register("botany:pigment", PigmentRecipe.class, RecipeSorter.Category.SHAPED, "");
|
RecipeSorter.register("botany:pigment", PigmentRecipe.class, RecipeSorter.Category.SHAPED, "");
|
||||||
final ItemStack yellow = new ItemStack(Blocks.yellow_flower, 1);
|
ItemStack yellow = new ItemStack(Blocks.yellow_flower, 1);
|
||||||
final ItemStack red = new ItemStack(Blocks.red_flower, 1);
|
ItemStack red = new ItemStack(Blocks.red_flower, 1);
|
||||||
final ItemStack blue = new ItemStack(Blocks.red_flower, 1, 7);
|
ItemStack blue = new ItemStack(Blocks.red_flower, 1, 7);
|
||||||
for (final boolean manual : new boolean[] { true, false }) {
|
|
||||||
for (final boolean fertilised : new boolean[] { true, false }) {
|
for (boolean manual : new boolean[]{true, false}) {
|
||||||
for (final EnumMoisture moist : EnumMoisture.values()) {
|
for (boolean fertilised : new boolean[]{true, false}) {
|
||||||
final ItemStack icon = (moist == EnumMoisture.Dry) ? yellow : ((moist == EnumMoisture.Normal) ? red : blue);
|
for (EnumMoisture moist : EnumMoisture.values()) {
|
||||||
|
ItemStack icon = (moist == EnumMoisture.DRY) ? yellow : ((moist == EnumMoisture.NORMAL) ? red : blue);
|
||||||
int insulate = 2 - moist.ordinal();
|
int insulate = 2 - moist.ordinal();
|
||||||
if (fertilised) {
|
if (fertilised) {
|
||||||
insulate += 3;
|
insulate += 3;
|
||||||
}
|
}
|
||||||
new CircuitGarden(moist, null, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 0 + 128 * insulate), icon);
|
new CircuitGarden(moist, null, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 128 * insulate), icon);
|
||||||
new CircuitGarden(moist, EnumAcidity.Acid, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 1 + 128 * insulate), icon);
|
new CircuitGarden(moist, EnumAcidity.ACID, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 1 + 128 * insulate), icon);
|
||||||
new CircuitGarden(moist, EnumAcidity.Neutral, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 2 + 128 * insulate), icon);
|
new CircuitGarden(moist, EnumAcidity.NEUTRAL, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 2 + 128 * insulate), icon);
|
||||||
new CircuitGarden(moist, EnumAcidity.Alkaline, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 3 + 128 * insulate), icon);
|
new CircuitGarden(moist, EnumAcidity.ALKALINE, manual, fertilised, new ItemStack(Botany.insulatedTube, 1, 3 + 128 * insulate), icon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -119,32 +125,109 @@ public class ModuleGardening implements IInitializable
|
|||||||
GameRegistry.addRecipe(new CeramicTileRecipe());
|
GameRegistry.addRecipe(new CeramicTileRecipe());
|
||||||
for (int mat = 0; mat < 4; ++mat) {
|
for (int mat = 0; mat < 4; ++mat) {
|
||||||
for (int insulate = 0; insulate < 6; ++insulate) {
|
for (int insulate = 0; insulate < 6; ++insulate) {
|
||||||
final ItemStack tubes = new ItemStack(Botany.insulatedTube, 2, mat + 128 * insulate);
|
ItemStack tubes = new ItemStack(Botany.insulatedTube, 2, mat + 128 * insulate);
|
||||||
final ItemStack insulateStack = ItemInsulatedTube.getInsulateStack(tubes);
|
ItemStack insulateStack = ItemInsulatedTube.getInsulateStack(tubes);
|
||||||
final ItemStack forestryTube = new ItemStack(Mods.Forestry.item("thermionicTubes"), 1, mat);
|
ItemStack forestryTube = new ItemStack(Mods.forestry.item("thermionicTubes"), 1, mat);
|
||||||
GameRegistry.addShapelessRecipe(tubes, new Object[] { forestryTube, forestryTube, insulateStack });
|
GameRegistry.addShapelessRecipe(tubes, forestryTube, forestryTube, insulateStack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GameRegistry.addRecipe(new ShapedOreRecipe((Item) Botany.trowelWood, new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "plankWood" }));
|
|
||||||
GameRegistry.addRecipe(new ShapedOreRecipe((Item) Botany.trowelStone, new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "cobblestone" }));
|
GameRegistry.addShapelessRecipe(new ItemStack(Blocks.dirt), new ItemStack(Botany.soil, 1, OreDictionary.WILDCARD_VALUE));
|
||||||
GameRegistry.addRecipe(new ShapedOreRecipe((Item) Botany.trowelIron, new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "ingotIron" }));
|
GameRegistry.addShapelessRecipe(new ItemStack(Blocks.dirt), new ItemStack(Botany.loam, 1, OreDictionary.WILDCARD_VALUE));
|
||||||
GameRegistry.addRecipe(new ShapedOreRecipe((Item) Botany.trowelGold, new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "ingotGold" }));
|
GameRegistry.addShapelessRecipe(new ItemStack(Blocks.dirt), new ItemStack(Botany.flowerbed, 1, OreDictionary.WILDCARD_VALUE));
|
||||||
GameRegistry.addRecipe(new ShapedOreRecipe((Item) Botany.trowelDiamond, new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "gemDiamond" }));
|
GameRegistry.addShapelessRecipe(new ItemStack(Blocks.dirt), new ItemStack(Botany.soilNoWeed, 1, OreDictionary.WILDCARD_VALUE));
|
||||||
GameRegistry.addRecipe(new ShapedOreRecipe((Item) Botany.soilMeter, new Object[] { " gg", " rg", "i ", 'g', "ingotGold", 'r', "dustRedstone", 'i', "ingotIron" }));
|
GameRegistry.addShapelessRecipe(new ItemStack(Blocks.dirt), new ItemStack(Botany.loamNoWeed, 1, OreDictionary.WILDCARD_VALUE));
|
||||||
GameRegistry.addShapelessRecipe(BotanyItems.Weedkiller.get(4), new Object[] { new ItemStack(Items.spider_eye), new ItemStack(Items.wheat_seeds), new ItemStack(Items.wheat_seeds), new ItemStack(Items.wheat_seeds) });
|
GameRegistry.addShapelessRecipe(new ItemStack(Blocks.dirt), new ItemStack(Botany.flowerbedNoWeed, 1, OreDictionary.WILDCARD_VALUE));
|
||||||
GameRegistry.addShapelessRecipe(BotanyItems.AshPowder.get(4), new Object[] { Mods.Forestry.stack("ash") });
|
|
||||||
GameRegistry.addShapelessRecipe(BotanyItems.MulchPowder.get(4), new Object[] { Mods.Forestry.stack("mulch") });
|
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||||
GameRegistry.addShapelessRecipe(BotanyItems.CompostPowder.get(4), new Object[] { Mods.Forestry.stack("fertilizerBio") });
|
Botany.trowelWood,
|
||||||
GameRegistry.addShapelessRecipe(BotanyItems.FertiliserPowder.get(4), new Object[] { Mods.Forestry.stack("fertilizerCompound") });
|
new Object[]{
|
||||||
GameRegistry.addShapelessRecipe(BotanyItems.PulpPowder.get(4), new Object[] { Mods.Forestry.stack("woodPulp") });
|
"d ", " x ", " s",
|
||||||
GameRegistry.addRecipe(new ShapelessOreRecipe(BotanyItems.SulphurPowder.get(4), new Object[] { "dustSulphur" }));
|
'd', Blocks.dirt,
|
||||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Botany.pigment, 2, EnumFlowerColor.Black.ordinal()), new Object[] { "pigment", "pigment", "dyeBlack" }));
|
's', "stickWood",
|
||||||
|
'x', "plankWood"
|
||||||
|
}
|
||||||
|
));
|
||||||
|
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||||
|
Botany.trowelStone,
|
||||||
|
new Object[]{
|
||||||
|
"d ", " x ", " s",
|
||||||
|
'd', Blocks.dirt,
|
||||||
|
's', "stickWood",
|
||||||
|
'x', "cobblestone"
|
||||||
|
}
|
||||||
|
));
|
||||||
|
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||||
|
Botany.trowelIron,
|
||||||
|
new Object[]{
|
||||||
|
"d ", " x ", " s",
|
||||||
|
'd', Blocks.dirt,
|
||||||
|
's', "stickWood",
|
||||||
|
'x', "ingotIron"
|
||||||
|
}
|
||||||
|
));
|
||||||
|
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||||
|
Botany.trowelGold,
|
||||||
|
new Object[]{
|
||||||
|
"d ", " x ", " s",
|
||||||
|
'd', Blocks.dirt,
|
||||||
|
's', "stickWood",
|
||||||
|
'x', "ingotGold"
|
||||||
|
}
|
||||||
|
));
|
||||||
|
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||||
|
Botany.trowelDiamond,
|
||||||
|
new Object[]{
|
||||||
|
"d ", " x ", " s",
|
||||||
|
'd', Blocks.dirt,
|
||||||
|
's', "stickWood",
|
||||||
|
'x', "gemDiamond"
|
||||||
|
}
|
||||||
|
));
|
||||||
|
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||||
|
Botany.soilMeter,
|
||||||
|
new Object[]{
|
||||||
|
" gg", " rg", "i ",
|
||||||
|
'g', "ingotGold",
|
||||||
|
'r', "dustRedstone",
|
||||||
|
'i', "ingotIron"
|
||||||
|
}
|
||||||
|
));
|
||||||
|
GameRegistry.addShapelessRecipe(
|
||||||
|
BotanyItems.Weedkiller.get(4),
|
||||||
|
new ItemStack(Items.spider_eye),
|
||||||
|
new ItemStack(Items.wheat_seeds),
|
||||||
|
new ItemStack(Items.wheat_seeds),
|
||||||
|
new ItemStack(Items.wheat_seeds)
|
||||||
|
);
|
||||||
|
|
||||||
|
GameRegistry.addShapelessRecipe(BotanyItems.AshPowder.get(4), Mods.forestry.stack("ash"));
|
||||||
|
GameRegistry.addShapelessRecipe(BotanyItems.MulchPowder.get(4), Mods.forestry.stack("mulch"));
|
||||||
|
GameRegistry.addShapelessRecipe(BotanyItems.CompostPowder.get(4), Mods.forestry.stack("fertilizerBio"));
|
||||||
|
GameRegistry.addShapelessRecipe(BotanyItems.FertiliserPowder.get(4), Mods.forestry.stack("fertilizerCompound"));
|
||||||
|
GameRegistry.addShapelessRecipe(BotanyItems.PulpPowder.get(4), Mods.forestry.stack("woodPulp"));
|
||||||
|
GameRegistry.addRecipe(new ShapelessOreRecipe(
|
||||||
|
BotanyItems.SulphurPowder.get(4),
|
||||||
|
new Object[]{"dustSulphur"}
|
||||||
|
));
|
||||||
|
|
||||||
|
GameRegistry.addRecipe(new ShapelessOreRecipe(
|
||||||
|
new ItemStack(Botany.pigment, 2, EnumFlowerColor.BLACK.ordinal()),
|
||||||
|
new Object[]{
|
||||||
|
"pigment",
|
||||||
|
"pigment",
|
||||||
|
"dyeBlack"
|
||||||
|
}
|
||||||
|
));
|
||||||
|
|
||||||
ModuleGardening.queuedAcidFertilisers.put(BotanyItems.SulphurPowder.get(1), 1);
|
ModuleGardening.queuedAcidFertilisers.put(BotanyItems.SulphurPowder.get(1), 1);
|
||||||
ModuleGardening.queuedAcidFertilisers.put(BotanyItems.MulchPowder.get(1), 1);
|
ModuleGardening.queuedAcidFertilisers.put(BotanyItems.MulchPowder.get(1), 1);
|
||||||
ModuleGardening.queuedAcidFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "mulch")), 2);
|
ModuleGardening.queuedAcidFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "mulch")), 2);
|
||||||
for (final ItemStack stack : OreDictionary.getOres("dustSulfur")) {
|
|
||||||
|
for (ItemStack stack : OreDictionary.getOres("dustSulfur")) {
|
||||||
ModuleGardening.queuedAcidFertilisers.put(stack, 2);
|
ModuleGardening.queuedAcidFertilisers.put(stack, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
ModuleGardening.queuedAlkalineFertilisers.put(BotanyItems.AshPowder.get(1), 1);
|
ModuleGardening.queuedAlkalineFertilisers.put(BotanyItems.AshPowder.get(1), 1);
|
||||||
ModuleGardening.queuedAlkalineFertilisers.put(BotanyItems.PulpPowder.get(1), 1);
|
ModuleGardening.queuedAlkalineFertilisers.put(BotanyItems.PulpPowder.get(1), 1);
|
||||||
ModuleGardening.queuedAlkalineFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "ash")), 2);
|
ModuleGardening.queuedAlkalineFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "ash")), 2);
|
||||||
@@ -153,50 +236,67 @@ public class ModuleGardening implements IInitializable
|
|||||||
ModuleGardening.queuedNutrientFertilisers.put(BotanyItems.FertiliserPowder.get(1), 1);
|
ModuleGardening.queuedNutrientFertilisers.put(BotanyItems.FertiliserPowder.get(1), 1);
|
||||||
ModuleGardening.queuedNutrientFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "fertilizerBio")), 2);
|
ModuleGardening.queuedNutrientFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "fertilizerBio")), 2);
|
||||||
ModuleGardening.queuedNutrientFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "fertilizerCompound")), 2);
|
ModuleGardening.queuedNutrientFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "fertilizerCompound")), 2);
|
||||||
for (final Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedAcidFertilisers.entrySet()) {
|
|
||||||
this.addAcidFertiliser(entry.getKey(), entry.getValue());
|
for (Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedAcidFertilisers.entrySet()) {
|
||||||
|
addAcidFertiliser(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
for (final Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedAlkalineFertilisers.entrySet()) {
|
|
||||||
this.addAlkalineFertiliser(entry.getKey(), entry.getValue());
|
for (Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedAlkalineFertilisers.entrySet()) {
|
||||||
|
addAlkalineFertiliser(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
for (final Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedNutrientFertilisers.entrySet()) {
|
|
||||||
this.addNutrientFertiliser(entry.getKey(), entry.getValue());
|
for (Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedNutrientFertilisers.entrySet()) {
|
||||||
|
addNutrientFertiliser(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
GameRegistry.addRecipe(BotanyItems.Mortar.get(6), new Object[] { " c ", "cgc", " c ", 'c', Items.clay_ball, 'g', Blocks.gravel });
|
|
||||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
GameRegistry.addRecipe(
|
||||||
final ItemStack clay = new ItemStack(Botany.clay, 1, c.ordinal());
|
BotanyItems.Mortar.get(6),
|
||||||
final ItemStack pigment = new ItemStack(Botany.pigment, 1, c.ordinal());
|
" c ", "cgc", " c ",
|
||||||
GameRegistry.addShapelessRecipe(clay, new Object[] { Items.clay_ball, Items.clay_ball, Items.clay_ball, pigment });
|
'c', Items.clay_ball,
|
||||||
|
'g', Blocks.gravel
|
||||||
|
);
|
||||||
|
|
||||||
|
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||||
|
ItemStack clay = new ItemStack(Botany.clay, 1, c.ordinal());
|
||||||
|
ItemStack pigment = new ItemStack(Botany.pigment, 1, c.ordinal());
|
||||||
|
GameRegistry.addShapelessRecipe(clay, Items.clay_ball, Items.clay_ball, Items.clay_ball, pigment);
|
||||||
GameRegistry.addSmelting(clay, TileEntityMetadata.getItemStack(Botany.ceramic, c.ordinal()), 0.0f);
|
GameRegistry.addSmelting(clay, TileEntityMetadata.getItemStack(Botany.ceramic, c.ordinal()), 0.0f);
|
||||||
final ItemStack glass = TileEntityMetadata.getItemStack(Botany.stained, c.ordinal());
|
ItemStack glass = TileEntityMetadata.getItemStack(Botany.stained, c.ordinal());
|
||||||
glass.stackSize = 4;
|
glass.stackSize = 4;
|
||||||
GameRegistry.addShapedRecipe(glass, new Object[] { " g ", "gpg", " g ", 'g', Blocks.glass, 'p', pigment });
|
GameRegistry.addShapedRecipe(
|
||||||
|
glass,
|
||||||
|
" g ", "gpg", " g ",
|
||||||
|
'g', Blocks.glass,
|
||||||
|
'p', pigment
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
GameRegistry.addRecipe(new PigmentRecipe());
|
GameRegistry.addRecipe(new PigmentRecipe());
|
||||||
}
|
}
|
||||||
|
|
||||||
private ItemStack getStack(final int type, final int pH, final int moisture) {
|
private ItemStack getStack(int type, int pH, int moisture) {
|
||||||
if (type < 0 || type > 2 || pH < 0 || pH > 2 || moisture < 0 || moisture > 2) {
|
if (type < 0 || type > 2 || pH < 0 || pH > 2 || moisture < 0 || moisture > 2) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new ItemStack(Gardening.getSoilBlock(EnumSoilType.values()[type]), 1, BlockSoil.getMeta(EnumAcidity.values()[pH], EnumMoisture.values()[moisture]));
|
return new ItemStack(Gardening.getSoilBlock(EnumSoilType.values()[type]), 1, BlockSoil.getMeta(EnumAcidity.values()[pH], EnumMoisture.values()[moisture]));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addAcidFertiliser(final ItemStack stack, final int strengthMax) {
|
private void addAcidFertiliser(ItemStack stack, int strengthMax) {
|
||||||
if (stack == null) {
|
if (stack == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Gardening.fertiliserAcid.put(stack, strengthMax);
|
Gardening.fertiliserAcid.put(stack, strengthMax);
|
||||||
for (int moisture = 0; moisture < 3; ++moisture) {
|
for (int moisture = 0; moisture < 3; ++moisture) {
|
||||||
for (int pH = 0; pH < 3; ++pH) {
|
for (int pH = 0; pH < 3; ++pH) {
|
||||||
for (int type = 0; type < 3; ++type) {
|
for (int type = 0; type < 3; ++type) {
|
||||||
int numOfBlocks = strengthMax * strengthMax;
|
int numOfBlocks = strengthMax * strengthMax;
|
||||||
for (int strength = 1; strength < strengthMax; ++strength) {
|
for (int strength = 1; strength < strengthMax; ++strength) {
|
||||||
final ItemStack start = this.getStack(type, pH, moisture);
|
ItemStack start = getStack(type, pH, moisture);
|
||||||
final ItemStack end = this.getStack(type, pH - strength, moisture);
|
ItemStack end = getStack(type, pH - strength, moisture);
|
||||||
if (end != null) {
|
if (end != null) {
|
||||||
end.stackSize = numOfBlocks;
|
end.stackSize = numOfBlocks;
|
||||||
final Object[] stacks = new Object[numOfBlocks + 1];
|
Object[] stacks = new Object[numOfBlocks + 1];
|
||||||
for (int i = 0; i < numOfBlocks; ++i) {
|
for (int i = 0; i < numOfBlocks; ++i) {
|
||||||
stacks[i] = start;
|
stacks[i] = start;
|
||||||
}
|
}
|
||||||
@@ -210,21 +310,22 @@ public class ModuleGardening implements IInitializable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addAlkalineFertiliser(final ItemStack stack, final int strengthMax) {
|
private void addAlkalineFertiliser(ItemStack stack, int strengthMax) {
|
||||||
if (stack == null) {
|
if (stack == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Gardening.fertiliserAlkaline.put(stack, strengthMax);
|
Gardening.fertiliserAlkaline.put(stack, strengthMax);
|
||||||
for (int moisture = 0; moisture < 3; ++moisture) {
|
for (int moisture = 0; moisture < 3; ++moisture) {
|
||||||
for (int pH = 0; pH < 3; ++pH) {
|
for (int pH = 0; pH < 3; ++pH) {
|
||||||
for (int type = 0; type < 3; ++type) {
|
for (int type = 0; type < 3; ++type) {
|
||||||
int numOfBlocks = strengthMax * strengthMax;
|
int numOfBlocks = strengthMax * strengthMax;
|
||||||
for (int strength = 1; strength < strengthMax; ++strength) {
|
for (int strength = 1; strength < strengthMax; ++strength) {
|
||||||
final ItemStack start = this.getStack(type, pH, moisture);
|
ItemStack start = getStack(type, pH, moisture);
|
||||||
final ItemStack end = this.getStack(type, pH + strength, moisture);
|
ItemStack end = getStack(type, pH + strength, moisture);
|
||||||
if (end != null) {
|
if (end != null) {
|
||||||
end.stackSize = numOfBlocks;
|
end.stackSize = numOfBlocks;
|
||||||
final Object[] stacks = new Object[numOfBlocks + 1];
|
Object[] stacks = new Object[numOfBlocks + 1];
|
||||||
for (int i = 0; i < numOfBlocks; ++i) {
|
for (int i = 0; i < numOfBlocks; ++i) {
|
||||||
stacks[i] = start;
|
stacks[i] = start;
|
||||||
}
|
}
|
||||||
@@ -238,21 +339,22 @@ public class ModuleGardening implements IInitializable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addNutrientFertiliser(final ItemStack stack, final int strengthMax) {
|
private void addNutrientFertiliser(ItemStack stack, int strengthMax) {
|
||||||
if (stack == null) {
|
if (stack == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Gardening.fertiliserNutrient.put(stack, strengthMax);
|
Gardening.fertiliserNutrient.put(stack, strengthMax);
|
||||||
for (int moisture = 0; moisture < 3; ++moisture) {
|
for (int moisture = 0; moisture < 3; ++moisture) {
|
||||||
for (int pH = 0; pH < 3; ++pH) {
|
for (int pH = 0; pH < 3; ++pH) {
|
||||||
for (int type = 0; type < 3; ++type) {
|
for (int type = 0; type < 3; ++type) {
|
||||||
int numOfBlocks = strengthMax * strengthMax;
|
int numOfBlocks = strengthMax * strengthMax;
|
||||||
for (int strength = 1; strength < strengthMax; ++strength) {
|
for (int strength = 1; strength < strengthMax; ++strength) {
|
||||||
final ItemStack start = this.getStack(type, pH, moisture);
|
ItemStack start = getStack(type, pH, moisture);
|
||||||
final ItemStack end = this.getStack(type + strength, pH, moisture);
|
ItemStack end = getStack(type + strength, pH, moisture);
|
||||||
if (end != null) {
|
if (end != null) {
|
||||||
end.stackSize = numOfBlocks;
|
end.stackSize = numOfBlocks;
|
||||||
final Object[] stacks = new Object[numOfBlocks + 1];
|
Object[] stacks = new Object[numOfBlocks + 1];
|
||||||
for (int i = 0; i < numOfBlocks; ++i) {
|
for (int i = 0; i < numOfBlocks; ++i) {
|
||||||
stacks[i] = start;
|
stacks[i] = start;
|
||||||
}
|
}
|
||||||
@@ -265,10 +367,4 @@ public class ModuleGardening implements IInitializable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
|
||||||
ModuleGardening.queuedAcidFertilisers = new HashMap<ItemStack, Integer>();
|
|
||||||
ModuleGardening.queuedAlkalineFertilisers = new HashMap<ItemStack, Integer>();
|
|
||||||
ModuleGardening.queuedNutrientFertilisers = new HashMap<ItemStack, Integer>();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,52 +1,45 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.genetics;
|
package binnie.botany.genetics;
|
||||||
|
|
||||||
import forestry.api.genetics.IAlleleInteger;
|
import forestry.api.genetics.IAlleleInteger;
|
||||||
|
|
||||||
public class AlleleColor implements IAlleleInteger
|
public class AlleleColor implements IAlleleInteger {
|
||||||
{
|
private String uid;
|
||||||
String uid;
|
private int value;
|
||||||
boolean dominant;
|
private EnumFlowerColor color;
|
||||||
String name;
|
private boolean dominant = true;
|
||||||
int value;
|
|
||||||
EnumFlowerColor color;
|
|
||||||
|
|
||||||
public AlleleColor(final EnumFlowerColor color, final String uid, final String name, final int value) {
|
public AlleleColor(EnumFlowerColor color, String uid, int value) {
|
||||||
this.color = color;
|
this.color = color;
|
||||||
this.uid = uid;
|
this.uid = uid;
|
||||||
this.name = name;
|
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUID() {
|
public String getUID() {
|
||||||
return this.uid;
|
return uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDominant() {
|
public boolean isDominant() {
|
||||||
return true;
|
return dominant;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.color.getName();
|
return color.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getValue() {
|
public int getValue() {
|
||||||
return this.value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EnumFlowerColor getColor() {
|
public EnumFlowerColor getColor() {
|
||||||
return this.color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUnlocalizedName() {
|
public String getUnlocalizedName() {
|
||||||
return this.getUID();
|
return getUID();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,23 +1,19 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.genetics;
|
package binnie.botany.genetics;
|
||||||
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import binnie.botany.api.IFlowerGenome;
|
|
||||||
import forestry.api.genetics.IEffectData;
|
|
||||||
import binnie.botany.api.IAlleleFlowerEffect;
|
import binnie.botany.api.IAlleleFlowerEffect;
|
||||||
|
import binnie.botany.api.IFlowerGenome;
|
||||||
|
import binnie.core.util.I18N;
|
||||||
|
import forestry.api.genetics.IEffectData;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class AlleleEffectNone implements IAlleleFlowerEffect
|
public class AlleleEffectNone implements IAlleleFlowerEffect {
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isCombinable() {
|
public boolean isCombinable() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IEffectData validateStorage(final IEffectData storedData) {
|
public IEffectData validateStorage(IEffectData storedData) {
|
||||||
return storedData;
|
return storedData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,16 +29,16 @@ public class AlleleEffectNone implements IAlleleFlowerEffect
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "None";
|
return I18N.localise("forestry.allele.effect.none");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IEffectData doEffect(final IFlowerGenome genome, final IEffectData storedData, final World world, final int x, final int y, final int z) {
|
public IEffectData doEffect(IFlowerGenome genome, IEffectData storedData, World world, int x, int y, int z) {
|
||||||
return storedData;
|
return storedData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUnlocalizedName() {
|
public String getUnlocalizedName() {
|
||||||
return this.getUID();
|
return getUID();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,31 +1,26 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.genetics;
|
package binnie.botany.genetics;
|
||||||
|
|
||||||
import binnie.Binnie;
|
import binnie.Binnie;
|
||||||
import forestry.api.genetics.IBreedingTracker;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import forestry.api.genetics.IIndividual;
|
|
||||||
|
|
||||||
import binnie.botany.api.IBotanistTracker;
|
import binnie.botany.api.IBotanistTracker;
|
||||||
|
import forestry.api.genetics.IBreedingTracker;
|
||||||
|
import forestry.api.genetics.IIndividual;
|
||||||
import forestry.core.genetics.BreedingTracker;
|
import forestry.core.genetics.BreedingTracker;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
|
||||||
public class BotanistTracker extends BreedingTracker implements IBotanistTracker
|
public class BotanistTracker extends BreedingTracker implements IBotanistTracker {
|
||||||
{
|
public BotanistTracker(String s) {
|
||||||
public BotanistTracker(final String s) {
|
|
||||||
super(s);
|
super(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerPickup(final IIndividual individual) {
|
public void registerPickup(IIndividual individual) {
|
||||||
|
// ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IBreedingTracker getBreedingTracker(final EntityPlayer player) {
|
protected IBreedingTracker getBreedingTracker(EntityPlayer player) {
|
||||||
return Binnie.Genetics.getFlowerRoot().getBreedingTracker(player.worldObj, player.getGameProfile());
|
return Binnie.Genetics.getFlowerRoot()
|
||||||
|
.getBreedingTracker(player.worldObj, player.getGameProfile());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package binnie.botany.genetics;
|
||||||
|
|
||||||
|
import binnie.botany.api.IColourMix;
|
||||||
|
import binnie.botany.api.IFlowerColor;
|
||||||
|
|
||||||
|
public class ColorMix implements IColourMix {
|
||||||
|
protected IFlowerColor color1;
|
||||||
|
protected IFlowerColor color2;
|
||||||
|
protected IFlowerColor result;
|
||||||
|
protected int chance;
|
||||||
|
|
||||||
|
public ColorMix(IFlowerColor color1, IFlowerColor color2, IFlowerColor result, int chance) {
|
||||||
|
this.color1 = color1;
|
||||||
|
this.color2 = color2;
|
||||||
|
this.result = result;
|
||||||
|
this.chance = chance;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IFlowerColor getColor1() {
|
||||||
|
return color1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IFlowerColor getColor2() {
|
||||||
|
return color2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isMutation(IFlowerColor color1, IFlowerColor color2) {
|
||||||
|
return (color1 == this.color1 && color2 == this.color2)
|
||||||
|
|| (color1 == this.color2 && color2 == this.color1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getChance() {
|
||||||
|
return chance;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IFlowerColor getResult() {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.genetics;
|
|
||||||
|
|
||||||
import binnie.botany.api.IFlowerColour;
|
|
||||||
import binnie.botany.api.IColourMix;
|
|
||||||
|
|
||||||
public class ColourMix implements IColourMix
|
|
||||||
{
|
|
||||||
IFlowerColour colour1;
|
|
||||||
IFlowerColour colour2;
|
|
||||||
IFlowerColour result;
|
|
||||||
int chance;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IFlowerColour getColour1() {
|
|
||||||
return this.colour1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IFlowerColour getColour2() {
|
|
||||||
return this.colour2;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isMutation(final IFlowerColour a, final IFlowerColour b) {
|
|
||||||
return (a == this.colour1 && b == this.colour2) || (a == this.colour2 && b == this.colour1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getChance() {
|
|
||||||
return this.chance;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IFlowerColour getResult() {
|
|
||||||
return this.result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ColourMix(final IFlowerColour colour1, final IFlowerColour colour2, final IFlowerColour result, final int chance) {
|
|
||||||
this.colour1 = colour1;
|
|
||||||
this.colour2 = colour2;
|
|
||||||
this.result = result;
|
|
||||||
this.chance = chance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -1,135 +1,152 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.genetics;
|
package binnie.botany.genetics;
|
||||||
|
|
||||||
import binnie.botany.Botany;
|
import binnie.botany.Botany;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import binnie.botany.api.EnumFlowerStage;
|
import binnie.botany.api.EnumFlowerStage;
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
import binnie.botany.api.IFlowerType;
|
import binnie.botany.api.IFlowerType;
|
||||||
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
|
||||||
public enum EnumFlowerType implements IFlowerType
|
public enum EnumFlowerType implements IFlowerType {
|
||||||
{
|
DANDELION,
|
||||||
Dandelion,
|
POPPY,
|
||||||
Poppy,
|
ORCHID,
|
||||||
Orchid,
|
ALLIUM,
|
||||||
Allium,
|
BLUET,
|
||||||
Bluet,
|
TULIP,
|
||||||
Tulip,
|
DAISY,
|
||||||
Daisy,
|
CORNFLOWER,
|
||||||
Cornflower,
|
PANSY,
|
||||||
Pansy,
|
IRIS,
|
||||||
Iris,
|
LAVENDER(2),
|
||||||
Lavender(2),
|
VIOLA,
|
||||||
Viola,
|
DAFFODIL,
|
||||||
Daffodil,
|
DAHLIA,
|
||||||
Dahlia,
|
PEONY(2),
|
||||||
Peony(2),
|
ROSE(2),
|
||||||
Rose(2),
|
LILAC(2),
|
||||||
Lilac(2),
|
HYDRANGEA(2),
|
||||||
Hydrangea(2),
|
FOXGLOVE(2),
|
||||||
Foxglove(2),
|
ZINNIA,
|
||||||
Zinnia,
|
MUMS,
|
||||||
Mums,
|
MARIGOLD,
|
||||||
Marigold,
|
GERANIUM,
|
||||||
Geranium,
|
AZALEA,
|
||||||
Azalea,
|
PRIMROSE,
|
||||||
Primrose,
|
ASTER,
|
||||||
Aster,
|
CARNATION,
|
||||||
Carnation,
|
LILY,
|
||||||
Lily,
|
YARROW,
|
||||||
Yarrow,
|
PETUNIA,
|
||||||
Petunia,
|
AGAPANTHUS,
|
||||||
Agapanthus,
|
FUCHSIA,
|
||||||
Fuchsia,
|
DIANTHUS,
|
||||||
Dianthus,
|
FORGET,
|
||||||
Forget,
|
ANEMONE,
|
||||||
Anemone,
|
AQUILEGIA,
|
||||||
Aquilegia,
|
EDELWEISS,
|
||||||
Edelweiss,
|
SCABIOUS,
|
||||||
Scabious,
|
CONEFLOWER,
|
||||||
Coneflower,
|
GAILLARDIA,
|
||||||
Gaillardia,
|
AURICULA,
|
||||||
Auricula,
|
CAMELLIA(2),
|
||||||
Camellia(2),
|
GOLDENROD(2),
|
||||||
Goldenrod(2),
|
ALTHEA(2),
|
||||||
Althea(2),
|
PENSTEMON(2),
|
||||||
Penstemon(2),
|
DELPHINIUM(2),
|
||||||
Delphinium(2),
|
HOLLYHOCK(2);
|
||||||
Hollyhock(2);
|
|
||||||
|
|
||||||
int sections;
|
protected int sections;
|
||||||
IIcon[] stem;
|
protected IIcon[] stem;
|
||||||
IIcon[] petal;
|
protected IIcon[] petal;
|
||||||
IIcon[] variant;
|
protected IIcon[] variant;
|
||||||
IIcon[] unflowered;
|
protected IIcon[] unflowered;
|
||||||
IIcon seedStem;
|
protected IIcon seedStem;
|
||||||
IIcon seedPetal;
|
protected IIcon seedPetal;
|
||||||
IIcon seedVariant;
|
protected IIcon seedVariant;
|
||||||
IIcon pollenStem;
|
protected IIcon pollenStem;
|
||||||
IIcon pollenPetal;
|
protected IIcon pollenPetal;
|
||||||
IIcon pollenVariant;
|
protected IIcon pollenVariant;
|
||||||
IIcon blank;
|
protected IIcon blank;
|
||||||
|
|
||||||
private EnumFlowerType() {
|
EnumFlowerType() {
|
||||||
this(1);
|
this(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private EnumFlowerType(final int sections) {
|
EnumFlowerType(int sections) {
|
||||||
this.sections = 1;
|
|
||||||
this.sections = sections;
|
this.sections = sections;
|
||||||
this.stem = new IIcon[sections];
|
stem = new IIcon[sections];
|
||||||
this.petal = new IIcon[sections];
|
petal = new IIcon[sections];
|
||||||
this.variant = new IIcon[sections];
|
variant = new IIcon[sections];
|
||||||
this.unflowered = new IIcon[sections];
|
unflowered = new IIcon[sections];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getStem(final EnumFlowerStage stage, final boolean flowered, final int section) {
|
public IIcon getStem(EnumFlowerStage stage, boolean flowered, int section) {
|
||||||
return (stage == EnumFlowerStage.SEED) ? this.seedStem : ((stage == EnumFlowerStage.POLLEN) ? this.pollenStem : this.stem[section % this.sections]);
|
if (stage == EnumFlowerStage.SEED) {
|
||||||
}
|
return seedStem;
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getPetalIcon(final EnumFlowerStage stage, final boolean flowered, final int section) {
|
|
||||||
return (stage == EnumFlowerStage.SEED) ? this.seedPetal : ((stage == EnumFlowerStage.POLLEN) ? this.pollenPetal : (flowered ? this.petal[section % this.sections] : this.unflowered[section % this.sections]));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getVariantIcon(final EnumFlowerStage stage, final boolean flowered, final int section) {
|
|
||||||
return (stage == EnumFlowerStage.SEED) ? this.seedVariant : ((stage == EnumFlowerStage.POLLEN) ? this.pollenVariant : (flowered ? this.variant[section % this.sections] : this.blank));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void registerIcons(final IIconRegister register) {
|
|
||||||
for (int i = 0; i < this.sections; ++i) {
|
|
||||||
final String suf = (i == 0) ? "" : ("" + (i + 1));
|
|
||||||
final String pre = (this.sections == 1) ? "" : "double/";
|
|
||||||
this.stem[i] = Botany.proxy.getIcon(register, "flowers/" + pre + this.toString().toLowerCase() + suf + ".0");
|
|
||||||
this.petal[i] = Botany.proxy.getIcon(register, "flowers/" + pre + this.toString().toLowerCase() + suf + ".1");
|
|
||||||
this.variant[i] = Botany.proxy.getIcon(register, "flowers/" + pre + this.toString().toLowerCase() + suf + ".2");
|
|
||||||
this.unflowered[i] = Botany.proxy.getIcon(register, "flowers/" + pre + this.toString().toLowerCase() + suf + ".3");
|
|
||||||
}
|
}
|
||||||
this.blank = Botany.proxy.getIcon(register, "flowers/blank");
|
if (stage == EnumFlowerStage.POLLEN) {
|
||||||
this.seedStem = Botany.proxy.getIcon(register, "flowers/seed.0");
|
return pollenStem;
|
||||||
this.seedPetal = Botany.proxy.getIcon(register, "flowers/seed.1");
|
}
|
||||||
this.seedVariant = Botany.proxy.getIcon(register, "flowers/seed.2");
|
return stem[section % sections];
|
||||||
this.pollenStem = Botany.proxy.getIcon(register, "flowers/pollen.0");
|
}
|
||||||
this.pollenPetal = Botany.proxy.getIcon(register, "flowers/pollen.1");
|
|
||||||
this.pollenVariant = Botany.proxy.getIcon(register, "flowers/pollen.2");
|
@Override
|
||||||
|
public IIcon getPetalIcon(EnumFlowerStage stage, boolean flowered, int section) {
|
||||||
|
if (stage == EnumFlowerStage.SEED) {
|
||||||
|
return seedPetal;
|
||||||
|
}
|
||||||
|
if (stage == EnumFlowerStage.POLLEN){
|
||||||
|
return pollenPetal;
|
||||||
|
}
|
||||||
|
if (flowered) {
|
||||||
|
return petal[section % sections];
|
||||||
|
}
|
||||||
|
return unflowered[section % sections];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IIcon getVariantIcon(EnumFlowerStage stage, boolean flowered, int section) {
|
||||||
|
if (stage == EnumFlowerStage.SEED) {
|
||||||
|
return seedVariant;
|
||||||
|
}
|
||||||
|
if (stage == EnumFlowerStage.POLLEN) {
|
||||||
|
return pollenVariant;
|
||||||
|
}
|
||||||
|
return flowered ? variant[section % sections] : blank;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void registerIcons(IIconRegister register) {
|
||||||
|
for (int i = 0; i < sections; ++i) {
|
||||||
|
String suf = (i == 0) ? "" : ("" + (i + 1));
|
||||||
|
String pre = (sections == 1) ? "" : "double/";
|
||||||
|
String id = pre + toString().toLowerCase() + suf;
|
||||||
|
stem[i] = Botany.proxy.getIcon(register, "flowers/" + id + ".0");
|
||||||
|
petal[i] = Botany.proxy.getIcon(register, "flowers/" + id + ".1");
|
||||||
|
variant[i] = Botany.proxy.getIcon(register, "flowers/" + id + ".2");
|
||||||
|
unflowered[i] = Botany.proxy.getIcon(register, "flowers/" + id + ".3");
|
||||||
|
}
|
||||||
|
|
||||||
|
blank = Botany.proxy.getIcon(register, "flowers/blank");
|
||||||
|
seedStem = Botany.proxy.getIcon(register, "flowers/seed.0");
|
||||||
|
seedPetal = Botany.proxy.getIcon(register, "flowers/seed.1");
|
||||||
|
seedVariant = Botany.proxy.getIcon(register, "flowers/seed.2");
|
||||||
|
pollenStem = Botany.proxy.getIcon(register, "flowers/pollen.0");
|
||||||
|
pollenPetal = Botany.proxy.getIcon(register, "flowers/pollen.1");
|
||||||
|
pollenVariant = Botany.proxy.getIcon(register, "flowers/pollen.2");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getID() {
|
public int getID() {
|
||||||
return this.ordinal();
|
return ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSections() {
|
public int getSections() {
|
||||||
return this.sections;
|
return sections;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IIcon getBlank() {
|
public IIcon getBlank() {
|
||||||
return this.blank;
|
return blank;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,121 +1,112 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.genetics;
|
package binnie.botany.genetics;
|
||||||
|
|
||||||
import binnie.botany.api.IFlowerColour;
|
|
||||||
import forestry.api.genetics.IGenome;
|
|
||||||
import binnie.botany.api.IFlowerMutation;
|
|
||||||
import binnie.botany.api.IColourMix;
|
|
||||||
import forestry.api.arboriculture.EnumTreeChromosome;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import forestry.api.genetics.IAllele;
|
|
||||||
import forestry.core.genetics.Chromosome;
|
|
||||||
import forestry.api.genetics.IChromosome;
|
|
||||||
import java.util.Random;
|
|
||||||
import net.minecraft.nbt.NBTBase;
|
|
||||||
import binnie.botany.core.BotanyCore;
|
|
||||||
import forestry.api.genetics.IChromosomeType;
|
|
||||||
import binnie.botany.api.EnumFlowerChromosome;
|
import binnie.botany.api.EnumFlowerChromosome;
|
||||||
import java.util.List;
|
|
||||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import binnie.botany.api.IColourMix;
|
||||||
import binnie.botany.api.IFlowerGenome;
|
|
||||||
import binnie.botany.api.IFlower;
|
import binnie.botany.api.IFlower;
|
||||||
|
import binnie.botany.api.IFlowerColor;
|
||||||
|
import binnie.botany.api.IFlowerGenome;
|
||||||
|
import binnie.botany.api.IFlowerMutation;
|
||||||
|
import binnie.botany.core.BotanyCore;
|
||||||
|
import binnie.core.util.I18N;
|
||||||
|
import binnie.genetics.genetics.AlleleHelper;
|
||||||
|
import forestry.api.arboriculture.EnumTreeChromosome;
|
||||||
|
import forestry.api.genetics.IAllele;
|
||||||
|
import forestry.api.genetics.IChromosome;
|
||||||
|
import forestry.core.genetics.Chromosome;
|
||||||
import forestry.core.genetics.Individual;
|
import forestry.core.genetics.Individual;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class Flower extends Individual implements IFlower
|
import java.util.List;
|
||||||
{
|
|
||||||
|
public class Flower extends Individual implements IFlower {
|
||||||
public IFlowerGenome genome;
|
public IFlowerGenome genome;
|
||||||
public IFlowerGenome mate;
|
public IFlowerGenome mate;
|
||||||
int age;
|
|
||||||
boolean wilting;
|
|
||||||
boolean flowered;
|
|
||||||
|
|
||||||
public Flower(final NBTTagCompound nbttagcompound) {
|
protected int age;
|
||||||
this.age = 0;
|
protected boolean wilting;
|
||||||
this.wilting = false;
|
protected boolean flowered;
|
||||||
this.readFromNBT(nbttagcompound);
|
|
||||||
|
public Flower(NBTTagCompound nbttagcompound) {
|
||||||
|
age = 0;
|
||||||
|
wilting = false;
|
||||||
|
readFromNBT(nbttagcompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Flower(final IFlowerGenome genome, final int age) {
|
public Flower(IFlowerGenome genome, int age) {
|
||||||
this.age = 0;
|
|
||||||
this.wilting = false;
|
|
||||||
this.genome = genome;
|
this.genome = genome;
|
||||||
this.age = age;
|
this.age = age;
|
||||||
if (age > 0) {
|
wilting = false;
|
||||||
this.flowered = true;
|
flowered = age > 0;
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.flowered = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDisplayName() {
|
public String getDisplayName() {
|
||||||
final IAlleleFlowerSpecies species = this.getGenome().getPrimary();
|
IAlleleFlowerSpecies species = getGenome().getPrimary();
|
||||||
String name = "";
|
String name = "";
|
||||||
if (species != null) {
|
if (species != null) {
|
||||||
name += species.getName();
|
name += species.getName();
|
||||||
}
|
}
|
||||||
if (this.age == 0) {
|
|
||||||
name += "";
|
|
||||||
}
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addTooltip(final List<String> list) {
|
public void addTooltip(List<String> list) {
|
||||||
final IAlleleFlowerSpecies primary = this.genome.getPrimary();
|
IAlleleFlowerSpecies primary = genome.getPrimary();
|
||||||
final IAlleleFlowerSpecies secondary = this.genome.getSecondary();
|
IAlleleFlowerSpecies secondary = genome.getSecondary();
|
||||||
if (!this.isPureBred(EnumFlowerChromosome.SPECIES)) {
|
if (!isPureBred(EnumFlowerChromosome.SPECIES)) {
|
||||||
list.add("§9" + primary.getName() + "-" + secondary.getName() + " Hybrid");
|
list.add(EnumChatFormatting.BLUE + I18N.localise("botany.item.tooltip.hybrid", primary.getName(), secondary.getName()));
|
||||||
}
|
}
|
||||||
list.add("§6Age: " + this.getAge());
|
|
||||||
list.add("§6T: " + this.getGenome().getPrimary().getTemperature() + " / " + this.getGenome().getToleranceTemperature());
|
list.add(EnumChatFormatting.GRAY + I18N.localise("botany.item.tooltip.age", getAge()));
|
||||||
list.add("§6M: " + this.getGenome().getPrimary().getMoisture() + " / " + this.getGenome().getToleranceMoisture());
|
list.add(EnumChatFormatting.GREEN + I18N.localise("botany.item.tooltip.temperature", AlleleHelper.toDisplay(primary.getTemperature()), AlleleHelper.toDisplay(genome.getToleranceTemperature())));
|
||||||
list.add("§6pH: " + this.getGenome().getPrimary().getHumidity() + " / " + this.getGenome().getTolerancePH());
|
list.add(EnumChatFormatting.GREEN + I18N.localise("botany.item.tooltip.moisture", AlleleHelper.toDisplay(primary.getMoisture()), AlleleHelper.toDisplay(genome.getToleranceMoisture())));
|
||||||
list.add("§6Fert: " + this.getGenome().getFertility() + "x");
|
list.add(EnumChatFormatting.GREEN + I18N.localise("botany.item.tooltip.pH", AlleleHelper.toDisplay(primary.getHumidity()), AlleleHelper.toDisplay(genome.getTolerancePH())));
|
||||||
|
list.add(EnumChatFormatting.GRAY + I18N.localise("botany.item.tooltip.fertility", genome.getFertility()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getIdent() {
|
public String getIdent() {
|
||||||
return this.getGenome().getPrimary().getUID();
|
return getGenome().getPrimary().getUID();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(final NBTTagCompound nbttagcompound) {
|
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||||
super.readFromNBT(nbttagcompound);
|
super.readFromNBT(nbttagcompound);
|
||||||
if (nbttagcompound == null) {
|
if (nbttagcompound == null) {
|
||||||
this.genome = BotanyCore.getFlowerRoot().templateAsGenome(BotanyCore.getFlowerRoot().getDefaultTemplate());
|
genome = BotanyCore.getFlowerRoot().templateAsGenome(BotanyCore.getFlowerRoot().getDefaultTemplate());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.age = nbttagcompound.getInteger("Age");
|
|
||||||
this.wilting = nbttagcompound.getBoolean("Wilt");
|
age = nbttagcompound.getInteger("Age");
|
||||||
this.flowered = nbttagcompound.getBoolean("Flowered");
|
wilting = nbttagcompound.getBoolean("Wilt");
|
||||||
|
flowered = nbttagcompound.getBoolean("Flowered");
|
||||||
if (nbttagcompound.hasKey("Genome")) {
|
if (nbttagcompound.hasKey("Genome")) {
|
||||||
this.genome = new FlowerGenome(nbttagcompound.getCompoundTag("Genome"));
|
genome = new FlowerGenome(nbttagcompound.getCompoundTag("Genome"));
|
||||||
}
|
}
|
||||||
if (nbttagcompound.hasKey("Mate")) {
|
if (nbttagcompound.hasKey("Mate")) {
|
||||||
this.mate = new FlowerGenome(nbttagcompound.getCompoundTag("Mate"));
|
mate = new FlowerGenome(nbttagcompound.getCompoundTag("Mate"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToNBT(final NBTTagCompound nbttagcompound) {
|
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||||
super.writeToNBT(nbttagcompound);
|
super.writeToNBT(nbttagcompound);
|
||||||
nbttagcompound.setInteger("Age", this.age);
|
nbttagcompound.setInteger("Age", age);
|
||||||
nbttagcompound.setBoolean("Wilt", this.wilting);
|
nbttagcompound.setBoolean("Wilt", wilting);
|
||||||
nbttagcompound.setBoolean("Flowered", this.flowered);
|
nbttagcompound.setBoolean("Flowered", flowered);
|
||||||
if (this.genome != null) {
|
|
||||||
final NBTTagCompound NBTmachine = new NBTTagCompound();
|
if (genome != null) {
|
||||||
this.genome.writeToNBT(NBTmachine);
|
NBTTagCompound NBTmachine = new NBTTagCompound();
|
||||||
|
genome.writeToNBT(NBTmachine);
|
||||||
nbttagcompound.setTag("Genome", NBTmachine);
|
nbttagcompound.setTag("Genome", NBTmachine);
|
||||||
}
|
}
|
||||||
if (this.mate != null) {
|
|
||||||
final NBTTagCompound NBTmachine = new NBTTagCompound();
|
if (mate != null) {
|
||||||
this.mate.writeToNBT(NBTmachine);
|
NBTTagCompound NBTmachine = new NBTTagCompound();
|
||||||
|
mate.writeToNBT(NBTmachine);
|
||||||
nbttagcompound.setTag("Mate", NBTmachine);
|
nbttagcompound.setTag("Mate", NBTmachine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -126,101 +117,78 @@ public class Flower extends Individual implements IFlower
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFlowerGenome getGenome() {
|
public IFlowerGenome getGenome() {
|
||||||
return this.genome;
|
return genome;
|
||||||
}
|
|
||||||
|
|
||||||
private IChromosome inheritChromosome(final Random rand, final IChromosome parent1, final IChromosome parent2) {
|
|
||||||
IAllele choice1;
|
|
||||||
if (rand.nextBoolean()) {
|
|
||||||
choice1 = parent1.getPrimaryAllele();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
choice1 = parent1.getSecondaryAllele();
|
|
||||||
}
|
|
||||||
IAllele choice2;
|
|
||||||
if (rand.nextBoolean()) {
|
|
||||||
choice2 = parent2.getPrimaryAllele();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
choice2 = parent2.getSecondaryAllele();
|
|
||||||
}
|
|
||||||
if (rand.nextBoolean()) {
|
|
||||||
return new Chromosome(choice1, choice2);
|
|
||||||
}
|
|
||||||
return new Chromosome(choice2, choice1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mate(final IFlower other) {
|
public void mate(IFlower other) {
|
||||||
this.mate = new FlowerGenome(other.getGenome().getChromosomes());
|
mate = new FlowerGenome(other.getGenome().getChromosomes());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFlowerGenome getMate() {
|
public IFlowerGenome getMate() {
|
||||||
return this.mate;
|
return mate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFlower copy() {
|
public IFlower copy() {
|
||||||
final NBTTagCompound nbttagcompound = new NBTTagCompound();
|
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||||
this.writeToNBT(nbttagcompound);
|
writeToNBT(nbttagcompound);
|
||||||
return new Flower(nbttagcompound);
|
return new Flower(nbttagcompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAge() {
|
public int getAge() {
|
||||||
return this.age;
|
return age;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setAge(int age) {
|
||||||
|
this.age = age;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void age() {
|
public void age() {
|
||||||
if (this.age < 15) {
|
if (age < 15) {
|
||||||
++this.age;
|
age++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAge(final int i) {
|
|
||||||
this.age = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxAge() {
|
public int getMaxAge() {
|
||||||
return this.getGenome().getLifespan();
|
return getGenome().getLifespan();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isWilted() {
|
public boolean isWilted() {
|
||||||
return this.wilting;
|
return wilting;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setWilted(final boolean wilted) {
|
public void setWilted(boolean value) {
|
||||||
this.wilting = wilted;
|
wilting = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasFlowered() {
|
public boolean hasFlowered() {
|
||||||
return this.flowered;
|
return flowered;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFlowered(final boolean flowered) {
|
public void setFlowered(boolean value) {
|
||||||
this.flowered = flowered;
|
flowered = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeMate() {
|
public void removeMate() {
|
||||||
this.mate = null;
|
mate = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFlower getOffspring(final World world) {
|
public IFlower getOffspring(World world) {
|
||||||
final IChromosome[] chromosomes = new IChromosome[this.genome.getChromosomes().length];
|
IChromosome[] chromosomes = new IChromosome[genome.getChromosomes().length];
|
||||||
IChromosome[] parent1 = this.genome.getChromosomes();
|
IChromosome[] parent1 = mutateSpecies(world, genome, mate);
|
||||||
IChromosome[] parent2 = this.mate.getChromosomes();
|
IChromosome[] parent2 = mutateSpecies(world, mate, genome);
|
||||||
parent1 = this.mutateSpecies(world, this.genome, this.mate);
|
|
||||||
parent2 = this.mutateSpecies(world, this.mate, this.genome);
|
|
||||||
for (int i = 0; i < parent1.length; ++i) {
|
for (int i = 0; i < parent1.length; ++i) {
|
||||||
if (parent1[i] != null && parent2[i] != null) {
|
if (parent1[i] != null && parent2[i] != null) {
|
||||||
chromosomes[i] = Chromosome.inheritChromosome(world.rand, parent1[i], parent2[i]);
|
chromosomes[i] = Chromosome.inheritChromosome(world.rand, parent1[i], parent2[i]);
|
||||||
@@ -229,59 +197,64 @@ public class Flower extends Individual implements IFlower
|
|||||||
return new Flower(new FlowerGenome(chromosomes), 0);
|
return new Flower(new FlowerGenome(chromosomes), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IChromosome[] mutateSpecies(final World world, final IFlowerGenome genomeOne, final IFlowerGenome genomeTwo) {
|
private IChromosome[] mutateSpecies(World world, IFlowerGenome genomeOne, IFlowerGenome genomeTwo) {
|
||||||
IChromosome[] parent1 = genomeOne.getChromosomes();
|
IChromosome[] parent1 = genomeOne.getChromosomes();
|
||||||
final IChromosome[] parent2 = genomeTwo.getChromosomes();
|
IChromosome[] parent2 = genomeTwo.getChromosomes();
|
||||||
IAllele allele0;
|
IAllele allele0;
|
||||||
IAllele allele2;
|
IAllele allele2;
|
||||||
IFlowerGenome genome0;
|
IFlowerGenome genome0;
|
||||||
IFlowerGenome genome2;
|
IFlowerGenome genome2;
|
||||||
|
|
||||||
if (world.rand.nextBoolean()) {
|
if (world.rand.nextBoolean()) {
|
||||||
allele0 = parent1[EnumTreeChromosome.SPECIES.ordinal()].getPrimaryAllele();
|
allele0 = parent1[EnumTreeChromosome.SPECIES.ordinal()].getPrimaryAllele();
|
||||||
allele2 = parent2[EnumTreeChromosome.SPECIES.ordinal()].getSecondaryAllele();
|
allele2 = parent2[EnumTreeChromosome.SPECIES.ordinal()].getSecondaryAllele();
|
||||||
genome0 = genomeOne;
|
genome0 = genomeOne;
|
||||||
genome2 = genomeTwo;
|
genome2 = genomeTwo;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
allele0 = parent2[EnumTreeChromosome.SPECIES.ordinal()].getPrimaryAllele();
|
allele0 = parent2[EnumTreeChromosome.SPECIES.ordinal()].getPrimaryAllele();
|
||||||
allele2 = parent1[EnumTreeChromosome.SPECIES.ordinal()].getSecondaryAllele();
|
allele2 = parent1[EnumTreeChromosome.SPECIES.ordinal()].getSecondaryAllele();
|
||||||
genome0 = genomeTwo;
|
genome0 = genomeTwo;
|
||||||
genome2 = genomeOne;
|
genome2 = genomeOne;
|
||||||
}
|
}
|
||||||
IFlowerColour colour1 = genome0.getPrimaryColor();
|
|
||||||
IFlowerColour colour2 = genome2.getPrimaryColor();
|
IFlowerColor colour1 = genome0.getPrimaryColor();
|
||||||
|
IFlowerColor colour2 = genome2.getPrimaryColor();
|
||||||
if (colour1 != colour2) {
|
if (colour1 != colour2) {
|
||||||
for (final IColourMix mutation : BotanyCore.getFlowerRoot().getColourMixes(true)) {
|
for (IColourMix mutation : BotanyCore.getFlowerRoot().getColourMixes(true)) {
|
||||||
if (mutation.isMutation(colour1, colour2) && world.rand.nextFloat() * 100.0f < mutation.getChance()) {
|
if (mutation.isMutation(colour1, colour2) && world.rand.nextFloat() * 100.0f < mutation.getChance()) {
|
||||||
parent1[EnumFlowerChromosome.PRIMARY.ordinal()] = new Chromosome(mutation.getResult().getAllele());
|
parent1[EnumFlowerChromosome.PRIMARY.ordinal()] = new Chromosome(mutation.getResult().getAllele());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
colour1 = genome0.getSecondaryColor();
|
colour1 = genome0.getSecondaryColor();
|
||||||
colour2 = genome2.getSecondaryColor();
|
colour2 = genome2.getSecondaryColor();
|
||||||
if (colour1 != colour2) {
|
if (colour1 != colour2) {
|
||||||
for (final IColourMix mutation : BotanyCore.getFlowerRoot().getColourMixes(true)) {
|
for (IColourMix mutation : BotanyCore.getFlowerRoot().getColourMixes(true)) {
|
||||||
if (mutation.isMutation(colour1, colour2) && world.rand.nextFloat() * 100.0f < mutation.getChance()) {
|
if (mutation.isMutation(colour1, colour2) && world.rand.nextFloat() * 100.0f < mutation.getChance()) {
|
||||||
parent1[EnumFlowerChromosome.SECONDARY.ordinal()] = new Chromosome(mutation.getResult().getAllele());
|
parent1[EnumFlowerChromosome.SECONDARY.ordinal()] = new Chromosome(mutation.getResult().getAllele());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
colour1 = genome0.getStemColor();
|
colour1 = genome0.getStemColor();
|
||||||
colour2 = genome2.getStemColor();
|
colour2 = genome2.getStemColor();
|
||||||
if (colour1 != colour2) {
|
if (colour1 != colour2) {
|
||||||
for (final IColourMix mutation : BotanyCore.getFlowerRoot().getColourMixes(true)) {
|
for (IColourMix mutation : BotanyCore.getFlowerRoot().getColourMixes(true)) {
|
||||||
if (mutation.isMutation(colour1, colour2) && world.rand.nextFloat() * 100.0f < mutation.getChance()) {
|
if (mutation.isMutation(colour1, colour2) && world.rand.nextFloat() * 100.0f < mutation.getChance()) {
|
||||||
parent1[EnumFlowerChromosome.STEM.ordinal()] = new Chromosome(mutation.getResult().getAllele());
|
parent1[EnumFlowerChromosome.STEM.ordinal()] = new Chromosome(mutation.getResult().getAllele());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IChromosome[] template = null;
|
IChromosome[] template = null;
|
||||||
for (final IFlowerMutation mutation2 : BotanyCore.getFlowerRoot().getMutations(true)) {
|
for (IFlowerMutation mutation2 : BotanyCore.getFlowerRoot().getMutations(true)) {
|
||||||
final float chance = mutation2.getChance(allele0, allele2, genome0, genome2);
|
float chance = mutation2.getChance(allele0, allele2, genome0, genome2);
|
||||||
if (chance > 0.0f && world.rand.nextFloat() * 100.0f < chance && template == null) {
|
if (chance > 0.0f && world.rand.nextFloat() * 100.0f < chance && template == null) {
|
||||||
template = BotanyCore.getFlowerRoot().templateAsChromosomes(mutation2.getTemplate());
|
template = BotanyCore.getFlowerRoot().templateAsChromosomes(mutation2.getTemplate());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (template != null) {
|
if (template != null) {
|
||||||
parent1 = template;
|
parent1 = template;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,46 +1,40 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.genetics;
|
package binnie.botany.genetics;
|
||||||
|
|
||||||
import forestry.api.core.EnumTemperature;
|
|
||||||
import binnie.botany.api.EnumMoisture;
|
|
||||||
import binnie.Binnie;
|
import binnie.Binnie;
|
||||||
import binnie.botany.api.EnumAcidity;
|
import binnie.botany.api.EnumAcidity;
|
||||||
import forestry.api.genetics.IAlleleFloat;
|
|
||||||
import forestry.api.genetics.IAlleleTolerance;
|
|
||||||
import forestry.api.genetics.EnumTolerance;
|
|
||||||
import binnie.botany.api.IFlowerType;
|
|
||||||
import forestry.api.genetics.IAlleleInteger;
|
|
||||||
import forestry.api.genetics.IChromosomeType;
|
|
||||||
import binnie.botany.core.BotanyCore;
|
|
||||||
import forestry.api.genetics.ISpeciesRoot;
|
|
||||||
import binnie.botany.api.EnumFlowerChromosome;
|
import binnie.botany.api.EnumFlowerChromosome;
|
||||||
|
import binnie.botany.api.EnumMoisture;
|
||||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||||
import forestry.api.genetics.IChromosome;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import binnie.botany.api.IFlowerGenome;
|
import binnie.botany.api.IFlowerGenome;
|
||||||
|
import binnie.botany.api.IFlowerType;
|
||||||
|
import binnie.botany.core.BotanyCore;
|
||||||
|
import forestry.api.core.EnumTemperature;
|
||||||
|
import forestry.api.genetics.EnumTolerance;
|
||||||
|
import forestry.api.genetics.IAlleleFloat;
|
||||||
|
import forestry.api.genetics.IAlleleInteger;
|
||||||
|
import forestry.api.genetics.IAlleleTolerance;
|
||||||
|
import forestry.api.genetics.IChromosome;
|
||||||
|
import forestry.api.genetics.ISpeciesRoot;
|
||||||
import forestry.core.genetics.Genome;
|
import forestry.core.genetics.Genome;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
public class FlowerGenome extends Genome implements IFlowerGenome
|
public class FlowerGenome extends Genome implements IFlowerGenome {
|
||||||
{
|
public FlowerGenome(NBTTagCompound nbttagcompound) {
|
||||||
public FlowerGenome(final NBTTagCompound nbttagcompound) {
|
|
||||||
super(nbttagcompound);
|
super(nbttagcompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FlowerGenome(final IChromosome[] chromosomes) {
|
public FlowerGenome(IChromosome[] chromosomes) {
|
||||||
super(chromosomes);
|
super(chromosomes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IAlleleFlowerSpecies getPrimary() {
|
public IAlleleFlowerSpecies getPrimary() {
|
||||||
return (IAlleleFlowerSpecies) this.getChromosomes()[EnumFlowerChromosome.SPECIES.ordinal()].getPrimaryAllele();
|
return (IAlleleFlowerSpecies) getChromosomes()[EnumFlowerChromosome.SPECIES.ordinal()].getPrimaryAllele();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IAlleleFlowerSpecies getSecondary() {
|
public IAlleleFlowerSpecies getSecondary() {
|
||||||
return (IAlleleFlowerSpecies) this.getChromosomes()[EnumFlowerChromosome.SPECIES.ordinal()].getSecondaryAllele();
|
return (IAlleleFlowerSpecies) getChromosomes()[EnumFlowerChromosome.SPECIES.ordinal()].getSecondaryAllele();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -50,85 +44,87 @@ public class FlowerGenome extends Genome implements IFlowerGenome
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFlowerColor getPrimaryColor() {
|
public EnumFlowerColor getPrimaryColor() {
|
||||||
return ((AlleleColor) this.getActiveAllele(EnumFlowerChromosome.PRIMARY)).getColor();
|
return ((AlleleColor) getActiveAllele(EnumFlowerChromosome.PRIMARY)).getColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFlowerColor getSecondaryColor() {
|
public EnumFlowerColor getSecondaryColor() {
|
||||||
return ((AlleleColor) this.getActiveAllele(EnumFlowerChromosome.SECONDARY)).getColor();
|
return ((AlleleColor) getActiveAllele(EnumFlowerChromosome.SECONDARY)).getColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFlowerColor getStemColor() {
|
public EnumFlowerColor getStemColor() {
|
||||||
return ((AlleleColor) this.getActiveAllele(EnumFlowerChromosome.STEM)).getColor();
|
return ((AlleleColor) getActiveAllele(EnumFlowerChromosome.STEM)).getColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFertility() {
|
public int getFertility() {
|
||||||
return ((IAlleleInteger) this.getActiveAllele(EnumFlowerChromosome.FERTILITY)).getValue();
|
return ((IAlleleInteger) getActiveAllele(EnumFlowerChromosome.FERTILITY)).getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLifespan() {
|
public int getLifespan() {
|
||||||
return ((IAlleleInteger) this.getActiveAllele(EnumFlowerChromosome.LIFESPAN)).getValue() / 5;
|
return ((IAlleleInteger) getActiveAllele(EnumFlowerChromosome.LIFESPAN)).getValue() / 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFlowerType getType() {
|
public IFlowerType getType() {
|
||||||
return this.getPrimary().getType();
|
return getPrimary().getType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumTolerance getToleranceTemperature() {
|
public EnumTolerance getToleranceTemperature() {
|
||||||
return ((IAlleleTolerance) this.getActiveAllele(EnumFlowerChromosome.TEMPERATURE_TOLERANCE)).getValue();
|
return ((IAlleleTolerance) getActiveAllele(EnumFlowerChromosome.TEMPERATURE_TOLERANCE)).getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumTolerance getToleranceMoisture() {
|
public EnumTolerance getToleranceMoisture() {
|
||||||
return ((IAlleleTolerance) this.getActiveAllele(EnumFlowerChromosome.HUMIDITY_TOLERANCE)).getValue();
|
return ((IAlleleTolerance) getActiveAllele(EnumFlowerChromosome.HUMIDITY_TOLERANCE)).getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumTolerance getTolerancePH() {
|
public EnumTolerance getTolerancePH() {
|
||||||
return ((IAlleleTolerance) this.getActiveAllele(EnumFlowerChromosome.PH_TOLERANCE)).getValue();
|
return ((IAlleleTolerance) getActiveAllele(EnumFlowerChromosome.PH_TOLERANCE)).getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(final NBTTagCompound nbttagcompound) {
|
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||||
super.readFromNBT(nbttagcompound);
|
super.readFromNBT(nbttagcompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getAgeChance() {
|
public float getAgeChance() {
|
||||||
return 1.0f * (float) Math.sqrt(2.0f / this.getLifespan());
|
return 1.0f * (float) Math.sqrt(2.0f / getLifespan());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getSappiness() {
|
public float getSappiness() {
|
||||||
return ((IAlleleFloat) this.getActiveAllele(EnumFlowerChromosome.SAPPINESS)).getValue();
|
return ((IAlleleFloat) getActiveAllele(EnumFlowerChromosome.SAPPINESS)).getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canTolerate(final EnumAcidity ePH) {
|
public boolean canTolerate(EnumAcidity ePH) {
|
||||||
final int pH = ePH.ordinal();
|
int pH = ePH.ordinal();
|
||||||
final int[] pHTol = Binnie.Genetics.getTolerance(this.getTolerancePH());
|
int[] pHTol = Binnie.Genetics.getTolerance(getTolerancePH());
|
||||||
final int fPH = this.getPrimary().getPH().ordinal();
|
int fPH = getPrimary().getPH().ordinal();
|
||||||
return pH >= fPH + pHTol[0] && pH <= fPH + pHTol[1];
|
return pH >= fPH + pHTol[0] && pH <= fPH + pHTol[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canTolerate(final EnumMoisture eMoisture) {
|
public boolean canTolerate(EnumMoisture eMoisture) {
|
||||||
final int moisture = eMoisture.ordinal();
|
int moisture = eMoisture.ordinal();
|
||||||
final int[] moistTol = Binnie.Genetics.getTolerance(this.getToleranceMoisture());
|
int[] moistTol = Binnie.Genetics.getTolerance(getToleranceMoisture());
|
||||||
final int fMoisture = this.getPrimary().getMoisture().ordinal();
|
int fMoisture = getPrimary().getMoisture().ordinal();
|
||||||
return moisture >= fMoisture + moistTol[0] && moisture <= fMoisture + moistTol[1];
|
return moisture >= fMoisture + moistTol[0]
|
||||||
|
&& moisture <= fMoisture + moistTol[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canTolerate(final EnumTemperature eTemp) {
|
public boolean canTolerate(EnumTemperature eTemp) {
|
||||||
final int temp = eTemp.ordinal();
|
int temp = eTemp.ordinal();
|
||||||
final int[] tempTol = Binnie.Genetics.getTolerance(this.getToleranceTemperature());
|
int[] tempTol = Binnie.Genetics.getTolerance(getToleranceTemperature());
|
||||||
final int fTemp = this.getPrimary().getTemperature().ordinal();
|
int fTemp = getPrimary().getTemperature().ordinal();
|
||||||
return temp >= fTemp + tempTol[0] && temp <= fTemp + tempTol[1];
|
return temp >= fTemp + tempTol[0]
|
||||||
|
&& temp <= fTemp + tempTol[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,80 +1,62 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.genetics;
|
package binnie.botany.genetics;
|
||||||
|
|
||||||
import forestry.api.genetics.ISpeciesType;
|
|
||||||
import binnie.botany.api.EnumFlowerChromosome;
|
|
||||||
import forestry.api.genetics.IChromosomeType;
|
|
||||||
|
|
||||||
import net.minecraft.world.WorldSavedData;
|
|
||||||
|
|
||||||
import binnie.botany.api.IBotanistTracker;
|
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
|
||||||
|
|
||||||
import forestry.api.genetics.IMutation;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import binnie.botany.api.IFlowerGenome;
|
|
||||||
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
|
|
||||||
import binnie.botany.Botany;
|
import binnie.botany.Botany;
|
||||||
import forestry.api.genetics.IIndividual;
|
import binnie.botany.api.EnumFlowerChromosome;
|
||||||
import binnie.botany.api.EnumFlowerStage;
|
import binnie.botany.api.EnumFlowerStage;
|
||||||
|
|
||||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||||
import forestry.api.genetics.IAllele;
|
import binnie.botany.api.IBotanistTracker;
|
||||||
import forestry.api.genetics.AlleleManager;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import binnie.botany.api.IColourMix;
|
import binnie.botany.api.IColourMix;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import binnie.botany.api.IFlowerMutation;
|
|
||||||
import binnie.botany.api.IFlower;
|
import binnie.botany.api.IFlower;
|
||||||
|
import binnie.botany.api.IFlowerGenome;
|
||||||
|
import binnie.botany.api.IFlowerMutation;
|
||||||
|
import binnie.botany.api.IFlowerRoot;
|
||||||
|
import com.mojang.authlib.GameProfile;
|
||||||
|
import forestry.api.genetics.AlleleManager;
|
||||||
|
import forestry.api.genetics.IAllele;
|
||||||
|
import forestry.api.genetics.IChromosomeType;
|
||||||
|
import forestry.api.genetics.IIndividual;
|
||||||
|
import forestry.api.genetics.IMutation;
|
||||||
|
import forestry.api.genetics.ISpeciesType;
|
||||||
|
import forestry.core.genetics.SpeciesRoot;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
import binnie.botany.api.IFlowerRoot;
|
public class FlowerHelper extends SpeciesRoot implements IFlowerRoot {
|
||||||
import forestry.core.genetics.SpeciesRoot;
|
public static int flowerSpeciesCount = -1;
|
||||||
|
public static ArrayList<IFlower> flowerTemplates = new ArrayList<>();
|
||||||
|
|
||||||
public class FlowerHelper extends SpeciesRoot implements IFlowerRoot
|
protected static String UID = "rootFlowers";
|
||||||
{
|
|
||||||
public static int flowerSpeciesCount;
|
private static ArrayList<IFlowerMutation> flowerMutations = new ArrayList<>();
|
||||||
static final String UID = "rootFlowers";
|
private static ArrayList<IColourMix> colourMixes = new ArrayList<>();
|
||||||
public static ArrayList<IFlower> flowerTemplates;
|
|
||||||
private static ArrayList<IFlowerMutation> flowerMutations;
|
protected Map<ItemStack, IFlower> conversions;
|
||||||
Map<ItemStack, IFlower> conversions;
|
|
||||||
private static ArrayList<IColourMix> colourMixes;
|
|
||||||
|
|
||||||
public FlowerHelper() {
|
public FlowerHelper() {
|
||||||
this.conversions = new HashMap<ItemStack, IFlower>();
|
conversions = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUID() {
|
public String getUID() {
|
||||||
return "rootFlowers";
|
return UID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSpeciesCount() {
|
public int getSpeciesCount() {
|
||||||
if (FlowerHelper.flowerSpeciesCount < 0) {
|
if (FlowerHelper.flowerSpeciesCount < 0) {
|
||||||
FlowerHelper.flowerSpeciesCount = 0;
|
FlowerHelper.flowerSpeciesCount = 0;
|
||||||
for (final Map.Entry<String, IAllele> entry : AlleleManager.alleleRegistry.getRegisteredAlleles().entrySet()) {
|
for (Map.Entry<String, IAllele> entry : AlleleManager.alleleRegistry.getRegisteredAlleles().entrySet()) {
|
||||||
if (entry.getValue() instanceof IAlleleFlowerSpecies && ((IAlleleFlowerSpecies) entry.getValue()).isCounted()) {
|
if (entry.getValue() instanceof IAlleleFlowerSpecies && ((IAlleleFlowerSpecies) entry.getValue()).isCounted()) {
|
||||||
++FlowerHelper.flowerSpeciesCount;
|
FlowerHelper.flowerSpeciesCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -82,78 +64,95 @@ public class FlowerHelper extends SpeciesRoot implements IFlowerRoot
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isMember(final ItemStack stack) {
|
public boolean isMember(ItemStack stack) {
|
||||||
return stack != null && this.getStageType(stack) != EnumFlowerStage.NONE;
|
return stack != null
|
||||||
|
&& getStageType(stack) != EnumFlowerStage.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isMember(final ItemStack stack, final int type) {
|
public boolean isMember(ItemStack stack, int type) {
|
||||||
return this.getStageType(stack).ordinal() == type;
|
return getStageType(stack).ordinal() == type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isMember(final IIndividual individual) {
|
public boolean isMember(IIndividual individual) {
|
||||||
return individual instanceof IFlower;
|
return individual instanceof IFlower;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getMemberStack(final IIndividual flower, final int type) {
|
public ItemStack getMemberStack(IIndividual flower, int type) {
|
||||||
if (!this.isMember(flower)) {
|
if (!isMember(flower)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Item flowerItem = Botany.flowerItem;
|
Item flowerItem = Botany.flowerItem;
|
||||||
if (type == EnumFlowerStage.SEED.ordinal()) {
|
if (type == EnumFlowerStage.SEED.ordinal()) {
|
||||||
flowerItem = Botany.seed;
|
flowerItem = Botany.seed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == EnumFlowerStage.POLLEN.ordinal()) {
|
if (type == EnumFlowerStage.POLLEN.ordinal()) {
|
||||||
flowerItem = Botany.pollen;
|
flowerItem = Botany.pollen;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flowerItem != Botany.flowerItem) {
|
if (flowerItem != Botany.flowerItem) {
|
||||||
((IFlower) flower).setAge(0);
|
((IFlower) flower).setAge(0);
|
||||||
}
|
}
|
||||||
final NBTTagCompound nbttagcompound = new NBTTagCompound();
|
|
||||||
|
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||||
flower.writeToNBT(nbttagcompound);
|
flower.writeToNBT(nbttagcompound);
|
||||||
final ItemStack flowerStack = new ItemStack(flowerItem);
|
ItemStack flowerStack = new ItemStack(flowerItem);
|
||||||
flowerStack.setTagCompound(nbttagcompound);
|
flowerStack.setTagCompound(nbttagcompound);
|
||||||
return flowerStack;
|
return flowerStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFlowerStage getStageType(final ItemStack stack) {
|
public EnumFlowerStage getStageType(ItemStack stack) {
|
||||||
return (stack == null) ? EnumFlowerStage.NONE : ((stack.getItem() == Botany.flowerItem) ? EnumFlowerStage.FLOWER : ((stack.getItem() == Botany.pollen) ? EnumFlowerStage.POLLEN : ((stack.getItem() == Botany.seed) ? EnumFlowerStage.SEED : EnumFlowerStage.NONE)));
|
if (stack == null) {
|
||||||
|
return EnumFlowerStage.NONE;
|
||||||
|
}
|
||||||
|
if (stack.getItem() == Botany.flowerItem) {
|
||||||
|
return EnumFlowerStage.FLOWER;
|
||||||
|
}
|
||||||
|
if (stack.getItem() == Botany.pollen) {
|
||||||
|
return EnumFlowerStage.POLLEN;
|
||||||
|
}
|
||||||
|
if (stack.getItem() == Botany.seed) {
|
||||||
|
return EnumFlowerStage.SEED;
|
||||||
|
}
|
||||||
|
return EnumFlowerStage.NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFlower getMember(final ItemStack stack) {
|
public IFlower getMember(ItemStack stack) {
|
||||||
if (!this.isMember(stack)) {
|
if (!isMember(stack)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new Flower(stack.getTagCompound());
|
return new Flower(stack.getTagCompound());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFlower getFlower(final World world, final IFlowerGenome genome) {
|
public IFlower getFlower(World world, IFlowerGenome genome) {
|
||||||
return new Flower(genome, 2);
|
return new Flower(genome, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFlowerGenome templateAsGenome(final IAllele[] template) {
|
public IFlowerGenome templateAsGenome(IAllele[] template) {
|
||||||
return new FlowerGenome(this.templateAsChromosomes(template));
|
return new FlowerGenome(templateAsChromosomes(template));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFlowerGenome templateAsGenome(final IAllele[] templateActive, final IAllele[] templateInactive) {
|
public IFlowerGenome templateAsGenome(IAllele[] templateActive, IAllele[] templateInactive) {
|
||||||
return new FlowerGenome(this.templateAsChromosomes(templateActive, templateInactive));
|
return new FlowerGenome(templateAsChromosomes(templateActive, templateInactive));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFlower templateAsIndividual(final IAllele[] template) {
|
public IFlower templateAsIndividual(IAllele[] template) {
|
||||||
return new Flower(this.templateAsGenome(template), 2);
|
return new Flower(templateAsGenome(template), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFlower templateAsIndividual(final IAllele[] templateActive, final IAllele[] templateInactive) {
|
public IFlower templateAsIndividual(IAllele[] templateActive, IAllele[] templateInactive) {
|
||||||
return new Flower(this.templateAsGenome(templateActive, templateInactive), 2);
|
return new Flower(templateAsGenome(templateActive, templateInactive), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -162,21 +161,21 @@ public class FlowerHelper extends SpeciesRoot implements IFlowerRoot
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerTemplate(final IAllele[] template) {
|
public void registerTemplate(IAllele[] template) {
|
||||||
this.registerTemplate(template[0].getUID(), template);
|
registerTemplate(template[0].getUID(), template);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerTemplate(final String identifier, final IAllele[] template) {
|
public void registerTemplate(String identifier, IAllele[] template) {
|
||||||
FlowerHelper.flowerTemplates.add(new Flower(this.templateAsGenome(template), 2));
|
FlowerHelper.flowerTemplates.add(new Flower(templateAsGenome(template), 2));
|
||||||
if (!this.speciesTemplates.containsKey(identifier)) {
|
if (!speciesTemplates.containsKey(identifier)) {
|
||||||
this.speciesTemplates.put(identifier, template);
|
speciesTemplates.put(identifier, template);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IAllele[] getTemplate(final String identifier) {
|
public IAllele[] getTemplate(String identifier) {
|
||||||
return this.speciesTemplates.get(identifier);
|
return speciesTemplates.get(identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -185,12 +184,12 @@ public class FlowerHelper extends SpeciesRoot implements IFlowerRoot
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IAllele[] getRandomTemplate(final Random rand) {
|
public IAllele[] getRandomTemplate(Random rand) {
|
||||||
return this.speciesTemplates.values().toArray(new IAllele[0][])[rand.nextInt(this.speciesTemplates.values().size())];
|
return speciesTemplates.values().toArray(new IAllele[0][])[rand.nextInt(speciesTemplates.values().size())];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<IFlowerMutation> getMutations(final boolean shuffle) {
|
public Collection<IFlowerMutation> getMutations(boolean shuffle) {
|
||||||
if (shuffle) {
|
if (shuffle) {
|
||||||
Collections.shuffle(FlowerHelper.flowerMutations);
|
Collections.shuffle(FlowerHelper.flowerMutations);
|
||||||
}
|
}
|
||||||
@@ -198,22 +197,18 @@ public class FlowerHelper extends SpeciesRoot implements IFlowerRoot
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerMutation(final IMutation mutation) {
|
public void registerMutation(IMutation mutation) {
|
||||||
if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getTemplate()[0].getUID())) {
|
if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getTemplate()[0].getUID()) ||
|
||||||
return;
|
AlleleManager.alleleRegistry.isBlacklisted(mutation.getAllele0().getUID()) ||
|
||||||
}
|
AlleleManager.alleleRegistry.isBlacklisted(mutation.getAllele1().getUID())) {
|
||||||
if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getAllele0().getUID())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getAllele1().getUID())) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FlowerHelper.flowerMutations.add((IFlowerMutation) mutation);
|
FlowerHelper.flowerMutations.add((IFlowerMutation) mutation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBotanistTracker getBreedingTracker(final World world, final GameProfile player) {
|
public IBotanistTracker getBreedingTracker(World world, GameProfile player) {
|
||||||
final String filename = "BotanistTracker." + ((player == null) ? "common" : player.getId());
|
String filename = "BotanistTracker." + ((player == null) ? "common" : player.getId());
|
||||||
BotanistTracker tracker = (BotanistTracker) world.loadItemData(BotanistTracker.class, filename);
|
BotanistTracker tracker = (BotanistTracker) world.loadItemData(BotanistTracker.class, filename);
|
||||||
if (tracker == null) {
|
if (tracker == null) {
|
||||||
tracker = new BotanistTracker(filename);
|
tracker = new BotanistTracker(filename);
|
||||||
@@ -223,7 +218,7 @@ public class FlowerHelper extends SpeciesRoot implements IFlowerRoot
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIndividual getMember(final NBTTagCompound compound) {
|
public IIndividual getMember(NBTTagCompound compound) {
|
||||||
return new Flower(compound);
|
return new Flower(compound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,15 +238,15 @@ public class FlowerHelper extends SpeciesRoot implements IFlowerRoot
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addConversion(final ItemStack itemstack, final IAllele[] template) {
|
public void addConversion(ItemStack stack, IAllele[] template) {
|
||||||
final IFlower flower = this.getFlower(null, this.templateAsGenome(template));
|
IFlower flower = getFlower(null, templateAsGenome(template));
|
||||||
this.conversions.put(itemstack, flower);
|
conversions.put(stack, flower);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IFlower getConversion(final ItemStack itemstack) {
|
public IFlower getConversion(ItemStack stack) {
|
||||||
for (final Map.Entry<ItemStack, IFlower> entry : this.conversions.entrySet()) {
|
for (Map.Entry<ItemStack, IFlower> entry : conversions.entrySet()) {
|
||||||
if (entry.getKey().isItemEqual(itemstack)) {
|
if (entry.getKey().isItemEqual(stack)) {
|
||||||
return (IFlower) entry.getValue().copy();
|
return (IFlower) entry.getValue().copy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -259,28 +254,21 @@ public class FlowerHelper extends SpeciesRoot implements IFlowerRoot
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerColourMix(final IColourMix colourMix) {
|
public void registerColourMix(IColourMix colorMix) {
|
||||||
FlowerHelper.colourMixes.add(colourMix);
|
FlowerHelper.colourMixes.add(colorMix);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<IColourMix> getColourMixes(final boolean shuffle) {
|
public Collection<IColourMix> getColourMixes(boolean shuffle) {
|
||||||
if (shuffle) {
|
if (shuffle) {
|
||||||
Collections.shuffle(FlowerHelper.colourMixes);
|
Collections.shuffle(FlowerHelper.colourMixes);
|
||||||
}
|
}
|
||||||
return FlowerHelper.colourMixes;
|
return FlowerHelper.colourMixes;
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
|
||||||
FlowerHelper.flowerSpeciesCount = -1;
|
|
||||||
FlowerHelper.flowerTemplates = new ArrayList<IFlower>();
|
|
||||||
FlowerHelper.flowerMutations = new ArrayList<IFlowerMutation>();
|
|
||||||
FlowerHelper.colourMixes = new ArrayList<IColourMix>();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ??
|
// ??
|
||||||
@Override
|
@Override
|
||||||
public ISpeciesType getType(ItemStack itemstack) {
|
public ISpeciesType getType(ItemStack stack) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,27 +1,22 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.genetics;
|
package binnie.botany.genetics;
|
||||||
|
|
||||||
|
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||||
|
import binnie.botany.api.IFlowerMutation;
|
||||||
|
import binnie.botany.core.BotanyCore;
|
||||||
|
import forestry.api.genetics.IAllele;
|
||||||
|
import forestry.api.genetics.IGenome;
|
||||||
|
import forestry.api.genetics.ISpeciesRoot;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import binnie.botany.core.BotanyCore;
|
public class FlowerMutation implements IFlowerMutation {
|
||||||
import forestry.api.genetics.ISpeciesRoot;
|
protected IAlleleFlowerSpecies allele0;
|
||||||
import forestry.api.genetics.IGenome;
|
protected IAlleleFlowerSpecies allele1;
|
||||||
import forestry.api.genetics.IAllele;
|
protected IAllele[] template;
|
||||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
protected int chance;
|
||||||
import binnie.botany.api.IFlowerMutation;
|
|
||||||
|
|
||||||
public class FlowerMutation implements IFlowerMutation
|
FlowerMutation(IAlleleFlowerSpecies allele0, IAlleleFlowerSpecies allele1, IAllele[] template, int chance) {
|
||||||
{
|
|
||||||
IAlleleFlowerSpecies allele0;
|
|
||||||
IAlleleFlowerSpecies allele1;
|
|
||||||
IAllele[] template;
|
|
||||||
int chance;
|
|
||||||
|
|
||||||
FlowerMutation(final IAlleleFlowerSpecies allele0, final IAlleleFlowerSpecies allele1, final IAllele[] template, final int chance) {
|
|
||||||
this.allele0 = allele0;
|
this.allele0 = allele0;
|
||||||
this.allele1 = allele1;
|
this.allele1 = allele1;
|
||||||
this.template = template;
|
this.template = template;
|
||||||
@@ -30,32 +25,33 @@ public class FlowerMutation implements IFlowerMutation
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IAlleleFlowerSpecies getAllele0() {
|
public IAlleleFlowerSpecies getAllele0() {
|
||||||
return this.allele0;
|
return allele0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IAlleleFlowerSpecies getAllele1() {
|
public IAlleleFlowerSpecies getAllele1() {
|
||||||
return this.allele1;
|
return allele1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IAllele[] getTemplate() {
|
public IAllele[] getTemplate() {
|
||||||
return this.template;
|
return template;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getBaseChance() {
|
public float getBaseChance() {
|
||||||
return this.chance;
|
return chance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPartner(final IAllele allele) {
|
public boolean isPartner(IAllele allele) {
|
||||||
return allele.getUID().equals(this.allele0.getUID()) || allele.getUID().equals(this.allele1.getUID());
|
return allele.getUID().equals(allele0.getUID())
|
||||||
|
|| allele.getUID().equals(allele1.getUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IAllele getPartner(final IAllele allele) {
|
public IAllele getPartner(IAllele allele) {
|
||||||
return allele.getUID().equals(this.allele0.getUID()) ? this.allele1 : this.allele0;
|
return allele.getUID().equals(allele0.getUID()) ? allele1 : allele0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -64,15 +60,15 @@ public class FlowerMutation implements IFlowerMutation
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getChance(final IAllele allele0, final IAllele allele1, final IGenome genome0, final IGenome genome1) {
|
public float getChance(IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
|
||||||
if (allele0 == null || allele1 == null) {
|
if (allele0 == null || allele1 == null) {
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
if (this.allele0.getUID().equals(allele0.getUID()) && this.allele1.getUID().equals(allele1.getUID())) {
|
if (this.allele0.getUID().equals(allele0.getUID()) && this.allele1.getUID().equals(allele1.getUID())) {
|
||||||
return this.getBaseChance();
|
return getBaseChance();
|
||||||
}
|
}
|
||||||
if (this.allele1.getUID().equals(allele0.getUID()) && this.allele0.getUID().equals(allele1.getUID())) {
|
if (this.allele1.getUID().equals(allele0.getUID()) && this.allele0.getUID().equals(allele1.getUID())) {
|
||||||
return this.getBaseChance();
|
return getBaseChance();
|
||||||
}
|
}
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
@@ -84,6 +80,6 @@ public class FlowerMutation implements IFlowerMutation
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<String> getSpecialConditions() {
|
public Collection<String> getSpecialConditions() {
|
||||||
return new ArrayList<String>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -1,29 +1,26 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.genetics;
|
package binnie.botany.genetics;
|
||||||
|
|
||||||
import forestry.api.genetics.AlleleManager;
|
|
||||||
import binnie.botany.api.EnumFlowerChromosome;
|
import binnie.botany.api.EnumFlowerChromosome;
|
||||||
|
import binnie.genetics.genetics.AlleleHelper;
|
||||||
|
import forestry.api.genetics.EnumTolerance;
|
||||||
import forestry.api.genetics.IAllele;
|
import forestry.api.genetics.IAllele;
|
||||||
|
import forestry.core.genetics.alleles.EnumAllele;
|
||||||
|
|
||||||
public class FlowerTemplates
|
public class FlowerTemplates {
|
||||||
{
|
|
||||||
public static IAllele[] getDefaultTemplate() {
|
public static IAllele[] getDefaultTemplate() {
|
||||||
final IAllele[] alleles = new IAllele[EnumFlowerChromosome.values().length];
|
IAllele[] alleles = new IAllele[EnumFlowerChromosome.values().length];
|
||||||
alleles[EnumFlowerChromosome.SPECIES.ordinal()] = FlowerSpecies.Poppy;
|
alleles[EnumFlowerChromosome.SPECIES.ordinal()] = FlowerSpecies.POPPY;
|
||||||
alleles[EnumFlowerChromosome.PRIMARY.ordinal()] = EnumFlowerColor.Red.getAllele();
|
alleles[EnumFlowerChromosome.PRIMARY.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.RED);
|
||||||
alleles[EnumFlowerChromosome.SECONDARY.ordinal()] = EnumFlowerColor.Red.getAllele();
|
alleles[EnumFlowerChromosome.SECONDARY.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.RED);
|
||||||
alleles[EnumFlowerChromosome.FERTILITY.ordinal()] = AlleleManager.alleleRegistry.getAllele("forestry.fertilityNormal");
|
alleles[EnumFlowerChromosome.FERTILITY.ordinal()] = AlleleHelper.getAllele(EnumAllele.Fertility.NORMAL);
|
||||||
alleles[EnumFlowerChromosome.TERRITORY.ordinal()] = AlleleManager.alleleRegistry.getAllele("forestry.territoryDefault");
|
alleles[EnumFlowerChromosome.TERRITORY.ordinal()] = AlleleHelper.getAllele(EnumAllele.Territory.AVERAGE);
|
||||||
alleles[EnumFlowerChromosome.EFFECT.ordinal()] = ModuleGenetics.alleleEffectNone;
|
alleles[EnumFlowerChromosome.EFFECT.ordinal()] = ModuleGenetics.alleleEffectNone;
|
||||||
alleles[EnumFlowerChromosome.LIFESPAN.ordinal()] = AlleleManager.alleleRegistry.getAllele("forestry.lifespanNormal");
|
alleles[EnumFlowerChromosome.LIFESPAN.ordinal()] = AlleleHelper.getAllele(EnumAllele.Lifespan.NORMAL);
|
||||||
alleles[EnumFlowerChromosome.TEMPERATURE_TOLERANCE.ordinal()] = AlleleManager.alleleRegistry.getAllele("forestry.toleranceNone");
|
alleles[EnumFlowerChromosome.TEMPERATURE_TOLERANCE.ordinal()] = AlleleHelper.getAllele(EnumTolerance.NONE);
|
||||||
alleles[EnumFlowerChromosome.HUMIDITY_TOLERANCE.ordinal()] = AlleleManager.alleleRegistry.getAllele("forestry.toleranceNone");
|
alleles[EnumFlowerChromosome.HUMIDITY_TOLERANCE.ordinal()] = AlleleHelper.getAllele(EnumTolerance.NONE);
|
||||||
alleles[EnumFlowerChromosome.PH_TOLERANCE.ordinal()] = AlleleManager.alleleRegistry.getAllele("forestry.toleranceNone");
|
alleles[EnumFlowerChromosome.PH_TOLERANCE.ordinal()] = AlleleHelper.getAllele(EnumTolerance.NONE);
|
||||||
alleles[EnumFlowerChromosome.SAPPINESS.ordinal()] = AlleleManager.alleleRegistry.getAllele("forestry.sappinessAverage");
|
alleles[EnumFlowerChromosome.SAPPINESS.ordinal()] = AlleleHelper.getAllele(EnumAllele.Sappiness.AVERAGE);
|
||||||
alleles[EnumFlowerChromosome.STEM.ordinal()] = EnumFlowerColor.Green.getAllele();
|
alleles[EnumFlowerChromosome.STEM.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.GREEN);
|
||||||
return alleles;
|
return alleles;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,72 +1,67 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.genetics;
|
package binnie.botany.genetics;
|
||||||
|
|
||||||
import binnie.botany.core.BotanyGUI;
|
import binnie.botany.Botany;
|
||||||
import net.minecraft.world.World;
|
|
||||||
import binnie.botany.CreativeTabBotany;
|
import binnie.botany.CreativeTabBotany;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import binnie.botany.core.BotanyGUI;
|
||||||
import java.util.List;
|
import binnie.core.util.I18N;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import binnie.botany.Botany;
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
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.IIcon;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class ItemDictionary extends Item
|
import java.util.List;
|
||||||
{
|
|
||||||
IIcon iconMaster;
|
|
||||||
|
|
||||||
@Override
|
public class ItemDictionary extends Item {
|
||||||
@SideOnly(Side.CLIENT)
|
protected IIcon iconMaster;
|
||||||
public void registerIcons(final IIconRegister register) {
|
|
||||||
this.itemIcon = Botany.proxy.getIcon(register, "botanistDatabase");
|
|
||||||
this.iconMaster = Botany.proxy.getIcon(register, "masterBotanistDatabase");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public IIcon getIconFromDamage(final int par1) {
|
|
||||||
return (par1 == 0) ? this.itemIcon : this.iconMaster;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void addInformation(final ItemStack par1ItemStack, final EntityPlayer par2EntityPlayer, final List par3List, final boolean par4) {
|
|
||||||
super.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void getSubItems(final Item par1, final CreativeTabs par2CreativeTabs, final List par3List) {
|
|
||||||
super.getSubItems(par1, par2CreativeTabs, par3List);
|
|
||||||
par3List.add(new ItemStack(par1, 1, 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemDictionary() {
|
public ItemDictionary() {
|
||||||
this.setCreativeTab(CreativeTabBotany.instance);
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
this.setUnlocalizedName("database");
|
setUnlocalizedName("database");
|
||||||
this.setMaxStackSize(1);
|
setMaxStackSize(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack onItemRightClick(final ItemStack itemstack, final World world, final EntityPlayer player) {
|
@SideOnly(Side.CLIENT)
|
||||||
if (itemstack.getItemDamage() == 0) {
|
public void registerIcons(IIconRegister register) {
|
||||||
Botany.proxy.openGui(BotanyGUI.Database, player, (int) player.posX, (int) player.posY, (int) player.posZ);
|
itemIcon = Botany.proxy.getIcon(register, "botanistDatabase");
|
||||||
}
|
iconMaster = Botany.proxy.getIcon(register, "masterBotanistDatabase");
|
||||||
else {
|
|
||||||
Botany.proxy.openGui(BotanyGUI.DatabaseNEI, player, (int) player.posX, (int) player.posY, (int) player.posZ);
|
|
||||||
}
|
|
||||||
return itemstack;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getItemStackDisplayName(final ItemStack i) {
|
@SideOnly(Side.CLIENT)
|
||||||
return (i.getItemDamage() == 0) ? "Botanist Database" : "Master Botanist Database";
|
public IIcon getIconFromDamage(int damage) {
|
||||||
|
return (damage == 0) ? itemIcon : iconMaster;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||||
|
super.addInformation(stack, player, tooltip, advanced);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||||
|
super.getSubItems(item, tab, list);
|
||||||
|
list.add(new ItemStack(item, 1, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||||
|
BotanyGUI guiId = (stack.getItemDamage() == 0) ? BotanyGUI.Database : BotanyGUI.DatabaseNEI;
|
||||||
|
Botany.proxy.openGui(guiId, player, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||||
|
return stack;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getItemStackDisplayName(ItemStack stack) {
|
||||||
|
return (stack.getItemDamage() == 0)
|
||||||
|
? I18N.localise("botany.item.database.0.name")
|
||||||
|
: I18N.localise("botany.item.database.1.name");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.genetics;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import binnie.botany.CreativeTabBotany;
|
|
||||||
import net.minecraft.util.IIcon;
|
|
||||||
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.Item;
|
|
||||||
|
|
||||||
public class ItemEncyclopedia extends Item
|
|
||||||
{
|
|
||||||
boolean reinforced;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void registerIcons(final IIconRegister register) {
|
|
||||||
this.itemIcon = Botany.proxy.getIcon(register, "encylopedia" + (this.reinforced ? "Iron" : ""));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public IIcon getIconFromDamage(final int par1) {
|
|
||||||
return this.itemIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemEncyclopedia(final boolean reinforced) {
|
|
||||||
this.reinforced = false;
|
|
||||||
this.reinforced = reinforced;
|
|
||||||
this.setCreativeTab(CreativeTabBotany.instance);
|
|
||||||
this.setUnlocalizedName("encylopedia" + (reinforced ? "Iron" : ""));
|
|
||||||
this.setMaxStackSize(1);
|
|
||||||
this.setMaxDamage(reinforced ? 480 : 120);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getItemStackDisplayName(final ItemStack i) {
|
|
||||||
return (this.reinforced ? "Reinforced " : "") + "Florist's Encyclopaedia";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,39 +1,28 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.genetics;
|
package binnie.botany.genetics;
|
||||||
|
|
||||||
import binnie.Binnie;
|
import binnie.Binnie;
|
||||||
import forestry.api.recipes.RecipeManagers;
|
import binnie.botany.Botany;
|
||||||
import forestry.api.apiculture.FlowerManager;
|
import binnie.botany.core.BotanyCore;
|
||||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
import binnie.botany.flower.BlockFlower;
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
import binnie.botany.flower.ItemFlower;
|
||||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
import binnie.botany.flower.ItemPollen;
|
||||||
import net.minecraft.init.Items;
|
import binnie.botany.flower.ItemSeed;
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import binnie.botany.flower.RendererBotany;
|
import binnie.botany.flower.RendererBotany;
|
||||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
|
||||||
import binnie.botany.flower.TileEntityFlower;
|
import binnie.botany.flower.TileEntityFlower;
|
||||||
import binnie.core.BinnieCore;
|
import binnie.core.BinnieCore;
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
|
||||||
import forestry.api.genetics.IAllele;
|
|
||||||
import forestry.api.genetics.ISpeciesRoot;
|
|
||||||
import binnie.botany.core.BotanyCore;
|
|
||||||
import forestry.api.genetics.AlleleManager;
|
|
||||||
import binnie.botany.flower.ItemSeed;
|
|
||||||
import binnie.botany.flower.ItemPollen;
|
|
||||||
import binnie.botany.flower.ItemFlower;
|
|
||||||
import binnie.botany.Botany;
|
|
||||||
import binnie.botany.flower.BlockFlower;
|
|
||||||
import binnie.core.IInitializable;
|
import binnie.core.IInitializable;
|
||||||
|
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||||
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
|
import forestry.api.apiculture.FlowerManager;
|
||||||
|
import forestry.api.genetics.AlleleManager;
|
||||||
|
import forestry.api.genetics.IAllele;
|
||||||
|
import forestry.api.recipes.RecipeManagers;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class ModuleGenetics implements IInitializable
|
public class ModuleGenetics implements IInitializable {
|
||||||
{
|
static AlleleEffectNone alleleEffectNone = new AlleleEffectNone();
|
||||||
static AlleleEffectNone alleleEffectNone;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preInit() {
|
public void preInit() {
|
||||||
@@ -47,38 +36,42 @@ public class ModuleGenetics implements IInitializable
|
|||||||
GameRegistry.registerBlock(Botany.flower, "flower");
|
GameRegistry.registerBlock(Botany.flower, "flower");
|
||||||
BinnieCore.proxy.registerTileEntity(TileEntityFlower.class, "botany.tile.flower", null);
|
BinnieCore.proxy.registerTileEntity(TileEntityFlower.class, "botany.tile.flower", null);
|
||||||
Botany.database = new ItemDictionary();
|
Botany.database = new ItemDictionary();
|
||||||
Botany.encyclopedia = new ItemEncyclopedia(false);
|
|
||||||
Botany.encyclopediaIron = new ItemEncyclopedia(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
for (final EnumFlowerColor color : EnumFlowerColor.values()) {
|
for (EnumFlowerColor color : EnumFlowerColor.values()) {
|
||||||
AlleleManager.alleleRegistry.registerAllele(color.getAllele());
|
AlleleManager.alleleRegistry.registerAllele(color.getAllele());
|
||||||
}
|
}
|
||||||
|
|
||||||
FlowerSpecies.setupVariants();
|
FlowerSpecies.setupVariants();
|
||||||
for (final FlowerSpecies species : FlowerSpecies.values()) {
|
for (FlowerSpecies species : FlowerSpecies.values()) {
|
||||||
AlleleManager.alleleRegistry.registerAllele(species);
|
AlleleManager.alleleRegistry.registerAllele(species);
|
||||||
BotanyCore.getFlowerRoot().registerTemplate(species.getUID(), species.getTemplate());
|
BotanyCore.getFlowerRoot().registerTemplate(species.getUID(), species.getTemplate());
|
||||||
for (final IAllele[] variant : species.getVariants()) {
|
for (IAllele[] variant : species.getVariants()) {
|
||||||
BotanyCore.getFlowerRoot().registerTemplate(variant);
|
BotanyCore.getFlowerRoot().registerTemplate(variant);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RendererBotany.renderID = RenderingRegistry.getNextAvailableRenderId();
|
RendererBotany.renderID = RenderingRegistry.getNextAvailableRenderId();
|
||||||
BinnieCore.proxy.registerBlockRenderer(new RendererBotany());
|
BinnieCore.proxy.registerBlockRenderer(new RendererBotany());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postInit() {
|
public void postInit() {
|
||||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Botany.encyclopedia), new Object[] { "fff", "fbf", "fff", 'f', new ItemStack(Blocks.red_flower, 1, 32767), 'b', Items.book }));
|
FlowerManager.flowerRegistry.registerAcceptableFlower(Botany.flower, "flowersVanilla");
|
||||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Botany.encyclopedia), new Object[] { "fff", "fbf", "fff", 'f', new ItemStack(Blocks.yellow_flower, 1, 32767), 'b', Items.book }));
|
RecipeManagers.carpenterManager.addRecipe(
|
||||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Botany.encyclopedia), new Object[] { "fff", "fbf", "fff", 'f', new ItemStack(Botany.flower, 1, 32767), 'b', Items.book }));
|
100,
|
||||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(Botany.encyclopediaIron), new Object[] { new ItemStack(Botany.encyclopedia), "ingotIron" }));
|
Binnie.Liquid.getLiquidStack("water", 2000),
|
||||||
FlowerManager.flowerRegistry.registerAcceptableFlower(Botany.flower, new String[] { "flowersVanilla" });
|
null,
|
||||||
RecipeManagers.carpenterManager.addRecipe(100, Binnie.Liquid.getLiquidStack("water", 2000), (ItemStack) null, new ItemStack(Botany.database), new Object[] { "X#X", "YEY", "RDR", '#', Blocks.glass_pane, 'X', Items.gold_ingot, 'Y', Items.gold_nugget, 'R', Items.redstone, 'D', Items.diamond, 'E', Items.emerald });
|
new ItemStack(Botany.database),
|
||||||
}
|
"X#X", "YEY", "RDR",
|
||||||
|
'#', Blocks.glass_pane,
|
||||||
static {
|
'X', Items.gold_ingot,
|
||||||
ModuleGenetics.alleleEffectNone = new AlleleEffectNone();
|
'Y', Items.gold_nugget,
|
||||||
|
'R', Items.redstone,
|
||||||
|
'D', Items.diamond,
|
||||||
|
'E', Items.emerald
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,59 +1,56 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.items;
|
package binnie.botany.items;
|
||||||
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import java.util.List;
|
|
||||||
import binnie.botany.Botany;
|
import binnie.botany.Botany;
|
||||||
|
import binnie.core.item.IItemMisc;
|
||||||
|
import binnie.core.util.I18N;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
import binnie.core.item.IItemMisc;
|
|
||||||
|
|
||||||
public enum BotanyItems implements IItemMisc
|
import java.util.List;
|
||||||
{
|
|
||||||
AshPowder("Ash Powder", "powderAsh"),
|
|
||||||
PulpPowder("Wood Pulp Powder", "powderPulp"),
|
|
||||||
MulchPowder("Mulch Powder", "powderMulch"),
|
|
||||||
SulphurPowder("Sulphur Powder", "powderSulphur"),
|
|
||||||
FertiliserPowder("Fertiliser Powder", "powderFertiliser"),
|
|
||||||
CompostPowder("Compost Powder", "powderCompost"),
|
|
||||||
Mortar("Mortar", "mortar"),
|
|
||||||
Weedkiller("Weedkiller", "weedkiller");
|
|
||||||
|
|
||||||
IIcon icon;
|
public enum BotanyItems implements IItemMisc {
|
||||||
String name;
|
AshPowder("powderAsh"),
|
||||||
String iconPath;
|
PulpPowder("powderPulp"),
|
||||||
|
MulchPowder("powderMulch"),
|
||||||
|
SulphurPowder("powderSulphur"),
|
||||||
|
FertiliserPowder("powderFertiliser"),
|
||||||
|
CompostPowder("powderCompost"),
|
||||||
|
Mortar("mortar"),
|
||||||
|
Weedkiller("weedkiller");
|
||||||
|
|
||||||
private BotanyItems(final String name, final String iconPath) {
|
protected IIcon icon;
|
||||||
|
protected String name;
|
||||||
|
protected String iconPath;
|
||||||
|
|
||||||
|
BotanyItems(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.iconPath = iconPath;
|
this.iconPath = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getIcon(final ItemStack stack) {
|
public IIcon getIcon(ItemStack itemStack) {
|
||||||
return this.icon;
|
return icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerIcons(final IIconRegister register) {
|
public void registerIcons(IIconRegister register) {
|
||||||
this.icon = Botany.proxy.getIcon(register, this.iconPath);
|
icon = Botany.proxy.getIcon(register, iconPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(final List par3List) {
|
public void addInformation(List data) {
|
||||||
|
// ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName(final ItemStack stack) {
|
public String getName(ItemStack itemStack) {
|
||||||
return this.name;
|
return I18N.localise("botany.item." + name + ".name");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack get(final int size) {
|
public ItemStack get(int count) {
|
||||||
return new ItemStack(Botany.misc, size, this.ordinal());
|
return new ItemStack(Botany.misc, count, ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,51 +1,56 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.items;
|
package binnie.botany.items;
|
||||||
|
|
||||||
import binnie.botany.Botany;
|
import binnie.botany.Botany;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import binnie.botany.CreativeTabBotany;
|
||||||
import java.util.List;
|
import binnie.botany.genetics.EnumFlowerColor;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import binnie.core.util.I18N;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import binnie.botany.genetics.EnumFlowerColor;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import binnie.botany.CreativeTabBotany;
|
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.EnumChatFormatting;
|
||||||
|
|
||||||
public class ItemClay extends Item
|
import java.util.List;
|
||||||
{
|
|
||||||
|
public class ItemClay extends Item {
|
||||||
public ItemClay() {
|
public ItemClay() {
|
||||||
this.setUnlocalizedName("clay");
|
setUnlocalizedName("clay");
|
||||||
this.setHasSubtypes(true);
|
setHasSubtypes(true);
|
||||||
this.setCreativeTab(CreativeTabBotany.instance);
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||||
|
super.addInformation(stack, player, tooltip, advanced);
|
||||||
|
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(stack.getItemDamage()).getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int getColorFromItemStack(final ItemStack stack, final int p_82790_2_) {
|
public int getColorFromItemStack(ItemStack stack, int index) {
|
||||||
final int damage = stack.getItemDamage();
|
int damage = stack.getItemDamage();
|
||||||
return EnumFlowerColor.get(damage).getColor(false);
|
return EnumFlowerColor.get(damage).getColor(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getItemStackDisplayName(final ItemStack stack) {
|
public String getItemStackDisplayName(ItemStack stack) {
|
||||||
return EnumFlowerColor.get(stack.getItemDamage()).getName() + " Clay";
|
return I18N.localise("botany.item.clay.name");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubItems(final Item p_150895_1_, final CreativeTabs p_150895_2_, final List list) {
|
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||||
list.add(new ItemStack(this, 1, c.ordinal()));
|
list.add(new ItemStack(this, 1, c.ordinal()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerIcons(final IIconRegister register) {
|
public void registerIcons(IIconRegister register) {
|
||||||
this.itemIcon = Botany.proxy.getIcon(register, "clay");
|
itemIcon = Botany.proxy.getIcon(register, "clay");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,51 +1,56 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.items;
|
package binnie.botany.items;
|
||||||
|
|
||||||
import binnie.botany.Botany;
|
import binnie.botany.Botany;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import binnie.botany.CreativeTabBotany;
|
||||||
import java.util.List;
|
import binnie.botany.genetics.EnumFlowerColor;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import binnie.core.util.I18N;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import binnie.botany.genetics.EnumFlowerColor;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
import binnie.botany.CreativeTabBotany;
|
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.EnumChatFormatting;
|
||||||
|
|
||||||
public class ItemPigment extends Item
|
import java.util.List;
|
||||||
{
|
|
||||||
|
public class ItemPigment extends Item {
|
||||||
public ItemPigment() {
|
public ItemPigment() {
|
||||||
this.setUnlocalizedName("pigment");
|
setUnlocalizedName("pigment");
|
||||||
this.setHasSubtypes(true);
|
setHasSubtypes(true);
|
||||||
this.setCreativeTab(CreativeTabBotany.instance);
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||||
|
super.addInformation(stack, player, tooltip, advanced);
|
||||||
|
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(stack.getItemDamage()).getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int getColorFromItemStack(final ItemStack stack, final int p_82790_2_) {
|
public int getColorFromItemStack(ItemStack stack, int index) {
|
||||||
final int damage = stack.getItemDamage();
|
int damage = stack.getItemDamage();
|
||||||
return EnumFlowerColor.get(damage).getColor(false);
|
return EnumFlowerColor.get(damage).getColor(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getItemStackDisplayName(final ItemStack stack) {
|
public String getItemStackDisplayName(ItemStack stack) {
|
||||||
return EnumFlowerColor.get(stack.getItemDamage()).getName() + " Pigment";
|
return I18N.localise("botany.item.pigment.name");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubItems(final Item p_150895_1_, final CreativeTabs p_150895_2_, final List list) {
|
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||||
for (final EnumFlowerColor c : EnumFlowerColor.values()) {
|
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||||
list.add(new ItemStack(this, 1, c.ordinal()));
|
list.add(new ItemStack(this, 1, c.ordinal()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerIcons(final IIconRegister register) {
|
public void registerIcons(IIconRegister register) {
|
||||||
this.itemIcon = Botany.proxy.getIcon(register, "pigment");
|
itemIcon = Botany.proxy.getIcon(register, "pigment");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,54 +1,50 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.network;
|
package binnie.botany.network;
|
||||||
|
|
||||||
import binnie.botany.genetics.EnumFlowerType;
|
|
||||||
import binnie.botany.genetics.EnumFlowerColor;
|
|
||||||
import java.io.IOException;
|
|
||||||
import io.netty.buffer.ByteBuf;
|
|
||||||
import binnie.core.network.packet.MessageBinnie;
|
|
||||||
import binnie.botany.flower.TileEntityFlower;
|
import binnie.botany.flower.TileEntityFlower;
|
||||||
|
import binnie.botany.genetics.EnumFlowerColor;
|
||||||
|
import binnie.botany.genetics.EnumFlowerType;
|
||||||
|
import binnie.core.network.packet.MessageBinnie;
|
||||||
import binnie.core.network.packet.MessageCoordinates;
|
import binnie.core.network.packet.MessageCoordinates;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
|
||||||
public class MessageFlowerUpdate extends MessageCoordinates
|
import java.io.IOException;
|
||||||
{
|
|
||||||
|
public class MessageFlowerUpdate extends MessageCoordinates {
|
||||||
public TileEntityFlower.RenderInfo render;
|
public TileEntityFlower.RenderInfo render;
|
||||||
|
|
||||||
public MessageFlowerUpdate(final int posX, final int posY, final int posZ, final TileEntityFlower.RenderInfo render) {
|
public MessageFlowerUpdate(int posX, int posY, int posZ, TileEntityFlower.RenderInfo render) {
|
||||||
super(PacketID.FlowerUpdate.ordinal(), posX, posY, posZ);
|
super(PacketID.FlowerUpdate.ordinal(), posX, posY, posZ);
|
||||||
this.render = render;
|
this.render = render;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MessageFlowerUpdate(final MessageBinnie message) {
|
public MessageFlowerUpdate(MessageBinnie message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeData(final ByteBuf data) throws IOException {
|
public void writeData(ByteBuf data) throws IOException {
|
||||||
super.writeData(data);
|
super.writeData(data);
|
||||||
data.writeByte(this.render.primary.getID());
|
data.writeByte(render.primary.getID());
|
||||||
data.writeByte(this.render.secondary.getID());
|
data.writeByte(render.secondary.getID());
|
||||||
data.writeByte(this.render.stem.getID());
|
data.writeByte(render.stem.getID());
|
||||||
data.writeByte(this.render.type.ordinal());
|
data.writeByte(render.type.ordinal());
|
||||||
data.writeByte(this.render.age);
|
data.writeByte(render.age);
|
||||||
data.writeByte(this.render.section);
|
data.writeByte(render.section);
|
||||||
data.writeBoolean(this.render.wilted);
|
data.writeBoolean(render.wilted);
|
||||||
data.writeBoolean(this.render.flowered);
|
data.writeBoolean(render.flowered);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readData(final ByteBuf data) throws IOException {
|
public void readData(ByteBuf data) throws IOException {
|
||||||
super.readData(data);
|
super.readData(data);
|
||||||
this.render = new TileEntityFlower.RenderInfo();
|
render = new TileEntityFlower.RenderInfo();
|
||||||
this.render.primary = EnumFlowerColor.values()[data.readByte()];
|
render.primary = EnumFlowerColor.values()[data.readByte()];
|
||||||
this.render.secondary = EnumFlowerColor.values()[data.readByte()];
|
render.secondary = EnumFlowerColor.values()[data.readByte()];
|
||||||
this.render.stem = EnumFlowerColor.values()[data.readByte()];
|
render.stem = EnumFlowerColor.values()[data.readByte()];
|
||||||
this.render.type = EnumFlowerType.values()[data.readByte()];
|
render.type = EnumFlowerType.values()[data.readByte()];
|
||||||
this.render.age = data.readByte();
|
render.age = data.readByte();
|
||||||
this.render.section = data.readByte();
|
render.section = data.readByte();
|
||||||
this.render.wilted = data.readBoolean();
|
render.wilted = data.readBoolean();
|
||||||
this.render.flowered = data.readBoolean();
|
render.flowered = data.readBoolean();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,90 +1,90 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.network;
|
package binnie.botany.network;
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import binnie.botany.api.IAlleleFlowerSpecies;
|
||||||
import net.minecraft.util.IChatComponent;
|
import binnie.botany.flower.TileEntityFlower;
|
||||||
|
import binnie.botany.genetics.EnumFlowerColor;
|
||||||
|
import binnie.core.BinnieCore;
|
||||||
|
import binnie.core.network.IPacketID;
|
||||||
|
import binnie.core.network.packet.MessageBinnie;
|
||||||
|
import binnie.core.network.packet.MessageNBT;
|
||||||
|
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import forestry.api.genetics.AlleleManager;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import binnie.botany.flower.TileEntityFlower;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.ChatComponentText;
|
import net.minecraft.util.ChatComponentText;
|
||||||
import binnie.botany.genetics.EnumFlowerColor;
|
import net.minecraft.util.IChatComponent;
|
||||||
import forestry.api.genetics.AlleleManager;
|
|
||||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
|
||||||
import binnie.core.BinnieCore;
|
|
||||||
import binnie.core.network.packet.MessageNBT;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
|
||||||
import binnie.core.network.packet.MessageBinnie;
|
|
||||||
import binnie.core.network.IPacketID;
|
|
||||||
|
|
||||||
public enum PacketID implements IPacketID
|
public enum PacketID implements IPacketID {
|
||||||
{
|
FieldKit,
|
||||||
Encylopedia,
|
|
||||||
FlowerUpdate;
|
FlowerUpdate;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMessage(final MessageBinnie message, final MessageContext context) {
|
public void onMessage(MessageBinnie message, MessageContext context) {
|
||||||
if (this == PacketID.Encylopedia && context.side == Side.CLIENT) {
|
if (this == PacketID.FieldKit && context.side == Side.CLIENT) {
|
||||||
final MessageNBT packet = new MessageNBT(message);
|
onFieldKitPacket(message);
|
||||||
final NBTTagCompound data = packet.getTagCompound();
|
} else if (this == PacketID.FlowerUpdate) {
|
||||||
final EntityPlayer player = BinnieCore.proxy.getPlayer();
|
onFlowerUpdatePacket(message);
|
||||||
String info = "";
|
|
||||||
if (data.hasNoTags()) {
|
|
||||||
info += "Flower has not been discovered by you. Breed this flower yourself to discover.";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
final IAlleleFlowerSpecies primary = (IAlleleFlowerSpecies) AlleleManager.alleleRegistry.getAllele(data.getString("Species"));
|
|
||||||
final IAlleleFlowerSpecies secondary = (IAlleleFlowerSpecies) AlleleManager.alleleRegistry.getAllele(data.getString("Species2"));
|
|
||||||
final float age = data.getFloat("Age");
|
|
||||||
final EnumFlowerColor color1 = EnumFlowerColor.get(data.getShort("Colour"));
|
|
||||||
final EnumFlowerColor color2 = EnumFlowerColor.get(data.getShort("Colour2"));
|
|
||||||
if (primary == null || secondary == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
info += "A";
|
|
||||||
if (age == 0.0f) {
|
|
||||||
info += "";
|
|
||||||
}
|
|
||||||
else if (age < 0.25f) {
|
|
||||||
info += " Young";
|
|
||||||
}
|
|
||||||
else if (age < 0.75f) {
|
|
||||||
info += " Mature";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
info += " Old";
|
|
||||||
}
|
|
||||||
if (color1 == color2) {
|
|
||||||
info = info + " " + color1.getName();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
info = info + " " + color1.getName() + " & " + color2.getName();
|
|
||||||
}
|
|
||||||
if (primary == secondary) {
|
|
||||||
info = info + " " + primary.getName();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
info = info + " " + primary.getName() + "-" + secondary.getName() + " Hybrid";
|
|
||||||
}
|
|
||||||
if (age == 0.0f) {
|
|
||||||
info += " Germling";
|
|
||||||
}
|
|
||||||
if (data.getBoolean("Wilting")) {
|
|
||||||
info += ". Shame it is Wilting!";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
final IChatComponent chat = new ChatComponentText(info);
|
|
||||||
player.addChatMessage(chat);
|
|
||||||
}
|
|
||||||
else if (this == PacketID.FlowerUpdate) {
|
|
||||||
final MessageFlowerUpdate packet2 = new MessageFlowerUpdate(message);
|
|
||||||
final TileEntity tile = packet2.getTileEntity(BinnieCore.proxy.getWorld());
|
|
||||||
if (tile instanceof TileEntityFlower) {
|
|
||||||
((TileEntityFlower) tile).setRender(packet2.render);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onFlowerUpdatePacket(MessageBinnie message) {
|
||||||
|
MessageFlowerUpdate packet = new MessageFlowerUpdate(message);
|
||||||
|
TileEntity tile = packet.getTileEntity(BinnieCore.proxy.getWorld());
|
||||||
|
if (tile instanceof TileEntityFlower) {
|
||||||
|
((TileEntityFlower) tile).setRender(packet.render);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onFieldKitPacket(MessageBinnie message) {
|
||||||
|
MessageNBT packet = new MessageNBT(message);
|
||||||
|
NBTTagCompound data = packet.getTagCompound();
|
||||||
|
EntityPlayer player = BinnieCore.proxy.getPlayer();
|
||||||
|
String info = "";
|
||||||
|
if (data.hasNoTags()) {
|
||||||
|
info += "Flower has not been discovered by you. Breed this flower yourself to discover.";
|
||||||
|
} else {
|
||||||
|
IAlleleFlowerSpecies primary = (IAlleleFlowerSpecies) AlleleManager.alleleRegistry.getAllele(data.getString("Species"));
|
||||||
|
IAlleleFlowerSpecies secondary = (IAlleleFlowerSpecies) AlleleManager.alleleRegistry.getAllele(data.getString("Species2"));
|
||||||
|
float age = data.getFloat("Age");
|
||||||
|
EnumFlowerColor color1 = EnumFlowerColor.get(data.getShort("Colour"));
|
||||||
|
EnumFlowerColor color2 = EnumFlowerColor.get(data.getShort("Colour2"));
|
||||||
|
if (primary == null || secondary == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
info += "A";
|
||||||
|
if (age == 0.0f) {
|
||||||
|
info += "";
|
||||||
|
} else if (age < 0.25f) {
|
||||||
|
info += " Young";
|
||||||
|
} else if (age < 0.75f) {
|
||||||
|
info += " Mature";
|
||||||
|
} else {
|
||||||
|
info += " Old";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (color1 == color2) {
|
||||||
|
info = info + " " + color1.getName();
|
||||||
|
} else {
|
||||||
|
info = info + " " + color1.getName() + " & " + color2.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (primary == secondary) {
|
||||||
|
info = info + " " + primary.getName();
|
||||||
|
} else {
|
||||||
|
info = info + " " + primary.getName() + "-" + secondary.getName() + " Hybrid";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (age == 0.0f) {
|
||||||
|
info += " Germling";
|
||||||
|
}
|
||||||
|
if (data.getBoolean("Wilting")) {
|
||||||
|
info += ". Shame it is Wilting!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IChatComponent chat = new ChatComponentText(info);
|
||||||
|
player.addChatMessage(chat);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,6 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.proxy;
|
package binnie.botany.proxy;
|
||||||
|
|
||||||
import binnie.core.proxy.IProxyCore;
|
import binnie.core.proxy.IProxyCore;
|
||||||
|
|
||||||
public interface IBotanyProxy extends IProxyCore
|
public interface IBotanyProxy extends IProxyCore {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,9 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.proxy;
|
package binnie.botany.proxy;
|
||||||
|
|
||||||
import binnie.botany.Botany;
|
import binnie.botany.Botany;
|
||||||
import binnie.core.proxy.BinnieModProxy;
|
import binnie.core.proxy.BinnieModProxy;
|
||||||
|
|
||||||
public class Proxy extends BinnieModProxy implements IBotanyProxy
|
public class Proxy extends BinnieModProxy implements IBotanyProxy {
|
||||||
{
|
|
||||||
public Proxy() {
|
public Proxy() {
|
||||||
super(Botany.instance);
|
super(Botany.instance);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,4 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.proxy;
|
package binnie.botany.proxy;
|
||||||
|
|
||||||
public class ProxyClient extends Proxy implements IBotanyProxy
|
public class ProxyClient extends Proxy implements IBotanyProxy {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,4 @@
|
|||||||
//
|
|
||||||
// Decompiled by Procyon v0.5.30
|
|
||||||
//
|
|
||||||
|
|
||||||
package binnie.botany.proxy;
|
package binnie.botany.proxy;
|
||||||
|
|
||||||
public class ProxyServer extends Proxy implements IBotanyProxy
|
public class ProxyServer extends Proxy implements IBotanyProxy {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
Loaded 100 of 1199 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user