Compare commits

..
3 Commits
2800 changed files with 11268 additions and 11013 deletions

No files matched your search

-2
View File
@@ -1,2 +0,0 @@
# Ignore spotlessApply reformat
91bf137a94d1207f943929e0881750a1b8c4f3bf
-1
View File
@@ -32,7 +32,6 @@
*.[dD][lL][lL] binary *.[dD][lL][lL] binary
*.[dD][yY][lL][iI][bB] binary *.[dD][yY][lL][iI][bB] binary
*.[pP][sS][dD] binary *.[pP][sS][dD] binary
*.[pP][dD][nN] binary
*.[tT][tT][fF] binary *.[tT][tT][fF] binary
*.[oO][tT][fF] binary *.[oO][tT][fF] binary
+33
View File
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
RUNDIR="run"
CRASH="crash-reports"
SERVERLOG="server.log"
if [[ -d $RUNDIR/$CRASH ]]; then
echo "Crash reports detected:"
cat $RUNDIR/$CRASH/crash*.txt
exit 1
fi
if grep --quiet "Fatal errors were detected" $SERVERLOG; then
echo "Fatal errors detected:"
cat server.log
exit 1
fi
if grep --quiet "The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED" $SERVERLOG; then
echo "Server force stopped:"
cat server.log
exit 1
fi
if ! grep --quiet -Po '.+Done \(.+\)\! For help, type "help" or "\?"' $SERVERLOG; then
echo "Server didn't finish startup:"
cat server.log
exit 1
fi
echo "No crash reports detected"
exit 0
+2 -2
View File
@@ -3,9 +3,9 @@ name: Build and test
on: on:
pull_request: pull_request:
branches: [ master, main, release/** ] branches: [ master, main ]
push: push:
branches: [ master, main, release/** ] branches: [ master, main ]
jobs: jobs:
build-and-test: build-and-test:
-17
View File
@@ -1,17 +0,0 @@
name: Optimize images
on:
pull_request:
branches: [ master, main, release/** ]
paths:
- "**/*.png"
push:
branches: [ master, main, release/** ]
paths:
- "**/*.png"
jobs:
optimize-images:
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/optimize-images.yml@master
secrets: inherit
+1 -8
View File
@@ -26,14 +26,7 @@ whitelist.json
*.iml *.iml
*.ipr *.ipr
*.iws *.iws
src/main/resources/mixins.*([!.]).json src/main/resources/mixins.*.json
*.bat *.bat
*.sh
*.DS_Store *.DS_Store
!gradlew.bat !gradlew.bat
.factorypath
addon.local.gradle
addon.local.gradle.kts
addon.late.local.gradle
addon.late.local.gradle.kts
layout.json
Binary file not shown.

Before

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 200 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 219 B

+1124 -3
View File
File diff suppressed because it is too large. Load diff
+6 -6
View File
@@ -1,12 +1,12 @@
// Add your dependencies here // Add your dependencies here
dependencies { dependencies {
api('com.github.GTNewHorizons:ForestryMC:4.11.39:dev') implementation('com.github.GTNewHorizons:GTNHLib:0.0.10:dev')
implementation('com.github.GTNewHorizons:GTNHLib:0.11.54:dev') compile('com.github.GTNewHorizons:ForestryMC:4.5.6:dev')
compile('com.github.GTNewHorizons:NotEnoughItems:2.3.21-GTNH:dev')
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.8.162-GTNH:dev') compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.28:api')
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.64:api') compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev') compileOnly('curse.maven:cofh-lib-220333:2388748')
compileOnly("curse.maven:extrabiomesxl-60041:2273301")
} }
+38 -162
View File
@@ -1,135 +1,65 @@
# ExampleMod tag to use as Blowdryer (Spotless, etc.) settings version, leave empty to disable.
# LOCAL to test local config updates.
gtnh.settings.blowdryerTag = 0.2.0
# Human-readable mod name, available for mcmod.info population.
modName = Binnie Core modName = Binnie Core
# Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation. # This is a case-sensitive string to identify your mod. Convention is to use lower case.
# Conventionally lowercase.
modId = BinnieCore modId = BinnieCore
# Root package of the mod, used to find various classes in other properties,
# mcmod.info substitution, enabling assertions in run tasks, etc.
modGroup = binnie modGroup = binnie
# Whether to use modGroup as the maven publishing group. # WHY is there no version field?
# When false, com.github.GTNewHorizons is used. # The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
useModGroupForPublishing = false # code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
# Updates your build.gradle and settings.gradle automatically whenever an update is available. # Will update your build.gradle automatically whenever an update is available
autoUpdateBuildScript = false autoUpdateBuildScript = false
# Version of Minecraft to target
minecraftVersion = 1.7.10 minecraftVersion = 1.7.10
# Version of Minecraft Forge to target
forgeVersion = 10.13.4.1614 forgeVersion = 10.13.4.1614
# Specify an MCP channel for dependency deobfuscation and the deobfParams task. # Specify a MCP channel and mappings version for dependency deobfuscation and the deobfParams task.
channel = stable channel = stable
# Specify an MCP mappings version for dependency deobfuscation and the deobfParams task.
mappingsVersion = 12 mappingsVersion = 12
# Defines other MCP mappings for dependency deobfuscation. # Define other MCP mappings for dependency deobfuscation
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/ remoteMappings = https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
# Select a default username for testing your mod. You can always override this per-run by running # Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE. # restart Minecraft in development. Choose this dependent on your mod:
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
developmentEnvironmentUserName = Developer developmentEnvironmentUserName = Developer
# Enables modern Java syntax support. Valid values: # Define a source file of your project with:
# - false: No modern syntax, Java 8 only
# - jabel: Jabel syntax-only support, compiles to J8 bytecode
# - jvmDowngrader: Full modern Java via JVM Downgrader (syntax + stdlib APIs)
# - modern: Native modern Java bytecode, no downgrading
enableModernJavaSyntax = jabel
# If set, ignores the above setting and compiles with the given toolchain. This may cause unexpected issues,
# and should *not* be used in most situations. -1 disables this.
# forceToolchainVersion = -1
# Target JVM version for JVM Downgrader bytecode downgrading.
# Only used when enableModernJavaSyntax = jvmDowngrader
# downgradeTargetVersion = 8
# Comma-separated list of Java versions for multi-release jar support (JVM Downgrader only).
# Classes will be available in META-INF/versions/N/ for each version N in this list.
# Default: "21,25" (J25+ gets native classes, J21-24 gets partial downgrade, J8-20 gets full downgrade).
# jvmDowngraderMultiReleaseVersions = 21,25
# Specifies how JVM Downgrader API stubs are provided. Options:
# - shade: Shade minimized stubs into the jar
# - gtnhlib: GTNHLib provides stubs at runtime (adds version constraint)
# - external: Another dependency provides stubs (no constraint, no warning)
# - (empty): Warning reminding you to configure stubs
# Note: 'shade' option requires you to verify license compliance, see: https://github.com/unimined/JvmDowngrader/blob/main/LICENSE.md
# jvmDowngraderStubsProvider =
# Enables injecting missing generics into the decompiled source code for a better coding experience.
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
enableGenericInjection = true
# Generate a class with a String field for the mod version named as defined below.
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
generateGradleTokenClass = binnie.core.Tags
# Name of the token containing the project's current version to generate/replace.
gradleTokenVersion = VERSION
# [DEPRECATED] Mod ID replacement token.
gradleTokenModId =
# [DEPRECATED] Mod name replacement token.
gradleTokenModName =
# [DEPRECATED] Mod Group replacement token.
gradleTokenGroupName =
# [DEPRECATED]
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
# public static final String VERSION = "GRADLETOKEN_VERSION"; # public static final String VERSION = "GRADLETOKEN_VERSION";
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's # The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
# version in @Mod([...], version = VERSION, [...]). # version in @Mod([...], version = VERSION, [...])
# Leave these properties empty to skip individual token replacements. # Leave these properties empty to skip individual token replacements
replaceGradleTokenInFile = replaceGradleTokenInFile = BinnieCore.java
gradleTokenModId =
gradleTokenModName =
gradleTokenVersion = GRADLETOKEN_VERSION
gradleTokenGroupName =
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can # In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
# leave this property empty. # leave this property empty.
# Example value: (apiPackage = api) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.api # Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
apiPackage = apiPackage =
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/ # Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
# There can be multiple files in a space-separated list. # Example value: mymodid_at.cfg
# Example value: mymodid_at.cfg nei_at.cfg
accessTransformersFile = accessTransformersFile =
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled! # Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false usesMixins = false
# Adds some debug arguments like verbose output and export
# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
# Mixin classes will have access to "main" classes, but not the other way around.
separateMixinSourceSet =
# Adds some debug arguments like verbose output and class export.
usesMixinDebug = false usesMixinDebug = false
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise. # Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
mixinPlugin = mixinPlugin =
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
# Specify the package that contains all of your Mixins. The package must exist or
# the build will fail. If you have a package property defined in your mixins.<modid>.json,
# it must match with this or the build will fail.
mixinsPackage = mixinsPackage =
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin! # Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
# This parameter is for legacy compatibility only # This parameter is for legacy compatibility only
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin # Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
coreModClass = coreModClass =
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class # If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false! # that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
containsMixinsAndOrCoreModOnly = false containsMixinsAndOrCoreModOnly = false
@@ -137,38 +67,15 @@ containsMixinsAndOrCoreModOnly = false
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins. # Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
forceEnableMixins = false forceEnableMixins = false
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated into your jar. It is your # If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your
# responsibility to check the license and request permission for distribution if required. # responsibility check the licence and request permission for distribution, if required.
usesShadowedDependencies = false usesShadowedDependencies = false
# If disabled, won't remove unused classes from shadowed dependencies. Some libraries use reflection to access
# their own classes, making the minimization unreliable.
minimizeShadowedDependencies = true
# If disabled, won't rename the shadowed classes. # Publishing to modrinth requires you to set the MODRINTH_TOKEN environment variable to your current modrinth API token.
relocateShadowedDependencies = true
# Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
includeWellKnownRepositories = true
# A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated
# list of strings, with the acceptable keys being(case does not matter):
# cursemaven
# modrinth
excludeWellKnownRepositories =
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
usesMavenPublishing = true
# Maven repository to publish the mod to.
# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/
# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
#
# The project's ID on Modrinth. Can be either the slug or the ID. # The project's ID on Modrinth. Can be either the slug or the ID.
# Leave this empty if you don't want to publish to Modrinth. # Leave this empty if you don't want to publish on Modrinth.
modrinthProjectId = modrinthProjectId =
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth. # The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
@@ -177,64 +84,33 @@ modrinthProjectId =
# type can be one of [project, version], # type can be one of [project, version],
# and the name is the Modrinth project or version slug/id of the other mod. # and the name is the Modrinth project or version slug/id of the other mod.
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech # Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
# Note: UniMixins is automatically set as a required dependency if usesMixins = true. # Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
modrinthRelations = modrinthRelations =
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens. # Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
#
# The project's numeric ID on CurseForge. You can find this in the About Project box. # The project's numeric ID on CurseForge. You can find this in the About Project box.
# Leave this empty if you don't want to publish on CurseForge. # Leave this empty if you don't want to publish on CurseForge.
curseForgeProjectId = curseForgeProjectId =
# Comma-separated supported CurseForge environments: client, server (case-insensitive).
# Use client or server for mods that only support one environment. Defaults to client,server.
# These tags describe where the mod can run, not whether installation is required on both sides.
curseForgeEnvironments = client,server
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge. # The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
# Syntax: type1:name1;type2:name2;... # Syntax: type1:name1;type2:name2;...
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible], # Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
# and the name is the CurseForge project slug of the other mod. # and the name is the CurseForge project slug of the other mod.
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft # Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
# Note: UniMixins is automatically set as a required dependency if usesMixins = true. # Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
curseForgeRelations = curseForgeRelations =
# Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older
# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
# projects. New projects should not use this parameter. # projects. New projects should not use this parameter.
customArchiveBaseName = binnie-mods customArchiveBaseName = binnie-mods
# Optional parameter to customize the default working directory used by the runClient* tasks. Relative to the project directory. # Optional parameter to prevent the source code from being published
# runClientWorkingDirectory = run/client # noPublishedSources =
# Optional parameter to customize the default working directory used by the runServer* tasks. Relative to the project directory. # Uncomment this to disable spotless checks
# runServerWorkingDirectory = run/server
# Optional parameter to have the build automatically fail if an illegal version is used.
# This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'.
# The check is ONLY performed if the version is a git tag.
# Note: the specified string must be escaped, so e.g. 1\\.1\\.\\d+ instead of 1\.1\.\d+
# versionPattern =
# Uncomment to prevent the source code from being published.
# noPublishedSources = true
# Uncomment this to disable Spotless checks.
# This should only be uncommented to keep it easier to sync with upstream/other forks. # This should only be uncommented to keep it easier to sync with upstream/other forks.
# That is, if there is no other active fork/upstream, NEVER change this. # That is, if there is no other active fork/upstream, NEVER change this.
# disableSpotless = true # disableSpotless = true
# Uncomment this to disable Checkstyle checks (currently wildcard import check).
# disableCheckstyle = true
# Override the IDEA build type. Valid values are: "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle"
# (force use delegated build).
# This is meant to be set in $HOME/.gradle/gradle.properties.
# e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be native build.
# WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want!
# Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you.
# ideaOverrideBuildType = idea
# Whether IDEA should run spotless checks when pressing the Build button.
# This is meant to be set in $HOME/.gradle/gradle.properties.
# ideaCheckSpotlessOnBuild = true
-12
View File
@@ -1,12 +0,0 @@
#This file is generated by updateDaemonJvm
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/9064f22734b42ac03e85df04b632e167/redirect
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/4d0277c49991306ac78048580fe34bcf/redirect
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/a9fa3b809e484a1e1ac4308a5dda661a/redirect
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/aa99913fa6d767d899ffc96082da01ca/redirect
toolchainVersion=25
Binary file not shown.
+1 -5
View File
@@ -1,9 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip
networkTimeout=10000
retries=0
retryBackOffMs=500
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
Vendored
+113 -173
View File
@@ -1,7 +1,7 @@
#!/bin/sh #!/usr/bin/env sh
# #
# Copyright © 2015 the original authors. # Copyright 2015 the original author or authors.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@@ -15,114 +15,80 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# SPDX-License-Identifier: Apache-2.0
#
############################################################################## ##############################################################################
# ##
# gradlew start up script for POSIX generated by Gradle. ## Gradle start up script for UN*X
# ##
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh gradlew
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
############################################################################## ##############################################################################
# Attempt to set APP_HOME # Attempt to set APP_HOME
# Resolve links: $0 may be a link # Resolve links: $0 may be a link
app_path=$0 PRG="$0"
# Need this for relative symlinks.
# Need this for daisy-chained symlinks. while [ -h "$PRG" ] ; do
while ls=`ls -ld "$PRG"`
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path link=`expr "$ls" : '.*-> \(.*\)$'`
[ -h "$app_path" ] if expr "$link" : '/.*' > /dev/null; then
do PRG="$link"
ls=$( ls -ld "$app_path" ) else
link=${ls#*' -> '} PRG=`dirname "$PRG"`"/$link"
case $link in #( fi
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
# This is normally unused APP_NAME="Gradle"
# shellcheck disable=SC2034 APP_BASE_NAME=`basename "$0"`
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD="maximum"
warn () { warn () {
echo "$*" echo "$*"
} >&2 }
die () { die () {
echo echo
echo "$*" echo "$*"
echo echo
exit 1 exit 1
} >&2 }
# OS specific support (must be 'true' or 'false'). # OS specific support (must be 'true' or 'false').
cygwin=false cygwin=false
msys=false msys=false
darwin=false darwin=false
nonstop=false nonstop=false
case "$( uname )" in #( case "`uname`" in
CYGWIN* ) cygwin=true ;; #( CYGWIN* )
Darwin* ) darwin=true ;; #( cygwin=true
MSYS* | MINGW* ) msys=true ;; #( ;;
NONSTOP* ) nonstop=true ;; Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM. # Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables # IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java JAVACMD="$JAVA_HOME/jre/sh/java"
else else
JAVACMD=$JAVA_HOME/bin/java JAVACMD="$JAVA_HOME/bin/java"
fi fi
if [ ! -x "$JAVACMD" ] ; then if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@@ -131,118 +97,92 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi fi
else else
JAVACMD=java JAVACMD="java"
if ! command -v java >/dev/null 2>&1 which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
case $MAX_FD in #( MAX_FD_LIMIT=`ulimit -H -n`
max*) if [ $? -eq 0 ] ; then
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
# shellcheck disable=SC2039,SC3045 MAX_FD="$MAX_FD_LIMIT"
MAX_FD=$( ulimit -H -n ) || fi
warn "Could not query maximum file descriptor limit" ulimit -n $MAX_FD
esac if [ $? -ne 0 ] ; then
case $MAX_FD in #( warn "Could not set maximum file descriptor limit: $MAX_FD"
'' | soft) :;; #( fi
*) else
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
# shellcheck disable=SC2039,SC3045 fi
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi fi
# Collect all arguments for the java command, stacking in reverse order: # For Darwin, add options to specify how the application appears in the dock
# * args from the command line if $darwin; then
# * the main class name GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
# * -classpath fi
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java # For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
JAVACMD=$( cygpath --unix "$JAVACMD" ) # We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
# Now convert the arguments - kludge to limit ourselves to /bin/sh SEP=""
for arg do for dir in $ROOTDIRSRAW ; do
if ROOTDIRS="$ROOTDIRS$SEP$dir"
case $arg in #( SEP="|"
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # Collect all arguments for the java command, following the shell quoting and substitution rules
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# Collect all arguments for the java command: # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
# and any embedded shellness will be escaped. cd "$(dirname "$0")"
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@" exec "$JAVACMD" "$@"
Vendored
+50 -32
View File
@@ -13,28 +13,22 @@
@rem See the License for the specific language governing permissions and @rem See the License for the specific language governing permissions and
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off @if "%DEBUG%" == "" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@rem gradlew startup script for Windows @rem Gradle startup script for Windows
@rem @rem
@rem ########################################################################## @rem ##########################################################################
@rem Set local scope for the variables, and ensure extensions are enabled @rem Set local scope for the variables with windows NT shell
setlocal EnableExtensions if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0 set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=. if "%DIRNAME%" == "" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@@ -43,40 +37,64 @@ 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% equ 0 goto execute if "%ERRORLEVEL%" == "0" goto init
echo. 1>&2 echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo. 1>&2 echo.
echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation. 1>&2 echo location of your Java installation.
"%COMSPEC%" /c exit 1 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 execute if exist "%JAVA_EXE%" goto init
echo. 1>&2 echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo. 1>&2 echo.
echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation. 1>&2 echo location of your Java installation.
"%COMSPEC%" /c exit 1 goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute :execute
@rem Setup the command line @rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@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%
@rem Execute gradlew :end
@rem endlocal doesn't take effect until after the line is parsed and variables are expanded @rem End local scope for the variables with windows NT shell
@rem which allows us to clear the local environment before executing the java command if "%ERRORLEVEL%"=="0" goto mainEnd
endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
:exitWithErrorLevel :fail
@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
"%COMSPEC%" /c exit %ERRORLEVEL% rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
+22
View File
@@ -1,4 +1,26 @@
// Add any additional repositories for your dependencies here // Add any additional repositories for your dependencies here
repositories { repositories {
maven {
name 'GTNH Maven'
url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/'
allowInsecureProtocol
}
maven {
name 'ic2'
url 'http://maven.ic2.player.to/'
metadataSources {
mavenPom()
artifact()
}
}
maven {
url 'https://cursemaven.com'
content {
includeGroup 'curse.maven'
}
}
maven {
url 'https://jitpack.io'
}
} }
+8 -19
View File
@@ -1,21 +1,10 @@
pluginManagement {
repositories {
maven {
// RetroFuturaGradle
name "GTNH Maven"
url "https://nexus.gtnewhorizons.com/repository/public/"
mavenContent {
includeGroup("com.gtnewhorizons")
includeGroupByRegex("com\\.gtnewhorizons\\..+")
}
}
gradlePluginPortal()
mavenCentral()
mavenLocal()
}
}
plugins { plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.34' id 'com.diffplug.blowdryerSetup' version '1.6.0'
}
apply plugin: 'com.diffplug.blowdryerSetup'
blowdryerSetup {
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.1.5')
//devLocal '.' // Use this when testing config updates locally
} }
+6 -4
View File
@@ -1,19 +1,21 @@
package binnie; package binnie;
import java.util.ArrayList;
import java.util.List;
import binnie.core.ManagerBase; import binnie.core.ManagerBase;
import binnie.core.genetics.ManagerGenetics; import binnie.core.genetics.ManagerGenetics;
import binnie.core.item.ManagerItem;
import binnie.core.liquid.ManagerLiquid; import binnie.core.liquid.ManagerLiquid;
import binnie.core.machines.ManagerMachine; import binnie.core.machines.ManagerMachine;
import binnie.core.mod.config.ManagerConfig;
import binnie.core.resource.ManagerResource; import binnie.core.resource.ManagerResource;
import java.util.ArrayList;
import java.util.List;
public final class Binnie { public final class Binnie {
public static List<ManagerBase> Managers = new ArrayList<>(); public static List<ManagerBase> Managers = new ArrayList<>();
public static ManagerGenetics Genetics = new ManagerGenetics(); public static ManagerGenetics Genetics = new ManagerGenetics();
public static ManagerConfig Configuration = new ManagerConfig();
public static ManagerLiquid Liquid = new ManagerLiquid(); public static ManagerLiquid Liquid = new ManagerLiquid();
public static ManagerMachine Machine = new ManagerMachine(); public static ManagerMachine Machine = new ManagerMachine();
public static ManagerItem Item = new ManagerItem();
public static ManagerResource Resource = new ManagerResource(); public static ManagerResource Resource = new ManagerResource();
} }
+171 -168
View File
@@ -1,16 +1,5 @@
package binnie.botany; package binnie.botany;
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.common.MinecraftForge;
import net.minecraftforge.event.entity.player.BonemealEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.event.world.BlockEvent;
import binnie.botany.api.EnumAcidity; import binnie.botany.api.EnumAcidity;
import binnie.botany.api.EnumSoilType; import binnie.botany.api.EnumSoilType;
import binnie.botany.api.IFlower; import binnie.botany.api.IFlower;
@@ -40,7 +29,6 @@ import binnie.botany.network.PacketID;
import binnie.botany.proxy.Proxy; import binnie.botany.proxy.Proxy;
import binnie.core.AbstractMod; import binnie.core.AbstractMod;
import binnie.core.BinnieCore; import binnie.core.BinnieCore;
import binnie.core.Tags;
import binnie.core.gui.IBinnieGUID; import binnie.core.gui.IBinnieGUID;
import binnie.core.item.ItemMisc; import binnie.core.item.ItemMisc;
import binnie.core.network.BinniePacketHandler; import binnie.core.network.BinniePacketHandler;
@@ -54,51 +42,58 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.eventhandler.Event; import cpw.mods.fml.common.eventhandler.Event;
import cpw.mods.fml.common.eventhandler.SubscribeEvent; 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", version = Tags.VERSION, useMetadata = true, dependencies = "after:BinnieCore") @Mod(
modid = "Botany",
name = "Botany",
version = BinnieCore.VERSION,
useMetadata = true,
dependencies = "after:BinnieCore")
public class Botany extends AbstractMod { 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;
// Genetics module
public static BlockFlower flower; public static BlockFlower flower;
public static ItemFlower flowerItem;
public static Item pollen;
public static Item seed; public static Item seed;
public static Item pollen;
public static ItemDictionary database; public static ItemDictionary database;
// Gardening module
public static BlockPlant plant; public static BlockPlant plant;
public static ItemTrowel trowelWood;
public static ItemTrowel trowelStone;
public static ItemTrowel trowelIron;
public static ItemTrowel trowelDiamond;
public static ItemTrowel trowelGold;
public static BlockSoil soil; public static BlockSoil soil;
public static BlockSoil loam; public static BlockSoil loam;
public static BlockSoil flowerbed; public static BlockSoil flowerbed;
public static BlockSoil soilNoWeed; public static BlockSoil soilNoWeed;
public static BlockSoil loamNoWeed; public static BlockSoil loamNoWeed;
public static BlockSoil flowerbedNoWeed; public static BlockSoil flowerbedNoWeed;
public static BlockCeramic ceramic;
public static BlockStained stained;
public static BlockCeramicPatterned ceramicTile;
public static BlockCeramicBrick ceramicBrick;
public static ItemSoilMeter soilMeter;
public static ItemInsulatedTube insulatedTube; public static ItemInsulatedTube insulatedTube;
public static ItemTrowel trowelWood; public static ItemSoilMeter soilMeter;
public static ItemTrowel trowelStone;
public static ItemTrowel trowelIron;
public static ItemTrowel trowelDiamond;
public static ItemTrowel trowelGold;
public static ItemMisc misc; public static ItemMisc misc;
public static ItemFlower flowerItem;
public static ItemPigment pigment; public static ItemPigment pigment;
public static ItemClay clay; public static ItemClay clay;
public static BlockCeramic ceramic;
public static BlockCeramicPatterned ceramicTile;
public static BlockStained stained;
public static BlockCeramicBrick ceramicBrick;
public Botany() { public Botany() {
Botany.instance = this; Botany.instance = this;
MinecraftForge.EVENT_BUS.register(new EventHandler());
} }
@Mod.EventHandler @Mod.EventHandler
@@ -124,6 +119,11 @@ public class Botany extends AbstractMod {
return BotanyGUI.values(); return BotanyGUI.values();
} }
@Override
public Class<?>[] getConfigs() {
return new Class[0];
}
@Override @Override
public IPacketID[] getPacketIDs() { public IPacketID[] getPacketIDs() {
return PacketID.values(); return PacketID.values();
@@ -149,6 +149,122 @@ public class Botany extends AbstractMod {
return PacketHandler.class; return PacketHandler.class;
} }
@SubscribeEvent
public void onShearFlower(PlayerInteractEvent event) {
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
return;
}
if (event.entityPlayer != null
&& event.entityPlayer.getHeldItem() != null
&& event.entityPlayer.getHeldItem().getItem() == Items.shears) {
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
if (tile instanceof TileEntityFlower) {
TileEntityFlower flower = (TileEntityFlower) tile;
flower.onShear();
event.entityPlayer.getHeldItem().damageItem(1, event.entityPlayer);
}
}
if (event.entityPlayer != null
&& event.entityPlayer.getHeldItem() != null
&& event.entityPlayer.getHeldItem().getItem() == Botany.pollen) {
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
if (tile instanceof TileEntityFlower) {
TileEntityFlower flower = (TileEntityFlower) tile;
IFlower pollen = BotanyCore.getFlowerRoot().getMember(event.entityPlayer.getHeldItem());
if (pollen != null && flower.canMateWith(pollen)) {
flower.mateWith(pollen);
if (!event.entityPlayer.capabilities.isCreativeMode) {
ItemStack heldItem = event.entityPlayer.getHeldItem();
heldItem.stackSize--;
}
}
}
}
}
@SubscribeEvent
public void onFertiliseSoil(PlayerInteractEvent event) {
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK || event.world == null) {
return;
}
if (event.entityPlayer == null || event.entityPlayer.getHeldItem() == null) {
return;
}
int y = event.y;
Block block = event.world.getBlock(event.x, y, event.z);
if (block == null || !Gardening.isSoil(block)) {
block = event.world.getBlock(event.x, --y, event.z);
}
if (block == null || !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;
}
}
if (Gardening.isAcidFertiliser(event.entityPlayer.getHeldItem())
&& soil.getPH(event.world, event.x, y, event.z) != EnumAcidity.ACID) {
EnumAcidity pH = soil.getPH(event.world, event.x, y, event.z);
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) {
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) {
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
public void plantVanilla(BlockEvent.PlaceEvent event) {
World world = event.world;
int x = event.x;
int y = event.y;
int z = event.z;
Block block = world.getBlock(x, y - 1, z);
if (!(block instanceof IBlockSoil)) {
return;
}
IFlower flower = BotanyCore.getFlowerRoot().getConversion(event.itemInHand);
if (flower != null) {
Gardening.plant(world, x, y, z, flower, event.player.getGameProfile());
}
}
@Deprecated @Deprecated
public void onPlantVanilla(PlayerInteractEvent event) { public void onPlantVanilla(PlayerInteractEvent event) {
if (!BinnieCore.proxy.isSimulating(event.world) if (!BinnieCore.proxy.isSimulating(event.world)
@@ -175,13 +291,35 @@ public class Botany extends AbstractMod {
} }
IFlower flower = BotanyCore.getFlowerRoot().getConversion(event.entityPlayer.getHeldItem()); IFlower flower = BotanyCore.getFlowerRoot().getConversion(event.entityPlayer.getHeldItem());
if (flower != null && Gardening.plant(world, x, y + py, z, flower, event.entityPlayer.getGameProfile()) if (flower != null
&& Gardening.plant(world, x, y + py, z, flower, event.entityPlayer.getGameProfile())
&& !event.entityPlayer.capabilities.isCreativeMode) { && !event.entityPlayer.capabilities.isCreativeMode) {
ItemStack heldItem = event.entityPlayer.getHeldItem(); ItemStack heldItem = event.entityPlayer.getHeldItem();
heldItem.stackSize--; heldItem.stackSize--;
} }
} }
@SubscribeEvent
public void onBonemeal(BonemealEvent event) {
Block block = event.world.getBlock(event.x, event.y, event.z);
if (Gardening.isSoil(block)) {
IBlockSoil soil = (IBlockSoil) block;
if (soil.fertilise(event.world, event.x, event.y, event.z, EnumSoilType.LOAM)) {
event.setResult(Event.Result.ALLOW);
}
}
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).onBonemeal()) {
event.setResult(Event.Result.ALLOW);
}
}
@Override
public boolean isActive() {
return BinnieCore.isBotanyActive();
}
@Mod.EventHandler @Mod.EventHandler
public void onIMC(FMLInterModComms.IMCEvent event) { public void onIMC(FMLInterModComms.IMCEvent event) {
for (FMLInterModComms.IMCMessage message : event.getMessages()) { for (FMLInterModComms.IMCMessage message : event.getMessages()) {
@@ -207,143 +345,8 @@ 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);
} }
} }
public static class EventHandler {
@SubscribeEvent
public void onShearFlower(PlayerInteractEvent event) {
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
return;
}
if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null
&& event.entityPlayer.getHeldItem().getItem() == Items.shears) {
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
if (tile instanceof TileEntityFlower tileFlower) {
tileFlower.onShear();
event.entityPlayer.getHeldItem().damageItem(1, event.entityPlayer);
}
}
if (event.entityPlayer != null && event.entityPlayer.getHeldItem() != null
&& event.entityPlayer.getHeldItem().getItem() == Botany.pollen) {
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
if (tile instanceof TileEntityFlower tileFlower) {
IFlower pollen = BotanyCore.getFlowerRoot().getMember(event.entityPlayer.getHeldItem());
if (pollen != null && tileFlower.canMateWith(pollen)) {
tileFlower.mateWith(pollen);
if (!event.entityPlayer.capabilities.isCreativeMode) {
ItemStack heldItem = event.entityPlayer.getHeldItem();
heldItem.stackSize--;
}
}
}
}
}
@SubscribeEvent
public void onFertiliseSoil(PlayerInteractEvent event) {
if (event.action != PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK || event.world == null) {
return;
}
if (event.entityPlayer == null || event.entityPlayer.getHeldItem() == null) {
return;
}
int y = event.y;
Block block = event.world.getBlock(event.x, y, event.z);
if (!Gardening.isSoil(block)) {
block = event.world.getBlock(event.x, --y, event.z);
}
if (!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;
}
}
if (Gardening.isAcidFertiliser(event.entityPlayer.getHeldItem())
&& soil.getPH(event.world, event.x, y, event.z) != EnumAcidity.ACID) {
EnumAcidity pH = soil.getPH(event.world, event.x, y, event.z);
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) {
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) {
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
public void plantVanilla(BlockEvent.PlaceEvent event) {
World world = event.world;
int x = event.x;
int y = event.y;
int z = event.z;
Block block = world.getBlock(x, y - 1, z);
if (!(block instanceof IBlockSoil)) {
return;
}
IFlower flower = BotanyCore.getFlowerRoot().getConversion(event.itemInHand);
if (flower != null) {
Gardening.plant(world, x, y, z, flower, event.player.getGameProfile());
}
}
@SubscribeEvent
public void onBonemeal(BonemealEvent event) {
Block block = event.world.getBlock(event.x, event.y, event.z);
if (Gardening.isSoil(block)) {
IBlockSoil soil = (IBlockSoil) block;
if (soil.fertilise(event.world, event.x, event.y, event.z, EnumSoilType.LOAM)) {
event.setResult(Event.Result.ALLOW);
}
}
TileEntity tile = event.world.getTileEntity(event.x, event.y, event.z);
if (tile instanceof TileEntityFlower && ((TileEntityFlower) tile).onBonemeal()) {
event.setResult(Event.Result.ALLOW);
}
}
}
} }
@@ -1,16 +1,14 @@
package binnie.botany; package binnie.botany;
import binnie.core.util.I18N;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import binnie.core.util.I18N;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class CreativeTabBotany extends CreativeTabs { public class CreativeTabBotany extends CreativeTabs {
public static CreativeTabs instance = new CreativeTabBotany(); public static CreativeTabs instance = new CreativeTabBotany();
public CreativeTabBotany() { public CreativeTabBotany() {
@@ -1,16 +1,10 @@
package binnie.botany.api; package binnie.botany.api;
public enum EnumAcidity { public enum EnumAcidity {
ACID, ACID,
NEUTRAL, NEUTRAL,
ALKALINE; ALKALINE;
/**
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
*/
public static final EnumAcidity[] VALUES = values();
public String getID() { public String getID() {
return name().toLowerCase(); return name().toLowerCase();
} }
@@ -10,7 +10,6 @@ import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.ISpeciesRoot; 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),
@@ -24,11 +23,7 @@ public enum EnumFlowerChromosome implements IChromosomeType {
SAPPINESS(IAlleleFloat.class), SAPPINESS(IAlleleFloat.class),
STEM(IAlleleInteger.class); STEM(IAlleleInteger.class);
/** private Class<? extends IAllele> cls;
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
*/
public static final EnumFlowerChromosome[] VALUES = values();
private final Class<? extends IAllele> cls;
EnumFlowerChromosome(Class<? extends IAllele> cls) { EnumFlowerChromosome(Class<? extends IAllele> cls) {
this.cls = cls; this.cls = cls;
@@ -1,13 +1,12 @@
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");
private final String name; protected String name;
EnumFlowerStage(String name) { EnumFlowerStage(String name) {
this.name = name; this.name = name;
@@ -1,16 +1,10 @@
package binnie.botany.api; package binnie.botany.api;
public enum EnumMoisture { public enum EnumMoisture {
DRY, DRY,
NORMAL, NORMAL,
DAMP; DAMP;
/**
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
*/
public static final EnumMoisture[] VALUES = values();
public String getID() { public String getID() {
return name().toLowerCase(); return name().toLowerCase();
} }
@@ -1,16 +1,10 @@
package binnie.botany.api; package binnie.botany.api;
public enum EnumSoilType { public enum EnumSoilType {
SOIL, SOIL,
LOAM, LOAM,
FLOWERBED; FLOWERBED;
/**
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
*/
public static final EnumSoilType[] VALUES = values();
public String getID() { public String getID() {
return name().toLowerCase(); return name().toLowerCase();
} }
@@ -1,11 +1,9 @@
package binnie.botany.api; package binnie.botany.api;
import net.minecraft.world.World;
import forestry.api.genetics.IAlleleEffect; import forestry.api.genetics.IAlleleEffect;
import forestry.api.genetics.IEffectData; 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(IFlowerGenome genome, IEffectData storedData, World world, int x, int y, int z);
} }
@@ -3,7 +3,6 @@ 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();
@@ -2,5 +2,4 @@ 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,7 +1,6 @@
package binnie.botany.api; package binnie.botany.api;
public interface IColourMix { public interface IColourMix {
IFlowerColor getColor1(); IFlowerColor getColor1();
IFlowerColor getColor2(); IFlowerColor getColor2();
+1 -3
View File
@@ -1,11 +1,9 @@
package binnie.botany.api; package binnie.botany.api;
import forestry.api.genetics.IIndividual;
import net.minecraft.world.World; import net.minecraft.world.World;
import forestry.api.genetics.IIndividual;
public interface IFlower extends IIndividual { public interface IFlower extends IIndividual {
@Override @Override
IFlowerGenome getGenome(); IFlowerGenome getGenome();
@@ -3,7 +3,6 @@ package binnie.botany.api;
import forestry.api.genetics.IAlleleInteger; import forestry.api.genetics.IAlleleInteger;
public interface IFlowerColor { public interface IFlowerColor {
int getColor(boolean dis); int getColor(boolean dis);
IAlleleInteger getAllele(); IAlleleInteger getAllele();
@@ -5,7 +5,6 @@ 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();
@@ -5,6 +5,5 @@ 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(IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1);
} }
@@ -1,17 +1,13 @@
package binnie.botany.api; package binnie.botany.api;
import com.mojang.authlib.GameProfile;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.ISpeciesRoot;
import java.util.Collection; import java.util.Collection;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.World; import net.minecraft.world.World;
import com.mojang.authlib.GameProfile;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.ISpeciesRoot;
public interface IFlowerRoot extends ISpeciesRoot { public interface IFlowerRoot extends ISpeciesRoot {
@Override @Override
IFlower getMember(ItemStack stack); IFlower getMember(ItemStack stack);
@@ -3,7 +3,6 @@ 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(EnumFlowerStage stage, boolean flowered, int section);
IIcon getPetalIcon(EnumFlowerStage stage, boolean flowered, int section); IIcon getPetalIcon(EnumFlowerStage stage, boolean flowered, int section);
@@ -1,13 +1,11 @@
package binnie.botany.api.gardening; package binnie.botany.api.gardening;
import net.minecraft.world.World;
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.world.World;
public interface IBlockSoil { public interface IBlockSoil {
EnumAcidity getPH(World world, int x, int y, int z); EnumAcidity getPH(World world, int x, int y, int z);
EnumMoisture getMoisture(World world, int x, int y, int z); EnumMoisture getMoisture(World world, int x, int y, int z);
@@ -1,8 +1,16 @@
package binnie.botany.ceramic; package binnie.botany.ceramic;
import binnie.botany.Botany;
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.SideOnly;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@@ -18,18 +26,7 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import binnie.botany.Botany;
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.SideOnly;
public class BlockCeramic extends Block implements IBlockMetadata { public class BlockCeramic extends Block implements IBlockMetadata {
public BlockCeramic() { public BlockCeramic() {
super(Material.rock); super(Material.rock);
setHardness(1.0f); setHardness(1.0f);
@@ -81,7 +78,7 @@ public class BlockCeramic extends Block implements IBlockMetadata {
} }
@Override @Override
public void addBlockTooltip(ItemStack stack, List<String> tooltip) { public void addBlockTooltip(ItemStack stack, List tooltip) {
int meta = TileEntityMetadata.getItemDamage(stack); int meta = TileEntityMetadata.getItemDamage(stack);
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(meta).getName()); tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(meta).getName());
} }
@@ -92,8 +89,8 @@ public class BlockCeramic extends Block implements IBlockMetadata {
} }
@Override @Override
public void getSubBlocks(Item item, CreativeTabs tabs, List<ItemStack> itemList) { public void getSubBlocks(Item item, CreativeTabs tabs, List itemList) {
for (EnumFlowerColor c : EnumFlowerColor.VALUES) { for (EnumFlowerColor c : EnumFlowerColor.values()) {
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal())); itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
} }
} }
@@ -1,8 +1,20 @@
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.core.BinnieCore;
import binnie.core.block.BlockMetadata;
import binnie.core.block.IBlockMetadata;
import binnie.core.block.IMultipassBlock;
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.SideOnly;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@@ -18,22 +30,7 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import binnie.botany.Botany;
import binnie.botany.CreativeTabBotany;
import binnie.botany.genetics.EnumFlowerColor;
import binnie.botany.items.BotanyItems;
import binnie.core.BinnieCore;
import binnie.core.block.BlockMetadata;
import binnie.core.block.IBlockMetadata;
import binnie.core.block.IMultipassBlock;
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.SideOnly;
public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipassBlock { public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipassBlock {
public BlockCeramicBrick() { public BlockCeramicBrick() {
super(Material.rock); super(Material.rock);
setHardness(1.0f); setHardness(1.0f);
@@ -90,7 +87,7 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
} }
@Override @Override
public void addBlockTooltip(ItemStack itemStack, List<String> tooltip) { public void addBlockTooltip(ItemStack itemStack, List tooltip) {
int meta = TileEntityMetadata.getItemDamage(itemStack); int meta = TileEntityMetadata.getItemDamage(itemStack);
getType(meta).addTooltip(tooltip); getType(meta).addTooltip(tooltip);
} }
@@ -101,13 +98,13 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
} }
@Override @Override
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> itemList) { public void getSubBlocks(Item item, CreativeTabs tab, List itemList) {
for (EnumFlowerColor c : EnumFlowerColor.VALUES) { for (EnumFlowerColor c : EnumFlowerColor.values()) {
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 (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));
} }
@@ -130,13 +127,13 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
@Override @Override
public IIcon getIcon(int side, int meta) { public IIcon getIcon(int side, int meta) {
return TileType.get(meta >>> 16 & 0xFF).icons[MultipassBlockRenderer.getLayer()]; return getType(meta).getIcon(MultipassBlockRenderer.getLayer());
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister register) { public void registerBlockIcons(IIconRegister register) {
for (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);
} }
@@ -167,9 +164,6 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public int getRenderColor(int meta) { public int getRenderColor(int meta) {
if (!MultipassBlockRenderer.isRendering()) {
return EnumFlowerColor.get(meta & 0xFF).getColor(false);
}
return colorMultiplier(meta); return colorMultiplier(meta);
} }
@@ -180,14 +174,14 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
@Override @Override
public int colorMultiplier(int meta) { public int colorMultiplier(int meta) {
int layer = MultipassBlockRenderer.getLayer(); BlockType type = getType(meta);
if (layer == 0) { if (MultipassBlockRenderer.getLayer() == 0) {
return 0xffffff; return 0xffffff;
} }
if (layer == 1) { if (MultipassBlockRenderer.getLayer() == 1) {
return EnumFlowerColor.get(meta & 0xFF).getColor(false); return type.color1.getColor(false);
} }
return EnumFlowerColor.get(meta >>> 8 & 0xFF).getColor(false); return type.color2.getColor(false);
} }
@Override @Override
@@ -196,7 +190,6 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
} }
public enum TileType { public enum TileType {
Tile("tile", "ceramicTile"), Tile("tile", "ceramicTile"),
Brick("brick", "ceramicBricks"), Brick("brick", "ceramicBricks"),
StripeBrick("brickstripe", "strippedCeramicBricks"), StripeBrick("brickstripe", "strippedCeramicBricks"),
@@ -208,13 +201,9 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
VerticalStripeBrick("verticalbrickstripe", "verticalStripedCeramicBricks"), VerticalStripeBrick("verticalbrickstripe", "verticalStripedCeramicBricks"),
VerticalLargeBrick("verticalbricklarge", "largeVerticalCeramicBricks"); VerticalLargeBrick("verticalbricklarge", "largeVerticalCeramicBricks");
/** protected String id;
* Cached values() array for frequent read-only operations, the array should NOT be mutated. protected String name;
*/ protected IIcon[] icons;
public static final TileType[] VALUES = values();
private final String id;
private final String name;
private final IIcon[] icons;
TileType(String id, String name) { TileType(String id, String name) {
icons = new IIcon[3]; icons = new IIcon[3];
@@ -223,7 +212,7 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
} }
public static TileType get(int id) { public static TileType get(int id) {
return VALUES[id % VALUES.length]; return values()[id % values().length];
} }
public boolean canDouble() { public boolean canDouble() {
@@ -231,15 +220,32 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
} }
public ItemStack getRecipe(List<ItemStack> stacks) { public ItemStack getRecipe(List<ItemStack> stacks) {
return switch (this) { switch (this) {
case Tile -> getTileRecipe(stacks); case Tile:
case Split -> getSplitRecipe(stacks); return getTileRecipe(stacks);
case Chequered -> getChequeredRecipe(stacks);
case Mixed -> getMixedRecipe(stacks); case Split:
case LargeBrick -> getLargeBrickRecipe(stacks); return getSplitRecipe(stacks);
case Brick, StripeBrick -> getBrickRecipe(stacks);
case VerticalLargeBrick, VerticalBrick, VerticalStripeBrick -> getVerticalBrickRecipe(stacks); case Chequered:
}; return getChequeredRecipe(stacks);
case Mixed:
return getMixedRecipe(stacks);
case LargeBrick:
return getLargeBrickRecipe(stacks);
case Brick:
case StripeBrick:
return getBrickRecipe(stacks);
case VerticalLargeBrick:
case VerticalBrick:
case VerticalStripeBrick:
return getVerticalBrickRecipe(stacks);
}
return null;
} }
private ItemStack getTileRecipe(List<ItemStack> stacks) { private ItemStack getTileRecipe(List<ItemStack> stacks) {
@@ -278,7 +284,7 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
return null; return null;
} }
int[] colors = { -1, -1 }; int[] colors = {-1, -1};
int altCounter = 0; int altCounter = 0;
for (ItemStack stack : stacks) { for (ItemStack stack : stacks) {
int alt = (altCounter != 0 && altCounter != 3) ? 1 : 0; int alt = (altCounter != 0 && altCounter != 3) ? 1 : 0;
@@ -308,7 +314,7 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
return null; return null;
} }
int[] colors = { -1, -1 }; int[] colors = {-1, -1};
for (ItemStack stack : stacks) { for (ItemStack stack : stacks) {
if (stack.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) { if (stack.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
return null; return null;
@@ -337,7 +343,7 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
return null; return null;
} }
int[] colors = { -1, -1 }; int[] colors = {-1, -1};
for (ItemStack stack : stacks) { for (ItemStack stack : stacks) {
if (stack.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) { if (stack.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
return null; return null;
@@ -389,7 +395,7 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
return null; return null;
} }
int[] colors = { -1, -1 }; int[] colors = {-1, -1};
for (ItemStack stack4 : stacks) { for (ItemStack stack4 : stacks) {
if (stack4.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) { if (stack4.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
return null; return null;
@@ -437,7 +443,7 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
return null; return null;
} }
int[] colors = { -1, -1 }; int[] colors = {-1, -1};
for (int index2 = 0; index2 < stacks.size(); ++index2) { for (int index2 = 0; index2 < stacks.size(); ++index2) {
ItemStack stack = stacks.get(index2); ItemStack stack = stacks.get(index2);
if (stack.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) { if (stack.getItem() != Item.getItemFromBlock(Botany.ceramicBrick)) {
@@ -496,7 +502,6 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
} }
public static class BlockType { public static class BlockType {
protected EnumFlowerColor color1; protected EnumFlowerColor color1;
protected EnumFlowerColor color2; protected EnumFlowerColor color2;
protected TileType type; protected TileType type;
@@ -531,7 +536,7 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
return I18N.localise("botany." + type.name); return I18N.localise("botany." + type.name);
} }
public void addTooltip(List<String> tooltip) { public void addTooltip(List tooltip) {
String name = color1.getName(); String name = color1.getName();
if (type.canDouble() && color2 != color1) { if (type.canDouble() && color2 != color1) {
name = I18N.localise("botany.colour.double", name, color2.getName()); name = I18N.localise("botany.colour.double", name, color2.getName());
@@ -1,11 +1,5 @@
package binnie.botany.ceramic; package binnie.botany.ceramic;
import java.util.List;
import net.minecraft.block.material.Material;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import binnie.botany.CreativeTabBotany; import binnie.botany.CreativeTabBotany;
import binnie.botany.genetics.EnumFlowerColor; import binnie.botany.genetics.EnumFlowerColor;
import binnie.core.block.TileEntityMetadata; import binnie.core.block.TileEntityMetadata;
@@ -14,9 +8,12 @@ import binnie.extratrees.api.IDesign;
import binnie.extratrees.carpentry.BlockDesign; 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 java.util.List;
import net.minecraft.block.material.Material;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
public class BlockCeramicPatterned extends BlockDesign { public class BlockCeramicPatterned extends BlockDesign {
public BlockCeramicPatterned() { public BlockCeramicPatterned() {
super(CeramicDesignSystem.instance, Material.rock); super(CeramicDesignSystem.instance, Material.rock);
setHardness(1.0f); setHardness(1.0f);
@@ -28,10 +25,7 @@ public class BlockCeramicPatterned extends BlockDesign {
@Override @Override
public ItemStack getCreativeStack(IDesign design) { public ItemStack getCreativeStack(IDesign design) {
return ModuleCarpentry.getItemStack( return ModuleCarpentry.getItemStack(
this, this, CeramicColor.get(EnumFlowerColor.WHITE), CeramicColor.get(EnumFlowerColor.BLACK), design);
CeramicColor.get(EnumFlowerColor.WHITE),
CeramicColor.get(EnumFlowerColor.BLACK),
design);
} }
@Override @Override
@@ -40,7 +34,7 @@ public class BlockCeramicPatterned extends BlockDesign {
} }
@Override @Override
public void addBlockTooltip(ItemStack stack, List<String> tooltip) { public void addBlockTooltip(ItemStack stack, List tooltip) {
super.addBlockTooltip(stack, tooltip); super.addBlockTooltip(stack, tooltip);
DesignBlock block = ModuleCarpentry.getDesignBlock(getDesignSystem(), TileEntityMetadata.getItemDamage(stack)); DesignBlock block = ModuleCarpentry.getDesignBlock(getDesignSystem(), TileEntityMetadata.getItemDamage(stack));
tooltip.add(EnumChatFormatting.GRAY + block.getDesign().getName()); tooltip.add(EnumChatFormatting.GRAY + block.getDesign().getName());
@@ -1,9 +1,18 @@
package binnie.botany.ceramic; package binnie.botany.ceramic;
import binnie.botany.Botany;
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 binnie.extratrees.ExtraTrees;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@@ -19,22 +28,9 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import binnie.botany.Botany;
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 binnie.extratrees.ExtraTrees;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockStained extends Block implements IBlockMetadata { public class BlockStained extends Block implements IBlockMetadata {
public BlockStained() { public BlockStained() {
super(Material.glass); super(Material.glass);
setHardness(0.3f);
setCreativeTab(CreativeTabBotany.instance); setCreativeTab(CreativeTabBotany.instance);
setBlockName("stained"); setBlockName("stained");
} }
@@ -63,7 +59,7 @@ public class BlockStained extends Block implements IBlockMetadata {
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) { public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
// Block block2 = world.getBlock(x - Facing.offsetsXForSide[side], y - Facing.offsetsYForSide[side], z - // Block block2 = world.getBlock(x - Facing.offsetsXForSide[side], y - Facing.offsetsYForSide[side], z -
// Facing.offsetsZForSide[side]); // Facing.offsetsZForSide[side]);
Block block = world.getBlock(x, y, z); Block block = world.getBlock(x, y, z);
return block != this && block != ExtraTrees.blockStained && super.shouldSideBeRendered(world, x, y, z, side); return block != this && block != ExtraTrees.blockStained && super.shouldSideBeRendered(world, x, y, z, side);
@@ -112,7 +108,7 @@ public class BlockStained extends Block implements IBlockMetadata {
} }
@Override @Override
public void addBlockTooltip(ItemStack itemStack, List<String> tooltip) { public void addBlockTooltip(ItemStack itemStack, List tooltip) {
int meta = TileEntityMetadata.getItemDamage(itemStack); int meta = TileEntityMetadata.getItemDamage(itemStack);
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(meta).getName()); tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(meta).getName());
} }
@@ -123,8 +119,8 @@ public class BlockStained extends Block implements IBlockMetadata {
} }
@Override @Override
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> itemList) { public void getSubBlocks(Item item, CreativeTabs tab, List itemList) {
for (EnumFlowerColor c : EnumFlowerColor.VALUES) { for (EnumFlowerColor c : EnumFlowerColor.values()) {
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal())); itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
} }
} }
@@ -1,22 +1,19 @@
package binnie.botany.ceramic; package binnie.botany.ceramic;
import java.util.LinkedHashMap;
import java.util.Map;
import net.minecraft.item.ItemStack;
import binnie.botany.Botany; import binnie.botany.Botany;
import binnie.botany.genetics.EnumFlowerColor; import binnie.botany.genetics.EnumFlowerColor;
import binnie.core.block.TileEntityMetadata; import binnie.core.block.TileEntityMetadata;
import binnie.extratrees.api.IDesignMaterial; import binnie.extratrees.api.IDesignMaterial;
import java.util.LinkedHashMap;
import java.util.Map;
import net.minecraft.item.ItemStack;
public class CeramicColor implements IDesignMaterial { public class CeramicColor implements IDesignMaterial {
private static Map<EnumFlowerColor, CeramicColor> map; private static Map<EnumFlowerColor, CeramicColor> map;
static { static {
CeramicColor.map = new LinkedHashMap<>(); CeramicColor.map = new LinkedHashMap<>();
for (EnumFlowerColor c : EnumFlowerColor.VALUES) { for (EnumFlowerColor c : EnumFlowerColor.values()) {
CeramicColor.map.put(c, new CeramicColor(c)); CeramicColor.map.put(c, new CeramicColor(c));
} }
} }
@@ -1,13 +1,5 @@
package binnie.botany.ceramic; package binnie.botany.ceramic;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import binnie.botany.Botany; import binnie.botany.Botany;
import binnie.botany.genetics.EnumFlowerColor; import binnie.botany.genetics.EnumFlowerColor;
import binnie.botany.items.BotanyItems; import binnie.botany.items.BotanyItems;
@@ -18,9 +10,14 @@ import binnie.extratrees.api.IDesignSystem;
import binnie.extratrees.api.IPattern; import binnie.extratrees.api.IPattern;
import binnie.extratrees.carpentry.DesignerManager; import binnie.extratrees.carpentry.DesignerManager;
import binnie.extratrees.carpentry.EnumPattern; import binnie.extratrees.carpentry.EnumPattern;
import java.util.HashMap;
import java.util.Map;
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 { public class CeramicDesignSystem implements IDesignSystem {
public static CeramicDesignSystem instance = new CeramicDesignSystem(); public static CeramicDesignSystem instance = new CeramicDesignSystem();
protected Map<Integer, IIcon> primary; protected Map<Integer, IIcon> primary;
@@ -74,7 +71,7 @@ public class CeramicDesignSystem implements IDesignSystem {
@Override @Override
public void registerIcons(IIconRegister register) { public void registerIcons(IIconRegister register) {
for (EnumPattern pattern : EnumPattern.VALUES) { for (EnumPattern pattern : EnumPattern.values()) {
primary.put( primary.put(
pattern.ordinal(), pattern.ordinal(),
BinnieCore.proxy.getIcon( BinnieCore.proxy.getIcon(
@@ -1,18 +1,15 @@
package binnie.botany.ceramic; package binnie.botany.ceramic;
import binnie.botany.Botany;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.minecraft.inventory.InventoryCrafting; import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.Item; 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; import net.minecraft.world.World;
import binnie.botany.Botany;
public class CeramicTileRecipe implements IRecipe { public class CeramicTileRecipe implements IRecipe {
protected ItemStack cached; protected ItemStack cached;
@Override @Override
@@ -52,7 +49,7 @@ public class CeramicTileRecipe implements IRecipe {
} }
} }
for (BlockCeramicBrick.TileType type : BlockCeramicBrick.TileType.VALUES) { for (BlockCeramicBrick.TileType type : BlockCeramicBrick.TileType.values()) {
ItemStack stack2 = type.getRecipe(stacks); ItemStack stack2 = type.getRecipe(stacks);
if (stack2 != null) { if (stack2 != null) {
return stack2; return stack2;
@@ -1,19 +1,17 @@
package binnie.botany.ceramic; package binnie.botany.ceramic;
import binnie.Binnie;
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; import net.minecraft.world.World;
import binnie.Binnie;
import binnie.botany.Botany;
import binnie.botany.api.IFlower;
public class PigmentRecipe implements IRecipe { public class PigmentRecipe implements IRecipe {
protected ItemStack cached; protected ItemStack cached;
private final ItemStack unknown; private ItemStack unknown;
public PigmentRecipe() { public PigmentRecipe() {
unknown = null; unknown = null;
@@ -47,7 +45,10 @@ public class PigmentRecipe implements IRecipe {
IFlower flower = Binnie.Genetics.getFlowerRoot().getMember(crafting.getStackInSlot(i)); IFlower flower = Binnie.Genetics.getFlowerRoot().getMember(crafting.getStackInSlot(i));
if (flower.getAge() >= 1) { if (flower.getAge() >= 1) {
stack = new ItemStack(Botany.pigment, 1, flower.getGenome().getPrimaryColor().getID()); stack = new ItemStack(
Botany.pigment,
1,
flower.getGenome().getPrimaryColor().getID());
} }
} }
} }
@@ -4,7 +4,6 @@ import binnie.botany.api.IFlowerRoot;
import binnie.botany.genetics.FlowerHelper; import binnie.botany.genetics.FlowerHelper;
public class BotanyCore { public class BotanyCore {
public static IFlowerRoot speciesRoot = new FlowerHelper(); public static IFlowerRoot speciesRoot = new FlowerHelper();
public static IFlowerRoot getFlowerRoot() { public static IFlowerRoot getFlowerRoot() {
@@ -1,15 +1,13 @@
package binnie.botany.core; package binnie.botany.core;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import binnie.botany.craftgui.WindowBotanistDatabase; import binnie.botany.craftgui.WindowBotanistDatabase;
import binnie.core.craftgui.minecraft.Window; import binnie.core.craftgui.minecraft.Window;
import binnie.core.gui.IBinnieGUID; import binnie.core.gui.IBinnieGUID;
import cpw.mods.fml.relauncher.Side; 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;
@@ -3,7 +3,6 @@ package binnie.botany.core;
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() {
// ignored // ignored
@@ -11,7 +11,6 @@ import binnie.core.craftgui.controls.core.IControlValue;
import binnie.core.craftgui.geometry.IArea; import binnie.core.craftgui.geometry.IArea;
public class ControlColorDisplay extends Control implements IControlValue<IFlowerColor>, ITooltip { public class ControlColorDisplay extends Control implements IControlValue<IFlowerColor>, ITooltip {
private IFlowerColor value; private IFlowerColor value;
public ControlColorDisplay(IWidget parent, float x, float y) { public ControlColorDisplay(IWidget parent, float x, float y) {
@@ -5,8 +5,7 @@ import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.controls.listbox.ControlListBox; import binnie.core.craftgui.controls.listbox.ControlListBox;
public class ControlColorMixBox extends ControlListBox<IColourMix> { public class ControlColorMixBox extends ControlListBox<IColourMix> {
private Type type;
private final Type type;
public ControlColorMixBox(IWidget parent, int x, int y, int width, int height, Type type) { public ControlColorMixBox(IWidget parent, int x, int y, int width, int height, Type type) {
super(parent, x, y, width, height, 12.0f); super(parent, x, y, width, height, 12.0f);
@@ -18,7 +17,7 @@ public class ControlColorMixBox extends ControlListBox<IColourMix> {
return new ControlColorMixItem(getContent(), value, y); return new ControlColorMixItem(getContent(), value, y);
} }
public enum Type { enum Type {
Resultant, Resultant,
Further Further
} }
@@ -5,7 +5,6 @@ import binnie.core.craftgui.controls.listbox.ControlList;
import binnie.core.craftgui.controls.listbox.ControlOption; import binnie.core.craftgui.controls.listbox.ControlOption;
public class ControlColorMixItem extends ControlOption<IColourMix> { public class ControlColorMixItem extends ControlOption<IColourMix> {
protected ControlColorDisplay itemWidget1; protected ControlColorDisplay itemWidget1;
protected ControlColorDisplay itemWidget2; protected ControlColorDisplay itemWidget2;
protected ControlColorDisplay itemWidget3; protected ControlColorDisplay itemWidget3;
@@ -9,7 +9,6 @@ import binnie.core.craftgui.geometry.CraftGUIUtil;
import binnie.core.craftgui.geometry.IPoint; import binnie.core.craftgui.geometry.IPoint;
public class ControlColorOption extends ControlTextOption<IFlowerColor> { public class ControlColorOption extends ControlTextOption<IFlowerColor> {
protected ControlColorDisplay controlBee; protected ControlColorDisplay controlBee;
protected IPoint boxPosition; protected IPoint boxPosition;
@@ -20,7 +19,8 @@ public class ControlColorOption extends ControlTextOption<IFlowerColor> {
addAttribute(WidgetAttribute.MOUSE_OVER); addAttribute(WidgetAttribute.MOUSE_OVER);
CraftGUIUtil.moveWidget(textWidget, new IPoint(22.0f, 0.0f)); CraftGUIUtil.moveWidget(textWidget, new IPoint(22.0f, 0.0f));
textWidget.setSize(textWidget.getSize().sub(new IPoint(24.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 th = (int) CraftGUI.render.textHeight(
textWidget.getValue(), textWidget.getSize().x());
int height = Math.max(20, th + 6); int height = Math.max(20, th + 6);
setSize(new IPoint(size().x(), height)); setSize(new IPoint(size().x(), height));
textWidget.setSize(new IPoint(textWidget.getSize().x(), height)); textWidget.setSize(new IPoint(textWidget.getSize().x(), height));
@@ -14,7 +14,6 @@ import binnie.core.craftgui.resource.minecraft.StandardTexture;
import binnie.core.util.I18N; import binnie.core.util.I18N;
public class ControlColourMixSymbol extends Control implements ITooltip { public class ControlColourMixSymbol extends Control implements ITooltip {
protected static Texture MutationPlus = new StandardTexture(2, 94, 16, 16, CraftGUITextureSheet.Controls2); 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 static Texture MutationArrow = new StandardTexture(20, 94, 32, 16, CraftGUITextureSheet.Controls2);
@@ -1,8 +1,5 @@
package binnie.botany.craftgui; package binnie.botany.craftgui;
import java.util.ArrayList;
import java.util.List;
import binnie.botany.api.IColourMix; import binnie.botany.api.IColourMix;
import binnie.botany.api.IFlowerColor; import binnie.botany.api.IFlowerColor;
import binnie.botany.core.BotanyCore; import binnie.botany.core.BotanyCore;
@@ -12,9 +9,10 @@ import binnie.core.craftgui.controls.ControlTextCentered;
import binnie.core.craftgui.database.DatabaseTab; import binnie.core.craftgui.database.DatabaseTab;
import binnie.core.craftgui.database.PageAbstract; import binnie.core.craftgui.database.PageAbstract;
import binnie.core.util.I18N; import binnie.core.util.I18N;
import java.util.ArrayList;
import java.util.List;
public class PageColorMix extends PageAbstract<IFlowerColor> { public class PageColorMix extends PageAbstract<IFlowerColor> {
ControlText title; ControlText title;
ControlColorMixBox list; ControlColorMixBox list;
@@ -1,8 +1,5 @@
package binnie.botany.craftgui; package binnie.botany.craftgui;
import java.util.ArrayList;
import java.util.List;
import binnie.botany.api.IColourMix; import binnie.botany.api.IColourMix;
import binnie.botany.api.IFlowerColor; import binnie.botany.api.IFlowerColor;
import binnie.botany.core.BotanyCore; import binnie.botany.core.BotanyCore;
@@ -12,9 +9,10 @@ import binnie.core.craftgui.controls.ControlTextCentered;
import binnie.core.craftgui.database.DatabaseTab; import binnie.core.craftgui.database.DatabaseTab;
import binnie.core.craftgui.database.PageAbstract; import binnie.core.craftgui.database.PageAbstract;
import binnie.core.util.I18N; import binnie.core.util.I18N;
import java.util.ArrayList;
import java.util.List;
public class PageColorMixResultant extends PageAbstract<IFlowerColor> { public class PageColorMixResultant extends PageAbstract<IFlowerColor> {
protected ControlText title; protected ControlText title;
protected ControlColorMixBox list; protected ControlColorMixBox list;
@@ -1,7 +1,5 @@
package binnie.botany.craftgui; package binnie.botany.craftgui;
import net.minecraft.item.ItemStack;
import binnie.Binnie; import binnie.Binnie;
import binnie.botany.api.EnumFlowerChromosome; import binnie.botany.api.EnumFlowerChromosome;
import binnie.botany.api.EnumFlowerStage; import binnie.botany.api.EnumFlowerStage;
@@ -24,9 +22,9 @@ import binnie.genetics.genetics.AlleleHelper;
import forestry.api.genetics.IAllele; import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleSpecies; import forestry.api.genetics.IAlleleSpecies;
import forestry.api.genetics.IIndividual; import forestry.api.genetics.IIndividual;
import net.minecraft.item.ItemStack;
public class PageSpeciesFlowerGenome extends PageSpecies { public class PageSpeciesFlowerGenome extends PageSpecies {
public PageSpeciesFlowerGenome(IWidget parent, DatabaseTab tab) { public PageSpeciesFlowerGenome(IWidget parent, DatabaseTab tab) {
super(parent, tab); super(parent, tab);
} }
@@ -105,10 +103,7 @@ public class PageSpeciesFlowerGenome extends PageSpecies {
I18N.localise("botany.gui.database.tab.genome.fertility"), I18N.localise("botany.gui.database.tab.genome.fertility"),
TextJustification.MIDDLE_RIGHT); TextJustification.MIDDLE_RIGHT);
new ControlText( new ControlText(
contents, contents, new IArea(valueX, y, w3, th), genome.getFertility() + "x", TextJustification.MIDDLE_LEFT);
new IArea(valueX, y, w3, th),
genome.getFertility() + "x",
TextJustification.MIDDLE_LEFT);
y += th; y += th;
float lifespan = genome.getLifespan() * 68.27f / genome.getAgeChance() / 24000.0f; float lifespan = genome.getLifespan() * 68.27f / genome.getAgeChance() / 24000.0f;
@@ -1,11 +1,5 @@
package binnie.botany.craftgui; package binnie.botany.craftgui;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import binnie.Binnie; import binnie.Binnie;
import binnie.botany.Botany; import binnie.botany.Botany;
import binnie.botany.api.IFlowerColor; import binnie.botany.api.IFlowerColor;
@@ -27,9 +21,12 @@ import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.minecraft.Window; import binnie.core.craftgui.minecraft.Window;
import binnie.core.util.I18N; import binnie.core.util.I18N;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
public class WindowBotanistDatabase extends WindowAbstractDatabase { public class WindowBotanistDatabase extends WindowAbstractDatabase {
public WindowBotanistDatabase(EntityPlayer player, Side side, boolean nei) { public WindowBotanistDatabase(EntityPlayer player, Side side, boolean nei) {
super(player, side, nei, Binnie.Genetics.flowerBreedingSystem, 130.0f); super(player, side, nei, Binnie.Genetics.flowerBreedingSystem, 130.0f);
} }
@@ -43,8 +40,7 @@ public class WindowBotanistDatabase extends WindowAbstractDatabase {
new PageSpeciesOverview(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.overview")); new PageSpeciesOverview(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.overview"));
new PageSpeciesFlowerGenome(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "genome")); new PageSpeciesFlowerGenome(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "genome"));
new PageSpeciesClassification( new PageSpeciesClassification(
getInfoPages(Mode.Species), getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.classification"));
new DatabaseTab(Botany.instance, "species.classification"));
new PageSpeciesResultant(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.resultant")); new PageSpeciesResultant(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.resultant"));
new PageSpeciesMutations(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.further")); new PageSpeciesMutations(getInfoPages(Mode.Species), new DatabaseTab(Botany.instance, "species.further"));
new PageBranchOverview(getInfoPages(Mode.Branches), new DatabaseTab(Botany.instance, "branches.overview")); new PageBranchOverview(getInfoPages(Mode.Branches), new DatabaseTab(Botany.instance, "branches.overview"));
@@ -66,7 +62,6 @@ public class WindowBotanistDatabase extends WindowAbstractDatabase {
} }
enum FlowerMode implements IDatabaseMode { enum FlowerMode implements IDatabaseMode {
COLOR; COLOR;
@Override @Override
@@ -76,7 +71,6 @@ public class WindowBotanistDatabase extends WindowAbstractDatabase {
} }
private class ColorModeWidget extends ModeWidgets { private class ColorModeWidget extends ModeWidgets {
public ColorModeWidget() { public ColorModeWidget() {
super(FlowerMode.COLOR, WindowBotanistDatabase.this); super(FlowerMode.COLOR, WindowBotanistDatabase.this);
} }
@@ -84,14 +78,13 @@ public class WindowBotanistDatabase extends WindowAbstractDatabase {
@Override @Override
public void createListBox(IArea area) { public void createListBox(IArea area) {
listBox = new ControlListBox<IFlowerColor>(modePage, area.x(), area.y(), area.w(), area.h(), 12.0f) { listBox = new ControlListBox<IFlowerColor>(modePage, area.x(), area.y(), area.w(), area.h(), 12.0f) {
@Override @Override
public IWidget createOption(IFlowerColor value, int y) { public IWidget createOption(IFlowerColor value, int y) {
return new ControlColorOption(getContent(), value, y); return new ControlColorOption(getContent(), value, y);
} }
}; };
List<IFlowerColor> colors = new ArrayList<>(); List<IFlowerColor> colors = new ArrayList<>();
Collections.addAll(colors, EnumFlowerColor.VALUES); Collections.addAll(colors, EnumFlowerColor.values());
listBox.setOptions(colors); listBox.setOptions(colors);
} }
} }
@@ -1,8 +1,5 @@
package binnie.botany.farm; package binnie.botany.farm;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
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;
@@ -10,24 +7,29 @@ import binnie.core.util.I18N;
import forestry.api.circuits.ChipsetManager; import forestry.api.circuits.ChipsetManager;
import forestry.api.farming.FarmDirection; import forestry.api.farming.FarmDirection;
import forestry.api.farming.IFarmHousing; 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 boolean isManual;
private boolean isFertilised;
private ItemStack icon;
private EnumMoisture moisture;
private EnumAcidity acidity;
private final boolean isManual; public CircuitGarden(
private final boolean isFertilised; EnumMoisture moisture,
private final ItemStack icon; EnumAcidity ph,
private final EnumMoisture moisture; boolean manual,
private final EnumAcidity acidity; boolean fertilised,
ItemStack recipe,
public CircuitGarden(EnumMoisture moisture, EnumAcidity ph, boolean manual, boolean fertilised, ItemStack recipe,
ItemStack icon) { ItemStack icon) {
super( super(
"garden." + moisture.getID() "garden." + moisture.getID() + ((ph != null) ? ("." + ph.getID()) : "") + (manual ? ".manual" : "")
+ ((ph != null) ? ("." + ph.getID()) : "")
+ (manual ? ".manual" : "")
+ (fertilised ? ".fert" : ""), + (fertilised ? ".fert" : ""),
4, 4,
manual ? ChipsetManager.circuitRegistry.getLayout("forestry.farms.manual") manual
? ChipsetManager.circuitRegistry.getLayout("forestry.farms.manual")
: ChipsetManager.circuitRegistry.getLayout("forestry.farms.managed"), : ChipsetManager.circuitRegistry.getLayout("forestry.farms.managed"),
recipe); recipe);
this.moisture = moisture; this.moisture = moisture;
@@ -46,27 +48,27 @@ public class CircuitGarden extends BinnieCircuit {
} }
if (acidity == EnumAcidity.ACID) { if (acidity == EnumAcidity.ACID) {
if (!info.isEmpty()) { if (info.length() > 0) {
info += ", "; info += ", ";
} }
info += EnumChatFormatting.RED + I18N.localise("botany.ph.acid") + EnumChatFormatting.RESET; info += EnumChatFormatting.RED + I18N.localise("botany.ph.acid") + EnumChatFormatting.RESET;
} }
if (acidity == EnumAcidity.NEUTRAL) { if (acidity == EnumAcidity.NEUTRAL) {
if (!info.isEmpty()) { if (info.length() > 0) {
info += ", "; info += ", ";
} }
info += EnumChatFormatting.GREEN + I18N.localise("botany.ph.neutral") + EnumChatFormatting.RESET; info += EnumChatFormatting.GREEN + I18N.localise("botany.ph.neutral") + EnumChatFormatting.RESET;
} }
if (acidity == EnumAcidity.ALKALINE) { if (acidity == EnumAcidity.ALKALINE) {
if (!info.isEmpty()) { if (info.length() > 0) {
info += ", "; info += ", ";
} }
info += EnumChatFormatting.AQUA + I18N.localise("botany.ph.alkaline") + EnumChatFormatting.RESET; info += EnumChatFormatting.AQUA + I18N.localise("botany.ph.alkaline") + EnumChatFormatting.RESET;
} }
if (!info.isEmpty()) { if (info.length() > 0) {
info = " (" + info + EnumChatFormatting.RESET + ")"; info = " (" + info + EnumChatFormatting.RESET + ")";
} }
addTooltipString(I18N.localise("botany.circuit.flowers") + info); addTooltipString(I18N.localise("botany.circuit.flowers") + info);
@@ -101,4 +103,8 @@ public class CircuitGarden extends BinnieCircuit {
((IFarmHousing) tile).resetFarmLogic(FarmDirection.values()[slot]); ((IFarmHousing) tile).resetFarmLogic(FarmDirection.values()[slot]);
} }
@Override
public void onTick(int arg0, Object arg1) {
// ignored
}
} }
@@ -1,17 +1,15 @@
package binnie.botany.farm; package binnie.botany.farm;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
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.api.farming.IFarmLogic;
import forestry.core.utils.vect.Vect; 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;
public abstract class FarmLogic implements IFarmLogic { public abstract class FarmLogic implements IFarmLogic {
protected World world; protected World world;
protected IFarmHousing housing; protected IFarmHousing housing;
protected boolean isManual; protected boolean isManual;
@@ -1,9 +1,5 @@
package binnie.botany.farm; package binnie.botany.farm;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import binnie.botany.Botany; import binnie.botany.Botany;
import binnie.botany.api.EnumFlowerStage; import binnie.botany.api.EnumFlowerStage;
import binnie.botany.api.IFlower; import binnie.botany.api.IFlower;
@@ -11,9 +7,11 @@ import binnie.botany.core.BotanyCore;
import binnie.botany.gardening.Gardening; import binnie.botany.gardening.Gardening;
import forestry.api.farming.ICrop; 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(World world, int x, int y, 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;
@@ -1,15 +1,13 @@
package binnie.botany.farm; package binnie.botany.farm;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import binnie.botany.api.IFlower; import binnie.botany.api.IFlower;
import binnie.botany.core.BotanyCore; import binnie.botany.core.BotanyCore;
import binnie.botany.gardening.Gardening; import binnie.botany.gardening.Gardening;
import net.minecraft.entity.player.EntityPlayer;
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(ItemStack itemstack) { public boolean isGermling(ItemStack itemstack) {
return BotanyCore.getFlowerRoot().getConversion(itemstack) != null; return BotanyCore.getFlowerRoot().getConversion(itemstack) != null;
@@ -1,9 +1,25 @@
package binnie.botany.farm; package binnie.botany.farm;
import binnie.Binnie;
import binnie.botany.Botany;
import binnie.botany.api.EnumAcidity;
import binnie.botany.api.EnumMoisture;
import binnie.botany.api.EnumSoilType;
import binnie.botany.api.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 java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
@@ -15,27 +31,7 @@ import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import com.mojang.authlib.GameProfile;
import binnie.Binnie;
import binnie.botany.Botany;
import binnie.botany.api.EnumAcidity;
import binnie.botany.api.EnumMoisture;
import binnie.botany.api.EnumSoilType;
import binnie.botany.api.gardening.IBlockSoil;
import binnie.botany.flower.TileEntityFlower;
import binnie.botany.gardening.Gardening;
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;
public class GardenLogic extends FarmLogic { public class GardenLogic extends FarmLogic {
protected EnumMoisture moisture; protected EnumMoisture moisture;
protected EnumAcidity acidity; protected EnumAcidity acidity;
protected boolean fertilised; protected boolean fertilised;
@@ -66,7 +62,8 @@ public class GardenLogic extends FarmLogic {
@Override @Override
public boolean isAcceptedResource(ItemStack stack) { public boolean isAcceptedResource(ItemStack stack) {
Item item = stack.getItem(); Item item = stack.getItem();
return Gardening.isSoil(item) || item == Item.getItemFromBlock(Blocks.sand) return Gardening.isSoil(item)
|| item == Item.getItemFromBlock(Blocks.sand)
|| item == Item.getItemFromBlock(Blocks.dirt) || item == Item.getItemFromBlock(Blocks.dirt)
|| Gardening.isAcidFertiliser(stack) || Gardening.isAcidFertiliser(stack)
|| Gardening.isAlkalineFertiliser(stack); || Gardening.isAlkalineFertiliser(stack);
@@ -82,7 +79,8 @@ public class GardenLogic extends FarmLogic {
@Override @Override
public boolean cultivate(int x, int y, int z, FarmDirection direction, int extent) { public boolean cultivate(int x, int y, int z, FarmDirection direction, int extent) {
world = housing.getWorld(); world = housing.getWorld();
return maintainSoil(x, y, z, direction, extent) || !isManual && maintainWater(x, y, z, direction, extent) return maintainSoil(x, y, z, direction, extent)
|| !isManual && maintainWater(x, y, z, direction, extent)
|| maintainCrops(x, y + 1, z, direction, extent); || maintainCrops(x, y + 1, z, direction, extent);
} }
@@ -128,25 +126,36 @@ public class GardenLogic extends FarmLogic {
EnumAcidity pH = soil.getPH(world, position.x, position.y, position.z); EnumAcidity pH = soil.getPH(world, position.x, position.y, position.z);
if (pH.ordinal() < acidity.ordinal()) { if (pH.ordinal() < acidity.ordinal()) {
ItemStack stack = getAvailableAlkaline(); ItemStack stack = getAvailableAlkaline();
if (stack != null && soil if (stack != null
.setPH(world, position.x, position.y, position.z, EnumAcidity.VALUES[pH.ordinal() + 1])) { && soil.setPH(
housing.getFarmInventory().removeResources(new ItemStack[] { stack }); world,
position.x,
position.y,
position.z,
EnumAcidity.values()[pH.ordinal() + 1])) {
housing.getFarmInventory().removeResources(new ItemStack[] {stack});
continue; continue;
} }
} }
if (pH.ordinal() > acidity.ordinal()) { if (pH.ordinal() > acidity.ordinal()) {
ItemStack stack = getAvailableAcid(); ItemStack stack = getAvailableAcid();
if (stack != null && soil if (stack != null
.setPH(world, position.x, position.y, position.z, EnumAcidity.VALUES[pH.ordinal() - 1])) { && soil.setPH(
housing.getFarmInventory().removeResources(new ItemStack[] { stack }); world,
position.x,
position.y,
position.z,
EnumAcidity.values()[pH.ordinal() - 1])) {
housing.getFarmInventory().removeResources(new ItemStack[] {stack});
continue; continue;
} }
} }
} }
if (!isAirBlock(position) && !world.getBlock(position.x, position.y, position.z) if (!isAirBlock(position)
.isReplaceable(world, position.x, position.y, position.z)) { && !world.getBlock(position.x, position.y, position.z)
.isReplaceable(world, position.x, position.y, position.z)) {
ItemStack block = getAsItemStack(position); ItemStack block = getAsItemStack(position);
ItemStack loam = getAvailableLoam(); ItemStack loam = getAvailableLoam();
if (isWaste(block) && loam != null) { if (isWaste(block) && loam != null) {
@@ -215,20 +224,20 @@ public class GardenLogic extends FarmLogic {
private ItemStack getAvailableLoam() { private ItemStack getAvailableLoam() {
EnumMoisture[] moistures; EnumMoisture[] moistures;
if (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) { } else if (moisture == EnumMoisture.DRY) {
moistures = new EnumMoisture[] { EnumMoisture.DRY, EnumMoisture.DAMP, EnumMoisture.DRY }; moistures = new EnumMoisture[] {EnumMoisture.DRY, EnumMoisture.DAMP, EnumMoisture.DRY};
} else { } else {
moistures = new EnumMoisture[] { EnumMoisture.DRY, EnumMoisture.NORMAL, EnumMoisture.DAMP }; moistures = new EnumMoisture[] {EnumMoisture.DRY, EnumMoisture.NORMAL, EnumMoisture.DAMP};
} }
EnumAcidity[] acidities = { EnumAcidity.NEUTRAL, EnumAcidity.ACID, EnumAcidity.ALKALINE }; EnumAcidity[] acidities = {EnumAcidity.NEUTRAL, EnumAcidity.ACID, EnumAcidity.ALKALINE};
for (EnumMoisture moist : moistures) { for (EnumMoisture moist : moistures) {
for (EnumAcidity acid : acidities) { for (EnumAcidity acid : acidities) {
for (Block type : new Block[] { Botany.flowerbed, Botany.loam, Botany.soil }) { for (Block type : new Block[] {Botany.flowerbed, Botany.loam, Botany.soil}) {
int meta = acid.ordinal() * 3 + moist.ordinal(); int meta = acid.ordinal() * 3 + moist.ordinal();
ItemStack[] resource = { new ItemStack(type, 1, meta) }; ItemStack[] resource = {new ItemStack(type, 1, meta)};
if (housing.getFarmInventory().hasResources(resource)) { if (housing.getFarmInventory().hasResources(resource)) {
return resource[0]; return resource[0];
} }
@@ -236,7 +245,7 @@ public class GardenLogic extends FarmLogic {
} }
} }
if (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;
@@ -257,7 +266,7 @@ public class GardenLogic extends FarmLogic {
} }
setBlock(position, ((ItemBlock) loam.getItem()).field_150939_a, loam.getItemDamage()); setBlock(position, ((ItemBlock) loam.getItem()).field_150939_a, loam.getItemDamage());
housing.getFarmInventory().removeResources(new ItemStack[] { copy }); housing.getFarmInventory().removeResources(new ItemStack[] {copy});
return true; return true;
} }
@@ -277,7 +286,7 @@ public class GardenLogic extends FarmLogic {
return trySetSoil(position); return trySetSoil(position);
} }
ItemStack[] sand = { new ItemStack(Blocks.sand, 1) }; ItemStack[] sand = {new ItemStack(Blocks.sand, 1)};
if (!housing.getFarmInventory().hasResources(sand)) { if (!housing.getFarmInventory().hasResources(sand)) {
return false; return false;
} }
@@ -359,7 +368,9 @@ public class GardenLogic extends FarmLogic {
try { try {
IOwnable housing2 = (IOwnable) housing; IOwnable housing2 = (IOwnable) housing;
GameProfile prof = (GameProfile) IOwnable.class.getMethod("getOwnerProfile").invoke(housing2); GameProfile prof = (GameProfile) IOwnable.class
.getMethod("getOwnerProfile", new Class[0])
.invoke(housing2);
((TileEntityFlower) tile).setOwner(prof); ((TileEntityFlower) tile).setOwner(prof);
} catch (Exception ex) { } catch (Exception ex) {
// ignored // ignored
@@ -371,8 +382,9 @@ public class GardenLogic extends FarmLogic {
public ItemStack getAvailableAcid() { public ItemStack getAvailableAcid() {
for (ItemStack stack : Gardening.getAcidFertilisers()) { for (ItemStack stack : Gardening.getAcidFertilisers()) {
if (stack != null && stack.getItem() != null if (stack != null
&& housing.getFarmInventory().hasResources(new ItemStack[] { stack })) { && stack.getItem() != null
&& housing.getFarmInventory().hasResources(new ItemStack[] {stack})) {
return stack; return stack;
} }
} }
@@ -381,16 +393,22 @@ public class GardenLogic extends FarmLogic {
public ItemStack getAvailableAlkaline() { public ItemStack getAvailableAlkaline() {
for (ItemStack stack : Gardening.getAlkalineFertilisers()) { for (ItemStack stack : Gardening.getAlkalineFertilisers()) {
if (stack != null && stack.getItem() != null if (stack != null
&& housing.getFarmInventory().hasResources(new ItemStack[] { stack })) { && stack.getItem() != null
&& housing.getFarmInventory().hasResources(new ItemStack[] {stack})) {
return stack; return stack;
} }
} }
return null; return null;
} }
public void setData(EnumMoisture moisture, EnumAcidity acidity, boolean isManual, boolean fertilised, public void setData(
ItemStack icon, String name) { EnumMoisture moisture,
EnumAcidity acidity,
boolean isManual,
boolean fertilised,
ItemStack icon,
String name) {
this.moisture = moisture; this.moisture = moisture;
this.acidity = acidity; this.acidity = acidity;
this.isManual = isManual; this.isManual = isManual;
@@ -1,9 +1,19 @@
package binnie.botany.flower; package binnie.botany.flower;
import binnie.botany.Botany;
import binnie.botany.api.EnumFlowerStage;
import binnie.botany.api.IFlower;
import binnie.botany.api.IFlowerType;
import binnie.botany.core.BotanyCore;
import binnie.botany.gardening.Gardening;
import binnie.botany.genetics.EnumFlowerType;
import binnie.core.BinnieCore;
import com.mojang.authlib.GameProfile;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@@ -18,21 +28,7 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import com.mojang.authlib.GameProfile;
import binnie.botany.Botany;
import binnie.botany.api.EnumFlowerStage;
import binnie.botany.api.IFlower;
import binnie.botany.api.IFlowerType;
import binnie.botany.core.BotanyCore;
import binnie.botany.gardening.Gardening;
import binnie.botany.genetics.EnumFlowerType;
import binnie.core.BinnieCore;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockFlower extends BlockContainer { public class BlockFlower extends BlockContainer {
public BlockFlower() { public BlockFlower() {
super(Material.plants); super(Material.plants);
float f = 0.2f; float f = 0.2f;
@@ -55,7 +51,7 @@ public class BlockFlower extends BlockContainer {
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister register) { public void registerBlockIcons(IIconRegister register) {
for (EnumFlowerType type : EnumFlowerType.VALUES) { for (EnumFlowerType type : EnumFlowerType.values()) {
type.registerIcons(register); type.registerIcons(register);
} }
} }
@@ -85,7 +81,7 @@ public class BlockFlower extends BlockContainer {
super.onBlockPlacedBy(world, x, y, z, entity, stack); super.onBlockPlacedBy(world, x, y, z, entity, stack);
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 instanceof TileEntityFlower) { if (flower != null && flower instanceof TileEntityFlower) {
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));
} }
@@ -93,7 +89,7 @@ public class BlockFlower extends BlockContainer {
} }
TileEntity below = world.getTileEntity(x, y - 1, z); TileEntity below = world.getTileEntity(x, y - 1, z);
if (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 {
@@ -108,19 +104,21 @@ public class BlockFlower extends BlockContainer {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
TileEntity tile = world.getTileEntity(x, y, z); TileEntity tile = world.getTileEntity(x, y, z);
if (!(tile instanceof TileEntityFlower tileFlower)) { if (!(tile instanceof TileEntityFlower)) {
return super.getIcon(world, x, y, z, side); return super.getIcon(world, x, y, z, side);
} }
EnumFlowerStage stage = (tileFlower.getAge() == 0) ? EnumFlowerStage.SEED : EnumFlowerStage.FLOWER; TileEntityFlower f = (TileEntityFlower) tile;
IFlowerType flower = tileFlower.getType(); EnumFlowerStage stage = (f.getAge() == 0) ? EnumFlowerStage.SEED : EnumFlowerStage.FLOWER;
int section = tileFlower.getRenderSection(); IFlowerType flower = f.getType();
boolean flowered = tileFlower.isFlowered(); int section = f.getRenderSection();
boolean flowered = f.isFlowered();
if (RendererBotany.pass == 0) { if (RendererBotany.pass == 0) {
return flower.getStem(stage, flowered, section); return flower.getStem(stage, flowered, section);
} }
return (RendererBotany.pass == 1) ? flower.getPetalIcon(stage, flowered, section) return (RendererBotany.pass == 1)
? flower.getPetalIcon(stage, flowered, section)
: flower.getVariantIcon(stage, flowered, section); : flower.getVariantIcon(stage, flowered, section);
} }
@@ -128,11 +126,12 @@ public class BlockFlower extends BlockContainer {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public int colorMultiplier(IBlockAccess world, int x, int y, int z) { public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
TileEntity tile = world.getTileEntity(x, y, z); TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileEntityFlower tileFlower) { if (tile instanceof TileEntityFlower) {
TileEntityFlower f = (TileEntityFlower) tile;
if (RendererBotany.pass == 0) { if (RendererBotany.pass == 0) {
return tileFlower.getStemColour(); return f.getStemColour();
} }
return (RendererBotany.pass == 1) ? tileFlower.getPrimaryColor() : tileFlower.getSecondaryColor(); return (RendererBotany.pass == 1) ? f.getPrimaryColor() : f.getSecondaryColor();
} }
return 0xffffff; return 0xffffff;
} }
@@ -151,13 +150,15 @@ public class BlockFlower extends BlockContainer {
super.onNeighborBlockChange(world, x, y, z, block); super.onNeighborBlockChange(world, x, y, z, block);
checkAndDropBlock(world, x, y, z); checkAndDropBlock(world, x, y, z);
TileEntity tile = world.getTileEntity(x, y, z); TileEntity tile = world.getTileEntity(x, y, z);
if (!(tile instanceof TileEntityFlower tileFlower)) { if (!(tile instanceof TileEntityFlower)) {
return; return;
} }
if (tileFlower.getSection() == 0 && tileFlower.getFlower() != null TileEntityFlower flower = (TileEntityFlower) tile;
&& tileFlower.getFlower().getAge() > 0 if (flower.getSection() == 0
&& tileFlower.getFlower().getGenome().getPrimary().getType().getSections() > 1 && flower.getFlower() != null
&& flower.getFlower().getAge() > 0
&& flower.getFlower().getGenome().getPrimary().getType().getSections() > 1
&& world.getBlock(x, y + 1, z) != Botany.flower) { && world.getBlock(x, y + 1, z) != Botany.flower) {
dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0); dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
world.setBlockToAir(x, y, z); world.setBlockToAir(x, y, z);
@@ -208,8 +209,9 @@ public class BlockFlower extends BlockContainer {
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) { public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) {
List<ItemStack> drops = 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);
boolean hasBeenBroken = world.setBlockToAir(x, y, z); boolean hasBeenBroken = world.setBlockToAir(x, y, z);
if (hasBeenBroken && BinnieCore.proxy.isSimulating(world) if (hasBeenBroken
&& !drops.isEmpty() && BinnieCore.proxy.isSimulating(world)
&& drops.size() > 0
&& (player == null || !player.capabilities.isCreativeMode)) { && (player == null || !player.capabilities.isCreativeMode)) {
for (ItemStack drop : drops) { for (ItemStack drop : drops) {
dropBlockAsItem(world, x, y, z, drop); dropBlockAsItem(world, x, y, z, drop);
@@ -1,9 +1,24 @@
package binnie.botany.flower; package binnie.botany.flower;
import static cpw.mods.fml.common.registry.GameRegistry.registerItem; import binnie.Binnie;
import binnie.botany.Botany;
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.SideOnly;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IPollinatable;
import forestry.core.config.Config;
import java.util.List; import java.util.List;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
@@ -11,47 +26,16 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import binnie.Binnie;
import binnie.botany.Botany;
import binnie.botany.CreativeTabBotany;
import binnie.botany.api.EnumFlowerChromosome;
import binnie.botany.api.EnumFlowerStage;
import binnie.botany.api.IAlleleFlowerSpecies;
import binnie.botany.api.IFlower;
import binnie.botany.api.IFlowerColor;
import binnie.botany.api.IFlowerGenome;
import binnie.botany.api.IFlowerType;
import binnie.botany.core.BotanyCore;
import binnie.botany.genetics.AlleleColor;
import binnie.botany.genetics.EnumFlowerColor;
import binnie.botany.genetics.EnumFlowerType;
import binnie.botany.genetics.Flower;
import binnie.botany.genetics.FlowerSpecies;
import binnie.core.BinnieCore;
import binnie.core.util.I18N;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IPollinatable;
import forestry.core.config.Config;
public abstract class ItemBotany extends Item { public abstract class ItemBotany extends Item {
public ItemBotany(String name) { public ItemBotany(String name) {
setCreativeTab(CreativeTabBotany.instance); setCreativeTab(CreativeTabBotany.instance);
setUnlocalizedName(name); setUnlocalizedName(name);
hasSubtypes = true; hasSubtypes = true;
registerItem(this, getUnlocalizedName().substring(5));
} }
@Override @Override
@@ -70,31 +54,9 @@ public abstract class ItemBotany extends Item {
return false; return false;
} }
static IAllele getRenderAllele(ItemStack stack, EnumFlowerChromosome chromosome, boolean active) { @Override
if (stack == null || !stack.hasTagCompound()) return null; public boolean getShareTag() {
return true;
NBTTagCompound genome = stack.getTagCompound().getCompoundTag("Genome");
NBTTagList chromosomes = genome.getTagList("Chromosomes", 10);
int slot = chromosome.ordinal();
NBTTagCompound chromosomeTag = null;
for (int index = chromosomes.tagCount() - 1; index >= 0; index--) {
NBTTagCompound candidate = chromosomes.getCompoundTagAt(index);
if (candidate.getByte("Slot") == slot) {
chromosomeTag = candidate;
break;
}
}
if (chromosomeTag == null) return null;
Class<? extends IAllele> alleleClass = chromosome.getAlleleClass();
IAllele primary = AlleleManager.alleleRegistry.getAllele(chromosomeTag.getString("UID0"));
if (!alleleClass.isInstance(primary)) return null;
IAllele secondary = AlleleManager.alleleRegistry.getAllele(chromosomeTag.getString("UID1"));
if (!alleleClass.isInstance(secondary)) return null;
if (!active) return primary;
if (primary.isDominant()) return primary;
return secondary.isDominant() ? secondary : primary;
} }
@Override @Override
@@ -103,17 +65,12 @@ public abstract class ItemBotany extends Item {
return false; return false;
} }
IAllele allele = getRenderAllele(stack, EnumFlowerChromosome.SPECIES, false);
if (allele instanceof IAlleleFlowerSpecies species) {
return species.hasEffect();
}
IIndividual individual = getIndividual(stack); IIndividual individual = getIndividual(stack);
return individual != null && individual.getGenome() != null && individual.hasEffect(); return individual != null && individual.getGenome() != null && individual.hasEffect();
} }
@Override @Override
public void addInformation(ItemStack itemstack, EntityPlayer player, List<String> tooltip, boolean flag) { public void addInformation(ItemStack itemstack, EntityPlayer player, List tooltip, boolean flag) {
if (!itemstack.hasTagCompound()) { if (!itemstack.hasTagCompound()) {
return; return;
} }
@@ -129,12 +86,11 @@ public abstract class ItemBotany extends Item {
IFlowerColor stemColor = genome.getStemColor(); IFlowerColor stemColor = genome.getStemColor();
if (primaryColor == secondColor) { if (primaryColor == secondColor) {
tooltip.add( tooltip.add(EnumChatFormatting.YELLOW
EnumChatFormatting.YELLOW + I18N + I18N.localise("botany.item.tooltip.flowerColor1", primaryColor.getName(), stemColor.getName()));
.localise("botany.item.tooltip.flowerColor1", primaryColor.getName(), stemColor.getName()));
} else { } else {
tooltip.add( tooltip.add(EnumChatFormatting.YELLOW
EnumChatFormatting.YELLOW + I18N.localise( + I18N.localise(
"botany.item.tooltip.flowerColor2", "botany.item.tooltip.flowerColor2",
primaryColor.getName(), primaryColor.getName(),
secondColor.getName(), secondColor.getName(),
@@ -178,32 +134,22 @@ public abstract class ItemBotany extends Item {
} }
@Override @Override
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List<ItemStack> itemList) { public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
addCreativeItems(itemList, true); addCreativeItems(itemList, true);
} }
public void addCreativeItems(List<ItemStack> itemList, boolean hideSecrets) { public void addCreativeItems(List itemList, boolean hideSecrets) {
for (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(), getStage().ordinal())); itemList.add(BotanyCore.speciesRoot.getMemberStack(
individual.copy(), getStage().ordinal()));
} }
} }
@Override @Override
public int getColorFromItemStack(ItemStack itemstack, int renderPass) { public int getColorFromItemStack(ItemStack itemstack, int renderPass) {
if (!itemstack.hasTagCompound()) {
return (renderPass == 0 ? EnumFlowerColor.GREEN : EnumFlowerColor.RED).getColor(false);
}
EnumFlowerChromosome chromosome = renderPass == 0 ? EnumFlowerChromosome.STEM
: renderPass == 1 ? EnumFlowerChromosome.PRIMARY : EnumFlowerChromosome.SECONDARY;
IAllele allele = getRenderAllele(itemstack, chromosome, true);
if (allele instanceof AlleleColor color) {
return color.getColor().getColor(itemstack.getTagCompound().getBoolean("Wilt"));
}
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 0xffffff; return 0xffffff;
@@ -212,7 +158,8 @@ public abstract class ItemBotany extends Item {
if (renderPass == 0) { if (renderPass == 0) {
return flower.getGenome().getStemColor().getColor(flower.isWilted()); return flower.getGenome().getStemColor().getColor(flower.isWilted());
} }
return (renderPass == 1) ? flower.getGenome().getPrimaryColor().getColor(flower.isWilted()) return (renderPass == 1)
? flower.getGenome().getPrimaryColor().getColor(flower.isWilted())
: flower.getGenome().getSecondaryColor().getColor(flower.isWilted()); : flower.getGenome().getSecondaryColor().getColor(flower.isWilted());
} }
@@ -229,43 +176,40 @@ public abstract class ItemBotany extends Item {
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(ItemStack itemstack, int renderPass) { public IIcon getIcon(ItemStack itemstack, int renderPass) {
IAlleleFlowerSpecies species = FlowerSpecies.POPPY; IFlower flower = BotanyCore.speciesRoot.getMember(itemstack);
boolean flowered = false; if (flower == null || flower.getGenome() == null || flower.getGenome().getPrimary() == null) {
return EnumFlowerType.ALLIUM.getBlank();
if (itemstack.hasTagCompound()) {
IAllele allele = getRenderAllele(itemstack, EnumFlowerChromosome.SPECIES, false);
if (allele instanceof IAlleleFlowerSpecies flowerSpecies) {
species = flowerSpecies;
flowered = itemstack.getTagCompound().getBoolean("Flowered");
} else {
IFlower flower = BotanyCore.speciesRoot.getMember(itemstack);
if (flower == null || flower.getGenome() == null || flower.getGenome().getPrimary() == null) {
return EnumFlowerType.ALLIUM.getBlank();
}
species = flower.getGenome().getPrimary();
flowered = flower.hasFlowered();
}
} }
IFlowerType type = species.getType(); IFlowerType type = flower.getGenome().getPrimary().getType();
if (renderPass == 0) { if (renderPass == 0) {
return type.getStem(getStage(), flowered, type.getSections() - 1); return type.getStem(getStage(), flower.hasFlowered(), type.getSections() - 1);
} }
if (renderPass == 1) { if (renderPass == 1) {
return type.getPetalIcon(getStage(), flowered, type.getSections() - 1); return type.getPetalIcon(getStage(), flower.hasFlowered(), type.getSections() - 1);
} }
return type.getVariantIcon(getStage(), flowered, type.getSections() - 1); return type.getVariantIcon(getStage(), flower.hasFlowered(), type.getSections() - 1);
} }
@Override @Override
public boolean onItemUse(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int side, public boolean onItemUse(
float px, float py, float pz) { ItemStack itemstack,
EntityPlayer player,
World world,
int x,
int y,
int z,
int side,
float px,
float py,
float pz) {
if (getStage() == EnumFlowerStage.POLLEN) { if (getStage() == EnumFlowerStage.POLLEN) {
IFlower flower = Binnie.Genetics.getFlowerRoot().getMember(itemstack); IFlower flower = Binnie.Genetics.getFlowerRoot().getMember(itemstack);
TileEntity target = world.getTileEntity(x, y, z); TileEntity target = world.getTileEntity(x, y, z);
if (!(target instanceof IPollinatable pollinatable)) { if (!(target instanceof IPollinatable)) {
return false; return false;
} }
IPollinatable pollinatable = (IPollinatable) target;
if (!pollinatable.canMateWith(flower)) { if (!pollinatable.canMateWith(flower)) {
return false; return false;
} }
@@ -280,23 +224,24 @@ public abstract class ItemBotany extends Item {
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 } else if (blockAlreadyThere != Blocks.vine
&& blockAlreadyThere != Blocks.tallgrass
&& blockAlreadyThere != Blocks.deadbush && blockAlreadyThere != Blocks.deadbush
&& !blockAlreadyThere.isReplaceable(world, x, y, z)) { && !blockAlreadyThere.isReplaceable(world, x, y, z)) {
if (side == 0) { if (side == 0) {
y--; y--;
} else if (side == 1) { } else if (side == 1) {
y++; y++;
} else if (side == 2) { } else if (side == 2) {
z--; z--;
} else if (side == 3) { } else if (side == 3) {
z++; z++;
} else if (side == 4) { } else if (side == 4) {
x--; x--;
} else if (side == 5) { } else if (side == 5) {
x++; x++;
} }
} }
if (itemstack.stackSize == 0 || !player.canPlayerEdit(x, y, z, side, itemstack)) { if (itemstack.stackSize == 0 || !player.canPlayerEdit(x, y, z, side, itemstack)) {
return false; return false;
@@ -329,28 +274,39 @@ public abstract class ItemBotany extends Item {
Block block = world.getBlock(x, y, z); Block block = world.getBlock(x, y, z);
if (block == Blocks.snow_layer) { if (block == Blocks.snow_layer) {
side = 1; side = 1;
} else if (block != Blocks.vine && block != Blocks.tallgrass } else if (block != Blocks.vine
&& block != Blocks.tallgrass
&& block != Blocks.deadbush && block != Blocks.deadbush
&& !block.isReplaceable(world, x, y, z)) { && !block.isReplaceable(world, x, y, z)) {
if (side == 0) { if (side == 0) {
y--; y--;
} else if (side == 1) { } else if (side == 1) {
y++; y++;
} else if (side == 2) { } else if (side == 2) {
z--; z--;
} else if (side == 3) { } else if (side == 3) {
z++; z++;
} else if (side == 4) { } else if (side == 4) {
x--; x--;
} else if (side == 5) { } else if (side == 5) {
x++; x++;
} }
} }
return world.canPlaceEntityOnSide(field_150939_a, x, y, z, false, side, null, stack); return world.canPlaceEntityOnSide(field_150939_a, x, y, z, false, side, null, stack);
} }
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, public boolean placeBlockAt(
float hitX, float hitY, float hitZ, int metadata) { ItemStack stack,
EntityPlayer player,
World world,
int x,
int y,
int z,
int side,
float hitX,
float hitY,
float hitZ,
int metadata) {
Block block = Botany.flower; Block block = Botany.flower;
if (!world.setBlock(x, y, z, block, metadata, 3)) { if (!world.setBlock(x, y, z, block, metadata, 3)) {
return false; return false;
@@ -3,7 +3,6 @@ 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,9 +1,11 @@
package binnie.botany.flower; package binnie.botany.flower;
import static cpw.mods.fml.common.registry.GameRegistry.registerItem; import binnie.botany.Botany;
import binnie.botany.CreativeTabBotany;
import binnie.core.util.I18N;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List; import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@@ -12,14 +14,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import binnie.botany.Botany;
import binnie.botany.CreativeTabBotany;
import binnie.core.util.I18N;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemInsulatedTube extends Item { public class ItemInsulatedTube extends Item {
IIcon[] icons; IIcon[] icons;
public ItemInsulatedTube() { public ItemInsulatedTube() {
@@ -27,8 +22,6 @@ public class ItemInsulatedTube extends Item {
setUnlocalizedName("insulatedTube"); setUnlocalizedName("insulatedTube");
setCreativeTab(CreativeTabBotany.instance); setCreativeTab(CreativeTabBotany.instance);
setHasSubtypes(true); setHasSubtypes(true);
registerItem(this, getUnlocalizedName().substring(5));
} }
public static ItemStack getInsulateStack(ItemStack stack) { public static ItemStack getInsulateStack(ItemStack stack) {
@@ -37,9 +30,9 @@ public class ItemInsulatedTube extends Item {
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) { public void getSubItems(Item item, CreativeTabs tab, List list) {
for (Material mat : Material.VALUES) { for (Material mat : Material.values()) {
for (Insulate ins : Insulate.VALUES) { for (Insulate ins : Insulate.values()) {
list.add(new ItemStack(this, 1, mat.ordinal() + ins.ordinal() * 128)); list.add(new ItemStack(this, 1, mat.ordinal() + ins.ordinal() * 128));
} }
} }
@@ -59,13 +52,14 @@ public class ItemInsulatedTube extends Item {
if (pass == 0) { if (pass == 0) {
return 0xffffff; return 0xffffff;
} }
return (pass == 1) ? Material.get(stack.getItemDamage()).getColor() return (pass == 1)
? Material.get(stack.getItemDamage()).getColor()
: Insulate.get(stack.getItemDamage()).getColor(); : Insulate.get(stack.getItemDamage()).getColor();
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced) { public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
super.addInformation(stack, player, tooltip, advanced); super.addInformation(stack, player, tooltip, advanced);
tooltip.add(Insulate.get(stack.getItemDamage()).getName()); tooltip.add(Insulate.get(stack.getItemDamage()).getName());
} }
@@ -91,16 +85,13 @@ public class ItemInsulatedTube extends Item {
} }
enum Material { enum Material {
Copper(0xe3b78e, "cooper"),
Copper(0xe3b78e, "copper"),
Tin(0xe1eef4, "tin"), Tin(0xe1eef4, "tin"),
Bronze(0xddc276, "bronze"), Bronze(0xddc276, "bronze"),
Iron(0xd8d8d8, "iron"); Iron(0xd8d8d8, "iron");
public static final Material[] VALUES = values(); protected int color;
protected String name;
private final int color;
private final String name;
Material(int color, String name) { Material(int color, String name) {
this.color = color; this.color = color;
@@ -108,7 +99,7 @@ public class ItemInsulatedTube extends Item {
} }
public static Material get(int i) { public static Material get(int i) {
return VALUES[i % VALUES.length]; return values()[i % values().length];
} }
public int getColor() { public int getColor() {
@@ -121,7 +112,6 @@ public class ItemInsulatedTube extends Item {
} }
enum Insulate { enum Insulate {
Clay(0xa1aacc, "clay"), Clay(0xa1aacc, "clay"),
Cobble(0x7b7b7b, "cobblestone"), Cobble(0x7b7b7b, "cobblestone"),
Sand(0xefeab5, "sand"), Sand(0xefeab5, "sand"),
@@ -129,10 +119,8 @@ public class ItemInsulatedTube extends Item {
Stone(0x6d6d6d, "smoothStone"), Stone(0x6d6d6d, "smoothStone"),
Sandstone(0xc1b989, "sandstone"); Sandstone(0xc1b989, "sandstone");
public static final Insulate[] VALUES = values(); protected int color;
protected String name;
private final int color;
private final String name;
Insulate(int color, String name) { Insulate(int color, String name) {
this.color = color; this.color = color;
@@ -140,7 +128,7 @@ public class ItemInsulatedTube extends Item {
} }
public static Insulate get(int i) { public static Insulate get(int i) {
return VALUES[i / 128 % VALUES.length]; return values()[i / 128 % values().length];
} }
public int getColor() { public int getColor() {
@@ -152,14 +140,26 @@ public class ItemInsulatedTube extends Item {
} }
public ItemStack getStack() { public ItemStack getStack() {
return switch (this) { switch (this) {
case Clay -> new ItemStack(Blocks.clay); case Clay:
case Cobble -> new ItemStack(Blocks.cobblestone); return new ItemStack(Blocks.clay);
case HardenedClay -> new ItemStack(Blocks.hardened_clay);
case Sand -> new ItemStack(Blocks.sand); case Cobble:
case Sandstone -> new ItemStack(Blocks.sandstone); return new ItemStack(Blocks.cobblestone);
case Stone -> new ItemStack(Blocks.stone);
}; case HardenedClay:
return new ItemStack(Blocks.hardened_clay);
case Sand:
return new ItemStack(Blocks.sand);
case Sandstone:
return new ItemStack(Blocks.sandstone);
case Stone:
return new ItemStack(Blocks.stone);
}
return null;
} }
} }
} }
@@ -4,7 +4,6 @@ import binnie.botany.api.EnumFlowerStage;
import binnie.core.util.I18N; import binnie.core.util.I18N;
public class ItemPollen extends ItemBotany { public class ItemPollen extends ItemBotany {
public ItemPollen() { public ItemPollen() {
super("pollen"); super("pollen");
} }
@@ -4,7 +4,6 @@ import binnie.botany.api.EnumFlowerStage;
import binnie.core.util.I18N; import binnie.core.util.I18N;
public class ItemSeed extends ItemBotany { public class ItemSeed extends ItemBotany {
public ItemSeed() { public ItemSeed() {
super("seed"); super("seed");
} }
@@ -1,5 +1,6 @@
package binnie.botany.flower; package binnie.botany.flower;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.renderer.EntityRenderer; import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.RenderBlocks;
@@ -7,10 +8,7 @@ import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
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;
@@ -20,13 +18,14 @@ public class RendererBotany implements ISimpleBlockRenderingHandler {
} }
@Override @Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, public boolean renderWorldBlock(
RenderBlocks renderer) { IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
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;
double d2 = y;
double d3 = z; double d3 = z;
long i1 = x * 3129871L ^ 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;
@@ -45,7 +44,7 @@ public class RendererBotany implements ISimpleBlockRenderingHandler {
} }
tessellator.setColorOpaque_F(f, f2, f3); tessellator.setColorOpaque_F(f, f2, f3);
IIcon iicon = block.getIcon(world, x, y, z, 0); IIcon iicon = block.getIcon(world, x, y, z, 0);
renderer.drawCrossedSquares(iicon, d1, y, d3, 1.0f); renderer.drawCrossedSquares(iicon, d1, d2, d3, 1.0f);
} }
return false; return false;
} }
@@ -1,23 +1,5 @@
package binnie.botany.flower; package binnie.botany.flower;
import java.util.EnumSet;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTUtil;
import net.minecraft.network.Packet;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.EnumPlantType;
import com.mojang.authlib.GameProfile;
import binnie.Binnie; import binnie.Binnie;
import binnie.botany.Botany; import binnie.botany.Botany;
import binnie.botany.api.EnumFlowerStage; import binnie.botany.api.EnumFlowerStage;
@@ -35,6 +17,7 @@ import binnie.botany.genetics.EnumFlowerType;
import binnie.botany.genetics.Flower; import binnie.botany.genetics.Flower;
import binnie.botany.network.MessageFlowerUpdate; import binnie.botany.network.MessageFlowerUpdate;
import binnie.core.BinnieCore; import binnie.core.BinnieCore;
import com.mojang.authlib.GameProfile;
import forestry.api.core.EnumHumidity; import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature; import forestry.api.core.EnumTemperature;
import forestry.api.genetics.IIndividual; import forestry.api.genetics.IIndividual;
@@ -42,10 +25,22 @@ import forestry.api.genetics.IPollinatable;
import forestry.api.lepidopterology.IButterfly; import forestry.api.lepidopterology.IButterfly;
import forestry.api.lepidopterology.IButterflyNursery; import forestry.api.lepidopterology.IButterflyNursery;
import forestry.lepidopterology.entities.EntityButterfly; import forestry.lepidopterology.entities.EntityButterfly;
import forestry.plugins.PluginLepidopterology; import java.util.EnumSet;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTUtil;
import net.minecraft.network.Packet;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.EnumPlantType;
public class TileEntityFlower extends TileEntity implements IPollinatable, IButterflyNursery { public class TileEntityFlower extends TileEntity implements IPollinatable, IButterflyNursery {
protected IFlower flower; protected IFlower flower;
protected GameProfile owner; protected GameProfile owner;
protected int section; protected int section;
@@ -124,7 +119,8 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
@Override @Override
public boolean canMateWith(IIndividual individual) { public boolean canMateWith(IIndividual individual) {
return isBreeding() && individual instanceof IFlower return isBreeding()
&& individual instanceof IFlower
&& getFlower() != null && getFlower() != null
&& getFlower().getMate() == null && getFlower().getMate() == null
&& getFlower().hasFlowered() && getFlower().hasFlowered()
@@ -137,7 +133,8 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
return; return;
} }
IAlleleFlowerSpecies primary = (IAlleleFlowerSpecies) individual.getGenome().getPrimary(); IAlleleFlowerSpecies primary =
(IAlleleFlowerSpecies) individual.getGenome().getPrimary();
IAlleleFlowerSpecies primary2 = getFlower().getGenome().getPrimary(); IAlleleFlowerSpecies primary2 = getFlower().getGenome().getPrimary();
if (primary == primary2 || worldObj.rand.nextInt(4) == 0) { if (primary == primary2 || worldObj.rand.nextInt(4) == 0) {
getFlower().mate((IFlower) individual); getFlower().mate((IFlower) individual);
@@ -213,7 +210,11 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
return; return;
} }
flower.setWilted(!canTolerate || light < 1.0f); if (!canTolerate || light < 1.0f) {
flower.setWilted(true);
} else {
flower.setWilted(false);
}
float chanceDispersal = 0.8f; float chanceDispersal = 0.8f;
chanceDispersal += 0.2f * flower.getGenome().getFertility(); chanceDispersal += 0.2f * flower.getGenome().getFertility();
@@ -282,7 +283,9 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
Gardening.onGrowFromSeed(worldObj, xCoord, yCoord, zCoord); Gardening.onGrowFromSeed(worldObj, xCoord, yCoord, zCoord);
if (getOwner() != null && getFlower() != null) { if (getOwner() != null && getFlower() != null) {
BotanyCore.getFlowerRoot().getBreedingTracker(getWorldObj(), getOwner()).registerBirth(getFlower()); BotanyCore.getFlowerRoot()
.getBreedingTracker(getWorldObj(), getOwner())
.registerBirth(getFlower());
} }
} }
@@ -291,14 +294,17 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
if (renderInfo == null && getFlower() != null && getFlower().getGenome() != null) { if (renderInfo == null && getFlower() != null && getFlower().getGenome() != null) {
renderInfo = new RenderInfo(getFlower(), this); renderInfo = new RenderInfo(getFlower(), this);
} }
return (renderInfo != null) ? Botany.instance.getNetworkWrapper() return (renderInfo != null)
.getPacketFrom(new MessageFlowerUpdate(xCoord, yCoord, zCoord, renderInfo).getMessage()) : null; ? Botany.instance
.getNetworkWrapper()
.getPacketFrom(new MessageFlowerUpdate(xCoord, yCoord, zCoord, renderInfo).getMessage())
: null;
} }
public void updateRender(boolean update) { public void updateRender(boolean update) {
if (update && getFlower() != null && getFlower().getGenome() != null) { if (update && getFlower() != null && getFlower().getGenome() != null) {
RenderInfo newInfo = new RenderInfo(getFlower(), this); RenderInfo newInfo = new RenderInfo(getFlower(), this);
if (!newInfo.equals(renderInfo)) { if (renderInfo == null || !newInfo.equals(renderInfo)) {
setRender(newInfo); setRender(newInfo);
} }
} }
@@ -448,12 +454,15 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
return; return;
} }
IButterfly spawn = Binnie.Genetics.getButterflyRoot().getIndividualTemplates() IButterfly spawn = Binnie.Genetics.getButterflyRoot()
.get(worldObj.rand.nextInt(Binnie.Genetics.getButterflyRoot().getIndividualTemplates().size())); .getIndividualTemplates()
.get(worldObj.rand.nextInt(Binnie.Genetics.getButterflyRoot()
.getIndividualTemplates()
.size()));
if (worldObj.rand.nextFloat() >= spawn.getGenome().getPrimary().getRarity() * 0.5f) { if (worldObj.rand.nextFloat() >= spawn.getGenome().getPrimary().getRarity() * 0.5f) {
return; return;
} }
if (worldObj.countEntities(EntityButterfly.class) > PluginLepidopterology.spawnConstraint) { if (worldObj.countEntities(EntityButterfly.class) > 100) {
return; return;
} }
if (!spawn.canSpawn(worldObj, x, y, z)) { if (!spawn.canSpawn(worldObj, x, y, z)) {
@@ -519,7 +528,9 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
} }
matureTime++; matureTime++;
if (matureTime >= caterpillar.getGenome().getLifespan() / (caterpillar.getGenome().getFertility() * 2) if (matureTime
>= caterpillar.getGenome().getLifespan()
/ (caterpillar.getGenome().getFertility() * 2)
&& caterpillar.canTakeFlight(worldObj, xCoord, yCoord, zCoord)) { && caterpillar.canTakeFlight(worldObj, xCoord, yCoord, zCoord)) {
if (worldObj.isAirBlock(xCoord, yCoord + 1, zCoord)) { if (worldObj.isAirBlock(xCoord, yCoord + 1, zCoord)) {
attemptButterflySpawn(worldObj, caterpillar, xCoord, yCoord + 1, zCoord); attemptButterflySpawn(worldObj, caterpillar, xCoord, yCoord + 1, zCoord);
@@ -590,7 +601,6 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
} }
public static class RenderInfo { public static class RenderInfo {
public IFlowerColor primary; public IFlowerColor primary;
public IFlowerColor secondary; public IFlowerColor secondary;
public IFlowerColor stem; public IFlowerColor stem;
@@ -615,8 +625,10 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj instanceof RenderInfo o) { if (obj instanceof RenderInfo) {
return o.age == age && o.wilted == wilted RenderInfo o = (RenderInfo) obj;
return o.age == age
&& o.wilted == wilted
&& o.flowered == flowered && o.flowered == flowered
&& o.primary == primary && o.primary == primary
&& o.secondary == secondary && o.secondary == secondary
@@ -1,9 +1,15 @@
package binnie.botany.gardening; package binnie.botany.gardening;
import binnie.botany.Botany;
import binnie.botany.CreativeTabBotany;
import binnie.botany.api.EnumSoilType;
import binnie.botany.api.gardening.IBlockSoil;
import binnie.core.util.I18N;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockBush; import net.minecraft.block.BlockBush;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@@ -14,16 +20,7 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import binnie.botany.Botany;
import binnie.botany.CreativeTabBotany;
import binnie.botany.api.EnumSoilType;
import binnie.botany.api.gardening.IBlockSoil;
import binnie.core.util.I18N;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockPlant extends BlockBush { public class BlockPlant extends BlockBush {
public BlockPlant() { public BlockPlant() {
setBlockName("plant"); setBlockName("plant");
setCreativeTab(CreativeTabBotany.instance); setCreativeTab(CreativeTabBotany.instance);
@@ -48,7 +45,7 @@ public class BlockPlant extends BlockBush {
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister register) { public void registerBlockIcons(IIconRegister register) {
for (Type t : Type.VALUES) { for (Type t : Type.values()) {
t.icon = Botany.proxy.getIcon(register, t.name().toLowerCase()); t.icon = Botany.proxy.getIcon(register, t.name().toLowerCase());
} }
} }
@@ -61,7 +58,7 @@ public class BlockPlant extends BlockBush {
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public IIcon getIcon(int side, 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
@@ -71,8 +68,8 @@ public class BlockPlant extends BlockBush {
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> list) { public void getSubBlocks(Item item, CreativeTabs tab, List list) {
for (Type type : Type.VALUES) { for (Type type : Type.values()) {
list.add(type.get()); list.add(type.get());
} }
} }
@@ -128,24 +125,22 @@ public class BlockPlant extends BlockBush {
} }
public enum Type { public enum Type {
Weeds("weeds"), Weeds("weeds"),
WeedsLong("longWeeds"), WeedsLong("longWeeds"),
WeedsVeryLong("veryLongWeeds"), WeedsVeryLong("veryLongWeeds"),
DeadFlower("deadFlower"), DeadFlower("deadFlower"),
DecayingFlower("decayingFlower"); DecayingFlower("decayingFlower");
public static final Type[] VALUES = values();
public IIcon icon; public IIcon icon;
private final String name; protected String name;
Type(String name) { Type(String name) {
this.name = name; this.name = name;
} }
public static Type get(int id) { public static Type get(int id) {
return VALUES[id % VALUES.length]; return values()[id % values().length];
} }
public ItemStack get() { public ItemStack get() {
@@ -1,8 +1,15 @@
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.EnumMoisture;
import binnie.botany.api.EnumSoilType;
import binnie.botany.api.gardening.IBlockSoil;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@@ -17,17 +24,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import binnie.botany.Botany;
import binnie.botany.CreativeTabBotany;
import binnie.botany.api.EnumAcidity;
import binnie.botany.api.EnumMoisture;
import binnie.botany.api.EnumSoilType;
import binnie.botany.api.gardening.IBlockSoil;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockSoil extends Block implements IBlockSoil { public class BlockSoil extends Block implements IBlockSoil {
protected boolean weedKilled; protected boolean weedKilled;
protected IIcon[] iconsTop; protected IIcon[] iconsTop;
protected IIcon[] iconsSide; protected IIcon[] iconsSide;
@@ -56,7 +53,7 @@ public class BlockSoil extends Block implements IBlockSoil {
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> list) { public void getSubBlocks(Item item, CreativeTabs tab, List list) {
for (int i = 0; i < 9; ++i) { for (int i = 0; i < 9; ++i) {
list.add(new ItemStack(this, 1, i)); list.add(new ItemStack(this, 1, i));
} }
@@ -81,8 +78,8 @@ public class BlockSoil extends Block implements IBlockSoil {
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister register) { public void registerBlockIcons(IIconRegister register) {
for (EnumMoisture moisture : EnumMoisture.VALUES) { for (EnumMoisture moisture : EnumMoisture.values()) {
for (EnumAcidity pH : EnumAcidity.VALUES) { for (EnumAcidity pH : EnumAcidity.values()) {
int index = moisture.ordinal() + pH.ordinal() * 3; int index = moisture.ordinal() + pH.ordinal() * 3;
String id = "soil/" + getType().getID() + "." + pH.getID() + "." + moisture.getID(); String id = "soil/" + getType().getID() + "." + pH.getID() + "." + moisture.getID();
iconsTop[index] = Botany.proxy.getIcon(register, id + ".0"); iconsTop[index] = Botany.proxy.getIcon(register, id + ".0");
@@ -104,8 +101,8 @@ public class BlockSoil extends Block implements IBlockSoil {
@Override @Override
public void updateTick(World world, int x, int y, int z, Random random) { public void updateTick(World world, int x, int y, int z, Random random) {
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];
EnumAcidity acidity = EnumAcidity.VALUES[meta / 3]; EnumAcidity acidity = EnumAcidity.values()[meta / 3];
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);
@@ -118,7 +115,8 @@ public class BlockSoil extends Block implements IBlockSoil {
if (meta != meta2) { if (meta != meta2) {
world.setBlockMetadataWithNotify(x, y, z, meta2, 2); world.setBlockMetadataWithNotify(x, y, z, meta2, 2);
} }
if (!weedKilled && random.nextInt(5 - getType(world, x, y, z).ordinal()) == 0 if (!weedKilled
&& random.nextInt(5 - getType(world, x, y, z).ordinal()) == 0
&& world.getBlock(x, y + 1, z) == Blocks.air) { && 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);
} }
@@ -141,12 +139,12 @@ public class BlockSoil extends Block implements IBlockSoil {
@Override @Override
public EnumAcidity getPH(World world, int x, int y, 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(World world, int x, int y, 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
@@ -197,8 +195,8 @@ public class BlockSoil extends Block implements IBlockSoil {
} }
@Override @Override
public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, public boolean canSustainPlant(
IPlantable plantable) { IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) {
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;
@@ -1,20 +1,5 @@
package binnie.botany.gardening; package binnie.botany.gardening;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;
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.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import com.mojang.authlib.GameProfile;
import binnie.botany.Botany; import binnie.botany.Botany;
import binnie.botany.api.EnumAcidity; import binnie.botany.api.EnumAcidity;
import binnie.botany.api.EnumMoisture; import binnie.botany.api.EnumMoisture;
@@ -24,10 +9,21 @@ import binnie.botany.api.gardening.IBlockSoil;
import binnie.botany.flower.TileEntityFlower; import binnie.botany.flower.TileEntityFlower;
import binnie.botany.items.BotanyItems; import binnie.botany.items.BotanyItems;
import binnie.core.BinnieCore; import binnie.core.BinnieCore;
import com.mojang.authlib.GameProfile;
import forestry.api.core.EnumTemperature; import forestry.api.core.EnumTemperature;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;
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.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
public class Gardening { public class Gardening {
public static Map<ItemStack, Integer> fertiliserAcid = new LinkedHashMap<>(); public static Map<ItemStack, Integer> fertiliserAcid = new LinkedHashMap<>();
public static Map<ItemStack, Integer> fertiliserAlkaline = new LinkedHashMap<>(); public static Map<ItemStack, Integer> fertiliserAlkaline = new LinkedHashMap<>();
public static Map<ItemStack, Integer> fertiliserNutrient = new LinkedHashMap<>(); public static Map<ItemStack, Integer> fertiliserNutrient = new LinkedHashMap<>();
@@ -46,16 +42,16 @@ public class Gardening {
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.5f; 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.5f; 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.5f; bias += 1.5;
} }
for (int dx = -1; dx < 2; ++dx) { for (int dx = -1; dx < 2; ++dx) {
@@ -85,10 +81,8 @@ public class Gardening {
public static float getBiomeMoisture(BiomeGenBase biome, int H) { public static float getBiomeMoisture(BiomeGenBase biome, int H) {
double R = biome.rainfall; double R = biome.rainfall;
double T = biome.temperature; double T = biome.temperature;
double m = 3.2 * (R - 0.5) - 0.4 * (1.0 + T + 0.5 * T * T) double m =
+ 1.1 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);
- 1.6 * (T - 0.9) * (T - 0.9)
- 0.002 * (H - 64);
if (m == 0.0) { if (m == 0.0) {
return (float) m; return (float) m;
} }
@@ -101,13 +95,14 @@ public class Gardening {
public static float getBiomePH(BiomeGenBase biome, int H) { public static float getBiomePH(BiomeGenBase biome, int H) {
double R = biome.rainfall; double R = biome.rainfall;
double T = biome.temperature; double T = biome.temperature;
return (float) (-3.0 * (R - 0.5) + 0.5 * (T - 0.699999988079071) * (T - 0.699999988079071) return (float) (-3.0 * (R - 0.5)
+ 0.5 * (T - 0.699999988079071) * (T - 0.699999988079071)
+ 0.02f * (H - 64) + 0.02f * (H - 64)
- 0.15000000596046448); - 0.15000000596046448);
} }
public static void createSoil(World world, int x, int y, int z, EnumSoilType soil, EnumMoisture moisture, public static void createSoil(
EnumAcidity acidity) { World world, int x, int y, int z, EnumSoilType soil, EnumMoisture moisture, EnumAcidity acidity) {
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);
} }
@@ -118,13 +113,13 @@ public class Gardening {
return false; return false;
} }
final TileEntity tile = world.getTileEntity(x, y, z); TileEntity tileFlower = world.getTileEntity(x, y, z);
final TileEntity below = world.getTileEntity(x, y - 1, z); TileEntity below = world.getTileEntity(x, y - 1, z);
if (tile instanceof TileEntityFlower tileFlower) { if (tileFlower != null && tileFlower instanceof TileEntityFlower) {
if (below instanceof TileEntityFlower lowerFlower) { if (below instanceof TileEntityFlower) {
tileFlower.setSection(lowerFlower.getSection()); ((TileEntityFlower) tileFlower).setSection(((TileEntityFlower) below).getSection());
} else { } else {
tileFlower.create(flower, owner); ((TileEntityFlower) tileFlower).create(flower, owner);
} }
} }
@@ -138,20 +133,21 @@ public class Gardening {
} }
TileEntity flower = world.getTileEntity(x, y, z); TileEntity flower = world.getTileEntity(x, y, z);
if (!(flower instanceof TileEntityFlower)) { if (flower == null || !(flower instanceof TileEntityFlower)) {
return; return;
} }
IFlower iflower = ((TileEntityFlower) flower).getFlower(); IFlower iflower = ((TileEntityFlower) flower).getFlower();
int section = ((TileEntityFlower) flower).getSection(); int section = ((TileEntityFlower) flower).getSection();
if (iflower == null || section >= iflower.getGenome().getPrimary().getType().getSections() - 1 if (iflower == null
|| section >= iflower.getGenome().getPrimary().getType().getSections() - 1
|| iflower.getAge() <= 0) { || iflower.getAge() <= 0) {
return; return;
} }
world.setBlock(x, y + 1, z, Botany.flower, 0, 2); world.setBlock(x, y + 1, z, Botany.flower, 0, 2);
TileEntity tileFlower = world.getTileEntity(x, y + 1, z); TileEntity tileFlower = world.getTileEntity(x, y + 1, z);
if (tileFlower instanceof TileEntityFlower) { if (tileFlower != null && tileFlower instanceof TileEntityFlower) {
((TileEntityFlower) tileFlower).setSection(section + 1); ((TileEntityFlower) tileFlower).setSection(section + 1);
} }
} }
@@ -233,8 +229,8 @@ public class Gardening {
BiomeGenBase biome = world.getBiomeGenForCoords(x, z); BiomeGenBase biome = world.getBiomeGenForCoords(x, z);
return canTolerate( return canTolerate(
flower, flower,
EnumAcidity.VALUES[soilMeta / 3 % 3], EnumAcidity.values()[soilMeta / 3 % 3],
EnumMoisture.VALUES[soilMeta % 3], EnumMoisture.values()[soilMeta % 3],
EnumTemperature.getFromValue(biome.temperature)); EnumTemperature.getFromValue(biome.temperature));
} }
@@ -250,15 +246,19 @@ public class Gardening {
} }
public static Block getSoilBlock(EnumSoilType type, boolean weedkill) { public static Block getSoilBlock(EnumSoilType type, boolean weedkill) {
return switch (type) { switch (type) {
case FLOWERBED -> weedkill ? Botany.flowerbedNoWeed : Botany.flowerbed; case FLOWERBED:
case LOAM -> weedkill ? Botany.loamNoWeed : Botany.loam; return weedkill ? Botany.flowerbedNoWeed : Botany.flowerbed;
default -> weedkill ? Botany.soilNoWeed : Botany.soil;
}; case LOAM:
return weedkill ? Botany.loamNoWeed : Botany.loam;
}
return weedkill ? Botany.soilNoWeed : Botany.soil;
} }
public static boolean canTolerate(IFlower flower, EnumAcidity ePH, EnumMoisture eMoisture, EnumTemperature eTemp) { public static boolean canTolerate(IFlower flower, EnumAcidity ePH, EnumMoisture eMoisture, EnumTemperature eTemp) {
return flower.getGenome().canTolerate(ePH) && flower.getGenome().canTolerate(eMoisture) return flower.getGenome().canTolerate(ePH)
&& flower.getGenome().canTolerate(eMoisture)
&& flower.getGenome().canTolerate(eTemp); && flower.getGenome().canTolerate(eTemp);
} }
@@ -1,26 +1,23 @@
package binnie.botany.gardening; package binnie.botany.gardening;
import java.util.List;
import java.util.Locale;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
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 binnie.core.util.I18N; 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 java.util.List;
import java.util.Locale;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
public class ItemSoil extends ItemBlock { public class ItemSoil extends ItemBlock {
protected EnumSoilType type; protected EnumSoilType type;
private final boolean noWeed; private boolean noWeed;
public ItemSoil(Block block) { public ItemSoil(Block block) {
super(block); super(block);
@@ -31,10 +28,10 @@ public class ItemSoil extends ItemBlock {
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced) { public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
super.addInformation(stack, player, tooltip, advanced); super.addInformation(stack, player, tooltip, advanced);
EnumMoisture moisture = EnumMoisture.VALUES[stack.getItemDamage() % 3]; EnumMoisture moisture = EnumMoisture.values()[stack.getItemDamage() % 3];
EnumAcidity acidity = EnumAcidity.VALUES[stack.getItemDamage() / 3]; EnumAcidity acidity = EnumAcidity.values()[stack.getItemDamage() / 3];
String info = ""; String info = "";
if (moisture == EnumMoisture.DRY) { if (moisture == EnumMoisture.DRY) {
@@ -45,20 +42,20 @@ public class ItemSoil extends ItemBlock {
} }
if (acidity == EnumAcidity.ACID) { if (acidity == EnumAcidity.ACID) {
if (!info.isEmpty()) { if (info.length() > 0) {
info += ", "; info += ", ";
} }
info += EnumChatFormatting.YELLOW + I18N.localise("botany.ph.acid") + EnumChatFormatting.RESET; info += EnumChatFormatting.YELLOW + I18N.localise("botany.ph.acid") + EnumChatFormatting.RESET;
} }
if (acidity == EnumAcidity.ALKALINE) { if (acidity == EnumAcidity.ALKALINE) {
if (!info.isEmpty()) { if (info.length() > 0) {
info += ", "; info += ", ";
} }
info += EnumChatFormatting.YELLOW + I18N.localise("botany.ph.alkaline") + EnumChatFormatting.RESET; info += EnumChatFormatting.YELLOW + I18N.localise("botany.ph.alkaline") + EnumChatFormatting.RESET;
} }
if (!info.isEmpty()) { if (info.length() > 0) {
tooltip.add(info); tooltip.add(info);
} }
@@ -1,17 +1,5 @@
package binnie.botany.gardening; package binnie.botany.gardening;
import static cpw.mods.fml.common.registry.GameRegistry.registerItem;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
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;
import binnie.botany.Botany; import binnie.botany.Botany;
import binnie.botany.CreativeTabBotany; import binnie.botany.CreativeTabBotany;
import binnie.botany.api.EnumAcidity; import binnie.botany.api.EnumAcidity;
@@ -23,20 +11,35 @@ import binnie.core.util.I18N;
import binnie.genetics.genetics.AlleleHelper; import binnie.genetics.genetics.AlleleHelper;
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.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
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 class ItemSoilMeter extends Item {
public ItemSoilMeter() { public ItemSoilMeter() {
setCreativeTab(CreativeTabBotany.instance); setCreativeTab(CreativeTabBotany.instance);
setUnlocalizedName("soilMeter"); setUnlocalizedName("soilMeter");
setMaxStackSize(1); setMaxStackSize(1);
registerItem(this, getUnlocalizedName().substring(5));
} }
@Override @Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, public boolean onItemUse(
float blockX, float blockY, float blockZ) { 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--;
@@ -49,18 +52,21 @@ public class ItemSoilMeter extends Item {
EnumMoisture moisture = soil.getMoisture(world, x, y, z); EnumMoisture moisture = soil.getMoisture(world, x, y, z);
EnumAcidity pH = soil.getPH(world, x, y, z); EnumAcidity pH = soil.getPH(world, x, y, z);
EnumChatFormatting[] colors = new EnumChatFormatting[] { EnumChatFormatting.DARK_GRAY, EnumChatFormatting[] colors = new EnumChatFormatting[] {
EnumChatFormatting.GOLD, EnumChatFormatting.LIGHT_PURPLE, }; EnumChatFormatting.DARK_GRAY, EnumChatFormatting.GOLD, EnumChatFormatting.LIGHT_PURPLE,
};
String info = I18N.localise("botany.soil.tooltip.type") + " "; String info = I18N.localise("botany.soil.tooltip.type") + " ";
info += colors[type.ordinal()] + AlleleHelper.toDisplay(type) + EnumChatFormatting.RESET; info += colors[type.ordinal()] + AlleleHelper.toDisplay(type) + EnumChatFormatting.RESET;
colors = new EnumChatFormatting[] { EnumChatFormatting.YELLOW, EnumChatFormatting.GRAY, colors = new EnumChatFormatting[] {
EnumChatFormatting.BLUE, }; EnumChatFormatting.YELLOW, EnumChatFormatting.GRAY, EnumChatFormatting.BLUE,
};
info += ", " + I18N.localise("botany.soil.tooltip.moisture") + " "; info += ", " + I18N.localise("botany.soil.tooltip.moisture") + " ";
info += colors[moisture.ordinal()] + AlleleHelper.toDisplay(moisture) + EnumChatFormatting.RESET; info += colors[moisture.ordinal()] + AlleleHelper.toDisplay(moisture) + EnumChatFormatting.RESET;
colors = new EnumChatFormatting[] { EnumChatFormatting.RED, EnumChatFormatting.GREEN, colors = new EnumChatFormatting[] {
EnumChatFormatting.AQUA, }; EnumChatFormatting.RED, EnumChatFormatting.GREEN, EnumChatFormatting.AQUA,
};
info += ", " + I18N.localise("botany.soil.tooltip.pH") + " "; info += ", " + I18N.localise("botany.soil.tooltip.pH") + " ";
info += colors[pH.ordinal()] + AlleleHelper.toDisplay(pH) + EnumChatFormatting.RESET; info += colors[pH.ordinal()] + AlleleHelper.toDisplay(pH) + EnumChatFormatting.RESET;
IChatComponent chat = new ChatComponentText(info); IChatComponent chat = new ChatComponentText(info);
@@ -1,15 +1,5 @@
package binnie.botany.gardening; package binnie.botany.gardening;
import static cpw.mods.fml.common.registry.GameRegistry.registerItem;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import binnie.botany.Botany; import binnie.botany.Botany;
import binnie.botany.CreativeTabBotany; import binnie.botany.CreativeTabBotany;
import binnie.botany.api.EnumAcidity; import binnie.botany.api.EnumAcidity;
@@ -17,9 +7,15 @@ import binnie.botany.api.EnumMoisture;
import binnie.botany.api.EnumSoilType; import binnie.botany.api.EnumSoilType;
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.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
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;
@@ -30,8 +26,6 @@ public class ItemTrowel extends Item {
setCreativeTab(CreativeTabBotany.instance); setCreativeTab(CreativeTabBotany.instance);
setUnlocalizedName("trowel" + material); setUnlocalizedName("trowel" + material);
locName = "trowel" + material; locName = "trowel" + material;
registerItem(this, getUnlocalizedName().substring(5));
} }
@Override @Override
@@ -41,8 +35,17 @@ public class ItemTrowel extends Item {
} }
@Override @Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, public boolean onItemUse(
float blockX, float blockY, float blockZ) { 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, side, stack)) { if (!player.canPlayerEdit(x, y, z, side, stack)) {
return false; return false;
} }
@@ -1,15 +1,13 @@
package binnie.botany.gardening; package binnie.botany.gardening;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
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.item.ItemStack;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemWeed extends ItemBlock { public class ItemWeed extends ItemBlock {
public ItemWeed(Block block) { public ItemWeed(Block block) {
super(block); super(block);
setHasSubtypes(true); setHasSubtypes(true);
@@ -18,7 +16,7 @@ public class ItemWeed extends ItemBlock {
@Override @Override
public String getItemStackDisplayName(ItemStack stack) { public String getItemStackDisplayName(ItemStack stack) {
return BlockPlant.Type.VALUES[stack.getItemDamage()].getName(); return BlockPlant.Type.values()[stack.getItemDamage()].getName();
} }
@Override @Override
@@ -1,17 +1,6 @@
package binnie.botany.gardening; package binnie.botany.gardening;
import java.util.HashMap; import binnie.Binnie;
import java.util.Map;
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;
import binnie.botany.Botany; import binnie.botany.Botany;
import binnie.botany.CreativeTabBotany; import binnie.botany.CreativeTabBotany;
import binnie.botany.api.EnumAcidity; import binnie.botany.api.EnumAcidity;
@@ -36,11 +25,19 @@ import binnie.core.block.ItemMetadata;
import binnie.core.block.ItemMetadataRenderer; import binnie.core.block.ItemMetadataRenderer;
import binnie.core.block.MultipassItemRenderer; import binnie.core.block.MultipassItemRenderer;
import binnie.core.block.TileEntityMetadata; import binnie.core.block.TileEntityMetadata;
import binnie.core.item.ItemMisc;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
import java.util.HashMap;
import java.util.Map;
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 { public class ModuleGardening implements IInitializable {
public static HashMap<ItemStack, Integer> queuedAcidFertilisers = new HashMap<>(); public static HashMap<ItemStack, Integer> queuedAcidFertilisers = new HashMap<>();
public static HashMap<ItemStack, Integer> queuedAlkalineFertilisers = new HashMap<>(); public static HashMap<ItemStack, Integer> queuedAlkalineFertilisers = new HashMap<>();
public static HashMap<ItemStack, Integer> queuedNutrientFertilisers = new HashMap<>(); public static HashMap<ItemStack, Integer> queuedNutrientFertilisers = new HashMap<>();
@@ -75,7 +72,7 @@ public class ModuleGardening implements IInitializable {
Botany.trowelIron = new ItemTrowel(Item.ToolMaterial.IRON, "Iron"); Botany.trowelIron = new ItemTrowel(Item.ToolMaterial.IRON, "Iron");
Botany.trowelDiamond = new ItemTrowel(Item.ToolMaterial.EMERALD, "Diamond"); Botany.trowelDiamond = new ItemTrowel(Item.ToolMaterial.EMERALD, "Diamond");
Botany.trowelGold = new ItemTrowel(Item.ToolMaterial.GOLD, "Gold"); Botany.trowelGold = new ItemTrowel(Item.ToolMaterial.GOLD, "Gold");
Botany.misc = new ItemMisc(CreativeTabBotany.instance, BotanyItems.values()); 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();
@@ -89,13 +86,13 @@ public class ModuleGardening implements IInitializable {
Botany.ceramicTile = new BlockCeramicPatterned(); Botany.ceramicTile = new BlockCeramicPatterned();
GameRegistry.registerBlock(Botany.ceramicTile, ItemMetadata.class, "ceramicPattern"); GameRegistry.registerBlock(Botany.ceramicTile, ItemMetadata.class, "ceramicPattern");
BinnieCore.proxy BinnieCore.proxy.registerCustomItemRenderer(
.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramicTile), new MultipassItemRenderer()); Item.getItemFromBlock(Botany.ceramicTile), new MultipassItemRenderer());
Botany.ceramicBrick = new BlockCeramicBrick(); Botany.ceramicBrick = new BlockCeramicBrick();
GameRegistry.registerBlock(Botany.ceramicBrick, ItemMetadata.class, "ceramicBrick"); GameRegistry.registerBlock(Botany.ceramicBrick, ItemMetadata.class, "ceramicBrick");
BinnieCore.proxy BinnieCore.proxy.registerCustomItemRenderer(
.registerCustomItemRenderer(Item.getItemFromBlock(Botany.ceramicBrick), new MultipassItemRenderer()); Item.getItemFromBlock(Botany.ceramicBrick), new MultipassItemRenderer());
} }
@Override @Override
@@ -107,11 +104,11 @@ public class ModuleGardening implements IInitializable {
ItemStack red = new ItemStack(Blocks.red_flower, 1); ItemStack red = new ItemStack(Blocks.red_flower, 1);
ItemStack blue = new ItemStack(Blocks.red_flower, 1, 7); ItemStack blue = new ItemStack(Blocks.red_flower, 1, 7);
for (boolean manual : new boolean[] { true, false }) { for (boolean manual : new boolean[] {true, false}) {
for (boolean fertilised : new boolean[] { true, false }) { for (boolean fertilised : new boolean[] {true, false}) {
for (EnumMoisture moist : EnumMoisture.VALUES) { for (EnumMoisture moist : EnumMoisture.values()) {
ItemStack icon = (moist == EnumMoisture.DRY) ? yellow ItemStack icon =
: ((moist == EnumMoisture.NORMAL) ? red : blue); (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;
@@ -162,48 +159,36 @@ public class ModuleGardening implements IInitializable {
} }
GameRegistry.addShapelessRecipe( GameRegistry.addShapelessRecipe(
new ItemStack(Blocks.dirt), new ItemStack(Blocks.dirt), new ItemStack(Botany.soil, 1, OreDictionary.WILDCARD_VALUE));
new ItemStack(Botany.soil, 1, OreDictionary.WILDCARD_VALUE));
GameRegistry.addShapelessRecipe( GameRegistry.addShapelessRecipe(
new ItemStack(Blocks.dirt), new ItemStack(Blocks.dirt), new ItemStack(Botany.loam, 1, OreDictionary.WILDCARD_VALUE));
new ItemStack(Botany.loam, 1, OreDictionary.WILDCARD_VALUE));
GameRegistry.addShapelessRecipe( GameRegistry.addShapelessRecipe(
new ItemStack(Blocks.dirt), new ItemStack(Blocks.dirt), new ItemStack(Botany.flowerbed, 1, OreDictionary.WILDCARD_VALUE));
new ItemStack(Botany.flowerbed, 1, OreDictionary.WILDCARD_VALUE));
GameRegistry.addShapelessRecipe( GameRegistry.addShapelessRecipe(
new ItemStack(Blocks.dirt), new ItemStack(Blocks.dirt), new ItemStack(Botany.soilNoWeed, 1, OreDictionary.WILDCARD_VALUE));
new ItemStack(Botany.soilNoWeed, 1, OreDictionary.WILDCARD_VALUE));
GameRegistry.addShapelessRecipe( GameRegistry.addShapelessRecipe(
new ItemStack(Blocks.dirt), new ItemStack(Blocks.dirt), new ItemStack(Botany.loamNoWeed, 1, OreDictionary.WILDCARD_VALUE));
new ItemStack(Botany.loamNoWeed, 1, OreDictionary.WILDCARD_VALUE));
GameRegistry.addShapelessRecipe( GameRegistry.addShapelessRecipe(
new ItemStack(Blocks.dirt), new ItemStack(Blocks.dirt), new ItemStack(Botany.flowerbedNoWeed, 1, OreDictionary.WILDCARD_VALUE));
new ItemStack(Botany.flowerbedNoWeed, 1, OreDictionary.WILDCARD_VALUE));
GameRegistry.addRecipe( GameRegistry.addRecipe(new ShapedOreRecipe(
new ShapedOreRecipe( Botany.trowelWood,
Botany.trowelWood, new Object[] {"d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "plankWood"}));
new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "plankWood" })); GameRegistry.addRecipe(new ShapedOreRecipe(
GameRegistry.addRecipe( Botany.trowelStone,
new ShapedOreRecipe( new Object[] {"d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "cobblestone"}));
Botany.trowelStone, GameRegistry.addRecipe(new ShapedOreRecipe(
new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "cobblestone" })); Botany.trowelIron,
GameRegistry.addRecipe( new Object[] {"d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "ingotIron"}));
new ShapedOreRecipe( GameRegistry.addRecipe(new ShapedOreRecipe(
Botany.trowelIron, Botany.trowelGold,
new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "ingotIron" })); new Object[] {"d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "ingotGold"}));
GameRegistry.addRecipe( GameRegistry.addRecipe(new ShapedOreRecipe(
new ShapedOreRecipe( Botany.trowelDiamond,
Botany.trowelGold, new Object[] {"d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "gemDiamond"}));
new Object[] { "d ", " x ", " s", 'd', Blocks.dirt, 's', "stickWood", 'x', "ingotGold" })); GameRegistry.addRecipe(new ShapedOreRecipe(
GameRegistry.addRecipe( Botany.soilMeter,
new ShapedOreRecipe( new Object[] {" gg", " rg", "i ", 'g', "ingotGold", 'r', "dustRedstone", 'i', "ingotIron"}));
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( GameRegistry.addShapelessRecipe(
BotanyItems.Weedkiller.get(4), BotanyItems.Weedkiller.get(4),
new ItemStack(Items.spider_eye), new ItemStack(Items.spider_eye),
@@ -216,13 +201,11 @@ public class ModuleGardening implements IInitializable {
GameRegistry.addShapelessRecipe(BotanyItems.CompostPowder.get(4), Mods.forestry.stack("fertilizerBio")); GameRegistry.addShapelessRecipe(BotanyItems.CompostPowder.get(4), Mods.forestry.stack("fertilizerBio"));
GameRegistry.addShapelessRecipe(BotanyItems.FertiliserPowder.get(4), Mods.forestry.stack("fertilizerCompound")); GameRegistry.addShapelessRecipe(BotanyItems.FertiliserPowder.get(4), Mods.forestry.stack("fertilizerCompound"));
GameRegistry.addShapelessRecipe(BotanyItems.PulpPowder.get(4), Mods.forestry.stack("woodPulp")); GameRegistry.addShapelessRecipe(BotanyItems.PulpPowder.get(4), Mods.forestry.stack("woodPulp"));
GameRegistry GameRegistry.addRecipe(new ShapelessOreRecipe(BotanyItems.SulphurPowder.get(4), new Object[] {"dustSulphur"}));
.addRecipe(new ShapelessOreRecipe(BotanyItems.SulphurPowder.get(4), new Object[] { "dustSulphur" }));
GameRegistry.addRecipe( GameRegistry.addRecipe(new ShapelessOreRecipe(
new ShapelessOreRecipe( new ItemStack(Botany.pigment, 2, EnumFlowerColor.BLACK.ordinal()),
new ItemStack(Botany.pigment, 2, EnumFlowerColor.BLACK.ordinal()), new Object[] {"pigment", "pigment", "dyeBlack"}));
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);
@@ -238,10 +221,10 @@ public class ModuleGardening implements IInitializable {
ModuleGardening.queuedAlkalineFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "woodPulp")), 2); ModuleGardening.queuedAlkalineFertilisers.put(new ItemStack(GameRegistry.findItem("Forestry", "woodPulp")), 2);
ModuleGardening.queuedNutrientFertilisers.put(BotanyItems.CompostPowder.get(1), 1); ModuleGardening.queuedNutrientFertilisers.put(BotanyItems.CompostPowder.get(1), 1);
ModuleGardening.queuedNutrientFertilisers.put(BotanyItems.FertiliserPowder.get(1), 1); ModuleGardening.queuedNutrientFertilisers.put(BotanyItems.FertiliserPowder.get(1), 1);
ModuleGardening.queuedNutrientFertilisers ModuleGardening.queuedNutrientFertilisers.put(
.put(new ItemStack(GameRegistry.findItem("Forestry", "fertilizerBio")), 2); new ItemStack(GameRegistry.findItem("Forestry", "fertilizerBio")), 2);
ModuleGardening.queuedNutrientFertilisers ModuleGardening.queuedNutrientFertilisers.put(
.put(new ItemStack(GameRegistry.findItem("Forestry", "fertilizerCompound")), 2); new ItemStack(GameRegistry.findItem("Forestry", "fertilizerCompound")), 2);
for (Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedAcidFertilisers.entrySet()) { for (Map.Entry<ItemStack, Integer> entry : ModuleGardening.queuedAcidFertilisers.entrySet()) {
addAcidFertiliser(entry.getKey(), entry.getValue()); addAcidFertiliser(entry.getKey(), entry.getValue());
@@ -255,10 +238,10 @@ public class ModuleGardening implements IInitializable {
addNutrientFertiliser(entry.getKey(), entry.getValue()); addNutrientFertiliser(entry.getKey(), entry.getValue());
} }
GameRegistry GameRegistry.addRecipe(
.addRecipe(BotanyItems.Mortar.get(6), " c ", "cgc", " c ", 'c', Items.clay_ball, 'g', Blocks.gravel); BotanyItems.Mortar.get(6), " c ", "cgc", " c ", 'c', Items.clay_ball, 'g', Blocks.gravel);
for (EnumFlowerColor c : EnumFlowerColor.VALUES) { for (EnumFlowerColor c : EnumFlowerColor.values()) {
ItemStack clay = new ItemStack(Botany.clay, 1, c.ordinal()); ItemStack clay = new ItemStack(Botany.clay, 1, c.ordinal());
ItemStack pigment = new ItemStack(Botany.pigment, 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.addShapelessRecipe(clay, Items.clay_ball, Items.clay_ball, Items.clay_ball, pigment);
@@ -276,9 +259,9 @@ public class ModuleGardening implements IInitializable {
return null; return null;
} }
return new ItemStack( return new ItemStack(
Gardening.getSoilBlock(EnumSoilType.VALUES[type]), Gardening.getSoilBlock(EnumSoilType.values()[type]),
1, 1,
BlockSoil.getMeta(EnumAcidity.VALUES[pH], EnumMoisture.VALUES[moisture])); BlockSoil.getMeta(EnumAcidity.values()[pH], EnumMoisture.values()[moisture]));
} }
private void addAcidFertiliser(ItemStack stack, int strengthMax) { private void addAcidFertiliser(ItemStack stack, int strengthMax) {
@@ -3,10 +3,10 @@ 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;
private final String uid; private int value;
private final int value; private EnumFlowerColor color;
private final EnumFlowerColor color; private boolean dominant = true;
public AlleleColor(EnumFlowerColor color, String uid, int value) { public AlleleColor(EnumFlowerColor color, String uid, int value) {
this.color = color; this.color = color;
@@ -21,7 +21,7 @@ public class AlleleColor implements IAlleleInteger {
@Override @Override
public boolean isDominant() { public boolean isDominant() {
return true; return dominant;
} }
@Override @Override
@@ -1,14 +1,12 @@
package binnie.botany.genetics; package binnie.botany.genetics;
import net.minecraft.world.World;
import binnie.botany.api.IAlleleFlowerEffect; import binnie.botany.api.IAlleleFlowerEffect;
import binnie.botany.api.IFlowerGenome; import binnie.botany.api.IFlowerGenome;
import binnie.core.util.I18N; import binnie.core.util.I18N;
import forestry.api.genetics.IEffectData; 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;
@@ -1,15 +1,13 @@
package binnie.botany.genetics; package binnie.botany.genetics;
import net.minecraft.entity.player.EntityPlayer;
import binnie.Binnie; import binnie.Binnie;
import binnie.botany.api.IBotanistTracker; import binnie.botany.api.IBotanistTracker;
import forestry.api.genetics.IBreedingTracker; import forestry.api.genetics.IBreedingTracker;
import forestry.api.genetics.IIndividual; 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(String s) {
super(s); super(s);
} }
@@ -4,7 +4,6 @@ import binnie.botany.api.IColourMix;
import binnie.botany.api.IFlowerColor; import binnie.botany.api.IFlowerColor;
public class ColorMix implements IColourMix { public class ColorMix implements IColourMix {
protected IFlowerColor color1; protected IFlowerColor color1;
protected IFlowerColor color2; protected IFlowerColor color2;
protected IFlowerColor result; protected IFlowerColor result;
@@ -1,16 +1,13 @@
package binnie.botany.genetics; package binnie.botany.genetics;
import java.util.Locale;
import org.apache.commons.lang3.StringUtils;
import binnie.botany.api.IFlowerColor; import binnie.botany.api.IFlowerColor;
import binnie.botany.core.BotanyCore; import binnie.botany.core.BotanyCore;
import binnie.core.util.I18N; import binnie.core.util.I18N;
import forestry.api.genetics.IAlleleInteger; import forestry.api.genetics.IAlleleInteger;
import java.util.Locale;
import org.apache.commons.lang3.StringUtils;
public enum EnumFlowerColor implements IFlowerColor { public enum EnumFlowerColor implements IFlowerColor {
AQUAMARINE("aquamarine", 0x7fffd4), AQUAMARINE("aquamarine", 0x7fffd4),
BLACK("black", 0x282828), BLACK("black", 0x282828),
BLUE("blue", 0x0000ff), BLUE("blue", 0x0000ff),
@@ -92,14 +89,10 @@ public enum EnumFlowerColor implements IFlowerColor {
YELLOW("yellow", 0xffff00), YELLOW("yellow", 0xffff00),
YELLOW_GREEN("yellowGreen", 0x9acd32); YELLOW_GREEN("yellowGreen", 0x9acd32);
/** private int color;
* Cached values() array for frequent read-only operations, the array should NOT be mutated. private int colorDis;
*/ private String name;
public static final EnumFlowerColor[] VALUES = values(); private AlleleColor allele;
private final int color;
private final int colorDis;
private final String name;
private final AlleleColor allele;
EnumFlowerColor(String name, int color) { EnumFlowerColor(String name, int color) {
this.name = name; this.name = name;
@@ -2967,7 +2960,7 @@ public enum EnumFlowerColor implements IFlowerColor {
} }
public static EnumFlowerColor get(int i) { public static EnumFlowerColor get(int i) {
return VALUES[Math.max(0, i) % VALUES.length]; return values()[Math.max(0, i) % values().length];
} }
@Override @Override
@@ -1,14 +1,12 @@
package binnie.botany.genetics; package binnie.botany.genetics;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import binnie.botany.Botany; import binnie.botany.Botany;
import binnie.botany.api.EnumFlowerStage; import binnie.botany.api.EnumFlowerStage;
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,
@@ -57,22 +55,18 @@ public enum EnumFlowerType implements IFlowerType {
DELPHINIUM(2), DELPHINIUM(2),
HOLLYHOCK(2); HOLLYHOCK(2);
/** protected int sections;
* Cached values() array for frequent read-only operations, the array should NOT be mutated. protected IIcon[] stem;
*/ protected IIcon[] petal;
public static final EnumFlowerType[] VALUES = values(); protected IIcon[] variant;
private final int sections; protected IIcon[] unflowered;
private final IIcon[] stem; protected IIcon seedStem;
private final IIcon[] petal; protected IIcon seedPetal;
private final IIcon[] variant; protected IIcon seedVariant;
private final IIcon[] unflowered; protected IIcon pollenStem;
private IIcon seedStem; protected IIcon pollenPetal;
private IIcon seedPetal; protected IIcon pollenVariant;
private IIcon seedVariant; protected IIcon blank;
private IIcon pollenStem;
private IIcon pollenPetal;
private IIcon pollenVariant;
private IIcon blank;
EnumFlowerType() { EnumFlowerType() {
this(1); this(1);
@@ -1,11 +1,5 @@
package binnie.botany.genetics; package binnie.botany.genetics;
import java.util.List;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import binnie.botany.api.EnumFlowerChromosome; import binnie.botany.api.EnumFlowerChromosome;
import binnie.botany.api.IAlleleFlowerSpecies; import binnie.botany.api.IAlleleFlowerSpecies;
import binnie.botany.api.IColourMix; import binnie.botany.api.IColourMix;
@@ -21,9 +15,12 @@ import forestry.api.genetics.IAllele;
import forestry.api.genetics.IChromosome; import forestry.api.genetics.IChromosome;
import forestry.core.genetics.Chromosome; import forestry.core.genetics.Chromosome;
import forestry.core.genetics.Individual; import forestry.core.genetics.Individual;
import java.util.List;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
public class Flower extends Individual implements IFlower { public class Flower extends Individual implements IFlower {
public IFlowerGenome genome; public IFlowerGenome genome;
public IFlowerGenome mate; public IFlowerGenome mate;
@@ -59,24 +56,23 @@ public class Flower extends Individual implements IFlower {
IAlleleFlowerSpecies primary = genome.getPrimary(); IAlleleFlowerSpecies primary = genome.getPrimary();
IAlleleFlowerSpecies secondary = genome.getSecondary(); IAlleleFlowerSpecies secondary = genome.getSecondary();
if (!isPureBred(EnumFlowerChromosome.SPECIES)) { if (!isPureBred(EnumFlowerChromosome.SPECIES)) {
list.add( list.add(EnumChatFormatting.BLUE
EnumChatFormatting.BLUE + I18N.localise("botany.item.tooltip.hybrid", primary.getName(), secondary.getName()));
+ I18N.localise("botany.item.tooltip.hybrid", primary.getName(), secondary.getName()));
} }
list.add(EnumChatFormatting.GRAY + I18N.localise("botany.item.tooltip.age", getAge())); list.add(EnumChatFormatting.GRAY + I18N.localise("botany.item.tooltip.age", getAge()));
list.add( list.add(EnumChatFormatting.GREEN
EnumChatFormatting.GREEN + I18N.localise( + I18N.localise(
"botany.item.tooltip.temperature", "botany.item.tooltip.temperature",
AlleleHelper.toDisplay(primary.getTemperature()), AlleleHelper.toDisplay(primary.getTemperature()),
AlleleHelper.toDisplay(genome.getToleranceTemperature()))); AlleleHelper.toDisplay(genome.getToleranceTemperature())));
list.add( list.add(EnumChatFormatting.GREEN
EnumChatFormatting.GREEN + I18N.localise( + I18N.localise(
"botany.item.tooltip.moisture", "botany.item.tooltip.moisture",
AlleleHelper.toDisplay(primary.getMoisture()), AlleleHelper.toDisplay(primary.getMoisture()),
AlleleHelper.toDisplay(genome.getToleranceMoisture()))); AlleleHelper.toDisplay(genome.getToleranceMoisture())));
list.add( list.add(EnumChatFormatting.GREEN
EnumChatFormatting.GREEN + I18N.localise( + I18N.localise(
"botany.item.tooltip.pH", "botany.item.tooltip.pH",
AlleleHelper.toDisplay(primary.getHumidity()), AlleleHelper.toDisplay(primary.getHumidity()),
AlleleHelper.toDisplay(genome.getTolerancePH()))); AlleleHelper.toDisplay(genome.getTolerancePH())));
@@ -92,7 +88,8 @@ public class Flower extends Individual implements IFlower {
public void readFromNBT(NBTTagCompound nbttagcompound) { public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound); super.readFromNBT(nbttagcompound);
if (nbttagcompound == null) { if (nbttagcompound == null) {
genome = BotanyCore.getFlowerRoot().templateAsGenome(BotanyCore.getFlowerRoot().getDefaultTemplate()); genome = BotanyCore.getFlowerRoot()
.templateAsGenome(BotanyCore.getFlowerRoot().getDefaultTemplate());
return; return;
} }
@@ -238,7 +235,8 @@ public class Flower extends Individual implements IFlower {
if (colour1 != colour2) { if (colour1 != colour2) {
for (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());
} }
} }
} }
@@ -248,8 +246,8 @@ public class Flower extends Individual implements IFlower {
if (colour1 != colour2) { if (colour1 != colour2) {
for (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( parent1[EnumFlowerChromosome.SECONDARY.ordinal()] =
mutation.getResult().getAllele()); new Chromosome(mutation.getResult().getAllele());
} }
} }
} }
@@ -259,7 +257,8 @@ public class Flower extends Individual implements IFlower {
if (colour1 != colour2) { if (colour1 != colour2) {
for (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());
} }
} }
} }
@@ -1,7 +1,5 @@
package binnie.botany.genetics; package binnie.botany.genetics;
import net.minecraft.nbt.NBTTagCompound;
import binnie.Binnie; import binnie.Binnie;
import binnie.botany.api.EnumAcidity; import binnie.botany.api.EnumAcidity;
import binnie.botany.api.EnumFlowerChromosome; import binnie.botany.api.EnumFlowerChromosome;
@@ -18,9 +16,9 @@ import forestry.api.genetics.IAlleleTolerance;
import forestry.api.genetics.IChromosome; import forestry.api.genetics.IChromosome;
import forestry.api.genetics.ISpeciesRoot; 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(NBTTagCompound nbttagcompound) {
super(nbttagcompound); super(nbttagcompound);
} }
@@ -96,7 +94,7 @@ public class FlowerGenome extends Genome implements IFlowerGenome {
@Override @Override
public float getAgeChance() { public float getAgeChance() {
return (float) Math.sqrt(2.0f / getLifespan()); return 1.0f * (float) Math.sqrt(2.0f / getLifespan());
} }
@Override @Override
@@ -1,19 +1,5 @@
package binnie.botany.genetics; package binnie.botany.genetics;
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 net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import com.mojang.authlib.GameProfile;
import binnie.botany.Botany; import binnie.botany.Botany;
import binnie.botany.api.EnumFlowerChromosome; import binnie.botany.api.EnumFlowerChromosome;
import binnie.botany.api.EnumFlowerStage; import binnie.botany.api.EnumFlowerStage;
@@ -24,6 +10,7 @@ import binnie.botany.api.IFlower;
import binnie.botany.api.IFlowerGenome; import binnie.botany.api.IFlowerGenome;
import binnie.botany.api.IFlowerMutation; import binnie.botany.api.IFlowerMutation;
import binnie.botany.api.IFlowerRoot; import binnie.botany.api.IFlowerRoot;
import com.mojang.authlib.GameProfile;
import forestry.api.genetics.AlleleManager; import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele; import forestry.api.genetics.IAllele;
import forestry.api.genetics.IChromosomeType; import forestry.api.genetics.IChromosomeType;
@@ -31,16 +18,25 @@ import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IMutation; import forestry.api.genetics.IMutation;
import forestry.api.genetics.ISpeciesType; import forestry.api.genetics.ISpeciesType;
import forestry.core.genetics.SpeciesRoot; import forestry.core.genetics.SpeciesRoot;
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 net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
public class FlowerHelper extends SpeciesRoot implements IFlowerRoot { public class FlowerHelper extends SpeciesRoot implements IFlowerRoot {
public static int flowerSpeciesCount = -1; public static int flowerSpeciesCount = -1;
public static ArrayList<IFlower> flowerTemplates = new ArrayList<>(); public static ArrayList<IFlower> flowerTemplates = new ArrayList<>();
protected static String UID = "rootFlowers"; protected static String UID = "rootFlowers";
private static final ArrayList<IFlowerMutation> flowerMutations = new ArrayList<>(); private static ArrayList<IFlowerMutation> flowerMutations = new ArrayList<>();
private static final ArrayList<IColourMix> colourMixes = new ArrayList<>(); private static ArrayList<IColourMix> colourMixes = new ArrayList<>();
protected Map<ItemStack, IFlower> conversions; protected Map<ItemStack, IFlower> conversions;
@@ -57,7 +53,8 @@ public class FlowerHelper extends SpeciesRoot implements IFlowerRoot {
public int getSpeciesCount() { public int getSpeciesCount() {
if (FlowerHelper.flowerSpeciesCount < 0) { if (FlowerHelper.flowerSpeciesCount < 0) {
FlowerHelper.flowerSpeciesCount = 0; FlowerHelper.flowerSpeciesCount = 0;
for (Map.Entry<String, IAllele> entry : AlleleManager.alleleRegistry.getRegisteredAlleles().entrySet()) { for (Map.Entry<String, IAllele> entry :
AlleleManager.alleleRegistry.getRegisteredAlleles().entrySet()) {
if (entry.getValue() instanceof IAlleleFlowerSpecies if (entry.getValue() instanceof IAlleleFlowerSpecies
&& ((IAlleleFlowerSpecies) entry.getValue()).isCounted()) { && ((IAlleleFlowerSpecies) entry.getValue()).isCounted()) {
FlowerHelper.flowerSpeciesCount++; FlowerHelper.flowerSpeciesCount++;
@@ -188,7 +185,9 @@ public class FlowerHelper extends SpeciesRoot implements IFlowerRoot {
@Override @Override
public IAllele[] getRandomTemplate(Random rand) { public IAllele[] getRandomTemplate(Random rand) {
return speciesTemplates.values().toArray(new IAllele[0][])[rand.nextInt(speciesTemplates.values().size())]; return speciesTemplates.values()
.toArray(new IAllele[0][])[
rand.nextInt(speciesTemplates.values().size())];
} }
@Override @Override
@@ -202,8 +201,10 @@ public class FlowerHelper extends SpeciesRoot implements IFlowerRoot {
@Override @Override
public void registerMutation(IMutation mutation) { public void registerMutation(IMutation mutation) {
if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getTemplate()[0].getUID()) if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getTemplate()[0].getUID())
|| AlleleManager.alleleRegistry.isBlacklisted(mutation.getAllele0().getUID()) || AlleleManager.alleleRegistry.isBlacklisted(
|| AlleleManager.alleleRegistry.isBlacklisted(mutation.getAllele1().getUID())) { mutation.getAllele0().getUID())
|| AlleleManager.alleleRegistry.isBlacklisted(
mutation.getAllele1().getUID())) {
return; return;
} }
FlowerHelper.flowerMutations.add((IFlowerMutation) mutation); FlowerHelper.flowerMutations.add((IFlowerMutation) mutation);
@@ -226,13 +227,13 @@ public class FlowerHelper extends SpeciesRoot implements IFlowerRoot {
} }
@Override @Override
public Class<? extends IIndividual> getMemberClass() { public Class getMemberClass() {
return IFlower.class; return IFlower.class;
} }
@Override @Override
public IChromosomeType[] getKaryotype() { public IChromosomeType[] getKaryotype() {
return EnumFlowerChromosome.VALUES; return EnumFlowerChromosome.values();
} }
@Override @Override
@@ -1,17 +1,15 @@
package binnie.botany.genetics; package binnie.botany.genetics;
import java.util.ArrayList;
import java.util.Collection;
import binnie.botany.api.IAlleleFlowerSpecies; import binnie.botany.api.IAlleleFlowerSpecies;
import binnie.botany.api.IFlowerMutation; import binnie.botany.api.IFlowerMutation;
import binnie.botany.core.BotanyCore; import binnie.botany.core.BotanyCore;
import forestry.api.genetics.IAllele; import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome; import forestry.api.genetics.IGenome;
import forestry.api.genetics.ISpeciesRoot; import forestry.api.genetics.ISpeciesRoot;
import java.util.ArrayList;
import java.util.Collection;
public class FlowerMutation implements IFlowerMutation { public class FlowerMutation implements IFlowerMutation {
protected IAlleleFlowerSpecies allele0; protected IAlleleFlowerSpecies allele0;
protected IAlleleFlowerSpecies allele1; protected IAlleleFlowerSpecies allele1;
protected IAllele[] template; protected IAllele[] template;
@@ -64,10 +62,12 @@ public class FlowerMutation implements IFlowerMutation {
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 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 getBaseChance(); return getBaseChance();
} }
return 0.0f; return 0.0f;
@@ -1,14 +1,5 @@
package binnie.botany.genetics; package binnie.botany.genetics;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import com.mojang.authlib.GameProfile;
import binnie.botany.api.EnumAcidity; import binnie.botany.api.EnumAcidity;
import binnie.botany.api.EnumFlowerChromosome; import binnie.botany.api.EnumFlowerChromosome;
import binnie.botany.api.EnumMoisture; import binnie.botany.api.EnumMoisture;
@@ -18,6 +9,7 @@ import binnie.botany.api.IFlowerType;
import binnie.botany.core.BotanyCore; import binnie.botany.core.BotanyCore;
import binnie.core.util.I18N; import binnie.core.util.I18N;
import binnie.genetics.genetics.AlleleHelper; import binnie.genetics.genetics.AlleleHelper;
import com.mojang.authlib.GameProfile;
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.core.EnumHumidity; import forestry.api.core.EnumHumidity;
@@ -30,9 +22,13 @@ import forestry.api.genetics.IClassification;
import forestry.api.genetics.IIndividual; import forestry.api.genetics.IIndividual;
import forestry.api.genetics.ISpeciesRoot; import forestry.api.genetics.ISpeciesRoot;
import forestry.core.genetics.alleles.EnumAllele; import forestry.core.genetics.alleles.EnumAllele;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public enum FlowerSpecies implements IAlleleFlowerSpecies { public enum FlowerSpecies implements IAlleleFlowerSpecies {
DANDELION("dandelion", "taraxacum", "officinale", EnumFlowerType.DANDELION, EnumFlowerColor.YELLOW), DANDELION("dandelion", "taraxacum", "officinale", EnumFlowerType.DANDELION, EnumFlowerColor.YELLOW),
POPPY("poppy", "papaver", "rhoeas", EnumFlowerType.POPPY, EnumFlowerColor.RED), POPPY("poppy", "papaver", "rhoeas", EnumFlowerType.POPPY, EnumFlowerColor.RED),
ORCHID("orchid", "vanda", "coerulea", EnumFlowerType.ORCHID, EnumFlowerColor.DEEP_SKY_BLUE), ORCHID("orchid", "vanda", "coerulea", EnumFlowerType.ORCHID, EnumFlowerColor.DEEP_SKY_BLUE),
@@ -45,80 +41,156 @@ public enum FlowerSpecies implements IAlleleFlowerSpecies {
IRIS("iris", "iris", "germanica", EnumFlowerType.IRIS, EnumFlowerColor.LIGHT_GRAY, EnumFlowerColor.PURPLE), IRIS("iris", "iris", "germanica", EnumFlowerType.IRIS, EnumFlowerColor.LIGHT_GRAY, EnumFlowerColor.PURPLE),
LAVENDER("lavender", "Lavandula", "angustifolia", EnumFlowerType.LAVENDER, EnumFlowerColor.MEDIUM_ORCHID), LAVENDER("lavender", "Lavandula", "angustifolia", EnumFlowerType.LAVENDER, EnumFlowerColor.MEDIUM_ORCHID),
VIOLA("viola", "viola", "odorata", EnumFlowerType.VIOLA, EnumFlowerColor.MEDIUM_PURPLE, EnumFlowerColor.SLATE_BLUE), VIOLA("viola", "viola", "odorata", EnumFlowerType.VIOLA, EnumFlowerColor.MEDIUM_PURPLE, EnumFlowerColor.SLATE_BLUE),
DAFFODIL("daffodil", "narcissus", "pseudonarcissus", EnumFlowerType.DAFFODIL, EnumFlowerColor.YELLOW, DAFFODIL(
"daffodil",
"narcissus",
"pseudonarcissus",
EnumFlowerType.DAFFODIL,
EnumFlowerColor.YELLOW,
EnumFlowerColor.GOLD), EnumFlowerColor.GOLD),
DAHLIA("dahlia", "dahlia", "variabilis", EnumFlowerType.DAHLIA, EnumFlowerColor.HOT_PINK, DAHLIA(
"dahlia",
"dahlia",
"variabilis",
EnumFlowerType.DAHLIA,
EnumFlowerColor.HOT_PINK,
EnumFlowerColor.DEEP_PINK), EnumFlowerColor.DEEP_PINK),
PEONY("peony", "paeonia", "suffruticosa", EnumFlowerType.PEONY, EnumFlowerColor.THISTLE), PEONY("peony", "paeonia", "suffruticosa", EnumFlowerType.PEONY, EnumFlowerColor.THISTLE),
ROSE("rose", "rosa", "rubiginosa", EnumFlowerType.ROSE, EnumFlowerColor.RED), ROSE("rose", "rosa", "rubiginosa", EnumFlowerType.ROSE, EnumFlowerColor.RED),
LILAC("lilac", "syringa", "vulgaris", EnumFlowerType.LILAC, EnumFlowerColor.PLUM), LILAC("lilac", "syringa", "vulgaris", EnumFlowerType.LILAC, EnumFlowerColor.PLUM),
HYDRANGEA("hydrangea", "hydrangea", "macrophylla", EnumFlowerType.HYDRANGEA, EnumFlowerColor.DEEP_SKY_BLUE), HYDRANGEA("hydrangea", "hydrangea", "macrophylla", EnumFlowerType.HYDRANGEA, EnumFlowerColor.DEEP_SKY_BLUE),
FOXGLOVE("foxglove", "digitalis", "purpurea", EnumFlowerType.FOXGLOVE, EnumFlowerColor.HOT_PINK), FOXGLOVE("foxglove", "digitalis", "purpurea", EnumFlowerType.FOXGLOVE, EnumFlowerColor.HOT_PINK),
ZINNIA("zinnia", "zinnia", "elegans", EnumFlowerType.ZINNIA, EnumFlowerColor.MEDIUM_VIOLET_RED, ZINNIA(
"zinnia",
"zinnia",
"elegans",
EnumFlowerType.ZINNIA,
EnumFlowerColor.MEDIUM_VIOLET_RED,
EnumFlowerColor.YELLOW), EnumFlowerColor.YELLOW),
CHRYSANTHEMUM("chrysanthemum", "chrysanthemum", "ï?? grandiflorum", EnumFlowerType.MUMS, EnumFlowerColor.VIOLET), CHRYSANTHEMUM(
MARIGOLD("marigold", "calendula", "officinalis", EnumFlowerType.MARIGOLD, EnumFlowerColor.GOLD, "chrysanthemum", "chrysanthemum", "\u00ef?? grandiflorum", EnumFlowerType.MUMS, EnumFlowerColor.VIOLET),
MARIGOLD(
"marigold",
"calendula",
"officinalis",
EnumFlowerType.MARIGOLD,
EnumFlowerColor.GOLD,
EnumFlowerColor.DARK_ORANGE), EnumFlowerColor.DARK_ORANGE),
GERANIUM("geranium", "geranium", "maderense", EnumFlowerType.GERANIUM, EnumFlowerColor.DEEP_PINK), GERANIUM("geranium", "geranium", "maderense", EnumFlowerType.GERANIUM, EnumFlowerColor.DEEP_PINK),
AZALEA("azalea", "rhododendrons", "aurigeranum", EnumFlowerType.AZALEA, EnumFlowerColor.HOT_PINK), AZALEA("azalea", "rhododendrons", "aurigeranum", EnumFlowerType.AZALEA, EnumFlowerColor.HOT_PINK),
PRIMROSE("primrose", "primula", "vulgaris", EnumFlowerType.PRIMROSE, EnumFlowerColor.RED, EnumFlowerColor.GOLD), PRIMROSE("primrose", "primula", "vulgaris", EnumFlowerType.PRIMROSE, EnumFlowerColor.RED, EnumFlowerColor.GOLD),
ASTER("aster", "aster", "amellus", EnumFlowerType.ASTER, EnumFlowerColor.MEDIUM_PURPLE, EnumFlowerColor.GOLDENROD), ASTER("aster", "aster", "amellus", EnumFlowerType.ASTER, EnumFlowerColor.MEDIUM_PURPLE, EnumFlowerColor.GOLDENROD),
CARNATION("carnation", "dianthus", "caryophyllus", EnumFlowerType.CARNATION, EnumFlowerColor.CRIMSON, CARNATION(
"carnation",
"dianthus",
"caryophyllus",
EnumFlowerType.CARNATION,
EnumFlowerColor.CRIMSON,
EnumFlowerColor.WHITE), EnumFlowerColor.WHITE),
LILY("lily", "lilium", "auratum", EnumFlowerType.LILY, EnumFlowerColor.PINK, EnumFlowerColor.GOLD), LILY("lily", "lilium", "auratum", EnumFlowerType.LILY, EnumFlowerColor.PINK, EnumFlowerColor.GOLD),
YARROW("yarrow", "achillea", "millefolium", EnumFlowerType.YARROW, EnumFlowerColor.YELLOW), YARROW("yarrow", "achillea", "millefolium", EnumFlowerType.YARROW, EnumFlowerColor.YELLOW),
PETUNIA("petunia", "petunia", "ï?? atkinsiana", EnumFlowerType.PETUNIA, EnumFlowerColor.MEDIUM_VIOLET_RED, PETUNIA(
"petunia",
"petunia",
"\u00ef?? atkinsiana",
EnumFlowerType.PETUNIA,
EnumFlowerColor.MEDIUM_VIOLET_RED,
EnumFlowerColor.THISTLE), EnumFlowerColor.THISTLE),
AGAPANTHUS("agapanthus", "agapanthus", "praecox", EnumFlowerType.AGAPANTHUS, EnumFlowerColor.DEEP_SKY_BLUE), AGAPANTHUS("agapanthus", "agapanthus", "praecox", EnumFlowerType.AGAPANTHUS, EnumFlowerColor.DEEP_SKY_BLUE),
FUCHSIA("fuchsia", "fuchsia", "magellanica", EnumFlowerType.FUCHSIA, EnumFlowerColor.DEEP_PINK, FUCHSIA(
"fuchsia",
"fuchsia",
"magellanica",
EnumFlowerType.FUCHSIA,
EnumFlowerColor.DEEP_PINK,
EnumFlowerColor.MEDIUM_ORCHID), EnumFlowerColor.MEDIUM_ORCHID),
DIANTHUS("dianthus", "dianthus", "barbatus", EnumFlowerType.DIANTHUS, EnumFlowerColor.CRIMSON, DIANTHUS(
"dianthus",
"dianthus",
"barbatus",
EnumFlowerType.DIANTHUS,
EnumFlowerColor.CRIMSON,
EnumFlowerColor.HOT_PINK), EnumFlowerColor.HOT_PINK),
FORGET("forget-me-nots", "myosotis", "arvensis", EnumFlowerType.FORGET, EnumFlowerColor.LIGHT_STEEL_BLUE), FORGET("forget-me-nots", "myosotis", "arvensis", EnumFlowerType.FORGET, EnumFlowerColor.LIGHT_STEEL_BLUE),
ANEMONE("anemone", "anemone", "coronaria", EnumFlowerType.ANEMONE, EnumFlowerColor.RED, EnumFlowerColor.MISTY_ROSE), ANEMONE("anemone", "anemone", "coronaria", EnumFlowerType.ANEMONE, EnumFlowerColor.RED, EnumFlowerColor.MISTY_ROSE),
AQUILEGIA("aquilegia", "aquilegia", "vulgaris", EnumFlowerType.AQUILEGIA, EnumFlowerColor.SLATE_BLUE, AQUILEGIA(
"aquilegia",
"aquilegia",
"vulgaris",
EnumFlowerType.AQUILEGIA,
EnumFlowerColor.SLATE_BLUE,
EnumFlowerColor.THISTLE), EnumFlowerColor.THISTLE),
EDELWEISS("edelweiss", "leontopodium", "alpinum", EnumFlowerType.EDELWEISS, EnumFlowerColor.WHITE, EDELWEISS(
"edelweiss",
"leontopodium",
"alpinum",
EnumFlowerType.EDELWEISS,
EnumFlowerColor.WHITE,
EnumFlowerColor.KHAKI), EnumFlowerColor.KHAKI),
SCABIOUS("scabious", "scabiosa", "columbaria", EnumFlowerType.SCABIOUS, EnumFlowerColor.ROYAL_BLUE), SCABIOUS("scabious", "scabiosa", "columbaria", EnumFlowerType.SCABIOUS, EnumFlowerColor.ROYAL_BLUE),
CONEFLOWER("coneflower", "echinacea", "purpurea", EnumFlowerType.CONEFLOWER, EnumFlowerColor.VIOLET, CONEFLOWER(
"coneflower",
"echinacea",
"purpurea",
EnumFlowerType.CONEFLOWER,
EnumFlowerColor.VIOLET,
EnumFlowerColor.DARK_ORANGE), EnumFlowerColor.DARK_ORANGE),
GAILLARDIA("gaillardia", "gaillardia", "aristata", EnumFlowerType.GAILLARDIA, EnumFlowerColor.DARK_ORANGE, GAILLARDIA(
"gaillardia",
"gaillardia",
"aristata",
EnumFlowerType.GAILLARDIA,
EnumFlowerColor.DARK_ORANGE,
EnumFlowerColor.YELLOW), EnumFlowerColor.YELLOW),
AURICULA("auricula", "primula", "auricula", EnumFlowerType.AURICULA, EnumFlowerColor.RED, EnumFlowerColor.YELLOW), AURICULA("auricula", "primula", "auricula", EnumFlowerType.AURICULA, EnumFlowerColor.RED, EnumFlowerColor.YELLOW),
CAMELLIA("camellia", "camellia", "japonica", EnumFlowerType.CAMELLIA, EnumFlowerColor.CRIMSON), CAMELLIA("camellia", "camellia", "japonica", EnumFlowerType.CAMELLIA, EnumFlowerColor.CRIMSON),
GOLDENROD("goldenrod", "solidago", "canadensis", EnumFlowerType.GOLDENROD, EnumFlowerColor.GOLD), GOLDENROD("goldenrod", "solidago", "canadensis", EnumFlowerType.GOLDENROD, EnumFlowerColor.GOLD),
ALTHEA("althea", "althaea", "officinalis", EnumFlowerType.ALTHEA, EnumFlowerColor.THISTLE, ALTHEA(
"althea",
"althaea",
"officinalis",
EnumFlowerType.ALTHEA,
EnumFlowerColor.THISTLE,
EnumFlowerColor.MEDIUM_ORCHID), EnumFlowerColor.MEDIUM_ORCHID),
PENSTEMON("penstemon", "penstemon", "digitalis", EnumFlowerType.PENSTEMON, EnumFlowerColor.MEDIUM_ORCHID, PENSTEMON(
"penstemon",
"penstemon",
"digitalis",
EnumFlowerType.PENSTEMON,
EnumFlowerColor.MEDIUM_ORCHID,
EnumFlowerColor.THISTLE), EnumFlowerColor.THISTLE),
DELPHINIUM("delphinium", "delphinium", "staphisagria", EnumFlowerType.DELPHINIUM, EnumFlowerColor.DARK_SLATE_BLUE), DELPHINIUM("delphinium", "delphinium", "staphisagria", EnumFlowerType.DELPHINIUM, EnumFlowerColor.DARK_SLATE_BLUE),
HOLLYHOCK("hollyhock", "Alcea", "rosea", EnumFlowerType.HOLLYHOCK, EnumFlowerColor.BLACK, EnumFlowerColor.GOLD); HOLLYHOCK("hollyhock", "Alcea", "rosea", EnumFlowerType.HOLLYHOCK, EnumFlowerColor.BLACK, EnumFlowerColor.GOLD);
private EnumFlowerColor stemColor; protected EnumFlowerColor stemColor;
private EnumAllele.Fertility fert; protected EnumAllele.Fertility fert;
private EnumAllele.Lifespan life; protected EnumAllele.Lifespan life;
private EnumAllele.Sappiness sap; protected EnumAllele.Sappiness sap;
private final IFlowerType type; protected IFlowerType type;
private final String name; protected String name;
private final String binomial; protected String binomial;
private final String branchName; protected String branchName;
private final EnumFlowerColor primaryColor; protected EnumFlowerColor primaryColor;
private final EnumFlowerColor secondaryColor; protected EnumFlowerColor secondaryColor;
private EnumTemperature temperature; protected EnumTemperature temperature;
private EnumAcidity pH; protected EnumAcidity pH;
private EnumMoisture moisture; protected EnumMoisture moisture;
private EnumTolerance tempTolerance; protected EnumTolerance tempTolerance;
private EnumTolerance pHTolerance; protected EnumTolerance pHTolerance;
private EnumTolerance moistureTolerance; protected EnumTolerance moistureTolerance;
private final List<IAllele[]> variantTemplates; protected List<IAllele[]> variantTemplates;
private IClassification branch; protected IClassification branch;
FlowerSpecies(String name, String branch, String binomial, IFlowerType type, EnumFlowerColor colour) { FlowerSpecies(String name, String branch, String binomial, IFlowerType type, EnumFlowerColor colour) {
this(name, branch, binomial, type, colour, colour); this(name, branch, binomial, type, colour, colour);
} }
FlowerSpecies(String name, String branch, String binomial, IFlowerType type, EnumFlowerColor primaryColor, FlowerSpecies(
String name,
String branch,
String binomial,
IFlowerType type,
EnumFlowerColor primaryColor,
EnumFlowerColor secondaryColor) { EnumFlowerColor secondaryColor) {
this.name = name; this.name = name;
this.binomial = binomial; this.binomial = binomial;
@@ -139,16 +211,21 @@ public enum FlowerSpecies implements IAlleleFlowerSpecies {
public static void setupVariants() { public static void setupVariants() {
FlowerSpecies.DANDELION FlowerSpecies.DANDELION
.setTraits(EnumAllele.Fertility.HIGH, EnumAllele.Lifespan.SHORTENED, EnumAllele.Sappiness.LOWER) .setTraits(EnumAllele.Fertility.HIGH, EnumAllele.Lifespan.SHORTENED, EnumAllele.Sappiness.LOWER)
.setPH(EnumAcidity.NEUTRAL, EnumTolerance.BOTH_1).setMoisture(EnumMoisture.NORMAL, EnumTolerance.BOTH_1) .setPH(EnumAcidity.NEUTRAL, EnumTolerance.BOTH_1)
.setMoisture(EnumMoisture.NORMAL, EnumTolerance.BOTH_1)
.setStemColor(EnumFlowerColor.GREEN); .setStemColor(EnumFlowerColor.GREEN);
FlowerSpecies.POPPY FlowerSpecies.POPPY
.setTraits(EnumAllele.Fertility.HIGH, EnumAllele.Lifespan.SHORTER, EnumAllele.Sappiness.AVERAGE) .setTraits(EnumAllele.Fertility.HIGH, EnumAllele.Lifespan.SHORTER, EnumAllele.Sappiness.AVERAGE)
.setPH(EnumAcidity.NEUTRAL, EnumTolerance.DOWN_1).setMoisture(EnumMoisture.NORMAL, EnumTolerance.DOWN_1) .setPH(EnumAcidity.NEUTRAL, EnumTolerance.DOWN_1)
.setTemperature(EnumTemperature.WARM, EnumTolerance.BOTH_2).setStemColor(EnumFlowerColor.GREEN); .setMoisture(EnumMoisture.NORMAL, EnumTolerance.DOWN_1)
.setTemperature(EnumTemperature.WARM, EnumTolerance.BOTH_2)
.setStemColor(EnumFlowerColor.GREEN);
FlowerSpecies.ORCHID.setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.LONG, EnumAllele.Sappiness.LOW) FlowerSpecies.ORCHID
.setPH(EnumAcidity.ACID, EnumTolerance.NONE).setMoisture(EnumMoisture.NORMAL, EnumTolerance.BOTH_1) .setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.LONG, EnumAllele.Sappiness.LOW)
.setPH(EnumAcidity.ACID, EnumTolerance.NONE)
.setMoisture(EnumMoisture.NORMAL, EnumTolerance.BOTH_1)
.setStemColor(EnumFlowerColor.GREEN); .setStemColor(EnumFlowerColor.GREEN);
FlowerSpecies.ALLIUM FlowerSpecies.ALLIUM
@@ -156,175 +233,224 @@ public enum FlowerSpecies implements IAlleleFlowerSpecies {
.setPH(EnumAcidity.ALKALINE, EnumTolerance.DOWN_1) .setPH(EnumAcidity.ALKALINE, EnumTolerance.DOWN_1)
.setMoisture(EnumMoisture.NORMAL, EnumTolerance.DOWN_1); .setMoisture(EnumMoisture.NORMAL, EnumTolerance.DOWN_1);
FlowerSpecies.BLUET.setTraits(EnumAllele.Fertility.LOW, EnumAllele.Lifespan.NORMAL, EnumAllele.Sappiness.LOWER) FlowerSpecies.BLUET
.setPH(EnumAcidity.NEUTRAL, EnumTolerance.DOWN_1).setMoisture(EnumMoisture.DAMP, EnumTolerance.NONE) .setTraits(EnumAllele.Fertility.LOW, EnumAllele.Lifespan.NORMAL, EnumAllele.Sappiness.LOWER)
.setPH(EnumAcidity.NEUTRAL, EnumTolerance.DOWN_1)
.setMoisture(EnumMoisture.DAMP, EnumTolerance.NONE)
.setStemColor(EnumFlowerColor.OLIVE_DRAB); .setStemColor(EnumFlowerColor.OLIVE_DRAB);
FlowerSpecies.TULIP FlowerSpecies.TULIP
.setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.LONG, EnumAllele.Sappiness.AVERAGE) .setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.LONG, EnumAllele.Sappiness.AVERAGE)
.setMoisture(EnumMoisture.NORMAL, EnumTolerance.BOTH_1).setStemColor(EnumFlowerColor.OLIVE_DRAB); .setMoisture(EnumMoisture.NORMAL, EnumTolerance.BOTH_1)
.setStemColor(EnumFlowerColor.OLIVE_DRAB);
FlowerSpecies.DAISY.setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.NORMAL, EnumAllele.Sappiness.LOW) FlowerSpecies.DAISY
.setPH(EnumAcidity.NEUTRAL, EnumTolerance.DOWN_1).setMoisture(EnumMoisture.NORMAL, EnumTolerance.DOWN_1) .setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.NORMAL, EnumAllele.Sappiness.LOW)
.setTemperature(EnumTemperature.WARM, EnumTolerance.BOTH_2).setStemColor(EnumFlowerColor.OLIVE_DRAB); .setPH(EnumAcidity.NEUTRAL, EnumTolerance.DOWN_1)
.setMoisture(EnumMoisture.NORMAL, EnumTolerance.DOWN_1)
.setTemperature(EnumTemperature.WARM, EnumTolerance.BOTH_2)
.setStemColor(EnumFlowerColor.OLIVE_DRAB);
FlowerSpecies.CORNFLOWER FlowerSpecies.CORNFLOWER
.setTraits(EnumAllele.Fertility.HIGH, EnumAllele.Lifespan.SHORTER, EnumAllele.Sappiness.LOW) .setTraits(EnumAllele.Fertility.HIGH, EnumAllele.Lifespan.SHORTER, EnumAllele.Sappiness.LOW)
.setMutation(FlowerSpecies.DANDELION, FlowerSpecies.TULIP, 10) .setMutation(FlowerSpecies.DANDELION, FlowerSpecies.TULIP, 10)
.setPH(EnumAcidity.NEUTRAL, EnumTolerance.BOTH_1).setStemColor(EnumFlowerColor.OLIVE_DRAB); .setPH(EnumAcidity.NEUTRAL, EnumTolerance.BOTH_1)
.setStemColor(EnumFlowerColor.OLIVE_DRAB);
FlowerSpecies.PANSY FlowerSpecies.PANSY
.setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.SHORTENED, EnumAllele.Sappiness.AVERAGE) .setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.SHORTENED, EnumAllele.Sappiness.AVERAGE)
.setMutation(FlowerSpecies.TULIP, FlowerSpecies.VIOLA, 5).setPH(EnumAcidity.ACID, EnumTolerance.NONE) .setMutation(FlowerSpecies.TULIP, FlowerSpecies.VIOLA, 5)
.setTemperature(EnumTemperature.WARM, EnumTolerance.DOWN_1).setStemColor(EnumFlowerColor.SEA_GREEN); .setPH(EnumAcidity.ACID, EnumTolerance.NONE)
.setTemperature(EnumTemperature.WARM, EnumTolerance.DOWN_1)
.setStemColor(EnumFlowerColor.SEA_GREEN);
FlowerSpecies.IRIS FlowerSpecies.IRIS
.setTraits(EnumAllele.Fertility.HIGH, EnumAllele.Lifespan.NORMAL, EnumAllele.Sappiness.AVERAGE) .setTraits(EnumAllele.Fertility.HIGH, EnumAllele.Lifespan.NORMAL, EnumAllele.Sappiness.AVERAGE)
.setMutation(FlowerSpecies.ORCHID, FlowerSpecies.VIOLA, 10).setPH(EnumAcidity.ACID, EnumTolerance.NONE) .setMutation(FlowerSpecies.ORCHID, FlowerSpecies.VIOLA, 10)
.setTemperature(EnumTemperature.WARM, EnumTolerance.DOWN_1).setStemColor(EnumFlowerColor.SEA_GREEN); .setPH(EnumAcidity.ACID, EnumTolerance.NONE)
.setTemperature(EnumTemperature.WARM, EnumTolerance.DOWN_1)
.setStemColor(EnumFlowerColor.SEA_GREEN);
FlowerSpecies.LAVENDER FlowerSpecies.LAVENDER
.setTraits(EnumAllele.Fertility.HIGH, EnumAllele.Lifespan.NORMAL, EnumAllele.Sappiness.LOW) .setTraits(EnumAllele.Fertility.HIGH, EnumAllele.Lifespan.NORMAL, EnumAllele.Sappiness.LOW)
.setMutation(FlowerSpecies.ALLIUM, FlowerSpecies.VIOLA, 10) .setMutation(FlowerSpecies.ALLIUM, FlowerSpecies.VIOLA, 10)
.setPH(EnumAcidity.NEUTRAL, EnumTolerance.UP_1).setMoisture(EnumMoisture.NORMAL, EnumTolerance.DOWN_1) .setPH(EnumAcidity.NEUTRAL, EnumTolerance.UP_1)
.setTemperature(EnumTemperature.WARM, EnumTolerance.DOWN_1).setStemColor(EnumFlowerColor.GREEN); .setMoisture(EnumMoisture.NORMAL, EnumTolerance.DOWN_1)
.setTemperature(EnumTemperature.WARM, EnumTolerance.DOWN_1)
.setStemColor(EnumFlowerColor.GREEN);
FlowerSpecies.VIOLA FlowerSpecies.VIOLA
.setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.SHORTENED, EnumAllele.Sappiness.AVERAGE) .setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.SHORTENED, EnumAllele.Sappiness.AVERAGE)
.setMutation(FlowerSpecies.ORCHID, FlowerSpecies.POPPY, 15).setPH(EnumAcidity.ACID, EnumTolerance.NONE) .setMutation(FlowerSpecies.ORCHID, FlowerSpecies.POPPY, 15)
.setMoisture(EnumMoisture.NORMAL, EnumTolerance.DOWN_1).setStemColor(EnumFlowerColor.OLIVE_DRAB); .setPH(EnumAcidity.ACID, EnumTolerance.NONE)
.setMoisture(EnumMoisture.NORMAL, EnumTolerance.DOWN_1)
.setStemColor(EnumFlowerColor.OLIVE_DRAB);
FlowerSpecies.DAFFODIL FlowerSpecies.DAFFODIL
.setTraits(EnumAllele.Fertility.HIGH, EnumAllele.Lifespan.ELONGATED, EnumAllele.Sappiness.AVERAGE) .setTraits(EnumAllele.Fertility.HIGH, EnumAllele.Lifespan.ELONGATED, EnumAllele.Sappiness.AVERAGE)
.setMutation(FlowerSpecies.DANDELION, FlowerSpecies.POPPY, 10) .setMutation(FlowerSpecies.DANDELION, FlowerSpecies.POPPY, 10)
.setPH(EnumAcidity.NEUTRAL, EnumTolerance.DOWN_1).setStemColor(EnumFlowerColor.GREEN); .setPH(EnumAcidity.NEUTRAL, EnumTolerance.DOWN_1)
.setStemColor(EnumFlowerColor.GREEN);
FlowerSpecies.ASTER FlowerSpecies.ASTER
.setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.NORMAL, EnumAllele.Sappiness.HIGHER) .setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.NORMAL, EnumAllele.Sappiness.HIGHER)
.setMutation(FlowerSpecies.DAISY, FlowerSpecies.TULIP, 10) .setMutation(FlowerSpecies.DAISY, FlowerSpecies.TULIP, 10)
.setPH(EnumAcidity.NEUTRAL, EnumTolerance.BOTH_1).setStemColor(EnumFlowerColor.GREEN); .setPH(EnumAcidity.NEUTRAL, EnumTolerance.BOTH_1)
.setStemColor(EnumFlowerColor.GREEN);
FlowerSpecies.LILAC FlowerSpecies.LILAC
.setTraits(EnumAllele.Fertility.LOW, EnumAllele.Lifespan.LONGER, EnumAllele.Sappiness.AVERAGE) .setTraits(EnumAllele.Fertility.LOW, EnumAllele.Lifespan.LONGER, EnumAllele.Sappiness.AVERAGE)
.setPH(EnumAcidity.ALKALINE, EnumTolerance.DOWN_1).setStemColor(EnumFlowerColor.OLIVE_DRAB); .setPH(EnumAcidity.ALKALINE, EnumTolerance.DOWN_1)
.setStemColor(EnumFlowerColor.OLIVE_DRAB);
FlowerSpecies.ROSE.setTraits(EnumAllele.Fertility.LOW, EnumAllele.Lifespan.LONGER, EnumAllele.Sappiness.HIGH) FlowerSpecies.ROSE
.setPH(EnumAcidity.ACID, EnumTolerance.UP_1).setStemColor(EnumFlowerColor.GREEN); .setTraits(EnumAllele.Fertility.LOW, EnumAllele.Lifespan.LONGER, EnumAllele.Sappiness.HIGH)
.setPH(EnumAcidity.ACID, EnumTolerance.UP_1)
.setStemColor(EnumFlowerColor.GREEN);
FlowerSpecies.PEONY.setTraits(EnumAllele.Fertility.LOW, EnumAllele.Lifespan.LONG, EnumAllele.Sappiness.AVERAGE) FlowerSpecies.PEONY
.setPH(EnumAcidity.ALKALINE, EnumTolerance.DOWN_1).setMoisture(EnumMoisture.NORMAL, EnumTolerance.UP_1) .setTraits(EnumAllele.Fertility.LOW, EnumAllele.Lifespan.LONG, EnumAllele.Sappiness.AVERAGE)
.setPH(EnumAcidity.ALKALINE, EnumTolerance.DOWN_1)
.setMoisture(EnumMoisture.NORMAL, EnumTolerance.UP_1)
.setStemColor(EnumFlowerColor.DARK_GREEN); .setStemColor(EnumFlowerColor.DARK_GREEN);
FlowerSpecies.MARIGOLD FlowerSpecies.MARIGOLD
.setTraits(EnumAllele.Fertility.HIGH, EnumAllele.Lifespan.SHORTER, EnumAllele.Sappiness.AVERAGE) .setTraits(EnumAllele.Fertility.HIGH, EnumAllele.Lifespan.SHORTER, EnumAllele.Sappiness.AVERAGE)
.setMutation(FlowerSpecies.DAISY, FlowerSpecies.DANDELION, 10) .setMutation(FlowerSpecies.DAISY, FlowerSpecies.DANDELION, 10)
.setPH(EnumAcidity.NEUTRAL, EnumTolerance.DOWN_1).setMoisture(EnumMoisture.NORMAL, EnumTolerance.UP_1) .setPH(EnumAcidity.NEUTRAL, EnumTolerance.DOWN_1)
.setTemperature(EnumTemperature.WARM, EnumTolerance.BOTH_2).setStemColor(EnumFlowerColor.GREEN); .setMoisture(EnumMoisture.NORMAL, EnumTolerance.UP_1)
.setTemperature(EnumTemperature.WARM, EnumTolerance.BOTH_2)
.setStemColor(EnumFlowerColor.GREEN);
FlowerSpecies.HYDRANGEA FlowerSpecies.HYDRANGEA
.setTraits(EnumAllele.Fertility.LOW, EnumAllele.Lifespan.LONGER, EnumAllele.Sappiness.HIGH) .setTraits(EnumAllele.Fertility.LOW, EnumAllele.Lifespan.LONGER, EnumAllele.Sappiness.HIGH)
.setMutation(FlowerSpecies.PEONY, FlowerSpecies.BLUET, 10) .setMutation(FlowerSpecies.PEONY, FlowerSpecies.BLUET, 10)
.setPH(EnumAcidity.NEUTRAL, EnumTolerance.BOTH_1).setMoisture(EnumMoisture.DAMP, EnumTolerance.NONE) .setPH(EnumAcidity.NEUTRAL, EnumTolerance.BOTH_1)
.setMoisture(EnumMoisture.DAMP, EnumTolerance.NONE)
.setStemColor(EnumFlowerColor.DARK_GREEN); .setStemColor(EnumFlowerColor.DARK_GREEN);
FlowerSpecies.FOXGLOVE FlowerSpecies.FOXGLOVE
.setTraits(EnumAllele.Fertility.LOW, EnumAllele.Lifespan.SHORTENED, EnumAllele.Sappiness.LOW) .setTraits(EnumAllele.Fertility.LOW, EnumAllele.Lifespan.SHORTENED, EnumAllele.Sappiness.LOW)
.setMutation(FlowerSpecies.LILAC, FlowerSpecies.ZINNIA, 5) .setMutation(FlowerSpecies.LILAC, FlowerSpecies.ZINNIA, 5)
.setPH(EnumAcidity.NEUTRAL, EnumTolerance.DOWN_1).setMoisture(EnumMoisture.NORMAL, EnumTolerance.UP_1) .setPH(EnumAcidity.NEUTRAL, EnumTolerance.DOWN_1)
.setMoisture(EnumMoisture.NORMAL, EnumTolerance.UP_1)
.setStemColor(EnumFlowerColor.DARK_GREEN); .setStemColor(EnumFlowerColor.DARK_GREEN);
FlowerSpecies.DAHLIA FlowerSpecies.DAHLIA
.setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.NORMAL, EnumAllele.Sappiness.AVERAGE) .setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.NORMAL, EnumAllele.Sappiness.AVERAGE)
.setMutation(FlowerSpecies.DAISY, FlowerSpecies.ALLIUM, 15) .setMutation(FlowerSpecies.DAISY, FlowerSpecies.ALLIUM, 15)
.setPH(EnumAcidity.NEUTRAL, EnumTolerance.DOWN_1).setMoisture(EnumMoisture.NORMAL, EnumTolerance.UP_1) .setPH(EnumAcidity.NEUTRAL, EnumTolerance.DOWN_1)
.setTemperature(EnumTemperature.NORMAL, EnumTolerance.BOTH_2).setStemColor(EnumFlowerColor.OLIVE_DRAB); .setMoisture(EnumMoisture.NORMAL, EnumTolerance.UP_1)
.setTemperature(EnumTemperature.NORMAL, EnumTolerance.BOTH_2)
.setStemColor(EnumFlowerColor.OLIVE_DRAB);
FlowerSpecies.CHRYSANTHEMUM FlowerSpecies.CHRYSANTHEMUM
.setTraits(EnumAllele.Fertility.HIGH, EnumAllele.Lifespan.LONG, EnumAllele.Sappiness.HIGH) .setTraits(EnumAllele.Fertility.HIGH, EnumAllele.Lifespan.LONG, EnumAllele.Sappiness.HIGH)
.setMutation(FlowerSpecies.GERANIUM, FlowerSpecies.ROSE, 10) .setMutation(FlowerSpecies.GERANIUM, FlowerSpecies.ROSE, 10)
.setPH(EnumAcidity.NEUTRAL, EnumTolerance.DOWN_1).setMoisture(EnumMoisture.NORMAL, EnumTolerance.DOWN_1) .setPH(EnumAcidity.NEUTRAL, EnumTolerance.DOWN_1)
.setMoisture(EnumMoisture.NORMAL, EnumTolerance.DOWN_1)
.setStemColor(EnumFlowerColor.MEDIUM_SEA_GREEN); .setStemColor(EnumFlowerColor.MEDIUM_SEA_GREEN);
FlowerSpecies.CARNATION FlowerSpecies.CARNATION
.setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.NORMAL, EnumAllele.Sappiness.HIGH) .setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.NORMAL, EnumAllele.Sappiness.HIGH)
.setMutation(FlowerSpecies.DIANTHUS, FlowerSpecies.ROSE, 5) .setMutation(FlowerSpecies.DIANTHUS, FlowerSpecies.ROSE, 5)
.setPH(EnumAcidity.ALKALINE, EnumTolerance.DOWN_1).setStemColor(EnumFlowerColor.SEA_GREEN); .setPH(EnumAcidity.ALKALINE, EnumTolerance.DOWN_1)
.setStemColor(EnumFlowerColor.SEA_GREEN);
FlowerSpecies.ZINNIA FlowerSpecies.ZINNIA
.setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.SHORTER, EnumAllele.Sappiness.AVERAGE) .setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.SHORTER, EnumAllele.Sappiness.AVERAGE)
.setMutation(FlowerSpecies.DAHLIA, FlowerSpecies.MARIGOLD, 5) .setMutation(FlowerSpecies.DAHLIA, FlowerSpecies.MARIGOLD, 5)
.setPH(EnumAcidity.NEUTRAL, EnumTolerance.BOTH_1).setMoisture(EnumMoisture.NORMAL, EnumTolerance.DOWN_1) .setPH(EnumAcidity.NEUTRAL, EnumTolerance.BOTH_1)
.setMoisture(EnumMoisture.NORMAL, EnumTolerance.DOWN_1)
.setTemperature(EnumTemperature.NORMAL, EnumTolerance.BOTH_2) .setTemperature(EnumTemperature.NORMAL, EnumTolerance.BOTH_2)
.setStemColor(EnumFlowerColor.MEDIUM_SEA_GREEN); .setStemColor(EnumFlowerColor.MEDIUM_SEA_GREEN);
FlowerSpecies.PRIMROSE FlowerSpecies.PRIMROSE
.setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.LONG, EnumAllele.Sappiness.AVERAGE) .setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.LONG, EnumAllele.Sappiness.AVERAGE)
.setMutation(FlowerSpecies.CHRYSANTHEMUM, FlowerSpecies.AURICULA, 5) .setMutation(FlowerSpecies.CHRYSANTHEMUM, FlowerSpecies.AURICULA, 5)
.setPH(EnumAcidity.ACID, EnumTolerance.UP_1).setMoisture(EnumMoisture.NORMAL, EnumTolerance.UP_1) .setPH(EnumAcidity.ACID, EnumTolerance.UP_1)
.setMoisture(EnumMoisture.NORMAL, EnumTolerance.UP_1)
.setStemColor(EnumFlowerColor.GREEN); .setStemColor(EnumFlowerColor.GREEN);
FlowerSpecies.AZALEA FlowerSpecies.AZALEA
.setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.NORMAL, EnumAllele.Sappiness.AVERAGE) .setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.NORMAL, EnumAllele.Sappiness.AVERAGE)
.setMutation(FlowerSpecies.ORCHID, FlowerSpecies.GERANIUM, 5) .setMutation(FlowerSpecies.ORCHID, FlowerSpecies.GERANIUM, 5)
.setPH(EnumAcidity.ACID, EnumTolerance.NONE).setStemColor(EnumFlowerColor.GREEN); .setPH(EnumAcidity.ACID, EnumTolerance.NONE)
.setStemColor(EnumFlowerColor.GREEN);
FlowerSpecies.GERANIUM.setTraits(EnumAllele.Fertility.LOW, EnumAllele.Lifespan.LONG, EnumAllele.Sappiness.LOW) FlowerSpecies.GERANIUM
.setTraits(EnumAllele.Fertility.LOW, EnumAllele.Lifespan.LONG, EnumAllele.Sappiness.LOW)
.setMutation(FlowerSpecies.TULIP, FlowerSpecies.ORCHID, 15) .setMutation(FlowerSpecies.TULIP, FlowerSpecies.ORCHID, 15)
.setPH(EnumAcidity.NEUTRAL, EnumTolerance.BOTH_1) .setPH(EnumAcidity.NEUTRAL, EnumTolerance.BOTH_1)
.setTemperature(EnumTemperature.WARM, EnumTolerance.BOTH_1) .setTemperature(EnumTemperature.WARM, EnumTolerance.BOTH_1)
.setStemColor(EnumFlowerColor.MEDIUM_SEA_GREEN); .setStemColor(EnumFlowerColor.MEDIUM_SEA_GREEN);
FlowerSpecies.LILY.setTraits(EnumAllele.Fertility.LOW, EnumAllele.Lifespan.LONG, EnumAllele.Sappiness.LOW) FlowerSpecies.LILY
.setTraits(EnumAllele.Fertility.LOW, EnumAllele.Lifespan.LONG, EnumAllele.Sappiness.LOW)
.setMutation(FlowerSpecies.TULIP, FlowerSpecies.CHRYSANTHEMUM, 5) .setMutation(FlowerSpecies.TULIP, FlowerSpecies.CHRYSANTHEMUM, 5)
.setPH(EnumAcidity.NEUTRAL, EnumTolerance.DOWN_1) .setPH(EnumAcidity.NEUTRAL, EnumTolerance.DOWN_1)
.setTemperature(EnumTemperature.WARM, EnumTolerance.BOTH_1).setStemColor(EnumFlowerColor.GREEN); .setTemperature(EnumTemperature.WARM, EnumTolerance.BOTH_1)
.setStemColor(EnumFlowerColor.GREEN);
FlowerSpecies.YARROW.setTraits(EnumAllele.Fertility.HIGH, EnumAllele.Lifespan.NORMAL, EnumAllele.Sappiness.LOW) FlowerSpecies.YARROW
.setTraits(EnumAllele.Fertility.HIGH, EnumAllele.Lifespan.NORMAL, EnumAllele.Sappiness.LOW)
.setMutation(FlowerSpecies.DANDELION, FlowerSpecies.ORCHID, 10) .setMutation(FlowerSpecies.DANDELION, FlowerSpecies.ORCHID, 10)
.setPH(EnumAcidity.ACID, EnumTolerance.UP_1).setMoisture(EnumMoisture.NORMAL, EnumTolerance.DOWN_1) .setPH(EnumAcidity.ACID, EnumTolerance.UP_1)
.setMoisture(EnumMoisture.NORMAL, EnumTolerance.DOWN_1)
.setStemColor(EnumFlowerColor.DARK_OLIVE_GREEN); .setStemColor(EnumFlowerColor.DARK_OLIVE_GREEN);
FlowerSpecies.PETUNIA FlowerSpecies.PETUNIA
.setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.SHORTER, EnumAllele.Sappiness.AVERAGE) .setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.SHORTER, EnumAllele.Sappiness.AVERAGE)
.setMutation(FlowerSpecies.TULIP, FlowerSpecies.DAHLIA, 5) .setMutation(FlowerSpecies.TULIP, FlowerSpecies.DAHLIA, 5)
.setPH(EnumAcidity.NEUTRAL, EnumTolerance.DOWN_1).setMoisture(EnumMoisture.NORMAL, EnumTolerance.UP_1) .setPH(EnumAcidity.NEUTRAL, EnumTolerance.DOWN_1)
.setTemperature(EnumTemperature.WARM, EnumTolerance.UP_1).setStemColor(EnumFlowerColor.GREEN); .setMoisture(EnumMoisture.NORMAL, EnumTolerance.UP_1)
.setTemperature(EnumTemperature.WARM, EnumTolerance.UP_1)
.setStemColor(EnumFlowerColor.GREEN);
FlowerSpecies.AGAPANTHUS FlowerSpecies.AGAPANTHUS
.setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.NORMAL, EnumAllele.Sappiness.LOW) .setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.NORMAL, EnumAllele.Sappiness.LOW)
.setMutation(FlowerSpecies.ALLIUM, FlowerSpecies.GERANIUM, 5) .setMutation(FlowerSpecies.ALLIUM, FlowerSpecies.GERANIUM, 5)
.setPH(EnumAcidity.NEUTRAL, EnumTolerance.BOTH_1).setMoisture(EnumMoisture.NORMAL, EnumTolerance.DOWN_1) .setPH(EnumAcidity.NEUTRAL, EnumTolerance.BOTH_1)
.setMoisture(EnumMoisture.NORMAL, EnumTolerance.DOWN_1)
.setTemperature(EnumTemperature.WARM, EnumTolerance.BOTH_1) .setTemperature(EnumTemperature.WARM, EnumTolerance.BOTH_1)
.setStemColor(EnumFlowerColor.DARK_OLIVE_GREEN); .setStemColor(EnumFlowerColor.DARK_OLIVE_GREEN);
FlowerSpecies.FUCHSIA FlowerSpecies.FUCHSIA
.setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.SHORTENED, EnumAllele.Sappiness.AVERAGE) .setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.SHORTENED, EnumAllele.Sappiness.AVERAGE)
.setMutation(FlowerSpecies.FOXGLOVE, FlowerSpecies.DAHLIA, 5) .setMutation(FlowerSpecies.FOXGLOVE, FlowerSpecies.DAHLIA, 5)
.setPH(EnumAcidity.NEUTRAL, EnumTolerance.BOTH_1).setMoisture(EnumMoisture.NORMAL, EnumTolerance.UP_1) .setPH(EnumAcidity.NEUTRAL, EnumTolerance.BOTH_1)
.setTemperature(EnumTemperature.WARM, EnumTolerance.BOTH_1).setStemColor(EnumFlowerColor.SEA_GREEN); .setMoisture(EnumMoisture.NORMAL, EnumTolerance.UP_1)
.setTemperature(EnumTemperature.WARM, EnumTolerance.BOTH_1)
.setStemColor(EnumFlowerColor.SEA_GREEN);
FlowerSpecies.DIANTHUS FlowerSpecies.DIANTHUS
.setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.SHORT, EnumAllele.Sappiness.HIGH) .setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.SHORT, EnumAllele.Sappiness.HIGH)
.setMutation(FlowerSpecies.TULIP, FlowerSpecies.POPPY, 15) .setMutation(FlowerSpecies.TULIP, FlowerSpecies.POPPY, 15)
.setPH(EnumAcidity.ALKALINE, EnumTolerance.DOWN_1) .setPH(EnumAcidity.ALKALINE, EnumTolerance.DOWN_1)
.setMoisture(EnumMoisture.NORMAL, EnumTolerance.DOWN_1) .setMoisture(EnumMoisture.NORMAL, EnumTolerance.DOWN_1)
.setTemperature(EnumTemperature.NORMAL, EnumTolerance.BOTH_2).setStemColor(EnumFlowerColor.OLIVE_DRAB); .setTemperature(EnumTemperature.NORMAL, EnumTolerance.BOTH_2)
.setStemColor(EnumFlowerColor.OLIVE_DRAB);
FlowerSpecies.FORGET FlowerSpecies.FORGET
.setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.SHORT, EnumAllele.Sappiness.LOWER) .setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.SHORT, EnumAllele.Sappiness.LOWER)
.setMutation(FlowerSpecies.ORCHID, FlowerSpecies.BLUET, 10).setPH(EnumAcidity.ACID, EnumTolerance.NONE) .setMutation(FlowerSpecies.ORCHID, FlowerSpecies.BLUET, 10)
.setPH(EnumAcidity.ACID, EnumTolerance.NONE)
.setMoisture(EnumMoisture.NORMAL, EnumTolerance.UP_1) .setMoisture(EnumMoisture.NORMAL, EnumTolerance.UP_1)
.setTemperature(EnumTemperature.NORMAL, EnumTolerance.UP_1).setStemColor(EnumFlowerColor.GREEN); .setTemperature(EnumTemperature.NORMAL, EnumTolerance.UP_1)
.setStemColor(EnumFlowerColor.GREEN);
FlowerSpecies.ANEMONE.setTraits(EnumAllele.Fertility.HIGH, EnumAllele.Lifespan.NORMAL, EnumAllele.Sappiness.LOW) FlowerSpecies.ANEMONE
.setTraits(EnumAllele.Fertility.HIGH, EnumAllele.Lifespan.NORMAL, EnumAllele.Sappiness.LOW)
.setMutation(FlowerSpecies.AQUILEGIA, FlowerSpecies.ROSE, 5) .setMutation(FlowerSpecies.AQUILEGIA, FlowerSpecies.ROSE, 5)
.setPH(EnumAcidity.NEUTRAL, EnumTolerance.BOTH_1).setMoisture(EnumMoisture.NORMAL, EnumTolerance.UP_1) .setPH(EnumAcidity.NEUTRAL, EnumTolerance.BOTH_1)
.setMoisture(EnumMoisture.NORMAL, EnumTolerance.UP_1)
.setStemColor(EnumFlowerColor.DARK_OLIVE_GREEN); .setStemColor(EnumFlowerColor.DARK_OLIVE_GREEN);
FlowerSpecies.AQUILEGIA FlowerSpecies.AQUILEGIA
.setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.NORMAL, EnumAllele.Sappiness.AVERAGE) .setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.NORMAL, EnumAllele.Sappiness.AVERAGE)
.setMutation(FlowerSpecies.IRIS, FlowerSpecies.POPPY, 5) .setMutation(FlowerSpecies.IRIS, FlowerSpecies.POPPY, 5)
.setMoisture(EnumMoisture.NORMAL, EnumTolerance.UP_1).setStemColor(EnumFlowerColor.MEDIUM_SEA_GREEN); .setMoisture(EnumMoisture.NORMAL, EnumTolerance.UP_1)
.setStemColor(EnumFlowerColor.MEDIUM_SEA_GREEN);
FlowerSpecies.EDELWEISS FlowerSpecies.EDELWEISS
.setTraits(EnumAllele.Fertility.LOW, EnumAllele.Lifespan.NORMAL, EnumAllele.Sappiness.LOWEST) .setTraits(EnumAllele.Fertility.LOW, EnumAllele.Lifespan.NORMAL, EnumAllele.Sappiness.LOWEST)
@@ -338,28 +464,34 @@ public enum FlowerSpecies implements IAlleleFlowerSpecies {
.setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.SHORTENED, EnumAllele.Sappiness.LOW) .setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.SHORTENED, EnumAllele.Sappiness.LOW)
.setMutation(FlowerSpecies.ALLIUM, FlowerSpecies.CORNFLOWER, 5) .setMutation(FlowerSpecies.ALLIUM, FlowerSpecies.CORNFLOWER, 5)
.setPH(EnumAcidity.NEUTRAL, EnumTolerance.UP_1) .setPH(EnumAcidity.NEUTRAL, EnumTolerance.UP_1)
.setTemperature(EnumTemperature.NORMAL, EnumTolerance.DOWN_1).setStemColor(EnumFlowerColor.OLIVE_DRAB); .setTemperature(EnumTemperature.NORMAL, EnumTolerance.DOWN_1)
.setStemColor(EnumFlowerColor.OLIVE_DRAB);
FlowerSpecies.CONEFLOWER FlowerSpecies.CONEFLOWER
.setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.NORMAL, EnumAllele.Sappiness.HIGHER) .setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.NORMAL, EnumAllele.Sappiness.HIGHER)
.setMutation(FlowerSpecies.TULIP, FlowerSpecies.CORNFLOWER, 5) .setMutation(FlowerSpecies.TULIP, FlowerSpecies.CORNFLOWER, 5)
.setPH(EnumAcidity.NEUTRAL, EnumTolerance.BOTH_1).setStemColor(EnumFlowerColor.DARK_OLIVE_GREEN); .setPH(EnumAcidity.NEUTRAL, EnumTolerance.BOTH_1)
.setStemColor(EnumFlowerColor.DARK_OLIVE_GREEN);
FlowerSpecies.GAILLARDIA FlowerSpecies.GAILLARDIA
.setTraits(EnumAllele.Fertility.HIGH, EnumAllele.Lifespan.LONG, EnumAllele.Sappiness.HIGHER) .setTraits(EnumAllele.Fertility.HIGH, EnumAllele.Lifespan.LONG, EnumAllele.Sappiness.HIGHER)
.setMutation(FlowerSpecies.DANDELION, FlowerSpecies.MARIGOLD, 5) .setMutation(FlowerSpecies.DANDELION, FlowerSpecies.MARIGOLD, 5)
.setPH(EnumAcidity.NEUTRAL, EnumTolerance.BOTH_1).setMoisture(EnumMoisture.DAMP, EnumTolerance.DOWN_1) .setPH(EnumAcidity.NEUTRAL, EnumTolerance.BOTH_1)
.setTemperature(EnumTemperature.NORMAL, EnumTolerance.BOTH_2).setStemColor(EnumFlowerColor.OLIVE_DRAB); .setMoisture(EnumMoisture.DAMP, EnumTolerance.DOWN_1)
.setTemperature(EnumTemperature.NORMAL, EnumTolerance.BOTH_2)
.setStemColor(EnumFlowerColor.OLIVE_DRAB);
FlowerSpecies.AURICULA FlowerSpecies.AURICULA
.setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.ELONGATED, EnumAllele.Sappiness.HIGH) .setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.ELONGATED, EnumAllele.Sappiness.HIGH)
.setMutation(FlowerSpecies.POPPY, FlowerSpecies.GERANIUM, 10) .setMutation(FlowerSpecies.POPPY, FlowerSpecies.GERANIUM, 10)
.setPH(EnumAcidity.ACID, EnumTolerance.UP_1).setMoisture(EnumMoisture.NORMAL, EnumTolerance.UP_1) .setPH(EnumAcidity.ACID, EnumTolerance.UP_1)
.setMoisture(EnumMoisture.NORMAL, EnumTolerance.UP_1)
.setStemColor(EnumFlowerColor.DARK_OLIVE_GREEN); .setStemColor(EnumFlowerColor.DARK_OLIVE_GREEN);
FlowerSpecies.CAMELLIA FlowerSpecies.CAMELLIA
.setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.NORMAL, EnumAllele.Sappiness.HIGH) .setTraits(EnumAllele.Fertility.NORMAL, EnumAllele.Lifespan.NORMAL, EnumAllele.Sappiness.HIGH)
.setMutation(FlowerSpecies.HYDRANGEA, FlowerSpecies.ROSE, 5).setPH(EnumAcidity.ACID, EnumTolerance.NONE) .setMutation(FlowerSpecies.HYDRANGEA, FlowerSpecies.ROSE, 5)
.setPH(EnumAcidity.ACID, EnumTolerance.NONE)
.setMoisture(EnumMoisture.DAMP, EnumTolerance.NONE) .setMoisture(EnumMoisture.DAMP, EnumTolerance.NONE)
.setTemperature(EnumTemperature.WARM, EnumTolerance.UP_1) .setTemperature(EnumTemperature.WARM, EnumTolerance.UP_1)
.setStemColor(EnumFlowerColor.DARK_OLIVE_GREEN); .setStemColor(EnumFlowerColor.DARK_OLIVE_GREEN);
@@ -367,18 +499,22 @@ public enum FlowerSpecies implements IAlleleFlowerSpecies {
FlowerSpecies.GOLDENROD FlowerSpecies.GOLDENROD
.setTraits(EnumAllele.Fertility.HIGH, EnumAllele.Lifespan.NORMAL, EnumAllele.Sappiness.HIGHER) .setTraits(EnumAllele.Fertility.HIGH, EnumAllele.Lifespan.NORMAL, EnumAllele.Sappiness.HIGHER)
.setMutation(FlowerSpecies.LILAC, FlowerSpecies.MARIGOLD, 10) .setMutation(FlowerSpecies.LILAC, FlowerSpecies.MARIGOLD, 10)
.setPH(EnumAcidity.NEUTRAL, EnumTolerance.BOTH_1).setStemColor(EnumFlowerColor.MEDIUM_SEA_GREEN); .setPH(EnumAcidity.NEUTRAL, EnumTolerance.BOTH_1)
.setStemColor(EnumFlowerColor.MEDIUM_SEA_GREEN);
FlowerSpecies.ALTHEA FlowerSpecies.ALTHEA
.setTraits(EnumAllele.Fertility.LOW, EnumAllele.Lifespan.ELONGATED, EnumAllele.Sappiness.HIGH) .setTraits(EnumAllele.Fertility.LOW, EnumAllele.Lifespan.ELONGATED, EnumAllele.Sappiness.HIGH)
.setMutation(FlowerSpecies.HYDRANGEA, FlowerSpecies.IRIS, 5) .setMutation(FlowerSpecies.HYDRANGEA, FlowerSpecies.IRIS, 5)
.setPH(EnumAcidity.NEUTRAL, EnumTolerance.DOWN_1) .setPH(EnumAcidity.NEUTRAL, EnumTolerance.DOWN_1)
.setTemperature(EnumTemperature.WARM, EnumTolerance.BOTH_1).setStemColor(EnumFlowerColor.DARK_GREEN); .setTemperature(EnumTemperature.WARM, EnumTolerance.BOTH_1)
.setStemColor(EnumFlowerColor.DARK_GREEN);
FlowerSpecies.PENSTEMON.setTraits(EnumAllele.Fertility.LOW, EnumAllele.Lifespan.LONG, EnumAllele.Sappiness.LOW) FlowerSpecies.PENSTEMON
.setTraits(EnumAllele.Fertility.LOW, EnumAllele.Lifespan.LONG, EnumAllele.Sappiness.LOW)
.setMutation(FlowerSpecies.PEONY, FlowerSpecies.LILAC, 5) .setMutation(FlowerSpecies.PEONY, FlowerSpecies.LILAC, 5)
.setMoisture(EnumMoisture.DRY, EnumTolerance.UP_1) .setMoisture(EnumMoisture.DRY, EnumTolerance.UP_1)
.setTemperature(EnumTemperature.WARM, EnumTolerance.UP_1).setStemColor(EnumFlowerColor.OLIVE_DRAB); .setTemperature(EnumTemperature.WARM, EnumTolerance.UP_1)
.setStemColor(EnumFlowerColor.OLIVE_DRAB);
FlowerSpecies.DELPHINIUM FlowerSpecies.DELPHINIUM
.setTraits(EnumAllele.Fertility.LOW, EnumAllele.Lifespan.LONGER, EnumAllele.Sappiness.LOW) .setTraits(EnumAllele.Fertility.LOW, EnumAllele.Lifespan.LONGER, EnumAllele.Sappiness.LOW)
@@ -387,9 +523,11 @@ public enum FlowerSpecies implements IAlleleFlowerSpecies {
.setTemperature(EnumTemperature.NORMAL, EnumTolerance.DOWN_1) .setTemperature(EnumTemperature.NORMAL, EnumTolerance.DOWN_1)
.setStemColor(EnumFlowerColor.DARK_SEA_GREEN); .setStemColor(EnumFlowerColor.DARK_SEA_GREEN);
FlowerSpecies.HOLLYHOCK.setTraits(EnumAllele.Fertility.LOW, EnumAllele.Lifespan.LONG, EnumAllele.Sappiness.HIGH) FlowerSpecies.HOLLYHOCK
.setTraits(EnumAllele.Fertility.LOW, EnumAllele.Lifespan.LONG, EnumAllele.Sappiness.HIGH)
.setMutation(FlowerSpecies.DELPHINIUM, FlowerSpecies.LAVENDER, 5) .setMutation(FlowerSpecies.DELPHINIUM, FlowerSpecies.LAVENDER, 5)
.setPH(EnumAcidity.NEUTRAL, EnumTolerance.UP_1).setStemColor(EnumFlowerColor.GREEN); .setPH(EnumAcidity.NEUTRAL, EnumTolerance.UP_1)
.setStemColor(EnumFlowerColor.GREEN);
IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot(); IFlowerRoot flowerRoot = BotanyCore.getFlowerRoot();
flowerRoot.addConversion(new ItemStack(Blocks.yellow_flower, 1, 0), FlowerSpecies.DANDELION.getTemplate()); flowerRoot.addConversion(new ItemStack(Blocks.yellow_flower, 1, 0), FlowerSpecies.DANDELION.getTemplate());
@@ -403,14 +541,11 @@ public enum FlowerSpecies implements IAlleleFlowerSpecies {
flowerRoot.addConversion(new ItemStack(Blocks.double_plant, 1, 4), FlowerSpecies.ROSE.getTemplate()); flowerRoot.addConversion(new ItemStack(Blocks.double_plant, 1, 4), FlowerSpecies.ROSE.getTemplate());
flowerRoot.addConversion(new ItemStack(Blocks.double_plant, 1, 5), FlowerSpecies.PEONY.getTemplate()); flowerRoot.addConversion(new ItemStack(Blocks.double_plant, 1, 5), FlowerSpecies.PEONY.getTemplate());
flowerRoot.addConversion( flowerRoot.addConversion(
new ItemStack(Blocks.red_flower, 1, 6), new ItemStack(Blocks.red_flower, 1, 6), FlowerSpecies.TULIP.addVariant(EnumFlowerColor.WHITE));
FlowerSpecies.TULIP.addVariant(EnumFlowerColor.WHITE));
flowerRoot.addConversion( flowerRoot.addConversion(
new ItemStack(Blocks.red_flower, 1, 4), new ItemStack(Blocks.red_flower, 1, 4), FlowerSpecies.TULIP.addVariant(EnumFlowerColor.CRIMSON));
FlowerSpecies.TULIP.addVariant(EnumFlowerColor.CRIMSON));
flowerRoot.addConversion( flowerRoot.addConversion(
new ItemStack(Blocks.red_flower, 1, 5), new ItemStack(Blocks.red_flower, 1, 5), FlowerSpecies.TULIP.addVariant(EnumFlowerColor.DARK_ORANGE));
FlowerSpecies.TULIP.addVariant(EnumFlowerColor.DARK_ORANGE));
for (FlowerSpecies species : values()) { for (FlowerSpecies species : values()) {
String scientific = species.branchName.substring(0, 1).toUpperCase() String scientific = species.branchName.substring(0, 1).toUpperCase()
@@ -418,8 +553,8 @@ public enum FlowerSpecies implements IAlleleFlowerSpecies {
String uid = "flowers." + species.branchName.toLowerCase(); String uid = "flowers." + species.branchName.toLowerCase();
IClassification branch = AlleleManager.alleleRegistry.getClassification("genus." + uid); IClassification branch = AlleleManager.alleleRegistry.getClassification("genus." + uid);
if (branch == null) { if (branch == null) {
branch = AlleleManager.alleleRegistry branch = AlleleManager.alleleRegistry.createAndRegisterClassification(
.createAndRegisterClassification(IClassification.EnumClassLevel.GENUS, uid, scientific); IClassification.EnumClassLevel.GENUS, uid, scientific);
} }
species.branch = branch; species.branch = branch;
@@ -432,8 +567,8 @@ public enum FlowerSpecies implements IAlleleFlowerSpecies {
return this; return this;
} }
private FlowerSpecies setTraits(EnumAllele.Fertility fertility, EnumAllele.Lifespan shortened, private FlowerSpecies setTraits(
EnumAllele.Sappiness lower) { EnumAllele.Fertility fertility, EnumAllele.Lifespan shortened, EnumAllele.Sappiness lower) {
fert = fertility; fert = fertility;
life = shortened; life = shortened;
sap = lower; sap = lower;
@@ -496,7 +631,7 @@ public enum FlowerSpecies implements IAlleleFlowerSpecies {
@Override @Override
public EnumHumidity getHumidity() { public EnumHumidity getHumidity() {
return EnumHumidity.VALUES[getMoisture().ordinal()]; return EnumHumidity.values()[getMoisture().ordinal()];
} }
@Override @Override
@@ -7,15 +7,8 @@ import forestry.api.genetics.IAllele;
import forestry.core.genetics.alleles.EnumAllele; import forestry.core.genetics.alleles.EnumAllele;
public class FlowerTemplates { public class FlowerTemplates {
private static IAllele[] defaultTemplate;
public static IAllele[] getDefaultTemplate() { public static IAllele[] getDefaultTemplate() {
if (defaultTemplate != null) { IAllele[] alleles = new IAllele[EnumFlowerChromosome.values().length];
return defaultTemplate.clone();
}
IAllele[] alleles = new IAllele[EnumFlowerChromosome.VALUES.length];
alleles[EnumFlowerChromosome.SPECIES.ordinal()] = FlowerSpecies.POPPY; alleles[EnumFlowerChromosome.SPECIES.ordinal()] = FlowerSpecies.POPPY;
alleles[EnumFlowerChromosome.PRIMARY.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.RED); alleles[EnumFlowerChromosome.PRIMARY.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.RED);
alleles[EnumFlowerChromosome.SECONDARY.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.RED); alleles[EnumFlowerChromosome.SECONDARY.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.RED);
@@ -28,13 +21,6 @@ public class FlowerTemplates {
alleles[EnumFlowerChromosome.PH_TOLERANCE.ordinal()] = AlleleHelper.getAllele(EnumTolerance.NONE); alleles[EnumFlowerChromosome.PH_TOLERANCE.ordinal()] = AlleleHelper.getAllele(EnumTolerance.NONE);
alleles[EnumFlowerChromosome.SAPPINESS.ordinal()] = AlleleHelper.getAllele(EnumAllele.Sappiness.AVERAGE); alleles[EnumFlowerChromosome.SAPPINESS.ordinal()] = AlleleHelper.getAllele(EnumAllele.Sappiness.AVERAGE);
alleles[EnumFlowerChromosome.STEM.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.GREEN); alleles[EnumFlowerChromosome.STEM.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.GREEN);
return alleles;
for (IAllele allele : alleles) {
// Do not cache a partial template during registry initialization.
if (allele == null) return alleles;
}
defaultTemplate = alleles;
return defaultTemplate.clone();
} }
} }
@@ -1,9 +1,12 @@
package binnie.botany.genetics; package binnie.botany.genetics;
import static cpw.mods.fml.common.registry.GameRegistry.registerItem; import binnie.botany.Botany;
import binnie.botany.CreativeTabBotany;
import binnie.botany.core.BotanyGUI;
import binnie.core.util.I18N;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List; import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@@ -12,23 +15,13 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.world.World; import net.minecraft.world.World;
import binnie.botany.Botany;
import binnie.botany.CreativeTabBotany;
import binnie.botany.core.BotanyGUI;
import binnie.core.util.I18N;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemDictionary extends Item { public class ItemDictionary extends Item {
protected IIcon iconMaster; protected IIcon iconMaster;
public ItemDictionary() { public ItemDictionary() {
setCreativeTab(CreativeTabBotany.instance); setCreativeTab(CreativeTabBotany.instance);
setUnlocalizedName("database"); setUnlocalizedName("database");
setMaxStackSize(1); setMaxStackSize(1);
registerItem(this, getUnlocalizedName().substring(5));
} }
@Override @Override
@@ -46,13 +39,13 @@ public class ItemDictionary extends Item {
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced) { public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
super.addInformation(stack, player, tooltip, advanced); super.addInformation(stack, player, tooltip, advanced);
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) { public void getSubItems(Item item, CreativeTabs tab, List list) {
super.getSubItems(item, tab, list); super.getSubItems(item, tab, list);
list.add(new ItemStack(item, 1, 1)); list.add(new ItemStack(item, 1, 1));
} }
@@ -66,7 +59,8 @@ public class ItemDictionary extends Item {
@Override @Override
public String getItemStackDisplayName(ItemStack stack) { public String getItemStackDisplayName(ItemStack stack) {
return (stack.getItemDamage() == 0) ? I18N.localise("botany.item.database.0.name") return (stack.getItemDamage() == 0)
? I18N.localise("botany.item.database.0.name")
: I18N.localise("botany.item.database.1.name"); : I18N.localise("botany.item.database.1.name");
} }
} }
@@ -1,9 +1,5 @@
package binnie.botany.genetics; package binnie.botany.genetics;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import binnie.Binnie; import binnie.Binnie;
import binnie.botany.Botany; import binnie.botany.Botany;
import binnie.botany.core.BotanyCore; import binnie.botany.core.BotanyCore;
@@ -21,9 +17,11 @@ import forestry.api.apiculture.FlowerManager;
import forestry.api.genetics.AlleleManager; import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele; import forestry.api.genetics.IAllele;
import forestry.api.recipes.RecipeManagers; 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 = new AlleleEffectNone();
@Override @Override
@@ -42,7 +40,7 @@ public class ModuleGenetics implements IInitializable {
@Override @Override
public void init() { public void init() {
for (EnumFlowerColor color : EnumFlowerColor.VALUES) { for (EnumFlowerColor color : EnumFlowerColor.values()) {
AlleleManager.alleleRegistry.registerAllele(color.getAllele()); AlleleManager.alleleRegistry.registerAllele(color.getAllele());
} }
@@ -1,17 +1,14 @@
package binnie.botany.items; package binnie.botany.items;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import binnie.botany.Botany; import binnie.botany.Botany;
import binnie.core.item.IItemMisc; import binnie.core.item.IItemMisc;
import binnie.core.util.I18N; import binnie.core.util.I18N;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
public enum BotanyItems implements IItemMisc { public enum BotanyItems implements IItemMisc {
AshPowder("powderAsh"), AshPowder("powderAsh"),
PulpPowder("powderPulp"), PulpPowder("powderPulp"),
MulchPowder("powderMulch"), MulchPowder("powderMulch"),
@@ -21,9 +18,9 @@ public enum BotanyItems implements IItemMisc {
Mortar("mortar"), Mortar("mortar"),
Weedkiller("weedkiller"); Weedkiller("weedkiller");
private IIcon icon; protected IIcon icon;
private final String name; protected String name;
private final String iconPath; protected String iconPath;
BotanyItems(String name) { BotanyItems(String name) {
this.name = name; this.name = name;
@@ -41,7 +38,7 @@ public enum BotanyItems implements IItemMisc {
} }
@Override @Override
public void addInformation(List<String> data) { public void addInformation(List data) {
// ignored // ignored
} }
+12 -18
View File
@@ -1,37 +1,31 @@
package binnie.botany.items; package binnie.botany.items;
import static cpw.mods.fml.common.registry.GameRegistry.registerItem;
import java.util.List;
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.util.EnumChatFormatting;
import binnie.botany.Botany; import binnie.botany.Botany;
import binnie.botany.CreativeTabBotany; import binnie.botany.CreativeTabBotany;
import binnie.botany.genetics.EnumFlowerColor; import binnie.botany.genetics.EnumFlowerColor;
import binnie.core.util.I18N; 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 java.util.List;
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.util.EnumChatFormatting;
public class ItemClay extends Item { public class ItemClay extends Item {
public ItemClay() { public ItemClay() {
setUnlocalizedName("clay"); setUnlocalizedName("clay");
setHasSubtypes(true); setHasSubtypes(true);
setCreativeTab(CreativeTabBotany.instance); setCreativeTab(CreativeTabBotany.instance);
registerItem(this, getUnlocalizedName().substring(5));
} }
@Override @Override
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced) { public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
super.addInformation(stack, player, tooltip, advanced); super.addInformation(stack, player, tooltip, advanced);
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(stack.getItemDamage()).getName()); tooltip.add(EnumChatFormatting.GRAY
+ EnumFlowerColor.get(stack.getItemDamage()).getName());
} }
@Override @Override
@@ -48,8 +42,8 @@ public class ItemClay extends Item {
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) { public void getSubItems(Item item, CreativeTabs tab, List list) {
for (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()));
} }
} }
@@ -1,37 +1,31 @@
package binnie.botany.items; package binnie.botany.items;
import static cpw.mods.fml.common.registry.GameRegistry.registerItem;
import java.util.List;
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.util.EnumChatFormatting;
import binnie.botany.Botany; import binnie.botany.Botany;
import binnie.botany.CreativeTabBotany; import binnie.botany.CreativeTabBotany;
import binnie.botany.genetics.EnumFlowerColor; import binnie.botany.genetics.EnumFlowerColor;
import binnie.core.util.I18N; 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 java.util.List;
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.util.EnumChatFormatting;
public class ItemPigment extends Item { public class ItemPigment extends Item {
public ItemPigment() { public ItemPigment() {
setUnlocalizedName("pigment"); setUnlocalizedName("pigment");
setHasSubtypes(true); setHasSubtypes(true);
setCreativeTab(CreativeTabBotany.instance); setCreativeTab(CreativeTabBotany.instance);
registerItem(this, getUnlocalizedName().substring(5));
} }
@Override @Override
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced) { public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
super.addInformation(stack, player, tooltip, advanced); super.addInformation(stack, player, tooltip, advanced);
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(stack.getItemDamage()).getName()); tooltip.add(EnumChatFormatting.GRAY
+ EnumFlowerColor.get(stack.getItemDamage()).getName());
} }
@Override @Override
@@ -48,8 +42,8 @@ public class ItemPigment extends Item {
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) { public void getSubItems(Item item, CreativeTabs tab, List list) {
for (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()));
} }
} }
Loaded 100 of 2800 files, more files were not shown because too many files have changed in this diff. Show more