mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-20 12:19:47 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ffcc5f7102 | ||
|
|
4c619fd3b2 | ||
|
|
341fea50ba | ||
|
|
e6c67df077 | ||
|
|
d24088ea4b | ||
|
|
a2a57d1656 | ||
|
|
2e36fbcfcc | ||
|
|
bd5bd5c153 | ||
|
|
f324cb53db | ||
|
|
c6815bebdf | ||
|
|
7ffa516892 | ||
|
|
311d618d53 | ||
|
|
9795aad66f | ||
|
|
ea7e2d7de4 | ||
|
|
39f86c8b0c | ||
|
|
5b551eb8ec | ||
|
|
f497114579 | ||
|
|
ea547df4d0 | ||
|
|
39c9f1f6c6 | ||
|
|
4000763323 | ||
|
|
59e98dd290 | ||
|
|
c1ec3e5c8e | ||
|
|
ac4b21b05e | ||
|
|
0e0ded5cc0 | ||
|
|
a1f54e7500 | ||
|
|
5f1b5daa24 | ||
|
|
8d0fa2ebb5 | ||
|
|
0db05cb60c | ||
|
|
0265d70a53 | ||
|
|
32b7efcd15 | ||
|
|
7059206cb0 | ||
|
|
54c702e935 | ||
|
|
a3aa358627 | ||
|
|
f0f14bb278 | ||
|
|
6b4f3eb1c7 | ||
|
|
f74f9e4967 | ||
|
|
12643d1b98 | ||
|
|
5bf4224f03 | ||
|
|
5a1030bde4 | ||
|
|
948876ffcd | ||
|
|
83142abde9 | ||
|
|
79cda2e4fd | ||
|
|
5409309b36 | ||
|
|
1a6e6b3c2c | ||
|
|
e5dfcc7942 | ||
|
|
ea78ca8069 | ||
|
|
29814550bb | ||
|
|
15769b9ee9 | ||
|
|
1253271111 | ||
|
|
d18be7848d | ||
|
|
ef4dd3710a | ||
|
|
190693ad68 | ||
|
|
3dc2806b36 | ||
|
|
a609f5dce5 |
No files matched your search
+2
-1621
File diff suppressed because it is too large.
Load diff
+6
-6
@@ -1,12 +1,12 @@
|
|||||||
// Add your dependencies here
|
// Add your dependencies here
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api('com.github.GTNewHorizons:ForestryMC:4.6.14:dev')
|
api('com.github.GTNewHorizons:ForestryMC:4.10.17:dev')
|
||||||
implementation('com.github.GTNewHorizons:GTNHLib:0.0.13:dev')
|
implementation('com.github.GTNewHorizons:GTNHLib:0.7.0:dev')
|
||||||
|
|
||||||
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.4.5-GTNH:dev')
|
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.8.0-GTNH:dev')
|
||||||
|
|
||||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.36:api')
|
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.44: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:extrabiomesxl-60041:2273301")
|
compileOnly("curse.maven:extrabiomesxl-60041:2273301")
|
||||||
}
|
}
|
||||||
+125
-38
@@ -1,65 +1,109 @@
|
|||||||
|
# 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
|
||||||
|
|
||||||
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
|
# Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation.
|
||||||
|
# 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
|
||||||
|
|
||||||
# WHY is there no version field?
|
# Whether to use modGroup as the maven publishing group.
|
||||||
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
|
# When false, com.github.GTNewHorizons is used.
|
||||||
# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
|
useModGroupForPublishing = false
|
||||||
|
|
||||||
# Will update your build.gradle automatically whenever an update is available
|
# Updates your build.gradle and settings.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 a MCP channel and mappings version for dependency deobfuscation and the deobfParams task.
|
# Specify an MCP channel 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
|
||||||
|
|
||||||
# Define other MCP mappings for dependency deobfuscation
|
# Defines 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 username for testing your mod with breakpoints. You may leave this empty for a random username each time you
|
# Select a default username for testing your mod. You can always override this per-run by running
|
||||||
# restart Minecraft in development. Choose this dependent on your mod:
|
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
||||||
# 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
|
||||||
|
|
||||||
# Define a source file of your project with:
|
# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
|
||||||
|
# See https://github.com/bsideup/jabel for details on how this works.
|
||||||
|
enableModernJavaSyntax = true
|
||||||
|
|
||||||
|
# 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 = BinnieCore.java
|
replaceGradleTokenInFile =
|
||||||
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/
|
||||||
# Example value: mymodid_at.cfg
|
# There can be multiple files in a space-separated list.
|
||||||
|
# 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. You may only place Mixins in this package 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
|
||||||
@@ -67,15 +111,38 @@ 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 in your jar. It is your
|
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated into your jar. It is your
|
||||||
# responsibility check the licence and request permission for distribution, if required.
|
# responsibility to check the license 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
|
||||||
|
|
||||||
# Publishing to modrinth requires you to set the MODRINTH_TOKEN environment variable to your current modrinth API token.
|
# If disabled, won't rename the shadowed classes.
|
||||||
|
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 on Modrinth.
|
# Leave this empty if you don't want to publish to 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.
|
||||||
@@ -84,12 +151,11 @@ 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: GTNH Mixins is automatically set as a required dependency if usesMixins = true
|
# Note: UniMixins 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 =
|
||||||
@@ -99,18 +165,39 @@ curseForgeProjectId =
|
|||||||
# 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: GTNH Mixins is automatically set as a required dependency if usesMixins = true
|
# Note: UniMixins 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 prevent the source code from being published
|
# Optional parameter to have the build automatically fail if an illegal version is used.
|
||||||
# noPublishedSources =
|
# 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 this to disable spotless checks
|
# 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
|
||||||
|
|
||||||
Vendored
BIN
Binary file not shown.
+2
-1
@@ -1,6 +1,7 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
@@ -15,6 +15,8 @@
|
|||||||
# 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
|
||||||
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
@@ -55,7 +57,7 @@
|
|||||||
# Darwin, MinGW, and NonStop.
|
# Darwin, MinGW, and NonStop.
|
||||||
#
|
#
|
||||||
# (3) This script is generated from the Groovy template
|
# (3) This script is generated from the Groovy template
|
||||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
# within the Gradle project.
|
# within the Gradle project.
|
||||||
#
|
#
|
||||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
@@ -83,7 +85,8 @@ done
|
|||||||
# This is normally unused
|
# This is normally unused
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
|
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||||
|
|
||||||
# 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
|
||||||
@@ -130,10 +133,13 @@ location of your Java installation."
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD=java
|
JAVACMD=java
|
||||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
if ! command -v java >/dev/null 2>&1
|
||||||
|
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.
|
||||||
@@ -141,7 +147,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
|||||||
case $MAX_FD in #(
|
case $MAX_FD in #(
|
||||||
max*)
|
max*)
|
||||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
# shellcheck disable=SC3045
|
# shellcheck disable=SC2039,SC3045
|
||||||
MAX_FD=$( ulimit -H -n ) ||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
warn "Could not query maximum file descriptor limit"
|
warn "Could not query maximum file descriptor limit"
|
||||||
esac
|
esac
|
||||||
@@ -149,7 +155,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
|||||||
'' | soft) :;; #(
|
'' | soft) :;; #(
|
||||||
*)
|
*)
|
||||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
# shellcheck disable=SC3045
|
# shellcheck disable=SC2039,SC3045
|
||||||
ulimit -n "$MAX_FD" ||
|
ulimit -n "$MAX_FD" ||
|
||||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
esac
|
esac
|
||||||
@@ -198,11 +204,11 @@ fi
|
|||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
# Collect all arguments for the java command;
|
# Collect all arguments for the java command:
|
||||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
# shell script including quotes and variable substitutions, so put them in
|
# and any embedded shellness will be escaped.
|
||||||
# double quotes to make sure that they get re-expanded; and
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
# * put everything else in single quotes, so that it's not re-expanded.
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
set -- \
|
set -- \
|
||||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
|||||||
Vendored
+12
-10
@@ -13,6 +13,8 @@
|
|||||||
@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 ##########################################################################
|
||||||
@@ -43,11 +45,11 @@ 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% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
@@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
|||||||
|
|
||||||
if exist "%JAVA_EXE%" goto execute
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
|
|||||||
+4
-11
@@ -4,10 +4,10 @@ pluginManagement {
|
|||||||
maven {
|
maven {
|
||||||
// RetroFuturaGradle
|
// RetroFuturaGradle
|
||||||
name "GTNH Maven"
|
name "GTNH Maven"
|
||||||
url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
|
url "https://nexus.gtnewhorizons.com/repository/public/"
|
||||||
allowInsecureProtocol = true
|
|
||||||
mavenContent {
|
mavenContent {
|
||||||
includeGroup("com.gtnewhorizons.retrofuturagradle")
|
includeGroup("com.gtnewhorizons")
|
||||||
|
includeGroupByRegex("com\\.gtnewhorizons\\..+")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
@@ -17,12 +17,5 @@ pluginManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.diffplug.blowdryerSetup' version '1.6.0'
|
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.43'
|
||||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' // Provides java toolchains
|
|
||||||
}
|
|
||||||
|
|
||||||
blowdryerSetup {
|
|
||||||
repoSubfolder 'gtnhShared'
|
|
||||||
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.2.0')
|
|
||||||
//devLocal '.' // Use this when testing config updates locally
|
|
||||||
}
|
}
|
||||||
@@ -8,14 +8,12 @@ import binnie.core.genetics.ManagerGenetics;
|
|||||||
import binnie.core.item.ManagerItem;
|
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;
|
||||||
|
|
||||||
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 ManagerItem Item = new ManagerItem();
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import net.minecraft.item.Item;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.entity.player.BonemealEvent;
|
import net.minecraftforge.event.entity.player.BonemealEvent;
|
||||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||||
import net.minecraftforge.event.world.BlockEvent;
|
import net.minecraftforge.event.world.BlockEvent;
|
||||||
@@ -39,6 +40,7 @@ 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;
|
||||||
@@ -53,12 +55,7 @@ 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;
|
||||||
|
|
||||||
@Mod(
|
@Mod(modid = "Botany", name = "Botany", version = Tags.VERSION, useMetadata = true, dependencies = "after:BinnieCore")
|
||||||
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")
|
||||||
@@ -96,6 +93,7 @@ public class Botany extends AbstractMod {
|
|||||||
|
|
||||||
public Botany() {
|
public Botany() {
|
||||||
Botany.instance = this;
|
Botany.instance = this;
|
||||||
|
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
@@ -121,11 +119,6 @@ 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();
|
||||||
@@ -151,120 +144,6 @@ 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)
|
||||||
@@ -298,27 +177,6 @@ public class Botany extends AbstractMod {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@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()) {
|
||||||
@@ -349,4 +207,138 @@ public class Botany extends AbstractMod {
|
|||||||
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,7 @@ public enum EnumFlowerChromosome implements IChromosomeType {
|
|||||||
SAPPINESS(IAlleleFloat.class),
|
SAPPINESS(IAlleleFloat.class),
|
||||||
STEM(IAlleleInteger.class);
|
STEM(IAlleleInteger.class);
|
||||||
|
|
||||||
private Class<? extends IAllele> cls;
|
private final Class<? extends IAllele> cls;
|
||||||
|
|
||||||
EnumFlowerChromosome(Class<? extends IAllele> cls) {
|
EnumFlowerChromosome(Class<? extends IAllele> cls) {
|
||||||
this.cls = cls;
|
this.cls = cls;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ public enum EnumFlowerStage {
|
|||||||
POLLEN("Pollen"),
|
POLLEN("Pollen"),
|
||||||
NONE("NONE");
|
NONE("NONE");
|
||||||
|
|
||||||
protected String name;
|
private final String name;
|
||||||
|
|
||||||
EnumFlowerStage(String name) {
|
EnumFlowerStage(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public class BlockCeramic extends Block implements IBlockMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addBlockTooltip(ItemStack stack, List tooltip) {
|
public void addBlockTooltip(ItemStack stack, List<String> 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,7 +92,7 @@ public class BlockCeramic extends Block implements IBlockMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item item, CreativeTabs tabs, List itemList) {
|
public void getSubBlocks(Item item, CreativeTabs tabs, List<ItemStack> 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()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addBlockTooltip(ItemStack itemStack, List tooltip) {
|
public void addBlockTooltip(ItemStack itemStack, List<String> tooltip) {
|
||||||
int meta = TileEntityMetadata.getItemDamage(itemStack);
|
int meta = TileEntityMetadata.getItemDamage(itemStack);
|
||||||
getType(meta).addTooltip(tooltip);
|
getType(meta).addTooltip(tooltip);
|
||||||
}
|
}
|
||||||
@@ -101,7 +101,7 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item item, CreativeTabs tab, List itemList) {
|
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> 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()));
|
||||||
@@ -205,9 +205,9 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
|||||||
VerticalStripeBrick("verticalbrickstripe", "verticalStripedCeramicBricks"),
|
VerticalStripeBrick("verticalbrickstripe", "verticalStripedCeramicBricks"),
|
||||||
VerticalLargeBrick("verticalbricklarge", "largeVerticalCeramicBricks");
|
VerticalLargeBrick("verticalbricklarge", "largeVerticalCeramicBricks");
|
||||||
|
|
||||||
protected String id;
|
private final String id;
|
||||||
protected String name;
|
private final String name;
|
||||||
protected IIcon[] icons;
|
private final IIcon[] icons;
|
||||||
|
|
||||||
TileType(String id, String name) {
|
TileType(String id, String name) {
|
||||||
icons = new IIcon[3];
|
icons = new IIcon[3];
|
||||||
@@ -224,32 +224,15 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||||
switch (this) {
|
return switch (this) {
|
||||||
case Tile:
|
case Tile -> getTileRecipe(stacks);
|
||||||
return getTileRecipe(stacks);
|
case Split -> getSplitRecipe(stacks);
|
||||||
|
case Chequered -> getChequeredRecipe(stacks);
|
||||||
case Split:
|
case Mixed -> getMixedRecipe(stacks);
|
||||||
return getSplitRecipe(stacks);
|
case LargeBrick -> getLargeBrickRecipe(stacks);
|
||||||
|
case Brick, StripeBrick -> getBrickRecipe(stacks);
|
||||||
case Chequered:
|
case VerticalLargeBrick, VerticalBrick, VerticalStripeBrick -> getVerticalBrickRecipe(stacks);
|
||||||
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) {
|
||||||
@@ -541,7 +524,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 tooltip) {
|
public void addTooltip(List<String> 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());
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class BlockCeramicPatterned extends BlockDesign {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addBlockTooltip(ItemStack stack, List tooltip) {
|
public void addBlockTooltip(ItemStack stack, List<String> 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());
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ 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");
|
||||||
}
|
}
|
||||||
@@ -111,7 +112,7 @@ public class BlockStained extends Block implements IBlockMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addBlockTooltip(ItemStack itemStack, List tooltip) {
|
public void addBlockTooltip(ItemStack itemStack, List<String> 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());
|
||||||
}
|
}
|
||||||
@@ -122,7 +123,7 @@ public class BlockStained extends Block implements IBlockMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item item, CreativeTabs tab, List itemList) {
|
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> 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()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public class PigmentRecipe implements IRecipe {
|
|||||||
|
|
||||||
protected ItemStack cached;
|
protected ItemStack cached;
|
||||||
|
|
||||||
private ItemStack unknown;
|
private final ItemStack unknown;
|
||||||
|
|
||||||
public PigmentRecipe() {
|
public PigmentRecipe() {
|
||||||
unknown = null;
|
unknown = null;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ 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 +18,7 @@ public class ControlColorMixBox extends ControlListBox<IColourMix> {
|
|||||||
return new ControlColorMixItem(getContent(), value, y);
|
return new ControlColorMixItem(getContent(), value, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Type {
|
public enum Type {
|
||||||
Resultant,
|
Resultant,
|
||||||
Further
|
Further
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ import forestry.api.farming.IFarmHousing;
|
|||||||
|
|
||||||
public class CircuitGarden extends BinnieCircuit {
|
public class CircuitGarden extends BinnieCircuit {
|
||||||
|
|
||||||
private boolean isManual;
|
private final boolean isManual;
|
||||||
private boolean isFertilised;
|
private final boolean isFertilised;
|
||||||
private ItemStack icon;
|
private final ItemStack icon;
|
||||||
private EnumMoisture moisture;
|
private final EnumMoisture moisture;
|
||||||
private EnumAcidity acidity;
|
private final EnumAcidity acidity;
|
||||||
|
|
||||||
public CircuitGarden(EnumMoisture moisture, EnumAcidity ph, boolean manual, boolean fertilised, ItemStack recipe,
|
public CircuitGarden(EnumMoisture moisture, EnumAcidity ph, boolean manual, boolean fertilised, ItemStack recipe,
|
||||||
ItemStack icon) {
|
ItemStack icon) {
|
||||||
@@ -46,27 +46,27 @@ public class CircuitGarden extends BinnieCircuit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (acidity == EnumAcidity.ACID) {
|
if (acidity == EnumAcidity.ACID) {
|
||||||
if (info.length() > 0) {
|
if (!info.isEmpty()) {
|
||||||
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.length() > 0) {
|
if (!info.isEmpty()) {
|
||||||
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.length() > 0) {
|
if (!info.isEmpty()) {
|
||||||
info += ", ";
|
info += ", ";
|
||||||
}
|
}
|
||||||
info += EnumChatFormatting.AQUA + I18N.localise("botany.ph.alkaline") + EnumChatFormatting.RESET;
|
info += EnumChatFormatting.AQUA + I18N.localise("botany.ph.alkaline") + EnumChatFormatting.RESET;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.length() > 0) {
|
if (!info.isEmpty()) {
|
||||||
info = " (" + info + EnumChatFormatting.RESET + ")";
|
info = " (" + info + EnumChatFormatting.RESET + ")";
|
||||||
}
|
}
|
||||||
addTooltipString(I18N.localise("botany.circuit.flowers") + info);
|
addTooltipString(I18N.localise("botany.circuit.flowers") + info);
|
||||||
@@ -101,8 +101,4 @@ 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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -359,8 +359,7 @@ public class GardenLogic extends FarmLogic {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
IOwnable housing2 = (IOwnable) housing;
|
IOwnable housing2 = (IOwnable) housing;
|
||||||
GameProfile prof = (GameProfile) IOwnable.class.getMethod("getOwnerProfile", new Class[0])
|
GameProfile prof = (GameProfile) IOwnable.class.getMethod("getOwnerProfile").invoke(housing2);
|
||||||
.invoke(housing2);
|
|
||||||
((TileEntityFlower) tile).setOwner(prof);
|
((TileEntityFlower) tile).setOwner(prof);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
// ignored
|
// ignored
|
||||||
|
|||||||
@@ -85,7 +85,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 != null && flower instanceof TileEntityFlower) {
|
if (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 +93,7 @@ public class BlockFlower extends BlockContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TileEntity below = world.getTileEntity(x, y - 1, z);
|
TileEntity below = world.getTileEntity(x, y - 1, z);
|
||||||
if (flower != null && flower instanceof TileEntityFlower) {
|
if (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,15 +108,14 @@ 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)) {
|
if (!(tile instanceof TileEntityFlower tileFlower)) {
|
||||||
return super.getIcon(world, x, y, z, side);
|
return super.getIcon(world, x, y, z, side);
|
||||||
}
|
}
|
||||||
|
|
||||||
TileEntityFlower f = (TileEntityFlower) tile;
|
EnumFlowerStage stage = (tileFlower.getAge() == 0) ? EnumFlowerStage.SEED : EnumFlowerStage.FLOWER;
|
||||||
EnumFlowerStage stage = (f.getAge() == 0) ? EnumFlowerStage.SEED : EnumFlowerStage.FLOWER;
|
IFlowerType flower = tileFlower.getType();
|
||||||
IFlowerType flower = f.getType();
|
int section = tileFlower.getRenderSection();
|
||||||
int section = f.getRenderSection();
|
boolean flowered = tileFlower.isFlowered();
|
||||||
boolean flowered = f.isFlowered();
|
|
||||||
if (RendererBotany.pass == 0) {
|
if (RendererBotany.pass == 0) {
|
||||||
return flower.getStem(stage, flowered, section);
|
return flower.getStem(stage, flowered, section);
|
||||||
}
|
}
|
||||||
@@ -129,12 +128,11 @@ 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) {
|
if (tile instanceof TileEntityFlower tileFlower) {
|
||||||
TileEntityFlower f = (TileEntityFlower) tile;
|
|
||||||
if (RendererBotany.pass == 0) {
|
if (RendererBotany.pass == 0) {
|
||||||
return f.getStemColour();
|
return tileFlower.getStemColour();
|
||||||
}
|
}
|
||||||
return (RendererBotany.pass == 1) ? f.getPrimaryColor() : f.getSecondaryColor();
|
return (RendererBotany.pass == 1) ? tileFlower.getPrimaryColor() : tileFlower.getSecondaryColor();
|
||||||
}
|
}
|
||||||
return 0xffffff;
|
return 0xffffff;
|
||||||
}
|
}
|
||||||
@@ -153,14 +151,13 @@ 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)) {
|
if (!(tile instanceof TileEntityFlower tileFlower)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TileEntityFlower flower = (TileEntityFlower) tile;
|
if (tileFlower.getSection() == 0 && tileFlower.getFlower() != null
|
||||||
if (flower.getSection() == 0 && flower.getFlower() != null
|
&& tileFlower.getFlower().getAge() > 0
|
||||||
&& flower.getFlower().getAge() > 0
|
&& tileFlower.getFlower().getGenome().getPrimary().getType().getSections() > 1
|
||||||
&& 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);
|
||||||
@@ -212,7 +209,7 @@ public class BlockFlower extends BlockContainer {
|
|||||||
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 && BinnieCore.proxy.isSimulating(world)
|
||||||
&& drops.size() > 0
|
&& !drops.isEmpty()
|
||||||
&& (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);
|
||||||
|
|||||||
@@ -57,11 +57,6 @@ public abstract class ItemBotany extends Item {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean getShareTag() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasEffect(ItemStack stack, int pass) {
|
public boolean hasEffect(ItemStack stack, int pass) {
|
||||||
if (!stack.hasTagCompound()) {
|
if (!stack.hasTagCompound()) {
|
||||||
@@ -73,7 +68,7 @@ public abstract class ItemBotany extends Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(ItemStack itemstack, EntityPlayer player, List tooltip, boolean flag) {
|
public void addInformation(ItemStack itemstack, EntityPlayer player, List<String> tooltip, boolean flag) {
|
||||||
if (!itemstack.hasTagCompound()) {
|
if (!itemstack.hasTagCompound()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -138,11 +133,11 @@ public abstract class ItemBotany extends Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List<ItemStack> itemList) {
|
||||||
addCreativeItems(itemList, true);
|
addCreativeItems(itemList, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addCreativeItems(List itemList, boolean hideSecrets) {
|
public void addCreativeItems(List<ItemStack> 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;
|
||||||
@@ -199,10 +194,9 @@ public abstract class ItemBotany extends Item {
|
|||||||
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)) {
|
if (!(target instanceof IPollinatable pollinatable)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
IPollinatable pollinatable = (IPollinatable) target;
|
|
||||||
if (!pollinatable.canMateWith(flower)) {
|
if (!pollinatable.canMateWith(flower)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class ItemInsulatedTube extends Item {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> 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));
|
||||||
@@ -61,7 +61,7 @@ public class ItemInsulatedTube extends Item {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
public void addInformation(ItemStack stack, EntityPlayer player, List<String> 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());
|
||||||
}
|
}
|
||||||
@@ -93,8 +93,8 @@ public class ItemInsulatedTube extends Item {
|
|||||||
Bronze(0xddc276, "bronze"),
|
Bronze(0xddc276, "bronze"),
|
||||||
Iron(0xd8d8d8, "iron");
|
Iron(0xd8d8d8, "iron");
|
||||||
|
|
||||||
protected int color;
|
private final int color;
|
||||||
protected String name;
|
private final String name;
|
||||||
|
|
||||||
Material(int color, String name) {
|
Material(int color, String name) {
|
||||||
this.color = color;
|
this.color = color;
|
||||||
@@ -123,8 +123,8 @@ public class ItemInsulatedTube extends Item {
|
|||||||
Stone(0x6d6d6d, "smoothStone"),
|
Stone(0x6d6d6d, "smoothStone"),
|
||||||
Sandstone(0xc1b989, "sandstone");
|
Sandstone(0xc1b989, "sandstone");
|
||||||
|
|
||||||
protected int color;
|
private final int color;
|
||||||
protected String name;
|
private final String name;
|
||||||
|
|
||||||
Insulate(int color, String name) {
|
Insulate(int color, String name) {
|
||||||
this.color = color;
|
this.color = color;
|
||||||
@@ -144,26 +144,14 @@ public class ItemInsulatedTube extends Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getStack() {
|
public ItemStack getStack() {
|
||||||
switch (this) {
|
return switch (this) {
|
||||||
case Clay:
|
case Clay -> new ItemStack(Blocks.clay);
|
||||||
return new ItemStack(Blocks.clay);
|
case Cobble -> new ItemStack(Blocks.cobblestone);
|
||||||
|
case HardenedClay -> new ItemStack(Blocks.hardened_clay);
|
||||||
case Cobble:
|
case Sand -> new ItemStack(Blocks.sand);
|
||||||
return new ItemStack(Blocks.cobblestone);
|
case Sandstone -> new ItemStack(Blocks.sandstone);
|
||||||
|
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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -25,9 +25,8 @@ public class RendererBotany implements ISimpleBlockRenderingHandler {
|
|||||||
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 * 3129871 ^ z * 116129781L;
|
long i1 = x * 3129871L ^ 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;
|
||||||
@@ -46,7 +45,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, d2, d3, 1.0f);
|
renderer.drawCrossedSquares(iicon, d1, y, d3, 1.0f);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ 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;
|
||||||
|
|
||||||
public class TileEntityFlower extends TileEntity implements IPollinatable, IButterflyNursery {
|
public class TileEntityFlower extends TileEntity implements IPollinatable, IButterflyNursery {
|
||||||
|
|
||||||
@@ -212,11 +213,7 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!canTolerate || light < 1.0f) {
|
flower.setWilted(!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();
|
||||||
@@ -301,7 +298,7 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
|||||||
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 (renderInfo == null || !newInfo.equals(renderInfo)) {
|
if (!newInfo.equals(renderInfo)) {
|
||||||
setRender(newInfo);
|
setRender(newInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -456,7 +453,7 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
|||||||
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) > 100) {
|
if (worldObj.countEntities(EntityButterfly.class) > PluginLepidopterology.spawnConstraint) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!spawn.canSpawn(worldObj, x, y, z)) {
|
if (!spawn.canSpawn(worldObj, x, y, z)) {
|
||||||
@@ -618,8 +615,7 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj instanceof RenderInfo) {
|
if (obj instanceof RenderInfo o) {
|
||||||
RenderInfo o = (RenderInfo) obj;
|
|
||||||
return o.age == age && o.wilted == wilted
|
return o.age == age && o.wilted == wilted
|
||||||
&& o.flowered == flowered
|
&& o.flowered == flowered
|
||||||
&& o.primary == primary
|
&& o.primary == primary
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public class BlockPlant extends BlockBush {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> list) {
|
||||||
for (Type type : Type.values()) {
|
for (Type type : Type.values()) {
|
||||||
list.add(type.get());
|
list.add(type.get());
|
||||||
}
|
}
|
||||||
@@ -137,7 +137,7 @@ public class BlockPlant extends BlockBush {
|
|||||||
|
|
||||||
public IIcon icon;
|
public IIcon icon;
|
||||||
|
|
||||||
protected String name;
|
private final String name;
|
||||||
|
|
||||||
Type(String name) {
|
Type(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class BlockSoil extends Block implements IBlockSoil {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> 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));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,16 +46,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.5;
|
bias -= 1.5f;
|
||||||
} else if (world.getBlock(x + dx, y, z + dz) == Blocks.water) {
|
} else if (world.getBlock(x + dx, y, z + dz) == Blocks.water) {
|
||||||
bias += 1.5;
|
bias += 1.5f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (world.isRaining() && world.canBlockSeeTheSky(x, y + 1, z) && world.getPrecipitationHeight(x, z) <= y + 1) {
|
if (world.isRaining() && world.canBlockSeeTheSky(x, y + 1, z) && world.getPrecipitationHeight(x, z) <= y + 1) {
|
||||||
bias += 1.5;
|
bias += 1.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int dx = -1; dx < 2; ++dx) {
|
for (int dx = -1; dx < 2; ++dx) {
|
||||||
@@ -118,13 +118,13 @@ public class Gardening {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
TileEntity tileFlower = world.getTileEntity(x, y, z);
|
final TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
TileEntity below = world.getTileEntity(x, y - 1, z);
|
final TileEntity below = world.getTileEntity(x, y - 1, z);
|
||||||
if (tileFlower != null && tileFlower instanceof TileEntityFlower) {
|
if (tile instanceof TileEntityFlower tileFlower) {
|
||||||
if (below instanceof TileEntityFlower) {
|
if (below instanceof TileEntityFlower lowerFlower) {
|
||||||
((TileEntityFlower) tileFlower).setSection(((TileEntityFlower) below).getSection());
|
tileFlower.setSection(lowerFlower.getSection());
|
||||||
} else {
|
} else {
|
||||||
((TileEntityFlower) tileFlower).create(flower, owner);
|
tileFlower.create(flower, owner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ public class Gardening {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TileEntity flower = world.getTileEntity(x, y, z);
|
TileEntity flower = world.getTileEntity(x, y, z);
|
||||||
if (flower == null || !(flower instanceof TileEntityFlower)) {
|
if (!(flower instanceof TileEntityFlower)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ public class Gardening {
|
|||||||
|
|
||||||
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 != null && tileFlower instanceof TileEntityFlower) {
|
if (tileFlower instanceof TileEntityFlower) {
|
||||||
((TileEntityFlower) tileFlower).setSection(section + 1);
|
((TileEntityFlower) tileFlower).setSection(section + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -250,14 +250,11 @@ public class Gardening {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Block getSoilBlock(EnumSoilType type, boolean weedkill) {
|
public static Block getSoilBlock(EnumSoilType type, boolean weedkill) {
|
||||||
switch (type) {
|
return switch (type) {
|
||||||
case FLOWERBED:
|
case FLOWERBED -> weedkill ? Botany.flowerbedNoWeed : Botany.flowerbed;
|
||||||
return weedkill ? Botany.flowerbedNoWeed : Botany.flowerbed;
|
case LOAM -> weedkill ? Botany.loamNoWeed : Botany.loam;
|
||||||
|
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) {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class ItemSoil extends ItemBlock {
|
|||||||
|
|
||||||
protected EnumSoilType type;
|
protected EnumSoilType type;
|
||||||
|
|
||||||
private boolean noWeed;
|
private final boolean noWeed;
|
||||||
|
|
||||||
public ItemSoil(Block block) {
|
public ItemSoil(Block block) {
|
||||||
super(block);
|
super(block);
|
||||||
@@ -31,7 +31,7 @@ public class ItemSoil extends ItemBlock {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
public void addInformation(ItemStack stack, EntityPlayer player, List<String> 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];
|
||||||
@@ -45,20 +45,20 @@ public class ItemSoil extends ItemBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (acidity == EnumAcidity.ACID) {
|
if (acidity == EnumAcidity.ACID) {
|
||||||
if (info.length() > 0) {
|
if (!info.isEmpty()) {
|
||||||
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.length() > 0) {
|
if (!info.isEmpty()) {
|
||||||
info += ", ";
|
info += ", ";
|
||||||
}
|
}
|
||||||
info += EnumChatFormatting.YELLOW + I18N.localise("botany.ph.alkaline") + EnumChatFormatting.RESET;
|
info += EnumChatFormatting.YELLOW + I18N.localise("botany.ph.alkaline") + EnumChatFormatting.RESET;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.length() > 0) {
|
if (!info.isEmpty()) {
|
||||||
tooltip.add(info);
|
tooltip.add(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,9 @@ 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;
|
||||||
@@ -22,7 +21,7 @@ public class AlleleColor implements IAlleleInteger {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDominant() {
|
public boolean isDominant() {
|
||||||
return dominant;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -92,10 +92,11 @@ public enum EnumFlowerColor implements IFlowerColor {
|
|||||||
YELLOW("yellow", 0xffff00),
|
YELLOW("yellow", 0xffff00),
|
||||||
YELLOW_GREEN("yellowGreen", 0x9acd32);
|
YELLOW_GREEN("yellowGreen", 0x9acd32);
|
||||||
|
|
||||||
private int color;
|
private static final EnumFlowerColor[] ALL_VALUES = values();
|
||||||
private int colorDis;
|
private final int color;
|
||||||
private String name;
|
private final int colorDis;
|
||||||
private AlleleColor allele;
|
private final String name;
|
||||||
|
private final AlleleColor allele;
|
||||||
|
|
||||||
EnumFlowerColor(String name, int color) {
|
EnumFlowerColor(String name, int color) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@@ -2963,7 +2964,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 ALL_VALUES[Math.max(0, i) % ALL_VALUES.length];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -57,18 +57,18 @@ public enum EnumFlowerType implements IFlowerType {
|
|||||||
DELPHINIUM(2),
|
DELPHINIUM(2),
|
||||||
HOLLYHOCK(2);
|
HOLLYHOCK(2);
|
||||||
|
|
||||||
protected int sections;
|
private final int sections;
|
||||||
protected IIcon[] stem;
|
private final IIcon[] stem;
|
||||||
protected IIcon[] petal;
|
private final IIcon[] petal;
|
||||||
protected IIcon[] variant;
|
private final IIcon[] variant;
|
||||||
protected IIcon[] unflowered;
|
private final IIcon[] unflowered;
|
||||||
protected IIcon seedStem;
|
private IIcon seedStem;
|
||||||
protected IIcon seedPetal;
|
private IIcon seedPetal;
|
||||||
protected IIcon seedVariant;
|
private IIcon seedVariant;
|
||||||
protected IIcon pollenStem;
|
private IIcon pollenStem;
|
||||||
protected IIcon pollenPetal;
|
private IIcon pollenPetal;
|
||||||
protected IIcon pollenVariant;
|
private IIcon pollenVariant;
|
||||||
protected IIcon blank;
|
private IIcon blank;
|
||||||
|
|
||||||
EnumFlowerType() {
|
EnumFlowerType() {
|
||||||
this(1);
|
this(1);
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ public class FlowerGenome extends Genome implements IFlowerGenome {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getAgeChance() {
|
public float getAgeChance() {
|
||||||
return 1.0f * (float) Math.sqrt(2.0f / getLifespan());
|
return (float) Math.sqrt(2.0f / getLifespan());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ public class FlowerHelper extends SpeciesRoot implements IFlowerRoot {
|
|||||||
|
|
||||||
protected static String UID = "rootFlowers";
|
protected static String UID = "rootFlowers";
|
||||||
|
|
||||||
private static ArrayList<IFlowerMutation> flowerMutations = new ArrayList<>();
|
private static final ArrayList<IFlowerMutation> flowerMutations = new ArrayList<>();
|
||||||
private static ArrayList<IColourMix> colourMixes = new ArrayList<>();
|
private static final ArrayList<IColourMix> colourMixes = new ArrayList<>();
|
||||||
|
|
||||||
protected Map<ItemStack, IFlower> conversions;
|
protected Map<ItemStack, IFlower> conversions;
|
||||||
|
|
||||||
@@ -226,7 +226,7 @@ public class FlowerHelper extends SpeciesRoot implements IFlowerRoot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class getMemberClass() {
|
public Class<? extends IIndividual> getMemberClass() {
|
||||||
return IFlower.class;
|
return IFlower.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,8 +56,7 @@ public enum FlowerSpecies implements IAlleleFlowerSpecies {
|
|||||||
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", "\u00ef?? grandiflorum", EnumFlowerType.MUMS,
|
CHRYSANTHEMUM("chrysanthemum", "chrysanthemum", "ï?? grandiflorum", EnumFlowerType.MUMS, EnumFlowerColor.VIOLET),
|
||||||
EnumFlowerColor.VIOLET),
|
|
||||||
MARIGOLD("marigold", "calendula", "officinalis", EnumFlowerType.MARIGOLD, EnumFlowerColor.GOLD,
|
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),
|
||||||
@@ -68,7 +67,7 @@ public enum FlowerSpecies implements IAlleleFlowerSpecies {
|
|||||||
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", "\u00ef?? atkinsiana", EnumFlowerType.PETUNIA, EnumFlowerColor.MEDIUM_VIOLET_RED,
|
PETUNIA("petunia", "petunia", "ï?? 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,
|
||||||
@@ -96,24 +95,24 @@ public enum FlowerSpecies implements IAlleleFlowerSpecies {
|
|||||||
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);
|
||||||
|
|
||||||
protected EnumFlowerColor stemColor;
|
private EnumFlowerColor stemColor;
|
||||||
protected EnumAllele.Fertility fert;
|
private EnumAllele.Fertility fert;
|
||||||
protected EnumAllele.Lifespan life;
|
private EnumAllele.Lifespan life;
|
||||||
protected EnumAllele.Sappiness sap;
|
private EnumAllele.Sappiness sap;
|
||||||
protected IFlowerType type;
|
private final IFlowerType type;
|
||||||
protected String name;
|
private final String name;
|
||||||
protected String binomial;
|
private final String binomial;
|
||||||
protected String branchName;
|
private final String branchName;
|
||||||
protected EnumFlowerColor primaryColor;
|
private final EnumFlowerColor primaryColor;
|
||||||
protected EnumFlowerColor secondaryColor;
|
private final EnumFlowerColor secondaryColor;
|
||||||
protected EnumTemperature temperature;
|
private EnumTemperature temperature;
|
||||||
protected EnumAcidity pH;
|
private EnumAcidity pH;
|
||||||
protected EnumMoisture moisture;
|
private EnumMoisture moisture;
|
||||||
protected EnumTolerance tempTolerance;
|
private EnumTolerance tempTolerance;
|
||||||
protected EnumTolerance pHTolerance;
|
private EnumTolerance pHTolerance;
|
||||||
protected EnumTolerance moistureTolerance;
|
private EnumTolerance moistureTolerance;
|
||||||
protected List<IAllele[]> variantTemplates;
|
private final List<IAllele[]> variantTemplates;
|
||||||
protected IClassification branch;
|
private 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);
|
||||||
|
|||||||
@@ -42,13 +42,13 @@ public class ItemDictionary extends Item {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
public void addInformation(ItemStack stack, EntityPlayer player, List<String> 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 list) {
|
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> 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));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ public enum BotanyItems implements IItemMisc {
|
|||||||
Mortar("mortar"),
|
Mortar("mortar"),
|
||||||
Weedkiller("weedkiller");
|
Weedkiller("weedkiller");
|
||||||
|
|
||||||
protected IIcon icon;
|
private IIcon icon;
|
||||||
protected String name;
|
private final String name;
|
||||||
protected String iconPath;
|
private final String iconPath;
|
||||||
|
|
||||||
BotanyItems(String name) {
|
BotanyItems(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@@ -41,7 +41,7 @@ public enum BotanyItems implements IItemMisc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(List data) {
|
public void addInformation(List<String> data) {
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class ItemClay extends Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
public void addInformation(ItemStack stack, EntityPlayer player, List<String> 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());
|
||||||
}
|
}
|
||||||
@@ -44,7 +44,7 @@ public class ItemClay extends Item {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> 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()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class ItemPigment extends Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
public void addInformation(ItemStack stack, EntityPlayer player, List<String> 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());
|
||||||
}
|
}
|
||||||
@@ -44,7 +44,7 @@ public class ItemPigment extends Item {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> 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()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,6 @@ import java.util.Collections;
|
|||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
|
||||||
|
|
||||||
import binnie.Binnie;
|
|
||||||
import binnie.core.gui.IBinnieGUID;
|
import binnie.core.gui.IBinnieGUID;
|
||||||
import binnie.core.mod.parser.FieldParser;
|
import binnie.core.mod.parser.FieldParser;
|
||||||
import binnie.core.network.BinniePacketHandler;
|
import binnie.core.network.BinniePacketHandler;
|
||||||
@@ -30,10 +27,11 @@ public abstract class AbstractMod implements IPacketProvider, IInitializable {
|
|||||||
fields = new LinkedHashSet<>();
|
fields = new LinkedHashSet<>();
|
||||||
modules = new ArrayList<>();
|
modules = new ArrayList<>();
|
||||||
BinnieCore.registerMod(this);
|
BinnieCore.registerMod(this);
|
||||||
MinecraftForge.EVENT_BUS.register(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract boolean isActive();
|
public boolean isActive() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public abstract String getChannel();
|
public abstract String getChannel();
|
||||||
@@ -47,10 +45,6 @@ public abstract class AbstractMod implements IPacketProvider, IInitializable {
|
|||||||
return new IBinnieGUID[0];
|
return new IBinnieGUID[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public Class[] getConfigs() {
|
|
||||||
return new Class[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract IProxyCore getProxy();
|
public abstract IProxyCore getProxy();
|
||||||
|
|
||||||
public abstract String getModID();
|
public abstract String getModID();
|
||||||
@@ -67,12 +61,6 @@ public abstract class AbstractMod implements IPacketProvider, IInitializable {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getConfigs() != null) {
|
|
||||||
for (Class cls : getConfigs()) {
|
|
||||||
Binnie.Configuration.registerConfiguration(cls, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
getProxy().preInit();
|
getProxy().preInit();
|
||||||
for (IInitializable module : modules) {
|
for (IInitializable module : modules) {
|
||||||
module.preInit();
|
module.preInit();
|
||||||
@@ -80,7 +68,7 @@ public abstract class AbstractMod implements IPacketProvider, IInitializable {
|
|||||||
|
|
||||||
// TODO what does it mean?
|
// TODO what does it mean?
|
||||||
Collections.addAll(fields, getClass().getFields());
|
Collections.addAll(fields, getClass().getFields());
|
||||||
for (Class cls : getClass().getClasses()) {
|
for (Class<?> cls : getClass().getClasses()) {
|
||||||
Collections.addAll(fields, getClass().getFields());
|
Collections.addAll(fields, getClass().getFields());
|
||||||
}
|
}
|
||||||
for (IInitializable module : modules) {
|
for (IInitializable module : modules) {
|
||||||
@@ -140,6 +128,6 @@ public abstract class AbstractMod implements IPacketProvider, IInitializable {
|
|||||||
|
|
||||||
protected void addModule(IInitializable init) {
|
protected void addModule(IInitializable init) {
|
||||||
modules.add(init);
|
modules.add(init);
|
||||||
MinecraftForge.EVENT_BUS.register(init);
|
init.registerEventHandler();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,9 +5,9 @@ import java.util.List;
|
|||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
|
||||||
import binnie.Binnie;
|
import binnie.Binnie;
|
||||||
import binnie.core.block.MultipassBlockRenderer;
|
import binnie.core.block.MultipassBlockRenderer;
|
||||||
@@ -22,8 +22,6 @@ import binnie.core.liquid.FluidContainer;
|
|||||||
import binnie.core.liquid.ItemFluidContainer;
|
import binnie.core.liquid.ItemFluidContainer;
|
||||||
import binnie.core.machines.MachineGroup;
|
import binnie.core.machines.MachineGroup;
|
||||||
import binnie.core.machines.storage.ModuleStorage;
|
import binnie.core.machines.storage.ModuleStorage;
|
||||||
import binnie.core.mod.config.ConfigurationMain;
|
|
||||||
import binnie.core.mod.config.ConfigurationMods;
|
|
||||||
import binnie.core.mod.parser.FieldParser;
|
import binnie.core.mod.parser.FieldParser;
|
||||||
import binnie.core.mod.parser.ItemParser;
|
import binnie.core.mod.parser.ItemParser;
|
||||||
import binnie.core.network.BinnieCorePacketID;
|
import binnie.core.network.BinnieCorePacketID;
|
||||||
@@ -49,13 +47,16 @@ import forestry.api.core.ForestryEvent;
|
|||||||
import forestry.plugins.PluginManager;
|
import forestry.plugins.PluginManager;
|
||||||
|
|
||||||
@Mod(
|
@Mod(
|
||||||
modid = "BinnieCore",
|
modid = BinnieCore.CORE_MODID,
|
||||||
name = "Binnie Core",
|
name = BinnieCore.CORE_MOD_NAME,
|
||||||
version = BinnieCore.VERSION,
|
version = Tags.VERSION,
|
||||||
useMetadata = true,
|
useMetadata = true,
|
||||||
dependencies = "after:Forestry@[4.2,),required-after:gtnhlib@[0.0.10,)")
|
dependencies = "after:Forestry@[4.2,),required-after:gtnhlib@[0.0.10,)")
|
||||||
public class BinnieCore extends AbstractMod {
|
public class BinnieCore extends AbstractMod {
|
||||||
|
|
||||||
|
public static final String CORE_MODID = "BinnieCore";
|
||||||
|
public static final String CORE_MOD_NAME = "Binnie Core";
|
||||||
|
|
||||||
@Mod.Instance("BinnieCore")
|
@Mod.Instance("BinnieCore")
|
||||||
public static BinnieCore instance;
|
public static BinnieCore instance;
|
||||||
|
|
||||||
@@ -63,15 +64,17 @@ public class BinnieCore extends AbstractMod {
|
|||||||
public static BinnieProxy proxy;
|
public static BinnieProxy proxy;
|
||||||
|
|
||||||
public static int multipassRenderID;
|
public static int multipassRenderID;
|
||||||
private static List<AbstractMod> modList = new ArrayList<>();
|
private static final List<AbstractMod> modList = new ArrayList<>();
|
||||||
public static MachineGroup packageCompartment;
|
public static MachineGroup packageCompartment;
|
||||||
public static ItemGenesis genesis;
|
public static ItemGenesis genesis;
|
||||||
public static ItemFieldKit fieldKit;
|
public static ItemFieldKit fieldKit;
|
||||||
public static final String VERSION = "GRADLETOKEN_VERSION";
|
|
||||||
|
public BinnieCore() {
|
||||||
|
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
||||||
|
}
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void preInit(FMLPreInitializationEvent evt) {
|
public void preInit(FMLPreInitializationEvent event) {
|
||||||
Binnie.Configuration.registerConfiguration(ConfigurationMods.class, this);
|
|
||||||
for (ManagerBase baseManager : Binnie.Managers) {
|
for (ManagerBase baseManager : Binnie.Managers) {
|
||||||
addModule(baseManager);
|
addModule(baseManager);
|
||||||
}
|
}
|
||||||
@@ -86,12 +89,12 @@ public class BinnieCore extends AbstractMod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void init(FMLInitializationEvent evt) {
|
public void init(FMLInitializationEvent event) {
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void postInit(FMLPostInitializationEvent evt) {
|
public void postInit(FMLPostInitializationEvent event) {
|
||||||
postInit();
|
postInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,20 +138,12 @@ public class BinnieCore extends AbstractMod {
|
|||||||
return PluginManager.Module.ARBORICULTURE.isEnabled();
|
return PluginManager.Module.ARBORICULTURE.isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isBotanyActive() {
|
|
||||||
return ConfigurationMods.botany;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isGeneticsActive() {
|
|
||||||
return ConfigurationMods.genetics;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isExtraBeesActive() {
|
public static boolean isExtraBeesActive() {
|
||||||
return ConfigurationMods.extraBees && isApicultureActive();
|
return isApicultureActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isExtraTreesActive() {
|
public static boolean isExtraTreesActive() {
|
||||||
return ConfigurationMods.extraTrees && isArboricultureActive();
|
return isArboricultureActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -170,23 +165,6 @@ public class BinnieCore extends AbstractMod {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void handleSpeciesDiscovered(ForestryEvent.SpeciesDiscovered event) {
|
|
||||||
try {
|
|
||||||
EntityPlayerMP player = MinecraftServer.getServer().getConfigurationManager()
|
|
||||||
.func_152612_a(event.username.getName());
|
|
||||||
if (player == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
event.tracker.synchToPlayer(player);
|
|
||||||
NBTTagCompound nbt = new NBTTagCompound();
|
|
||||||
nbt.setString("species", event.species.getUID());
|
|
||||||
} catch (Exception ex) {
|
|
||||||
// ignored
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getChannel() {
|
public String getChannel() {
|
||||||
return "BIN";
|
return "BIN";
|
||||||
@@ -207,20 +185,6 @@ public class BinnieCore extends AbstractMod {
|
|||||||
return BinnieCorePacketID.values();
|
return BinnieCorePacketID.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void handleTextureRemap(TextureStitchEvent.Pre event) {
|
|
||||||
if (event.map.getTextureType() == 0) {
|
|
||||||
Binnie.Liquid.reloadIcons(event.map);
|
|
||||||
}
|
|
||||||
Binnie.Resource.registerIcons(event.map, event.map.getTextureType());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<?>[] getConfigs() {
|
|
||||||
return new Class[] { ConfigurationMain.class };
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class<? extends BinniePacketHandler> getPacketHandler() {
|
protected Class<? extends BinniePacketHandler> getPacketHandler() {
|
||||||
return PacketHandler.class;
|
return PacketHandler.class;
|
||||||
@@ -237,4 +201,31 @@ public class BinnieCore extends AbstractMod {
|
|||||||
super(instance);
|
super(instance);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class EventHandler {
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void handleSpeciesDiscovered(ForestryEvent.SpeciesDiscovered event) {
|
||||||
|
try {
|
||||||
|
EntityPlayerMP player = MinecraftServer.getServer().getConfigurationManager()
|
||||||
|
.func_152612_a(event.username.getName());
|
||||||
|
if (player == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
event.tracker.synchToPlayer(player);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void handleTextureRemap(TextureStitchEvent.Pre event) {
|
||||||
|
if (event.map.getTextureType() == 0) {
|
||||||
|
Binnie.Liquid.reloadIcons(event.map);
|
||||||
|
}
|
||||||
|
Binnie.Resource.registerIcons(event.map, event.map.getTextureType());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -7,4 +7,6 @@ public interface IInitializable {
|
|||||||
void init();
|
void init();
|
||||||
|
|
||||||
void postInit();
|
void postInit();
|
||||||
|
|
||||||
|
default void registerEventHandler() {}
|
||||||
}
|
}
|
||||||
@@ -9,14 +9,16 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
|||||||
|
|
||||||
public class Mods {
|
public class Mods {
|
||||||
|
|
||||||
public static Mod forestry;
|
public static final Mod forestry = new Mod("Forestry");
|
||||||
public static Mod ic2;
|
public static final Mod ic2 = new Mod("IC2");
|
||||||
public static Mod botania;
|
public static final Mod botania = new Mod("Botania");
|
||||||
public static Mod extraBiomes;
|
public static final Mod extraBiomes = new Mod("ExtrabiomesXL");
|
||||||
|
public static final Mod dreamcraft = new Mod("dreamcraft");
|
||||||
|
public static final Mod buildcraftCore = new Mod("BuildCraft|Core");
|
||||||
|
|
||||||
private static Item findItem(String modId, String name) {
|
private static Item findItem(String modId, String name) {
|
||||||
Item stack = GameRegistry.findItem(modId, name);
|
Item stack = GameRegistry.findItem(modId, name);
|
||||||
if (stack == null && modId.equals("Forestry")) {
|
if (stack == null && forestry.matchID(modId)) {
|
||||||
throw new RuntimeException("Item not found: " + modId + ":" + name);
|
throw new RuntimeException("Item not found: " + modId + ":" + name);
|
||||||
}
|
}
|
||||||
return stack;
|
return stack;
|
||||||
@@ -24,7 +26,7 @@ public class Mods {
|
|||||||
|
|
||||||
private static ItemStack findItemStack(String modId, String name, int stackSize) {
|
private static ItemStack findItemStack(String modId, String name, int stackSize) {
|
||||||
ItemStack stack = GameRegistry.findItemStack(modId, name, stackSize);
|
ItemStack stack = GameRegistry.findItemStack(modId, name, stackSize);
|
||||||
if (stack == null && modId.equals("Forestry")) {
|
if (stack == null && forestry.matchID(modId)) {
|
||||||
throw new RuntimeException("Stack not found: " + modId + ":" + name);
|
throw new RuntimeException("Stack not found: " + modId + ":" + name);
|
||||||
}
|
}
|
||||||
return stack;
|
return stack;
|
||||||
@@ -32,37 +34,32 @@ public class Mods {
|
|||||||
|
|
||||||
private static Block findBlock(String modId, String name) {
|
private static Block findBlock(String modId, String name) {
|
||||||
Block stack = GameRegistry.findBlock(modId, name);
|
Block stack = GameRegistry.findBlock(modId, name);
|
||||||
if (stack == null && modId.equals("Forestry")) {
|
if (stack == null && forestry.matchID(modId)) {
|
||||||
throw new RuntimeException("Block not found: " + modId + ":" + name);
|
throw new RuntimeException("Block not found: " + modId + ":" + name);
|
||||||
}
|
}
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
|
||||||
Mods.forestry = new Mod("Forestry");
|
|
||||||
Mods.ic2 = new Mod("IC2");
|
|
||||||
Mods.botania = new Mod("Botania");
|
|
||||||
Mods.extraBiomes = new Mod("ExtrabiomesXL");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Mod {
|
public static class Mod {
|
||||||
|
|
||||||
private String id;
|
private final String modid;
|
||||||
|
private final boolean isLoaded;
|
||||||
|
|
||||||
private Mod(String id) {
|
private Mod(String id) {
|
||||||
this.id = id;
|
modid = id;
|
||||||
|
isLoaded = Loader.isModLoaded(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Item item(String name) {
|
public Item item(String name) {
|
||||||
return findItem(id, name);
|
return findItem(modid, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Block block(String name) {
|
public Block block(String name) {
|
||||||
return findBlock(id, name);
|
return findBlock(modid, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack stack(String name, int stackSize) {
|
public ItemStack stack(String name, int stackSize) {
|
||||||
return findItemStack(id, name, stackSize);
|
return findItemStack(modid, name, stackSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack stack(String name) {
|
public ItemStack stack(String name) {
|
||||||
@@ -74,7 +71,11 @@ public class Mods {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean active() {
|
public boolean active() {
|
||||||
return Loader.isModLoaded(id);
|
return isLoaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean matchID(final String id) {
|
||||||
|
return modid.equals(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -62,7 +62,7 @@ public class BlockMetadata extends BlockContainer implements IBlockMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addBlockTooltip(ItemStack itemStack, List tooltip) {
|
public void addBlockTooltip(ItemStack itemStack, List<String> tooltip) {
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ public class BlockMetadata extends BlockContainer implements IBlockMetadata {
|
|||||||
|
|
||||||
boolean hasBeenBroken = world.setBlockToAir(i, j, k);
|
boolean hasBeenBroken = world.setBlockToAir(i, j, k);
|
||||||
if (hasBeenBroken && BinnieCore.proxy.isSimulating(world)
|
if (hasBeenBroken && BinnieCore.proxy.isSimulating(world)
|
||||||
&& drops.size() > 0
|
&& !drops.isEmpty()
|
||||||
&& (player == null || !player.capabilities.isCreativeMode)) {
|
&& (player == null || !player.capabilities.isCreativeMode)) {
|
||||||
for (ItemStack drop : drops) {
|
for (ItemStack drop : drops) {
|
||||||
block.dropAsStack(world, i, j, k, drop);
|
block.dropAsStack(world, i, j, k, drop);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public interface IBlockMetadata extends ITileEntityProvider {
|
|||||||
|
|
||||||
String getBlockName(ItemStack itemStack);
|
String getBlockName(ItemStack itemStack);
|
||||||
|
|
||||||
void addBlockTooltip(ItemStack itemStack, List tooltip);
|
void addBlockTooltip(ItemStack itemStack, List<String> tooltip);
|
||||||
|
|
||||||
void dropAsStack(World world, int x, int y, int z, ItemStack itemStack);
|
void dropAsStack(World world, int x, int y, int z, ItemStack itemStack);
|
||||||
}
|
}
|
||||||
@@ -19,11 +19,6 @@ public class ItemMetadata extends ItemBlock {
|
|||||||
super(block);
|
super(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMetadata(int damage) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
|
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
|
||||||
float hitX, float hitY, float hitZ, int metadata) {
|
float hitX, float hitY, float hitZ, int metadata) {
|
||||||
@@ -56,7 +51,7 @@ public class ItemMetadata extends ItemBlock {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void addInformation(ItemStack itemStack, EntityPlayer player, List tooltip, boolean advanced) {
|
public void addInformation(ItemStack itemStack, EntityPlayer player, List<String> tooltip, boolean advanced) {
|
||||||
((IBlockMetadata) field_150939_a).addBlockTooltip(itemStack, tooltip);
|
((IBlockMetadata) field_150939_a).addBlockTooltip(itemStack, tooltip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,14 +34,10 @@ public class MultipassItemRenderer implements IItemRenderer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handleRenderType(ItemStack item, IItemRenderer.ItemRenderType type) {
|
public boolean handleRenderType(ItemStack item, IItemRenderer.ItemRenderType type) {
|
||||||
switch (type) {
|
return switch (type) {
|
||||||
case ENTITY:
|
case ENTITY, EQUIPPED, INVENTORY, EQUIPPED_FIRST_PERSON -> true;
|
||||||
case EQUIPPED:
|
default -> false;
|
||||||
case INVENTORY:
|
};
|
||||||
case EQUIPPED_FIRST_PERSON:
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -76,12 +76,14 @@ public class TileEntityMetadata extends TileEntity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack getItemStack(Block block, int damage) {
|
public static ItemStack getItemStack(Block block, int damage) {
|
||||||
NBTTagCompound tag = new NBTTagCompound();
|
|
||||||
tag.setInteger("meta", damage);
|
|
||||||
|
|
||||||
ItemStack item = new ItemStack(block, 1, 0);
|
ItemStack item = new ItemStack(block, 1, 0);
|
||||||
item.setItemDamage(Math.min(damage, 16387));
|
if (0 <= damage && damage < Short.MAX_VALUE) {
|
||||||
item.setTagCompound(tag);
|
item.setItemDamage(damage);
|
||||||
|
} else {
|
||||||
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
|
tag.setInteger("meta", damage);
|
||||||
|
item.setTagCompound(tag);
|
||||||
|
}
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ import forestry.api.circuits.ICircuitLayout;
|
|||||||
|
|
||||||
public class BinnieCircuit implements ICircuit {
|
public class BinnieCircuit implements ICircuit {
|
||||||
|
|
||||||
private String uid;
|
private final String uid;
|
||||||
private int limit;
|
private final int limit;
|
||||||
private List<String> tooltips;
|
private final List<String> tooltips;
|
||||||
|
|
||||||
public BinnieCircuit(String uid, int limit, ICircuitLayout layout, ItemStack itemStack) {
|
public BinnieCircuit(String uid, int limit, ICircuitLayout layout, ItemStack itemStack) {
|
||||||
tooltips = new ArrayList<>();
|
tooltips = new ArrayList<>();
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ import forestry.api.circuits.ICircuitSocketType;
|
|||||||
|
|
||||||
public class BinnieCircuitLayout implements ICircuitLayout {
|
public class BinnieCircuitLayout implements ICircuitLayout {
|
||||||
|
|
||||||
private String uid;
|
private final String uid;
|
||||||
private AbstractMod mod;
|
private final AbstractMod mod;
|
||||||
|
|
||||||
public BinnieCircuitLayout(AbstractMod mod, String uid) {
|
public BinnieCircuitLayout(AbstractMod mod, String uid) {
|
||||||
this.uid = uid;
|
this.uid = uid;
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ public interface IWidget {
|
|||||||
|
|
||||||
void callEvent(Event event);
|
void callEvent(Event event);
|
||||||
|
|
||||||
void recieveEvent(Event event);
|
void receiveEvent(Event event);
|
||||||
|
|
||||||
void onUpdateClient();
|
void onUpdateClient();
|
||||||
|
|
||||||
|
|||||||
@@ -39,13 +39,11 @@ public class Tooltip {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean exists() {
|
public boolean exists() {
|
||||||
return tooltip.size() > 0;
|
return !tooltip.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(List list) {
|
public void add(List<String> list) {
|
||||||
for (Object obj : list) {
|
tooltip.addAll(list);
|
||||||
tooltip.add((String) obj);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getList() {
|
public List<String> getList() {
|
||||||
|
|||||||
@@ -19,17 +19,16 @@ public class Widget implements IWidget {
|
|||||||
protected int color;
|
protected int color;
|
||||||
|
|
||||||
private IWidget parent;
|
private IWidget parent;
|
||||||
private List<IWidget> subWidgets;
|
private final List<IWidget> subWidgets;
|
||||||
private List<WidgetAttribute> attributes;
|
private final List<WidgetAttribute> attributes;
|
||||||
private IPoint position;
|
private IPoint position;
|
||||||
private IPoint size;
|
private IPoint size;
|
||||||
private IPoint offset;
|
private IPoint offset;
|
||||||
private Collection<EventHandler> globalEventHandlers;
|
private final Collection<EventHandler> globalEventHandlers;
|
||||||
private boolean enabled;
|
private boolean enabled;
|
||||||
private boolean visible;
|
private boolean visible;
|
||||||
|
|
||||||
public Widget(IWidget parent) {
|
public Widget(IWidget parent) {
|
||||||
this.parent = null;
|
|
||||||
subWidgets = new ArrayList<>();
|
subWidgets = new ArrayList<>();
|
||||||
attributes = new ArrayList<>();
|
attributes = new ArrayList<>();
|
||||||
position = new IPoint(0.0f, 0.0f);
|
position = new IPoint(0.0f, 0.0f);
|
||||||
@@ -91,7 +90,7 @@ public class Widget implements IWidget {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IWidget addWidget(IWidget widget) {
|
public IWidget addWidget(IWidget widget) {
|
||||||
if (subWidgets.size() != 0
|
if (!subWidgets.isEmpty()
|
||||||
&& subWidgets.get(subWidgets.size() - 1).hasAttribute(WidgetAttribute.ALWAYS_ON_TOP)) {
|
&& subWidgets.get(subWidgets.size() - 1).hasAttribute(WidgetAttribute.ALWAYS_ON_TOP)) {
|
||||||
subWidgets.add(subWidgets.size() - 1, widget);
|
subWidgets.add(subWidgets.size() - 1, widget);
|
||||||
} else {
|
} else {
|
||||||
@@ -236,11 +235,11 @@ public class Widget implements IWidget {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void callEvent(Event event) {
|
public void callEvent(Event event) {
|
||||||
getSuperParent().recieveEvent(event);
|
getSuperParent().receiveEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recieveEvent(Event event) {
|
public void receiveEvent(Event event) {
|
||||||
for (EventHandler handler : globalEventHandlers) {
|
for (EventHandler handler : globalEventHandlers) {
|
||||||
if (handler.handles(event)) {
|
if (handler.handles(event)) {
|
||||||
handler.onEvent(event);
|
handler.onEvent(event);
|
||||||
@@ -249,7 +248,7 @@ public class Widget implements IWidget {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
for (IWidget child : getWidgets()) {
|
for (IWidget child : getWidgets()) {
|
||||||
child.recieveEvent(event);
|
child.receiveEvent(event);
|
||||||
}
|
}
|
||||||
} catch (ConcurrentModificationException e) {
|
} catch (ConcurrentModificationException e) {
|
||||||
// ignored
|
// ignored
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import net.minecraft.init.Items;
|
|||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
|
||||||
import binnie.Binnie;
|
import binnie.Binnie;
|
||||||
import binnie.core.AbstractMod;
|
import binnie.core.AbstractMod;
|
||||||
@@ -33,6 +34,7 @@ import binnie.core.craftgui.resource.minecraft.CraftGUITexture;
|
|||||||
import binnie.core.craftgui.resource.minecraft.PaddedTexture;
|
import binnie.core.craftgui.resource.minecraft.PaddedTexture;
|
||||||
import binnie.core.craftgui.resource.minecraft.StandardTexture;
|
import binnie.core.craftgui.resource.minecraft.StandardTexture;
|
||||||
import binnie.core.machines.inventory.SlotValidator;
|
import binnie.core.machines.inventory.SlotValidator;
|
||||||
|
import binnie.core.network.packet.MessageCraftGUI;
|
||||||
import binnie.core.util.I18N;
|
import binnie.core.util.I18N;
|
||||||
import binnie.extrabees.core.ExtraBeeTexture;
|
import binnie.extrabees.core.ExtraBeeTexture;
|
||||||
import binnie.extrabees.gui.ExtraBeeGUITexture;
|
import binnie.extrabees.gui.ExtraBeeGUITexture;
|
||||||
@@ -51,13 +53,13 @@ public class WindowFieldKit extends Window {
|
|||||||
private float glassOffsetY;
|
private float glassOffsetY;
|
||||||
private float glassVX;
|
private float glassVX;
|
||||||
private float glassVY;
|
private float glassVY;
|
||||||
private Random glassRand;
|
private final Random glassRand;
|
||||||
private Control GlassControl;
|
private Control GlassControl;
|
||||||
private ControlChromosome chromo;
|
private ControlChromosome chromo;
|
||||||
private ControlText text;
|
private ControlText text;
|
||||||
private float analyseProgress;
|
private float analyseProgress;
|
||||||
private boolean isAnalysing;
|
private boolean isAnalysing;
|
||||||
private Map<IChromosomeType, String> info;
|
private final Map<IChromosomeType, String> info;
|
||||||
|
|
||||||
public WindowFieldKit(EntityPlayer player, IInventory inventory, Side side) {
|
public WindowFieldKit(EntityPlayer player, IInventory inventory, Side side) {
|
||||||
super(280.0f, 230.0f, player, inventory, side);
|
super(280.0f, 230.0f, player, inventory, side);
|
||||||
@@ -113,20 +115,26 @@ public class WindowFieldKit extends Window {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialiseClient() {
|
public void initialiseClient() {
|
||||||
|
final NBTTagList actions = new NBTTagList();
|
||||||
|
|
||||||
setTitle(getName());
|
setTitle(getName());
|
||||||
CraftGUI.render.stylesheet(new StyleSheetPunnett());
|
CraftGUI.render.stylesheet(new StyleSheetPunnett());
|
||||||
getWindowInventory().createSlot(0);
|
getWindowInventory().createSlot(0);
|
||||||
getWindowInventory().createSlot(1);
|
getWindowInventory().createSlot(1);
|
||||||
setupValidators();
|
setupValidators();
|
||||||
new ControlPlayerInventory(this);
|
new ControlPlayerInventory(this).create(actions);
|
||||||
IPoint handGlass = new IPoint(16.0f, 32.0f);
|
IPoint handGlass = new IPoint(16.0f, 32.0f);
|
||||||
GlassControl = new ControlImage(
|
GlassControl = new ControlImage(
|
||||||
this,
|
this,
|
||||||
handGlass.x(),
|
handGlass.x(),
|
||||||
handGlass.y(),
|
handGlass.y(),
|
||||||
new StandardTexture(0, 160, 96, 96, ExtraBeeTexture.GUIPunnett));
|
new StandardTexture(0, 160, 96, 96, ExtraBeeTexture.GUIPunnett));
|
||||||
new ControlSlot(this, handGlass.x() + 54.0f, handGlass.y() + 26.0f).assign(InventoryType.Window, 0);
|
|
||||||
new ControlSlot(this, 208.0f, 8.0f).assign(InventoryType.Window, 1);
|
new ControlSlot(this, handGlass.x() + 54.0f, handGlass.y() + 26.0f).assign(actions, InventoryType.Window, 0);
|
||||||
|
new ControlSlot(this, 208.0f, 8.0f).assign(actions, InventoryType.Window, 1);
|
||||||
|
|
||||||
|
MessageCraftGUI.sendToServer(actions);
|
||||||
|
|
||||||
(text = new ControlText(this, new IPoint(232.0f, 13.0f), I18N.localise("binniecore.gui.tooltip.paper")))
|
(text = new ControlText(this, new IPoint(232.0f, 13.0f), I18N.localise("binniecore.gui.tooltip.paper")))
|
||||||
.setColor(0x222222);
|
.setColor(0x222222);
|
||||||
(text = new ControlText(this, new IArea(0.0f, 120.0f, w(), 24.0f), "", TextJustification.MIDDLE_CENTER))
|
(text = new ControlText(this, new IArea(0.0f, 120.0f, w(), 24.0f), "", TextJustification.MIDDLE_CENTER))
|
||||||
@@ -285,8 +293,8 @@ public class WindowFieldKit extends Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) {
|
public void receiveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) {
|
||||||
super.recieveGuiNBT(side, player, name, nbt);
|
super.receiveGuiNBT(side, player, name, nbt);
|
||||||
if (side != Side.SERVER || !name.equals("analyse")) {
|
if (side != Side.SERVER || !name.equals("analyse")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class WindowGenesis extends Window {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialiseClient() {
|
public void initialiseClient() {
|
||||||
new ControlPlayerInventory(this);
|
new ControlPlayerInventory(this).createAndRegister();
|
||||||
setTitle(getName());
|
setTitle(getName());
|
||||||
|
|
||||||
ControlTabBar<BreedingSystem> tabSystems = new BreedingSystemControlTabBar();
|
ControlTabBar<BreedingSystem> tabSystems = new BreedingSystemControlTabBar();
|
||||||
@@ -75,7 +75,7 @@ public class WindowGenesis extends Window {
|
|||||||
new Panel(this, one.outset(1), MinecraftGUI.PanelType.Black);
|
new Panel(this, one.outset(1), MinecraftGUI.PanelType.Black);
|
||||||
new Panel(this, two.outset(1), MinecraftGUI.PanelType.Black);
|
new Panel(this, two.outset(1), MinecraftGUI.PanelType.Black);
|
||||||
|
|
||||||
geneList = new ControlListBox<Gene>(this, one.x(), one.y(), one.w(), one.h(), 10.0f) {
|
geneList = new ControlListBox<>(this, one.x(), one.y(), one.w(), one.h(), 10.0f) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IWidget createOption(Gene value, int y) {
|
public IWidget createOption(Gene value, int y) {
|
||||||
@@ -83,7 +83,7 @@ public class WindowGenesis extends Window {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
geneOptions = new ControlListBox<Gene>(this, two.x(), two.y(), two.w(), two.h(), 10.0f) {
|
geneOptions = new ControlListBox<>(this, two.x(), two.y(), two.w(), two.h(), 10.0f) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IWidget createOption(Gene value, int y) {
|
public IWidget createOption(Gene value, int y) {
|
||||||
@@ -175,8 +175,8 @@ public class WindowGenesis extends Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) {
|
public void receiveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) {
|
||||||
super.recieveGuiNBT(side, player, name, nbt);
|
super.receiveGuiNBT(side, player, name, nbt);
|
||||||
if (side == Side.SERVER && name.equals("genesis")) {
|
if (side == Side.SERVER && name.equals("genesis")) {
|
||||||
ItemStack stack = ItemStack.loadItemStackFromNBT(nbt);
|
ItemStack stack = ItemStack.loadItemStackFromNBT(nbt);
|
||||||
InventoryPlayer playerInv = player.inventory;
|
InventoryPlayer playerInv = player.inventory;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class ControlButton extends Control {
|
|||||||
textWidget = new ControlText(this, getArea(), text, TextJustification.MIDDLE_CENTER);
|
textWidget = new ControlText(this, getArea(), text, TextJustification.MIDDLE_CENTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
private EventMouse.Down.Handler mouseHandler = new EventMouse.Down.Handler() {
|
private final EventMouse.Down.Handler mouseHandler = new EventMouse.Down.Handler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(EventMouse.Down event) {
|
public void onEvent(EventMouse.Down event) {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class ControlCheckbox extends Control implements IControlValue<Boolean> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ControlCheckbox(IWidget parent, float x, float y, float w, String text, boolean bool) {
|
public ControlCheckbox(IWidget parent, float x, float y, float w, String text, boolean bool) {
|
||||||
super(parent, x, y, (w > 16.0f) ? w : 16.0f, 16.0f);
|
super(parent, x, y, Math.max(w, 16.0f), 16.0f);
|
||||||
this.text = text;
|
this.text = text;
|
||||||
value = bool;
|
value = bool;
|
||||||
if (w > 16.0f) {
|
if (w > 16.0f) {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import binnie.core.craftgui.geometry.TextJustification;
|
|||||||
public class ControlText extends Control implements IControlValue<String> {
|
public class ControlText extends Control implements IControlValue<String> {
|
||||||
|
|
||||||
private String text;
|
private String text;
|
||||||
private TextJustification align;
|
private final TextJustification align;
|
||||||
|
|
||||||
public ControlText(IWidget parent, IPoint pos, String text) {
|
public ControlText(IWidget parent, IPoint pos, String text) {
|
||||||
this(parent, new IArea(pos, new IPoint(500.0f, 0.0f)), text, TextJustification.TOP_LEFT);
|
this(parent, new IArea(pos, new IPoint(500.0f, 0.0f)), text, TextJustification.TOP_LEFT);
|
||||||
|
|||||||
@@ -69,11 +69,6 @@ public class ControlTextEdit extends Control implements IControlValue<String> {
|
|||||||
}.setOrigin(EventHandler.Origin.Self, this));
|
}.setOrigin(EventHandler.Origin.Self, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onUpdateClient() {
|
|
||||||
// ignored
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void onTextEdit(String value) {
|
protected void onTextEdit(String value) {
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,11 +38,6 @@ public class Control extends Widget implements ITooltipHelp, ITooltip {
|
|||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onUpdateClient() {
|
|
||||||
// ignored
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addHelp(String string) {
|
public void addHelp(String string) {
|
||||||
helpStrings.add(string);
|
helpStrings.add(string);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class ControlOption<T> extends Control implements IControlValue<T> {
|
|||||||
setColor(color);
|
setColor(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
private EventMouse.Down.Handler mouseHandler = new EventMouse.Down.Handler() {
|
private final EventMouse.Down.Handler mouseHandler = new EventMouse.Down.Handler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(EventMouse.Down event) {
|
public void onEvent(EventMouse.Down event) {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class ControlTextOption<T> extends ControlOption<T> {
|
|||||||
this(controlList, option, option.toString(), y);
|
this(controlList, option, option.toString(), y);
|
||||||
}
|
}
|
||||||
|
|
||||||
private EventWidget.ChangeColour.Handler mouseHandler = new EventWidget.ChangeColour.Handler() {
|
private final EventWidget.ChangeColour.Handler mouseHandler = new EventWidget.ChangeColour.Handler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(EventWidget.ChangeColour event) {
|
public void onEvent(EventWidget.ChangeColour event) {
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ public class ControlPage<T> extends Control implements IControlValue<T> {
|
|||||||
public ControlPage(IWidget parent, float x, float y, float w, float h, T value) {
|
public ControlPage(IWidget parent, float x, float y, float w, float h, T value) {
|
||||||
super(parent, x, y, w, h);
|
super(parent, x, y, w, h);
|
||||||
setValue(value);
|
setValue(value);
|
||||||
if (parent instanceof IControlValue && ((IControlValue) parent).getValue() == null) {
|
if (parent instanceof IControlValue cv && ((IControlValue<?>) parent).getValue() == null) {
|
||||||
((IControlValue) parent).setValue(value);
|
cv.setValue(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ public class ControlPages<T> extends Control implements IControlValues<T>, ICont
|
|||||||
public Collection<T> getValues() {
|
public Collection<T> getValues() {
|
||||||
List<T> list = new ArrayList<>();
|
List<T> list = new ArrayList<>();
|
||||||
for (IWidget child : getWidgets()) {
|
for (IWidget child : getWidgets()) {
|
||||||
list.add((T) ((IControlValue) child).getValue());
|
list.add((T) ((IControlValue<?>) child).getValue());
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import binnie.core.craftgui.controls.core.Control;
|
|||||||
|
|
||||||
public class ControlScroll extends Control {
|
public class ControlScroll extends Control {
|
||||||
|
|
||||||
private IControlScrollable scrollWidget;
|
private final IControlScrollable scrollWidget;
|
||||||
|
|
||||||
public ControlScroll(IWidget parent, float x, float y, float width, float height, IControlScrollable scrollWidget) {
|
public ControlScroll(IWidget parent, float x, float y, float width, float height, IControlScrollable scrollWidget) {
|
||||||
super(parent, x, y, width, height);
|
super(parent, x, y, width, height);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class ControlScrollBar extends Control {
|
|||||||
addSelfEventHandler(mouseDownHandler);
|
addSelfEventHandler(mouseDownHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
private EventMouse.Down.Handler mouseDownHandler = new EventMouse.Down.Handler() {
|
private final EventMouse.Down.Handler mouseDownHandler = new EventMouse.Down.Handler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(EventMouse.Down event) {
|
public void onEvent(EventMouse.Down event) {
|
||||||
@@ -50,11 +50,6 @@ public class ControlScrollBar extends Control {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onUpdateClient() {
|
|
||||||
// ignored
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRenderBackground() {
|
public void onRenderBackground() {
|
||||||
IArea renderArea = getRenderArea();
|
IArea renderArea = getRenderArea();
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class ControlScrollableContent<T extends IWidget> extends Control impleme
|
|||||||
setPercentageIndex(getPercentageIndex());
|
setPercentageIndex(getPercentageIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
private EventMouse.Wheel.Handler mouseWheelHandler = new EventMouse.Wheel.Handler() {
|
private final EventMouse.Wheel.Handler mouseWheelHandler = new EventMouse.Wheel.Handler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(EventMouse.Wheel event) {
|
public void onEvent(EventMouse.Wheel event) {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class ControlTab<T> extends Control implements ITooltip, IControlValue<T>
|
|||||||
|
|
||||||
protected T value;
|
protected T value;
|
||||||
|
|
||||||
private ControlTabBar<T> tabBar;
|
private final ControlTabBar<T> tabBar;
|
||||||
|
|
||||||
public ControlTab(ControlTabBar<T> parent, float x, float y, float w, float h, T value) {
|
public ControlTab(ControlTabBar<T> parent, float x, float y, float w, float h, T value) {
|
||||||
super(parent, x, y, w, h);
|
super(parent, x, y, w, h);
|
||||||
@@ -59,8 +59,7 @@ public class ControlTab<T> extends Control implements ITooltip, IControlValue<T>
|
|||||||
}
|
}
|
||||||
|
|
||||||
CraftGUI.render.texture(iTexture, area);
|
CraftGUI.render.texture(iTexture, area);
|
||||||
if (this instanceof ControlTabIcon) {
|
if (this instanceof ControlTabIcon icon) {
|
||||||
ControlTabIcon icon = (ControlTabIcon) this;
|
|
||||||
ControlItemDisplay item = (ControlItemDisplay) getWidgets().get(0);
|
ControlItemDisplay item = (ControlItemDisplay) getWidgets().get(0);
|
||||||
if (texture == CraftGUITexture.TabDisabled) {
|
if (texture == CraftGUITexture.TabDisabled) {
|
||||||
item.setColor(0xaaaaaaaa);
|
item.setColor(0xaaaaaaaa);
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ import binnie.core.genetics.BreedingSystem;
|
|||||||
|
|
||||||
class ControlBreedingProgress extends Control {
|
class ControlBreedingProgress extends Control {
|
||||||
|
|
||||||
private static Texture Progress = new StandardTexture(80, 22, 4, 4, CraftGUITextureSheet.Controls2);
|
private static final Texture Progress = new StandardTexture(80, 22, 4, 4, CraftGUITextureSheet.Controls2);
|
||||||
private float percentage;
|
private final float percentage;
|
||||||
private int colour;
|
private final int colour;
|
||||||
|
|
||||||
public ControlBreedingProgress(IWidget parent, int x, int y, int width, int height, BreedingSystem system,
|
public ControlBreedingProgress(IWidget parent, int x, int y, int width, int height, BreedingSystem system,
|
||||||
float percentage) {
|
float percentage) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import binnie.core.craftgui.minecraft.control.ControlItemDisplay;
|
|||||||
|
|
||||||
public class ControlItemStackOption extends ControlTextOption<ItemStack> {
|
public class ControlItemStackOption extends ControlTextOption<ItemStack> {
|
||||||
|
|
||||||
private ControlItemDisplay controlBee;
|
private final ControlItemDisplay controlBee;
|
||||||
|
|
||||||
public ControlItemStackOption(ControlList<ItemStack> controlList, ItemStack option, int y) {
|
public ControlItemStackOption(ControlList<ItemStack> controlList, ItemStack option, int y) {
|
||||||
super(controlList, option, option.getDisplayName(), y);
|
super(controlList, option, option.getDisplayName(), y);
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import forestry.api.genetics.IMutation;
|
|||||||
|
|
||||||
class ControlMutationBox extends ControlListBox<IMutation> {
|
class ControlMutationBox extends ControlListBox<IMutation> {
|
||||||
|
|
||||||
private Type type;
|
private final Type type;
|
||||||
private IAlleleSpecies species;
|
private IAlleleSpecies species;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ import forestry.api.genetics.IMutation;
|
|||||||
|
|
||||||
class ControlMutationSymbol extends Control implements ITooltip {
|
class ControlMutationSymbol extends Control implements ITooltip {
|
||||||
|
|
||||||
private static Texture MutationPlus = new StandardTexture(2, 94, 16, 16, CraftGUITextureSheet.Controls2);
|
private static final Texture MutationPlus = new StandardTexture(2, 94, 16, 16, CraftGUITextureSheet.Controls2);
|
||||||
private static Texture MutationArrow = new StandardTexture(20, 94, 32, 16, CraftGUITextureSheet.Controls2);
|
private static final Texture MutationArrow = new StandardTexture(20, 94, 32, 16, CraftGUITextureSheet.Controls2);
|
||||||
private IMutation value;
|
private IMutation value;
|
||||||
private boolean discovered;
|
private boolean discovered;
|
||||||
private int type;
|
private final int type;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRenderBackground() {
|
public void onRenderBackground() {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import forestry.api.genetics.IAlleleSpecies;
|
|||||||
|
|
||||||
class ControlSpeciesBoxOption extends ControlTextOption<IAlleleSpecies> {
|
class ControlSpeciesBoxOption extends ControlTextOption<IAlleleSpecies> {
|
||||||
|
|
||||||
private ControlDatabaseIndividualDisplay controlBee;
|
private final ControlDatabaseIndividualDisplay controlBee;
|
||||||
|
|
||||||
public ControlSpeciesBoxOption(ControlList<IAlleleSpecies> controlList, IAlleleSpecies option, int y) {
|
public ControlSpeciesBoxOption(ControlList<IAlleleSpecies> controlList, IAlleleSpecies option, int y) {
|
||||||
super(controlList, option, option.getName(), y);
|
super(controlList, option, option.getName(), y);
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import binnie.core.util.I18N;
|
|||||||
|
|
||||||
public class DatabaseTab implements ITooltipHelp {
|
public class DatabaseTab implements ITooltipHelp {
|
||||||
|
|
||||||
private String mod;
|
private final String mod;
|
||||||
private String unloc;
|
private final String unloc;
|
||||||
|
|
||||||
public DatabaseTab(AbstractMod mod, String unloc) {
|
public DatabaseTab(AbstractMod mod, String unloc) {
|
||||||
this.mod = mod.getModID();
|
this.mod = mod.getModID();
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ import forestry.api.genetics.IClassification;
|
|||||||
|
|
||||||
public class PageBranchOverview extends PageBranch {
|
public class PageBranchOverview extends PageBranch {
|
||||||
|
|
||||||
private ControlText branchName;
|
private final ControlText branchName;
|
||||||
private ControlText branchScientific;
|
private final ControlText branchScientific;
|
||||||
private ControlText branchAuthority;
|
private final ControlText branchAuthority;
|
||||||
private List<ControlText> branchDescription;
|
private final List<ControlText> branchDescription;
|
||||||
|
|
||||||
public PageBranchOverview(IWidget parent, DatabaseTab tab) {
|
public PageBranchOverview(IWidget parent, DatabaseTab tab) {
|
||||||
super(parent, tab);
|
super(parent, tab);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import forestry.api.genetics.IClassification;
|
|||||||
|
|
||||||
public class PageBranchSpecies extends PageBranch {
|
public class PageBranchSpecies extends PageBranch {
|
||||||
|
|
||||||
private ControlSpeciesBox speciesList;
|
private final ControlSpeciesBox speciesList;
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void onHandleEvent(EventValueChanged<IAlleleSpecies> event) {
|
public void onHandleEvent(EventValueChanged<IAlleleSpecies> event) {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import binnie.core.util.I18N;
|
|||||||
|
|
||||||
public class PageBreeder extends ControlPage<DatabaseTab> {
|
public class PageBreeder extends ControlPage<DatabaseTab> {
|
||||||
|
|
||||||
private GameProfile player;
|
private final GameProfile player;
|
||||||
|
|
||||||
public PageBreeder(IWidget parent, GameProfile player, DatabaseTab tab) {
|
public PageBreeder(IWidget parent, GameProfile player, DatabaseTab tab) {
|
||||||
super(parent, 0.0f, 0.0f, parent.getSize().x(), parent.getSize().y(), tab);
|
super(parent, 0.0f, 0.0f, parent.getSize().x(), parent.getSize().y(), tab);
|
||||||
@@ -22,7 +22,7 @@ public class PageBreeder extends ControlPage<DatabaseTab> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onPageRefresh() {
|
public void onPageRefresh() {
|
||||||
while (getWidgets().size() > 0) {
|
while (!getWidgets().isEmpty()) {
|
||||||
deleteChild(getWidgets().get(0));
|
deleteChild(getWidgets().get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ import forestry.api.genetics.IClassification;
|
|||||||
|
|
||||||
public class PageSpeciesClassification extends PageSpecies {
|
public class PageSpeciesClassification extends PageSpecies {
|
||||||
|
|
||||||
private Map<IClassification.EnumClassLevel, ControlText> levels;
|
private final Map<IClassification.EnumClassLevel, ControlText> levels;
|
||||||
private ControlText genus;
|
private final ControlText genus;
|
||||||
|
|
||||||
public PageSpeciesClassification(IWidget parent, DatabaseTab tab) {
|
public PageSpeciesClassification(IWidget parent, DatabaseTab tab) {
|
||||||
super(parent, tab);
|
super(parent, tab);
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import forestry.api.genetics.IAlleleSpecies;
|
|||||||
|
|
||||||
public class PageSpeciesMutations extends PageSpecies {
|
public class PageSpeciesMutations extends PageSpecies {
|
||||||
|
|
||||||
private ControlMutationBox list;
|
private final ControlMutationBox list;
|
||||||
|
|
||||||
public PageSpeciesMutations(IWidget parent, DatabaseTab tab) {
|
public PageSpeciesMutations(IWidget parent, DatabaseTab tab) {
|
||||||
super(parent, tab);
|
super(parent, tab);
|
||||||
|
|||||||
@@ -14,14 +14,14 @@ import forestry.api.genetics.IAlleleSpecies;
|
|||||||
|
|
||||||
public class PageSpeciesOverview extends PageSpecies {
|
public class PageSpeciesOverview extends PageSpecies {
|
||||||
|
|
||||||
private ControlText controlName;
|
private final ControlText controlName;
|
||||||
private ControlText controlScientific;
|
private final ControlText controlScientific;
|
||||||
private ControlText controlAuthority;
|
private final ControlText controlAuthority;
|
||||||
private ControlText controlComplexity;
|
private final ControlText controlComplexity;
|
||||||
private ControlText controlDescription;
|
private final ControlText controlDescription;
|
||||||
private ControlText controlSignature;
|
private final ControlText controlSignature;
|
||||||
private ControlDatabaseIndividualDisplay controlInd1;
|
private final ControlDatabaseIndividualDisplay controlInd1;
|
||||||
private ControlDatabaseIndividualDisplay controlInd2;
|
private final ControlDatabaseIndividualDisplay controlInd2;
|
||||||
|
|
||||||
public PageSpeciesOverview(IWidget parent, DatabaseTab tab) {
|
public PageSpeciesOverview(IWidget parent, DatabaseTab tab) {
|
||||||
super(parent, tab);
|
super(parent, tab);
|
||||||
@@ -58,23 +58,23 @@ public class PageSpeciesOverview extends PageSpecies {
|
|||||||
+ EnumChatFormatting.RESET);
|
+ EnumChatFormatting.RESET);
|
||||||
controlComplexity.setValue(I18N.localise("extratrees.genetics.complexity", species.getComplexity()));
|
controlComplexity.setValue(I18N.localise("extratrees.genetics.complexity", species.getComplexity()));
|
||||||
String desc = species.getDescription();
|
String desc = species.getDescription();
|
||||||
String descBody = EnumChatFormatting.ITALIC.toString();
|
StringBuilder descBody = new StringBuilder(EnumChatFormatting.ITALIC.toString());
|
||||||
String descSig = "";
|
String descSig = "";
|
||||||
|
|
||||||
if (desc == null || desc.isEmpty() || desc.matches("(\\w+\\.?)+")) {
|
if (desc == null || desc.isEmpty() || desc.matches("(\\w+\\.?)+")) {
|
||||||
descBody += I18N.localise("binniecore.gui.database.species.noDesc");
|
descBody.append(I18N.localise("binniecore.gui.database.species.noDesc"));
|
||||||
} else {
|
} else {
|
||||||
String[] descStrings = desc.split("\\|");
|
String[] descStrings = desc.split("\\|");
|
||||||
descBody += descStrings[0];
|
descBody.append(descStrings[0]);
|
||||||
for (int i = 1; i < descStrings.length - 1; ++i) {
|
for (int i = 1; i < descStrings.length - 1; ++i) {
|
||||||
descBody = descBody + " " + descStrings[i];
|
descBody.append(" ").append(descStrings[i]);
|
||||||
}
|
}
|
||||||
if (descStrings.length > 1) {
|
if (descStrings.length > 1) {
|
||||||
descSig += descStrings[descStrings.length - 1];
|
descSig += descStrings[descStrings.length - 1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
controlDescription.setValue(descBody + EnumChatFormatting.RESET);
|
controlDescription.setValue(descBody.toString() + EnumChatFormatting.RESET);
|
||||||
controlSignature.setValue(descSig + EnumChatFormatting.RESET);
|
controlSignature.setValue(descSig + EnumChatFormatting.RESET);
|
||||||
float descHeight = CraftGUI.render.textHeight(controlDescription.getValue(), controlDescription.getSize().x());
|
float descHeight = CraftGUI.render.textHeight(controlDescription.getValue(), controlDescription.getSize().x());
|
||||||
controlSignature.setPosition(
|
controlSignature.setPosition(
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import forestry.api.genetics.IAlleleSpecies;
|
|||||||
|
|
||||||
public class PageSpeciesResultant extends PageSpecies {
|
public class PageSpeciesResultant extends PageSpecies {
|
||||||
|
|
||||||
private ControlMutationBox list;
|
private final ControlMutationBox list;
|
||||||
|
|
||||||
public PageSpeciesResultant(IWidget parent, DatabaseTab tab) {
|
public PageSpeciesResultant(IWidget parent, DatabaseTab tab) {
|
||||||
super(parent, tab);
|
super(parent, tab);
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ public abstract class WindowAbstractDatabase extends Window {
|
|||||||
protected boolean isNEI;
|
protected boolean isNEI;
|
||||||
|
|
||||||
private float selectionBoxWidth;
|
private float selectionBoxWidth;
|
||||||
private Map<IDatabaseMode, ModeWidgets> modes;
|
private final Map<IDatabaseMode, ModeWidgets> modes;
|
||||||
private BreedingSystem system;
|
private final BreedingSystem system;
|
||||||
private Panel panelInformation;
|
private Panel panelInformation;
|
||||||
private Panel panelSearch;
|
private Panel panelSearch;
|
||||||
private ControlPages<IDatabaseMode> modePages;
|
private ControlPages<IDatabaseMode> modePages;
|
||||||
@@ -88,13 +88,12 @@ public abstract class WindowAbstractDatabase extends Window {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(EventValueChanged event) {
|
public void onEvent(EventValueChanged event) {
|
||||||
if (!(event.getOrigin().getParent() instanceof ControlPage)) {
|
if (!(event.getOrigin().getParent() instanceof ControlPage parent)) {
|
||||||
return;
|
return;
|
||||||
} else if ((event.getValue() instanceof DatabaseTab)) {
|
} else if ((event.getValue() instanceof DatabaseTab)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ControlPage parent = (ControlPage) event.getOrigin().getParent();
|
|
||||||
if (!(parent.getValue() instanceof IDatabaseMode)) {
|
if (!(parent.getValue() instanceof IDatabaseMode)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -185,7 +184,7 @@ public abstract class WindowAbstractDatabase extends Window {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ControlTab<IDatabaseMode> createTab(float x, float y, float w, float h, IDatabaseMode value) {
|
public ControlTab<IDatabaseMode> createTab(float x, float y, float w, float h, IDatabaseMode value) {
|
||||||
return new ControlTab<IDatabaseMode>(this, x, y, w, h, value) {
|
return new ControlTab<>(this, x, y, w, h, value) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
@@ -199,7 +198,7 @@ public abstract class WindowAbstractDatabase extends Window {
|
|||||||
CraftGUIUtil.linkWidgets(tab, modePages);
|
CraftGUIUtil.linkWidgets(tab, modePages);
|
||||||
changeMode(Mode.Species);
|
changeMode(Mode.Species);
|
||||||
for (IDatabaseMode mode : modes.keySet()) {
|
for (IDatabaseMode mode : modes.keySet()) {
|
||||||
modes.get(mode).infoTabs = new ControlTabBar(
|
modes.get(mode).infoTabs = new ControlTabBar<>(
|
||||||
modes.get(mode).modePage,
|
modes.get(mode).modePage,
|
||||||
8.0f,
|
8.0f,
|
||||||
24.0f,
|
24.0f,
|
||||||
@@ -266,7 +265,7 @@ public abstract class WindowAbstractDatabase extends Window {
|
|||||||
public ControlPage<IDatabaseMode> modePage;
|
public ControlPage<IDatabaseMode> modePage;
|
||||||
public ControlListBox listBox;
|
public ControlListBox listBox;
|
||||||
|
|
||||||
private ControlPages<DatabaseTab> infoPages;
|
private final ControlPages<DatabaseTab> infoPages;
|
||||||
private ControlTabBar<DatabaseTab> infoTabs;
|
private ControlTabBar<DatabaseTab> infoTabs;
|
||||||
|
|
||||||
public ModeWidgets(IDatabaseMode mode, WindowAbstractDatabase database) {
|
public ModeWidgets(IDatabaseMode mode, WindowAbstractDatabase database) {
|
||||||
|
|||||||
@@ -33,20 +33,12 @@ public abstract class EventHandler<E extends Event> {
|
|||||||
DirectChild;
|
DirectChild;
|
||||||
|
|
||||||
public boolean isOrigin(IWidget origin, IWidget test) {
|
public boolean isOrigin(IWidget origin, IWidget test) {
|
||||||
switch (this) {
|
return switch (this) {
|
||||||
case Any:
|
case Any -> true;
|
||||||
return true;
|
case DirectChild -> test.getWidgets().contains(origin);
|
||||||
|
case Parent -> test.getParent() == origin;
|
||||||
case DirectChild:
|
case Self -> test == origin;
|
||||||
return test.getWidgets().contains(origin);
|
};
|
||||||
|
|
||||||
case Parent:
|
|
||||||
return test.getParent() == origin;
|
|
||||||
|
|
||||||
case Self:
|
|
||||||
return test == origin;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,8 +7,8 @@ public enum Position {
|
|||||||
LEFT(-1, 0),
|
LEFT(-1, 0),
|
||||||
RIGHT(1, 0);
|
RIGHT(1, 0);
|
||||||
|
|
||||||
protected int x;
|
private final int x;
|
||||||
protected int y;
|
private final int y;
|
||||||
|
|
||||||
Position(int x, int y) {
|
Position(int x, int y) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
@@ -24,19 +24,11 @@ public enum Position {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Position opposite() {
|
public Position opposite() {
|
||||||
switch (this) {
|
return switch (this) {
|
||||||
case BOTTOM:
|
case BOTTOM -> Position.TOP;
|
||||||
return Position.TOP;
|
case LEFT -> Position.RIGHT;
|
||||||
|
case RIGHT -> Position.LEFT;
|
||||||
case LEFT:
|
case TOP -> Position.BOTTOM;
|
||||||
return Position.RIGHT;
|
};
|
||||||
|
|
||||||
case RIGHT:
|
|
||||||
return Position.LEFT;
|
|
||||||
|
|
||||||
case TOP:
|
|
||||||
return Position.BOTTOM;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,8 +12,8 @@ public enum TextJustification {
|
|||||||
BOTTOM_CENTER(0.5f, 1.0f),
|
BOTTOM_CENTER(0.5f, 1.0f),
|
||||||
BOTTOM_RIGHT(1.0f, 1.0f);
|
BOTTOM_RIGHT(1.0f, 1.0f);
|
||||||
|
|
||||||
protected float xOffset;
|
final float xOffset;
|
||||||
protected float yOffset;
|
final float yOffset;
|
||||||
|
|
||||||
TextJustification(float xOffset, float yOffset) {
|
TextJustification(float xOffset, float yOffset) {
|
||||||
this.xOffset = xOffset;
|
this.xOffset = xOffset;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package binnie.core.craftgui.minecraft;
|
package binnie.core.craftgui.minecraft;
|
||||||
|
|
||||||
|
import static net.minecraftforge.common.util.Constants.NBT.TAG_COMPOUND;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -7,12 +9,14 @@ import java.util.Map;
|
|||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.inventory.ICrafting;
|
import net.minecraft.inventory.ICrafting;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.inventory.Slot;
|
import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
|
|
||||||
@@ -36,43 +40,71 @@ import cpw.mods.fml.relauncher.Side;
|
|||||||
|
|
||||||
public class ContainerCraftGUI extends Container {
|
public class ContainerCraftGUI extends Container {
|
||||||
|
|
||||||
private Window window;
|
// Action type is one of the action constants below
|
||||||
private Map<String, NBTTagCompound> syncedNBT;
|
public final static String ACTION_TYPE = "type";
|
||||||
private Map<String, NBTTagCompound> sentNBT;
|
|
||||||
private Map<Integer, TankInfo> syncedTanks;
|
// Action constants
|
||||||
private PowerInfo syncedPower;
|
public final static String ACTION_BATCH = "batch";
|
||||||
private ProcessInfo syncedProcess;
|
public final static String SLOT_REG = "slot-reg";
|
||||||
private int errorType;
|
public final static String TANK_CLICK = "tank-click";
|
||||||
private ErrorState error;
|
public final static String TANK_UPDATE = "tank-update-";
|
||||||
private int mousedOverSlotNumber;
|
public final static String POWER_UPDATE = "power-update";
|
||||||
|
public final static String PROCESS_UPDATE = "process-update";
|
||||||
|
public final static String ERROR_UPDATE = "error-update";
|
||||||
|
public final static String MOUSE_OVER_SLOT = "mouse-over-slot";
|
||||||
|
public final static String SHIFT_CLICK_INFO = "shift-click-info";
|
||||||
|
|
||||||
|
// Error type is one of the error constants below
|
||||||
|
public final static String ERROR_TYPE = "type";
|
||||||
|
|
||||||
|
// Error constants
|
||||||
|
public static final byte CANNOT_WORK = (byte) 0;
|
||||||
|
public static final byte CANNOT_PROGRESS = (byte) 1;
|
||||||
|
|
||||||
|
// Slot constants
|
||||||
|
public static final String SLOT_TYPE = "t";
|
||||||
|
public static final String SLOT_INDEX = "i";
|
||||||
|
public static final String SLOT_NUMBER = "n";
|
||||||
|
|
||||||
|
// Uncategorized constants
|
||||||
|
public static final String ACTIONS = "actions";
|
||||||
|
private static final String USERNAME = "username";
|
||||||
|
private static final String SLOT_ID = "id";
|
||||||
|
private static final String SLOT = "slot";
|
||||||
|
private static final String SLOTS = "slots";
|
||||||
|
private static final String TANK = "tank";
|
||||||
|
private static final String ORIGIN = "origin";
|
||||||
|
private static final String NAME = "name";
|
||||||
|
|
||||||
|
private final Window window;
|
||||||
|
private final Map<String, NBTTagCompound> syncedNBT = new HashMap<>();
|
||||||
|
private final Map<String, NBTTagCompound> sentNBT = new HashMap<>();
|
||||||
|
private final Map<Integer, TankInfo> syncedTanks = new HashMap<>();
|
||||||
|
private PowerInfo syncedPower = new PowerInfo();
|
||||||
|
private ProcessInfo syncedProcess = new ProcessInfo();
|
||||||
|
private int errorType = 0;
|
||||||
|
private ErrorState error = null;
|
||||||
|
private int mousedOverSlotNumber = -1;
|
||||||
|
|
||||||
public ContainerCraftGUI(Window window) {
|
public ContainerCraftGUI(Window window) {
|
||||||
this.window = window;
|
this.window = window;
|
||||||
syncedNBT = new HashMap<>();
|
|
||||||
sentNBT = new HashMap<>();
|
|
||||||
syncedTanks = new HashMap<>();
|
|
||||||
syncedPower = new PowerInfo();
|
|
||||||
syncedProcess = new ProcessInfo();
|
|
||||||
errorType = 0;
|
|
||||||
error = null;
|
|
||||||
mousedOverSlotNumber = -1;
|
|
||||||
IMachine machine = Machine.getMachine(window.getInventory());
|
|
||||||
if (getSide() != Side.SERVER) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
inventoryItemStacks = new ListMap();
|
if (!window.isServer()) return;
|
||||||
inventorySlots = new ListMap();
|
|
||||||
if (machine == null) {
|
// WARNING: The client side expects `ArrayList` and the server expects `ListMap`
|
||||||
return;
|
inventoryItemStacks = new ListMap<>();
|
||||||
}
|
inventorySlots = new ListMap<>();
|
||||||
|
|
||||||
|
IInventory entityInventory = window.getInventory();
|
||||||
|
IMachine machine = Machine.getMachine(entityInventory);
|
||||||
|
if (machine == null) return;
|
||||||
|
|
||||||
GameProfile user = machine.getOwner();
|
GameProfile user = machine.getOwner();
|
||||||
if (user != null) {
|
if (user == null) return;
|
||||||
NBTTagCompound nbt = new NBTTagCompound();
|
|
||||||
nbt.setString("username", user.getName());
|
NBTTagCompound nbt = new NBTTagCompound();
|
||||||
sendNBTToClient("username", nbt);
|
nbt.setString(USERNAME, user.getName());
|
||||||
}
|
sendNBTToClient(USERNAME, nbt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -86,54 +118,47 @@ public class ContainerCraftGUI extends Container {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Slot getSlot(int index) {
|
public Slot getSlot(int index) {
|
||||||
if (index < 0 || index >= inventorySlots.size()) {
|
return index < 0 || index >= inventorySlots.size() ? null : inventorySlots.get(index);
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return (Slot) inventorySlots.get(index);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void putStackInSlot(int index, ItemStack stack) {
|
public void putStackInSlot(int index, ItemStack stack) {
|
||||||
if (getSlot(index) != null) {
|
final Slot slot = getSlot(index);
|
||||||
getSlot(index).putStack(stack);
|
if (slot != null) slot.putStack(stack);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void putStacksInSlots(ItemStack[] par1ArrayOfItemStack) {
|
public void putStacksInSlots(ItemStack[] par1ArrayOfItemStack) {
|
||||||
for (int i = 0; i < par1ArrayOfItemStack.length; ++i) {
|
for (int i = 0; i < par1ArrayOfItemStack.length; ++i) {
|
||||||
if (getSlot(i) != null) {
|
final Slot slot = getSlot(i);
|
||||||
getSlot(i).putStack(par1ArrayOfItemStack[i]);
|
if (slot != null) slot.putStack(par1ArrayOfItemStack[i]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onContainerClosed(EntityPlayer player) {
|
public void onContainerClosed(EntityPlayer player) {
|
||||||
super.onContainerClosed(player);
|
super.onContainerClosed(player);
|
||||||
WindowInventory inventory = window.getWindowInventory();
|
WindowInventory windowInventory = window.getWindowInventory();
|
||||||
for (int i = 0; i < inventory.getSizeInventory(); ++i) {
|
InventoryPlayer playerInventory = player.inventory;
|
||||||
if (!inventory.dispenseOnClose(i)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack stack = inventory.getStackInSlot(i);
|
for (int i = 0; i < windowInventory.getSizeInventory(); ++i) {
|
||||||
if (stack == null) {
|
if (!windowInventory.dispenseOnClose(i)) continue;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
stack = new TransferRequest(stack, player.inventory).transfer(true);
|
final ItemStack stack = windowInventory.getStackInSlot(i);
|
||||||
if (stack != null) {
|
if (stack == null) continue;
|
||||||
player.dropPlayerItemWithRandomChoice(stack, false);
|
|
||||||
}
|
final ItemStack newStack = new TransferRequest(stack, playerInventory).transfer(true);
|
||||||
|
if (newStack == null) continue;
|
||||||
|
|
||||||
|
player.dropPlayerItemWithRandomChoice(newStack, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack slotClick(int slotNum, int mouseButton, int modifier, EntityPlayer player) {
|
public ItemStack slotClick(int slotNum, int mouseButton, int modifier, EntityPlayer player) {
|
||||||
Slot slot = getSlot(slotNum);
|
Slot slot = getSlot(slotNum);
|
||||||
if (slot instanceof CustomSlot && ((CustomSlot) slot).handleClick()) {
|
if (slot instanceof CustomSlot customSlot && customSlot.handleClick()) {
|
||||||
((CustomSlot) slot).onSlotClick(this, mouseButton, modifier, player);
|
customSlot.onSlotClick(this, mouseButton, modifier, player);
|
||||||
return player.inventory.getItemStack();
|
return player.inventory.getItemStack();
|
||||||
}
|
}
|
||||||
return super.slotClick(slotNum, mouseButton, modifier, player);
|
return super.slotClick(slotNum, mouseButton, modifier, player);
|
||||||
@@ -145,51 +170,46 @@ public class ContainerCraftGUI extends Container {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInteractWith(EntityPlayer player) {
|
public boolean canInteractWith(EntityPlayer player) {
|
||||||
if (player instanceof EntityPlayerMP) {
|
if (player instanceof EntityPlayerMP playerMP) {
|
||||||
if (!crafters.contains(player)) {
|
if (!crafters.contains(playerMP)) {
|
||||||
crafters.add(player);
|
crafters.add(playerMP);
|
||||||
}
|
}
|
||||||
sentNBT.clear();
|
sentNBT.clear();
|
||||||
}
|
}
|
||||||
IInventory inventory = window.getInventory();
|
IInventory entityInventory = window.getInventory();
|
||||||
return inventory == null || inventory.isUseableByPlayer(player);
|
return entityInventory == null || entityInventory.isUseableByPlayer(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotID) {
|
public ItemStack transferStackInSlot(EntityPlayer player, int slotID) {
|
||||||
return shiftClick(player, slotID);
|
shiftClick(player, slotID);
|
||||||
}
|
|
||||||
|
|
||||||
private ItemStack shiftClick(EntityPlayer player, int index) {
|
|
||||||
TransferRequest request = getShiftClickRequest(player, index);
|
|
||||||
if (request == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack stack = request.transfer(true);
|
|
||||||
Slot shiftClickedSlot = (Slot) inventorySlots.get(index);
|
|
||||||
shiftClickedSlot.putStack(stack);
|
|
||||||
shiftClickedSlot.onSlotChanged();
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private TransferRequest getShiftClickRequest(EntityPlayer player, int index) {
|
private void shiftClick(EntityPlayer player, int index) {
|
||||||
if (index < 0) {
|
TransferRequest request = getShiftClickRequest(player, index);
|
||||||
return null;
|
if (request == null) return;
|
||||||
}
|
ItemStack stack = request.transfer(true);
|
||||||
|
Slot shiftClickedSlot = inventorySlots.get(index);
|
||||||
|
shiftClickedSlot.putStack(stack);
|
||||||
|
shiftClickedSlot.onSlotChanged();
|
||||||
|
}
|
||||||
|
|
||||||
Slot shiftClickedSlot = (Slot) inventorySlots.get(index);
|
private TransferRequest getShiftClickRequest(EntityPlayer player, int index) {
|
||||||
|
if (index < 0) return null;
|
||||||
|
|
||||||
|
Slot shiftClickedSlot = inventorySlots.get(index);
|
||||||
ItemStack itemstack = null;
|
ItemStack itemstack = null;
|
||||||
if (shiftClickedSlot.getHasStack()) {
|
if (shiftClickedSlot.getHasStack()) {
|
||||||
itemstack = shiftClickedSlot.getStack().copy();
|
itemstack = shiftClickedSlot.getStack().copy();
|
||||||
}
|
}
|
||||||
|
|
||||||
IInventory playerInventory = player.inventory;
|
IInventory playerInventory = player.inventory;
|
||||||
IInventory containerInventory = window.getInventory();
|
IInventory entityInventory = window.getInventory();
|
||||||
IInventory windowInventory = window.getWindowInventory();
|
IInventory windowInventory = window.getWindowInventory();
|
||||||
IInventory fromPlayer = (containerInventory == null) ? windowInventory : containerInventory;
|
IInventory fromPlayer = (entityInventory == null) ? windowInventory : entityInventory;
|
||||||
int[] target = new int[36];
|
int[] target = new int[36];
|
||||||
for (int i = 0; i < 36; ++i) {
|
for (int i = 0; i < target.length; ++i) {
|
||||||
target[i] = i;
|
target[i] = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,110 +221,116 @@ public class ContainerCraftGUI extends Container {
|
|||||||
.setTargetSlots(target);
|
.setTargetSlots(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window instanceof IWindowAffectsShiftClick) {
|
if (window instanceof IWindowAffectsShiftClick iWindowAffectsShiftClick) {
|
||||||
((IWindowAffectsShiftClick) window).alterRequest(request);
|
iWindowAffectsShiftClick.alterRequest(request);
|
||||||
}
|
}
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("UnusedReturnValue")
|
||||||
public ItemStack tankClick(EntityPlayer player, int slotID) {
|
public ItemStack tankClick(EntityPlayer player, int slotID) {
|
||||||
if (player.inventory.getItemStack() == null) {
|
if (player.inventory.getItemStack() == null) return null;
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack heldItem = player.inventory.getItemStack().copy();
|
ItemStack heldItem = player.inventory.getItemStack().copy();
|
||||||
heldItem = new TransferRequest(heldItem, window.getInventory()).setOrigin(player.inventory)
|
IInventory entityInventory = window.getInventory();
|
||||||
.setTargetSlots(new int[0]).setTargetTanks(new int[] { slotID }).transfer(true);
|
heldItem = new TransferRequest(heldItem, entityInventory).setOrigin(player.inventory).setTargetSlots(new int[0])
|
||||||
|
.setTargetTanks(new int[] { slotID }).transfer(true);
|
||||||
|
|
||||||
player.inventory.setItemStack(heldItem);
|
player.inventory.setItemStack(heldItem);
|
||||||
if (player instanceof EntityPlayerMP) {
|
|
||||||
((EntityPlayerMP) player).updateHeldItem();
|
if (player instanceof EntityPlayerMP entityPlayerMP) {
|
||||||
|
entityPlayerMP.updateHeldItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
return heldItem;
|
return heldItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean handleNBT(Side side, EntityPlayer player, String name, NBTTagCompound action) {
|
public void handleNBT(Side side, EntityPlayer player, NBTTagCompound action) {
|
||||||
if (side == Side.SERVER) {
|
final String actionType = action.getString(ACTION_TYPE);
|
||||||
if (name.equals("tank-click")) {
|
|
||||||
tankClick(player, action.getByte("id"));
|
|
||||||
}
|
|
||||||
if (name.equals("slot-reg")) {
|
|
||||||
int type = action.getByte("t");
|
|
||||||
int index = action.getShort("i");
|
|
||||||
int slotNumber = action.getShort("n");
|
|
||||||
getOrCreateSlot(InventoryType.values()[type % 4], index, slotNumber);
|
|
||||||
|
|
||||||
for (Object crafterObject : crafters) {
|
if (side == Side.SERVER) {
|
||||||
ICrafting crafter = (ICrafting) crafterObject;
|
switch (actionType) {
|
||||||
crafter.sendContainerAndContentsToPlayer(this, getInventory());
|
case TANK_CLICK -> tankClick(player, action.getByte(SLOT_ID));
|
||||||
|
case SLOT_REG -> {
|
||||||
|
final int slotType = action.getByte(SLOT_TYPE);
|
||||||
|
final int slotIndex = action.getShort(SLOT_INDEX);
|
||||||
|
final int slotNumber = action.getShort(SLOT_NUMBER);
|
||||||
|
|
||||||
|
createSlot(InventoryType.values()[slotType % 4], slotIndex, slotNumber);
|
||||||
|
|
||||||
|
for (ICrafting crafterObject : crafters) {
|
||||||
|
crafterObject.sendContainerAndContentsToPlayer(this, getInventory());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name.contains("tank-update")) {
|
switch (actionType) {
|
||||||
onTankUpdate(action);
|
case POWER_UPDATE -> onPowerUpdate(action);
|
||||||
} else if (name.equals("power-update")) {
|
case PROCESS_UPDATE -> onProcessUpdate(action);
|
||||||
onPowerUpdate(action);
|
case ERROR_UPDATE -> onErrorUpdate(action);
|
||||||
} else if (name.equals("process-update")) {
|
case MOUSE_OVER_SLOT -> onMouseOverSlot(player, action);
|
||||||
onProcessUpdate(action);
|
case SHIFT_CLICK_INFO -> onReceiveShiftClickHighlights(action);
|
||||||
} else if (name.equals("error-update")) {
|
default -> {
|
||||||
onErrorUpdate(action);
|
if (actionType.contains(TANK_UPDATE)) onTankUpdate(action);
|
||||||
} else if (name.equals("mouse-over-slot")) {
|
}
|
||||||
onMouseOverSlot(player, action);
|
|
||||||
} else if (name.equals("shift-click-info")) {
|
|
||||||
onRecieveShiftClickHighlights(player, action);
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void detectAndSendChanges() {
|
public void detectAndSendChanges() {
|
||||||
super.detectAndSendChanges();
|
super.detectAndSendChanges();
|
||||||
ITankMachine tanks = Machine.getInterface(ITankMachine.class, window.getInventory());
|
|
||||||
IPoweredMachine powered = Machine.getInterface(IPoweredMachine.class, window.getInventory());
|
IInventory entityInventory = window.getInventory();
|
||||||
IErrorStateSource error = Machine.getInterface(IErrorStateSource.class, window.getInventory());
|
ITankMachine tanks = Machine.getInterface(ITankMachine.class, entityInventory);
|
||||||
IProcess process = Machine.getInterface(IProcess.class, window.getInventory());
|
IPoweredMachine powered = Machine.getInterface(IPoweredMachine.class, entityInventory);
|
||||||
if (tanks != null && window.isServer()) {
|
IErrorStateSource error = Machine.getInterface(IErrorStateSource.class, entityInventory);
|
||||||
for (int i = 0; i < tanks.getTankInfos().length; ++i) {
|
IProcess process = Machine.getInterface(IProcess.class, entityInventory);
|
||||||
TankInfo tank = tanks.getTankInfos()[i];
|
|
||||||
if (!getTankInfo(i).equals(tank)) {
|
if (window.isServer() && tanks != null) {
|
||||||
syncedNBT.put("tank-update-" + i, createTankNBT(i, tank));
|
final TankInfo[] tankInfos = tanks.getTankInfos();
|
||||||
syncedTanks.put(i, tank);
|
for (int i = 0; i < tankInfos.length; ++i) {
|
||||||
}
|
final TankInfo tank = tankInfos[i];
|
||||||
|
if (this.getTankInfo(i).equals(tank)) continue;
|
||||||
|
syncedNBT.put(TANK_UPDATE + i, createTankNBT(i, tank));
|
||||||
|
syncedTanks.put(i, tank);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (powered != null && window.isServer()) {
|
if (window.isServer()) {
|
||||||
syncedNBT.put("power-update", createPowerNBT(powered.getPowerInfo()));
|
if (powered != null) syncedNBT.put(POWER_UPDATE, createPowerNBT(powered.getPowerInfo()));
|
||||||
}
|
if (process != null) syncedNBT.put(PROCESS_UPDATE, createProcessNBT(process.getInfo()));
|
||||||
if (process != null && window.isServer()) {
|
if (error != null) syncedNBT.put(ERROR_UPDATE, createErrorNBT(error));
|
||||||
syncedNBT.put("process-update", createProcessNBT(process.getInfo()));
|
|
||||||
}
|
|
||||||
if (error != null && window.isServer()) {
|
|
||||||
syncedNBT.put("error-update", createErrorNBT(error));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
INetwork.SendGuiNBT machineSync = Machine.getInterface(INetwork.SendGuiNBT.class, window.getInventory());
|
INetwork.SendGuiNBT machineSync = Machine.getInterface(INetwork.SendGuiNBT.class, entityInventory);
|
||||||
if (machineSync != null) {
|
|
||||||
machineSync.sendGuiNBT(syncedNBT);
|
if (machineSync != null) machineSync.sendGuiNBT(syncedNBT);
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, NBTTagCompound> sentThisTime = new HashMap<>();
|
Map<String, NBTTagCompound> sentThisTime = new HashMap<>();
|
||||||
for (Map.Entry<String, NBTTagCompound> nbt : syncedNBT.entrySet()) {
|
NBTTagList actions = new NBTTagList();
|
||||||
nbt.getValue().setString("type", nbt.getKey());
|
|
||||||
boolean shouldSend = true;
|
|
||||||
NBTTagCompound lastSent = sentNBT.get(nbt.getKey());
|
|
||||||
if (lastSent != null) {
|
|
||||||
shouldSend = !lastSent.equals(nbt.getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (shouldSend) {
|
for (Map.Entry<String, NBTTagCompound> entry : syncedNBT.entrySet()) {
|
||||||
for (Object crafter : crafters) {
|
final String actionType = entry.getKey();
|
||||||
if (crafter instanceof EntityPlayerMP) {
|
final NBTTagCompound action = entry.getValue();
|
||||||
EntityPlayerMP player = (EntityPlayerMP) crafter;
|
final NBTTagCompound actionPrev = sentNBT.get(actionType);
|
||||||
BinnieCore.proxy.sendToPlayer(new MessageContainerUpdate(nbt.getValue()), player);
|
|
||||||
}
|
action.setString(ACTION_TYPE, actionType);
|
||||||
}
|
|
||||||
sentThisTime.put(nbt.getKey(), nbt.getValue());
|
if (action.equals(actionPrev)) continue;
|
||||||
|
|
||||||
|
actions.appendTag(action);
|
||||||
|
sentThisTime.put(actionType, action);
|
||||||
|
}
|
||||||
|
|
||||||
|
NBTTagCompound actionsBatch = new NBTTagCompound();
|
||||||
|
actionsBatch.setString(ACTION_TYPE, ACTION_BATCH);
|
||||||
|
actionsBatch.setTag(ACTIONS, actions);
|
||||||
|
|
||||||
|
for (ICrafting crafter : crafters) {
|
||||||
|
if (crafter instanceof EntityPlayerMP playerMP) {
|
||||||
|
final MessageContainerUpdate packet = new MessageContainerUpdate(actionsBatch);
|
||||||
|
BinnieCore.proxy.sendToPlayer(packet, playerMP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,10 +342,10 @@ public class ContainerCraftGUI extends Container {
|
|||||||
NBTTagCompound nbt = new NBTTagCompound();
|
NBTTagCompound nbt = new NBTTagCompound();
|
||||||
ErrorState state = null;
|
ErrorState state = null;
|
||||||
if (error.canWork() != null) {
|
if (error.canWork() != null) {
|
||||||
nbt.setByte("type", (byte) 0);
|
nbt.setByte(ERROR_TYPE, CANNOT_WORK);
|
||||||
state = error.canWork();
|
state = error.canWork();
|
||||||
} else if (error.canProgress() != null) {
|
} else if (error.canProgress() != null) {
|
||||||
nbt.setByte("type", (byte) 1);
|
nbt.setByte(ERROR_TYPE, CANNOT_PROGRESS);
|
||||||
state = error.canProgress();
|
state = error.canProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,19 +370,20 @@ public class ContainerCraftGUI extends Container {
|
|||||||
public NBTTagCompound createTankNBT(int tank, TankInfo tankInfo) {
|
public NBTTagCompound createTankNBT(int tank, TankInfo tankInfo) {
|
||||||
NBTTagCompound nbt = new NBTTagCompound();
|
NBTTagCompound nbt = new NBTTagCompound();
|
||||||
tankInfo.writeToNBT(nbt);
|
tankInfo.writeToNBT(nbt);
|
||||||
nbt.setByte("tank", (byte) tank);
|
nbt.setByte(TANK, (byte) tank);
|
||||||
return nbt;
|
return nbt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onTankUpdate(NBTTagCompound nbt) {
|
public void onTankUpdate(NBTTagCompound nbt) {
|
||||||
int tankID = nbt.getByte("tank");
|
int tankID = nbt.getByte(TANK);
|
||||||
TankInfo tank = new TankInfo();
|
TankInfo tank = new TankInfo();
|
||||||
tank.readFromNBT(nbt);
|
tank.readFromNBT(nbt);
|
||||||
syncedTanks.put(tankID, tank);
|
syncedTanks.put(tankID, tank);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onProcessUpdate(NBTTagCompound nbt) {
|
public void onProcessUpdate(NBTTagCompound nbt) {
|
||||||
(syncedProcess = new ProcessInfo()).readFromNBT(nbt);
|
syncedProcess = new ProcessInfo();
|
||||||
|
syncedProcess.readFromNBT(nbt);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onPowerUpdate(NBTTagCompound nbt) {
|
public void onPowerUpdate(NBTTagCompound nbt) {
|
||||||
@@ -377,8 +404,8 @@ public class ContainerCraftGUI extends Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onErrorUpdate(NBTTagCompound nbt) {
|
public void onErrorUpdate(NBTTagCompound nbt) {
|
||||||
errorType = nbt.getByte("type");
|
errorType = nbt.getByte(ERROR_TYPE);
|
||||||
if (nbt.hasKey("name")) {
|
if (nbt.hasKey(NAME)) {
|
||||||
error = new ErrorState("", "");
|
error = new ErrorState("", "");
|
||||||
error.readFromNBT(nbt);
|
error.readFromNBT(nbt);
|
||||||
} else {
|
} else {
|
||||||
@@ -405,20 +432,18 @@ public class ContainerCraftGUI extends Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setMouseOverSlot(Slot slot) {
|
public void setMouseOverSlot(Slot slot) {
|
||||||
if (slot.slotNumber == mousedOverSlotNumber) {
|
if (slot.slotNumber == mousedOverSlotNumber) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
mousedOverSlotNumber = slot.slotNumber;
|
mousedOverSlotNumber = slot.slotNumber;
|
||||||
ControlSlot.highlighting.get(EnumHighlighting.SHIFT_CLICK).clear();
|
ControlSlot.highlighting.get(EnumHighlighting.SHIFT_CLICK).clear();
|
||||||
NBTTagCompound nbt = new NBTTagCompound();
|
NBTTagCompound nbt = new NBTTagCompound();
|
||||||
nbt.setShort("slot", (short) slot.slotNumber);
|
nbt.setShort(SLOT, (short) slot.slotNumber);
|
||||||
window.sendClientAction("mouse-over-slot", nbt);
|
window.sendClientAction(MOUSE_OVER_SLOT, nbt);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onMouseOverSlot(EntityPlayer player, NBTTagCompound data) {
|
private void onMouseOverSlot(EntityPlayer player, NBTTagCompound data) {
|
||||||
int slotnumber = data.getShort("slot");
|
int slotNumber = data.getShort(SLOT);
|
||||||
TransferRequest request = getShiftClickRequest(player, slotnumber);
|
TransferRequest request = getShiftClickRequest(player, slotNumber);
|
||||||
if (request == null) {
|
if (request == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -426,8 +451,8 @@ public class ContainerCraftGUI extends Container {
|
|||||||
request.transfer(false);
|
request.transfer(false);
|
||||||
NBTTagCompound nbt = new NBTTagCompound();
|
NBTTagCompound nbt = new NBTTagCompound();
|
||||||
List<Integer> slots = new ArrayList<>();
|
List<Integer> slots = new ArrayList<>();
|
||||||
for (TransferRequest.TransferSlot tslot : request.getInsertedSlots()) {
|
for (TransferRequest.TransferSlot transferSlot : request.getInsertedSlots()) {
|
||||||
Slot slot = getSlot(tslot.inventory, tslot.id);
|
Slot slot = getSlot(transferSlot.inventory, transferSlot.id);
|
||||||
if (slot != null) {
|
if (slot != null) {
|
||||||
slots.add(slot.slotNumber);
|
slots.add(slot.slotNumber);
|
||||||
}
|
}
|
||||||
@@ -438,15 +463,15 @@ public class ContainerCraftGUI extends Container {
|
|||||||
array[i] = slots.get(i);
|
array[i] = slots.get(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
nbt.setIntArray("slots", array);
|
nbt.setIntArray(SLOTS, array);
|
||||||
nbt.setShort("origin", (short) slotnumber);
|
nbt.setShort(ORIGIN, (short) slotNumber);
|
||||||
syncedNBT.put("shift-click-info", nbt);
|
syncedNBT.put(SHIFT_CLICK_INFO, nbt);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onRecieveShiftClickHighlights(EntityPlayer player, NBTTagCompound data) {
|
private void onReceiveShiftClickHighlights(NBTTagCompound data) {
|
||||||
ControlSlot.highlighting.get(EnumHighlighting.SHIFT_CLICK).clear();
|
ControlSlot.highlighting.get(EnumHighlighting.SHIFT_CLICK).clear();
|
||||||
for (int slotnumber : data.getIntArray("slots")) {
|
for (int slotIndex : data.getIntArray(SLOTS)) {
|
||||||
ControlSlot.highlighting.get(EnumHighlighting.SHIFT_CLICK).add(slotnumber);
|
ControlSlot.highlighting.get(EnumHighlighting.SHIFT_CLICK).add(slotIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -460,58 +485,50 @@ public class ContainerCraftGUI extends Container {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void recieveNBT(Side side, EntityPlayer player, NBTTagCompound action) {
|
public void receiveNBT(Side side, EntityPlayer player, NBTTagCompound action) {
|
||||||
String name = action.getString("type");
|
String actionType = action.getString(ACTION_TYPE);
|
||||||
if (handleNBT(side, player, name, action)) {
|
if (actionType.equals(ACTION_BATCH)) {
|
||||||
|
NBTTagList actionsBatch = action.getTagList(ACTIONS, TAG_COMPOUND);
|
||||||
|
for (int i = 0; i < actionsBatch.tagCount(); i++) {
|
||||||
|
receiveNBT(side, player, actionsBatch.getCompoundTagAt(i));
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
handleNBT(side, player, action);
|
||||||
window.recieveGuiNBT(getSide(), player, name, action);
|
window.receiveGuiNBT(getSide(), player, actionType, action);
|
||||||
INetwork.RecieveGuiNBT machine = Machine.getInterface(INetwork.RecieveGuiNBT.class, window.getInventory());
|
INetwork.ReceiveGuiNBT machine = Machine.getInterface(INetwork.ReceiveGuiNBT.class, window.getInventory());
|
||||||
if (machine != null) {
|
if (machine == null) return;
|
||||||
machine.recieveGuiNBT(getSide(), player, name, action);
|
machine.receiveGuiNBT(getSide(), player, actionType, action);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Slot getOrCreateSlot(InventoryType type, int index) {
|
public Slot getOrCreateSlot(InventoryType inventoryType, int slotIndex) {
|
||||||
IInventory inventory = getInventory(type);
|
final IInventory inventory = getInventory(inventoryType);
|
||||||
Slot slot = getSlot(inventory, index);
|
Slot slot = getSlot(inventory, slotIndex);
|
||||||
|
|
||||||
if (slot == null) {
|
if (slot == null) {
|
||||||
slot = new CustomSlot(inventory, index);
|
slot = new CustomSlot(inventory, slotIndex);
|
||||||
addSlotToContainer(slot);
|
addSlotToContainer(slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound nbt = new NBTTagCompound();
|
|
||||||
nbt.setByte("t", (byte) type.ordinal());
|
|
||||||
nbt.setShort("i", (short) index);
|
|
||||||
nbt.setShort("n", (short) slot.slotNumber);
|
|
||||||
window.sendClientAction("slot-reg", nbt);
|
|
||||||
return slot;
|
return slot;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IInventory getInventory(InventoryType type) {
|
protected IInventory getInventory(InventoryType type) {
|
||||||
if (type == InventoryType.Machine) {
|
return switch (type) {
|
||||||
return window.getInventory();
|
case Machine -> window.getInventory();
|
||||||
}
|
case Player -> window.getPlayer().inventory;
|
||||||
if (type == InventoryType.Player) {
|
case Window -> window.getWindowInventory();
|
||||||
return window.getPlayer().inventory;
|
default -> null;
|
||||||
}
|
};
|
||||||
if (type == InventoryType.Window) {
|
|
||||||
return window.getWindowInventory();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Slot getOrCreateSlot(InventoryType type, int index, int slotNumber) {
|
private void createSlot(InventoryType type, int index, int slotNumber) {
|
||||||
IInventory inventory = getInventory(type);
|
if (inventorySlots.get(slotNumber) != null) return;
|
||||||
if (inventorySlots.get(slotNumber) != null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
IInventory inventory = getInventory(type);
|
||||||
Slot slot = new CustomSlot(inventory, index);
|
Slot slot = new CustomSlot(inventory, index);
|
||||||
slot.slotNumber = slotNumber;
|
slot.slotNumber = slotNumber;
|
||||||
inventorySlots.add(slotNumber, slot);
|
inventorySlots.add(slotNumber, slot);
|
||||||
inventoryItemStacks.add(slotNumber, null);
|
inventoryItemStacks.add(slotNumber, null);
|
||||||
return slot;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -20,9 +20,9 @@ public enum EnumColor {
|
|||||||
Yellow("Yellow", 16777045, 'e'),
|
Yellow("Yellow", 16777045, 'e'),
|
||||||
White("White", 16777215, 'f');
|
White("White", 16777215, 'f');
|
||||||
|
|
||||||
protected int colour;
|
private final int colour;
|
||||||
protected String name;
|
private final String name;
|
||||||
protected char code;
|
private final char code;
|
||||||
|
|
||||||
EnumColor(String name, int colour, char code) {
|
EnumColor(String name, int colour, char code) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@@ -35,7 +35,7 @@ public enum EnumColor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getCode() {
|
public String getCode() {
|
||||||
return "\u00a7" + code;
|
return "§" + code;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public enum GUIIcon {
|
|||||||
ArrowLeftDown("arrow-leftdown"),
|
ArrowLeftDown("arrow-leftdown"),
|
||||||
ArrowLeftUp("arrow-leftup");
|
ArrowLeftUp("arrow-leftup");
|
||||||
|
|
||||||
String path;
|
final String path;
|
||||||
BinnieIcon icon;
|
BinnieIcon icon;
|
||||||
|
|
||||||
GUIIcon(String path) {
|
GUIIcon(String path) {
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import net.minecraft.client.renderer.OpenGlHelper;
|
|||||||
import net.minecraft.client.renderer.RenderHelper;
|
import net.minecraft.client.renderer.RenderHelper;
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.inventory.Slot;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.JsonToNBT;
|
import net.minecraft.nbt.JsonToNBT;
|
||||||
import net.minecraft.nbt.NBTException;
|
import net.minecraft.nbt.NBTException;
|
||||||
@@ -31,7 +30,7 @@ import binnie.core.craftgui.events.EventMouse;
|
|||||||
import binnie.core.craftgui.geometry.IArea;
|
import binnie.core.craftgui.geometry.IArea;
|
||||||
import binnie.core.craftgui.geometry.IBorder;
|
import binnie.core.craftgui.geometry.IBorder;
|
||||||
import binnie.core.craftgui.geometry.IPoint;
|
import binnie.core.craftgui.geometry.IPoint;
|
||||||
import binnie.core.craftgui.minecraft.control.ControlSlot;
|
import binnie.core.craftgui.minecraft.control.ControlSlotBase;
|
||||||
import binnie.core.nei.NEIHook;
|
import binnie.core.nei.NEIHook;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@@ -39,7 +38,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public class GuiCraftGUI extends GuiContainer {
|
public class GuiCraftGUI extends GuiContainer {
|
||||||
|
|
||||||
private Window window;
|
private final Window window;
|
||||||
private ItemStack draggedItem;
|
private ItemStack draggedItem;
|
||||||
|
|
||||||
public GuiCraftGUI(Window window) {
|
public GuiCraftGUI(Window window) {
|
||||||
@@ -117,12 +116,13 @@ public class GuiCraftGUI extends GuiContainer {
|
|||||||
} else {
|
} else {
|
||||||
tooltip.setType(Tooltip.Type.STANDARD);
|
tooltip.setType(Tooltip.Type.STANDARD);
|
||||||
window.getTooltip(tooltip);
|
window.getTooltip(tooltip);
|
||||||
|
NEIHook.renderToolTips(mouseX, mouseY);
|
||||||
}
|
}
|
||||||
|
|
||||||
NEIHook.renderToolTips(mouseX, mouseY);
|
|
||||||
|
|
||||||
if (tooltip.exists()) {
|
if (tooltip.exists()) {
|
||||||
renderTooltip(new IPoint(mouseX, mouseY), tooltip);
|
renderTooltip(new IPoint(mouseX, mouseY), tooltip);
|
||||||
|
} else {
|
||||||
|
NEIHook.renderToolTips(mouseX, mouseY);
|
||||||
}
|
}
|
||||||
zLevel = 0.0f;
|
zLevel = 0.0f;
|
||||||
GL11.glEnable(GL11.GL_LIGHTING);
|
GL11.glEnable(GL11.GL_LIGHTING);
|
||||||
@@ -525,7 +525,11 @@ public class GuiCraftGUI extends GuiContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getStackUnderMouse(int x, int y) {
|
public ItemStack getStackUnderMouse(int x, int y) {
|
||||||
return window.calculateMousedOverWidgets().stream().filter(widget -> widget instanceof ControlSlot).findFirst()
|
for (IWidget widget : window.calculateMousedOverWidgets()) {
|
||||||
.map(w -> ((ControlSlot) w).slot).map(Slot::getStack).orElse(null);
|
if (widget instanceof ControlSlotBase && widget.isVisible()) {
|
||||||
|
return ((ControlSlotBase) widget).getItemStack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,7 +9,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
class ListMap<T> implements List<T> {
|
class ListMap<T> implements List<T> {
|
||||||
|
|
||||||
private LinkedHashMap<Integer, T> map;
|
private final LinkedHashMap<Integer, T> map;
|
||||||
|
|
||||||
ListMap() {
|
ListMap() {
|
||||||
map = new LinkedHashMap<>();
|
map = new LinkedHashMap<>();
|
||||||
|
|||||||
@@ -33,9 +33,9 @@ public class MinecraftTooltip extends Tooltip {
|
|||||||
USER(0x962433, EnumChatFormatting.RED, EnumChatFormatting.DARK_RED),
|
USER(0x962433, EnumChatFormatting.RED, EnumChatFormatting.DARK_RED),
|
||||||
POWER(0x896e00, EnumChatFormatting.YELLOW, EnumChatFormatting.GOLD);
|
POWER(0x896e00, EnumChatFormatting.YELLOW, EnumChatFormatting.GOLD);
|
||||||
|
|
||||||
int outline;
|
final int outline;
|
||||||
String mainText;
|
final String mainText;
|
||||||
String bodyText;
|
final String bodyText;
|
||||||
|
|
||||||
TypeColor(int outline, EnumChatFormatting mainText, EnumChatFormatting bodyText) {
|
TypeColor(int outline, EnumChatFormatting mainText, EnumChatFormatting bodyText) {
|
||||||
this.outline = outline;
|
this.outline = outline;
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import binnie.core.craftgui.minecraft.control.ControlHelp;
|
|||||||
import binnie.core.craftgui.minecraft.control.ControlInfo;
|
import binnie.core.craftgui.minecraft.control.ControlInfo;
|
||||||
import binnie.core.craftgui.minecraft.control.ControlPowerSystem;
|
import binnie.core.craftgui.minecraft.control.ControlPowerSystem;
|
||||||
import binnie.core.craftgui.minecraft.control.ControlSlot;
|
import binnie.core.craftgui.minecraft.control.ControlSlot;
|
||||||
|
import binnie.core.craftgui.minecraft.control.ControlSlotBase;
|
||||||
import binnie.core.craftgui.minecraft.control.ControlUser;
|
import binnie.core.craftgui.minecraft.control.ControlUser;
|
||||||
import binnie.core.craftgui.minecraft.control.EnumHighlighting;
|
import binnie.core.craftgui.minecraft.control.EnumHighlighting;
|
||||||
import binnie.core.craftgui.renderer.Renderer;
|
import binnie.core.craftgui.renderer.Renderer;
|
||||||
@@ -40,26 +41,27 @@ import binnie.core.machines.Machine;
|
|||||||
import binnie.core.machines.inventory.IInventoryMachine;
|
import binnie.core.machines.inventory.IInventoryMachine;
|
||||||
import binnie.core.machines.network.INetwork;
|
import binnie.core.machines.network.INetwork;
|
||||||
import binnie.core.machines.power.PowerSystem;
|
import binnie.core.machines.power.PowerSystem;
|
||||||
|
import binnie.core.nei.NEIHook;
|
||||||
import binnie.core.network.packet.MessageCraftGUI;
|
import binnie.core.network.packet.MessageCraftGUI;
|
||||||
import binnie.core.resource.BinnieResource;
|
import binnie.core.resource.BinnieResource;
|
||||||
import binnie.core.resource.ResourceType;
|
import binnie.core.resource.ResourceType;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public abstract class Window extends TopLevelWidget implements INetwork.RecieveGuiNBT {
|
public abstract class Window extends TopLevelWidget implements INetwork.ReceiveGuiNBT {
|
||||||
|
|
||||||
protected float titleButtonLeft;
|
protected float titleButtonLeft;
|
||||||
protected float titleButtonRight;
|
protected float titleButtonRight;
|
||||||
private GuiCraftGUI gui;
|
private GuiCraftGUI gui;
|
||||||
private ContainerCraftGUI container;
|
private final ContainerCraftGUI container;
|
||||||
private WindowInventory windowInventory;
|
private final WindowInventory windowInventory;
|
||||||
private ControlText title;
|
private ControlText title;
|
||||||
private StandardTexture bgText1;
|
private StandardTexture bgText1;
|
||||||
private StandardTexture bgText2;
|
private StandardTexture bgText2;
|
||||||
private boolean hasBeenInitialised;
|
private boolean hasBeenInitialised;
|
||||||
private EntityPlayer player;
|
private EntityPlayer player;
|
||||||
private IInventory entityInventory;
|
private IInventory entityInventory;
|
||||||
private Side side;
|
private final Side side;
|
||||||
|
|
||||||
public Window(float width, float height, EntityPlayer player, IInventory inventory, Side side) {
|
public Window(float width, float height, EntityPlayer player, IInventory inventory, Side side) {
|
||||||
this.side = side;
|
this.side = side;
|
||||||
@@ -118,6 +120,9 @@ public abstract class Window extends TopLevelWidget implements INetwork.RecieveG
|
|||||||
if (!widget.calculateIsMouseOver()) {
|
if (!widget.calculateIsMouseOver()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (NEIHook.enabled && widget instanceof ControlSlotBase) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (widget instanceof ITooltip) {
|
if (widget instanceof ITooltip) {
|
||||||
((ITooltip) widget).getTooltip(tooltip);
|
((ITooltip) widget).getTooltip(tooltip);
|
||||||
if (tooltip.exists()) {
|
if (tooltip.exists()) {
|
||||||
@@ -286,7 +291,7 @@ public abstract class Window extends TopLevelWidget implements INetwork.RecieveG
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) {
|
public void receiveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) {
|
||||||
if (side == Side.CLIENT && name.equals("username")) {
|
if (side == Side.CLIENT && name.equals("username")) {
|
||||||
float w = w();
|
float w = w();
|
||||||
float titleButtonRight = this.titleButtonRight + 16.0f;
|
float titleButtonRight = this.titleButtonRight + 16.0f;
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ import binnie.core.machines.inventory.SlotValidator;
|
|||||||
|
|
||||||
public class WindowInventory implements IInventory {
|
public class WindowInventory implements IInventory {
|
||||||
|
|
||||||
private Window window;
|
private final Window window;
|
||||||
private Map<Integer, ItemStack> inventory;
|
private final Map<Integer, ItemStack> inventory;
|
||||||
private Map<Integer, SlotValidator> validators;
|
private final Map<Integer, SlotValidator> validators;
|
||||||
private List<Integer> disabledAutoDispenses;
|
private final List<Integer> disabledAutoDispenses;
|
||||||
|
|
||||||
public WindowInventory(Window window) {
|
public WindowInventory(Window window) {
|
||||||
inventory = new HashMap<>();
|
inventory = new HashMap<>();
|
||||||
@@ -27,7 +27,7 @@ public class WindowInventory implements IInventory {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSizeInventory() {
|
public int getSizeInventory() {
|
||||||
if (inventory.size() == 0) {
|
if (inventory.isEmpty()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,8 +61,7 @@ public class WindowInventory implements IInventory {
|
|||||||
amount = available;
|
amount = available;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack itemStack = item;
|
item.stackSize -= amount;
|
||||||
itemStack.stackSize -= amount;
|
|
||||||
output.stackSize = amount;
|
output.stackSize = amount;
|
||||||
if (item.stackSize == 0) {
|
if (item.stackSize == 0) {
|
||||||
setInventorySlotContents(index, null);
|
setInventorySlotContents(index, null);
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package binnie.core.craftgui.minecraft.control;
|
package binnie.core.craftgui.minecraft.control;
|
||||||
|
|
||||||
import net.minecraft.inventory.IInventory;
|
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import binnie.core.craftgui.CraftGUI;
|
import binnie.core.craftgui.CraftGUI;
|
||||||
@@ -17,8 +15,6 @@ import binnie.core.craftgui.minecraft.MinecraftTooltip;
|
|||||||
import binnie.core.craftgui.minecraft.Window;
|
import binnie.core.craftgui.minecraft.Window;
|
||||||
import binnie.core.craftgui.resource.minecraft.CraftGUITexture;
|
import binnie.core.craftgui.resource.minecraft.CraftGUITexture;
|
||||||
import binnie.core.machines.Machine;
|
import binnie.core.machines.Machine;
|
||||||
import binnie.core.machines.TileEntityMachine;
|
|
||||||
import binnie.core.machines.power.IPoweredMachine;
|
|
||||||
import binnie.core.machines.power.IProcess;
|
import binnie.core.machines.power.IProcess;
|
||||||
import binnie.core.util.I18N;
|
import binnie.core.util.I18N;
|
||||||
|
|
||||||
@@ -26,7 +22,7 @@ public class ControlEnergyBar extends Control implements ITooltip {
|
|||||||
|
|
||||||
public static boolean isError;
|
public static boolean isError;
|
||||||
|
|
||||||
private Position direction;
|
private final Position direction;
|
||||||
|
|
||||||
public ControlEnergyBar(IWidget parent, int x, int y, int width, int height, Position direction) {
|
public ControlEnergyBar(IWidget parent, int x, int y, int width, int height, Position direction) {
|
||||||
super(parent, x, y, width, height);
|
super(parent, x, y, width, height);
|
||||||
@@ -34,18 +30,6 @@ public class ControlEnergyBar extends Control implements ITooltip {
|
|||||||
addAttribute(WidgetAttribute.MOUSE_OVER);
|
addAttribute(WidgetAttribute.MOUSE_OVER);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO unused method?
|
|
||||||
public IPoweredMachine getClientPower() {
|
|
||||||
IInventory inventory = Window.get(this).getInventory();
|
|
||||||
TileEntityMachine machine = (inventory instanceof TileEntityMachine) ? (TileEntityMachine) inventory : null;
|
|
||||||
if (machine == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
IPoweredMachine clientPower = machine.getMachine().getInterface(IPoweredMachine.class);
|
|
||||||
return clientPower;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getPercentage() {
|
public float getPercentage() {
|
||||||
float percentage = 100.0f * getStoredEnergy() / getMaxEnergy();
|
float percentage = 100.0f * getStoredEnergy() / getMaxEnergy();
|
||||||
if (percentage > 100.0f) {
|
if (percentage > 100.0f) {
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ public class ControlErrorState extends Control implements ITooltip {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tooltip.add(errorState.toString());
|
tooltip.add(errorState.toString());
|
||||||
if (errorState.getTooltip().length() > 0) {
|
if (!errorState.getTooltip().isEmpty()) {
|
||||||
tooltip.add(errorState.getTooltip());
|
tooltip.add(errorState.getTooltip());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import binnie.core.craftgui.geometry.IPoint;
|
|||||||
|
|
||||||
public class ControlIconDisplay extends Control {
|
public class ControlIconDisplay extends Control {
|
||||||
|
|
||||||
private IIcon icon;
|
private final IIcon icon;
|
||||||
|
|
||||||
public ControlIconDisplay(IWidget parent, float x, float y, IIcon icon) {
|
public ControlIconDisplay(IWidget parent, float x, float y, IIcon icon) {
|
||||||
super(parent, x, y, 16.0f, 16.0f);
|
super(parent, x, y, 16.0f, 16.0f);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import binnie.core.craftgui.resource.Texture;
|
|||||||
|
|
||||||
public class ControlImage extends Control {
|
public class ControlImage extends Control {
|
||||||
|
|
||||||
private Object key;
|
private final Object key;
|
||||||
|
|
||||||
public ControlImage(IWidget parent, float x, float y, Texture text) {
|
public ControlImage(IWidget parent, float x, float y, Texture text) {
|
||||||
super(parent, x, y, text.w(), text.h());
|
super(parent, x, y, text.w(), text.h());
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import binnie.core.util.I18N;
|
|||||||
|
|
||||||
public class ControlInfo extends Control implements ITooltip {
|
public class ControlInfo extends Control implements ITooltip {
|
||||||
|
|
||||||
private String info;
|
private final String info;
|
||||||
|
|
||||||
public ControlInfo(IWidget parent, float x, float y, String info) {
|
public ControlInfo(IWidget parent, float x, float y, String info) {
|
||||||
super(parent, x, y, 16.0f, 16.0f);
|
super(parent, x, y, 16.0f, 16.0f);
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class ControlLiquidTank extends Control implements ITooltip {
|
|||||||
|
|
||||||
public static List<Integer> tankError = new ArrayList<>();
|
public static List<Integer> tankError = new ArrayList<>();
|
||||||
private int tankID;
|
private int tankID;
|
||||||
private boolean horizontal;
|
private final boolean horizontal;
|
||||||
|
|
||||||
public ControlLiquidTank(IWidget parent, int x, int y) {
|
public ControlLiquidTank(IWidget parent, int x, int y) {
|
||||||
this(parent, x, y, false);
|
this(parent, x, y, false);
|
||||||
|
|||||||
@@ -3,13 +3,16 @@ package binnie.core.craftgui.minecraft.control;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
|
||||||
import binnie.core.craftgui.IWidget;
|
import binnie.core.craftgui.IWidget;
|
||||||
import binnie.core.craftgui.controls.core.Control;
|
import binnie.core.craftgui.controls.core.Control;
|
||||||
import binnie.core.craftgui.minecraft.InventoryType;
|
import binnie.core.craftgui.minecraft.InventoryType;
|
||||||
|
import binnie.core.network.packet.MessageCraftGUI;
|
||||||
|
|
||||||
public class ControlPlayerInventory extends Control {
|
public class ControlPlayerInventory extends Control {
|
||||||
|
|
||||||
private List<ControlSlot> slots;
|
private final List<ControlSlot> slots;
|
||||||
|
|
||||||
public ControlPlayerInventory(IWidget parent, boolean wide) {
|
public ControlPlayerInventory(IWidget parent, boolean wide) {
|
||||||
super(
|
super(
|
||||||
@@ -37,7 +40,6 @@ public class ControlPlayerInventory extends Control {
|
|||||||
slots.add(slot2);
|
slots.add(slot2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
create();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ControlPlayerInventory(IWidget parent) {
|
public ControlPlayerInventory(IWidget parent) {
|
||||||
@@ -53,32 +55,28 @@ public class ControlPlayerInventory extends Control {
|
|||||||
slots.add(slot);
|
slots.add(slot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
create();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void create() {
|
public ControlPlayerInventory create(NBTTagList actions) {
|
||||||
for (int row = 0; row < 3; ++row) {
|
for (int row = 0; row < 3; ++row) {
|
||||||
for (int column = 0; column < 9; ++column) {
|
for (int column = 0; column < 9; ++column) {
|
||||||
ControlSlot slot = slots.get(column + row * 9);
|
ControlSlot slot = slots.get(column + row * 9);
|
||||||
slot.assign(InventoryType.Player, 9 + column + row * 9);
|
slot.assign(actions, InventoryType.Player, 9 + column + row * 9);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i1 = 0; i1 < 9; ++i1) {
|
for (int i1 = 0; i1 < 9; ++i1) {
|
||||||
ControlSlot slot2 = slots.get(27 + i1);
|
ControlSlot slot2 = slots.get(27 + i1);
|
||||||
slot2.assign(InventoryType.Player, i1);
|
slot2.assign(actions, InventoryType.Player, i1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ControlSlot getSlot(int i) {
|
public ControlPlayerInventory createAndRegister() {
|
||||||
if (i < 0 || i >= slots.size()) {
|
final NBTTagList actions = new NBTTagList();
|
||||||
return null;
|
create(actions);
|
||||||
}
|
MessageCraftGUI.sendToServer(actions);
|
||||||
return slots.get(i);
|
return this;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onUpdateClient() {
|
|
||||||
// ignored
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loaded 100 of 400 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user