mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-14 17:14:46 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f0099b728f | ||
|
|
1ceccddbd0 | ||
|
|
c875e8ed5d | ||
|
|
f3ee4f8694 | ||
|
|
c2437a8a13 | ||
|
|
e2f32ab767 | ||
|
|
d0c8c92863 | ||
|
|
a8c84cfcf9 | ||
|
|
8f8f6a05f7 | ||
|
|
721c8fd0ad | ||
|
|
01e43d8a18 | ||
|
|
4228ef73d7 | ||
|
|
6b9614bccd | ||
|
|
179311a390 | ||
|
|
d8bcab07ba | ||
|
|
2368f05778 | ||
|
|
347e0a61e1 | ||
|
|
23792a84c1 | ||
|
|
b4c0777f1c | ||
|
|
db5daf9e3d | ||
|
|
a574eac903 | ||
|
|
b3799c22e6 | ||
|
|
97d10fdba3 | ||
|
|
e03400fc6a | ||
|
|
2a35c1072b | ||
|
|
a4dd450ff8 | ||
|
|
8df8404a84 | ||
|
|
54e73da1d5 | ||
|
|
7d83e28a03 | ||
|
|
db7736f7d2 | ||
|
|
eff9dfcca7 | ||
|
|
2b874fb42f | ||
|
|
27daa8e1ac | ||
|
|
a49eb1c5f9 | ||
|
|
7e3b7acdef | ||
|
|
9c532dd076 | ||
|
|
3de8bac1ad | ||
|
|
abca8b13f3 | ||
|
|
3c7856f264 | ||
|
|
408a66bb40 | ||
|
|
31231db459 | ||
|
|
67a7185261 | ||
|
|
aeaf113b11 | ||
|
|
084a84903f | ||
|
|
167e493160 | ||
|
|
ce2a2ec8ed | ||
|
|
10e5391f48 | ||
|
|
ffe19807db | ||
|
|
6cfae1462f | ||
|
|
18a0ae3643 | ||
|
|
358522b2af | ||
|
|
ade9bb6940 | ||
|
|
23fd664e34 | ||
|
|
60d5728ccb | ||
|
|
55118e399f | ||
|
|
7e50c57ba9 | ||
|
|
317dd0dbf9 | ||
|
|
e9af62e772 | ||
|
|
daa5e3bc75 | ||
|
|
e248f40f58 | ||
|
|
0e53fccfdb | ||
|
|
fc289c16d4 | ||
|
|
fe69452464 | ||
|
|
4c41d0bb6e | ||
|
|
0fe87253d1 | ||
|
|
4f19f95b71 | ||
|
|
a6ecc95f80 | ||
|
|
4b43ee9e8e | ||
|
|
f52059640e | ||
|
|
c96f260abd | ||
|
|
010c65b192 | ||
|
|
f2b95e1777 | ||
|
|
5f18a51827 | ||
|
|
eaad349b74 | ||
|
|
efd9cd06f6 | ||
|
|
2f16ca5828 | ||
|
|
d7c2f11ace | ||
|
|
d82db2f003 | ||
|
|
84b1fa8c07 | ||
|
|
723d07ab7c | ||
|
|
71b5f2f181 | ||
|
|
8d7dc86e9f | ||
|
|
5f2de3026e | ||
|
|
430115a7d4 | ||
|
|
a516886087 | ||
|
|
c6b1e65a4a | ||
|
|
e154d4e2c6 | ||
|
|
9247ed1509 | ||
|
|
0251691d66 | ||
|
|
d4cd0aaf7e | ||
|
|
90c9050e80 | ||
|
|
0713e0ea9c | ||
|
|
731d15fbd5 | ||
|
|
14bdab069e | ||
|
|
e73e18a3c7 | ||
|
|
fc69e25ea3 | ||
|
|
8465ff358a | ||
|
|
b7382f074a | ||
|
|
56a9e84800 | ||
|
|
01433d7741 | ||
|
|
fb595f7b26 | ||
|
|
53269c63ca | ||
|
|
63a48b2ea2 | ||
|
|
3770d34926 | ||
|
|
2ab553898f | ||
|
|
862feea792 | ||
|
|
bd8dbbeaf8 | ||
|
|
571bdd9b80 | ||
|
|
411b4959f2 | ||
|
|
f1afca664b | ||
|
|
d1fe7eee92 | ||
|
|
08812ae5ea | ||
|
|
c9b145817e | ||
|
|
407496a0ad | ||
|
|
eb0a55d91c | ||
|
|
5b53c3f153 | ||
|
|
d284ee0e6d | ||
|
|
acf350d1aa | ||
|
|
3fde556b86 | ||
|
|
7a45ce35a3 | ||
|
|
9a745b10d7 | ||
|
|
1594edd4d4 | ||
|
|
72fc7cee93 | ||
|
|
4796ea24bb | ||
|
|
bcb468b496 | ||
|
|
6a3e3e6f55 | ||
|
|
6ed24c7c8c | ||
|
|
d6a5b00251 | ||
|
|
1f82c216a8 | ||
|
|
8824585282 | ||
|
|
784bdba4fb | ||
|
|
79f98f35d8 | ||
|
|
a7ca8b0c20 | ||
|
|
23271bab04 | ||
|
|
d1328cff6c | ||
|
|
45f844b53b | ||
|
|
8502ec84f9 | ||
|
|
b7aaebd508 | ||
|
|
85c05d8985 | ||
|
|
dffa89709b | ||
|
|
d25f869129 | ||
|
|
f1693a248c | ||
|
|
888047cad8 | ||
|
|
7ad2e2e94d | ||
|
|
ef61493179 | ||
|
|
a2aef025c1 | ||
|
|
41e3fb15e5 | ||
|
|
bb87fc6046 | ||
|
|
806d7eb9f6 | ||
|
|
6539ad10af | ||
|
|
76afe30e94 | ||
|
|
02c25142cd | ||
|
|
84968c6021 | ||
|
|
4874b628db | ||
|
|
df02bf1d26 | ||
|
|
cf69299087 | ||
|
|
c49401bcda | ||
|
|
d2d203f772 | ||
|
|
6d6af6b043 | ||
|
|
c4311cca77 | ||
|
|
824b3f087a | ||
|
|
2a1b8fbc68 | ||
|
|
07defbeec3 | ||
|
|
4716f8daf7 | ||
|
|
0cc8c4c4df | ||
|
|
2605bdaceb | ||
|
|
9899687786 | ||
|
|
0ea878d7bc | ||
|
|
3e0cf7c302 | ||
|
|
b81466fdcb | ||
|
|
2725b19f95 | ||
|
|
099e6f47e8 | ||
|
|
614c13b4f3 | ||
|
|
140643bec3 | ||
|
|
e6bb939f7f | ||
|
|
ad0fcc57b5 | ||
|
|
3684792a39 | ||
|
|
0e81f373f0 | ||
|
|
59d1d3456b | ||
|
|
15fe11094b | ||
|
|
790e9b9fba | ||
|
|
c7ef2ef807 | ||
|
|
11fa7bbf75 | ||
|
|
4c2cbd77c1 | ||
|
|
f58de9e5cc | ||
|
|
3f0dc9e74f | ||
|
|
9ecab0fecd | ||
|
|
01245f32c5 | ||
|
|
8cc0da5c04 | ||
|
|
6e68768259 | ||
|
|
9ee34b06b6 | ||
|
|
b05c395300 | ||
|
|
48ef020dc9 | ||
|
|
83b7ce00f7 | ||
|
|
6165d80c0c | ||
|
|
31cb40f7b6 | ||
|
|
16e4801d48 | ||
|
|
8fb7d5eb67 | ||
|
|
55866d6a64 | ||
|
|
510cf83670 | ||
|
|
656a6451bf | ||
|
|
69ee5bde65 | ||
|
|
592895cc48 | ||
|
|
7b5febd394 | ||
|
|
71481d5ace | ||
|
|
1d0efd537e | ||
|
|
5052df8844 | ||
|
|
b1d496f24f | ||
|
|
2bfe576f7e | ||
|
|
cc5c8af338 |
No files matched your search
+1
-1
@@ -16,7 +16,7 @@
|
||||
!/LICENSE.txt
|
||||
!/license-header.txt
|
||||
!/README.md
|
||||
!/application.properties
|
||||
!/gradle.properties
|
||||
!/build.gradle
|
||||
!/build.xml
|
||||
!/gradlew
|
||||
|
||||
@@ -31,7 +31,7 @@ Beware of ugly code.
|
||||
|
||||
Bugfixes are generally welcome. If you want to contribute something which changes game mechanics, please talk to someone with commit privileges first. Nothing is more frustrating than putting a lot of work and effort into a new game mechanic and then having the PR rejected because it doesn’t fit gameplay-wise.
|
||||
|
||||
**If you submit a PR you must accept the [Contributor License Agreement](https://www.clahub.com/agreements/ForestryMC/ForestryMC). There is no way around that, since otherwise changing the license later - even to something more permissive! - , becomes close to impossible.**
|
||||
**If you submit a PR you must accept the [Contributor License Agreement](https://cla-assistant.io/ForestryMC/ForestryMC). There is no way around that, since otherwise changing the license later - even to something more permissive! - , becomes close to impossible.**
|
||||
|
||||
### License & Copyright
|
||||
|
||||
|
||||
+1
-1
Submodule api/forestry updated: 73da80bca5...5e44fe9c6a.
+30
-70
@@ -21,8 +21,6 @@ apply plugin: 'forge'
|
||||
apply plugin: 'maven'
|
||||
apply plugin: 'java'
|
||||
|
||||
loadProperties()
|
||||
|
||||
version = version_major + '.' + version_minor + '.' + version_patch + '.' + getBuildNumber()
|
||||
if (project.hasProperty('buildQualifier')) {
|
||||
version = project.version + '-' + project.buildQualifier
|
||||
@@ -36,12 +34,18 @@ ext.dirLang = "./lang"
|
||||
ext.apiForestry = "./api/forestry"
|
||||
ext.apiRedstoneFlux = "./api/redstoneflux"
|
||||
|
||||
// java version
|
||||
sourceCompatibility = 1.7
|
||||
targetCompatibility = 1.7
|
||||
|
||||
minecraft {
|
||||
version = mcversion + "-" + forgeversion
|
||||
runDir = "run"
|
||||
|
||||
replace '@VERSION@', project.version
|
||||
replace '@BUILD_NUMBER@', getBuildNumber()
|
||||
|
||||
srgExtra "PK: chylex/javacheck forestry/shade/javacheck"
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
@@ -69,16 +73,22 @@ repositories {
|
||||
name = "chickenbones"
|
||||
url = "http://chickenbones.net/maven/"
|
||||
}
|
||||
maven{
|
||||
name "tterrag Repo"
|
||||
url "http://maven.tterrag.com/"
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
api
|
||||
compile.extendsFrom api
|
||||
shade
|
||||
compile.extendsFrom shade
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api 'net.industrial-craft:industrialcraft-2:2.2.713-experimental:api'
|
||||
api name: "buildcraft", version: "7.0.25", classifier: "api"
|
||||
api 'net.industrial-craft:industrialcraft-2:2.2.790-experimental:api'
|
||||
api name: "buildcraft", version: "7.1.12", classifier: "api"
|
||||
|
||||
// http://files.minecraftforge.net/CodeChickenLib/
|
||||
compile "codechicken:CodeChickenLib:1.7.10-1.1.3.140:dev"
|
||||
@@ -88,6 +98,9 @@ dependencies {
|
||||
compile "codechicken:NotEnoughItems:1.7.10-1.0.5.111:dev"
|
||||
compile "codechicken:NotEnoughItems:1.7.10-1.0.5.111:src"
|
||||
|
||||
// http://maven.tterrag.com/
|
||||
shade "chylex.javacheck:JavaChecker:v1.2-b1"
|
||||
|
||||
testCompile 'junit:junit:4.12'
|
||||
}
|
||||
|
||||
@@ -130,45 +143,6 @@ debugClient {
|
||||
}
|
||||
}
|
||||
|
||||
task echoVersion << {
|
||||
printNextVersion()
|
||||
}
|
||||
|
||||
def saveVersion() {
|
||||
ant.propertyfile(
|
||||
file: "application.properties") {
|
||||
entry( key:"version_major", type:"int", value: version_major)
|
||||
entry( key:"version_minor", type:"int", value: version_minor)
|
||||
entry( key:"version_patch", type:"int", value: version_patch)
|
||||
}
|
||||
project.version = version_major + '.' + version_minor + '.' + version_patch + '.' + getBuildNumber()
|
||||
printNextVersion()
|
||||
}
|
||||
|
||||
def printNextVersion() {
|
||||
println '*************************************************************'
|
||||
println 'The next build will be version: ' + project.version
|
||||
println '*************************************************************'
|
||||
}
|
||||
|
||||
task bumpMajor << {
|
||||
project.version_major = Integer.parseInt(project.version_major) + 1
|
||||
project.version_minor = "0"
|
||||
project.version_patch = "0"
|
||||
saveVersion()
|
||||
}
|
||||
|
||||
task bumpMinor << {
|
||||
project.version_minor = Integer.parseInt(project.version_minor) + 1
|
||||
project.version_patch = "0"
|
||||
saveVersion()
|
||||
}
|
||||
|
||||
task bumpPatch << {
|
||||
project.version_patch = Integer.parseInt(project.version_patch) + 1
|
||||
saveVersion()
|
||||
}
|
||||
|
||||
jar {
|
||||
destinationDir = file("build/tmp")
|
||||
archiveName = "main.jar"
|
||||
@@ -180,8 +154,14 @@ jar {
|
||||
into ('cofh/api') {
|
||||
from project.apiRedstoneFlux + "/LICENSE - LGPLv3.txt"
|
||||
}
|
||||
into ('buildcraft/api') {
|
||||
from "./src/main/java/buildcraft/LICENSE-API"
|
||||
into ('invtweaks/api') {
|
||||
from "./src/main/java/invtweaks/LICENSE.txt"
|
||||
}
|
||||
|
||||
configurations.shade.each{ dep ->
|
||||
from(project.zipTree(dep)){
|
||||
exclude 'META-INF', 'META-INF/**', 'mcmod.info'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,6 +175,10 @@ task mainJar(type: Jar, dependsOn: 'reobf') {
|
||||
destinationDir = file(dirDest)
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
includeEmptyDirs = false
|
||||
|
||||
manifest{
|
||||
attributes 'TweakClass': 'forestry.shade.javacheck.Java7Checker'
|
||||
}
|
||||
}
|
||||
|
||||
task devJar(type: Jar, dependsOn: 'classes') {
|
||||
@@ -236,20 +220,9 @@ task sourceJar(type: Jar, dependsOn: 'classes') {
|
||||
classifier = 'sources'
|
||||
}
|
||||
|
||||
task releaseInit << {
|
||||
println '*************************************************************'
|
||||
println 'This build will be version: ' + rootProject.version
|
||||
println '*************************************************************'
|
||||
task release (dependsOn: [mainJar, apiJar, devJar, sourceJar]) {
|
||||
}
|
||||
|
||||
task release (dependsOn: [releaseInit, mainJar, apiJar, devJar, sourceJar]) {
|
||||
}
|
||||
|
||||
mainJar.shouldRunAfter releaseInit
|
||||
devJar.shouldRunAfter releaseInit
|
||||
apiJar.shouldRunAfter releaseInit
|
||||
sourceJar.shouldRunAfter releaseInit
|
||||
|
||||
artifacts {
|
||||
archives apiJar
|
||||
archives devJar
|
||||
@@ -278,19 +251,6 @@ uploadArchives {
|
||||
}
|
||||
}
|
||||
|
||||
def loadProperties() {
|
||||
println('loading application.properties')
|
||||
|
||||
file("application.properties").withReader { reader ->
|
||||
def userProps = new Properties()
|
||||
userProps.load(reader)
|
||||
|
||||
for (Map.Entry property in userProps) {
|
||||
project.ext[property.getKey()] = property.getValue()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def getBuildNumber() {
|
||||
return "$System.env.BUILD_NUMBER" != "null" ? "$System.env.BUILD_NUMBER" : "0"
|
||||
}
|
||||
|
||||
@@ -3,3 +3,4 @@ samtrion;[email protected];2015-01-18
|
||||
GenuineSounds;[email protected];2015-02-26
|
||||
airbreather;[email protected];2015-04-10
|
||||
ganymedes01;[email protected];2015-05-27
|
||||
infinityraider;theoneandonlyraider@gmail;com;2015-10-03
|
||||
@@ -1,5 +1,5 @@
|
||||
mcversion=1.7.10
|
||||
forgeversion=10.13.3.1370-1.7.10
|
||||
forgeversion=10.13.4.1541-1.7.10
|
||||
version_major=4
|
||||
version_minor=0
|
||||
version_minor=2
|
||||
version_patch=2
|
||||
+1
-1
Submodule lang updated: 2518a210e7...cb5900228e.
@@ -1,40 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License.
|
||||
* Please check the contents of the license, which should be located
|
||||
* as "LICENSE.API" in the BuildCraft source code distribution.
|
||||
*/
|
||||
package buildcraft.api.tools;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
/***
|
||||
* Implement this interface on subclasses of Item to have that item work as a wrench for buildcraft
|
||||
*/
|
||||
public interface IToolWrench {
|
||||
|
||||
/***
|
||||
* Called to ensure that the wrench can be used. To get the ItemStack that is used, check player.inventory.getCurrentItem()
|
||||
*
|
||||
* @param player
|
||||
* - The player doing the wrenching
|
||||
* @param x
|
||||
* ,y,z - The coordinates for the block being wrenched
|
||||
*
|
||||
* @return true if wrenching is allowed, false if not
|
||||
*/
|
||||
boolean canWrench(EntityPlayer player, int x, int y, int z);
|
||||
|
||||
/***
|
||||
* Callback after the wrench has been used. This can be used to decrease durability or for other purposes. To get the ItemStack that was used, check
|
||||
* player.inventory.getCurrentItem()
|
||||
*
|
||||
* @param player
|
||||
* - The player doing the wrenching
|
||||
* @param x
|
||||
* ,y,z - The coordinates of the block being wrenched
|
||||
*/
|
||||
void wrenchUsed(EntityPlayer player, int x, int y, int z);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License.
|
||||
* Please check the contents of the license, which should be located
|
||||
* as "LICENSE.API" in the BuildCraft source code distribution.
|
||||
*/
|
||||
@API(apiVersion = "1.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|tools")
|
||||
package buildcraft.api.tools;
|
||||
import cpw.mods.fml.common.API;
|
||||
@@ -11,41 +11,43 @@
|
||||
package forestry;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent;
|
||||
import cpw.mods.fml.common.event.FMLMissingMappingsEvent;
|
||||
import cpw.mods.fml.common.event.FMLMissingMappingsEvent.MissingMapping;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry.Type;
|
||||
|
||||
import forestry.api.fuels.EngineBronzeFuel;
|
||||
import forestry.api.fuels.EngineCopperFuel;
|
||||
import forestry.api.fuels.FermenterFuel;
|
||||
import forestry.api.fuels.FuelManager;
|
||||
import forestry.api.fuels.GeneratorFuel;
|
||||
import forestry.api.fuels.MoistenerFuel;
|
||||
import forestry.api.fuels.RainSubstrate;
|
||||
import forestry.core.ForestryCore;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.core.EventHandlerCore;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.config.GameMode;
|
||||
import forestry.core.config.Version;
|
||||
import forestry.core.errors.EnumErrorCode;
|
||||
import forestry.core.errors.ErrorStateRegistry;
|
||||
import forestry.core.gui.GuiHandler;
|
||||
import forestry.core.multiblock.MultiblockEventHandler;
|
||||
import forestry.core.network.PacketHandler;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.Log;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.core.utils.datastructures.FluidMap;
|
||||
import forestry.core.utils.datastructures.ItemStackMap;
|
||||
import forestry.core.worldgen.WorldGenerator;
|
||||
import forestry.plugins.PluginManager;
|
||||
|
||||
/**
|
||||
* Forestry Minecraft Mod
|
||||
@@ -57,7 +59,7 @@ import forestry.core.utils.datastructures.ItemStackMap;
|
||||
name = "Forestry",
|
||||
version = Version.VERSION,
|
||||
guiFactory = "forestry.core.config.ForestryGuiConfigFactory",
|
||||
dependencies = "required-after:Forge@[10.13.0.1207,);"
|
||||
dependencies = "required-after:Forge@[10.13.4.1448,);"
|
||||
+ "after:Buildcraft|Core@[6.1.7,);"
|
||||
+ "after:ExtrabiomesXL;"
|
||||
+ "after:BiomesOPlenty;"
|
||||
@@ -70,73 +72,70 @@ public class Forestry {
|
||||
public static Forestry instance;
|
||||
private File configFolder;
|
||||
|
||||
private static final Map<String, ForestryItem> mappedItems = new HashMap<String, ForestryItem>();
|
||||
|
||||
static {
|
||||
mappedItems.put("Forestry:builderBackpack", ForestryItem.builderBackpack);
|
||||
mappedItems.put("Forestry:builderBackpackT2", ForestryItem.builderBackpackT2);
|
||||
mappedItems.put("Forestry:adventurerBackpack", ForestryItem.adventurerBackpack);
|
||||
mappedItems.put("Forestry:adventurerBackpackT2", ForestryItem.adventurerBackpackT2);
|
||||
mappedItems.put("Forestry:shortMead", ForestryItem.beverage);
|
||||
mappedItems.put("Forestry:waterCan", ForestryItem.canWater);
|
||||
mappedItems.put("Forestry:biofuelCan", ForestryItem.canEthanol);
|
||||
mappedItems.put("Forestry:biomassCan", ForestryItem.canBiomass);
|
||||
mappedItems.put("Forestry:bucketBiofuel", ForestryItem.bucketEthanol);
|
||||
mappedItems.put("Forestry:refractoryBiofuel", ForestryItem.refractoryEthanol);
|
||||
mappedItems.put("Forestry:waxCapsuleBiofuel", ForestryItem.waxCapsuleEthanol);
|
||||
}
|
||||
|
||||
public Forestry() {
|
||||
FuelManager.fermenterFuel = new ItemStackMap<FermenterFuel>();
|
||||
FuelManager.moistenerResource = new ItemStackMap<MoistenerFuel>();
|
||||
FuelManager.rainSubstrate = new ItemStackMap<RainSubstrate>();
|
||||
FuelManager.bronzeEngineFuel = new FluidMap<EngineBronzeFuel>();
|
||||
FuelManager.copperEngineFuel = new ItemStackMap<EngineCopperFuel>();
|
||||
FuelManager.generatorFuel = new FluidMap<GeneratorFuel>();
|
||||
ForestryAPI.instance = this;
|
||||
ForestryAPI.forestryConstants = new Constants();
|
||||
ForestryAPI.errorStateRegistry = new ErrorStateRegistry();
|
||||
EnumErrorCode.init();
|
||||
}
|
||||
|
||||
@SidedProxy(clientSide = "forestry.core.ForestryClient", serverSide = "forestry.core.ForestryCore")
|
||||
public static ForestryCore core = new ForestryCore();
|
||||
public static PacketHandler packetHandler;
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
packetHandler = new PacketHandler();
|
||||
|
||||
configFolder = new File(event.getModConfigurationDirectory(), "forestry");
|
||||
|
||||
core.preInit(event.getSourceFile(), this);
|
||||
// Register event handler
|
||||
EventHandlerCore eventHandlerCore = new EventHandlerCore();
|
||||
MinecraftForge.EVENT_BUS.register(eventHandlerCore);
|
||||
FMLCommonHandler.instance().bus().register(eventHandlerCore);
|
||||
MinecraftForge.EVENT_BUS.register(new MultiblockEventHandler());
|
||||
|
||||
configFolder = new File(event.getModConfigurationDirectory(), "forestry");
|
||||
Config.load();
|
||||
|
||||
PluginManager.runSetup();
|
||||
|
||||
ForestryAPI.activeMode = new GameMode(Config.gameMode);
|
||||
|
||||
PluginManager.runPreInit();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
core.init(this);
|
||||
// Register gui handler
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());
|
||||
|
||||
PluginManager.runInit();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
core.postInit();
|
||||
PluginManager.runPostInit();
|
||||
|
||||
// Register world generator
|
||||
WorldGenerator worldGenerator = new WorldGenerator();
|
||||
GameRegistry.registerWorldGenerator(worldGenerator, 0);
|
||||
|
||||
// Register tick handlers
|
||||
Proxies.common.registerTickHandlers(worldGenerator);
|
||||
|
||||
// Handle IMC messages.
|
||||
PluginManager.processIMCMessages(FMLInterModComms.fetchRuntimeMessages(ForestryAPI.instance));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void serverStarting(FMLServerStartingEvent event) {
|
||||
core.serverStarting(event.getServer());
|
||||
PluginManager.serverStarting(event.getServer());
|
||||
}
|
||||
|
||||
public File getConfigFolder() {
|
||||
return configFolder;
|
||||
}
|
||||
/*@EventHandler
|
||||
public void fingerprintWarning(FMLFingerprintViolationEvent event) {
|
||||
Log.info("Fingerprint of the mod jar is invalid. The jar file was tampered with.");
|
||||
FMLInterModComms.sendMessage("Railcraft", "securityViolation", "Fingerprint of jar file did not match.");
|
||||
FMLInterModComms.sendMessage("Thaumcraft", "securityViolation", "Fingerprint of jar file did not match.");
|
||||
FMLInterModComms.sendMessage("IC2", "securityViolation", "Fingerprint of jar file did not match.");
|
||||
}*/
|
||||
|
||||
@EventHandler
|
||||
public void processIMCMessages(IMCEvent event) {
|
||||
core.processIMCMessages(event.getMessages());
|
||||
PluginManager.processIMCMessages(event.getMessages());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -149,16 +148,10 @@ public class Forestry {
|
||||
Log.warning("Remapping block " + mapping.name + " to " + StringUtil.cleanBlockName(block));
|
||||
}
|
||||
} else {
|
||||
Block block = GameRegistry.findBlock(Constants.MOD, StringUtil.cleanTags(mapping.name));
|
||||
if (block != null) {
|
||||
mapping.remap(Item.getItemFromBlock(block));
|
||||
Log.warning("Remapping item " + mapping.name + " to " + StringUtil.cleanBlockName(block));
|
||||
} else {
|
||||
ForestryItem mappedItem = mappedItems.get(mapping.name);
|
||||
if (mappedItem != null) {
|
||||
mapping.remap(mappedItem.item());
|
||||
Log.warning("Remapping item " + mapping.name + " to " + mappedItem.name());
|
||||
}
|
||||
Item item = GameRegistry.findItem(Constants.MOD, StringUtil.cleanTags(mapping.name));
|
||||
if (item != null) {
|
||||
mapping.remap(item);
|
||||
Log.warning("Remapping item " + mapping.name + " to " + StringUtil.cleanItemName(item));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import forestry.api.apiculture.DefaultBeeModifier;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
|
||||
public class AlvearyBeeModifier extends DefaultBeeModifier {
|
||||
@Override
|
||||
public float getTerritoryModifier(IBeeGenome genome, float currentModifier) {
|
||||
return 2.0f;
|
||||
}
|
||||
}
|
||||
+13
-10
@@ -8,18 +8,21 @@
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.tiles;
|
||||
package forestry.apiculture;
|
||||
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import forestry.api.apiculture.DefaultBeeListener;
|
||||
import forestry.apiculture.inventory.IApiaryInventory;
|
||||
|
||||
import forestry.core.access.EnumAccess;
|
||||
import forestry.core.access.IAccessHandler;
|
||||
import forestry.core.network.IStreamableGui;
|
||||
public class ApiaryBeeListener extends DefaultBeeListener {
|
||||
private final IApiary apiary;
|
||||
|
||||
public interface IRestrictedAccessTile extends IStreamableGui {
|
||||
IAccessHandler getAccessHandler();
|
||||
public ApiaryBeeListener(IApiary apiary) {
|
||||
this.apiary = apiary;
|
||||
}
|
||||
|
||||
ChunkCoordinates getCoordinates();
|
||||
|
||||
void onSwitchAccess(EnumAccess oldAccess, EnumAccess newAccess);
|
||||
@Override
|
||||
public void wearOutEquipment(int amount) {
|
||||
IApiaryInventory apiaryInventory = apiary.getApiaryInventory();
|
||||
apiaryInventory.wearOutFrames(apiary, amount);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import forestry.api.apiculture.DefaultBeeModifier;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
|
||||
public class ApiaryBeeModifier extends DefaultBeeModifier {
|
||||
@Override
|
||||
public float getProductionModifier(IBeeGenome genome, float currentModifier) {
|
||||
return 0.1f;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -20,7 +21,7 @@ import forestry.api.apiculture.IArmorApiaristHelper;
|
||||
public class ArmorApiaristHelper implements IArmorApiaristHelper {
|
||||
|
||||
@Override
|
||||
public boolean isArmorApiarist(ItemStack stack, EntityPlayer player, String cause, boolean doProtect) {
|
||||
public boolean isArmorApiarist(ItemStack stack, EntityLivingBase entity, String cause, boolean doProtect) {
|
||||
if (stack == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -31,19 +32,38 @@ public class ArmorApiaristHelper implements IArmorApiaristHelper {
|
||||
}
|
||||
|
||||
IArmorApiarist armorApiarist = (IArmorApiarist) item;
|
||||
return armorApiarist.protectPlayer(player, stack, cause, doProtect);
|
||||
try {
|
||||
return armorApiarist.protectEntity(entity, stack, cause, doProtect);
|
||||
} catch (Throwable ignored) { // protectEntity is new to the API and may not be implemented by the armor
|
||||
if (entity instanceof EntityPlayer) {
|
||||
return armorApiarist.protectPlayer((EntityPlayer) entity, stack, cause, doProtect);
|
||||
} else {
|
||||
return true; // fallback on assuming IArmorApiarist will protect the entity
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int wearsItems(EntityPlayer player, String cause, boolean doProtect) {
|
||||
public int wearsItems(EntityLivingBase entity, String cause, boolean doProtect) {
|
||||
int count = 0;
|
||||
|
||||
for (ItemStack armorItem : player.inventory.armorInventory) {
|
||||
if (isArmorApiarist(armorItem, player, cause, doProtect)) {
|
||||
for (int i = 1; i <= 4; i++) {
|
||||
ItemStack armorItem = entity.getEquipmentInSlot(i);
|
||||
if (isArmorApiarist(armorItem, entity, cause, doProtect)) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isArmorApiarist(ItemStack stack, EntityPlayer player, String cause, boolean doProtect) {
|
||||
return isArmorApiarist(stack, (EntityLivingBase) player, cause, doProtect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int wearsItems(EntityPlayer player, String cause, boolean doProtect) {
|
||||
return wearsItems((EntityLivingBase) player, cause, doProtect);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import forestry.api.apiculture.DefaultBeeModifier;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
|
||||
public class BeehouseBeeModifier extends DefaultBeeModifier {
|
||||
@Override
|
||||
public float getTerritoryModifier(IBeeGenome genome, float currentModifier) {
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getProductionModifier(IBeeGenome genome, float currentModifier) {
|
||||
return 0.25f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) {
|
||||
return 3.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFloweringModifier(IBeeGenome genome, float currentModifier) {
|
||||
return 3.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getGeneticDecay(IBeeGenome genome, float currentModifier) {
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
||||
@@ -17,9 +17,12 @@ import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import java.util.Stack;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
@@ -35,9 +38,9 @@ import forestry.api.core.IErrorLogic;
|
||||
import forestry.api.core.IErrorState;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.apiculture.network.PacketBeekeepingLogicActive;
|
||||
import forestry.apiculture.network.packets.PacketBeeLogicActive;
|
||||
import forestry.apiculture.network.packets.PacketBeeLogicActiveEntity;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.errors.EnumErrorCode;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
@@ -60,7 +63,7 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
private int queenWorkCycleThrottle;
|
||||
private IEffectData effectData[] = new IEffectData[2];
|
||||
|
||||
private final Stack<ItemStack> spawn = new Stack<ItemStack>();
|
||||
private final Stack<ItemStack> spawn = new Stack<>();
|
||||
|
||||
private final HasFlowersCache hasFlowersCache = new HasFlowersCache();
|
||||
private final QueenCanWorkCache queenCanWorkCache = new QueenCanWorkCache();
|
||||
@@ -73,8 +76,8 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
|
||||
public BeekeepingLogic(IBeeHousing housing) {
|
||||
this.housing = housing;
|
||||
this.beeModifier = new BeeHousingModifier(housing);
|
||||
this.beeListener = new BeeHousingListener(housing);
|
||||
this.beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
this.beeListener = BeeManager.beeRoot.createBeeHousingListener(housing);
|
||||
}
|
||||
|
||||
// / SAVING & LOADING
|
||||
@@ -112,7 +115,7 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
|
||||
hasFlowersCache.writeToNBT(nbttagcompound);
|
||||
|
||||
Stack<ItemStack> spawnCopy = new Stack<ItemStack>();
|
||||
Stack<ItemStack> spawnCopy = new Stack<>();
|
||||
spawnCopy.addAll(spawn);
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
while (!spawnCopy.isEmpty()) {
|
||||
@@ -162,20 +165,20 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
IBeeHousingInventory beeInventory = housing.getBeeInventory();
|
||||
|
||||
boolean hasSpace = addPendingProducts(beeInventory, spawn);
|
||||
errorLogic.setCondition(!hasSpace, EnumErrorCode.NOSPACE);
|
||||
errorLogic.setCondition(!hasSpace, EnumErrorCode.NO_SPACE_INVENTORY);
|
||||
|
||||
ItemStack queenStack = beeInventory.getQueen();
|
||||
|
||||
EnumBeeType beeType = BeeManager.beeRoot.getType(queenStack);
|
||||
// check if we're breeding
|
||||
if (ForestryItem.beePrincessGE.isItemEqual(queenStack)) {
|
||||
if (beeType == EnumBeeType.PRINCESS) {
|
||||
boolean hasDrone = BeeManager.beeRoot.isDrone(beeInventory.getDrone());
|
||||
errorLogic.setCondition(!hasDrone, EnumErrorCode.NODRONE);
|
||||
errorLogic.setCondition(!hasDrone, EnumErrorCode.NO_DRONE);
|
||||
|
||||
setActive(false); // not active (no bee FX) when we are breeding
|
||||
return !errorLogic.hasErrors();
|
||||
}
|
||||
|
||||
if (ForestryItem.beeQueenGE.isItemEqual(queenStack)) {
|
||||
if (beeType == EnumBeeType.QUEEN) {
|
||||
if (!isQueenAlive(queenStack)) {
|
||||
IBee dyingQueen = BeeManager.beeRoot.getMember(queenStack);
|
||||
Collection<ItemStack> spawned = killQueen(dyingQueen, housing, beeListener);
|
||||
@@ -191,8 +194,9 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
this.queenStack = queenStack;
|
||||
}
|
||||
|
||||
if (errorLogic.setCondition(queen == null, EnumErrorCode.NOQUEEN)) {
|
||||
if (errorLogic.setCondition(queen == null, EnumErrorCode.NO_QUEEN)) {
|
||||
setActive(false);
|
||||
beeProgress = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -202,7 +206,7 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
}
|
||||
|
||||
boolean hasFlowers = hasFlowersCache.hasFlowers(queen, housing);
|
||||
errorLogic.setCondition(!hasFlowers, EnumErrorCode.NOFLOWER);
|
||||
errorLogic.setCondition(!hasFlowers, EnumErrorCode.NO_FLOWER);
|
||||
|
||||
boolean canWork = !errorLogic.hasErrors();
|
||||
setActive(canWork);
|
||||
@@ -213,7 +217,8 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
public void doWork() {
|
||||
IBeeHousingInventory beeInventory = housing.getBeeInventory();
|
||||
ItemStack queenStack = beeInventory.getQueen();
|
||||
if (ForestryItem.beePrincessGE.isItemEqual(queenStack)) {
|
||||
EnumBeeType beeType = BeeManager.beeRoot.getType(queenStack);
|
||||
if (beeType == EnumBeeType.PRINCESS) {
|
||||
tickBreed();
|
||||
} else {
|
||||
queenWorkTick(queen);
|
||||
@@ -284,7 +289,13 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
|
||||
/** Checks if a queen is alive. Much faster than reading the whole bee nbt */
|
||||
private static boolean isQueenAlive(ItemStack queenStack) {
|
||||
if (queenStack == null) {
|
||||
return false;
|
||||
}
|
||||
NBTTagCompound nbtTagCompound = queenStack.getTagCompound();
|
||||
if (nbtTagCompound == null) {
|
||||
return false;
|
||||
}
|
||||
int health = nbtTagCompound.getInteger("Health");
|
||||
return health > 0;
|
||||
}
|
||||
@@ -298,7 +309,9 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
ItemStack droneStack = beeInventory.getDrone();
|
||||
ItemStack princessStack = beeInventory.getQueen();
|
||||
|
||||
if (!ForestryItem.beeDroneGE.isItemEqual(droneStack) || !ForestryItem.beePrincessGE.isItemEqual(princessStack)) {
|
||||
EnumBeeType droneType = BeeManager.beeRoot.getType(droneStack);
|
||||
EnumBeeType princessType = BeeManager.beeRoot.getType(princessStack);
|
||||
if (droneType != EnumBeeType.DRONE || princessType != EnumBeeType.PRINCESS) {
|
||||
beeProgress = 0;
|
||||
return;
|
||||
}
|
||||
@@ -317,7 +330,7 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
princess.writeToNBT(nbttagcompound);
|
||||
queenStack = ForestryItem.beeQueenGE.getItemStack();
|
||||
queenStack = new ItemStack(PluginApiculture.items.beeQueenGE);
|
||||
queenStack.setTagCompound(nbttagcompound);
|
||||
|
||||
beeInventory.setQueen(queenStack);
|
||||
@@ -354,7 +367,7 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
} else {
|
||||
Log.warning("Tried to spawn offspring off an unmated queen. Devolving her to a princess.");
|
||||
|
||||
ItemStack convert = ForestryItem.beePrincessGE.getItemStack();
|
||||
ItemStack convert = new ItemStack(PluginApiculture.items.beePrincessGE);
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
queen.writeToNBT(nbttagcompound);
|
||||
convert.setTagCompound(nbttagcompound);
|
||||
@@ -373,7 +386,7 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
|
||||
World world = beeHousing.getWorld();
|
||||
|
||||
Stack<ItemStack> offspring = new Stack<ItemStack>();
|
||||
Stack<ItemStack> offspring = new Stack<>();
|
||||
IApiaristTracker breedingTracker = BeeManager.beeRoot.getBreedingTracker(world, beeHousing.getOwner());
|
||||
|
||||
// Princess
|
||||
@@ -399,7 +412,7 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
|
||||
IBeeHousingInventory beeInventory = beeHousing.getBeeInventory();
|
||||
|
||||
Collection<ItemStack> spawn = new ArrayList<ItemStack>();
|
||||
Collection<ItemStack> spawn = new ArrayList<>();
|
||||
|
||||
while (!offspring.isEmpty()) {
|
||||
ItemStack spawned = offspring.pop();
|
||||
@@ -417,7 +430,23 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
public void syncToClient() {
|
||||
World world = housing.getWorld();
|
||||
if (world != null && !world.isRemote) {
|
||||
Proxies.net.sendNetworkPacket(new PacketBeekeepingLogicActive(housing), world);
|
||||
if (housing instanceof Entity) {
|
||||
Proxies.net.sendNetworkPacket(new PacketBeeLogicActiveEntity(housing, (Entity) housing), world);
|
||||
} else {
|
||||
Proxies.net.sendNetworkPacket(new PacketBeeLogicActive(housing), world);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncToClient(EntityPlayerMP player) {
|
||||
World world = housing.getWorld();
|
||||
if (world != null && !world.isRemote) {
|
||||
if (housing instanceof TileEntity) {
|
||||
Proxies.net.sendToPlayer(new PacketBeeLogicActive(housing), player);
|
||||
} else if (housing instanceof Entity) {
|
||||
Proxies.net.sendToPlayer(new PacketBeeLogicActiveEntity(housing, (Entity) housing), player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import forestry.api.apiculture.IBeekeepingLogic;
|
||||
@@ -36,6 +37,11 @@ public class FakeBeekeepingLogic implements IBeekeepingLogic {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncToClient(EntityPlayerMP player) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBeeProgressPercent() {
|
||||
return 0;
|
||||
|
||||
@@ -1,181 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.apiculture.genetics.BeeHelper;
|
||||
import forestry.apiculture.gui.ContainerAlveary;
|
||||
import forestry.apiculture.gui.ContainerAlvearyHygroregulator;
|
||||
import forestry.apiculture.gui.ContainerAlvearySieve;
|
||||
import forestry.apiculture.gui.ContainerAlvearySwarmer;
|
||||
import forestry.apiculture.gui.ContainerBeeHousing;
|
||||
import forestry.apiculture.gui.ContainerHabitatLocator;
|
||||
import forestry.apiculture.gui.ContainerImprinter;
|
||||
import forestry.apiculture.gui.GuiAlveary;
|
||||
import forestry.apiculture.gui.GuiAlvearyHygroregulator;
|
||||
import forestry.apiculture.gui.GuiAlvearySieve;
|
||||
import forestry.apiculture.gui.GuiAlvearySwarmer;
|
||||
import forestry.apiculture.gui.GuiBeeHousing;
|
||||
import forestry.apiculture.gui.GuiBeealyzer;
|
||||
import forestry.apiculture.gui.GuiHabitatLocator;
|
||||
import forestry.apiculture.gui.GuiImprinter;
|
||||
import forestry.apiculture.items.ItemBeealyzer.BeealyzerInventory;
|
||||
import forestry.apiculture.items.ItemHabitatLocator.HabitatLocatorInventory;
|
||||
import forestry.apiculture.items.ItemImprinter.ImprinterInventory;
|
||||
import forestry.apiculture.multiblock.TileAlvearyHygroregulator;
|
||||
import forestry.apiculture.multiblock.TileAlvearyPlain;
|
||||
import forestry.apiculture.multiblock.TileAlvearySieve;
|
||||
import forestry.apiculture.multiblock.TileAlvearySwarmer;
|
||||
import forestry.apiculture.tiles.TileApiary;
|
||||
import forestry.apiculture.tiles.TileBeehouse;
|
||||
import forestry.core.GuiHandlerBase;
|
||||
import forestry.core.gui.ContainerAlyzer;
|
||||
import forestry.core.network.GuiId;
|
||||
|
||||
public class GuiHandlerApiculture extends GuiHandlerBase {
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
|
||||
int cleanId = decodeGuiID(id);
|
||||
int guiData = decodeGuiData(id);
|
||||
|
||||
if (cleanId >= GuiId.values().length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ItemStack equipped;
|
||||
switch (GuiId.values()[cleanId]) {
|
||||
|
||||
case AlvearyGUI:
|
||||
return new GuiAlveary(player.inventory, getTile(world, x, y, z, player, TileAlvearyPlain.class));
|
||||
|
||||
case AlvearySieveGUI:
|
||||
return new GuiAlvearySieve(player.inventory, getTile(world, x, y, z, player, TileAlvearySieve.class));
|
||||
|
||||
case AlvearySwarmerGUI:
|
||||
return new GuiAlvearySwarmer(player.inventory, getTile(world, x, y, z, player, TileAlvearySwarmer.class));
|
||||
|
||||
case ApiaristChestGUI:
|
||||
return getNaturalistChestGui(BeeHelper.UID, player, world, x, y, z, guiData);
|
||||
|
||||
case ApiaryGUI:
|
||||
return new GuiBeeHousing(player.inventory, getTile(world, x, y, z, player, TileApiary.class));
|
||||
|
||||
case BeealyzerGUI:
|
||||
equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new GuiBeealyzer(player, new BeealyzerInventory(player, equipped));
|
||||
|
||||
case BeehouseGUI:
|
||||
return new GuiBeeHousing(player.inventory, getTile(world, x, y, z, player, TileBeehouse.class));
|
||||
|
||||
case HabitatLocatorGUI:
|
||||
equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new GuiHabitatLocator(player, new HabitatLocatorInventory(player, equipped));
|
||||
|
||||
case HygroregulatorGUI:
|
||||
return new GuiAlvearyHygroregulator(player.inventory, getTile(world, x, y, z, player, TileAlvearyHygroregulator.class));
|
||||
|
||||
case ImprinterGUI:
|
||||
equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == null) {
|
||||
return null;
|
||||
}
|
||||
return new GuiImprinter(player.inventory, new ImprinterInventory(player, equipped));
|
||||
|
||||
default:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
|
||||
int cleanId = decodeGuiID(id);
|
||||
int guiData = decodeGuiData(id);
|
||||
|
||||
if (cleanId >= GuiId.values().length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ItemStack equipped;
|
||||
switch (GuiId.values()[cleanId]) {
|
||||
|
||||
case AlvearyGUI:
|
||||
synchApiaristTracker(world, player);
|
||||
return new ContainerAlveary(player.inventory, getTile(world, x, y, z, player, TileAlvearyPlain.class));
|
||||
|
||||
case AlvearySieveGUI:
|
||||
return new ContainerAlvearySieve(player.inventory, getTile(world, x, y, z, player, TileAlvearySieve.class));
|
||||
|
||||
case AlvearySwarmerGUI:
|
||||
return new ContainerAlvearySwarmer(player.inventory, getTile(world, x, y, z, player, TileAlvearySwarmer.class));
|
||||
|
||||
case ApiaristChestGUI:
|
||||
return getNaturalistChestContainer(BeeHelper.UID, player, world, x, y, z, guiData);
|
||||
|
||||
case ApiaryGUI:
|
||||
synchApiaristTracker(world, player);
|
||||
return new ContainerBeeHousing(player.inventory, getTile(world, x, y, z, player, TileApiary.class), true);
|
||||
|
||||
case BeealyzerGUI:
|
||||
equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
synchApiaristTracker(world, player);
|
||||
return new ContainerAlyzer(new BeealyzerInventory(player, equipped), player);
|
||||
|
||||
case BeehouseGUI:
|
||||
synchApiaristTracker(world, player);
|
||||
return new ContainerBeeHousing(player.inventory, getTile(world, x, y, z, player, TileBeehouse.class), false);
|
||||
|
||||
case HabitatLocatorGUI:
|
||||
equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return new ContainerHabitatLocator(player, new HabitatLocatorInventory(player, equipped));
|
||||
|
||||
case HygroregulatorGUI:
|
||||
return new ContainerAlvearyHygroregulator(player.inventory, getTile(world, x, y, z, player, TileAlvearyHygroregulator.class));
|
||||
|
||||
case ImprinterGUI:
|
||||
synchApiaristTracker(world, player);
|
||||
equipped = player.getCurrentEquippedItem();
|
||||
if (equipped == null) {
|
||||
return null;
|
||||
}
|
||||
return new ContainerImprinter(player.inventory, new ImprinterInventory(player, equipped));
|
||||
|
||||
default:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private static void synchApiaristTracker(World world, EntityPlayer player) {
|
||||
BeeManager.beeRoot.getBreedingTracker(world, player.getGameProfile()).synchToPlayer(player);
|
||||
}
|
||||
}
|
||||
@@ -16,11 +16,14 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.core.INBTTagable;
|
||||
import forestry.api.genetics.IFlowerProvider;
|
||||
import forestry.core.utils.vect.Vect;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class HasFlowersCache implements INBTTagable {
|
||||
@@ -42,7 +45,16 @@ public class HasFlowersCache implements INBTTagable {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (FlowerManager.flowerRegistry.isAcceptedFlower(flowerType, world, flowerCoords.posX, flowerCoords.posY, flowerCoords.posZ)) {
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(beeHousing);
|
||||
ChunkCoordinates housingCoords = beeHousing.getCoordinates();
|
||||
|
||||
int[] genomeTerritory = queen.getGenome().getTerritory();
|
||||
float housingModifier = beeModifier.getTerritoryModifier(queen.getGenome(), 1f);
|
||||
Vect area = new Vect(genomeTerritory).multiply(housingModifier * 3.0f);
|
||||
Vect min = new Vect(area).multiply(-0.5f).add(housingCoords);
|
||||
Vect max = new Vect(area).multiply(0.5f).add(housingCoords);
|
||||
|
||||
if (isFlowerValid(world, flowerType, min, max)) {
|
||||
return true;
|
||||
} else {
|
||||
flowerCoords = null;
|
||||
@@ -60,6 +72,17 @@ public class HasFlowersCache implements INBTTagable {
|
||||
return flowerCoords != null;
|
||||
}
|
||||
|
||||
private boolean isFlowerValid(World world, String flowerType, Vect min, Vect max) {
|
||||
if (!isFlowerCoordInRange(flowerCoords, min, max)) {
|
||||
return false;
|
||||
}
|
||||
return FlowerManager.flowerRegistry.isAcceptedFlower(flowerType, world, flowerCoords.posX, flowerCoords.posY, flowerCoords.posZ);
|
||||
}
|
||||
|
||||
private static boolean isFlowerCoordInRange(ChunkCoordinates flowerCoords, Vect min, Vect max) {
|
||||
return flowerCoords.posX >= min.x && flowerCoords.posX <= max.x && flowerCoords.posY >= min.y && flowerCoords.posY <= max.y && flowerCoords.posZ >= min.z && flowerCoords.posZ <= max.z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
if (!nbttagcompound.hasKey(nbtKey)) {
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture;
|
||||
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.apiculture.inventory.IApiaryInventory;
|
||||
|
||||
public interface IApiary extends IBeeHousing {
|
||||
IApiaryInventory getApiaryInventory();
|
||||
}
|
||||
+3
-3
@@ -20,14 +20,14 @@ import forestry.core.inventory.InventoryAdapterRestricted;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
import forestry.core.utils.SlotUtil;
|
||||
|
||||
public class BeeHousingInventory extends InventoryAdapterRestricted implements IBeeHousingInventory {
|
||||
public class InventoryBeeHousing extends InventoryAdapterRestricted implements IBeeHousingInventory {
|
||||
public static final int SLOT_QUEEN = 0;
|
||||
public static final int SLOT_DRONE = 1;
|
||||
public static final int SLOT_PRODUCT_1 = 2;
|
||||
public static final int SLOT_PRODUCT_COUNT = 7;
|
||||
|
||||
public BeeHousingInventory(int size, String name, IAccessHandler accessHandler) {
|
||||
super(size, name, accessHandler);
|
||||
public InventoryBeeHousing(int size, IAccessHandler accessHandler) {
|
||||
super(size, "Items", accessHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -29,13 +29,11 @@ import cpw.mods.fml.common.registry.VillagerRegistry.IVillageCreationHandler;
|
||||
import cpw.mods.fml.common.registry.VillagerRegistry.IVillageTradeHandler;
|
||||
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.apiculture.blocks.BlockApicultureType;
|
||||
import forestry.apiculture.genetics.BeeDefinition;
|
||||
import forestry.apiculture.items.ItemHoneycomb;
|
||||
import forestry.apiculture.worldgen.ComponentVillageBeeHouse;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.utils.Log;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class VillageHandlerApiculture implements IVillageCreationHandler, IVillageTradeHandler {
|
||||
|
||||
@@ -50,11 +48,20 @@ public class VillageHandlerApiculture implements IVillageCreationHandler, IVilla
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random) {
|
||||
recipeList.add(new MerchantRecipe(ForestryItem.beePrincessGE.getItemStack(1, OreDictionary.WILDCARD_VALUE), new ItemStack(Items.emerald, 1)));
|
||||
recipeList.add(new MerchantRecipe(new ItemStack(Items.wheat, 2), ItemHoneycomb.getRandomComb(1, random, false)));
|
||||
recipeList.add(new MerchantRecipe(new ItemStack(Blocks.log, 24, OreDictionary.WILDCARD_VALUE), ForestryBlock.apiculture.getItemStack(1, Constants.DEFINITION_APIARY_META)));
|
||||
recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 1), ForestryItem.frameProven.getItemStack(6)));
|
||||
recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 12), ForestryItem.beePrincessGE.getItemStack(1, OreDictionary.WILDCARD_VALUE), BeeDefinition.MONASTIC.getMemberStack(EnumBeeType.DRONE)));
|
||||
ItemStack wildcardPrincess = new ItemStack(PluginApiculture.items.beePrincessGE, 1, OreDictionary.WILDCARD_VALUE);
|
||||
recipeList.add(new MerchantRecipe(wildcardPrincess, new ItemStack(Items.emerald, 1)));
|
||||
|
||||
ItemStack randomComb = PluginApiculture.items.beeComb.getRandomComb(1, random, false);
|
||||
recipeList.add(new MerchantRecipe(new ItemStack(Items.wheat, 2), randomComb));
|
||||
|
||||
ItemStack apiary = PluginApiculture.blocks.apiculture.get(BlockApicultureType.APIARY);
|
||||
recipeList.add(new MerchantRecipe(new ItemStack(Blocks.log, 24, OreDictionary.WILDCARD_VALUE), apiary));
|
||||
|
||||
ItemStack provenFrames = PluginApiculture.items.frameProven.getItemStack(6);
|
||||
recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 1), provenFrames));
|
||||
|
||||
ItemStack monasticDrone = BeeDefinition.MONASTIC.getMemberStack(EnumBeeType.DRONE);
|
||||
recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 12), wildcardPrincess, monasticDrone));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -37,15 +37,27 @@ import forestry.apiculture.multiblock.TileAlvearySieve;
|
||||
import forestry.apiculture.multiblock.TileAlvearyStabiliser;
|
||||
import forestry.apiculture.multiblock.TileAlvearySwarmer;
|
||||
import forestry.core.blocks.BlockStructure;
|
||||
import forestry.core.multiblock.MultiblockRegistry;
|
||||
import forestry.core.render.TextureManager;
|
||||
|
||||
public class BlockAlveary extends BlockStructure {
|
||||
public enum Type {
|
||||
PLAIN,
|
||||
ENTRANCE,
|
||||
SWARMER,
|
||||
FAN,
|
||||
HEATER,
|
||||
HYGRO,
|
||||
STABILIZER,
|
||||
SIEVE;
|
||||
|
||||
public static final Type[] VALUES = values();
|
||||
}
|
||||
|
||||
public BlockAlveary() {
|
||||
super(new MaterialBeehive(false));
|
||||
setHardness(1.0f);
|
||||
setCreativeTab(Tabs.tabApiculture);
|
||||
setHarvestLevel("axe", 0);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@@ -72,7 +84,7 @@ public class BlockAlveary extends BlockStructure {
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
ArrayList<ItemStack> drop = new ArrayList<ItemStack>();
|
||||
ArrayList<ItemStack> drop = new ArrayList<>();
|
||||
drop.add(new ItemStack(this, 1, metadata != 1 ? metadata : 0));
|
||||
return drop;
|
||||
}
|
||||
@@ -86,19 +98,25 @@ public class BlockAlveary extends BlockStructure {
|
||||
/* TILE ENTITY CREATION */
|
||||
@Override
|
||||
public TileEntity createTileEntity(World world, int metadata) {
|
||||
switch (metadata) {
|
||||
case TileAlveary.SWARMER_META:
|
||||
if (metadata < 0 || metadata > Type.VALUES.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Type type = Type.VALUES[metadata];
|
||||
switch (type) {
|
||||
case SWARMER:
|
||||
return new TileAlvearySwarmer();
|
||||
case TileAlveary.FAN_META:
|
||||
case FAN:
|
||||
return new TileAlvearyFan();
|
||||
case TileAlveary.HEATER_META:
|
||||
case HEATER:
|
||||
return new TileAlvearyHeater();
|
||||
case TileAlveary.HYGRO_META:
|
||||
case HYGRO:
|
||||
return new TileAlvearyHygroregulator();
|
||||
case TileAlveary.STABILIZER_META:
|
||||
case STABILIZER:
|
||||
return new TileAlvearyStabiliser();
|
||||
case TileAlveary.SIEVE_META:
|
||||
case SIEVE:
|
||||
return new TileAlvearySieve();
|
||||
case PLAIN:
|
||||
default:
|
||||
return new TileAlvearyPlain();
|
||||
}
|
||||
@@ -132,47 +150,49 @@ public class BlockAlveary extends BlockStructure {
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
icons = new IIcon[14];
|
||||
icons[0] = TextureManager.getInstance().registerTex(register, "apiculture/alveary.plain");
|
||||
icons[1] = TextureManager.getInstance().registerTex(register, "apiculture/alveary.entrance");
|
||||
icons[2] = TextureManager.getInstance().registerTex(register, "apiculture/alveary.bottom");
|
||||
icons[3] = TextureManager.getInstance().registerTex(register, "apiculture/alveary.left");
|
||||
icons[4] = TextureManager.getInstance().registerTex(register, "apiculture/alveary.right");
|
||||
icons[5] = TextureManager.getInstance().registerTex(register, "apiculture/alveary.swarmer.off");
|
||||
icons[6] = TextureManager.getInstance().registerTex(register, "apiculture/alveary.swarmer.on");
|
||||
icons[7] = TextureManager.getInstance().registerTex(register, "apiculture/alveary.heater.off");
|
||||
icons[8] = TextureManager.getInstance().registerTex(register, "apiculture/alveary.heater.on");
|
||||
icons[9] = TextureManager.getInstance().registerTex(register, "apiculture/alveary.fan.off");
|
||||
icons[10] = TextureManager.getInstance().registerTex(register, "apiculture/alveary.fan.on");
|
||||
icons[11] = TextureManager.getInstance().registerTex(register, "apiculture/alveary.valve");
|
||||
icons[12] = TextureManager.getInstance().registerTex(register, "apiculture/alveary.stabiliser");
|
||||
icons[13] = TextureManager.getInstance().registerTex(register, "apiculture/alveary.sieve");
|
||||
icons[0] = TextureManager.registerTex(register, "apiculture/alveary.plain");
|
||||
icons[1] = TextureManager.registerTex(register, "apiculture/alveary.entrance");
|
||||
icons[2] = TextureManager.registerTex(register, "apiculture/alveary.bottom");
|
||||
icons[3] = TextureManager.registerTex(register, "apiculture/alveary.left");
|
||||
icons[4] = TextureManager.registerTex(register, "apiculture/alveary.right");
|
||||
icons[5] = TextureManager.registerTex(register, "apiculture/alveary.swarmer.off");
|
||||
icons[6] = TextureManager.registerTex(register, "apiculture/alveary.swarmer.on");
|
||||
icons[7] = TextureManager.registerTex(register, "apiculture/alveary.heater.off");
|
||||
icons[8] = TextureManager.registerTex(register, "apiculture/alveary.heater.on");
|
||||
icons[9] = TextureManager.registerTex(register, "apiculture/alveary.fan.off");
|
||||
icons[10] = TextureManager.registerTex(register, "apiculture/alveary.fan.on");
|
||||
icons[11] = TextureManager.registerTex(register, "apiculture/alveary.valve");
|
||||
icons[12] = TextureManager.registerTex(register, "apiculture/alveary.stabiliser");
|
||||
icons[13] = TextureManager.registerTex(register, "apiculture/alveary.sieve");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
if ((metadata <= 1
|
||||
|| metadata == TileAlveary.SIEVE_META || metadata == TileAlveary.SWARMER_META || metadata == TileAlveary.STABILIZER_META)
|
||||
|| metadata == Type.SIEVE.ordinal() || metadata == Type.SWARMER.ordinal() || metadata == Type.STABILIZER.ordinal())
|
||||
&& (side == 1 || side == 0)) {
|
||||
return icons[BOTTOM];
|
||||
}
|
||||
|
||||
switch (metadata) {
|
||||
case TileAlveary.PLAIN_META:
|
||||
Type type = Type.VALUES[metadata];
|
||||
|
||||
switch (type) {
|
||||
case PLAIN:
|
||||
return icons[PLAIN];
|
||||
case TileAlveary.ENTRANCE_META:
|
||||
case ENTRANCE:
|
||||
return icons[ENTRANCE];
|
||||
case TileAlveary.SWARMER_META:
|
||||
case SWARMER:
|
||||
return icons[ALVEARY_SWARMER_OFF];
|
||||
case TileAlveary.FAN_META:
|
||||
case FAN:
|
||||
return icons[ALVEARY_FAN_OFF];
|
||||
case TileAlveary.HEATER_META:
|
||||
case HEATER:
|
||||
return icons[ALVEARY_HEATER_OFF];
|
||||
case TileAlveary.HYGRO_META:
|
||||
case HYGRO:
|
||||
return icons[ALVEARY_HYGRO];
|
||||
case TileAlveary.STABILIZER_META:
|
||||
case STABILIZER:
|
||||
return icons[STABILISER];
|
||||
case TileAlveary.SIEVE_META:
|
||||
case SIEVE:
|
||||
return icons[SIEVE];
|
||||
default:
|
||||
return null;
|
||||
@@ -228,7 +248,7 @@ public class BlockAlveary extends BlockStructure {
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon getBlockTextureFromSideAndTile(IBlockAccess world, int x, int y, int z, int side) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile == null || !(tile instanceof TileAlveary)) {
|
||||
if (!(tile instanceof TileAlveary)) {
|
||||
return getIcon(side, 0);
|
||||
}
|
||||
|
||||
@@ -261,7 +281,11 @@ public class BlockAlveary extends BlockStructure {
|
||||
TileAlveary tileAlveary = (TileAlveary) tileEntity;
|
||||
|
||||
// We must check that the slabs on top were not removed
|
||||
MultiblockRegistry.addDirtyController(world, tileAlveary.getMultiblockController());
|
||||
tileAlveary.getMultiblockLogic().getController().reassemble();
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack get(Type type) {
|
||||
return new ItemStack(this, 1, type.ordinal());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.blocks;
|
||||
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.core.blocks.BlockBase;
|
||||
|
||||
public class BlockApiculture extends BlockBase<BlockApicultureType> {
|
||||
public BlockApiculture() {
|
||||
super();
|
||||
setCreativeTab(Tabs.tabApiculture);
|
||||
setHarvestLevel("axe", 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.blocks;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
|
||||
import forestry.apiculture.tiles.TileApiaristChest;
|
||||
import forestry.apiculture.tiles.TileApiary;
|
||||
import forestry.apiculture.tiles.TileBeehouse;
|
||||
import forestry.core.blocks.IMachineProperties;
|
||||
import forestry.core.tiles.TileForestry;
|
||||
|
||||
public enum BlockApicultureType implements IMachineProperties {
|
||||
APIARY(TileApiary.class),
|
||||
APIARIST_CHEST_LEGACY(TileApiaristChest.class, "ApiaristChest"),
|
||||
BEEHOUSE(TileBeehouse.class);
|
||||
|
||||
public static final BlockApicultureType[] VALUES = values();
|
||||
|
||||
private final String teIdent;
|
||||
private final Class<? extends TileForestry> teClass;
|
||||
|
||||
BlockApicultureType(Class<? extends TileForestry> teClass) {
|
||||
String name = toString().toLowerCase(Locale.ENGLISH);
|
||||
this.teIdent = "forestry." + WordUtils.capitalize(name);
|
||||
this.teClass = teClass;
|
||||
}
|
||||
|
||||
BlockApicultureType(Class<? extends TileForestry> teClass, String name) {
|
||||
this.teIdent = "forestry." + name;
|
||||
this.teClass = teClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMeta() {
|
||||
return ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTeIdent() {
|
||||
return teIdent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends TileForestry> getTeClass() {
|
||||
return teClass;
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,11 @@ import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class BlockBeehives extends BlockContainer {
|
||||
public enum Type {
|
||||
LEGACY,
|
||||
FOREST,
|
||||
MEADOWS;
|
||||
}
|
||||
|
||||
public BlockBeehives() {
|
||||
super(new MaterialBeehive(true));
|
||||
@@ -83,7 +88,7 @@ public class BlockBeehives extends BlockContainer {
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
ArrayList<ItemStack> ret = new ArrayList<>();
|
||||
|
||||
// Handle legacy block
|
||||
if (metadata == 0) {
|
||||
@@ -185,8 +190,8 @@ public class BlockBeehives extends BlockContainer {
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
icons = new IIcon[18];
|
||||
for (int i = 1; i < 9; i++) {
|
||||
icons[i * 2] = TextureManager.getInstance().registerTex(register, "beehives/beehive." + i + ".top");
|
||||
icons[(i * 2) + 1] = TextureManager.getInstance().registerTex(register, "beehives/beehive." + i + ".side");
|
||||
icons[i * 2] = TextureManager.registerTex(register, "beehives/beehive." + i + ".top");
|
||||
icons[(i * 2) + 1] = TextureManager.registerTex(register, "beehives/beehive." + i + ".side");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.apiculture.tiles.TileCandle;
|
||||
import forestry.core.ForestryClient;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.render.TextureManager;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.core.utils.StringUtil;
|
||||
@@ -75,7 +75,7 @@ public class BlockCandle extends BlockTorch {
|
||||
.put("dyeBlack", new Color(20, 20, 20).getRGB())
|
||||
.build();
|
||||
|
||||
lightingItems = new HashSet<Item>(Arrays.asList(
|
||||
lightingItems = new HashSet<>(Arrays.asList(
|
||||
Items.flint_and_steel,
|
||||
Items.flint,
|
||||
Item.getItemFromBlock(Blocks.torch)
|
||||
@@ -110,18 +110,18 @@ public class BlockCandle extends BlockTorch {
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return ForestryClient.candleRenderId;
|
||||
return Proxies.render.getCandleRenderId();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
String fileBase = StringUtil.cleanBlockName(this);
|
||||
this.blockIcon = TextureManager.getInstance().registerTex(register, "stump");
|
||||
this.litStump = TextureManager.getInstance().registerTex(register, fileBase + "StumpLit");
|
||||
this.litTip = TextureManager.getInstance().registerTex(register, fileBase + "TipLit");
|
||||
this.unlitStump = TextureManager.getInstance().registerTex(register, fileBase + "StumpUnlit");
|
||||
this.unlitTip = TextureManager.getInstance().registerTex(register, fileBase + "TipUnlit");
|
||||
this.blockIcon = TextureManager.registerTex(register, "stump");
|
||||
this.litStump = TextureManager.registerTex(register, fileBase + "StumpLit");
|
||||
this.litTip = TextureManager.registerTex(register, fileBase + "TipLit");
|
||||
this.unlitStump = TextureManager.registerTex(register, fileBase + "StumpUnlit");
|
||||
this.unlitTip = TextureManager.registerTex(register, fileBase + "TipUnlit");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -233,7 +233,7 @@ public class BlockCandle extends BlockTorch {
|
||||
/* DROP HANDLING */
|
||||
// Hack: When harvesting we need to get the drops in onBlockHarvested,
|
||||
// because Mojang destroys the block and tile before calling getDrops.
|
||||
private final ThreadLocal<ItemStack> drop = new ThreadLocal<ItemStack>();
|
||||
private final ThreadLocal<ItemStack> drop = new ThreadLocal<>();
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World world, int x, int y, int z, int metadata, EntityPlayer player) {
|
||||
@@ -253,7 +253,7 @@ public class BlockCandle extends BlockTorch {
|
||||
dropStack = getCandleDrop(world, x, y, z);
|
||||
}
|
||||
|
||||
ArrayList<ItemStack> drops = new ArrayList<ItemStack>(1);
|
||||
ArrayList<ItemStack> drops = new ArrayList<>(1);
|
||||
drops.add(dropStack);
|
||||
|
||||
return drops;
|
||||
@@ -326,4 +326,11 @@ public class BlockCandle extends BlockTorch {
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getUnlitCandle(int amount) {
|
||||
return new ItemStack(this, amount, 0);
|
||||
}
|
||||
|
||||
public ItemStack getLitCandle(int amount) {
|
||||
return new ItemStack(this, amount, 1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.blocks;
|
||||
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.apiculture.items.ItemBlockCandle;
|
||||
import forestry.core.blocks.BlockBase;
|
||||
import forestry.core.blocks.BlockRegistry;
|
||||
import forestry.core.items.ItemBlockForestry;
|
||||
|
||||
public class BlockRegistryApiculture extends BlockRegistry {
|
||||
public final BlockApiculture apiculture;
|
||||
public final BlockBase apicultureChest;
|
||||
public final BlockBeehives beehives;
|
||||
public final BlockCandle candle;
|
||||
public final BlockStump stump;
|
||||
public final BlockAlveary alveary;
|
||||
|
||||
public BlockRegistryApiculture() {
|
||||
apiculture = registerBlock(new BlockApiculture(), ItemBlockForestry.class, "apiculture");
|
||||
|
||||
apicultureChest = registerBlock(new BlockBase(true), ItemBlockForestry.class, "apicultureChest");
|
||||
apicultureChest.setCreativeTab(Tabs.tabApiculture);
|
||||
apicultureChest.setHarvestLevel("axe", 0);
|
||||
|
||||
beehives = registerBlock(new BlockBeehives(), ItemBlockForestry.class, "beehives");
|
||||
|
||||
candle = registerBlock(new BlockCandle(), ItemBlockCandle.class, "candle");
|
||||
stump = registerBlock(new BlockStump(), ItemBlockForestry.class, "stump");
|
||||
|
||||
alveary = registerBlock(new BlockAlveary(), ItemBlockForestry.class, "alveary");
|
||||
}
|
||||
}
|
||||
@@ -29,10 +29,10 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.apiculture.tiles.TileCandle;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import forestry.core.render.TextureManager;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class BlockStump extends BlockTorch {
|
||||
|
||||
@@ -46,7 +46,7 @@ public class BlockStump extends BlockTorch {
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
this.blockIcon = TextureManager.getInstance().registerTex(register, StringUtil.cleanBlockName(this));
|
||||
this.blockIcon = TextureManager.registerTex(register, StringUtil.cleanBlockName(this));
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@@ -63,7 +63,7 @@ public class BlockStump extends BlockTorch {
|
||||
(held.getItem() == Items.flint_and_steel ||
|
||||
held.getItem() == Items.flint ||
|
||||
ItemStackUtil.equals(Blocks.torch, held))) {
|
||||
world.setBlock(x, y, z, ForestryBlock.candle.block(), world.getBlockMetadata(x, y, z) | 0x08, Constants.FLAG_BLOCK_SYNCH);
|
||||
world.setBlock(x, y, z, PluginApiculture.blocks.candle, world.getBlockMetadata(x, y, z) | 0x08, Constants.FLAG_BLOCK_SYNCH);
|
||||
TileCandle tc = new TileCandle();
|
||||
tc.setColour(0); // default to white
|
||||
world.setTileEntity(x, y, z, tc);
|
||||
|
||||
@@ -25,7 +25,7 @@ public class BeeModeHelper implements ICommandModeHelper {
|
||||
public String[] getModeNames() {
|
||||
ArrayList<IBeekeepingMode> beekeepingModes = BeeManager.beeRoot.getBeekeepingModes();
|
||||
int modeStringCount = beekeepingModes.size();
|
||||
List<String> modeStrings = new ArrayList<String>(modeStringCount);
|
||||
List<String> modeStrings = new ArrayList<>(modeStringCount);
|
||||
for (IBeekeepingMode mode : beekeepingModes) {
|
||||
modeStrings.add(mode.getName());
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ public class BeeStatsSaveHelper implements IStatsSaveHelper {
|
||||
|
||||
@Override
|
||||
public Collection<IAlleleSpecies> getSpecies() {
|
||||
Collection<IAlleleSpecies> species = new ArrayList<IAlleleSpecies>();
|
||||
Collection<IAlleleSpecies> species = new ArrayList<>();
|
||||
for (IAllele allele : AlleleManager.alleleRegistry.getRegisteredAlleles().values()) {
|
||||
if (allele instanceof IAlleleBeeSpecies) {
|
||||
species.add((IAlleleBeeSpecies) allele);
|
||||
|
||||
@@ -39,7 +39,7 @@ public class CommandBeeGive extends SubCommand {
|
||||
super("give");
|
||||
setPermLevel(PermLevel.ADMIN);
|
||||
|
||||
List<String> beeTypeStrings = new ArrayList<String>();
|
||||
List<String> beeTypeStrings = new ArrayList<>();
|
||||
for (EnumBeeType type : EnumBeeType.values()) {
|
||||
if (type == EnumBeeType.NONE) {
|
||||
continue;
|
||||
@@ -151,7 +151,7 @@ public class CommandBeeGive extends SubCommand {
|
||||
}
|
||||
|
||||
private static String[] getSpecies() {
|
||||
List<String> species = new ArrayList<String>();
|
||||
List<String> species = new ArrayList<>();
|
||||
|
||||
for (IAllele allele : AlleleManager.alleleRegistry.getRegisteredAlleles().values()) {
|
||||
if (allele instanceof IAlleleBeeSpecies) {
|
||||
|
||||
@@ -27,9 +27,9 @@ public class EntityFXBee extends EntityFX {
|
||||
this.particleMaxAge = (int) (20.0D / (Math.random() * 0.8D + 0.2D));
|
||||
this.noClip = true;
|
||||
|
||||
this.motionX *= 0.2D;
|
||||
this.motionX *= 0.1D;
|
||||
this.motionY *= 0.015D;
|
||||
this.motionZ *= 0.2D;
|
||||
this.motionZ *= 0.1D;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.entities;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.IBeeHousingInventory;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IHiveFrame;
|
||||
import forestry.apiculture.ApiaryBeeListener;
|
||||
import forestry.apiculture.ApiaryBeeModifier;
|
||||
import forestry.apiculture.IApiary;
|
||||
import forestry.apiculture.blocks.BlockApicultureType;
|
||||
import forestry.apiculture.gui.ContainerMinecartBeehouse;
|
||||
import forestry.apiculture.gui.GuiBeeHousing;
|
||||
import forestry.apiculture.inventory.IApiaryInventory;
|
||||
import forestry.apiculture.inventory.InventoryApiary;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class EntityMinecartApiary extends EntityMinecartBeeHousingBase implements IApiary {
|
||||
private static final IBeeModifier beeModifier = new ApiaryBeeModifier();
|
||||
private final IBeeListener beeListener = new ApiaryBeeListener(this);
|
||||
private final InventoryApiary inventory = new InventoryApiary(getAccessHandler());
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public EntityMinecartApiary(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
public EntityMinecartApiary(World world, double posX, double posY, double posZ) {
|
||||
super(world, posX, posY, posZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getHints() {
|
||||
return Config.hints.get("apiary");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IInventoryAdapter getInternalInventory() {
|
||||
return inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IApiaryInventory getApiaryInventory() {
|
||||
return inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBeeHousingInventory getBeeInventory() {
|
||||
return inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block func_145820_n() {
|
||||
return PluginApiculture.blocks.apiculture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDisplayTileData() {
|
||||
return BlockApicultureType.APIARY.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCartItem() {
|
||||
return PluginApiculture.items.minecartBeehouse.getApiaryMinecart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<IBeeModifier> getBeeModifiers() {
|
||||
List<IBeeModifier> beeModifiers = new ArrayList<>();
|
||||
|
||||
beeModifiers.add(beeModifier);
|
||||
|
||||
for (IHiveFrame frame : inventory.getFrames()) {
|
||||
beeModifiers.add(frame.getBeeModifier());
|
||||
}
|
||||
|
||||
return beeModifiers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<IBeeListener> getBeeListeners() {
|
||||
return Collections.singleton(beeListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
ContainerMinecartBeehouse container = new ContainerMinecartBeehouse(player.inventory, this, true);
|
||||
return new GuiBeeHousing<>(this, container, GuiBeeHousing.Icon.APIARY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
return new ContainerMinecartBeehouse(player.inventory, this, true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.entities;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeekeepingLogic;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.IErrorLogic;
|
||||
import forestry.apiculture.gui.IGuiBeeHousingInventory;
|
||||
import forestry.apiculture.network.packets.PacketBeeLogicEntityRequest;
|
||||
import forestry.apiculture.tiles.TileBeeHousingBase;
|
||||
import forestry.core.entities.EntityMinecartContainerForestry;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.IForestryPacketServer;
|
||||
import forestry.core.network.IStreamableGui;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.IClimatised;
|
||||
|
||||
public abstract class EntityMinecartBeeHousingBase extends EntityMinecartContainerForestry implements IBeeHousing, IGuiBeeHousingInventory, IClimatised, IStreamableGui {
|
||||
private static final Random random = new Random();
|
||||
private static final int beeFXInterval = 4;
|
||||
private static final int pollenFXInterval = 50;
|
||||
|
||||
private final int beeFXTime = random.nextInt(beeFXInterval);
|
||||
private final int pollenFXTime = random.nextInt(pollenFXInterval);
|
||||
|
||||
private final IBeekeepingLogic beeLogic = BeeManager.beeRoot.createBeekeepingLogic(this);
|
||||
private final IErrorLogic errorLogic = ForestryAPI.errorStateRegistry.createErrorLogic();
|
||||
|
||||
// CLIENT
|
||||
private int breedingProgressPercent = 0;
|
||||
private boolean needsActiveUpdate = true;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public EntityMinecartBeeHousingBase(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
public EntityMinecartBeeHousingBase(World world, double posX, double posY, double posZ) {
|
||||
super(world, posX, posY, posZ);
|
||||
}
|
||||
|
||||
/* IBeeHousing */
|
||||
@Override
|
||||
public IBeekeepingLogic getBeekeepingLogic() {
|
||||
return beeLogic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumTemperature getTemperature() {
|
||||
return EnumTemperature.getFromBiome(getBiome(), (int) posX, (int) posY, (int) posZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumHumidity getHumidity() {
|
||||
return EnumHumidity.getFromValue(getBiome().rainfall);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getExactTemperature() {
|
||||
return getBiome().temperature;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getExactHumidity() {
|
||||
return getBiome().rainfall;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockLightValue() {
|
||||
return worldObj.getBlockLightValue((int) posX, (int) posY + 1, (int) posZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlockSeeTheSky() {
|
||||
return worldObj.canBlockSeeTheSky((int) posX, (int) posY + 1, (int) posZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld() {
|
||||
return worldObj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeGenBase getBiome() {
|
||||
return worldObj.getBiomeGenForCoords((int) posX, (int) posZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GameProfile getOwner() {
|
||||
return getAccessHandler().getOwner();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IErrorLogic getErrorLogic() {
|
||||
return errorLogic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkCoordinates getCoordinates() {
|
||||
return new ChunkCoordinates((int) posX, (int) posY, (int) posZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3 getBeeFXCoordinates() {
|
||||
return Vec3.createVectorHelper(posX, posY + 0.25, posZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeGuiData(DataOutputStreamForestry data) throws IOException {
|
||||
data.writeVarInt(beeLogic.getBeeProgressPercent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readGuiData(DataInputStreamForestry data) throws IOException {
|
||||
breedingProgressPercent = data.readVarInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHealthScaled(int i) {
|
||||
return (breedingProgressPercent * i) / 100;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
if (!worldObj.isRemote) {
|
||||
if (beeLogic.canWork()) {
|
||||
beeLogic.doWork();
|
||||
}
|
||||
} else {
|
||||
if (needsActiveUpdate) {
|
||||
IForestryPacketServer packet = new PacketBeeLogicEntityRequest(this);
|
||||
Proxies.net.sendToServer(packet);
|
||||
needsActiveUpdate = false;
|
||||
}
|
||||
|
||||
if (beeLogic.canDoBeeFX()) {
|
||||
if (worldObj.getTotalWorldTime() % beeFXInterval == beeFXTime) {
|
||||
beeLogic.doBeeFX();
|
||||
}
|
||||
|
||||
if (worldObj.getTotalWorldTime() % pollenFXInterval == pollenFXTime) {
|
||||
TileBeeHousingBase.doPollenFX(worldObj, posX - 0.5, posY - 0.1, posZ - 0.5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readEntityFromNBT(NBTTagCompound nbtTagCompound) {
|
||||
super.readEntityFromNBT(nbtTagCompound);
|
||||
beeLogic.readFromNBT(nbtTagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeEntityToNBT(NBTTagCompound nbtTagCompound) {
|
||||
super.writeEntityToNBT(nbtTagCompound);
|
||||
beeLogic.writeToNBT(nbtTagCompound);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.entities;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.DefaultBeeListener;
|
||||
import forestry.api.apiculture.IBeeHousingInventory;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.apiculture.BeehouseBeeModifier;
|
||||
import forestry.apiculture.InventoryBeeHousing;
|
||||
import forestry.apiculture.blocks.BlockApicultureType;
|
||||
import forestry.apiculture.gui.ContainerMinecartBeehouse;
|
||||
import forestry.apiculture.gui.GuiBeeHousing;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class EntityMinecartBeehouse extends EntityMinecartBeeHousingBase {
|
||||
private static final IBeeModifier beeModifier = new BeehouseBeeModifier();
|
||||
private static final IBeeListener beeListener = new DefaultBeeListener();
|
||||
private final InventoryBeeHousing beeInventory = new InventoryBeeHousing(9, getAccessHandler());
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public EntityMinecartBeehouse(World world) {
|
||||
super(world);
|
||||
beeInventory.disableAutomation();
|
||||
}
|
||||
|
||||
public EntityMinecartBeehouse(World world, double posX, double posY, double posZ) {
|
||||
super(world, posX, posY, posZ);
|
||||
beeInventory.disableAutomation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getHints() {
|
||||
return Config.hints.get("bee.house");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Block func_145820_n() {
|
||||
return PluginApiculture.blocks.apiculture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDisplayTileData() {
|
||||
return BlockApicultureType.BEEHOUSE.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCartItem() {
|
||||
return PluginApiculture.items.minecartBeehouse.getBeeHouseMinecart();
|
||||
}
|
||||
|
||||
/* IBeeHousing */
|
||||
@Override
|
||||
public Iterable<IBeeModifier> getBeeModifiers() {
|
||||
return Collections.singleton(beeModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<IBeeListener> getBeeListeners() {
|
||||
return Collections.singleton(beeListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBeeHousingInventory getBeeInventory() {
|
||||
return beeInventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IInventoryAdapter getInternalInventory() {
|
||||
return beeInventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
ContainerMinecartBeehouse container = new ContainerMinecartBeehouse(player.inventory, this, false);
|
||||
return new GuiBeeHousing<>(this, container, GuiBeeHousing.Icon.BEE_HOUSE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, int data) {
|
||||
return new ContainerMinecartBeehouse(player.inventory, this, false);
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,8 @@ package forestry.apiculture.flowers;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
@@ -46,7 +48,7 @@ final class Flower implements IFlower {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(IFlower other) {
|
||||
public int compareTo(@Nonnull IFlower other) {
|
||||
return this.weight.compareTo(other.getWeight());
|
||||
}
|
||||
|
||||
|
||||
@@ -45,12 +45,13 @@ public class FlowerProvider implements IFlowerProvider {
|
||||
|
||||
EnumSet<EnumPlantType> plantTypes = pollinatable.getPlantType();
|
||||
|
||||
if (flowerType.equals(FlowerManager.FlowerTypeNether)) {
|
||||
return plantTypes.contains(EnumPlantType.Nether);
|
||||
} else if (flowerType.equals(FlowerManager.FlowerTypeCacti)) {
|
||||
return plantTypes.contains(EnumPlantType.Desert);
|
||||
} else {
|
||||
return plantTypes.size() > 1 || !plantTypes.contains(EnumPlantType.Nether);
|
||||
switch (flowerType) {
|
||||
case FlowerManager.FlowerTypeNether:
|
||||
return plantTypes.contains(EnumPlantType.Nether);
|
||||
case FlowerManager.FlowerTypeCacti:
|
||||
return plantTypes.contains(EnumPlantType.Desert);
|
||||
default:
|
||||
return plantTypes.size() > 1 || !plantTypes.contains(EnumPlantType.Nether);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,25 +34,30 @@ import net.minecraft.tileentity.TileEntityFlowerPot;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.genetics.IFlower;
|
||||
import forestry.api.genetics.IFlowerAcceptableRule;
|
||||
import forestry.api.genetics.IFlowerGrowthHelper;
|
||||
import forestry.api.genetics.IFlowerGrowthRule;
|
||||
import forestry.api.genetics.IFlowerRegistry;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.apiculture.BeeHousingModifier;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.utils.Log;
|
||||
import forestry.core.utils.vect.MutableVect;
|
||||
import forestry.core.utils.vect.Vect;
|
||||
import forestry.plugins.PluginManager;
|
||||
|
||||
public final class FlowerRegistry implements IFlowerRegistry {
|
||||
public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelper {
|
||||
|
||||
private final Set<String> defaultFlowerTypes = ImmutableSet.of(
|
||||
FlowerManager.FlowerTypeVanilla,
|
||||
@@ -66,17 +71,19 @@ public final class FlowerRegistry implements IFlowerRegistry {
|
||||
FlowerManager.FlowerTypeGourd
|
||||
);
|
||||
|
||||
private final HashMultimap<String, IFlowerAcceptableRule> registeredRules; // custom check
|
||||
private final HashMultimap<String, Block> registeredBlocks; // quick first check
|
||||
private final HashMultimap<String, IFlower> registeredFlowers; // full check
|
||||
private final HashMultimap<String, Flower> registeredFlowers; // full check
|
||||
|
||||
private final ArrayListMultimap<String, IFlowerGrowthRule> growthRules;
|
||||
private final Map<String, TreeMap<Double, IFlower>> chances;
|
||||
private final Map<String, TreeMap<Double, Flower>> chances;
|
||||
|
||||
public FlowerRegistry() {
|
||||
this.registeredRules = HashMultimap.create();
|
||||
this.registeredBlocks = HashMultimap.create();
|
||||
this.registeredFlowers = HashMultimap.create();
|
||||
this.growthRules = ArrayListMultimap.create();
|
||||
this.chances = new HashMap<String, TreeMap<Double, IFlower>>();
|
||||
this.chances = new HashMap<>();
|
||||
|
||||
registerVanillaGrowthRules();
|
||||
}
|
||||
@@ -91,6 +98,17 @@ public final class FlowerRegistry implements IFlowerRegistry {
|
||||
registerFlower(block, meta, 0.0, flowerTypes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerAcceptableFlowerRule(IFlowerAcceptableRule acceptableFlower, String... flowerTypes) {
|
||||
for (String flowerType : flowerTypes) {
|
||||
if (defaultFlowerTypes.contains(flowerType)) {
|
||||
Log.severe("IFlowerAcceptableRules are too slow to be applied to Forestry's built-in flower type: " + flowerType + ".");
|
||||
} else {
|
||||
registeredRules.put(flowerType, acceptableFlower);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPlantableFlower(Block block, int meta, double weight, String... flowerTypes) {
|
||||
registerFlower(block, meta, weight, flowerTypes);
|
||||
@@ -114,7 +132,7 @@ public final class FlowerRegistry implements IFlowerRegistry {
|
||||
throw new NullPointerException("Tried to register flower with null type. " + block);
|
||||
}
|
||||
|
||||
Set<IFlower> flowers = this.registeredFlowers.get(flowerType);
|
||||
Set<Flower> flowers = this.registeredFlowers.get(flowerType);
|
||||
flowers.add(newFlower);
|
||||
|
||||
Set<Block> blocks = this.registeredBlocks.get(flowerType);
|
||||
@@ -138,11 +156,12 @@ public final class FlowerRegistry implements IFlowerRegistry {
|
||||
return null;
|
||||
}
|
||||
|
||||
Set<IFlowerAcceptableRule> acceptableRules = this.registeredRules.get(flowerType);
|
||||
Set<Block> acceptedBlocks = this.registeredBlocks.get(flowerType);
|
||||
Set<IFlower> acceptedFlowers = this.registeredFlowers.get(flowerType);
|
||||
Set<Flower> acceptedFlowers = this.registeredFlowers.get(flowerType);
|
||||
World world = beeHousing.getWorld();
|
||||
|
||||
IBeeModifier beeModifier = new BeeHousingModifier(beeHousing);
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(beeHousing);
|
||||
|
||||
Vect area = getArea(bee.getGenome(), beeModifier);
|
||||
Vect housingPos = new Vect(beeHousing.getCoordinates()).add(-area.x / 2, -area.y / 2, -area.z / 2);
|
||||
@@ -152,6 +171,12 @@ public final class FlowerRegistry implements IFlowerRegistry {
|
||||
|
||||
Vect posBlock = Vect.add(housingPos, posCurrent);
|
||||
|
||||
for (IFlowerAcceptableRule acceptableRule : acceptableRules) {
|
||||
if (acceptableRule.isAcceptableFlower(flowerType, world, posBlock.x, posBlock.y, posBlock.z)) {
|
||||
return new ChunkCoordinates(posBlock.x, posBlock.y, posBlock.z);
|
||||
}
|
||||
}
|
||||
|
||||
if (isAcceptedFlower(flowerType, acceptedBlocks, acceptedFlowers, world, posBlock.x, posBlock.y, posBlock.z)) {
|
||||
return new ChunkCoordinates(posBlock.x, posBlock.y, posBlock.z);
|
||||
}
|
||||
@@ -166,13 +191,20 @@ public final class FlowerRegistry implements IFlowerRegistry {
|
||||
return false;
|
||||
}
|
||||
|
||||
Set<IFlowerAcceptableRule> acceptedCustom = this.registeredRules.get(flowerType);
|
||||
for (IFlowerAcceptableRule acceptableFlower : acceptedCustom) {
|
||||
if (acceptableFlower.isAcceptableFlower(flowerType, world, x, y, z)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Set<Block> acceptedBlocks = this.registeredBlocks.get(flowerType);
|
||||
Set<IFlower> acceptedFlowers = this.registeredFlowers.get(flowerType);
|
||||
Set<Flower> acceptedFlowers = this.registeredFlowers.get(flowerType);
|
||||
|
||||
return isAcceptedFlower(flowerType, acceptedBlocks, acceptedFlowers, world, x, y, z);
|
||||
}
|
||||
|
||||
private static boolean isAcceptedFlower(String flowerType, Set<Block> acceptedBlocks, Set<IFlower> acceptedFlowers, World world, int x, int y, int z) {
|
||||
private static boolean isAcceptedFlower(String flowerType, Set<Block> acceptedBlocks, Set<Flower> acceptedFlowers, World world, int x, int y, int z) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
|
||||
final int meta;
|
||||
@@ -190,15 +222,21 @@ public final class FlowerRegistry implements IFlowerRegistry {
|
||||
meta = world.getBlockMetadata(x, y, z);
|
||||
}
|
||||
|
||||
if (PluginManager.Module.AGRICRAFT.isEnabled() && (flowerType.equals(FlowerManager.FlowerTypeWheat) || flowerType.equals(FlowerManager.FlowerTypeNether))) {
|
||||
if (PluginManager.Module.AGRICRAFT.isEnabled()) {
|
||||
Block cropBlock = GameRegistry.findBlock("AgriCraft", "crops");
|
||||
if (block == cropBlock) {
|
||||
ArrayList<ItemStack> drops = block.getDrops(world, x, y, z, 7, 0);
|
||||
if (drops.get(1).getItem() == Items.wheat_seeds && flowerType.equals(FlowerManager.FlowerTypeWheat)) {
|
||||
return true;
|
||||
}
|
||||
if (drops.get(1).getItem() == Items.nether_wart && flowerType.equals(FlowerManager.FlowerTypeNether)) {
|
||||
return true;
|
||||
if(block instanceof IPlantable) {
|
||||
//For agricraft versions which implement IPlantable in the BlockCrop class
|
||||
block = ((IPlantable) block).getPlant(world, x, y, z);
|
||||
} else {
|
||||
//For earlier versions of AgriCraft
|
||||
ArrayList<ItemStack> drops = block.getDrops(world, x, y, z, 7, 0);
|
||||
if (drops.get(1).getItem() == Items.wheat_seeds && flowerType.equals(FlowerManager.FlowerTypeWheat)) {
|
||||
return true;
|
||||
}
|
||||
if (drops.get(1).getItem() == Items.nether_wart && flowerType.equals(FlowerManager.FlowerTypeNether)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -214,7 +252,15 @@ public final class FlowerRegistry implements IFlowerRegistry {
|
||||
}
|
||||
|
||||
for (IFlowerGrowthRule rule : this.growthRules.get(flowerType)) {
|
||||
if (rule.growFlower(this, flowerType, world, individual, x, y, z)) {
|
||||
boolean success;
|
||||
try {
|
||||
success = rule.growFlower(this, flowerType, world, x, y, z);
|
||||
} catch (Throwable ignored) {
|
||||
// legacy method
|
||||
success = rule.growFlower(this, flowerType, world, individual, x, y, z);
|
||||
}
|
||||
|
||||
if (success) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -224,7 +270,7 @@ public final class FlowerRegistry implements IFlowerRegistry {
|
||||
|
||||
@Override
|
||||
public Set<IFlower> getAcceptableFlowers(String flowerType) {
|
||||
return this.registeredFlowers.get(flowerType);
|
||||
return ImmutableSet.<IFlower>copyOf(this.registeredFlowers.get(flowerType));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -240,21 +286,21 @@ public final class FlowerRegistry implements IFlowerRegistry {
|
||||
|
||||
@Override
|
||||
public IFlower getRandomPlantableFlower(String flowerType, Random rand) {
|
||||
TreeMap<Double, IFlower> chancesMap = getChancesMap(flowerType);
|
||||
TreeMap<Double, Flower> chancesMap = getChancesMap(flowerType);
|
||||
double maxKey = chancesMap.lastKey() + 1.0;
|
||||
return chancesMap.get(chancesMap.lowerKey(rand.nextDouble() * maxKey));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getFlowerTypes() {
|
||||
return new ArrayList<String>(Sets.union(defaultFlowerTypes, registeredFlowers.keySet()));
|
||||
return new ArrayList<>(Sets.union(defaultFlowerTypes, registeredFlowers.keySet()));
|
||||
}
|
||||
|
||||
private TreeMap<Double, IFlower> getChancesMap(String flowerType) {
|
||||
private TreeMap<Double, Flower> getChancesMap(String flowerType) {
|
||||
if (!this.chances.containsKey(flowerType)) {
|
||||
TreeMap<Double, IFlower> flowerChances = new TreeMap<Double, IFlower>();
|
||||
TreeMap<Double, Flower> flowerChances = new TreeMap<>();
|
||||
double count = 0.0;
|
||||
for (IFlower flower : this.registeredFlowers.get(flowerType)) {
|
||||
for (Flower flower : this.registeredFlowers.get(flowerType)) {
|
||||
if (flower.isPlantable()) {
|
||||
flowerChances.put(count, flower);
|
||||
count += flower.getWeight();
|
||||
@@ -266,13 +312,19 @@ public final class FlowerRegistry implements IFlowerRegistry {
|
||||
}
|
||||
|
||||
private void registerVanillaGrowthRules() {
|
||||
registerGrowthRule(new VanillaDirtGrassGrowthRule(), FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);
|
||||
registerGrowthRule(new VanillaSnowGrowthRule(), FlowerManager.FlowerTypeSnow);
|
||||
registerGrowthRule(new VanillaFlowerPotGrowthRule(), FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow, FlowerManager.FlowerTypeMushrooms, FlowerManager.FlowerTypeCacti,
|
||||
registerGrowthRule(new GrowthRuleDirtGrass(), FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);
|
||||
registerGrowthRule(new GrowthRuleSnow(), FlowerManager.FlowerTypeSnow);
|
||||
registerGrowthRule(new GrowthRuleFlowerPot(), FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow, FlowerManager.FlowerTypeMushrooms, FlowerManager.FlowerTypeCacti,
|
||||
FlowerManager.FlowerTypeJungle);
|
||||
registerGrowthRule(new VanillaMyceliumGrowthRule(), FlowerManager.FlowerTypeMushrooms);
|
||||
registerGrowthRule(new VanillaDefaultGrowthRule(), FlowerManager.FlowerTypeEnd);
|
||||
registerGrowthRule(new VanillaFertilizeGrowthRule(Blocks.melon_stem, Blocks.pumpkin_stem), FlowerManager.FlowerTypeGourd);
|
||||
registerGrowthRule(new VanillaFertilizeGrowthRule(Blocks.wheat), FlowerManager.FlowerTypeWheat);
|
||||
registerGrowthRule(new GrowthRuleMycelium(), FlowerManager.FlowerTypeMushrooms);
|
||||
registerGrowthRule(new GrowthRuleNone(), FlowerManager.FlowerTypeEnd);
|
||||
registerGrowthRule(new GrowthRuleFertilize(Blocks.melon_stem, Blocks.pumpkin_stem), FlowerManager.FlowerTypeGourd);
|
||||
registerGrowthRule(new GrowthRuleFertilize(Blocks.wheat), FlowerManager.FlowerTypeWheat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean plantRandomFlower(String flowerType, World world, int x, int y, int z) {
|
||||
IFlower flower = getRandomPlantableFlower(flowerType, world.rand);
|
||||
return world.setBlock(x, y, z, flower.getBlock(), flower.getMeta(), Constants.FLAG_BLOCK_SYNCH);
|
||||
}
|
||||
}
|
||||
+16
-1
@@ -15,12 +15,13 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.genetics.IFlower;
|
||||
import forestry.api.genetics.IFlowerGrowthHelper;
|
||||
import forestry.api.genetics.IFlowerGrowthRule;
|
||||
import forestry.api.genetics.IFlowerRegistry;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.core.config.Constants;
|
||||
|
||||
public class VanillaDirtGrassGrowthRule implements IFlowerGrowthRule {
|
||||
public class GrowthRuleDirtGrass implements IFlowerGrowthRule {
|
||||
|
||||
@Override
|
||||
public boolean growFlower(IFlowerRegistry flowerRegistry, String flowerType, World world, IIndividual individual, int x, int y, int z) {
|
||||
@@ -37,4 +38,18 @@ public class VanillaDirtGrassGrowthRule implements IFlowerGrowthRule {
|
||||
return world.setBlock(x, y, z, flower.getBlock(), flower.getMeta(), Constants.FLAG_BLOCK_SYNCH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) {
|
||||
if (!world.isAirBlock(x, y, z)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Block ground = world.getBlock(x, y - 1, z);
|
||||
if (ground != Blocks.dirt && ground != Blocks.grass) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return helper.plantRandomFlower(flowerType, world, x, y, z);
|
||||
}
|
||||
|
||||
}
|
||||
+12
-2
@@ -16,20 +16,30 @@ import java.util.List;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.genetics.IFlowerGrowthHelper;
|
||||
import forestry.api.genetics.IFlowerGrowthRule;
|
||||
import forestry.api.genetics.IFlowerRegistry;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
|
||||
public class VanillaFertilizeGrowthRule implements IFlowerGrowthRule {
|
||||
public class GrowthRuleFertilize implements IFlowerGrowthRule {
|
||||
|
||||
private final List<Block> allowedItems;
|
||||
|
||||
public VanillaFertilizeGrowthRule(Block... allowedItems) {
|
||||
public GrowthRuleFertilize(Block... allowedItems) {
|
||||
this.allowedItems = Arrays.asList(allowedItems);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean growFlower(IFlowerRegistry fr, String flowerType, World world, IIndividual individual, int x, int y, int z) {
|
||||
return growFlower(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) {
|
||||
return growFlower(world, x, y, z);
|
||||
}
|
||||
|
||||
private boolean growFlower(World world, int x, int y, int z) {
|
||||
Block ground = world.getBlock(x, y, z);
|
||||
int groundMeta;
|
||||
for (Block b : this.allowedItems) {
|
||||
+26
-11
@@ -17,15 +17,24 @@ import net.minecraft.tileentity.TileEntityFlowerPot;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
import forestry.api.genetics.IFlowerGrowthHelper;
|
||||
import forestry.api.genetics.IFlowerGrowthRule;
|
||||
import forestry.api.genetics.IFlowerRegistry;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
|
||||
public class VanillaFlowerPotGrowthRule implements IFlowerGrowthRule {
|
||||
public class GrowthRuleFlowerPot implements IFlowerGrowthRule {
|
||||
|
||||
@Override
|
||||
public boolean growFlower(IFlowerRegistry fr, String flowerType, World world, IIndividual individual, int x, int y, int z) {
|
||||
return growFlower(flowerType, world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) {
|
||||
return growFlower(flowerType, world, x, y, z);
|
||||
}
|
||||
|
||||
private static boolean growFlower(String flowerType, World world, int x, int y, int z) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (!(tile instanceof TileEntityFlowerPot)) {
|
||||
return false;
|
||||
@@ -44,16 +53,22 @@ public class VanillaFlowerPotGrowthRule implements IFlowerGrowthRule {
|
||||
BlockFlowerPot flowerPot = (BlockFlowerPot) block;
|
||||
|
||||
int flower;
|
||||
if (flowerType.equals(FlowerManager.FlowerTypeVanilla) || flowerType.equals(FlowerManager.FlowerTypeSnow)) {
|
||||
flower = world.rand.nextInt(2) + 1;
|
||||
} else if (flowerType.equals(FlowerManager.FlowerTypeJungle)) {
|
||||
flower = 6;
|
||||
} else if (flowerType.equals(FlowerManager.FlowerTypeCacti)) {
|
||||
flower = world.rand.nextInt(2) + 9;
|
||||
} else if (flowerType.equals(FlowerManager.FlowerTypeMushrooms)) {
|
||||
flower = world.rand.nextInt(2) + 7;
|
||||
} else {
|
||||
return false;
|
||||
switch (flowerType) {
|
||||
case FlowerManager.FlowerTypeVanilla:
|
||||
case FlowerManager.FlowerTypeSnow:
|
||||
flower = world.rand.nextInt(2) + 1;
|
||||
break;
|
||||
case FlowerManager.FlowerTypeJungle:
|
||||
flower = 6;
|
||||
break;
|
||||
case FlowerManager.FlowerTypeCacti:
|
||||
flower = world.rand.nextInt(2) + 9;
|
||||
break;
|
||||
case FlowerManager.FlowerTypeMushrooms:
|
||||
flower = world.rand.nextInt(2) + 7;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
TileEntityFlowerPot newTile = (TileEntityFlowerPot) flowerPot.createNewTileEntity(world, flower);
|
||||
+16
-1
@@ -15,12 +15,13 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.genetics.IFlower;
|
||||
import forestry.api.genetics.IFlowerGrowthHelper;
|
||||
import forestry.api.genetics.IFlowerGrowthRule;
|
||||
import forestry.api.genetics.IFlowerRegistry;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.core.config.Constants;
|
||||
|
||||
public class VanillaMyceliumGrowthRule implements IFlowerGrowthRule {
|
||||
public class GrowthRuleMycelium implements IFlowerGrowthRule {
|
||||
|
||||
@Override
|
||||
public boolean growFlower(IFlowerRegistry fr, String flowerType, World world, IIndividual individual, int x, int y, int z) {
|
||||
@@ -37,4 +38,18 @@ public class VanillaMyceliumGrowthRule implements IFlowerGrowthRule {
|
||||
return world.setBlock(x, y, z, flower.getBlock(), flower.getMeta(), Constants.FLAG_BLOCK_SYNCH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) {
|
||||
if (!world.isAirBlock(x, y, z)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Block ground = world.getBlock(x, y - 1, z);
|
||||
if (ground != Blocks.mycelium) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return helper.plantRandomFlower(flowerType, world, x, y, z);
|
||||
}
|
||||
|
||||
}
|
||||
+7
-1
@@ -12,15 +12,21 @@ package forestry.apiculture.flowers;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.genetics.IFlowerGrowthHelper;
|
||||
import forestry.api.genetics.IFlowerGrowthRule;
|
||||
import forestry.api.genetics.IFlowerRegistry;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
|
||||
public class VanillaDefaultGrowthRule implements IFlowerGrowthRule {
|
||||
public class GrowthRuleNone implements IFlowerGrowthRule {
|
||||
|
||||
@Override
|
||||
public boolean growFlower(IFlowerRegistry fr, String flowerType, World world, IIndividual individual, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
+16
-1
@@ -15,12 +15,13 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.genetics.IFlower;
|
||||
import forestry.api.genetics.IFlowerGrowthHelper;
|
||||
import forestry.api.genetics.IFlowerGrowthRule;
|
||||
import forestry.api.genetics.IFlowerRegistry;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.core.config.Constants;
|
||||
|
||||
public class VanillaSnowGrowthRule implements IFlowerGrowthRule {
|
||||
public class GrowthRuleSnow implements IFlowerGrowthRule {
|
||||
|
||||
@Override
|
||||
public boolean growFlower(IFlowerRegistry fr, String flowerType, World world, IIndividual individual, int x, int y, int z) {
|
||||
@@ -37,4 +38,18 @@ public class VanillaSnowGrowthRule implements IFlowerGrowthRule {
|
||||
return world.setBlock(x, y, z, flower.getBlock(), flower.getMeta(), Constants.FLAG_BLOCK_SYNCH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, int x, int y, int z) {
|
||||
if (world.getBlock(x, y, z) != Blocks.snow) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Block ground = world.getBlock(x, y - 1, z);
|
||||
if (ground != Blocks.dirt && ground != Blocks.grass) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return helper.plantRandomFlower(flowerType, world, x, y, z);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,8 +13,6 @@ package forestry.apiculture.genetics;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.IApiaristTracker;
|
||||
@@ -27,11 +25,7 @@ public class ApiaristTracker extends BreedingTracker implements IApiaristTracker
|
||||
|
||||
/** Required for creation from map storage */
|
||||
public ApiaristTracker(String s) {
|
||||
this(s, null);
|
||||
}
|
||||
|
||||
public ApiaristTracker(String s, GameProfile player) {
|
||||
super(s, player);
|
||||
super(s);
|
||||
}
|
||||
|
||||
private int queensTotal = 0;
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IApiaristTracker;
|
||||
@@ -44,6 +45,7 @@ import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.IErrorState;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleTolerance;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
@@ -52,7 +54,6 @@ import forestry.api.genetics.IFlowerProvider;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.api.genetics.IPollinatable;
|
||||
import forestry.apiculture.BeeHousingModifier;
|
||||
import forestry.arboriculture.genetics.pollination.FakePollinatable;
|
||||
import forestry.arboriculture.genetics.pollination.ICheckPollinatable;
|
||||
import forestry.core.config.Config;
|
||||
@@ -251,53 +252,92 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
World world = housing.getWorld();
|
||||
BiomeGenBase biome = housing.getBiome();
|
||||
|
||||
Set<IErrorState> errorStates = new HashSet<IErrorState>();
|
||||
Set<IErrorState> errorStates = new HashSet<>();
|
||||
|
||||
IBeeModifier beeModifier = new BeeHousingModifier(housing);
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
// / Rain needs tolerant flyers
|
||||
if (world.isRaining() && !genome.getTolerantFlyer() && BiomeHelper.canRainOrSnow(biome) && !beeModifier.isSealed()) {
|
||||
errorStates.add(EnumErrorCode.ISRAINING);
|
||||
if (world.isRaining() && BiomeHelper.canRainOrSnow(biome) && !canFlyInRain(beeModifier)) {
|
||||
errorStates.add(EnumErrorCode.IS_RAINING);
|
||||
}
|
||||
|
||||
// / Night or darkness requires nocturnal species
|
||||
if (world.isDaytime()) {
|
||||
if (!canWorkDuringDay()) {
|
||||
errorStates.add(EnumErrorCode.NOTNIGHT);
|
||||
errorStates.add(EnumErrorCode.NOT_NIGHT);
|
||||
}
|
||||
} else {
|
||||
if (!canWorkAtNight(beeModifier)) {
|
||||
errorStates.add(EnumErrorCode.NOT_DAY);
|
||||
}
|
||||
} else if (!canWorkAtNight() && !beeModifier.isSelfLighted()) {
|
||||
errorStates.add(EnumErrorCode.NOTDAY);
|
||||
}
|
||||
|
||||
if (housing.getBlockLightValue() > Constants.APIARY_MIN_LEVEL_LIGHT) {
|
||||
if (!canWorkDuringDay()) {
|
||||
errorStates.add(EnumErrorCode.NOTGLOOMY);
|
||||
errorStates.add(EnumErrorCode.NOT_GLOOMY);
|
||||
}
|
||||
} else {
|
||||
if (!canWorkAtNight(beeModifier)) {
|
||||
errorStates.add(EnumErrorCode.NOT_BRIGHT);
|
||||
}
|
||||
} else if (!canWorkAtNight() && !beeModifier.isSelfLighted()) {
|
||||
errorStates.add(EnumErrorCode.NOTLUCID);
|
||||
}
|
||||
|
||||
// / No sky, except if in hell
|
||||
if (biome != null && !BiomeHelper.isBiomeHellish(biome) && !housing.canBlockSeeTheSky() && !genome.getCaveDwelling() && !beeModifier.isSunlightSimulated()) {
|
||||
errorStates.add(EnumErrorCode.NOSKY);
|
||||
// / Check for the sky, except if in hell
|
||||
if (biome != null && !BiomeHelper.isBiomeHellish(biome)) {
|
||||
if (!housing.canBlockSeeTheSky() && !canWorkUnderground(beeModifier)) {
|
||||
errorStates.add(EnumErrorCode.NO_SKY);
|
||||
}
|
||||
}
|
||||
|
||||
// / And finally climate check
|
||||
if (!isSuitableClimate(housing.getTemperature(), housing.getHumidity())) {
|
||||
errorStates.add(EnumErrorCode.INVALIDBIOME);
|
||||
IAlleleBeeSpecies species = genome.getPrimary();
|
||||
{
|
||||
EnumTemperature actualTemperature = housing.getTemperature();
|
||||
EnumTemperature beeBaseTemperature = species.getTemperature();
|
||||
EnumTolerance beeToleranceTemperature = genome.getToleranceTemp();
|
||||
|
||||
if (!AlleleManager.climateHelper.isWithinLimits(actualTemperature, beeBaseTemperature, beeToleranceTemperature)) {
|
||||
if (beeBaseTemperature.ordinal() > actualTemperature.ordinal()) {
|
||||
errorStates.add(EnumErrorCode.TOO_COLD);
|
||||
} else {
|
||||
errorStates.add(EnumErrorCode.TOO_HOT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
EnumHumidity actualHumidity = housing.getHumidity();
|
||||
EnumHumidity beeBaseHumidity = species.getHumidity();
|
||||
EnumTolerance beeToleranceHumidity = genome.getToleranceHumid();
|
||||
|
||||
if (!AlleleManager.climateHelper.isWithinLimits(actualHumidity, beeBaseHumidity, beeToleranceHumidity)) {
|
||||
if (beeBaseHumidity.ordinal() > actualHumidity.ordinal()) {
|
||||
errorStates.add(EnumErrorCode.TOO_ARID);
|
||||
} else {
|
||||
errorStates.add(EnumErrorCode.TOO_HUMID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return errorStates;
|
||||
}
|
||||
|
||||
private boolean canWorkAtNight() {
|
||||
return genome.getPrimary().isNocturnal() || genome.getNocturnal();
|
||||
private boolean canWorkAtNight(IBeeModifier beeModifier) {
|
||||
return genome.getPrimary().isNocturnal() || genome.getNocturnal() || beeModifier.isSelfLighted();
|
||||
}
|
||||
|
||||
private boolean canWorkDuringDay() {
|
||||
return !genome.getPrimary().isNocturnal() || genome.getNocturnal();
|
||||
}
|
||||
|
||||
private boolean canWorkUnderground(IBeeModifier beeModifier) {
|
||||
return genome.getCaveDwelling() || beeModifier.isSunlightSimulated();
|
||||
}
|
||||
|
||||
private boolean canFlyInRain(IBeeModifier beeModifier) {
|
||||
return genome.getTolerantFlyer() || beeModifier.isSealed();
|
||||
}
|
||||
|
||||
private boolean isSuitableBiome(BiomeGenBase biome) {
|
||||
if (biome == null) {
|
||||
return false;
|
||||
@@ -316,7 +356,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
|
||||
@Override
|
||||
public ArrayList<BiomeGenBase> getSuitableBiomes() {
|
||||
ArrayList<BiomeGenBase> suitableBiomes = new ArrayList<BiomeGenBase>();
|
||||
ArrayList<BiomeGenBase> suitableBiomes = new ArrayList<>();
|
||||
for (BiomeGenBase biome : BiomeGenBase.getBiomeGenArray()) {
|
||||
if (isSuitableBiome(biome)) {
|
||||
suitableBiomes.add(biome);
|
||||
@@ -402,7 +442,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
// / PRODUCTION
|
||||
@Override
|
||||
public ItemStack[] getProduceList() {
|
||||
ArrayList<ItemStack> products = new ArrayList<ItemStack>();
|
||||
ArrayList<ItemStack> products = new ArrayList<>();
|
||||
|
||||
IAlleleBeeSpecies primary = genome.getPrimary();
|
||||
IAlleleBeeSpecies secondary = genome.getSecondary();
|
||||
@@ -448,7 +488,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<ItemStack> products = new ArrayList<ItemStack>();
|
||||
List<ItemStack> products = new ArrayList<>();
|
||||
|
||||
IAlleleBeeSpecies primary = genome.getPrimary();
|
||||
IAlleleBeeSpecies secondary = genome.getSecondary();
|
||||
@@ -458,7 +498,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
setIsNatural(false);
|
||||
}
|
||||
|
||||
IBeeModifier beeHousingModifier = new BeeHousingModifier(housing);
|
||||
IBeeModifier beeHousingModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
IBeeModifier beeModeModifier = mode.getBeeModifier();
|
||||
|
||||
// Bee genetic speed * beehousing * beekeeping mode
|
||||
@@ -518,7 +558,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<IBee> bees = new ArrayList<IBee>();
|
||||
List<IBee> bees = new ArrayList<>();
|
||||
|
||||
ChunkCoordinates housingCoordinates = housing.getCoordinates();
|
||||
int toCreate = BeeManager.beeRoot.getBeekeepingMode(world).getFinalFertility(this, world, housingCoordinates.posX, housingCoordinates.posY, housingCoordinates.posZ);
|
||||
@@ -630,7 +670,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
@Override
|
||||
public IIndividual retrievePollen(IBeeHousing housing) {
|
||||
|
||||
IBeeModifier beeModifier = new BeeHousingModifier(housing);
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
int chance = Math.round(genome.getFlowering() * beeModifier.getFloweringModifier(getGenome(), 1f));
|
||||
|
||||
@@ -673,7 +713,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
@Override
|
||||
public boolean pollinateRandom(IBeeHousing housing, IIndividual pollen) {
|
||||
|
||||
IBeeModifier beeModifier = new BeeHousingModifier(housing);
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
int chance = (int) (genome.getFlowering() * beeModifier.getFloweringModifier(getGenome(), 1f));
|
||||
|
||||
@@ -720,7 +760,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
@Override
|
||||
public void plantFlowerRandom(IBeeHousing housing) {
|
||||
|
||||
IBeeModifier beeModifier = new BeeHousingModifier(housing);
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
int chance = Math.round(genome.getFlowering() * beeModifier.getFloweringModifier(getGenome(), 1f));
|
||||
|
||||
@@ -742,7 +782,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
Vect randomPos = Vect.getRandomPositionInArea(random, area);
|
||||
Vect posBlock = Vect.add(housingPos, randomPos, offset);
|
||||
|
||||
if (provider.growFlower(world, this, posBlock.x, posBlock.y, posBlock.z)) {
|
||||
if (FlowerManager.flowerRegistry.growFlower(provider.getFlowerType(), world, this, posBlock.x, posBlock.y, posBlock.z)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,9 @@ import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IClassification;
|
||||
import forestry.apiculture.genetics.alleles.AlleleEffect;
|
||||
import forestry.core.genetics.IBranchDefinition;
|
||||
import forestry.core.genetics.alleles.Allele;
|
||||
import forestry.core.genetics.alleles.AlleleHelper;
|
||||
import forestry.core.genetics.alleles.EnumAllele;
|
||||
|
||||
public enum BeeBranchDefinition implements IBranchDefinition {
|
||||
@@ -19,96 +20,96 @@ public enum BeeBranchDefinition implements IBranchDefinition {
|
||||
INFERNAL("Diapis") {
|
||||
@Override
|
||||
protected void setBranchProperties(IAllele[] alleles) {
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.DOWN_2);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.NOCTURNAL, true);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.NETHER);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.AVERAGE);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.DOWN_2);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.NOCTURNAL, true);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.NETHER);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.AVERAGE);
|
||||
}
|
||||
},
|
||||
AUSTERE("Modapis") {
|
||||
@Override
|
||||
protected void setBranchProperties(IAllele[] alleles) {
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.DOWN_1);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.NOCTURNAL, true);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.CACTI);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.DOWN_1);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.NOCTURNAL, true);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.CACTI);
|
||||
}
|
||||
},
|
||||
TROPICAL("Caldapis") {
|
||||
@Override
|
||||
protected void setBranchProperties(IAllele[] alleles) {
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.UP_1);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.UP_1);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.JUNGLE);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.EFFECT, Allele.effectMiasmic);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.UP_1);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.UP_1);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.JUNGLE);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.EFFECT, AlleleEffect.effectMiasmic);
|
||||
}
|
||||
},
|
||||
END("Finapis") {
|
||||
@Override
|
||||
protected void setBranchProperties(IAllele[] alleles) {
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.FERTILITY, EnumAllele.Fertility.LOW);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.LONGER);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.UP_1);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.TERRITORY, EnumAllele.Territory.LARGE);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.END);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.NOCTURNAL, true);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.EFFECT, Allele.effectMisanthrope);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.FERTILITY, EnumAllele.Fertility.LOW);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.LONGER);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.UP_1);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.TERRITORY, EnumAllele.Territory.LARGE);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.END);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.NOCTURNAL, true);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.EFFECT, AlleleEffect.effectMisanthrope);
|
||||
}
|
||||
},
|
||||
FROZEN("Coagapis") {
|
||||
@Override
|
||||
protected void setBranchProperties(IAllele[] alleles) {
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.UP_1);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.SNOW);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.EFFECT, Allele.effectGlacial);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.UP_1);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.SNOW);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.EFFECT, AlleleEffect.effectGlacial);
|
||||
}
|
||||
},
|
||||
VENGEFUL("Punapis") {
|
||||
@Override
|
||||
protected void setBranchProperties(IAllele[] alleles) {
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.TERRITORY, EnumAllele.Territory.LARGEST);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.EFFECT, Allele.effectRadioactive);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.TERRITORY, EnumAllele.Territory.LARGEST);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.EFFECT, AlleleEffect.effectRadioactive);
|
||||
}
|
||||
},
|
||||
FESTIVE("Festapis") {
|
||||
@Override
|
||||
protected void setBranchProperties(IAllele[] alleles) {
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.BOTH_2);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.NORMAL);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.BOTH_2);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.NORMAL);
|
||||
}
|
||||
},
|
||||
AGRARIAN("Rustapis") {
|
||||
@Override
|
||||
protected void setBranchProperties(IAllele[] alleles) {
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORTER);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.WHEAT);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.FASTER);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORTER);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.WHEAT);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.FASTER);
|
||||
}
|
||||
},
|
||||
BOGGY("Paludapis") {
|
||||
@Override
|
||||
protected void setBranchProperties(IAllele[] alleles) {
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.MUSHROOMS);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.SLOWER);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.MUSHROOMS);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.SLOWER);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
|
||||
}
|
||||
},
|
||||
MONASTIC("Monapis") {
|
||||
@Override
|
||||
protected void setBranchProperties(IAllele[] alleles) {
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.LONG);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.FERTILITY, EnumAllele.Fertility.LOW);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.FASTER);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.CAVE_DWELLING, true);
|
||||
Allele.helper.set(alleles, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.WHEAT);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.LONG);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.FERTILITY, EnumAllele.Fertility.LOW);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.FASTER);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.BOTH_1);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.CAVE_DWELLING, true);
|
||||
AlleleHelper.instance.set(alleles, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.WHEAT);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -140,18 +141,18 @@ public enum BeeBranchDefinition implements IBranchDefinition {
|
||||
if (defaultTemplate == null) {
|
||||
defaultTemplate = new IAllele[EnumBeeChromosome.values().length];
|
||||
|
||||
Allele.helper.set(defaultTemplate, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWEST);
|
||||
Allele.helper.set(defaultTemplate, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORTER);
|
||||
Allele.helper.set(defaultTemplate, EnumBeeChromosome.FERTILITY, EnumAllele.Fertility.NORMAL);
|
||||
Allele.helper.set(defaultTemplate, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.NONE);
|
||||
Allele.helper.set(defaultTemplate, EnumBeeChromosome.NOCTURNAL, false);
|
||||
Allele.helper.set(defaultTemplate, EnumBeeChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.NONE);
|
||||
Allele.helper.set(defaultTemplate, EnumBeeChromosome.TOLERANT_FLYER, false);
|
||||
Allele.helper.set(defaultTemplate, EnumBeeChromosome.CAVE_DWELLING, false);
|
||||
Allele.helper.set(defaultTemplate, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.VANILLA);
|
||||
Allele.helper.set(defaultTemplate, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.SLOWEST);
|
||||
Allele.helper.set(defaultTemplate, EnumBeeChromosome.TERRITORY, EnumAllele.Territory.AVERAGE);
|
||||
Allele.helper.set(defaultTemplate, EnumBeeChromosome.EFFECT, Allele.effectNone);
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWEST);
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORTER);
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumBeeChromosome.FERTILITY, EnumAllele.Fertility.NORMAL);
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.NONE);
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumBeeChromosome.NOCTURNAL, false);
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumBeeChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.NONE);
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumBeeChromosome.TOLERANT_FLYER, false);
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumBeeChromosome.CAVE_DWELLING, false);
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.VANILLA);
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.SLOWEST);
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumBeeChromosome.TERRITORY, EnumAllele.Territory.AVERAGE);
|
||||
AlleleHelper.instance.set(defaultTemplate, EnumBeeChromosome.EFFECT, AlleleEffect.effectNone);
|
||||
}
|
||||
return Arrays.copyOf(defaultTemplate, defaultTemplate.length);
|
||||
}
|
||||
|
||||
@@ -32,22 +32,26 @@ import forestry.api.apiculture.IBeeMutationCustom;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.genetics.alleles.Allele;
|
||||
import forestry.apiculture.genetics.alleles.AlleleEffect;
|
||||
import forestry.apiculture.items.EnumHoneyComb;
|
||||
import forestry.apiculture.items.EnumPollenCluster;
|
||||
import forestry.core.genetics.alleles.AlleleHelper;
|
||||
import forestry.core.genetics.alleles.EnumAllele;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
import forestry.plugins.PluginCore;
|
||||
|
||||
public enum BeeDefinition implements IBeeDefinition {
|
||||
/* HONEY BRANCH */
|
||||
FOREST(BeeBranchDefinition.HONEY, "nigrocincta", true, new Color(0x19d0ec), new Color(0xffdc16)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 0), 0.30f);
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.HONEY, 1), 0.30f);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.SLOWER);
|
||||
Allele.helper.set(template, EnumBeeChromosome.FERTILITY, EnumAllele.Fertility.HIGH);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.SLOWER);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.FERTILITY, EnumAllele.Fertility.HIGH);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -58,12 +62,12 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
MEADOWS(BeeBranchDefinition.HONEY, "florea", true, new Color(0xef131e), new Color(0xffdc16)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 0), 0.30f);
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.HONEY, 1), 0.30f);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.SLOWER);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.SLOWER);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -74,12 +78,12 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
COMMON(BeeBranchDefinition.HONEY, "cerana", true, new Color(0xb2b2b2), new Color(0xffdc16)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 0), 0.35f);
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.HONEY, 1), 0.35f);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -96,13 +100,13 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
CULTIVATED(BeeBranchDefinition.HONEY, "mellifera", true, new Color(0x5734ec), new Color(0xffdc16)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 0), 0.40f);
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.HONEY, 1), 0.40f);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.FAST);
|
||||
Allele.helper.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORTEST);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.FAST);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORTEST);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -117,14 +121,14 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
NOBLE(BeeBranchDefinition.NOBLE, "nobilis", false, new Color(0xec9a19), new Color(0xffdc16)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 5), 0.20f);
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.DRIPPING, 1), 0.20f);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
Allele.helper.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORT);
|
||||
Allele.helper.set(template, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.SLOW);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORT);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.SLOW);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -135,14 +139,14 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
MAJESTIC(BeeBranchDefinition.NOBLE, "regalis", true, new Color(0x7f0000), new Color(0xffdc16)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 5), 0.30f);
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.DRIPPING, 1), 0.30f);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.NORMAL);
|
||||
Allele.helper.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORTENED);
|
||||
Allele.helper.set(template, EnumBeeChromosome.FERTILITY, EnumAllele.Fertility.MAXIMUM);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.NORMAL);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORTENED);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.FERTILITY, EnumAllele.Fertility.MAXIMUM);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -153,16 +157,16 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
IMPERIAL(BeeBranchDefinition.NOBLE, "imperatorius", false, new Color(0xa3e02f), new Color(0xffdc16)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 5), 0.20f)
|
||||
.addProduct(ForestryItem.royalJelly.getItemStack(), 0.15f)
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.DRIPPING, 1), 0.20f)
|
||||
.addProduct(PluginApiculture.items.royalJelly.getItemStack(), 0.15f)
|
||||
.setHasEffect();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
Allele.helper.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.NORMAL);
|
||||
Allele.helper.set(template, EnumBeeChromosome.EFFECT, Allele.effectBeatific);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.NORMAL);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.EFFECT, AlleleEffect.effectBeatific);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -175,14 +179,14 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
DILIGENT(BeeBranchDefinition.INDUSTRIOUS, "sedulus", false, new Color(0xc219ec), new Color(0xffdc16)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 3), 0.20f);
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.STRINGY, 1), 0.20f);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
Allele.helper.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORT);
|
||||
Allele.helper.set(template, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.SLOW);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORT);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.SLOW);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -193,13 +197,13 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
UNWEARY(BeeBranchDefinition.INDUSTRIOUS, "assiduus", true, new Color(0x19ec5a), new Color(0xffdc16)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 3), 0.30f);
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.STRINGY, 1), 0.30f);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.NORMAL);
|
||||
Allele.helper.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORTENED);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.NORMAL);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORTENED);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -210,16 +214,16 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
INDUSTRIOUS(BeeBranchDefinition.INDUSTRIOUS, "industria", false, new Color(0xffffff), new Color(0xffdc16)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 3), 0.20f)
|
||||
.addProduct(ForestryItem.pollenCluster.getItemStack(), 0.15f)
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.STRINGY, 1), 0.20f)
|
||||
.addProduct(PluginApiculture.items.pollenCluster.get(EnumPollenCluster.NORMAL, 1), 0.15f)
|
||||
.setHasEffect();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
Allele.helper.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.NORMAL);
|
||||
Allele.helper.set(template, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.FAST);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.NORMAL);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.FAST);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -232,16 +236,16 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
STEADFAST(BeeBranchDefinition.HEROIC, "legio", false, new Color(0x4d2b15), new Color(0xffdc16)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 1), 0.20f)
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.COCOA, 1), 0.20f)
|
||||
.setHasEffect();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
Allele.helper.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.NORMAL);
|
||||
Allele.helper.set(template, EnumBeeChromosome.NOCTURNAL, true);
|
||||
Allele.helper.set(template, EnumBeeChromosome.CAVE_DWELLING, true);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.NORMAL);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.NOCTURNAL, true);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.CAVE_DWELLING, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -252,16 +256,16 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
VALIANT(BeeBranchDefinition.HEROIC, "centurio", true, new Color(0x626bdd), new Color(0xffdc16)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 1), 0.30f)
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.COCOA, 1), 0.30f)
|
||||
.addSpecialty(new ItemStack(Items.sugar), 0.15f);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOW);
|
||||
Allele.helper.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.LONG);
|
||||
Allele.helper.set(template, EnumBeeChromosome.NOCTURNAL, true);
|
||||
Allele.helper.set(template, EnumBeeChromosome.CAVE_DWELLING, true);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOW);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.LONG);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.NOCTURNAL, true);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.CAVE_DWELLING, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -272,17 +276,17 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
HEROIC(BeeBranchDefinition.HEROIC, "kraphti", false, new Color(0xb3d5e4), new Color(0xffdc16)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 1), 0.40f)
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.COCOA, 1), 0.40f)
|
||||
.setHasEffect();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOW);
|
||||
Allele.helper.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.LONG);
|
||||
Allele.helper.set(template, EnumBeeChromosome.NOCTURNAL, true);
|
||||
Allele.helper.set(template, EnumBeeChromosome.CAVE_DWELLING, true);
|
||||
Allele.helper.set(template, EnumBeeChromosome.EFFECT, Allele.effectHeroic);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOW);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.LONG);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.NOCTURNAL, true);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.CAVE_DWELLING, true);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.EFFECT, AlleleEffect.effectHeroic);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -296,16 +300,16 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
SINISTER(BeeBranchDefinition.INFERNAL, "caecus", false, new Color(0xb3d5e4), new Color(0x9a2323)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 2), 0.45f)
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.SIMMERING, 1), 0.45f)
|
||||
.setTemperature(EnumTemperature.HELLISH)
|
||||
.setHumidity(EnumHumidity.ARID);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
Allele.helper.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.NORMAL);
|
||||
Allele.helper.set(template, EnumBeeChromosome.EFFECT, Allele.effectAggressive);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.NORMAL);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.EFFECT, AlleleEffect.effectAggressive);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -319,17 +323,17 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
FIENDISH(BeeBranchDefinition.INFERNAL, "diabolus", true, new Color(0xd7bee5), new Color(0x9a2323)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 2), 0.55f)
|
||||
.addProduct(ForestryItem.ash.getItemStack(), 0.15f)
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.SIMMERING, 1), 0.55f)
|
||||
.addProduct(PluginCore.items.ash.getItemStack(), 0.15f)
|
||||
.setTemperature(EnumTemperature.HELLISH)
|
||||
.setHumidity(EnumHumidity.ARID);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.NORMAL);
|
||||
Allele.helper.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.LONG);
|
||||
Allele.helper.set(template, EnumBeeChromosome.EFFECT, Allele.effectAggressive);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.NORMAL);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.LONG);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.EFFECT, AlleleEffect.effectAggressive);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -343,7 +347,7 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
DEMONIC(BeeBranchDefinition.INFERNAL, "draco", false, new Color(0xf4e400), new Color(0x9a2323)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 2), 0.45f)
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.SIMMERING, 1), 0.45f)
|
||||
.addProduct(new ItemStack(Items.glowstone_dust), 0.15f)
|
||||
.setHasEffect()
|
||||
.setTemperature(EnumTemperature.HELLISH)
|
||||
@@ -352,9 +356,9 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
Allele.helper.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.LONGER);
|
||||
Allele.helper.set(template, EnumBeeChromosome.EFFECT, Allele.effectIgnition);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.LONGER);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.EFFECT, AlleleEffect.effectIgnition);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -368,15 +372,15 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
MODEST(BeeBranchDefinition.AUSTERE, "modicus", false, new Color(0xc5be86), new Color(0xffdc16)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 7), 0.20f)
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.PARCHED, 1), 0.20f)
|
||||
.setTemperature(EnumTemperature.HOT)
|
||||
.setHumidity(EnumHumidity.ARID);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
Allele.helper.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORT);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -387,15 +391,15 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
FRUGAL(BeeBranchDefinition.AUSTERE, "permodestus", true, new Color(0xe8dcb1), new Color(0xffdc16)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 7), 0.30f)
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.PARCHED, 1), 0.30f)
|
||||
.setTemperature(EnumTemperature.HOT)
|
||||
.setHumidity(EnumHumidity.ARID);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.NORMAL);
|
||||
Allele.helper.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.LONG);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.NORMAL);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.LONG);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -411,8 +415,8 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
AUSTERE(BeeBranchDefinition.AUSTERE, "correpere", false, new Color(0xfffac2), new Color(0xffdc16)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 7), 0.20f)
|
||||
.addSpecialty(ForestryItem.beeComb.getItemStack(1, 10), 0.50f)
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.PARCHED, 1), 0.20f)
|
||||
.addSpecialty(PluginApiculture.items.beeComb.get(EnumHoneyComb.POWDERY, 1), 0.50f)
|
||||
.setHasEffect()
|
||||
.setTemperature(EnumTemperature.HOT)
|
||||
.setHumidity(EnumHumidity.ARID);
|
||||
@@ -420,10 +424,10 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWEST);
|
||||
Allele.helper.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.LONGER);
|
||||
Allele.helper.set(template, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.DOWN_2);
|
||||
Allele.helper.set(template, EnumBeeChromosome.EFFECT, Allele.effectCreeper);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWEST);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.LONGER);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.DOWN_2);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.EFFECT, AlleleEffect.effectCreeper);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -438,15 +442,15 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
TROPICAL(BeeBranchDefinition.TROPICAL, "mendelia", false, new Color(0x378020), new Color(0xffdc16)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 6), 0.20f)
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.SILKY, 1), 0.20f)
|
||||
.setTemperature(EnumTemperature.WARM)
|
||||
.setHumidity(EnumHumidity.DAMP);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
Allele.helper.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORT);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -457,15 +461,15 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
EXOTIC(BeeBranchDefinition.TROPICAL, "darwini", true, new Color(0x304903), new Color(0xffdc16)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 6), 0.30f)
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.SILKY, 1), 0.30f)
|
||||
.setTemperature(EnumTemperature.WARM)
|
||||
.setHumidity(EnumHumidity.DAMP);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.NORMAL);
|
||||
Allele.helper.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.LONG);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.NORMAL);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.LONG);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -476,7 +480,7 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
EDENIC(BeeBranchDefinition.TROPICAL, "humboldti", false, new Color(0x393d0d), new Color(0xffdc16)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 6), 0.20f)
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.SILKY, 1), 0.20f)
|
||||
.setHasEffect()
|
||||
.setTemperature(EnumTemperature.WARM)
|
||||
.setHumidity(EnumHumidity.DAMP);
|
||||
@@ -484,10 +488,10 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWEST);
|
||||
Allele.helper.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.LONGER);
|
||||
Allele.helper.set(template, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.BOTH_2);
|
||||
Allele.helper.set(template, EnumBeeChromosome.EFFECT, Allele.effectExploration);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWEST);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.LONGER);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.TEMPERATURE_TOLERANCE, EnumAllele.Tolerance.BOTH_2);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.EFFECT, AlleleEffect.effectExploration);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -500,7 +504,7 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
ENDED(BeeBranchDefinition.END, "notchi", false, new Color(0xe079fa), new Color(0xd9de9e)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 8), 0.30f)
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.MYSTERIOUS, 1), 0.30f)
|
||||
.setTemperature(EnumTemperature.COLD);
|
||||
}
|
||||
|
||||
@@ -517,13 +521,13 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
SPECTRAL(BeeBranchDefinition.END, "idolum", true, new Color(0xa98bed), new Color(0xd9de9e)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 8), 0.50f)
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.MYSTERIOUS, 1), 0.50f)
|
||||
.setTemperature(EnumTemperature.COLD);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.EFFECT, Allele.effectReanimation);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.EFFECT, AlleleEffect.effectReanimation);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -534,16 +538,16 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
PHANTASMAL(BeeBranchDefinition.END, "lemur", false, new Color(0xcc00fa), new Color(0xd9de9e)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 8), 0.40f)
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.MYSTERIOUS, 1), 0.40f)
|
||||
.setHasEffect()
|
||||
.setTemperature(EnumTemperature.COLD);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWEST);
|
||||
Allele.helper.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.LONGEST);
|
||||
Allele.helper.set(template, EnumBeeChromosome.EFFECT, Allele.effectResurrection);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWEST);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.LONGEST);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.EFFECT, AlleleEffect.effectResurrection);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -556,15 +560,15 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
WINTRY(BeeBranchDefinition.FROZEN, "brumalis", false, new Color(0xa0ffc8), new Color(0xdaf5f3)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 4), 0.30f)
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.FROZEN, 1), 0.30f)
|
||||
.setTemperature(EnumTemperature.ICY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
Allele.helper.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORT);
|
||||
Allele.helper.set(template, EnumBeeChromosome.FERTILITY, EnumAllele.Fertility.MAXIMUM);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORT);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.FERTILITY, EnumAllele.Fertility.MAXIMUM);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -575,15 +579,15 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
ICY(BeeBranchDefinition.FROZEN, "coagulis", true, new Color(0xa0ffff), new Color(0xdaf5f3)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 4), 0.20f)
|
||||
.addProduct(ForestryItem.craftingMaterial.getItemStack(1, 5), 0.20f)
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.FROZEN, 1), 0.20f)
|
||||
.addProduct(PluginCore.items.craftingMaterial.getIceShard(1), 0.20f)
|
||||
.setTemperature(EnumTemperature.ICY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOW);
|
||||
Allele.helper.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORT);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOW);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -595,16 +599,16 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
GLACIAL(BeeBranchDefinition.FROZEN, "glacialis", false, new Color(0xefffff), new Color(0xdaf5f3)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 4), 0.20f)
|
||||
.addProduct(ForestryItem.craftingMaterial.getItemStack(1, 5), 0.40f)
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.FROZEN, 1), 0.20f)
|
||||
.addProduct(PluginCore.items.craftingMaterial.getIceShard(1), 0.40f)
|
||||
.setTemperature(EnumTemperature.ICY)
|
||||
.setHasEffect();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
Allele.helper.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORT);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.SHORT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -618,14 +622,14 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
VINDICTIVE(BeeBranchDefinition.VENGEFUL, "ultio", false, new Color(0xeafff3), new Color(0xffdc16)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 9), 0.25f)
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.IRRADIATED, 1), 0.25f)
|
||||
.setIsNotCounted();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
Allele.helper.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.NORMAL);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWER);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.NORMAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -636,14 +640,14 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
VENGEFUL(BeeBranchDefinition.VENGEFUL, "punire", false, new Color(0xc2de00), new Color(0xffdc16)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 9), 0.40f)
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.IRRADIATED, 1), 0.40f)
|
||||
.setIsNotCounted();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.NORMAL);
|
||||
Allele.helper.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.LONGER);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.NORMAL);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.LONGER);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -655,15 +659,15 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
AVENGING(BeeBranchDefinition.VENGEFUL, "hostimentum", false, new Color(0xddff00), new Color(0xffdc16)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 9), 0.40f)
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.IRRADIATED, 1), 0.40f)
|
||||
.setHasEffect()
|
||||
.setIsNotCounted();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWEST);
|
||||
Allele.helper.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.LONGEST);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOWEST);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.LIFESPAN, EnumAllele.Lifespan.LONGEST);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -677,7 +681,7 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
LEPORINE(BeeBranchDefinition.FESTIVE, "lepus", false, new Color(0xfeff8f), new Color(0x3cd757)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 6), 0.30f)
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.SILKY, 1), 0.30f)
|
||||
.addProduct(new ItemStack(Items.egg), 0.10f)
|
||||
.setHasEffect()
|
||||
.setIsNotCounted();
|
||||
@@ -685,7 +689,7 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.EFFECT, Allele.effectFestiveEaster);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.EFFECT, AlleleEffect.effectFestiveEaster);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -699,8 +703,8 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
MERRY(BeeBranchDefinition.FESTIVE, "feliciter", false, new Color(0xffffff), new Color(0xd40000)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 4), 0.30f)
|
||||
.addProduct(ForestryItem.craftingMaterial.getItemStack(1, 5), 0.20f)
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.FROZEN, 1), 0.30f)
|
||||
.addProduct(PluginCore.items.craftingMaterial.getIceShard(1), 0.20f)
|
||||
.setTemperature(EnumTemperature.ICY)
|
||||
.setHasEffect()
|
||||
.setIsNotCounted();
|
||||
@@ -708,8 +712,8 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.NOCTURNAL, true);
|
||||
Allele.helper.set(template, EnumBeeChromosome.EFFECT, Allele.effectSnowing);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.NOCTURNAL, true);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.EFFECT, AlleleEffect.effectSnowing);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -723,8 +727,8 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
TIPSY(BeeBranchDefinition.FESTIVE, "ebrius", false, new Color(0xffffff), new Color(0xc219ec)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 4), 0.30f)
|
||||
.addProduct(ForestryItem.craftingMaterial.getItemStack(1, 5), 0.20f)
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.FROZEN, 1), 0.30f)
|
||||
.addProduct(PluginCore.items.craftingMaterial.getIceShard(1), 0.20f)
|
||||
.setTemperature(EnumTemperature.ICY)
|
||||
.setHasEffect()
|
||||
.setIsNotCounted();
|
||||
@@ -732,8 +736,8 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.NOCTURNAL, true);
|
||||
Allele.helper.set(template, EnumBeeChromosome.EFFECT, Allele.effectDrunkard);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.NOCTURNAL, true);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.EFFECT, AlleleEffect.effectDrunkard);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -748,7 +752,7 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
TRICKY(BeeBranchDefinition.FESTIVE, "libita", false, new Color(0x49413B), new Color(0xFF6A00)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 0), 0.40f)
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.HONEY, 1), 0.40f)
|
||||
.addProduct(new ItemStack(Items.cookie), 0.15f)
|
||||
.addSpecialty(new ItemStack(Items.skull, 1, 0), 0.02f)
|
||||
.addSpecialty(new ItemStack(Items.skull, 1, 2), 0.02f)
|
||||
@@ -760,9 +764,9 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.NOCTURNAL, true);
|
||||
Allele.helper.set(template, EnumBeeChromosome.TOLERANT_FLYER, true);
|
||||
Allele.helper.set(template, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.GOURD);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.NOCTURNAL, true);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.TOLERANT_FLYER, true);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.FLOWER_PROVIDER, EnumAllele.Flowers.GOURD);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -778,7 +782,7 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
RURAL(BeeBranchDefinition.AGRARIAN, "rustico", false, new Color(0xfeff8f), new Color(0xffdc16)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 14), 0.20f);
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.WHEATEN, 1), 0.20f);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -795,13 +799,13 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
FARMERLY(BeeBranchDefinition.AGRARIAN, "arator", true, new Color(0xD39728), new Color(0xffdc16)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 14), 0.27f);
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.WHEATEN, 1), 0.27f);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOW);
|
||||
Allele.helper.set(template, EnumBeeChromosome.TERRITORY, EnumAllele.Territory.LARGE);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOW);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.TERRITORY, EnumAllele.Territory.LARGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -813,16 +817,16 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
AGRARIAN(BeeBranchDefinition.AGRARIAN, "arator", true, new Color(0xFFCA75), new Color(0xFFE047)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 14), 0.35f)
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.WHEATEN, 1), 0.35f)
|
||||
.setHasEffect();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOW);
|
||||
Allele.helper.set(template, EnumBeeChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.BOTH_2);
|
||||
Allele.helper.set(template, EnumBeeChromosome.EFFECT, Allele.effectFertile);
|
||||
Allele.helper.set(template, EnumBeeChromosome.TERRITORY, EnumAllele.Territory.LARGE);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.SPEED, EnumAllele.Speed.SLOW);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.HUMIDITY_TOLERANCE, EnumAllele.Tolerance.BOTH_2);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.EFFECT, AlleleEffect.effectFertile);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.TERRITORY, EnumAllele.Territory.LARGE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -836,7 +840,7 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
MARSHY(BeeBranchDefinition.BOGGY, "adorasti", true, new Color(0x546626), new Color(0xffdc16)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 15), 0.30f)
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.MOSSY, 1), 0.30f)
|
||||
.setHumidity(EnumHumidity.DAMP);
|
||||
}
|
||||
|
||||
@@ -853,15 +857,15 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
MIRY(BeeBranchDefinition.BOGGY, "humidium", true, new Color(0x92AF42), new Color(0xffdc16)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 15), 0.36f)
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.MOSSY, 1), 0.36f)
|
||||
.setHumidity(EnumHumidity.DAMP);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.FERTILITY, EnumAllele.Fertility.MAXIMUM);
|
||||
Allele.helper.set(template, EnumBeeChromosome.TOLERANT_FLYER, true);
|
||||
Allele.helper.set(template, EnumBeeChromosome.NOCTURNAL, true);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.FERTILITY, EnumAllele.Fertility.MAXIMUM);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.TOLERANT_FLYER, true);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.NOCTURNAL, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -874,17 +878,17 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
BOGGY(BeeBranchDefinition.BOGGY, "paluster", true, new Color(0x698948), new Color(0xffdc16)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 15), 0.39f)
|
||||
.addSpecialty(ForestryItem.peat.getItemStack(), 0.08f)
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.MOSSY, 1), 0.39f)
|
||||
.addSpecialty(PluginCore.items.peat.getItemStack(), 0.08f)
|
||||
.setHumidity(EnumHumidity.DAMP);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.TOLERANT_FLYER, true);
|
||||
Allele.helper.set(template, EnumBeeChromosome.NOCTURNAL, true);
|
||||
Allele.helper.set(template, EnumBeeChromosome.EFFECT, Allele.effectMycophilic);
|
||||
Allele.helper.set(template, EnumBeeChromosome.TERRITORY, EnumAllele.Territory.LARGER);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.TOLERANT_FLYER, true);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.NOCTURNAL, true);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.EFFECT, AlleleEffect.effectMycophilic);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.TERRITORY, EnumAllele.Territory.LARGER);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -899,8 +903,8 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
MONASTIC(BeeBranchDefinition.MONASTIC, "monachus", false, new Color(0x42371c), new Color(0xfff7b6)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addProduct(ForestryItem.beeComb.getItemStack(1, 14), 0.30f)
|
||||
.addSpecialty(ForestryItem.beeComb.getItemStack(1, 16), 0.10f)
|
||||
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.WHEATEN, 1), 0.30f)
|
||||
.addSpecialty(PluginApiculture.items.beeComb.get(EnumHoneyComb.MELLOW, 1), 0.10f)
|
||||
.setJubilanceProvider(new JubilanceProviderHermit());
|
||||
}
|
||||
|
||||
@@ -917,13 +921,13 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
SECLUDED(BeeBranchDefinition.MONASTIC, "contractus", true, new Color(0x7b6634), new Color(0xfff7b6)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addSpecialty(ForestryItem.beeComb.getItemStack(1, 16), 0.20f)
|
||||
beeSpecies.addSpecialty(PluginApiculture.items.beeComb.get(EnumHoneyComb.MELLOW, 1), 0.20f)
|
||||
.setJubilanceProvider(new JubilanceProviderHermit());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.FASTEST);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.FASTEST);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -934,15 +938,15 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
HERMITIC(BeeBranchDefinition.MONASTIC, "anachoreta", false, new Color(0xffd46c), new Color(0xfff7b6)) {
|
||||
@Override
|
||||
protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) {
|
||||
beeSpecies.addSpecialty(ForestryItem.beeComb.getItemStack(1, 16), 0.20f)
|
||||
beeSpecies.addSpecialty(PluginApiculture.items.beeComb.get(EnumHoneyComb.MELLOW, 1), 0.20f)
|
||||
.setJubilanceProvider(new JubilanceProviderHermit())
|
||||
.setHasEffect();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.FASTEST);
|
||||
Allele.helper.set(template, EnumBeeChromosome.EFFECT, Allele.effectRepulsion);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.FLOWERING, EnumAllele.Flowering.FASTEST);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.EFFECT, AlleleEffect.effectRepulsion);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -993,7 +997,7 @@ public enum BeeDefinition implements IBeeDefinition {
|
||||
setSpeciesProperties(species);
|
||||
|
||||
template = branch.getTemplate();
|
||||
Allele.helper.set(template, EnumBeeChromosome.SPECIES, species);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.SPECIES, species);
|
||||
setAlleles(template);
|
||||
|
||||
genome = BeeManager.beeRoot.templateAsGenome(template);
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.IAlleleBeeSpeciesCustom;
|
||||
import forestry.api.apiculture.IBeeFactory;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
@@ -20,7 +21,7 @@ public class BeeFactory implements IBeeFactory {
|
||||
@Override
|
||||
public IAlleleBeeSpeciesCustom createSpecies(String uid, boolean dominant, String authority, String unlocalizedName, String unlocalizedDescription, IClassification branch, String binomial, int primaryColor, int secondaryColor) {
|
||||
IAlleleBeeSpeciesCustom species = new AlleleBeeSpecies(uid, unlocalizedName, authority, unlocalizedDescription, dominant, branch, binomial, primaryColor, secondaryColor);
|
||||
AlleleManager.alleleRegistry.registerAllele(species);
|
||||
AlleleManager.alleleRegistry.registerAllele(species, EnumBeeChromosome.SPECIES);
|
||||
return species;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,17 +33,21 @@ import forestry.api.apiculture.IApiaristTracker;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IBeeMutation;
|
||||
import forestry.api.apiculture.IBeeRoot;
|
||||
import forestry.api.apiculture.IBeekeepingLogic;
|
||||
import forestry.api.apiculture.IBeekeepingMode;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosome;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import forestry.apiculture.BeeHousingListener;
|
||||
import forestry.apiculture.BeeHousingModifier;
|
||||
import forestry.apiculture.BeekeepingLogic;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.genetics.SpeciesRoot;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
@@ -94,24 +98,29 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getMemberStack(IIndividual bee, int type) {
|
||||
if (!isMember(bee)) {
|
||||
public ItemStack getMemberStack(IIndividual individual, int type) {
|
||||
if (!isMember(individual)) {
|
||||
return null;
|
||||
}
|
||||
IBee bee = (IBee) individual;
|
||||
|
||||
Item beeItem;
|
||||
switch (EnumBeeType.VALUES[type]) {
|
||||
case QUEEN:
|
||||
beeItem = ForestryItem.beeQueenGE.item();
|
||||
beeItem = PluginApiculture.items.beeQueenGE;
|
||||
// ensure a queen is always mated
|
||||
if (bee.getMate() == null) {
|
||||
bee.mate(bee);
|
||||
}
|
||||
break;
|
||||
case PRINCESS:
|
||||
beeItem = ForestryItem.beePrincessGE.item();
|
||||
beeItem = PluginApiculture.items.beePrincessGE;
|
||||
break;
|
||||
case DRONE:
|
||||
beeItem = ForestryItem.beeDroneGE.item();
|
||||
beeItem = PluginApiculture.items.beeDroneGE;
|
||||
break;
|
||||
case LARVAE:
|
||||
beeItem = ForestryItem.beeLarvaeGE.item();
|
||||
beeItem = PluginApiculture.items.beeLarvaeGE;
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException("Cannot instantiate a bee of type " + type);
|
||||
@@ -130,13 +139,15 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
|
||||
return EnumBeeType.NONE;
|
||||
}
|
||||
|
||||
if (ForestryItem.beeDroneGE.isItemEqual(stack)) {
|
||||
Item item = stack.getItem();
|
||||
|
||||
if (PluginApiculture.items.beeDroneGE == item) {
|
||||
return EnumBeeType.DRONE;
|
||||
} else if (ForestryItem.beePrincessGE.isItemEqual(stack)) {
|
||||
} else if (PluginApiculture.items.beePrincessGE == item) {
|
||||
return EnumBeeType.PRINCESS;
|
||||
} else if (ForestryItem.beeQueenGE.isItemEqual(stack)) {
|
||||
} else if (PluginApiculture.items.beeQueenGE == item) {
|
||||
return EnumBeeType.QUEEN;
|
||||
} else if (ForestryItem.beeLarvaeGE.isItemEqual(stack)) {
|
||||
} else if (PluginApiculture.items.beeLarvaeGE == item) {
|
||||
return EnumBeeType.LARVAE;
|
||||
}
|
||||
|
||||
@@ -185,7 +196,8 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
|
||||
/* GENOME CONVERSIONS */
|
||||
@Override
|
||||
public IBeeGenome templateAsGenome(IAllele[] template) {
|
||||
return new BeeGenome(templateAsChromosomes(template));
|
||||
IChromosome[] chromosomes = templateAsChromosomes(template);
|
||||
return new BeeGenome(chromosomes);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -204,7 +216,7 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
|
||||
}
|
||||
|
||||
/* TEMPLATES */
|
||||
private static final ArrayList<IBee> beeTemplates = new ArrayList<IBee>();
|
||||
private static final ArrayList<IBee> beeTemplates = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public ArrayList<IBee> getIndividualTemplates() {
|
||||
@@ -213,7 +225,9 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
|
||||
|
||||
@Override
|
||||
public void registerTemplate(String identifier, IAllele[] template) {
|
||||
beeTemplates.add(new Bee(BeeManager.beeRoot.templateAsGenome(template)));
|
||||
IBeeGenome beeGenome = BeeManager.beeRoot.templateAsGenome(template);
|
||||
IBee bee = new Bee(beeGenome);
|
||||
beeTemplates.add(bee);
|
||||
speciesTemplates.put(identifier, template);
|
||||
}
|
||||
|
||||
@@ -226,7 +240,7 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
|
||||
/**
|
||||
* List of possible mutations on species alleles.
|
||||
*/
|
||||
private static final ArrayList<IBeeMutation> beeMutations = new ArrayList<IBeeMutation>();
|
||||
private static final ArrayList<IBeeMutation> beeMutations = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public Collection<IBeeMutation> getMutations(boolean shuffle) {
|
||||
@@ -252,7 +266,7 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
|
||||
}
|
||||
|
||||
/* BREEDING MODES */
|
||||
private final ArrayList<IBeekeepingMode> beekeepingModes = new ArrayList<IBeekeepingMode>();
|
||||
private final ArrayList<IBeekeepingMode> beekeepingModes = new ArrayList<>();
|
||||
private static IBeekeepingMode activeBeekeepingMode;
|
||||
|
||||
@Override
|
||||
@@ -314,10 +328,13 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
|
||||
|
||||
// Create a tracker if there is none yet.
|
||||
if (tracker == null) {
|
||||
tracker = new ApiaristTracker(filename, player);
|
||||
tracker = new ApiaristTracker(filename);
|
||||
world.setItemData(filename, tracker);
|
||||
}
|
||||
|
||||
tracker.setUsername(player);
|
||||
tracker.setWorld(world);
|
||||
|
||||
return tracker;
|
||||
}
|
||||
|
||||
@@ -326,6 +343,16 @@ public class BeeHelper extends SpeciesRoot implements IBeeRoot {
|
||||
return new BeekeepingLogic(housing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBeeModifier createBeeHousingModifier(IBeeHousing housing) {
|
||||
return new BeeHousingModifier(housing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBeeListener createBeeHousingListener(IBeeHousing housing) {
|
||||
return new BeeHousingListener(housing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChromosomeType[] getKaryotype() {
|
||||
return EnumBeeChromosome.values();
|
||||
|
||||
@@ -21,7 +21,6 @@ import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IBeeMutationCustom;
|
||||
import forestry.api.apiculture.IBeeRoot;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.apiculture.BeeHousingModifier;
|
||||
import forestry.core.genetics.mutations.Mutation;
|
||||
|
||||
public class BeeMutation extends Mutation implements IBeeMutationCustom {
|
||||
@@ -48,7 +47,7 @@ public class BeeMutation extends Mutation implements IBeeMutationCustom {
|
||||
return 0;
|
||||
}
|
||||
|
||||
IBeeModifier beeHousingModifier = new BeeHousingModifier(housing);
|
||||
IBeeModifier beeHousingModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
IBeeModifier beeModeModifier = BeeManager.beeRoot.getBeekeepingMode(world).getBeeModifier();
|
||||
|
||||
processedChance *= beeHousingModifier.getMutationModifier(genome0, genome1, processedChance);
|
||||
|
||||
@@ -8,7 +8,7 @@ import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.core.genetics.alleles.Allele;
|
||||
import forestry.core.genetics.alleles.AlleleHelper;
|
||||
|
||||
public abstract class BeeVariation implements IBeeDefinition {
|
||||
|
||||
@@ -51,7 +51,7 @@ public abstract class BeeVariation implements IBeeDefinition {
|
||||
|
||||
@Override
|
||||
protected void initializeTemplate(IAllele[] template) {
|
||||
Allele.helper.set(template, EnumBeeChromosome.TOLERANT_FLYER, true);
|
||||
AlleleHelper.instance.set(template, EnumBeeChromosome.TOLERANT_FLYER, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,13 +16,13 @@ import java.util.Random;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.DefaultBeeModifier;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IBeekeepingMode;
|
||||
import forestry.apiculture.BeeHousingModifier;
|
||||
|
||||
public class BeekeepingMode implements IBeekeepingMode {
|
||||
|
||||
@@ -53,7 +53,7 @@ public class BeekeepingMode implements IBeekeepingMode {
|
||||
|
||||
@Override
|
||||
public ArrayList<String> getDescription() {
|
||||
ArrayList<String> ret = new ArrayList<String>();
|
||||
ArrayList<String> ret = new ArrayList<>();
|
||||
ret.add("beemode." + name.toLowerCase(Locale.ENGLISH) + ".desc");
|
||||
return ret;
|
||||
}
|
||||
@@ -84,7 +84,7 @@ public class BeekeepingMode implements IBeekeepingMode {
|
||||
return false;
|
||||
}
|
||||
|
||||
IBeeModifier beeModifier = new BeeHousingModifier(housing);
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
return queen.getGeneration() > 96 + rand.nextInt(6) + rand.nextInt(6) &&
|
||||
rand.nextFloat() < 0.02f * beeModifier.getGeneticDecay(queen.getGenome(), 1f);
|
||||
@@ -92,7 +92,7 @@ public class BeekeepingMode implements IBeekeepingMode {
|
||||
|
||||
@Override
|
||||
public boolean isOverworked(IBee queen, IBeeHousing housing) {
|
||||
IBeeModifier beeModifier = new BeeHousingModifier(housing);
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
float productionModifier = beeModifier.getProductionModifier(queen.getGenome(), 1f);
|
||||
if (productionModifier > 16) {
|
||||
@@ -106,7 +106,7 @@ public class BeekeepingMode implements IBeekeepingMode {
|
||||
|
||||
@Override
|
||||
public boolean isDegenerating(IBee queen, IBee offspring, IBeeHousing housing) {
|
||||
IBeeModifier beeModifier = new BeeHousingModifier(housing);
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
|
||||
float mutationModifier = beeModifier.getMutationModifier(queen.getGenome(), queen.getMate(), 1.0f);
|
||||
if (mutationModifier > 10) {
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import forestry.api.apiculture.IBeeIconColourProvider;
|
||||
|
||||
public class DefaultBeeIconColourProvider implements IBeeIconColourProvider {
|
||||
private final int primaryColour;
|
||||
private final int secondaryColour;
|
||||
|
||||
public DefaultBeeIconColourProvider(int primaryColour, int secondaryColour) {
|
||||
this.primaryColour = primaryColour;
|
||||
this.secondaryColour = secondaryColour;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconColour(int renderPass) {
|
||||
if (renderPass == 0) {
|
||||
return primaryColour;
|
||||
}
|
||||
if (renderPass == 1) {
|
||||
return secondaryColour;
|
||||
}
|
||||
return 0xffffff;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IBeeIconProvider;
|
||||
import forestry.core.render.TextureManager;
|
||||
|
||||
public class DefaultBeeIconProvider implements IBeeIconProvider {
|
||||
|
||||
public static final DefaultBeeIconProvider instance = new DefaultBeeIconProvider();
|
||||
|
||||
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];
|
||||
if (beeType == EnumBeeType.NONE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String beeTypeNameBase = beeIconDir + beeType.toString().toLowerCase(Locale.ENGLISH);
|
||||
|
||||
icons[i][0] = TextureManager.registerTex(register, beeTypeNameBase + ".outline");
|
||||
if (beeType == EnumBeeType.LARVAE) {
|
||||
icons[i][1] = TextureManager.registerTex(register, beeTypeNameBase + ".body");
|
||||
} else {
|
||||
icons[i][1] = body1;
|
||||
}
|
||||
icons[i][2] = TextureManager.registerTex(register, beeTypeNameBase + ".body2");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(EnumBeeType type, int renderPass) {
|
||||
return icons[type.ordinal()][renderPass];
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ import forestry.api.apiculture.IHiveDrop;
|
||||
public class HiveDrop implements IHiveDrop {
|
||||
|
||||
private final IBeeDefinition beeTemplate;
|
||||
private final ArrayList<ItemStack> additional = new ArrayList<ItemStack>();
|
||||
private final ArrayList<ItemStack> additional = new ArrayList<>();
|
||||
private final int chance;
|
||||
private float ignobleShare = 0.0f;
|
||||
|
||||
@@ -59,7 +59,7 @@ public class HiveDrop implements IHiveDrop {
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getAdditional(World world, int x, int y, int z, int fortune) {
|
||||
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
ArrayList<ItemStack> ret = new ArrayList<>();
|
||||
for (ItemStack stack : additional) {
|
||||
ret.add(stack.copy());
|
||||
}
|
||||
|
||||
@@ -13,39 +13,19 @@ package forestry.apiculture.genetics;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.core.utils.vect.Vect;
|
||||
import forestry.apiculture.genetics.alleles.AlleleEffect;
|
||||
|
||||
/**
|
||||
* Hermits will not produce if there are any other living creatures nearby.
|
||||
*/
|
||||
public class JubilanceProviderHermit extends JubilanceDefault {
|
||||
|
||||
@Override
|
||||
public boolean isJubilant(IAlleleBeeSpecies species, IBeeGenome genome, IBeeHousing housing) {
|
||||
AxisAlignedBB bounding = getBounding(genome, housing, 1.0f);
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
List list = housing.getWorld().getEntitiesWithinAABB(EntityLiving.class, bounding);
|
||||
List<EntityLiving> list = AlleleEffect.getEntitiesInRange(genome, housing, EntityLiving.class);
|
||||
return list.size() <= 0;
|
||||
}
|
||||
|
||||
private static AxisAlignedBB getBounding(IBeeGenome genome, IBeeHousing housing, float modifier) {
|
||||
int[] areaAr = genome.getTerritory();
|
||||
Vect area = new Vect(areaAr).multiply(modifier);
|
||||
Vect offset = area.multiply(-1 / 2.0f);
|
||||
|
||||
ChunkCoordinates housingCoordinates = housing.getCoordinates();
|
||||
|
||||
Vect min = new Vect(housingCoordinates).add(offset);
|
||||
Vect max = min.add(area);
|
||||
|
||||
return AxisAlignedBB.getBoundingBox(min.x, min.y, min.z, max.x, max.y, max.z);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,7 +13,6 @@ package forestry.apiculture.genetics.alleles;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -27,39 +26,38 @@ import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IAlleleBeeSpeciesCustom;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeIconColourProvider;
|
||||
import forestry.api.apiculture.IBeeIconProvider;
|
||||
import forestry.api.apiculture.IBeeRoot;
|
||||
import forestry.api.apiculture.IJubilanceProvider;
|
||||
import forestry.api.core.IIconProvider;
|
||||
import forestry.api.genetics.IClassification;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.apiculture.genetics.DefaultBeeIconColourProvider;
|
||||
import forestry.apiculture.genetics.DefaultBeeIconProvider;
|
||||
import forestry.apiculture.genetics.JubilanceDefault;
|
||||
import forestry.core.genetics.alleles.AlleleSpecies;
|
||||
import forestry.core.render.TextureManager;
|
||||
import forestry.core.utils.GeneticsUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
|
||||
public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpeciesCustom {
|
||||
private final Map<ItemStack, Float> productChances = new HashMap<ItemStack, Float>();
|
||||
private final Map<ItemStack, Float> specialtyChances = new HashMap<ItemStack, Float>();
|
||||
private final Map<ItemStack, Float> productChances = new HashMap<>();
|
||||
private final Map<ItemStack, Float> specialtyChances = new HashMap<>();
|
||||
|
||||
private final int primaryColour;
|
||||
private final int secondaryColour;
|
||||
|
||||
private IBeeIconProvider beeIconProvider = DefaultBeeIconProvider.instance;
|
||||
private IJubilanceProvider jubilanceProvider = JubilanceDefault.instance;
|
||||
private IBeeIconProvider beeIconProvider;
|
||||
private IBeeIconColourProvider beeIconColourProvider;
|
||||
private IJubilanceProvider jubilanceProvider;
|
||||
private boolean nocturnal = false;
|
||||
|
||||
public AlleleBeeSpecies(String uid, String unlocalizedName, String authority, String unlocalizedDescription, boolean dominant, IClassification branch, String binomial, int primaryColor, int secondaryColor) {
|
||||
super(uid, unlocalizedName, authority, unlocalizedDescription, dominant, branch, binomial, false);
|
||||
super(uid, unlocalizedName, authority, unlocalizedDescription, dominant, branch, binomial);
|
||||
|
||||
this.primaryColour = primaryColor;
|
||||
this.secondaryColour = secondaryColor;
|
||||
beeIconProvider = DefaultBeeIconProvider.instance;
|
||||
beeIconColourProvider = new DefaultBeeIconColourProvider(primaryColor, secondaryColor);
|
||||
jubilanceProvider = JubilanceDefault.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -109,12 +107,13 @@ public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpecies
|
||||
return this;
|
||||
}
|
||||
|
||||
/* RESEARCH */
|
||||
@Override
|
||||
public int getComplexity() {
|
||||
return GeneticsUtil.getResearchComplexity(this, EnumBeeChromosome.SPECIES);
|
||||
public IAlleleBeeSpeciesCustom setCustomBeeIconColourProvider(IBeeIconColourProvider beeIconColourProvider) {
|
||||
this.beeIconColourProvider = beeIconColourProvider;
|
||||
return this;
|
||||
}
|
||||
|
||||
/* RESEARCH */
|
||||
@Override
|
||||
public float getResearchSuitability(ItemStack itemstack) {
|
||||
if (itemstack == null) {
|
||||
@@ -137,7 +136,7 @@ public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpecies
|
||||
|
||||
@Override
|
||||
public ItemStack[] getResearchBounty(World world, GameProfile researcher, IIndividual individual, int bountyLevel) {
|
||||
ArrayList<ItemStack> bounty = new ArrayList<ItemStack>();
|
||||
ArrayList<ItemStack> bounty = new ArrayList<>();
|
||||
Collections.addAll(bounty, super.getResearchBounty(world, researcher, individual, bountyLevel));
|
||||
|
||||
if (bountyLevel > 10) {
|
||||
@@ -185,13 +184,7 @@ public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpecies
|
||||
|
||||
@Override
|
||||
public int getIconColour(int renderPass) {
|
||||
if (renderPass == 0) {
|
||||
return primaryColour;
|
||||
}
|
||||
if (renderPass == 1) {
|
||||
return secondaryColour;
|
||||
}
|
||||
return 0xffffff;
|
||||
return beeIconColourProvider.getIconColour(renderPass);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -199,48 +192,6 @@ public class AlleleBeeSpecies extends AlleleSpecies implements IAlleleBeeSpecies
|
||||
return null;
|
||||
}
|
||||
|
||||
private static class DefaultBeeIconProvider implements IBeeIconProvider {
|
||||
|
||||
public static final DefaultBeeIconProvider instance = new DefaultBeeIconProvider();
|
||||
|
||||
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/";
|
||||
TextureManager textureManager = TextureManager.getInstance();
|
||||
IIcon body1 = textureManager.registerTex(register, beeIconDir + "body1");
|
||||
|
||||
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);
|
||||
|
||||
icons[i][0] = textureManager.registerTex(register, beeTypeNameBase + ".outline");
|
||||
if (beeType == EnumBeeType.LARVAE) {
|
||||
icons[i][1] = textureManager.registerTex(register, beeTypeNameBase + ".body");
|
||||
} else {
|
||||
icons[i][1] = body1;
|
||||
}
|
||||
icons[i][2] = textureManager.registerTex(register, beeTypeNameBase + ".body2");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(EnumBeeType type, int renderPass) {
|
||||
return icons[type.ordinal()][renderPass];
|
||||
}
|
||||
}
|
||||
|
||||
private static class BeeIconProviderWrapper implements IIconProvider {
|
||||
|
||||
private final IBeeIconProvider beeIconProvider;
|
||||
|
||||
@@ -0,0 +1,160 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics.alleles;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.Vec3;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.core.genetics.alleles.AlleleCategorized;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.EntityUtil;
|
||||
import forestry.core.utils.vect.MutableVect;
|
||||
import forestry.core.utils.vect.Vect;
|
||||
|
||||
public abstract class AlleleEffect extends AlleleCategorized implements IAlleleBeeEffect {
|
||||
|
||||
public static IAlleleBeeEffect effectNone;
|
||||
public static IAlleleBeeEffect effectAggressive;
|
||||
public static IAlleleBeeEffect effectHeroic;
|
||||
public static IAlleleBeeEffect effectBeatific;
|
||||
public static IAlleleBeeEffect effectMiasmic;
|
||||
public static IAlleleBeeEffect effectMisanthrope;
|
||||
public static IAlleleBeeEffect effectGlacial;
|
||||
public static IAlleleBeeEffect effectRadioactive;
|
||||
public static IAlleleBeeEffect effectCreeper;
|
||||
public static IAlleleBeeEffect effectIgnition;
|
||||
public static IAlleleBeeEffect effectExploration;
|
||||
public static IAlleleBeeEffect effectFestiveEaster;
|
||||
public static IAlleleBeeEffect effectSnowing;
|
||||
public static IAlleleBeeEffect effectDrunkard;
|
||||
public static IAlleleBeeEffect effectReanimation;
|
||||
public static IAlleleBeeEffect effectResurrection;
|
||||
public static IAlleleBeeEffect effectRepulsion;
|
||||
public static IAlleleBeeEffect effectFertile;
|
||||
public static IAlleleBeeEffect effectMycophilic;
|
||||
|
||||
public static void createAlleles() {
|
||||
List<IAlleleBeeEffect> beeEffects = Arrays.asList(
|
||||
effectNone = new AlleleEffectNone("none", true),
|
||||
effectAggressive = new AlleleEffectAggressive(),
|
||||
effectHeroic = new AlleleEffectHeroic(),
|
||||
effectBeatific = new AlleleEffectPotion("beatific", false, Potion.regeneration, 100),
|
||||
effectMiasmic = new AlleleEffectPotion("miasmic", false, Potion.poison, 600, 100, 0.1f),
|
||||
effectMisanthrope = new AlleleEffectMisanthrope(),
|
||||
effectGlacial = new AlleleEffectGlacial(),
|
||||
effectRadioactive = new AlleleEffectRadioactive(),
|
||||
effectCreeper = new AlleleEffectCreeper(),
|
||||
effectIgnition = new AlleleEffectIgnition(),
|
||||
effectExploration = new AlleleEffectExploration(),
|
||||
effectFestiveEaster = new AlleleEffectNone("festiveEaster", true),
|
||||
effectSnowing = new AlleleEffectSnowing(),
|
||||
effectDrunkard = new AlleleEffectPotion("drunkard", false, Potion.confusion, 100),
|
||||
effectReanimation = new AlleleEffectResurrection("reanimation", AlleleEffectResurrection.getReanimationList()),
|
||||
effectResurrection = new AlleleEffectResurrection("resurrection", AlleleEffectResurrection.getResurrectionList()),
|
||||
effectRepulsion = new AlleleEffectRepulsion(),
|
||||
effectFertile = new AlleleEffectFertile(),
|
||||
effectMycophilic = new AlleleEffectFungification()
|
||||
);
|
||||
|
||||
for (IAlleleBeeEffect beeEffect : beeEffects) {
|
||||
AlleleManager.alleleRegistry.registerAllele(beeEffect, EnumBeeChromosome.EFFECT);
|
||||
}
|
||||
}
|
||||
|
||||
protected AlleleEffect(String valueName, boolean isDominant) {
|
||||
super("forestry", "effect", valueName, isDominant);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCombinable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
return storedData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData doFX(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
Vec3 beeFXCoordinates = getFXCoordinates(housing);
|
||||
Proxies.render.addBeeHiveFX("particles/swarm_bee", housing.getWorld(), beeFXCoordinates.xCoord, beeFXCoordinates.yCoord, beeFXCoordinates.zCoord, genome.getPrimary().getIconColour(0));
|
||||
return storedData;
|
||||
}
|
||||
|
||||
protected Vec3 getFXCoordinates(IBeeHousing housing) {
|
||||
try {
|
||||
return housing.getBeeFXCoordinates();
|
||||
} catch (Throwable error) {
|
||||
// getBeeFXCoordinates() is only newly added to the API, fall back on getCoordinates()
|
||||
ChunkCoordinates coordinates = housing.getCoordinates();
|
||||
return Vec3.createVectorHelper(coordinates.posX + 0.5D, coordinates.posY + 0.5D, coordinates.posZ + 0.5D);
|
||||
}
|
||||
}
|
||||
|
||||
protected Vect getModifiedArea(IBeeGenome genome, IBeeHousing housing) {
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
float territoryModifier = beeModifier.getTerritoryModifier(genome, 1f);
|
||||
|
||||
MutableVect area = new MutableVect(genome.getTerritory());
|
||||
area.multiply(territoryModifier);
|
||||
|
||||
if (area.x < 1) {
|
||||
area.x = 1;
|
||||
}
|
||||
if (area.y < 1) {
|
||||
area.y = 1;
|
||||
}
|
||||
if (area.z < 1) {
|
||||
area.z = 1;
|
||||
}
|
||||
|
||||
return new Vect(area);
|
||||
}
|
||||
|
||||
public static AxisAlignedBB getBounding(IBeeGenome genome, IBeeHousing housing) {
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
float territoryModifier = beeModifier.getTerritoryModifier(genome, 1.0f);
|
||||
|
||||
MutableVect area = new MutableVect(genome.getTerritory());
|
||||
area.multiply(territoryModifier);
|
||||
Vect offset = new Vect(area).multiply(-1 / 2.0f);
|
||||
|
||||
Vect min = new Vect(housing.getCoordinates()).add(offset);
|
||||
Vect max = min.add(area);
|
||||
|
||||
return AxisAlignedBB.getBoundingBox(min.x, min.y, min.z, max.x, max.y, max.z);
|
||||
}
|
||||
|
||||
public static <T extends Entity> List<T> getEntitiesInRange(IBeeGenome genome, IBeeHousing housing, Class<T> entityClass) {
|
||||
AxisAlignedBB boundingBox = getBounding(genome, housing);
|
||||
return EntityUtil.getEntitiesWithinAABB(housing.getWorld(), entityClass, boundingBox);
|
||||
}
|
||||
}
|
||||
@@ -13,8 +13,6 @@ package forestry.apiculture.genetics.alleles;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
@@ -24,7 +22,6 @@ import forestry.api.genetics.IEffectData;
|
||||
import forestry.core.utils.DamageSourceForestry;
|
||||
|
||||
public class AlleleEffectAggressive extends AlleleEffectThrottled {
|
||||
|
||||
private static final DamageSource damageSourceBeeAggressive = new DamageSourceForestry("bee.aggressive");
|
||||
|
||||
public AlleleEffectAggressive() {
|
||||
@@ -33,29 +30,15 @@ public class AlleleEffectAggressive extends AlleleEffectThrottled {
|
||||
|
||||
@Override
|
||||
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
AxisAlignedBB hurtBox = getBounding(genome, housing);
|
||||
@SuppressWarnings("rawtypes")
|
||||
List list = housing.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, hurtBox);
|
||||
|
||||
for (Object obj : list) {
|
||||
EntityLivingBase entity = (EntityLivingBase) obj;
|
||||
|
||||
List<EntityLivingBase> entities = getEntitiesInRange(genome, housing, EntityLivingBase.class);
|
||||
for (EntityLivingBase entity : entities) {
|
||||
int damage = 4;
|
||||
|
||||
// Players are not attacked if they wear a full set of apiarist's
|
||||
// armor.
|
||||
if (entity instanceof EntityPlayer) {
|
||||
int count = BeeManager.armorApiaristHelper.wearsItems((EntityPlayer) entity, getUID(), true);
|
||||
// Full set, no damage/effect
|
||||
if (count > 3) {
|
||||
continue;
|
||||
} else if (count > 2) {
|
||||
damage = 1;
|
||||
} else if (count > 1) {
|
||||
damage = 2;
|
||||
} else if (count > 0) {
|
||||
damage = 3;
|
||||
}
|
||||
// Entities are not attacked if they wear a full set of apiarist's armor.
|
||||
int count = BeeManager.armorApiaristHelper.wearsItems(entity, getUID(), true);
|
||||
damage -= count;
|
||||
if (damage <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
entity.attackEntityFrom(damageSourceBeeAggressive, damage);
|
||||
|
||||
@@ -13,7 +13,6 @@ package forestry.apiculture.genetics.alleles;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -59,24 +58,15 @@ public class AlleleEffectCreeper extends AlleleEffectThrottled {
|
||||
return storedData;
|
||||
}
|
||||
|
||||
AxisAlignedBB infectionBox = getBounding(genome, housing);
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
List list = world.getEntitiesWithinAABB(EntityPlayer.class, infectionBox);
|
||||
|
||||
for (Object obj : list) {
|
||||
|
||||
EntityPlayer player = (EntityPlayer) obj;
|
||||
|
||||
List<EntityPlayer> players = getEntitiesInRange(genome, housing, EntityPlayer.class);
|
||||
for (EntityPlayer player : players) {
|
||||
int chance = explosionChance;
|
||||
storedData.setInteger(indexExplosionForce, defaultForce);
|
||||
|
||||
// Players are not attacked if they wear a full set of apiarist's
|
||||
// armor.
|
||||
// Entities are not attacked if they wear a full set of apiarist's armor.
|
||||
int count = BeeManager.armorApiaristHelper.wearsItems(player, getUID(), true);
|
||||
// Full set, no damage/effect
|
||||
if (count > 3) {
|
||||
continue;
|
||||
continue; // Full set, no damage/effect
|
||||
} else if (count > 2) {
|
||||
chance = 5;
|
||||
storedData.setInteger(indexExplosionForce, 6);
|
||||
@@ -94,8 +84,7 @@ public class AlleleEffectCreeper extends AlleleEffectThrottled {
|
||||
|
||||
world.playSoundEffect(housingCoords.posX, housingCoords.posY, housingCoords.posZ, "mob.creeper", 4F,
|
||||
(1.0F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.2F) * 0.7F);
|
||||
storedData.setInteger(indexExplosionTimer, 2); // Set explosion
|
||||
// timer
|
||||
storedData.setInteger(indexExplosionTimer, 2); // Set explosion timer
|
||||
}
|
||||
|
||||
return storedData;
|
||||
|
||||
@@ -13,7 +13,6 @@ package forestry.apiculture.genetics.alleles;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
@@ -27,13 +26,8 @@ public class AlleleEffectExploration extends AlleleEffectThrottled {
|
||||
|
||||
@Override
|
||||
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
|
||||
AxisAlignedBB beatifyBox = getBounding(genome, housing);
|
||||
@SuppressWarnings("rawtypes")
|
||||
List list = housing.getWorld().getEntitiesWithinAABB(EntityPlayer.class, beatifyBox);
|
||||
|
||||
for (Object obj : list) {
|
||||
EntityPlayer player = (EntityPlayer) obj;
|
||||
List<EntityPlayer> players = getEntitiesInRange(genome, housing, EntityPlayer.class);
|
||||
for (EntityPlayer player : players) {
|
||||
player.addExperience(2);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,9 +13,12 @@ package forestry.apiculture.genetics.alleles;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.IGrowable;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.IPlantable;
|
||||
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
@@ -58,8 +61,8 @@ public class AlleleEffectFertile extends AlleleEffectThrottled {
|
||||
|
||||
private static boolean tryTickColumn(World world, int x, int z, int maxY, int minY) {
|
||||
for (int y = maxY; y >= minY; --y) {
|
||||
if (!world.isAirBlock(x, y, z)) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (block.getTickRandomly() && (block instanceof IGrowable || block instanceof IPlantable)) {
|
||||
world.scheduleBlockUpdate(x, y, z, block, 5);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.passive.EntityCow;
|
||||
import net.minecraft.entity.passive.EntityMooshroom;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenBigMushroom;
|
||||
@@ -78,16 +77,10 @@ public class AlleleEffectFungification extends AlleleEffectThrottled {
|
||||
|
||||
}
|
||||
|
||||
private void doEntityEffect(IBeeGenome genome, IBeeHousing housing) {
|
||||
AxisAlignedBB aabb = this.getBounding(genome, housing);
|
||||
World world = housing.getWorld();
|
||||
|
||||
List entities = world.getEntitiesWithinAABB(EntityCow.class, aabb);
|
||||
for (Object entity : entities) {
|
||||
if (entity instanceof EntityCow && !(entity instanceof EntityMooshroom)) {
|
||||
convertCowToMooshroom((EntityCow) entity);
|
||||
break;
|
||||
}
|
||||
private static void doEntityEffect(IBeeGenome genome, IBeeHousing housing) {
|
||||
List<EntityCow> cows = getEntitiesInRange(genome, housing, EntityCow.class);
|
||||
for (EntityCow cow : cows) {
|
||||
convertCowToMooshroom(cow);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,6 +97,9 @@ public class AlleleEffectFungification extends AlleleEffectThrottled {
|
||||
}
|
||||
|
||||
private static void convertCowToMooshroom(EntityCow cow) {
|
||||
if (cow instanceof EntityMooshroom) {
|
||||
return;
|
||||
}
|
||||
World worldObj = cow.worldObj;
|
||||
cow.setDead();
|
||||
EntityMooshroom mooshroom = new EntityMooshroom(worldObj);
|
||||
|
||||
@@ -18,7 +18,7 @@ import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.utils.vect.Vect;
|
||||
|
||||
public class AlleleEffectGlacial extends AlleleEffectThrottled {
|
||||
@@ -61,7 +61,7 @@ public class AlleleEffectGlacial extends AlleleEffectThrottled {
|
||||
continue;
|
||||
}
|
||||
|
||||
Proxies.common.setBlockWithNotify(world, posBlock.x, posBlock.y, posBlock.z, Blocks.ice);
|
||||
world.setBlock(posBlock.x, posBlock.y, posBlock.z, Blocks.ice, 0, Constants.FLAG_BLOCK_SYNCH_AND_UPDATE);
|
||||
}
|
||||
|
||||
return storedData;
|
||||
|
||||
@@ -13,14 +13,15 @@ package forestry.apiculture.genetics.alleles;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.core.utils.DamageSourceForestry;
|
||||
|
||||
public class AlleleEffectHeroic extends AlleleEffectThrottled {
|
||||
private static final DamageSource damageSourceBeeHeroic = new DamageSourceForestry("bee.heroic");
|
||||
|
||||
public AlleleEffectHeroic() {
|
||||
super("heroic", false, 40, true, false);
|
||||
@@ -28,16 +29,11 @@ public class AlleleEffectHeroic extends AlleleEffectThrottled {
|
||||
|
||||
@Override
|
||||
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
AxisAlignedBB hurtBox = getBounding(genome, housing);
|
||||
@SuppressWarnings("rawtypes")
|
||||
List list = housing.getWorld().getEntitiesWithinAABB(EntityMob.class, hurtBox);
|
||||
|
||||
for (Object obj : list) {
|
||||
EntityMob mob = (EntityMob) obj;
|
||||
mob.attackEntityFrom(DamageSource.generic, 2);
|
||||
List<EntityMob> mobs = getEntitiesInRange(genome, housing, EntityMob.class);
|
||||
for (EntityMob mob : mobs) {
|
||||
mob.attackEntityFrom(damageSourceBeeHeroic, 2);
|
||||
}
|
||||
|
||||
return storedData;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,8 +13,7 @@ package forestry.apiculture.genetics.alleles;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
@@ -24,7 +23,6 @@ import forestry.api.genetics.IEffectData;
|
||||
import forestry.core.proxy.Proxies;
|
||||
|
||||
public class AlleleEffectIgnition extends AlleleEffectThrottled {
|
||||
|
||||
private static final int ignitionChance = 50;
|
||||
private static final int fireDuration = 500;
|
||||
|
||||
@@ -34,35 +32,25 @@ public class AlleleEffectIgnition extends AlleleEffectThrottled {
|
||||
|
||||
@Override
|
||||
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
|
||||
World world = housing.getWorld();
|
||||
|
||||
AxisAlignedBB hurtBox = getBounding(genome, housing);
|
||||
@SuppressWarnings("rawtypes")
|
||||
List list = world.getEntitiesWithinAABB(EntityLivingBase.class, hurtBox);
|
||||
|
||||
for (Object obj : list) {
|
||||
EntityLivingBase entity = (EntityLivingBase) obj;
|
||||
|
||||
List<EntityLivingBase> entities = getEntitiesInRange(genome, housing, EntityLivingBase.class);
|
||||
for (EntityLivingBase entity : entities) {
|
||||
int chance = ignitionChance;
|
||||
int duration = fireDuration;
|
||||
|
||||
// Players are not attacked if they wear a full set of apiarist's armor.
|
||||
if (entity instanceof EntityPlayer) {
|
||||
int count = BeeManager.armorApiaristHelper.wearsItems((EntityPlayer) entity, getUID(), true);
|
||||
// Full set, no damage/effect
|
||||
if (count > 3) {
|
||||
continue;
|
||||
} else if (count > 2) {
|
||||
chance = 5;
|
||||
duration = 50;
|
||||
} else if (count > 1) {
|
||||
chance = 20;
|
||||
duration = 200;
|
||||
} else if (count > 0) {
|
||||
chance = 35;
|
||||
duration = 350;
|
||||
}
|
||||
// Entities are not attacked if they wear a full set of apiarist's armor.
|
||||
int count = BeeManager.armorApiaristHelper.wearsItems(entity, getUID(), true);
|
||||
if (count > 3) {
|
||||
continue; // Full set, no damage/effect
|
||||
} else if (count > 2) {
|
||||
chance = 5;
|
||||
duration = 50;
|
||||
} else if (count > 1) {
|
||||
chance = 20;
|
||||
duration = 200;
|
||||
} else if (count > 0) {
|
||||
chance = 35;
|
||||
duration = 350;
|
||||
}
|
||||
|
||||
if (world.rand.nextInt(1000) >= chance) {
|
||||
@@ -80,7 +68,8 @@ public class AlleleEffectIgnition extends AlleleEffectThrottled {
|
||||
if (housing.getWorld().rand.nextInt(2) != 0) {
|
||||
super.doFX(genome, storedData, housing);
|
||||
} else {
|
||||
Proxies.common.addEntityIgnitionFX(housing.getWorld(), housing.getCoordinates().posX + 0.5, housing.getCoordinates().posY + 1, housing.getCoordinates().posZ + 0.5);
|
||||
Vec3 beeFXCoordinates = getFXCoordinates(housing);
|
||||
Proxies.render.addEntityIgnitionFX(housing.getWorld(), beeFXCoordinates.xCoord, beeFXCoordinates.yCoord + 0.5, beeFXCoordinates.zCoord);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ package forestry.apiculture.genetics.alleles;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
@@ -32,28 +31,15 @@ public class AlleleEffectMisanthrope extends AlleleEffectThrottled {
|
||||
|
||||
@Override
|
||||
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
|
||||
AxisAlignedBB beatifyBox = getBounding(genome, housing);
|
||||
@SuppressWarnings("rawtypes")
|
||||
List list = housing.getWorld().getEntitiesWithinAABB(EntityPlayer.class, beatifyBox);
|
||||
|
||||
for (Object obj : list) {
|
||||
EntityPlayer player = (EntityPlayer) obj;
|
||||
|
||||
List<EntityPlayer> players = getEntitiesInRange(genome, housing, EntityPlayer.class);
|
||||
for (EntityPlayer player : players) {
|
||||
int damage = 4;
|
||||
|
||||
// Players are not attacked if they wear a full set of apiarist's
|
||||
// armor.
|
||||
// Entities are not attacked if they wear a full set of apiarist's armor.
|
||||
int count = BeeManager.armorApiaristHelper.wearsItems(player, getUID(), true);
|
||||
// Full set, no damage/effect
|
||||
if (count > 3) {
|
||||
damage -= count;
|
||||
if (damage <= 0) {
|
||||
continue;
|
||||
} else if (count > 2) {
|
||||
damage = 1;
|
||||
} else if (count > 1) {
|
||||
damage = 2;
|
||||
} else if (count > 0) {
|
||||
damage = 3;
|
||||
}
|
||||
|
||||
player.attackEntityFrom(damageSourceBeeEnd, damage);
|
||||
|
||||
@@ -1,87 +1,17 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics.alleles;
|
||||
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.apiculture.BeeHousingModifier;
|
||||
import forestry.core.genetics.alleles.AlleleCategorized;
|
||||
import forestry.core.utils.vect.MutableVect;
|
||||
import forestry.core.utils.vect.Vect;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class AlleleEffectNone extends AlleleCategorized implements IAlleleBeeEffect {
|
||||
|
||||
public AlleleEffectNone(String valueName, boolean isDominant) {
|
||||
super("forestry", "effect", valueName, isDominant);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData validateStorage(IEffectData storedData) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCombinable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
return storedData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEffectData doFX(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
PluginApiculture.proxy.addBeeHiveFX("particles/swarm_bee", housing.getWorld(), housing.getCoordinates(), genome.getPrimary().getIconColour(0));
|
||||
return storedData;
|
||||
}
|
||||
|
||||
protected Vect getModifiedArea(IBeeGenome genome, IBeeHousing housing) {
|
||||
IBeeModifier beeModifier = new BeeHousingModifier(housing);
|
||||
float territoryModifier = beeModifier.getTerritoryModifier(genome, 1f);
|
||||
|
||||
MutableVect area = new MutableVect(genome.getTerritory());
|
||||
area.multiply(territoryModifier);
|
||||
|
||||
if (area.x < 1) {
|
||||
area.x = 1;
|
||||
}
|
||||
if (area.y < 1) {
|
||||
area.y = 1;
|
||||
}
|
||||
if (area.z < 1) {
|
||||
area.z = 1;
|
||||
}
|
||||
|
||||
return new Vect(area);
|
||||
}
|
||||
|
||||
protected AxisAlignedBB getBounding(IBeeGenome genome, IBeeHousing housing) {
|
||||
IBeeModifier beeModifier = new BeeHousingModifier(housing);
|
||||
float territoryModifier = beeModifier.getTerritoryModifier(genome, 1.0f);
|
||||
|
||||
MutableVect area = new MutableVect(genome.getTerritory());
|
||||
area.multiply(territoryModifier);
|
||||
Vect offset = new Vect(area).multiply(-1 / 2.0f);
|
||||
|
||||
Vect min = new Vect(housing.getCoordinates()).add(offset);
|
||||
Vect max = min.add(area);
|
||||
|
||||
return AxisAlignedBB.getBoundingBox(min.x, min.y, min.z, max.x, max.y, max.z);
|
||||
}
|
||||
|
||||
}
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics.alleles;
|
||||
|
||||
public class AlleleEffectNone extends AlleleEffect {
|
||||
public AlleleEffectNone(String valueName, boolean isDominant) {
|
||||
super(valueName, isDominant);
|
||||
}
|
||||
}
|
||||
@@ -14,12 +14,12 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.monster.IMob;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.potion.PotionHelper;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
@@ -56,26 +56,17 @@ public class AlleleEffectPotion extends AlleleEffectThrottled {
|
||||
|
||||
@Override
|
||||
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
|
||||
World world = housing.getWorld();
|
||||
AxisAlignedBB effectArea = getBounding(genome, housing);
|
||||
List list = housing.getWorld().getEntitiesWithinAABB(EntityPlayer.class, effectArea);
|
||||
|
||||
for (Object entity : list) {
|
||||
if (!(entity instanceof EntityPlayer)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
List<EntityLivingBase> entities = getEntitiesInRange(genome, housing, EntityLivingBase.class);
|
||||
for (EntityLivingBase entity : entities) {
|
||||
if (world.rand.nextFloat() >= chance) {
|
||||
continue;
|
||||
}
|
||||
|
||||
EntityPlayer player = (EntityPlayer) entity;
|
||||
|
||||
int dur = this.duration;
|
||||
if (isBadEffect) {
|
||||
// Players are not attacked if they wear a full set of apiarist's armor.
|
||||
int count = BeeManager.armorApiaristHelper.wearsItems((EntityPlayer) entity, getUID(), true);
|
||||
// Entities are not attacked if they wear a full set of apiarist's armor.
|
||||
int count = BeeManager.armorApiaristHelper.wearsItems(entity, getUID(), true);
|
||||
if (count >= 4) {
|
||||
continue; // Full set, no damage/effect
|
||||
} else if (count == 3) {
|
||||
@@ -85,9 +76,14 @@ public class AlleleEffectPotion extends AlleleEffectThrottled {
|
||||
} else if (count == 1) {
|
||||
dur = this.duration * 3 / 4;
|
||||
}
|
||||
} else {
|
||||
// don't apply positive effects to mobs
|
||||
if (entity instanceof IMob) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
player.addPotionEffect(new PotionEffect(potion.getId(), dur, 0));
|
||||
entity.addPotionEffect(new PotionEffect(potion.getId(), dur, 0));
|
||||
}
|
||||
|
||||
return storedData;
|
||||
@@ -108,8 +104,8 @@ public class AlleleEffectPotion extends AlleleEffectThrottled {
|
||||
if (housing.getWorld().rand.nextBoolean()) {
|
||||
super.doFX(genome, storedData, housing);
|
||||
} else {
|
||||
ChunkCoordinates coords = housing.getCoordinates();
|
||||
Proxies.common.addEntityPotionFX(housing.getWorld(), coords.posX + 0.5, coords.posY + 1, coords.posZ + 0.5, potionFXColor);
|
||||
Vec3 beeFXCoordinates = getFXCoordinates(housing);
|
||||
Proxies.render.addEntityPotionFX(housing.getWorld(), beeFXCoordinates.xCoord, beeFXCoordinates.yCoord + 0.5, beeFXCoordinates.zCoord, potionFXColor);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
|
||||
@@ -15,9 +15,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.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -26,7 +24,6 @@ import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.apiculture.blocks.BlockAlveary;
|
||||
import forestry.apiculture.multiblock.TileAlveary;
|
||||
import forestry.core.utils.DamageSourceForestry;
|
||||
import forestry.core.utils.vect.Vect;
|
||||
|
||||
@@ -40,54 +37,38 @@ public class AlleleEffectRadioactive extends AlleleEffectThrottled {
|
||||
|
||||
@Override
|
||||
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
harmEntities(genome, housing);
|
||||
|
||||
return destroyEnvironment(genome, storedData, housing);
|
||||
}
|
||||
|
||||
private void harmEntities(IBeeGenome genome, IBeeHousing housing) {
|
||||
List<EntityLivingBase> entities = getEntitiesInRange(genome, housing, EntityLivingBase.class);
|
||||
for (EntityLivingBase entity : entities) {
|
||||
int damage = 8;
|
||||
|
||||
// Entities are not attacked if they wear a full set of apiarist's armor.
|
||||
int count = BeeManager.armorApiaristHelper.wearsItems(entity, getUID(), true);
|
||||
damage -= count;
|
||||
if (damage <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
entity.attackEntityFrom(damageSourceBeeRadioactive, damage);
|
||||
}
|
||||
}
|
||||
|
||||
private static IEffectData destroyEnvironment(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
World world = housing.getWorld();
|
||||
Random rand = world.rand;
|
||||
|
||||
int[] areaAr = genome.getTerritory();
|
||||
Vect area = new Vect(areaAr).multiply(2);
|
||||
Vect offset = area.multiply(-1 / 2.0f);
|
||||
Vect posHousing = new Vect(housing.getCoordinates());
|
||||
|
||||
// Radioactivity hurts players and mobs
|
||||
Vect min = new Vect(housing.getCoordinates()).add(offset);
|
||||
Vect max = min.add(area);
|
||||
|
||||
AxisAlignedBB hurtBox = AxisAlignedBB.getBoundingBox(min.x, min.y, min.z, max.x, max.y, max.z);
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
List list = housing.getWorld().getEntitiesWithinAABB(EntityLivingBase.class, hurtBox);
|
||||
|
||||
for (Object obj : list) {
|
||||
EntityLivingBase entity = (EntityLivingBase) obj;
|
||||
|
||||
int damage = 8;
|
||||
|
||||
// Players are not attacked if they wear a full set of apiarist's
|
||||
// armor.
|
||||
if (entity instanceof EntityPlayer) {
|
||||
int count = BeeManager.armorApiaristHelper.wearsItems((EntityPlayer) entity, getUID(), true);
|
||||
// Full set, no damage/effect
|
||||
if (count > 3) {
|
||||
continue;
|
||||
} else if (count > 2) {
|
||||
damage = 1;
|
||||
} else if (count > 1) {
|
||||
damage = 2;
|
||||
} else if (count > 0) {
|
||||
damage = 3;
|
||||
}
|
||||
}
|
||||
|
||||
entity.attackEntityFrom(damageSourceBeeRadioactive, damage);
|
||||
|
||||
}
|
||||
|
||||
Random rand = housing.getWorld().rand;
|
||||
// Radioactivity destroys environment
|
||||
for (int i = 0; i < 20; i++) {
|
||||
|
||||
Vect randomPos = Vect.getRandomPositionInArea(rand, area);
|
||||
|
||||
Vect posHousing = new Vect(housing.getCoordinates());
|
||||
Vect posBlock = randomPos.add(posHousing);
|
||||
posBlock = posBlock.add(offset);
|
||||
|
||||
@@ -114,9 +95,6 @@ public class AlleleEffectRadioactive extends AlleleEffectThrottled {
|
||||
if (tile instanceof IBeeHousing) {
|
||||
continue;
|
||||
}
|
||||
if (tile instanceof TileAlveary) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (block.getBlockHardness(world, posBlock.x, posBlock.y, posBlock.z) < 0) {
|
||||
continue;
|
||||
|
||||
@@ -14,7 +14,6 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.entity.ai.EntityAITasks.EntityAITaskEntry;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
@@ -29,31 +28,24 @@ public class AlleleEffectRepulsion extends AlleleEffectThrottled {
|
||||
|
||||
@Override
|
||||
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
|
||||
if (housing.getOwner() == null) {
|
||||
return storedData;
|
||||
}
|
||||
|
||||
AxisAlignedBB hurtBox = getBounding(genome, housing);
|
||||
@SuppressWarnings("rawtypes")
|
||||
List list = housing.getWorld().getEntitiesWithinAABB(EntityMob.class, hurtBox);
|
||||
|
||||
for (Object obj : list) {
|
||||
EntityMob mob = (EntityMob) obj;
|
||||
|
||||
for (Object objT : mob.tasks.taskEntries) {
|
||||
EntityAITaskEntry task = (EntityAITaskEntry) objT;
|
||||
if (task.action instanceof AIAvoidPlayers) {
|
||||
return storedData;
|
||||
}
|
||||
List<EntityMob> mobs = getEntitiesInRange(genome, housing, EntityMob.class);
|
||||
for (EntityMob mob : mobs) {
|
||||
if (!isMobAvoidingPlayers(mob)) {
|
||||
mob.tasks.addTask(3, new AIAvoidPlayers(mob, 6.0f, 0.25f, 0.3f));
|
||||
mob.tasks.onUpdateTasks();
|
||||
}
|
||||
|
||||
mob.tasks.addTask(3, new AIAvoidPlayers(mob, 6.0f, 0.25f, 0.3f));
|
||||
mob.tasks.onUpdateTasks();
|
||||
|
||||
}
|
||||
|
||||
return storedData;
|
||||
}
|
||||
|
||||
private boolean isMobAvoidingPlayers(EntityMob mob) {
|
||||
for (Object objT : mob.tasks.taskEntries) {
|
||||
EntityAITaskEntry task = (EntityAITaskEntry) objT;
|
||||
if (task.action instanceof AIAvoidPlayers) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,6 @@ import net.minecraft.entity.monster.EntityZombie;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
@@ -49,7 +48,7 @@ public class AlleleEffectResurrection extends AlleleEffectThrottled {
|
||||
}
|
||||
|
||||
public static List<Resurrectable> getReanimationList() {
|
||||
ArrayList<Resurrectable> list = new ArrayList<Resurrectable>();
|
||||
ArrayList<Resurrectable> list = new ArrayList<>();
|
||||
list.add(new Resurrectable(new ItemStack(Items.bone), EntitySkeleton.class));
|
||||
list.add(new Resurrectable(new ItemStack(Items.arrow), EntitySkeleton.class));
|
||||
list.add(new Resurrectable(new ItemStack(Items.rotten_flesh), EntityZombie.class));
|
||||
@@ -58,7 +57,7 @@ public class AlleleEffectResurrection extends AlleleEffectThrottled {
|
||||
}
|
||||
|
||||
public static List<Resurrectable> getResurrectionList() {
|
||||
ArrayList<Resurrectable> list = new ArrayList<Resurrectable>();
|
||||
ArrayList<Resurrectable> list = new ArrayList<>();
|
||||
list.add(new Resurrectable(new ItemStack(Items.gunpowder), EntityCreeper.class));
|
||||
list.add(new Resurrectable(new ItemStack(Items.ender_pearl), EntityEnderman.class));
|
||||
list.add(new Resurrectable(new ItemStack(Items.string), EntitySpider.class));
|
||||
@@ -79,35 +78,37 @@ public class AlleleEffectResurrection extends AlleleEffectThrottled {
|
||||
|
||||
@Override
|
||||
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
|
||||
AxisAlignedBB bounding = getBounding(genome, housing);
|
||||
@SuppressWarnings("rawtypes")
|
||||
List list = housing.getWorld().getEntitiesWithinAABB(EntityItem.class, bounding);
|
||||
|
||||
if (list.size() > 0) {
|
||||
Collections.shuffle(resurrectables);
|
||||
List<EntityItem> entities = getEntitiesInRange(genome, housing, EntityItem.class);
|
||||
if (entities.size() == 0) {
|
||||
return storedData;
|
||||
}
|
||||
|
||||
for (Object obj : list) {
|
||||
EntityItem item = (EntityItem) obj;
|
||||
if (item.isDead) {
|
||||
continue;
|
||||
}
|
||||
Collections.shuffle(resurrectables);
|
||||
|
||||
ItemStack contained = item.getEntityItem();
|
||||
for (Resurrectable entry : resurrectables) {
|
||||
if (ItemStackUtil.isIdenticalItem(entry.res, contained)) {
|
||||
EntityUtil.spawnEntity(housing.getWorld(), entry.risen, item.posX, item.posY, item.posZ);
|
||||
contained.stackSize--;
|
||||
if (contained.stackSize <= 0) {
|
||||
item.setDead();
|
||||
}
|
||||
break;
|
||||
}
|
||||
for (EntityItem entity : entities) {
|
||||
if (resurrectEntity(entity)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return storedData;
|
||||
}
|
||||
|
||||
private boolean resurrectEntity(EntityItem entity) {
|
||||
if (entity.isDead) {
|
||||
return false;
|
||||
}
|
||||
ItemStack contained = entity.getEntityItem();
|
||||
for (Resurrectable entry : resurrectables) {
|
||||
if (ItemStackUtil.isIdenticalItem(entry.res, contained)) {
|
||||
EntityUtil.spawnEntity(entity.worldObj, entry.risen, entity.posX, entity.posY, entity.posZ);
|
||||
contained.stackSize--;
|
||||
if (contained.stackSize <= 0) {
|
||||
entity.setDead();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -69,7 +69,7 @@ public class AlleleEffectSnowing extends AlleleEffectThrottled {
|
||||
world.setBlockMetadataWithNotify(posBlock.x, posBlock.y, posBlock.z, meta + 1, Constants.FLAG_BLOCK_SYNCH_AND_UPDATE);
|
||||
}
|
||||
} else if (block.isReplaceable(world, posBlock.x, posBlock.y, posBlock.z)) {
|
||||
Proxies.common.setBlockWithNotify(world, posBlock.x, posBlock.y, posBlock.z, Blocks.snow_layer);
|
||||
world.setBlock(posBlock.x, posBlock.y, posBlock.z, Blocks.snow_layer, 0, Constants.FLAG_BLOCK_SYNCH_AND_UPDATE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ public class AlleleEffectSnowing extends AlleleEffectThrottled {
|
||||
World world = housing.getWorld();
|
||||
|
||||
Vect spawn = Vect.getRandomPositionInArea(world.rand, area).add(coordinates).add(offset);
|
||||
Proxies.common.addEntitySnowFX(world, spawn.x, spawn.y, spawn.z);
|
||||
Proxies.render.addEntitySnowFX(world, spawn.x, spawn.y, spawn.z);
|
||||
return storedData;
|
||||
} else {
|
||||
return super.doFX(genome, storedData, housing);
|
||||
|
||||
@@ -15,7 +15,7 @@ import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.core.genetics.EffectData;
|
||||
|
||||
public abstract class AlleleEffectThrottled extends AlleleEffectNone {
|
||||
public abstract class AlleleEffectThrottled extends AlleleEffect {
|
||||
|
||||
private boolean isCombinable = false;
|
||||
private final int throttle;
|
||||
|
||||
@@ -12,32 +12,15 @@ package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import forestry.apiculture.BeeHousingInventory;
|
||||
import forestry.apiculture.multiblock.TileAlvearyPlain;
|
||||
import forestry.apiculture.multiblock.TileAlveary;
|
||||
import forestry.core.gui.ContainerTile;
|
||||
import forestry.core.gui.slots.SlotFiltered;
|
||||
import forestry.core.gui.slots.SlotOutput;
|
||||
import forestry.core.network.PacketGuiUpdate;
|
||||
import forestry.core.network.packets.PacketGuiUpdate;
|
||||
|
||||
public class ContainerAlveary extends ContainerTile<TileAlvearyPlain> {
|
||||
public class ContainerAlveary extends ContainerTile<TileAlveary> {
|
||||
|
||||
public ContainerAlveary(InventoryPlayer player, TileAlvearyPlain tile) {
|
||||
public ContainerAlveary(InventoryPlayer player, TileAlveary tile) {
|
||||
super(tile, player, 8, 108);
|
||||
|
||||
// Queen/Princess
|
||||
this.addSlotToContainer(new SlotFiltered(tile, BeeHousingInventory.SLOT_QUEEN, 29, 39));
|
||||
|
||||
// Drone
|
||||
this.addSlotToContainer(new SlotFiltered(tile, BeeHousingInventory.SLOT_DRONE, 29, 65));
|
||||
|
||||
// Product Inventory
|
||||
this.addSlotToContainer(new SlotOutput(tile, 2, 116, 52));
|
||||
this.addSlotToContainer(new SlotOutput(tile, 3, 137, 39));
|
||||
this.addSlotToContainer(new SlotOutput(tile, 4, 137, 65));
|
||||
this.addSlotToContainer(new SlotOutput(tile, 5, 116, 78));
|
||||
this.addSlotToContainer(new SlotOutput(tile, 6, 95, 65));
|
||||
this.addSlotToContainer(new SlotOutput(tile, 7, 95, 39));
|
||||
this.addSlotToContainer(new SlotOutput(tile, 8, 116, 26));
|
||||
ContainerBeeHelper.addSlots(this, tile, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,6 +12,7 @@ package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import forestry.apiculture.inventory.InventoryHygroregulator;
|
||||
import forestry.apiculture.multiblock.TileAlvearyHygroregulator;
|
||||
import forestry.core.gui.ContainerLiquidTanks;
|
||||
import forestry.core.gui.slots.SlotFiltered;
|
||||
@@ -21,7 +22,7 @@ public class ContainerAlvearyHygroregulator extends ContainerLiquidTanks<TileAlv
|
||||
public ContainerAlvearyHygroregulator(InventoryPlayer playerInventory, TileAlvearyHygroregulator tile) {
|
||||
super(tile, playerInventory, 8, 84);
|
||||
|
||||
this.addSlotToContainer(new SlotFiltered(tile, TileAlvearyHygroregulator.HygroInventory.SLOT_INPUT, 56, 38));
|
||||
this.addSlotToContainer(new SlotFiltered(tile, InventoryHygroregulator.SLOT_INPUT, 56, 38));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,21 +12,25 @@ package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import forestry.apiculture.inventory.InventoryAlvearySieve;
|
||||
import forestry.apiculture.multiblock.TileAlvearySieve;
|
||||
import forestry.core.gui.ContainerTile;
|
||||
import forestry.core.gui.slots.SlotFiltered;
|
||||
import forestry.core.gui.slots.SlotOutput;
|
||||
import forestry.core.inventory.watchers.ISlotPickupWatcher;
|
||||
|
||||
public class ContainerAlvearySieve extends ContainerTile<TileAlvearySieve> {
|
||||
|
||||
public ContainerAlvearySieve(InventoryPlayer player, TileAlvearySieve tile) {
|
||||
super(tile, player, 8, 87);
|
||||
|
||||
addSlotToContainer(new SlotOutput(tile, 0, 94, 52).setCrafter(tile));
|
||||
addSlotToContainer(new SlotOutput(tile, 1, 115, 39).setCrafter(tile));
|
||||
addSlotToContainer(new SlotOutput(tile, 2, 73, 39).setCrafter(tile));
|
||||
addSlotToContainer(new SlotOutput(tile, 3, 94, 26).setCrafter(tile));
|
||||
ISlotPickupWatcher crafter = tile.getCrafter();
|
||||
|
||||
addSlotToContainer(new SlotFiltered(tile, TileAlvearySieve.AlvearySieveInventory.SLOT_SIEVE, 43, 39).setCrafter(tile));
|
||||
addSlotToContainer(new SlotOutput(tile, 0, 94, 52).setPickupWatcher(crafter));
|
||||
addSlotToContainer(new SlotOutput(tile, 1, 115, 39).setPickupWatcher(crafter));
|
||||
addSlotToContainer(new SlotOutput(tile, 2, 73, 39).setPickupWatcher(crafter));
|
||||
addSlotToContainer(new SlotOutput(tile, 3, 94, 26).setPickupWatcher(crafter));
|
||||
|
||||
addSlotToContainer(new SlotFiltered(tile, InventoryAlvearySieve.SLOT_SIEVE, 43, 39).setPickupWatcher(crafter));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
import forestry.apiculture.InventoryBeeHousing;
|
||||
import forestry.apiculture.inventory.InventoryApiary;
|
||||
import forestry.core.gui.ContainerForestry;
|
||||
import forestry.core.gui.slots.SlotFiltered;
|
||||
import forestry.core.gui.slots.SlotOutput;
|
||||
import forestry.core.tiles.IFilterSlotDelegate;
|
||||
|
||||
public abstract class ContainerBeeHelper {
|
||||
public static <T extends IInventory & IFilterSlotDelegate> void addSlots(ContainerForestry container, T inventory, boolean hasFrames) {
|
||||
// Queen/Princess
|
||||
container.addSlotToContainer(new SlotFiltered(inventory, InventoryBeeHousing.SLOT_QUEEN, 29, 39));
|
||||
|
||||
// Drone
|
||||
container.addSlotToContainer(new SlotFiltered(inventory, InventoryBeeHousing.SLOT_DRONE, 29, 65));
|
||||
|
||||
// Frames
|
||||
if (hasFrames) {
|
||||
int slotFrames = InventoryApiary.SLOT_FRAMES_1;
|
||||
container.addSlotToContainer(new SlotFiltered(inventory, slotFrames++, 66, 23));
|
||||
container.addSlotToContainer(new SlotFiltered(inventory, slotFrames++, 66, 52));
|
||||
container.addSlotToContainer(new SlotFiltered(inventory, slotFrames, 66, 81));
|
||||
}
|
||||
|
||||
// Product Inventory
|
||||
int slotProduct = InventoryBeeHousing.SLOT_PRODUCT_1;
|
||||
container.addSlotToContainer(new SlotOutput(inventory, slotProduct++, 116, 52));
|
||||
container.addSlotToContainer(new SlotOutput(inventory, slotProduct++, 137, 39));
|
||||
container.addSlotToContainer(new SlotOutput(inventory, slotProduct++, 137, 65));
|
||||
container.addSlotToContainer(new SlotOutput(inventory, slotProduct++, 116, 78));
|
||||
container.addSlotToContainer(new SlotOutput(inventory, slotProduct++, 95, 65));
|
||||
container.addSlotToContainer(new SlotOutput(inventory, slotProduct++, 95, 39));
|
||||
container.addSlotToContainer(new SlotOutput(inventory, slotProduct, 116, 26));
|
||||
}
|
||||
}
|
||||
@@ -11,54 +11,30 @@
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
|
||||
import forestry.apiculture.BeeHousingInventory;
|
||||
import forestry.apiculture.tiles.TileAbstractBeeHousing;
|
||||
import forestry.apiculture.tiles.TileApiary;
|
||||
import forestry.apiculture.tiles.TileBeeHousingBase;
|
||||
import forestry.core.gui.ContainerTile;
|
||||
import forestry.core.gui.slots.SlotFiltered;
|
||||
import forestry.core.gui.slots.SlotOutput;
|
||||
import forestry.core.network.IForestryPacketClient;
|
||||
import forestry.core.network.packets.PacketGuiUpdate;
|
||||
|
||||
public class ContainerBeeHousing extends ContainerTile<TileAbstractBeeHousing> {
|
||||
public class ContainerBeeHousing extends ContainerTile<TileBeeHousingBase> implements IContainerBeeHousing {
|
||||
|
||||
public ContainerBeeHousing(InventoryPlayer player, TileAbstractBeeHousing tile, boolean hasFrames) {
|
||||
public ContainerBeeHousing(InventoryPlayer player, TileBeeHousingBase tile, boolean hasFrames) {
|
||||
super(tile, player, 8, 108);
|
||||
|
||||
// Queen/Princess
|
||||
this.addSlotToContainer(new SlotFiltered(tile, BeeHousingInventory.SLOT_QUEEN, 29, 39));
|
||||
|
||||
// Drone
|
||||
this.addSlotToContainer(new SlotFiltered(tile, BeeHousingInventory.SLOT_DRONE, 29, 65));
|
||||
|
||||
// Frames
|
||||
if (hasFrames) {
|
||||
final int slotFrames1 = TileApiary.ApiaryInventory.SLOT_FRAMES_1;
|
||||
this.addSlotToContainer(new SlotFiltered(tile, slotFrames1, 66, 23));
|
||||
this.addSlotToContainer(new SlotFiltered(tile, slotFrames1 + 1, 66, 52));
|
||||
this.addSlotToContainer(new SlotFiltered(tile, slotFrames1 + 2, 66, 81));
|
||||
}
|
||||
|
||||
// Product Inventory
|
||||
this.addSlotToContainer(new SlotOutput(tile, 2, 116, 52));
|
||||
this.addSlotToContainer(new SlotOutput(tile, 3, 137, 39));
|
||||
this.addSlotToContainer(new SlotOutput(tile, 4, 137, 65));
|
||||
this.addSlotToContainer(new SlotOutput(tile, 5, 116, 78));
|
||||
this.addSlotToContainer(new SlotOutput(tile, 6, 95, 65));
|
||||
this.addSlotToContainer(new SlotOutput(tile, 7, 95, 39));
|
||||
this.addSlotToContainer(new SlotOutput(tile, 8, 116, 26));
|
||||
ContainerBeeHelper.addSlots(this, tile, hasFrames);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgressBar(int i, int j) {
|
||||
tile.getGUINetworkData(i, j);
|
||||
}
|
||||
private int beeProgress = 0;
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
for (Object crafter : crafters) {
|
||||
tile.sendGUINetworkData(this, (ICrafting) crafter);
|
||||
|
||||
int beeProgress = tile.getBeekeepingLogic().getBeeProgressPercent();
|
||||
if (this.beeProgress != beeProgress) {
|
||||
this.beeProgress = beeProgress;
|
||||
IForestryPacketClient packet = new PacketGuiUpdate(tile);
|
||||
sendPacketToCrafters(packet);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,14 +12,14 @@ package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import forestry.apiculture.items.ItemHabitatLocator.HabitatLocatorInventory;
|
||||
import forestry.apiculture.inventory.ItemInventoryHabitatLocator;
|
||||
import forestry.core.gui.ContainerItemInventory;
|
||||
import forestry.core.gui.slots.SlotFiltered;
|
||||
import forestry.core.gui.slots.SlotOutput;
|
||||
|
||||
public class ContainerHabitatLocator extends ContainerItemInventory<HabitatLocatorInventory> {
|
||||
public class ContainerHabitatLocator extends ContainerItemInventory<ItemInventoryHabitatLocator> {
|
||||
|
||||
public ContainerHabitatLocator(EntityPlayer player, HabitatLocatorInventory inventory) {
|
||||
public ContainerHabitatLocator(EntityPlayer player, ItemInventoryHabitatLocator inventory) {
|
||||
super(inventory, player.inventory, 8, 102);
|
||||
|
||||
// Energy
|
||||
|
||||
@@ -10,26 +10,21 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.apiculture.items.ItemImprinter.ImprinterInventory;
|
||||
import forestry.apiculture.inventory.ItemInventoryImprinter;
|
||||
import forestry.apiculture.network.packets.PacketImprintSelectionResponse;
|
||||
import forestry.core.gui.ContainerItemInventory;
|
||||
import forestry.core.gui.IGuiSelectable;
|
||||
import forestry.core.gui.slots.SlotFiltered;
|
||||
import forestry.core.gui.slots.SlotOutput;
|
||||
import forestry.core.network.ForestryPacket;
|
||||
import forestry.core.network.PacketGuiSelect;
|
||||
import forestry.core.network.PacketId;
|
||||
import forestry.core.network.packets.PacketGuiSelectRequest;
|
||||
import forestry.core.proxy.Proxies;
|
||||
|
||||
public class ContainerImprinter extends ContainerItemInventory<ImprinterInventory> implements IGuiSelectable {
|
||||
public class ContainerImprinter extends ContainerItemInventory<ItemInventoryImprinter> implements IGuiSelectable {
|
||||
|
||||
private boolean isNetSynced = false;
|
||||
|
||||
public ContainerImprinter(InventoryPlayer inventoryplayer, ImprinterInventory inventory) {
|
||||
public ContainerImprinter(InventoryPlayer inventoryplayer, ItemInventoryImprinter inventory) {
|
||||
super(inventory, inventoryplayer, 8, 103);
|
||||
|
||||
// Input
|
||||
@@ -39,67 +34,26 @@ public class ContainerImprinter extends ContainerItemInventory<ImprinterInventor
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed(EntityPlayer entityplayer) {
|
||||
|
||||
if (entityplayer.worldObj.isRemote) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Drop everything still in there.
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
ItemStack stack = inventory.getStackInSlot(i);
|
||||
if (stack == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Proxies.common.dropItemPlayer(entityplayer, stack);
|
||||
inventory.setInventorySlotContents(i, null);
|
||||
}
|
||||
}
|
||||
|
||||
public void advanceSelection(int index) {
|
||||
sendSelectionChange(index, 0);
|
||||
}
|
||||
|
||||
public void regressSelection(int index) {
|
||||
sendSelectionChange(index, 1);
|
||||
}
|
||||
|
||||
public void updateContainer(World world) {
|
||||
if (!isNetSynced && world.isRemote) {
|
||||
isNetSynced = true;
|
||||
Proxies.net.sendToServer(new ForestryPacket(PacketId.IMPRINT_SELECTION_GET));
|
||||
}
|
||||
}
|
||||
|
||||
private void sendSelectionChange(int index, int advance) {
|
||||
ForestryPacket packet = new PacketGuiSelect(PacketId.GUI_SELECTION_CHANGE, index, advance);
|
||||
Proxies.net.sendToServer(packet);
|
||||
isNetSynced = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleSelectionChange(EntityPlayer player, PacketGuiSelect packet) {
|
||||
if (packet.getSecondaryIndex() == 0) {
|
||||
if (packet.getPrimaryIndex() == 0) {
|
||||
public void handleSelectionRequest(EntityPlayerMP player, PacketGuiSelectRequest packetRequest) {
|
||||
if (packetRequest.getPrimaryIndex() == 0) {
|
||||
if (packetRequest.getSecondaryIndex() == 0) {
|
||||
inventory.advancePrimary();
|
||||
} else {
|
||||
inventory.advanceSecondary();
|
||||
inventory.regressPrimary();
|
||||
}
|
||||
} else if (packet.getPrimaryIndex() == 0) {
|
||||
inventory.regressPrimary();
|
||||
} else {
|
||||
inventory.regressSecondary();
|
||||
if (packetRequest.getSecondaryIndex() == 0) {
|
||||
inventory.advanceSecondary();
|
||||
} else {
|
||||
inventory.regressSecondary();
|
||||
}
|
||||
}
|
||||
|
||||
PacketImprintSelectionResponse packetResponse = new PacketImprintSelectionResponse(inventory.getPrimaryIndex(), inventory.getSecondaryIndex());
|
||||
Proxies.net.sendToPlayer(packetResponse, player);
|
||||
}
|
||||
|
||||
public void sendSelection(EntityPlayer player) {
|
||||
ForestryPacket packet = new PacketGuiSelect(PacketId.GUI_SELECTION_SET, inventory.getPrimaryIndex(), inventory.getSecondaryIndex());
|
||||
Proxies.net.sendToPlayer(packet, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelection(PacketGuiSelect packetPayload) {
|
||||
public void setSelection(PacketImprintSelectionResponse packetPayload) {
|
||||
inventory.setPrimaryIndex(packetPayload.getPrimaryIndex());
|
||||
inventory.setSecondaryIndex(packetPayload.getSecondaryIndex());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import forestry.apiculture.entities.EntityMinecartBeeHousingBase;
|
||||
import forestry.core.gui.ContainerEntity;
|
||||
import forestry.core.network.IForestryPacketClient;
|
||||
import forestry.core.network.packets.PacketGuiUpdateEntity;
|
||||
|
||||
public class ContainerMinecartBeehouse extends ContainerEntity<EntityMinecartBeeHousingBase> implements IContainerBeeHousing {
|
||||
public ContainerMinecartBeehouse(InventoryPlayer player, EntityMinecartBeeHousingBase entity, boolean hasFrames) {
|
||||
super(entity, player, 8, 108);
|
||||
ContainerBeeHelper.addSlots(this, entity, hasFrames);
|
||||
}
|
||||
|
||||
private int beeProgress = 0;
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
|
||||
int beeProgress = entity.getBeekeepingLogic().getBeeProgressPercent();
|
||||
if (this.beeProgress != beeProgress) {
|
||||
this.beeProgress = beeProgress;
|
||||
IForestryPacketClient packet = new PacketGuiUpdateEntity(entity, entity);
|
||||
sendPacketToCrafters(packet);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,16 +12,15 @@ package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import forestry.apiculture.multiblock.IAlvearyController;
|
||||
import forestry.apiculture.multiblock.TileAlvearyPlain;
|
||||
import forestry.apiculture.multiblock.IAlvearyControllerInternal;
|
||||
import forestry.apiculture.multiblock.TileAlveary;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.gui.GuiForestryTitled;
|
||||
import forestry.core.gui.ledgers.OwnerLedger;
|
||||
import forestry.core.render.EnumTankLevel;
|
||||
|
||||
public class GuiAlveary extends GuiForestryTitled<ContainerAlveary, TileAlvearyPlain> {
|
||||
public class GuiAlveary extends GuiForestryTitled<ContainerAlveary, TileAlveary> {
|
||||
|
||||
public GuiAlveary(InventoryPlayer inventory, TileAlvearyPlain tile) {
|
||||
public GuiAlveary(InventoryPlayer inventory, TileAlveary tile) {
|
||||
super(Constants.TEXTURE_PATH_GUI + "/alveary.png", new ContainerAlveary(inventory, tile), tile);
|
||||
|
||||
ySize = 190;
|
||||
@@ -31,39 +30,14 @@ public class GuiAlveary extends GuiForestryTitled<ContainerAlveary, TileAlvearyP
|
||||
protected void drawGuiContainerBackgroundLayer(float var1, int mouseX, int mouseY) {
|
||||
super.drawGuiContainerBackgroundLayer(var1, mouseX, mouseY);
|
||||
|
||||
IAlvearyController alvearyController = inventory.getAlvearyController();
|
||||
IAlvearyControllerInternal alvearyController = inventory.getMultiblockLogic().getController();
|
||||
drawHealthMeter(guiLeft + 20, guiTop + 37, alvearyController.getHealthScaled(46), EnumTankLevel.rateTankLevel(alvearyController.getHealthScaled(100)));
|
||||
}
|
||||
|
||||
private void drawHealthMeter(int x, int y, int height, EnumTankLevel rated) {
|
||||
int i = 176;
|
||||
int i = 176 + rated.getLevelScaled(16);
|
||||
int k = 0;
|
||||
switch (rated) {
|
||||
case EMPTY:
|
||||
break;
|
||||
case LOW:
|
||||
i += 4;
|
||||
break;
|
||||
case MEDIUM:
|
||||
i += 8;
|
||||
break;
|
||||
case HIGH:
|
||||
i += 12;
|
||||
break;
|
||||
case MAXIMUM:
|
||||
i += 16;
|
||||
break;
|
||||
}
|
||||
|
||||
this.drawTexturedModalRect(x, y + 46 - height, i, k + 46 - height, 4, height);
|
||||
}
|
||||
|
||||
/* LEDGERS */
|
||||
protected void initLedgers() {
|
||||
super.initLedgers();
|
||||
|
||||
IAlvearyController alvearyController = inventory.getAlvearyController();
|
||||
ledgerManager.add(new OwnerLedger(ledgerManager, alvearyController));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,26 +10,27 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
|
||||
import forestry.apiculture.tiles.TileAbstractBeeHousing;
|
||||
import forestry.apiculture.tiles.TileApiary;
|
||||
import forestry.apiculture.tiles.TileBeehouse;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.gui.GuiForestryTitled;
|
||||
import forestry.core.render.EnumTankLevel;
|
||||
|
||||
public class GuiBeeHousing extends GuiForestryTitled<ContainerBeeHousing, TileAbstractBeeHousing> {
|
||||
public class GuiBeeHousing<C extends Container & IContainerBeeHousing> extends GuiForestryTitled<C, IGuiBeeHousingInventory> {
|
||||
|
||||
public GuiBeeHousing(InventoryPlayer inventory, TileApiary tile) {
|
||||
super(Constants.TEXTURE_PATH_GUI + "/apiary.png", new ContainerBeeHousing(inventory, tile, true), tile);
|
||||
public enum Icon {
|
||||
APIARY("/apiary.png"),
|
||||
BEE_HOUSE("/alveary.png");
|
||||
|
||||
ySize = 190;
|
||||
private final String path;
|
||||
|
||||
Icon(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
}
|
||||
|
||||
public GuiBeeHousing(InventoryPlayer inventory, TileBeehouse tile) {
|
||||
super(Constants.TEXTURE_PATH_GUI + "/alveary.png", new ContainerBeeHousing(inventory, tile, false), tile);
|
||||
|
||||
public GuiBeeHousing(IGuiBeeHousingInventory tile, C container, Icon icon) {
|
||||
super(Constants.TEXTURE_PATH_GUI + icon.path, container, tile);
|
||||
ySize = 190;
|
||||
}
|
||||
|
||||
@@ -41,24 +42,8 @@ public class GuiBeeHousing extends GuiForestryTitled<ContainerBeeHousing, TileAb
|
||||
}
|
||||
|
||||
private void drawHealthMeter(int x, int y, int height, EnumTankLevel rated) {
|
||||
int i = 176;
|
||||
int i = 176 + rated.getLevelScaled(16);
|
||||
int k = 0;
|
||||
switch (rated) {
|
||||
case EMPTY:
|
||||
break;
|
||||
case LOW:
|
||||
i += 4;
|
||||
break;
|
||||
case MEDIUM:
|
||||
i += 8;
|
||||
break;
|
||||
case HIGH:
|
||||
i += 12;
|
||||
break;
|
||||
case MAXIMUM:
|
||||
i += 16;
|
||||
break;
|
||||
}
|
||||
|
||||
this.drawTexturedModalRect(x, y + 46 - height, i, k + 46 - height, 4, height);
|
||||
}
|
||||
|
||||
@@ -21,26 +21,24 @@ import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAlleleArea;
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
import forestry.api.genetics.IAlleleTolerance;
|
||||
import forestry.apiculture.genetics.BeeGenome;
|
||||
import forestry.apiculture.items.ItemBeeGE;
|
||||
import forestry.apiculture.items.ItemBeealyzer.BeealyzerInventory;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.apiculture.inventory.ItemInventoryBeealyzer;
|
||||
import forestry.core.genetics.alleles.AlleleBoolean;
|
||||
import forestry.core.gui.ContainerAlyzer;
|
||||
import forestry.core.gui.GuiAlyzer;
|
||||
import forestry.core.gui.widgets.ItemStackWidget;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.core.utils.vect.Vect;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class GuiBeealyzer extends GuiAlyzer {
|
||||
|
||||
public GuiBeealyzer(EntityPlayer player, BeealyzerInventory inventory) {
|
||||
super("rootBees", player, new ContainerAlyzer(inventory, player), inventory, "gui.beealyzer");
|
||||
public GuiBeealyzer(EntityPlayer player, ItemInventoryBeealyzer inventory) {
|
||||
super(BeeManager.beeRoot, player, new ContainerAlyzer(inventory, player), inventory, "gui.beealyzer");
|
||||
|
||||
ArrayList<ItemStack> beeList = new ArrayList<ItemStack>();
|
||||
((ItemBeeGE) ForestryItem.beeDroneGE.item()).addCreativeItems(beeList, false);
|
||||
ArrayList<ItemStack> beeList = new ArrayList<>();
|
||||
PluginApiculture.items.beeDroneGE.addCreativeItems(beeList, false);
|
||||
for (ItemStack beeStack : beeList) {
|
||||
IAlleleBeeSpecies species = BeeGenome.getSpecies(beeStack);
|
||||
if (species != null) {
|
||||
@@ -57,8 +55,8 @@ public class GuiBeealyzer extends GuiAlyzer {
|
||||
IBee bee = null;
|
||||
EnumBeeType beeType = EnumBeeType.DRONE;
|
||||
|
||||
for (int k = BeealyzerInventory.SLOT_SPECIMEN; k <= BeealyzerInventory.SLOT_ANALYZE_5; k++) {
|
||||
if (k == BeealyzerInventory.SLOT_ENERGY) {
|
||||
for (int k = ItemInventoryBeealyzer.SLOT_SPECIMEN; k <= ItemInventoryBeealyzer.SLOT_ANALYZE_5; k++) {
|
||||
if (k == ItemInventoryBeealyzer.SLOT_ENERGY) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -99,89 +97,81 @@ public class GuiBeealyzer extends GuiAlyzer {
|
||||
|
||||
private void drawAnalyticsPage1(IBee bee, EnumBeeType type) {
|
||||
|
||||
startPage(COLUMN_0, COLUMN_1, COLUMN_2);
|
||||
textLayout.startPage(COLUMN_0, COLUMN_1, COLUMN_2);
|
||||
|
||||
drawLine(StringUtil.localize("gui.active"), COLUMN_1);
|
||||
drawLine(StringUtil.localize("gui.inactive"), COLUMN_2);
|
||||
textLayout.drawLine(StringUtil.localize("gui.active"), COLUMN_1);
|
||||
textLayout.drawLine(StringUtil.localize("gui.inactive"), COLUMN_2);
|
||||
|
||||
newLine();
|
||||
newLine();
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
{
|
||||
String customPrimaryBeeKey = "bees.custom.beealyzer." + type.getName() + "." + bee.getGenome().getPrimary().getUnlocalizedName().replace("bees.species.", "");
|
||||
String customSecondaryBeeKey = "bees.custom.beealyzer." + type.getName() + "." + bee.getGenome().getSecondary().getUnlocalizedName().replace("bees.species.", "");
|
||||
|
||||
drawSpeciesRow(StringUtil.localize("gui.species"), bee, EnumBeeChromosome.SPECIES, checkCustomName(customPrimaryBeeKey), checkCustomName(customSecondaryBeeKey));
|
||||
newLine();
|
||||
textLayout.newLine();
|
||||
}
|
||||
|
||||
drawChromosomeRow(StringUtil.localize("gui.lifespan"), bee, EnumBeeChromosome.LIFESPAN);
|
||||
newLine();
|
||||
textLayout.newLine();
|
||||
drawChromosomeRow(StringUtil.localize("gui.speed"), bee, EnumBeeChromosome.SPEED);
|
||||
newLine();
|
||||
textLayout.newLine();
|
||||
drawChromosomeRow(StringUtil.localize("gui.pollination"), bee, EnumBeeChromosome.FLOWERING);
|
||||
newLine();
|
||||
textLayout.newLine();
|
||||
drawChromosomeRow(StringUtil.localize("gui.flowers"), bee, EnumBeeChromosome.FLOWER_PROVIDER);
|
||||
newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
drawLine(StringUtil.localize("gui.fertility"), COLUMN_0);
|
||||
textLayout.drawLine(StringUtil.localize("gui.fertility"), COLUMN_0);
|
||||
IAlleleInteger primaryFertility = (IAlleleInteger) bee.getGenome().getActiveAllele(EnumBeeChromosome.FERTILITY);
|
||||
IAlleleInteger secondaryFertility = (IAlleleInteger) bee.getGenome().getInactiveAllele(EnumBeeChromosome.FERTILITY);
|
||||
drawFertilityInfo(primaryFertility.getValue(), COLUMN_1, getColorCoding(primaryFertility.isDominant()), 0);
|
||||
drawFertilityInfo(secondaryFertility.getValue(), COLUMN_2, getColorCoding(secondaryFertility.isDominant()), 0);
|
||||
textLayout.newLine();
|
||||
|
||||
newLine();
|
||||
|
||||
IAlleleArea activeTerritory = (IAlleleArea) bee.getGenome().getActiveAllele(EnumBeeChromosome.TERRITORY);
|
||||
IAlleleArea inactiveTerritory = (IAlleleArea) bee.getGenome().getInactiveAllele(EnumBeeChromosome.TERRITORY);
|
||||
drawRow(StringUtil.localize("gui.area"),
|
||||
new Vect(activeTerritory.getValue()).toString(),
|
||||
new Vect(inactiveTerritory.getValue()).toString(),
|
||||
bee, EnumBeeChromosome.TERRITORY);
|
||||
|
||||
newLine();
|
||||
drawChromosomeRow(StringUtil.localize("gui.area"), bee, EnumBeeChromosome.TERRITORY);
|
||||
textLayout.newLine();
|
||||
|
||||
drawChromosomeRow(StringUtil.localize("gui.effect"), bee, EnumBeeChromosome.EFFECT);
|
||||
textLayout.newLine();
|
||||
|
||||
newLine();
|
||||
|
||||
endPage();
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
private void drawAnalyticsPage2(IBee bee, EnumBeeType type) {
|
||||
|
||||
startPage(COLUMN_0, COLUMN_1, COLUMN_2);
|
||||
textLayout.startPage(COLUMN_0, COLUMN_1, COLUMN_2);
|
||||
|
||||
drawLine(StringUtil.localize("gui.active"), COLUMN_1);
|
||||
drawLine(StringUtil.localize("gui.inactive"), COLUMN_2);
|
||||
textLayout.drawLine(StringUtil.localize("gui.active"), COLUMN_1);
|
||||
textLayout.drawLine(StringUtil.localize("gui.inactive"), COLUMN_2);
|
||||
|
||||
newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
drawRow(StringUtil.localize("gui.climate"), AlleleManager.climateHelper.toDisplay(bee.getGenome().getPrimary().getTemperature()),
|
||||
AlleleManager.climateHelper.toDisplay(bee.getGenome().getSecondary().getTemperature()), bee, EnumBeeChromosome.SPECIES);
|
||||
|
||||
newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
IAlleleTolerance tempToleranceActive = (IAlleleTolerance) bee.getGenome().getActiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE);
|
||||
IAlleleTolerance tempToleranceInactive = (IAlleleTolerance) bee.getGenome().getInactiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE);
|
||||
drawLine(" " + StringUtil.localize("gui.tolerance"), COLUMN_0);
|
||||
textLayout.drawLine(" " + StringUtil.localize("gui.tolerance"), COLUMN_0);
|
||||
drawToleranceInfo(tempToleranceActive, COLUMN_1);
|
||||
drawToleranceInfo(tempToleranceInactive, COLUMN_2);
|
||||
|
||||
newLine(16);
|
||||
textLayout.newLine(16);
|
||||
|
||||
drawRow(StringUtil.localize("gui.humidity"), AlleleManager.climateHelper.toDisplay(bee.getGenome().getPrimary().getHumidity()),
|
||||
AlleleManager.climateHelper.toDisplay(bee.getGenome().getSecondary().getHumidity()), bee, EnumBeeChromosome.SPECIES);
|
||||
|
||||
newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
IAlleleTolerance humidToleranceActive = (IAlleleTolerance) bee.getGenome().getActiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE);
|
||||
IAlleleTolerance humidToleranceInactive = (IAlleleTolerance) bee.getGenome().getInactiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE);
|
||||
drawLine(" " + StringUtil.localize("gui.tolerance"), COLUMN_0);
|
||||
textLayout.drawLine(" " + StringUtil.localize("gui.tolerance"), COLUMN_0);
|
||||
drawToleranceInfo(humidToleranceActive, COLUMN_1);
|
||||
drawToleranceInfo(humidToleranceInactive, COLUMN_2);
|
||||
|
||||
newLine(16);
|
||||
textLayout.newLine(16);
|
||||
|
||||
String yes = StringUtil.localize("yes");
|
||||
String no = StringUtil.localize("no");
|
||||
@@ -200,29 +190,29 @@ public class GuiBeealyzer extends GuiAlyzer {
|
||||
diurnal1 = !bee.getGenome().getSecondary().isNocturnal() ? yes : no;
|
||||
}
|
||||
|
||||
drawLine(StringUtil.localize("gui.diurnal"), COLUMN_0);
|
||||
drawLine(diurnal0, COLUMN_1, getColorCoding(false));
|
||||
drawLine(diurnal1, COLUMN_2, getColorCoding(false));
|
||||
newLineCompressed();
|
||||
textLayout.drawLine(StringUtil.localize("gui.diurnal"), COLUMN_0);
|
||||
textLayout.drawLine(diurnal0, COLUMN_1, getColorCoding(false));
|
||||
textLayout.drawLine(diurnal1, COLUMN_2, getColorCoding(false));
|
||||
textLayout.newLineCompressed();
|
||||
|
||||
drawLine(StringUtil.localize("gui.nocturnal"), COLUMN_0);
|
||||
drawLine(nocturnal0, COLUMN_1, getColorCoding(false));
|
||||
drawLine(nocturnal1, COLUMN_2, getColorCoding(false));
|
||||
newLineCompressed();
|
||||
textLayout.drawLine(StringUtil.localize("gui.nocturnal"), COLUMN_0);
|
||||
textLayout.drawLine(nocturnal0, COLUMN_1, getColorCoding(false));
|
||||
textLayout.drawLine(nocturnal1, COLUMN_2, getColorCoding(false));
|
||||
textLayout.newLineCompressed();
|
||||
|
||||
String primary = StringUtil.readableBoolean(bee.getGenome().getTolerantFlyer(), yes, no);
|
||||
String secondary = StringUtil.readableBoolean(((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.TOLERANT_FLYER)).getValue(), yes, no);
|
||||
|
||||
drawRow(StringUtil.localize("gui.flyer"), primary, secondary, bee, EnumBeeChromosome.TOLERANT_FLYER);
|
||||
|
||||
newLineCompressed();
|
||||
textLayout.newLineCompressed();
|
||||
|
||||
primary = StringUtil.readableBoolean(bee.getGenome().getCaveDwelling(), yes, no);
|
||||
secondary = StringUtil.readableBoolean(((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.CAVE_DWELLING)).getValue(), yes, no);
|
||||
|
||||
drawRow(StringUtil.localize("gui.cave"), primary, secondary, bee, EnumBeeChromosome.CAVE_DWELLING);
|
||||
|
||||
newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
String displayText;
|
||||
if (type == EnumBeeType.PRINCESS || type == EnumBeeType.QUEEN) {
|
||||
@@ -231,57 +221,57 @@ public class GuiBeealyzer extends GuiAlyzer {
|
||||
displayText = "bees.stock.ignoble";
|
||||
}
|
||||
displayText = StringUtil.localize(displayText);
|
||||
drawCenteredLine(displayText, 8, 208, fontColor.get("gui.beealyzer.binomial"));
|
||||
textLayout.drawCenteredLine(displayText, 8, 208, fontColor.get("gui.beealyzer.binomial"));
|
||||
}
|
||||
|
||||
if (bee.getGeneration() >= 0) {
|
||||
newLineCompressed();
|
||||
textLayout.newLineCompressed();
|
||||
displayText = StringUtil.localizeAndFormat("gui.beealyzer.generations", bee.getGeneration());
|
||||
drawCenteredLine(displayText, 8, 208, fontColor.get("gui.beealyzer.binomial"));
|
||||
textLayout.drawCenteredLine(displayText, 8, 208, fontColor.get("gui.beealyzer.binomial"));
|
||||
}
|
||||
|
||||
endPage();
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
private void drawAnalyticsPage3(IBee bee) {
|
||||
|
||||
startPage(COLUMN_0, COLUMN_1, COLUMN_2);
|
||||
textLayout.startPage(COLUMN_0, COLUMN_1, COLUMN_2);
|
||||
|
||||
drawLine(StringUtil.localize("gui.beealyzer.produce") + ":", COLUMN_0);
|
||||
textLayout.drawLine(StringUtil.localize("gui.beealyzer.produce") + ":", COLUMN_0);
|
||||
|
||||
newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
int x = COLUMN_0;
|
||||
for (ItemStack stack : bee.getProduceList()) {
|
||||
widgetManager.add(new ItemStackWidget(x, getLineY(), stack));
|
||||
widgetManager.add(new ItemStackWidget(widgetManager, x, textLayout.getLineY(), stack));
|
||||
|
||||
x += 18;
|
||||
if (x > 148) {
|
||||
x = COLUMN_0;
|
||||
newLine();
|
||||
textLayout.newLine();
|
||||
}
|
||||
}
|
||||
|
||||
newLine();
|
||||
newLine();
|
||||
newLine();
|
||||
newLine();
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
textLayout.newLine();
|
||||
|
||||
drawLine(StringUtil.localize("gui.beealyzer.specialty") + ":", COLUMN_0);
|
||||
newLine();
|
||||
textLayout.drawLine(StringUtil.localize("gui.beealyzer.specialty") + ":", COLUMN_0);
|
||||
textLayout.newLine();
|
||||
|
||||
x = COLUMN_0;
|
||||
for (ItemStack stack : bee.getSpecialtyList()) {
|
||||
widgetManager.add(new ItemStackWidget(x, getLineY(), stack));
|
||||
widgetManager.add(new ItemStackWidget(widgetManager, x, textLayout.getLineY(), stack));
|
||||
|
||||
x += 18;
|
||||
if (x > 148) {
|
||||
x = COLUMN_0;
|
||||
newLine();
|
||||
textLayout.newLine();
|
||||
}
|
||||
}
|
||||
|
||||
endPage();
|
||||
textLayout.endPage();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,15 +10,17 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import com.google.common.collect.LinkedListMultimap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumMap;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
@@ -26,70 +28,57 @@ import net.minecraftforge.common.BiomeDictionary;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import forestry.apiculture.items.ItemHabitatLocator.HabitatLocatorInventory;
|
||||
import forestry.apiculture.gui.widgets.HabitatSlot;
|
||||
import forestry.apiculture.inventory.ItemInventoryHabitatLocator;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.gui.GuiForestry;
|
||||
import forestry.core.gui.widgets.Widget;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.render.SpriteSheet;
|
||||
import forestry.core.render.TextureManager;
|
||||
|
||||
public class GuiHabitatLocator extends GuiForestry<ContainerHabitatLocator, HabitatLocatorInventory> {
|
||||
public class GuiHabitatLocator extends GuiForestry<ContainerHabitatLocator, ItemInventoryHabitatLocator> {
|
||||
private static final LinkedListMultimap<String, BiomeDictionary.Type> habitats = LinkedListMultimap.create();
|
||||
|
||||
private final HabitatSlot[] habitatSlots = new HabitatSlot[]{
|
||||
new HabitatSlot(0, "Ocean"), // ocean, beach
|
||||
new HabitatSlot(1, "Plains"),
|
||||
new HabitatSlot(2, "Desert"), // desert, desert hills
|
||||
new HabitatSlot(3, "Forest"), // forest, forestHills, river
|
||||
new HabitatSlot(4, "Jungle"), // jungle, jungleHills
|
||||
new HabitatSlot(5, "Taiga"), // taiga, taigaHills
|
||||
new HabitatSlot(6, "Hills"), // extremeHills, extremeHillsEdge
|
||||
new HabitatSlot(7, "Swamp"),
|
||||
new HabitatSlot(8, "Snow"), // Ice plains, mountains, frozen rivers, frozen oceans
|
||||
new HabitatSlot(9, "Mushroom"),
|
||||
new HabitatSlot(10, "Nether"),
|
||||
new HabitatSlot(11, "End")};
|
||||
private final Map<BiomeDictionary.Type, HabitatSlot> biomeToHabitat = new EnumMap<BiomeDictionary.Type, HabitatSlot>(BiomeDictionary.Type.class);
|
||||
static {
|
||||
habitats.putAll("Ocean", Arrays.asList(BiomeDictionary.Type.OCEAN, BiomeDictionary.Type.BEACH));
|
||||
habitats.put("Plains", BiomeDictionary.Type.PLAINS);
|
||||
habitats.put("Desert", BiomeDictionary.Type.SANDY);
|
||||
habitats.putAll("Forest", Arrays.asList(BiomeDictionary.Type.FOREST, BiomeDictionary.Type.RIVER));
|
||||
habitats.put("Jungle", BiomeDictionary.Type.JUNGLE);
|
||||
habitats.put("Taiga", BiomeDictionary.Type.CONIFEROUS);
|
||||
habitats.put("Hills", BiomeDictionary.Type.MOUNTAIN);
|
||||
habitats.put("Swamp", BiomeDictionary.Type.SWAMP);
|
||||
habitats.put("Snow", BiomeDictionary.Type.SNOWY);
|
||||
habitats.put("Mushroom", BiomeDictionary.Type.MUSHROOM);
|
||||
habitats.put("Nether", BiomeDictionary.Type.NETHER);
|
||||
habitats.put("End", BiomeDictionary.Type.END);
|
||||
}
|
||||
|
||||
private final List<HabitatSlot> habitatSlots = new ArrayList<>(habitats.size());
|
||||
|
||||
private int startX;
|
||||
private int startY;
|
||||
|
||||
public GuiHabitatLocator(EntityPlayer player, HabitatLocatorInventory item) {
|
||||
public GuiHabitatLocator(EntityPlayer player, ItemInventoryHabitatLocator item) {
|
||||
super(Constants.TEXTURE_PATH_GUI + "/biomefinder.png", new ContainerHabitatLocator(player, item), item);
|
||||
|
||||
xSize = 176;
|
||||
ySize = 184;
|
||||
|
||||
int x;
|
||||
int y;
|
||||
for (HabitatSlot slot : habitatSlots) {
|
||||
|
||||
if (slot.slot > 5) {
|
||||
x = 18 + (slot.slot - 6) * 20;
|
||||
int slot = 0;
|
||||
for (String habitatName : habitats.keySet()) {
|
||||
int x;
|
||||
int y;
|
||||
if (slot > 5) {
|
||||
x = 18 + (slot - 6) * 20;
|
||||
y = 50;
|
||||
} else {
|
||||
x = 18 + slot.slot * 20;
|
||||
x = 18 + slot * 20;
|
||||
y = 32;
|
||||
}
|
||||
|
||||
slot.setPosition(x, y);
|
||||
this.widgetManager.add(slot);
|
||||
Collection<BiomeDictionary.Type> biomes = habitats.get(habitatName);
|
||||
HabitatSlot habitatSlot = new HabitatSlot(widgetManager, x, y, habitatName, biomes);
|
||||
habitatSlots.add(habitatSlot);
|
||||
widgetManager.add(habitatSlot);
|
||||
slot++;
|
||||
}
|
||||
|
||||
biomeToHabitat.put(BiomeDictionary.Type.OCEAN, habitatSlots[0]);
|
||||
biomeToHabitat.put(BiomeDictionary.Type.BEACH, habitatSlots[0]);
|
||||
biomeToHabitat.put(BiomeDictionary.Type.PLAINS, habitatSlots[1]);
|
||||
biomeToHabitat.put(BiomeDictionary.Type.SANDY, habitatSlots[2]);
|
||||
biomeToHabitat.put(BiomeDictionary.Type.FOREST, habitatSlots[3]);
|
||||
biomeToHabitat.put(BiomeDictionary.Type.RIVER, habitatSlots[3]);
|
||||
biomeToHabitat.put(BiomeDictionary.Type.JUNGLE, habitatSlots[4]);
|
||||
biomeToHabitat.put(BiomeDictionary.Type.CONIFEROUS, habitatSlots[5]);
|
||||
biomeToHabitat.put(BiomeDictionary.Type.MOUNTAIN, habitatSlots[6]);
|
||||
biomeToHabitat.put(BiomeDictionary.Type.SWAMP, habitatSlots[7]);
|
||||
biomeToHabitat.put(BiomeDictionary.Type.SNOWY, habitatSlots[8]);
|
||||
biomeToHabitat.put(BiomeDictionary.Type.MUSHROOM, habitatSlots[9]);
|
||||
biomeToHabitat.put(BiomeDictionary.Type.NETHER, habitatSlots[10]);
|
||||
biomeToHabitat.put(BiomeDictionary.Type.END, habitatSlots[11]);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -97,31 +86,22 @@ public class GuiHabitatLocator extends GuiForestry<ContainerHabitatLocator, Habi
|
||||
super.drawGuiContainerBackgroundLayer(var1, mouseX, mouseY);
|
||||
|
||||
String str = StatCollector.translateToLocal("item.for.habitatLocator.name").toUpperCase();
|
||||
fontRendererObj.drawString(str, startX + 8 + getCenteredOffset(str, 138), startY + 16, fontColor.get("gui.screen"));
|
||||
fontRendererObj.drawString(str, startX + 8 + textLayout.getCenteredOffset(str, 138), startY + 16, fontColor.get("gui.screen"));
|
||||
|
||||
// Set active according to valid biomes.
|
||||
Set<BiomeDictionary.Type> activeBiomeTypes = EnumSet.noneOf(BiomeDictionary.Type.class);
|
||||
|
||||
for (HabitatSlot habitatSlot : habitatSlots) {
|
||||
habitatSlot.isActive = false;
|
||||
}
|
||||
|
||||
for (BiomeGenBase biome : inventory.getBiomesToSearch()) {
|
||||
Collections.addAll(activeBiomeTypes, BiomeDictionary.getTypesForBiome(biome));
|
||||
}
|
||||
|
||||
for (BiomeDictionary.Type biomeType : activeBiomeTypes) {
|
||||
HabitatSlot habitatSlot = biomeToHabitat.get(biomeType);
|
||||
if (habitatSlot != null) {
|
||||
habitatSlot.isActive = true;
|
||||
}
|
||||
for (HabitatSlot habitatSlot : habitatSlots) {
|
||||
habitatSlot.setActive(activeBiomeTypes);
|
||||
}
|
||||
|
||||
for (HabitatSlot slot : habitatSlots) {
|
||||
slot.draw(startX, startY);
|
||||
}
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); // Reset afterwards.
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -131,53 +111,4 @@ public class GuiHabitatLocator extends GuiForestry<ContainerHabitatLocator, Habi
|
||||
startX = (this.width - this.xSize) / 2;
|
||||
startY = (this.height - this.ySize) / 2;
|
||||
}
|
||||
|
||||
public class HabitatSlot extends Widget {
|
||||
|
||||
private final int slot;
|
||||
private final String name;
|
||||
private final String iconIndex;
|
||||
public boolean isActive = false;
|
||||
|
||||
public HabitatSlot(int slot, String name) {
|
||||
super(widgetManager, 0, 0);
|
||||
this.slot = slot;
|
||||
this.name = name;
|
||||
this.iconIndex = "habitats/" + name.toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLegacyTooltip(EntityPlayer player) {
|
||||
return name;
|
||||
}
|
||||
|
||||
public IIcon getIcon() {
|
||||
return TextureManager.getInstance().getDefault(iconIndex);
|
||||
}
|
||||
|
||||
public void setPosition(int x, int y) {
|
||||
this.xPos = x;
|
||||
this.yPos = y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int startX, int startY) {
|
||||
|
||||
if (getIcon() != null) {
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
if (!isActive) {
|
||||
GL11.glColor4f(0.2f, 0.2f, 0.2f, 0.2f);
|
||||
} else {
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
Proxies.common.bindTexture(SpriteSheet.ITEMS);
|
||||
manager.gui.drawTexturedModelRectFromIcon(startX + xPos, startY + yPos, getIcon(), 16, 16);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,35 +15,35 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.apiculture.genetics.BeeGenome;
|
||||
import forestry.apiculture.items.ItemBeeGE;
|
||||
import forestry.apiculture.items.ItemImprinter.ImprinterInventory;
|
||||
import forestry.apiculture.inventory.ItemInventoryImprinter;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.config.ForestryItem;
|
||||
import forestry.core.gui.GuiForestry;
|
||||
import forestry.core.gui.GuiUtil;
|
||||
import forestry.core.network.packets.PacketGuiSelectRequest;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class GuiImprinter extends GuiForestry<ContainerImprinter, ImprinterInventory> {
|
||||
public class GuiImprinter extends GuiForestry<ContainerImprinter, ItemInventoryImprinter> {
|
||||
|
||||
private int startX;
|
||||
private int startY;
|
||||
|
||||
private final Map<String, ItemStack> iconStacks = new HashMap<String, ItemStack>();
|
||||
private final Map<String, ItemStack> iconStacks = new HashMap<>();
|
||||
|
||||
public GuiImprinter(InventoryPlayer inventoryplayer, ImprinterInventory inventory) {
|
||||
public GuiImprinter(InventoryPlayer inventoryplayer, ItemInventoryImprinter inventory) {
|
||||
super(Constants.TEXTURE_PATH_GUI + "/imprinter.png", new ContainerImprinter(inventoryplayer, inventory), inventory);
|
||||
|
||||
xSize = 176;
|
||||
ySize = 185;
|
||||
|
||||
List<ItemStack> beeList = new ArrayList<ItemStack>();
|
||||
((ItemBeeGE) ForestryItem.beeDroneGE.item()).addCreativeItems(beeList, false);
|
||||
List<ItemStack> beeList = new ArrayList<>();
|
||||
PluginApiculture.items.beeDroneGE.addCreativeItems(beeList, false);
|
||||
for (ItemStack beeStack : beeList) {
|
||||
IAlleleBeeSpecies species = BeeGenome.getSpecies(beeStack);
|
||||
if (species != null) {
|
||||
@@ -54,7 +54,6 @@ public class GuiImprinter extends GuiForestry<ContainerImprinter, ImprinterInven
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float var1, int mouseX, int mouseY) {
|
||||
container.updateContainer(Proxies.common.getRenderWorld());
|
||||
super.drawGuiContainerBackgroundLayer(var1, mouseX, mouseY);
|
||||
|
||||
int offset = (138 - fontRendererObj.getStringWidth(StringUtil.localize("gui.imprinter.name"))) / 2;
|
||||
@@ -75,9 +74,7 @@ public class GuiImprinter extends GuiForestry<ContainerImprinter, ImprinterInven
|
||||
}
|
||||
|
||||
private void drawBeeSpeciesIcon(IAlleleBeeSpecies bee, int x, int y) {
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
drawItemStack(iconStacks.get(bee.getUID()), x, y);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GuiUtil.drawItemStack(this, iconStacks.get(bee.getUID()), x, y);
|
||||
}
|
||||
|
||||
private static int getHabitatSlotAtPosition(int i, int j) {
|
||||
@@ -106,9 +103,9 @@ public class GuiImprinter extends GuiForestry<ContainerImprinter, ImprinterInven
|
||||
}
|
||||
|
||||
if (k == 0) {
|
||||
container.advanceSelection(slot);
|
||||
advanceSelection(slot);
|
||||
} else {
|
||||
container.regressSelection(slot);
|
||||
regressSelection(slot);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,4 +116,16 @@ public class GuiImprinter extends GuiForestry<ContainerImprinter, ImprinterInven
|
||||
startX = (this.width - this.xSize) / 2;
|
||||
startY = (this.height - this.ySize) / 2;
|
||||
}
|
||||
|
||||
private static void advanceSelection(int index) {
|
||||
sendSelectionChange(index, 0);
|
||||
}
|
||||
|
||||
private static void regressSelection(int index) {
|
||||
sendSelectionChange(index, 1);
|
||||
}
|
||||
|
||||
private static void sendSelectionChange(int index, int advance) {
|
||||
Proxies.net.sendToServer(new PacketGuiSelectRequest(index, advance));
|
||||
}
|
||||
}
|
||||
+14
-18
@@ -1,18 +1,14 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.items;
|
||||
|
||||
/**
|
||||
* @author CovertJaguar <http://www.railcraft.info/>
|
||||
*/
|
||||
public interface IStructureBlockItem {
|
||||
|
||||
}
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
public interface IContainerBeeHousing {
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
import forestry.core.tiles.ITitled;
|
||||
|
||||
public interface IGuiBeeHousingInventory extends ITitled, IInventory {
|
||||
/** Returns scaled queen health or breeding progress */
|
||||
int getHealthScaled(int i);
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.gui.widgets;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import forestry.core.gui.widgets.Widget;
|
||||
import forestry.core.gui.widgets.WidgetManager;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.render.SpriteSheet;
|
||||
import forestry.core.render.TextureManager;
|
||||
|
||||
public class HabitatSlot extends Widget {
|
||||
private final Collection<BiomeDictionary.Type> biomes;
|
||||
private final String name;
|
||||
private final String iconIndex;
|
||||
public boolean isActive = false;
|
||||
|
||||
public HabitatSlot(WidgetManager widgetManager, int xPos, int yPos, String name, Collection<BiomeDictionary.Type> biomes) {
|
||||
super(widgetManager, xPos, yPos);
|
||||
this.biomes = biomes;
|
||||
this.name = name;
|
||||
this.iconIndex = "habitats/" + name.toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLegacyTooltip(EntityPlayer player) {
|
||||
return name;
|
||||
}
|
||||
|
||||
public IIcon getIcon() {
|
||||
return TextureManager.getInstance().getDefault(iconIndex);
|
||||
}
|
||||
|
||||
public void setActive(Collection<BiomeDictionary.Type> biomes) {
|
||||
isActive = !Collections.disjoint(this.biomes, biomes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int startX, int startY) {
|
||||
if (getIcon() != null) {
|
||||
if (!isActive) {
|
||||
GL11.glColor4f(0.2f, 0.2f, 0.2f, 0.2f);
|
||||
} else {
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
Proxies.render.bindTexture(SpriteSheet.ITEMS);
|
||||
manager.gui.drawTexturedModelRectFromIcon(startX + xPos, startY + yPos, getIcon(), 16, 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
-8
@@ -8,14 +8,11 @@
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.recipes.nei;
|
||||
package forestry.apiculture.inventory;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeHousingInventory;
|
||||
|
||||
public interface INBTMatchingCachedRecipe {
|
||||
Iterable<PositionedStack> getIngredients();
|
||||
|
||||
boolean preservesNBT();
|
||||
|
||||
PositionedStack getResult();
|
||||
public interface IApiaryInventory extends IBeeHousingInventory {
|
||||
void wearOutFrames(IBeeHousing beeHousing, int amount);
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.inventory;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.apiculture.multiblock.TileAlvearySieve;
|
||||
import forestry.core.inventory.InventoryAdapterTile;
|
||||
import forestry.core.inventory.watchers.ISlotPickupWatcher;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.plugins.PluginCore;
|
||||
|
||||
public class InventoryAlvearySieve extends InventoryAdapterTile<TileAlvearySieve> implements ISlotPickupWatcher {
|
||||
public static final int SLOT_POLLEN_1 = 0;
|
||||
public static final int SLOTS_POLLEN_COUNT = 4;
|
||||
public static final int SLOT_SIEVE = 4;
|
||||
|
||||
public InventoryAlvearySieve(TileAlvearySieve alvearySieve) {
|
||||
super(alvearySieve, 5, "Items", 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
|
||||
return ItemStackUtil.isIdenticalItem(PluginCore.items.craftingMaterial.getWovenSilk(), itemStack);
|
||||
}
|
||||
|
||||
public boolean canStorePollen() {
|
||||
if (getStackInSlot(SLOT_SIEVE) == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = SLOT_POLLEN_1; i < SLOT_POLLEN_1 + SLOTS_POLLEN_COUNT; i++) {
|
||||
if (getStackInSlot(i) == null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void storePollenStack(ItemStack itemstack) {
|
||||
for (int i = SLOT_POLLEN_1; i < SLOT_POLLEN_1 + SLOTS_POLLEN_COUNT; i++) {
|
||||
if (getStackInSlot(i) == null) {
|
||||
setInventorySlotContents(i, itemstack);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ISlotPickupWatcher */
|
||||
@Override
|
||||
public void onPickupFromSlot(int slotIndex, EntityPlayer player) {
|
||||
if (slotIndex == SLOT_SIEVE) {
|
||||
for (int i = SLOT_POLLEN_1; i < SLOT_POLLEN_1 + SLOTS_POLLEN_COUNT; i++) {
|
||||
setInventorySlotContents(i, null);
|
||||
}
|
||||
} else {
|
||||
setInventorySlotContents(SLOT_SIEVE, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.inventory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeekeepingMode;
|
||||
import forestry.api.apiculture.IHiveFrame;
|
||||
import forestry.apiculture.InventoryBeeHousing;
|
||||
import forestry.core.access.IAccessHandler;
|
||||
import forestry.core.utils.SlotUtil;
|
||||
|
||||
public class InventoryApiary extends InventoryBeeHousing implements IApiaryInventory {
|
||||
public static final int SLOT_FRAMES_1 = 9;
|
||||
public static final int SLOT_FRAMES_COUNT = 3;
|
||||
|
||||
public InventoryApiary(IAccessHandler accessHandler) {
|
||||
super(12, accessHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
|
||||
if (SlotUtil.isSlotInRange(slotIndex, SLOT_FRAMES_1, SLOT_FRAMES_COUNT)) {
|
||||
return (itemStack.getItem() instanceof IHiveFrame) && (getStackInSlot(slotIndex) == null);
|
||||
}
|
||||
|
||||
return super.canSlotAccept(slotIndex, itemStack);
|
||||
}
|
||||
|
||||
// override for pipe automation
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack) {
|
||||
if (SlotUtil.isSlotInRange(slotIndex, SLOT_FRAMES_1, SLOT_FRAMES_COUNT)) {
|
||||
return false;
|
||||
}
|
||||
return super.isItemValidForSlot(slotIndex, itemStack);
|
||||
}
|
||||
|
||||
public Collection<IHiveFrame> getFrames() {
|
||||
Collection<IHiveFrame> hiveFrames = new ArrayList<>(SLOT_FRAMES_COUNT);
|
||||
|
||||
for (int i = SLOT_FRAMES_1; i < SLOT_FRAMES_1 + SLOT_FRAMES_COUNT; i++) {
|
||||
ItemStack stackInSlot = getStackInSlot(i);
|
||||
if (stackInSlot == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Item itemInSlot = stackInSlot.getItem();
|
||||
if (itemInSlot instanceof IHiveFrame) {
|
||||
hiveFrames.add((IHiveFrame) itemInSlot);
|
||||
}
|
||||
}
|
||||
|
||||
return hiveFrames;
|
||||
}
|
||||
|
||||
public void wearOutFrames(IBeeHousing beeHousing, int amount) {
|
||||
IBeekeepingMode beekeepingMode = BeeManager.beeRoot.getBeekeepingMode(beeHousing.getWorld());
|
||||
int wear = Math.round(amount * beekeepingMode.getWearModifier());
|
||||
|
||||
for (int i = SLOT_FRAMES_1; i < SLOT_FRAMES_1 + SLOT_FRAMES_COUNT; i++) {
|
||||
ItemStack hiveFrameStack = getStackInSlot(i);
|
||||
if (hiveFrameStack == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Item hiveFrameItem = hiveFrameStack.getItem();
|
||||
if (!(hiveFrameItem instanceof IHiveFrame)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
IHiveFrame hiveFrame = (IHiveFrame) hiveFrameItem;
|
||||
|
||||
ItemStack queenStack = getQueen();
|
||||
IBee queen = BeeManager.beeRoot.getMember(queenStack);
|
||||
ItemStack usedFrame = hiveFrame.frameUsed(beeHousing, hiveFrameStack, queen, wear);
|
||||
|
||||
setInventorySlotContents(i, usedFrame);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.inventory;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
import forestry.apiculture.multiblock.TileAlvearyHygroregulator;
|
||||
import forestry.core.fluids.FluidHelper;
|
||||
import forestry.core.inventory.InventoryAdapterTile;
|
||||
|
||||
public class InventoryHygroregulator extends InventoryAdapterTile<TileAlvearyHygroregulator> {
|
||||
public static final short SLOT_INPUT = 0;
|
||||
|
||||
public InventoryHygroregulator(TileAlvearyHygroregulator alvearyHygroregulator) {
|
||||
super(alvearyHygroregulator, 1, "CanInv");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
|
||||
if (slotIndex == SLOT_INPUT) {
|
||||
Fluid fluid = FluidHelper.getFluidInContainer(itemStack);
|
||||
return tile.getTankManager().accepts(fluid);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.inventory;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.apiculture.multiblock.TileAlvearySwarmer;
|
||||
import forestry.core.inventory.InventoryAdapterTile;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
|
||||
public class InventorySwarmer extends InventoryAdapterTile<TileAlvearySwarmer> {
|
||||
public InventorySwarmer(TileAlvearySwarmer alvearySwarmer) {
|
||||
super(alvearySwarmer, 4, "SwarmInv");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
|
||||
return ItemStackUtil.containsItemStack(BeeManager.inducers.keySet(), itemStack);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.inventory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.gui.IHintSource;
|
||||
import forestry.core.inventory.ItemInventoryAlyzer;
|
||||
|
||||
public class ItemInventoryBeealyzer extends ItemInventoryAlyzer implements IHintSource {
|
||||
|
||||
public ItemInventoryBeealyzer(EntityPlayer player, ItemStack itemStack) {
|
||||
super(BeeManager.beeRoot, player, itemStack);
|
||||
}
|
||||
|
||||
/* IHintSource */
|
||||
@Override
|
||||
public List<String> getHints() {
|
||||
return Config.hints.get("beealyzer");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.inventory;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.core.IErrorSource;
|
||||
import forestry.api.core.IErrorState;
|
||||
import forestry.apiculture.items.HabitatLocatorLogic;
|
||||
import forestry.apiculture.items.ItemHabitatLocator;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.errors.EnumErrorCode;
|
||||
import forestry.core.gui.IHintSource;
|
||||
import forestry.core.inventory.ItemInventory;
|
||||
import forestry.plugins.PluginApiculture;
|
||||
|
||||
public class ItemInventoryHabitatLocator extends ItemInventory implements IErrorSource, IHintSource {
|
||||
|
||||
private static final short SLOT_ENERGY = 2;
|
||||
private static final short SLOT_SPECIMEN = 0;
|
||||
private static final short SLOT_ANALYZED = 1;
|
||||
|
||||
private final HabitatLocatorLogic locatorLogic;
|
||||
|
||||
public ItemInventoryHabitatLocator(EntityPlayer player, ItemStack itemstack) {
|
||||
super(player, 3, itemstack);
|
||||
ItemHabitatLocator habitatLocator = (ItemHabitatLocator) itemstack.getItem();
|
||||
this.locatorLogic = habitatLocator.getLocatorLogic();
|
||||
}
|
||||
|
||||
private static boolean isEnergy(ItemStack itemstack) {
|
||||
if (itemstack == null || itemstack.stackSize <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Item item = itemstack.getItem();
|
||||
return PluginApiculture.items.honeyDrop == item || PluginApiculture.items.honeydew == item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSlotClick(EntityPlayer player) {
|
||||
|
||||
if (getStackInSlot(SLOT_ANALYZED) != null) {
|
||||
if (locatorLogic.isBiomeFound()) {
|
||||
return;
|
||||
}
|
||||
} else if (getStackInSlot(SLOT_SPECIMEN) != null) {
|
||||
// Requires energy
|
||||
if (!isEnergy(getStackInSlot(SLOT_ENERGY))) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Decrease energy
|
||||
decrStackSize(SLOT_ENERGY, 1);
|
||||
|
||||
setInventorySlotContents(SLOT_ANALYZED, getStackInSlot(SLOT_SPECIMEN));
|
||||
setInventorySlotContents(SLOT_SPECIMEN, null);
|
||||
}
|
||||
|
||||
IBee bee = BeeManager.beeRoot.getMember(getStackInSlot(SLOT_ANALYZED));
|
||||
|
||||
// No bee, abort
|
||||
if (bee == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
locatorLogic.startBiomeSearch(bee, player);
|
||||
}
|
||||
|
||||
public Set<BiomeGenBase> getBiomesToSearch() {
|
||||
return locatorLogic.getTargetBiomes();
|
||||
}
|
||||
|
||||
/* IHintSource */
|
||||
@Override
|
||||
public List<String> getHints() {
|
||||
return Config.hints.get("habitat.locator");
|
||||
}
|
||||
|
||||
/* IErrorSource */
|
||||
@Override
|
||||
public ImmutableSet<IErrorState> getErrorStates() {
|
||||
if (getStackInSlot(SLOT_ANALYZED) != null) {
|
||||
return ImmutableSet.of();
|
||||
}
|
||||
|
||||
ImmutableSet.Builder<IErrorState> errorStates = ImmutableSet.builder();
|
||||
|
||||
ItemStack specimen = getStackInSlot(SLOT_SPECIMEN);
|
||||
if (!BeeManager.beeRoot.isMember(specimen)) {
|
||||
errorStates.add(EnumErrorCode.NO_SPECIMEN);
|
||||
}
|
||||
|
||||
if (!isEnergy(getStackInSlot(SLOT_ENERGY))) {
|
||||
errorStates.add(EnumErrorCode.NO_HONEY);
|
||||
}
|
||||
|
||||
return errorStates.build();
|
||||
}
|
||||
|
||||
/* IFilterSlotDelegate */
|
||||
@Override
|
||||
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
|
||||
if (slotIndex == SLOT_ENERGY) {
|
||||
return isEnergy(itemStack);
|
||||
} else if (slotIndex == SLOT_SPECIMEN) {
|
||||
return BeeManager.beeRoot.isMember(itemStack);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.inventory;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.apiculture.genetics.Bee;
|
||||
import forestry.core.inventory.ItemInventory;
|
||||
|
||||
public class ItemInventoryImprinter extends ItemInventory {
|
||||
private static final short specimenSlot = 0;
|
||||
private static final short imprintedSlot = 1;
|
||||
|
||||
private int primaryIndex = 0;
|
||||
private int secondaryIndex = 0;
|
||||
|
||||
public ItemInventoryImprinter(EntityPlayer player, ItemStack itemStack) {
|
||||
super(player, 2, itemStack);
|
||||
}
|
||||
|
||||
public void advancePrimary() {
|
||||
if (primaryIndex < BeeManager.beeRoot.getIndividualTemplates().size() - 1) {
|
||||
primaryIndex++;
|
||||
} else {
|
||||
primaryIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void advanceSecondary() {
|
||||
if (secondaryIndex < BeeManager.beeRoot.getIndividualTemplates().size() - 1) {
|
||||
secondaryIndex++;
|
||||
} else {
|
||||
secondaryIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void regressPrimary() {
|
||||
if (primaryIndex > 0) {
|
||||
primaryIndex--;
|
||||
} else {
|
||||
primaryIndex = BeeManager.beeRoot.getIndividualTemplates().size() - 1;
|
||||
}
|
||||
}
|
||||
|
||||
public void regressSecondary() {
|
||||
if (secondaryIndex > 0) {
|
||||
secondaryIndex--;
|
||||
} else {
|
||||
secondaryIndex = BeeManager.beeRoot.getIndividualTemplates().size() - 1;
|
||||
}
|
||||
}
|
||||
|
||||
public IAlleleBeeSpecies getPrimary() {
|
||||
return BeeManager.beeRoot.getIndividualTemplates().get(primaryIndex).getGenome().getPrimary();
|
||||
}
|
||||
|
||||
public IAlleleBeeSpecies getSecondary() {
|
||||
return BeeManager.beeRoot.getIndividualTemplates().get(secondaryIndex).getGenome().getPrimary();
|
||||
}
|
||||
|
||||
public IBee getSelectedBee() {
|
||||
return new Bee(BeeManager.beeRoot.templateAsGenome(
|
||||
BeeManager.beeRoot.getGenomeTemplates().get(BeeManager.beeRoot.getIndividualTemplates().get(primaryIndex).getIdent()),
|
||||
BeeManager.beeRoot.getGenomeTemplates().get(BeeManager.beeRoot.getIndividualTemplates().get(secondaryIndex).getIdent())));
|
||||
}
|
||||
|
||||
public int getPrimaryIndex() {
|
||||
return primaryIndex;
|
||||
}
|
||||
|
||||
public int getSecondaryIndex() {
|
||||
return secondaryIndex;
|
||||
}
|
||||
|
||||
public void setPrimaryIndex(int index) {
|
||||
primaryIndex = index;
|
||||
}
|
||||
|
||||
public void setSecondaryIndex(int index) {
|
||||
secondaryIndex = index;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSlotClick(EntityPlayer player) {
|
||||
ItemStack specimen = getStackInSlot(specimenSlot);
|
||||
if (specimen == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Only imprint bees
|
||||
if (!BeeManager.beeRoot.isMember(specimen)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Needs space
|
||||
if (getStackInSlot(imprintedSlot) != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
IBee imprint = getSelectedBee();
|
||||
if (imprint == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
imprint.writeToNBT(nbttagcompound);
|
||||
specimen.setTagCompound(nbttagcompound);
|
||||
|
||||
setInventorySlotContents(imprintedSlot, specimen);
|
||||
setInventorySlotContents(specimenSlot, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return "Imprinter";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
|
||||
return BeeManager.beeRoot.isMember(itemStack);
|
||||
}
|
||||
|
||||
}
|
||||
Loaded 100 of 1016 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user