mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-10-27 06:43:57 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b310d407f | ||
|
|
f2e85073d3 | ||
|
|
0bd9a7978a | ||
|
|
e47fc90433 | ||
|
|
452064ef1d | ||
|
|
59c8c36520 | ||
|
|
ea1c4edae4 | ||
|
|
4c46626cdb | ||
|
|
d6fa8d8b74 | ||
|
|
704861b666 | ||
|
|
db25dcce48 | ||
|
|
4b364a93db | ||
|
|
a217884480 | ||
|
|
90f7c36a1e | ||
|
|
974e44f5cd | ||
|
|
bbb374cd5e | ||
|
|
3470c6c7d1 | ||
|
|
b1377d5642 | ||
|
|
b50910496e | ||
|
|
cc4b16e2a5 | ||
|
|
3b63133790 | ||
|
|
6d8d7110e1 | ||
|
|
98fa57844e | ||
|
|
adbb300523 | ||
|
|
839882b783 | ||
|
|
2635d036aa | ||
|
|
cf8f2f54c5 | ||
|
|
4844bc937b | ||
|
|
88f50d91e1 | ||
|
|
3bc6720dec | ||
|
|
1083f52a30 | ||
|
|
3fb58ad6a5 | ||
|
|
7e1398438d | ||
|
|
a02df943ed | ||
|
|
f88742e7ab | ||
|
|
fb2ff8aef3 | ||
|
|
3f41c5e8f8 | ||
|
|
81b1de6925 | ||
|
|
278d091b08 | ||
|
|
1552ad1b68 | ||
|
|
bf94b22345 | ||
|
|
c89b61682a | ||
|
|
43fc136fe3 | ||
|
|
ea52fa0d55 | ||
|
|
725d556718 | ||
|
|
d88c007fbb | ||
|
|
485333c6aa | ||
|
|
240802082e | ||
|
|
6f182e932d | ||
|
|
d08b42f18c | ||
|
|
57cc915a1e | ||
|
|
d7c5940596 | ||
|
|
79a6af701b | ||
|
|
4c0b503b8b | ||
|
|
2a6f3771a3 | ||
|
|
04a7c96b4d | ||
|
|
6d0a001b9e | ||
|
|
e2c2ff8d30 | ||
|
|
586f5bf093 | ||
|
|
755301d313 | ||
|
|
33f3389b84 | ||
|
|
c9167b8316 | ||
|
|
1ed646b147 | ||
|
|
7a7930d7eb | ||
|
|
3dccc7e06d | ||
|
|
18e26956ef | ||
|
|
713b0f9d9e | ||
|
|
c6f2e3c7b3 | ||
|
|
c6d8518d82 | ||
|
|
98711e5d34 | ||
|
|
5caab59507 | ||
|
|
41d47d99ca | ||
|
|
3c6d5d04d0 | ||
|
|
137927b3e6 | ||
|
|
8aa7e05bbe | ||
|
|
16414da3f2 | ||
|
|
11eb4b62df | ||
|
|
a172cb379f | ||
|
|
c979d1fa79 | ||
|
|
ef5825edcf | ||
|
|
9570cb2982 | ||
|
|
f89a074393 | ||
|
|
19457080bf | ||
|
|
d6ec27209b | ||
|
|
a0435886ab | ||
|
|
2ab8613bec | ||
|
|
9d31dedd35 | ||
|
|
2dd539c3df | ||
|
|
fd2ac7d172 | ||
|
|
466110d461 | ||
|
|
ecf0d7165c | ||
|
|
dde3514dce | ||
|
|
0f24a4e043 | ||
|
|
3ed2ecfdd0 | ||
|
|
be548b06cc | ||
|
|
7db0dc7767 | ||
|
|
2e20b14e06 | ||
|
|
576afde7b7 | ||
|
|
7f133a5e2a | ||
|
|
0135b39309 | ||
|
|
2bcd3bb46c | ||
|
|
646988aae8 | ||
|
|
331c8a8c7b | ||
|
|
68ab1b98bd | ||
|
|
9140f84d57 | ||
|
|
bf23ca2317 | ||
|
|
0e4f38b3d1 | ||
|
|
eeb29cd7f0 | ||
|
|
103cd87cbe | ||
|
|
1da67c79f3 | ||
|
|
3023b12d83 | ||
|
|
05c4914c79 | ||
|
|
bf6bf6846a | ||
|
|
ba6f1d6249 | ||
|
|
64e861af85 | ||
|
|
27a4d86108 | ||
|
|
afc859c6e9 | ||
|
|
6292b4569f | ||
|
|
99ebd8efe0 | ||
|
|
29df6ceb1b |
No files matched your search
@@ -1,33 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
RUNDIR="run"
|
||||
CRASH="crash-reports"
|
||||
SERVERLOG="server.log"
|
||||
|
||||
if [[ -d $RUNDIR/$CRASH ]]; then
|
||||
echo "Crash reports detected:"
|
||||
cat $RUNDIR/$CRASH/crash*.txt
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if grep --quiet "Fatal errors were detected" $SERVERLOG; then
|
||||
echo "Fatal errors detected:"
|
||||
cat server.log
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if grep --quiet "The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED" $SERVERLOG; then
|
||||
echo "Server force stopped:"
|
||||
cat server.log
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! grep --quiet -Po '.+Done \(.+\)\! For help, type "help" or "\?"' $SERVERLOG; then
|
||||
echo "Server didn't finish startup:"
|
||||
cat server.log
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "No crash reports detected"
|
||||
exit 0
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
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
|
||||
@@ -30,3 +30,4 @@ src/main/resources/mixins.*.json
|
||||
*.bat
|
||||
*.DS_Store
|
||||
!gradlew.bat
|
||||
layout.json
|
||||
@@ -1,29 +0,0 @@
|
||||
How to submit a bug report to Forestry
|
||||
====================================
|
||||
Please make sure the bug has not already been reported by [searching the issues](https://github.com/ForestryMC/ForestryMC/issues?q=is%3Aissue).
|
||||
|
||||
If you can, see if the bug still happens with the latest unstable build.
|
||||
[The latest unstable builds are available here](http://jenkins.ic2.player.to/job/Forestry_Dev/)
|
||||
|
||||
For crashes, you must post a link to the full crash report.
|
||||
[gist.github.com](gist.github.com) or [pastebin.com](www.pastebin.com) are good places to upload them.
|
||||
Full crash reports are located in [the minecraft data folder](http://hopper.minecraft.net/help/finding-minecraft-data-folder/), in "crash-reports".
|
||||
|
||||
Thank you for reporting bugs!
|
||||
|
||||
How to contribute to Forestry
|
||||
====================================
|
||||
|
||||
### Contributor License Agreement
|
||||
|
||||
Before pull requests can be accepted, the contributor needs to sign a contributor license agreement. (Essentially giving a license for using his code and/or media and for re-licensing it, for details read the agreement linked below.)
|
||||
|
||||
### How do I sign?
|
||||
|
||||
To keep the hassle for everyone involved to a minimum, Forestry uses CLAHub to manage the agreements. To get started, <a href="https://www.clahub.com/agreements/ForestryMC/ForestryMC">sign the Contributor License Agreement</a>.
|
||||
|
||||
### Why is this needed?
|
||||
|
||||
Without CLAs it at some point becomes essentially impossible to change the license of a project which accepts contributions from third parties. Without an explicit agreement every contributor would still own the copyright to his code. So as long as it (or parts of it) remain in the code base, he would have to agree to every license change. If enough time has passed, there may be dozens, perhaps even hundreds of contributors involved and it will be very hard to track down each and every one of them and get them to agree on a new license.
|
||||
|
||||
This would make it impossible to change the license to a more permissive one at a later date, so the code would be locked into CC BY-NC-ND 3.0 until it passes into the public domain about a hundred years from now. This situation is to be avoided and that’s why you are being bothered with this CLA.
|
||||
@@ -3,17 +3,9 @@ Forestry
|
||||
|
||||
### What is it?
|
||||
|
||||
This is the GTNH fork of Forestry for 1.7.10. Do not report any issues to the original Forestry team. This fork is maintained by the GTNH team and is not supported by the original Forestry team.
|
||||
Forestry is a modification for the game Minecraft and known primarily for its farms and bees.
|
||||
|
||||
### Homepage
|
||||
|
||||
[Wiki](http://forestry.sengir.net/)
|
||||
|
||||
[Latest Builds for 1.7.10](http://jenkins.ic2.player.to/job/Forestry_Dev/)
|
||||
|
||||
[IRC #forestry on esper.net](http://webchat.esper.net/?nick=ForestryGithub...&channels=forestry&prompt=1)
|
||||
|
||||
For those interested in developement, you can also visit #forestry-dev.
|
||||
|
||||
### Building
|
||||
|
||||
@@ -31,8 +23,6 @@ Beware of ugly code.
|
||||
|
||||
Bugfixes are generally welcome. If you want to contribute something which changes game mechanics, please talk to someone with commit privileges first. Nothing is more frustrating than putting a lot of work and effort into a new game mechanic and then having the PR rejected because it doesn’t fit gameplay-wise.
|
||||
|
||||
**If you submit a PR you must accept the [Contributor License Agreement](https://cla-assistant.io/ForestryMC/ForestryMC). There is no way around that, since otherwise changing the license later - even to something more permissive! - , becomes close to impossible.**
|
||||
|
||||
### License & Copyright
|
||||
|
||||
Forestry is (c) 2011 - 2014 SirSengir and licensed under LGPL v3. See the LICENSE.txt for all the gory details or go to http://www.gnu.org/licenses/lgpl-3.0.txt for more information. Forestry also contains code contributed by CovertJaguar, Player, MysteriousAges, Binnie, RichardG, cpw and others.
|
||||
Forestry is (c) 2011 - 2014 SirSengir and licensed under LGPL v3. See the LICENSE.txt for all the gory details or go to http://www.gnu.org/licenses/lgpl-3.0.txt for more information. Forestry also contains code contributed by CovertJaguar, Player, MysteriousAges, Binnie, RichardG, cpw, the GTNH Team, and others.
|
||||
+2
-1531
File diff suppressed because it is too large.
Load diff
+8
-7
@@ -1,12 +1,13 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
compile('com.github.GTNewHorizons:NotEnoughItems:2.3.45-GTNH:dev')
|
||||
compile('com.github.GTNewHorizons:inventory-tweaks:1.5.14:api')
|
||||
compile('com.github.GTNewHorizons:BuildCraft:7.1.27:api')
|
||||
compile('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
|
||||
|
||||
compile('curse.maven:cofh-lib-220333:2388748')
|
||||
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.9.54:dev")
|
||||
api('curse.maven:cofh-lib-220333:2388748')
|
||||
compileOnlyApi('com.github.GTNewHorizons:Angelica:2.1.19:api')
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.8.107-GTNH:dev')
|
||||
compileOnly('com.github.GTNewHorizons:inventory-tweaks:1.7.1:api')
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.57:api')
|
||||
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
|
||||
compileOnly('curse.maven:craftguide-75557:2459320')
|
||||
devOnlyNonPublishable('net.xonich.mc:NoHotbarNeeded:0.0.3:dev')
|
||||
}
|
||||
+202
-24
@@ -1,60 +1,238 @@
|
||||
# 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 = Forestry
|
||||
|
||||
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
|
||||
# Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation.
|
||||
# Conventionally lowercase.
|
||||
modId = Forestry
|
||||
|
||||
# Root package of the mod, used to find various classes in other properties,
|
||||
# mcmod.info substitution, enabling assertions in run tasks, etc.
|
||||
modGroup = forestry
|
||||
|
||||
# WHY is there no version field?
|
||||
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
|
||||
# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
|
||||
# Whether to use modGroup as the maven publishing group.
|
||||
# When false, com.github.GTNewHorizons is used.
|
||||
useModGroupForPublishing = false
|
||||
|
||||
# Will update your build.gradle automatically whenever an update is available
|
||||
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
|
||||
autoUpdateBuildScript = false
|
||||
|
||||
# Version of Minecraft to target
|
||||
minecraftVersion = 1.7.10
|
||||
|
||||
# Version of Minecraft Forge to target
|
||||
forgeVersion = 10.13.4.1614
|
||||
|
||||
# Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you
|
||||
# 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
|
||||
# Specify an MCP channel for dependency deobfuscation and the deobfParams task.
|
||||
channel = stable
|
||||
|
||||
# Specify an MCP mappings version for dependency deobfuscation and the deobfParams task.
|
||||
mappingsVersion = 12
|
||||
|
||||
# Defines other MCP mappings for dependency deobfuscation.
|
||||
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
|
||||
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
||||
developmentEnvironmentUserName = Developer
|
||||
|
||||
# Define a source file of your project with:
|
||||
# Enables modern Java syntax support. Valid values:
|
||||
# - 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 = forestry.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";
|
||||
# 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, [...])
|
||||
# Leave these properties empty to skip individual token replacements
|
||||
replaceGradleTokenInFile = Constants.java
|
||||
gradleTokenModId =
|
||||
gradleTokenModName =
|
||||
gradleTokenVersion = GRADLETOKEN_VERSION
|
||||
gradleTokenGroupName =
|
||||
# version in @Mod([...], version = VERSION, [...]).
|
||||
# Leave these properties empty to skip individual token replacements.
|
||||
replaceGradleTokenInFile =
|
||||
|
||||
# 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.
|
||||
# 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 = api
|
||||
|
||||
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
|
||||
# Example value: mymodid_at.cfg
|
||||
accessTransformersFile =
|
||||
# There can be multiple files in a space-separated list.
|
||||
# Example value: mymodid_at.cfg nei_at.cfg
|
||||
accessTransformersFile = forestry_at.cfg
|
||||
|
||||
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
||||
usesMixins = false
|
||||
|
||||
# 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
|
||||
|
||||
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
||||
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 =
|
||||
|
||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||
# 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 =
|
||||
|
||||
# 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!
|
||||
containsMixinsAndOrCoreModOnly = false
|
||||
|
||||
# If enabled, you may use 'shadowImplementation' for dependencies. They will be integrated in your jar. It is your
|
||||
# responsibility check the licence and request permission for distribution, if required.
|
||||
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
|
||||
forceEnableMixins = false
|
||||
|
||||
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated into your jar. It is your
|
||||
# responsibility to check the license and request permission for distribution if required.
|
||||
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.
|
||||
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.
|
||||
# Leave this empty if you don't want to publish to Modrinth.
|
||||
modrinthProjectId =
|
||||
|
||||
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
|
||||
# Syntax: scope1-type1:name1;scope2-type2:name2;...
|
||||
# Where scope can be one of [required, optional, incompatible, embedded],
|
||||
# type can be one of [project, version],
|
||||
# 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
|
||||
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
|
||||
modrinthRelations =
|
||||
|
||||
# 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.
|
||||
# Leave this empty if you don't want to publish on CurseForge.
|
||||
curseForgeProjectId =
|
||||
|
||||
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
|
||||
# Syntax: type1:name1;type2:name2;...
|
||||
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
||||
# and the name is the CurseForge project slug of the other mod.
|
||||
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
|
||||
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
|
||||
curseForgeRelations =
|
||||
|
||||
# Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older
|
||||
# projects. New projects should not use this parameter.
|
||||
# customArchiveBaseName =
|
||||
|
||||
# Optional parameter to customize the default working directory used by the runClient* tasks. Relative to the project directory.
|
||||
# runClientWorkingDirectory = run/client
|
||||
|
||||
# Optional parameter to customize the default working directory used by the runServer* tasks. Relative to the project directory.
|
||||
# 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.
|
||||
# That is, if there is no other active fork/upstream, NEVER change this.
|
||||
# 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
|
||||
|
||||
# Non-GTNH properties
|
||||
org.gradle.configuration-cache = true
|
||||
org.gradle.parallel = true
|
||||
@@ -0,0 +1,12 @@
|
||||
#This file is generated by updateDaemonJvm
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c2dd35c9d0aaf0ba6ad0791320f99dfc/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/e5810bd7fd1f8a586644409d395a7e55/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/7b3c4877c0749019e6805bb61e421497/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/8e1d9ee5d0f13e442218f6884a306da1/redirect
|
||||
toolchainVersion=25
|
||||
Vendored
BIN
Binary file not shown.
+2
-1
@@ -1,6 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
# Copyright © 2015 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
@@ -55,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/b631911858264c0b6e4d6603d677ff5218766cee/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@@ -83,10 +85,8 @@ done
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -114,7 +114,6 @@ case "$( uname )" in #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
@@ -133,10 +132,13 @@ location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
@@ -144,7 +146,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
@@ -152,7 +154,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
@@ -169,7 +171,6 @@ fi
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
@@ -197,16 +198,19 @@ if "$cygwin" || "$msys" ; then
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# 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
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
|
||||
Vendored
+13
-12
@@ -13,6 +13,8 @@
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
@@ -57,22 +59,21 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
|
||||
+1
-22
@@ -1,26 +1,5 @@
|
||||
// Add any additional repositiroes for your dependencies here
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name 'GTNH Maven'
|
||||
url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/'
|
||||
allowInsecureProtocol
|
||||
}
|
||||
maven {
|
||||
name 'ic2'
|
||||
url 'http://maven.ic2.player.to/'
|
||||
metadataSources {
|
||||
mavenPom()
|
||||
artifact()
|
||||
}
|
||||
}
|
||||
maven {
|
||||
url 'https://cursemaven.com'
|
||||
content {
|
||||
includeGroup 'curse.maven'
|
||||
}
|
||||
}
|
||||
maven {
|
||||
url 'https://jitpack.io'
|
||||
}
|
||||
mavenLocal()
|
||||
}
|
||||
+5
-10
@@ -4,10 +4,10 @@ pluginManagement {
|
||||
maven {
|
||||
// RetroFuturaGradle
|
||||
name "GTNH Maven"
|
||||
url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
|
||||
allowInsecureProtocol = true
|
||||
url "https://nexus.gtnewhorizons.com/repository/public/"
|
||||
mavenContent {
|
||||
includeGroup("com.gtnewhorizons.retrofuturagradle")
|
||||
includeGroup("com.gtnewhorizons")
|
||||
includeGroupByRegex("com\\.gtnewhorizons\\..+")
|
||||
}
|
||||
}
|
||||
gradlePluginPortal()
|
||||
@@ -17,12 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.diffplug.blowdryerSetup' version '1.6.0'
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' // Provides java toolchains
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.24'
|
||||
}
|
||||
|
||||
blowdryerSetup {
|
||||
repoSubfolder 'gtnhShared'
|
||||
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.2.0')
|
||||
//devLocal '.' // Use this when testing config updates locally
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import net.minecraft.item.Item;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.ModAPIManager;
|
||||
@@ -56,7 +57,8 @@ import forestry.plugins.PluginManager;
|
||||
name = Constants.MOD,
|
||||
version = Constants.VERSION,
|
||||
guiFactory = "forestry.core.config.ForestryGuiConfigFactory",
|
||||
dependencies = "required-after:Forge@[10.13.4.1566,);" + "after:Buildcraft|Core@[6.1.7,);"
|
||||
dependencies = "required-after:Forge@[10.13.4.1566,);" + "required-after:gtnhlib@[0.9.41,);"
|
||||
+ "after:Buildcraft|Core@[6.1.7,);"
|
||||
+ "after:ExtrabiomesXL;"
|
||||
+ "after:BiomesOPlenty;"
|
||||
+ "after:IC2@[2.0.140,);"
|
||||
@@ -79,11 +81,15 @@ public class Forestry {
|
||||
|
||||
public static PacketHandler packetHandler;
|
||||
|
||||
public static boolean isDreamcraftLoaded;
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
checkForCoFHLib();
|
||||
packetHandler = new PacketHandler();
|
||||
|
||||
isDreamcraftLoaded = Loader.isModLoaded("dreamcraft");
|
||||
|
||||
// Register event handler
|
||||
EventHandlerCore eventHandlerCore = new EventHandlerCore();
|
||||
MinecraftForge.EVENT_BUS.register(eventHandlerCore);
|
||||
@@ -112,6 +118,9 @@ public class Forestry {
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
PluginManager.runPostInit();
|
||||
|
||||
// Parse Mail Blacklist
|
||||
Config.parseMailBlacklist();
|
||||
|
||||
// Register world generator
|
||||
WorldGenerator worldGenerator = new WorldGenerator();
|
||||
GameRegistry.registerWorldGenerator(worldGenerator, 0);
|
||||
|
||||
@@ -24,7 +24,7 @@ public class DefaultBeeModifier implements IBeeModifier {
|
||||
}
|
||||
|
||||
public float getProductionModifier(IBeeGenome genome, float currentModifier) {
|
||||
return 1.0f;
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
public float getFloweringModifier(IBeeGenome genome, float currentModifier) {
|
||||
|
||||
@@ -84,7 +84,12 @@ public enum EnumBeeChromosome implements IChromosomeType {
|
||||
*/
|
||||
EFFECT(IAlleleBeeEffect.class);
|
||||
|
||||
Class<? extends IAllele> clss;
|
||||
final Class<? extends IAllele> clss;
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumBeeChromosome[] VALUES = values();
|
||||
|
||||
EnumBeeChromosome(Class<? extends IAllele> clss) {
|
||||
this.clss = clss;
|
||||
|
||||
@@ -17,9 +17,12 @@ public enum EnumBeeType implements ISpeciesType {
|
||||
LARVAE,
|
||||
NONE;
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumBeeType[] VALUES = values();
|
||||
|
||||
String name;
|
||||
private final String name;
|
||||
|
||||
EnumBeeType() {
|
||||
this.name = this.toString().toLowerCase(Locale.ENGLISH);
|
||||
@@ -28,4 +31,8 @@ public enum EnumBeeType implements ISpeciesType {
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public static EnumBeeType fromOrdinal(int ordinal) {
|
||||
return VALUES[ordinal];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IArmorApiaristMulti extends IArmorApiarist {
|
||||
|
||||
/**
|
||||
* Called to determine how many pieces an armor "counts for". For instance, if this returns 4, the single piece will
|
||||
* act as full protection.
|
||||
*
|
||||
* @param entity Entity being attacked
|
||||
* @param armor Armor item
|
||||
* @param cause Optional cause of attack, such as a bee effect identifier
|
||||
* @return Amount of effective protected slots
|
||||
*/
|
||||
default int getProtectionCount(EntityLivingBase entity, ItemStack armor, String cause) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||
|
||||
public interface IHiveFrame {
|
||||
|
||||
@@ -22,4 +27,15 @@ public interface IHiveFrame {
|
||||
ItemStack frameUsed(IBeeHousing housing, ItemStack frame, IBee queen, int wear);
|
||||
|
||||
IBeeModifier getBeeModifier();
|
||||
|
||||
/**
|
||||
* Provides an override for the "Hold Shift" tooltip info for a frame.<br>
|
||||
* Called by {@link forestry.apiculture.EventHandlerApiculture#addFrameTooltip(ItemTooltipEvent)}.
|
||||
*
|
||||
* @return The info to display for this frame, or null if default generated info.
|
||||
*/
|
||||
@Nullable
|
||||
default List<String> getFrameTooltip() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -73,9 +73,14 @@ public enum EnumTreeChromosome implements IChromosomeType {
|
||||
/**
|
||||
* Determines if the tree can burn.
|
||||
*/
|
||||
FIREPROOF(IAlleleBoolean.class),;
|
||||
FIREPROOF(IAlleleBoolean.class);
|
||||
|
||||
Class<? extends IAllele> clss;
|
||||
final Class<? extends IAllele> clss;
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumTreeChromosome[] VALUES = values();
|
||||
|
||||
EnumTreeChromosome(Class<? extends IAllele> clss) {
|
||||
this.clss = clss;
|
||||
|
||||
@@ -10,6 +10,7 @@ import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.world.ITreeGenData;
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,9 +17,14 @@ public enum EnumHumidity {
|
||||
NORMAL("Normal"),
|
||||
DAMP("Damp");
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumHumidity[] VALUES = values();
|
||||
|
||||
public final String name;
|
||||
|
||||
private EnumHumidity(String name) {
|
||||
EnumHumidity(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,10 +27,15 @@ public enum EnumTemperature {
|
||||
HOT("Hot", "habitats/desert"),
|
||||
HELLISH("Hellish", "habitats/nether");
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumTemperature[] VALUES = values();
|
||||
|
||||
public final String name;
|
||||
public final String iconIndex;
|
||||
|
||||
private EnumTemperature(String name, String iconIndex) {
|
||||
EnumTemperature(String name, String iconIndex) {
|
||||
this.name = name;
|
||||
this.iconIndex = iconIndex;
|
||||
}
|
||||
|
||||
@@ -12,11 +12,15 @@ public interface IClimateControlled {
|
||||
|
||||
/**
|
||||
* Change the temperature, but not lower than boundaryDown or higher than boundaryUp.
|
||||
*
|
||||
* When used in an alveary the change applies a 20x stronger effect
|
||||
*/
|
||||
void addTemperatureChange(float change, float boundaryDown, float boundaryUp);
|
||||
|
||||
/**
|
||||
* Change the humidity, but not lower than boundaryDown or higher than boundaryUp.
|
||||
*
|
||||
* When used in an alveary the change applies a 20x stronger effect
|
||||
*/
|
||||
void addHumidityChange(float change, float boundaryDown, float boundaryUp);
|
||||
}
|
||||
@@ -16,6 +16,11 @@ public enum FarmDirection {
|
||||
|
||||
private final ForgeDirection forgeDirection;
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final FarmDirection[] VALUES = values();
|
||||
|
||||
FarmDirection(ForgeDirection forgeDirection) {
|
||||
this.forgeDirection = forgeDirection;
|
||||
}
|
||||
@@ -25,16 +30,16 @@ public enum FarmDirection {
|
||||
}
|
||||
|
||||
public static FarmDirection getFarmDirection(ForgeDirection forgeDirection) {
|
||||
switch (forgeDirection) {
|
||||
case NORTH:
|
||||
return NORTH;
|
||||
case EAST:
|
||||
return EAST;
|
||||
case SOUTH:
|
||||
return SOUTH;
|
||||
case WEST:
|
||||
return WEST;
|
||||
}
|
||||
return null;
|
||||
return switch (forgeDirection) {
|
||||
case NORTH -> NORTH;
|
||||
case EAST -> EAST;
|
||||
case SOUTH -> SOUTH;
|
||||
case WEST -> WEST;
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
|
||||
public static FarmDirection fromOrdinal(int ordinal) {
|
||||
return VALUES[ordinal];
|
||||
}
|
||||
}
|
||||
@@ -9,33 +9,37 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
public class RainSubstrate {
|
||||
|
||||
public enum WeatherState {
|
||||
CLEAR,
|
||||
RAIN,
|
||||
STORM
|
||||
}
|
||||
|
||||
/**
|
||||
* Rain substrate capable of activating the rainmaker.
|
||||
*/
|
||||
public ItemStack item;
|
||||
/**
|
||||
* Duration of the rain shower triggered by this substrate in Minecraft ticks.
|
||||
* Duration of the weather event triggered by this substrate in Minecraft ticks.
|
||||
*/
|
||||
public int duration;
|
||||
/**
|
||||
* Speed of activation sequence triggered.
|
||||
*/
|
||||
public float speed;
|
||||
/**
|
||||
* The type of weather triggered.
|
||||
*/
|
||||
public WeatherState weather;
|
||||
|
||||
public boolean reverse;
|
||||
|
||||
public RainSubstrate(ItemStack item, int duration, float speed) {
|
||||
this(item, duration, speed, false);
|
||||
public RainSubstrate(ItemStack item, float speed, WeatherState weather) {
|
||||
this(item, 0, speed, weather);
|
||||
}
|
||||
|
||||
public RainSubstrate(ItemStack item, float speed) {
|
||||
this(item, 0, speed, true);
|
||||
}
|
||||
|
||||
public RainSubstrate(ItemStack item, int duration, float speed, boolean reverse) {
|
||||
public RainSubstrate(ItemStack item, int duration, float speed, WeatherState weather) {
|
||||
this.item = item;
|
||||
this.duration = duration;
|
||||
this.speed = speed;
|
||||
this.reverse = reverse;
|
||||
this.weather = weather;
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import java.util.Map;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.genetics.IClassification.EnumClassLevel;
|
||||
|
||||
/**
|
||||
|
||||
@@ -52,4 +52,8 @@ public interface IIndividual extends INBTTagable {
|
||||
IIndividual copy();
|
||||
|
||||
boolean isPureBred(IChromosomeType chromosomeType);
|
||||
|
||||
default void addLore(List<String> text) {}
|
||||
|
||||
default void addDiscoveredBy(List<String> text) {}
|
||||
}
|
||||
@@ -77,7 +77,12 @@ public enum EnumButterflyChromosome implements IChromosomeType {
|
||||
*/
|
||||
TERRITORY(IAlleleArea.class),;
|
||||
|
||||
Class<? extends IAllele> clss;
|
||||
final Class<? extends IAllele> clss;
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumButterflyChromosome[] VALUES = values();
|
||||
|
||||
EnumButterflyChromosome(Class<? extends IAllele> clss) {
|
||||
this.clss = clss;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
package forestry.api.mail;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.core.INBTTagable;
|
||||
|
||||
public interface IMailAddress extends INBTTagable {
|
||||
|
||||
@@ -49,6 +49,14 @@ public interface IAlvearyComponent<T extends IMultiblockLogicAlveary> extends IM
|
||||
* @param alveary the climate controlled alveary
|
||||
*/
|
||||
void changeClimate(int tickCount, IClimateControlled alveary);
|
||||
|
||||
/**
|
||||
* Get the priority of this climatiser. Called when alveary is constructed.
|
||||
* {@link #changeClimate(int, IClimateControlled)} are run in descending priority.
|
||||
*/
|
||||
default int getPriority() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package forestry.api.multiblock;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IFarmFertilizerRegistry {
|
||||
|
||||
/**
|
||||
* Gets a list of all fertilizer stacks in the registry.
|
||||
*
|
||||
* @return The current fertilizer registry.
|
||||
*/
|
||||
Collection<ItemStack> getFertilizers();
|
||||
|
||||
/**
|
||||
* Adds a new fertilizer to the registry.
|
||||
*
|
||||
* @apiNote The stack size doesn't matter it always consumes 1.
|
||||
* @apiNote You can use OreDictionary.WILDCARD_VALUE to specific that any meta of the item will be ok.
|
||||
*
|
||||
* @param itemstack The item to add to the registry.
|
||||
*/
|
||||
void addFertilizer(ItemStack itemstack);
|
||||
|
||||
/**
|
||||
* Removes a fertilizer from the fretilizer registry.
|
||||
*
|
||||
* @param itemstack The item to remove from the registry.
|
||||
*/
|
||||
void removeFertilizer(ItemStack itemstack);
|
||||
|
||||
/**
|
||||
* Checks if an item is a usable multi-farm fertilizer.
|
||||
*
|
||||
* @param itemstack - The stack to check with.
|
||||
* @return True if the item is a fertilizer item.
|
||||
*/
|
||||
boolean isFertilizer(ItemStack itemstack);
|
||||
}
|
||||
@@ -9,6 +9,8 @@ import net.minecraft.util.ChunkCoordinates;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
|
||||
/**
|
||||
* Basic interface for a multiblock machine component. Implemented by TileEntities.
|
||||
*/
|
||||
@@ -45,4 +47,15 @@ public interface IMultiblockComponent {
|
||||
* Called when the machine is broken for game reasons, e.g. a player removed a block or an explosion occurred.
|
||||
*/
|
||||
void onMachineBroken();
|
||||
|
||||
/**
|
||||
* A component with a separate inventory, like the Alveary Swarmer or Alveary Sieve.
|
||||
*/
|
||||
interface HasInventory {
|
||||
|
||||
/**
|
||||
* Called when this part is destroyed to drop its contents.
|
||||
*/
|
||||
IInventoryAdapter getInternalInventory();
|
||||
}
|
||||
}
|
||||
@@ -8,4 +8,6 @@ package forestry.api.multiblock;
|
||||
public class MultiblockManager {
|
||||
|
||||
public static IMultiblockLogicFactory logicFactory;
|
||||
|
||||
public static IFarmFertilizerRegistry farmFertilizerRegistry;
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
|
||||
public interface ITreeGenData {
|
||||
|
||||
@@ -15,6 +15,6 @@ public class ApiaryBeeModifier extends DefaultBeeModifier {
|
||||
|
||||
@Override
|
||||
public float getProductionModifier(IBeeGenome genome, float currentModifier) {
|
||||
return 0.1f;
|
||||
return -0.9f; // results in 0.1 with no frames, see BeeHousingModifier,java
|
||||
}
|
||||
}
|
||||
@@ -15,26 +15,20 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.apiculture.IArmorApiarist;
|
||||
import forestry.api.apiculture.IArmorApiaristHelper;
|
||||
import forestry.api.apiculture.IArmorApiaristMulti;
|
||||
|
||||
public class ArmorApiaristHelper implements IArmorApiaristHelper {
|
||||
|
||||
@Override
|
||||
public boolean isArmorApiarist(ItemStack stack, EntityLivingBase entity, String cause, boolean doProtect) {
|
||||
if (stack == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Item item = stack.getItem();
|
||||
if (!(item instanceof IArmorApiarist)) {
|
||||
return false;
|
||||
}
|
||||
if (stack == null || !(stack.getItem() instanceof IArmorApiarist armor)) return false;
|
||||
|
||||
IArmorApiarist armorApiarist = (IArmorApiarist) item;
|
||||
try {
|
||||
return armorApiarist.protectEntity(entity, stack, cause, doProtect);
|
||||
return armor.protectEntity(entity, stack, cause, doProtect);
|
||||
} catch (Throwable ignored) { // protectEntity is new to the API and may not be implemented by the armor
|
||||
if (entity instanceof EntityPlayer) {
|
||||
return armorApiarist.protectPlayer((EntityPlayer) entity, stack, cause, doProtect);
|
||||
return armor.protectPlayer((EntityPlayer) entity, stack, cause, doProtect);
|
||||
} else {
|
||||
return true; // fallback on assuming IArmorApiarist will protect the entity
|
||||
}
|
||||
@@ -48,11 +42,13 @@ public class ArmorApiaristHelper implements IArmorApiaristHelper {
|
||||
for (int i = 1; i <= 4; i++) {
|
||||
ItemStack armorItem = entity.getEquipmentInSlot(i);
|
||||
if (isArmorApiarist(armorItem, entity, cause, doProtect)) {
|
||||
count++;
|
||||
Item item = armorItem.getItem();
|
||||
if (item instanceof IArmorApiaristMulti am) count += am.getProtectionCount(entity, armorItem, cause);
|
||||
else count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
return Math.min(count, 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -49,7 +49,8 @@ public class BeeHousingModifier implements IBeeModifier {
|
||||
|
||||
@Override
|
||||
public float getProductionModifier(IBeeGenome genome, final float currentModifier) {
|
||||
float modifierValue = 1.0f;
|
||||
float modifierValue = 0.0f; // part of the additive production nerf, but don't worry at least you effectively
|
||||
// get +1 from `t` in `Bee.java:produceStacks`
|
||||
for (IBeeModifier modifier : beeHousing.getBeeModifiers()) {
|
||||
modifierValue += modifier.getProductionModifier(genome, modifierValue + currentModifier);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public class BeehouseBeeModifier extends DefaultBeeModifier {
|
||||
|
||||
@Override
|
||||
public float getProductionModifier(IBeeGenome genome, float currentModifier) {
|
||||
return 0.25f;
|
||||
return -0.75f;// results in 0.25 with no frames, see BeeHousingModifier,java
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -115,7 +115,7 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
|
||||
Stack<ItemStack> spawnCopy = new Stack<>();
|
||||
if (spawn.size() < 128) spawnCopy.addAll(spawn);
|
||||
else for (byte b = 0; b < 128; ++b) spawnCopy.add(spawn.get(b));
|
||||
else for (int b = 0; b < 128; ++b) spawnCopy.add(spawn.get(b));
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
while (!spawnCopy.isEmpty() && spawnCopy.size() <= 128) {
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
package forestry.apiculture;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IHiveFrame;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
public class EventHandlerApiculture {
|
||||
|
||||
@SubscribeEvent
|
||||
public void addFrameTooltip(ItemTooltipEvent event) {
|
||||
ItemStack itemStack = event.itemStack;
|
||||
if (itemStack != null && itemStack.getItem() instanceof IHiveFrame) {
|
||||
IHiveFrame frame = (IHiveFrame) itemStack.getItem();
|
||||
IBeeModifier modifier = frame.getBeeModifier();
|
||||
List<String> tooltip = event.toolTip;
|
||||
|
||||
if (!Proxies.common.isShiftDown()) {
|
||||
tooltip.add(EnumChatFormatting.ITALIC + "<" + StringUtil.localize("gui.tooltip.tmi") + ">");
|
||||
} else {
|
||||
if (frame.getFrameTooltip() != null) {
|
||||
// use the override if it exists
|
||||
tooltip.addAll(frame.getFrameTooltip());
|
||||
} else {
|
||||
// otherwise use the auto-generated info
|
||||
int durability = itemStack.getMaxDamage();
|
||||
tooltip.add(StringUtil.localize("frame.tooltip.durability") + getDurabilityFormatted(durability));
|
||||
|
||||
float territory = modifier.getTerritoryModifier(null, 1.0F);
|
||||
tooltip.add(
|
||||
StringUtil.localize("frame.tooltip.territory")
|
||||
+ getModifierFormatted(territory, false, false));
|
||||
float mutation = modifier.getMutationModifier(null, null, 1.0F);
|
||||
tooltip.add(
|
||||
StringUtil.localize("frame.tooltip.mutationRate")
|
||||
+ getModifierFormatted(mutation, false, false));
|
||||
float lifespan = modifier.getLifespanModifier(null, null, 1.0F);
|
||||
// lower lifespan is better
|
||||
tooltip.add(
|
||||
StringUtil.localize("frame.tooltip.lifespan")
|
||||
+ getModifierFormatted(lifespan, false, true));
|
||||
float production = modifier.getProductionModifier(null, 0.0F);
|
||||
tooltip.add(
|
||||
StringUtil.localize("frame.tooltip.production")
|
||||
+ getModifierFormatted(production, true, false));
|
||||
float flowering = modifier.getFloweringModifier(null, 1.0F);
|
||||
tooltip.add(
|
||||
StringUtil.localize("frame.tooltip.flowering")
|
||||
+ getModifierFormatted(flowering, false, false));
|
||||
float decay = modifier.getGeneticDecay(null, 1.0F);
|
||||
// lower genetic decay is better
|
||||
tooltip.add(
|
||||
StringUtil.localize("frame.tooltip.geneticDecay")
|
||||
+ getModifierFormatted(decay, false, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static String getDurabilityFormatted(int durability) {
|
||||
EnumChatFormatting color;
|
||||
if (durability < 100) {
|
||||
color = EnumChatFormatting.DARK_RED;
|
||||
} else if (durability < 200) {
|
||||
color = EnumChatFormatting.RED;
|
||||
} else if (durability < 250) {
|
||||
color = EnumChatFormatting.GOLD;
|
||||
} else if (durability < 750) {
|
||||
color = EnumChatFormatting.GREEN;
|
||||
} else {
|
||||
color = EnumChatFormatting.AQUA;
|
||||
}
|
||||
return color + " " + durability;
|
||||
}
|
||||
|
||||
private static String getModifierFormatted(float value, boolean additive, boolean undesireable) {
|
||||
EnumChatFormatting color;
|
||||
float lo_threshold = 0.5F, mid_threshold = 1.0F, hi_threshold = 2.0F;
|
||||
float discriminant = value;
|
||||
if (additive) {
|
||||
lo_threshold = -1.0F;
|
||||
mid_threshold = 0.0F;
|
||||
hi_threshold = 2.0F; // this one is the same
|
||||
if (undesireable) {
|
||||
discriminant = -value;
|
||||
}
|
||||
} else if (undesireable) {
|
||||
discriminant = 1.0F / value;
|
||||
}
|
||||
if (discriminant <= lo_threshold) {
|
||||
color = EnumChatFormatting.DARK_RED; // "bad" stat
|
||||
} else if (discriminant < mid_threshold) {
|
||||
color = EnumChatFormatting.RED; // "below average" stat
|
||||
} else if (discriminant == mid_threshold) {
|
||||
color = EnumChatFormatting.GOLD; // "average" stat
|
||||
} else if (discriminant <= hi_threshold) {
|
||||
color = EnumChatFormatting.GREEN; // "above average" stat
|
||||
} else {
|
||||
color = EnumChatFormatting.AQUA; // "great" stat
|
||||
}
|
||||
String formatted = color.toString();
|
||||
|
||||
// Set symbol for if this value is additive or multiplicative
|
||||
if (!additive) {
|
||||
formatted += " x";
|
||||
} else if (value >= 0.0F) {
|
||||
formatted += " +";
|
||||
} else {
|
||||
formatted += " "; // the "-" will be applied, but we still need a space or minecraft will crash
|
||||
}
|
||||
|
||||
// trim trailing zeroes if no decimal-precision is needed
|
||||
if (value == (long) value) {
|
||||
return formatted + (long) value;
|
||||
}
|
||||
return formatted + value;
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,10 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
@@ -73,4 +76,27 @@ public class InventoryBeeHousing extends InventoryAdapterRestricted implements I
|
||||
public final boolean addProduct(ItemStack product, boolean all) {
|
||||
return InventoryUtil.tryAddStack(this, product, SLOT_PRODUCT_1, SLOT_PRODUCT_COUNT, all, true);
|
||||
}
|
||||
|
||||
public void dumpInventoryIntoWorld(World world, ChunkCoordinates coordinates) {
|
||||
if (world.isRemote) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < SLOT_PRODUCT_COUNT; i++) {
|
||||
ItemStack stack = getStackInSlot(i);
|
||||
if (stack == null) {
|
||||
continue;
|
||||
}
|
||||
setInventorySlotContents(i, null);
|
||||
|
||||
EntityItem entityitem = new EntityItem(
|
||||
world,
|
||||
coordinates.posX + 0.5,
|
||||
coordinates.posY + 0.5,
|
||||
coordinates.posZ + 0.5,
|
||||
stack);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -97,7 +97,7 @@ public class BlockAlveary extends BlockStructure {
|
||||
/* TILE ENTITY CREATION */
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int metadata) {
|
||||
if (metadata < 0 || metadata > Type.VALUES.length) {
|
||||
if (metadata < 0 || metadata >= Type.VALUES.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,12 +12,13 @@ import forestry.api.core.Tabs;
|
||||
import forestry.apiculture.items.ItemBlockCandle;
|
||||
import forestry.core.blocks.BlockBase;
|
||||
import forestry.core.blocks.BlockRegistry;
|
||||
import forestry.core.blocks.IMachineProperties;
|
||||
import forestry.core.items.ItemBlockForestry;
|
||||
|
||||
public class BlockRegistryApiculture extends BlockRegistry {
|
||||
|
||||
public final BlockApiculture apiculture;
|
||||
public final BlockBase apicultureChest;
|
||||
public final BlockBase<? extends IMachineProperties> apicultureChest;
|
||||
public final BlockBeehives beehives;
|
||||
public final BlockCandle candle;
|
||||
public final BlockStump stump;
|
||||
@@ -26,7 +27,7 @@ public class BlockRegistryApiculture extends BlockRegistry {
|
||||
public BlockRegistryApiculture() {
|
||||
apiculture = registerBlock(new BlockApiculture(), ItemBlockForestry.class, "apiculture");
|
||||
|
||||
apicultureChest = registerBlock(new BlockBase(true), ItemBlockForestry.class, "apicultureChest");
|
||||
apicultureChest = registerBlock(new BlockBase<>(true), ItemBlockForestry.class, "apicultureChest");
|
||||
apicultureChest.setCreativeTab(Tabs.tabApiculture);
|
||||
apicultureChest.setHarvestLevel("axe", 0);
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ public class CommandBeeGive extends SubCommand {
|
||||
setPermLevel(PermLevel.ADMIN);
|
||||
|
||||
List<String> beeTypeStrings = new ArrayList<>();
|
||||
for (EnumBeeType type : EnumBeeType.values()) {
|
||||
for (EnumBeeType type : EnumBeeType.VALUES) {
|
||||
if (type == EnumBeeType.NONE) {
|
||||
continue;
|
||||
}
|
||||
@@ -166,7 +166,7 @@ public class CommandBeeGive extends SubCommand {
|
||||
}
|
||||
|
||||
private static EnumBeeType getBeeType(String beeTypeName) {
|
||||
for (EnumBeeType beeType : EnumBeeType.values()) {
|
||||
for (EnumBeeType beeType : EnumBeeType.VALUES) {
|
||||
if (beeType.getName().equalsIgnoreCase(beeTypeName)) {
|
||||
return beeType;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
import forestry.api.genetics.IFlower;
|
||||
|
||||
final class Flower implements IFlower {
|
||||
|
||||
@@ -213,6 +213,7 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
|
||||
private static boolean isAcceptedFlower(String flowerType, Set<Block> acceptedBlocks, Set<Flower> acceptedFlowers,
|
||||
World world, int x, int y, int z) {
|
||||
if (!world.blockExists(x, y, z)) return false;
|
||||
Block block = world.getBlock(x, y, z);
|
||||
|
||||
final int meta;
|
||||
|
||||
@@ -24,7 +24,7 @@ public class GrowthRuleDirtGrass implements IFlowerGrowthRule {
|
||||
@Override
|
||||
public boolean growFlower(IFlowerRegistry flowerRegistry, String flowerType, World world, IIndividual individual,
|
||||
int x, int y, int z) {
|
||||
if (!world.isAirBlock(x, y, z)) {
|
||||
if (!world.blockExists(x, y, z) || !world.isAirBlock(x, y, z)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class GrowthRuleDirtGrass implements IFlowerGrowthRule {
|
||||
|
||||
@Override
|
||||
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) {
|
||||
if (!world.isAirBlock(x, y, z)) {
|
||||
if (!world.blockExists(x, y, z) || !world.isAirBlock(x, y, z)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,10 @@ public class GrowthRuleFlowerPot implements IFlowerGrowthRule {
|
||||
}
|
||||
|
||||
private static boolean growFlower(String flowerType, World world, int x, int y, int z) {
|
||||
if (!world.blockExists(x, y, z)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (!(tile instanceof TileEntityFlowerPot)) {
|
||||
return false;
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import static forestry.core.utils.MathUtil.safeAdd;
|
||||
import static forestry.core.utils.MathUtil.safeMultiply;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -15,6 +18,8 @@ import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -26,7 +31,20 @@ import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.apiculture.*;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IAlleleBeeSpeciesCustom;
|
||||
import forestry.api.apiculture.IApiaristTracker;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IBeeMutation;
|
||||
import forestry.api.apiculture.IBeekeepingMode;
|
||||
import forestry.api.apiculture.IJubilanceProvider;
|
||||
import forestry.api.core.BiomeHelper;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
@@ -360,6 +378,36 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
return suitableBiomes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addLore(List<String> text) {
|
||||
IAlleleBeeSpecies primary = genome.getPrimary();
|
||||
String descTokens[] = primary.getDescription().split("\\|");
|
||||
|
||||
if (descTokens.length > 0) {
|
||||
String speciesLore = descTokens[0];
|
||||
if (!speciesLore.isEmpty() && !speciesLore.contains("for.description")) {
|
||||
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
|
||||
String formattedLore = EnumChatFormatting.GOLD + speciesLore;
|
||||
List<String> formattedLoreList = fontRenderer.listFormattedStringToWidth(formattedLore, 200);
|
||||
text.addAll(formattedLoreList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDiscoveredBy(List<String> text) {
|
||||
IAlleleBeeSpecies primary = genome.getPrimary();
|
||||
String descTokens[] = primary.getDescription().split("\\|");
|
||||
|
||||
if (descTokens.length > 2) {
|
||||
String discoveredBy = descTokens[2];
|
||||
if (!discoveredBy.isEmpty()) {
|
||||
text.add("");
|
||||
text.add("Discovered by " + EnumChatFormatting.ITALIC + discoveredBy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTooltip(List<String> list) {
|
||||
|
||||
@@ -514,8 +562,8 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
|
||||
// Bee genetic speed * beehousing * beekeeping mode
|
||||
float speed = genome.getSpeed();
|
||||
float prodModifier = beeHousingModifier.getProductionModifier(genome, 1f)
|
||||
* beeModeModifier.getProductionModifier(genome, 1f);
|
||||
float prodModifier = beeHousingModifier.getProductionModifier(genome, 0f);
|
||||
prodModifier += beeModeModifier.getProductionModifier(genome, prodModifier);
|
||||
|
||||
// / Primary Products
|
||||
for (Map.Entry<ItemStack, Float> entry : primary.getProductChances().entrySet()) {
|
||||
@@ -525,7 +573,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
}
|
||||
// / Secondary Products
|
||||
for (Map.Entry<ItemStack, Float> entry : secondary.getProductChances().entrySet()) {
|
||||
if (housing.getWorld().rand.nextFloat() < getFinalChance(entry.getValue() / 2, speed, prodModifier, 1f)) {
|
||||
if (housing.getWorld().rand.nextFloat() < getFinalChance(entry.getValue() / 2f, speed, prodModifier, 1f)) {
|
||||
products.add(entry.getKey().copy());
|
||||
}
|
||||
}
|
||||
@@ -551,10 +599,13 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
}
|
||||
|
||||
public static float getFinalChance(float chance, float beeSpeed, float productionModifier, float t) {
|
||||
if (productionModifier + t <= 0f) {
|
||||
return 0f;
|
||||
}
|
||||
chance *= 100f;
|
||||
return (float) (2.8 * Math.pow(chance, 0.52)
|
||||
* Math.pow((productionModifier + t), 0.52)
|
||||
* Math.pow(beeSpeed, 0.37)) / 100.f;
|
||||
* Math.pow(beeSpeed, 0.37)) / 100f;
|
||||
}
|
||||
|
||||
/* REPRODUCTION */
|
||||
@@ -683,9 +734,9 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
|
||||
// boost chance for researched mutations
|
||||
if (breedingTracker.isResearched(beeMutation)) {
|
||||
float mutationBoost = chance * (Config.researchMutationBoostMultiplier - 1.0f);
|
||||
float mutationBoost = safeMultiply(chance, Config.researchMutationBoostMultiplier - 1.0f);
|
||||
mutationBoost = Math.min(Config.maxResearchMutationBoostPercent, mutationBoost);
|
||||
chance += mutationBoost;
|
||||
chance = safeAdd(chance, mutationBoost);
|
||||
}
|
||||
|
||||
if (chance > world.rand.nextFloat() * 100) {
|
||||
@@ -722,6 +773,9 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
for (int i = 0; i < 20; i++) {
|
||||
Vect randomPos = Vect.getRandomPositionInArea(random, area);
|
||||
Vect blockPos = Vect.add(housingPos, randomPos, offset);
|
||||
if (!world.blockExists(blockPos.x, blockPos.y, blockPos.z)) {
|
||||
continue;
|
||||
}
|
||||
TileEntity tile = world.getTileEntity(blockPos.x, blockPos.y, blockPos.z);
|
||||
|
||||
if (tile instanceof IPollinatable) {
|
||||
|
||||
@@ -148,7 +148,7 @@ public enum BeeBranchDefinition implements IBranchDefinition {
|
||||
|
||||
private static IAllele[] getDefaultTemplate() {
|
||||
if (defaultTemplate == null) {
|
||||
defaultTemplate = new IAllele[EnumBeeChromosome.values().length];
|
||||
defaultTemplate = new IAllele[EnumBeeChromosome.VALUES.length];
|
||||
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWEST);
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORTER);
|
||||
|
||||
@@ -331,7 +331,7 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.SIMMERING, 1), 0.55f)
|
||||
.addProduct(PluginCore.items.ash.getItemStack(), 0.15f).setTemperature(EnumTemperature.HELLISH)
|
||||
.addProduct(PluginCore.items.getAsh(), 0.15f).setTemperature(EnumTemperature.HELLISH)
|
||||
.setHumidity(EnumHumidity.ARID);
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
|
||||
IBee bee = (IBee) individual;
|
||||
|
||||
Item beeItem;
|
||||
switch (EnumBeeType.VALUES[type]) {
|
||||
switch (EnumBeeType.fromOrdinal(type)) {
|
||||
case QUEEN:
|
||||
beeItem = PluginApiculture.items.beeQueenGE;
|
||||
// ensure a queen is always mated
|
||||
@@ -353,7 +353,7 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
|
||||
|
||||
@Override
|
||||
public IChromosomeType[] getKaryotype() {
|
||||
return EnumBeeChromosome.values();
|
||||
return EnumBeeChromosome.VALUES;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import static forestry.core.utils.MathUtil.safeMultiply;
|
||||
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -49,8 +51,8 @@ public class BeeMutation extends Mutation implements IBeeMutationCustom {
|
||||
IBeeModifier beeHousingModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
IBeeModifier beeModeModifier = BeeManager.beeRoot.getBeekeepingMode(world).getBeeModifier();
|
||||
|
||||
processedChance *= beeHousingModifier.getMutationModifier(genome0, genome1, processedChance);
|
||||
processedChance *= beeModeModifier.getMutationModifier(genome0, genome1, processedChance);
|
||||
processedChance = safeMultiply(processedChance, beeHousingModifier.getMutationModifier(genome0, genome1, 1.0F));
|
||||
processedChance = safeMultiply(processedChance, beeModeModifier.getMutationModifier(genome0, genome1, 1.0F));
|
||||
|
||||
return processedChance;
|
||||
}
|
||||
|
||||
@@ -24,11 +24,19 @@ import forestry.api.apiculture.IBeekeepingMode;
|
||||
|
||||
public class BeekeepingMode implements IBeekeepingMode {
|
||||
|
||||
public static final IBeekeepingMode easy = new BeekeepingMode("EASY", 2.0f, 1.0f, 1.0f, false, false);
|
||||
public static final IBeekeepingMode normal = new BeekeepingMode("NORMAL", 1.0f, 1.0f, 1.0f, false, true);
|
||||
public static final IBeekeepingMode hard = new BeekeepingMode("HARD", 0.75f, 1.5f, 1.0f, false, true);
|
||||
public static final IBeekeepingMode hardcore = new BeekeepingMode("HARDCORE", 0.5f, 5.0f, 0.8f, true, true);
|
||||
public static final IBeekeepingMode insane = new BeekeepingMode("INSANE", 0.2f, 10.0f, 0.6f, true, true);
|
||||
public static final IBeekeepingMode easy = new BeekeepingMode("EASY", 2.0f, 1.0f, 0.0f, false, false);// original
|
||||
// multiplicative
|
||||
// modifier is
|
||||
// 1x
|
||||
public static final IBeekeepingMode normal = new BeekeepingMode("NORMAL", 1.0f, 1.0f, 0.0f, false, true);// orig 1x
|
||||
public static final IBeekeepingMode hard = new BeekeepingMode("HARD", 0.75f, 1.5f, 0.0f, false, true);// orig 1x;
|
||||
// this is the
|
||||
// default in
|
||||
// gtnh
|
||||
public static final IBeekeepingMode hardcore = new BeekeepingMode("HARDCORE", 0.5f, 5.0f, -0.2f, true, true);// orig
|
||||
// 0.8x
|
||||
public static final IBeekeepingMode insane = new BeekeepingMode("INSANE", 0.2f, 10.0f, -0.4f, true, true);// orig
|
||||
// 0.6x
|
||||
|
||||
private final Random rand;
|
||||
private final String name;
|
||||
@@ -93,7 +101,7 @@ public class BeekeepingMode implements IBeekeepingMode {
|
||||
public boolean isOverworked(IBee queen, IBeeHousing housing) {
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
float productionModifier = beeModifier.getProductionModifier(queen.getGenome(), 1f);
|
||||
float productionModifier = beeModifier.getProductionModifier(queen.getGenome(), 0f);
|
||||
if (productionModifier > 16) {
|
||||
if (housing.getWorld().rand.nextFloat() * 100 < 0.01 * ((productionModifier * productionModifier) - 100)) {
|
||||
return true;
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
@@ -22,24 +20,23 @@ import forestry.core.render.TextureManager;
|
||||
public class DefaultBeeIconProvider implements IBeeIconProvider {
|
||||
|
||||
public static final DefaultBeeIconProvider instance = new DefaultBeeIconProvider();
|
||||
private static final IIcon[][] icons = new IIcon[EnumBeeType.VALUES.length][3];
|
||||
|
||||
private DefaultBeeIconProvider() {}
|
||||
|
||||
private static final IIcon[][] icons = new IIcon[EnumBeeType.values().length][3];
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
String beeIconDir = "bees/default/";
|
||||
IIcon body1 = TextureManager.registerTex(register, beeIconDir + "body1");
|
||||
|
||||
for (int i = 0; i < EnumBeeType.values().length; i++) {
|
||||
EnumBeeType beeType = EnumBeeType.values()[i];
|
||||
for (int i = 0; i < EnumBeeType.VALUES.length; i++) {
|
||||
EnumBeeType beeType = EnumBeeType.VALUES[i];
|
||||
if (beeType == EnumBeeType.NONE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String beeTypeNameBase = beeIconDir + beeType.toString().toLowerCase(Locale.ENGLISH);
|
||||
String beeTypeNameBase = beeIconDir + beeType.getName();
|
||||
|
||||
icons[i][0] = TextureManager.registerTex(register, beeTypeNameBase + ".outline");
|
||||
if (beeType == EnumBeeType.LARVAE) {
|
||||
|
||||
@@ -13,6 +13,7 @@ import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
@@ -21,7 +22,7 @@ import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.apiculture.blocks.BlockAlveary;
|
||||
import forestry.apiculture.multiblock.AlvearyController;
|
||||
import forestry.core.utils.DamageSourceForestry;
|
||||
import forestry.core.utils.vect.Vect;
|
||||
|
||||
@@ -36,8 +37,13 @@ public class AlleleEffectRadioactive extends AlleleEffectThrottled {
|
||||
@Override
|
||||
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
harmEntities(genome, housing);
|
||||
if (isMobGriefingEnabled(housing)) destroyEnvironment(genome, housing);
|
||||
|
||||
return destroyEnvironment(genome, storedData, housing);
|
||||
return storedData;
|
||||
}
|
||||
|
||||
private boolean isMobGriefingEnabled(IBeeHousing housing) {
|
||||
return housing.getWorld().getGameRules().getGameRuleBooleanValue("mobGriefing");
|
||||
}
|
||||
|
||||
private void harmEntities(IBeeGenome genome, IBeeHousing housing) {
|
||||
@@ -56,7 +62,7 @@ public class AlleleEffectRadioactive extends AlleleEffectThrottled {
|
||||
}
|
||||
}
|
||||
|
||||
private static IEffectData destroyEnvironment(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
private static void destroyEnvironment(IBeeGenome genome, IBeeHousing housing) {
|
||||
World world = housing.getWorld();
|
||||
Random rand = world.rand;
|
||||
|
||||
@@ -65,43 +71,66 @@ public class AlleleEffectRadioactive extends AlleleEffectThrottled {
|
||||
Vect offset = area.multiply(-1 / 2.0f);
|
||||
Vect posHousing = new Vect(housing.getCoordinates());
|
||||
|
||||
boolean isAlveary = housing instanceof AlvearyController;
|
||||
|
||||
for (int i = 0; i < 20; i++) {
|
||||
Vect randomPos = Vect.getRandomPositionInArea(rand, area);
|
||||
Vect posBlock = randomPos.add(posHousing);
|
||||
posBlock = posBlock.add(offset);
|
||||
Vect posBlock = randomPos.add(posHousing).add(offset);
|
||||
|
||||
if (posBlock.y <= 1 || posBlock.y >= housing.getWorld().getActualHeight()) {
|
||||
// Don't destroy blocks in the protected 3x3x4 area if housing is an Alveary.
|
||||
// Stops the bee destroying itself. Silly behaviour.
|
||||
if (isInAlvearyProtectedArea(posHousing, posBlock)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Don't destroy ourselves or blocks below us.
|
||||
if (posBlock.x == posHousing.x && posBlock.z == posHousing.z && posBlock.y <= posHousing.y) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (world.isAirBlock(posBlock.x, posBlock.y, posBlock.z)) {
|
||||
continue;
|
||||
// Don't destroy the block directly below the bee.
|
||||
if (isAlveary) {
|
||||
if (posBlock.y == posHousing.y - 3) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
if (posBlock.y == posHousing.y - 1) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
Block block = world.getBlock(posBlock.x, posBlock.y, posBlock.z);
|
||||
|
||||
if (block instanceof BlockAlveary) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Never delete a tile entity. Allows far too much griefing and abuse otherwise.
|
||||
TileEntity tile = world.getTileEntity(posBlock.x, posBlock.y, posBlock.z);
|
||||
if (tile instanceof IBeeHousing) {
|
||||
if (tile != null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Don't let us delete blocks that are not supposed to be breakable by players.
|
||||
if (block.getBlockHardness(world, posBlock.x, posBlock.y, posBlock.z) < 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Some mods might use this logic? Idk, just a safety check. Might stop griefing.
|
||||
EntityPlayer player = world.func_152378_a(housing.getOwner().getId());
|
||||
if (player == null || !world.canMineBlock(player, posHousing.x, posHousing.y, posHousing.z)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
world.setBlockToAir(posBlock.x, posBlock.y, posBlock.z);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return storedData;
|
||||
private static boolean isInAlvearyProtectedArea(Vect posHousing, Vect posBlock) {
|
||||
// Alveary protection area is a 3x3x4 area centered on the top middle, down one block.
|
||||
int startX = posHousing.x - 1;
|
||||
int endX = posHousing.x + 1;
|
||||
int startZ = posHousing.z - 1;
|
||||
int endZ = posHousing.z + 1;
|
||||
int startY = posHousing.y - 2;
|
||||
int endY = posHousing.y + 1;
|
||||
|
||||
return posBlock.x >= startX && posBlock.x <= endX
|
||||
&& posBlock.z >= startZ
|
||||
&& posBlock.z <= endZ
|
||||
&& posBlock.y >= startY
|
||||
&& posBlock.y <= endY;
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,10 @@ public abstract class AlleleEffectThrottled extends AlleleEffect {
|
||||
this.requiresWorkingQueen = requiresWorking;
|
||||
}
|
||||
|
||||
public int getThrottle() {
|
||||
return throttle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCombinable() {
|
||||
return isCombinable;
|
||||
|
||||
@@ -13,7 +13,13 @@ import java.util.ArrayList;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.apiculture.*;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IAlleleBeeSpeciesCustom;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IJubilanceProvider;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
import forestry.api.genetics.IAlleleTolerance;
|
||||
|
||||
@@ -15,6 +15,7 @@ import forestry.api.core.Tabs;
|
||||
import forestry.apiculture.gui.GuiBeealyzer;
|
||||
import forestry.apiculture.inventory.ItemInventoryBeealyzer;
|
||||
import forestry.core.gui.ContainerAlyzer;
|
||||
import forestry.core.inventory.ItemLocation;
|
||||
import forestry.core.items.ItemWithGui;
|
||||
|
||||
public class ItemBeealyzer extends ItemWithGui {
|
||||
@@ -24,13 +25,13 @@ public class ItemBeealyzer extends ItemWithGui {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, ItemStack heldItem, int data) {
|
||||
public Object getGui(EntityPlayer player, ItemStack heldItem, int data, ItemLocation loc) {
|
||||
ItemInventoryBeealyzer inventory = new ItemInventoryBeealyzer(player, heldItem);
|
||||
return new GuiBeealyzer(player, inventory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, ItemStack heldItem, int data) {
|
||||
public Object getContainer(EntityPlayer player, ItemStack heldItem, int data, ItemLocation loc) {
|
||||
ItemInventoryBeealyzer inventory = new ItemInventoryBeealyzer(player, heldItem);
|
||||
return new ContainerAlyzer(inventory, player);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import forestry.apiculture.gui.ContainerHabitatLocator;
|
||||
import forestry.apiculture.gui.GuiHabitatLocator;
|
||||
import forestry.apiculture.inventory.ItemInventoryHabitatLocator;
|
||||
import forestry.apiculture.render.TextureHabitatLocator;
|
||||
import forestry.core.inventory.ItemLocation;
|
||||
import forestry.core.items.ItemWithGui;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
@@ -71,9 +72,8 @@ public class ItemHabitatLocator extends ItemWithGui {
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean flag) {
|
||||
BiomeGenBase currentBiome = player.worldObj.getBiomeGenForCoords((int) player.posX, (int) player.posZ);
|
||||
|
||||
float temperatureValue = currentBiome
|
||||
.getFloatTemperature((int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
EnumTemperature temperature = EnumTemperature.getFromValue(temperatureValue);
|
||||
EnumTemperature temperature = EnumTemperature
|
||||
.getFromBiome(currentBiome, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
EnumHumidity humidity = EnumHumidity.getFromValue(currentBiome.rainfall);
|
||||
|
||||
list.add(StringUtil.localize("gui.currentBiome") + ": " + currentBiome.biomeName);
|
||||
@@ -82,12 +82,12 @@ public class ItemHabitatLocator extends ItemWithGui {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, ItemStack heldItem, int data) {
|
||||
public Object getGui(EntityPlayer player, ItemStack heldItem, int data, ItemLocation loc) {
|
||||
return new GuiHabitatLocator(player, new ItemInventoryHabitatLocator(player, heldItem));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, ItemStack heldItem, int data) {
|
||||
public Object getContainer(EntityPlayer player, ItemStack heldItem, int data, ItemLocation loc) {
|
||||
return new ContainerHabitatLocator(player, new ItemInventoryHabitatLocator(player, heldItem));
|
||||
}
|
||||
}
|
||||
@@ -56,7 +56,7 @@ public class ItemHiveFrame extends ItemForestry implements IHiveFrame {
|
||||
|
||||
@Override
|
||||
public float getProductionModifier(IBeeGenome genome, float currentModifier) {
|
||||
return (currentModifier < 10f) ? 2f : 1f;
|
||||
return (currentModifier < 10.0f) ? 1.0f : 0.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,6 +15,7 @@ import forestry.api.core.Tabs;
|
||||
import forestry.apiculture.gui.ContainerImprinter;
|
||||
import forestry.apiculture.gui.GuiImprinter;
|
||||
import forestry.apiculture.inventory.ItemInventoryImprinter;
|
||||
import forestry.core.inventory.ItemLocation;
|
||||
import forestry.core.items.ItemWithGui;
|
||||
|
||||
public class ItemImprinter extends ItemWithGui {
|
||||
@@ -24,12 +25,12 @@ public class ItemImprinter extends ItemWithGui {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, ItemStack heldItem, int data) {
|
||||
public Object getGui(EntityPlayer player, ItemStack heldItem, int data, ItemLocation loc) {
|
||||
return new GuiImprinter(player.inventory, new ItemInventoryImprinter(player, heldItem));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, ItemStack heldItem, int data) {
|
||||
public Object getContainer(EntityPlayer player, ItemStack heldItem, int data, ItemLocation loc) {
|
||||
return new ContainerImprinter(player.inventory, new ItemInventoryImprinter(player, heldItem));
|
||||
}
|
||||
}
|
||||
@@ -9,8 +9,10 @@
|
||||
package forestry.apiculture.multiblock;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -59,7 +61,9 @@ public class AlvearyController extends RectangularMultiblockControllerBase
|
||||
// PARTS
|
||||
private final Set<IBeeModifier> beeModifiers = new HashSet<>();
|
||||
private final Set<IBeeListener> beeListeners = new HashSet<>();
|
||||
private final Set<IAlvearyComponent.Climatiser> climatisers = new HashSet<>();
|
||||
private final Set<IAlvearyComponent.Climatiser> climatisers = new TreeSet<>(
|
||||
Comparator.comparingInt(IAlvearyComponent.Climatiser::getPriority).thenComparingInt(Object::hashCode)
|
||||
.reversed());
|
||||
private final Set<IAlvearyComponent.Active> activeComponents = new HashSet<>();
|
||||
|
||||
// CLIENT
|
||||
@@ -107,6 +111,14 @@ public class AlvearyController extends RectangularMultiblockControllerBase
|
||||
this.readFromNBT(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detachBlock(IMultiblockComponent part, boolean chunkUnloading) {
|
||||
if (!chunkUnloading) {
|
||||
inventory.dumpInventoryIntoWorld(this.worldObj, part.getCoordinates());
|
||||
}
|
||||
super.detachBlock(part, chunkUnloading);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onBlockAdded(IMultiblockComponent newPart) {
|
||||
if (newPart instanceof IAlvearyComponent) {
|
||||
@@ -233,26 +245,25 @@ public class AlvearyController extends RectangularMultiblockControllerBase
|
||||
beekeepingLogic.doWork();
|
||||
}
|
||||
|
||||
tempChange = 0;
|
||||
humidChange = 0;
|
||||
for (IAlvearyComponent.Climatiser climatiser : climatisers) {
|
||||
climatiser.changeClimate(tickCount, this);
|
||||
}
|
||||
|
||||
tempChange = equalizeChange(tempChange);
|
||||
humidChange = equalizeChange(humidChange);
|
||||
|
||||
return canWork;
|
||||
}
|
||||
|
||||
private static float equalizeChange(float change) {
|
||||
if (change == 0) {
|
||||
return 0;
|
||||
private float applyChange(float base, float currentChange, float extraChange, float boundaryDown,
|
||||
float boundaryUp) {
|
||||
float boundedNewChange = Math.round(
|
||||
(Math.max(boundaryDown, Math.min(base + currentChange + (extraChange * 20), boundaryUp)) - base) * 100)
|
||||
/ 100.0f;
|
||||
if (extraChange > 0) {
|
||||
return Math.max(currentChange, boundedNewChange);
|
||||
} else {
|
||||
return Math.min(currentChange, boundedNewChange);
|
||||
}
|
||||
|
||||
change *= 0.95f;
|
||||
if (change <= 0.001f && change >= -0.001f) {
|
||||
change = 0;
|
||||
}
|
||||
return change;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -351,12 +362,13 @@ public class AlvearyController extends RectangularMultiblockControllerBase
|
||||
@Override
|
||||
public float getExactTemperature() {
|
||||
ChunkCoordinates coords = getReferenceCoord();
|
||||
return getBiome().getFloatTemperature(coords.posX, coords.posY, coords.posZ) + tempChange;
|
||||
return Math.round((getBiome().getFloatTemperature(coords.posX, coords.posY, coords.posZ) + tempChange) * 100)
|
||||
/ 100.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getExactHumidity() {
|
||||
return getBiome().rainfall + humidChange;
|
||||
return Math.round((getBiome().rainfall + humidChange) * 100) / 100.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -410,21 +422,13 @@ public class AlvearyController extends RectangularMultiblockControllerBase
|
||||
ChunkCoordinates coordinates = getCoordinates();
|
||||
|
||||
float temperature = getBiome().getFloatTemperature(coordinates.posX, coordinates.posY, coordinates.posZ);
|
||||
|
||||
tempChange += change;
|
||||
tempChange = Math.max(boundaryDown - temperature, tempChange);
|
||||
tempChange = Math.min(boundaryUp - temperature, tempChange);
|
||||
tempChange = (change > 0 && tempChange < 0) || (change < 0 && tempChange > 0) ? 0 : tempChange;
|
||||
tempChange = applyChange(temperature, tempChange, change, boundaryDown, boundaryUp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addHumidityChange(float change, float boundaryDown, float boundaryUp) {
|
||||
float humidity = getBiome().rainfall;
|
||||
|
||||
humidChange += change;
|
||||
humidChange = Math.max(boundaryDown - humidity, humidChange);
|
||||
humidChange = Math.min(boundaryUp - humidity, humidChange);
|
||||
humidChange = (change > 0 && humidChange < 0) || (change < 0 && humidChange > 0) ? 0 : humidChange;
|
||||
humidChange = applyChange(humidity, humidChange, change, boundaryDown, boundaryUp);
|
||||
}
|
||||
|
||||
/* GUI */
|
||||
|
||||
@@ -32,7 +32,7 @@ public class TileAlvearyFan extends TileAlvearyClimatiser {
|
||||
|
||||
@Override
|
||||
public float getBoundaryDown() {
|
||||
return 0.05f;
|
||||
return -1f;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,12 +22,12 @@ public class TileAlvearyHeater extends TileAlvearyClimatiser {
|
||||
|
||||
@Override
|
||||
public float getChangePerTransfer() {
|
||||
return 0.01f;
|
||||
return 0.015f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getBoundaryUp() {
|
||||
return 2.5f;
|
||||
return 3.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,6 +19,7 @@ import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import forestry.api.core.IClimateControlled;
|
||||
import forestry.api.multiblock.IAlvearyComponent;
|
||||
import forestry.api.multiblock.IMultiblockComponent;
|
||||
import forestry.apiculture.blocks.BlockAlveary;
|
||||
import forestry.apiculture.gui.ContainerAlvearyHygroregulator;
|
||||
import forestry.apiculture.gui.GuiAlvearyHygroregulator;
|
||||
@@ -31,8 +32,8 @@ import forestry.core.fluids.tanks.FilteredTank;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.tiles.ILiquidTankTile;
|
||||
|
||||
public class TileAlvearyHygroregulator extends TileAlveary
|
||||
implements IInventory, ILiquidTankTile, IFluidHandler, IAlvearyComponent.Climatiser {
|
||||
public class TileAlvearyHygroregulator extends TileAlveary implements IInventory, ILiquidTankTile, IFluidHandler,
|
||||
IAlvearyComponent.Climatiser, IMultiblockComponent.HasInventory {
|
||||
|
||||
private final HygroregulatorRecipe[] recipes;
|
||||
|
||||
@@ -56,9 +57,9 @@ public class TileAlvearyHygroregulator extends TileAlveary
|
||||
this.tankManager = new TankManager(this, liquidTank);
|
||||
|
||||
this.recipes = new HygroregulatorRecipe[] {
|
||||
new HygroregulatorRecipe(new FluidStack(water, 1), 1, 0.01f, -0.005f),
|
||||
new HygroregulatorRecipe(new FluidStack(water, 1), 1, +0.01f, -0.005f),
|
||||
new HygroregulatorRecipe(new FluidStack(lava, 1), 10, -0.01f, +0.005f),
|
||||
new HygroregulatorRecipe(new FluidStack(liquidIce, 1), 10, 0.02f, -0.01f) };
|
||||
new HygroregulatorRecipe(new FluidStack(liquidIce, 1), 10, +0.02f, -0.01f) };
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -111,6 +112,11 @@ public class TileAlvearyHygroregulator extends TileAlveary
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPriority() {
|
||||
return 100;
|
||||
}
|
||||
|
||||
/* SAVING & LOADING */
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
|
||||
@@ -18,6 +18,7 @@ import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.multiblock.IAlvearyComponent;
|
||||
import forestry.api.multiblock.IMultiblockComponent;
|
||||
import forestry.apiculture.blocks.BlockAlveary;
|
||||
import forestry.apiculture.gui.ContainerAlvearySieve;
|
||||
import forestry.apiculture.gui.GuiAlvearySieve;
|
||||
@@ -25,7 +26,8 @@ import forestry.apiculture.inventory.InventoryAlvearySieve;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.inventory.watchers.ISlotPickupWatcher;
|
||||
|
||||
public class TileAlvearySieve extends TileAlveary implements IAlvearyComponent.BeeListener {
|
||||
public class TileAlvearySieve extends TileAlveary
|
||||
implements IAlvearyComponent.BeeListener, IMultiblockComponent.HasInventory {
|
||||
|
||||
private final IBeeListener beeListener;
|
||||
private final InventoryAlvearySieve inventory;
|
||||
|
||||
@@ -8,8 +8,9 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.multiblock;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Deque;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Stack;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
@@ -21,6 +22,7 @@ import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.multiblock.IAlvearyComponent;
|
||||
import forestry.api.multiblock.IMultiblockComponent;
|
||||
import forestry.apiculture.blocks.BlockAlveary;
|
||||
import forestry.apiculture.gui.ContainerAlvearySwarmer;
|
||||
import forestry.apiculture.gui.GuiAlvearySwarmer;
|
||||
@@ -36,10 +38,11 @@ import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.IActivatable;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
|
||||
public class TileAlvearySwarmer extends TileAlveary implements ISidedInventory, IActivatable, IAlvearyComponent.Active {
|
||||
public class TileAlvearySwarmer extends TileAlveary
|
||||
implements ISidedInventory, IActivatable, IAlvearyComponent.Active, IMultiblockComponent.HasInventory {
|
||||
|
||||
private final InventorySwarmer inventory;
|
||||
private final Stack<ItemStack> pendingSpawns = new Stack<>();
|
||||
private final Deque<ItemStack> pendingSpawns = new ArrayDeque<>();
|
||||
private boolean active;
|
||||
|
||||
public TileAlvearySwarmer() {
|
||||
|
||||
@@ -15,11 +15,14 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import forestry.apiculture.blocks.BlockCandle;
|
||||
import forestry.apiculture.tiles.TileCandle;
|
||||
import forestry.core.proxy.Proxies;
|
||||
|
||||
@ThreadSafeISBRH(perThread = false)
|
||||
public class RenderCandleBlock implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@Override
|
||||
@@ -58,7 +61,7 @@ public class RenderCandleBlock implements ISimpleBlockRenderingHandler {
|
||||
IIcon iconB = block.getTextureFromPassAndLit(1, isLit);
|
||||
|
||||
int colour = tileCandle.getColour();
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.setBrightness(world.getLightBrightnessForSkyBlocks(x, y, z, block.getLightValue(world, x, y, z)));
|
||||
tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F);
|
||||
double d0 = 0.4000000059604645D;
|
||||
@@ -87,7 +90,7 @@ public class RenderCandleBlock implements ISimpleBlockRenderingHandler {
|
||||
|
||||
private static void renderCandleAtAngle(IIcon icon, double x, double y, double z, double par8, double par10,
|
||||
int colour) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
double minU = icon.getMinU();
|
||||
double minV = icon.getMinV();
|
||||
double maxU = icon.getMaxU();
|
||||
|
||||
@@ -99,7 +99,7 @@ public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public static ComponentVillageBeeHouse buildComponent(StructureVillagePieces.Start startPiece, List par1List,
|
||||
Random random, int par3, int par4, int par5, int par6, int par7) {
|
||||
StructureBoundingBox bbox = StructureBoundingBox
|
||||
|
||||
@@ -28,7 +28,6 @@ import forestry.plugins.PluginApiculture;
|
||||
|
||||
public abstract class HiveDecorator {
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private static final EventType EVENT_TYPE = EnumHelper
|
||||
.addEnum(EventType.class, "FORESTRY_HIVES", new Class[0], new Object[0]);
|
||||
|
||||
|
||||
@@ -1,145 +0,0 @@
|
||||
package forestry.arboriculture;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockLeaves;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/** Based on vanilla leaf decay, but accepts leaves that are connected further from a trunk */
|
||||
public abstract class LeafDecayHelper {
|
||||
|
||||
private static final short SUSTAINS_LEAVES = 0;
|
||||
private static final short NOT_SUSTAINS_LEAVES = -1;
|
||||
private static final short IS_LEAVES = -2;
|
||||
private static int[] leafDecayValues;
|
||||
|
||||
public static void leafDecay(BlockLeaves leaves, World world, int x, int y, int z) {
|
||||
if (world.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
int leafMeta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if ((leafMeta & 8) != 0 && (leafMeta & 4) == 0) {
|
||||
byte radius = 4;
|
||||
byte yArrayMult = 32;
|
||||
int xArrayMult = yArrayMult * yArrayMult;
|
||||
int arrayOffset = yArrayMult / 2;
|
||||
|
||||
if (leafDecayValues == null) {
|
||||
leafDecayValues = new int[yArrayMult * yArrayMult * yArrayMult];
|
||||
}
|
||||
|
||||
int radius1 = radius + 1;
|
||||
if (world.checkChunksExist(x - radius1, y - radius1, z - radius1, x + radius1, y + radius1, z + radius1)) {
|
||||
for (int xOffset = -radius; xOffset <= radius; ++xOffset) {
|
||||
for (int yOffset = -radius; yOffset <= radius; ++yOffset) {
|
||||
for (int zOffset = -radius; zOffset <= radius; ++zOffset) {
|
||||
Block block = world.getBlock(x + xOffset, y + yOffset, z + zOffset);
|
||||
|
||||
if (!block.canSustainLeaves(world, x + xOffset, y + yOffset, z + zOffset)) {
|
||||
if (block.isLeaves(world, x + xOffset, y + yOffset, z + zOffset)) {
|
||||
leafDecayValues[(xOffset + arrayOffset) * xArrayMult
|
||||
+ (yOffset + arrayOffset) * yArrayMult
|
||||
+ zOffset
|
||||
+ arrayOffset] = IS_LEAVES;
|
||||
} else {
|
||||
leafDecayValues[(xOffset + arrayOffset) * xArrayMult
|
||||
+ (yOffset + arrayOffset) * yArrayMult
|
||||
+ zOffset
|
||||
+ arrayOffset] = NOT_SUSTAINS_LEAVES;
|
||||
}
|
||||
} else {
|
||||
leafDecayValues[(xOffset + arrayOffset) * xArrayMult
|
||||
+ (yOffset + arrayOffset) * yArrayMult
|
||||
+ zOffset
|
||||
+ arrayOffset] = SUSTAINS_LEAVES;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int sustainedValue = 1; sustainedValue <= 8; ++sustainedValue) {
|
||||
for (int xOffset = -radius; xOffset <= radius; ++xOffset) {
|
||||
for (int yOffset = -radius; yOffset <= radius; ++yOffset) {
|
||||
for (int zOffset = -radius; zOffset <= radius; ++zOffset) {
|
||||
if (leafDecayValues[(xOffset + arrayOffset) * xArrayMult
|
||||
+ (yOffset + arrayOffset) * yArrayMult
|
||||
+ zOffset
|
||||
+ arrayOffset] == sustainedValue - 1) {
|
||||
if (leafDecayValues[(xOffset + arrayOffset - 1) * xArrayMult
|
||||
+ (yOffset + arrayOffset) * yArrayMult
|
||||
+ zOffset
|
||||
+ arrayOffset] == IS_LEAVES) {
|
||||
leafDecayValues[(xOffset + arrayOffset - 1) * xArrayMult
|
||||
+ (yOffset + arrayOffset) * yArrayMult
|
||||
+ zOffset
|
||||
+ arrayOffset] = sustainedValue;
|
||||
}
|
||||
|
||||
if (leafDecayValues[(xOffset + arrayOffset + 1) * xArrayMult
|
||||
+ (yOffset + arrayOffset) * yArrayMult
|
||||
+ zOffset
|
||||
+ arrayOffset] == IS_LEAVES) {
|
||||
leafDecayValues[(xOffset + arrayOffset + 1) * xArrayMult
|
||||
+ (yOffset + arrayOffset) * yArrayMult
|
||||
+ zOffset
|
||||
+ arrayOffset] = sustainedValue;
|
||||
}
|
||||
|
||||
if (leafDecayValues[(xOffset + arrayOffset) * xArrayMult
|
||||
+ (yOffset + arrayOffset - 1) * yArrayMult
|
||||
+ zOffset
|
||||
+ arrayOffset] == IS_LEAVES) {
|
||||
leafDecayValues[(xOffset + arrayOffset) * xArrayMult
|
||||
+ (yOffset + arrayOffset - 1) * yArrayMult
|
||||
+ zOffset
|
||||
+ arrayOffset] = sustainedValue;
|
||||
}
|
||||
|
||||
if (leafDecayValues[(xOffset + arrayOffset) * xArrayMult
|
||||
+ (yOffset + arrayOffset + 1) * yArrayMult
|
||||
+ zOffset
|
||||
+ arrayOffset] == IS_LEAVES) {
|
||||
leafDecayValues[(xOffset + arrayOffset) * xArrayMult
|
||||
+ (yOffset + arrayOffset + 1) * yArrayMult
|
||||
+ zOffset
|
||||
+ arrayOffset] = sustainedValue;
|
||||
}
|
||||
|
||||
if (leafDecayValues[(xOffset + arrayOffset) * xArrayMult
|
||||
+ (yOffset + arrayOffset) * yArrayMult
|
||||
+ (zOffset + arrayOffset - 1)] == IS_LEAVES) {
|
||||
leafDecayValues[(xOffset + arrayOffset) * xArrayMult
|
||||
+ (yOffset + arrayOffset) * yArrayMult
|
||||
+ (zOffset + arrayOffset - 1)] = sustainedValue;
|
||||
}
|
||||
|
||||
if (leafDecayValues[(xOffset + arrayOffset) * xArrayMult
|
||||
+ (yOffset + arrayOffset) * yArrayMult
|
||||
+ zOffset
|
||||
+ arrayOffset
|
||||
+ 1] == IS_LEAVES) {
|
||||
leafDecayValues[(xOffset + arrayOffset) * xArrayMult
|
||||
+ (yOffset + arrayOffset) * yArrayMult
|
||||
+ zOffset
|
||||
+ arrayOffset
|
||||
+ 1] = sustainedValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int sustainValue = leafDecayValues[(arrayOffset * xArrayMult) + (arrayOffset * yArrayMult) + arrayOffset];
|
||||
|
||||
if (sustainValue >= 0) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, leafMeta & -9, 4); // stop trying to decay
|
||||
} else {
|
||||
leaves.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||
world.setBlockToAir(x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,7 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.gtnewhorizon.gtnhlib.blocks.util.BFSLeafDecay;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -48,7 +49,6 @@ import forestry.api.core.Tabs;
|
||||
import forestry.api.lepidopterology.ButterflyManager;
|
||||
import forestry.api.lepidopterology.EnumFlutterType;
|
||||
import forestry.api.lepidopterology.IButterfly;
|
||||
import forestry.arboriculture.LeafDecayHelper;
|
||||
import forestry.arboriculture.genetics.TreeDefinition;
|
||||
import forestry.arboriculture.items.ItemBlockLeaves;
|
||||
import forestry.arboriculture.render.TextureLeaves;
|
||||
@@ -168,6 +168,7 @@ public class BlockForestryLeaves extends BlockNewLeaf implements ITileEntityProv
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||
@SuppressWarnings("deprecation")
|
||||
ItemStack itemStack = super.getPickBlock(target, world, x, y, z);
|
||||
TileLeaves leaves = getLeafTile(world, x, y, z);
|
||||
NBTTagCompound leavesNBT = new NBTTagCompound();
|
||||
@@ -229,7 +230,12 @@ public class BlockForestryLeaves extends BlockNewLeaf implements ITileEntityProv
|
||||
return;
|
||||
}
|
||||
|
||||
LeafDecayHelper.leafDecay(this, world, x, y, z);
|
||||
if (!world.isRemote) {
|
||||
final int meta = world.getBlockMetadata(x, y, z);
|
||||
if ((meta & 8) != 0 && (meta & 4) == 0) {
|
||||
BFSLeafDecay.handleDecayChecked(this, world, x, y, z, meta, 4);
|
||||
}
|
||||
}
|
||||
|
||||
// check leaves tile again because they can decay in super.updateTick
|
||||
if (tileLeaves.isInvalid()) {
|
||||
|
||||
@@ -36,31 +36,32 @@ public class BlockFruitPod extends BlockCocoa {
|
||||
}
|
||||
|
||||
public static TileFruitPod getPodTile(IBlockAccess world, int x, int y, int z) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (!(tile instanceof TileFruitPod)) {
|
||||
return null;
|
||||
final TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile instanceof TileFruitPod) {
|
||||
return (TileFruitPod) tile;
|
||||
}
|
||||
|
||||
return (TileFruitPod) tile;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random rand) {
|
||||
|
||||
if (!world.checkChunksExist(x - 1, y, z - 1, x + 1, y, z + 1)) {
|
||||
return;
|
||||
}
|
||||
if (!canBlockStay(world, x, y, z)) {
|
||||
dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
|
||||
final int meta = world.getBlockMetadata(x, y, z);
|
||||
this.dropBlockAsItem(world, x, y, z, meta, 0);
|
||||
world.setBlockToAir(x, y, z);
|
||||
return;
|
||||
}
|
||||
|
||||
TileFruitPod tile = getPodTile(world, x, y, z);
|
||||
if (tile == null) {
|
||||
return;
|
||||
final TileFruitPod tile = getPodTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
tile.onBlockTick();
|
||||
}
|
||||
|
||||
tile.onBlockTick();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) {
|
||||
if (!world.isRemote) {
|
||||
|
||||
@@ -16,8 +16,8 @@ import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.particle.EffectRenderer;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -72,7 +72,7 @@ public class BlockSlab extends net.minecraft.block.BlockSlab implements IWoodTyp
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return IconProviderWood.getPlankIcon(EnumWoodType.LARCH);
|
||||
return IconProviderWood.getPlankIcon(EnumWoodType.VALUES[meta]);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -84,7 +84,8 @@ public class BlockSlab extends net.minecraft.block.BlockSlab implements IWoodTyp
|
||||
|
||||
@Override
|
||||
protected ItemStack createStackedBlock(int meta) {
|
||||
return new ItemStack(Blocks.wooden_slab, 2, meta & 7);
|
||||
Item item = Item.getItemFromBlock(this);
|
||||
return item != null ? new ItemStack(item, 2, 0) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -107,6 +108,18 @@ public class BlockSlab extends net.minecraft.block.BlockSlab implements IWoodTyp
|
||||
return new TileWood();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
|
||||
// Special case for double slabs placed by building mods (e.g., MatterManipulator)
|
||||
if (stack == null) return;
|
||||
int damage = stack.getItemDamage();
|
||||
if (damage < 0 || damage >= EnumWoodType.VALUES.length) return;
|
||||
TileWood tile = TileWood.getWoodTile(world, x, y, z);
|
||||
if (tile != null) {
|
||||
tile.setWoodType(EnumWoodType.VALUES[damage]);
|
||||
}
|
||||
}
|
||||
|
||||
/* PROPERTIES */
|
||||
@Override
|
||||
public final ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||
|
||||
@@ -16,6 +16,8 @@ import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
@@ -298,6 +300,36 @@ public class Tree extends Individual implements ITree, IPlantable {
|
||||
return plantTypes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addLore(List<String> text) {
|
||||
IAlleleTreeSpecies primary = genome.getPrimary();
|
||||
String descTokens[] = primary.getDescription().split("\\|");
|
||||
|
||||
if (descTokens.length > 0) {
|
||||
String speciesLore = descTokens[0];
|
||||
if (!speciesLore.isEmpty() && !speciesLore.contains("for.description")) {
|
||||
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
|
||||
String formattedLore = EnumChatFormatting.GOLD + speciesLore;
|
||||
List<String> formattedLoreList = fontRenderer.listFormattedStringToWidth(formattedLore, 200);
|
||||
text.addAll(formattedLoreList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDiscoveredBy(List<String> text) {
|
||||
IAlleleTreeSpecies primary = genome.getPrimary();
|
||||
String descTokens[] = primary.getDescription().split("\\|");
|
||||
|
||||
if (descTokens.length > 2) {
|
||||
String discoveredBy = descTokens[2];
|
||||
if (!discoveredBy.isEmpty()) {
|
||||
text.add("");
|
||||
text.add("Discovered by " + EnumChatFormatting.ITALIC + discoveredBy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTooltip(List<String> list) {
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ public enum TreeBranchDefinition implements IBranchDefinition {
|
||||
@Override
|
||||
public IAllele[] getTemplate() {
|
||||
if (defaultTemplate == null) {
|
||||
defaultTemplate = new IAllele[EnumTreeChromosome.values().length];
|
||||
defaultTemplate = new IAllele[EnumTreeChromosome.VALUES.length];
|
||||
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumTreeChromosome.FRUITS, AlleleFruit.fruitNone);
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumTreeChromosome.GROWTH, AlleleGrowth.growthLightLevel);
|
||||
|
||||
@@ -1059,6 +1059,8 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
case WEST:
|
||||
vanillaWoodMeta |= 1 << 2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
world.setBlock(x, y, z, vanillaWoodBlock, vanillaWoodMeta, Constants.FLAG_BLOCK_SYNCH);
|
||||
@@ -1146,6 +1148,14 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
return species.getUID();
|
||||
}
|
||||
|
||||
public EnumWoodType getWoodType() {
|
||||
return woodType;
|
||||
}
|
||||
|
||||
public ItemStack getVanillaWood() {
|
||||
return vanillaWood;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final ITreeGenome getGenome() {
|
||||
return genome;
|
||||
|
||||
@@ -389,7 +389,7 @@ public class TreeHelper extends SpeciesRoot implements ITreeRoot {
|
||||
|
||||
@Override
|
||||
public IChromosomeType[] getKaryotype() {
|
||||
return EnumTreeChromosome.values();
|
||||
return EnumTreeChromosome.VALUES;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,6 +26,7 @@ public class ItemRegistryArboriculture extends ItemRegistry {
|
||||
OreDictionary.registerOre("treeSapling", sapling.getWildcard());
|
||||
|
||||
pollenFertile = registerItem(new ItemGermlingGE(EnumGermlingType.POLLEN), "pollenFertile");
|
||||
OreDictionary.registerOre("itemPollenFertile", pollenFertile.getWildcard());
|
||||
treealyzer = registerItem(new ItemTreealyzer(), "treealyzer");
|
||||
grafter = registerItem(new ItemGrafter(4), "grafter");
|
||||
grafterProven = registerItem(new ItemGrafter(149), "grafterProven");
|
||||
|
||||
@@ -15,6 +15,7 @@ import forestry.api.core.Tabs;
|
||||
import forestry.arboriculture.gui.GuiTreealyzer;
|
||||
import forestry.arboriculture.inventory.ItemInventoryTreealyzer;
|
||||
import forestry.core.gui.ContainerAlyzer;
|
||||
import forestry.core.inventory.ItemLocation;
|
||||
import forestry.core.items.ItemWithGui;
|
||||
|
||||
public class ItemTreealyzer extends ItemWithGui {
|
||||
@@ -24,12 +25,12 @@ public class ItemTreealyzer extends ItemWithGui {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, ItemStack heldItem, int data) {
|
||||
public Object getGui(EntityPlayer player, ItemStack heldItem, int data, ItemLocation loc) {
|
||||
return new GuiTreealyzer(player, new ItemInventoryTreealyzer(player, heldItem));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, ItemStack heldItem, int data) {
|
||||
public Object getContainer(EntityPlayer player, ItemStack heldItem, int data, ItemLocation loc) {
|
||||
return new ContainerAlyzer(new ItemInventoryTreealyzer(player, heldItem), player);
|
||||
}
|
||||
}
|
||||
@@ -15,11 +15,14 @@ import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import forestry.arboriculture.blocks.BlockFruitPod;
|
||||
import forestry.arboriculture.tiles.TileFruitPod;
|
||||
import forestry.plugins.PluginArboriculture;
|
||||
|
||||
@ThreadSafeISBRH(perThread = false)
|
||||
public class RenderFruitPodBlock implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@Override
|
||||
@@ -37,7 +40,7 @@ public class RenderFruitPodBlock implements ISimpleBlockRenderingHandler {
|
||||
maturity = pod.getMaturity();
|
||||
}
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.setBrightness(blockPod.getMixedBrightnessForBlock(world, x, y, z));
|
||||
tessellator.setColorOpaque_F(1.0f, 1.0f, 1.0f);
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
|
||||
@@ -14,6 +14,8 @@ import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
|
||||
|
||||
import forestry.arboriculture.blocks.BlockForestryLeaves;
|
||||
import forestry.arboriculture.tiles.TileLeaves;
|
||||
import forestry.core.render.RenderOverlayBlock;
|
||||
@@ -22,6 +24,7 @@ import forestry.plugins.PluginArboriculture;
|
||||
/**
|
||||
* Ugly but serviceable renderer for leaves, taking fruits into account.
|
||||
*/
|
||||
@ThreadSafeISBRH(perThread = false)
|
||||
public class RenderLeavesBlock extends RenderOverlayBlock {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,6 +15,8 @@ import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import com.gtnewhorizons.angelica.api.ThreadSafeISBRH;
|
||||
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import forestry.api.arboriculture.EnumGermlingType;
|
||||
import forestry.api.arboriculture.IAlleleTreeSpecies;
|
||||
@@ -22,10 +24,9 @@ import forestry.arboriculture.blocks.BlockSapling;
|
||||
import forestry.arboriculture.tiles.TileSapling;
|
||||
import forestry.plugins.PluginArboriculture;
|
||||
|
||||
@ThreadSafeISBRH(perThread = false)
|
||||
public class RenderSaplingBlock implements ISimpleBlockRenderingHandler {
|
||||
|
||||
private static int renderLayer = 0;
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {}
|
||||
|
||||
@@ -45,10 +46,8 @@ public class RenderSaplingBlock implements ISimpleBlockRenderingHandler {
|
||||
|
||||
IAlleleTreeSpecies species = tile.getTree().getGenome().getPrimary();
|
||||
|
||||
renderCrossedSquares(species, world, block, x, y, z);
|
||||
renderLayer = 1;
|
||||
renderCrossedSquares(species, world, block, x, y, z);
|
||||
renderLayer = 0;
|
||||
renderCrossedSquares(species, world, block, x, y, z, 0);
|
||||
renderCrossedSquares(species, world, block, x, y, z, 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -63,9 +62,9 @@ public class RenderSaplingBlock implements ISimpleBlockRenderingHandler {
|
||||
}
|
||||
|
||||
private static boolean renderCrossedSquares(IAlleleTreeSpecies species, IBlockAccess world, Block block, int x,
|
||||
int y, int z) {
|
||||
int y, int z, int renderLayer) {
|
||||
|
||||
Tessellator tess = Tessellator.instance;
|
||||
final Tessellator tess = Tessellator.instance;
|
||||
|
||||
tess.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
|
||||
int colourMultiplier = species.getGermlingColour(EnumGermlingType.SAPLING, renderLayer);
|
||||
@@ -81,14 +80,14 @@ public class RenderSaplingBlock implements ISimpleBlockRenderingHandler {
|
||||
}
|
||||
|
||||
tess.setColorOpaque_F(r, g, b);
|
||||
drawCrossedSquares(species, x, y, z, 1.0f);
|
||||
drawCrossedSquares(species, x, y, z, 1.0f, renderLayer);
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void drawCrossedSquares(IAlleleTreeSpecies species, double par3, double par5, double par7,
|
||||
float mod) {
|
||||
private static void drawCrossedSquares(IAlleleTreeSpecies species, double par3, double par5, double par7, float mod,
|
||||
int renderLayer) {
|
||||
|
||||
Tessellator tess = Tessellator.instance;
|
||||
final Tessellator tess = Tessellator.instance;
|
||||
IIcon icon = species.getGermlingIcon(EnumGermlingType.SAPLING, renderLayer);
|
||||
|
||||
double d3 = (double) icon.getMinU();
|
||||
|
||||
@@ -95,8 +95,7 @@ public class TileWood extends TileEntity implements IStreamable {
|
||||
EnumWoodType woodType = wood.getWoodType();
|
||||
|
||||
int amount = 1;
|
||||
if (block instanceof BlockSlab) {
|
||||
BlockSlab blockSlab = (BlockSlab) block;
|
||||
if (block instanceof BlockSlab blockSlab) {
|
||||
if (blockSlab.isDoubleSlab()) {
|
||||
amount = 2;
|
||||
block = PluginArboriculture.blocks.slabs;
|
||||
@@ -104,6 +103,7 @@ public class TileWood extends TileEntity implements IStreamable {
|
||||
}
|
||||
|
||||
ItemStack itemStack = new ItemStack(block, amount);
|
||||
if (itemStack.getItem() == null) return null;
|
||||
ItemBlockWood.saveToItemStack(woodType, itemStack);
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.world.ITreeGenData;
|
||||
|
||||
public class TreeBlockTypeLeaf implements ITreeBlockType {
|
||||
|
||||
@@ -113,11 +113,7 @@ public final class AccessHandler implements IAccessHandler {
|
||||
if (!isOwner(player)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int ordinal = (access.ordinal() + 1) % EnumAccess.values().length;
|
||||
EnumAccess newAccess = EnumAccess.values()[ordinal];
|
||||
setAccess(player.worldObj, newAccess);
|
||||
|
||||
setAccess(player.worldObj, access.next());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -156,7 +152,7 @@ public final class AccessHandler implements IAccessHandler {
|
||||
public void readData(DataInputStreamForestry data) throws IOException {
|
||||
byte accessOrdinal = data.readByte();
|
||||
if (accessOrdinal >= 0) {
|
||||
access = EnumAccess.values()[accessOrdinal];
|
||||
access = EnumAccess.fromOrdinal(accessOrdinal);
|
||||
GameProfile owner = new GameProfile(new UUID(data.readLong(), data.readLong()), data.readUTF());
|
||||
setOwner(owner);
|
||||
}
|
||||
@@ -164,8 +160,7 @@ public final class AccessHandler implements IAccessHandler {
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound data) {
|
||||
access = EnumAccess.values()[data.getInteger("Access")];
|
||||
|
||||
access = EnumAccess.fromOrdinal(data.getInteger("Access"));
|
||||
if (data.hasKey("owner")) {
|
||||
owner = NBTUtil.func_152459_a(data.getCompoundTag("owner"));
|
||||
}
|
||||
|
||||
@@ -8,22 +8,15 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.access;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public enum EnumAccess {
|
||||
|
||||
SHARED("gui.rule.shared"),
|
||||
VIEWABLE("gui.rule.restricted"),
|
||||
PRIVATE("gui.rule.private");
|
||||
|
||||
private static final EnumAccess[] VALUES = values();
|
||||
private final String name;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon icon;
|
||||
|
||||
EnumAccess(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
@@ -31,4 +24,13 @@ public enum EnumAccess {
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public EnumAccess next() {
|
||||
int ordinal = (this.ordinal() + 1) % VALUES.length;
|
||||
return VALUES[ordinal];
|
||||
}
|
||||
|
||||
public static EnumAccess fromOrdinal(int ordinal) {
|
||||
return VALUES[ordinal];
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,7 @@ public abstract class BlockForestry extends BlockContainer {
|
||||
setCreativeTab(CreativeTabForestry.tabForestry);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.blocks;
|
||||
|
||||
import static forestry.Forestry.isDreamcraftLoaded;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -52,7 +54,7 @@ public class BlockResourceOre extends Block {
|
||||
public void dropBlockAsItemWithChance(World world, int x, int y, int z, int metadata, float par6, int par7) {
|
||||
super.dropBlockAsItemWithChance(world, x, y, z, metadata, par6, par7);
|
||||
|
||||
if (metadata == 0) {
|
||||
if (metadata == 0 && !isDreamcraftLoaded) {
|
||||
this.dropXpOnBlockBreak(world, x, y, z, MathHelper.getRandomIntegerInRange(world.rand, 1, 4));
|
||||
}
|
||||
}
|
||||
@@ -61,7 +63,7 @@ public class BlockResourceOre extends Block {
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
ArrayList<ItemStack> drops = new ArrayList<>();
|
||||
|
||||
if (metadata == ResourceType.APATITE.ordinal()) {
|
||||
if (metadata == ResourceType.APATITE.ordinal() && !isDreamcraftLoaded) {
|
||||
int fortuneModifier = world.rand.nextInt(fortune + 2) - 1;
|
||||
if (fortuneModifier < 0) {
|
||||
fortuneModifier = 0;
|
||||
|
||||
@@ -84,31 +84,26 @@ public class BlockSoil extends Block implements IItemTyped {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int i, int j, int k, Random random) {
|
||||
public void updateTick(World world, int x, int y, int z, Random random) {
|
||||
if (world.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
int meta = world.getBlockMetadata(i, j, k);
|
||||
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
SoilType type = getTypeFromMeta(meta);
|
||||
|
||||
if (type == SoilType.HUMUS) {
|
||||
updateTickHumus(world, i, j, k);
|
||||
if (world.checkChunksExist(x - 1, y + 1, z - 1, x + 1, y + 1, z + 1)) {
|
||||
if (isEnrooted(world, x, y, z)) {
|
||||
degradeSoil(world, x, y, z);
|
||||
}
|
||||
}
|
||||
} else if (type == SoilType.BOG_EARTH) {
|
||||
updateTickBogEarth(world, i, j, k);
|
||||
}
|
||||
}
|
||||
|
||||
private static void updateTickHumus(World world, int i, int j, int k) {
|
||||
if (isEnrooted(world, i, j, k)) {
|
||||
degradeSoil(world, i, j, k);
|
||||
}
|
||||
}
|
||||
|
||||
private static void updateTickBogEarth(World world, int i, int j, int k) {
|
||||
if (isMoistened(world, i, j, k)) {
|
||||
matureBog(world, i, j, k);
|
||||
if (world.checkChunksExist(x - 2, y, z - 2, x + 2, y, z + 2)) {
|
||||
if (isMoistened(world, x, y, z)) {
|
||||
matureBog(world, x, y, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +117,6 @@ public class BlockSoil extends Block implements IItemTyped {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -156,7 +150,6 @@ public class BlockSoil extends Block implements IItemTyped {
|
||||
}
|
||||
|
||||
private static boolean isMoistened(World world, int x, int y, int z) {
|
||||
|
||||
for (int i = -2; i < 3; i++) {
|
||||
for (int j = -2; j < 3; j++) {
|
||||
Block block = world.getBlock(x + i, y, z + j);
|
||||
@@ -165,7 +158,6 @@ public class BlockSoil extends Block implements IItemTyped {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
@@ -50,29 +49,22 @@ public abstract class BlockStructure extends BlockForestry {
|
||||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (!(tile instanceof MultiblockTileEntityForestry)) {
|
||||
if (!(tile instanceof MultiblockTileEntityForestry<?>part)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
MultiblockTileEntityForestry part = (MultiblockTileEntityForestry) tile;
|
||||
IMultiblockController controller = part.getMultiblockLogic().getController();
|
||||
|
||||
// If the player's hands are empty and they right-click on a multiblock, they get a
|
||||
// multiblock-debugging message if the machine is not assembled.
|
||||
if (player.getCurrentEquippedItem() == null && !controller.isAssembled()) {
|
||||
if (controller != null) {
|
||||
String validationError = controller.getLastValidationError();
|
||||
if (validationError != null) {
|
||||
long tick = world.getTotalWorldTime();
|
||||
if (tick > previousMessageTick + 20) {
|
||||
player.addChatMessage(new ChatComponentText(validationError));
|
||||
previousMessageTick = tick;
|
||||
}
|
||||
return true;
|
||||
String validationError = controller.getLastValidationError();
|
||||
if (validationError != null) {
|
||||
long tick = world.getTotalWorldTime();
|
||||
if (tick > previousMessageTick + 20) {
|
||||
player.addChatMessage(new ChatComponentText(validationError));
|
||||
previousMessageTick = tick;
|
||||
}
|
||||
} else {
|
||||
player.addChatMessage(
|
||||
new ChatComponentText(StatCollector.translateToLocal("for.multiblock.error.notConnected")));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -94,13 +86,12 @@ public abstract class BlockStructure extends BlockForestry {
|
||||
return;
|
||||
}
|
||||
|
||||
if (entityLiving instanceof EntityPlayer) {
|
||||
if (entityLiving instanceof EntityPlayer player) {
|
||||
TileEntity tile = world.getTileEntity(i, j, k);
|
||||
|
||||
if (tile instanceof MultiblockTileEntityForestry) {
|
||||
EntityPlayer player = (EntityPlayer) entityLiving;
|
||||
if (tile instanceof MultiblockTileEntityForestry<?>tileForestry) {
|
||||
GameProfile gameProfile = player.getGameProfile();
|
||||
((MultiblockTileEntityForestry) tile).setOwner(gameProfile);
|
||||
tileForestry.setOwner(gameProfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -125,6 +116,12 @@ public abstract class BlockStructure extends BlockForestry {
|
||||
InventoryUtil.dropSockets((ISocketable) tile, world, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
if (tile instanceof IMultiblockComponent.HasInventory) {
|
||||
IMultiblockComponent.HasInventory hasInventory = (IMultiblockComponent.HasInventory) tile;
|
||||
|
||||
InventoryUtil.dropInventory(hasInventory.getInternalInventory(), world, x, y, z);
|
||||
}
|
||||
}
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
|
||||
@@ -2,5 +2,5 @@ package forestry.core.blocks;
|
||||
|
||||
public interface IItemTyped {
|
||||
|
||||
Enum getTypeFromMeta(int meta);
|
||||
Enum<?> getTypeFromMeta(int meta);
|
||||
}
|
||||
@@ -71,7 +71,7 @@ public class CircuitBoard<T> implements ICircuitBoard {
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
|
||||
type = EnumCircuitBoardType.values()[nbttagcompound.getShort("T")];
|
||||
type = EnumCircuitBoardType.VALUES[nbttagcompound.getShort("T")];
|
||||
|
||||
// Layout
|
||||
if (nbttagcompound.hasKey("LY")) {
|
||||
|
||||
@@ -109,6 +109,6 @@ public class CircuitRegistry implements ICircuitRegistry {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new CircuitBoard(nbttagcompound);
|
||||
return new CircuitBoard<>(nbttagcompound);
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,11 @@ public enum EnumCircuitBoardType {
|
||||
REFINED((short) 3, 0x191919, 0xc9c9c9),
|
||||
INTRICATE((short) 4, 0x191919, 0xe2cb6b);
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumCircuitBoardType[] VALUES = values();
|
||||
|
||||
private final short sockets;
|
||||
private final int primaryColor;
|
||||
private final int secondaryColor;
|
||||
|
||||
@@ -63,7 +63,7 @@ public class GuiSolderingIron extends GuiForestry<ContainerSolderingIron, ItemIn
|
||||
try {
|
||||
ICircuitSocketType socketType = layout.getSocketType();
|
||||
if (CircuitSocketType.FARM.equals(socketType)) {
|
||||
FarmDirection farmDirection = FarmDirection.values()[i];
|
||||
FarmDirection farmDirection = FarmDirection.fromOrdinal(i);
|
||||
String farmDirectionString = farmDirection.toString().toLowerCase(Locale.ENGLISH);
|
||||
String localizedDirection = StringUtil.localize("gui.solder." + farmDirectionString);
|
||||
fontRendererObj.drawString(
|
||||
@@ -79,7 +79,6 @@ public class GuiSolderingIron extends GuiForestry<ContainerSolderingIron, ItemIn
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
Loaded 100 of 492 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user