mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-15 01:24:59 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3fb58ad6a5 | ||
|
|
7e1398438d | ||
|
|
a02df943ed | ||
|
|
f88742e7ab | ||
|
|
fb2ff8aef3 | ||
|
|
3f41c5e8f8 | ||
|
|
81b1de6925 | ||
|
|
278d091b08 | ||
|
|
1552ad1b68 | ||
|
|
bf94b22345 | ||
|
|
c89b61682a | ||
|
|
43fc136fe3 | ||
|
|
ea52fa0d55 | ||
|
|
725d556718 | ||
|
|
d88c007fbb | ||
|
|
485333c6aa | ||
|
|
240802082e | ||
|
|
6f182e932d | ||
|
|
d08b42f18c | ||
|
|
57cc915a1e | ||
|
|
d7c5940596 | ||
|
|
79a6af701b | ||
|
|
4c0b503b8b | ||
|
|
2a6f3771a3 | ||
|
|
04a7c96b4d | ||
|
|
6d0a001b9e | ||
|
|
e2c2ff8d30 | ||
|
|
586f5bf093 | ||
|
|
755301d313 | ||
|
|
33f3389b84 | ||
|
|
c9167b8316 | ||
|
|
1ed646b147 | ||
|
|
7a7930d7eb | ||
|
|
3dccc7e06d | ||
|
|
18e26956ef | ||
|
|
713b0f9d9e | ||
|
|
c6f2e3c7b3 | ||
|
|
c6d8518d82 | ||
|
|
98711e5d34 | ||
|
|
5caab59507 | ||
|
|
41d47d99ca | ||
|
|
3c6d5d04d0 | ||
|
|
137927b3e6 | ||
|
|
8aa7e05bbe | ||
|
|
16414da3f2 | ||
|
|
11eb4b62df | ||
|
|
a172cb379f | ||
|
|
c979d1fa79 | ||
|
|
ef5825edcf | ||
|
|
9570cb2982 | ||
|
|
f89a074393 | ||
|
|
19457080bf | ||
|
|
d6ec27209b | ||
|
|
a0435886ab | ||
|
|
2ab8613bec | ||
|
|
9d31dedd35 | ||
|
|
2dd539c3df | ||
|
|
fd2ac7d172 |
No files matched your search
@@ -30,3 +30,4 @@ src/main/resources/mixins.*.json
|
||||
*.bat
|
||||
*.DS_Store
|
||||
!gradlew.bat
|
||||
layout.json
|
||||
+4
-4
@@ -2,10 +2,10 @@
|
||||
|
||||
dependencies {
|
||||
api('curse.maven:cofh-lib-220333:2388748')
|
||||
compileOnlyApi('com.github.GTNewHorizons:Angelica:1.0.0-alpha35:api')
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.5.25-GTNH:dev')
|
||||
compileOnly('com.github.GTNewHorizons:inventory-tweaks:1.6.2:api')
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.39:api')
|
||||
compileOnlyApi('com.github.GTNewHorizons:Angelica:1.0.0-beta68a:api')
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.8.70-GTNH:dev')
|
||||
compileOnly('com.github.GTNewHorizons:inventory-tweaks:1.7.1:api')
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.55:api')
|
||||
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
|
||||
compileOnly('curse.maven:craftguide-75557:2459320')
|
||||
}
|
||||
+54
-8
@@ -14,7 +14,7 @@ modId = Forestry
|
||||
modGroup = forestry
|
||||
|
||||
# Whether to use modGroup as the maven publishing group.
|
||||
# Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods.
|
||||
# When false, com.github.GTNewHorizons is used.
|
||||
useModGroupForPublishing = false
|
||||
|
||||
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
|
||||
@@ -39,9 +39,33 @@ remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/co
|
||||
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
||||
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 modern Java syntax support. Valid values:
|
||||
# - false: No modern syntax, Java 8 only
|
||||
# - jabel: Jabel syntax-only support, compiles to J8 bytecode
|
||||
# - jvmDowngrader: Full modern Java via JVM Downgrader (syntax + stdlib APIs)
|
||||
# - modern: Native modern Java bytecode, no downgrading
|
||||
enableModernJavaSyntax = jabel
|
||||
|
||||
# If set, ignores the above setting and compiles with the given toolchain. This may cause unexpected issues,
|
||||
# and should *not* be used in most situations. -1 disables this.
|
||||
# forceToolchainVersion = -1
|
||||
|
||||
# Target JVM version for JVM Downgrader bytecode downgrading.
|
||||
# Only used when enableModernJavaSyntax = jvmDowngrader
|
||||
# downgradeTargetVersion = 8
|
||||
|
||||
# Comma-separated list of Java versions for multi-release jar support (JVM Downgrader only).
|
||||
# Classes will be available in META-INF/versions/N/ for each version N in this list.
|
||||
# Default: "21,25" (J25+ gets native classes, J21-24 gets partial downgrade, J8-20 gets full downgrade).
|
||||
# jvmDowngraderMultiReleaseVersions = 21,25
|
||||
|
||||
# Specifies how JVM Downgrader API stubs are provided. Options:
|
||||
# - shade: Shade minimized stubs into the jar
|
||||
# - gtnhlib: GTNHLib provides stubs at runtime (adds version constraint)
|
||||
# - external: Another dependency provides stubs (no constraint, no warning)
|
||||
# - (empty): Warning reminding you to configure stubs
|
||||
# Note: 'shade' option requires you to verify license compliance, see: https://github.com/unimined/JvmDowngrader/blob/main/LICENSE.md
|
||||
# jvmDowngraderStubsProvider =
|
||||
|
||||
# Enables injecting missing generics into the decompiled source code for a better coding experience.
|
||||
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
|
||||
@@ -80,18 +104,25 @@ 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 =
|
||||
accessTransformersFile = forestry_at.cfg
|
||||
|
||||
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
||||
usesMixins = false
|
||||
|
||||
# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
|
||||
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
|
||||
# Mixin classes will have access to "main" classes, but not the other way around.
|
||||
separateMixinSourceSet =
|
||||
|
||||
# Adds some debug arguments like verbose output and class export.
|
||||
usesMixinDebug = false
|
||||
|
||||
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
||||
mixinPlugin =
|
||||
|
||||
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
|
||||
# Specify the package that contains all of your Mixins. The package must exist or
|
||||
# the build will fail. If you have a package property defined in your mixins.<modid>.json,
|
||||
# it must match with this or the build will fail.
|
||||
mixinsPackage =
|
||||
|
||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||
@@ -117,9 +148,15 @@ minimizeShadowedDependencies = true
|
||||
# If disabled, won't rename the shadowed classes.
|
||||
relocateShadowedDependencies = true
|
||||
|
||||
# Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories.
|
||||
# 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.
|
||||
@@ -140,7 +177,7 @@ modrinthProjectId =
|
||||
# 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: GTNH Mixins is automatically set as a required dependency if usesMixins = true
|
||||
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
|
||||
modrinthRelations =
|
||||
|
||||
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
|
||||
@@ -161,6 +198,12 @@ curseForgeRelations =
|
||||
# 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.
|
||||
@@ -190,3 +233,6 @@ curseForgeRelations =
|
||||
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
||||
# ideaCheckSpotlessOnBuild = true
|
||||
|
||||
# Non-GTNH properties
|
||||
org.gradle.configuration-cache = true
|
||||
org.gradle.parallel = true
|
||||
@@ -0,0 +1,12 @@
|
||||
#This file is generated by updateDaemonJvm
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/df211d3c3eefdc408b462041881bc575/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/93aeea858331bd6bb00ba94759830234/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/df211d3c3eefdc408b462041881bc575/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/93aeea858331bd6bb00ba94759830234/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/3426ffcaa54c3f62406beb1f1ab8b179/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/f636c800fdb3f9ae33f019dfa048ba72/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/df211d3c3eefdc408b462041881bc575/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/93aeea858331bd6bb00ba94759830234/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/3cd7045fca9a72cd9bc7d14a385e594c/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/0ef34dd9312b12d61ba1b8e66126d140/redirect
|
||||
toolchainVersion=25
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
# Copyright © 2015 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
@@ -55,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@@ -84,7 +86,7 @@ done
|
||||
# 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 "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -112,7 +114,6 @@ case "$( uname )" in #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
@@ -170,7 +171,6 @@ fi
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
@@ -203,15 +203,14 @@ fi
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
|
||||
Vendored
+3
-2
@@ -13,6 +13,8 @@
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@@ -68,11 +70,10 @@ goto fail
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.19'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.20'
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import net.minecraft.item.Item;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.ModAPIManager;
|
||||
@@ -79,11 +80,15 @@ public class Forestry {
|
||||
|
||||
public static PacketHandler packetHandler;
|
||||
|
||||
public static boolean isDreamcraftLoaded;
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
checkForCoFHLib();
|
||||
packetHandler = new PacketHandler();
|
||||
|
||||
isDreamcraftLoaded = Loader.isModLoaded("dreamcraft");
|
||||
|
||||
// Register event handler
|
||||
EventHandlerCore eventHandlerCore = new EventHandlerCore();
|
||||
MinecraftForge.EVENT_BUS.register(eventHandlerCore);
|
||||
|
||||
@@ -84,7 +84,12 @@ public enum EnumBeeChromosome implements IChromosomeType {
|
||||
*/
|
||||
EFFECT(IAlleleBeeEffect.class);
|
||||
|
||||
Class<? extends IAllele> clss;
|
||||
final Class<? extends IAllele> clss;
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumBeeChromosome[] VALUES = values();
|
||||
|
||||
EnumBeeChromosome(Class<? extends IAllele> clss) {
|
||||
this.clss = clss;
|
||||
|
||||
@@ -17,9 +17,12 @@ public enum EnumBeeType implements ISpeciesType {
|
||||
LARVAE,
|
||||
NONE;
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumBeeType[] VALUES = values();
|
||||
|
||||
String name;
|
||||
private final String name;
|
||||
|
||||
EnumBeeType() {
|
||||
this.name = this.toString().toLowerCase(Locale.ENGLISH);
|
||||
@@ -28,4 +31,8 @@ public enum EnumBeeType implements ISpeciesType {
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public static EnumBeeType fromOrdinal(int ordinal) {
|
||||
return VALUES[ordinal];
|
||||
}
|
||||
}
|
||||
@@ -73,9 +73,14 @@ public enum EnumTreeChromosome implements IChromosomeType {
|
||||
/**
|
||||
* Determines if the tree can burn.
|
||||
*/
|
||||
FIREPROOF(IAlleleBoolean.class),;
|
||||
FIREPROOF(IAlleleBoolean.class);
|
||||
|
||||
Class<? extends IAllele> clss;
|
||||
final Class<? extends IAllele> clss;
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumTreeChromosome[] VALUES = values();
|
||||
|
||||
EnumTreeChromosome(Class<? extends IAllele> clss) {
|
||||
this.clss = clss;
|
||||
|
||||
@@ -17,9 +17,14 @@ public enum EnumHumidity {
|
||||
NORMAL("Normal"),
|
||||
DAMP("Damp");
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumHumidity[] VALUES = values();
|
||||
|
||||
public final String name;
|
||||
|
||||
private EnumHumidity(String name) {
|
||||
EnumHumidity(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,10 +27,15 @@ public enum EnumTemperature {
|
||||
HOT("Hot", "habitats/desert"),
|
||||
HELLISH("Hellish", "habitats/nether");
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumTemperature[] VALUES = values();
|
||||
|
||||
public final String name;
|
||||
public final String iconIndex;
|
||||
|
||||
private EnumTemperature(String name, String iconIndex) {
|
||||
EnumTemperature(String name, String iconIndex) {
|
||||
this.name = name;
|
||||
this.iconIndex = iconIndex;
|
||||
}
|
||||
|
||||
@@ -12,11 +12,15 @@ public interface IClimateControlled {
|
||||
|
||||
/**
|
||||
* Change the temperature, but not lower than boundaryDown or higher than boundaryUp.
|
||||
*
|
||||
* When used in an alveary the change applies a 20x stronger effect
|
||||
*/
|
||||
void addTemperatureChange(float change, float boundaryDown, float boundaryUp);
|
||||
|
||||
/**
|
||||
* Change the humidity, but not lower than boundaryDown or higher than boundaryUp.
|
||||
*
|
||||
* When used in an alveary the change applies a 20x stronger effect
|
||||
*/
|
||||
void addHumidityChange(float change, float boundaryDown, float boundaryUp);
|
||||
}
|
||||
@@ -16,6 +16,11 @@ public enum FarmDirection {
|
||||
|
||||
private final ForgeDirection forgeDirection;
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final FarmDirection[] VALUES = values();
|
||||
|
||||
FarmDirection(ForgeDirection forgeDirection) {
|
||||
this.forgeDirection = forgeDirection;
|
||||
}
|
||||
@@ -25,17 +30,16 @@ public enum FarmDirection {
|
||||
}
|
||||
|
||||
public static FarmDirection getFarmDirection(ForgeDirection forgeDirection) {
|
||||
switch (forgeDirection) {
|
||||
case NORTH:
|
||||
return NORTH;
|
||||
case EAST:
|
||||
return EAST;
|
||||
case SOUTH:
|
||||
return SOUTH;
|
||||
case WEST:
|
||||
return WEST;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
return switch (forgeDirection) {
|
||||
case NORTH -> NORTH;
|
||||
case EAST -> EAST;
|
||||
case SOUTH -> SOUTH;
|
||||
case WEST -> WEST;
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
|
||||
public static FarmDirection fromOrdinal(int ordinal) {
|
||||
return VALUES[ordinal];
|
||||
}
|
||||
}
|
||||
@@ -9,33 +9,37 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
public class RainSubstrate {
|
||||
|
||||
public enum WeatherState {
|
||||
CLEAR,
|
||||
RAIN,
|
||||
STORM
|
||||
}
|
||||
|
||||
/**
|
||||
* Rain substrate capable of activating the rainmaker.
|
||||
*/
|
||||
public ItemStack item;
|
||||
/**
|
||||
* Duration of the rain shower triggered by this substrate in Minecraft ticks.
|
||||
* Duration of the weather event triggered by this substrate in Minecraft ticks.
|
||||
*/
|
||||
public int duration;
|
||||
/**
|
||||
* Speed of activation sequence triggered.
|
||||
*/
|
||||
public float speed;
|
||||
/**
|
||||
* The type of weather triggered.
|
||||
*/
|
||||
public WeatherState weather;
|
||||
|
||||
public boolean reverse;
|
||||
|
||||
public RainSubstrate(ItemStack item, int duration, float speed) {
|
||||
this(item, duration, speed, false);
|
||||
public RainSubstrate(ItemStack item, float speed, WeatherState weather) {
|
||||
this(item, 0, speed, weather);
|
||||
}
|
||||
|
||||
public RainSubstrate(ItemStack item, float speed) {
|
||||
this(item, 0, speed, true);
|
||||
}
|
||||
|
||||
public RainSubstrate(ItemStack item, int duration, float speed, boolean reverse) {
|
||||
public RainSubstrate(ItemStack item, int duration, float speed, WeatherState weather) {
|
||||
this.item = item;
|
||||
this.duration = duration;
|
||||
this.speed = speed;
|
||||
this.reverse = reverse;
|
||||
this.weather = weather;
|
||||
}
|
||||
}
|
||||
@@ -52,4 +52,8 @@ public interface IIndividual extends INBTTagable {
|
||||
IIndividual copy();
|
||||
|
||||
boolean isPureBred(IChromosomeType chromosomeType);
|
||||
|
||||
default void addLore(List<String> text) {}
|
||||
|
||||
default void addDiscoveredBy(List<String> text) {}
|
||||
}
|
||||
@@ -77,7 +77,12 @@ public enum EnumButterflyChromosome implements IChromosomeType {
|
||||
*/
|
||||
TERRITORY(IAlleleArea.class),;
|
||||
|
||||
Class<? extends IAllele> clss;
|
||||
final Class<? extends IAllele> clss;
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumButterflyChromosome[] VALUES = values();
|
||||
|
||||
EnumButterflyChromosome(Class<? extends IAllele> clss) {
|
||||
this.clss = clss;
|
||||
|
||||
@@ -49,6 +49,14 @@ public interface IAlvearyComponent<T extends IMultiblockLogicAlveary> extends IM
|
||||
* @param alveary the climate controlled alveary
|
||||
*/
|
||||
void changeClimate(int tickCount, IClimateControlled alveary);
|
||||
|
||||
/**
|
||||
* Get the priority of this climatiser. Called when alveary is constructed.
|
||||
* {@link #changeClimate(int, IClimateControlled)} are run in descending priority.
|
||||
*/
|
||||
default int getPriority() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,6 +9,8 @@ import net.minecraft.util.ChunkCoordinates;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
|
||||
/**
|
||||
* Basic interface for a multiblock machine component. Implemented by TileEntities.
|
||||
*/
|
||||
@@ -45,4 +47,15 @@ public interface IMultiblockComponent {
|
||||
* Called when the machine is broken for game reasons, e.g. a player removed a block or an explosion occurred.
|
||||
*/
|
||||
void onMachineBroken();
|
||||
|
||||
/**
|
||||
* A component with a separate inventory, like the Alveary Swarmer or Alveary Sieve.
|
||||
*/
|
||||
interface HasInventory {
|
||||
|
||||
/**
|
||||
* Called when this part is destroyed to drop its contents.
|
||||
*/
|
||||
IInventoryAdapter getInternalInventory();
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,10 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
@@ -73,4 +76,27 @@ public class InventoryBeeHousing extends InventoryAdapterRestricted implements I
|
||||
public final boolean addProduct(ItemStack product, boolean all) {
|
||||
return InventoryUtil.tryAddStack(this, product, SLOT_PRODUCT_1, SLOT_PRODUCT_COUNT, all, true);
|
||||
}
|
||||
|
||||
public void dumpInventoryIntoWorld(World world, ChunkCoordinates coordinates) {
|
||||
if (world.isRemote) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < SLOT_PRODUCT_COUNT; i++) {
|
||||
ItemStack stack = getStackInSlot(i);
|
||||
if (stack == null) {
|
||||
continue;
|
||||
}
|
||||
setInventorySlotContents(i, null);
|
||||
|
||||
EntityItem entityitem = new EntityItem(
|
||||
world,
|
||||
coordinates.posX + 0.5,
|
||||
coordinates.posY + 0.5,
|
||||
coordinates.posZ + 0.5,
|
||||
stack);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
world.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,7 @@ public class CommandBeeGive extends SubCommand {
|
||||
setPermLevel(PermLevel.ADMIN);
|
||||
|
||||
List<String> beeTypeStrings = new ArrayList<>();
|
||||
for (EnumBeeType type : EnumBeeType.values()) {
|
||||
for (EnumBeeType type : EnumBeeType.VALUES) {
|
||||
if (type == EnumBeeType.NONE) {
|
||||
continue;
|
||||
}
|
||||
@@ -166,7 +166,7 @@ public class CommandBeeGive extends SubCommand {
|
||||
}
|
||||
|
||||
private static EnumBeeType getBeeType(String beeTypeName) {
|
||||
for (EnumBeeType beeType : EnumBeeType.values()) {
|
||||
for (EnumBeeType beeType : EnumBeeType.VALUES) {
|
||||
if (beeType.getName().equalsIgnoreCase(beeTypeName)) {
|
||||
return beeType;
|
||||
}
|
||||
|
||||
@@ -213,6 +213,7 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
|
||||
private static boolean isAcceptedFlower(String flowerType, Set<Block> acceptedBlocks, Set<Flower> acceptedFlowers,
|
||||
World world, int x, int y, int z) {
|
||||
if (!world.blockExists(x, y, z)) return false;
|
||||
Block block = world.getBlock(x, y, z);
|
||||
|
||||
final int meta;
|
||||
|
||||
@@ -24,7 +24,7 @@ public class GrowthRuleDirtGrass implements IFlowerGrowthRule {
|
||||
@Override
|
||||
public boolean growFlower(IFlowerRegistry flowerRegistry, String flowerType, World world, IIndividual individual,
|
||||
int x, int y, int z) {
|
||||
if (!world.isAirBlock(x, y, z)) {
|
||||
if (!world.blockExists(x, y, z) || !world.isAirBlock(x, y, z)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class GrowthRuleDirtGrass implements IFlowerGrowthRule {
|
||||
|
||||
@Override
|
||||
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) {
|
||||
if (!world.isAirBlock(x, y, z)) {
|
||||
if (!world.blockExists(x, y, z) || !world.isAirBlock(x, y, z)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,10 @@ public class GrowthRuleFlowerPot implements IFlowerGrowthRule {
|
||||
}
|
||||
|
||||
private static boolean growFlower(String flowerType, World world, int x, int y, int z) {
|
||||
if (!world.blockExists(x, y, z)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (!(tile instanceof TileEntityFlowerPot)) {
|
||||
return false;
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import static forestry.core.utils.MathUtil.safeAdd;
|
||||
import static forestry.core.utils.MathUtil.safeMultiply;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -15,6 +18,8 @@ import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -373,6 +378,36 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
return suitableBiomes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addLore(List<String> text) {
|
||||
IAlleleBeeSpecies primary = genome.getPrimary();
|
||||
String descTokens[] = primary.getDescription().split("\\|");
|
||||
|
||||
if (descTokens.length > 0) {
|
||||
String speciesLore = descTokens[0];
|
||||
if (!speciesLore.isEmpty() && !speciesLore.contains("for.description")) {
|
||||
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
|
||||
String formattedLore = EnumChatFormatting.GOLD + speciesLore;
|
||||
List<String> formattedLoreList = fontRenderer.listFormattedStringToWidth(formattedLore, 200);
|
||||
text.addAll(formattedLoreList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDiscoveredBy(List<String> text) {
|
||||
IAlleleBeeSpecies primary = genome.getPrimary();
|
||||
String descTokens[] = primary.getDescription().split("\\|");
|
||||
|
||||
if (descTokens.length > 2) {
|
||||
String discoveredBy = descTokens[2];
|
||||
if (!discoveredBy.isEmpty()) {
|
||||
text.add("");
|
||||
text.add("Discovered by " + EnumChatFormatting.ITALIC + discoveredBy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTooltip(List<String> list) {
|
||||
|
||||
@@ -699,9 +734,9 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
|
||||
// boost chance for researched mutations
|
||||
if (breedingTracker.isResearched(beeMutation)) {
|
||||
float mutationBoost = chance * (Config.researchMutationBoostMultiplier - 1.0f);
|
||||
float mutationBoost = safeMultiply(chance, Config.researchMutationBoostMultiplier - 1.0f);
|
||||
mutationBoost = Math.min(Config.maxResearchMutationBoostPercent, mutationBoost);
|
||||
chance += mutationBoost;
|
||||
chance = safeAdd(chance, mutationBoost);
|
||||
}
|
||||
|
||||
if (chance > world.rand.nextFloat() * 100) {
|
||||
@@ -738,6 +773,9 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
for (int i = 0; i < 20; i++) {
|
||||
Vect randomPos = Vect.getRandomPositionInArea(random, area);
|
||||
Vect blockPos = Vect.add(housingPos, randomPos, offset);
|
||||
if (!world.blockExists(blockPos.x, blockPos.y, blockPos.z)) {
|
||||
continue;
|
||||
}
|
||||
TileEntity tile = world.getTileEntity(blockPos.x, blockPos.y, blockPos.z);
|
||||
|
||||
if (tile instanceof IPollinatable) {
|
||||
|
||||
@@ -148,7 +148,7 @@ public enum BeeBranchDefinition implements IBranchDefinition {
|
||||
|
||||
private static IAllele[] getDefaultTemplate() {
|
||||
if (defaultTemplate == null) {
|
||||
defaultTemplate = new IAllele[EnumBeeChromosome.values().length];
|
||||
defaultTemplate = new IAllele[EnumBeeChromosome.VALUES.length];
|
||||
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWEST);
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORTER);
|
||||
|
||||
@@ -331,7 +331,7 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.SIMMERING, 1), 0.55f)
|
||||
.addProduct(PluginCore.items.ash.getItemStack(), 0.15f).setTemperature(EnumTemperature.HELLISH)
|
||||
.addProduct(PluginCore.items.getAsh(), 0.15f).setTemperature(EnumTemperature.HELLISH)
|
||||
.setHumidity(EnumHumidity.ARID);
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
|
||||
IBee bee = (IBee) individual;
|
||||
|
||||
Item beeItem;
|
||||
switch (EnumBeeType.VALUES[type]) {
|
||||
switch (EnumBeeType.fromOrdinal(type)) {
|
||||
case QUEEN:
|
||||
beeItem = PluginApiculture.items.beeQueenGE;
|
||||
// ensure a queen is always mated
|
||||
@@ -353,7 +353,7 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
|
||||
|
||||
@Override
|
||||
public IChromosomeType[] getKaryotype() {
|
||||
return EnumBeeChromosome.values();
|
||||
return EnumBeeChromosome.VALUES;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import static forestry.core.utils.MathUtil.safeMultiply;
|
||||
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -49,8 +51,8 @@ public class BeeMutation extends Mutation implements IBeeMutationCustom {
|
||||
IBeeModifier beeHousingModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
IBeeModifier beeModeModifier = BeeManager.beeRoot.getBeekeepingMode(world).getBeeModifier();
|
||||
|
||||
processedChance *= beeHousingModifier.getMutationModifier(genome0, genome1, processedChance);
|
||||
processedChance *= beeModeModifier.getMutationModifier(genome0, genome1, processedChance);
|
||||
processedChance = safeMultiply(processedChance, beeHousingModifier.getMutationModifier(genome0, genome1, 1.0F));
|
||||
processedChance = safeMultiply(processedChance, beeModeModifier.getMutationModifier(genome0, genome1, 1.0F));
|
||||
|
||||
return processedChance;
|
||||
}
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
@@ -22,24 +20,23 @@ import forestry.core.render.TextureManager;
|
||||
public class DefaultBeeIconProvider implements IBeeIconProvider {
|
||||
|
||||
public static final DefaultBeeIconProvider instance = new DefaultBeeIconProvider();
|
||||
private static final IIcon[][] icons = new IIcon[EnumBeeType.VALUES.length][3];
|
||||
|
||||
private DefaultBeeIconProvider() {}
|
||||
|
||||
private static final IIcon[][] icons = new IIcon[EnumBeeType.values().length][3];
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister register) {
|
||||
String beeIconDir = "bees/default/";
|
||||
IIcon body1 = TextureManager.registerTex(register, beeIconDir + "body1");
|
||||
|
||||
for (int i = 0; i < EnumBeeType.values().length; i++) {
|
||||
EnumBeeType beeType = EnumBeeType.values()[i];
|
||||
for (int i = 0; i < EnumBeeType.VALUES.length; i++) {
|
||||
EnumBeeType beeType = EnumBeeType.VALUES[i];
|
||||
if (beeType == EnumBeeType.NONE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String beeTypeNameBase = beeIconDir + beeType.toString().toLowerCase(Locale.ENGLISH);
|
||||
String beeTypeNameBase = beeIconDir + beeType.getName();
|
||||
|
||||
icons[i][0] = TextureManager.registerTex(register, beeTypeNameBase + ".outline");
|
||||
if (beeType == EnumBeeType.LARVAE) {
|
||||
|
||||
@@ -13,6 +13,7 @@ import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
@@ -21,7 +22,7 @@ import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.apiculture.blocks.BlockAlveary;
|
||||
import forestry.apiculture.multiblock.AlvearyController;
|
||||
import forestry.core.utils.DamageSourceForestry;
|
||||
import forestry.core.utils.vect.Vect;
|
||||
|
||||
@@ -36,8 +37,13 @@ public class AlleleEffectRadioactive extends AlleleEffectThrottled {
|
||||
@Override
|
||||
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
harmEntities(genome, housing);
|
||||
if (isMobGriefingEnabled(housing)) destroyEnvironment(genome, housing);
|
||||
|
||||
return destroyEnvironment(genome, storedData, housing);
|
||||
return storedData;
|
||||
}
|
||||
|
||||
private boolean isMobGriefingEnabled(IBeeHousing housing) {
|
||||
return housing.getWorld().getGameRules().getGameRuleBooleanValue("mobGriefing");
|
||||
}
|
||||
|
||||
private void harmEntities(IBeeGenome genome, IBeeHousing housing) {
|
||||
@@ -56,7 +62,7 @@ public class AlleleEffectRadioactive extends AlleleEffectThrottled {
|
||||
}
|
||||
}
|
||||
|
||||
private static IEffectData destroyEnvironment(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
private static void destroyEnvironment(IBeeGenome genome, IBeeHousing housing) {
|
||||
World world = housing.getWorld();
|
||||
Random rand = world.rand;
|
||||
|
||||
@@ -65,43 +71,66 @@ public class AlleleEffectRadioactive extends AlleleEffectThrottled {
|
||||
Vect offset = area.multiply(-1 / 2.0f);
|
||||
Vect posHousing = new Vect(housing.getCoordinates());
|
||||
|
||||
boolean isAlveary = housing instanceof AlvearyController;
|
||||
|
||||
for (int i = 0; i < 20; i++) {
|
||||
Vect randomPos = Vect.getRandomPositionInArea(rand, area);
|
||||
Vect posBlock = randomPos.add(posHousing);
|
||||
posBlock = posBlock.add(offset);
|
||||
Vect posBlock = randomPos.add(posHousing).add(offset);
|
||||
|
||||
if (posBlock.y <= 1 || posBlock.y >= housing.getWorld().getActualHeight()) {
|
||||
// Don't destroy blocks in the protected 3x3x4 area if housing is an Alveary.
|
||||
// Stops the bee destroying itself. Silly behaviour.
|
||||
if (isInAlvearyProtectedArea(posHousing, posBlock)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Don't destroy ourselves or blocks below us.
|
||||
if (posBlock.x == posHousing.x && posBlock.z == posHousing.z && posBlock.y <= posHousing.y) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (world.isAirBlock(posBlock.x, posBlock.y, posBlock.z)) {
|
||||
continue;
|
||||
// Don't destroy the block directly below the bee.
|
||||
if (isAlveary) {
|
||||
if (posBlock.y == posHousing.y - 3) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
if (posBlock.y == posHousing.y - 1) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
Block block = world.getBlock(posBlock.x, posBlock.y, posBlock.z);
|
||||
|
||||
if (block instanceof BlockAlveary) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Never delete a tile entity. Allows far too much griefing and abuse otherwise.
|
||||
TileEntity tile = world.getTileEntity(posBlock.x, posBlock.y, posBlock.z);
|
||||
if (tile instanceof IBeeHousing) {
|
||||
if (tile != null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Don't let us delete blocks that are not supposed to be breakable by players.
|
||||
if (block.getBlockHardness(world, posBlock.x, posBlock.y, posBlock.z) < 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Some mods might use this logic? Idk, just a safety check. Might stop griefing.
|
||||
EntityPlayer player = world.func_152378_a(housing.getOwner().getId());
|
||||
if (player == null || !world.canMineBlock(player, posHousing.x, posHousing.y, posHousing.z)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
world.setBlockToAir(posBlock.x, posBlock.y, posBlock.z);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return storedData;
|
||||
private static boolean isInAlvearyProtectedArea(Vect posHousing, Vect posBlock) {
|
||||
// Alveary protection area is a 3x3x4 area centered on the top middle, down one block.
|
||||
int startX = posHousing.x - 1;
|
||||
int endX = posHousing.x + 1;
|
||||
int startZ = posHousing.z - 1;
|
||||
int endZ = posHousing.z + 1;
|
||||
int startY = posHousing.y - 2;
|
||||
int endY = posHousing.y + 1;
|
||||
|
||||
return posBlock.x >= startX && posBlock.x <= endX
|
||||
&& posBlock.z >= startZ
|
||||
&& posBlock.z <= endZ
|
||||
&& posBlock.y >= startY
|
||||
&& posBlock.y <= endY;
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,10 @@ public abstract class AlleleEffectThrottled extends AlleleEffect {
|
||||
this.requiresWorkingQueen = requiresWorking;
|
||||
}
|
||||
|
||||
public int getThrottle() {
|
||||
return throttle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCombinable() {
|
||||
return isCombinable;
|
||||
|
||||
@@ -71,9 +71,8 @@ public class ItemHabitatLocator extends ItemWithGui {
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean flag) {
|
||||
BiomeGenBase currentBiome = player.worldObj.getBiomeGenForCoords((int) player.posX, (int) player.posZ);
|
||||
|
||||
float temperatureValue = currentBiome
|
||||
.getFloatTemperature((int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
EnumTemperature temperature = EnumTemperature.getFromValue(temperatureValue);
|
||||
EnumTemperature temperature = EnumTemperature
|
||||
.getFromBiome(currentBiome, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
EnumHumidity humidity = EnumHumidity.getFromValue(currentBiome.rainfall);
|
||||
|
||||
list.add(StringUtil.localize("gui.currentBiome") + ": " + currentBiome.biomeName);
|
||||
|
||||
@@ -9,8 +9,10 @@
|
||||
package forestry.apiculture.multiblock;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -59,7 +61,9 @@ public class AlvearyController extends RectangularMultiblockControllerBase
|
||||
// PARTS
|
||||
private final Set<IBeeModifier> beeModifiers = new HashSet<>();
|
||||
private final Set<IBeeListener> beeListeners = new HashSet<>();
|
||||
private final Set<IAlvearyComponent.Climatiser> climatisers = new HashSet<>();
|
||||
private final Set<IAlvearyComponent.Climatiser> climatisers = new TreeSet<>(
|
||||
Comparator.comparingInt(IAlvearyComponent.Climatiser::getPriority).thenComparingInt(Object::hashCode)
|
||||
.reversed());
|
||||
private final Set<IAlvearyComponent.Active> activeComponents = new HashSet<>();
|
||||
|
||||
// CLIENT
|
||||
@@ -155,6 +159,8 @@ public class AlvearyController extends RectangularMultiblockControllerBase
|
||||
activeComponents.remove(oldPart);
|
||||
}
|
||||
}
|
||||
|
||||
inventory.dumpInventoryIntoWorld(this.worldObj, oldPart.getCoordinates());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -233,26 +239,24 @@ public class AlvearyController extends RectangularMultiblockControllerBase
|
||||
beekeepingLogic.doWork();
|
||||
}
|
||||
|
||||
tempChange = 0;
|
||||
humidChange = 0;
|
||||
for (IAlvearyComponent.Climatiser climatiser : climatisers) {
|
||||
climatiser.changeClimate(tickCount, this);
|
||||
}
|
||||
|
||||
tempChange = equalizeChange(tempChange);
|
||||
humidChange = equalizeChange(humidChange);
|
||||
|
||||
return canWork;
|
||||
}
|
||||
|
||||
private static float equalizeChange(float change) {
|
||||
if (change == 0) {
|
||||
return 0;
|
||||
private float applyChange(float base, float currentChange, float extraChange, float boundaryDown,
|
||||
float boundaryUp) {
|
||||
float boundedNewChange = Math.max(boundaryDown, Math.min(base + currentChange + (extraChange * 20), boundaryUp))
|
||||
- base;
|
||||
if (extraChange > 0) {
|
||||
return Math.max(currentChange, boundedNewChange);
|
||||
} else {
|
||||
return Math.min(currentChange, boundedNewChange);
|
||||
}
|
||||
|
||||
change *= 0.95f;
|
||||
if (change <= 0.001f && change >= -0.001f) {
|
||||
change = 0;
|
||||
}
|
||||
return change;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -410,19 +414,13 @@ public class AlvearyController extends RectangularMultiblockControllerBase
|
||||
ChunkCoordinates coordinates = getCoordinates();
|
||||
|
||||
float temperature = getBiome().getFloatTemperature(coordinates.posX, coordinates.posY, coordinates.posZ);
|
||||
|
||||
tempChange += change;
|
||||
tempChange = Math.max(boundaryDown - temperature, tempChange);
|
||||
tempChange = Math.min(boundaryUp - temperature, tempChange);
|
||||
tempChange = applyChange(temperature, tempChange, change, boundaryDown, boundaryUp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addHumidityChange(float change, float boundaryDown, float boundaryUp) {
|
||||
float humidity = getBiome().rainfall;
|
||||
|
||||
humidChange += change;
|
||||
humidChange = Math.max(boundaryDown - humidity, humidChange);
|
||||
humidChange = Math.min(boundaryUp - humidity, humidChange);
|
||||
humidChange = applyChange(humidity, humidChange, change, boundaryDown, boundaryUp);
|
||||
}
|
||||
|
||||
/* GUI */
|
||||
|
||||
@@ -19,6 +19,7 @@ import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import forestry.api.core.IClimateControlled;
|
||||
import forestry.api.multiblock.IAlvearyComponent;
|
||||
import forestry.api.multiblock.IMultiblockComponent;
|
||||
import forestry.apiculture.blocks.BlockAlveary;
|
||||
import forestry.apiculture.gui.ContainerAlvearyHygroregulator;
|
||||
import forestry.apiculture.gui.GuiAlvearyHygroregulator;
|
||||
@@ -31,8 +32,8 @@ import forestry.core.fluids.tanks.FilteredTank;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.tiles.ILiquidTankTile;
|
||||
|
||||
public class TileAlvearyHygroregulator extends TileAlveary
|
||||
implements IInventory, ILiquidTankTile, IFluidHandler, IAlvearyComponent.Climatiser {
|
||||
public class TileAlvearyHygroregulator extends TileAlveary implements IInventory, ILiquidTankTile, IFluidHandler,
|
||||
IAlvearyComponent.Climatiser, IMultiblockComponent.HasInventory {
|
||||
|
||||
private final HygroregulatorRecipe[] recipes;
|
||||
|
||||
@@ -56,9 +57,9 @@ public class TileAlvearyHygroregulator extends TileAlveary
|
||||
this.tankManager = new TankManager(this, liquidTank);
|
||||
|
||||
this.recipes = new HygroregulatorRecipe[] {
|
||||
new HygroregulatorRecipe(new FluidStack(water, 1), 1, +0.01f, -0.0005f),
|
||||
new HygroregulatorRecipe(new FluidStack(lava, 1), 10, -0.01f, +0.0005f),
|
||||
new HygroregulatorRecipe(new FluidStack(liquidIce, 1), 10, +0.02f, -0.001f) };
|
||||
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) };
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -111,6 +112,11 @@ public class TileAlvearyHygroregulator extends TileAlveary
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPriority() {
|
||||
return 100;
|
||||
}
|
||||
|
||||
/* SAVING & LOADING */
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
|
||||
@@ -18,6 +18,7 @@ import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.multiblock.IAlvearyComponent;
|
||||
import forestry.api.multiblock.IMultiblockComponent;
|
||||
import forestry.apiculture.blocks.BlockAlveary;
|
||||
import forestry.apiculture.gui.ContainerAlvearySieve;
|
||||
import forestry.apiculture.gui.GuiAlvearySieve;
|
||||
@@ -25,7 +26,8 @@ import forestry.apiculture.inventory.InventoryAlvearySieve;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.core.inventory.watchers.ISlotPickupWatcher;
|
||||
|
||||
public class TileAlvearySieve extends TileAlveary implements IAlvearyComponent.BeeListener {
|
||||
public class TileAlvearySieve extends TileAlveary
|
||||
implements IAlvearyComponent.BeeListener, IMultiblockComponent.HasInventory {
|
||||
|
||||
private final IBeeListener beeListener;
|
||||
private final InventoryAlvearySieve inventory;
|
||||
|
||||
@@ -22,6 +22,7 @@ import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.multiblock.IAlvearyComponent;
|
||||
import forestry.api.multiblock.IMultiblockComponent;
|
||||
import forestry.apiculture.blocks.BlockAlveary;
|
||||
import forestry.apiculture.gui.ContainerAlvearySwarmer;
|
||||
import forestry.apiculture.gui.GuiAlvearySwarmer;
|
||||
@@ -37,7 +38,8 @@ import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.IActivatable;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
|
||||
public class TileAlvearySwarmer extends TileAlveary implements ISidedInventory, IActivatable, IAlvearyComponent.Active {
|
||||
public class TileAlvearySwarmer extends TileAlveary
|
||||
implements ISidedInventory, IActivatable, IAlvearyComponent.Active, IMultiblockComponent.HasInventory {
|
||||
|
||||
private final InventorySwarmer inventory;
|
||||
private final Deque<ItemStack> pendingSpawns = new ArrayDeque<>();
|
||||
|
||||
@@ -16,6 +16,8 @@ import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
@@ -298,6 +300,36 @@ public class Tree extends Individual implements ITree, IPlantable {
|
||||
return plantTypes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addLore(List<String> text) {
|
||||
IAlleleTreeSpecies primary = genome.getPrimary();
|
||||
String descTokens[] = primary.getDescription().split("\\|");
|
||||
|
||||
if (descTokens.length > 0) {
|
||||
String speciesLore = descTokens[0];
|
||||
if (!speciesLore.isEmpty() && !speciesLore.contains("for.description")) {
|
||||
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
|
||||
String formattedLore = EnumChatFormatting.GOLD + speciesLore;
|
||||
List<String> formattedLoreList = fontRenderer.listFormattedStringToWidth(formattedLore, 200);
|
||||
text.addAll(formattedLoreList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDiscoveredBy(List<String> text) {
|
||||
IAlleleTreeSpecies primary = genome.getPrimary();
|
||||
String descTokens[] = primary.getDescription().split("\\|");
|
||||
|
||||
if (descTokens.length > 2) {
|
||||
String discoveredBy = descTokens[2];
|
||||
if (!discoveredBy.isEmpty()) {
|
||||
text.add("");
|
||||
text.add("Discovered by " + EnumChatFormatting.ITALIC + discoveredBy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTooltip(List<String> list) {
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ public enum TreeBranchDefinition implements IBranchDefinition {
|
||||
@Override
|
||||
public IAllele[] getTemplate() {
|
||||
if (defaultTemplate == null) {
|
||||
defaultTemplate = new IAllele[EnumTreeChromosome.values().length];
|
||||
defaultTemplate = new IAllele[EnumTreeChromosome.VALUES.length];
|
||||
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumTreeChromosome.FRUITS, AlleleFruit.fruitNone);
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumTreeChromosome.GROWTH, AlleleGrowth.growthLightLevel);
|
||||
|
||||
@@ -1148,6 +1148,14 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator {
|
||||
return species.getUID();
|
||||
}
|
||||
|
||||
public EnumWoodType getWoodType() {
|
||||
return woodType;
|
||||
}
|
||||
|
||||
public ItemStack getVanillaWood() {
|
||||
return vanillaWood;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final ITreeGenome getGenome() {
|
||||
return genome;
|
||||
|
||||
@@ -389,7 +389,7 @@ public class TreeHelper extends SpeciesRoot implements ITreeRoot {
|
||||
|
||||
@Override
|
||||
public IChromosomeType[] getKaryotype() {
|
||||
return EnumTreeChromosome.values();
|
||||
return EnumTreeChromosome.VALUES;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -113,11 +113,7 @@ public final class AccessHandler implements IAccessHandler {
|
||||
if (!isOwner(player)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int ordinal = (access.ordinal() + 1) % EnumAccess.values().length;
|
||||
EnumAccess newAccess = EnumAccess.values()[ordinal];
|
||||
setAccess(player.worldObj, newAccess);
|
||||
|
||||
setAccess(player.worldObj, access.next());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -156,7 +152,7 @@ public final class AccessHandler implements IAccessHandler {
|
||||
public void readData(DataInputStreamForestry data) throws IOException {
|
||||
byte accessOrdinal = data.readByte();
|
||||
if (accessOrdinal >= 0) {
|
||||
access = EnumAccess.values()[accessOrdinal];
|
||||
access = EnumAccess.fromOrdinal(accessOrdinal);
|
||||
GameProfile owner = new GameProfile(new UUID(data.readLong(), data.readLong()), data.readUTF());
|
||||
setOwner(owner);
|
||||
}
|
||||
@@ -164,8 +160,7 @@ public final class AccessHandler implements IAccessHandler {
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound data) {
|
||||
access = EnumAccess.values()[data.getInteger("Access")];
|
||||
|
||||
access = EnumAccess.fromOrdinal(data.getInteger("Access"));
|
||||
if (data.hasKey("owner")) {
|
||||
owner = NBTUtil.func_152459_a(data.getCompoundTag("owner"));
|
||||
}
|
||||
|
||||
@@ -8,22 +8,15 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.access;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public enum EnumAccess {
|
||||
|
||||
SHARED("gui.rule.shared"),
|
||||
VIEWABLE("gui.rule.restricted"),
|
||||
PRIVATE("gui.rule.private");
|
||||
|
||||
private static final EnumAccess[] VALUES = values();
|
||||
private final String name;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon icon;
|
||||
|
||||
EnumAccess(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
@@ -31,4 +24,13 @@ public enum EnumAccess {
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public EnumAccess next() {
|
||||
int ordinal = (this.ordinal() + 1) % VALUES.length;
|
||||
return VALUES[ordinal];
|
||||
}
|
||||
|
||||
public static EnumAccess fromOrdinal(int ordinal) {
|
||||
return VALUES[ordinal];
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.blocks;
|
||||
|
||||
import static forestry.Forestry.isDreamcraftLoaded;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -52,7 +54,7 @@ public class BlockResourceOre extends Block {
|
||||
public void dropBlockAsItemWithChance(World world, int x, int y, int z, int metadata, float par6, int par7) {
|
||||
super.dropBlockAsItemWithChance(world, x, y, z, metadata, par6, par7);
|
||||
|
||||
if (metadata == 0) {
|
||||
if (metadata == 0 && !isDreamcraftLoaded) {
|
||||
this.dropXpOnBlockBreak(world, x, y, z, MathHelper.getRandomIntegerInRange(world.rand, 1, 4));
|
||||
}
|
||||
}
|
||||
@@ -61,7 +63,7 @@ public class BlockResourceOre extends Block {
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
ArrayList<ItemStack> drops = new ArrayList<>();
|
||||
|
||||
if (metadata == ResourceType.APATITE.ordinal()) {
|
||||
if (metadata == ResourceType.APATITE.ordinal() && !isDreamcraftLoaded) {
|
||||
int fortuneModifier = world.rand.nextInt(fortune + 2) - 1;
|
||||
if (fortuneModifier < 0) {
|
||||
fortuneModifier = 0;
|
||||
|
||||
@@ -116,6 +116,12 @@ public abstract class BlockStructure extends BlockForestry {
|
||||
InventoryUtil.dropSockets((ISocketable) tile, world, x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
if (tile instanceof IMultiblockComponent.HasInventory) {
|
||||
IMultiblockComponent.HasInventory hasInventory = (IMultiblockComponent.HasInventory) tile;
|
||||
|
||||
InventoryUtil.dropInventory(hasInventory.getInternalInventory(), world, x, y, z);
|
||||
}
|
||||
}
|
||||
super.breakBlock(world, x, y, z, block, meta);
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ public class CircuitBoard<T> implements ICircuitBoard {
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
|
||||
type = EnumCircuitBoardType.values()[nbttagcompound.getShort("T")];
|
||||
type = EnumCircuitBoardType.VALUES[nbttagcompound.getShort("T")];
|
||||
|
||||
// Layout
|
||||
if (nbttagcompound.hasKey("LY")) {
|
||||
|
||||
@@ -15,6 +15,11 @@ public enum EnumCircuitBoardType {
|
||||
REFINED((short) 3, 0x191919, 0xc9c9c9),
|
||||
INTRICATE((short) 4, 0x191919, 0xe2cb6b);
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumCircuitBoardType[] VALUES = values();
|
||||
|
||||
private final short sockets;
|
||||
private final int primaryColor;
|
||||
private final int secondaryColor;
|
||||
|
||||
@@ -63,7 +63,7 @@ public class GuiSolderingIron extends GuiForestry<ContainerSolderingIron, ItemIn
|
||||
try {
|
||||
ICircuitSocketType socketType = layout.getSocketType();
|
||||
if (CircuitSocketType.FARM.equals(socketType)) {
|
||||
FarmDirection farmDirection = FarmDirection.values()[i];
|
||||
FarmDirection farmDirection = FarmDirection.fromOrdinal(i);
|
||||
String farmDirectionString = farmDirection.toString().toLowerCase(Locale.ENGLISH);
|
||||
String localizedDirection = StringUtil.localize("gui.solder." + farmDirectionString);
|
||||
fontRendererObj.drawString(
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ItemCircuitBoard extends ItemForestryMultiPass {
|
||||
|
||||
@Override
|
||||
public int getColorFromItemStack(ItemStack itemstack, int pass) {
|
||||
EnumCircuitBoardType type = EnumCircuitBoardType.values()[itemstack.getItemDamage()];
|
||||
EnumCircuitBoardType type = EnumCircuitBoardType.VALUES[itemstack.getItemDamage()];
|
||||
if (pass == 0) {
|
||||
return type.getPrimaryColor();
|
||||
} else {
|
||||
@@ -60,7 +60,7 @@ public class ItemCircuitBoard extends ItemForestryMultiPass {
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
EnumCircuitBoardType type = EnumCircuitBoardType.values()[stack.getItemDamage()];
|
||||
EnumCircuitBoardType type = EnumCircuitBoardType.VALUES[stack.getItemDamage()];
|
||||
return "item.for.circuitboard." + type.toString().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
|
||||
@@ -137,6 +137,7 @@ 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);
|
||||
@@ -301,6 +302,9 @@ 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",
|
||||
|
||||
@@ -109,6 +109,7 @@ 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;
|
||||
|
||||
@@ -14,7 +14,6 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.minecart.MinecartInteractEvent;
|
||||
@@ -29,6 +28,7 @@ import forestry.core.gui.GuiHandler;
|
||||
import forestry.core.gui.IGuiHandlerEntity;
|
||||
import forestry.core.gui.IHintSource;
|
||||
import forestry.core.tiles.ITitled;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
public abstract class EntityMinecartForestry extends EntityMinecart
|
||||
implements ITitled, IRestrictedAccess, IHintSource, IGuiHandlerEntity {
|
||||
@@ -111,7 +111,7 @@ public abstract class EntityMinecartForestry extends EntityMinecart
|
||||
|
||||
@Override
|
||||
public String getCommandSenderName() {
|
||||
return StatCollector.translateToLocal(getUnlocalizedTitle());
|
||||
return StringUtil.localizeGuiTitle(getUnlocalizedTitle());
|
||||
}
|
||||
|
||||
/* ITitled */
|
||||
|
||||
@@ -72,6 +72,12 @@ 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") + ">");
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.genetics.mutations;
|
||||
|
||||
import static forestry.core.utils.MathUtil.safeMultiply;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -126,7 +128,9 @@ public abstract class Mutation implements IMutationCustom {
|
||||
IGenome genome1, IClimateProvider climate) {
|
||||
float mutationChance = chance;
|
||||
for (IMutationCondition mutationCondition : mutationConditions) {
|
||||
mutationChance *= mutationCondition.getChance(world, x, y, z, allele0, allele1, genome0, genome1, climate);
|
||||
mutationChance = safeMultiply(
|
||||
mutationChance,
|
||||
mutationCondition.getChance(world, x, y, z, allele0, allele1, genome0, genome1, climate));
|
||||
if (mutationChance == 0) {
|
||||
return 0;
|
||||
}
|
||||
@@ -172,4 +176,8 @@ public abstract class Mutation implements IMutationCustom {
|
||||
public boolean isSecret() {
|
||||
return isSecret;
|
||||
}
|
||||
|
||||
public List<IMutationCondition> getMutationConditions() {
|
||||
return mutationConditions;
|
||||
}
|
||||
}
|
||||
@@ -53,4 +53,13 @@ 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();
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,8 @@ 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;
|
||||
@@ -34,6 +36,7 @@ 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;
|
||||
@@ -43,6 +46,10 @@ 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) {
|
||||
@@ -128,6 +135,15 @@ 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) {
|
||||
|
||||
@@ -10,9 +10,9 @@ package forestry.core.gui;
|
||||
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import forestry.core.tiles.ITitled;
|
||||
import forestry.core.utils.StringUtil;
|
||||
|
||||
public abstract class GuiForestryTitled<C extends Container, I extends ITitled & IInventory> extends GuiForestry<C, I> {
|
||||
|
||||
@@ -24,7 +24,7 @@ public abstract class GuiForestryTitled<C extends Container, I extends ITitled &
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
|
||||
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
|
||||
|
||||
String name = StatCollector.translateToLocal(inventory.getUnlocalizedTitle());
|
||||
String name = StringUtil.localizeGuiTitle(inventory.getUnlocalizedTitle());
|
||||
textLayout.line = 6;
|
||||
textLayout.drawCenteredLine(name, 0, fontColor.get("gui.title"));
|
||||
bindTexture(textureFile);
|
||||
|
||||
@@ -138,6 +138,10 @@ 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
|
||||
|
||||
@@ -159,29 +159,28 @@ 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;
|
||||
}
|
||||
|
||||
if (mouseButton == 0) {
|
||||
// Default action only if the mouse click was not handled by the
|
||||
// ledger itself.
|
||||
if (!ledger.handleMouseClicked(x, y, mouseButton)) {
|
||||
|
||||
Ledger ledger = this.getAtPosition(x, y);
|
||||
|
||||
// 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();
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
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,12 +20,14 @@ 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
|
||||
@@ -39,7 +41,7 @@ public class SlotCrafter extends SlotCrafting {
|
||||
|
||||
@Override
|
||||
public boolean canTakeStack(EntityPlayer player) {
|
||||
return crafter.canTakeStack(getSlotIndex());
|
||||
return crafter.canTakeStack(player, getSlotIndex());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -49,7 +51,7 @@ public class SlotCrafter extends SlotCrafting {
|
||||
|
||||
@Override
|
||||
public boolean getHasStack() {
|
||||
return getStack() != null && crafter.canTakeStack(getSlotIndex());
|
||||
return getStack() != null && crafter.canTakeStack(player, getSlotIndex());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -78,6 +78,14 @@ public abstract class ItemInventory implements IInventory, IFilterSlotDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isParentItemEquipped() {
|
||||
return isSameItemInventory(player.getCurrentEquippedItem(), parent);
|
||||
}
|
||||
|
||||
public EntityPlayer getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
public boolean isParentItemInventory(ItemStack itemStack) {
|
||||
ItemStack parent = getParent();
|
||||
return isSameItemInventory(parent, itemStack);
|
||||
|
||||
@@ -121,11 +121,11 @@ public class ItemInventorySolderingIron extends ItemInventory implements IErrorS
|
||||
}
|
||||
|
||||
// Illegal type
|
||||
if (blank.getItemDamage() < 0 || blank.getItemDamage() >= EnumCircuitBoardType.values().length) {
|
||||
if (blank.getItemDamage() < 0 || blank.getItemDamage() >= EnumCircuitBoardType.VALUES.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
EnumCircuitBoardType type = EnumCircuitBoardType.values()[blank.getItemDamage()];
|
||||
EnumCircuitBoardType type = EnumCircuitBoardType.VALUES[blank.getItemDamage()];
|
||||
if (getCircuitCount() != type.getSockets()) {
|
||||
return;
|
||||
}
|
||||
@@ -172,7 +172,7 @@ public class ItemInventorySolderingIron extends ItemInventory implements IErrorS
|
||||
if (blankCircuitBoard == null) {
|
||||
errorStates.add(EnumErrorCode.NO_CIRCUIT_BOARD);
|
||||
} else {
|
||||
EnumCircuitBoardType type = EnumCircuitBoardType.values()[blankCircuitBoard.getItemDamage()];
|
||||
EnumCircuitBoardType type = EnumCircuitBoardType.VALUES[blankCircuitBoard.getItemDamage()];
|
||||
|
||||
int circuitCount = 0;
|
||||
for (short i = 0; i < type.getSockets(); i++) {
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
package forestry.core.inventory;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class MergedInventories implements IInventory {
|
||||
|
||||
private final IInventory first;
|
||||
private final IInventory second;
|
||||
|
||||
public MergedInventories(IInventory first, IInventory second) {
|
||||
this.first = first;
|
||||
this.second = second;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return first.getSizeInventory() + second.getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int slotIn) {
|
||||
if (slotIn < first.getSizeInventory()) {
|
||||
return first.getStackInSlot(slotIn);
|
||||
}
|
||||
return second.getStackInSlot(slotIn - first.getSizeInventory());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int index, int count) {
|
||||
if (index < first.getSizeInventory()) {
|
||||
return first.decrStackSize(index, count);
|
||||
}
|
||||
return second.decrStackSize(index - first.getSizeInventory(), count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int index) {
|
||||
if (index < first.getSizeInventory()) {
|
||||
return first.getStackInSlotOnClosing(index);
|
||||
}
|
||||
return second.getStackInSlotOnClosing(index - first.getSizeInventory());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int index, ItemStack stack) {
|
||||
if (index < first.getSizeInventory()) {
|
||||
first.setInventorySlotContents(index, stack);
|
||||
} else {
|
||||
second.setInventorySlotContents(index - first.getSizeInventory(), stack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return first.getInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return first.hasCustomInventoryName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return Math.min(first.getInventoryStackLimit(), second.getInventoryStackLimit());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
first.markDirty();
|
||||
second.markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
return first.isUseableByPlayer(player) && second.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {
|
||||
first.openInventory();
|
||||
second.openInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
first.closeInventory();
|
||||
second.closeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int index, ItemStack stack) {
|
||||
if (index < first.getSizeInventory()) {
|
||||
return first.isItemValidForSlot(index, stack);
|
||||
}
|
||||
return second.isItemValidForSlot(index - first.getSizeInventory(), stack);
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ public class ItemForestryTool extends ItemForestry {
|
||||
setMaxDamage(200);
|
||||
this.remnants = remnants;
|
||||
if (remnants != null) {
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,20 +53,6 @@ public class ItemForestryTool extends ItemForestry {
|
||||
return ForgeHooks.canToolHarvestBlock(block, 0, stack);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDestroyCurrentItem(PlayerDestroyItemEvent event) {
|
||||
if (event.original == null || event.original.getItem() != this) {
|
||||
return;
|
||||
}
|
||||
|
||||
EntityPlayer player = event.entityPlayer;
|
||||
World world = player.worldObj;
|
||||
|
||||
if (!world.isRemote && remnants != null) {
|
||||
ItemStackUtil.dropItemStackAsEntity(remnants.copy(), world, player.posX, player.posY, player.posZ);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed(ItemStack itemstack, World world, Block block, int x, int y, int z,
|
||||
EntityLivingBase entityliving) {
|
||||
@@ -80,4 +66,21 @@ public class ItemForestryTool extends ItemForestry {
|
||||
public boolean isFull3D() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public class EventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onDestroyCurrentItem(PlayerDestroyItemEvent event) {
|
||||
if (event.original == null || event.original.getItem() != ItemForestryTool.this) {
|
||||
return;
|
||||
}
|
||||
|
||||
EntityPlayer player = event.entityPlayer;
|
||||
World world = player.worldObj;
|
||||
|
||||
if (!world.isRemote && remnants != null) {
|
||||
ItemStackUtil.dropItemStackAsEntity(remnants.copy(), world, player.posX, player.posY, player.posZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,9 @@ public class ItemFruit extends ItemForestryFood {
|
||||
DATES("cropDate"),
|
||||
PAPAYA("cropPapaya"); // , COCONUT("cropCoconut");
|
||||
|
||||
/**
|
||||
* Cached values() array for frequent read-only operations, the array should NOT be mutated.
|
||||
*/
|
||||
public static final EnumFruit[] VALUES = values();
|
||||
|
||||
private final String oreDict;
|
||||
@@ -94,13 +97,13 @@ public class ItemFruit extends ItemForestryFood {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
return EnumFruit.values()[meta].getIcon();
|
||||
return EnumFruit.VALUES[meta].getIcon();
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
||||
for (int i = 0; i < EnumFruit.values().length; i++) {
|
||||
for (int i = 0; i < EnumFruit.VALUES.length; i++) {
|
||||
itemList.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.items;
|
||||
|
||||
import static forestry.Forestry.isDreamcraftLoaded;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
@@ -63,7 +67,7 @@ public class ItemRegistryCore extends ItemRegistry {
|
||||
|
||||
/* Peat */
|
||||
public final ItemForestry peat;
|
||||
public final ItemForestry ash;
|
||||
private final ItemForestry ash;
|
||||
public final ItemForestry bituminousPeat;
|
||||
|
||||
/* Moistener */
|
||||
@@ -74,6 +78,7 @@ public class ItemRegistryCore extends ItemRegistry {
|
||||
/* Rainmaker */
|
||||
public final ItemForestry iodineCharge;
|
||||
public final ItemForestry phosphor;
|
||||
public final ItemForestry phosphorCharge;
|
||||
|
||||
/* Misc */
|
||||
public final ItemCraftingMaterial craftingMaterial;
|
||||
@@ -87,19 +92,26 @@ public class ItemRegistryCore extends ItemRegistry {
|
||||
fertilizerBio = registerItem(new ItemForestry(), "fertilizerBio");
|
||||
fertilizerCompound = registerItem(new ItemForestryBonemeal(), "fertilizerCompound");
|
||||
|
||||
apatite = registerItem(new ItemForestry(), "apatite");
|
||||
OreDictionary.registerOre("gemApatite", apatite);
|
||||
|
||||
researchNote = registerItem(new ItemResearchNote(), "researchNote");
|
||||
|
||||
ingotCopper = registerItem(new ItemForestry(), "ingotCopper");
|
||||
OreDictionary.registerOre("ingotCopper", ingotCopper);
|
||||
if (!isDreamcraftLoaded) {
|
||||
apatite = registerItem(new ItemForestry(), "apatite");
|
||||
OreDictionary.registerOre("gemApatite", apatite);
|
||||
|
||||
ingotTin = registerItem(new ItemForestry(), "ingotTin");
|
||||
OreDictionary.registerOre("ingotTin", ingotTin);
|
||||
ingotCopper = registerItem(new ItemForestry(), "ingotCopper");
|
||||
OreDictionary.registerOre("ingotCopper", ingotCopper);
|
||||
|
||||
ingotBronze = registerItem(new ItemForestry(), "ingotBronze");
|
||||
OreDictionary.registerOre("ingotBronze", ingotBronze);
|
||||
ingotTin = registerItem(new ItemForestry(), "ingotTin");
|
||||
OreDictionary.registerOre("ingotTin", ingotTin);
|
||||
|
||||
ingotBronze = registerItem(new ItemForestry(), "ingotBronze");
|
||||
OreDictionary.registerOre("ingotBronze", ingotBronze);
|
||||
} else {
|
||||
apatite = null;
|
||||
ingotCopper = null;
|
||||
ingotTin = null;
|
||||
ingotBronze = null;
|
||||
}
|
||||
|
||||
wrench = registerItem(new ItemWrench(), "wrench");
|
||||
pipette = registerItem(new ItemPipette(), "pipette");
|
||||
@@ -170,8 +182,8 @@ public class ItemRegistryCore extends ItemRegistry {
|
||||
|
||||
// / RAINMAKER SUBSTRATES
|
||||
iodineCharge = registerItem(new ItemForestry(), "iodineCapsule");
|
||||
|
||||
phosphor = registerItem(new ItemForestry(), "phosphor");
|
||||
phosphorCharge = registerItem(new ItemForestry(), "phosphoricIodineCapsule");
|
||||
|
||||
// / BEE RESOURCES
|
||||
beeswax = registerItem(new ItemForestry(), "beeswax");
|
||||
@@ -182,9 +194,17 @@ public class ItemRegistryCore extends ItemRegistry {
|
||||
|
||||
// FRUITS
|
||||
fruits = registerItem(new ItemFruit(), "fruits");
|
||||
for (ItemFruit.EnumFruit def : ItemFruit.EnumFruit.values()) {
|
||||
for (ItemFruit.EnumFruit def : ItemFruit.EnumFruit.VALUES) {
|
||||
ItemStack fruit = new ItemStack(fruits, 1, def.ordinal());
|
||||
OreDictionary.registerOre(def.getOreDict(), fruit);
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getAsh() {
|
||||
List<ItemStack> options = OreDictionary.getOres("dustAsh");
|
||||
for (ItemStack option : options) {
|
||||
if (option.getItem() != ash) return option.copy();
|
||||
}
|
||||
return ash.getItemStack();
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,7 @@ public enum PacketIdClient implements IPacketId {
|
||||
ITEMSTACK_DISPLAY,
|
||||
FX_SIGNAL,
|
||||
TANK_LEVEL_UPDATE,
|
||||
TILE_CONFIGURATION,
|
||||
|
||||
// Core Genome
|
||||
GENOME_TRACKER_UPDATE,
|
||||
|
||||
@@ -27,6 +27,7 @@ import forestry.core.network.packets.PacketPipetteClick;
|
||||
import forestry.core.network.packets.PacketSocketUpdate;
|
||||
import forestry.core.network.packets.PacketSolderingIronClick;
|
||||
import forestry.core.network.packets.PacketTankLevelUpdate;
|
||||
import forestry.core.network.packets.PacketTileConfiguration;
|
||||
import forestry.core.network.packets.PacketTileStream;
|
||||
|
||||
public class PacketRegistryCore extends PacketRegistry {
|
||||
@@ -47,6 +48,7 @@ public class PacketRegistryCore extends PacketRegistry {
|
||||
registerClientPacket(new PacketFXSignal());
|
||||
registerClientPacket(new PacketTankLevelUpdate());
|
||||
registerClientPacket(new PacketGenomeTrackerSync());
|
||||
registerClientPacket(new PacketTileConfiguration());
|
||||
|
||||
registerServerPacket(new PacketGuiSelectRequest());
|
||||
registerServerPacket(new PacketPipetteClick());
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package forestry.core.network.packets;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.IForestryPacketClient;
|
||||
import forestry.core.network.PacketIdClient;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.IConfigurable;
|
||||
|
||||
/**
|
||||
* Used to sync the tile configuration from Server to Client.
|
||||
*/
|
||||
public class PacketTileConfiguration extends PacketCoordinates implements IForestryPacketClient {
|
||||
|
||||
private TileEntity tileEntity = null;
|
||||
|
||||
public PacketTileConfiguration() {}
|
||||
|
||||
public PacketTileConfiguration(TileEntity tileEntity) {
|
||||
super(tileEntity);
|
||||
this.tileEntity = tileEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeData(DataOutputStreamForestry data) throws IOException {
|
||||
super.writeData(data);
|
||||
if (tileEntity instanceof IConfigurable) {
|
||||
((IConfigurable) tileEntity).writeConfigurationData(data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacketData(DataInputStreamForestry data, EntityPlayer player) throws IOException {
|
||||
TileEntity tile = getTarget(Proxies.common.getRenderWorld());
|
||||
if (tile instanceof IConfigurable) {
|
||||
((IConfigurable) tile).readConfigurationData(data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketIdClient getPacketId() {
|
||||
return PacketIdClient.TILE_CONFIGURATION;
|
||||
}
|
||||
}
|
||||
@@ -61,6 +61,10 @@ public class ProxyCommon {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isCtrlDown() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void playSoundFX(World world, int x, int y, int z, Block block) {
|
||||
Proxies.net.sendNetworkPacket(new PacketFXSignal(PacketFXSignal.SoundFXType.LEAF, x, y, z, block, 0), world);
|
||||
}
|
||||
|
||||
@@ -63,6 +63,11 @@ public class ProxyCommonClient extends ProxyCommon {
|
||||
return Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCtrlDown() {
|
||||
return Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName(ItemStack itemstack) {
|
||||
return itemstack.getItem().getItemStackDisplayName(itemstack);
|
||||
|
||||
@@ -112,15 +112,14 @@ public abstract class RecipeHandlerBase extends TemplateRecipeHandler implements
|
||||
public List<String> handleTooltip(GuiRecipe<?> guiRecipe, List<String> currenttip, int recipe) {
|
||||
super.handleTooltip(guiRecipe, currenttip, recipe);
|
||||
CachedBaseRecipe crecipe = (CachedBaseRecipe) this.arecipes.get(recipe);
|
||||
|
||||
if (GuiContainerManager.shouldShowTooltip(guiRecipe)) {
|
||||
Point mouse = GuiDraw.getMousePosition();
|
||||
Point offset = guiRecipe.getRecipePosition(recipe);
|
||||
Point relMouse = new Point(
|
||||
mouse.x - (guiRecipe.width - 176) / 2 - offset.x,
|
||||
mouse.y - (guiRecipe.height - 166) / 2 - offset.y);
|
||||
|
||||
Point relMouse = new Point(mouse.x - guiRecipe.guiLeft - offset.x, mouse.y - guiRecipe.guiTop - offset.y);
|
||||
currenttip = this.provideTooltip(guiRecipe, currenttip, crecipe, relMouse);
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@@ -131,12 +130,9 @@ public abstract class RecipeHandlerBase extends TemplateRecipeHandler implements
|
||||
CachedBaseRecipe crecipe = (CachedBaseRecipe) this.arecipes.get(recipe);
|
||||
Point mouse = GuiDraw.getMousePosition();
|
||||
Point offset = guiRecipe.getRecipePosition(recipe);
|
||||
Point relMouse = new Point(
|
||||
mouse.x - (guiRecipe.width - 176) / 2 - offset.x,
|
||||
mouse.y - (guiRecipe.height - 166) / 2 - offset.y);
|
||||
Point relMouse = new Point(mouse.x - guiRecipe.guiLeft - offset.x, mouse.y - guiRecipe.guiTop - offset.y);
|
||||
|
||||
currenttip = this.provideItemTooltip(guiRecipe, itemStack, currenttip, crecipe, relMouse);
|
||||
return currenttip;
|
||||
return this.provideItemTooltip(guiRecipe, itemStack, currenttip, crecipe, relMouse);
|
||||
}
|
||||
|
||||
public List<String> provideTooltip(GuiRecipe<?> guiRecipe, List<String> currenttip, CachedBaseRecipe crecipe,
|
||||
@@ -200,11 +196,9 @@ public abstract class RecipeHandlerBase extends TemplateRecipeHandler implements
|
||||
|
||||
protected boolean transferFluidTank(GuiRecipe<?> guiRecipe, int recipe, boolean usage) {
|
||||
CachedBaseRecipe crecipe = (CachedBaseRecipe) this.arecipes.get(recipe);
|
||||
Point mousepos = GuiDraw.getMousePosition();
|
||||
Point mouse = GuiDraw.getMousePosition();
|
||||
Point offset = guiRecipe.getRecipePosition(recipe);
|
||||
Point relMouse = new Point(
|
||||
mousepos.x - (guiRecipe.width - 176) / 2 - offset.x,
|
||||
mousepos.y - (guiRecipe.height - 166) / 2 - offset.y);
|
||||
Point relMouse = new Point(mouse.x - guiRecipe.guiLeft - offset.x, mouse.y - guiRecipe.guiTop - offset.y);
|
||||
|
||||
if (crecipe.getFluidTanks() != null) {
|
||||
for (PositionedFluidTank tank : crecipe.getFluidTanks()) {
|
||||
|
||||
@@ -8,15 +8,19 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.render;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
|
||||
import net.minecraft.client.resources.IResource;
|
||||
import net.minecraft.client.resources.IResourceManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class FontColour {
|
||||
|
||||
// private static final ResourceLocation colourDefinitions = new
|
||||
// ForestryResource("/config/forestry/colour.properties");
|
||||
private static final ResourceLocation colourDefinitions = new ForestryResource("config/colour.properties");
|
||||
private static final String defaultColourDefinitions = "/assets/forestry/config/colour.properties";
|
||||
|
||||
private final Properties defaultMappings = new Properties();
|
||||
private final Properties mappings = new Properties();
|
||||
@@ -30,17 +34,30 @@ public class FontColour {
|
||||
}
|
||||
|
||||
public void load(IResourceManager texturepack) {
|
||||
try {
|
||||
// InputStream fontStream = texturepack.func_110536_a(colourDefinitions).func_110527_b();
|
||||
InputStream defaultFontStream = FontColour.class.getResourceAsStream("/config/forestry/colour.properties");
|
||||
// mappings.load((fontStream == null) ? defaultFontStream : fontStream);
|
||||
mappings.load(defaultFontStream);
|
||||
defaultMappings.load(defaultFontStream);
|
||||
mappings.clear();
|
||||
defaultMappings.clear();
|
||||
|
||||
// if (fontStream != null)
|
||||
// fontStream.close();
|
||||
defaultFontStream.close();
|
||||
} catch (Exception e) {
|
||||
try (InputStream defaultFontStream = FontColour.class.getResourceAsStream(defaultColourDefinitions)) {
|
||||
if (defaultFontStream != null) {
|
||||
defaultMappings.load(defaultFontStream);
|
||||
mappings.putAll(defaultMappings);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (texturepack == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
IResource resource = texturepack.getResource(colourDefinitions);
|
||||
try (InputStream fontStream = resource.getInputStream()) {
|
||||
mappings.load(fontStream);
|
||||
}
|
||||
} catch (FileNotFoundException ignored) {
|
||||
// Resource pack does not provide an override.
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,9 @@ public class TextureManager implements ITextureManager {
|
||||
"analyzer/nocturnal", "analyzer/princess", "analyzer/pure_breed", "analyzer/pure_cave",
|
||||
"analyzer/pure_flyer", "analyzer/pure_nocturnal", "analyzer/queen", "particles/swarm_bee",
|
||||
"errors/errored", "errors/unknown", "slots/blocked", "slots/blocked_2", "slots/liquid",
|
||||
"slots/container", "slots/locked", "mail/carrier.player", "mail/carrier.trader" };
|
||||
"slots/container", "slots/locked", "mail/carrier.player", "mail/carrier.trader",
|
||||
"misc/search_ingredients.internal_inventory", "misc/search_ingredients.player_inventory",
|
||||
"misc/search_ingredients.all_inventories" };
|
||||
for (String str : defaultIconNames) {
|
||||
IIcon icon = registerTex(register, str);
|
||||
defaultIcons.put(str, icon);
|
||||
|
||||
@@ -37,7 +37,8 @@ public class EscritoireTextSource {
|
||||
EnumSet<Notes> multipleTranslationNoteLevels = EnumSet
|
||||
.of(Notes.level1, Notes.level2, Notes.level3, Notes.level4, Notes.success, Notes.failure);
|
||||
for (Notes notesLevel : multipleTranslationNoteLevels) {
|
||||
int levelCount = Integer.valueOf(StringUtil.localize("gui.escritoire.notes." + notesLevel + ".count"));
|
||||
int levelCount = Integer.valueOf(
|
||||
StringUtil.localize("gui.escritoire.notes." + notesLevel + ".count").replaceAll("§\\d", ""));
|
||||
for (int i = 1; i <= levelCount; i++) {
|
||||
String note = StringUtil.localize("gui.escritoire.notes." + notesLevel + '.' + i);
|
||||
researchNotes.put(notesLevel, note);
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package forestry.core.tiles;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
|
||||
public interface IConfigurable {
|
||||
|
||||
void writeConfigurationData(DataOutputStreamForestry data) throws IOException;
|
||||
|
||||
void readConfigurationData(DataInputStreamForestry data) throws IOException;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package forestry.core.tiles;
|
||||
|
||||
public interface IIngredientsSearchController {
|
||||
|
||||
IngredientsStorage getIngredientsStorage();
|
||||
|
||||
void setIngredientsStorage(IngredientsStorage ingredientsStorage);
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package forestry.core.tiles;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
import forestry.core.inventory.MergedInventories;
|
||||
|
||||
public enum IngredientsStorage {
|
||||
|
||||
INTERNAL_INVENTORY,
|
||||
PLAYER_INVENTORY,
|
||||
ALL_INVENTORIES;
|
||||
|
||||
public static final IngredientsStorage[] VALUES = values();
|
||||
|
||||
public static IngredientsStorage fromInt(int value) {
|
||||
value = value % VALUES.length;
|
||||
if (value < 0) {
|
||||
value += VALUES.length;
|
||||
}
|
||||
return VALUES[value];
|
||||
}
|
||||
|
||||
public IngredientsStorage next() {
|
||||
return fromInt(ordinal() + 1);
|
||||
}
|
||||
|
||||
public IngredientsStorage previous() {
|
||||
return fromInt(ordinal() - 1);
|
||||
}
|
||||
|
||||
public IInventory getInventory(IInventory internal, EntityPlayer player) {
|
||||
switch (this) {
|
||||
case PLAYER_INVENTORY:
|
||||
return player.inventory;
|
||||
case ALL_INVENTORIES:
|
||||
return new MergedInventories(internal, player.inventory);
|
||||
default:
|
||||
return internal;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -235,22 +235,22 @@ public abstract class BlockUtil {
|
||||
private static Class<? extends Block> GTBlockMachines_Class;
|
||||
private static Block GTBlockMachines;
|
||||
private static final boolean bw = Loader.isModLoaded("bartworks");
|
||||
private static final boolean gt = Loader.isModLoaded("gregtech");
|
||||
private static final boolean gt = Loader.isModLoaded("gregtech") && !Loader.isModLoaded("gregapi");
|
||||
|
||||
static {
|
||||
if (bw) try {
|
||||
// noinspection unchecked
|
||||
BW_MetaGenerated_WerkstoffBlocksClass = (Class<? extends Block>) Class
|
||||
.forName("com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerated_WerkstoffBlocks");
|
||||
BWBlocks = (Block) Class.forName("com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader")
|
||||
.getField("BWBlocks").get(null);
|
||||
.forName("bartworks.system.material.BWMetaGeneratedWerkstoffBlocks");
|
||||
BWBlocks = (Block) Class.forName("bartworks.system.material.WerkstoffLoader").getField("BWBlocks")
|
||||
.get(null);
|
||||
} catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (gt) try {
|
||||
// noinspection unchecked
|
||||
GTBlockMachines_Class = (Class<? extends Block>) Class.forName("gregtech.common.blocks.GT_Block_Machines");
|
||||
GTBlockMachines = (Block) Class.forName("gregtech.api.GregTech_API").getField("sBlockMachines").get(null);
|
||||
GTBlockMachines_Class = (Class<? extends Block>) Class.forName("gregtech.common.blocks.BlockMachines");
|
||||
GTBlockMachines = (Block) Class.forName("gregtech.api.GregTechAPI").getField("sBlockMachines").get(null);
|
||||
} catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -268,11 +268,13 @@ public abstract class BlockUtil {
|
||||
} while (stillInside.test(tile));
|
||||
block = world.getBlock(x, y - depth, z);
|
||||
|
||||
if (bw && BW_MetaGenerated_WerkstoffBlocksClass.isInstance(block)) {
|
||||
if (bw && BW_MetaGenerated_WerkstoffBlocksClass != null
|
||||
&& BWBlocks != null
|
||||
&& BW_MetaGenerated_WerkstoffBlocksClass.isInstance(block)) {
|
||||
return new ItemStack(BWBlocks, 1, block.getDamageValue(world, x, y - depth, z));
|
||||
}
|
||||
|
||||
if (gt && GTBlockMachines_Class.isInstance(block)) {
|
||||
if (gt && GTBlockMachines_Class != null && GTBlockMachines != null && GTBlockMachines_Class.isInstance(block)) {
|
||||
return new ItemStack(GTBlockMachines, 1, block.getDamageValue(world, x, y - depth, z));
|
||||
}
|
||||
|
||||
|
||||
@@ -45,18 +45,18 @@ public class ClimateUtil implements IClimateHelper {
|
||||
case BOTH_4:
|
||||
case BOTH_3:
|
||||
case BOTH_2:
|
||||
if (prefered.ordinal() + 2 < EnumHumidity.values().length) {
|
||||
tolerated.add(EnumHumidity.values()[prefered.ordinal() + 2]);
|
||||
if (prefered.ordinal() + 2 < EnumHumidity.VALUES.length) {
|
||||
tolerated.add(EnumHumidity.VALUES[prefered.ordinal() + 2]);
|
||||
}
|
||||
if (prefered.ordinal() - 2 >= 0) {
|
||||
tolerated.add(EnumHumidity.values()[prefered.ordinal() - 2]);
|
||||
tolerated.add(EnumHumidity.VALUES[prefered.ordinal() - 2]);
|
||||
}
|
||||
case BOTH_1:
|
||||
if (prefered.ordinal() + 1 < EnumHumidity.values().length) {
|
||||
tolerated.add(EnumHumidity.values()[prefered.ordinal() + 1]);
|
||||
if (prefered.ordinal() + 1 < EnumHumidity.VALUES.length) {
|
||||
tolerated.add(EnumHumidity.VALUES[prefered.ordinal() + 1]);
|
||||
}
|
||||
if (prefered.ordinal() - 1 >= 0) {
|
||||
tolerated.add(EnumHumidity.values()[prefered.ordinal() - 1]);
|
||||
tolerated.add(EnumHumidity.VALUES[prefered.ordinal() - 1]);
|
||||
}
|
||||
return tolerated;
|
||||
|
||||
@@ -64,12 +64,12 @@ public class ClimateUtil implements IClimateHelper {
|
||||
case UP_4:
|
||||
case UP_3:
|
||||
case UP_2:
|
||||
if (prefered.ordinal() + 2 < EnumHumidity.values().length) {
|
||||
tolerated.add(EnumHumidity.values()[prefered.ordinal() + 2]);
|
||||
if (prefered.ordinal() + 2 < EnumHumidity.VALUES.length) {
|
||||
tolerated.add(EnumHumidity.VALUES[prefered.ordinal() + 2]);
|
||||
}
|
||||
case UP_1:
|
||||
if (prefered.ordinal() + 1 < EnumHumidity.values().length) {
|
||||
tolerated.add(EnumHumidity.values()[prefered.ordinal() + 1]);
|
||||
if (prefered.ordinal() + 1 < EnumHumidity.VALUES.length) {
|
||||
tolerated.add(EnumHumidity.VALUES[prefered.ordinal() + 1]);
|
||||
}
|
||||
return tolerated;
|
||||
|
||||
@@ -78,11 +78,11 @@ public class ClimateUtil implements IClimateHelper {
|
||||
case DOWN_3:
|
||||
case DOWN_2:
|
||||
if (prefered.ordinal() - 2 >= 0) {
|
||||
tolerated.add(EnumHumidity.values()[prefered.ordinal() - 2]);
|
||||
tolerated.add(EnumHumidity.VALUES[prefered.ordinal() - 2]);
|
||||
}
|
||||
case DOWN_1:
|
||||
if (prefered.ordinal() - 1 >= 0) {
|
||||
tolerated.add(EnumHumidity.values()[prefered.ordinal() - 1]);
|
||||
tolerated.add(EnumHumidity.VALUES[prefered.ordinal() - 1]);
|
||||
}
|
||||
return tolerated;
|
||||
|
||||
@@ -96,85 +96,86 @@ public class ClimateUtil implements IClimateHelper {
|
||||
ArrayList<EnumTemperature> tolerated = new ArrayList<>();
|
||||
tolerated.add(prefered);
|
||||
|
||||
final EnumTemperature[] TEMP_VALUES = EnumTemperature.VALUES;
|
||||
switch (tolerance) {
|
||||
case BOTH_5:
|
||||
if (prefered.ordinal() + 5 < EnumTemperature.values().length) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() + 5]);
|
||||
if (prefered.ordinal() + 5 < TEMP_VALUES.length) {
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() + 5]);
|
||||
}
|
||||
if (prefered.ordinal() - 5 >= 0) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() - 5]);
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() - 5]);
|
||||
}
|
||||
case BOTH_4:
|
||||
if (prefered.ordinal() + 4 < EnumTemperature.values().length) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() + 4]);
|
||||
if (prefered.ordinal() + 4 < TEMP_VALUES.length) {
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() + 4]);
|
||||
}
|
||||
if (prefered.ordinal() - 4 >= 0) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() - 4]);
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() - 4]);
|
||||
}
|
||||
case BOTH_3:
|
||||
if (prefered.ordinal() + 3 < EnumTemperature.values().length) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() + 3]);
|
||||
if (prefered.ordinal() + 3 < TEMP_VALUES.length) {
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() + 3]);
|
||||
}
|
||||
if (prefered.ordinal() - 3 >= 0) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() - 3]);
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() - 3]);
|
||||
}
|
||||
case BOTH_2:
|
||||
if (prefered.ordinal() + 2 < EnumTemperature.values().length) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() + 2]);
|
||||
if (prefered.ordinal() + 2 < TEMP_VALUES.length) {
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() + 2]);
|
||||
}
|
||||
if (prefered.ordinal() - 2 >= 0) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() - 2]);
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() - 2]);
|
||||
}
|
||||
case BOTH_1:
|
||||
if (prefered.ordinal() + 1 < EnumTemperature.values().length) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() + 1]);
|
||||
if (prefered.ordinal() + 1 < TEMP_VALUES.length) {
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() + 1]);
|
||||
}
|
||||
if (prefered.ordinal() - 1 >= 0) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() - 1]);
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() - 1]);
|
||||
}
|
||||
return tolerated;
|
||||
|
||||
case UP_5:
|
||||
if (prefered.ordinal() + 5 < EnumTemperature.values().length) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() + 5]);
|
||||
if (prefered.ordinal() + 5 < TEMP_VALUES.length) {
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() + 5]);
|
||||
}
|
||||
case UP_4:
|
||||
if (prefered.ordinal() + 4 < EnumTemperature.values().length) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() + 4]);
|
||||
if (prefered.ordinal() + 4 < TEMP_VALUES.length) {
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() + 4]);
|
||||
}
|
||||
case UP_3:
|
||||
if (prefered.ordinal() + 3 < EnumTemperature.values().length) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() + 3]);
|
||||
if (prefered.ordinal() + 3 < TEMP_VALUES.length) {
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() + 3]);
|
||||
}
|
||||
case UP_2:
|
||||
if (prefered.ordinal() + 2 < EnumTemperature.values().length) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() + 2]);
|
||||
if (prefered.ordinal() + 2 < TEMP_VALUES.length) {
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() + 2]);
|
||||
}
|
||||
case UP_1:
|
||||
if (prefered.ordinal() + 1 < EnumTemperature.values().length) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() + 1]);
|
||||
if (prefered.ordinal() + 1 < TEMP_VALUES.length) {
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() + 1]);
|
||||
}
|
||||
return tolerated;
|
||||
|
||||
case DOWN_5:
|
||||
if (prefered.ordinal() - 5 >= 0) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() - 5]);
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() - 5]);
|
||||
}
|
||||
case DOWN_4:
|
||||
if (prefered.ordinal() - 4 >= 0) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() - 4]);
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() - 4]);
|
||||
}
|
||||
case DOWN_3:
|
||||
if (prefered.ordinal() - 3 >= 0) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() - 3]);
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() - 3]);
|
||||
}
|
||||
case DOWN_2:
|
||||
if (prefered.ordinal() - 2 >= 0) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() - 2]);
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() - 2]);
|
||||
}
|
||||
case DOWN_1:
|
||||
if (prefered.ordinal() - 1 >= 0) {
|
||||
tolerated.add(EnumTemperature.values()[prefered.ordinal() - 1]);
|
||||
tolerated.add(TEMP_VALUES[prefered.ordinal() - 1]);
|
||||
}
|
||||
return tolerated;
|
||||
|
||||
|
||||
@@ -96,6 +96,8 @@ public class GeneticsUtil {
|
||||
* altering the world by changing vanilla leaves to forestry ones.
|
||||
*/
|
||||
public static ICheckPollinatable getCheckPollinatable(World world, final int x, final int y, final int z) {
|
||||
if (!world.blockExists(x, y, z)) return null;
|
||||
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tile instanceof IPollinatable) {
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package forestry.core.utils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class MathUtil {
|
||||
|
||||
private static final BigDecimal MAX_FLOAT = BigDecimal.valueOf(Float.MAX_VALUE);
|
||||
private static final BigDecimal MIN_FLOAT = BigDecimal.valueOf(-Float.MAX_VALUE);
|
||||
|
||||
private static float clampToFloatRange(BigDecimal result) {
|
||||
if (result.compareTo(MAX_FLOAT) > 0) {
|
||||
return Float.MAX_VALUE;
|
||||
} else if (result.compareTo(MIN_FLOAT) < 0) {
|
||||
return -Float.MAX_VALUE;
|
||||
}
|
||||
return result.floatValue();
|
||||
}
|
||||
|
||||
public static float safeMultiply(float a, float b) {
|
||||
BigDecimal bigA = BigDecimal.valueOf(a);
|
||||
BigDecimal bigB = BigDecimal.valueOf(b);
|
||||
return clampToFloatRange(bigA.multiply(bigB));
|
||||
}
|
||||
|
||||
public static float safeAdd(float a, float b) {
|
||||
BigDecimal bigA = BigDecimal.valueOf(a);
|
||||
BigDecimal bigB = BigDecimal.valueOf(b);
|
||||
return clampToFloatRange(bigA.add(bigB));
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,17 @@ public class StringUtil {
|
||||
.replace("\\%", "@");
|
||||
}
|
||||
|
||||
public static String localizeGuiTitle(String unlocalizedKey) {
|
||||
String titleKey = unlocalizedKey + ".title";
|
||||
String translated;
|
||||
if (StatCollector.canTranslate(titleKey)) {
|
||||
translated = StatCollector.translateToLocal(titleKey);
|
||||
} else {
|
||||
translated = StatCollector.translateToLocal(unlocalizedKey);
|
||||
}
|
||||
return translated.replace("\\n", "\n").replace("@", "%").replace("\\%", "@");
|
||||
}
|
||||
|
||||
public static String localizeAndFormat(String key, Object... args) {
|
||||
return localizeAndFormatRaw("for." + key, args);
|
||||
}
|
||||
|
||||
@@ -73,9 +73,9 @@ public class Vect implements IVect {
|
||||
}
|
||||
|
||||
public static Vect getRandomPositionInArea(Random random, IVect area) {
|
||||
int x = random.nextInt(area.getX());
|
||||
int y = random.nextInt(area.getY());
|
||||
int z = random.nextInt(area.getZ());
|
||||
int x = random.nextInt(area.getX() + 1);
|
||||
int y = random.nextInt(area.getY() + 1);
|
||||
int z = random.nextInt(area.getZ() + 1);
|
||||
return new Vect(x, y, z);
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ public class TileEnginePeat extends TileEngine implements ISidedInventory {
|
||||
return i;
|
||||
}
|
||||
|
||||
if (waste.getItem() != PluginCore.items.ash) {
|
||||
if (waste.getItem() != PluginCore.items.getAsh().getItem()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ public class TileEnginePeat extends TileEngine implements ISidedInventory {
|
||||
if (wasteSlot >= 0) {
|
||||
IInventoryAdapter inventory = getInternalInventory();
|
||||
if (inventory.getStackInSlot(wasteSlot) == null) {
|
||||
inventory.setInventorySlotContents(wasteSlot, PluginCore.items.ash.getItemStack());
|
||||
inventory.setInventorySlotContents(wasteSlot, PluginCore.items.getAsh());
|
||||
} else {
|
||||
inventory.getStackInSlot(wasteSlot).stackSize++;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import forestry.core.gui.slots.SlotCraftMatrix;
|
||||
import forestry.core.gui.slots.SlotCrafter;
|
||||
import forestry.core.network.packets.PacketGuiSelectRequest;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.IngredientsStorage;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.core.utils.Log;
|
||||
import forestry.factory.inventory.InventoryCraftingForestry;
|
||||
@@ -207,6 +208,15 @@ public class ContainerWorktable extends ContainerTile<TileWorktable> implements
|
||||
sendPacketToCrafters(new PacketWorktableRecipeUpdate(tile));
|
||||
break;
|
||||
}
|
||||
case 200: { // switch ingredients storage
|
||||
tile.setIngredientsStorage(IngredientsStorage.fromInt(secondary));
|
||||
markConfigurationDirty();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IngredientsStorage getIngredientsStorage() {
|
||||
return tile.getIngredientsStorage();
|
||||
}
|
||||
}
|
||||
@@ -19,9 +19,12 @@ import forestry.core.config.Constants;
|
||||
import forestry.core.gui.GuiForestryTitled;
|
||||
import forestry.core.gui.buttons.GuiBetterButton;
|
||||
import forestry.core.gui.buttons.StandardButtonTextureSets;
|
||||
import forestry.core.gui.ledgers.SearchIngregientsLedger;
|
||||
import forestry.core.network.packets.PacketGuiSelectRequest;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.tiles.IIngredientsSearchController;
|
||||
import forestry.core.tiles.IngredientsStorage;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
import forestry.factory.gui.widgets.ClearWorktable;
|
||||
import forestry.factory.gui.widgets.MemorizedRecipeSlot;
|
||||
@@ -30,13 +33,16 @@ import forestry.factory.recipes.MemorizedRecipe;
|
||||
import forestry.factory.recipes.RecipeMemory;
|
||||
import forestry.factory.tiles.TileWorktable;
|
||||
|
||||
public class GuiWorktable extends GuiForestryTitled<ContainerWorktable, TileWorktable> {
|
||||
public class GuiWorktable extends GuiForestryTitled<ContainerWorktable, TileWorktable>
|
||||
implements IIngredientsSearchController {
|
||||
|
||||
private static final int SPACING = 18;
|
||||
private boolean hasRecipeConflict = false;
|
||||
private final EntityPlayer player;
|
||||
|
||||
public GuiWorktable(EntityPlayer player, TileWorktable tile) {
|
||||
super(Constants.TEXTURE_PATH_GUI + "/worktable2.png", new ContainerWorktable(player, tile), tile);
|
||||
this.player = player;
|
||||
|
||||
ySize = 218;
|
||||
|
||||
@@ -60,6 +66,12 @@ public class GuiWorktable extends GuiForestryTitled<ContainerWorktable, TileWork
|
||||
widgetManager.add(new ClearWorktable(widgetManager, 66, 19));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addLedgers() {
|
||||
super.addLedgers();
|
||||
ledgerManager.add(new SearchIngregientsLedger(ledgerManager, this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScreen() {
|
||||
super.updateScreen();
|
||||
@@ -82,7 +94,7 @@ public class GuiWorktable extends GuiForestryTitled<ContainerWorktable, TileWork
|
||||
.get(54 + InventoryGhostCrafting.SLOT_CRAFTING_RESULT);
|
||||
|
||||
if (func_146978_c(itemSlot.xDisplayPosition, itemSlot.yDisplayPosition, 16, 16, mouseX, mouseY)
|
||||
&& !inventory.canTakeStack(InventoryGhostCrafting.SLOT_CRAFTING_RESULT)) {
|
||||
&& !inventory.canTakeStack(player, InventoryGhostCrafting.SLOT_CRAFTING_RESULT)) {
|
||||
final MemorizedRecipe recipe = inventory.getCurrentRecipe();
|
||||
|
||||
if (recipe != null) {
|
||||
@@ -121,4 +133,14 @@ public class GuiWorktable extends GuiForestryTitled<ContainerWorktable, TileWork
|
||||
int id = 100 + button.id;
|
||||
Proxies.net.sendToServer(new PacketGuiSelectRequest(id, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IngredientsStorage getIngredientsStorage() {
|
||||
return container.getIngredientsStorage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIngredientsStorage(IngredientsStorage ingredientsStorage) {
|
||||
Proxies.net.sendToServer(new PacketGuiSelectRequest(200, ingredientsStorage.ordinal()));
|
||||
}
|
||||
}
|
||||
@@ -26,16 +26,14 @@ public class InventoryRainmaker extends InventoryAdapterTile<TileMillRainmaker>
|
||||
@Override
|
||||
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
|
||||
if (slotIndex == SLOT_SUBSTRATE) {
|
||||
if (getStackInSlot(SLOT_SUBSTRATE) != null) {
|
||||
return false;
|
||||
}
|
||||
if (FuelManager.rainSubstrate.containsKey(itemStack) && tile.charge == 0 && tile.progress == 0) {
|
||||
RainSubstrate substrate = FuelManager.rainSubstrate.get(itemStack);
|
||||
if (tile.getWorld().isRaining() && substrate.reverse) {
|
||||
return true;
|
||||
} else if (!tile.getWorld().isRaining() && !substrate.reverse) {
|
||||
return true;
|
||||
}
|
||||
return tile.isValidSubstrate(substrate);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry.FluidContainerData;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
@@ -26,6 +25,7 @@ import codechicken.nei.PositionedStack;
|
||||
import forestry.core.recipes.nei.NEIUtils;
|
||||
import forestry.core.recipes.nei.PositionedFluidTank;
|
||||
import forestry.core.recipes.nei.RecipeHandlerBase;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.factory.gui.GuiBottler;
|
||||
import forestry.factory.recipes.BottlerRecipe;
|
||||
|
||||
@@ -89,7 +89,7 @@ public class NEIHandlerBottler extends RecipeHandlerBase {
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("tile.for.factory.0.name");
|
||||
return StringUtil.localizeGuiTitle("tile.for.factory.0.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,7 +15,6 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
@@ -28,6 +27,7 @@ import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.core.recipes.nei.NEIUtils;
|
||||
import forestry.core.recipes.nei.PositionedFluidTank;
|
||||
import forestry.core.recipes.nei.RecipeHandlerBase;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.factory.gui.GuiCarpenter;
|
||||
|
||||
public class NEIHandlerCarpenter extends RecipeHandlerBase {
|
||||
@@ -125,7 +125,7 @@ public class NEIHandlerCarpenter extends RecipeHandlerBase {
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("tile.for.factory.1.name");
|
||||
return StringUtil.localizeGuiTitle("tile.for.factory.1.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,7 +18,6 @@ import java.util.Set;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
@@ -26,6 +25,7 @@ import forestry.api.recipes.ICentrifugeRecipe;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.core.recipes.nei.PositionedStackAdv;
|
||||
import forestry.core.recipes.nei.RecipeHandlerBase;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.factory.gui.GuiCentrifuge;
|
||||
|
||||
public class NEIHandlerCentrifuge extends RecipeHandlerBase {
|
||||
@@ -109,7 +109,7 @@ public class NEIHandlerCentrifuge extends RecipeHandlerBase {
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("tile.for.factory.2.name");
|
||||
return StringUtil.localizeGuiTitle("tile.for.factory.2.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,7 +18,6 @@ import java.util.Map;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
@@ -31,6 +30,7 @@ import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.core.recipes.nei.NEIUtils;
|
||||
import forestry.core.recipes.nei.PositionedFluidTank;
|
||||
import forestry.core.recipes.nei.RecipeHandlerBase;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.factory.gui.GuiFabricator;
|
||||
import forestry.factory.recipes.FabricatorSmeltingRecipeManager;
|
||||
|
||||
@@ -140,7 +140,7 @@ public class NEIHandlerFabricator extends RecipeHandlerBase {
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("tile.for.factory2.0.name");
|
||||
return StringUtil.localizeGuiTitle("tile.for.factory2.0.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,7 +16,6 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
@@ -32,6 +31,7 @@ import forestry.core.config.Constants;
|
||||
import forestry.core.recipes.nei.NEIUtils;
|
||||
import forestry.core.recipes.nei.PositionedFluidTank;
|
||||
import forestry.core.recipes.nei.RecipeHandlerBase;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.factory.gui.GuiFermenter;
|
||||
|
||||
public class NEIHandlerFermenter extends RecipeHandlerBase {
|
||||
@@ -118,7 +118,7 @@ public class NEIHandlerFermenter extends RecipeHandlerBase {
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("tile.for.factory.3.name");
|
||||
return StringUtil.localizeGuiTitle("tile.for.factory.3.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,7 +15,6 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
@@ -27,6 +26,7 @@ import forestry.api.recipes.IMoistenerRecipe;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.core.recipes.nei.PositionedFluidTank;
|
||||
import forestry.core.recipes.nei.RecipeHandlerBase;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.factory.gui.GuiMoistener;
|
||||
|
||||
public class NEIHandlerMoistener extends RecipeHandlerBase {
|
||||
@@ -88,7 +88,7 @@ public class NEIHandlerMoistener extends RecipeHandlerBase {
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("tile.for.factory.4.name");
|
||||
return StringUtil.localizeGuiTitle("tile.for.factory.4.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,7 +18,6 @@ import java.util.Random;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
@@ -30,6 +29,7 @@ import forestry.core.recipes.nei.NEIUtils;
|
||||
import forestry.core.recipes.nei.PositionedFluidTank;
|
||||
import forestry.core.recipes.nei.PositionedStackAdv;
|
||||
import forestry.core.recipes.nei.RecipeHandlerBase;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.factory.gui.GuiSqueezer;
|
||||
import forestry.factory.recipes.ISqueezerContainerRecipe;
|
||||
import forestry.factory.recipes.SqueezerRecipeManager;
|
||||
@@ -165,7 +165,7 @@ public class NEIHandlerSqueezer extends RecipeHandlerBase {
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("tile.for.factory.5.name");
|
||||
return StringUtil.localizeGuiTitle("tile.for.factory.5.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,7 +14,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
@@ -24,6 +23,7 @@ import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.core.recipes.nei.NEIUtils;
|
||||
import forestry.core.recipes.nei.PositionedFluidTank;
|
||||
import forestry.core.recipes.nei.RecipeHandlerBase;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.factory.gui.GuiStill;
|
||||
|
||||
public class NEIHandlerStill extends RecipeHandlerBase {
|
||||
@@ -71,7 +71,7 @@ public class NEIHandlerStill extends RecipeHandlerBase {
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return StatCollector.translateToLocal("tile.for.factory.6.name");
|
||||
return StringUtil.localizeGuiTitle("tile.for.factory.6.name");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loaded 100 of 135 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user