Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3af60db068 | ||
|
|
eb82a6a618 | ||
|
|
b2d41908b6 |
No files matched your search
@@ -32,7 +32,6 @@
|
|||||||
*.[dD][lL][lL] binary
|
*.[dD][lL][lL] binary
|
||||||
*.[dD][yY][lL][iI][bB] binary
|
*.[dD][yY][lL][iI][bB] binary
|
||||||
*.[pP][sS][dD] binary
|
*.[pP][sS][dD] binary
|
||||||
*.[pP][dD][nN] binary
|
|
||||||
*.[tT][tT][fF] binary
|
*.[tT][tT][fF] binary
|
||||||
*.[oO][tT][fF] binary
|
*.[oO][tT][fF] binary
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ name: Build and test
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ master, main, release/** ]
|
branches: [ master, main ]
|
||||||
push:
|
push:
|
||||||
branches: [ master, main, release/** ]
|
branches: [ master, main ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-test:
|
build-and-test:
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
name: Optimize images
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches: [ master, main, release/** ]
|
|
||||||
paths:
|
|
||||||
- "**/*.png"
|
|
||||||
|
|
||||||
push:
|
|
||||||
branches: [ master, main, release/** ]
|
|
||||||
paths:
|
|
||||||
- "**/*.png"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
optimize-images:
|
|
||||||
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/optimize-images.yml@master
|
|
||||||
secrets: inherit
|
|
||||||
@@ -28,7 +28,6 @@ whitelist.json
|
|||||||
*.iws
|
*.iws
|
||||||
src/main/resources/mixins.*([!.]).json
|
src/main/resources/mixins.*([!.]).json
|
||||||
*.bat
|
*.bat
|
||||||
*.sh
|
|
||||||
*.DS_Store
|
*.DS_Store
|
||||||
!gradlew.bat
|
!gradlew.bat
|
||||||
.factorypath
|
.factorypath
|
||||||
@@ -36,4 +35,4 @@ addon.local.gradle
|
|||||||
addon.local.gradle.kts
|
addon.local.gradle.kts
|
||||||
addon.late.local.gradle
|
addon.late.local.gradle
|
||||||
addon.late.local.gradle.kts
|
addon.late.local.gradle.kts
|
||||||
layout.json
|
layout.json
|
||||||
|
Before Width: | Height: | Size: 231 B |
|
Before Width: | Height: | Size: 204 B |
|
Before Width: | Height: | Size: 220 B |
|
Before Width: | Height: | Size: 220 B |
|
Before Width: | Height: | Size: 200 B |
|
Before Width: | Height: | Size: 222 B |
|
Before Width: | Height: | Size: 219 B |
@@ -1,12 +1,12 @@
|
|||||||
// Add your dependencies here
|
// Add your dependencies here
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api('com.github.GTNewHorizons:ForestryMC:4.11.39:dev')
|
api('com.github.GTNewHorizons:ForestryMC:4.8.2:dev')
|
||||||
implementation('com.github.GTNewHorizons:GTNHLib:0.11.54:dev')
|
implementation('com.github.GTNewHorizons:GTNHLib:0.2.1:dev')
|
||||||
|
|
||||||
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.8.162-GTNH:dev')
|
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.5.4-GTNH:dev')
|
||||||
|
|
||||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.64:api')
|
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.39: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")
|
||||||
}
|
}
|
||||||
@@ -1,135 +1,65 @@
|
|||||||
# ExampleMod tag to use as Blowdryer (Spotless, etc.) settings version, leave empty to disable.
|
|
||||||
# LOCAL to test local config updates.
|
|
||||||
gtnh.settings.blowdryerTag = 0.2.0
|
|
||||||
|
|
||||||
# Human-readable mod name, available for mcmod.info population.
|
|
||||||
modName = Binnie Core
|
modName = Binnie Core
|
||||||
|
|
||||||
# Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation.
|
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
|
||||||
# Conventionally lowercase.
|
|
||||||
modId = BinnieCore
|
modId = BinnieCore
|
||||||
|
|
||||||
# Root package of the mod, used to find various classes in other properties,
|
|
||||||
# mcmod.info substitution, enabling assertions in run tasks, etc.
|
|
||||||
modGroup = binnie
|
modGroup = binnie
|
||||||
|
|
||||||
# Whether to use modGroup as the maven publishing group.
|
# WHY is there no version field?
|
||||||
# When false, com.github.GTNewHorizons is used.
|
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
|
||||||
useModGroupForPublishing = false
|
# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
|
||||||
|
|
||||||
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
|
# Will update your build.gradle automatically whenever an update is available
|
||||||
autoUpdateBuildScript = false
|
autoUpdateBuildScript = false
|
||||||
|
|
||||||
# Version of Minecraft to target
|
|
||||||
minecraftVersion = 1.7.10
|
minecraftVersion = 1.7.10
|
||||||
|
|
||||||
# Version of Minecraft Forge to target
|
|
||||||
forgeVersion = 10.13.4.1614
|
forgeVersion = 10.13.4.1614
|
||||||
|
|
||||||
# Specify an MCP channel for dependency deobfuscation and the deobfParams task.
|
# Specify a MCP channel and mappings version for dependency deobfuscation and the deobfParams task.
|
||||||
channel = stable
|
channel = stable
|
||||||
|
|
||||||
# Specify an MCP mappings version for dependency deobfuscation and the deobfParams task.
|
|
||||||
mappingsVersion = 12
|
mappingsVersion = 12
|
||||||
|
|
||||||
# Defines other MCP mappings for dependency deobfuscation.
|
# Define other MCP mappings for dependency deobfuscation
|
||||||
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
|
remoteMappings = https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
|
||||||
|
|
||||||
# Select a default username for testing your mod. You can always override this per-run by running
|
# Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you
|
||||||
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
# restart Minecraft in development. Choose this dependent on your mod:
|
||||||
|
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
|
||||||
|
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
|
||||||
developmentEnvironmentUserName = Developer
|
developmentEnvironmentUserName = Developer
|
||||||
|
|
||||||
# Enables modern Java syntax support. Valid values:
|
# Define a source file of your project with:
|
||||||
# - false: No modern syntax, Java 8 only
|
|
||||||
# - jabel: Jabel syntax-only support, compiles to J8 bytecode
|
|
||||||
# - jvmDowngrader: Full modern Java via JVM Downgrader (syntax + stdlib APIs)
|
|
||||||
# - modern: Native modern Java bytecode, no downgrading
|
|
||||||
enableModernJavaSyntax = jabel
|
|
||||||
|
|
||||||
# If set, ignores the above setting and compiles with the given toolchain. This may cause unexpected issues,
|
|
||||||
# and should *not* be used in most situations. -1 disables this.
|
|
||||||
# forceToolchainVersion = -1
|
|
||||||
|
|
||||||
# Target JVM version for JVM Downgrader bytecode downgrading.
|
|
||||||
# Only used when enableModernJavaSyntax = jvmDowngrader
|
|
||||||
# downgradeTargetVersion = 8
|
|
||||||
|
|
||||||
# Comma-separated list of Java versions for multi-release jar support (JVM Downgrader only).
|
|
||||||
# Classes will be available in META-INF/versions/N/ for each version N in this list.
|
|
||||||
# Default: "21,25" (J25+ gets native classes, J21-24 gets partial downgrade, J8-20 gets full downgrade).
|
|
||||||
# jvmDowngraderMultiReleaseVersions = 21,25
|
|
||||||
|
|
||||||
# Specifies how JVM Downgrader API stubs are provided. Options:
|
|
||||||
# - shade: Shade minimized stubs into the jar
|
|
||||||
# - gtnhlib: GTNHLib provides stubs at runtime (adds version constraint)
|
|
||||||
# - external: Another dependency provides stubs (no constraint, no warning)
|
|
||||||
# - (empty): Warning reminding you to configure stubs
|
|
||||||
# Note: 'shade' option requires you to verify license compliance, see: https://github.com/unimined/JvmDowngrader/blob/main/LICENSE.md
|
|
||||||
# jvmDowngraderStubsProvider =
|
|
||||||
|
|
||||||
# Enables injecting missing generics into the decompiled source code for a better coding experience.
|
|
||||||
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
|
|
||||||
enableGenericInjection = true
|
|
||||||
|
|
||||||
# Generate a class with a String field for the mod version named as defined below.
|
|
||||||
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
|
|
||||||
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
|
|
||||||
generateGradleTokenClass = binnie.core.Tags
|
|
||||||
|
|
||||||
# Name of the token containing the project's current version to generate/replace.
|
|
||||||
gradleTokenVersion = VERSION
|
|
||||||
|
|
||||||
# [DEPRECATED] Mod ID replacement token.
|
|
||||||
gradleTokenModId =
|
|
||||||
|
|
||||||
# [DEPRECATED] Mod name replacement token.
|
|
||||||
gradleTokenModName =
|
|
||||||
|
|
||||||
# [DEPRECATED] Mod Group replacement token.
|
|
||||||
gradleTokenGroupName =
|
|
||||||
|
|
||||||
# [DEPRECATED]
|
|
||||||
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
|
|
||||||
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||||
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
|
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
|
||||||
# version in @Mod([...], version = VERSION, [...]).
|
# version in @Mod([...], version = VERSION, [...])
|
||||||
# Leave these properties empty to skip individual token replacements.
|
# Leave these properties empty to skip individual token replacements
|
||||||
replaceGradleTokenInFile =
|
replaceGradleTokenInFile = BinnieCore.java
|
||||||
|
gradleTokenModId =
|
||||||
|
gradleTokenModName =
|
||||||
|
gradleTokenVersion = GRADLETOKEN_VERSION
|
||||||
|
gradleTokenGroupName =
|
||||||
|
|
||||||
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
|
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
|
||||||
# leave this property empty.
|
# leave this property empty.
|
||||||
# Example value: (apiPackage = api) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.api
|
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
|
||||||
apiPackage =
|
apiPackage =
|
||||||
|
|
||||||
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
|
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
|
||||||
# There can be multiple files in a space-separated list.
|
# Example value: mymodid_at.cfg
|
||||||
# Example value: mymodid_at.cfg nei_at.cfg
|
|
||||||
accessTransformersFile =
|
accessTransformersFile =
|
||||||
|
|
||||||
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
||||||
usesMixins = false
|
usesMixins = false
|
||||||
|
# Adds some debug arguments like verbose output and export
|
||||||
# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
|
|
||||||
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
|
|
||||||
# Mixin classes will have access to "main" classes, but not the other way around.
|
|
||||||
separateMixinSourceSet =
|
|
||||||
|
|
||||||
# Adds some debug arguments like verbose output and class export.
|
|
||||||
usesMixinDebug = false
|
usesMixinDebug = false
|
||||||
|
|
||||||
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
||||||
mixinPlugin =
|
mixinPlugin =
|
||||||
|
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
|
||||||
# Specify the package that contains all of your Mixins. The package must exist or
|
|
||||||
# the build will fail. If you have a package property defined in your mixins.<modid>.json,
|
|
||||||
# it must match with this or the build will fail.
|
|
||||||
mixinsPackage =
|
mixinsPackage =
|
||||||
|
|
||||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||||
# This parameter is for legacy compatibility only
|
# This parameter is for legacy compatibility only
|
||||||
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
|
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
|
||||||
coreModClass =
|
coreModClass =
|
||||||
|
|
||||||
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
|
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
|
||||||
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
|
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
|
||||||
containsMixinsAndOrCoreModOnly = false
|
containsMixinsAndOrCoreModOnly = false
|
||||||
@@ -137,38 +67,15 @@ containsMixinsAndOrCoreModOnly = false
|
|||||||
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
|
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
|
||||||
forceEnableMixins = false
|
forceEnableMixins = false
|
||||||
|
|
||||||
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated into your jar. It is your
|
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your
|
||||||
# responsibility to check the license and request permission for distribution if required.
|
# responsibility check the licence and request permission for distribution, if required.
|
||||||
usesShadowedDependencies = false
|
usesShadowedDependencies = false
|
||||||
|
|
||||||
# If disabled, won't remove unused classes from shadowed dependencies. Some libraries use reflection to access
|
|
||||||
# their own classes, making the minimization unreliable.
|
|
||||||
minimizeShadowedDependencies = true
|
|
||||||
|
|
||||||
# If disabled, won't rename the shadowed classes.
|
# Publishing to modrinth requires you to set the MODRINTH_TOKEN environment variable to your current modrinth API token.
|
||||||
relocateShadowedDependencies = true
|
|
||||||
|
|
||||||
# Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
|
|
||||||
includeWellKnownRepositories = true
|
|
||||||
|
|
||||||
# A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated
|
|
||||||
# list of strings, with the acceptable keys being(case does not matter):
|
|
||||||
# cursemaven
|
|
||||||
# modrinth
|
|
||||||
excludeWellKnownRepositories =
|
|
||||||
|
|
||||||
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
|
|
||||||
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
|
|
||||||
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
|
|
||||||
usesMavenPublishing = true
|
|
||||||
|
|
||||||
# Maven repository to publish the mod to.
|
|
||||||
# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/
|
|
||||||
|
|
||||||
# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
|
|
||||||
#
|
|
||||||
# The project's ID on Modrinth. Can be either the slug or the ID.
|
# The project's ID on Modrinth. Can be either the slug or the ID.
|
||||||
# Leave this empty if you don't want to publish to Modrinth.
|
# Leave this empty if you don't want to publish on Modrinth.
|
||||||
modrinthProjectId =
|
modrinthProjectId =
|
||||||
|
|
||||||
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
|
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
|
||||||
@@ -177,64 +84,33 @@ modrinthProjectId =
|
|||||||
# type can be one of [project, version],
|
# type can be one of [project, version],
|
||||||
# and the name is the Modrinth project or version slug/id of the other mod.
|
# and the name is the Modrinth project or version slug/id of the other mod.
|
||||||
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
|
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
|
||||||
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
|
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
|
||||||
modrinthRelations =
|
modrinthRelations =
|
||||||
|
|
||||||
|
|
||||||
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
|
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
|
||||||
#
|
|
||||||
# The project's numeric ID on CurseForge. You can find this in the About Project box.
|
# The project's numeric ID on CurseForge. You can find this in the About Project box.
|
||||||
# Leave this empty if you don't want to publish on CurseForge.
|
# Leave this empty if you don't want to publish on CurseForge.
|
||||||
curseForgeProjectId =
|
curseForgeProjectId =
|
||||||
|
|
||||||
# Comma-separated supported CurseForge environments: client, server (case-insensitive).
|
|
||||||
# Use client or server for mods that only support one environment. Defaults to client,server.
|
|
||||||
# These tags describe where the mod can run, not whether installation is required on both sides.
|
|
||||||
curseForgeEnvironments = client,server
|
|
||||||
|
|
||||||
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
|
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
|
||||||
# Syntax: type1:name1;type2:name2;...
|
# Syntax: type1:name1;type2:name2;...
|
||||||
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
||||||
# and the name is the CurseForge project slug of the other mod.
|
# and the name is the CurseForge project slug of the other mod.
|
||||||
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
|
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
|
||||||
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
|
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
|
||||||
curseForgeRelations =
|
curseForgeRelations =
|
||||||
|
|
||||||
# Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older
|
|
||||||
|
# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
|
||||||
# projects. New projects should not use this parameter.
|
# projects. New projects should not use this parameter.
|
||||||
customArchiveBaseName = binnie-mods
|
customArchiveBaseName = binnie-mods
|
||||||
|
|
||||||
# Optional parameter to customize the default working directory used by the runClient* tasks. Relative to the project directory.
|
# Optional parameter to prevent the source code from being published
|
||||||
# runClientWorkingDirectory = run/client
|
# noPublishedSources =
|
||||||
|
|
||||||
# Optional parameter to customize the default working directory used by the runServer* tasks. Relative to the project directory.
|
# Uncomment this to disable spotless checks
|
||||||
# runServerWorkingDirectory = run/server
|
|
||||||
|
|
||||||
# Optional parameter to have the build automatically fail if an illegal version is used.
|
|
||||||
# This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'.
|
|
||||||
# The check is ONLY performed if the version is a git tag.
|
|
||||||
# Note: the specified string must be escaped, so e.g. 1\\.1\\.\\d+ instead of 1\.1\.\d+
|
|
||||||
# versionPattern =
|
|
||||||
|
|
||||||
# Uncomment to prevent the source code from being published.
|
|
||||||
# noPublishedSources = true
|
|
||||||
|
|
||||||
# Uncomment this to disable Spotless checks.
|
|
||||||
# This should only be uncommented to keep it easier to sync with upstream/other forks.
|
# This should only be uncommented to keep it easier to sync with upstream/other forks.
|
||||||
# That is, if there is no other active fork/upstream, NEVER change this.
|
# That is, if there is no other active fork/upstream, NEVER change this.
|
||||||
# disableSpotless = true
|
# disableSpotless = true
|
||||||
|
|
||||||
# Uncomment this to disable Checkstyle checks (currently wildcard import check).
|
|
||||||
# disableCheckstyle = true
|
|
||||||
|
|
||||||
# Override the IDEA build type. Valid values are: "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle"
|
|
||||||
# (force use delegated build).
|
|
||||||
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
|
||||||
# e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be native build.
|
|
||||||
# WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want!
|
|
||||||
# Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you.
|
|
||||||
# ideaOverrideBuildType = idea
|
|
||||||
|
|
||||||
# Whether IDEA should run spotless checks when pressing the Build button.
|
|
||||||
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
|
||||||
# ideaCheckSpotlessOnBuild = true
|
|
||||||
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#This file is generated by updateDaemonJvm
|
|
||||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
|
|
||||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
|
|
||||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
|
|
||||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
|
|
||||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/9064f22734b42ac03e85df04b632e167/redirect
|
|
||||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/4d0277c49991306ac78048580fe34bcf/redirect
|
|
||||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
|
|
||||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
|
|
||||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/a9fa3b809e484a1e1ac4308a5dda661a/redirect
|
|
||||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/aa99913fa6d767d899ffc96082da01ca/redirect
|
|
||||||
toolchainVersion=25
|
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
retries=0
|
|
||||||
retryBackOffMs=500
|
|
||||||
validateDistributionUrl=true
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright © 2015 the original authors.
|
# Copyright © 2015-2021 the original authors.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# you may not use this file except in compliance with the License.
|
||||||
@@ -15,12 +15,10 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
#
|
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
# gradlew start up script for POSIX generated by Gradle.
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
#
|
#
|
||||||
# Important for running:
|
# Important for running:
|
||||||
#
|
#
|
||||||
@@ -29,7 +27,7 @@
|
|||||||
# bash, then to run this script, type that shell name before the whole
|
# bash, then to run this script, type that shell name before the whole
|
||||||
# command line, like:
|
# command line, like:
|
||||||
#
|
#
|
||||||
# ksh gradlew
|
# ksh Gradle
|
||||||
#
|
#
|
||||||
# Busybox and similar reduced shells will NOT work, because this script
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
# requires all of these POSIX shell features:
|
# requires all of these POSIX shell features:
|
||||||
@@ -57,7 +55,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/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/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/.
|
||||||
@@ -86,7 +84,7 @@ done
|
|||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
# 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
|
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || 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
|
||||||
@@ -114,6 +112,7 @@ case "$( uname )" in #(
|
|||||||
NONSTOP* ) nonstop=true ;;
|
NONSTOP* ) nonstop=true ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
# Determine the Java command to use to start the JVM.
|
# Determine the Java command to use to start the JVM.
|
||||||
@@ -171,6 +170,7 @@ fi
|
|||||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
if "$cygwin" || "$msys" ; then
|
if "$cygwin" || "$msys" ; then
|
||||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
@@ -203,14 +203,15 @@ fi
|
|||||||
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 optsEnvironmentVar are not allowed to contain shell fragments,
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
# and any embedded shellness will be escaped.
|
# and any embedded shellness will be escaped.
|
||||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
# treated as '${Hostname}' itself on the command line.
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
set -- \
|
set -- \
|
||||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
-classpath "$CLASSPATH" \
|
||||||
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
"$@"
|
"$@"
|
||||||
|
|
||||||
# Stop when "xargs" is not available.
|
# Stop when "xargs" is not available.
|
||||||
|
|||||||
@@ -13,18 +13,16 @@
|
|||||||
@rem See the License for the specific language governing permissions and
|
@rem See the License for the specific language governing permissions and
|
||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
@rem SPDX-License-Identifier: Apache-2.0
|
|
||||||
@rem
|
|
||||||
|
|
||||||
@if "%DEBUG%"=="" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem gradlew startup script for Windows
|
@rem Gradle startup script for Windows
|
||||||
@rem
|
@rem
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
|
|
||||||
@rem Set local scope for the variables, and ensure extensions are enabled
|
@rem Set local scope for the variables with windows NT shell
|
||||||
setlocal EnableExtensions
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%"=="" set DIRNAME=.
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
@@ -45,13 +43,13 @@ 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. 1>&2
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
echo. 1>&2
|
echo.
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
echo location of your Java installation. 1>&2
|
echo location of your Java installation.
|
||||||
|
|
||||||
"%COMSPEC%" /c exit 1
|
goto fail
|
||||||
|
|
||||||
:findJavaFromJavaHome
|
:findJavaFromJavaHome
|
||||||
set JAVA_HOME=%JAVA_HOME:"=%
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
@@ -59,24 +57,36 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
|||||||
|
|
||||||
if exist "%JAVA_EXE%" goto execute
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo. 1>&2
|
echo.
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
echo. 1>&2
|
echo.
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
echo location of your Java installation. 1>&2
|
echo location of your Java installation.
|
||||||
|
|
||||||
"%COMSPEC%" /c exit 1
|
goto fail
|
||||||
|
|
||||||
:execute
|
:execute
|
||||||
@rem Setup the command line
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
@rem Execute gradlew
|
@rem Execute Gradle
|
||||||
@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||||
@rem which allows us to clear the local environment before executing the java command
|
|
||||||
endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
|
|
||||||
|
|
||||||
:exitWithErrorLevel
|
:end
|
||||||
@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
|
@rem End local scope for the variables with windows NT shell
|
||||||
"%COMSPEC%" /c exit %ERRORLEVEL%
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
||||||
@@ -6,7 +6,6 @@ pluginManagement {
|
|||||||
name "GTNH Maven"
|
name "GTNH Maven"
|
||||||
url "https://nexus.gtnewhorizons.com/repository/public/"
|
url "https://nexus.gtnewhorizons.com/repository/public/"
|
||||||
mavenContent {
|
mavenContent {
|
||||||
includeGroup("com.gtnewhorizons")
|
|
||||||
includeGroupByRegex("com\\.gtnewhorizons\\..+")
|
includeGroupByRegex("com\\.gtnewhorizons\\..+")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -17,5 +16,12 @@ pluginManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.34'
|
id 'com.diffplug.blowdryerSetup' version '1.7.1'
|
||||||
|
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' // Provides java toolchains
|
||||||
|
}
|
||||||
|
|
||||||
|
blowdryerSetup {
|
||||||
|
repoSubfolder 'gtnhShared'
|
||||||
|
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.2.0')
|
||||||
|
//devLocal '.' // Use this when testing config updates locally
|
||||||
}
|
}
|
||||||
@@ -5,15 +5,19 @@ import java.util.List;
|
|||||||
|
|
||||||
import binnie.core.ManagerBase;
|
import binnie.core.ManagerBase;
|
||||||
import binnie.core.genetics.ManagerGenetics;
|
import binnie.core.genetics.ManagerGenetics;
|
||||||
|
import binnie.core.item.ManagerItem;
|
||||||
import binnie.core.liquid.ManagerLiquid;
|
import binnie.core.liquid.ManagerLiquid;
|
||||||
import binnie.core.machines.ManagerMachine;
|
import binnie.core.machines.ManagerMachine;
|
||||||
|
import binnie.core.mod.config.ManagerConfig;
|
||||||
import binnie.core.resource.ManagerResource;
|
import binnie.core.resource.ManagerResource;
|
||||||
|
|
||||||
public final class Binnie {
|
public final class Binnie {
|
||||||
|
|
||||||
public static List<ManagerBase> Managers = new ArrayList<>();
|
public static List<ManagerBase> Managers = new ArrayList<>();
|
||||||
public static ManagerGenetics Genetics = new ManagerGenetics();
|
public static ManagerGenetics Genetics = new ManagerGenetics();
|
||||||
|
public static ManagerConfig Configuration = new ManagerConfig();
|
||||||
public static ManagerLiquid Liquid = new ManagerLiquid();
|
public static ManagerLiquid Liquid = new ManagerLiquid();
|
||||||
public static ManagerMachine Machine = new ManagerMachine();
|
public static ManagerMachine Machine = new ManagerMachine();
|
||||||
|
public static ManagerItem Item = new ManagerItem();
|
||||||
public static ManagerResource Resource = new ManagerResource();
|
public static ManagerResource Resource = new ManagerResource();
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,6 @@ 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;
|
||||||
@@ -40,7 +39,6 @@ import binnie.botany.network.PacketID;
|
|||||||
import binnie.botany.proxy.Proxy;
|
import binnie.botany.proxy.Proxy;
|
||||||
import binnie.core.AbstractMod;
|
import binnie.core.AbstractMod;
|
||||||
import binnie.core.BinnieCore;
|
import binnie.core.BinnieCore;
|
||||||
import binnie.core.Tags;
|
|
||||||
import binnie.core.gui.IBinnieGUID;
|
import binnie.core.gui.IBinnieGUID;
|
||||||
import binnie.core.item.ItemMisc;
|
import binnie.core.item.ItemMisc;
|
||||||
import binnie.core.network.BinniePacketHandler;
|
import binnie.core.network.BinniePacketHandler;
|
||||||
@@ -55,7 +53,12 @@ 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(modid = "Botany", name = "Botany", version = Tags.VERSION, useMetadata = true, dependencies = "after:BinnieCore")
|
@Mod(
|
||||||
|
modid = "Botany",
|
||||||
|
name = "Botany",
|
||||||
|
version = BinnieCore.VERSION,
|
||||||
|
useMetadata = true,
|
||||||
|
dependencies = "after:BinnieCore")
|
||||||
public class Botany extends AbstractMod {
|
public class Botany extends AbstractMod {
|
||||||
|
|
||||||
@Mod.Instance("Botany")
|
@Mod.Instance("Botany")
|
||||||
@@ -64,41 +67,35 @@ public class Botany extends AbstractMod {
|
|||||||
@SidedProxy(clientSide = "binnie.botany.proxy.ProxyClient", serverSide = "binnie.botany.proxy.ProxyServer")
|
@SidedProxy(clientSide = "binnie.botany.proxy.ProxyClient", serverSide = "binnie.botany.proxy.ProxyServer")
|
||||||
public static Proxy proxy;
|
public static Proxy proxy;
|
||||||
|
|
||||||
// Genetics module
|
|
||||||
public static BlockFlower flower;
|
public static BlockFlower flower;
|
||||||
|
|
||||||
public static ItemFlower flowerItem;
|
|
||||||
public static Item pollen;
|
|
||||||
public static Item seed;
|
public static Item seed;
|
||||||
|
public static Item pollen;
|
||||||
public static ItemDictionary database;
|
public static ItemDictionary database;
|
||||||
|
|
||||||
// Gardening module
|
|
||||||
public static BlockPlant plant;
|
public static BlockPlant plant;
|
||||||
|
public static ItemTrowel trowelWood;
|
||||||
|
public static ItemTrowel trowelStone;
|
||||||
|
public static ItemTrowel trowelIron;
|
||||||
|
public static ItemTrowel trowelDiamond;
|
||||||
|
public static ItemTrowel trowelGold;
|
||||||
public static BlockSoil soil;
|
public static BlockSoil soil;
|
||||||
public static BlockSoil loam;
|
public static BlockSoil loam;
|
||||||
public static BlockSoil flowerbed;
|
public static BlockSoil flowerbed;
|
||||||
public static BlockSoil soilNoWeed;
|
public static BlockSoil soilNoWeed;
|
||||||
public static BlockSoil loamNoWeed;
|
public static BlockSoil loamNoWeed;
|
||||||
public static BlockSoil flowerbedNoWeed;
|
public static BlockSoil flowerbedNoWeed;
|
||||||
public static BlockCeramic ceramic;
|
|
||||||
public static BlockStained stained;
|
|
||||||
public static BlockCeramicPatterned ceramicTile;
|
|
||||||
public static BlockCeramicBrick ceramicBrick;
|
|
||||||
|
|
||||||
public static ItemSoilMeter soilMeter;
|
|
||||||
public static ItemInsulatedTube insulatedTube;
|
public static ItemInsulatedTube insulatedTube;
|
||||||
public static ItemTrowel trowelWood;
|
public static ItemSoilMeter soilMeter;
|
||||||
public static ItemTrowel trowelStone;
|
|
||||||
public static ItemTrowel trowelIron;
|
|
||||||
public static ItemTrowel trowelDiamond;
|
|
||||||
public static ItemTrowel trowelGold;
|
|
||||||
public static ItemMisc misc;
|
public static ItemMisc misc;
|
||||||
|
public static ItemFlower flowerItem;
|
||||||
public static ItemPigment pigment;
|
public static ItemPigment pigment;
|
||||||
public static ItemClay clay;
|
public static ItemClay clay;
|
||||||
|
public static BlockCeramic ceramic;
|
||||||
|
public static BlockCeramicPatterned ceramicTile;
|
||||||
|
public static BlockStained stained;
|
||||||
|
public static BlockCeramicBrick ceramicBrick;
|
||||||
|
|
||||||
public Botany() {
|
public Botany() {
|
||||||
Botany.instance = this;
|
Botany.instance = this;
|
||||||
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
@@ -124,6 +121,11 @@ public class Botany extends AbstractMod {
|
|||||||
return BotanyGUI.values();
|
return BotanyGUI.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<?>[] getConfigs() {
|
||||||
|
return new Class[0];
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPacketID[] getPacketIDs() {
|
public IPacketID[] getPacketIDs() {
|
||||||
return PacketID.values();
|
return PacketID.values();
|
||||||
@@ -149,6 +151,120 @@ 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)
|
||||||
@@ -182,6 +298,27 @@ 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()) {
|
||||||
@@ -212,138 +349,4 @@ 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -6,11 +6,6 @@ public enum EnumAcidity {
|
|||||||
NEUTRAL,
|
NEUTRAL,
|
||||||
ALKALINE;
|
ALKALINE;
|
||||||
|
|
||||||
/**
|
|
||||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
|
||||||
*/
|
|
||||||
public static final EnumAcidity[] VALUES = values();
|
|
||||||
|
|
||||||
public String getID() {
|
public String getID() {
|
||||||
return name().toLowerCase();
|
return name().toLowerCase();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,11 +24,7 @@ public enum EnumFlowerChromosome implements IChromosomeType {
|
|||||||
SAPPINESS(IAlleleFloat.class),
|
SAPPINESS(IAlleleFloat.class),
|
||||||
STEM(IAlleleInteger.class);
|
STEM(IAlleleInteger.class);
|
||||||
|
|
||||||
/**
|
private Class<? extends IAllele> cls;
|
||||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
|
||||||
*/
|
|
||||||
public static final EnumFlowerChromosome[] VALUES = values();
|
|
||||||
private final Class<? extends IAllele> cls;
|
|
||||||
|
|
||||||
EnumFlowerChromosome(Class<? extends IAllele> cls) {
|
EnumFlowerChromosome(Class<? extends IAllele> cls) {
|
||||||
this.cls = cls;
|
this.cls = cls;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ public enum EnumFlowerStage {
|
|||||||
POLLEN("Pollen"),
|
POLLEN("Pollen"),
|
||||||
NONE("NONE");
|
NONE("NONE");
|
||||||
|
|
||||||
private final String name;
|
protected String name;
|
||||||
|
|
||||||
EnumFlowerStage(String name) {
|
EnumFlowerStage(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|||||||
@@ -6,11 +6,6 @@ public enum EnumMoisture {
|
|||||||
NORMAL,
|
NORMAL,
|
||||||
DAMP;
|
DAMP;
|
||||||
|
|
||||||
/**
|
|
||||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
|
||||||
*/
|
|
||||||
public static final EnumMoisture[] VALUES = values();
|
|
||||||
|
|
||||||
public String getID() {
|
public String getID() {
|
||||||
return name().toLowerCase();
|
return name().toLowerCase();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,11 +6,6 @@ public enum EnumSoilType {
|
|||||||
LOAM,
|
LOAM,
|
||||||
FLOWERBED;
|
FLOWERBED;
|
||||||
|
|
||||||
/**
|
|
||||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
|
||||||
*/
|
|
||||||
public static final EnumSoilType[] VALUES = values();
|
|
||||||
|
|
||||||
public String getID() {
|
public String getID() {
|
||||||
return name().toLowerCase();
|
return name().toLowerCase();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public class BlockCeramic extends Block implements IBlockMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addBlockTooltip(ItemStack stack, List<String> tooltip) {
|
public void addBlockTooltip(ItemStack stack, List tooltip) {
|
||||||
int meta = TileEntityMetadata.getItemDamage(stack);
|
int meta = TileEntityMetadata.getItemDamage(stack);
|
||||||
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(meta).getName());
|
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(meta).getName());
|
||||||
}
|
}
|
||||||
@@ -92,8 +92,8 @@ public class BlockCeramic extends Block implements IBlockMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item item, CreativeTabs tabs, List<ItemStack> itemList) {
|
public void getSubBlocks(Item item, CreativeTabs tabs, List itemList) {
|
||||||
for (EnumFlowerColor c : EnumFlowerColor.VALUES) {
|
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||||
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
|
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addBlockTooltip(ItemStack itemStack, List<String> tooltip) {
|
public void addBlockTooltip(ItemStack itemStack, List tooltip) {
|
||||||
int meta = TileEntityMetadata.getItemDamage(itemStack);
|
int meta = TileEntityMetadata.getItemDamage(itemStack);
|
||||||
getType(meta).addTooltip(tooltip);
|
getType(meta).addTooltip(tooltip);
|
||||||
}
|
}
|
||||||
@@ -101,13 +101,13 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> itemList) {
|
public void getSubBlocks(Item item, CreativeTabs tab, List itemList) {
|
||||||
for (EnumFlowerColor c : EnumFlowerColor.VALUES) {
|
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||||
BlockType type = new BlockType(c, c, TileType.Tile);
|
BlockType type = new BlockType(c, c, TileType.Tile);
|
||||||
itemList.add(TileEntityMetadata.getItemStack(this, type.ordinal()));
|
itemList.add(TileEntityMetadata.getItemStack(this, type.ordinal()));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (TileType type2 : TileType.VALUES) {
|
for (TileType type2 : TileType.values()) {
|
||||||
if (type2.canDouble()) {
|
if (type2.canDouble()) {
|
||||||
itemList.add(new BlockType(EnumFlowerColor.BROWN, EnumFlowerColor.GOLD, type2).getStack(1));
|
itemList.add(new BlockType(EnumFlowerColor.BROWN, EnumFlowerColor.GOLD, type2).getStack(1));
|
||||||
}
|
}
|
||||||
@@ -130,13 +130,13 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getIcon(int side, int meta) {
|
public IIcon getIcon(int side, int meta) {
|
||||||
return TileType.get(meta >>> 16 & 0xFF).icons[MultipassBlockRenderer.getLayer()];
|
return getType(meta).getIcon(MultipassBlockRenderer.getLayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister register) {
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
for (TileType type : TileType.VALUES) {
|
for (TileType type : TileType.values()) {
|
||||||
for (int i = 0; i < 3; ++i) {
|
for (int i = 0; i < 3; ++i) {
|
||||||
type.icons[i] = Botany.proxy.getIcon(register, "ceramic." + type.id + "." + i);
|
type.icons[i] = Botany.proxy.getIcon(register, "ceramic." + type.id + "." + i);
|
||||||
}
|
}
|
||||||
@@ -167,9 +167,6 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
|||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int getRenderColor(int meta) {
|
public int getRenderColor(int meta) {
|
||||||
if (!MultipassBlockRenderer.isRendering()) {
|
|
||||||
return EnumFlowerColor.get(meta & 0xFF).getColor(false);
|
|
||||||
}
|
|
||||||
return colorMultiplier(meta);
|
return colorMultiplier(meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,14 +177,14 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int colorMultiplier(int meta) {
|
public int colorMultiplier(int meta) {
|
||||||
int layer = MultipassBlockRenderer.getLayer();
|
BlockType type = getType(meta);
|
||||||
if (layer == 0) {
|
if (MultipassBlockRenderer.getLayer() == 0) {
|
||||||
return 0xffffff;
|
return 0xffffff;
|
||||||
}
|
}
|
||||||
if (layer == 1) {
|
if (MultipassBlockRenderer.getLayer() == 1) {
|
||||||
return EnumFlowerColor.get(meta & 0xFF).getColor(false);
|
return type.color1.getColor(false);
|
||||||
}
|
}
|
||||||
return EnumFlowerColor.get(meta >>> 8 & 0xFF).getColor(false);
|
return type.color2.getColor(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -208,13 +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;
|
||||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
protected String name;
|
||||||
*/
|
protected IIcon[] icons;
|
||||||
public static final TileType[] VALUES = values();
|
|
||||||
private final String id;
|
|
||||||
private final String name;
|
|
||||||
private final IIcon[] icons;
|
|
||||||
|
|
||||||
TileType(String id, String name) {
|
TileType(String id, String name) {
|
||||||
icons = new IIcon[3];
|
icons = new IIcon[3];
|
||||||
@@ -223,7 +216,7 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static TileType get(int id) {
|
public static TileType get(int id) {
|
||||||
return VALUES[id % VALUES.length];
|
return values()[id % values().length];
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canDouble() {
|
public boolean canDouble() {
|
||||||
@@ -231,15 +224,32 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getRecipe(List<ItemStack> stacks) {
|
public ItemStack getRecipe(List<ItemStack> stacks) {
|
||||||
return switch (this) {
|
switch (this) {
|
||||||
case Tile -> getTileRecipe(stacks);
|
case Tile:
|
||||||
case Split -> getSplitRecipe(stacks);
|
return getTileRecipe(stacks);
|
||||||
case Chequered -> getChequeredRecipe(stacks);
|
|
||||||
case Mixed -> getMixedRecipe(stacks);
|
case Split:
|
||||||
case LargeBrick -> getLargeBrickRecipe(stacks);
|
return getSplitRecipe(stacks);
|
||||||
case Brick, StripeBrick -> getBrickRecipe(stacks);
|
|
||||||
case VerticalLargeBrick, VerticalBrick, VerticalStripeBrick -> getVerticalBrickRecipe(stacks);
|
case Chequered:
|
||||||
};
|
return getChequeredRecipe(stacks);
|
||||||
|
|
||||||
|
case Mixed:
|
||||||
|
return getMixedRecipe(stacks);
|
||||||
|
|
||||||
|
case LargeBrick:
|
||||||
|
return getLargeBrickRecipe(stacks);
|
||||||
|
|
||||||
|
case Brick:
|
||||||
|
case StripeBrick:
|
||||||
|
return getBrickRecipe(stacks);
|
||||||
|
|
||||||
|
case VerticalLargeBrick:
|
||||||
|
case VerticalBrick:
|
||||||
|
case VerticalStripeBrick:
|
||||||
|
return getVerticalBrickRecipe(stacks);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ItemStack getTileRecipe(List<ItemStack> stacks) {
|
private ItemStack getTileRecipe(List<ItemStack> stacks) {
|
||||||
@@ -531,7 +541,7 @@ public class BlockCeramicBrick extends Block implements IBlockMetadata, IMultipa
|
|||||||
return I18N.localise("botany." + type.name);
|
return I18N.localise("botany." + type.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addTooltip(List<String> tooltip) {
|
public void addTooltip(List tooltip) {
|
||||||
String name = color1.getName();
|
String name = color1.getName();
|
||||||
if (type.canDouble() && color2 != color1) {
|
if (type.canDouble() && color2 != color1) {
|
||||||
name = I18N.localise("botany.colour.double", name, color2.getName());
|
name = I18N.localise("botany.colour.double", name, color2.getName());
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class BlockCeramicPatterned extends BlockDesign {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addBlockTooltip(ItemStack stack, List<String> tooltip) {
|
public void addBlockTooltip(ItemStack stack, List tooltip) {
|
||||||
super.addBlockTooltip(stack, tooltip);
|
super.addBlockTooltip(stack, tooltip);
|
||||||
DesignBlock block = ModuleCarpentry.getDesignBlock(getDesignSystem(), TileEntityMetadata.getItemDamage(stack));
|
DesignBlock block = ModuleCarpentry.getDesignBlock(getDesignSystem(), TileEntityMetadata.getItemDamage(stack));
|
||||||
tooltip.add(EnumChatFormatting.GRAY + block.getDesign().getName());
|
tooltip.add(EnumChatFormatting.GRAY + block.getDesign().getName());
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ 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");
|
||||||
}
|
}
|
||||||
@@ -112,7 +111,7 @@ public class BlockStained extends Block implements IBlockMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addBlockTooltip(ItemStack itemStack, List<String> tooltip) {
|
public void addBlockTooltip(ItemStack itemStack, List tooltip) {
|
||||||
int meta = TileEntityMetadata.getItemDamage(itemStack);
|
int meta = TileEntityMetadata.getItemDamage(itemStack);
|
||||||
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(meta).getName());
|
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(meta).getName());
|
||||||
}
|
}
|
||||||
@@ -123,8 +122,8 @@ public class BlockStained extends Block implements IBlockMetadata {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> itemList) {
|
public void getSubBlocks(Item item, CreativeTabs tab, List itemList) {
|
||||||
for (EnumFlowerColor c : EnumFlowerColor.VALUES) {
|
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||||
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
|
itemList.add(TileEntityMetadata.getItemStack(this, c.ordinal()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class CeramicColor implements IDesignMaterial {
|
|||||||
|
|
||||||
static {
|
static {
|
||||||
CeramicColor.map = new LinkedHashMap<>();
|
CeramicColor.map = new LinkedHashMap<>();
|
||||||
for (EnumFlowerColor c : EnumFlowerColor.VALUES) {
|
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||||
CeramicColor.map.put(c, new CeramicColor(c));
|
CeramicColor.map.put(c, new CeramicColor(c));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public class CeramicDesignSystem implements IDesignSystem {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerIcons(IIconRegister register) {
|
public void registerIcons(IIconRegister register) {
|
||||||
for (EnumPattern pattern : EnumPattern.VALUES) {
|
for (EnumPattern pattern : EnumPattern.values()) {
|
||||||
primary.put(
|
primary.put(
|
||||||
pattern.ordinal(),
|
pattern.ordinal(),
|
||||||
BinnieCore.proxy.getIcon(
|
BinnieCore.proxy.getIcon(
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class CeramicTileRecipe implements IRecipe {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (BlockCeramicBrick.TileType type : BlockCeramicBrick.TileType.VALUES) {
|
for (BlockCeramicBrick.TileType type : BlockCeramicBrick.TileType.values()) {
|
||||||
ItemStack stack2 = type.getRecipe(stacks);
|
ItemStack stack2 = type.getRecipe(stacks);
|
||||||
if (stack2 != null) {
|
if (stack2 != null) {
|
||||||
return stack2;
|
return stack2;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public class PigmentRecipe implements IRecipe {
|
|||||||
|
|
||||||
protected ItemStack cached;
|
protected ItemStack cached;
|
||||||
|
|
||||||
private final ItemStack unknown;
|
private ItemStack unknown;
|
||||||
|
|
||||||
public PigmentRecipe() {
|
public PigmentRecipe() {
|
||||||
unknown = null;
|
unknown = null;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import binnie.core.craftgui.controls.listbox.ControlListBox;
|
|||||||
|
|
||||||
public class ControlColorMixBox extends ControlListBox<IColourMix> {
|
public class ControlColorMixBox extends ControlListBox<IColourMix> {
|
||||||
|
|
||||||
private final Type type;
|
private 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Type {
|
enum Type {
|
||||||
Resultant,
|
Resultant,
|
||||||
Further
|
Further
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ public class WindowBotanistDatabase extends WindowAbstractDatabase {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
List<IFlowerColor> colors = new ArrayList<>();
|
List<IFlowerColor> colors = new ArrayList<>();
|
||||||
Collections.addAll(colors, EnumFlowerColor.VALUES);
|
Collections.addAll(colors, EnumFlowerColor.values());
|
||||||
listBox.setOptions(colors);
|
listBox.setOptions(colors);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ import forestry.api.farming.IFarmHousing;
|
|||||||
|
|
||||||
public class CircuitGarden extends BinnieCircuit {
|
public class CircuitGarden extends BinnieCircuit {
|
||||||
|
|
||||||
private final boolean isManual;
|
private boolean isManual;
|
||||||
private final boolean isFertilised;
|
private boolean isFertilised;
|
||||||
private final ItemStack icon;
|
private ItemStack icon;
|
||||||
private final EnumMoisture moisture;
|
private EnumMoisture moisture;
|
||||||
private final EnumAcidity acidity;
|
private 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.isEmpty()) {
|
if (info.length() > 0) {
|
||||||
info += ", ";
|
info += ", ";
|
||||||
}
|
}
|
||||||
info += EnumChatFormatting.RED + I18N.localise("botany.ph.acid") + EnumChatFormatting.RESET;
|
info += EnumChatFormatting.RED + I18N.localise("botany.ph.acid") + EnumChatFormatting.RESET;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (acidity == EnumAcidity.NEUTRAL) {
|
if (acidity == EnumAcidity.NEUTRAL) {
|
||||||
if (!info.isEmpty()) {
|
if (info.length() > 0) {
|
||||||
info += ", ";
|
info += ", ";
|
||||||
}
|
}
|
||||||
info += EnumChatFormatting.GREEN + I18N.localise("botany.ph.neutral") + EnumChatFormatting.RESET;
|
info += EnumChatFormatting.GREEN + I18N.localise("botany.ph.neutral") + EnumChatFormatting.RESET;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (acidity == EnumAcidity.ALKALINE) {
|
if (acidity == EnumAcidity.ALKALINE) {
|
||||||
if (!info.isEmpty()) {
|
if (info.length() > 0) {
|
||||||
info += ", ";
|
info += ", ";
|
||||||
}
|
}
|
||||||
info += EnumChatFormatting.AQUA + I18N.localise("botany.ph.alkaline") + EnumChatFormatting.RESET;
|
info += EnumChatFormatting.AQUA + I18N.localise("botany.ph.alkaline") + EnumChatFormatting.RESET;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!info.isEmpty()) {
|
if (info.length() > 0) {
|
||||||
info = " (" + info + EnumChatFormatting.RESET + ")";
|
info = " (" + info + EnumChatFormatting.RESET + ")";
|
||||||
}
|
}
|
||||||
addTooltipString(I18N.localise("botany.circuit.flowers") + info);
|
addTooltipString(I18N.localise("botany.circuit.flowers") + info);
|
||||||
@@ -101,4 +101,8 @@ public class CircuitGarden extends BinnieCircuit {
|
|||||||
((IFarmHousing) tile).resetFarmLogic(FarmDirection.values()[slot]);
|
((IFarmHousing) tile).resetFarmLogic(FarmDirection.values()[slot]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTick(int arg0, Object arg1) {
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -129,7 +129,7 @@ public class GardenLogic extends FarmLogic {
|
|||||||
if (pH.ordinal() < acidity.ordinal()) {
|
if (pH.ordinal() < acidity.ordinal()) {
|
||||||
ItemStack stack = getAvailableAlkaline();
|
ItemStack stack = getAvailableAlkaline();
|
||||||
if (stack != null && soil
|
if (stack != null && soil
|
||||||
.setPH(world, position.x, position.y, position.z, EnumAcidity.VALUES[pH.ordinal() + 1])) {
|
.setPH(world, position.x, position.y, position.z, EnumAcidity.values()[pH.ordinal() + 1])) {
|
||||||
housing.getFarmInventory().removeResources(new ItemStack[] { stack });
|
housing.getFarmInventory().removeResources(new ItemStack[] { stack });
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -138,7 +138,7 @@ public class GardenLogic extends FarmLogic {
|
|||||||
if (pH.ordinal() > acidity.ordinal()) {
|
if (pH.ordinal() > acidity.ordinal()) {
|
||||||
ItemStack stack = getAvailableAcid();
|
ItemStack stack = getAvailableAcid();
|
||||||
if (stack != null && soil
|
if (stack != null && soil
|
||||||
.setPH(world, position.x, position.y, position.z, EnumAcidity.VALUES[pH.ordinal() - 1])) {
|
.setPH(world, position.x, position.y, position.z, EnumAcidity.values()[pH.ordinal() - 1])) {
|
||||||
housing.getFarmInventory().removeResources(new ItemStack[] { stack });
|
housing.getFarmInventory().removeResources(new ItemStack[] { stack });
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -359,7 +359,8 @@ public class GardenLogic extends FarmLogic {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
IOwnable housing2 = (IOwnable) housing;
|
IOwnable housing2 = (IOwnable) housing;
|
||||||
GameProfile prof = (GameProfile) IOwnable.class.getMethod("getOwnerProfile").invoke(housing2);
|
GameProfile prof = (GameProfile) IOwnable.class.getMethod("getOwnerProfile", new Class[0])
|
||||||
|
.invoke(housing2);
|
||||||
((TileEntityFlower) tile).setOwner(prof);
|
((TileEntityFlower) tile).setOwner(prof);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
// ignored
|
// ignored
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public class BlockFlower extends BlockContainer {
|
|||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister register) {
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
for (EnumFlowerType type : EnumFlowerType.VALUES) {
|
for (EnumFlowerType type : EnumFlowerType.values()) {
|
||||||
type.registerIcons(register);
|
type.registerIcons(register);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -85,7 +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 instanceof TileEntityFlower) {
|
if (flower != null && flower instanceof TileEntityFlower) {
|
||||||
IFlower f = BotanyCore.getFlowerRoot().getMember(stack);
|
IFlower f = BotanyCore.getFlowerRoot().getMember(stack);
|
||||||
((TileEntityFlower) flower).setRender(new TileEntityFlower.RenderInfo(f, (TileEntityFlower) flower));
|
((TileEntityFlower) flower).setRender(new TileEntityFlower.RenderInfo(f, (TileEntityFlower) flower));
|
||||||
}
|
}
|
||||||
@@ -93,7 +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 instanceof TileEntityFlower) {
|
if (flower != null && flower instanceof TileEntityFlower) {
|
||||||
if (below instanceof TileEntityFlower) {
|
if (below instanceof TileEntityFlower) {
|
||||||
((TileEntityFlower) flower).setSection(((TileEntityFlower) below).getSection());
|
((TileEntityFlower) flower).setSection(((TileEntityFlower) below).getSection());
|
||||||
} else {
|
} else {
|
||||||
@@ -108,14 +108,15 @@ public class BlockFlower extends BlockContainer {
|
|||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||||
TileEntity tile = world.getTileEntity(x, y, z);
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
if (!(tile instanceof TileEntityFlower tileFlower)) {
|
if (!(tile instanceof TileEntityFlower)) {
|
||||||
return super.getIcon(world, x, y, z, side);
|
return super.getIcon(world, x, y, z, side);
|
||||||
}
|
}
|
||||||
|
|
||||||
EnumFlowerStage stage = (tileFlower.getAge() == 0) ? EnumFlowerStage.SEED : EnumFlowerStage.FLOWER;
|
TileEntityFlower f = (TileEntityFlower) tile;
|
||||||
IFlowerType flower = tileFlower.getType();
|
EnumFlowerStage stage = (f.getAge() == 0) ? EnumFlowerStage.SEED : EnumFlowerStage.FLOWER;
|
||||||
int section = tileFlower.getRenderSection();
|
IFlowerType flower = f.getType();
|
||||||
boolean flowered = tileFlower.isFlowered();
|
int section = f.getRenderSection();
|
||||||
|
boolean flowered = f.isFlowered();
|
||||||
if (RendererBotany.pass == 0) {
|
if (RendererBotany.pass == 0) {
|
||||||
return flower.getStem(stage, flowered, section);
|
return flower.getStem(stage, flowered, section);
|
||||||
}
|
}
|
||||||
@@ -128,11 +129,12 @@ public class BlockFlower extends BlockContainer {
|
|||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
||||||
TileEntity tile = world.getTileEntity(x, y, z);
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
if (tile instanceof TileEntityFlower tileFlower) {
|
if (tile instanceof TileEntityFlower) {
|
||||||
|
TileEntityFlower f = (TileEntityFlower) tile;
|
||||||
if (RendererBotany.pass == 0) {
|
if (RendererBotany.pass == 0) {
|
||||||
return tileFlower.getStemColour();
|
return f.getStemColour();
|
||||||
}
|
}
|
||||||
return (RendererBotany.pass == 1) ? tileFlower.getPrimaryColor() : tileFlower.getSecondaryColor();
|
return (RendererBotany.pass == 1) ? f.getPrimaryColor() : f.getSecondaryColor();
|
||||||
}
|
}
|
||||||
return 0xffffff;
|
return 0xffffff;
|
||||||
}
|
}
|
||||||
@@ -151,13 +153,14 @@ public class BlockFlower extends BlockContainer {
|
|||||||
super.onNeighborBlockChange(world, x, y, z, block);
|
super.onNeighborBlockChange(world, x, y, z, block);
|
||||||
checkAndDropBlock(world, x, y, z);
|
checkAndDropBlock(world, x, y, z);
|
||||||
TileEntity tile = world.getTileEntity(x, y, z);
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
if (!(tile instanceof TileEntityFlower tileFlower)) {
|
if (!(tile instanceof TileEntityFlower)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tileFlower.getSection() == 0 && tileFlower.getFlower() != null
|
TileEntityFlower flower = (TileEntityFlower) tile;
|
||||||
&& tileFlower.getFlower().getAge() > 0
|
if (flower.getSection() == 0 && flower.getFlower() != null
|
||||||
&& tileFlower.getFlower().getGenome().getPrimary().getType().getSections() > 1
|
&& flower.getFlower().getAge() > 0
|
||||||
|
&& flower.getFlower().getGenome().getPrimary().getType().getSections() > 1
|
||||||
&& world.getBlock(x, y + 1, z) != Botany.flower) {
|
&& world.getBlock(x, y + 1, z) != Botany.flower) {
|
||||||
dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||||
world.setBlockToAir(x, y, z);
|
world.setBlockToAir(x, y, z);
|
||||||
@@ -209,7 +212,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.isEmpty()
|
&& drops.size() > 0
|
||||||
&& (player == null || !player.capabilities.isCreativeMode)) {
|
&& (player == null || !player.capabilities.isCreativeMode)) {
|
||||||
for (ItemStack drop : drops) {
|
for (ItemStack drop : drops) {
|
||||||
dropBlockAsItem(world, x, y, z, drop);
|
dropBlockAsItem(world, x, y, z, drop);
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package binnie.botany.flower;
|
package binnie.botany.flower;
|
||||||
|
|
||||||
import static cpw.mods.fml.common.registry.GameRegistry.registerItem;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@@ -11,8 +9,6 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.nbt.NBTTagList;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumChatFormatting;
|
import net.minecraft.util.EnumChatFormatting;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
@@ -21,25 +17,18 @@ import net.minecraft.world.World;
|
|||||||
import binnie.Binnie;
|
import binnie.Binnie;
|
||||||
import binnie.botany.Botany;
|
import binnie.botany.Botany;
|
||||||
import binnie.botany.CreativeTabBotany;
|
import binnie.botany.CreativeTabBotany;
|
||||||
import binnie.botany.api.EnumFlowerChromosome;
|
|
||||||
import binnie.botany.api.EnumFlowerStage;
|
import binnie.botany.api.EnumFlowerStage;
|
||||||
import binnie.botany.api.IAlleleFlowerSpecies;
|
|
||||||
import binnie.botany.api.IFlower;
|
import binnie.botany.api.IFlower;
|
||||||
import binnie.botany.api.IFlowerColor;
|
import binnie.botany.api.IFlowerColor;
|
||||||
import binnie.botany.api.IFlowerGenome;
|
import binnie.botany.api.IFlowerGenome;
|
||||||
import binnie.botany.api.IFlowerType;
|
import binnie.botany.api.IFlowerType;
|
||||||
import binnie.botany.core.BotanyCore;
|
import binnie.botany.core.BotanyCore;
|
||||||
import binnie.botany.genetics.AlleleColor;
|
|
||||||
import binnie.botany.genetics.EnumFlowerColor;
|
|
||||||
import binnie.botany.genetics.EnumFlowerType;
|
import binnie.botany.genetics.EnumFlowerType;
|
||||||
import binnie.botany.genetics.Flower;
|
import binnie.botany.genetics.Flower;
|
||||||
import binnie.botany.genetics.FlowerSpecies;
|
|
||||||
import binnie.core.BinnieCore;
|
import binnie.core.BinnieCore;
|
||||||
import binnie.core.util.I18N;
|
import binnie.core.util.I18N;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import forestry.api.genetics.AlleleManager;
|
|
||||||
import forestry.api.genetics.IAllele;
|
|
||||||
import forestry.api.genetics.IIndividual;
|
import forestry.api.genetics.IIndividual;
|
||||||
import forestry.api.genetics.IPollinatable;
|
import forestry.api.genetics.IPollinatable;
|
||||||
import forestry.core.config.Config;
|
import forestry.core.config.Config;
|
||||||
@@ -50,8 +39,6 @@ public abstract class ItemBotany extends Item {
|
|||||||
setCreativeTab(CreativeTabBotany.instance);
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
setUnlocalizedName(name);
|
setUnlocalizedName(name);
|
||||||
hasSubtypes = true;
|
hasSubtypes = true;
|
||||||
|
|
||||||
registerItem(this, getUnlocalizedName().substring(5));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -70,31 +57,9 @@ public abstract class ItemBotany extends Item {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static IAllele getRenderAllele(ItemStack stack, EnumFlowerChromosome chromosome, boolean active) {
|
@Override
|
||||||
if (stack == null || !stack.hasTagCompound()) return null;
|
public boolean getShareTag() {
|
||||||
|
return true;
|
||||||
NBTTagCompound genome = stack.getTagCompound().getCompoundTag("Genome");
|
|
||||||
NBTTagList chromosomes = genome.getTagList("Chromosomes", 10);
|
|
||||||
int slot = chromosome.ordinal();
|
|
||||||
NBTTagCompound chromosomeTag = null;
|
|
||||||
for (int index = chromosomes.tagCount() - 1; index >= 0; index--) {
|
|
||||||
NBTTagCompound candidate = chromosomes.getCompoundTagAt(index);
|
|
||||||
if (candidate.getByte("Slot") == slot) {
|
|
||||||
chromosomeTag = candidate;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (chromosomeTag == null) return null;
|
|
||||||
|
|
||||||
Class<? extends IAllele> alleleClass = chromosome.getAlleleClass();
|
|
||||||
IAllele primary = AlleleManager.alleleRegistry.getAllele(chromosomeTag.getString("UID0"));
|
|
||||||
if (!alleleClass.isInstance(primary)) return null;
|
|
||||||
IAllele secondary = AlleleManager.alleleRegistry.getAllele(chromosomeTag.getString("UID1"));
|
|
||||||
if (!alleleClass.isInstance(secondary)) return null;
|
|
||||||
if (!active) return primary;
|
|
||||||
|
|
||||||
if (primary.isDominant()) return primary;
|
|
||||||
return secondary.isDominant() ? secondary : primary;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -103,17 +68,12 @@ public abstract class ItemBotany extends Item {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
IAllele allele = getRenderAllele(stack, EnumFlowerChromosome.SPECIES, false);
|
|
||||||
if (allele instanceof IAlleleFlowerSpecies species) {
|
|
||||||
return species.hasEffect();
|
|
||||||
}
|
|
||||||
|
|
||||||
IIndividual individual = getIndividual(stack);
|
IIndividual individual = getIndividual(stack);
|
||||||
return individual != null && individual.getGenome() != null && individual.hasEffect();
|
return individual != null && individual.getGenome() != null && individual.hasEffect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(ItemStack itemstack, EntityPlayer player, List<String> tooltip, boolean flag) {
|
public void addInformation(ItemStack itemstack, EntityPlayer player, List tooltip, boolean flag) {
|
||||||
if (!itemstack.hasTagCompound()) {
|
if (!itemstack.hasTagCompound()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -178,11 +138,11 @@ public abstract class ItemBotany extends Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List<ItemStack> itemList) {
|
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
||||||
addCreativeItems(itemList, true);
|
addCreativeItems(itemList, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addCreativeItems(List<ItemStack> itemList, boolean hideSecrets) {
|
public void addCreativeItems(List itemList, boolean hideSecrets) {
|
||||||
for (IIndividual individual : BotanyCore.speciesRoot.getIndividualTemplates()) {
|
for (IIndividual individual : BotanyCore.speciesRoot.getIndividualTemplates()) {
|
||||||
if (hideSecrets && individual.isSecret() && !Config.isDebug) {
|
if (hideSecrets && individual.isSecret() && !Config.isDebug) {
|
||||||
continue;
|
continue;
|
||||||
@@ -193,17 +153,6 @@ public abstract class ItemBotany extends Item {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getColorFromItemStack(ItemStack itemstack, int renderPass) {
|
public int getColorFromItemStack(ItemStack itemstack, int renderPass) {
|
||||||
if (!itemstack.hasTagCompound()) {
|
|
||||||
return (renderPass == 0 ? EnumFlowerColor.GREEN : EnumFlowerColor.RED).getColor(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
EnumFlowerChromosome chromosome = renderPass == 0 ? EnumFlowerChromosome.STEM
|
|
||||||
: renderPass == 1 ? EnumFlowerChromosome.PRIMARY : EnumFlowerChromosome.SECONDARY;
|
|
||||||
IAllele allele = getRenderAllele(itemstack, chromosome, true);
|
|
||||||
if (allele instanceof AlleleColor color) {
|
|
||||||
return color.getColor().getColor(itemstack.getTagCompound().getBoolean("Wilt"));
|
|
||||||
}
|
|
||||||
|
|
||||||
IFlower flower = BotanyCore.speciesRoot.getMember(itemstack);
|
IFlower flower = BotanyCore.speciesRoot.getMember(itemstack);
|
||||||
if (flower == null || flower.getGenome() == null) {
|
if (flower == null || flower.getGenome() == null) {
|
||||||
return 0xffffff;
|
return 0xffffff;
|
||||||
@@ -229,32 +178,19 @@ public abstract class ItemBotany extends Item {
|
|||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(ItemStack itemstack, int renderPass) {
|
public IIcon getIcon(ItemStack itemstack, int renderPass) {
|
||||||
IAlleleFlowerSpecies species = FlowerSpecies.POPPY;
|
IFlower flower = BotanyCore.speciesRoot.getMember(itemstack);
|
||||||
boolean flowered = false;
|
if (flower == null || flower.getGenome() == null || flower.getGenome().getPrimary() == null) {
|
||||||
|
return EnumFlowerType.ALLIUM.getBlank();
|
||||||
if (itemstack.hasTagCompound()) {
|
|
||||||
IAllele allele = getRenderAllele(itemstack, EnumFlowerChromosome.SPECIES, false);
|
|
||||||
if (allele instanceof IAlleleFlowerSpecies flowerSpecies) {
|
|
||||||
species = flowerSpecies;
|
|
||||||
flowered = itemstack.getTagCompound().getBoolean("Flowered");
|
|
||||||
} else {
|
|
||||||
IFlower flower = BotanyCore.speciesRoot.getMember(itemstack);
|
|
||||||
if (flower == null || flower.getGenome() == null || flower.getGenome().getPrimary() == null) {
|
|
||||||
return EnumFlowerType.ALLIUM.getBlank();
|
|
||||||
}
|
|
||||||
species = flower.getGenome().getPrimary();
|
|
||||||
flowered = flower.hasFlowered();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IFlowerType type = species.getType();
|
IFlowerType type = flower.getGenome().getPrimary().getType();
|
||||||
if (renderPass == 0) {
|
if (renderPass == 0) {
|
||||||
return type.getStem(getStage(), flowered, type.getSections() - 1);
|
return type.getStem(getStage(), flower.hasFlowered(), type.getSections() - 1);
|
||||||
}
|
}
|
||||||
if (renderPass == 1) {
|
if (renderPass == 1) {
|
||||||
return type.getPetalIcon(getStage(), flowered, type.getSections() - 1);
|
return type.getPetalIcon(getStage(), flower.hasFlowered(), type.getSections() - 1);
|
||||||
}
|
}
|
||||||
return type.getVariantIcon(getStage(), flowered, type.getSections() - 1);
|
return type.getVariantIcon(getStage(), flower.hasFlowered(), type.getSections() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -263,9 +199,10 @@ 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 pollinatable)) {
|
if (!(target instanceof IPollinatable)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
IPollinatable pollinatable = (IPollinatable) target;
|
||||||
if (!pollinatable.canMateWith(flower)) {
|
if (!pollinatable.canMateWith(flower)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package binnie.botany.flower;
|
package binnie.botany.flower;
|
||||||
|
|
||||||
import static cpw.mods.fml.common.registry.GameRegistry.registerItem;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
@@ -27,8 +25,6 @@ public class ItemInsulatedTube extends Item {
|
|||||||
setUnlocalizedName("insulatedTube");
|
setUnlocalizedName("insulatedTube");
|
||||||
setCreativeTab(CreativeTabBotany.instance);
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
setHasSubtypes(true);
|
setHasSubtypes(true);
|
||||||
|
|
||||||
registerItem(this, getUnlocalizedName().substring(5));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemStack getInsulateStack(ItemStack stack) {
|
public static ItemStack getInsulateStack(ItemStack stack) {
|
||||||
@@ -37,9 +33,9 @@ public class ItemInsulatedTube extends Item {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
|
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||||
for (Material mat : Material.VALUES) {
|
for (Material mat : Material.values()) {
|
||||||
for (Insulate ins : Insulate.VALUES) {
|
for (Insulate ins : Insulate.values()) {
|
||||||
list.add(new ItemStack(this, 1, mat.ordinal() + ins.ordinal() * 128));
|
list.add(new ItemStack(this, 1, mat.ordinal() + ins.ordinal() * 128));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -65,7 +61,7 @@ public class ItemInsulatedTube extends Item {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced) {
|
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||||
super.addInformation(stack, player, tooltip, advanced);
|
super.addInformation(stack, player, tooltip, advanced);
|
||||||
tooltip.add(Insulate.get(stack.getItemDamage()).getName());
|
tooltip.add(Insulate.get(stack.getItemDamage()).getName());
|
||||||
}
|
}
|
||||||
@@ -97,10 +93,8 @@ public class ItemInsulatedTube extends Item {
|
|||||||
Bronze(0xddc276, "bronze"),
|
Bronze(0xddc276, "bronze"),
|
||||||
Iron(0xd8d8d8, "iron");
|
Iron(0xd8d8d8, "iron");
|
||||||
|
|
||||||
public static final Material[] VALUES = values();
|
protected int color;
|
||||||
|
protected String name;
|
||||||
private final int color;
|
|
||||||
private final String name;
|
|
||||||
|
|
||||||
Material(int color, String name) {
|
Material(int color, String name) {
|
||||||
this.color = color;
|
this.color = color;
|
||||||
@@ -108,7 +102,7 @@ public class ItemInsulatedTube extends Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Material get(int i) {
|
public static Material get(int i) {
|
||||||
return VALUES[i % VALUES.length];
|
return values()[i % values().length];
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getColor() {
|
public int getColor() {
|
||||||
@@ -129,10 +123,8 @@ public class ItemInsulatedTube extends Item {
|
|||||||
Stone(0x6d6d6d, "smoothStone"),
|
Stone(0x6d6d6d, "smoothStone"),
|
||||||
Sandstone(0xc1b989, "sandstone");
|
Sandstone(0xc1b989, "sandstone");
|
||||||
|
|
||||||
public static final Insulate[] VALUES = values();
|
protected int color;
|
||||||
|
protected String name;
|
||||||
private final int color;
|
|
||||||
private final String name;
|
|
||||||
|
|
||||||
Insulate(int color, String name) {
|
Insulate(int color, String name) {
|
||||||
this.color = color;
|
this.color = color;
|
||||||
@@ -140,7 +132,7 @@ public class ItemInsulatedTube extends Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Insulate get(int i) {
|
public static Insulate get(int i) {
|
||||||
return VALUES[i / 128 % VALUES.length];
|
return values()[i / 128 % values().length];
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getColor() {
|
public int getColor() {
|
||||||
@@ -152,14 +144,26 @@ public class ItemInsulatedTube extends Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getStack() {
|
public ItemStack getStack() {
|
||||||
return switch (this) {
|
switch (this) {
|
||||||
case Clay -> new ItemStack(Blocks.clay);
|
case Clay:
|
||||||
case Cobble -> new ItemStack(Blocks.cobblestone);
|
return new ItemStack(Blocks.clay);
|
||||||
case HardenedClay -> new ItemStack(Blocks.hardened_clay);
|
|
||||||
case Sand -> new ItemStack(Blocks.sand);
|
case Cobble:
|
||||||
case Sandstone -> new ItemStack(Blocks.sandstone);
|
return new ItemStack(Blocks.cobblestone);
|
||||||
case Stone -> new ItemStack(Blocks.stone);
|
|
||||||
};
|
case HardenedClay:
|
||||||
|
return new ItemStack(Blocks.hardened_clay);
|
||||||
|
|
||||||
|
case Sand:
|
||||||
|
return new ItemStack(Blocks.sand);
|
||||||
|
|
||||||
|
case Sandstone:
|
||||||
|
return new ItemStack(Blocks.sandstone);
|
||||||
|
|
||||||
|
case Stone:
|
||||||
|
return new ItemStack(Blocks.stone);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -25,8 +25,9 @@ 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 * 3129871L ^ z * 116129781L;
|
long i1 = x * 3129871 ^ z * 116129781L;
|
||||||
i1 = i1 * i1 * 42317861L + i1 * 11L;
|
i1 = i1 * i1 * 42317861L + i1 * 11L;
|
||||||
d1 += ((i1 >> 16 & 0xFL) / 15.0f - 0.5) * 0.3;
|
d1 += ((i1 >> 16 & 0xFL) / 15.0f - 0.5) * 0.3;
|
||||||
d3 += ((i1 >> 24 & 0xFL) / 15.0f - 0.5) * 0.3;
|
d3 += ((i1 >> 24 & 0xFL) / 15.0f - 0.5) * 0.3;
|
||||||
@@ -45,7 +46,7 @@ public class RendererBotany implements ISimpleBlockRenderingHandler {
|
|||||||
}
|
}
|
||||||
tessellator.setColorOpaque_F(f, f2, f3);
|
tessellator.setColorOpaque_F(f, f2, f3);
|
||||||
IIcon iicon = block.getIcon(world, x, y, z, 0);
|
IIcon iicon = block.getIcon(world, x, y, z, 0);
|
||||||
renderer.drawCrossedSquares(iicon, d1, y, d3, 1.0f);
|
renderer.drawCrossedSquares(iicon, d1, d2, d3, 1.0f);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ 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 {
|
||||||
|
|
||||||
@@ -213,7 +212,11 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
flower.setWilted(!canTolerate || light < 1.0f);
|
if (!canTolerate || light < 1.0f) {
|
||||||
|
flower.setWilted(true);
|
||||||
|
} else {
|
||||||
|
flower.setWilted(false);
|
||||||
|
}
|
||||||
|
|
||||||
float chanceDispersal = 0.8f;
|
float chanceDispersal = 0.8f;
|
||||||
chanceDispersal += 0.2f * flower.getGenome().getFertility();
|
chanceDispersal += 0.2f * flower.getGenome().getFertility();
|
||||||
@@ -298,7 +301,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 (!newInfo.equals(renderInfo)) {
|
if (renderInfo == null || !newInfo.equals(renderInfo)) {
|
||||||
setRender(newInfo);
|
setRender(newInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -453,7 +456,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) > PluginLepidopterology.spawnConstraint) {
|
if (worldObj.countEntities(EntityButterfly.class) > 100) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!spawn.canSpawn(worldObj, x, y, z)) {
|
if (!spawn.canSpawn(worldObj, x, y, z)) {
|
||||||
@@ -615,7 +618,8 @@ public class TileEntityFlower extends TileEntity implements IPollinatable, IButt
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj instanceof RenderInfo o) {
|
if (obj instanceof RenderInfo) {
|
||||||
|
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
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class BlockPlant extends BlockBush {
|
|||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister register) {
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
for (Type t : Type.VALUES) {
|
for (Type t : Type.values()) {
|
||||||
t.icon = Botany.proxy.getIcon(register, t.name().toLowerCase());
|
t.icon = Botany.proxy.getIcon(register, t.name().toLowerCase());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -61,7 +61,7 @@ public class BlockPlant extends BlockBush {
|
|||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(int side, int meta) {
|
public IIcon getIcon(int side, int meta) {
|
||||||
return Type.VALUES[meta % Type.VALUES.length].icon;
|
return Type.values()[meta % Type.values().length].icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -71,8 +71,8 @@ public class BlockPlant extends BlockBush {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> list) {
|
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||||
for (Type type : Type.VALUES) {
|
for (Type type : Type.values()) {
|
||||||
list.add(type.get());
|
list.add(type.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -135,17 +135,16 @@ public class BlockPlant extends BlockBush {
|
|||||||
DeadFlower("deadFlower"),
|
DeadFlower("deadFlower"),
|
||||||
DecayingFlower("decayingFlower");
|
DecayingFlower("decayingFlower");
|
||||||
|
|
||||||
public static final Type[] VALUES = values();
|
|
||||||
public IIcon icon;
|
public IIcon icon;
|
||||||
|
|
||||||
private final String name;
|
protected String name;
|
||||||
|
|
||||||
Type(String name) {
|
Type(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Type get(int id) {
|
public static Type get(int id) {
|
||||||
return VALUES[id % VALUES.length];
|
return values()[id % values().length];
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack get() {
|
public ItemStack get() {
|
||||||
|
|||||||
@@ -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<ItemStack> list) {
|
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||||
for (int i = 0; i < 9; ++i) {
|
for (int i = 0; i < 9; ++i) {
|
||||||
list.add(new ItemStack(this, 1, i));
|
list.add(new ItemStack(this, 1, i));
|
||||||
}
|
}
|
||||||
@@ -81,8 +81,8 @@ public class BlockSoil extends Block implements IBlockSoil {
|
|||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister register) {
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
for (EnumMoisture moisture : EnumMoisture.VALUES) {
|
for (EnumMoisture moisture : EnumMoisture.values()) {
|
||||||
for (EnumAcidity pH : EnumAcidity.VALUES) {
|
for (EnumAcidity pH : EnumAcidity.values()) {
|
||||||
int index = moisture.ordinal() + pH.ordinal() * 3;
|
int index = moisture.ordinal() + pH.ordinal() * 3;
|
||||||
String id = "soil/" + getType().getID() + "." + pH.getID() + "." + moisture.getID();
|
String id = "soil/" + getType().getID() + "." + pH.getID() + "." + moisture.getID();
|
||||||
iconsTop[index] = Botany.proxy.getIcon(register, id + ".0");
|
iconsTop[index] = Botany.proxy.getIcon(register, id + ".0");
|
||||||
@@ -104,8 +104,8 @@ public class BlockSoil extends Block implements IBlockSoil {
|
|||||||
@Override
|
@Override
|
||||||
public void updateTick(World world, int x, int y, int z, Random random) {
|
public void updateTick(World world, int x, int y, int z, Random random) {
|
||||||
int meta = world.getBlockMetadata(x, y, z);
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
EnumMoisture moisture = EnumMoisture.VALUES[meta % 3];
|
EnumMoisture moisture = EnumMoisture.values()[meta % 3];
|
||||||
EnumAcidity acidity = EnumAcidity.VALUES[meta / 3];
|
EnumAcidity acidity = EnumAcidity.values()[meta / 3];
|
||||||
EnumMoisture desiredMoisture = Gardening.getNaturalMoisture(world, x, y, z);
|
EnumMoisture desiredMoisture = Gardening.getNaturalMoisture(world, x, y, z);
|
||||||
if (desiredMoisture.ordinal() > moisture.ordinal()) {
|
if (desiredMoisture.ordinal() > moisture.ordinal()) {
|
||||||
moisture = ((moisture == EnumMoisture.DRY) ? EnumMoisture.NORMAL : EnumMoisture.DAMP);
|
moisture = ((moisture == EnumMoisture.DRY) ? EnumMoisture.NORMAL : EnumMoisture.DAMP);
|
||||||
@@ -141,12 +141,12 @@ public class BlockSoil extends Block implements IBlockSoil {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumAcidity getPH(World world, int x, int y, int z) {
|
public EnumAcidity getPH(World world, int x, int y, int z) {
|
||||||
return EnumAcidity.VALUES[world.getBlockMetadata(x, y, z) / 3];
|
return EnumAcidity.values()[world.getBlockMetadata(x, y, z) / 3];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumMoisture getMoisture(World world, int x, int y, int z) {
|
public EnumMoisture getMoisture(World world, int x, int y, int z) {
|
||||||
return EnumMoisture.VALUES[world.getBlockMetadata(x, y, z) % 3];
|
return EnumMoisture.values()[world.getBlockMetadata(x, y, z) % 3];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -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.5f;
|
bias -= 1.5;
|
||||||
} else if (world.getBlock(x + dx, y, z + dz) == Blocks.water) {
|
} else if (world.getBlock(x + dx, y, z + dz) == Blocks.water) {
|
||||||
bias += 1.5f;
|
bias += 1.5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (world.isRaining() && world.canBlockSeeTheSky(x, y + 1, z) && world.getPrecipitationHeight(x, z) <= y + 1) {
|
if (world.isRaining() && world.canBlockSeeTheSky(x, y + 1, z) && world.getPrecipitationHeight(x, z) <= y + 1) {
|
||||||
bias += 1.5f;
|
bias += 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int dx = -1; dx < 2; ++dx) {
|
for (int dx = -1; dx < 2; ++dx) {
|
||||||
@@ -118,13 +118,13 @@ public class Gardening {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final TileEntity tile = world.getTileEntity(x, y, z);
|
TileEntity tileFlower = world.getTileEntity(x, y, z);
|
||||||
final TileEntity below = world.getTileEntity(x, y - 1, z);
|
TileEntity below = world.getTileEntity(x, y - 1, z);
|
||||||
if (tile instanceof TileEntityFlower tileFlower) {
|
if (tileFlower != null && tileFlower instanceof TileEntityFlower) {
|
||||||
if (below instanceof TileEntityFlower lowerFlower) {
|
if (below instanceof TileEntityFlower) {
|
||||||
tileFlower.setSection(lowerFlower.getSection());
|
((TileEntityFlower) tileFlower).setSection(((TileEntityFlower) below).getSection());
|
||||||
} else {
|
} else {
|
||||||
tileFlower.create(flower, owner);
|
((TileEntityFlower) tileFlower).create(flower, owner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ public class Gardening {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TileEntity flower = world.getTileEntity(x, y, z);
|
TileEntity flower = world.getTileEntity(x, y, z);
|
||||||
if (!(flower instanceof TileEntityFlower)) {
|
if (flower == null || !(flower instanceof TileEntityFlower)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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 instanceof TileEntityFlower) {
|
if (tileFlower != null && tileFlower instanceof TileEntityFlower) {
|
||||||
((TileEntityFlower) tileFlower).setSection(section + 1);
|
((TileEntityFlower) tileFlower).setSection(section + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -233,8 +233,8 @@ public class Gardening {
|
|||||||
BiomeGenBase biome = world.getBiomeGenForCoords(x, z);
|
BiomeGenBase biome = world.getBiomeGenForCoords(x, z);
|
||||||
return canTolerate(
|
return canTolerate(
|
||||||
flower,
|
flower,
|
||||||
EnumAcidity.VALUES[soilMeta / 3 % 3],
|
EnumAcidity.values()[soilMeta / 3 % 3],
|
||||||
EnumMoisture.VALUES[soilMeta % 3],
|
EnumMoisture.values()[soilMeta % 3],
|
||||||
EnumTemperature.getFromValue(biome.temperature));
|
EnumTemperature.getFromValue(biome.temperature));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,11 +250,14 @@ public class Gardening {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Block getSoilBlock(EnumSoilType type, boolean weedkill) {
|
public static Block getSoilBlock(EnumSoilType type, boolean weedkill) {
|
||||||
return switch (type) {
|
switch (type) {
|
||||||
case FLOWERBED -> weedkill ? Botany.flowerbedNoWeed : Botany.flowerbed;
|
case FLOWERBED:
|
||||||
case LOAM -> weedkill ? Botany.loamNoWeed : Botany.loam;
|
return weedkill ? Botany.flowerbedNoWeed : Botany.flowerbed;
|
||||||
default -> weedkill ? Botany.soilNoWeed : Botany.soil;
|
|
||||||
};
|
case LOAM:
|
||||||
|
return weedkill ? Botany.loamNoWeed : Botany.loam;
|
||||||
|
}
|
||||||
|
return weedkill ? Botany.soilNoWeed : Botany.soil;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean canTolerate(IFlower flower, EnumAcidity ePH, EnumMoisture eMoisture, EnumTemperature eTemp) {
|
public static boolean canTolerate(IFlower flower, EnumAcidity ePH, EnumMoisture eMoisture, EnumTemperature eTemp) {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class ItemSoil extends ItemBlock {
|
|||||||
|
|
||||||
protected EnumSoilType type;
|
protected EnumSoilType type;
|
||||||
|
|
||||||
private final boolean noWeed;
|
private boolean noWeed;
|
||||||
|
|
||||||
public ItemSoil(Block block) {
|
public ItemSoil(Block block) {
|
||||||
super(block);
|
super(block);
|
||||||
@@ -31,10 +31,10 @@ public class ItemSoil extends ItemBlock {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced) {
|
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||||
super.addInformation(stack, player, tooltip, advanced);
|
super.addInformation(stack, player, tooltip, advanced);
|
||||||
EnumMoisture moisture = EnumMoisture.VALUES[stack.getItemDamage() % 3];
|
EnumMoisture moisture = EnumMoisture.values()[stack.getItemDamage() % 3];
|
||||||
EnumAcidity acidity = EnumAcidity.VALUES[stack.getItemDamage() / 3];
|
EnumAcidity acidity = EnumAcidity.values()[stack.getItemDamage() / 3];
|
||||||
String info = "";
|
String info = "";
|
||||||
|
|
||||||
if (moisture == EnumMoisture.DRY) {
|
if (moisture == EnumMoisture.DRY) {
|
||||||
@@ -45,20 +45,20 @@ public class ItemSoil extends ItemBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (acidity == EnumAcidity.ACID) {
|
if (acidity == EnumAcidity.ACID) {
|
||||||
if (!info.isEmpty()) {
|
if (info.length() > 0) {
|
||||||
info += ", ";
|
info += ", ";
|
||||||
}
|
}
|
||||||
info += EnumChatFormatting.YELLOW + I18N.localise("botany.ph.acid") + EnumChatFormatting.RESET;
|
info += EnumChatFormatting.YELLOW + I18N.localise("botany.ph.acid") + EnumChatFormatting.RESET;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (acidity == EnumAcidity.ALKALINE) {
|
if (acidity == EnumAcidity.ALKALINE) {
|
||||||
if (!info.isEmpty()) {
|
if (info.length() > 0) {
|
||||||
info += ", ";
|
info += ", ";
|
||||||
}
|
}
|
||||||
info += EnumChatFormatting.YELLOW + I18N.localise("botany.ph.alkaline") + EnumChatFormatting.RESET;
|
info += EnumChatFormatting.YELLOW + I18N.localise("botany.ph.alkaline") + EnumChatFormatting.RESET;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!info.isEmpty()) {
|
if (info.length() > 0) {
|
||||||
tooltip.add(info);
|
tooltip.add(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package binnie.botany.gardening;
|
package binnie.botany.gardening;
|
||||||
|
|
||||||
import static cpw.mods.fml.common.registry.GameRegistry.registerItem;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@@ -30,8 +28,6 @@ public class ItemSoilMeter extends Item {
|
|||||||
setCreativeTab(CreativeTabBotany.instance);
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
setUnlocalizedName("soilMeter");
|
setUnlocalizedName("soilMeter");
|
||||||
setMaxStackSize(1);
|
setMaxStackSize(1);
|
||||||
|
|
||||||
registerItem(this, getUnlocalizedName().substring(5));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package binnie.botany.gardening;
|
package binnie.botany.gardening;
|
||||||
|
|
||||||
import static cpw.mods.fml.common.registry.GameRegistry.registerItem;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@@ -30,8 +28,6 @@ public class ItemTrowel extends Item {
|
|||||||
setCreativeTab(CreativeTabBotany.instance);
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
setUnlocalizedName("trowel" + material);
|
setUnlocalizedName("trowel" + material);
|
||||||
locName = "trowel" + material;
|
locName = "trowel" + material;
|
||||||
|
|
||||||
registerItem(this, getUnlocalizedName().substring(5));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public class ItemWeed extends ItemBlock {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getItemStackDisplayName(ItemStack stack) {
|
public String getItemStackDisplayName(ItemStack stack) {
|
||||||
return BlockPlant.Type.VALUES[stack.getItemDamage()].getName();
|
return BlockPlant.Type.values()[stack.getItemDamage()].getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import net.minecraftforge.oredict.RecipeSorter;
|
|||||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||||
|
|
||||||
|
import binnie.Binnie;
|
||||||
import binnie.botany.Botany;
|
import binnie.botany.Botany;
|
||||||
import binnie.botany.CreativeTabBotany;
|
import binnie.botany.CreativeTabBotany;
|
||||||
import binnie.botany.api.EnumAcidity;
|
import binnie.botany.api.EnumAcidity;
|
||||||
@@ -36,7 +37,6 @@ import binnie.core.block.ItemMetadata;
|
|||||||
import binnie.core.block.ItemMetadataRenderer;
|
import binnie.core.block.ItemMetadataRenderer;
|
||||||
import binnie.core.block.MultipassItemRenderer;
|
import binnie.core.block.MultipassItemRenderer;
|
||||||
import binnie.core.block.TileEntityMetadata;
|
import binnie.core.block.TileEntityMetadata;
|
||||||
import binnie.core.item.ItemMisc;
|
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
|
|
||||||
public class ModuleGardening implements IInitializable {
|
public class ModuleGardening implements IInitializable {
|
||||||
@@ -75,7 +75,7 @@ public class ModuleGardening implements IInitializable {
|
|||||||
Botany.trowelIron = new ItemTrowel(Item.ToolMaterial.IRON, "Iron");
|
Botany.trowelIron = new ItemTrowel(Item.ToolMaterial.IRON, "Iron");
|
||||||
Botany.trowelDiamond = new ItemTrowel(Item.ToolMaterial.EMERALD, "Diamond");
|
Botany.trowelDiamond = new ItemTrowel(Item.ToolMaterial.EMERALD, "Diamond");
|
||||||
Botany.trowelGold = new ItemTrowel(Item.ToolMaterial.GOLD, "Gold");
|
Botany.trowelGold = new ItemTrowel(Item.ToolMaterial.GOLD, "Gold");
|
||||||
Botany.misc = new ItemMisc(CreativeTabBotany.instance, BotanyItems.values());
|
Botany.misc = Binnie.Item.registerMiscItems(BotanyItems.values(), CreativeTabBotany.instance);
|
||||||
Botany.pigment = new ItemPigment();
|
Botany.pigment = new ItemPigment();
|
||||||
Botany.clay = new ItemClay();
|
Botany.clay = new ItemClay();
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ public class ModuleGardening implements IInitializable {
|
|||||||
|
|
||||||
for (boolean manual : new boolean[] { true, false }) {
|
for (boolean manual : new boolean[] { true, false }) {
|
||||||
for (boolean fertilised : new boolean[] { true, false }) {
|
for (boolean fertilised : new boolean[] { true, false }) {
|
||||||
for (EnumMoisture moist : EnumMoisture.VALUES) {
|
for (EnumMoisture moist : EnumMoisture.values()) {
|
||||||
ItemStack icon = (moist == EnumMoisture.DRY) ? yellow
|
ItemStack icon = (moist == EnumMoisture.DRY) ? yellow
|
||||||
: ((moist == EnumMoisture.NORMAL) ? red : blue);
|
: ((moist == EnumMoisture.NORMAL) ? red : blue);
|
||||||
int insulate = 2 - moist.ordinal();
|
int insulate = 2 - moist.ordinal();
|
||||||
@@ -258,7 +258,7 @@ public class ModuleGardening implements IInitializable {
|
|||||||
GameRegistry
|
GameRegistry
|
||||||
.addRecipe(BotanyItems.Mortar.get(6), " c ", "cgc", " c ", 'c', Items.clay_ball, 'g', Blocks.gravel);
|
.addRecipe(BotanyItems.Mortar.get(6), " c ", "cgc", " c ", 'c', Items.clay_ball, 'g', Blocks.gravel);
|
||||||
|
|
||||||
for (EnumFlowerColor c : EnumFlowerColor.VALUES) {
|
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||||
ItemStack clay = new ItemStack(Botany.clay, 1, c.ordinal());
|
ItemStack clay = new ItemStack(Botany.clay, 1, c.ordinal());
|
||||||
ItemStack pigment = new ItemStack(Botany.pigment, 1, c.ordinal());
|
ItemStack pigment = new ItemStack(Botany.pigment, 1, c.ordinal());
|
||||||
GameRegistry.addShapelessRecipe(clay, Items.clay_ball, Items.clay_ball, Items.clay_ball, pigment);
|
GameRegistry.addShapelessRecipe(clay, Items.clay_ball, Items.clay_ball, Items.clay_ball, pigment);
|
||||||
@@ -276,9 +276,9 @@ public class ModuleGardening implements IInitializable {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new ItemStack(
|
return new ItemStack(
|
||||||
Gardening.getSoilBlock(EnumSoilType.VALUES[type]),
|
Gardening.getSoilBlock(EnumSoilType.values()[type]),
|
||||||
1,
|
1,
|
||||||
BlockSoil.getMeta(EnumAcidity.VALUES[pH], EnumMoisture.VALUES[moisture]));
|
BlockSoil.getMeta(EnumAcidity.values()[pH], EnumMoisture.values()[moisture]));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addAcidFertiliser(ItemStack stack, int strengthMax) {
|
private void addAcidFertiliser(ItemStack stack, int strengthMax) {
|
||||||
|
|||||||
@@ -4,9 +4,10 @@ import forestry.api.genetics.IAlleleInteger;
|
|||||||
|
|
||||||
public class AlleleColor implements IAlleleInteger {
|
public class AlleleColor implements IAlleleInteger {
|
||||||
|
|
||||||
private final String uid;
|
private String uid;
|
||||||
private final int value;
|
private int value;
|
||||||
private final EnumFlowerColor color;
|
private EnumFlowerColor color;
|
||||||
|
private boolean dominant = true;
|
||||||
|
|
||||||
public AlleleColor(EnumFlowerColor color, String uid, int value) {
|
public AlleleColor(EnumFlowerColor color, String uid, int value) {
|
||||||
this.color = color;
|
this.color = color;
|
||||||
@@ -21,7 +22,7 @@ public class AlleleColor implements IAlleleInteger {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDominant() {
|
public boolean isDominant() {
|
||||||
return true;
|
return dominant;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -92,14 +92,11 @@ public enum EnumFlowerColor implements IFlowerColor {
|
|||||||
YELLOW("yellow", 0xffff00),
|
YELLOW("yellow", 0xffff00),
|
||||||
YELLOW_GREEN("yellowGreen", 0x9acd32);
|
YELLOW_GREEN("yellowGreen", 0x9acd32);
|
||||||
|
|
||||||
/**
|
private static final EnumFlowerColor[] ALL_VALUES = values();
|
||||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
private int color;
|
||||||
*/
|
private int colorDis;
|
||||||
public static final EnumFlowerColor[] VALUES = values();
|
private String name;
|
||||||
private final int color;
|
private AlleleColor allele;
|
||||||
private final int colorDis;
|
|
||||||
private final String name;
|
|
||||||
private final AlleleColor allele;
|
|
||||||
|
|
||||||
EnumFlowerColor(String name, int color) {
|
EnumFlowerColor(String name, int color) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@@ -2967,7 +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,22 +57,18 @@ public enum EnumFlowerType implements IFlowerType {
|
|||||||
DELPHINIUM(2),
|
DELPHINIUM(2),
|
||||||
HOLLYHOCK(2);
|
HOLLYHOCK(2);
|
||||||
|
|
||||||
/**
|
protected int sections;
|
||||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
protected IIcon[] stem;
|
||||||
*/
|
protected IIcon[] petal;
|
||||||
public static final EnumFlowerType[] VALUES = values();
|
protected IIcon[] variant;
|
||||||
private final int sections;
|
protected IIcon[] unflowered;
|
||||||
private final IIcon[] stem;
|
protected IIcon seedStem;
|
||||||
private final IIcon[] petal;
|
protected IIcon seedPetal;
|
||||||
private final IIcon[] variant;
|
protected IIcon seedVariant;
|
||||||
private final IIcon[] unflowered;
|
protected IIcon pollenStem;
|
||||||
private IIcon seedStem;
|
protected IIcon pollenPetal;
|
||||||
private IIcon seedPetal;
|
protected IIcon pollenVariant;
|
||||||
private IIcon seedVariant;
|
protected IIcon blank;
|
||||||
private IIcon pollenStem;
|
|
||||||
private IIcon pollenPetal;
|
|
||||||
private IIcon pollenVariant;
|
|
||||||
private IIcon blank;
|
|
||||||
|
|
||||||
EnumFlowerType() {
|
EnumFlowerType() {
|
||||||
this(1);
|
this(1);
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ public class FlowerGenome extends Genome implements IFlowerGenome {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getAgeChance() {
|
public float getAgeChance() {
|
||||||
return (float) Math.sqrt(2.0f / getLifespan());
|
return 1.0f * (float) Math.sqrt(2.0f / getLifespan());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ public class FlowerHelper extends SpeciesRoot implements IFlowerRoot {
|
|||||||
|
|
||||||
protected static String UID = "rootFlowers";
|
protected static String UID = "rootFlowers";
|
||||||
|
|
||||||
private static final ArrayList<IFlowerMutation> flowerMutations = new ArrayList<>();
|
private static ArrayList<IFlowerMutation> flowerMutations = new ArrayList<>();
|
||||||
private static final ArrayList<IColourMix> colourMixes = new ArrayList<>();
|
private static ArrayList<IColourMix> colourMixes = new ArrayList<>();
|
||||||
|
|
||||||
protected Map<ItemStack, IFlower> conversions;
|
protected Map<ItemStack, IFlower> conversions;
|
||||||
|
|
||||||
@@ -226,13 +226,13 @@ public class FlowerHelper extends SpeciesRoot implements IFlowerRoot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends IIndividual> getMemberClass() {
|
public Class getMemberClass() {
|
||||||
return IFlower.class;
|
return IFlower.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IChromosomeType[] getKaryotype() {
|
public IChromosomeType[] getKaryotype() {
|
||||||
return EnumFlowerChromosome.VALUES;
|
return EnumFlowerChromosome.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -56,7 +56,8 @@ 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", "ï?? grandiflorum", EnumFlowerType.MUMS, EnumFlowerColor.VIOLET),
|
CHRYSANTHEMUM("chrysanthemum", "chrysanthemum", "\u00ef?? grandiflorum", EnumFlowerType.MUMS,
|
||||||
|
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),
|
||||||
@@ -67,7 +68,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", "ï?? atkinsiana", EnumFlowerType.PETUNIA, EnumFlowerColor.MEDIUM_VIOLET_RED,
|
PETUNIA("petunia", "petunia", "\u00ef?? atkinsiana", EnumFlowerType.PETUNIA, EnumFlowerColor.MEDIUM_VIOLET_RED,
|
||||||
EnumFlowerColor.THISTLE),
|
EnumFlowerColor.THISTLE),
|
||||||
AGAPANTHUS("agapanthus", "agapanthus", "praecox", EnumFlowerType.AGAPANTHUS, EnumFlowerColor.DEEP_SKY_BLUE),
|
AGAPANTHUS("agapanthus", "agapanthus", "praecox", EnumFlowerType.AGAPANTHUS, EnumFlowerColor.DEEP_SKY_BLUE),
|
||||||
FUCHSIA("fuchsia", "fuchsia", "magellanica", EnumFlowerType.FUCHSIA, EnumFlowerColor.DEEP_PINK,
|
FUCHSIA("fuchsia", "fuchsia", "magellanica", EnumFlowerType.FUCHSIA, EnumFlowerColor.DEEP_PINK,
|
||||||
@@ -95,24 +96,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);
|
||||||
|
|
||||||
private EnumFlowerColor stemColor;
|
protected EnumFlowerColor stemColor;
|
||||||
private EnumAllele.Fertility fert;
|
protected EnumAllele.Fertility fert;
|
||||||
private EnumAllele.Lifespan life;
|
protected EnumAllele.Lifespan life;
|
||||||
private EnumAllele.Sappiness sap;
|
protected EnumAllele.Sappiness sap;
|
||||||
private final IFlowerType type;
|
protected IFlowerType type;
|
||||||
private final String name;
|
protected String name;
|
||||||
private final String binomial;
|
protected String binomial;
|
||||||
private final String branchName;
|
protected String branchName;
|
||||||
private final EnumFlowerColor primaryColor;
|
protected EnumFlowerColor primaryColor;
|
||||||
private final EnumFlowerColor secondaryColor;
|
protected EnumFlowerColor secondaryColor;
|
||||||
private EnumTemperature temperature;
|
protected EnumTemperature temperature;
|
||||||
private EnumAcidity pH;
|
protected EnumAcidity pH;
|
||||||
private EnumMoisture moisture;
|
protected EnumMoisture moisture;
|
||||||
private EnumTolerance tempTolerance;
|
protected EnumTolerance tempTolerance;
|
||||||
private EnumTolerance pHTolerance;
|
protected EnumTolerance pHTolerance;
|
||||||
private EnumTolerance moistureTolerance;
|
protected EnumTolerance moistureTolerance;
|
||||||
private final List<IAllele[]> variantTemplates;
|
protected List<IAllele[]> variantTemplates;
|
||||||
private IClassification branch;
|
protected IClassification branch;
|
||||||
|
|
||||||
FlowerSpecies(String name, String branch, String binomial, IFlowerType type, EnumFlowerColor colour) {
|
FlowerSpecies(String name, String branch, String binomial, IFlowerType type, EnumFlowerColor colour) {
|
||||||
this(name, branch, binomial, type, colour, colour);
|
this(name, branch, binomial, type, colour, colour);
|
||||||
@@ -496,7 +497,7 @@ public enum FlowerSpecies implements IAlleleFlowerSpecies {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumHumidity getHumidity() {
|
public EnumHumidity getHumidity() {
|
||||||
return EnumHumidity.VALUES[getMoisture().ordinal()];
|
return EnumHumidity.values()[getMoisture().ordinal()];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -8,14 +8,8 @@ import forestry.core.genetics.alleles.EnumAllele;
|
|||||||
|
|
||||||
public class FlowerTemplates {
|
public class FlowerTemplates {
|
||||||
|
|
||||||
private static IAllele[] defaultTemplate;
|
|
||||||
|
|
||||||
public static IAllele[] getDefaultTemplate() {
|
public static IAllele[] getDefaultTemplate() {
|
||||||
if (defaultTemplate != null) {
|
IAllele[] alleles = new IAllele[EnumFlowerChromosome.values().length];
|
||||||
return defaultTemplate.clone();
|
|
||||||
}
|
|
||||||
|
|
||||||
IAllele[] alleles = new IAllele[EnumFlowerChromosome.VALUES.length];
|
|
||||||
alleles[EnumFlowerChromosome.SPECIES.ordinal()] = FlowerSpecies.POPPY;
|
alleles[EnumFlowerChromosome.SPECIES.ordinal()] = FlowerSpecies.POPPY;
|
||||||
alleles[EnumFlowerChromosome.PRIMARY.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.RED);
|
alleles[EnumFlowerChromosome.PRIMARY.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.RED);
|
||||||
alleles[EnumFlowerChromosome.SECONDARY.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.RED);
|
alleles[EnumFlowerChromosome.SECONDARY.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.RED);
|
||||||
@@ -28,13 +22,6 @@ public class FlowerTemplates {
|
|||||||
alleles[EnumFlowerChromosome.PH_TOLERANCE.ordinal()] = AlleleHelper.getAllele(EnumTolerance.NONE);
|
alleles[EnumFlowerChromosome.PH_TOLERANCE.ordinal()] = AlleleHelper.getAllele(EnumTolerance.NONE);
|
||||||
alleles[EnumFlowerChromosome.SAPPINESS.ordinal()] = AlleleHelper.getAllele(EnumAllele.Sappiness.AVERAGE);
|
alleles[EnumFlowerChromosome.SAPPINESS.ordinal()] = AlleleHelper.getAllele(EnumAllele.Sappiness.AVERAGE);
|
||||||
alleles[EnumFlowerChromosome.STEM.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.GREEN);
|
alleles[EnumFlowerChromosome.STEM.ordinal()] = AlleleHelper.getAllele(EnumFlowerColor.GREEN);
|
||||||
|
return alleles;
|
||||||
for (IAllele allele : alleles) {
|
|
||||||
// Do not cache a partial template during registry initialization.
|
|
||||||
if (allele == null) return alleles;
|
|
||||||
}
|
|
||||||
|
|
||||||
defaultTemplate = alleles;
|
|
||||||
return defaultTemplate.clone();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
package binnie.botany.genetics;
|
package binnie.botany.genetics;
|
||||||
|
|
||||||
import static cpw.mods.fml.common.registry.GameRegistry.registerItem;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
@@ -27,8 +25,6 @@ public class ItemDictionary extends Item {
|
|||||||
setCreativeTab(CreativeTabBotany.instance);
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
setUnlocalizedName("database");
|
setUnlocalizedName("database");
|
||||||
setMaxStackSize(1);
|
setMaxStackSize(1);
|
||||||
|
|
||||||
registerItem(this, getUnlocalizedName().substring(5));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -46,13 +42,13 @@ public class ItemDictionary extends Item {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced) {
|
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||||
super.addInformation(stack, player, tooltip, advanced);
|
super.addInformation(stack, player, tooltip, advanced);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
|
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||||
super.getSubItems(item, tab, list);
|
super.getSubItems(item, tab, list);
|
||||||
list.add(new ItemStack(item, 1, 1));
|
list.add(new ItemStack(item, 1, 1));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class ModuleGenetics implements IInitializable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
for (EnumFlowerColor color : EnumFlowerColor.VALUES) {
|
for (EnumFlowerColor color : EnumFlowerColor.values()) {
|
||||||
AlleleManager.alleleRegistry.registerAllele(color.getAllele());
|
AlleleManager.alleleRegistry.registerAllele(color.getAllele());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ public enum BotanyItems implements IItemMisc {
|
|||||||
Mortar("mortar"),
|
Mortar("mortar"),
|
||||||
Weedkiller("weedkiller");
|
Weedkiller("weedkiller");
|
||||||
|
|
||||||
private IIcon icon;
|
protected IIcon icon;
|
||||||
private final String name;
|
protected String name;
|
||||||
private final String iconPath;
|
protected String iconPath;
|
||||||
|
|
||||||
BotanyItems(String name) {
|
BotanyItems(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@@ -41,7 +41,7 @@ public enum BotanyItems implements IItemMisc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(List<String> data) {
|
public void addInformation(List data) {
|
||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package binnie.botany.items;
|
package binnie.botany.items;
|
||||||
|
|
||||||
import static cpw.mods.fml.common.registry.GameRegistry.registerItem;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
@@ -24,12 +22,10 @@ public class ItemClay extends Item {
|
|||||||
setUnlocalizedName("clay");
|
setUnlocalizedName("clay");
|
||||||
setHasSubtypes(true);
|
setHasSubtypes(true);
|
||||||
setCreativeTab(CreativeTabBotany.instance);
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
|
|
||||||
registerItem(this, getUnlocalizedName().substring(5));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced) {
|
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||||
super.addInformation(stack, player, tooltip, advanced);
|
super.addInformation(stack, player, tooltip, advanced);
|
||||||
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(stack.getItemDamage()).getName());
|
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(stack.getItemDamage()).getName());
|
||||||
}
|
}
|
||||||
@@ -48,8 +44,8 @@ public class ItemClay extends Item {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
|
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||||
for (EnumFlowerColor c : EnumFlowerColor.VALUES) {
|
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||||
list.add(new ItemStack(this, 1, c.ordinal()));
|
list.add(new ItemStack(this, 1, c.ordinal()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package binnie.botany.items;
|
package binnie.botany.items;
|
||||||
|
|
||||||
import static cpw.mods.fml.common.registry.GameRegistry.registerItem;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
@@ -24,12 +22,10 @@ public class ItemPigment extends Item {
|
|||||||
setUnlocalizedName("pigment");
|
setUnlocalizedName("pigment");
|
||||||
setHasSubtypes(true);
|
setHasSubtypes(true);
|
||||||
setCreativeTab(CreativeTabBotany.instance);
|
setCreativeTab(CreativeTabBotany.instance);
|
||||||
|
|
||||||
registerItem(this, getUnlocalizedName().substring(5));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced) {
|
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||||
super.addInformation(stack, player, tooltip, advanced);
|
super.addInformation(stack, player, tooltip, advanced);
|
||||||
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(stack.getItemDamage()).getName());
|
tooltip.add(EnumChatFormatting.GRAY + EnumFlowerColor.get(stack.getItemDamage()).getName());
|
||||||
}
|
}
|
||||||
@@ -48,8 +44,8 @@ public class ItemPigment extends Item {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
|
public void getSubItems(Item item, CreativeTabs tab, List list) {
|
||||||
for (EnumFlowerColor c : EnumFlowerColor.VALUES) {
|
for (EnumFlowerColor c : EnumFlowerColor.values()) {
|
||||||
list.add(new ItemStack(this, 1, c.ordinal()));
|
list.add(new ItemStack(this, 1, c.ordinal()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,10 +39,10 @@ public class MessageFlowerUpdate extends MessageCoordinates {
|
|||||||
public void readData(ByteBuf data) throws IOException {
|
public void readData(ByteBuf data) throws IOException {
|
||||||
super.readData(data);
|
super.readData(data);
|
||||||
render = new TileEntityFlower.RenderInfo();
|
render = new TileEntityFlower.RenderInfo();
|
||||||
render.primary = EnumFlowerColor.get(data.readByte());
|
render.primary = EnumFlowerColor.values()[data.readByte()];
|
||||||
render.secondary = EnumFlowerColor.get(data.readByte());
|
render.secondary = EnumFlowerColor.values()[data.readByte()];
|
||||||
render.stem = EnumFlowerColor.get(data.readByte());
|
render.stem = EnumFlowerColor.values()[data.readByte()];
|
||||||
render.type = EnumFlowerType.VALUES[data.readByte()];
|
render.type = EnumFlowerType.values()[data.readByte()];
|
||||||
render.age = data.readByte();
|
render.age = data.readByte();
|
||||||
render.section = data.readByte();
|
render.section = data.readByte();
|
||||||
render.wilted = data.readBoolean();
|
render.wilted = data.readBoolean();
|
||||||
|
|||||||
@@ -1,9 +1,16 @@
|
|||||||
package binnie.core;
|
package binnie.core;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
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.network.BinniePacketHandler;
|
import binnie.core.network.BinniePacketHandler;
|
||||||
import binnie.core.network.IPacketID;
|
import binnie.core.network.IPacketID;
|
||||||
import binnie.core.network.IPacketProvider;
|
import binnie.core.network.IPacketProvider;
|
||||||
@@ -16,16 +23,17 @@ import cpw.mods.fml.relauncher.Side;
|
|||||||
public abstract class AbstractMod implements IPacketProvider, IInitializable {
|
public abstract class AbstractMod implements IPacketProvider, IInitializable {
|
||||||
|
|
||||||
private SimpleNetworkWrapper wrapper;
|
private SimpleNetworkWrapper wrapper;
|
||||||
|
private final LinkedHashSet<Field> fields;
|
||||||
protected final List<IInitializable> modules;
|
protected final List<IInitializable> modules;
|
||||||
|
|
||||||
public AbstractMod() {
|
public AbstractMod() {
|
||||||
|
fields = new LinkedHashSet<>();
|
||||||
modules = new ArrayList<>();
|
modules = new ArrayList<>();
|
||||||
BinnieCore.registerMod(this);
|
BinnieCore.registerMod(this);
|
||||||
|
MinecraftForge.EVENT_BUS.register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isActive() {
|
public abstract boolean isActive();
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public abstract String getChannel();
|
public abstract String getChannel();
|
||||||
@@ -39,6 +47,10 @@ 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();
|
||||||
@@ -55,10 +67,32 @@ 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO what does it mean?
|
||||||
|
Collections.addAll(fields, getClass().getFields());
|
||||||
|
for (Class cls : getClass().getClasses()) {
|
||||||
|
Collections.addAll(fields, getClass().getFields());
|
||||||
|
}
|
||||||
|
for (IInitializable module : modules) {
|
||||||
|
Collections.addAll(fields, module.getClass().getFields());
|
||||||
|
}
|
||||||
|
for (Field field4 : fields) {
|
||||||
|
try {
|
||||||
|
FieldParser.preInitParse(field4, this);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -74,6 +108,14 @@ public abstract class AbstractMod implements IPacketProvider, IInitializable {
|
|||||||
for (IInitializable module : modules) {
|
for (IInitializable module : modules) {
|
||||||
module.init();
|
module.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (Field field : fields) {
|
||||||
|
try {
|
||||||
|
FieldParser.initParse(field, this);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -86,10 +128,18 @@ public abstract class AbstractMod implements IPacketProvider, IInitializable {
|
|||||||
for (IInitializable module : modules) {
|
for (IInitializable module : modules) {
|
||||||
module.postInit();
|
module.postInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (Field field : fields) {
|
||||||
|
try {
|
||||||
|
FieldParser.postInitParse(field, this);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addModule(IInitializable init) {
|
protected void addModule(IInitializable init) {
|
||||||
modules.add(init);
|
modules.add(init);
|
||||||
init.registerEventHandler();
|
MinecraftForge.EVENT_BUS.register(init);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,14 +5,13 @@ 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;
|
||||||
import binnie.core.block.TileEntityMetadata;
|
import binnie.core.block.TileEntityMetadata;
|
||||||
import binnie.core.config.BCConfig;
|
|
||||||
import binnie.core.craftgui.minecraft.ModuleCraftGUI;
|
import binnie.core.craftgui.minecraft.ModuleCraftGUI;
|
||||||
import binnie.core.gui.BinnieCoreGUI;
|
import binnie.core.gui.BinnieCoreGUI;
|
||||||
import binnie.core.gui.BinnieGUIHandler;
|
import binnie.core.gui.BinnieGUIHandler;
|
||||||
@@ -23,6 +22,10 @@ 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.ItemParser;
|
||||||
import binnie.core.network.BinnieCorePacketID;
|
import binnie.core.network.BinnieCorePacketID;
|
||||||
import binnie.core.network.BinniePacketHandler;
|
import binnie.core.network.BinniePacketHandler;
|
||||||
import binnie.core.network.IPacketID;
|
import binnie.core.network.IPacketID;
|
||||||
@@ -46,16 +49,13 @@ import forestry.api.core.ForestryEvent;
|
|||||||
import forestry.plugins.PluginManager;
|
import forestry.plugins.PluginManager;
|
||||||
|
|
||||||
@Mod(
|
@Mod(
|
||||||
modid = BinnieCore.CORE_MODID,
|
modid = "BinnieCore",
|
||||||
name = BinnieCore.CORE_MOD_NAME,
|
name = "Binnie Core",
|
||||||
version = Tags.VERSION,
|
version = BinnieCore.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,25 +63,21 @@ public class BinnieCore extends AbstractMod {
|
|||||||
public static BinnieProxy proxy;
|
public static BinnieProxy proxy;
|
||||||
|
|
||||||
public static int multipassRenderID;
|
public static int multipassRenderID;
|
||||||
private static final List<AbstractMod> modList = new ArrayList<>();
|
private static 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 event) {
|
public void preInit(FMLPreInitializationEvent evt) {
|
||||||
|
Binnie.Configuration.registerConfiguration(ConfigurationMods.class, this);
|
||||||
for (ManagerBase baseManager : Binnie.Managers) {
|
for (ManagerBase baseManager : Binnie.Managers) {
|
||||||
addModule(baseManager);
|
addModule(baseManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
addModule(new ModuleCraftGUI());
|
addModule(new ModuleCraftGUI());
|
||||||
if (!BCConfig.disableCompartments) {
|
addModule(new ModuleStorage());
|
||||||
addModule(new ModuleStorage());
|
|
||||||
}
|
|
||||||
addModule(new ModuleItems());
|
addModule(new ModuleItems());
|
||||||
if (Loader.isModLoaded("BuildCraft|Silicon")) {
|
if (Loader.isModLoaded("BuildCraft|Silicon")) {
|
||||||
addModule(new ModuleTrigger());
|
addModule(new ModuleTrigger());
|
||||||
@@ -90,12 +86,12 @@ public class BinnieCore extends AbstractMod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void init(FMLInitializationEvent event) {
|
public void init(FMLInitializationEvent evt) {
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void postInit(FMLPostInitializationEvent event) {
|
public void postInit(FMLPostInitializationEvent evt) {
|
||||||
postInit();
|
postInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,6 +107,7 @@ public class BinnieCore extends AbstractMod {
|
|||||||
Item item = new ItemFluidContainer(container);
|
Item item = new ItemFluidContainer(container);
|
||||||
GameRegistry.registerItem(item, item.getUnlocalizedName().substring(5));
|
GameRegistry.registerItem(item, item.getUnlocalizedName().substring(5));
|
||||||
}
|
}
|
||||||
|
FieldParser.parsers.add(new ItemParser());
|
||||||
super.preInit();
|
super.preInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,12 +135,20 @@ 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 isApicultureActive();
|
return ConfigurationMods.extraBees && isApicultureActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isExtraTreesActive() {
|
public static boolean isExtraTreesActive() {
|
||||||
return isArboricultureActive();
|
return ConfigurationMods.extraTrees && isArboricultureActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -165,6 +170,23 @@ 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";
|
||||||
@@ -185,6 +207,20 @@ 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;
|
||||||
@@ -201,31 +237,4 @@ 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,6 +7,4 @@ public interface IInitializable {
|
|||||||
void init();
|
void init();
|
||||||
|
|
||||||
void postInit();
|
void postInit();
|
||||||
|
|
||||||
default void registerEventHandler() {}
|
|
||||||
}
|
}
|
||||||
@@ -9,16 +9,14 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
|||||||
|
|
||||||
public class Mods {
|
public class Mods {
|
||||||
|
|
||||||
public static final Mod forestry = new Mod("Forestry");
|
public static Mod forestry;
|
||||||
public static final Mod ic2 = new Mod("IC2");
|
public static Mod ic2;
|
||||||
public static final Mod botania = new Mod("Botania");
|
public static Mod botania;
|
||||||
public static final Mod extraBiomes = new Mod("ExtrabiomesXL");
|
public static Mod extraBiomes;
|
||||||
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 && forestry.matchID(modId)) {
|
if (stack == null && modId.equals("Forestry")) {
|
||||||
throw new RuntimeException("Item not found: " + modId + ":" + name);
|
throw new RuntimeException("Item not found: " + modId + ":" + name);
|
||||||
}
|
}
|
||||||
return stack;
|
return stack;
|
||||||
@@ -26,7 +24,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 && forestry.matchID(modId)) {
|
if (stack == null && modId.equals("Forestry")) {
|
||||||
throw new RuntimeException("Stack not found: " + modId + ":" + name);
|
throw new RuntimeException("Stack not found: " + modId + ":" + name);
|
||||||
}
|
}
|
||||||
return stack;
|
return stack;
|
||||||
@@ -34,32 +32,37 @@ 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 && forestry.matchID(modId)) {
|
if (stack == null && modId.equals("Forestry")) {
|
||||||
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 final String modid;
|
private String id;
|
||||||
private final boolean isLoaded;
|
|
||||||
|
|
||||||
private Mod(String id) {
|
private Mod(String id) {
|
||||||
modid = id;
|
this.id = id;
|
||||||
isLoaded = Loader.isModLoaded(id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Item item(String name) {
|
public Item item(String name) {
|
||||||
return findItem(modid, name);
|
return findItem(id, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Block block(String name) {
|
public Block block(String name) {
|
||||||
return findBlock(modid, name);
|
return findBlock(id, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack stack(String name, int stackSize) {
|
public ItemStack stack(String name, int stackSize) {
|
||||||
return findItemStack(modid, name, stackSize);
|
return findItemStack(id, name, stackSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack stack(String name) {
|
public ItemStack stack(String name) {
|
||||||
@@ -71,11 +74,7 @@ public class Mods {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean active() {
|
public boolean active() {
|
||||||
return isLoaded;
|
return Loader.isModLoaded(id);
|
||||||
}
|
|
||||||
|
|
||||||
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<String> tooltip) {
|
public void addBlockTooltip(ItemStack itemStack, List 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.isEmpty()
|
&& drops.size() > 0
|
||||||
&& (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<String> tooltip);
|
void addBlockTooltip(ItemStack itemStack, List 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);
|
||||||
}
|
}
|
||||||
@@ -17,8 +17,11 @@ public class ItemMetadata extends ItemBlock {
|
|||||||
|
|
||||||
public ItemMetadata(Block block) {
|
public ItemMetadata(Block block) {
|
||||||
super(block);
|
super(block);
|
||||||
setMaxDamage(0);
|
}
|
||||||
setHasSubtypes(true);
|
|
||||||
|
@Override
|
||||||
|
public int getMetadata(int damage) {
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -53,7 +56,7 @@ public class ItemMetadata extends ItemBlock {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void addInformation(ItemStack itemStack, EntityPlayer player, List<String> tooltip, boolean advanced) {
|
public void addInformation(ItemStack itemStack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||||
((IBlockMetadata) field_150939_a).addBlockTooltip(itemStack, tooltip);
|
((IBlockMetadata) field_150939_a).addBlockTooltip(itemStack, tooltip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ public class MultipassBlockRenderer implements ISimpleBlockRenderingHandler {
|
|||||||
|
|
||||||
public static MultipassBlockRenderer instance;
|
public static MultipassBlockRenderer instance;
|
||||||
private static int layer = 0;
|
private static int layer = 0;
|
||||||
private static boolean rendering = false;
|
|
||||||
|
|
||||||
public MultipassBlockRenderer() {
|
public MultipassBlockRenderer() {
|
||||||
MultipassBlockRenderer.instance = this;
|
MultipassBlockRenderer.instance = this;
|
||||||
@@ -24,49 +23,31 @@ public class MultipassBlockRenderer implements ISimpleBlockRenderingHandler {
|
|||||||
return MultipassBlockRenderer.layer;
|
return MultipassBlockRenderer.layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isRendering() {
|
|
||||||
return MultipassBlockRenderer.rendering;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer) {
|
public void renderInventoryBlock(Block block, int meta, int modelID, RenderBlocks renderer) {
|
||||||
IMultipassBlock multipassBlock = (IMultipassBlock) block;
|
|
||||||
int passes = multipassBlock.getNumberOfPasses();
|
|
||||||
|
|
||||||
block.setBlockBoundsForItemRender();
|
block.setBlockBoundsForItemRender();
|
||||||
renderer.setRenderBoundsFromBlock(block);
|
renderer.setRenderBoundsFromBlock(block);
|
||||||
GL11.glTranslatef(-0.5f, -0.5f, -0.5f);
|
GL11.glTranslatef(-0.5f, -0.5f, -0.5f);
|
||||||
|
|
||||||
MultipassBlockRenderer.rendering = true;
|
MultipassBlockRenderer.layer = 0;
|
||||||
try {
|
while (MultipassBlockRenderer.layer < ((IMultipassBlock) block).getNumberOfPasses()) {
|
||||||
for (int pass = 0; pass < passes; ++pass) {
|
renderItem(block, renderer, meta);
|
||||||
MultipassBlockRenderer.layer = pass;
|
MultipassBlockRenderer.layer++;
|
||||||
renderItem(block, multipassBlock, renderer, meta);
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
MultipassBlockRenderer.layer = 0;
|
|
||||||
MultipassBlockRenderer.rendering = false;
|
|
||||||
}
|
}
|
||||||
|
MultipassBlockRenderer.layer = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
|
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
|
||||||
RenderBlocks renderer) {
|
RenderBlocks renderer) {
|
||||||
IMultipassBlock multipassBlock = (IMultipassBlock) block;
|
boolean r = true;
|
||||||
int passes = multipassBlock.getNumberOfPasses();
|
MultipassBlockRenderer.layer = 0;
|
||||||
boolean rendered = true;
|
while (MultipassBlockRenderer.layer < ((IMultipassBlock) block).getNumberOfPasses()) {
|
||||||
|
r = renderer.renderStandardBlock(block, x, y, z);
|
||||||
MultipassBlockRenderer.rendering = true;
|
MultipassBlockRenderer.layer++;
|
||||||
try {
|
|
||||||
for (int pass = 0; pass < passes; ++pass) {
|
|
||||||
MultipassBlockRenderer.layer = pass;
|
|
||||||
rendered = renderer.renderStandardBlock(block, x, y, z);
|
|
||||||
}
|
|
||||||
return rendered;
|
|
||||||
} finally {
|
|
||||||
MultipassBlockRenderer.layer = 0;
|
|
||||||
MultipassBlockRenderer.rendering = false;
|
|
||||||
}
|
}
|
||||||
|
MultipassBlockRenderer.layer = 0;
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -79,8 +60,8 @@ public class MultipassBlockRenderer implements ISimpleBlockRenderingHandler {
|
|||||||
return BinnieCore.multipassRenderID;
|
return BinnieCore.multipassRenderID;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderItem(Block block, IMultipassBlock multipassBlock, RenderBlocks renderer, int meta) {
|
public void renderItem(Block block, RenderBlocks renderer, int meta) {
|
||||||
setColor(multipassBlock.colorMultiplier(meta));
|
setColor(((IMultipassBlock) block).colorMultiplier(meta));
|
||||||
Tessellator tessellator = Tessellator.instance;
|
Tessellator tessellator = Tessellator.instance;
|
||||||
tessellator.startDrawingQuads();
|
tessellator.startDrawingQuads();
|
||||||
tessellator.setNormal(0.0f, -1.0f, 0.0f);
|
tessellator.setNormal(0.0f, -1.0f, 0.0f);
|
||||||
|
|||||||
@@ -34,10 +34,14 @@ public class MultipassItemRenderer implements IItemRenderer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handleRenderType(ItemStack item, IItemRenderer.ItemRenderType type) {
|
public boolean handleRenderType(ItemStack item, IItemRenderer.ItemRenderType type) {
|
||||||
return switch (type) {
|
switch (type) {
|
||||||
case ENTITY, EQUIPPED, INVENTORY, EQUIPPED_FIRST_PERSON -> true;
|
case ENTITY:
|
||||||
default -> false;
|
case EQUIPPED:
|
||||||
};
|
case INVENTORY:
|
||||||
|
case EQUIPPED_FIRST_PERSON:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -76,14 +76,12 @@ 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);
|
||||||
if (0 <= damage && damage < Short.MAX_VALUE) {
|
item.setItemDamage(Math.min(damage, 16387));
|
||||||
item.setItemDamage(damage);
|
item.setTagCompound(tag);
|
||||||
} 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 final String uid;
|
private String uid;
|
||||||
private final int limit;
|
private int limit;
|
||||||
private final List<String> tooltips;
|
private 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 final String uid;
|
private String uid;
|
||||||
private final AbstractMod mod;
|
private AbstractMod mod;
|
||||||
|
|
||||||
public BinnieCircuitLayout(AbstractMod mod, String uid) {
|
public BinnieCircuitLayout(AbstractMod mod, String uid) {
|
||||||
this.uid = uid;
|
this.uid = uid;
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
package binnie.core.config;
|
|
||||||
|
|
||||||
import com.gtnewhorizon.gtnhlib.config.Config;
|
|
||||||
|
|
||||||
import binnie.core.BinnieCore;
|
|
||||||
|
|
||||||
@Config(modid = BinnieCore.CORE_MODID)
|
|
||||||
public class BCConfig {
|
|
||||||
|
|
||||||
@Config.Comment("If true, disables all compartment storage machines (no blocks/recipes will be registered).")
|
|
||||||
@Config.DefaultBoolean(false)
|
|
||||||
@Config.RequiresMcRestart
|
|
||||||
public static boolean disableCompartments;
|
|
||||||
}
|
|
||||||
@@ -91,7 +91,7 @@ public interface IWidget {
|
|||||||
|
|
||||||
void callEvent(Event event);
|
void callEvent(Event event);
|
||||||
|
|
||||||
void receiveEvent(Event event);
|
void recieveEvent(Event event);
|
||||||
|
|
||||||
void onUpdateClient();
|
void onUpdateClient();
|
||||||
|
|
||||||
|
|||||||
@@ -39,11 +39,13 @@ public class Tooltip {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean exists() {
|
public boolean exists() {
|
||||||
return !tooltip.isEmpty();
|
return tooltip.size() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add(List<String> list) {
|
public void add(List list) {
|
||||||
tooltip.addAll(list);
|
for (Object obj : list) {
|
||||||
|
tooltip.add((String) obj);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getList() {
|
public List<String> getList() {
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
package binnie.core.craftgui;
|
package binnie.core.craftgui;
|
||||||
|
|
||||||
import java.util.ArrayDeque;
|
import java.util.ArrayDeque;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Deque;
|
import java.util.Deque;
|
||||||
|
import java.util.List;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
|
|
||||||
import org.lwjgl.input.Mouse;
|
import org.lwjgl.input.Mouse;
|
||||||
@@ -165,14 +168,17 @@ public abstract class TopLevelWidget extends Widget implements ITopLevelWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Deque<IWidget> calculateMousedOverWidgets() {
|
public Deque<IWidget> calculateMousedOverWidgets() {
|
||||||
Deque<IWidget> widgets = new ArrayDeque<>();
|
Deque<IWidget> list = new ArrayDeque<>();
|
||||||
addMousedOverWidgets(this, widgets);
|
for (IWidget widget : getQueuedWidgets(this)) {
|
||||||
return widgets;
|
if (widget.calculateIsMouseOver()) {
|
||||||
|
list.addLast(widget);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addMousedOverWidgets(IWidget widget, Deque<IWidget> widgets) {
|
private Collection<IWidget> getQueuedWidgets(IWidget widget) {
|
||||||
if (!widget.isVisible()) return;
|
List<IWidget> widgets = new ArrayList<>();
|
||||||
|
|
||||||
boolean addChildren = true;
|
boolean addChildren = true;
|
||||||
if (widget.isCroppedWidget()) {
|
if (widget.isCroppedWidget()) {
|
||||||
addChildren = widget.getCroppedZone().contains(widget.getCropWidget().getRelativeMousePosition());
|
addChildren = widget.getCroppedZone().contains(widget.getCropWidget().getRelativeMousePosition());
|
||||||
@@ -182,12 +188,11 @@ public abstract class TopLevelWidget extends Widget implements ITopLevelWidget {
|
|||||||
ListIterator<IWidget> li = widget.getWidgets().listIterator(widget.getWidgets().size());
|
ListIterator<IWidget> li = widget.getWidgets().listIterator(widget.getWidgets().size());
|
||||||
while (li.hasPrevious()) {
|
while (li.hasPrevious()) {
|
||||||
IWidget child = li.previous();
|
IWidget child = li.previous();
|
||||||
addMousedOverWidgets(child, widgets);
|
widgets.addAll(getQueuedWidgets(child));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (widget.calculateIsMouseOver()) {
|
widgets.add(widget);
|
||||||
widgets.addLast(widget);
|
return widgets;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -19,16 +19,17 @@ public class Widget implements IWidget {
|
|||||||
protected int color;
|
protected int color;
|
||||||
|
|
||||||
private IWidget parent;
|
private IWidget parent;
|
||||||
private final List<IWidget> subWidgets;
|
private List<IWidget> subWidgets;
|
||||||
private final List<WidgetAttribute> attributes;
|
private List<WidgetAttribute> attributes;
|
||||||
private IPoint position;
|
private IPoint position;
|
||||||
private IPoint size;
|
private IPoint size;
|
||||||
private IPoint offset;
|
private IPoint offset;
|
||||||
private final Collection<EventHandler> globalEventHandlers;
|
private 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);
|
||||||
@@ -90,7 +91,7 @@ public class Widget implements IWidget {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IWidget addWidget(IWidget widget) {
|
public IWidget addWidget(IWidget widget) {
|
||||||
if (!subWidgets.isEmpty()
|
if (subWidgets.size() != 0
|
||||||
&& 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 {
|
||||||
@@ -194,7 +195,7 @@ public class Widget implements IWidget {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setOffset(IPoint offset) {
|
public void setOffset(IPoint offset) {
|
||||||
if (!offset.equals(this.offset)) {
|
if (offset != this.offset) {
|
||||||
this.offset = new IPoint(offset);
|
this.offset = new IPoint(offset);
|
||||||
callEvent(new EventWidget.ChangeOffset(this));
|
callEvent(new EventWidget.ChangeOffset(this));
|
||||||
}
|
}
|
||||||
@@ -235,11 +236,11 @@ public class Widget implements IWidget {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void callEvent(Event event) {
|
public void callEvent(Event event) {
|
||||||
getSuperParent().receiveEvent(event);
|
getSuperParent().recieveEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receiveEvent(Event event) {
|
public void recieveEvent(Event event) {
|
||||||
for (EventHandler handler : globalEventHandlers) {
|
for (EventHandler handler : globalEventHandlers) {
|
||||||
if (handler.handles(event)) {
|
if (handler.handles(event)) {
|
||||||
handler.onEvent(event);
|
handler.onEvent(event);
|
||||||
@@ -248,7 +249,7 @@ public class Widget implements IWidget {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
for (IWidget child : getWidgets()) {
|
for (IWidget child : getWidgets()) {
|
||||||
child.receiveEvent(event);
|
child.recieveEvent(event);
|
||||||
}
|
}
|
||||||
} catch (ConcurrentModificationException e) {
|
} catch (ConcurrentModificationException e) {
|
||||||
// ignored
|
// ignored
|
||||||
@@ -285,10 +286,6 @@ public class Widget implements IWidget {
|
|||||||
onRender(RenderStage.PreChildren);
|
onRender(RenderStage.PreChildren);
|
||||||
|
|
||||||
for (IWidget widget : getWidgets()) {
|
for (IWidget widget : getWidgets()) {
|
||||||
if (!widget.isVisible()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
widget.render();
|
widget.render();
|
||||||
CraftGUI.render.preRender(widget);
|
CraftGUI.render.preRender(widget);
|
||||||
widget.onRender(RenderStage.PostSiblings);
|
widget.onRender(RenderStage.PostSiblings);
|
||||||
@@ -310,22 +307,17 @@ public class Widget implements IWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onUpdateClient();
|
onUpdateClient();
|
||||||
List<IWidget> deletedWidgets = null;
|
List<IWidget> deletedWidgets = new ArrayList<>();
|
||||||
for (IWidget widget : getWidgets()) {
|
for (IWidget widget : getWidgets()) {
|
||||||
if (widget.hasAttribute(WidgetAttribute.NEEDS_DELETION)) {
|
if (widget.hasAttribute(WidgetAttribute.NEEDS_DELETION)) {
|
||||||
if (deletedWidgets == null) {
|
|
||||||
deletedWidgets = new ArrayList<>();
|
|
||||||
}
|
|
||||||
deletedWidgets.add(widget);
|
deletedWidgets.add(widget);
|
||||||
} else {
|
} else {
|
||||||
widget.updateClient();
|
widget.updateClient();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (deletedWidgets != null) {
|
for (IWidget widget : deletedWidgets) {
|
||||||
for (IWidget widget : deletedWidgets) {
|
deleteChild(widget);
|
||||||
deleteChild(widget);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -347,7 +339,7 @@ public class Widget implements IWidget {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isMouseOverWidget(IPoint relativeMouse) {
|
public boolean isMouseOverWidget(IPoint relativeMouse) {
|
||||||
return contains(relativeMouse);
|
return getArea().contains(relativeMouse);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -475,8 +467,7 @@ public class Widget implements IWidget {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean contains(IPoint position) {
|
public boolean contains(IPoint position) {
|
||||||
IPoint size = size();
|
return getArea().contains(position);
|
||||||
return position.x() >= 0.0f && position.y() >= 0.0f && position.x() <= size.x() && position.y() <= size.y();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ 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;
|
||||||
@@ -34,7 +33,6 @@ 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;
|
||||||
@@ -53,13 +51,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 final Random glassRand;
|
private 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 final Map<IChromosomeType, String> info;
|
private 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);
|
||||||
@@ -115,26 +113,20 @@ 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).create(actions);
|
new ControlPlayerInventory(this);
|
||||||
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, handGlass.x() + 54.0f, handGlass.y() + 26.0f).assign(actions, InventoryType.Window, 0);
|
new ControlSlot(this, 208.0f, 8.0f).assign(InventoryType.Window, 1);
|
||||||
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))
|
||||||
@@ -188,9 +180,7 @@ public class WindowFieldKit extends Window {
|
|||||||
glassOffsetX *= 1.0f - analyseProgress;
|
glassOffsetX *= 1.0f - analyseProgress;
|
||||||
glassOffsetY += glassVY;
|
glassOffsetY += glassVY;
|
||||||
glassOffsetY *= 1.0f - analyseProgress;
|
glassOffsetY *= 1.0f - analyseProgress;
|
||||||
if (GlassControl != null) {
|
GlassControl.setOffset(new IPoint(glassOffsetX, glassOffsetY));
|
||||||
GlassControl.setOffset(new IPoint(glassOffsetX, glassOffsetY));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshSpecies() {
|
private void refreshSpecies() {
|
||||||
@@ -295,8 +285,8 @@ public class WindowFieldKit extends Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receiveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) {
|
public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) {
|
||||||
super.receiveGuiNBT(side, player, name, nbt);
|
super.recieveGuiNBT(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).createAndRegister();
|
new ControlPlayerInventory(this);
|
||||||
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<>(this, one.x(), one.y(), one.w(), one.h(), 10.0f) {
|
geneList = new ControlListBox<Gene>(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<>(this, two.x(), two.y(), two.w(), two.h(), 10.0f) {
|
geneOptions = new ControlListBox<Gene>(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 receiveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) {
|
public void recieveGuiNBT(Side side, EntityPlayer player, String name, NBTTagCompound nbt) {
|
||||||
super.receiveGuiNBT(side, player, name, nbt);
|
super.recieveGuiNBT(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 final EventMouse.Down.Handler mouseHandler = new EventMouse.Down.Handler() {
|
private 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, Math.max(w, 16.0f), 16.0f);
|
super(parent, x, y, (w > 16.0f) ? 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 final TextJustification align;
|
private 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,6 +69,11 @@ 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,6 +38,11 @@ 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 final EventMouse.Down.Handler mouseHandler = new EventMouse.Down.Handler() {
|
private 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 final EventWidget.ChangeColour.Handler mouseHandler = new EventWidget.ChangeColour.Handler() {
|
private 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 cv && ((IControlValue<?>) parent).getValue() == null) {
|
if (parent instanceof IControlValue && ((IControlValue) parent).getValue() == null) {
|
||||||
cv.setValue(value);
|
((IControlValue) parent).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 final IControlScrollable scrollWidget;
|
private 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 final EventMouse.Down.Handler mouseDownHandler = new EventMouse.Down.Handler() {
|
private EventMouse.Down.Handler mouseDownHandler = new EventMouse.Down.Handler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(EventMouse.Down event) {
|
public void onEvent(EventMouse.Down event) {
|
||||||
@@ -50,6 +50,11 @@ 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 final EventMouse.Wheel.Handler mouseWheelHandler = new EventMouse.Wheel.Handler() {
|
private EventMouse.Wheel.Handler mouseWheelHandler = new EventMouse.Wheel.Handler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEvent(EventMouse.Wheel event) {
|
public void onEvent(EventMouse.Wheel event) {
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
package binnie.core.craftgui.controls.tab;
|
package binnie.core.craftgui.controls.tab;
|
||||||
|
|
||||||
import java.util.IdentityHashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import binnie.core.craftgui.CraftGUI;
|
import binnie.core.craftgui.CraftGUI;
|
||||||
import binnie.core.craftgui.ITooltip;
|
import binnie.core.craftgui.ITooltip;
|
||||||
import binnie.core.craftgui.Tooltip;
|
import binnie.core.craftgui.Tooltip;
|
||||||
@@ -23,8 +20,7 @@ public class ControlTab<T> extends Control implements ITooltip, IControlValue<T>
|
|||||||
|
|
||||||
protected T value;
|
protected T value;
|
||||||
|
|
||||||
private final ControlTabBar<T> tabBar;
|
private ControlTabBar<T> tabBar;
|
||||||
private final Map<Texture, Texture> croppedTextures = new IdentityHashMap<>();
|
|
||||||
|
|
||||||
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);
|
||||||
@@ -49,8 +45,9 @@ public class ControlTab<T> extends Control implements ITooltip, IControlValue<T>
|
|||||||
texture = CraftGUITexture.Tab;
|
texture = CraftGUITexture.Tab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Texture lTexture = CraftGUI.render.getTexture(texture);
|
||||||
Position position = getTabPosition();
|
Position position = getTabPosition();
|
||||||
Texture iTexture = getCroppedTexture(texture);
|
Texture iTexture = lTexture.crop(position, 8.0f);
|
||||||
IArea area = getArea();
|
IArea area = getArea();
|
||||||
if (texture == CraftGUITexture.TabDisabled) {
|
if (texture == CraftGUITexture.TabDisabled) {
|
||||||
if (position == Position.TOP || position == Position.LEFT) {
|
if (position == Position.TOP || position == Position.LEFT) {
|
||||||
@@ -62,7 +59,8 @@ public class ControlTab<T> extends Control implements ITooltip, IControlValue<T>
|
|||||||
}
|
}
|
||||||
|
|
||||||
CraftGUI.render.texture(iTexture, area);
|
CraftGUI.render.texture(iTexture, area);
|
||||||
if (this instanceof ControlTabIcon icon) {
|
if (this instanceof ControlTabIcon) {
|
||||||
|
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);
|
||||||
@@ -71,23 +69,14 @@ public class ControlTab<T> extends Control implements ITooltip, IControlValue<T>
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (icon.hasOutline()) {
|
if (icon.hasOutline()) {
|
||||||
iTexture = getCroppedTexture(CraftGUITexture.TabOutline);
|
iTexture = CraftGUI.render.getTexture(CraftGUITexture.TabOutline);
|
||||||
|
iTexture = iTexture.crop(position, 8.0f);
|
||||||
CraftGUI.render.color(icon.getOutlineColor());
|
CraftGUI.render.color(icon.getOutlineColor());
|
||||||
CraftGUI.render.texture(iTexture, area.inset(2));
|
CraftGUI.render.texture(iTexture, area.inset(2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Texture getCroppedTexture(Object key) {
|
|
||||||
Texture source = CraftGUI.render.getTexture(key);
|
|
||||||
Texture cropped = croppedTextures.get(source);
|
|
||||||
if (cropped == null) {
|
|
||||||
cropped = source.crop(getTabPosition(), 8.0f);
|
|
||||||
croppedTextures.put(source, cropped);
|
|
||||||
}
|
|
||||||
return cropped;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getTooltip(Tooltip tooltip) {
|
public void getTooltip(Tooltip tooltip) {
|
||||||
String name = getName();
|
String name = getName();
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ import binnie.core.genetics.BreedingSystem;
|
|||||||
|
|
||||||
class ControlBreedingProgress extends Control {
|
class ControlBreedingProgress extends Control {
|
||||||
|
|
||||||
private static final Texture Progress = new StandardTexture(80, 22, 4, 4, CraftGUITextureSheet.Controls2);
|
private static Texture Progress = new StandardTexture(80, 22, 4, 4, CraftGUITextureSheet.Controls2);
|
||||||
private final float percentage;
|
private float percentage;
|
||||||
private final int colour;
|
private 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 final ControlItemDisplay controlBee;
|
private 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 final Type type;
|
private Type type;
|
||||||
private IAlleleSpecies species;
|
private IAlleleSpecies species;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||