Compare commits

..
1 Commits
Author SHA1 Message Date
Martin Robertzandkuba6000 19ef8fe309 Bees (#47)
* New formula

* Make production modifier globally additive

---------

Co-authored-by: kuba6000 <[email protected]>
2023-03-28 07:42:16 +02:00
231 changed files with 2555 additions and 2467 deletions

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
RUNDIR="run"
CRASH="crash-reports"
SERVERLOG="server.log"
if [[ -d $RUNDIR/$CRASH ]]; then
echo "Crash reports detected:"
cat $RUNDIR/$CRASH/crash*.txt
exit 1
fi
if grep --quiet "Fatal errors were detected" $SERVERLOG; then
echo "Fatal errors detected:"
cat server.log
exit 1
fi
if grep --quiet "The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED" $SERVERLOG; then
echo "Server force stopped:"
cat server.log
exit 1
fi
if ! grep --quiet -Po '.+Done \(.+\)\! For help, type "help" or "\?"' $SERVERLOG; then
echo "Server didn't finish startup:"
cat server.log
exit 1
fi
echo "No crash reports detected"
exit 0
-1
View File
@@ -30,4 +30,3 @@ src/main/resources/mixins.*.json
*.bat
*.DS_Store
!gradlew.bat
layout.json
+12 -2
View File
@@ -3,9 +3,17 @@ 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
@@ -23,6 +31,8 @@ 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, the GTNH Team, 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 and others.
+1532 -3
View File
File diff suppressed because it is too large. Load diff
+7 -6
View File
@@ -1,11 +1,12 @@
// Add your dependencies here
dependencies {
api('curse.maven:cofh-lib-220333:2388748')
compileOnlyApi('com.github.GTNewHorizons:Angelica:1.0.0-beta64:api')
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.8.26-GTNH:dev')
compileOnly('com.github.GTNewHorizons:inventory-tweaks:1.7.1:api')
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.45:api')
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
compile('com.github.GTNewHorizons:NotEnoughItems:2.2.7-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')
compileOnly('curse.maven:craftguide-75557:2459320')
}
+24 -175
View File
@@ -1,211 +1,60 @@
# 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
# Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation.
# Conventionally lowercase.
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
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
# Whether to use modGroup as the maven publishing group.
# When false, com.github.GTNewHorizons is used.
useModGroupForPublishing = false
# 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/
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
# Will update your build.gradle automatically whenever an update is available
autoUpdateBuildScript = false
# Version of Minecraft to target
minecraftVersion = 1.7.10
# Version of Minecraft Forge to target
forgeVersion = 10.13.4.1614
# 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.
# 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
developmentEnvironmentUserName = Developer
# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
# See https://github.com/bsideup/jabel for details on how this works.
enableModernJavaSyntax = true
# Enables injecting missing generics into the decompiled source code for a better coding experience.
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
enableGenericInjection = true
# Generate a class with a String field for the mod version named as defined below.
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
generateGradleTokenClass = 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
# Define a source file of your project with:
# 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 =
# version in @Mod([...], version = VERSION, [...])
# Leave these properties empty to skip individual token replacements
replaceGradleTokenInFile = Constants.java
gradleTokenModId =
gradleTokenModName =
gradleTokenVersion = GRADLETOKEN_VERSION
gradleTokenGroupName =
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
# 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/
# There can be multiple files in a space-separated list.
# Example value: mymodid_at.cfg nei_at.cfg
accessTransformersFile = forestry_at.cfg
# Example value: mymodid_at.cfg
accessTransformersFile =
# 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. 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.
# Specify the package that contains all of your Mixins. You may only place Mixins in this package 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
# 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.
# 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.
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
Binary file not shown.
+1 -2
View File
@@ -1,7 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored
+15 -22
View File
@@ -15,8 +15,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
@@ -57,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -85,8 +83,10 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
APP_HOME=$( cd "${APP_HOME:-./}" && 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"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -114,7 +114,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH="\\\"\\\""
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
@@ -133,13 +133,10 @@ location of your Java installation."
fi
else
JAVACMD=java
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.
which java >/dev/null 2>&1 || 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.
@@ -147,7 +144,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=SC2039,SC3045
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@@ -155,7 +152,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=SC2039,SC3045
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -200,20 +197,16 @@ if "$cygwin" || "$msys" ; then
done
fi
# 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.
# 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.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
Vendored
+12 -14
View File
@@ -13,8 +13,6 @@
@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 ##########################################################################
@@ -45,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
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
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.
goto fail
@@ -59,22 +57,22 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
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
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.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=
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%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
+22
View File
@@ -1,4 +1,26 @@
// 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'
}
}
+10 -5
View File
@@ -4,10 +4,10 @@ pluginManagement {
maven {
// RetroFuturaGradle
name "GTNH Maven"
url "https://nexus.gtnewhorizons.com/repository/public/"
url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
allowInsecureProtocol = true
mavenContent {
includeGroup("com.gtnewhorizons")
includeGroupByRegex("com\\.gtnewhorizons\\..+")
includeGroup("com.gtnewhorizons.retrofuturagradle")
}
}
gradlePluginPortal()
@@ -17,7 +17,12 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.48'
id 'com.diffplug.blowdryerSetup' version '1.6.0'
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' // Provides java toolchains
}
blowdryerSetup {
repoSubfolder 'gtnhShared'
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.2.0')
//devLocal '.' // Use this when testing config updates locally
}
-8
View File
@@ -15,7 +15,6 @@ 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;
@@ -80,15 +79,11 @@ 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);
@@ -117,9 +112,6 @@ 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 0.0f;
return 1.0f;
}
public float getFloweringModifier(IBeeGenome genome, float currentModifier) {
@@ -5,12 +5,7 @@
******************************************************************************/
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 {
@@ -27,15 +22,4 @@ 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;
}
}
@@ -10,7 +10,6 @@ import net.minecraft.world.gen.feature.WorldGenerator;
import net.minecraftforge.common.util.ForgeDirection;
import com.mojang.authlib.GameProfile;
import forestry.api.world.ITreeGenData;
/**
@@ -12,15 +12,11 @@ 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);
}
@@ -34,8 +34,7 @@ public enum FarmDirection {
return SOUTH;
case WEST:
return WEST;
default:
return null;
}
return null;
}
}
@@ -9,37 +9,33 @@ 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 weather event triggered by this substrate in Minecraft ticks.
* Duration of the rain shower 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 RainSubstrate(ItemStack item, float speed, WeatherState weather) {
this(item, 0, speed, weather);
public boolean reverse;
public RainSubstrate(ItemStack item, int duration, float speed) {
this(item, duration, speed, false);
}
public RainSubstrate(ItemStack item, int duration, float speed, WeatherState weather) {
public RainSubstrate(ItemStack item, float speed) {
this(item, 0, speed, true);
}
public RainSubstrate(ItemStack item, int duration, float speed, boolean reverse) {
this.item = item;
this.duration = duration;
this.speed = speed;
this.weather = weather;
this.reverse = reverse;
}
}
@@ -11,7 +11,6 @@ import java.util.Map;
import net.minecraft.item.ItemStack;
import com.mojang.authlib.GameProfile;
import forestry.api.genetics.IClassification.EnumClassLevel;
/**
@@ -52,8 +52,4 @@ public interface IIndividual extends INBTTagable {
IIndividual copy();
boolean isPureBred(IChromosomeType chromosomeType);
default void addLore(List<String> text) {}
default void addDiscoveredBy(List<String> text) {}
}
@@ -6,7 +6,6 @@
package forestry.api.mail;
import com.mojang.authlib.GameProfile;
import forestry.api.core.INBTTagable;
public interface IMailAddress extends INBTTagable {
@@ -49,14 +49,6 @@ 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;
}
}
/**
@@ -9,8 +9,6 @@ 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.
*/
@@ -47,15 +45,4 @@ 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();
}
}
@@ -9,7 +9,6 @@ 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.9f; // results in 0.1 with no frames, see BeeHousingModifier,java
return 0.1f;
}
}
@@ -49,8 +49,7 @@ public class BeeHousingModifier implements IBeeModifier {
@Override
public float getProductionModifier(IBeeGenome genome, final float currentModifier) {
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`
float modifierValue = 1.0f;
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.75f;// results in 0.25 with no frames, see BeeHousingModifier,java
return 0.25f;
}
@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 (int b = 0; b < 128; ++b) spawnCopy.add(spawn.get(b));
else for (byte b = 0; b < 128; ++b) spawnCopy.add(spawn.get(b));
NBTTagList nbttaglist = new NBTTagList();
while (!spawnCopy.isEmpty() && spawnCopy.size() <= 128) {
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
@@ -1,125 +0,0 @@
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,10 +8,7 @@
******************************************************************************/
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;
@@ -76,27 +73,4 @@ 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,13 +12,12 @@ 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<? extends IMachineProperties> apicultureChest;
public final BlockBase apicultureChest;
public final BlockBeehives beehives;
public final BlockCandle candle;
public final BlockStump stump;
@@ -27,7 +26,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);
@@ -14,7 +14,6 @@ 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,7 +213,6 @@ 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.blockExists(x, y, z) || !world.isAirBlock(x, y, z)) {
if (!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.blockExists(x, y, z) || !world.isAirBlock(x, y, z)) {
if (!world.isAirBlock(x, y, z)) {
return false;
}
@@ -34,10 +34,6 @@ 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,9 +8,6 @@
******************************************************************************/
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;
@@ -18,8 +15,6 @@ 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;
@@ -31,20 +26,7 @@ import net.minecraft.world.biome.BiomeGenBase;
import com.mojang.authlib.GameProfile;
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.apiculture.*;
import forestry.api.core.BiomeHelper;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
@@ -378,36 +360,6 @@ 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) {
@@ -562,8 +514,8 @@ public class Bee extends IndividualLiving implements IBee {
// Bee genetic speed * beehousing * beekeeping mode
float speed = genome.getSpeed();
float prodModifier = beeHousingModifier.getProductionModifier(genome, 0f);
prodModifier += beeModeModifier.getProductionModifier(genome, prodModifier);
float prodModifier = beeHousingModifier.getProductionModifier(genome, 1f)
* beeModeModifier.getProductionModifier(genome, 1f);
// / Primary Products
for (Map.Entry<ItemStack, Float> entry : primary.getProductChances().entrySet()) {
@@ -599,13 +551,10 @@ 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)) / 100f;
* Math.pow(beeSpeed, 0.37)) / 100.f;
}
/* REPRODUCTION */
@@ -734,9 +683,9 @@ public class Bee extends IndividualLiving implements IBee {
// boost chance for researched mutations
if (breedingTracker.isResearched(beeMutation)) {
float mutationBoost = safeMultiply(chance, Config.researchMutationBoostMultiplier - 1.0f);
float mutationBoost = chance * (Config.researchMutationBoostMultiplier - 1.0f);
mutationBoost = Math.min(Config.maxResearchMutationBoostPercent, mutationBoost);
chance = safeAdd(chance, mutationBoost);
chance += mutationBoost;
}
if (chance > world.rand.nextFloat() * 100) {
@@ -773,9 +722,6 @@ 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) {
@@ -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.getAsh(), 0.15f).setTemperature(EnumTemperature.HELLISH)
.addProduct(PluginCore.items.ash.getItemStack(), 0.15f).setTemperature(EnumTemperature.HELLISH)
.setHumidity(EnumHumidity.ARID);
}
@@ -8,8 +8,6 @@
******************************************************************************/
package forestry.apiculture.genetics;
import static forestry.core.utils.MathUtil.safeMultiply;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World;
@@ -51,8 +49,8 @@ public class BeeMutation extends Mutation implements IBeeMutationCustom {
IBeeModifier beeHousingModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
IBeeModifier beeModeModifier = BeeManager.beeRoot.getBeekeepingMode(world).getBeeModifier();
processedChance = safeMultiply(processedChance, beeHousingModifier.getMutationModifier(genome0, genome1, 1.0F));
processedChance = safeMultiply(processedChance, beeModeModifier.getMutationModifier(genome0, genome1, 1.0F));
processedChance *= beeHousingModifier.getMutationModifier(genome0, genome1, processedChance);
processedChance *= beeModeModifier.getMutationModifier(genome0, genome1, processedChance);
return processedChance;
}
@@ -24,19 +24,11 @@ import forestry.api.apiculture.IBeekeepingMode;
public class BeekeepingMode implements IBeekeepingMode {
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
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);
private final Random rand;
private final String name;
@@ -101,7 +93,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(), 0f);
float productionModifier = beeModifier.getProductionModifier(queen.getGenome(), 1f);
if (productionModifier > 16) {
if (housing.getWorld().rand.nextFloat() * 100 < 0.01 * ((productionModifier * productionModifier) - 100)) {
return true;
@@ -13,7 +13,6 @@ 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;
@@ -22,7 +21,7 @@ import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.genetics.IEffectData;
import forestry.apiculture.multiblock.AlvearyController;
import forestry.apiculture.blocks.BlockAlveary;
import forestry.core.utils.DamageSourceForestry;
import forestry.core.utils.vect.Vect;
@@ -37,13 +36,8 @@ 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 storedData;
}
private boolean isMobGriefingEnabled(IBeeHousing housing) {
return housing.getWorld().getGameRules().getGameRuleBooleanValue("mobGriefing");
return destroyEnvironment(genome, storedData, housing);
}
private void harmEntities(IBeeGenome genome, IBeeHousing housing) {
@@ -62,7 +56,7 @@ public class AlleleEffectRadioactive extends AlleleEffectThrottled {
}
}
private static void destroyEnvironment(IBeeGenome genome, IBeeHousing housing) {
private static IEffectData destroyEnvironment(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
World world = housing.getWorld();
Random rand = world.rand;
@@ -71,66 +65,43 @@ 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).add(offset);
Vect posBlock = randomPos.add(posHousing);
posBlock = posBlock.add(offset);
// 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)) {
if (posBlock.y <= 1 || posBlock.y >= housing.getWorld().getActualHeight()) {
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;
}
// 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;
}
Block block = world.getBlock(posBlock.x, posBlock.y, posBlock.z);
// Never delete a tile entity. Allows far too much griefing and abuse otherwise.
if (block instanceof BlockAlveary) {
continue;
}
TileEntity tile = world.getTileEntity(posBlock.x, posBlock.y, posBlock.z);
if (tile != null) {
if (tile instanceof IBeeHousing) {
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;
}
}
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;
return storedData;
}
}
@@ -27,10 +27,6 @@ public abstract class AlleleEffectThrottled extends AlleleEffect {
this.requiresWorkingQueen = requiresWorking;
}
public int getThrottle() {
return throttle;
}
@Override
public boolean isCombinable() {
return isCombinable;
@@ -13,13 +13,7 @@ import java.util.ArrayList;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
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.apiculture.*;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAlleleInteger;
import forestry.api.genetics.IAlleleTolerance;
@@ -71,8 +71,9 @@ 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);
EnumTemperature temperature = EnumTemperature
.getFromBiome(currentBiome, (int) player.posX, (int) player.posY, (int) player.posZ);
float temperatureValue = currentBiome
.getFloatTemperature((int) player.posX, (int) player.posY, (int) player.posZ);
EnumTemperature temperature = EnumTemperature.getFromValue(temperatureValue);
EnumHumidity humidity = EnumHumidity.getFromValue(currentBiome.rainfall);
list.add(StringUtil.localize("gui.currentBiome") + ": " + currentBiome.biomeName);
@@ -56,7 +56,7 @@ public class ItemHiveFrame extends ItemForestry implements IHiveFrame {
@Override
public float getProductionModifier(IBeeGenome genome, float currentModifier) {
return (currentModifier < 10.0f) ? 1.0f : 0.0f;
return (currentModifier < 10f) ? 2f : 1f;
}
@Override
@@ -9,10 +9,8 @@
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;
@@ -61,9 +59,7 @@ 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 TreeSet<>(
Comparator.comparingInt(IAlvearyComponent.Climatiser::getPriority).thenComparingInt(Object::hashCode)
.reversed());
private final Set<IAlvearyComponent.Climatiser> climatisers = new HashSet<>();
private final Set<IAlvearyComponent.Active> activeComponents = new HashSet<>();
// CLIENT
@@ -159,8 +155,6 @@ public class AlvearyController extends RectangularMultiblockControllerBase
activeComponents.remove(oldPart);
}
}
inventory.dumpInventoryIntoWorld(this.worldObj, oldPart.getCoordinates());
}
@Override
@@ -239,24 +233,26 @@ 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 float applyChange(float base, float currentChange, float extraChange, float boundaryDown,
float boundaryUp) {
float boundedNewChange = Math.max(boundaryDown, Math.min(base + currentChange + (extraChange * 20), boundaryUp))
- base;
if (extraChange > 0) {
return Math.max(currentChange, boundedNewChange);
} else {
return Math.min(currentChange, boundedNewChange);
private static float equalizeChange(float change) {
if (change == 0) {
return 0;
}
change *= 0.95f;
if (change <= 0.001f && change >= -0.001f) {
change = 0;
}
return change;
}
@Override
@@ -414,13 +410,21 @@ public class AlvearyController extends RectangularMultiblockControllerBase
ChunkCoordinates coordinates = getCoordinates();
float temperature = getBiome().getFloatTemperature(coordinates.posX, coordinates.posY, coordinates.posZ);
tempChange = applyChange(temperature, tempChange, change, boundaryDown, boundaryUp);
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;
}
@Override
public void addHumidityChange(float change, float boundaryDown, float boundaryUp) {
float humidity = getBiome().rainfall;
humidChange = applyChange(humidity, humidChange, change, boundaryDown, boundaryUp);
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;
}
/* GUI */
@@ -32,7 +32,7 @@ public class TileAlvearyFan extends TileAlvearyClimatiser {
@Override
public float getBoundaryDown() {
return -1f;
return 0.05f;
}
@Override
@@ -22,12 +22,12 @@ public class TileAlvearyHeater extends TileAlvearyClimatiser {
@Override
public float getChangePerTransfer() {
return 0.015f;
return 0.01f;
}
@Override
public float getBoundaryUp() {
return 3.5f;
return 2.5f;
}
@Override
@@ -19,7 +19,6 @@ 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;
@@ -32,8 +31,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, IMultiblockComponent.HasInventory {
public class TileAlvearyHygroregulator extends TileAlveary
implements IInventory, ILiquidTankTile, IFluidHandler, IAlvearyComponent.Climatiser {
private final HygroregulatorRecipe[] recipes;
@@ -57,9 +56,9 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
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
@@ -112,11 +111,6 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
}
}
@Override
public int getPriority() {
return 100;
}
/* SAVING & LOADING */
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
@@ -18,7 +18,6 @@ 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;
@@ -26,8 +25,7 @@ import forestry.apiculture.inventory.InventoryAlvearySieve;
import forestry.core.inventory.IInventoryAdapter;
import forestry.core.inventory.watchers.ISlotPickupWatcher;
public class TileAlvearySieve extends TileAlveary
implements IAlvearyComponent.BeeListener, IMultiblockComponent.HasInventory {
public class TileAlvearySieve extends TileAlveary implements IAlvearyComponent.BeeListener {
private final IBeeListener beeListener;
private final InventoryAlvearySieve inventory;
@@ -8,9 +8,8 @@
******************************************************************************/
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;
@@ -22,7 +21,6 @@ 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;
@@ -38,11 +36,10 @@ 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, IMultiblockComponent.HasInventory {
public class TileAlvearySwarmer extends TileAlveary implements ISidedInventory, IActivatable, IAlvearyComponent.Active {
private final InventorySwarmer inventory;
private final Deque<ItemStack> pendingSpawns = new ArrayDeque<>();
private final Stack<ItemStack> pendingSpawns = new Stack<>();
private boolean active;
public TileAlvearySwarmer() {
@@ -15,14 +15,11 @@ 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
@@ -61,7 +58,7 @@ public class RenderCandleBlock implements ISimpleBlockRenderingHandler {
IIcon iconB = block.getTextureFromPassAndLit(1, isLit);
int colour = tileCandle.getColour();
final Tessellator tessellator = Tessellator.instance;
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;
@@ -90,7 +87,7 @@ public class RenderCandleBlock implements ISimpleBlockRenderingHandler {
private static void renderCandleAtAngle(IIcon icon, double x, double y, double z, double par8, double par10,
int colour) {
final Tessellator tessellator = Tessellator.instance;
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", "unchecked" })
@SuppressWarnings("rawtypes")
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,6 +28,7 @@ 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]);
@@ -168,7 +168,6 @@ 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();
@@ -61,7 +61,6 @@ public class BlockFruitPod extends BlockCocoa {
tile.onBlockTick();
}
@SuppressWarnings("deprecation")
@Override
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) {
if (!world.isRemote) {
@@ -16,8 +16,6 @@ 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;
@@ -300,36 +298,6 @@ 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) {
@@ -1059,8 +1059,6 @@ 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);
@@ -1148,14 +1146,6 @@ 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;
@@ -15,14 +15,11 @@ 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
@@ -40,7 +37,7 @@ public class RenderFruitPodBlock implements ISimpleBlockRenderingHandler {
maturity = pod.getMaturity();
}
final Tessellator tessellator = Tessellator.instance;
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,8 +14,6 @@ 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;
@@ -24,7 +22,6 @@ import forestry.plugins.PluginArboriculture;
/**
* Ugly but serviceable renderer for leaves, taking fruits into account.
*/
@ThreadSafeISBRH(perThread = false)
public class RenderLeavesBlock extends RenderOverlayBlock {
@Override
@@ -15,8 +15,6 @@ 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;
@@ -24,9 +22,10 @@ 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) {}
@@ -46,8 +45,10 @@ public class RenderSaplingBlock implements ISimpleBlockRenderingHandler {
IAlleleTreeSpecies species = tile.getTree().getGenome().getPrimary();
renderCrossedSquares(species, world, block, x, y, z, 0);
renderCrossedSquares(species, world, block, x, y, z, 1);
renderCrossedSquares(species, world, block, x, y, z);
renderLayer = 1;
renderCrossedSquares(species, world, block, x, y, z);
renderLayer = 0;
return true;
}
@@ -62,9 +63,9 @@ public class RenderSaplingBlock implements ISimpleBlockRenderingHandler {
}
private static boolean renderCrossedSquares(IAlleleTreeSpecies species, IBlockAccess world, Block block, int x,
int y, int z, int renderLayer) {
int y, int z) {
final Tessellator tess = Tessellator.instance;
Tessellator tess = Tessellator.instance;
tess.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
int colourMultiplier = species.getGermlingColour(EnumGermlingType.SAPLING, renderLayer);
@@ -80,14 +81,14 @@ public class RenderSaplingBlock implements ISimpleBlockRenderingHandler {
}
tess.setColorOpaque_F(r, g, b);
drawCrossedSquares(species, x, y, z, 1.0f, renderLayer);
drawCrossedSquares(species, x, y, z, 1.0f);
return true;
}
private static void drawCrossedSquares(IAlleleTreeSpecies species, double par3, double par5, double par7, float mod,
int renderLayer) {
private static void drawCrossedSquares(IAlleleTreeSpecies species, double par3, double par5, double par7,
float mod) {
final Tessellator tess = Tessellator.instance;
Tessellator tess = Tessellator.instance;
IIcon icon = species.getGermlingIcon(EnumGermlingType.SAPLING, renderLayer);
double d3 = (double) icon.getMinU();
@@ -12,7 +12,6 @@ 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 {
@@ -35,7 +35,6 @@ 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,8 +8,6 @@
******************************************************************************/
package forestry.core.blocks;
import static forestry.Forestry.isDreamcraftLoaded;
import java.util.ArrayList;
import java.util.List;
@@ -54,7 +52,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 && !isDreamcraftLoaded) {
if (metadata == 0) {
this.dropXpOnBlockBreak(world, x, y, z, MathHelper.getRandomIntegerInRange(world.rand, 1, 4));
}
}
@@ -63,7 +61,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() && !isDreamcraftLoaded) {
if (metadata == ResourceType.APATITE.ordinal()) {
int fortuneModifier = world.rand.nextInt(fortune + 2) - 1;
if (fortuneModifier < 0) {
fortuneModifier = 0;
@@ -16,6 +16,7 @@ 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;
@@ -49,22 +50,29 @@ public abstract class BlockStructure extends BlockForestry {
}
TileEntity tile = world.getTileEntity(x, y, z);
if (!(tile instanceof MultiblockTileEntityForestry<?>part)) {
if (!(tile instanceof MultiblockTileEntityForestry)) {
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()) {
String validationError = controller.getLastValidationError();
if (validationError != null) {
long tick = world.getTotalWorldTime();
if (tick > previousMessageTick + 20) {
player.addChatMessage(new ChatComponentText(validationError));
previousMessageTick = tick;
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;
}
} else {
player.addChatMessage(
new ChatComponentText(StatCollector.translateToLocal("for.multiblock.error.notConnected")));
return true;
}
}
@@ -86,12 +94,13 @@ public abstract class BlockStructure extends BlockForestry {
return;
}
if (entityLiving instanceof EntityPlayer player) {
if (entityLiving instanceof EntityPlayer) {
TileEntity tile = world.getTileEntity(i, j, k);
if (tile instanceof MultiblockTileEntityForestry<?>tileForestry) {
if (tile instanceof MultiblockTileEntityForestry) {
EntityPlayer player = (EntityPlayer) entityLiving;
GameProfile gameProfile = player.getGameProfile();
tileForestry.setOwner(gameProfile);
((MultiblockTileEntityForestry) tile).setOwner(gameProfile);
}
}
}
@@ -116,12 +125,6 @@ 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);
}
@@ -109,6 +109,6 @@ public class CircuitRegistry implements ICircuitRegistry {
return null;
}
return new CircuitBoard<>(nbttagcompound);
return new CircuitBoard(nbttagcompound);
}
}
@@ -79,6 +79,7 @@ public class GuiSolderingIron extends GuiForestry<ContainerSolderingIron, ItemIn
}
}
@SuppressWarnings("unchecked")
@Override
public void initGui() {
super.initGui();
@@ -75,7 +75,7 @@ public class ItemCircuitBoard extends ItemForestryMultiPass {
public static ItemStack createCircuitboard(EnumCircuitBoardType type, ICircuitLayout layout, ICircuit[] circuits) {
ItemStack chipset = PluginCore.items.circuitboards.get(type);
saveChipset(chipset, new CircuitBoard<>(type, layout, circuits));
saveChipset(chipset, new CircuitBoard(type, layout, circuits));
return chipset;
}
@@ -164,6 +164,7 @@ public class CommandHelpers {
return false;
}
@SuppressWarnings("unchecked")
public static List<String> getListOfStringsMatchingLastWord(String[] strings, String... lastWords) {
return CommandBase.getListOfStringsMatchingLastWord(strings, lastWords);
}
@@ -26,11 +26,24 @@ public class CommandVersion extends SubCommand {
@Override
public void processSubCommand(ICommandSender sender, String[] args) {
ChatStyle style = new ChatStyle();
if (Version.isOutdated()) {
style.setColor(EnumChatFormatting.RED);
} else {
style.setColor(EnumChatFormatting.GREEN);
}
CommandHelpers.sendLocalizedChatMessage(
sender,
new ChatStyle().setColor(EnumChatFormatting.GREEN),
style,
"for.chat.version",
Version.getVersion(),
Proxies.common.getMinecraftVersion());
Proxies.common.getMinecraftVersion(),
Version.getRecommendedVersion());
if (Version.isOutdated()) {
for (String updateLine : Version.getChangelog()) {
CommandHelpers.sendChatMessage(sender, EnumChatFormatting.BLUE + updateLine);
}
}
}
}
@@ -74,7 +74,7 @@ public class RootCommand extends CommandBase implements IForestryCommand {
}
@Override
public List<String> addTabCompletionOptions(ICommandSender sender, String[] incomplete) {
public List addTabCompletionOptions(ICommandSender sender, String[] incomplete) {
return CommandHelpers.addStandardTabCompletionOptions(this, sender, incomplete);
}
@@ -18,13 +18,11 @@ import java.util.HashSet;
import java.util.Properties;
import java.util.Set;
import net.minecraft.item.Item;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.config.Property;
import com.google.common.collect.LinkedListMultimap;
import cpw.mods.fml.common.registry.GameRegistry;
import forestry.Forestry;
import forestry.core.fluids.Fluids;
import forestry.core.utils.Log;
@@ -99,37 +97,6 @@ public class Config {
public static GuiMailboxInfo.XPosition mailAlertXPosition = GuiMailboxInfo.XPosition.LEFT;
public static GuiMailboxInfo.YPosition mailAlertYPosition = GuiMailboxInfo.YPosition.TOP;
public static Set<Item> mailBlacklist = new HashSet<Item>();
public static String[] mailBlacklistString;
public static final String[] mailBlacklistDefault = new String[] { "arsmagica2:essenceBag", "arsmagica2:runeBag",
"betterstorage:backpack", "betterstorage:cardboardBox", "betterstorage:thaumcraftBackpack",
"Botania:baubleBox", "Botania:flowerBag", "cardboardboxes:cbCardboardBox", "dendrology:fullDrawers1",
"dendrology:fullDrawers2", "dendrology:fullDrawers4", "dendrology:halfDrawers2", "dendrology:halfDrawers4",
"DQMIIINext:ItemMahounoTutu11", "DQMIIINext:ItemOokinaFukuro", "DQMIIINext:ItemOokinaFukuroB",
"DQMIIINext:ItemOokinaFukuroG", "DQMIIINext:ItemOokinaFukuroR", "DQMIIINext:ItemOokinaFukuroY",
"ExtraUtilities:golden_bag", "HardcoreEnderExpansion:charm_pouch", "ImmersiveEngineering:toolbox",
"ironbackpacks:basicBackpack", "ironbackpacks:diamondBackpack", "ironbackpacks:goldBackpack",
"ironbackpacks:ironBackpack", "JABBA:mover", "JABBA:moverDiamond", "MagicBees:backpack.thaumaturgeT1",
"MagicBees:backpack.thaumaturgeT2", "Mekanism:CardboardBox", "MineFactoryReloaded:plastic.bag",
"OpenBlocks:devnull", "ProjectE:item.pe_alchemical_bag",
"ProjRed|Exploration:projectred.exploration.backpack", "sgs_treasure:dread_pirate_chest",
"sgs_treasure:iron_chest", "sgs_treasure:locked_wooden_chest", "sgs_treasure:obsidian_chest",
"sgs_treasure:pirate_chest", "sgs_treasure:wither_chest", "sgs_treasure:wooden_chest",
"StorageDrawers:compDrawers", "StorageDrawers:fullCustom1", "StorageDrawers:fullCustom2",
"StorageDrawers:fullCustom4", "StorageDrawers:fullDrawers1", "StorageDrawers:fullDrawers2",
"StorageDrawers:fullDrawers4", "StorageDrawers:halfCustom2", "StorageDrawers:halfCustom4",
"StorageDrawers:halfDrawers2", "StorageDrawers:halfDrawers4", "StorageDrawersBop:fullDrawers1",
"StorageDrawersBop:fullDrawers1", "StorageDrawersBop:fullDrawers2", "StorageDrawersBop:fullDrawers2",
"StorageDrawersBop:fullDrawers4", "StorageDrawersBop:fullDrawers4", "StorageDrawersBop:halfDrawers2",
"StorageDrawersBop:halfDrawers2", "StorageDrawersBop:halfDrawers4", "StorageDrawersBop:halfDrawers4",
"StorageDrawersForestry:fullDrawers1A", "StorageDrawersForestry:fullDrawers2A",
"StorageDrawersForestry:fullDrawers4A", "StorageDrawersForestry:halfDrawers2A",
"StorageDrawersForestry:halfDrawers4A", "StorageDrawersNatura:fullDrawers1",
"StorageDrawersNatura:fullDrawers2", "StorageDrawersNatura:fullDrawers4",
"StorageDrawersNatura:halfDrawers2", "StorageDrawersNatura:halfDrawers4", "Thaumcraft:FocusPouch",
"ThaumicTinkerer:ichorPouch", "thebetweenlands:lurkerSkinPouch", "ThermalExpansion:Strongbox",
"ThermalExpansion:satchel", "warpbook:warpbook", "witchery:brewbag", "WitchingGadgets:item.WG_Bag" };
// Gui tabs (Ledger)
public static int guiTabSpeed = 8;
@@ -137,7 +104,6 @@ public class Config {
public static boolean enableHints = true;
public static final LinkedListMultimap<String, String> hints = LinkedListMultimap.create();
public static boolean enableEnergyStat = true;
public static boolean showBackpackDurability = true;
public static boolean isStructureEnabled(String uid) {
return !Config.disabledStructures.contains(uid);
@@ -302,9 +268,6 @@ public class Config {
configCommon.moveProperty("tweaks.gui", "mail.alert", "tweaks.gui.mail.alert");
configCommon.renameProperty("tweaks.gui.mail.alert", "mail.alert", "enabled");
showBackpackDurability = configCommon
.getBooleanLocalized("tweaks.gui", "showBackpackDurability", showBackpackDurability);
mailAlertEnabled = configCommon.getBooleanLocalized("tweaks.gui.mail.alert", "enabled", mailAlertEnabled);
mailAlertXPosition = configCommon.getEnumLocalized(
"tweaks.gui.mail.alert",
@@ -316,11 +279,6 @@ public class Config {
"yPosition",
mailAlertYPosition,
GuiMailboxInfo.YPosition.values());
mailBlacklistString = configCommon.getStringList(
"mailBlacklist",
"restrictions",
mailBlacklistDefault,
"Items that cannot be shipped through a letter");
guiTabSpeed = configCommon.getIntLocalized("tweaks.gui.tabs", "speed", guiTabSpeed, 1, 50);
enableHints = configCommon.getBooleanLocalized("tweaks.gui.tabs", "hints", enableHints);
@@ -428,16 +386,4 @@ public class Config {
return list.split("[;]+");
}
}
public static void parseMailBlacklist() {
for (String itemName : mailBlacklistString) {
String[] nameAndID;
if (itemName.contains(":") && (nameAndID = itemName.split(":")).length == 2) {
Item item = GameRegistry.findItem(nameAndID[0], nameAndID[1]);
if (item != null) {
mailBlacklist.add(item);
}
}
}
}
}
@@ -8,7 +8,6 @@
******************************************************************************/
package forestry.core.config;
import forestry.Tags;
import forestry.api.core.IForestryConstants;
public class Constants implements IForestryConstants {
@@ -16,7 +15,7 @@ public class Constants implements IForestryConstants {
// System
public static final String MOD = "Forestry";
public static final String ID = "forestry";
public static final String VERSION = Tags.VERSION;
public static final String VERSION = "GRADLETOKEN_VERSION";
public static final String URL = "http://forestry.sengir.net/";
public static final int FLAG_BLOCK_UPDATE = 1;
@@ -109,7 +108,6 @@ public class Constants implements IForestryConstants {
public static final int MACHINE_MAX_ENERGY = 5000;
public static final int RAINMAKER_RAIN_DURATION_IODINE = 10000;
public static final int RAINMAKER_RAIN_DURATION_PHOSPHORICIODINE = 10000;
public static final int STILL_DESTILLATION_DURATION = 100;
public static final int STILL_DESTILLATION_INPUT = 10;
@@ -25,7 +25,6 @@ public class ForestryGuiConfig extends GuiConfig {
super(parent, getConfigCategories(), Constants.MOD, true, true, Constants.MOD);
}
@SuppressWarnings("rawtypes")
private static List<IConfigElement> getConfigCategories() {
List<IConfigElement> configElements = new ArrayList<>();
@@ -33,13 +32,13 @@ public class ForestryGuiConfig extends GuiConfig {
.asList("crafting", "difficulty", "genetics", "performance", "structures", "tweaks", "world");
for (String categoryName : commonCategoryNames) {
ConfigCategory category = Config.configCommon.getCategory(categoryName);
configElements.add(new ConfigElement<>(category));
configElements.add(new ConfigElement(category));
}
List<String> fluidCategoryNames = Arrays.asList("enableFluid", "enableFluidBlock");
for (String categoryName : fluidCategoryNames) {
ConfigCategory category = Config.configFluid.getCategory(categoryName);
configElements.add(new ConfigElement<>(category));
configElements.add(new ConfigElement(category));
}
return configElements;
+146 -20
View File
@@ -8,7 +8,21 @@
******************************************************************************/
package forestry.core.config;
import forestry.Tags;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
import forestry.Forestry;
import forestry.core.proxy.Proxies;
import forestry.core.utils.Log;
/**
* With permission from pahimar.
@@ -17,51 +31,163 @@ import forestry.Tags;
*/
public class Version {
@Deprecated
public enum EnumUpdateState {
CURRENT,
OUTDATED,
CONNECTION_ERROR
}
public static final String VERSION = Tags.VERSION;
@Deprecated
public static final String BUILD_NUMBER = "";
@Deprecated
public static final String VERSION = "@VERSION@";
public static final String BUILD_NUMBER = "@BUILD_NUMBER@";
public static final String[] FAILED_CHANGELOG = new String[] {
String.format("Unable to retrieve changelog for %s", Constants.MOD) };
@Deprecated
private static final String REMOTE_VERSION_FILE = "http://bit.ly/forestryver";
private static final String REMOTE_CHANGELOG_ROOT = "https://dl.dropbox.com/u/44760587/forestry/changelog/";
public static EnumUpdateState currentVersion = EnumUpdateState.CURRENT;
private static String recommendedVersion;
private static String[] cachedChangelog = FAILED_CHANGELOG;
public static String getVersion() {
return VERSION;
return VERSION + " (" + BUILD_NUMBER + ")";
}
@Deprecated
public static boolean isOutdated() {
return false;
return currentVersion == EnumUpdateState.OUTDATED;
}
@Deprecated
public static boolean needsUpdateNoticeAndMarkAsSeen() {
return false;
if (!isOutdated()) {
return false;
}
File versionFile = new File(Forestry.instance.getConfigFolder(), Config.CATEGORY_COMMON + ".cfg");
Configuration config = new Configuration(versionFile);
Property property = config.get("version", "seen", VERSION);
property.comment = "indicates the last version the user has been informed about and will suppress further notices on it.";
String seenVersion = property.getString();
if (recommendedVersion == null || recommendedVersion.equals(seenVersion)) {
return false;
}
property.set(recommendedVersion);
config.save();
return true;
}
@Deprecated
public static String getRecommendedVersion() {
return VERSION;
return recommendedVersion;
}
@Deprecated
public static void versionCheck() {}
private static class VersionChecker extends Thread {
@Override
public void run() {
try {
String location = REMOTE_VERSION_FILE;
HttpURLConnection conn = null;
while (location != null && !location.isEmpty()) {
URL url = new URL(location);
conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty(
"User-Agent",
"Mozilla/5.0 (Windows; U; Windows NT 6.0; ru; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)");
conn.connect();
location = conn.getHeaderField("Location");
}
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
String mcVersion = Proxies.common.getMinecraftVersion();
while ((line = reader.readLine()) != null) {
if (line.startsWith(mcVersion) && line.contains(Constants.MOD)) {
String[] tokens = line.split(":");
recommendedVersion = tokens[2];
}
}
if (recommendedVersion == null) {
return;
}
int result = FMLCommonHandler.instance().findContainerFor(Forestry.instance).getProcessedVersion()
.compareTo(new DefaultArtifactVersion(recommendedVersion));
if (result >= 0) {
Log.finer(
"Using the latest version [" + VERSION
+ " (build:"
+ BUILD_NUMBER
+ ")] for Minecraft "
+ mcVersion);
currentVersion = EnumUpdateState.CURRENT;
return;
}
cachedChangelog = grabChangelog(recommendedVersion);
Log.warning(
"Using outdated version [" + VERSION
+ " (build:"
+ BUILD_NUMBER
+ ")] for Minecraft "
+ mcVersion
+ ". Consider updating.");
currentVersion = EnumUpdateState.OUTDATED;
} catch (Exception e) {
// e.printStackTrace();
Log.warning("Unable to read from remote version authority.");
currentVersion = EnumUpdateState.CONNECTION_ERROR;
}
}
}
public static void versionCheck() {
new VersionChecker().start();
}
@Deprecated
public static String[] getChangelog() {
return FAILED_CHANGELOG;
return cachedChangelog;
}
@Deprecated
public static String[] grabChangelog(String version) {
return FAILED_CHANGELOG;
try {
String location = REMOTE_CHANGELOG_ROOT + version;
HttpURLConnection conn;
do {
URL url = new URL(location);
conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty(
"User-Agent",
"Mozilla/5.0 (Windows; U; Windows NT 6.0; ru; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)");
conn.connect();
location = conn.getHeaderField("Location");
} while (location != null && !location.isEmpty());
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
ArrayList<String> changelog = new ArrayList<>();
while ((line = reader.readLine()) != null) {
if (line.startsWith("#")) {
continue;
}
if (line.isEmpty()) {
continue;
}
changelog.add(line);
}
return changelog.toArray(new String[changelog.size()]);
} catch (Exception ex) {
// ex.printStackTrace();
Log.warning("Unable to read changelog from remote site.");
}
return new String[] { String.format("Unable to retrieve changelog for %s %s", Constants.MOD, version) };
}
}
@@ -10,6 +10,7 @@ package forestry.core.fluids;
import java.util.List;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraftforge.common.util.ForgeDirection;
@@ -30,7 +31,7 @@ public class FakeTankManager implements ITankManager {
public void containerAdded(Container container, ICrafting player) {}
@Override
public void updateGuiData(Container container, List<ICrafting> crafters) {}
public void updateGuiData(Container container, List<EntityPlayerMP> crafters) {}
@Override
public void containerRemoved(Container container) {}
@@ -10,6 +10,7 @@ package forestry.core.fluids;
import java.util.List;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraftforge.fluids.FluidStack;
@@ -20,7 +21,7 @@ public interface ITankManager extends IFluidHandler {
void containerAdded(Container container, ICrafting player);
void updateGuiData(Container container, List<ICrafting> crafters);
void updateGuiData(Container container, List<EntityPlayerMP> crafters);
void containerRemoved(Container container);
@@ -17,7 +17,6 @@ import java.util.List;
import javax.annotation.Nonnull;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
@@ -135,7 +134,7 @@ public class TankManager implements ITankManager, ITankUpdateHandler, IStreamabl
return;
}
List<ICrafting> crafters = Collections.singletonList(player);
List<EntityPlayerMP> crafters = Collections.singletonList((EntityPlayerMP) player);
for (StandardTank tank : tanks) {
sendTankUpdate(container, tank, crafters);
@@ -150,13 +149,13 @@ public class TankManager implements ITankManager, ITankUpdateHandler, IStreamabl
}
@Override
public void updateGuiData(Container container, List<ICrafting> crafters) {
public void updateGuiData(Container container, List<EntityPlayerMP> crafters) {
for (StandardTank tank : tanks) {
updateGuiData(container, crafters, tank.getTankIndex());
}
}
private void updateGuiData(Container container, List<ICrafting> crafters, int tankIndex) {
private void updateGuiData(Container container, List<EntityPlayerMP> crafters, int tankIndex) {
StandardTank tank = tanks.get(tankIndex);
if (tank == null) {
return;
@@ -171,12 +170,12 @@ public class TankManager implements ITankManager, ITankUpdateHandler, IStreamabl
sendTankUpdate(container, tank, crafters);
}
private void sendTankUpdate(Container container, StandardTank tank, Iterable<ICrafting> crafters) {
private void sendTankUpdate(Container container, StandardTank tank, Iterable<EntityPlayerMP> crafters) {
int tankIndex = tank.getTankIndex();
FluidStack fluid = tank.getFluid();
IForestryPacketClient packet = new PacketTankLevelUpdate(tile, tankIndex, fluid);
for (ICrafting player : crafters) {
Proxies.net.sendToPlayer(packet, (EntityPlayer) player);
for (EntityPlayerMP player : crafters) {
Proxies.net.sendToPlayer(packet, player);
}
if (fluid == null) {
@@ -133,9 +133,8 @@ public class StandardTank extends FluidTank implements IStreamable {
case DEFAULT:
case INPUT:
return true;
default:
return false;
}
return false;
}
public boolean canBeDrainedExternally() {
@@ -143,9 +142,8 @@ public class StandardTank extends FluidTank implements IStreamable {
case DEFAULT:
case OUTPUT:
return true;
default:
return false;
}
return false;
}
public boolean canFill(Fluid fluid, int amount) {
@@ -72,12 +72,6 @@ public abstract class ItemGE extends ItemForestry {
if (individual.isAnalyzed()) {
if (Proxies.common.isShiftDown()) {
individual.addTooltip(list);
individual.addDiscoveredBy(list);
if (Proxies.common.isCtrlDown()) {
individual.addLore(list);
} else {
list.add(EnumChatFormatting.ITALIC + "<" + StringUtil.localize("gui.tooltip.tml") + ">");
}
} else {
list.add(EnumChatFormatting.ITALIC + "<" + StringUtil.localize("gui.tooltip.tmi") + ">");
}
@@ -33,7 +33,7 @@ public class AlleleHelper implements IAlleleHelper {
private static final String modId = Constants.ID;
public static AlleleHelper instance;
private final Map<Class<?>, Map<?, ? extends IAllele>> alleleMaps = new HashMap<>();
private final Map<Class, Map<?, ? extends IAllele>> alleleMaps = new HashMap<>();
public void init() {
if (PluginManager.Module.APICULTURE.isEnabled()) {
@@ -8,8 +8,6 @@
******************************************************************************/
package forestry.core.genetics.mutations;
import static forestry.core.utils.MathUtil.safeMultiply;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -128,9 +126,7 @@ public abstract class Mutation implements IMutationCustom {
IGenome genome1, IClimateProvider climate) {
float mutationChance = chance;
for (IMutationCondition mutationCondition : mutationConditions) {
mutationChance = safeMultiply(
mutationChance,
mutationCondition.getChance(world, x, y, z, allele0, allele1, genome0, genome1, climate));
mutationChance *= mutationCondition.getChance(world, x, y, z, allele0, allele1, genome0, genome1, climate);
if (mutationChance == 0) {
return 0;
}
@@ -176,8 +172,4 @@ public abstract class Mutation implements IMutationCustom {
public boolean isSecret() {
return isSecret;
}
public List<IMutationCondition> getMutationConditions() {
return mutationConditions;
}
}
@@ -53,13 +53,4 @@ public abstract class ContainerItemInventory<I extends ItemInventory> extends Co
inventory.onSlotClick(player);
return result;
}
@Override
public void detectAndSendChanges() {
if (!inventory.isParentItemEquipped()) {
inventory.getPlayer().closeScreen();
return;
}
super.detectAndSendChanges();
}
}
@@ -38,6 +38,7 @@ public abstract class ContainerLiquidTanks<T extends TileEntity & ILiquidTankTil
}
@Override
@SuppressWarnings("unchecked")
public void detectAndSendChanges() {
super.detectAndSendChanges();
tile.getTankManager().updateGuiData(this, crafters);
@@ -43,6 +43,7 @@ public abstract class ContainerLiquidTanksSocketed<T extends TileEntity & ILiqui
}
@Override
@SuppressWarnings("unchecked")
public void detectAndSendChanges() {
super.detectAndSendChanges();
tile.getTankManager().updateGuiData(this, crafters);
@@ -25,8 +25,6 @@ import forestry.core.network.packets.PacketAccessUpdate;
import forestry.core.network.packets.PacketErrorUpdate;
import forestry.core.network.packets.PacketGuiEnergy;
import forestry.core.network.packets.PacketGuiUpdate;
import forestry.core.network.packets.PacketTileConfiguration;
import forestry.core.tiles.IConfigurable;
import forestry.core.tiles.IPowerHandler;
import forestry.core.tiles.TilePowered;
import forestry.core.tiles.TileUtil;
@@ -36,7 +34,6 @@ public abstract class ContainerTile<T extends TileEntity> extends ContainerFores
protected final T tile;
private final IAccessHandler accessHandler;
private boolean configurationChanged;
protected ContainerTile(T tile) {
this.tile = tile;
@@ -46,10 +43,6 @@ public abstract class ContainerTile<T extends TileEntity> extends ContainerFores
} else {
accessHandler = FakeAccessHandler.getInstance();
}
if (tile instanceof IConfigurable) {
configurationChanged = true;
}
}
protected ContainerTile(T tileForestry, InventoryPlayer playerInventory, int xInv, int yInv) {
@@ -135,15 +128,6 @@ public abstract class ContainerTile<T extends TileEntity> extends ContainerFores
sendPacketToCrafters(packet);
}
}
if (tile instanceof IConfigurable && configurationChanged) {
configurationChanged = false;
sendPacketToCrafters(new PacketTileConfiguration(tile));
}
}
protected void markConfigurationDirty() {
configurationChanged = true;
}
public void onGuiEnergy(int energyStored) {
@@ -8,11 +8,10 @@
******************************************************************************/
package forestry.core.gui;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Stack;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.entity.player.EntityPlayer;
@@ -209,7 +208,7 @@ public abstract class GuiAlyzer extends GuiForestry<ContainerAlyzer, IInventory>
textLayout.drawLine(StringUtil.localize("gui.alyzer.classification") + ":", 12);
textLayout.newLine();
Deque<IClassification> hierarchy = new ArrayDeque<>();
Stack<IClassification> hierarchy = new Stack<>();
IClassification classification = individual.getGenome().getPrimary().getBranch();
while (classification != null) {
@@ -302,7 +302,7 @@ public abstract class GuiForestry<C extends Container, I extends IInventory> ext
@Optional.Method(modid = "NotEnoughItems")
public boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int w, int h) {
if (gui instanceof GuiForestry) {
return ((GuiForestry<?, ?>) gui).ledgerManager.ledgerOverlaps(x, y, w, h);
return ((GuiForestry) gui).ledgerManager.ledgerOverlaps(x, y, w, h);
} else {
return false;
}
@@ -94,6 +94,7 @@ public class GuiNaturalistInventory extends GuiForestry<Container, IPagedInvento
}
}
@SuppressWarnings("unchecked")
@Override
public void initGui() {
super.initGui();
@@ -70,6 +70,7 @@ public class GuiTextBox extends GuiTextField {
return text.substring(0, cursorPos) + "_" + text.substring(cursorPos);
}
@SuppressWarnings("unchecked")
private void drawScrolledSplitString(String text, int startX, int startY, int width, int textColour) {
List<String> lines = fontRendererObj.listFormattedStringToWidth(text, width);
maxLines = lines.size();
+3 -3
View File
@@ -25,7 +25,7 @@ import forestry.core.gui.tooltips.ToolTipLine;
public class GuiUtil {
public static void drawItemStack(GuiForestry<?, ?> gui, ItemStack stack, int xPos, int yPos) {
public static void drawItemStack(GuiForestry gui, ItemStack stack, int xPos, int yPos) {
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
RenderHelper.enableGUIStandardItemLighting();
@@ -50,7 +50,7 @@ public class GuiUtil {
GL11.glPopAttrib();
}
public static void drawToolTips(GuiForestry<?, ?> gui, ToolTip toolTips, int mouseX, int mouseY) {
public static void drawToolTips(GuiForestry gui, ToolTip toolTips, int mouseX, int mouseY) {
if (toolTips == null) {
return;
}
@@ -144,7 +144,7 @@ public class GuiUtil {
itemRender.zLevel = 0.0F;
}
public static void drawToolTips(GuiForestry<?, ?> gui, Collection<?> objects, int mouseX, int mouseY) {
public static void drawToolTips(GuiForestry gui, Collection<?> objects, int mouseX, int mouseY) {
for (Object obj : objects) {
if (!(obj instanceof IToolTipProvider)) {
continue;
@@ -9,8 +9,6 @@
package forestry.core.gui;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import org.lwjgl.opengl.GL11;
@@ -20,7 +18,7 @@ public class TextLayoutHelper {
private static final int LINE_HEIGHT = 12;
private final GuiForestry<? extends Container, ? extends IInventory> guiForestry;
private final GuiForestry guiForestry;
private final int defaultFontColor;
private FontRenderer fontRendererObj;
@@ -29,7 +27,7 @@ public class TextLayoutHelper {
public int column2;
public int line;
public TextLayoutHelper(GuiForestry<? extends Container, ? extends IInventory> guiForestry, FontColour fontColour) {
public TextLayoutHelper(GuiForestry guiForestry, FontColour fontColour) {
this.guiForestry = guiForestry;
this.defaultFontColor = fontColour.get("gui.screen");
}
@@ -138,10 +138,6 @@ public abstract class Ledger {
return false;
}
public boolean acceptMouseButton(int mouseButton) {
return mouseButton == 0;
}
public boolean intersectsWith(int mouseX, int mouseY) {
return mouseX >= currentShiftX && mouseX <= currentShiftX + currentWidth
&& mouseY >= currentShiftY
@@ -231,10 +227,12 @@ public abstract class Ledger {
protected int drawSplitText(String string, int x, int y, int width, int color, boolean shadow) {
int originalY = y;
Minecraft minecraft = Proxies.common.getClientInstance();
List<String> strings = minecraft.fontRenderer.listFormattedStringToWidth(string, width);
for (String obj : strings) {
minecraft.fontRenderer.drawString(obj, x, y, color, shadow);
y += minecraft.fontRenderer.FONT_HEIGHT;
List strings = minecraft.fontRenderer.listFormattedStringToWidth(string, width);
for (Object obj : strings) {
if (obj instanceof String) {
minecraft.fontRenderer.drawString((String) obj, x, y, color, shadow);
y += minecraft.fontRenderer.FONT_HEIGHT;
}
}
return y - originalY;
}
@@ -11,9 +11,6 @@ package forestry.core.gui.ledgers;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import org.lwjgl.opengl.GL11;
import forestry.api.core.IErrorSource;
@@ -32,9 +29,9 @@ public class LedgerManager {
private IErrorSource errorSource;
private final int maxWidth;
public final GuiForestry<? extends Container, ? extends IInventory> gui;
public final GuiForestry gui;
public LedgerManager(GuiForestry<? extends Container, ? extends IInventory> gui, int maxWidth) {
public LedgerManager(GuiForestry gui, int maxWidth) {
this.gui = gui;
this.errorSource = FakeErrorSource.instance;
this.maxWidth = maxWidth;
@@ -159,28 +156,29 @@ public class LedgerManager {
}
public void handleMouseClicked(int x, int y, int mouseButton) {
Ledger ledger = this.getAtPosition(x, y);
if (ledger == null || !ledger.acceptMouseButton(mouseButton)) {
return;
}
// Default action only if the mouse click was not handled by the
// ledger itself.
if (!ledger.handleMouseClicked(x, y, mouseButton)) {
if (mouseButton == 0) {
List<? extends Ledger> toggleLedgers;
if (ledgers.contains(ledger)) {
toggleLedgers = ledgers;
} else {
toggleLedgers = errorLedgers;
}
Ledger ledger = this.getAtPosition(x, y);
for (Ledger other : toggleLedgers) {
if (other != ledger && other.isOpen()) {
other.toggleOpen();
// Default action only if the mouse click was not handled by the
// ledger itself.
if (ledger != null && !ledger.handleMouseClicked(x, y, mouseButton)) {
List<? extends Ledger> toggleLedgers;
if (ledgers.contains(ledger)) {
toggleLedgers = ledgers;
} else {
toggleLedgers = errorLedgers;
}
for (Ledger other : toggleLedgers) {
if (other != ledger && other.isOpen()) {
other.toggleOpen();
}
}
ledger.toggleOpen();
}
ledger.toggleOpen();
}
}
@@ -1,78 +0,0 @@
package forestry.core.gui.ledgers;
import java.util.Locale;
import net.minecraft.util.IIcon;
import forestry.core.render.TextureManager;
import forestry.core.tiles.IIngredientsSearchController;
import forestry.core.tiles.IngredientsStorage;
import forestry.core.utils.StringUtil;
public class SearchIngregientsLedger extends Ledger {
private final IIngredientsSearchController ingredientsSearch;
public SearchIngregientsLedger(LedgerManager manager, IIngredientsSearchController ingredientsSearch) {
super(manager, "search_ingredients");
this.ingredientsSearch = ingredientsSearch;
this.maxHeight = 36;
}
private boolean isSwitchButton(int mouseX, int mouseY) {
int shiftX = currentShiftX + 20;
int shiftY = currentShiftY + 8;
return mouseX >= shiftX && mouseX <= currentShiftX + currentWidth && mouseY >= shiftY && mouseY <= shiftY + 24;
}
@Override
public void draw(int x, int y) {
// Draw background
drawBackground(x, y);
// Draw icon
IIcon icon = TextureManager.getInstance().getDefault(
"misc/search_ingredients."
+ ingredientsSearch.getIngredientsStorage().toString().toLowerCase(Locale.ENGLISH));
drawIcon(icon, x + 3, y + 4);
// Draw description
if (!isFullyOpened()) {
return;
}
drawHeader(StringUtil.localize("gui.search_ingredients"), x + 22, y + 8);
drawText(
StringUtil.localize(
"gui.search_ingredients."
+ ingredientsSearch.getIngredientsStorage().toString().toLowerCase(Locale.ENGLISH)),
x + 22,
y + 20);
}
@Override
public String getTooltip() {
return StringUtil.localize("gui.search_ingredients") + ": "
+ StringUtil.localize(
"gui.search_ingredients."
+ ingredientsSearch.getIngredientsStorage().toString().toLowerCase(Locale.ENGLISH));
}
@Override
public boolean handleMouseClicked(int x, int y, int mouseButton) {
if (isSwitchButton(x, y)) {
IngredientsStorage ingredientsStorage = ingredientsSearch.getIngredientsStorage();
IngredientsStorage newIngredientsStorage = mouseButton == 0 ? ingredientsStorage.next()
: ingredientsStorage.previous();
ingredientsSearch.setIngredientsStorage(newIngredientsStorage);
return true;
}
return false;
}
@Override
public boolean acceptMouseButton(int mouseButton) {
return mouseButton == 0 || mouseButton == 1;
}
}
@@ -20,14 +20,12 @@ public class SlotCrafter extends SlotCrafting {
private final IInventory craftMatrix;
private final ICrafterWorktable crafter;
private final EntityPlayer player;
public SlotCrafter(EntityPlayer player, IInventory craftMatrix, ICrafterWorktable crafter, int slot, int xPos,
int yPos) {
super(player, craftMatrix, craftMatrix, slot, xPos, yPos);
this.craftMatrix = craftMatrix;
this.crafter = crafter;
this.player = player;
}
@Override
@@ -41,7 +39,7 @@ public class SlotCrafter extends SlotCrafting {
@Override
public boolean canTakeStack(EntityPlayer player) {
return crafter.canTakeStack(player, getSlotIndex());
return crafter.canTakeStack(getSlotIndex());
}
@Override
@@ -51,7 +49,7 @@ public class SlotCrafter extends SlotCrafting {
@Override
public boolean getHasStack() {
return getStack() != null && crafter.canTakeStack(player, getSlotIndex());
return getStack() != null && crafter.canTakeStack(getSlotIndex());
}
@Override
@@ -39,7 +39,7 @@ public class ToolTip extends ForwardingList<ToolTipLine> {
return add(new ToolTipLine(line));
}
public boolean add(List<?> lines) {
public boolean add(List lines) {
boolean changed = false;
for (Object line : lines) {
if (line instanceof String) {
@@ -54,6 +54,7 @@ public class SocketWidget extends Widget {
private final ToolTip toolTip = new ToolTip(250) {
@SuppressWarnings("unchecked")
@Override
public void refresh() {
toolTip.clear();
Loaded 100 of 231 files, more files were not shown because too many files have changed in this diff. Show more